X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/591fde8f4a6b6cb56d8e3cbbabaab1df78b7ec0e..6acbde01b724dbdcc2e081738d4bcbb1ff443387:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 41930221d..40a62e844 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -23,6 +23,7 @@ #include "dolphinsortfilterproxymodel.h" #include "dolphinview.h" #include "dolphinmodel.h" +#include "dolphinnewmenuobserver.h" #include #include @@ -96,8 +97,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL this, SLOT(slotItemTriggered(KFileItem))); connect(m_view, SIGNAL(tabRequested(KUrl)), this, SLOT(createNewWindow(KUrl))); - connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl)), - this, SLOT(slotOpenContextMenu(KFileItem,KUrl))); + connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList)), + this, SLOT(slotOpenContextMenu(KFileItem,KUrl,QList))); connect(m_view, SIGNAL(selectionChanged(KFileItemList)), m_extension, SIGNAL(selectionInfo(KFileItemList))); connect(m_view, SIGNAL(selectionChanged(KFileItemList)), @@ -139,6 +140,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL DolphinPart::~DolphinPart() { + DolphinNewMenuObserver::instance().detach(m_newMenu); delete m_dirLister; } @@ -147,6 +149,7 @@ void DolphinPart::createActions() // Edit menu m_newMenu = new KNewMenu(actionCollection(), widget(), "new_menu"); + DolphinNewMenuObserver::instance().attach(m_newMenu); connect(m_newMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(updateNewMenu())); @@ -276,6 +279,7 @@ bool DolphinPart::openUrl(const KUrl& url) emit started(0); // get the wheel to spin m_dirLister->setNameFilter(m_nameFilter); m_view->setUrl(url); + updatePasteAction(); emit aboutToOpenURL(); if (reload) m_view->reload(); @@ -335,7 +339,9 @@ void DolphinPart::createNewWindow(const KUrl& url) emit m_extension->createNewWindow(url, args); } -void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&) +void DolphinPart::slotOpenContextMenu(const KFileItem& _item, + const KUrl&, + const QList& customActions) { KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems | KParts::BrowserExtension::ShowProperties @@ -353,6 +359,8 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&) KParts::BrowserExtension::ActionGroupMap actionGroups; QList editActions; + editActions += customActions; + if (!_item.isNull()) { // only for context menu on one or more items bool sDeleting = true; bool sMoving = true; @@ -396,7 +404,6 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&) editActions.append(actionCollection()->action("move_to_trash")); if (addDel) editActions.append(actionCollection()->action("delete")); - actionGroups.insert("editactions", editActions); // Normally KonqPopupMenu only shows the "Create new" subdir in the current view // since otherwise the created file would not be visible. @@ -406,6 +413,8 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&) } + actionGroups.insert("editactions", editActions); + // TODO: We should change the signature of the slots (and signals) for being able // to tell for which items we want a popup. KFileItemList items = (m_view->selectedItems().count() ? m_view->selectedItems() @@ -502,7 +511,7 @@ void DolphinPart::slotOpenTerminal() //If the URL is local after the above conversion, set the directory. if (u.isLocalFile()) { - dir = u.path(); + dir = u.toLocalFile(); } KToolInvocation::invokeTerminal(QString(), dir);