Correctly handle the webservice userid in preferences

Because of the way that the webservice userid can be saved both in the
preferences and in a data file it was treated differently than other
preferences settings - which prevented the reset of the preferences from
actually clearing it.

This patch makes sure that if the preferences are reset the preferences UI
reflects that. To make this work the data file loading functions can no
longer be allowed to just simply clear out the userid preference value
just in case they might load a new one.

Fixes #939

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-06 08:53:54 +01:00
parent e5fa424a67
commit 2e6afb8e89
4 changed files with 4 additions and 2 deletions

View file

@ -1469,7 +1469,6 @@ static int parse_settings_entry(git_repository *repo, const git_tree_entry *entr
if (!blob)
return report_error("Unable to read settings file");
set_save_userid_local(false);
set_userid("");
for_each_line(blob, settings_parser, NULL);
git_blob_free(blob);
return 0;

View file

@ -2022,7 +2022,6 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
return report_error(translate("gettextFromC", "Failed to parse '%s'"), url);
set_save_userid_local(false);
set_userid("");
reset_all();
dive_start();
doc = test_xslt_transforms(doc, params);

View file

@ -239,6 +239,7 @@ void PreferencesDialog::setUiFromPrefs()
ui.save_password_local->setChecked(prefs.save_password_local);
cloudPinNeeded();
ui.cloud_background_sync->setChecked(prefs.cloud_background_sync);
ui.default_uid->setText(prefs.userid);
// GeoManagement
#ifdef DISABLED

View file

@ -1536,6 +1536,9 @@ void loadPreferences()
prefs.cloud_git_url = strdup(qPrintable(QString(prefs.cloud_base_url) + "/git"));
s.endGroup();
// Subsurface webservice id is stored outside of the groups
GET_TXT("subsurface_webservice_uid", userid);
// GeoManagement
s.beginGroup("geocoding");
#ifdef DISABLED