]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Implemented one of the most often requested features for Dolphin: allow that the...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 25 Feb 2007 20:51:05 +0000 (20:51 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 25 Feb 2007 20:51:05 +0000 (20:51 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=637232

src/dolphin_generalsettings.kcfg
src/dolphincontextmenu.cpp
src/dolphinmainwindow.cpp
src/generalsettingspage.cpp
src/generalsettingspage.h

index 37fe8d18eec01f5343e6deafc759f0f0f8c0cd6d..9f9f3e56ba616a12e11826b91f3063a5c7077e44 100644 (file)
             <label>Should the view properties used for all directories</label>
             <default>false</default>
         </entry>
+        <entry name="ShowDeleteCommand" type="Bool">
+            <label>Should the command 'Delete' be shown in the context menu</label>
+            <default>false</default>
+        </entry>
         <entry name="ViewPropsTimestamp" type="DateTime" >
             <label>Timestamp since when the view properties are valid</label>
         </entry>
index d27aa99cd23f0d0df4510f683af73fa58326c28c..14f71f44953898aab65c0dba917ffe70a3125357 100644 (file)
@@ -25,6 +25,8 @@
 #include "dolphinview.h"
 #include "editbookmarkdialog.h"
 
+#include "dolphin_generalsettings.h"
+
 #include <assert.h>
 
 #include <kactioncollection.h>
@@ -151,13 +153,18 @@ void DolphinContextMenu::openItemContextMenu()
     QAction* renameAction = dolphin->actionCollection()->action("rename");
     popup->addAction(renameAction);
 
-    // insert 'Move to Trash' for local Urls, otherwise insert 'Delete'
+    // insert 'Move to Trash' and (optionally) 'Delete'
+    bool showDeleteCommand = DolphinSettings::instance().generalSettings()->showDeleteCommand();
     const KUrl& url = dolphin->activeView()->url();
     if (url.isLocalFile()) {
         QAction* moveToTrashAction = dolphin->actionCollection()->action("move_to_trash");
         popup->addAction(moveToTrashAction);
     }
     else {
+        showDeleteCommand = true;
+    }
+
+    if (showDeleteCommand) {
         QAction* deleteAction = dolphin->actionCollection()->action("delete");
         popup->addAction(deleteAction);
     }
index 2585a7b82d9e9bad2cc97a4ea3da75e8c05b2793..7a0ff6c6a59112d2d11c0a2b9a5e15289cabf0b7 100644 (file)
@@ -994,10 +994,11 @@ void DolphinMainWindow::setupActions()
     connect(menu, SIGNAL(aboutToShow()),\r
             this, SLOT(updateNewMenu()));\r
 \r
-    QAction* action = actionCollection()->addAction("new_window");\r
-    action->setIcon(KIcon("window_new"));\r
-    action->setText(i18n("New &Window"));\r
-    connect(action, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));\r
+    QAction* newWindow = actionCollection()->addAction("new_window");\r
+    newWindow->setIcon(KIcon("window_new"));\r
+    newWindow->setText(i18n("New &Window"));\r
+    newWindow->setShortcut(Qt::CTRL | Qt::Key_N);\r
+    connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));\r
 \r
     QAction* rename = actionCollection()->addAction("rename");\r
     rename->setText(i18n("Rename"));\r
@@ -1012,7 +1013,7 @@ void DolphinMainWindow::setupActions()
 \r
     QAction* deleteAction = actionCollection()->addAction("delete");\r
     deleteAction->setText(i18n("Delete"));\r
-    deleteAction->setShortcut(Qt::ALT | Qt::Key_Delete);\r
+    deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete);\r
     deleteAction->setIcon(KIcon("editdelete"));\r
     connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItems()));\r
 \r
index e31d0620e78c34556c388d1b2ce1da8e24b9dfc2..ba5473054c9efcf513905955b8a3525e3b3da2ac 100644 (file)
 
 #include "generalsettingspage.h"
 
-#include <qlayout.h>
-//Added by qt3to4:
-#include <Q3VBoxLayout>
 #include <kdialog.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-
-#include <q3grid.h>
-#include <q3groupbox.h>
-#include <klocale.h>
-#include <qcheckbox.h>
-#include <q3buttongroup.h>
-#include <qpushbutton.h>
 #include <kfiledialog.h>
-#include <qradiobutton.h>
+#include <klocale.h>
 #include <kvbox.h>
 
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+
 #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());
 }
index 0cffc3f6970b1944bd89bdcff225b14f3c4d7b14..4a71c5d1f9bc29d21391fbe6829fd3a60aabc5e9 100644 (file)
@@ -47,13 +47,14 @@ public:
 private slots:
     void selectHomeUrl();
     void useCurrentLocation();
-    void useDefaulLocation();
+    void useDefaultLocation();
 
 private:
     DolphinMainWindow* m_mainWindow;
     QLineEdit* m_homeUrl;
     QCheckBox* m_startSplit;
     QCheckBox* m_startEditable;
+    QCheckBox* m_showDeleteCommand;
 };
 
 #endif