Replace repetitive code in SettingsObjectWrapper.cpp by functions?

Berthold Stoeger bstoeger at mail.tuwien.ac.at
Sun Nov 19 04:07:28 PST 2017


Hi Dirk,

On Sonntag, 19. November 2017 01:52:10 CET Dirk Hohndel wrote:
> > On Nov 18, 2017, at 11:17 AM, Berthold Stoeger
> > <bstoeger at mail.tuwien.ac.at> wrote:
> > 1) In getCloudURL() in core/qthelper.cpp, the cloud_storate_email_encoded
> > member is set, but it seems not to be written to disk.
> 
> I looked at that code recently and am struggling with the overall logic of
> it. Right now I feel like I need to take a step back and really look at the
> overall logic of how we manage user name and password - because as I read
> the code as it is it confuses me (and I think I wrote a good part of this).

This one is not a bug, just a duplication of code issue. The reason is that 
cloud_storage_email_encoded is one of those fields that are not written to disk 
in SettingsObjectWrapper.

I guess the more consistent variant would be calling the method in 
SettingsObjectWrapper and not manipulating the pref struct directly. But I'm 
not going to meddle with this. 

> > 2) In uploadFinished() in core/cloudstorage.cpp, the
> > cloud_storage_password
> > member is set, but it likewise seems not to be written to disk.
> 
> The password we should only store if that checkbox is ticked.

This one I have no idea - I would have to test it. And I'm not going to touch 
it unless I have a reliable method of testing it. What I got so far:
- If the password changed, uploadFinished() sets the new password in prefs and 
emits the passordChangeSuccesful signal.
- This signal is connected to the passwordUpdateSuccesfull(sic) slot of 
PreferencesNetwork.
- This slot sets the cloud_storage_password widget according to the prefs 
field.
- Back in uploadFinished context(!), the finishedAuthenticate signal is raised.
- This signal is connected to the updateCloudAuthenticationState slot of 
PreferencesNetwork.
- This slot emits the settingsChanged() signal.
- Maybe(!) this signal then actually writes the password out to disk, but I 
don't see how.

Trying to understand this code I had a distinct association:
https://en.wikipedia.org/wiki/COMEFROM

Berthold


More information about the subsurface mailing list