]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/folders/treeviewcontextmenu.cpp
GIT_SILENT Sync po/docbooks with svn
[dolphin.git] / src / panels / folders / treeviewcontextmenu.cpp
index 0e6260b3b844842a21261cb3a52f506d136e26b1..ec1ccb4d637089a7733a5027c7a3dac55b886c29 100644 (file)
@@ -13,7 +13,7 @@
 #include <KConfigGroup>
 #include <KFileItemListProperties>
 #include <KIO/CopyJob>
-#include <KIO/DeleteJob>
+#include <KIO/DeleteOrTrashJob>
 #include <KIO/Paste>
 #include <KIO/PasteJob>
 #include <KJobWidgets>
 #include <KSharedConfig>
 #include <KUrlMimeData>
 
-#include <kio_version.h>
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
-#include <KIO/DeleteOrTrashJob>
-#else
-#include <KIO/FileUndoManager>
-#include <KIO/JobUiDelegate>
-#endif
-
 #include <QApplication>
 #include <QClipboard>
 #include <QMenu>
@@ -83,7 +75,7 @@ void TreeViewContextMenu::open(const QPoint &pos)
 
         // insert 'Move to Trash' and (optionally) 'Delete'
         KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::IncludeGlobals);
-        KConfigGroup configGroup(globalConfig, "KDE");
+        KConfigGroup configGroup(globalConfig, QStringLiteral("KDE"));
         bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
 
         const QUrl url = m_fileItem.url();
@@ -197,39 +189,16 @@ void TreeViewContextMenu::rename()
 
 void TreeViewContextMenu::moveToTrash()
 {
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
     using Iface = KIO::AskUserActionInterface;
     auto *deleteJob = new KIO::DeleteOrTrashJob(QList{m_fileItem.url()}, Iface::Trash, Iface::DefaultConfirmation, m_parent);
     deleteJob->start();
-#else
-    const QList<QUrl> list{m_fileItem.url()};
-    KIO::JobUiDelegate uiDelegate;
-    uiDelegate.setWindow(m_parent);
-    if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
-        KIO::Job *job = KIO::trash(list);
-        KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl(QStringLiteral("trash:/")), job);
-        KJobWidgets::setWindow(job, m_parent);
-        job->uiDelegate()->setAutoErrorHandlingEnabled(true);
-    }
-#endif
 }
 
 void TreeViewContextMenu::deleteItem()
 {
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
     using Iface = KIO::AskUserActionInterface;
     auto *deleteJob = new KIO::DeleteOrTrashJob(QList{m_fileItem.url()}, Iface::Delete, Iface::DefaultConfirmation, m_parent);
     deleteJob->start();
-#else
-    const QList<QUrl> list{m_fileItem.url()};
-    KIO::JobUiDelegate uiDelegate;
-    uiDelegate.setWindow(m_parent);
-    if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
-        KIO::Job *job = KIO::del(list);
-        KJobWidgets::setWindow(job, m_parent);
-        job->uiDelegate()->setAutoErrorHandlingEnabled(true);
-    }
-#endif
 }
 
 void TreeViewContextMenu::showProperties()
@@ -253,3 +222,5 @@ void TreeViewContextMenu::setAutoScrolling(bool enable)
 {
     m_parent->setAutoScrolling(enable);
 }
+
+#include "moc_treeviewcontextmenu.cpp"