]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/generalsettingspage.cpp
don't forget to delete the proxy model
[dolphin.git] / src / generalsettingspage.cpp
index 85f7a00be3df35b9b1e3852946986127ba7f93f6..f856de1b17894e8135115bf084abf86dd7b6d31c 100644 (file)
@@ -62,7 +62,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     KHBox* homeUrlBox = new KHBox(homeBox);
     homeUrlBox->setSpacing(spacing);
 
-    new QLabel(i18n("Location:"), homeUrlBox);
+    new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
     m_homeUrl = new QLineEdit(homeUrlBox);
 
     QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox);
@@ -72,10 +72,10 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     KHBox* buttonBox = new KHBox(homeBox);
     buttonBox->setSpacing(spacing);
 
-    QPushButton* useCurrentButton = new QPushButton(i18n("Use Current Location"), buttonBox);
+    QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox);
     connect(useCurrentButton, SIGNAL(clicked()),
             this, SLOT(useCurrentLocation()));
-    QPushButton* useDefaultButton = new QPushButton(i18n("Use Default Location"), buttonBox);
+    QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox);
     connect(useDefaultButton, SIGNAL(clicked()),
             this, SLOT(useDefaultLocation()));
 
@@ -96,18 +96,11 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
     startBoxLayout->addWidget(m_filterBar);
 
     // create 'Ask Confirmation For' group
-    KSharedConfig::Ptr konqConfig = KSharedConfig::openConfig("konquerorrc", KConfig::IncludeGlobals);
-    const KConfigGroup trashConfig(konqConfig, "Trash");
-
     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);
-    m_confirmMoveToTrash->setChecked(trashConfig.readEntry("ConfirmTrash", false));
-
     m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for Confirmation When",
                                           "Deleting files or folders"), confirmBox);
-    m_confirmDelete->setChecked(trashConfig.readEntry("ConfirmDelete", true));
 
     QVBoxLayout* confirmBoxLayout = new QVBoxLayout(confirmBox);
     confirmBoxLayout->addWidget(m_confirmMoveToTrash);
@@ -115,9 +108,6 @@ 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);
-    const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
-    const KConfigGroup kdeConfig(globalConfig, "KDE");
-    m_showDeleteCommand->setChecked(kdeConfig.readEntry("ShowDeleteCommand", false));
 
     // Add a dummy widget with no restriction regarding
     // a vertical resizing. This assures that the dialog layout
@@ -151,9 +141,9 @@ void GeneralSettingsPage::applySettings()
     KConfigGroup trashConfig(konqConfig, "Trash");
     trashConfig.writeEntry("ConfirmTrash", m_confirmMoveToTrash->isChecked());
     trashConfig.writeEntry("ConfirmDelete", m_confirmDelete->isChecked());
+    trashConfig.sync();
 
-    KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
-    KConfigGroup kdeConfig(globalConfig, "KDE");
+    KConfigGroup kdeConfig(KGlobal::config(), "KDE");
     kdeConfig.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked());
     kdeConfig.sync();
 }
@@ -164,10 +154,6 @@ void GeneralSettingsPage::restoreDefaults()
     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();
 }
@@ -199,6 +185,14 @@ void GeneralSettingsPage::loadSettings()
     m_splitView->setChecked(settings->splitView());
     m_editableUrl->setChecked(settings->editableUrl());
     m_filterBar->setChecked(settings->filterBar());
+
+    KSharedConfig::Ptr konqConfig = KSharedConfig::openConfig("konquerorrc", KConfig::IncludeGlobals);
+    const KConfigGroup trashConfig(konqConfig, "Trash");
+    m_confirmMoveToTrash->setChecked(trashConfig.readEntry("ConfirmTrash", false));
+    m_confirmDelete->setChecked(trashConfig.readEntry("ConfirmDelete", true));
+
+    const KConfigGroup kdeConfig(KGlobal::config(), "KDE");
+    m_showDeleteCommand->setChecked(kdeConfig.readEntry("ShowDeleteCommand", false));
 }
 
 #include "generalsettingspage.moc"