Fixed #68.
This commit is contained in:
parent
a8ca78d880
commit
9b916e1dbd
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Fully portable settings is now used as default if non portable settings does not exist yet.</li>
|
||||||
<li>List of actions in toolbar editor now does not allow copying of items.</li>
|
<li>List of actions in toolbar editor now does not allow copying of items.</li>
|
||||||
<li>Keyboard search for message list should now work with Qt 4.</li>
|
<li>Keyboard search for message list should now work with Qt 4.</li>
|
||||||
<li>Overall code cleanups and refactoring primarily in area of feed/message models and recycle bin functionality.</li>
|
<li>Overall code cleanups and refactoring primarily in area of feed/message models and recycle bin functionality.</li>
|
||||||
|
@ -48,43 +48,43 @@ Settings *Settings::setupSettings(QObject *parent) {
|
|||||||
// If settings file exists in executable file working directory
|
// If settings file exists in executable file working directory
|
||||||
// (in subdirectory APP_CFG_PATH), then use it (portable settings).
|
// (in subdirectory APP_CFG_PATH), then use it (portable settings).
|
||||||
// Otherwise use settings file stored in homePath();
|
// Otherwise use settings file stored in homePath();
|
||||||
QString relative_path = QDir::separator() + QString(APP_CFG_PATH) +
|
QString relative_path = QDir::separator() + QString(APP_CFG_PATH) + QDir::separator() + QString(APP_CFG_FILE);
|
||||||
QDir::separator() + QString(APP_CFG_FILE);
|
|
||||||
|
|
||||||
QString app_path = qApp->applicationDirPath();
|
QString app_path = qApp->applicationDirPath();
|
||||||
QString app_path_file = app_path + relative_path;
|
QString app_path_file = app_path + relative_path;
|
||||||
|
QString home_path = QDir::homePath() + QDir::separator() + QString(APP_LOW_H_NAME);
|
||||||
|
QString home_path_file = home_path + relative_path;
|
||||||
|
|
||||||
|
|
||||||
|
bool portable_settings_available = QFileInfo(app_path).isWritable();
|
||||||
|
bool non_portable_settings_exist = QFile::exists(home_path_file);
|
||||||
|
|
||||||
|
// We will use PORTABLE settings only and only if it is available and NON-PORTABLE
|
||||||
|
// settings was not initialized before.
|
||||||
|
bool will_we_use_portable_settings = portable_settings_available && !non_portable_settings_exist;
|
||||||
|
|
||||||
// Check if portable settings are available.
|
// Check if portable settings are available.
|
||||||
if (QFile(app_path_file).exists()) {
|
if (will_we_use_portable_settings) {
|
||||||
// Portable settings are available, use them.
|
// Portable settings are available, use them.
|
||||||
new_settings = new Settings(app_path_file, QSettings::IniFormat,
|
new_settings = new Settings(app_path_file, QSettings::IniFormat, Settings::Portable, parent);
|
||||||
Settings::Portable, parent);
|
|
||||||
|
|
||||||
// Construct icon cache in the same path.
|
// Construct icon cache in the same path.
|
||||||
QString web_path = app_path + QDir::separator() + QString(APP_DB_WEB_PATH);
|
QString web_path = app_path + QDir::separator() + QString(APP_DB_WEB_PATH);
|
||||||
QDir(web_path).mkpath(web_path);
|
QDir(web_path).mkpath(web_path);
|
||||||
QWebSettings::setIconDatabasePath(web_path);
|
QWebSettings::setIconDatabasePath(web_path);
|
||||||
|
|
||||||
qDebug("Initializing settings in '%s' (portable way).",
|
qDebug("Initializing settings in '%s' (portable way).", qPrintable(QDir::toNativeSeparators(app_path_file)));
|
||||||
qPrintable(QDir::toNativeSeparators(app_path_file)));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Portable settings are NOT available, store them in
|
// Portable settings are NOT available, store them in
|
||||||
// user's home directory.
|
// user's home directory.
|
||||||
QString home_path = QDir::homePath() + QDir::separator() +
|
new_settings = new Settings(home_path_file, QSettings::IniFormat, Settings::NonPortable, parent);
|
||||||
QString(APP_LOW_H_NAME);
|
|
||||||
QString home_path_file = home_path + relative_path;
|
|
||||||
|
|
||||||
new_settings = new Settings(home_path_file, QSettings::IniFormat,
|
|
||||||
Settings::NonPortable, parent);
|
|
||||||
|
|
||||||
// Construct icon cache in the same path.
|
// Construct icon cache in the same path.
|
||||||
QString web_path = home_path + QDir::separator() + QString(APP_DB_WEB_PATH);
|
QString web_path = home_path + QDir::separator() + QString(APP_DB_WEB_PATH);
|
||||||
QDir(web_path).mkpath(web_path);
|
QDir(web_path).mkpath(web_path);
|
||||||
QWebSettings::setIconDatabasePath(web_path);
|
QWebSettings::setIconDatabasePath(web_path);
|
||||||
|
|
||||||
qDebug("Initializing settings in '%s' (non-portable way).",
|
qDebug("Initializing settings in '%s' (non-portable way).", qPrintable(QDir::toNativeSeparators(home_path_file)));
|
||||||
qPrintable(QDir::toNativeSeparators(home_path_file)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_settings;
|
return new_settings;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user