Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-09-24 11:50:29 +0300
committerHannah von Reth <vonreth@kde.org>2021-09-27 09:44:55 +0300
commitcf06a96255d1a82575bf1931a12127d3e88d04c1 (patch)
tree96909a5456bb520db347e8593d744e97429ef128
parentde7e0093ec07117d86a1d5f3b95df763a4c770db (diff)
Cleanup and some assrts to ensure assumptions
-rw-r--r--src/gui/accountsettings.cpp4
-rw-r--r--src/gui/folder.cpp14
-rw-r--r--src/gui/folder.h8
-rw-r--r--src/gui/folderman.cpp7
-rw-r--r--src/gui/folderstatusmodel.cpp4
-rw-r--r--src/gui/selectivesyncdialog.cpp2
-rw-r--r--src/libsync/discoveryphase.cpp2
7 files changed, 15 insertions, 26 deletions
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 2cffeba70..20e5b8342 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -711,7 +711,7 @@ void AccountSettings::slotEnableCurrentFolder(bool terminate)
currentlyPaused = f->syncPaused();
if (!currentlyPaused && !terminate) {
// check if a sync is still running and if so, ask if we should terminate.
- if (f->isBusy()) { // its still running
+ if (f->isSyncRunning()) { // its still running
auto msgbox = new QMessageBox(QMessageBox::Question, tr("Sync Running"),
tr("The syncing operation is running.<br/>Do you want to terminate it?"),
QMessageBox::Yes | QMessageBox::No, this);
@@ -727,7 +727,7 @@ void AccountSettings::slotEnableCurrentFolder(bool terminate)
// message box can return at any time while the thread keeps running,
// so better check again after the user has responded.
- if (f->isBusy() && terminate) {
+ if (f->isSyncRunning() && terminate) {
f->slotTerminateSync();
}
f->setSyncPaused(!currentlyPaused);
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index fb1345af5..6df1e5f6f 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -259,11 +259,6 @@ QString Folder::cleanPath() const
return cleanedPath;
}
-bool Folder::isBusy() const
-{
- return isSyncRunning();
-}
-
bool Folder::isSyncRunning() const
{
return _engine->isSyncRunning() || _vfs->isHydrating();
@@ -305,7 +300,7 @@ bool Folder::ok() const
bool Folder::dueToSync() const
{
// conditions taken from previous folderman implementation
- if (isSyncRunning() || etagJob() || isBusy() || !canSync()) {
+ if (isSyncRunning() || etagJob() || !canSync()) {
return false;
}
@@ -835,11 +830,12 @@ bool Folder::reloadExcludes()
return _engine->excludedFiles().reloadExcludeFiles();
}
-void Folder::startSync(const QStringList &pathList)
+void Folder::startSync()
{
- Q_UNUSED(pathList)
+ Q_ASSERT(ok());
+ Q_ASSERT(_folderWatcher);
- if (isBusy()) {
+ if (!OC_ENSURE(!isSyncRunning())) {
qCCritical(lcFolder) << "ERROR csync is still running and new sync requested.";
return;
}
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 9a02d4147..8e798a760 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -195,12 +195,6 @@ public:
void prepareToSync();
- /**
- * True if the folder is busy and can't initiate
- * a synchronization
- */
- virtual bool isBusy() const;
-
/** True if the folder is currently synchronizing */
bool isSyncRunning() const;
@@ -337,7 +331,7 @@ public slots:
*
* If the list of changed files is known, it is passed.
*/
- void startSync(const QStringList &pathList = QStringList());
+ void startSync();
int slotDiscardDownloadProgress();
int downloadInfoCount();
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index f3a2ac8ff..73a5caf9d 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -653,8 +653,7 @@ void FolderMan::slotSyncOnceFileUnlocks(const QString &path, FileSystem::LockMod
*/
void FolderMan::scheduleFolder(Folder *f)
{
- if (!f) {
- qCCritical(lcFolderMan) << "slotScheduleSync called with null folder";
+ if (!OC_ENSURE(f)) {
return;
}
auto alias = f->alias();
@@ -876,7 +875,7 @@ void FolderMan::slotStartScheduledFolderSync()
registerFolderWithSocketApi(folder);
_currentSyncFolder = folder;
- folder->startSync(QStringList());
+ folder->startSync();
}
}
@@ -1302,7 +1301,7 @@ void FolderMan::setDirtyNetworkLimits()
{
for (auto *f : qAsConst(_folderMap)) {
// set only in busy folders. Otherwise they read the config anyway.
- if (f && f->isBusy()) {
+ if (f && f->isSyncRunning()) {
f->setDirtyNetworkLimits();
}
}
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 0d2d13cb2..50ffe327d 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -841,7 +841,7 @@ void FolderStatusModel::slotApplySelectiveSync()
// do the sync if there were changes
const auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
if (!changes.isEmpty()) {
- if (folder->isBusy()) {
+ if (folder->isSyncRunning()) {
folder->slotTerminateSync();
}
//The part that changed should not be read from the DB on next sync because there might be new folders
@@ -1154,7 +1154,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders()
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
// Trigger a sync
- if (folder->isBusy()) {
+ if (folder->isSyncRunning()) {
folder->slotTerminateSync();
}
// The part that changed should not be read from the DB on next sync because there might be new folders
diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp
index 338ce4726..e16091862 100644
--- a/src/gui/selectivesyncdialog.cpp
+++ b/src/gui/selectivesyncdialog.cpp
@@ -463,7 +463,7 @@ void SelectiveSyncDialog::accept()
_folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
FolderMan *folderMan = FolderMan::instance();
- if (_folder->isBusy()) {
+ if (_folder->isSyncRunning()) {
_folder->slotTerminateSync();
}
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index 41fa78e29..2a6c40071 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -260,7 +260,7 @@ void DiscoverySingleLocalDirectoryJob::run() {
auto dh = csync_vio_local_opendir(localPath);
if (!dh) {
- qCInfo(lcDiscovery) << "Error while opening directory" << (localPath) << errno;
+ qCCritical(lcDiscovery) << "Error while opening directory" << (localPath) << errno;
QString errorString = tr("Error while opening directory %1").arg(localPath);
if (errno == EACCES) {
errorString = tr("Directory not accessible on client, permission denied");