X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ccb06e68ac2f983c4de5a4f37754362ca7ad6b12..abf17941f7:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 36a731c0f..f40b47878 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -45,11 +46,9 @@ #include DolphinContextMenu::DolphinContextMenu(DolphinView* parent, - KFileItem* fileInfo, - const QPoint& pos) : + KFileItem* fileInfo) : m_dolphinView(parent), - m_fileInfo(fileInfo), - m_pos(pos) + m_fileInfo(fileInfo) { } @@ -69,31 +68,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 ) - 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 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)); @@ -119,7 +102,7 @@ void DolphinContextMenu::openViewportContextMenu() QAction* propertiesAction = popup->addAction(i18n("Properties...")); - QAction* activatedAction = popup->exec(m_pos); + QAction* activatedAction = popup->exec(QCursor::pos()); if (activatedAction == propertiesAction) { new KPropertiesDialog(dolphin->activeView()->url()); } @@ -142,11 +125,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 ) - assert(m_fileInfo != 0); KMenu* popup = new KMenu(m_dolphinView); @@ -205,7 +183,7 @@ void DolphinContextMenu::openItemContextMenu() QAction* propertiesAction = dolphin->actionCollection()->action("properties"); popup->addAction(propertiesAction); - QAction* activatedAction = popup->exec(m_pos); + QAction* activatedAction = popup->exec(QCursor::pos()); if ((bookmarkAction!= 0) && (activatedAction == bookmarkAction)) { const KUrl selectedUrl(m_fileInfo->url()); @@ -246,6 +224,11 @@ void DolphinContextMenu::openItemContextMenu() QList DolphinContextMenu::insertOpenWithItems(KMenu* popup, QVector& 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 ) + // 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 +297,11 @@ QList DolphinContextMenu::insertOpenWithItems(KMenu* popup, QList DolphinContextMenu::insertActionItems(KMenu* popup, QVector& 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 ) + KMenu* actionsMenu = new KMenu(i18n("Actions")); QList serviceActions;