#include "generalsettingspage.h"
-#include <kdialog.h>
-#include <kfiledialog.h>
-#include <klocale.h>
-#include <kvbox.h>
-
-#include <QtGui/QCheckBox>
-#include <QtGui/QGroupBox>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QPushButton>
-#include <QtGui/QRadioButton>
-
#include "dolphinsettings.h"
#include "dolphinmainwindow.h"
#include "dolphinview.h"
+#include "dolphinviewcontainer.h"
#include "dolphin_generalsettings.h"
+#include <kdialog.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kvbox.h>
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+
GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) :
SettingsPageBase(parent),
m_mainWindow(mainWin),
m_confirmDelete(0)
{
const int spacing = KDialog::spacingHint();
- GeneralSettings* settings = DolphinSettings::instance().generalSettings();
QVBoxLayout* topLayout = new QVBoxLayout(this);
KVBox* vBox = new KVBox(this);
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()),
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);
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);
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));
new QWidget(vBox);
topLayout->addWidget(vBox);
+
+ loadSettings();
}
GeneralSettingsPage::~GeneralSettingsPage()
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());
void GeneralSettingsPage::useCurrentLocation()
{
- const DolphinView* view = m_mainWindow->activeView();
+ const DolphinView* view = m_mainWindow->activeViewContainer()->view();
m_homeUrl->setText(view->url().prettyUrl());
}
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"