This can be used for job error reporting using KNotification rather than a KDialog.
Details
- Reviewers
nicolasfella dfaure - Group Reviewers
Frameworks - Commits
- R289:3dafde9c61b9: Introduce KNotificationJobUiDelegate
As discussed in D28286
auto *job = new KIO::ApplicationLauncherJob(service); auto *delegate = new KNotificationJobUiDelegate; delegate->setAutoErrorHandlingEnabled(true); job->setUiDelegate(delegate); job->start();
Is there a way to get the job description/title outside of its description emission? I kinda would like to show the job title in the notification but I don't see how.
Diff Detail
- Repository
- R289 KNotifications
- Lint
Lint Skipped - Unit
Unit Tests Skipped
src/knotificationjobuidelegate.h | ||
---|---|---|
30 | s/KMessageBox/KNotification/g? |
Indeed missing @since 5.69
To get the description, just connect to the description signal and store it, until the time you need to show the error?
src/knotificationjobuidelegate.cpp | ||
---|---|---|
33 | remove? |
src/knotificationjobuidelegate.cpp | ||
---|---|---|
25 | Not using a nested class Private but a normal separate one like here to be named KNotificationJobUiDelegatePrivate seems more simple, avoids the need for things like Q_DECL_HIDDEN. At least recently most code uses the latter, so would be good to standardize on that. |
src/knotificationjobuidelegate.h | ||
---|---|---|
59 | Using QScopedPointer or std::unique_ptr instead of raw pointer also avoids need to manually delete in destructor, also better practice these days. |
src/knotificationjobuidelegate.cpp | ||
---|---|---|
25 | I thought we wanted to migrate towards nested Private class? :0 |
src/knotificationjobuidelegate.cpp | ||
---|---|---|
25 | I don't remember any past discussion about this, but as I discovered in KIO commit 3d2330968b, nested Private classes have the problem that you can't forward-declare them elsewhere in order to make them friends of another class. What would be the arguments in favour of nested Private classes? |
To get the description, just connect to the description signal and store it, until the time you need to show the error?
Should the new app start jobs have one, maybe?
- Use QScopedPointer
- No nested private class
- Store description and use it as notification title
Is this good now? But I think I'll wait until after tagging, it's not really urgent to get it in
I'm OK with this landing into 5.69
Feel free to emit a description from the two new jobs.
Thanks,
David.
src/knotificationjobuidelegate.cpp | ||
---|---|---|
25 | Someone should update the part about the nested Private classes https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C++#Using_a_d-Pointer |