diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-09-21 17:50:56 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-09-22 15:47:46 +0300 |
commit | 2091a668fbfab3c5354830f28e1391d43e1978fd (patch) | |
tree | c44b51ef99c89e4de1e9ef43ddde2134486fc039 /src/gui/folder.cpp | |
parent | 7d9e5082b1e5cf501c9e1ad95d1562740c2cb106 (diff) |
Improve error handling during vfs setup
Diffstat (limited to 'src/gui/folder.cpp')
-rw-r--r-- | src/gui/folder.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 33f531d17..fb0560b72 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -299,7 +299,7 @@ bool Folder::canSync() const bool Folder::ok() const { - return _syncResult.status() != SyncResult::SetupError; + return _vfsIsReady; } bool Folder::dueToSync() const @@ -523,7 +523,8 @@ void Folder::startVfs() vfsParams.remotePath = remotePathTrailingSlash(); vfsParams.account = _accountState->account(); vfsParams.journal = &_journal; - vfsParams.providerName = Theme::instance()->appNameGUI(); + vfsParams.providerDisplayName = Theme::instance()->appNameGUI(); + vfsParams.providerName = Theme::instance()->appName(); vfsParams.providerVersion = Theme::instance()->version(); vfsParams.multipleAccountsRegistered = AccountManager::instance()->accounts().size() > 1; @@ -535,12 +536,20 @@ void Folder::startVfs() _vfs->start(vfsParams); - // Immediately mark the sqlite temporaries as excluded. They get recreated - // on db-open and need to get marked again every time. - QString stateDbFile = _journal.databaseFilePath(); - _journal.open(); - _vfs->fileStatusChanged(stateDbFile + "-wal", SyncFileStatus::StatusExcluded); - _vfs->fileStatusChanged(stateDbFile + "-shm", SyncFileStatus::StatusExcluded); + connect(_vfs.data(), &Vfs::started, this, [this] { + // Immediately mark the sqlite temporaries as excluded. They get recreated + // on db-open and need to get marked again every time. + QString stateDbFile = _journal.databaseFilePath(); + _journal.open(); + _vfs->fileStatusChanged(stateDbFile + QStringLiteral("-wal"), SyncFileStatus::StatusExcluded); + _vfs->fileStatusChanged(stateDbFile + QStringLiteral("-shm"), SyncFileStatus::StatusExcluded); + _vfsIsReady = true; + }); + connect(_vfs.data(), &Vfs::error, this, [this](const QString &error) { + _syncResult.appendErrorString(error); + _syncResult.setStatus(SyncResult::SetupError); + _vfsIsReady = false; + }); } int Folder::slotDiscardDownloadProgress() |