]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/folders/treeviewcontextmenu.cpp
fix initializer list
[dolphin.git] / src / panels / folders / treeviewcontextmenu.cpp
index 4afe9e8e39360b235413a5e9cdee07393faaa344..4fdaef3b6af3810441238ef4bc923d1d646c749c 100644 (file)
@@ -31,8 +31,8 @@
 #include <KConfigGroup>
 #include <kurlmimedata.h>
 #include <KFileItemListProperties>
-#include <konq_operations.h>
 #include <KLocalizedString>
+#include <KIO/PasteJob>
 #include <KIO/Paste>
 #include <KIO/FileUndoManager>
 #include <KPropertiesDialog>
@@ -70,10 +70,12 @@ void TreeViewContextMenu::open()
         QAction* copyAction = new QAction(QIcon::fromTheme("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
         connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
 
-        const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileItem.url());
-        QAction* pasteAction = new QAction(QIcon::fromTheme("edit-paste"), pasteInfo.second, this);
+        const QMimeData *mimeData = QApplication::clipboard()->mimeData();
+        bool canPaste;
+        const QString text = KIO::pasteActionText(mimeData, &canPaste, m_fileItem);
+        QAction* pasteAction = new QAction(QIcon::fromTheme("edit-paste"), text, this);
         connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
-        pasteAction->setEnabled(pasteInfo.first);
+        pasteAction->setEnabled(canPaste);
 
         popup->addAction(cutAction);
         popup->addAction(copyAction);
@@ -180,7 +182,8 @@ void TreeViewContextMenu::copy()
 
 void TreeViewContextMenu::paste()
 {
-    KonqOperations::doPaste(m_parent, m_fileItem.url());
+    KIO::PasteJob *job = KIO::paste(QApplication::clipboard()->mimeData(), m_fileItem.url());
+    KJobWidgets::setWindow(job, m_parent);
 }
 
 void TreeViewContextMenu::rename()
@@ -190,7 +193,7 @@ void TreeViewContextMenu::rename()
 
 void TreeViewContextMenu::moveToTrash()
 {
-    const QList<QUrl> list {QList<QUrl>() << m_fileItem.url()};
+    const QList<QUrl> list {m_fileItem.url()};
     KIO::JobUiDelegate uiDelegate;
     uiDelegate.setWindow(m_parent);
     if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
@@ -203,7 +206,7 @@ void TreeViewContextMenu::moveToTrash()
 
 void TreeViewContextMenu::deleteItem()
 {
-    const QList<QUrl> list {QList<QUrl>() << m_fileItem.url()};
+    const QList<QUrl> list {m_fileItem.url()};
     KIO::JobUiDelegate uiDelegate;
     uiDelegate.setWindow(m_parent);
     if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {