void EditLocallyJob::startSyncBeforeOpening()
{
- eraseBlacklistRecordForItem();
+ if (!eraseBlacklistRecordForItem()) {
+ showError(tr("Could not start editing locally."),
+ tr("An error occurred trying to synchronise the file to edit locally."));
+ return;
+ }
+
if (!checkIfFileParentSyncIsNeeded()) {
processLocalItem();
return;
FolderMan::instance()->forceSyncForFolder(_folderForFile);
}
-void EditLocallyJob::eraseBlacklistRecordForItem()
+bool EditLocallyJob::eraseBlacklistRecordForItem()
{
if (!_folderForFile || !_fileParentItem) {
qCWarning(lcEditLocallyJob) << "_folderForFile or _fileParentItem is invalid!";
- return;
+ return false;
}
+
Q_ASSERT(!_folderForFile->isSyncRunning());
if (_folderForFile->isSyncRunning()) {
qCWarning(lcEditLocallyJob) << "_folderForFile is syncing";
- return;
+ return false;
}
+
if (_folderForFile->journalDb()->errorBlacklistEntry(_fileParentItem->_file).isValid()) {
_folderForFile->journalDb()->wipeErrorBlacklistEntry(_fileParentItem->_file);
}
+
+ return true;
}
const QString EditLocallyJob::getRelativePathToRemoteRootForFile() const
private slots:
void fetchRemoteFileParentInfo();
void startSyncBeforeOpening();
- void eraseBlacklistRecordForItem();
void startTokenRemoteCheck();
void proceedWithSetup();
private:
[[nodiscard]] bool checkIfFileParentSyncIsNeeded(); // returns true if sync will be needed, false otherwise
+ [[nodiscard]] bool eraseBlacklistRecordForItem();
[[nodiscard]] const QString getRelativePathToRemoteRootForFile() const; // returns either '/' or a (relative path - Folder::remotePath()) for folders pointing to a non-root remote path e.g. '/subfolder' instead of '/'
[[nodiscard]] const QString getRelativePathParent() const;