summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kdatenavigator.cpp7
-rw-r--r--korganizer/koeditorrecurrence.cpp2
2 files changed, 6 insertions, 3 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 7d0c516..b420351 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -236,36 +236,39 @@ void KDateNavigator::updateView()
236 236
237 int i; 237 int i;
238 238
239// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 239// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
240 daymatrix->updateView(); 240 daymatrix->updateView();
241 241
242 // set the week numbers. 242 // set the week numbers.
243 for(i = 0; i < 6; i++) { 243 for(i = 0; i < 6; i++) {
244 QString weeknum; 244 QString weeknum;
245 // remember, according to ISO 8601, the first week of the year is the 245 // remember, according to ISO 8601, the first week of the year is the
246 // first week that contains a thursday. Thus we must subtract off 4, 246 // first week that contains a thursday. Thus we must subtract off 4,
247 // not just 1. 247 // not just 1.
248 248
249 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 249 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
250 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); 250 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4)));
251 251
252 int add = 0;
253 if ( ! KGlobal::locale()->weekStartsMonday() )
254 ++add;
252 if (dayOfYear % 7 != 0) 255 if (dayOfYear % 7 != 0)
253 weeknum.setNum(dayOfYear / 7 + 1); 256 weeknum.setNum(dayOfYear / 7 + 1+add);
254 else 257 else
255 weeknum.setNum(dayOfYear / 7); 258 weeknum.setNum(dayOfYear / 7 +add);
256 weeknos[i]->setText(weeknum); 259 weeknos[i]->setText(weeknum);
257 } 260 }
258 261
259 setUpdatesEnabled( true ); 262 setUpdatesEnabled( true );
260// kdDebug() << "updateView() -> repaint()" << endl; 263// kdDebug() << "updateView() -> repaint()" << endl;
261 repaint(); 264 repaint();
262 daymatrix->repaint(); 265 daymatrix->repaint();
263} 266}
264 267
265void KDateNavigator::updateConfig() 268void KDateNavigator::updateConfig()
266{ 269{
267 int day; 270 int day;
268 for(int i=0; i<7; i++) { 271 for(int i=0; i<7; i++) {
269 // take the first letter of the day name to be the abbreviation 272 // take the first letter of the day name to be the abbreviation
270 if (KGlobal::locale()->weekStartsMonday()) { 273 if (KGlobal::locale()->weekStartsMonday()) {
271 day = i+1; 274 day = i+1;
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 584d1ed..4209e10 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -1039,33 +1039,33 @@ void KOEditorRecurrence::writeEvent( Event *event )
1039 int recurrenceType = mRecurrenceChooser->type(); 1039 int recurrenceType = mRecurrenceChooser->type();
1040 1040
1041 if ( recurrenceType == RecurrenceChooser::Daily ) { 1041 if ( recurrenceType == RecurrenceChooser::Daily ) {
1042 int freq = mDaily->frequency(); 1042 int freq = mDaily->frequency();
1043 if ( duration != 0 ) r->setDaily( freq, duration ); 1043 if ( duration != 0 ) r->setDaily( freq, duration );
1044 else r->setDaily( freq, endDate ); 1044 else r->setDaily( freq, endDate );
1045 } else if ( recurrenceType == RecurrenceChooser::Weekly ) { 1045 } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
1046 int freq = mWeekly->frequency(); 1046 int freq = mWeekly->frequency();
1047 QBitArray days = mWeekly->days(); 1047 QBitArray days = mWeekly->days();
1048 int j; 1048 int j;
1049 bool found = false; 1049 bool found = false;
1050 for (j = 0; j < 7 ; ++j ) { 1050 for (j = 0; j < 7 ; ++j ) {
1051 found |=days.at(j); 1051 found |=days.at(j);
1052 } 1052 }
1053 if ( !found ) { 1053 if ( !found ) {
1054 days.setBit( event->dtStart().date().dayOfWeek()-1); 1054 days.setBit( event->dtStart().date().dayOfWeek()-1);
1055 qDebug("bit set %d "); 1055 qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1);
1056 } 1056 }
1057 if ( duration != 0 ) r->setWeekly( freq, days, duration ); 1057 if ( duration != 0 ) r->setWeekly( freq, days, duration );
1058 else r->setWeekly( freq, days, endDate ); 1058 else r->setWeekly( freq, days, endDate );
1059 } else if ( recurrenceType == RecurrenceChooser::Monthly ) { 1059 } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
1060 int freq = mMonthly->frequency(); 1060 int freq = mMonthly->frequency();
1061 if ( mMonthly->byPos() ) { 1061 if ( mMonthly->byPos() ) {
1062 int pos = mMonthly->count(); 1062 int pos = mMonthly->count();
1063 1063
1064 QBitArray days( 7 ); 1064 QBitArray days( 7 );
1065 days.fill( false ); 1065 days.fill( false );
1066 1066
1067 days.setBit( mMonthly->weekday() ); 1067 days.setBit( mMonthly->weekday() );
1068 if ( duration != 0 ) 1068 if ( duration != 0 )
1069 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 1069 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
1070 else 1070 else
1071 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 1071 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );