In the process, port jump list actions from custom KDesktopFile parsing to KServiceAction on KService, simplifying the code a lot.
Also, use the new KNotificationJobUiDelegate to provide a Plasma notification on error rather than a modal dialog box.
Details
- Reviewers
hein dfaure - Group Reviewers
Plasma - Commits
- R119:fa8e49b3be08: [Task Manager] Port backend to ApplicationLauncherJob
- Launching incognito tabs in my browser still works
- Opening Dolphin places still works
- Opening recent docs still work and do open in the app the task manager entry is for rather than the default app for the mimetype
Diff Detail
- Repository
- R119 Plasma Desktop
- Lint
Lint Skipped - Unit
Unit Tests Skipped
applets/taskmanager/plugin/backend.cpp | ||
---|---|---|
178 | Only if you like messageboxes. Plasma code might prefer something else? A notification maybe? I think we both know a guy who likes them very much ;) |
applets/taskmanager/plugin/backend.cpp | ||
---|---|---|
233–237 | I see that redundant code in many places can you wrap it in function KJob* createApplicationNotificationLauncherJob or something similar. |
Alternatively I'm wondering if we should add constructors to the delegates that take some AutoErrorHandlingEnabled enum value, then it can become something like
auto *job = new KIO::ApplicationLauncherJob(service); job->setUiDelegate(new KNotificationJobUiDelegate(KJob::AutoErrorHandlingEnabled));
(and the same with KDialogJobUiDelegate in widget applications)
Benefit: available everywhere, unlike a local wrapper function.
I don't think we want to have wrapper functions in KIO for all combinations of jobs and delegates. There are many of each.
Why not -> because it just doesn't scale. 30 jobs * 4 delegates = 120 wrapper methods...
- Adjust to API change in KServiceAction
- Drop linkage of KIOWidgets in favor of KIOGui (though KIOFileWidgets probably implies it anyway)
And what about the idea to pass delegate to job constructor? At least it's better than current one. I'm pretty pedantic about duplicate code in plus it makes porting harder.
That would save only one line (the call to setUiDelegate).
I prefer my earlier suggestion: job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled));
That one alone would save 2 lines ;)
OK, let's keep things as they are. Because the best i can make without dedicated function is new KIO::ApplicationLauncherJob(service, KIO::ApplicationLauncher::WITH_AUTO_ERROR_HANDLED_DELEGATE)
That wouldn't work either, you need to be able to choose between a Notification delegate, a Dialog delegate (which lives in a different library due to the QtWidgets dependency), and some more.