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

Steve Wolter swolter at SDF.LONESTAR.ORG
Tue Feb 12 16:20:04 GMT 2008


Dear KDE-PIM developers,

some time ago, I've submitted a patch to improve the KDE
free/busy-URI-handling, which is quite contraintuitive and
close to broken right now. Unfortunately, it seems that
the patch was dropped in the general pre-christmas trouble,
thus I've rechecked the changes against today's svn and
attached the resulting patch.

I hope you find this useful. If not, I'd love to hear some
kind of feedback.

Thanks in advance, Steve Wolter

-- 
We may not return the affection of those who like us, but we always
respect their good judgement.
-------------- next part --------------
An embedded message was scrubbed...
From: Steve Wolter <swolter at sdf.lonestar.org>
Subject: [Kde-pim] [libkabc/korganizer] Storing of free/busy URLs in contacts
Date: Sun, 16 Dec 2007 22:58:21 +0100
Size: 10455
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080212/d40b9ddd/attachment.mht>
-------------- 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->fburi().isEmpty() )
+    mURL->setUrl(addr->fburi());
+  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->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 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.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 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 --------------
Index: kabc/scripts/entrylist
===================================================================
--- kabc/scripts/entrylist	(revision 774078)
+++ 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 774078)
+++ kabc/vcardtool.cpp	(working copy)
@@ -323,6 +323,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 ) {
@@ -619,6 +623,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/20080212/d40b9ddd/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