Bug 136954 - Reminders from outlook invites are set to unknown in exchange resources
Summary: Reminders from outlook invites are set to unknown in exchange resources
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-06 16:57 UTC by Henrik Segesten
Modified: 2006-12-18 17:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
fixes missing reminders for events in an exchange resource (1.01 KB, patch)
2006-12-12 20:32 UTC, Uli
Details
one-liner to set alarm type of events fetched from an exchange server (479 bytes, patch)
2006-12-12 20:33 UTC, Uli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Segesten 2006-11-06 16:57:56 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
Compiler:          GCC 4.1.1 stable gentoo 
OS:                Linux

I have configured two resources in korganizer one regular local calendar and one exchange calendar. When I receive invites to meetings via email and press the accept button I get to choose which of the two resources the event should be saved to. If I select the local calendar the event is saved fine with the correct reminder. But if I instead select the exchange calendar the event is still saved but the type of the reminder of the event is set to "Unknown" which results in that I get no reminder at all.
Comment 1 Uli 2006-12-12 20:27:41 UTC
Unfortunately, the problem is bigger than just the missing setting for the alarm type.
The reminder process (icon in system tray) fetches alarms from a cache that is never updated.
I am not a kde programmer, but the patch I attached works for me. It fetches all events since the last check and doesnt use the cache.

I also attached a one-liner to set the alarm type to "display", also it is not neccessary if you just want to be reminded.
Comment 2 Uli 2006-12-12 20:32:32 UTC
Created attachment 18903 [details]
fixes missing reminders for events in an exchange resource

When alarms are queried from an exchange resource, events will be fetched from
the server. Previously, they were returned from the (always empty) cache.
Comment 3 Uli 2006-12-12 20:33:44 UTC
Created attachment 18904 [details]
one-liner to set alarm type of events fetched from an exchange server
Comment 4 Henrik Segesten 2006-12-18 12:59:42 UTC
What do I need to do to get these patches accepted into SVN?
Comment 5 Allen Winter 2006-12-18 17:04:20 UTC
SVN commit 614667 by winterz:

Fix for "Reminders from outlook invites are set to unknown in exchange resources"
Patch from Uli.  Thanks!
Approved by Reinhold.

BUGS: 136954


 M  +20 -2     resourceexchange.cpp  


--- branches/KDE/3.5/kdepim/kresources/exchange/resourceexchange.cpp #614666:614667
@@ -403,12 +403,30 @@
   return list;
 }
 
+/* Invoked by korgac when checking alarms. Always updates the cache. */
 Alarm::List ResourceExchange::alarms( const QDateTime &from, const QDateTime &to )
 {
   kdDebug(5800) << "ResourceExchange::alarms(" << from.toString() << " - " << to.toString() << ")\n";
   Alarm::List list;
-  if ( mCache )
-  	list = mCache->alarms( from, to );
+
+  QDate start = from.date();
+  QDate end = to.date();
+
+  if ( mCache ) {
+
+    /* Clear the cache */
+    Event::List oldEvents = mCache->rawEvents( start, end, false );
+
+    Event::List::ConstIterator it;
+    for( it = oldEvents.begin(); it != oldEvents.end(); ++it ) {
+      mCache->deleteEvent( *it );
+    }
+
+    /* Fetch events */
+    mClient->downloadSynchronous( mCache, start, end, false );
+
+    list = mCache->alarms( from, to );
+  }
   return list;
 }
 
Comment 6 Allen Winter 2006-12-18 17:07:49 UTC
SVN commit 614668 by winterz:

forgot this as part of the fix for the exhange alarms.
CCBUGS: 136954


 M  +18 -17    exchangedownload.cpp  


--- branches/KDE/3.5/kdepim/libkpimexchange/core/exchangedownload.cpp #614667:614668
@@ -91,7 +91,7 @@
     //kdDebug() << "Creating progress dialog" << endl;
     mProgress = new ExchangeProgress();
     mProgress->show();
-  
+
     connect( this, SIGNAL( startDownload() ), mProgress,
              SLOT( slotTransferStarted() ) );
     connect( this, SIGNAL(finishDownload() ), mProgress,
@@ -100,7 +100,7 @@
   }
 
   QString sql = dateSelectQuery( start, end.addDays( 1 ) );
- 
+
   kdDebug() << "Exchange download query: " << endl << sql << endl;
 
   increaseDownloads();
@@ -125,13 +125,13 @@
     //kdDebug() << "Creating progress dialog" << endl;
     mProgress = new ExchangeProgress();
     mProgress->show();
-  
+
     connect( this, SIGNAL(startDownload()), mProgress, SLOT(slotTransferStarted()) );
     connect( this, SIGNAL(finishDownload()), mProgress, SLOT(slotTransferFinished()) );
   }
 
   QString sql = dateSelectQuery( start, end.addDays( 1 ) );
- 
+
   increaseDownloads();
 
   KIO::DavJob *job = KIO::davSearch( mAccount->calendarURL(), "DAV:", "sql", sql, false );
@@ -148,7 +148,7 @@
   startString.sprintf("%04i/%02i/%02i",start.year(),start.month(),start.day());
   QString endString;
   endString.sprintf("%04i/%02i/%02i",end.year(),end.month(),end.day());
-  QString sql = 
+  QString sql =
         "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\", \"urn:schemas:calendar:uid\"\r\n"
         "FROM Scope('shallow traversal of \"\"')\r\n"
         "WHERE \"urn:schemas:calendar:dtend\" > '" + startString + "'\r\n"
@@ -166,7 +166,7 @@
   QString endString;
   endString.sprintf( "%04i-%02i-%02iT23:59:59Z", end.year(), end.month(),
                      end.day() );
-  QString sql = 
+  QString sql =
         "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\", "
         "\"urn:schemas:calendar:uid\"\r\n"
         "FROM Scope('shallow traversal of \"\"')\r\n"
@@ -193,7 +193,7 @@
   kdDebug() << "Search result: " << endl << response.toString() << endl;
 
   handleAppointments( response, true );
-  
+
   decreaseDownloads();
 }
 
@@ -210,7 +210,7 @@
   kdDebug() << "Search (master) result: " << endl << response.toString() << endl;
 
   handleAppointments( response, false );
-  
+
   decreaseDownloads();
 }
 
@@ -231,7 +231,7 @@
        item = item.nextSibling().toElement() ) {
     //kdDebug() << "Current item:" << item.tagName() << endl;
     QDomNodeList propstats = item.elementsByTagNameNS( "DAV:", "propstat" );
-    // kdDebug() << "Item has " << propstats.count() << " propstat children" << endl; 
+    // kdDebug() << "Item has " << propstats.count() << " propstat children" << endl;
     for( uint i=0; i < propstats.count(); i++ ) {
       QDomElement propstat = propstats.item(i).toElement();
       QDomElement prop = propstat.namedItem( "prop" ).toElement();
@@ -247,7 +247,7 @@
       }
       int instanceType = instancetypeElement.text().toInt();
       //kdDebug() << "Instance type: " << instanceType << endl;
-    
+
       if ( recurrence && instanceType > 0 ) {
         QDomElement uidElement = prop.namedItem( "uid" ).toElement();
         if ( uidElement.isNull() ) {
@@ -286,7 +286,7 @@
 void ExchangeDownload::handleRecurrence( QString uid )
 {
   // kdDebug() << "Handling recurrence info for uid=" << uid << endl;
-  QString query = 
+  QString query =
         "SELECT \"DAV:href\", \"urn:schemas:calendar:instancetype\"\r\n"
         "FROM Scope('shallow traversal of \"\"')\r\n"
         "WHERE \"urn:schemas:calendar:uid\" = '" + uid + "'\r\n"
@@ -333,7 +333,7 @@
   addElement( doc, prop, "urn:schemas:calendar:", "exdate" );
   addElement( doc, prop, "urn:schemas:mailheader:", "sensitivity" );
   addElement( doc, prop, "urn:schemas:calendar:", "reminderoffset" );
-  
+
   addElement( doc, prop, "urn:schemas-microsoft-com:office:office",
               "Keywords" );
 
@@ -357,7 +357,7 @@
 {
   kdDebug() << "slotPropFindResult" << endl;
 
-  int error = job->error(); 
+  int error = job->error();
   if ( error ) {
     job->showErrorDialog( 0 );
     finishUp( ExchangeClient::CommunicationError, job );
@@ -370,7 +370,7 @@
 
   QDomElement prop = response.documentElement().namedItem( "response" )
                      .namedItem( "propstat" ).namedItem( "prop" ).toElement();
- 
+
   KCal::Event* event = new KCal::Event();
 
   QDomElement uidElement = prop.namedItem( "uid" ).toElement();
@@ -485,7 +485,7 @@
   QString rrule = prop.namedItem( "rrule" ).toElement().text();
   kdDebug() << "Got rrule: " << rrule << endl;
   if ( !rrule.isEmpty() ) {
-    // Timezone should be handled automatically 
+    // Timezone should be handled automatically
     // because we used mFormat->setTimeZone() earlier
     KCal::RecurrenceRule *rr = event->recurrence()->defaultRRule( true );
 
@@ -522,7 +522,7 @@
   // 2 Private
   // 3 Company Confidential
   QString sensitivity = prop.namedItem( "sensitivity" ).toElement().text();
-  if ( ! sensitivity.isNull() ) 
+  if ( ! sensitivity.isNull() )
   switch( sensitivity.toInt() ) {
     case 0: event->setSecrecy( KCal::Incidence::SecrecyPublic ); break;
     case 1: event->setSecrecy( KCal::Incidence::SecrecyPrivate ); break;
@@ -540,6 +540,7 @@
     KCal::Duration offset( - reminder.toInt() );
     KCal::Alarm *alarm = event->newAlarm();
     alarm->setStartOffset( offset );
+    alarm->setDisplayAlarm("");
     alarm->setEnabled( true );
     // TODO: multiple alarms; alarm->setType( KCal::Alarm::xxxx );
   }
@@ -555,7 +556,7 @@
 
     /** set the list of attachments/associated files for this event */
     //void setAttachments(const QStringList &attachments);
- 
+
      /** set resources used, such as Office, Car, etc. */
     //void setResources(const QStringList &resources);