summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/event.cpp20
-rw-r--r--libkcal/event.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index 5285559..ad66639 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -162,24 +162,44 @@ void Event::setTransparency(Event::Transparency transparency)
162} 162}
163 163
164Event::Transparency Event::transparency() const 164Event::Transparency Event::transparency() const
165{ 165{
166 return mTransparency; 166 return mTransparency;
167} 167}
168 168
169void Event::setDuration(int seconds) 169void Event::setDuration(int seconds)
170{ 170{
171 setHasEndDate(false); 171 setHasEndDate(false);
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174bool Event::matchTime(QDateTime*startDT, QDateTime* endDT)
175{
176 if ( ! doesRecur() ) {
177 if ( doesFloat() ) {
178 if ( mDtEnd.addDays( 1 ) < *startDT)
179 return false;
180 if ( endDT && mDtStart > * endDT)
181 return false;
182 } else {
183 if ( mDtEnd < *startDT )
184 return false;
185 if ( endDT && mDtStart > * endDT)
186 return false;
187 }
188 } else {
189 if ( endDT && mDtStart > * endDT)
190 return false;
191 }
192 return true;
193}
174bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT ) 194bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT )
175{ 195{
176 if ( testEvent == this ) 196 if ( testEvent == this )
177 return false; 197 return false;
178 if ( ! doesRecur() && !testEvent->doesRecur() ) { 198 if ( ! doesRecur() && !testEvent->doesRecur() ) {
179 QDateTime te; 199 QDateTime te;
180 if ( testEvent->doesFloat() ) 200 if ( testEvent->doesFloat() )
181 te = testEvent->mDtEnd.addDays( 1 ); 201 te = testEvent->mDtEnd.addDays( 1 );
182 else 202 else
183 te = testEvent->mDtEnd; 203 te = testEvent->mDtEnd;
184 QDateTime e; 204 QDateTime e;
185 if ( doesFloat() ) 205 if ( doesFloat() )
diff --git a/libkcal/event.h b/libkcal/event.h
index e6055a5..2da9770 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -29,24 +29,25 @@ namespace KCal {
29 29
30/** 30/**
31 This class provides an Event in the sense of RFC2445. 31 This class provides an Event in the sense of RFC2445.
32*/ 32*/
33class Event : public Incidence 33class Event : public Incidence
34{ 34{
35 public: 35 public:
36 enum Transparency { Opaque, Transparent }; 36 enum Transparency { Opaque, Transparent };
37 typedef ListBase<Event> List; 37 typedef ListBase<Event> List;
38 Event(); 38 Event();
39 Event(const Event &); 39 Event(const Event &);
40 ~Event(); 40 ~Event();
41 bool matchTime(QDateTime*startDT, QDateTime* endDT);
41 42
42 QCString type() const { return "Event"; } 43 QCString type() const { return "Event"; }
43 IncTypeID typeID() const { return eventID; } 44 IncTypeID typeID() const { return eventID; }
44 45
45 Incidence *clone(); 46 Incidence *clone();
46 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; 47 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
47 48
48 /** for setting an event's ending date/time with a QDateTime. */ 49 /** for setting an event's ending date/time with a QDateTime. */
49 void setDtEnd(const QDateTime &dtEnd); 50 void setDtEnd(const QDateTime &dtEnd);
50 /** Return the event's ending date/time as a QDateTime. */ 51 /** Return the event's ending date/time as a QDateTime. */
51 virtual QDateTime dtEnd() const; 52 virtual QDateTime dtEnd() const;
52 /** returns an event's end time as a string formatted according to the 53 /** returns an event's end time as a string formatted according to the