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

List:       kde-commits
Subject:    [kdepim] kmail: Fix load systemtray at startup (by default model can not be empty)
From:       Montel Laurent <montel () kde ! org>
Date:       2012-06-26 11:28:25
Message-ID: 20120626112825.88C04A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 13d3912085a1b5071687925c7d80e07936f2603e by Montel Laurent.
Committed on 26/06/2012 at 13:27.
Pushed by mlaurent into branch 'master'.

Fix load systemtray at startup (by default model can not be empty)

M  +7    -3    kmail/kmsystemtray.cpp

http://commits.kde.org/kdepim/13d3912085a1b5071687925c7d80e07936f2603e

diff --git a/kmail/kmsystemtray.cpp b/kmail/kmsystemtray.cpp
index 0e61aff..bd2575a 100644
--- a/kmail/kmsystemtray.cpp
+++ b/kmail/kmsystemtray.cpp
@@ -94,7 +94,6 @@ KMSystemTray::KMSystemTray(QObject *parent)
   connect( kmkernel->folderCollectionMonitor(), \
SIGNAL(collectionSubscribed(Akonadi::Collection,Akonadi::Collection)),SLOT(initListOfCollection()) \
);  connect( kmkernel->folderCollectionMonitor(), \
SIGNAL(collectionUnsubscribed(Akonadi::Collection)),SLOT(initListOfCollection()) );  
-  
   initListOfCollection();
 
 }
@@ -204,7 +203,7 @@ void KMSystemTray::updateCount()
   p.setBrush( Qt::NoBrush );
   p.setPen( scheme.foreground( KColorScheme::LinkText ).color() );
   p.setOpacity( 1.0 );
-  p.drawText( overlayPixmap.rect(), Qt::AlignCenter, countString );
+  p.drawText( overlayPixmap.rect(),Qt::AlignCenter, countString );
   p.end();
 
   QPixmap iconPixmap = mIcon.pixmap(overlaySize, overlaySize);
@@ -329,7 +328,12 @@ void KMSystemTray::hideKMail()
 void KMSystemTray::initListOfCollection()
 {
   mCount = 0;
-  unreadMail( KMKernel::self()->entityTreeModel() );
+  const QAbstractItemModel *model = KMKernel::self()->entityTreeModel();
+  if(model->rowCount() == 0) {
+    QTimer::singleShot(1000,this,SLOT(initListOfCollection()));
+    return;
+  }
+  unreadMail( model );
 
   if ( mMode == GlobalSettings::EnumSystemTrayPolicy::ShowOnUnread ) {
     if(status() == KStatusNotifierItem::Passive && (mCount > 0)) {


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

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