diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-07-06 13:53:57 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2022-07-06 19:57:04 +0300 |
commit | 97a9c9380185a8661c99d483e2370c8c9bb1fe3c (patch) | |
tree | 454669a0013da23a6910616b4d72351171357e18 /src | |
parent | 61ccccb8ca083d2178a5c5be905a1d920af19d12 (diff) |
Timeout needs to be on a folder level
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/folderstatusmodel.cpp | 16 | ||||
-rw-r--r-- | src/gui/folderstatusmodel.h | 6 | ||||
-rw-r--r-- | src/libsync/progressdispatcher.h | 1 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 4a47d03b4..4f0ac6515 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -13,15 +13,16 @@ */ #include "folderstatusmodel.h" -#include "folderman.h" +#include "account.h" #include "accountstate.h" #include "common/asserts.h" -#include <theme.h> -#include <account.h> +#include "folderman.h" #include "folderstatusdelegate.h" +#include "theme.h" #include <QFileIconProvider> #include <QVarLengthArray> + #include <set> using namespace std::chrono_literals; @@ -892,8 +893,9 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress, Folder *f) if (folderIndex < 0) { return; } + auto &folder = _folders[folderIndex]; - auto *pi = &_folders[folderIndex]._progress; + auto *pi = &folder._progress; const QVector<int> roles = { FolderStatusDelegate::SyncProgressItemString, FolderStatusDelegate::WarningCount, Qt::ToolTipRole }; @@ -909,7 +911,7 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress, Folder *f) pi->_overallSyncString = tr("Reconciling changes"); emit dataChanged(index(folderIndex), index(folderIndex), roles); } else { - // Status is Starting, Propagation or Done + // Status is Propagation or Done if (!progress._lastCompletedItem.isEmpty() && Progress::isWarningKind(progress._lastCompletedItem._status)) { @@ -917,9 +919,9 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress, Folder *f) } // progress updates are expensive, throtle them - if (std::chrono::steady_clock::now() - _lastProgressUpdated > progressUpdateTimeOutC) { + if (std::chrono::steady_clock::now() - folder._lastProgressUpdated > progressUpdateTimeOutC) { computeProgress(progress, pi); - _lastProgressUpdated = std::chrono::steady_clock::now(); + folder._lastProgressUpdated = std::chrono::steady_clock::now(); emit dataChanged(index(folderIndex), index(folderIndex), roles); } } diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h index 4a88e27c4..09f67eb9a 100644 --- a/src/gui/folderstatusmodel.h +++ b/src/gui/folderstatusmodel.h @@ -15,7 +15,8 @@ #ifndef FOLDERSTATUSMODEL_H #define FOLDERSTATUSMODEL_H -#include <accountfwd.h> +#include "accountfwd.h" + #include <QAbstractItemModel> #include <QLoggingCategory> #include <QVector> @@ -110,6 +111,8 @@ public: int _overallPercent; }; Progress _progress; + + std::chrono::steady_clock::time_point _lastProgressUpdated = std::chrono::steady_clock::now(); }; QVector<SubFolderInfo> _folders; @@ -160,7 +163,6 @@ private: const AccountState *_accountState; bool _dirty; // If the selective sync checkboxes were changed - std::chrono::steady_clock::time_point _lastProgressUpdated = std::chrono::steady_clock::now(); /** * Keeps track of items that are fetching data from the server. diff --git a/src/libsync/progressdispatcher.h b/src/libsync/progressdispatcher.h index 933a2cff0..a94ec1798 100644 --- a/src/libsync/progressdispatcher.h +++ b/src/libsync/progressdispatcher.h @@ -68,6 +68,7 @@ public: */ Done }; + Q_ENUM(Status); Status status() const; |