[rkward-cvs] [rkward] rkward/settings: Fix adjustment of paths after installation has moved.
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Dec 1 19:18:14 UTC 2014
Git commit 05839d0de9fb1e2f786358a9491eb79f7a6cd953 by Thomas Friedrichsmeier.
Committed on 01/12/2014 at 19:00.
Pushed by tfry into branch 'master'.
Fix adjustment of paths after installation has moved.
M +9 -6 rkward/settings/rksettingsmodulegeneral.cpp
http://commits.kde.org/rkward/05839d0de9fb1e2f786358a9491eb79f7a6cd953
diff --git a/rkward/settings/rksettingsmodulegeneral.cpp b/rkward/settings/rksettingsmodulegeneral.cpp
index 51bc61e..ef84a5d 100644
--- a/rkward/settings/rksettingsmodulegeneral.cpp
+++ b/rkward/settings/rksettingsmodulegeneral.cpp
@@ -239,10 +239,9 @@ void RKSettingsModuleGeneral::loadSettings (KConfig *config) {
config_exists = config->hasGroup ("General"); // one of the very oldest groups in the config
KConfigGroup cg;
- cg = config->group ("Logfiles");
- files_path = new_files_path = checkAdjustLoadedPath (cg.readEntry ("logfile dir", QDir ().homePath () + "/.rkward/"));
-
cg = config->group ("General");
+ previous_rkward_data_dir = cg.readEntry ("last known data dir", RKCommonFunctions::getRKWardDataDir ());
+ installation_moved = (previous_rkward_data_dir != RKCommonFunctions::getRKWardDataDir ()) && !previous_rkward_data_dir.isEmpty ();
startup_action = (StartupDialog::Result) cg.readEntry ("startup action", (int) StartupDialog::NoSavedSetting);
show_help_on_startup = cg.readEntry ("show help on startup", true);
initial_dir = (InitialDirectory) cg.readEntry ("initial dir mode",
@@ -253,8 +252,9 @@ void RKSettingsModuleGeneral::loadSettings (KConfig *config) {
#endif
);
initial_dir_specification = checkAdjustLoadedPath (cg.readEntry ("initial dir spec", QString ()));
- previous_rkward_data_dir = cg.readEntry ("last known data dir", RKCommonFunctions::getRKWardDataDir ());
- installation_moved = (previous_rkward_data_dir != RKCommonFunctions::getRKWardDataDir ()) && !previous_rkward_data_dir.isEmpty ();
+
+ cg = config->group ("Logfiles");
+ files_path = new_files_path = checkAdjustLoadedPath (cg.readEntry ("logfile dir", QDir ().homePath () + "/.rkward/"));
cg = config->group ("Workplace");
workplace_save_mode = (WorkplaceSaveMode) cg.readEntry ("save mode", (int) SaveWorkplaceWithWorkspace);
@@ -291,7 +291,10 @@ QString RKSettingsModuleGeneral::checkAdjustLoadedPath (const QString& localpath
if (!installation_moved) return localpath;
bool is_parent; // old data path is parent of given path
QString adjusted = KUrl::relativePath (previous_rkward_data_dir, localpath, &is_parent);
- if (is_parent) return adjusted;
+ if (is_parent) {
+ QDir new_data_dir (RKCommonFunctions::getRKWardDataDir ());
+ return QDir::cleanPath (new_data_dir.absoluteFilePath (adjusted));
+ }
return localpath;
}
More information about the rkward-tracker
mailing list