X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=ad9eab8586ea239bb7e2f6c0c63c10589f762de7;hp=dadd70a42a3bf25268315cb59202d638d6f53a0d;hb=10e6f4629e39c66cfb8db6ab2806bf8f13ec700b;hpb=424eddc71def51d22ec9f19d6a57c06af0d25295 diff --git a/src/core/core.cpp b/src/core/core.cpp index dadd70a4..ad9eab85 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -299,7 +299,9 @@ QString Core::setupCore(const QString &adminUser, const QString &adminPassword, return tr("Could not setup storage!"); } - saveBackendSettings(backend, setupData); + if (!saveBackendSettings(backend, setupData)) { + return tr("Could not save backend settings, probably a permission problem."); + } quInfo() << qPrintable(tr("Creating admin user...")); _storage->addUser(adminUser, adminPassword); @@ -705,7 +707,9 @@ bool Core::selectBackend(const QString &backend) Storage::State storageState = storage->init(settings); switch (storageState) { case Storage::IsReady: - saveBackendSettings(backend, settings); + if (!saveBackendSettings(backend, settings)) { + qCritical() << qPrintable(QString("Could not save backend settings, probably a permission problem.")); + } qWarning() << "Switched backend to:" << qPrintable(backend); qWarning() << "Backend already initialized. Skipping Migration"; return true; @@ -723,7 +727,9 @@ bool Core::selectBackend(const QString &backend) return false; } - saveBackendSettings(backend, settings); + if (!saveBackendSettings(backend, settings)) { + qCritical() << qPrintable(QString("Could not save backend settings, probably a permission problem.")); + } qWarning() << "Switched backend to:" << qPrintable(backend); break; } @@ -739,7 +745,10 @@ bool Core::selectBackend(const QString &backend) storage = 0; if (reader->migrateTo(writer)) { qDebug() << "Migration finished!"; - saveBackendSettings(backend, settings); + if (!saveBackendSettings(backend, settings)) { + qCritical() << qPrintable(QString("Could not save backend settings, probably a permission problem.")); + return false; + } return true; } return false; @@ -886,12 +895,14 @@ AbstractSqlMigrationWriter *Core::getMigrationWriter(Storage *storage) } -void Core::saveBackendSettings(const QString &backend, const QVariantMap &settings) +bool Core::saveBackendSettings(const QString &backend, const QVariantMap &settings) { QVariantMap dbsettings; dbsettings["Backend"] = backend; dbsettings["ConnectionProperties"] = settings; - CoreSettings().setStorageSettings(dbsettings); + CoreSettings s = CoreSettings(); + s.setStorageSettings(dbsettings); + return s.sync(); }