X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/4d930992c47140bc47dac2ecfe0c4ca7eca33be7..be51e7233294263e3c2866e101e1151dbc61ccbe:/src/panels/folders/treeviewcontextmenu.cpp diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 0e6260b3b..ec1ccb4d6 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,14 +22,6 @@ #include #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) -#include -#else -#include -#include -#endif - #include #include #include @@ -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 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 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"