diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml --- a/containments/desktop/package/contents/ui/FolderView.qml +++ b/containments/desktop/package/contents/ui/FolderView.qml @@ -134,6 +134,12 @@ } } + Connections { + target: dir + onPopupMenuAboutToShow: { + plasmoid.processMimeData(mimeData, x, y, dropJob); + } + } function makeBackButton() { return Qt.createQmlObject("BackButtonItem {}", main); } diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h --- a/containments/desktop/plugins/folder/foldermodel.h +++ b/containments/desktop/plugins/folder/foldermodel.h @@ -50,6 +50,10 @@ class KJob; class KNewFileMenu; +namespace KIO { + class DropJob; +} + class DirLister : public KDirLister { Q_OBJECT @@ -232,6 +236,7 @@ void filterMimeTypesChanged() const; void requestRename() const; void move(int x, int y, QList urls); + void popupMenuAboutToShow(KIO::DropJob *dropJob, QMimeData *mimeData, int x, int y); protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp --- a/containments/desktop/plugins/folder/foldermodel.cpp +++ b/containments/desktop/plugins/folder/foldermodel.cpp @@ -112,6 +112,8 @@ m_filterMode(NoFilter), m_filterPatternMatchAll(true) { + //needed to pass the job around with qml + qmlRegisterType(); DirLister *dirLister = new DirLister(this); dirLister->setDelayedMimeTypes(true); dirLister->setAutoErrorHandlingEnabled(false, 0); @@ -939,6 +941,12 @@ KIO::DropJob *dropJob = KIO::drop(&ev, dropTargetUrl); dropJob->ui()->setAutoErrorHandlingEnabled(true); + const int x = dropEvent->property("x").toInt(); + const int y = dropEvent->property("y").toInt(); + + connect(dropJob, static_cast(&KIO::DropJob::popupMenuAboutToShow), this, [this, mimeData, x, y, dropJob](const KFileItemListProperties &) { + emit popupMenuAboutToShow(dropJob, mimeData, x, y); + }); } void FolderModel::dropCwd(QObject* dropEvent)