[Pkg-owncloud-commits] [owncloud-client] 17/26: Add blackListEntryCount method.

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Dec 9 00:01:58 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 278e76b774dc6e6e7bc4ed06d9aef4d2f4371be6
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Dec 3 14:47:32 2013 +0100

    Add blackListEntryCount method.
---
 src/mirall/folder.cpp        |  5 +++++
 src/mirall/folder.h          |  1 +
 src/mirall/syncjournaldb.cpp | 18 ++++++++++++++++++
 src/mirall/syncjournaldb.h   |  2 ++
 4 files changed, 26 insertions(+)

diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 7b64b1d..715922d 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -416,6 +416,11 @@ void Folder::createGuiLog( const QString& filename, const QString& verb, int cou
     }
 }
 
+int Folder::blackListEntryCount()
+{
+    return _journal.blackListEntryCount();
+}
+
 int Folder::slotWipeBlacklist()
 {
     return _journal.wipeBlacklist();
diff --git a/src/mirall/folder.h b/src/mirall/folder.h
index 769a145..72eaab1 100644
--- a/src/mirall/folder.h
+++ b/src/mirall/folder.h
@@ -168,6 +168,7 @@ public slots:
       bool proxyDirty();
 
       int slotWipeBlacklist();
+      int blackListEntryCount();
 
 private slots:
     void slotCSyncStarted();
diff --git a/src/mirall/syncjournaldb.cpp b/src/mirall/syncjournaldb.cpp
index cd779b4..2b9558e 100644
--- a/src/mirall/syncjournaldb.cpp
+++ b/src/mirall/syncjournaldb.cpp
@@ -677,6 +677,23 @@ SyncJournalBlacklistRecord SyncJournalDb::blacklistEntry( const QString& file )
     return entry;
 }
 
+int SyncJournalDb::blackListEntryCount()
+{
+    int re = 0;
+
+    QMutexLocker locker(&_mutex);
+    if( checkConnect() ) {
+        QSqlQuery query(_db);
+        if( ! query.exec("SELECT count(*) FROM blacklist WHERE retrycount >= 0") ) {
+            sqlFail("Count number of blacklist entries failed", query);
+        }
+        if( query.next() ) {
+            re = query.value(0).toInt();
+        }
+    }
+    return re;
+}
+
 int SyncJournalDb::wipeBlacklist()
 {
     QMutexLocker locker(&_mutex);
@@ -687,6 +704,7 @@ int SyncJournalDb::wipeBlacklist()
 
         if( ! query.exec() ) {
             sqlFail("Deletion of whole blacklist failed", query);
+            return -1;
         }
         return query.numRowsAffected();
     }
diff --git a/src/mirall/syncjournaldb.h b/src/mirall/syncjournaldb.h
index fffb224..35d255a 100644
--- a/src/mirall/syncjournaldb.h
+++ b/src/mirall/syncjournaldb.h
@@ -36,9 +36,11 @@ public:
     bool deleteFileRecord( const QString& filename, bool recursively = false );
     int getFileRecordCount();
     bool exists();
+
     void updateBlacklistEntry( const SyncJournalBlacklistRecord& item );
     void wipeBlacklistEntry(const QString& file);
     int wipeBlacklist();
+    int blackListEntryCount();
 
     struct DownloadInfo {
         DownloadInfo() : _errorCount(0), _valid(false) {}

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