[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/akonadi/libakonadi
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2008-03-08 18:07:12
Message-ID: 1204999632.390165.3175.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 783564 by toma:

Introduce a signal which emits the total unread count. The current way is temp, it \
needs to be expanded to show the total unread count per folder, including the \
children, and simply count the top level unread counts.


 M  +13 -0     collectionmodel.cpp  
 M  +6 -0      collectionmodel.h  


--- trunk/KDE/kdepim/akonadi/libakonadi/collectionmodel.cpp #783563:783564
@@ -153,6 +153,19 @@
     QModelIndex startIndex = mParent->indexForId( col.id() );
     QModelIndex endIndex = mParent->indexForId( col.id(), mParent->columnCount( \
mParent->parent( startIndex ) ) - 1 );  emit mParent->dataChanged( startIndex, \
endIndex ); +
+    // Unread total might have changed now.
+    static int oldTotalUnread = -1;
+    int totalUnread = 0;
+    foreach ( const Collection& col, collections.values() ) {
+      int colUnread = col.status().unreadCount();
+      if ( colUnread > 0 )
+          totalUnread += colUnread;
+    }
+    if ( oldTotalUnread != totalUnread ) {
+        emit mParent->unreadCountChanged( totalUnread );
+        oldTotalUnread = totalUnread;
+    }
   }
 }
 
--- trunk/KDE/kdepim/akonadi/libakonadi/collectionmodel.h #783563:783564
@@ -123,6 +123,12 @@
     */
     virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int \
row, int column, const QModelIndex &parent );  
+  Q_SIGNALS:
+    /**
+     * emitted when the unread count of the complete model changes.
+     */
+    void unreadCountChanged( int );
+
   protected:
     /**
       Returns the collection for a given collection id.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic