[Kde-pim] [PATCH] Storing of free/busy URLs in contacts

Steve Wolter swolter at sdf.lonestar.org
Thu Feb 14 10:13:56 GMT 2008


Tobias Koenig schrieb:

Hi Tobias,

> > Thanks for the patch, Steve, I'll have a look at it today. :)
> Please rename the methods in the KABC code to something meaningfull.

I've replaced the short RFC 2739 terms by the long ones.
Patch is attached.

Regards, Steve

-- 
Wer nicht weiß, was er selbst will, muß wenigstens wissen, was die
anderen wollen.
		-- Robert Musil
-------------- next part --------------
Index: kabc/scripts/entrylist
===================================================================
--- kabc/scripts/entrylist	(revision 774868)
+++ kabc/scripts/entrylist	(working copy)
@@ -73,6 +73,11 @@
 ALE,sort string,,QString,sortString
 
 ALF,homepage,,KUrl,url,,.url()
+# Calendaring URIs as defined in RFC 2739
+ALF,free/busy information,file with information when addressee is busy,KUrl,freeBusyURI,,.url()
+ALF,event destination,URI where event suggestions for addressee should be sent,KUrl,calendarEventDestinationURI,,.url()
+ALF,calendar location,read/write calendar access,KUrl,calendarAccessURI,,.url()
+ALF,calendar information,iCal calendar access,KUrl,calendarURI,,.url()
 
 ALE,security class,,Secrecy,secrecy,,.toString()
 
Index: kabc/vcardtool.cpp
===================================================================
--- kabc/vcardtool.cpp	(revision 774868)
+++ kabc/vcardtool.cpp	(working copy)
@@ -323,6 +323,11 @@
 
     // URL
     card.addLine( VCardLine( "URL", (*addrIt).url().url() ) );
+    card.addLine( VCardLine( "FBURL", (*addrIt).freeBusyURI().url() ) );
+    card.addLine( VCardLine( "CALADRURL", 
+      (*addrIt).calendarEventDestinationURI().url() ) );
+    card.addLine( VCardLine( "CAPURL", (*addrIt).calendarAccessURI().url() ) );
+    card.addLine( VCardLine( "CALURL", (*addrIt).calendarURI().url() ) );
 
     // VERSION
     if ( version == VCard::v2_1 ) {
@@ -619,6 +624,23 @@
         else if ( identifier == "url" ) {
           addr.setUrl( KUrl( (*lineIt).value().toString() ) );
         }
+        // FBURL
+        else if ( identifier == "fburl" ) {
+          addr.setFreeBusyURI( KUrl( (*lineIt).value().toString() ) );
+        }
+        // CALADRURL
+        else if ( identifier == "caladrurl" ) {
+          addr.setCalendarEventDestinationURI( 
+            KUrl( (*lineIt).value().toString() ) );
+        }
+        // CAPURL
+        else if ( identifier == "capurl" ) {
+          addr.setCalendarAccessURI( KUrl( (*lineIt).value().toString() ) );
+        }
+        // CALURL
+        else if ( identifier == "calurl" ) {
+          addr.setCalendarURI( KUrl( (*lineIt).value().toString() ) );
+        }
 
         // X-
         else if ( identifier.startsWith( "x-" ) ) {
-------------- next part --------------
Index: kaddressbook/freebusywidget.cpp
===================================================================
--- kaddressbook/freebusywidget.cpp	(revision 774118)
+++ kaddressbook/freebusywidget.cpp	(working copy)
@@ -60,7 +60,11 @@
   if ( addr->preferredEmail().isEmpty() )
     return;
 
-  mURL->setUrl( KCal::FreeBusyUrlStore::self()->readUrl( addr->preferredEmail() ) );
+  if ( ! addr->freeBusyURI().isEmpty() )
+    mURL->setUrl(addr->freeBusyURI());
+  else
+    mURL->setUrl( KCal::FreeBusyUrlStore::self()
+                     ->readUrl( addr->preferredEmail() ) );
 }
 
 void FreeBusyWidget::storeContact( KABC::Addressee *addr )
@@ -68,6 +72,8 @@
   if ( addr->preferredEmail().isEmpty() )
     return;
 
+  addr->setFreeBusyURI(mURL->url());
+
   KCal::FreeBusyUrlStore::self()->writeUrl( addr->preferredEmail(), mURL->url().url() );
   KCal::FreeBusyUrlStore::self()->sync();
 }
Index: kaddressbook/xxport/vcard_xxport.cpp
===================================================================
--- kaddressbook/xxport/vcard_xxport.cpp	(revision 774118)
+++ kaddressbook/xxport/vcard_xxport.cpp	(working copy)
@@ -279,6 +279,10 @@
     addr.setProductId( (*it).productId() );
     addr.setSortString( (*it).sortString() );
     addr.setUrl( (*it).url() );
+    addr.setFreeBusyURI( (*it).freeBusyURI() );
+    addr.setCalendarEventDestinationURI( (*it).calendarEventDestinationURI() );
+    addr.setCalendarAccessURI( (*it).calendarAccessURI() );
+    addr.setCalendarURI( (*it).calendarURI() );
     addr.setSecrecy( (*it).secrecy() );
     addr.setSound( (*it).sound() );
     addr.setEmails( (*it).emails() );
Index: korganizer/freebusymanager.cpp
===================================================================
--- korganizer/freebusymanager.cpp	(revision 774118)
+++ korganizer/freebusymanager.cpp	(working copy)
@@ -416,11 +416,17 @@
   if ( !url.isEmpty() ) {
     return KUrl( url );
   }
-  // Try with the url configurated by preferred email in kaddressbook
+
+  // Try with the url configurated by FBURL field or preferred email in kaddressbook
   KABC::Addressee::List list= KABC::StdAddressBook::self( true )->findByEmail( email );
   KABC::Addressee::List::Iterator it;
   QString pref;
   for ( it = list.begin(); it != list.end(); ++it ) {
+    if ( ! (*it).fburi().isEmpty() ) {
+      kDebug( 5850 ) <<"FreeBusyManager::freeBusyUrl():" <<
+        "Taken from Fburi field of kabc:" << (*it).fburi();
+      return (*it).fburi();
+    }
     pref = (*it).preferredEmail();
     if ( !pref.isEmpty() && pref != email ) {
       kDebug( 5850 ) <<"FreeBusyManager::freeBusyUrl():" <<
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080214/f98a31dc/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list