[Pkg-owncloud-commits] [owncloud-client] 18/26: Rather count the blacklist items in the database.

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Dec 9 00:01:59 UTC 2013


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 046d180d2ff7e7b6ce0414a9f9095e5258f27062
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Dec 3 14:48:38 2013 +0100

    Rather count the blacklist items in the database.
    
    Use database functions to count the entries rather than trying to
    compute it from the progress items the widget got.
---
 src/mirall/protocolwidget.cpp | 18 +++++++++++++++---
 src/mirall/protocolwidget.h   |  2 ++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/mirall/protocolwidget.cpp b/src/mirall/protocolwidget.cpp
index 5cb037a..c7c882e 100644
--- a/src/mirall/protocolwidget.cpp
+++ b/src/mirall/protocolwidget.cpp
@@ -171,7 +171,6 @@ void ProtocolWidget::cleanErrorItems( const QString& folder ) // FIXME: Use the
     if( wipeList.count() > 0 ) {
         qDeleteAll(wipeList.begin(), wipeList.end());
     }
-    _clearBlacklistBtn->setEnabled(false);
 }
 
 QString ProtocolWidget::timeString(QDateTime dt, QLocale::FormatType format) const
@@ -217,7 +216,6 @@ QTreeWidgetItem *ProtocolWidget::createProblemTreewidgetItem( const Progress::Sy
         item->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem, true));
     } else {
         item->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Error, true));
-       _clearBlacklistBtn->setEnabled(true);
     }
     item->setToolTip(0, longTimeStr);
     item->setToolTip(3, errMsg );
@@ -264,14 +262,28 @@ QTreeWidgetItem* ProtocolWidget::createProgressTreewidgetItem( const Progress::I
     return item;
 }
 
+void ProtocolWidget::computeResyncButtonEnabled()
+{
+    FolderMan *folderMan = FolderMan::instance();
+    Folder::Map folders = folderMan->map();
+
+    int cnt = 0;
+    foreach( Folder *f, folders ) {
+        cnt += f->blackListEntryCount();
+    }
+    _clearBlacklistBtn->setEnabled(cnt > 0);
+
+}
+
 void ProtocolWidget::slotProgressInfo( const QString& folder, const Progress::Info& progress )
 {
     if( progress.kind == Progress::StartSync ) {
       cleanErrorItems( folder );
+      _clearBlacklistBtn->setEnabled(false);
     }
 
     if( progress.kind == Progress::EndSync ) {
-      // decorateFolderItem( folder );
+        computeResyncButtonEnabled();
     }
 
     // Ingore other events than finishing an individual up- or download.
diff --git a/src/mirall/protocolwidget.h b/src/mirall/protocolwidget.h
index db1543a..c61ec48 100644
--- a/src/mirall/protocolwidget.h
+++ b/src/mirall/protocolwidget.h
@@ -58,6 +58,8 @@ signals:
 private:
     void setSyncResultStatus(const SyncResult& result );
     void cleanErrorItems( const QString& folder );
+    void computeResyncButtonEnabled();
+
     QTreeWidgetItem* createProgressTreewidgetItem(const Progress::Info& progress );
     QTreeWidgetItem* createProblemTreewidgetItem( const Progress::SyncProblem& problem);
     QList<QTreeWidgetItem*> errorItems(const QString &folder);

-- 
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