Commit be2c1901 authored by Karel Slaný's avatar Karel Slaný
Browse files

Reopening database if toggling ephemeral value.

parent 218d2acc
...@@ -209,27 +209,32 @@ void Accounts::updateAccount(const QString &loginMetod, ...@@ -209,27 +209,32 @@ void Accounts::updateAccount(const QString &loginMetod,
acntData.setPassword(pwd.trimmed()); acntData.setPassword(pwd.trimmed());
acntData.setTestAccount(isTestAccount); acntData.setTestAccount(isTestAccount);
acntData.setRememberPwd(rememberPwd); acntData.setRememberPwd(rememberPwd);
#if 0
bool oldStoreToDisk = acntData.storeToDisk(); bool oldStoreToDisk = acntData.storeToDisk();
/* Reopen database if storeToDisk changed. */
if (acntData.storeToDisk() != storeToDisk) { if (acntData.storeToDisk() != storeToDisk) {
MessageDb *mDb = globMessageDbsPtr->accessMessageDb( MessageDb *mDb = globMessageDbsPtr->accessMessageDb(
globSet.dbsLocation, userName); globSet.dbsLocation, userName, oldStoreToDisk);
if (mDb != NULL) { if (mDb != NULL) {
QString mDbFileName(mDb->fileName()); QString mDbFileName(mDb->fileName());
/* Reopen database. */ /* Reopen database. */
mDb->openDb(globSet.dbsLocation, storeToDisk); globMessageDbsPtr->deleteDb(mDb);
if (!storeToDisk) { globMessageDbsPtr->accessMessageDb(globSet.dbsLocation,
userName, storeToDisk);
if (oldStoreToDisk) {
/* Delete databases from storage. */ /* Delete databases from storage. */
QFile::remove(mDbFileName); QFile::remove(mDbFileName);
} }
} }
FileDb *fDb = globFileDbsPtr->accessFileDb( FileDb *fDb = globFileDbsPtr->accessFileDb(
globSet.dbsLocation, userName); globSet.dbsLocation, userName, oldStoreToDisk);
if (fDb != NULL) { if (fDb != NULL) {
QString fDbFileName(fDb->fileName()); QString fDbFileName(fDb->fileName());
/* Reopen database. */ /* Reopen database. */
fDb->openDb(globSet.dbsLocation, storeToDisk); globFileDbsPtr->deleteDb(fDb);
if (!storeToDisk) { globFileDbsPtr->accessFileDb(globSet.dbsLocation,
userName, storeToDisk);
if (oldStoreToDisk) {
/* Delete databases from storage. */ /* Delete databases from storage. */
QFile::remove(fDbFileName); QFile::remove(fDbFileName);
} }
...@@ -238,7 +243,7 @@ void Accounts::updateAccount(const QString &loginMetod, ...@@ -238,7 +243,7 @@ void Accounts::updateAccount(const QString &loginMetod,
/* Inform the model that message counters have changed. */ /* Inform the model that message counters have changed. */
globAccountsModelPtr->updateCounters(userName, 0, 0, 0, 0); globAccountsModelPtr->updateCounters(userName, 0, 0, 0, 0);
} }
#endif
acntData.setStoreToDisk(storeToDisk); acntData.setStoreToDisk(storeToDisk);
QUrl url(certPath, QUrl::TolerantMode); QUrl url(certPath, QUrl::TolerantMode);
url.toLocalFile(); url.toLocalFile();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment