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

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/korganizer/incidenceeditor
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-01-07 14:09:39
Message-ID: 1262873379.597990.24369.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1071083 by vkrause:

Restore lost parts of the KABC::StdAddressBook porting.


 M  +15 -11    koeditordetails.cpp  
 M  +1 -1      koeditordetails.h  
 M  +15 -11    koeditorfreebusy.cpp  


--- branches/work/akonadi-ports/kdepim/korganizer/incidenceeditor/koeditordetails.cpp #1071082:1071083
@@ -26,10 +26,10 @@
 #include "koeditordetails.h"
 #include "koeditorconfig.h"
 
-#include <libkdepim/distributionlist.h>
 #include <libkdepim/kvcarddrag.h>
 
-#include <KABC/StdAddressBook>
+#include <akonadi/contact/contactgroupexpandjob.h>
+#include <akonadi/contact/contactgroupsearchjob.h>
 #include <KCal/Incidence>
 #include <KPIMUtils/Email>
 
@@ -284,17 +284,21 @@
     Q_ASSERT( attendee );
     /* Check if the attendee is a distribution list and expand it */
     if ( attendee->email().isEmpty() ) {
-      KPIM::DistributionList list =
-        KPIM::DistributionList::findByName( KABC::StdAddressBook::self(), attendee->name() );
-      if ( !list.isEmpty() ) {
+      Akonadi::ContactGroupSearchJob *job = new Akonadi::ContactGroupSearchJob();
+      job->setQuery( Akonadi::ContactGroupSearchJob::Name, attendee->name() );
+      job->exec();
+
+      const KABC::ContactGroup::List groups = job->contactGroups();
+      if ( !groups.isEmpty() ) {
         toBeDeleted.push_back( item ); // remove it once we are done expanding
-        KPIM::DistributionList::Entry::List entries = list.entries( KABC::StdAddressBook::self() );
-        KPIM::DistributionList::Entry::List::Iterator it( entries.begin() );
-        while ( it != entries.end() ) {
-          KPIM::DistributionList::Entry &e = ( *it );
-          ++it;
+        Akonadi::ContactGroupExpandJob *expandJob =
+          new Akonadi::ContactGroupExpandJob( groups.first() );
+        expandJob->exec();
+
+        const KABC::Addressee::List contacts = expandJob->contacts();
+        foreach ( const KABC::Addressee &contact, contacts ) {
           // this calls insertAttendee, which appends
-          insertAttendeeFromAddressee( e.addressee, attendee );
+          insertAttendeeFromAddressee( contact, attendee );
           // TODO: duplicate check, in case it was already added manually
         }
       }
--- branches/work/akonadi-ports/kdepim/korganizer/incidenceeditor/koeditordetails.h #1071082:1071083
@@ -38,7 +38,7 @@
 typedef CustomListViewItem<KCal::Attendee *> AttendeeListItem;
 
 /** KOAttendeeListView is a child class of K3ListView  which supports
- *  dropping of attendees (e.g. from kcontactmanager) onto it. If an attendeee
+ *  dropping of attendees (e.g. from kaddressbook) onto it. If an attendeee
  *  was dropped, the signal dropped(Attendee*)  is emitted.
  */
 class KOAttendeeListView : public K3ListView
--- branches/work/akonadi-ports/kdepim/korganizer/incidenceeditor/koeditorfreebusy.cpp #1071082:1071083
@@ -34,9 +34,9 @@
 #include <kdgantt1/KDGanttViewSubwidgets.h>
 #include <kdgantt1/KDGanttViewTaskItem.h>
 
-#include <libkdepim/distributionlist.h>
+#include <akonadi/contact/contactgroupexpandjob.h>
+#include <akonadi/contact/contactgroupsearchjob.h>
 
-#include <KABC/StdAddressBook>
 #include <KCal/Incidence>
 #include <KCal/FreeBusy>
 #include <KPIMUtils/Email>
@@ -784,17 +784,21 @@
     Q_ASSERT( attendee );
     /* Check if the attendee is a distribution list and expand it */
     if ( attendee->email().isEmpty() ) {
-      KPIM::DistributionList list =
-        KPIM::DistributionList::findByName( KABC::StdAddressBook::self(), attendee->name() );
-      if ( !list.isEmpty() ) {
+      Akonadi::ContactGroupSearchJob *job = new Akonadi::ContactGroupSearchJob();
+      job->setQuery( Akonadi::ContactGroupSearchJob::Name, attendee->name() );
+      job->exec();
+
+      const KABC::ContactGroup::List groups = job->contactGroups();
+      if ( !groups.isEmpty() ) {
         toBeDeleted.push_back( item ); // remove it once we are done expanding
-        KPIM::DistributionList::Entry::List entries = list.entries( KABC::StdAddressBook::self() );
-        KPIM::DistributionList::Entry::List::Iterator it( entries.begin() );
-        while ( it != entries.end() ) {
-          KPIM::DistributionList::Entry &e = ( *it );
-          ++it;
+        Akonadi::ContactGroupExpandJob *expandJob =
+          new Akonadi::ContactGroupExpandJob( groups.first() );
+        expandJob->exec();
+
+        const KABC::Addressee::List contacts = expandJob->contacts();
+        foreach ( const KABC::Addressee &contact, contacts ) {
           // this calls insertAttendee, which appends
-          insertAttendeeFromAddressee( e.addressee, attendee );
+          insertAttendeeFromAddressee( contact, attendee );
           // TODO: duplicate check, in case it was already added manually
         }
       }
[prev in list] [next in list] [prev in thread] [next in thread] 

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