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

List:       kde-commits
Subject:    kdepim/knotes
From:       Michael Brade <brade () kde ! org>
Date:       2005-02-21 23:06:57
Message-ID: 20050221230657.7BA382226 () office ! kde ! org
[Download RAW message or body]

CVS commit by brade: 

I can't believe that Calendar(Local) doesn't return the alarms of the journals
when calling CalendarLocal::alarms(). Implemented it myself in the notes
resource, but this has to be fixed in the calendar for the next KDE version.
I didn't do it now because I don't know if this was intentional and it is
quite late in the release cycle.


  M +24 -1     resourcelocal.cpp   1.16
  M +3 -0      resourcelocal.h   1.5


--- kdepim/knotes/resourcelocal.cpp  #1.15:1.16
@@ -3,5 +3,5 @@
 
  Copyright (c) 2004, Bo Thorsen <bo@sonofthor.dk>
-               2004, Michael Brade <brade@kde.org>
+               2004, 2005, Michael Brade <brade@kde.org>
 
  This program is free software; you can redistribute it and/or modify
@@ -94,2 +94,25 @@ bool ResourceLocal::deleteNote( KCal::Jo
     return true;
 }
+
+KCal::Alarm::List ResourceLocal::alarms( const QDateTime& from, const QDateTime& to )
+{
+    KCal::Alarm::List alarms;
+    KCal::Journal::List notes = mCalendar.journals();
+    KCal::Journal::List::ConstIterator note;
+    for ( note = notes.begin(); note != notes.end(); ++note )
+    {
+        QDateTime preTime = from.addSecs( -1 );
+        KCal::Alarm::List::ConstIterator it;
+        for( it = (*note)->alarms().begin(); it != (*note)->alarms().end(); ++it )
+        {
+            if ( (*it)->enabled() )
+            {
+                QDateTime dt = (*it)->nextRepetition( preTime );
+                if ( dt.isValid() && dt <= to )
+                    alarms.append( *it );
+            }
+        }
+    }
+
+    return alarms;
+}

--- kdepim/knotes/resourcelocal.h  #1.4:1.5
@@ -57,4 +58,6 @@ public:
     virtual bool deleteNote( KCal::Journal* );
 
+    virtual KCal::Alarm::List alarms( const QDateTime& from, const QDateTime& to );
+
 protected:
     KCal::CalendarLocal mCalendar;


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

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