mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
Port away from deprecated KIO::JobUiDelegate API
This commit is contained in:
parent
6a30343baa
commit
b5e5debad3
1 changed files with 5 additions and 15 deletions
|
|
@ -25,10 +25,7 @@
|
||||||
#include <KStandardAction>
|
#include <KStandardAction>
|
||||||
#include <KUrlMimeData>
|
#include <KUrlMimeData>
|
||||||
|
|
||||||
#include <KIO/CopyJob> // for KIO::trash
|
#include <KIO/DeleteOrTrashJob>
|
||||||
#include <KIO/DeleteJob>
|
|
||||||
#include <KIO/FileUndoManager>
|
|
||||||
#include <KIO/JobUiDelegate>
|
|
||||||
#include <KIO/OpenFileManagerWindowJob>
|
#include <KIO/OpenFileManagerWindowJob>
|
||||||
|
|
||||||
NotificationFileMenu::NotificationFileMenu(QObject *parent)
|
NotificationFileMenu::NotificationFileMenu(QObject *parent)
|
||||||
|
|
@ -148,12 +145,8 @@ void NotificationFileMenu::open(int x, int y)
|
||||||
auto moveToTrashLambda = [this] {
|
auto moveToTrashLambda = [this] {
|
||||||
const QList<QUrl> urls{m_url};
|
const QList<QUrl> urls{m_url};
|
||||||
|
|
||||||
KIO::JobUiDelegate uiDelegate;
|
auto *job = new KIO::DeleteOrTrashJob(urls, KIO::AskUserActionInterface::Trash, KIO::AskUserActionInterface::DefaultConfirmation, this);
|
||||||
if (uiDelegate.askDeleteConfirmation(urls, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
|
job->start();
|
||||||
auto *job = KIO::trash(urls);
|
|
||||||
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
|
|
||||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, urls, QUrl(QStringLiteral("trash:/")), job);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
auto moveToTrashAction = KStandardAction::moveToTrash(this, moveToTrashLambda, menu);
|
auto moveToTrashAction = KStandardAction::moveToTrash(this, moveToTrashLambda, menu);
|
||||||
moveToTrashAction->setShortcut({}); // Can't focus notification to press Delete
|
moveToTrashAction->setShortcut({}); // Can't focus notification to press Delete
|
||||||
|
|
@ -167,11 +160,8 @@ void NotificationFileMenu::open(int x, int y)
|
||||||
auto deleteLambda = [this] {
|
auto deleteLambda = [this] {
|
||||||
const QList<QUrl> urls{m_url};
|
const QList<QUrl> urls{m_url};
|
||||||
|
|
||||||
KIO::JobUiDelegate uiDelegate;
|
auto *job = new KIO::DeleteOrTrashJob(urls, KIO::AskUserActionInterface::Delete, KIO::AskUserActionInterface::DefaultConfirmation, this);
|
||||||
if (uiDelegate.askDeleteConfirmation(urls, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
|
job->start();
|
||||||
auto *job = KIO::del(urls);
|
|
||||||
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
auto deleteAction = KStandardAction::deleteFile(this, deleteLambda, menu);
|
auto deleteAction = KStandardAction::deleteFile(this, deleteLambda, menu);
|
||||||
deleteAction->setShortcut({});
|
deleteAction->setShortcut({});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue