+ connect(storage.get(), SIGNAL(dbUpgradeInProgress(bool)), this, SIGNAL(dbUpgradeInProgress(bool)));
+
+ Storage::State storageState = storage->init(settings, environment, loadFromEnvironment);
+ switch (storageState) {
+ case Storage::NeedsSetup:
+ if (!setup)
+ return false; // trigger setup process
+ if (storage->setup(settings, environment, loadFromEnvironment))
+ return initStorage(backend, settings, environment, loadFromEnvironment, false);
+ return false;
+
+ case Storage::NotAvailable:
+ if (!setup) {
+ // If initialization wasn't successful, we quit to keep from coming up unconfigured
+ throw ExitException{EXIT_FAILURE, tr("Selected storage backend %1 is not available.").arg(backend)};
+ }
+ qCritical() << "Selected storage backend is not available:" << backend;
+ return false;
+
+ case Storage::IsReady:
+ // delete all other backends
+ _registeredStorageBackends.clear();
+ connect(storage.get(), SIGNAL(bufferInfoUpdated(UserId, const BufferInfo &)),
+ this, SIGNAL(bufferInfoUpdated(UserId, const BufferInfo &)));
+ break;