Introduce KNotificationJobUiDelegate
Needs RevisionPublic

Authored by broulik on Thu, Mar 26, 8:27 AM.

Details

Reviewers
nicolasfella
dfaure
Group Reviewers
Frameworks
Summary

This can be used for job error reporting using KNotification rather than a KDialog.

Test Plan

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
broulik created this revision.Thu, Mar 26, 8:27 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptThu, Mar 26, 8:27 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Thu, Mar 26, 8:27 AM
nicolasfella added inline comments.Fri, Mar 27, 12:25 PM
src/knotificationjobuidelegate.h
30

s/KMessageBox/KNotification/g?

broulik updated this revision to Diff 78644.Fri, Mar 27, 1:34 PM
  • Fix docs
nicolasfella accepted this revision.Fri, Mar 27, 1:37 PM

Otherwise looks good to me

src/knotificationjobuidelegate.h
28

@since

This revision is now accepted and ready to land.Fri, Mar 27, 1:37 PM
dfaure requested changes to this revision.Sat, Mar 28, 9:28 AM

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
32

remove?

This revision now requires changes to proceed.Sat, Mar 28, 9:28 AM
kossebau added inline comments.
src/knotificationjobuidelegate.cpp
24

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.

kossebau added inline comments.Sat, Mar 28, 9:44 AM
src/knotificationjobuidelegate.h
58

Using QScopedPointer or std::unique_ptr instead of raw pointer also avoids need to manually delete in destructor, also better practice these days.