From 3db73a2d153f9fe3c8cab8ef70e106b833a269b7 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 2 Apr 2008 19:49:04 +0000 Subject: [PATCH] Thanks to David Faure the 'Copy To' and 'Move To' menus in the context menu can also be used by Dolphin now :-) In opposite to Konqueror the sub menus are turned off per default. Minor issue: the Dolphin context menu should take care about the protocol capabilities (copy, move, delete, ...) like in konq_popupmenu (I'll fix this before 4.1). CCMAIL: faure@kde.org BUG: 155969 svn path=/trunk/KDE/kdebase/apps/; revision=792995 --- src/dolphin_generalsettings.kcfg | 4 ++++ src/dolphincontextmenu.cpp | 11 ++++++++++- src/dolphincontextmenu.h | 2 ++ src/generalsettingspage.cpp | 6 ++++++ src/generalsettingspage.h | 1 + 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/dolphin_generalsettings.kcfg b/src/dolphin_generalsettings.kcfg index 7778db702..cc498f273 100644 --- a/src/dolphin_generalsettings.kcfg +++ b/src/dolphin_generalsettings.kcfg @@ -40,6 +40,10 @@ true + + + false + diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 6ee2c1672..41673e182 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -24,6 +24,7 @@ #include "dolphinsettings.h" #include "dolphinview.h" #include "dolphinviewcontainer.h" +#include "dolphin_generalsettings.h" #include #include @@ -185,8 +186,16 @@ void DolphinContextMenu::openItemContextMenu() // Insert 'Actions' sub menu KonqMenuActions menuActions; menuActions.setItems(m_selectedItems); - if (menuActions.addActionsTo(popup)) + if (menuActions.addActionsTo(popup)) { popup->addSeparator(); + } + + // Insert 'Copy To' and 'Move To' sub menus + if (DolphinSettings::instance().generalSettings()->showCopyMoveMenu()) { + m_copyToMenu.setItems(m_selectedItems); + m_copyToMenu.addActionsTo(popup); + popup->addSeparator(); + } // insert 'Properties...' entry QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties"); diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h index f7234f8e0..7eb542b6b 100644 --- a/src/dolphincontextmenu.h +++ b/src/dolphincontextmenu.h @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -134,6 +135,7 @@ private: KFileItemList m_selectedItems; KUrl::List m_selectedUrls; int m_context; + KonqCopyToMenu m_copyToMenu; }; #endif diff --git a/src/generalsettingspage.cpp b/src/generalsettingspage.cpp index f976bbffa..a570141a6 100644 --- a/src/generalsettingspage.cpp +++ b/src/generalsettingspage.cpp @@ -38,6 +38,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa m_confirmMoveToTrash(0), m_confirmDelete(0), m_showDeleteCommand(0), + m_showCopyMoveMenu(0), m_browseThroughArchives(0), m_renameInline(0) { @@ -66,6 +67,9 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa m_showDeleteCommand = new QCheckBox(i18nc("@option:check", "Show 'Delete' command in context menu"), vBox); connect(m_showDeleteCommand, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + m_showCopyMoveMenu = new QCheckBox(i18nc("@option:check", "Show 'Copy To' and 'Move To' commands in context menu"), vBox); + connect(m_showCopyMoveMenu, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + m_browseThroughArchives = new QCheckBox(i18nc("@option:check", "Browse through archives"), vBox); connect(m_browseThroughArchives, SIGNAL(toggled(bool)), this, SIGNAL(changed())); @@ -100,6 +104,7 @@ void GeneralSettingsPage::applySettings() kdeConfig.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked()); kdeConfig.sync(); + settings->setShowCopyMoveMenu(m_showCopyMoveMenu->isChecked()); settings->setBrowseThroughArchives(m_browseThroughArchives->isChecked()); settings->setRenameInline(m_renameInline->isChecked()); } @@ -125,6 +130,7 @@ void GeneralSettingsPage::loadSettings() m_showDeleteCommand->setChecked(kdeConfig.readEntry("ShowDeleteCommand", false)); GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + m_showCopyMoveMenu->setChecked(settings->showCopyMoveMenu()); m_browseThroughArchives->setChecked(settings->browseThroughArchives()); m_renameInline->setChecked(settings->renameInline()); } diff --git a/src/generalsettingspage.h b/src/generalsettingspage.h index 42ea08185..55528bc56 100644 --- a/src/generalsettingspage.h +++ b/src/generalsettingspage.h @@ -51,6 +51,7 @@ private: QCheckBox* m_confirmDelete; QCheckBox* m_showDeleteCommand; + QCheckBox* m_showCopyMoveMenu; QCheckBox* m_browseThroughArchives; QCheckBox* m_renameInline; }; -- 2.47.3