X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/5be69f0daba256cd3faad0aaa16dee8447a76af4..a2c9c05de2dfabbb2bb614390c8e03023dad2bd1:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 4e5f4c786..5f331dc27 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -49,6 +49,11 @@ #include +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) +#include +#endif + #include #include #include @@ -190,6 +195,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) : connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection); connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError); connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged); + connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved); connect(this, &DolphinView::itemCountChanged, this, &DolphinView::updatePlaceholderLabel); @@ -753,6 +759,13 @@ void DolphinView::renameSelectedItems() void DolphinView::trashSelectedItems() { const QList list = simplifiedSelectedUrls(); + +#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) + using Iface = KIO::AskUserActionInterface; + auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Trash, Iface::DefaultConfirmation, this); + connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished); + trashJob->start(); +#else KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(window()); if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { @@ -762,12 +775,19 @@ void DolphinView::trashSelectedItems() connect(job, &KIO::Job::result, this, &DolphinView::slotTrashFileFinished); } +#endif } void DolphinView::deleteSelectedItems() { const QList list = simplifiedSelectedUrls(); +#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) + using Iface = KIO::AskUserActionInterface; + auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Delete, Iface::DefaultConfirmation, this); + connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished); + trashJob->start(); +#else KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(window()); if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { @@ -776,6 +796,7 @@ void DolphinView::deleteSelectedItems() connect(job, &KIO::Job::result, this, &DolphinView::slotDeleteFileFinished); } +#endif } void DolphinView::cutSelectedItemsToClipboard() @@ -1886,8 +1907,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con #ifndef Q_OS_WIN //Confirm hiding file/directory by renaming inline if (!hiddenFilesShown() && newName.startsWith(QLatin1Char('.')) && !oldItem.name().startsWith(QLatin1Char('.'))) { - KGuiItem yesGuiItem(KStandardGuiItem::yes()); - yesGuiItem.setText(i18nc("@action:button", "Rename and Hide")); + KGuiItem yesGuiItem(i18nc("@action:button", "Rename and Hide"), QStringLiteral("view-hidden")); #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) const auto code = KMessageBox::questionTwoActions(this,