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

List:       kde-commits
Subject:    KDE/kdepim/kontact/plugins/kmail
From:       Laurent Montel <montel () kde ! org>
Date:       2007-06-20 15:36:46
Message-ID: 1182353806.452930.682.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 678057 by mlaurent:

Now that kmail->folder dbus interface was fixed we can
fix kmail kontact plugins


 M  +9 -1      CMakeLists.txt  
 M  +11 -6     kcmkmailsummary.cpp  
 M  +43 -36    summarywidget.cpp  


--- trunk/KDE/kdepim/kontact/plugins/kmail/CMakeLists.txt #678056:678057
@@ -8,8 +8,15 @@
 )
 
 ########### next target ###############
+set(interface_SRCS)
 
-set(kontact_kmail_plugins_interface_SRCS)
+set(folder_adaptor ${CMAKE_SOURCE_DIR}/kmail/folderadaptor.h)
+set(folder_adaptor_xml ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kmail.folder.xml)
+
+qt4_generate_dbus_interface( ${folder_adaptor} org.kde.kmail.folder.xml )
+qt4_add_dbus_interface( interface_SRCS ${folder_adaptor_xml} kmail_folder_interface )
+
+set(kontact_kmail_plugins_interface_SRCS ${interface_SRCS})
 qt4_add_dbus_interfaces(kontact_kmail_plugins_interface_SRCS ${CMAKE_SOURCE_DIR}/kmail/org.kde.kmail.kmail.xml )
 
 set(kontact_kmailplugin_PART_SRCS kmail_plugin.cpp summarywidget.cpp ${kontact_kmail_plugins_interface_SRCS})
@@ -30,6 +37,7 @@
 
 set(kcm_kmailsummary_PART_SRCS kcmkmailsummary.cpp ${kontact_kmail_plugins_interface_SRCS} )
 
+
 kde4_automoc(${kcm_kmailsummary_PART_SRCS})
 
 kde4_add_plugin(kcm_kmailsummary ${kcm_kmailsummary_PART_SRCS})
--- trunk/KDE/kdepim/kontact/plugins/kmail/kcmkmailsummary.cpp #678056:678057
@@ -35,9 +35,11 @@
 #include <kcomponentdata.h>
 
 #include "kcmkmailsummary.h"
+#include "kmail_folder_interface.h"
 
 #include <kdemacros.h>
 #include "kmailinterface.h"
+#define DBUS_KMAIL "org.kde.kmail"
 
 extern "C"
 {
@@ -107,12 +109,15 @@
     if ( (*it) == "/Local" )
       displayName = i18nc( "prefix for local folders", "Local" );
     else {
-	org::kde::kmail::kmail kmail("org.kde.kmail", "/KMail", QDBusConnection::sessionBus());
-#ifdef __GNUC__
-#warning Port me to DBus!
-#endif
-//      DCOPRef folderRef = kmail.call( "getFolder(QString)", *it );
-//      folderRef.call( "displayName()" ).get( displayName );
+	org::kde::kmail::kmail kmail(DBUS_KMAIL, "/KMail", QDBusConnection::sessionBus());
+        QDBusReply<QDBusObjectPath> ref = kmail.getFolder( *it );
+        if ( ref.isValid() )
+        {
+          QDBusObjectPath path = ref;
+
+          OrgKdeKmailFolderInterface folderInterface(  DBUS_KMAIL, path.path(), QDBusConnection::sessionBus());
+          displayName = folderInterface.displayName();
+        }
     }
     if ( (*it).count( '/' ) == 1 ) {
       if ( mFolderMap.find( *it ) == mFolderMap.end() )
--- trunk/KDE/kdepim/kontact/plugins/kmail/summarywidget.cpp #678056:678057
@@ -43,7 +43,10 @@
 #include "summarywidget.h"
 
 #include <time.h>
-#include "kmailinterface.h" 
+#include "kmailinterface.h"
+#include "kmail_folder_interface.h"
+#define DBUS_KMAIL "org.kde.kmail"
+
 SummaryWidget::SummaryWidget( Kontact::Plugin *plugin, QWidget *parent )
   : Kontact::Summary( parent ),
 //    DCOPObject( "MailSummary" ),
@@ -85,7 +88,7 @@
 void SummaryWidget::updateSummary( bool )
 {
   // check whether we need to update the message counts
-  org::kde::kmail::kmail kmail("org.kde.kmail", "/KMail" , QDBusConnection::sessionBus());
+  org::kde::kmail::kmail kmail( DBUS_KMAIL , "/KMail" , QDBusConnection::sessionBus());
   const int timeOfLastMessageCountChange = kmail.timeOfLastMessageCountChange();
   if ( timeOfLastMessageCountChange > mTimeOfLastMessageCountUpdate )
     slotUnreadCountChanged();
@@ -94,7 +97,7 @@
 void SummaryWidget::slotUnreadCountChanged()
 {
   kDebug()<<" SummaryWidget::slotUnreadCountChanged\n";
-  org::kde::kmail::kmail kmail("org.kde.kmail", "/KMail" , QDBusConnection::sessionBus());
+  org::kde::kmail::kmail kmail( DBUS_KMAIL, "/KMail" , QDBusConnection::sessionBus());
   QDBusReply<QStringList> reply = kmail.folderList();
   if ( reply.isValid() ) {
     QStringList folderList = reply;
@@ -123,46 +126,50 @@
 
   int counter = 0;
   QStringList::ConstIterator it;
-#ifdef __GNUC__
-#warning Port me to DBus!
-#endif
-/*  DCOPRef kmail( "kmail", "KMailIface" );
-  org::kde::kmail::kmail kmail("org.kde.kmail", "/KMail" , QDBusConnection::sessionBus());
+  org::kde::kmail::kmail kmail( DBUS_KMAIL , "/KMail" , QDBusConnection::sessionBus());
   for ( it = folders.begin(); it != folders.end(); ++it ) {
     if ( activeFolders.contains( *it ) ) {
-      DCOPRef folderRef = kmail.call( "getFolder(QString)", *it );
-      const int numMsg = folderRef.call( "messages()" );
-      const int numUnreadMsg = folderRef.call( "unreadMessages()" );
+      QDBusReply<QDBusObjectPath> ref = kmail.getFolder( *it );
+      if ( ref.isValid() )
+        {
+          QDBusObjectPath path = ref;
+          OrgKdeKmailFolderInterface folderInterface(  DBUS_KMAIL, path.path(), QDBusConnection::sessionBus());
+          QDBusReply<int> replyNumMsg = folderInterface.messages();
+          const int numMsg = replyNumMsg;
+          QDBusReply<int> replyUnreadNumMsg = folderInterface.unreadMessages();
+          const int numUnreadMsg=replyUnreadNumMsg;
 
-      if ( numUnreadMsg == 0 ) continue;
+          if ( numUnreadMsg == 0 ) continue;
 
-      QString folderPath;
-      if ( config.readEntry( "ShowFullPath", true ) )
-        folderRef.call( "displayPath()" ).get( folderPath );
-      else
-        folderRef.call( "displayName()" ).get( folderPath );
+          QString folderPath;
+          QDBusReply<QString> replyFolderPath;
+          if ( config.readEntry( "ShowFullPath", true ) )
+            replyFolderPath= folderInterface.displayPath();
+          else
+            replyFolderPath= folderInterface.displayName();
+          folderPath = replyFolderPath;
+          KUrlLabel *urlLabel = new KUrlLabel( *it, folderPath, this );
+          urlLabel->installEventFilter( this );
+          urlLabel->setAlignment( Qt::AlignLeft );
+          urlLabel->show();
+          connect( urlLabel, SIGNAL( leftClickedUrl( const KUrl&) ),
+                   SLOT( selectFolder( const KUrl& ) ) );
+          mLayout->addWidget( urlLabel, counter, 0 );
+          mLabels.append( urlLabel );
 
-      KUrlLabel *urlLabel = new KUrlLabel( *it, folderPath, this );
-      urlLabel->installEventFilter( this );
-      urlLabel->setAlignment( Qt::AlignLeft );
-      urlLabel->show();
-      connect( urlLabel, SIGNAL( leftClickedUrl( const QString& ) ),
-               SLOT( selectFolder( const QString& ) ) );
-      mLayout->addWidget( urlLabel, counter, 0 );
-      mLabels.append( urlLabel );
+          QLabel *label =
+            new QLabel( i18nc("%1: number of unread messages "
+                              "%2: total number of messages", "%1 / %2",
+                              numUnreadMsg, numMsg ), this );
+          label->setAlignment( Qt::AlignLeft );
+          label->show();
+          mLayout->addWidget( label, counter, 2 );
+          mLabels.append( label );
 
-      QLabel *label =
-        new QLabel( i18nc("%1: number of unread messages "
-                                  "%2: total number of messages", "%1 / %2",
-                      numUnreadMsg, numMsg ), this );
-      label->setAlignment( Qt::AlignLeft );
-      label->show();
-      mLayout->addWidget( label, counter, 2 );
-      mLabels.append( label );
-
-      counter++;
+          counter++;
+        }
     }
-  }*/
+  }
 
   if ( counter == 0 ) {
     QLabel *label = new QLabel( i18n( "No unread messages in your monitored folders" ), this );
[prev in list] [next in list] [prev in thread] [next in thread] 

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