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

List:       kde-commits
Subject:    kroupware_branch: kdepim/korganizer
From:       Bo Thorsen <bo () sonofthor ! dk>
Date:       2003-06-17 10:47:49
[Download RAW message or body]

CVS commit by thorsen: 

Yet another OL workaround - set alarm time as non-negative


  M +22 -0     kogroupware.cpp   1.1.2.25


--- kdepim/korganizer/kogroupware.cpp  #1.1.2.24:1.1.2.25
@@ -195,4 +195,26 @@ KOGroupware::EventState KOGroupware::inc
   }
 
+  // If the event has an alarm, make sure it doesn't have a negative time.
+  // This is yet another OL workaround
+  QPtrList<Alarm> alarms = event->alarms();
+  Alarm* alarm;
+  QPtrListIterator<Alarm> it( alarms );
+  for (; (alarm = it.current()) != 0; ++it) {
+    if ( alarm->hasTime() ) {
+      QDateTime t = alarm->time();
+      int offset = event->dtStart().secsTo( t );
+      if( offset > 0 )
+        // PENDING(Bo): Not implemented yet
+        kdDebug(5850) << "Warning: Alarm fires after the event\n";
+    } else {
+      int offset = alarm->offset().asSeconds();
+      if( offset > 0 ) {
+        // This number should be negative so the alarm fires before the event
+        Duration d( -offset );
+        alarm->setOffset( d );
+      }
+    }
+  }
+
   // Enter the event into the calendar. We just create a
   // Scheduler, because all the code we need is already there. We


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

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