Add KDialogJobUiDelegate(KJobUiDelegate::Flags) constructor
ClosedPublic

Authored by dfaure on Apr 11 2020, 11:06 AM.

Details

Summary

Requires: D28741

Test Plan

Ported kruntest to ApplicationLauncherJob, used this constructor, works.

Diff Detail

Repository
R288 KJobWidgets
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25071
Build 25089: arc lint + arc unit
dfaure created this revision.Apr 11 2020, 11:06 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 11 2020, 11:06 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
dfaure requested review of this revision.Apr 11 2020, 11:06 AM
ervin accepted this revision.Apr 11 2020, 1:38 PM
This revision is now accepted and ready to land.Apr 11 2020, 1:38 PM
kossebau added inline comments.
src/kdialogjobuidelegate.h
51

Why no explicit?

dfaure marked an inline comment as done.Apr 11 2020, 1:49 PM
dfaure added inline comments.
src/kdialogjobuidelegate.h
51

good point

dfaure updated this revision to Diff 79840.Apr 11 2020, 1:50 PM
dfaure marked an inline comment as done.

explicit

ervin accepted this revision.Apr 11 2020, 2:18 PM
dfaure updated this revision to Diff 79848.Apr 11 2020, 2:21 PM

Add QWidget *window parameter. Even better, no?

Needed for dialog boxes to respect stacking order, centering to parent, focus going back to parent after closing...

ervin accepted this revision.Apr 11 2020, 2:36 PM

Indeed, good point.

window parameter wants API dox mentioning, though. And perhaps could be defaulted to nullptr, for use-cases which do not have a window at hand and are fine with any default?

dfaure updated this revision to Diff 79857.Apr 11 2020, 2:42 PM

Expand docs about the associated window

window parameter wants API dox mentioning, though.

Oops, I thought I did that. Fixed.

And perhaps could be defaulted to nullptr, for use-cases which do not have a window at hand and are fine with any default?

I've been wondering. But people tend to forget to do so, and in most cases, if we choose the dialog delegate, then there's a QWidget based window somewhere.
Plasma uses KNotificationJobUiDelegate so it's not a problem here.
My thinking is that I'd rather force people to think about it, and possibly pass a nullptr in case there's really no window around.

ervin added a comment.Apr 11 2020, 2:58 PM

And perhaps could be defaulted to nullptr, for use-cases which do not have a window at hand and are fine with any default?

I've been wondering. But people tend to forget to do so, and in most cases, if we choose the dialog delegate, then there's a QWidget based window somewhere.
Plasma uses KNotificationJobUiDelegate so it's not a problem here.
My thinking is that I'd rather force people to think about it, and possibly pass a nullptr in case there's really no window around.

+1, I don't think defaulting to nullptr is a good idea.

ervin accepted this revision.Apr 11 2020, 2:59 PM

Not into details, so if there is no sane default, forcing developers to pass something sane here make sense
Second thought I also had was avoiding code which uses nullptr as arguments, which harms humans reading code a bit as in, "nullptr of what?!!" (compare boolean flags) ;)

ervin added a comment.Apr 11 2020, 3:24 PM

Agreed, nullptr is going to be the boolean flag of our time, before it was 0 though, so still an improvement. ;-)

More seriously, here I'm not sure how to avoid it, at least it's a case of "if you feel like passing nullptr here you might be doing something wrong".

dfaure closed this revision.Apr 11 2020, 3:27 PM

(nullptr used as arguments always make me consider finally working on a patch to add to normal kdevelop the feature "Show argument names at call site" like demoed here among other things: https://kate-editor.org/wp-content/uploads/2018/08/inline-note-anim.gif so far hoped someone else would do it, but seems it is time to help myself possibly)