From d9c3648d5a4601d8e11e148ca77b3e9d84cf3207 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sun, 25 Feb 2007 20:51:05 +0000 Subject: Implemented one of the most often requested features for Dolphin: allow that the command 'Delete' is shown in the context menu to bypass the trash. Like in Konqueror the default setting is that the 'Delete' command is not shown. TODO: currently this is a custom setting of Dolphin. Konqueror uses the global settings from KDE for this -> should this be changed to use the global setting instead? svn path=/trunk/KDE/kdebase/apps/; revision=637232 --- src/generalsettingspage.cpp | 60 +++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 32 deletions(-) (limited to 'src/generalsettingspage.cpp') diff --git a/src/generalsettingspage.cpp b/src/generalsettingspage.cpp index e31d0620e..ba5473054 100644 --- a/src/generalsettingspage.cpp +++ b/src/generalsettingspage.cpp @@ -20,26 +20,22 @@ #include "generalsettingspage.h" -#include -//Added by qt3to4: -#include #include -#include -#include - -#include -#include -#include -#include -#include -#include #include -#include +#include #include +#include +#include +#include +#include +#include +#include + #include "dolphinsettings.h" #include "dolphinmainwindow.h" #include "dolphinview.h" + #include "dolphin_generalsettings.h" GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* parent) : @@ -47,29 +43,20 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* par m_mainWindow(mainWin), m_homeUrl(0), m_startSplit(0), - m_startEditable(0) + m_startEditable(0), + m_showDeleteCommand(0) { - Q3VBoxLayout* topLayout = new Q3VBoxLayout(this, 2, KDialog::spacingHint()); - const int spacing = KDialog::spacingHint(); - const int margin = KDialog::marginHint(); - const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + QVBoxLayout* topLayout = new QVBoxLayout(this); KVBox* vBox = new KVBox(this); - vBox->setSizePolicy(sizePolicy); vBox->setSpacing(spacing); - vBox->setMargin(margin); - vBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); - // create 'Home Url' editor - Q3GroupBox* homeGroup = new Q3GroupBox(1, Qt::Horizontal, i18n("Home Folder"), vBox); - homeGroup->setSizePolicy(sizePolicy); - homeGroup->setMargin(margin); + // create 'Home URL' editor + QGroupBox* homeBox = new QGroupBox(i18n("Home folder"), vBox); - KHBox* homeUrlBox = new KHBox(homeGroup); - homeUrlBox->setSizePolicy(sizePolicy); + KHBox* homeUrlBox = new KHBox(homeBox); homeUrlBox->setSpacing(spacing); new QLabel(i18n("Location:"), homeUrlBox); @@ -79,15 +66,19 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* par connect(selectHomeUrlButton, SIGNAL(clicked()), this, SLOT(selectHomeUrl())); - KHBox* buttonBox = new KHBox(homeGroup); - buttonBox->setSizePolicy(sizePolicy); + KHBox* buttonBox = new KHBox(homeBox); buttonBox->setSpacing(spacing); + QPushButton* useCurrentButton = new QPushButton(i18n("Use current location"), buttonBox); connect(useCurrentButton, SIGNAL(clicked()), this, SLOT(useCurrentLocation())); QPushButton* useDefaultButton = new QPushButton(i18n("Use default location"), buttonBox); connect(useDefaultButton, SIGNAL(clicked()), - this, SLOT(useDefaulLocation())); + this, SLOT(useDefaultLocation())); + + QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox); + homeBoxLayout->addWidget(homeUrlBox); + homeBoxLayout->addWidget(buttonBox); QGroupBox* startBox = new QGroupBox(i18n("Start"), vBox); @@ -103,6 +94,10 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* par startBoxLayout->addWidget(m_startSplit); startBoxLayout->addWidget(m_startEditable); + m_showDeleteCommand = new QCheckBox(i18n("Show the command 'Delete' in context menu"), vBox); + // TODO: use global config like in Konqueror or is this a custom setting for Dolphin? + m_showDeleteCommand->setChecked(settings->showDeleteCommand()); + // Add a dummy widget with no restriction regarding // a vertical resizing. This assures that the dialog layout // is not stretched vertically. @@ -128,6 +123,7 @@ void GeneralSettingsPage::applySettings() settings->setSplitView(m_startSplit->isChecked()); settings->setEditableUrl(m_startEditable->isChecked()); + settings->setShowDeleteCommand(m_showDeleteCommand->isChecked()); } void GeneralSettingsPage::selectHomeUrl() @@ -145,7 +141,7 @@ void GeneralSettingsPage::useCurrentLocation() m_homeUrl->setText(view->url().prettyUrl()); } -void GeneralSettingsPage::useDefaulLocation() +void GeneralSettingsPage::useDefaultLocation() { m_homeUrl->setText("file://" + QDir::homePath()); } -- cgit v1.3