Handle privilege operation confirmation prompts in SlaveBase
ClosedPublic

Authored by chinmoyr on Feb 16 2018, 3:14 AM.

Details

Summary

This way a confirmation dialog is always shown if the application allows privilege operation.

Depends on D10567

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chinmoyr created this revision.Feb 16 2018, 3:14 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 16 2018, 3:14 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
chinmoyr requested review of this revision.Feb 16 2018, 3:14 AM
dfaure requested changes to this revision.Mar 4 2018, 10:29 AM

Just minor requests

src/core/slavebase.cpp
127

move next to the other bool (-> less padding)

518

BTW now that there are 5 duplicated lines below the //reset comment (in error and finished), it would be worth extracting a reset function...

1496

This reads like it's going to ask confirmation every time this method is called (once we are in OperationAllowed state).

The method impl uses a bool to ask only once, but that doesn't show here.

One solution is to rename the method to maybeAskConfirmation, but that's not great.
Better might be to test the bool here?

if (d->m_privilegeOperationStatus == OperationAllowed && !d->m_confirmationAsked) {
    d->m_confirmationAsked = true;
    d->m_privilegeOperationStatus = d->askConfirmation();
}

This implies a small behavior change: in your patch, if the user presses Cancel, then he might still get asked again, while in my case he wouldn't. But, unless I'm wrong, after Cancel we'll go to SlaveBase::error() which will reset both member vars anyway, right?

This revision now requires changes to proceed.Mar 4 2018, 10:29 AM
chinmoyr updated this revision to Diff 31156.Apr 2 2018, 4:47 PM
chinmoyr marked 2 inline comments as done.

Addressed David's issues.

src/core/slavebase.cpp
518

I think it will be better to have a separate commit for that.

1496

Yes, clicking cancel will reset the variables. So setting the bool here is totally fine and semantically more correct.

dfaure accepted this revision.Apr 2 2018, 7:43 PM
This revision is now accepted and ready to land.Apr 2 2018, 7:43 PM
This revision was automatically updated to reflect the committed changes.