#include "dolphinmainwindow.h"
#include "dolphinnewmenu.h"
-#include "dolphinsettings.h"
+#include "settings/dolphinsettings.h"
#include "dolphinview.h"
#include "dolphinviewcontainer.h"
#include "dolphin_generalsettings.h"
m_capabilities(0),
m_fileInfo(fileInfo),
m_baseUrl(baseUrl),
- m_context(NoContext)
+ m_context(NoContext),
+ 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.
m_capabilities = 0;
}
+void DolphinContextMenu::setCustomActions(const QList<QAction*>& actions)
+{
+ m_customActions = actions;
+}
+
void DolphinContextMenu::open()
{
// get the context information
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);
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());
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"));
return *m_capabilities;
}
+void DolphinContextMenu::addCustomActions(KMenu* menu)
+{
+ foreach (QAction* action, m_customActions) {
+ menu->addAction(action);
+ }
+}
+
#include "dolphincontextmenu.moc"