diff --git a/src/database.cpp b/src/database.cpp index d3dec5b8ea753e7cae39624cfc16782086caeb9c..e2c1b50f0aaecdca74b8bd7b3999422a9d177d9e 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -80,15 +80,25 @@ Database::Database(const QString& name, const QString& basePath) db_.setDatabaseName(databaseFullPath_); } -Database::~Database() {} +Database::~Database() +{ + close(); +} void -Database::remove() +Database::close() { - // close db and remove file + // close db if (db_.isOpen()) { db_.close(); } +} + +void +Database::remove() +{ + // close db and remove file + close(); QFile(databaseFullPath_).remove(); } diff --git a/src/database.h b/src/database.h index 7b153d513723cf1f8e90c4d2c7abc005c15316b9..6802ff55b101f09772ecb9399e4b27374b494c9e 100644 --- a/src/database.h +++ b/src/database.h @@ -60,6 +60,8 @@ public: void remove(); + void close(); + virtual void load(); /** diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp index b65c16b5c5aa92977ac7d5a5351a28b3dfd8fc21..512dffd5cf4b560fdee8110643430fdb29f1a22b 100644 --- a/src/newaccountmodel.cpp +++ b/src/newaccountmodel.cpp @@ -319,6 +319,7 @@ NewAccountModel::exportOnRing(const QString& accountId, const QString& password) void NewAccountModel::removeAccount(const QString& accountId) const { + pimpl_->accounts.erase(accountId); ConfigurationManager::instance().removeAccount(accountId); } @@ -837,7 +838,8 @@ account::Info::fromDetails(const MapStringString& details) confProperties.bootstrapListUrl = QString(details[ConfProperties::BOOTSTRAP_LIST_URL]); confProperties.dhtProxyListUrl = QString(details[ConfProperties::DHT_PROXY_LIST_URL]); confProperties.defaultModerators = QString(details[ConfProperties::DEFAULT_MODERATORS]); - confProperties.localModeratorsEnabled = toBool(details[ConfProperties::LOCAL_MODERATORS_ENABLED]); + confProperties.localModeratorsEnabled = toBool( + details[ConfProperties::LOCAL_MODERATORS_ENABLED]); // Audio confProperties.Audio.audioPortMax = toInt(details[ConfProperties::Audio::PORT_MAX]); confProperties.Audio.audioPortMin = toInt(details[ConfProperties::Audio::PORT_MIN]); @@ -1157,7 +1159,9 @@ NewAccountModel::bestIdForAccount(const QString& accountID) } void -NewAccountModel::setDefaultModerator(const QString& accountID, const QString& peerURI, const bool& state) +NewAccountModel::setDefaultModerator(const QString& accountID, + const QString& peerURI, + const bool& state) { ConfigurationManager::instance().setDefaultModerator(accountID, peerURI, state); }