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

Steve Wolter swolter at SDF.LONESTAR.ORG
Sun Dec 16 21:58:21 GMT 2007


Dear KDE PIM developers,

first of all, thank you for your great work.

I've recently set up a groupware environment with the KDE PIM
tools and spent three hours finding a particularily nasty bug
in the handling of free/busy URLs in kaddressbook.

As you may recall, there is a field in the Misc tab of the
Addressee edit dialog of kaddressbook where one can set the
URL of the free/busy file for an addressee, which can be used
by korganizer to determine when that person will be free for
meetings. Unfortunately, that information might get _displayed_
with all the other contact infos, but isn't _stored_ with these,
but rather in the configuration file korganizer/freebusys, in-
dexed by preferred e-mail. You can easily imagine the trouble
this causes in any kind of shared-contact-environment or when
changing e-mail-addresses.

This behaviour is particularily unsatisfactory since 7 years ago,
RFC 2739 defined quite well an format for storing that URL in 
VCards. I've taken the liberty to write a little patch that im-
plements the FBURL fields and its friends in libkabc, made kaddress-
book honor it as well and patched korganizer to use it. The two
patch files are appended. I'd be quite happy if that patch made
it into KDE 4. It is highly unlikely that it breaks anything,
since current behaviour is preserved whenever the fburl field in
an addressee is not set. This is, of course, a makeshift solution
until all resources could be patched to support the new fields;
since the korganizer/freebusys-file is undocumented and contraintui-
tive, its elimination or at least its reduction to the data entered
by hand in korganizer forms would be preferable.

Unfortunately, I didn't have the KDE knowledge to patch the several
kresources. I'd be happy to help there as well.

Best regards, Steve Wolter
-------------- next part --------------
Index: kaddressbook/freebusywidget.cpp
===================================================================
--- kaddressbook/freebusywidget.cpp	(revision 749237)
+++ kaddressbook/freebusywidget.cpp	(working copy)
@@ -61,7 +61,11 @@
   if ( addr->preferredEmail().isEmpty() )
     return;
 
-  mURL->setUrl( KCal::FreeBusyUrlStore::self()->readUrl( addr->preferredEmail() ) );
+  if ( ! addr->fburi().isEmpty() )
+    mURL->setUrl(addr->fburi());
+  else
+    mURL->setUrl( KCal::FreeBusyUrlStore::self()
+                     ->readUrl( addr->preferredEmail() ) );
 }
 
 void FreeBusyWidget::storeContact( KABC::Addressee *addr )
@@ -69,6 +73,8 @@
   if ( addr->preferredEmail().isEmpty() )
     return;
 
+  addr->setFburi(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 749237)
+++ kaddressbook/xxport/vcard_xxport.cpp	(working copy)
@@ -279,6 +279,10 @@
     addr.setProductId( (*it).productId() );
     addr.setSortString( (*it).sortString() );
     addr.setUrl( (*it).url() );
+    addr.setFburi( (*it).fburi() );
+    addr.setCaluri( (*it).caluri() );
+    addr.setCaladruri( (*it).caladruri() );
+    addr.setCapuri( (*it).capuri() );
     addr.setSecrecy( (*it).secrecy() );
     addr.setSound( (*it).sound() );
     addr.setEmails( (*it).emails() );
Index: korganizer/freebusymanager.cpp
===================================================================
--- korganizer/freebusymanager.cpp	(revision 749237)
+++ 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 --------------
Index: kabc/scripts/entrylist
===================================================================
--- kabc/scripts/entrylist	(revision 749238)
+++ 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,fburi,,.url()
+ALF,event destination,URI where event suggestions for addressee should be sent,KUrl,caladruri,,.url()
+ALF,calendar location,read/write calendar access,KUrl,capuri,,.url()
+ALF,calendar information,iCal calendar access,KUrl,caluri,,.url()
 
 ALE,security class,,Secrecy,secrecy,,.toString()
 
Index: kabc/vcardtool.cpp
===================================================================
--- kabc/vcardtool.cpp	(revision 749238)
+++ kabc/vcardtool.cpp	(working copy)
@@ -322,6 +322,10 @@
 
     // URL
     card.addLine( VCardLine( "URL", (*addrIt).url().url() ) );
+    card.addLine( VCardLine( "FBURL", (*addrIt).fburi().url() ) );
+    card.addLine( VCardLine( "CALADRURL", (*addrIt).caladruri().url() ) );
+    card.addLine( VCardLine( "CAPURL", (*addrIt).capuri().url() ) );
+    card.addLine( VCardLine( "CALURL", (*addrIt).caluri().url() ) );
 
     // VERSION
     if ( version == VCard::v2_1 ) {
@@ -615,6 +619,22 @@
         else if ( identifier == "url" ) {
           addr.setUrl( KUrl( (*lineIt).value().toString() ) );
         }
+        // FBURL
+        else if ( identifier == "fburl" ) {
+          addr.setFburi( KUrl( (*lineIt).value().toString() ) );
+        }
+        // CALADRURL
+        else if ( identifier == "caladrurl" ) {
+          addr.setCaladruri( KUrl( (*lineIt).value().toString() ) );
+        }
+        // CAPURL
+        else if ( identifier == "capurl" ) {
+          addr.setCapuri( KUrl( (*lineIt).value().toString() ) );
+        }
+        // CALURL
+        else if ( identifier == "calurl" ) {
+          addr.setCaluri( KUrl( (*lineIt).value().toString() ) );
+        }
 
         // X-
         else if ( identifier.startsWith( "x-" ) ) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20071216/faaae590/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