]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
SVN_SILENT made messages (.desktop file, second try)
[dolphin.git] / src / dolphincontextmenu.cpp
index 1d99f96373e7dcce4817954c7946dfc9b1eea1cc..f633fb945165c7f54ac6f0923f56b39159b14bea 100644 (file)
@@ -61,7 +61,8 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
     m_fileInfo(fileInfo),
     m_baseUrl(baseUrl),
     m_context(NoContext),
-    m_copyToMenu(parent)
+    m_copyToMenu(parent),
+    m_customActions()
 {
     // The context menu either accesses the URLs of the selected items
     // or the items itself. To increase the performance both lists are cached.
@@ -76,6 +77,11 @@ DolphinContextMenu::~DolphinContextMenu()
     m_capabilities = 0;
 }
 
+void DolphinContextMenu::setCustomActions(const QList<QAction*>& actions)
+{
+    m_customActions = actions;
+}
+
 void DolphinContextMenu::open()
 {
     // get the context information
@@ -119,6 +125,8 @@ void DolphinContextMenu::openTrashContextMenu()
     QAction* addToPlacesAction = popup->addAction(KIcon("bookmark-new"),
                                                   i18nc("@action:inmenu Add current folder to places", "Add to Places"));
 
+    addCustomActions(popup);
+
     QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
     popup->addAction(propertiesAction);
 
@@ -210,15 +218,15 @@ void DolphinContextMenu::openItemContextMenu()
     KonqMenuActions menuActions;
     menuActions.setPopupMenuInfo(popupInfo);
 
-    // Insert 'Open With...' action or sub menu
+    // insert 'Open With...' action or sub menu
     menuActions.addOpenWithActionsTo(popup, "DesktopEntryName != 'dolphin'");
 
-    // Insert 'Actions' sub menu
+    // insert 'Actions' sub menu
     if (menuActions.addActionsTo(popup)) {
         popup->addSeparator();
     }
 
-    // Insert 'Copy To' and 'Move To' sub menus
+    // insert 'Copy To' and 'Move To' sub menus
     if (DolphinSettings::instance().generalSettings()->showCopyMoveMenu()) {
         m_copyToMenu.setItems(m_selectedItems);
         m_copyToMenu.setReadOnly(!capabilities().supportsWriting());
@@ -277,7 +285,8 @@ void DolphinContextMenu::openViewportContextMenu()
 
     QAction* addToPlacesAction = popup->addAction(KIcon("bookmark-new"),
                                                   i18nc("@action:inmenu Add current folder to places", "Add to Places"));
-    popup->addSeparator();
+
+    addCustomActions(popup);
 
     QAction* propertiesAction = popup->addAction(i18nc("@action:inmenu", "Properties"));
 
@@ -379,4 +388,11 @@ KonqFileItemCapabilities& DolphinContextMenu::capabilities()
     return *m_capabilities;
 }
 
+void DolphinContextMenu::addCustomActions(KMenu* menu)
+{
+    foreach (QAction* action, m_customActions) {
+        menu->addAction(action);
+    }
+}
+
 #include "dolphincontextmenu.moc"