#include "dolphin_generalsettings.h"
#include <kactioncollection.h>
+#include <kfileitemlistproperties.h>
#include <kfileplacesmodel.h>
#include <kdesktopfile.h>
#include <kglobal.h>
#include <kmimetypetrader.h>
#include <knewmenu.h>
#include <konqmimedata.h>
-#include <konq_fileitemcapabilities.h>
+#include <kfileitemlistproperties.h>
#include <konq_operations.h>
#include <konq_menuactions.h>
-#include <konq_popupmenuinformation.h>
#include <klocale.h>
#include <kpropertiesdialog.h>
#include <krun.h>
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.
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);
i18nc("@action:inmenu Add selected folder to places", "Add to Places"));
}
- KonqPopupMenuInformation popupInfo;
- popupInfo.setItems(m_selectedItems);
- popupInfo.setParentWidget(m_mainWindow);
KonqMenuActions menuActions;
- menuActions.setPopupMenuInfo(popupInfo);
+ menuActions.setParentWidget(m_mainWindow);
+ menuActions.setItemListProperties(m_selectedItems);
- // 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();
- QAction* propertiesAction = popup->addAction(i18nc("@action:inmenu", "Properties"));
+ addCustomActions(popup);
+ QAction* propertiesAction = popup->addAction(i18nc("@action:inmenu", "Properties"));
+ propertiesAction->setIcon(KIcon("document-properties"));
QAction* action = popup->exec(QCursor::pos());
if (action == propertiesAction) {
const KUrl& url = m_mainWindow->activeViewContainer()->url();
return action;
}
-KonqFileItemCapabilities& DolphinContextMenu::capabilities()
+KFileItemListProperties& DolphinContextMenu::capabilities()
{
if (m_capabilities == 0) {
- m_capabilities = new KonqFileItemCapabilities(m_selectedItems);
+ m_capabilities = new KFileItemListProperties(m_selectedItems);
}
return *m_capabilities;
}
+void DolphinContextMenu::addCustomActions(KMenu* menu)
+{
+ foreach (QAction* action, m_customActions) {
+ menu->addAction(action);
+ }
+}
+
#include "dolphincontextmenu.moc"