summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp23
-rw-r--r--libkcal/kincidenceformatter.cpp24
-rw-r--r--libkcal/recurrence.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.h2
5 files changed, 32 insertions, 21 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index de11c13..39921a0 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -258,110 +258,113 @@ void KOEventViewer::appendEvent(Event *event, int mode )
258 addTag("h2",i18n( "Local: " ) +event->summary()); 258 addTag("h2",i18n( "Local: " ) +event->summary());
259 } else { 259 } else {
260 addTag("h2",i18n( "Remote: " ) +event->summary()); 260 addTag("h2",i18n( "Remote: " ) +event->summary());
261 } 261 }
262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
263 if ( mColorMode ) 263 if ( mColorMode )
264 mText += "</font>"; 264 mText += "</font>";
265 } 265 }
266 mMailSubject += i18n( "Meeting " )+ event->summary(); 266 mMailSubject += i18n( "Meeting " )+ event->summary();
267 if (event->cancelled ()) { 267 if (event->cancelled ()) {
268 mText +="<font color=\"#B00000\">"; 268 mText +="<font color=\"#B00000\">";
269 addTag("i",i18n("This event has been cancelled!")); 269 addTag("i",i18n("This event has been cancelled!"));
270 mText.append("<br>"); 270 mText.append("<br>");
271 mText += "</font>"; 271 mText += "</font>";
272 mMailSubject += i18n("(cancelled)"); 272 mMailSubject += i18n("(cancelled)");
273 } 273 }
274 if (!event->location().isEmpty()) { 274 if (!event->location().isEmpty()) {
275 addTag("b",i18n("Location: ")); 275 addTag("b",i18n("Location: "));
276 mText.append(event->location()+"<br>"); 276 mText.append(event->location()+"<br>");
277 mMailSubject += i18n(" at ") + event->location(); 277 mMailSubject += i18n(" at ") + event->location();
278 } 278 }
279 if (event->doesFloat()) { 279 if (event->doesFloat()) {
280 if (event->isMultiDay()) { 280 if (event->isMultiDay()) {
281 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 281 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
282 .arg(event->dtStartDateStr(shortDate)) 282 .arg(event->dtStartDateStr(shortDate))
283 .arg(event->dtEndDateStr(shortDate))); 283 .arg(event->dtEndDateStr(shortDate)));
284 } else { 284 } else {
285 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 285 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
286 } 286 }
287 } else { 287 } else {
288 if (event->isMultiDay()) { 288 if (event->isMultiDay()) {
289 mText.append(i18n("<p><b>From:</b> %1</p> ") 289 mText.append(i18n("<p><b>From:</b> %1</p> ")
290 .arg(event->dtStartStr( shortDate))); 290 .arg(event->dtStartStr( shortDate)));
291 mText.append(i18n("<p><b>To:</b> %1</p>") 291 mText.append(i18n("<p><b>To:</b> %1</p>")
292 .arg(event->dtEndStr(shortDate))); 292 .arg(event->dtEndStr(shortDate)));
293 } else { 293 } else {
294 mText.append(i18n("<p><b>On:</b> %1</p> ") 294 mText.append(i18n("<p><b>On:</b> %1</p> ")
295 .arg(event->dtStartDateStr( shortDate ))); 295 .arg(event->dtStartDateStr( shortDate )));
296 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 296 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
297 .arg(event->dtStartTimeStr()) 297 .arg(event->dtStartTimeStr())
298 .arg(event->dtEndTimeStr())); 298 .arg(event->dtEndTimeStr()));
299 } 299 }
300 } 300 }
301 301
302 if (event->recurrence()->doesRecur()) { 302 if (event->recurrence()->doesRecur()) {
303 303
304 QString recurText = event->recurrence()->recurrenceText(); 304 QString recurText = event->recurrence()->recurrenceText();
305 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 305 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
306 bool last; 306 bool ok;
307 QDate start = QDate::currentDate(); 307 QDate start = QDate::currentDate();
308 QDate next; 308 QDateTime next;
309 next = event->recurrence()->getPreviousDate( start , &last ); 309 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
310 if ( !last ) { 310 if ( ok ) {
311 next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
312 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 311 addTag("p",i18n("<b>Next recurrence is on:</b>") );
313 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 312 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
314 QDateTime nextdt = QDateTime( next, event->dtStart().time()); 313 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
315 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true );
316 314
317 } else { 315 } else {
318 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 316 bool last;
319 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 317 QDate nextd;
318 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
319 if ( last ) {
320 addTag("p",i18n("<b>Last recurrence was on:</b>") );
321 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
322 }
320 } 323 }
321 } else { 324 } else {
322 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 325 mMailSubject += i18n(" - " )+event->dtStartStr( true );
323 326
324 } 327 }
325 328
326 329
327 if (event->isAlarmEnabled()) { 330 if (event->isAlarmEnabled()) {
328 Alarm *alarm =event->alarms().first() ; 331 Alarm *alarm =event->alarms().first() ;
329 QDateTime t = alarm->time(); 332 QDateTime t = alarm->time();
330 int min = t.secsTo( event->dtStart() )/60; 333 int min = t.secsTo( event->dtStart() )/60;
331 QString s =i18n("( %1 min before )").arg( min ); 334 QString s =i18n("( %1 min before )").arg( min );
332 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 335 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
333 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 336 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
334 //addTag("p",s); 337 //addTag("p",s);
335 } 338 }
336 339
337 addTag("b",i18n("Access: ")); 340 addTag("b",i18n("Access: "));
338 mText.append(event->secrecyStr()+"<br>"); 341 mText.append(event->secrecyStr()+"<br>");
339 if (!event->description().isEmpty()) { 342 if (!event->description().isEmpty()) {
340 addTag("p",i18n("<b>Details: </b>")); 343 addTag("p",i18n("<b>Details: </b>"));
341 addTag("p",event->description()); 344 addTag("p",event->description());
342 } 345 }
343 346
344 formatCategories(event); 347 formatCategories(event);
345 348
346 formatReadOnly(event); 349 formatReadOnly(event);
347 formatAttendees(event); 350 formatAttendees(event);
348 351
349 setText(mText); 352 setText(mText);
350 //QWhatsThis::add(this,mText); 353 //QWhatsThis::add(this,mText);
351 354
352} 355}
353 356
354void KOEventViewer::appendTodo(Todo *event, int mode ) 357void KOEventViewer::appendTodo(Todo *event, int mode )
355{ 358{
356 mMailSubject = ""; 359 mMailSubject = "";
357 mCurrentIncidence = event; 360 mCurrentIncidence = event;
358 topLevelWidget()->setCaption(i18n("Todo Viewer")); 361 topLevelWidget()->setCaption(i18n("Todo Viewer"));
359 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 362 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
360 if (mode == 0 ) 363 if (mode == 0 )
361 addTag("h2",event->summary()); 364 addTag("h2",event->summary());
362 else { 365 else {
363 if ( mColorMode == 1 ) { 366 if ( mColorMode == 1 ) {
364 mText +="<font color=\"#00A000\">"; 367 mText +="<font color=\"#00A000\">";
365 } 368 }
366 if ( mColorMode == 2 ) { 369 if ( mColorMode == 2 ) {
367 mText +="<font color=\"#B00000\">"; 370 mText +="<font color=\"#B00000\">";
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 6d07d4c..0d9c3f4 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -59,107 +59,113 @@ void KIncidenceFormatter::setEvent(Event *event)
59 } 59 }
60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
61 if ( mode == 1 ) { 61 if ( mode == 1 ) {
62 addTag("h2",i18n( "Local: " ) +event->summary()); 62 addTag("h2",i18n( "Local: " ) +event->summary());
63 } else { 63 } else {
64 addTag("h2",i18n( "Remote: " ) +event->summary()); 64 addTag("h2",i18n( "Remote: " ) +event->summary());
65 } 65 }
66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
67 if ( mColorMode ) 67 if ( mColorMode )
68 mText += "</font>"; 68 mText += "</font>";
69 } 69 }
70 if (event->cancelled ()) { 70 if (event->cancelled ()) {
71 mText +="<font color=\"#B00000\">"; 71 mText +="<font color=\"#B00000\">";
72 addTag("i",i18n("This event has been cancelled!")); 72 addTag("i",i18n("This event has been cancelled!"));
73 mText.append("<br>"); 73 mText.append("<br>");
74 mText += "</font>"; 74 mText += "</font>";
75 } 75 }
76 if (!event->location().isEmpty()) { 76 if (!event->location().isEmpty()) {
77 addTag("b",i18n("Location: ")); 77 addTag("b",i18n("Location: "));
78 mText.append(event->location()+"<br>"); 78 mText.append(event->location()+"<br>");
79 } 79 }
80 if (event->doesFloat()) { 80 if (event->doesFloat()) {
81 if (event->isMultiDay()) { 81 if (event->isMultiDay()) {
82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
83 .arg(event->dtStartDateStr(shortDate)) 83 .arg(event->dtStartDateStr(shortDate))
84 .arg(event->dtEndDateStr(shortDate))); 84 .arg(event->dtEndDateStr(shortDate)));
85 } else { 85 } else {
86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
87 } 87 }
88 } else { 88 } else {
89 if (event->isMultiDay()) { 89 if (event->isMultiDay()) {
90 mText.append(i18n("<p><b>From:</b> %1</p> ") 90 mText.append(i18n("<p><b>From:</b> %1</p> ")
91 .arg(event->dtStartStr( shortDate))); 91 .arg(event->dtStartStr( shortDate)));
92 mText.append(i18n("<p><b>To:</b> %1</p>") 92 mText.append(i18n("<p><b>To:</b> %1</p>")
93 .arg(event->dtEndStr(shortDate))); 93 .arg(event->dtEndStr(shortDate)));
94 } else { 94 } else {
95 mText.append(i18n("<p><b>On:</b> %1</p> ") 95 mText.append(i18n("<p><b>On:</b> %1</p> ")
96 .arg(event->dtStartDateStr( shortDate ))); 96 .arg(event->dtStartDateStr( shortDate )));
97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
98 .arg(event->dtStartTimeStr()) 98 .arg(event->dtStartTimeStr())
99 .arg(event->dtEndTimeStr())); 99 .arg(event->dtEndTimeStr()));
100 } 100 }
101 } 101 }
102 102
103 if (event->recurrence()->doesRecur()) { 103 if (event->recurrence()->doesRecur()) {
104 104
105 QString recurText = event->recurrence()->recurrenceText(); 105 QString recurText = event->recurrence()->recurrenceText();
106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
107 bool last; 107
108 bool ok;
108 QDate start = QDate::currentDate(); 109 QDate start = QDate::currentDate();
109 QDate next; 110 QDateTime next;
110 next = event->recurrence()->getPreviousDate( start , &last ); 111 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
111 if ( !last ) { 112 if ( ok ) {
112 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 113 addTag("p",i18n("<b>Next recurrence is on:</b>") );
113 addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); 114 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
114 //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 115
115 } else { 116 } else {
116 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 117 bool last;
117 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 118 QDate nextd;
119 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
120 if ( last ) {
121 addTag("p",i18n("<b>Last recurrence was on:</b>") );
122 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
123 }
118 } 124 }
119 } 125 }
120 126
121 127
122 if (event->isAlarmEnabled()) { 128 if (event->isAlarmEnabled()) {
123 Alarm *alarm =event->alarms().first() ; 129 Alarm *alarm =event->alarms().first() ;
124 QDateTime t = alarm->time(); 130 QDateTime t = alarm->time();
125 int min = t.secsTo( event->dtStart() )/60; 131 int min = t.secsTo( event->dtStart() )/60;
126 QString s =i18n("(%1 min before)").arg( min ); 132 QString s =i18n("(%1 min before)").arg( min );
127 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 133 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
128 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 134 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
129 //addTag("p",s); 135 //addTag("p",s);
130 } 136 }
131 137
132 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 138 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
133 // mText.append(event->secrecyStr()+"<br>"); 139 // mText.append(event->secrecyStr()+"<br>");
134 formatCategories(event); 140 formatCategories(event);
135 if (!event->description().isEmpty()) { 141 if (!event->description().isEmpty()) {
136 addTag("p",i18n("<b>Details: </b>")); 142 addTag("p",i18n("<b>Details: </b>"));
137 addTag("p",event->description()); 143 addTag("p",event->description());
138 } 144 }
139 145
140 146
141 formatReadOnly(event); 147 formatReadOnly(event);
142 formatAttendees(event); 148 formatAttendees(event);
143 149
144 150
145} 151}
146 152
147void KIncidenceFormatter::setTodo(Todo *event ) 153void KIncidenceFormatter::setTodo(Todo *event )
148{ 154{
149 int mode = 0; 155 int mode = 0;
150 mCurrentIncidence = event; 156 mCurrentIncidence = event;
151 bool shortDate = true; 157 bool shortDate = true;
152 if (mode == 0 ) 158 if (mode == 0 )
153 addTag("h3",event->summary()); 159 addTag("h3",event->summary());
154 else { 160 else {
155 if ( mColorMode == 1 ) { 161 if ( mColorMode == 1 ) {
156 mText +="<font color=\"#00A000\">"; 162 mText +="<font color=\"#00A000\">";
157 } 163 }
158 if ( mColorMode == 2 ) { 164 if ( mColorMode == 2 ) {
159 mText +="<font color=\"#B00000\">"; 165 mText +="<font color=\"#B00000\">";
160 } 166 }
161 if ( mode == 1 ) { 167 if ( mode == 1 ) {
162 addTag("h2",i18n( "Local: " ) +event->summary()); 168 addTag("h2",i18n( "Local: " ) +event->summary());
163 } else { 169 } else {
164 addTag("h2",i18n( "Remote: " ) +event->summary()); 170 addTag("h2",i18n( "Remote: " ) +event->summary());
165 } 171 }
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index e84f672..5181eaf 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -834,96 +834,97 @@ QDateTime Recurrence::getNextDateTime(const QDateTime &preDateTime, bool *last)
834 case rYearlyMonth: 834 case rYearlyMonth:
835 case rYearlyDay: 835 case rYearlyDay:
836 case rYearlyPos: { 836 case rYearlyPos: {
837 QDate preDate = preDateTime.date(); 837 QDate preDate = preDateTime.date();
838 if (!mFloats && mRecurStart.time() > preDateTime.time()) 838 if (!mFloats && mRecurStart.time() > preDateTime.time())
839 preDate = preDate.addDays(-1); 839 preDate = preDate.addDays(-1);
840 return QDateTime(getNextDateNoTime(preDate, last), mRecurStart.time()); 840 return QDateTime(getNextDateNoTime(preDate, last), mRecurStart.time());
841 } 841 }
842 default: 842 default:
843 return QDateTime(); 843 return QDateTime();
844 } 844 }
845 845
846 // It's a sub-daily recurrence 846 // It's a sub-daily recurrence
847 if (preDateTime < mRecurStart) 847 if (preDateTime < mRecurStart)
848 return mRecurStart; 848 return mRecurStart;
849 int count = mRecurStart.secsTo(preDateTime) / freq + 2; 849 int count = mRecurStart.secsTo(preDateTime) / freq + 2;
850 if (rDuration > 0) { 850 if (rDuration > 0) {
851 if (count > rDuration) 851 if (count > rDuration)
852 return QDateTime(); 852 return QDateTime();
853 if (last && count == rDuration) 853 if (last && count == rDuration)
854 *last = true; 854 *last = true;
855 } 855 }
856 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); 856 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq);
857 if (rDuration == 0) { 857 if (rDuration == 0) {
858 if (endtime > rEndDateTime) 858 if (endtime > rEndDateTime)
859 return QDateTime(); 859 return QDateTime();
860 if (last && endtime == rEndDateTime) 860 if (last && endtime == rEndDateTime)
861 *last = true; 861 *last = true;
862 } 862 }
863 return endtime; 863 return endtime;
864} 864}
865 865
866QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const 866QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const
867{ 867{
868 if (last) 868 if (last)
869 *last = false; 869 *last = false;
870 switch (recurs) 870 switch (recurs)
871 { 871 {
872 case rMinutely: 872 case rMinutely:
873 case rHourly: 873 case rHourly:
874 return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date(); 874 return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date();
875 case rDaily: 875 case rDaily:
876 case rWeekly: 876 case rWeekly:
877 case rMonthlyPos: 877 case rMonthlyPos:
878 case rMonthlyDay: 878 case rMonthlyDay:
879 case rYearlyMonth: 879 case rYearlyMonth:
880 case rYearlyDay: 880 case rYearlyDay:
881 case rYearlyPos: 881 case rYearlyPos:
882 qDebug("Recurrence::getNextDate: MAY BE BROKEN ");
882 return getNextDateNoTime(preDate, last); 883 return getNextDateNoTime(preDate, last);
883 default: 884 default:
884 return QDate(); 885 return QDate();
885 } 886 }
886} 887}
887 888
888 889
889QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const 890QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const
890{ 891{
891 if (last) 892 if (last)
892 *last = false; 893 *last = false;
893 int freq; 894 int freq;
894 switch (recurs) 895 switch (recurs)
895 { 896 {
896 case rMinutely: 897 case rMinutely:
897 freq = rFreq * 60; 898 freq = rFreq * 60;
898 break; 899 break;
899 case rHourly: 900 case rHourly:
900 freq = rFreq * 3600; 901 freq = rFreq * 3600;
901 break; 902 break;
902 case rDaily: 903 case rDaily:
903 case rWeekly: 904 case rWeekly:
904 case rMonthlyPos: 905 case rMonthlyPos:
905 case rMonthlyDay: 906 case rMonthlyDay:
906 case rYearlyMonth: 907 case rYearlyMonth:
907 case rYearlyDay: 908 case rYearlyDay:
908 case rYearlyPos: { 909 case rYearlyPos: {
909 QDate afterDate = afterDateTime.date(); 910 QDate afterDate = afterDateTime.date();
910 if (!mFloats && mRecurStart.time() < afterDateTime.time()) 911 if (!mFloats && mRecurStart.time() < afterDateTime.time())
911 afterDate = afterDate.addDays(1); 912 afterDate = afterDate.addDays(1);
912 return QDateTime(getPreviousDateNoTime(afterDate, last), mRecurStart.time()); 913 return QDateTime(getPreviousDateNoTime(afterDate, last), mRecurStart.time());
913 } 914 }
914 default: 915 default:
915 return QDateTime(); 916 return QDateTime();
916 } 917 }
917 918
918 // It's a sub-daily recurrence 919 // It's a sub-daily recurrence
919 if (afterDateTime <= mRecurStart) 920 if (afterDateTime <= mRecurStart)
920 return QDateTime(); 921 return QDateTime();
921 int count = (mRecurStart.secsTo(afterDateTime) - 1) / freq + 1; 922 int count = (mRecurStart.secsTo(afterDateTime) - 1) / freq + 1;
922 if (rDuration > 0) { 923 if (rDuration > 0) {
923 if (count > rDuration) 924 if (count > rDuration)
924 count = rDuration; 925 count = rDuration;
925 if (last && count == rDuration) 926 if (last && count == rDuration)
926 *last = true; 927 *last = true;
927 } 928 }
928 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq); 929 QDateTime endtime = mRecurStart.addSecs((count - 1)*freq);
929 if (rDuration == 0) { 930 if (rDuration == 0) {
@@ -1121,96 +1122,97 @@ bool Recurrence::recursYearlyByPos(const QDate &qd) const
1121 rDuration == -1)) { 1122 rDuration == -1)) {
1122 // The date queried falls within the range of the event. 1123 // The date queried falls within the range of the event.
1123 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { 1124 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
1124 if (month == *qlin.current()) { 1125 if (month == *qlin.current()) {
1125 // The month recurs 1126 // The month recurs
1126 QValueList<int> days; 1127 QValueList<int> days;
1127 getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek()); 1128 getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek());
1128 for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) { 1129 for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
1129 if (*it == day) 1130 if (*it == day)
1130 return true; 1131 return true;
1131 } 1132 }
1132 } 1133 }
1133 } 1134 }
1134 } 1135 }
1135 } 1136 }
1136 return false; 1137 return false;
1137} 1138}
1138 1139
1139bool Recurrence::recursYearlyByDay(const QDate &qd) const 1140bool Recurrence::recursYearlyByDay(const QDate &qd) const
1140{ 1141{
1141 QDate dStart = mRecurStart.date(); 1142 QDate dStart = mRecurStart.date();
1142 // calculate how many years ahead this date is from the original 1143 // calculate how many years ahead this date is from the original
1143 // event's date 1144 // event's date
1144 int yearsAhead = (qd.year() - dStart.year()); 1145 int yearsAhead = (qd.year() - dStart.year());
1145 if (yearsAhead % rFreq == 0) { 1146 if (yearsAhead % rFreq == 0) {
1146 // The date is in a year which recurs 1147 // The date is in a year which recurs
1147 if (qd >= dStart 1148 if (qd >= dStart
1148 && ((rDuration > 0 && qd <= endDate()) || 1149 && ((rDuration > 0 && qd <= endDate()) ||
1149 (rDuration == 0 && qd <= rEndDateTime.date()) || 1150 (rDuration == 0 && qd <= rEndDateTime.date()) ||
1150 rDuration == -1)) { 1151 rDuration == -1)) {
1151 // The date queried falls within the range of the event. 1152 // The date queried falls within the range of the event.
1152 int i = qd.dayOfYear(); 1153 int i = qd.dayOfYear();
1153 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) { 1154 for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
1154 if (i == *qlin.current()) 1155 if (i == *qlin.current())
1155 return true; 1156 return true;
1156 } 1157 }
1157 } 1158 }
1158 } 1159 }
1159 return false; 1160 return false;
1160} 1161}
1161 1162
1162/* Get the date of the next recurrence, after the specified date. 1163/* Get the date of the next recurrence, after the specified date.
1163 * If 'last' is non-null, '*last' is set to true if the next recurrence is the 1164 * If 'last' is non-null, '*last' is set to true if the next recurrence is the
1164 * last recurrence, else false. 1165 * last recurrence, else false.
1165 * Reply = date of next recurrence, or invalid date if none. 1166 * Reply = date of next recurrence, or invalid date if none.
1166 */ 1167 */
1167QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const 1168QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1168{ 1169{
1170
1169 if (last) 1171 if (last)
1170 *last = false; 1172 *last = false;
1171 QDate dStart = mRecurStart.date(); 1173 QDate dStart = mRecurStart.date();
1172 if (preDate < dStart) 1174 if (preDate < dStart)
1173 return dStart; 1175 return dStart;
1174 QDate earliestDate = preDate.addDays(1); 1176 QDate earliestDate = preDate.addDays(1);
1175 QDate nextDate; 1177 QDate nextDate;
1176 1178
1177 switch (recurs) { 1179 switch (recurs) {
1178 case rDaily: 1180 case rDaily:
1179 nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq); 1181 nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq);
1180 break; 1182 break;
1181 1183
1182 case rWeekly: { 1184 case rWeekly: {
1183 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart 1185 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart
1184 int earliestDayOfWeek = earliestDate.dayOfWeek(); 1186 int earliestDayOfWeek = earliestDate.dayOfWeek();
1185 int weeksAhead = start.daysTo(earliestDate) / 7; 1187 int weeksAhead = start.daysTo(earliestDate) / 7;
1186 int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week 1188 int notThisWeek = weeksAhead % rFreq; // zero if this week is a recurring week
1187 weeksAhead -= notThisWeek; // latest week which recurred 1189 weeksAhead -= notThisWeek; // latest week which recurred
1188 int weekday = 0; 1190 int weekday = 0;
1189 // First check for any remaining day this week, if this week is a recurring week 1191 // First check for any remaining day this week, if this week is a recurring week
1190 if (!notThisWeek) 1192 if (!notThisWeek)
1191 weekday = getFirstDayInWeek(earliestDayOfWeek); 1193 weekday = getFirstDayInWeek(earliestDayOfWeek);
1192 // Check for a day in the next scheduled week 1194 // Check for a day in the next scheduled week
1193 if (!weekday && earliestDayOfWeek > 1) 1195 if (!weekday && earliestDayOfWeek > 1)
1194 weekday = getFirstDayInWeek(rWeekStart) + rFreq*7; 1196 weekday = getFirstDayInWeek(rWeekStart) + rFreq*7;
1195 if (weekday) 1197 if (weekday)
1196 nextDate = start.addDays(weeksAhead*7 + weekday - 1); 1198 nextDate = start.addDays(weeksAhead*7 + weekday - 1);
1197 break; 1199 break;
1198 } 1200 }
1199 case rMonthlyDay: 1201 case rMonthlyDay:
1200 case rMonthlyPos: { 1202 case rMonthlyPos: {
1201 int startYear = dStart.year(); 1203 int startYear = dStart.year();
1202 int startMonth = dStart.month(); // 1..12 1204 int startMonth = dStart.month(); // 1..12
1203 int earliestYear = earliestDate.year(); 1205 int earliestYear = earliestDate.year();
1204 int monthsAhead = (earliestYear - startYear)*12 + earliestDate.month() - startMonth; 1206 int monthsAhead = (earliestYear - startYear)*12 + earliestDate.month() - startMonth;
1205 int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month 1207 int notThisMonth = monthsAhead % rFreq; // zero if this month is a recurring month
1206 monthsAhead -= notThisMonth; // latest month which recurred 1208 monthsAhead -= notThisMonth; // latest month which recurred
1207 // Check for the first later day in the current month 1209 // Check for the first later day in the current month
1208 if (!notThisMonth) 1210 if (!notThisMonth)
1209 nextDate = getFirstDateInMonth(earliestDate); 1211 nextDate = getFirstDateInMonth(earliestDate);
1210 if (!nextDate.isValid() && earliestDate.day() > 1) { 1212 if (!nextDate.isValid() && earliestDate.day() > 1) {
1211 // Check for a day in the next scheduled month 1213 // Check for a day in the next scheduled month
1212 int months = startMonth - 1 + monthsAhead + rFreq; 1214 int months = startMonth - 1 + monthsAhead + rFreq;
1213 nextDate = getFirstDateInMonth(QDate(startYear + months/12, months%12 + 1, 1)); 1215 nextDate = getFirstDateInMonth(QDate(startYear + months/12, months%12 + 1, 1));
1214 } 1216 }
1215 break; 1217 break;
1216 } 1218 }
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 09ad0c8..35d4916 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -833,97 +833,97 @@ void KToolBar::hideItem (int id)
833 w->hide(); 833 w->hide();
834} 834}
835 835
836 836
837void KToolBar::showItem (int id) 837void KToolBar::showItem (int id)
838{ 838{
839 QWidget *w = getWidget(id); 839 QWidget *w = getWidget(id);
840 if ( w ) 840 if ( w )
841 w->show(); 841 w->show();
842} 842}
843 843
844 844
845int KToolBar::itemIndex (int id) 845int KToolBar::itemIndex (int id)
846{ 846{
847 QWidget *w = getWidget(id); 847 QWidget *w = getWidget(id);
848 return w ? widgets.findRef(w) : -1; 848 return w ? widgets.findRef(w) : -1;
849} 849}
850 850
851 851
852void KToolBar::setFullSize(bool flag ) 852void KToolBar::setFullSize(bool flag )
853{ 853{
854 setHorizontalStretchable( flag ); 854 setHorizontalStretchable( flag );
855 setVerticalStretchable( flag ); 855 setVerticalStretchable( flag );
856} 856}
857 857
858 858
859bool KToolBar::fullSize() const 859bool KToolBar::fullSize() const
860{ 860{
861 return isHorizontalStretchable() || isVerticalStretchable(); 861 return isHorizontalStretchable() || isVerticalStretchable();
862} 862}
863 863
864 864
865void KToolBar::enableMoving(bool flag ) 865void KToolBar::enableMoving(bool flag )
866{ 866{
867//US setMovingEnabled(flag); 867//US setMovingEnabled(flag);
868 this->mainWindow()->setToolBarsMovable(flag); 868 this->mainWindow()->setToolBarsMovable(flag);
869} 869}
870 870
871 871
872void KToolBar::setBarPos (BarPosition bpos) 872void KToolBar::setBarPos (BarPosition bpos)
873{ 873{
874 if ( !mainWindow() ) 874 if ( !mainWindow() )
875 return; 875 return;
876//US mainWindow()->moveDockWindow( this, (Dock)bpos ); 876//US mainWindow()->moveDockWindow( this, (Dock)bpos );
877 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); 877 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
878} 878}
879 879
880 880
881KToolBar::BarPosition KToolBar::barPos() const 881const KToolBar::BarPosition KToolBar::barPos()
882{ 882{
883 if ( !(QMainWindow*)mainWindow() ) 883 if ( !(QMainWindow*)mainWindow() )
884 return KToolBar::Top; 884 return KToolBar::Top;
885//US Dock dock; 885//US Dock dock;
886 QMainWindow::ToolBarDock dock; 886 QMainWindow::ToolBarDock dock;
887 int dm1, dm2; 887 int dm1, dm2;
888 bool dm3; 888 bool dm3;
889 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); 889 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
890//US if ( dock == DockUnmanaged ) { 890//US if ( dock == DockUnmanaged ) {
891 if ( dock == QMainWindow::Unmanaged ) { 891 if ( dock == QMainWindow::Unmanaged ) {
892 return (KToolBar::BarPosition)Top; 892 return (KToolBar::BarPosition)Top;
893 } 893 }
894 return (BarPosition)dock; 894 return (BarPosition)dock;
895} 895}
896 896
897 897
898bool KToolBar::enable(BarStatus stat) 898bool KToolBar::enable(BarStatus stat)
899{ 899{
900 bool mystat = isVisible(); 900 bool mystat = isVisible();
901 901
902 if ( (stat == Toggle && mystat) || stat == Hide ) 902 if ( (stat == Toggle && mystat) || stat == Hide )
903 hide(); 903 hide();
904 else 904 else
905 show(); 905 show();
906 906
907 return isVisible() == mystat; 907 return isVisible() == mystat;
908} 908}
909 909
910 910
911void KToolBar::setMaxHeight ( int h ) 911void KToolBar::setMaxHeight ( int h )
912{ 912{
913 setMaximumHeight( h ); 913 setMaximumHeight( h );
914} 914}
915 915
916int KToolBar::maxHeight() 916int KToolBar::maxHeight()
917{ 917{
918 return maximumHeight(); 918 return maximumHeight();
919} 919}
920 920
921 921
922void KToolBar::setMaxWidth (int dw) 922void KToolBar::setMaxWidth (int dw)
923{ 923{
924 setMaximumWidth( dw ); 924 setMaximumWidth( dw );
925} 925}
926 926
927 927
928int KToolBar::maxWidth() 928int KToolBar::maxWidth()
929{ 929{
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 49ff856..7a5c114 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -701,97 +701,97 @@ public:
701 701
702 /** 702 /**
703 * Show item. 703 * Show item.
704 */ 704 */
705 void showItem (int id); 705 void showItem (int id);
706 706
707 /** 707 /**
708 * Returns the index of the given item. 708 * Returns the index of the given item.
709 * 709 *
710 * KDE4: make this const! 710 * KDE4: make this const!
711 */ 711 */
712 int itemIndex (int id); 712 int itemIndex (int id);
713 713
714 /** 714 /**
715 * Set toolbar to full parent size (default). 715 * Set toolbar to full parent size (default).
716 * 716 *
717 * In full size mode the bar 717 * In full size mode the bar
718 * extends over the parent's full width or height. If the mode is disabled 718 * extends over the parent's full width or height. If the mode is disabled
719 * the toolbar tries to take as much space as it needs without wrapping, but 719 * the toolbar tries to take as much space as it needs without wrapping, but
720 * it does not exceed the parent box. You can force a certain width or 720 * it does not exceed the parent box. You can force a certain width or
721 * height with @ref setMaxWidth() or @ref setMaxHeight(). 721 * height with @ref setMaxWidth() or @ref setMaxHeight().
722 * 722 *
723 * If you want to use right-aligned items or auto-sized items you must use 723 * If you want to use right-aligned items or auto-sized items you must use
724 * full size mode. 724 * full size mode.
725 */ 725 */
726 void setFullSize(bool flag = true); 726 void setFullSize(bool flag = true);
727 727
728 /** 728 /**
729 * @return @p true if the full-size mode is enabled. Otherwise 729 * @return @p true if the full-size mode is enabled. Otherwise
730 * it returns @false. 730 * it returns @false.
731 */ 731 */
732 bool fullSize() const; 732 bool fullSize() const;
733 733
734 /** 734 /**
735 * @deprecated use setMovingEnabled(bool) instead. 735 * @deprecated use setMovingEnabled(bool) instead.
736 * Enable or disable moving of toolbar. 736 * Enable or disable moving of toolbar.
737 */ 737 */
738 void enableMoving(bool flag = true); 738 void enableMoving(bool flag = true);
739 739
740 /** 740 /**
741 * Set position of toolbar. 741 * Set position of toolbar.
742 * @see BarPosition() 742 * @see BarPosition()
743 */ 743 */
744 void setBarPos (BarPosition bpos); 744 void setBarPos (BarPosition bpos);
745 745
746 /** 746 /**
747 * Returns position of toolbar. 747 * Returns position of toolbar.
748 */ 748 */
749 BarPosition barPos() const; 749 const BarPosition barPos();
750 750
751 /** 751 /**
752 * @deprecated 752 * @deprecated
753 * Show, hide, or toggle toolbar. 753 * Show, hide, or toggle toolbar.
754 * 754 *
755 * This method is provided for compatibility only, 755 * This method is provided for compatibility only,
756 * please use show() and/or hide() instead. 756 * please use show() and/or hide() instead.
757 * @see BarStatus 757 * @see BarStatus
758 */ 758 */
759 bool enable(BarStatus stat); 759 bool enable(BarStatus stat);
760 760
761 /** 761 /**
762 * @deprecated 762 * @deprecated
763 * Use setMaximumHeight() instead. 763 * Use setMaximumHeight() instead.
764 */ 764 */
765 void setMaxHeight (int h); // Set max height for vertical toolbars 765 void setMaxHeight (int h); // Set max height for vertical toolbars
766 766
767 /** 767 /**
768 * @deprecated 768 * @deprecated
769 * Use maximumHeight() instead. 769 * Use maximumHeight() instead.
770 * Returns the value that was set with @ref setMaxHeight(). 770 * Returns the value that was set with @ref setMaxHeight().
771 */ 771 */
772 int maxHeight(); 772 int maxHeight();
773 773
774 /** 774 /**
775 * @deprecated 775 * @deprecated
776 * Use setMaximumWidth() instead. 776 * Use setMaximumWidth() instead.
777 * Set maximal width of horizontal (top or bottom) toolbar. 777 * Set maximal width of horizontal (top or bottom) toolbar.
778 */ 778 */
779 void setMaxWidth (int dw); 779 void setMaxWidth (int dw);
780 780
781 /** 781 /**
782 * @deprecated 782 * @deprecated
783 * Use maximumWidth() instead. 783 * Use maximumWidth() instead.
784 * Returns the value that was set with @ref setMaxWidth(). 784 * Returns the value that was set with @ref setMaxWidth().
785 */ 785 */
786 int maxWidth(); 786 int maxWidth();
787 787
788 /** 788 /**
789 * Set title for toolbar when it floats. 789 * Set title for toolbar when it floats.
790 * 790 *
791 * Titles are however not (yet) 791 * Titles are however not (yet)
792 * visible. You can't change toolbar's title while it's floating. 792 * visible. You can't change toolbar's title while it's floating.
793 */ 793 */
794 void setTitle (const QString& _title); 794 void setTitle (const QString& _title);
795 795
796 /** 796 /**
797 * @deprecated 797 * @deprecated