┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-01-25 16:56:52 +0000
committerPeter Penz <[email protected]>2007-01-25 16:56:52 +0000
commit214ee5de3fab8db92db116496b73200e466b41de (patch)
tree261263d71eb1a88acb979c0b99120e955e23e9c9 /src/dolphincontextmenu.cpp
parent78d1167c38be4318114aa8ae4b7d433c12f86b77 (diff)
Use KNewMenu instead of custom implementation of Dolphin. TODO: currently errors are indicated automatically in a message box KNewMenu. In Dolphin modal dialogs having only an "OK" button are not used -> it would be nice if Dolphin could handle the errors in a custom way.
svn path=/trunk/playground/utils/dolphin/; revision=627085
Diffstat (limited to 'src/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp40
1 files changed, 15 insertions, 25 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 36a731c0f..8cc79e955 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -36,6 +36,7 @@
#include <kio/netaccess.h>
#include <kmenu.h>
#include <kmimetypetrader.h>
+#include <knewmenu.h>
#include <klocale.h>
#include <kpropertiesdialog.h>
#include <krun.h>
@@ -69,31 +70,15 @@ DolphinContextMenu::~DolphinContextMenu()
void DolphinContextMenu::openViewportContextMenu()
{
- // Parts of the following code have been taken
- // from the class KonqOperations located in
- // libqonq/konq_operations.h of Konqueror.
- // (Copyright (C) 2000 David Faure <[email protected]>)
-
assert(m_fileInfo == 0);
-
DolphinMainWindow* dolphin = m_dolphinView->mainWindow();
KMenu* popup = new KMenu(m_dolphinView);
// setup 'Create New' menu
- KMenu* createNewMenu = new KMenu(i18n("Create New"));
- createNewMenu->setIcon(SmallIcon("filenew"));
-
- QAction* createFolderAction = dolphin->actionCollection()->action("create_folder");
- if (createFolderAction != 0) {
- createNewMenu->addAction(createFolderAction);
- }
-
- QLinkedListIterator<QAction*> fileGrouptIt(dolphin->fileGroupActions());
- while (fileGrouptIt.hasNext()) {
- createNewMenu->addAction(fileGrouptIt.next());
- }
-
- popup->addMenu(createNewMenu);
+ KNewMenu* newMenu = dolphin->newMenu();
+ newMenu->slotCheckUpToDate();
+ newMenu->setPopupFiles(m_dolphinView->url());
+ popup->addMenu(newMenu->menu());
popup->addSeparator();
QAction* pasteAction = dolphin->actionCollection()->action(KStandardAction::stdName(KStandardAction::Paste));
@@ -142,11 +127,6 @@ void DolphinContextMenu::openViewportContextMenu()
void DolphinContextMenu::openItemContextMenu()
{
- // Parts of the following code have been taken
- // from the class KonqOperations located in
- // libkonq/konq_operations.h of Konqueror.
- // (Copyright (C) 2000 David Faure <[email protected]>)
-
assert(m_fileInfo != 0);
KMenu* popup = new KMenu(m_dolphinView);
@@ -246,6 +226,11 @@ void DolphinContextMenu::openItemContextMenu()
QList<QAction*> DolphinContextMenu::insertOpenWithItems(KMenu* popup,
QVector<KService::Ptr>& openWithVector)
{
+ // Parts of the following code have been taken
+ // from the class KonqOperations located in
+ // libqonq/konq_operations.h of Konqueror.
+ // (Copyright (C) 2000 David Faure <[email protected]>)
+
// Prepare 'Open With' sub menu. Usually a sub menu is created, where all applications
// are listed which are registered to open the item. As last entry "Other..." will be
// attached which allows to select a custom application. If no applications are registered
@@ -314,6 +299,11 @@ QList<QAction*> DolphinContextMenu::insertOpenWithItems(KMenu* popup,
QList<QAction*> DolphinContextMenu::insertActionItems(KMenu* popup,
QVector<KDEDesktopMimeType::Service>& actionsVector)
{
+ // Parts of the following code have been taken
+ // from the class KonqOperations located in
+ // libqonq/konq_operations.h of Konqueror.
+ // (Copyright (C) 2000 David Faure <[email protected]>)
+
KMenu* actionsMenu = new KMenu(i18n("Actions"));
QList<QAction*> serviceActions;