summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences/preferences_language.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-09-02 15:28:40 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-04 07:41:21 -0700
commita7d8e0d18748fdf72f5d43cceec945c6add74294 (patch)
tree49c79dc55e307643d0442435e8151619d90c8cbc /desktop-widgets/preferences/preferences_language.cpp
parent9a2d503d3b3d2c0a4631ef6c26dcf1c6785a4e56 (diff)
downloadsubsurface-a7d8e0d18748fdf72f5d43cceec945c6add74294.tar.gz
googlemaps: clear the cache folder on language change
Open the cache folder via QDir and call removeRecursively(). At that point the user needs to restart Subsurface to be able to use the map in another language properly. This change is triggered by the fact that the user might want to see the street map in his preferred language after he/she picks another language from Settings. But one problem here is that the cached files do not carry a language flag - e.g. they are in the lines of: googlemaps_100-1-9-445-245.png Which means that the only way to not mix tiles in different languages is to clear the cache and start downloading the new tiles in the newly picked language after Subsurface has restarted. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'desktop-widgets/preferences/preferences_language.cpp')
-rw-r--r--desktop-widgets/preferences/preferences_language.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp
index 387d55ea0..7f49e0106 100644
--- a/desktop-widgets/preferences/preferences_language.cpp
+++ b/desktop-widgets/preferences/preferences_language.cpp
@@ -51,6 +51,10 @@ void PreferencesLanguage::syncSettings()
if (useSystemLang != ui->languageSystemDefault->isChecked() ||
(!useSystemLang && currentText != prefs.locale.language)) {
+ // remove the marble cache folder on language change
+ QDir googlecachedir(QString(system_default_directory()).append("/googlemaps"));
+ googlecachedir.removeRecursively();
+
QMessageBox::warning(this, tr("Restart required"),
tr("To correctly load a new language you must restart Subsurface."));
}