summaryrefslogtreecommitdiffabout
path: root/libkcal/event.cpp
Unidiff
Diffstat (limited to 'libkcal/event.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/event.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index 7256f05..de8dceb 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -80,25 +80,25 @@ bool Event::contains ( Event* from )
80 if ( !alarms().count() ) 80 if ( !alarms().count() )
81 return false; 81 return false;
82 Alarm *b = alarms().first(); 82 Alarm *b = alarms().first();
83 if( ! b->enabled() ) 83 if( ! b->enabled() )
84 return false; 84 return false;
85 if ( ! (a->offset() == b->offset() )) 85 if ( ! (a->offset() == b->offset() ))
86 return false; 86 return false;
87 } 87 }
88 } 88 }
89 QStringList cat = categories(); 89 QStringList cat = categories();
90 QStringList catFrom = from->categories(); 90 QStringList catFrom = from->categories();
91 QString nCat; 91 QString nCat;
92 int iii; 92 unsigned int iii;
93 for ( iii = 0; iii < catFrom.count();++iii ) { 93 for ( iii = 0; iii < catFrom.count();++iii ) {
94 nCat = catFrom[iii]; 94 nCat = catFrom[iii];
95 if ( !nCat.isEmpty() ) 95 if ( !nCat.isEmpty() )
96 if ( !cat.contains( nCat )) { 96 if ( !cat.contains( nCat )) {
97 return false; 97 return false;
98 } 98 }
99 } 99 }
100 if ( from->doesRecur() ) 100 if ( from->doesRecur() )
101 if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) ) 101 if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) )
102 return false; 102 return false;
103 return true; 103 return true;
104} 104}
@@ -111,26 +111,24 @@ void Event::setDtEnd(const QDateTime &dtEnd)
111 111
112 setHasEndDate(true); 112 setHasEndDate(true);
113 setHasDuration(false); 113 setHasDuration(false);
114 114
115 updated(); 115 updated();
116} 116}
117 117
118QDateTime Event::dtEnd() const 118QDateTime Event::dtEnd() const
119{ 119{
120 if (hasEndDate()) return mDtEnd; 120 if (hasEndDate()) return mDtEnd;
121 if (hasDuration()) return dtStart().addSecs(duration()); 121 if (hasDuration()) return dtStart().addSecs(duration());
122 122
123 kdDebug(5800) << "Warning! Event '" << summary()
124 << "' does have neither end date nor duration." << endl;
125 return dtStart(); 123 return dtStart();
126} 124}
127 125
128QString Event::dtEndTimeStr() const 126QString Event::dtEndTimeStr() const
129{ 127{
130 return KGlobal::locale()->formatTime(mDtEnd.time()); 128 return KGlobal::locale()->formatTime(mDtEnd.time());
131} 129}
132 130
133QString Event::dtEndDateStr(bool shortfmt) const 131QString Event::dtEndDateStr(bool shortfmt) const
134{ 132{
135 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); 133 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt);
136} 134}
@@ -176,25 +174,25 @@ void Event::setDuration(int seconds)
176QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const 174QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const
177{ 175{
178 176
179 bool yes; 177 bool yes;
180 QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes ); 178 QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes );
181 if ( ! yes || cancelled() ) { 179 if ( ! yes || cancelled() ) {
182 *ok = false; 180 *ok = false;
183 return QDateTime (); 181 return QDateTime ();
184 } 182 }
185 183
186 bool enabled = false; 184 bool enabled = false;
187 Alarm* alarm; 185 Alarm* alarm;
188 int off; 186 int off = 0;
189 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 187 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
190 // if ( QDateTime::currentDateTime() > incidenceStart ){ 188 // if ( QDateTime::currentDateTime() > incidenceStart ){
191// *ok = false; 189// *ok = false;
192// return incidenceStart; 190// return incidenceStart;
193// } 191// }
194 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 192 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
195 if (alarm->enabled()) { 193 if (alarm->enabled()) {
196 if ( alarm->hasTime () ) { 194 if ( alarm->hasTime () ) {
197 if ( alarm->time() < alarmStart ) { 195 if ( alarm->time() < alarmStart ) {
198 alarmStart = alarm->time(); 196 alarmStart = alarm->time();
199 enabled = true; 197 enabled = true;
200 off = alarmStart.secsTo( incidenceStart ); 198 off = alarmStart.secsTo( incidenceStart );