mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
provide a config module for the settings GUI of the Dolphin views, so that it can be embedded into Konqueror
CCMAIL: faure@kde.org svn path=/trunk/KDE/kdebase/apps/; revision=789209
This commit is contained in:
parent
cfb135f24e
commit
6420d5f973
|
@ -19,7 +19,6 @@ set(dolphinprivate_LIB_SRCS
|
|||
dolphincolumnview.cpp
|
||||
dolphincolumnwidget.cpp
|
||||
dolphindropcontroller.cpp
|
||||
dolphinfileitemdelegate.cpp
|
||||
dolphinsortfilterproxymodel.cpp
|
||||
draganddrophelper.cpp
|
||||
dolphinmodel.cpp
|
||||
|
@ -41,8 +40,6 @@ kde4_add_kcfg_files(dolphinprivate_LIB_SRCS
|
|||
dolphin_iconsmodesettings.kcfgc
|
||||
dolphin_generalsettings.kcfgc)
|
||||
|
||||
|
||||
|
||||
kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS})
|
||||
|
||||
find_package(Nepomuk)
|
||||
|
@ -80,44 +77,48 @@ install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
|||
##########################################
|
||||
|
||||
set(dolphin_SRCS
|
||||
additionalinfodialog.cpp
|
||||
applyviewpropsjob.cpp
|
||||
columnviewsettingspage.cpp
|
||||
detailsviewsettingspage.cpp
|
||||
dolphinapplication.cpp
|
||||
dolphinfontrequester.cpp
|
||||
dolphinmainwindow.cpp
|
||||
dolphinnewmenu.cpp
|
||||
dolphinviewcontainer.cpp
|
||||
dolphinstatusbar.cpp
|
||||
dolphindirlister.cpp
|
||||
dolphincontextmenu.cpp
|
||||
dolphinfileplacesview.cpp
|
||||
dolphinsettingsdialog.cpp
|
||||
draganddrophelper.cpp
|
||||
filterbar.cpp
|
||||
generalsettingspage.cpp
|
||||
generalviewsettingspage.cpp
|
||||
iconsizedialog.cpp
|
||||
iconsviewsettingspage.cpp
|
||||
infosidebarpage.cpp
|
||||
main.cpp
|
||||
metadatawidget.cpp
|
||||
commentwidget.cpp
|
||||
commenteditwidget.cpp
|
||||
metatextlabel.cpp
|
||||
pixmapviewer.cpp
|
||||
settingspagebase.cpp
|
||||
sidebarpage.cpp
|
||||
startupsettingspage.cpp
|
||||
statusbarspaceinfo.cpp
|
||||
statusbarmessagelabel.cpp
|
||||
treeviewcontextmenu.cpp
|
||||
treeviewsidebarpage.cpp
|
||||
sidebartreeview.cpp
|
||||
viewpropertiesdialog.cpp
|
||||
viewsettingspage.cpp
|
||||
viewpropsprogressinfo.cpp )
|
||||
additionalinfodialog.cpp
|
||||
applyviewpropsjob.cpp
|
||||
columnviewsettingspage.cpp
|
||||
commentwidget.cpp
|
||||
commenteditwidget.cpp
|
||||
detailsviewsettingspage.cpp
|
||||
dolphinapplication.cpp
|
||||
dolphinfontrequester.cpp
|
||||
dolphinmainwindow.cpp
|
||||
dolphinnewmenu.cpp
|
||||
dolphinviewcontainer.cpp
|
||||
dolphinstatusbar.cpp
|
||||
dolphindirlister.cpp
|
||||
dolphincontextmenu.cpp
|
||||
dolphinfileplacesview.cpp
|
||||
dolphinsettingsdialog.cpp
|
||||
draganddrophelper.cpp
|
||||
filterbar.cpp
|
||||
generalsettingspage.cpp
|
||||
generalviewsettingspage.cpp
|
||||
iconsizedialog.cpp
|
||||
iconsviewsettingspage.cpp
|
||||
infosidebarpage.cpp
|
||||
main.cpp
|
||||
metadatawidget.cpp
|
||||
metatextlabel.cpp
|
||||
pixmapviewer.cpp
|
||||
settingspagebase.cpp
|
||||
sidebarpage.cpp
|
||||
startupsettingspage.cpp
|
||||
statusbarspaceinfo.cpp
|
||||
statusbarmessagelabel.cpp
|
||||
treeviewcontextmenu.cpp
|
||||
treeviewsidebarpage.cpp
|
||||
sidebartreeview.cpp
|
||||
viewpropertiesdialog.cpp
|
||||
viewsettingspage.cpp
|
||||
viewsettingspagebase.cpp
|
||||
viewpropsprogressinfo.cpp)
|
||||
|
||||
kde4_add_kcfg_files(dolphin_SRCS
|
||||
dolphin_folderspanelsettings.kcfgc)
|
||||
|
||||
if(Nepomuk_FOUND)
|
||||
set(dolphin_SRCS
|
||||
|
@ -152,9 +153,40 @@ endif (Nepomuk_FOUND)
|
|||
|
||||
install(TARGETS dolphin DESTINATION ${BIN_INSTALL_DIR})
|
||||
|
||||
##########################################
|
||||
|
||||
set(kcm_dolphin_PART_SRCS
|
||||
kcmdolphin.cpp
|
||||
columnviewsettingspage.cpp
|
||||
detailsviewsettingspage.cpp
|
||||
dolphinfontrequester.cpp
|
||||
dolphinsettings.cpp
|
||||
generalviewsettingspage.cpp
|
||||
iconsizedialog.cpp
|
||||
iconsviewsettingspage.cpp
|
||||
pixmapviewer.cpp
|
||||
viewsettingspagebase.cpp
|
||||
viewproperties.cpp)
|
||||
|
||||
kde4_add_kcfg_files(kcm_dolphin_PART_SRCS
|
||||
dolphin_columnmodesettings.kcfgc
|
||||
dolphin_directoryviewpropertysettings.kcfgc
|
||||
dolphin_detailsmodesettings.kcfgc
|
||||
dolphin_iconsmodesettings.kcfgc
|
||||
dolphin_generalsettings.kcfgc)
|
||||
|
||||
kde4_add_plugin(kcm_dolphin ${kcm_dolphin_PART_SRCS})
|
||||
|
||||
target_link_libraries(kcm_dolphin ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} )
|
||||
if (Nepomuk_FOUND)
|
||||
target_link_libraries(kcm_dolphin ${NEPOMUK_LIBRARIES})
|
||||
endif (Nepomuk_FOUND)
|
||||
|
||||
install(TARGETS kcm_dolphin DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install( FILES dolphin.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
|
||||
install( FILES dolphin_directoryviewpropertysettings.kcfg dolphin_generalsettings.kcfg dolphin_columnmodesettings.kcfg dolphin_iconsmodesettings.kcfg dolphin_detailsmodesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
|
||||
install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin )
|
||||
install( FILES kcmdolphin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
|
@ -35,10 +35,8 @@
|
|||
#include <QSlider>
|
||||
#include <QRadioButton>
|
||||
|
||||
ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow,
|
||||
QWidget* parent) :
|
||||
KVBox(parent),
|
||||
m_mainWindow(mainWindow),
|
||||
ColumnViewSettingsPage::ColumnViewSettingsPage(QWidget* parent) :
|
||||
ViewSettingsPageBase(parent),
|
||||
m_smallIconSize(0),
|
||||
m_mediumIconSize(0),
|
||||
m_largeIconSize(0),
|
||||
|
@ -63,6 +61,7 @@ ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
m_columnWidthSlider->setPageStep(1);
|
||||
m_columnWidthSlider->setTickPosition(QSlider::TicksBelow);
|
||||
QLabel* largeLabel = new QLabel(i18nc("@item:inrange Column Width", "Large"), columnWidthBox);
|
||||
connect(m_columnWidthSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
|
||||
|
||||
QHBoxLayout* columnWidthLayout = new QHBoxLayout(columnWidthBox);
|
||||
columnWidthLayout->addWidget(smallLabel);
|
||||
|
@ -76,6 +75,9 @@ ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
m_smallIconSize = new QRadioButton(i18nc("@option:radio Icon Size", "Small"), this);
|
||||
m_mediumIconSize = new QRadioButton(i18nc("@option:radio Icon Size", "Medium"), this);
|
||||
m_largeIconSize = new QRadioButton(i18nc("@option:radio Icon Size", "Large"), this);
|
||||
connect(m_smallIconSize, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_mediumIconSize, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_largeIconSize, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
QButtonGroup* iconSizeGroup = new QButtonGroup(this);
|
||||
iconSizeGroup->addButton(m_smallIconSize);
|
||||
|
@ -93,6 +95,7 @@ ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
|
||||
QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textBox);
|
||||
m_fontRequester = new DolphinFontRequester(textBox);
|
||||
connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
QHBoxLayout* textLayout = new QHBoxLayout(textBox);
|
||||
textLayout->addWidget(fontLabel);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef COLUMNVIEWSETTINGSPAGE_H
|
||||
#define COLUMNVIEWSETTINGSPAGE_H
|
||||
|
||||
#include <kvbox.h>
|
||||
#include <viewsettingspagebase.h>
|
||||
|
||||
class DolphinMainWindow;
|
||||
class DolphinFontRequester;
|
||||
|
@ -31,12 +31,12 @@ class QRadioButton;
|
|||
* @brief Represents the page from the Dolphin Settings which allows
|
||||
* to modify the settings for the details view.
|
||||
*/
|
||||
class ColumnViewSettingsPage : public KVBox
|
||||
class ColumnViewSettingsPage : public ViewSettingsPageBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ColumnViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
|
||||
ColumnViewSettingsPage(QWidget* parent);
|
||||
virtual ~ColumnViewSettingsPage();
|
||||
|
||||
/**
|
||||
|
@ -44,16 +44,15 @@ public:
|
|||
* The settings are persisted automatically when
|
||||
* closing Dolphin.
|
||||
*/
|
||||
void applySettings();
|
||||
virtual void applySettings();
|
||||
|
||||
/** Restores the settings to default values. */
|
||||
void restoreDefaults();
|
||||
virtual void restoreDefaults();
|
||||
|
||||
private:
|
||||
void loadSettings();
|
||||
|
||||
private:
|
||||
DolphinMainWindow* m_mainWindow;
|
||||
QRadioButton* m_smallIconSize;
|
||||
QRadioButton* m_mediumIconSize;
|
||||
QRadioButton* m_largeIconSize;
|
||||
|
|
|
@ -35,10 +35,8 @@
|
|||
#include <QRadioButton>
|
||||
#include <QtGui/QSpinBox>
|
||||
|
||||
DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
||||
QWidget* parent) :
|
||||
KVBox(parent),
|
||||
m_mainWindow(mainWindow),
|
||||
DetailsViewSettingsPage::DetailsViewSettingsPage(QWidget* parent) :
|
||||
ViewSettingsPageBase(parent),
|
||||
m_smallIconSize(0),
|
||||
m_mediumIconSize(0),
|
||||
m_largeIconSize(0),
|
||||
|
@ -59,6 +57,9 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
m_smallIconSize = new QRadioButton(i18nc("@option:radio Icon Size", "Small"), this);
|
||||
m_mediumIconSize = new QRadioButton(i18nc("@option:radio Icon Size", "Medium"), this);
|
||||
m_largeIconSize = new QRadioButton(i18nc("@option:radio Icon Size", "Large"), this);
|
||||
connect(m_smallIconSize, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_mediumIconSize, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_largeIconSize, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
QButtonGroup* iconSizeGroup = new QButtonGroup(this);
|
||||
iconSizeGroup->addButton(m_smallIconSize);
|
||||
|
@ -76,6 +77,7 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
|
||||
QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textBox);
|
||||
m_fontRequester = new DolphinFontRequester(textBox);
|
||||
connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
QHBoxLayout* textLayout = new QHBoxLayout(textBox);
|
||||
textLayout->addWidget(fontLabel);
|
||||
|
@ -83,6 +85,7 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
|
||||
// create "Expandable Folders" checkbox
|
||||
m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable Folders"), this);
|
||||
connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
// Add a dummy widget with no restriction regarding
|
||||
// a vertical resizing. This assures that the dialog layout
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
#ifndef DETAILSVIEWSETTINGSPAGE_H
|
||||
#define DETAILSVIEWSETTINGSPAGE_H
|
||||
|
||||
#include <kvbox.h>
|
||||
#include <viewsettingspagebase.h>
|
||||
|
||||
class DolphinMainWindow;
|
||||
class DolphinFontRequester;
|
||||
class QCheckBox;
|
||||
class QRadioButton;
|
||||
|
@ -31,12 +30,12 @@ class QRadioButton;
|
|||
* @brief Represents the page from the Dolphin Settings which allows
|
||||
* to modify the settings for the details view.
|
||||
*/
|
||||
class DetailsViewSettingsPage : public KVBox
|
||||
class DetailsViewSettingsPage : public ViewSettingsPageBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DetailsViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
|
||||
DetailsViewSettingsPage(QWidget* parent);
|
||||
virtual ~DetailsViewSettingsPage();
|
||||
|
||||
/**
|
||||
|
@ -44,16 +43,15 @@ public:
|
|||
* The settings are persisted automatically when
|
||||
* closing Dolphin.
|
||||
*/
|
||||
void applySettings();
|
||||
virtual void applySettings();
|
||||
|
||||
/** Restores the settings to default values. */
|
||||
void restoreDefaults();
|
||||
virtual void restoreDefaults();
|
||||
|
||||
private:
|
||||
void loadSettings();
|
||||
|
||||
private:
|
||||
DolphinMainWindow* m_mainWindow;
|
||||
QRadioButton* m_smallIconSize;
|
||||
QRadioButton* m_mediumIconSize;
|
||||
QRadioButton* m_largeIconSize;
|
||||
|
|
11
src/dolphin_folderspanelsettings.kcfg
Normal file
11
src/dolphin_folderspanelsettings.kcfg
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
|
||||
<kcfg>
|
||||
<kcfgfile name="dolphinrc"/>
|
||||
<group name="FoldersPanel">
|
||||
<entry name="ShowHiddenFiles" type="Bool">
|
||||
<label context="@label">Show hidden files</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
4
src/dolphin_folderspanelsettings.kcfgc
Normal file
4
src/dolphin_folderspanelsettings.kcfgc
Normal file
|
@ -0,0 +1,4 @@
|
|||
File=dolphin_folderspanelsettings.kcfg
|
||||
ClassName=FoldersPanelSettings
|
||||
Singleton=true
|
||||
Mutators=true
|
|
@ -32,6 +32,10 @@
|
|||
<label context="@label">Browse through archives</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="RenameInline" type="Bool">
|
||||
<label context="@label">Rename inline</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="ShowSelectionToggle" type="Bool">
|
||||
<label context="@label">Show selection toggle</label>
|
||||
<default>true</default>
|
||||
|
|
|
@ -34,6 +34,8 @@ DolphinFontRequester::DolphinFontRequester(QWidget* parent) :
|
|||
m_mode(SystemFont),
|
||||
m_customFont()
|
||||
{
|
||||
setSpacing(KDialog::spacingHint());
|
||||
|
||||
m_modeCombo = new QComboBox(this);
|
||||
m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font"));
|
||||
m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font"));
|
||||
|
@ -96,12 +98,14 @@ void DolphinFontRequester::openFontDialog()
|
|||
if (result == KFontDialog::Accepted) {
|
||||
m_customFont = font;
|
||||
m_modeCombo->setFont(m_customFont);
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinFontRequester::changeMode(int index)
|
||||
{
|
||||
setMode((index == CustomFont) ? CustomFont : SystemFont);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
#include "dolphinfontrequester.moc"
|
||||
|
|
|
@ -57,6 +57,10 @@ public:
|
|||
void setCustomFont(const QFont& font);
|
||||
QFont customFont() const;
|
||||
|
||||
signals:
|
||||
/** Is emitted, if the font has been changed. */
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event);
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "dolphincategorydrawer.h"
|
||||
#include "dolphincontroller.h"
|
||||
#include "dolphinfileitemdelegate.h"
|
||||
#include "dolphinsettings.h"
|
||||
#include "dolphin_iconsmodesettings.h"
|
||||
#include "dolphin_generalsettings.h"
|
||||
|
@ -31,6 +30,7 @@
|
|||
#include <kcategorizedsortfilterproxymodel.h>
|
||||
#include <kdialog.h>
|
||||
#include <kdirmodel.h>
|
||||
#include <kfileitemdelegate.h>
|
||||
|
||||
#include <QAbstractProxyModel>
|
||||
#include <QApplication>
|
||||
|
@ -257,8 +257,7 @@ void DolphinIconsView::wheelEvent(QWheelEvent* event)
|
|||
|
||||
void DolphinIconsView::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_ASSERT(qobject_cast<DolphinFileItemDelegate*>(itemDelegate()) != 0);
|
||||
DolphinFileItemDelegate* delegate = static_cast<DolphinFileItemDelegate*>(itemDelegate());
|
||||
KFileItemDelegate* delegate = dynamic_cast<KFileItemDelegate*>(itemDelegate());
|
||||
delegate->setMaximumSize(m_itemSize);
|
||||
|
||||
KCategorizedView::showEvent(event);
|
||||
|
@ -428,7 +427,7 @@ void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount)
|
|||
m_controller->setZoomInPossible(isZoomInPossible());
|
||||
m_controller->setZoomOutPossible(isZoomOutPossible());
|
||||
|
||||
DolphinFileItemDelegate* delegate = qobject_cast<DolphinFileItemDelegate*>(itemDelegate());
|
||||
KFileItemDelegate* delegate = dynamic_cast<KFileItemDelegate*>(itemDelegate());
|
||||
if (delegate != 0) {
|
||||
delegate->setMaximumSize(m_itemSize);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) :
|
||||
KPageDialog(mainWindow),
|
||||
m_startupSettingsPage(0),
|
||||
m_generalSettingsPage(0),
|
||||
m_viewSettingsPage(0)
|
||||
m_pages()
|
||||
|
||||
{
|
||||
const QSize minSize = minimumSize();
|
||||
|
@ -43,25 +41,33 @@ DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) :
|
|||
setFaceType(List);
|
||||
setCaption(i18nc("@title:window", "Dolphin Preferences"));
|
||||
setButtons(Ok | Apply | Cancel | Default);
|
||||
enableButtonApply(false);
|
||||
setDefaultButton(Ok);
|
||||
|
||||
m_startupSettingsPage = new StartupSettingsPage(mainWindow, this);
|
||||
KPageWidgetItem* startupSettingsFrame = addPage(m_startupSettingsPage,
|
||||
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(mainWindow, this);
|
||||
KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage,
|
||||
i18nc("@title:group", "Startup"));
|
||||
startupSettingsFrame->setIcon(KIcon("go-home"));
|
||||
connect(startupSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
|
||||
|
||||
m_viewSettingsPage = new ViewSettingsPage(mainWindow, this);
|
||||
KPageWidgetItem* viewSettingsFrame = addPage(m_viewSettingsPage,
|
||||
ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(mainWindow, this);
|
||||
KPageWidgetItem* viewSettingsFrame = addPage(viewSettingsPage,
|
||||
i18nc("@title:group", "View Modes"));
|
||||
viewSettingsFrame->setIcon(KIcon("view-choose"));
|
||||
connect(viewSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
|
||||
|
||||
m_generalSettingsPage = new GeneralSettingsPage(mainWindow, this);
|
||||
KPageWidgetItem* generalSettingsFrame = addPage(m_generalSettingsPage,
|
||||
GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(mainWindow, this);
|
||||
KPageWidgetItem* generalSettingsFrame = addPage(generalSettingsPage,
|
||||
i18nc("@title:group General settings", "General"));
|
||||
generalSettingsFrame->setIcon(KIcon("system-run"));
|
||||
connect(generalSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
|
||||
|
||||
const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog");
|
||||
restoreDialogSize(dialogConfig);
|
||||
|
||||
m_pages.append(startupSettingsPage);
|
||||
m_pages.append(viewSettingsPage);
|
||||
m_pages.append(generalSettingsPage);
|
||||
}
|
||||
|
||||
DolphinSettingsDialog::~DolphinSettingsDialog()
|
||||
|
@ -84,19 +90,24 @@ void DolphinSettingsDialog::slotButtonClicked(int button)
|
|||
KPageDialog::slotButtonClicked(button);
|
||||
}
|
||||
|
||||
void DolphinSettingsDialog::enableApply()
|
||||
{
|
||||
enableButtonApply(true);
|
||||
}
|
||||
|
||||
void DolphinSettingsDialog::applySettings()
|
||||
{
|
||||
m_startupSettingsPage->applySettings();
|
||||
m_generalSettingsPage->applySettings();
|
||||
m_viewSettingsPage->applySettings();
|
||||
foreach (SettingsPageBase* page, m_pages) {
|
||||
page->applySettings();
|
||||
}
|
||||
DolphinApplication::app()->refreshMainWindows();
|
||||
}
|
||||
|
||||
void DolphinSettingsDialog::restoreDefaults()
|
||||
{
|
||||
m_startupSettingsPage->restoreDefaults();
|
||||
m_generalSettingsPage->restoreDefaults();
|
||||
m_viewSettingsPage->restoreDefaults();
|
||||
foreach (SettingsPageBase* page, m_pages) {
|
||||
page->restoreDefaults();
|
||||
}
|
||||
DolphinApplication::app()->refreshMainWindows();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
|
||||
#include <kpagedialog.h>
|
||||
|
||||
class GeneralSettingsPage;
|
||||
class StartupSettingsPage;
|
||||
class ViewSettingsPage;
|
||||
class DolphinMainWindow;
|
||||
class SettingsPageBase;
|
||||
|
||||
/**
|
||||
* @brief Settings dialog for Dolphin.
|
||||
|
@ -47,14 +45,16 @@ protected slots:
|
|||
/** @see KDialog::slotButtonClicked() */
|
||||
virtual void slotButtonClicked(int button);
|
||||
|
||||
private slots:
|
||||
/** Enables the Apply button. */
|
||||
void enableApply();
|
||||
|
||||
private:
|
||||
void applySettings();
|
||||
void restoreDefaults();
|
||||
|
||||
private:
|
||||
StartupSettingsPage* m_startupSettingsPage;
|
||||
GeneralSettingsPage* m_generalSettingsPage;
|
||||
ViewSettingsPage* m_viewSettingsPage;
|
||||
QList<SettingsPageBase*> m_pages;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,10 +35,11 @@
|
|||
|
||||
GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) :
|
||||
SettingsPageBase(parent),
|
||||
m_showDeleteCommand(0),
|
||||
m_confirmMoveToTrash(0),
|
||||
m_confirmDelete(0),
|
||||
m_browseThroughArchives(0)
|
||||
m_showDeleteCommand(0),
|
||||
m_browseThroughArchives(0),
|
||||
m_renameInline(0)
|
||||
{
|
||||
Q_UNUSED(mainWin);
|
||||
|
||||
|
@ -52,8 +53,10 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
|
|||
QGroupBox* confirmBox = new QGroupBox(i18nc("@title:group", "Ask For Confirmation When"), vBox);
|
||||
m_confirmMoveToTrash = new QCheckBox(i18nc("@option:check Ask for Confirmation When",
|
||||
"Moving files or folders to trash"), confirmBox);
|
||||
connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for Confirmation When",
|
||||
"Deleting files or folders"), confirmBox);
|
||||
connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox);
|
||||
confirmBoxLayout->addWidget(m_confirmMoveToTrash);
|
||||
|
@ -61,8 +64,13 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
|
|||
|
||||
// create 'Show the command 'Delete' in context menu' checkbox
|
||||
m_showDeleteCommand = new QCheckBox(i18nc("@option:check", "Show 'Delete' command in context menu"), vBox);
|
||||
connect(m_showDeleteCommand, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
m_browseThroughArchives = new QCheckBox(i18nc("@option:check", "Browse through archives"), vBox);
|
||||
connect(m_browseThroughArchives, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
m_renameInline = new QCheckBox(i18nc("@option:check", "Rename inline"), vBox);
|
||||
connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
// Add a dummy widget with no restriction regarding
|
||||
// a vertical resizing. This assures that the dialog layout
|
||||
|
@ -93,6 +101,7 @@ void GeneralSettingsPage::applySettings()
|
|||
kdeConfig.sync();
|
||||
|
||||
settings->setBrowseThroughArchives(m_browseThroughArchives->isChecked());
|
||||
settings->setRenameInline(m_renameInline->isChecked());
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::restoreDefaults()
|
||||
|
@ -117,6 +126,7 @@ void GeneralSettingsPage::loadSettings()
|
|||
|
||||
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
|
||||
m_browseThroughArchives->setChecked(settings->browseThroughArchives());
|
||||
m_renameInline->setChecked(settings->renameInline());
|
||||
}
|
||||
|
||||
#include "generalsettingspage.moc"
|
||||
|
|
|
@ -47,11 +47,12 @@ private:
|
|||
void loadSettings();
|
||||
|
||||
private:
|
||||
QCheckBox* m_showDeleteCommand;
|
||||
QCheckBox* m_confirmMoveToTrash;
|
||||
QCheckBox* m_confirmDelete;
|
||||
|
||||
QCheckBox* m_showDeleteCommand;
|
||||
QCheckBox* m_browseThroughArchives;
|
||||
QCheckBox* m_renameInline;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
#include <klocale.h>
|
||||
#include <khbox.h>
|
||||
|
||||
GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
|
||||
GeneralViewSettingsPage::GeneralViewSettingsPage(const KUrl& url,
|
||||
QWidget* parent) :
|
||||
KVBox(parent),
|
||||
m_mainWindow(mainWindow),
|
||||
ViewSettingsPageBase(parent),
|
||||
m_url(url),
|
||||
m_localProps(0),
|
||||
m_globalProps(0),
|
||||
m_maxPreviewSize(0),
|
||||
|
@ -60,7 +60,10 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
QGroupBox* propsBox = new QGroupBox(i18nc("@title:group", "View Properties"), this);
|
||||
|
||||
m_localProps = new QRadioButton(i18nc("@option:radio", "Remember view properties for each folder"), propsBox);
|
||||
connect(m_localProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
m_globalProps = new QRadioButton(i18nc("@option:radio", "Use common view properties for all folders"), propsBox);
|
||||
connect(m_globalProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
QVBoxLayout* propsBoxLayout = new QVBoxLayout(propsBox);
|
||||
propsBoxLayout->addWidget(m_localProps);
|
||||
|
@ -82,13 +85,20 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
connect(m_spinBox, SIGNAL(valueChanged(int)),
|
||||
m_maxPreviewSize, SLOT(setValue(int)));
|
||||
|
||||
connect(m_maxPreviewSize, SIGNAL(valueChanged(int)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(m_spinBox, SIGNAL(valueChanged(int)),
|
||||
this, SIGNAL(changed()));
|
||||
|
||||
m_useFileThumbnails = new QCheckBox(i18nc("@option:check", "Use thumbnails embedded in files"), previewBox);
|
||||
connect(m_useFileThumbnails, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
QVBoxLayout* previewBoxLayout = new QVBoxLayout(previewBox);
|
||||
previewBoxLayout->addWidget(vBox);
|
||||
previewBoxLayout->addWidget(m_useFileThumbnails);
|
||||
|
||||
m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection toggle"), this);
|
||||
connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
// Add a dummy widget with no restriction regarding
|
||||
// a vertical resizing. This assures that the dialog layout
|
||||
|
@ -105,8 +115,7 @@ GeneralViewSettingsPage::~GeneralViewSettingsPage()
|
|||
|
||||
void GeneralViewSettingsPage::applySettings()
|
||||
{
|
||||
const KUrl& url = m_mainWindow->activeViewContainer()->url();
|
||||
ViewProperties props(url); // read current view properties
|
||||
ViewProperties props(m_url); // read current view properties
|
||||
|
||||
const bool useGlobalProps = m_globalProps->isChecked();
|
||||
|
||||
|
@ -118,7 +127,7 @@ void GeneralViewSettingsPage::applySettings()
|
|||
// It is important that GeneralSettings::globalViewProps() is set before
|
||||
// the class ViewProperties is used, as ViewProperties uses this setting
|
||||
// to find the destination folder for storing the view properties.
|
||||
ViewProperties globalProps(url);
|
||||
ViewProperties globalProps(m_url);
|
||||
globalProps.setDirProperties(props);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
#ifndef GENERALVIEWSETTINGSPAGE_H
|
||||
#define GENERALVIEWSETTINGSPAGE_H
|
||||
|
||||
#include <kvbox.h>
|
||||
#include <kurl.h>
|
||||
#include <viewsettingspagebase.h>
|
||||
|
||||
class DolphinMainWindow;
|
||||
class QCheckBox;
|
||||
|
@ -32,12 +33,17 @@ class QSpinBox;
|
|||
* @brief Represents the page from the Dolphin Settings which allows
|
||||
* to modify general settings for the view modes.
|
||||
*/
|
||||
class GeneralViewSettingsPage : public KVBox
|
||||
class GeneralViewSettingsPage : public ViewSettingsPageBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GeneralViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
|
||||
/**
|
||||
* @param url URL of the currently shown directory, which is used
|
||||
* to read the viewproperties.
|
||||
* @param parent Parent widget of the settings page.
|
||||
*/
|
||||
GeneralViewSettingsPage(const KUrl& url, QWidget* parent);
|
||||
virtual ~GeneralViewSettingsPage();
|
||||
|
||||
/**
|
||||
|
@ -45,16 +51,16 @@ public:
|
|||
* The settings are persisted automatically when
|
||||
* closing Dolphin.
|
||||
*/
|
||||
void applySettings();
|
||||
virtual void applySettings();
|
||||
|
||||
/** Restores the settings to default values. */
|
||||
void restoreDefaults();
|
||||
virtual void restoreDefaults();
|
||||
|
||||
private:
|
||||
void loadSettings();
|
||||
|
||||
private:
|
||||
DolphinMainWindow* m_mainWindow;
|
||||
KUrl m_url;
|
||||
QRadioButton* m_localProps;
|
||||
QRadioButton* m_globalProps;
|
||||
QSlider* m_maxPreviewSize;
|
||||
|
|
|
@ -40,10 +40,8 @@
|
|||
#include <QGridLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow,
|
||||
QWidget* parent) :
|
||||
KVBox(parent),
|
||||
m_mainWindow(mainWindow),
|
||||
IconsViewSettingsPage::IconsViewSettingsPage(QWidget* parent) :
|
||||
ViewSettingsPageBase(parent),
|
||||
m_iconSize(0),
|
||||
m_previewSize(0),
|
||||
m_iconSizeButton(0),
|
||||
|
@ -71,17 +69,20 @@ IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
|
||||
QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup);
|
||||
m_fontRequester = new DolphinFontRequester(textGroup);
|
||||
connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
QLabel* textlinesCountLabel = new QLabel(i18nc("@label:textbox", "Number of lines:"), textGroup);
|
||||
m_textlinesCountBox = new QSpinBox(textGroup);
|
||||
m_textlinesCountBox->setMinimum(1);
|
||||
m_textlinesCountBox->setMaximum(5);
|
||||
connect(m_textlinesCountBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
|
||||
|
||||
QLabel* textWidthLabel = new QLabel(i18nc("@label:listbox", "Text width:"), textGroup);
|
||||
m_textWidthBox = new QComboBox(textGroup);
|
||||
m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Small"));
|
||||
m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Medium"));
|
||||
m_textWidthBox->addItem(i18nc("@item:inlistbox Text width", "Large"));
|
||||
connect(m_textWidthBox, SIGNAL(activated(int)), this, SIGNAL(changed()));
|
||||
|
||||
QGridLayout* textGroupLayout = new QGridLayout(textGroup);
|
||||
textGroupLayout->addWidget(fontLabel, 0, 0);
|
||||
|
@ -99,12 +100,14 @@ IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
m_arrangementBox = new QComboBox(gridGroup);
|
||||
m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Left to Right"));
|
||||
m_arrangementBox->addItem(i18nc("@item:inlistbox Arrangement", "Top to Bottom"));
|
||||
connect(m_arrangementBox, SIGNAL(activated(int)), this, SIGNAL(changed()));
|
||||
|
||||
QLabel* gridSpacingLabel = new QLabel(i18nc("@label:listbox", "Grid spacing:"), gridGroup);
|
||||
m_gridSpacingBox = new QComboBox(gridGroup);
|
||||
m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Small"));
|
||||
m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Medium"));
|
||||
m_gridSpacingBox->addItem(i18nc("@item:inlistbox Grid spacing", "Large"));
|
||||
connect(m_gridSpacingBox, SIGNAL(activated(int)), this, SIGNAL(changed()));
|
||||
|
||||
QGridLayout* gridGroupLayout = new QGridLayout(gridGroup);
|
||||
gridGroupLayout->addWidget(arrangementLabel, 0, 0);
|
||||
|
@ -180,6 +183,7 @@ void IconsViewSettingsPage::openIconSizeDialog()
|
|||
if (dialog.exec() == QDialog::Accepted) {
|
||||
m_iconSize = dialog.iconSize();
|
||||
m_previewSize = dialog.previewSize();
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
#define ICONSVIEWSETTINGSPAGE_H
|
||||
|
||||
#include <dolphiniconsview.h>
|
||||
#include <kvbox.h>
|
||||
#include <viewsettingspagebase.h>
|
||||
|
||||
class DolphinMainWindow;
|
||||
class DolphinFontRequester;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
|
@ -45,12 +44,12 @@ class QSpinBox;
|
|||
*
|
||||
* @see DolphinIconsViewSettings
|
||||
*/
|
||||
class IconsViewSettingsPage : public KVBox
|
||||
class IconsViewSettingsPage : public ViewSettingsPageBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IconsViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
|
||||
IconsViewSettingsPage(QWidget* parent);
|
||||
virtual ~IconsViewSettingsPage();
|
||||
|
||||
/**
|
||||
|
@ -58,10 +57,10 @@ public:
|
|||
* The settings are persisted automatically when
|
||||
* closing Dolphin.
|
||||
*/
|
||||
void applySettings();
|
||||
virtual void applySettings();
|
||||
|
||||
/** Restores the settings to default values. */
|
||||
void restoreDefaults();
|
||||
virtual void restoreDefaults();
|
||||
|
||||
private slots:
|
||||
void openIconSizeDialog();
|
||||
|
@ -80,7 +79,6 @@ private:
|
|||
TopToBottomInc = 32
|
||||
};
|
||||
|
||||
DolphinMainWindow* m_mainWindow;
|
||||
int m_iconSize;
|
||||
int m_previewSize;
|
||||
|
||||
|
|
99
src/kcmdolphin.cpp
Normal file
99
src/kcmdolphin.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Peter Penz <peter.penz@gmx.at> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include "kcmdolphin.h"
|
||||
|
||||
#include "columnviewsettingspage.h"
|
||||
#include "detailsviewsettingspage.h"
|
||||
#include "generalviewsettingspage.h"
|
||||
#include "iconsviewsettingspage.h"
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
K_PLUGIN_FACTORY(KCMDolphinConfigFactory, registerPlugin<DolphinConfigModule>("dolphin");)
|
||||
K_EXPORT_PLUGIN(KCMDolphinConfigFactory("kcmdolphin"))
|
||||
|
||||
DolphinConfigModule::DolphinConfigModule(QWidget* parent, const QVariantList& args) :
|
||||
KCModule(KCMDolphinConfigFactory::componentData(), parent),
|
||||
m_pages()
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
|
||||
setButtons(KCModule::Default | KCModule::Help);
|
||||
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
topLayout->setSpacing(KDialog::spacingHint());
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
// initialize 'General' tab
|
||||
GeneralViewSettingsPage* generalPage = new GeneralViewSettingsPage(QDir::homePath(), tabWidget);
|
||||
tabWidget->addTab(generalPage, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
|
||||
connect(generalPage, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
// initialize 'Icons' tab
|
||||
IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
|
||||
tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
|
||||
connect(iconsPage, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
// initialize 'Details' tab
|
||||
DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget);
|
||||
tabWidget->addTab(detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
|
||||
connect(detailsPage, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
// initialize 'Column' tab
|
||||
ColumnViewSettingsPage* columnPage = new ColumnViewSettingsPage(tabWidget);
|
||||
tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
|
||||
connect(columnPage, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
m_pages.append(generalPage);
|
||||
m_pages.append(iconsPage);
|
||||
m_pages.append(detailsPage);
|
||||
m_pages.append(columnPage);
|
||||
|
||||
topLayout->addWidget(tabWidget, 0, 0);
|
||||
}
|
||||
|
||||
DolphinConfigModule::~DolphinConfigModule()
|
||||
{
|
||||
}
|
||||
|
||||
void DolphinConfigModule::save()
|
||||
{
|
||||
foreach (ViewSettingsPageBase* page, m_pages) {
|
||||
page->applySettings();
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinConfigModule::defaults()
|
||||
{
|
||||
foreach (ViewSettingsPageBase* page, m_pages) {
|
||||
page->restoreDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
#include "kcmdolphin.moc"
|
16
src/kcmdolphin.desktop
Normal file
16
src/kcmdolphin.desktop
Normal file
|
@ -0,0 +1,16 @@
|
|||
Name=Dolphin
|
||||
Comment=This service allows to configure the Dolphin views.
|
||||
|
||||
[Desktop Entry]
|
||||
Icon=view-choose
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
Exec=kcmshell4 kcmdolphin
|
||||
|
||||
X-KDE-Library=kcm_dolphin
|
||||
X-KDE-PluginKeyword=dolphin
|
||||
X-KDE-ParentApp=kcontrol
|
||||
|
||||
Name=Views
|
||||
Comment=Configure file manager settings
|
||||
X-KDE-Keywords=file manager
|
|
@ -17,32 +17,29 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DOLPHINFILEITEMDELEGATE_H
|
||||
#define DOLPHINFILEITEMDELEGATE_H
|
||||
#ifndef DOLPHINCONFIGMODULE_H
|
||||
#define DOLPHINCONFIGMODULE_H
|
||||
|
||||
#include <kfileitemdelegate.h>
|
||||
#include <kcmodule.h>
|
||||
|
||||
class ViewSettingsPageBase;
|
||||
|
||||
/**
|
||||
* @brief Extends KFileItemDelegate with the ability to set
|
||||
* a maximum size.
|
||||
* @brief Allow to configure the Dolphin views.
|
||||
*/
|
||||
class DolphinFileItemDelegate : public KFileItemDelegate
|
||||
class DolphinConfigModule : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DolphinFileItemDelegate(QObject* parent = 0);
|
||||
virtual ~DolphinFileItemDelegate();
|
||||
DolphinConfigModule(QWidget* parent, const QVariantList& args);
|
||||
virtual ~DolphinConfigModule();
|
||||
|
||||
void setMaximumSize(const QSize& size);
|
||||
QSize maximumSize() const;
|
||||
|
||||
/** @see QItemDelegate::sizeHint() */
|
||||
virtual QSize sizeHint(const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const;
|
||||
virtual void save();
|
||||
virtual void defaults();
|
||||
|
||||
private:
|
||||
QSize m_maxSize;
|
||||
QList<ViewSettingsPageBase*> m_pages;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -47,6 +47,10 @@ public:
|
|||
* restored the settings to default values.
|
||||
*/
|
||||
virtual void restoreDefaults() = 0;
|
||||
|
||||
signals:
|
||||
/** Is emitted if a setting has been changed. */
|
||||
void changed();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
#include <kdialog.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <klocale.h>
|
||||
#include <klineedit.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kvbox.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
|
||||
|
@ -60,7 +60,8 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
|
|||
homeUrlBox->setSpacing(spacing);
|
||||
|
||||
new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
|
||||
m_homeUrl = new QLineEdit(homeUrlBox);
|
||||
m_homeUrl = new KLineEdit(homeUrlBox);
|
||||
m_homeUrl->setClearButtonShown(true);
|
||||
|
||||
QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox);
|
||||
connect(selectHomeUrlButton, SIGNAL(clicked()),
|
||||
|
@ -84,6 +85,9 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
|
|||
m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox);
|
||||
m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox);
|
||||
m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox);
|
||||
connect(m_splitView, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_editableUrl, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(m_filterBar, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
// Add a dummy widget with no restriction regarding
|
||||
// a vertical resizing. This assures that the dialog layout
|
||||
|
@ -93,6 +97,10 @@ StartupSettingsPage::StartupSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
|
|||
topLayout->addWidget(vBox);
|
||||
|
||||
loadSettings();
|
||||
|
||||
// it's important connecting 'textChanged' after loadSettings(), as loadSettings()
|
||||
// invokes m_homeUrl->setText()
|
||||
connect(m_homeUrl, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
|
||||
}
|
||||
|
||||
StartupSettingsPage::~StartupSettingsPage()
|
||||
|
@ -129,6 +137,7 @@ void StartupSettingsPage::selectHomeUrl()
|
|||
KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl);
|
||||
if (!url.isEmpty()) {
|
||||
m_homeUrl->setText(url.prettyUrl());
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <settingspagebase.h>
|
||||
|
||||
class DolphinMainWindow;
|
||||
class QLineEdit;
|
||||
class KLineEdit;
|
||||
class QCheckBox;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
|
||||
private:
|
||||
DolphinMainWindow* m_mainWindow;
|
||||
QLineEdit* m_homeUrl;
|
||||
KLineEdit* m_homeUrl;
|
||||
|
||||
QCheckBox* m_splitView;
|
||||
QCheckBox* m_editableUrl;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "columnviewsettingspage.h"
|
||||
#include "detailsviewsettingspage.h"
|
||||
#include "dolphinmainwindow.h"
|
||||
#include "dolphinviewcontainer.h"
|
||||
#include "generalviewsettingspage.h"
|
||||
#include "iconsviewsettingspage.h"
|
||||
|
||||
|
@ -37,10 +39,7 @@
|
|||
ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
|
||||
QWidget* parent) :
|
||||
SettingsPageBase(parent),
|
||||
m_generalPage(0),
|
||||
m_iconsPage(0),
|
||||
m_detailsPage(0),
|
||||
m_columnPage(0)
|
||||
m_pages()
|
||||
{
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
|
@ -49,20 +48,30 @@ ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
// initialize 'General' tab
|
||||
m_generalPage = new GeneralViewSettingsPage(mainWindow, tabWidget);
|
||||
tabWidget->addTab(m_generalPage, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
|
||||
const KUrl& url = mainWindow->activeViewContainer()->url();
|
||||
GeneralViewSettingsPage* generalPage = new GeneralViewSettingsPage(url, tabWidget);
|
||||
tabWidget->addTab(generalPage, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
|
||||
connect(generalPage, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
// initialize 'Icons' tab
|
||||
m_iconsPage = new IconsViewSettingsPage(mainWindow, tabWidget);
|
||||
tabWidget->addTab(m_iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
|
||||
IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
|
||||
tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
|
||||
connect(iconsPage, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
// initialize 'Details' tab
|
||||
m_detailsPage = new DetailsViewSettingsPage(mainWindow, tabWidget);
|
||||
tabWidget->addTab(m_detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
|
||||
DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget);
|
||||
tabWidget->addTab(detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
|
||||
connect(detailsPage, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
// initialize 'Column' tab
|
||||
m_columnPage = new ColumnViewSettingsPage(mainWindow, tabWidget);
|
||||
tabWidget->addTab(m_columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
|
||||
ColumnViewSettingsPage* columnPage = new ColumnViewSettingsPage(tabWidget);
|
||||
tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
|
||||
connect(columnPage, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
|
||||
m_pages.append(generalPage);
|
||||
m_pages.append(iconsPage);
|
||||
m_pages.append(detailsPage);
|
||||
m_pages.append(columnPage);
|
||||
|
||||
topLayout->addWidget(tabWidget, 0, 0);
|
||||
}
|
||||
|
@ -73,18 +82,16 @@ ViewSettingsPage::~ViewSettingsPage()
|
|||
|
||||
void ViewSettingsPage::applySettings()
|
||||
{
|
||||
m_generalPage->applySettings();
|
||||
m_iconsPage->applySettings();
|
||||
m_detailsPage->applySettings();
|
||||
m_columnPage->applySettings();
|
||||
foreach (ViewSettingsPageBase* page, m_pages) {
|
||||
page->applySettings();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewSettingsPage::restoreDefaults()
|
||||
{
|
||||
m_generalPage->restoreDefaults();
|
||||
m_iconsPage->restoreDefaults();
|
||||
m_detailsPage->restoreDefaults();
|
||||
m_columnPage->restoreDefaults();
|
||||
foreach (ViewSettingsPageBase* page, m_pages) {
|
||||
page->restoreDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
#include "viewsettingspage.moc"
|
||||
|
|
|
@ -23,11 +23,8 @@
|
|||
#include <QtGui/QWidget>
|
||||
#include <settingspagebase.h>
|
||||
|
||||
class ColumnViewSettingsPage;
|
||||
class ViewSettingsPageBase;
|
||||
class DolphinMainWindow;
|
||||
class GeneralViewSettingsPage;
|
||||
class IconsViewSettingsPage;
|
||||
class DetailsViewSettingsPage;
|
||||
|
||||
/**
|
||||
* @brief Page for the 'View' settings of the Dolphin settings dialog.
|
||||
|
@ -50,10 +47,7 @@ public:
|
|||
virtual void restoreDefaults();
|
||||
|
||||
private:
|
||||
GeneralViewSettingsPage* m_generalPage;
|
||||
IconsViewSettingsPage* m_iconsPage;
|
||||
DetailsViewSettingsPage* m_detailsPage;
|
||||
ColumnViewSettingsPage* m_columnPage;
|
||||
QList<ViewSettingsPageBase*> m_pages;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,45 +17,15 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include "dolphinfileitemdelegate.h"
|
||||
#include "viewsettingspagebase.h"
|
||||
|
||||
DolphinFileItemDelegate::DolphinFileItemDelegate(QObject* parent) :
|
||||
KFileItemDelegate(parent),
|
||||
m_maxSize(0, 0)
|
||||
ViewSettingsPageBase::ViewSettingsPageBase(QWidget* parent) :
|
||||
KVBox(parent)
|
||||
{
|
||||
}
|
||||
|
||||
DolphinFileItemDelegate::~DolphinFileItemDelegate()
|
||||
ViewSettingsPageBase::~ViewSettingsPageBase()
|
||||
{
|
||||
}
|
||||
|
||||
void DolphinFileItemDelegate::setMaximumSize(const QSize& size)
|
||||
{
|
||||
m_maxSize = size;
|
||||
}
|
||||
|
||||
|
||||
QSize DolphinFileItemDelegate::maximumSize() const
|
||||
{
|
||||
return m_maxSize;
|
||||
}
|
||||
|
||||
QSize DolphinFileItemDelegate::sizeHint(const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const
|
||||
{
|
||||
QSize size = KFileItemDelegate::sizeHint(option, index);
|
||||
|
||||
const int maxWidth = m_maxSize.width();
|
||||
if ((maxWidth > 0) && (size.width() > maxWidth)) {
|
||||
size.setWidth(maxWidth);
|
||||
}
|
||||
|
||||
const int maxHeight = m_maxSize.height();
|
||||
if ((maxHeight > 0) && (size.height() > maxHeight)) {
|
||||
size.setHeight(maxHeight);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
#include "dolphinfileitemdelegate.moc"
|
||||
#include "viewsettingspagebase.moc"
|
55
src/viewsettingspagebase.h
Normal file
55
src/viewsettingspagebase.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Peter Penz <peter.penz@gmx.at> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef VIEWSETTINGSPAGEBASE_H
|
||||
#define VIEWSETTINGSPAGEBASE_H
|
||||
|
||||
#include <kvbox.h>
|
||||
|
||||
/**
|
||||
* @brief Base class for view settings configuration pages.
|
||||
*
|
||||
* @see GeneralViewSettingsPage;
|
||||
* @see IconViewSettingsPage
|
||||
* @see DetailsViewSettingsPage
|
||||
* @see ColumnViewSettingsPage
|
||||
*/
|
||||
class ViewSettingsPageBase : public KVBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ViewSettingsPageBase(QWidget* parent);
|
||||
virtual ~ViewSettingsPageBase();
|
||||
|
||||
/**
|
||||
* Applies the settings for the view.
|
||||
* The settings are persisted automatically when
|
||||
* closing Dolphin.
|
||||
*/
|
||||
virtual void applySettings() = 0;
|
||||
|
||||
/** Restores the settings to default values. */
|
||||
virtual void restoreDefaults() = 0;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue