X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c66891ce79344ac60621b1b2fbde6bf098bd7620..862ceee323ad3b474ce9de11eefbddd99c528fac:/src/generalsettingspage.cpp diff --git a/src/generalsettingspage.cpp b/src/generalsettingspage.cpp index 87c8a24c3..ccb06cd09 100644 --- a/src/generalsettingspage.cpp +++ b/src/generalsettingspage.cpp @@ -20,24 +20,25 @@ #include "generalsettingspage.h" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - #include "dolphinsettings.h" #include "dolphinmainwindow.h" #include "dolphinview.h" +#include "dolphinviewcontainer.h" #include "dolphin_generalsettings.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) : SettingsPageBase(parent), m_mainWindow(mainWin), @@ -50,7 +51,6 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa m_confirmDelete(0) { const int spacing = KDialog::spacingHint(); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); QVBoxLayout* topLayout = new QVBoxLayout(this); KVBox* vBox = new KVBox(this); @@ -63,7 +63,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa homeUrlBox->setSpacing(spacing); new QLabel(i18n("Location:"), homeUrlBox); - m_homeUrl = new QLineEdit(settings->homeUrl(), homeUrlBox); + m_homeUrl = new QLineEdit(homeUrlBox); QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox); connect(selectHomeUrlButton, SIGNAL(clicked()), @@ -83,19 +83,12 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa homeBoxLayout->addWidget(homeUrlBox); homeBoxLayout->addWidget(buttonBox); - QGroupBox* startBox = new QGroupBox(i18n("Start"), vBox); - - // create 'Split view' checkbox - m_splitView = new QCheckBox(i18n("Split view"), startBox); - m_splitView->setChecked(settings->splitView()); - - // create 'Editable location' checkbox - m_editableUrl = new QCheckBox(i18n("Editable location"), startBox); - m_editableUrl->setChecked(settings->editableUrl()); + QGroupBox* startBox = new QGroupBox(i18n("Startup Settings"), vBox); - // create 'Filter bar' checkbox - m_filterBar = new QCheckBox(i18n("Filter bar"),startBox); - m_filterBar->setChecked(settings->filterBar()); + // create 'Split view', 'Editable location' and 'Filter bar' checkboxes + m_splitView = new QCheckBox(i18n("Split view mode"), startBox); + m_editableUrl = new QCheckBox(i18n("Editable location bar"), startBox); + m_filterBar = new QCheckBox(i18n("Show filter bar"),startBox); QVBoxLayout* startBoxLayout = new QVBoxLayout(startBox); startBoxLayout->addWidget(m_splitView); @@ -106,12 +99,12 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa KSharedConfig::Ptr konqConfig = KSharedConfig::openConfig("konquerorrc", KConfig::IncludeGlobals); const KConfigGroup trashConfig(konqConfig, "Trash"); - QGroupBox* confirmBox = new QGroupBox(i18n("Ask Confirmation For"), vBox); + QGroupBox* confirmBox = new QGroupBox(i18n("Ask For Confirmation When"), vBox); - m_confirmMoveToTrash = new QCheckBox(i18n("Move to trash"), confirmBox); + m_confirmMoveToTrash = new QCheckBox(i18n("Moving files or folders to trash"), confirmBox); m_confirmMoveToTrash->setChecked(trashConfig.readEntry("ConfirmTrash", false)); - m_confirmDelete = new QCheckBox(i18n("Delete"), confirmBox); + m_confirmDelete = new QCheckBox(i18n("Deleting files or folders"), confirmBox); m_confirmDelete->setChecked(trashConfig.readEntry("ConfirmDelete", true)); QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox); @@ -119,7 +112,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa confirmBoxLayout->addWidget(m_confirmDelete); // create 'Show the command 'Delete' in context menu' checkbox - m_showDeleteCommand = new QCheckBox(i18n("Show the command 'Delete' in context menu"), vBox); + m_showDeleteCommand = new QCheckBox(i18n("Show 'Delete' command in context menu"), vBox); const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals); const KConfigGroup kdeConfig(globalConfig, "KDE"); m_showDeleteCommand->setChecked(kdeConfig.readEntry("ShowDeleteCommand", false)); @@ -130,6 +123,8 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa new QWidget(vBox); topLayout->addWidget(vBox); + + loadSettings(); } GeneralSettingsPage::~GeneralSettingsPage() @@ -161,6 +156,20 @@ void GeneralSettingsPage::applySettings() kdeConfig.sync(); } +void GeneralSettingsPage::restoreDefaults() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + settings->setDefaults(); + + // TODO: reset default settings for trash and show delete command... + //KSharedConfig::Ptr konqConfig = KSharedConfig::openConfig("konquerorrc", KConfig::IncludeGlobals); + //KConfigGroup trashConfig(konqConfig, "Trash"); + //KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals); + //KConfigGroup kdeConfig(globalConfig, "KDE"); + + loadSettings(); +} + void GeneralSettingsPage::selectHomeUrl() { const QString homeUrl(m_homeUrl->text()); @@ -172,7 +181,7 @@ void GeneralSettingsPage::selectHomeUrl() void GeneralSettingsPage::useCurrentLocation() { - const DolphinView* view = m_mainWindow->activeView(); + const DolphinView* view = m_mainWindow->activeViewContainer()->view(); m_homeUrl->setText(view->url().prettyUrl()); } @@ -181,4 +190,13 @@ void GeneralSettingsPage::useDefaultLocation() m_homeUrl->setText("file://" + QDir::homePath()); } +void GeneralSettingsPage::loadSettings() +{ + GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + m_homeUrl->setText(settings->homeUrl()); + m_splitView->setChecked(settings->splitView()); + m_editableUrl->setChecked(settings->editableUrl()); + m_filterBar->setChecked(settings->filterBar()); +} + #include "generalsettingspage.moc"