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

List:       kde-commits
Subject:    kdepim/kontact/plugins/kmail
From:       Ingo Klöcker <kloecker () kde ! org>
Date:       2004-06-14 21:32:43
Message-ID: 20040614213243.221119980 () office ! kde ! org
[Download RAW message or body]

CVS commit by kloecker: 

Reimplement the new updateSummary in the kmail summary plugin to update the message counts if necessary.


  M +15 -1     summarywidget.cpp   1.29
  M +4 -0      summarywidget.h   1.14


--- kdepim/kontact/plugins/kmail/summarywidget.h  #1.13:1.14
@@ -53,4 +53,7 @@ class SummaryWidget : public Kontact::Su
     void slotUnreadCountChanged();
 
+  public slots:
+    virtual void updateSummary( bool force );
+
   private slots:
     void selectFolder( const QString& );
@@ -62,4 +65,5 @@ class SummaryWidget : public Kontact::Su
     QGridLayout *mLayout;
     Kontact::Plugin *mPlugin;
+    int mTimeOfLastMessageCountUpdate;
 };
 

--- kdepim/kontact/plugins/kmail/summarywidget.cpp  #1.28:1.29
@@ -40,4 +40,6 @@
 #include "summarywidget.h"
 
+#include <time.h>
+
 SummaryWidget::SummaryWidget( Kontact::Plugin *plugin, QWidget *parent, const char *name )
   : Kontact::Summary( parent, name ),
@@ -47,5 +49,6 @@ SummaryWidget::SummaryWidget( Kontact::P
   QVBoxLayout *mainLayout = new QVBoxLayout( this, 3, 3 );
 
-  QPixmap icon = KGlobal::iconLoader()->loadIcon( "kmail", KIcon::Desktop, KIcon::SizeMedium);
+  QPixmap icon = KGlobal::iconLoader()->loadIcon( "kmail", KIcon::Desktop,
+                                                  KIcon::SizeMedium );
   QWidget *header = createHeader(this, icon, i18n("New Messages"));
   mLayout = new QGridLayout( 1, 3, 3 );
@@ -72,4 +75,14 @@ void SummaryWidget::selectFolder( const 
 }
 
+void SummaryWidget::updateSummary( bool )
+{
+  // check whether we need to update the message counts
+  DCOPRef kmail( "kmail", "KMailIface" );
+  const int timeOfLastMessageCountChange =
+    kmail.call( "timeOfLastMessageCountChange()" );
+  if ( timeOfLastMessageCountChange > mTimeOfLastMessageCountUpdate )
+    slotUnreadCountChanged();
+}
+
 void SummaryWidget::slotUnreadCountChanged()
 {
@@ -84,4 +97,5 @@ void SummaryWidget::slotUnreadCountChang
                   << endl;
   }
+  mTimeOfLastMessageCountUpdate = ::time( 0 );
 }
 


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

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