Prompt user when KWallet is disabled
ClosedPublic

Authored by puneethchanda on Jan 27 2020, 4:14 AM.

Details

Summary

From now, when the user saves the password by clicking remember he will get a notification that the password is saved.

Diff Detail

Repository
R875 Falkon
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
puneethchanda created this revision.Jan 27 2020, 4:14 AM
Restricted Application added a subscriber: falkon. · View Herald TranscriptJan 27 2020, 4:14 AM
puneethchanda requested review of this revision.Jan 27 2020, 4:14 AM

I am against this patch.
In my eyes I expect it to just work and to not bother me.
I would welcome notification when it for some reason failed, because that would have some value for users.

I can see first thing after we release this patch is we would get bug reports asking to disable it.

sorry for this, even I thought the same but since it was discussed that it was better than nothing, I did this, if this is not good I am happy with that too.
can I close this, or do you suggest any changes?

btw thanks for confirming @SGOrava

puneethchanda retitled this revision from Show notification when the password is saved. to Prompt user when KWallet is disabled.

Sorry for making the previous patch a redundant one, I hope this one fixes the issue when KWallet is disabled,
when KWallet is disabled and password is tried to save falkon prompts the user to enable KWallet.

Sorry for making the previous patch a redundant one, I hope this one fixes the issue when KWallet is disabled,
when KWallet is disabled and password is tried to save falkon prompts the user to enable KWallet.

The same code is repeated 5 times in different places. Wouldn't it better be factored out into a single inline function/method?

@alukichev sorry, I know this is a bad mistake, will change asap and not repeat it again.
Thanks :)

created a function for showing the prompt, the previous one was full of unwanted lines

SGOrava added inline comments.Jan 27 2020, 4:20 PM
src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp
176

Here I wonder.
Why did you choose messagebox ?

src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.h
44

This should be a private function.

I actually didn't know what to use exactly and I thought that by using a message box we can also make the user click the close button in which there is a high probability that he will read. the message.

okay, I will change it to private, sorry I forgot.

If QMessage box is not suitable, I would be happy to take suggestions regarding what to use.

I am not that sure about it, you see I am more of a programmer than a designer,
iirc the messagebox will block Falkon until you press it so it is a bit annoying.
Maybe using falkon notifications sounds better.

remove QMessagebox and use desktop notifications to show notification

done @SGOrava , is this fine.

SGOrava requested changes to this revision.Jan 27 2020, 6:07 PM

Can you return original blank lines ?
The spacing between lines is there to make it easier to read.

This revision now requires changes to proceed.Jan 27 2020, 6:07 PM

fix space issue

+ as drisca suggested, it would be great to add some stopper for notifications to show only once.
You may see it as "it will show only when there is a problem", well trust him with this, there will be some users who will be spammed with notifications.
I apologize I did not thought about this.

I believe it can be done simple by new bool variable which you will check and set when showing this error message.
Showing it once is enough HE said.

src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp
24

keep this empty line, it separates includes from Qt and KDE

27

no need to add so many blank lines, one is enough

88

no need add new lines here, repeat x times

188

no need for new line

src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.h
44

keep this empty line

50

keep the empty line between methods and variables

puneethchanda marked an inline comment as done.

fix space issue.

puneethchanda marked an inline comment as done.Jan 28 2020, 11:40 AM
This comment was removed by puneethchanda.
src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp
24

I am afraid, this is already there I think SGOrava, 22, emptyline(23),24

puneethchanda marked an inline comment as done.EditedJan 28 2020, 11:44 AM

@SGOrava with the changes that I did now, the user gets a notification only when he clicks "remember", "update" etc right. I which case he will get only one notification.

I would really like to know what causes multiple notifications here, I would be happy to fix that. asking because of curiosity

That is what you think from user perspective.
But if there is ever any bug which triggers those functions without a break a 1000 times, users will be mad.

src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp
24

The empty line is not there.
look at the diff, this part should not be changed.

show notification only once.

puneethchanda added a comment.EditedJan 28 2020, 3:07 PM

@SGOrava done. This is what you suggested right.

I have tested it and it is by calling two times, but It is not showing QDBus multiple notifications error, which I saw when I tried calling two notifications.
:)

drosca requested changes to this revision.Jan 29 2020, 2:34 PM
drosca added a subscriber: drosca.
drosca added inline comments.
src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp
176

Probably should be called different name, as now it is no longer showing any "prompt".

179

Don't use global static here, instead move the static inside the function.

180

Needs to be translated (tr()) and coding style - space after comma.

183

It's a void function so there is no reason to add empty return statement at the end.

This revision now requires changes to proceed.Jan 29 2020, 2:34 PM

add translator and change name of function.

@drosca @SGOrava is there anything else I could do.

@SGOrava @drosca can you check this please.

drosca requested changes to this revision.Feb 7 2020, 2:28 PM
drosca added inline comments.
src/plugins/KDEFrameworksIntegration/kwalletpasswordbackend.cpp
25

Does this even build? Also QTranslator is not needed here.

182

QObject::tr()

This revision now requires changes to proceed.Feb 7 2020, 2:28 PM
puneethchanda marked 2 inline comments as done.

@drosca it's building and working for me,
and I changed the files according to your suggestions

drosca accepted this revision.Feb 7 2020, 5:06 PM
This revision is now accepted and ready to land.Feb 7 2020, 5:17 PM
This revision was automatically updated to reflect the committed changes.