dolphincolumnview.cpp
dolphincolumnwidget.cpp
dolphindropcontroller.cpp
- dolphinfileitemdelegate.cpp
dolphinsortfilterproxymodel.cpp
draganddrophelper.cpp
dolphinmodel.cpp
dolphin_iconsmodesettings.kcfgc
dolphin_generalsettings.kcfgc)
-
-
kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS})
find_package(Nepomuk)
##########################################
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
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} )
\ No newline at end of file
#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),
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);
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);
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);
#ifndef COLUMNVIEWSETTINGSPAGE_H
#define COLUMNVIEWSETTINGSPAGE_H
-#include <kvbox.h>
+#include <viewsettingspagebase.h>
class DolphinMainWindow;
class DolphinFontRequester;
* @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();
/**
* 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;
#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),
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);
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);
// 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
#ifndef DETAILSVIEWSETTINGSPAGE_H
#define DETAILSVIEWSETTINGSPAGE_H
-#include <kvbox.h>
+#include <viewsettingspagebase.h>
-class DolphinMainWindow;
class DolphinFontRequester;
class QCheckBox;
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();
/**
* 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;
--- /dev/null
+<?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>
--- /dev/null
+File=dolphin_folderspanelsettings.kcfg
+ClassName=FoldersPanelSettings
+Singleton=true
+Mutators=true
<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>
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"));
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"
void setCustomFont(const QFont& font);
QFont customFont() const;
+signals:
+ /** Is emitted, if the font has been changed. */
+ void changed();
+
protected:
bool event(QEvent* event);
#include "dolphincategorydrawer.h"
#include "dolphincontroller.h"
-#include "dolphinfileitemdelegate.h"
#include "dolphinsettings.h"
#include "dolphin_iconsmodesettings.h"
#include "dolphin_generalsettings.h"
#include <kcategorizedsortfilterproxymodel.h>
#include <kdialog.h>
#include <kdirmodel.h>
+#include <kfileitemdelegate.h>
#include <QAbstractProxyModel>
#include <QApplication>
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);
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);
}
DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) :
KPageDialog(mainWindow),
- m_startupSettingsPage(0),
- m_generalSettingsPage(0),
- m_viewSettingsPage(0)
+ m_pages()
{
const QSize minSize = minimumSize();
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()
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();
}
#include <kpagedialog.h>
-class GeneralSettingsPage;
-class StartupSettingsPage;
-class ViewSettingsPage;
class DolphinMainWindow;
+class SettingsPageBase;
/**
* @brief Settings dialog for Dolphin.
/** @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
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);
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);
// 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
kdeConfig.sync();
settings->setBrowseThroughArchives(m_browseThroughArchives->isChecked());
+ settings->setRenameInline(m_renameInline->isChecked());
}
void GeneralSettingsPage::restoreDefaults()
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_browseThroughArchives->setChecked(settings->browseThroughArchives());
+ m_renameInline->setChecked(settings->renameInline());
}
#include "generalsettingspage.moc"
void loadSettings();
private:
- QCheckBox* m_showDeleteCommand;
QCheckBox* m_confirmMoveToTrash;
QCheckBox* m_confirmDelete;
+ QCheckBox* m_showDeleteCommand;
QCheckBox* m_browseThroughArchives;
+ QCheckBox* m_renameInline;
};
#endif
#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),
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);
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
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();
// 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);
}
#ifndef GENERALVIEWSETTINGSPAGE_H
#define GENERALVIEWSETTINGSPAGE_H
-#include <kvbox.h>
+#include <kurl.h>
+#include <viewsettingspagebase.h>
class DolphinMainWindow;
class QCheckBox;
* @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();
/**
* 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;
#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),
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);
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);
if (dialog.exec() == QDialog::Accepted) {
m_iconSize = dialog.iconSize();
m_previewSize = dialog.previewSize();
+ emit changed();
}
}
#define ICONSVIEWSETTINGSPAGE_H
#include <dolphiniconsview.h>
-#include <kvbox.h>
+#include <viewsettingspagebase.h>
-class DolphinMainWindow;
class DolphinFontRequester;
class QCheckBox;
class QComboBox;
*
* @see DolphinIconsViewSettings
*/
-class IconsViewSettingsPage : public KVBox
+class IconsViewSettingsPage : public ViewSettingsPageBase
{
Q_OBJECT
public:
- IconsViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
+ IconsViewSettingsPage(QWidget* parent);
virtual ~IconsViewSettingsPage();
/**
* 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();
TopToBottomInc = 32
};
- DolphinMainWindow* m_mainWindow;
int m_iconSize;
int m_previewSize;
--- /dev/null
+/***************************************************************************
+ * 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"
--- /dev/null
+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
\ No newline at end of file
* 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();
-
- void setMaximumSize(const QSize& size);
- QSize maximumSize() const;
+ DolphinConfigModule(QWidget* parent, const QVariantList& args);
+ virtual ~DolphinConfigModule();
- /** @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
* restored the settings to default values.
*/
virtual void restoreDefaults() = 0;
+
+signals:
+ /** Is emitted if a setting has been changed. */
+ void changed();
};
#endif
#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>
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()),
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
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()
KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl);
if (!url.isEmpty()) {
m_homeUrl->setText(url.prettyUrl());
+ emit changed();
}
}
#include <settingspagebase.h>
class DolphinMainWindow;
-class QLineEdit;
+class KLineEdit;
class QCheckBox;
/**
private:
DolphinMainWindow* m_mainWindow;
- QLineEdit* m_homeUrl;
+ KLineEdit* m_homeUrl;
QCheckBox* m_splitView;
QCheckBox* m_editableUrl;
#include "columnviewsettingspage.h"
#include "detailsviewsettingspage.h"
+#include "dolphinmainwindow.h"
+#include "dolphinviewcontainer.h"
#include "generalviewsettingspage.h"
#include "iconsviewsettingspage.h"
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);
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);
}
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"
#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.
virtual void restoreDefaults();
private:
- GeneralViewSettingsPage* m_generalPage;
- IconsViewSettingsPage* m_iconsPage;
- DetailsViewSettingsPage* m_detailsPage;
- ColumnViewSettingsPage* m_columnPage;
+ QList<ViewSettingsPageBase*> m_pages;
};
#endif
* 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"
--- /dev/null
+/***************************************************************************
+ * 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