[Pkg-owncloud-commits] [owncloud-client] 236/498: FolderStatusModel: Always update on sync state change.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit ba613a152aa56afa9fd29b68d17f3cff4c94f8d9
Author: Christian Kamm <kamm at incasoftware.de>
Date: Thu Jul 2 13:50:13 2015 +0200
FolderStatusModel: Always update on sync state change.
Previously the icon and progress report could easily get
somewhat stale and go out of sync with the tray icon.
---
src/gui/folderstatusmodel.cpp | 25 ++++++-------------------
src/gui/folderstatusmodel.h | 1 -
2 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 8b654a1..23d7bd7 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -689,20 +689,11 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
emit dataChanged(index(folderIndex), index(folderIndex), roles);
}
-void FolderStatusModel::slotHideProgress()
-{
- auto folderIndex = sender()->property("owncloud_folderIndex").toInt();
- if (folderIndex < 0 || _folders.size() <= folderIndex) { return; }
-
- _folders[folderIndex]._progress = SubFolderInfo::Progress();
- emit dataChanged(index(folderIndex), index(folderIndex),
- QVector<int>() << FolderStatusDelegate::AddProgressSpace);
-}
-
void FolderStatusModel::slotFolderSyncStateChange()
{
Folder *f = qobject_cast<Folder*>(sender());
if( !f ) { return; }
+
int folderIndex = -1;
for (int i = 0; i < _folders.count(); ++i) {
if (_folders.at(i)._folder == f) {
@@ -715,16 +706,12 @@ void FolderStatusModel::slotFolderSyncStateChange()
SyncResult::Status state = f->syncResult().status();
if (state == SyncResult::SyncPrepare) {
_folders[folderIndex]._progress = SubFolderInfo::Progress();
- } else if (state == SyncResult::Success || state == SyncResult::Problem) {
- // start a timer to stop the progress display
- QTimer *timer;
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(slotHideProgress()));
- connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
- timer->setSingleShot(true);
- timer->setProperty("owncloud_folderIndex", folderIndex);
- timer->start(5000);
+ } else if (state == SyncResult::Error) {
+ _folders[folderIndex]._progress._progressString = f->syncResult().errorString();
}
+
+ // update the icon etc. now
+ slotUpdateFolderState(f);
}
void FolderStatusModel::resetFolders()
diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h
index 6836849..9fd4b60 100644
--- a/src/gui/folderstatusmodel.h
+++ b/src/gui/folderstatusmodel.h
@@ -94,7 +94,6 @@ public slots:
private slots:
void slotUpdateDirectories(const QStringList &);
- void slotHideProgress();
void slotFolderSyncStateChange();
void slotLscolFinishedWithError(QNetworkReply *r);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list