summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-29 22:27:13 (UTC)
committer zautrix <zautrix>2004-10-29 22:27:13 (UTC)
commitaafa695508796e86e9f267633ea5e6965d876031 (patch) (unidiff)
tree8ff03f51e99f7e90b85e8f94af157a883bcd48f8
parent8e08679a79398def54980c0e838b242d69ca6030 (diff)
downloadkdepimpi-aafa695508796e86e9f267633ea5e6965d876031.zip
kdepimpi-aafa695508796e86e9f267633ea5e6965d876031.tar.gz
kdepimpi-aafa695508796e86e9f267633ea5e6965d876031.tar.bz2
monthview exclude sat fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp19
-rw-r--r--korganizer/komonthview.cpp2
2 files changed, 17 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 749204b..c5acafd 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1249,135 +1249,148 @@ void KOAgendaView::updateEventIndicatorBottom(int newY)
1249 } 1249 }
1250 1250
1251 mEventIndicatorBottom->update(); 1251 mEventIndicatorBottom->update();
1252} 1252}
1253 1253
1254void KOAgendaView::startDrag(Event *event) 1254void KOAgendaView::startDrag(Event *event)
1255{ 1255{
1256#ifndef KORG_NODND 1256#ifndef KORG_NODND
1257 DndFactory factory( calendar() ); 1257 DndFactory factory( calendar() );
1258 ICalDrag *vd = factory.createDrag(event,this); 1258 ICalDrag *vd = factory.createDrag(event,this);
1259 if (vd->drag()) { 1259 if (vd->drag()) {
1260 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; 1260 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
1261 } 1261 }
1262#endif 1262#endif
1263} 1263}
1264 1264
1265void KOAgendaView::readSettings() 1265void KOAgendaView::readSettings()
1266{ 1266{
1267 readSettings(KOGlobals::config()); 1267 readSettings(KOGlobals::config());
1268} 1268}
1269 1269
1270void KOAgendaView::readSettings(KConfig *config) 1270void KOAgendaView::readSettings(KConfig *config)
1271{ 1271{
1272 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1272 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1273 1273
1274 config->setGroup("Views"); 1274 config->setGroup("Views");
1275 1275
1276 //#ifndef KORG_NOSPLITTER 1276 //#ifndef KORG_NOSPLITTER
1277 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1277 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1278 if (sizes.count() == 2) { 1278 if (sizes.count() == 2) {
1279 if ( sizes[0] < 20 ) { 1279 if ( sizes[0] < 20 ) {
1280 sizes[1] = sizes[1] +20 - sizes[0]; 1280 sizes[1] = sizes[1] +20 - sizes[0];
1281 sizes[0] = 20; 1281 sizes[0] = 20;
1282 } 1282 }
1283 mSplitterAgenda->setSizes(sizes); 1283 mSplitterAgenda->setSizes(sizes);
1284 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1284 // qDebug("read %d %d ",sizes[0],sizes[1] );
1285 } 1285 }
1286 //#endif 1286 //#endif
1287 1287
1288 // updateConfig(); 1288 // updateConfig();
1289} 1289}
1290 1290
1291void KOAgendaView::writeSettings(KConfig *config) 1291void KOAgendaView::writeSettings(KConfig *config)
1292{ 1292{
1293 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1293 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1294 1294
1295 config->setGroup("Views"); 1295 config->setGroup("Views");
1296 1296
1297 //#ifndef KORG_NOSPLITTER 1297 //#ifndef KORG_NOSPLITTER
1298 QValueList<int> list = mSplitterAgenda->sizes(); 1298 QValueList<int> list = mSplitterAgenda->sizes();
1299 config->writeEntry("Separator AgendaView",list); 1299 config->writeEntry("Separator AgendaView",list);
1300 //qDebug("write %d %d ", list[0],list[1] ); 1300 //qDebug("write %d %d ", list[0],list[1] );
1301 //#endif 1301 //#endif
1302} 1302}
1303 1303
1304void KOAgendaView::setHolidayMasks() 1304void KOAgendaView::setHolidayMasks()
1305{ 1305{
1306 mHolidayMask.resize(mSelectedDates.count()); 1306 mHolidayMask.resize(mSelectedDates.count());
1307 1307
1308 uint i; 1308 uint i;
1309 for(i=0;i<mSelectedDates.count();++i) { 1309 for(i=0;i<mSelectedDates.count();++i) {
1310 QDate date = mSelectedDates[i]; 1310 QDate date = mSelectedDates[i];
1311 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1311 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
1312 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1312 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1313 bool showHoliday = false;
1314 if ( KOPrefs::instance()->mExcludeHolidays ) {
1315 QPtrList<Event> events = calendar()->events( date, true );
1316 Event *event;
1317 for( event = events.first(); event; event = events.next() ) {
1318 if ( event->categories().contains("Holiday") ||
1319 event->categories().contains(i18n("Holiday"))) {
1320 showHoliday = true;
1321 break;
1322 }
1323 }
1324
1325 }
1326
1313#ifndef KORG_NOPLUGINS 1327#ifndef KORG_NOPLUGINS
1314 bool showHoliday = KOPrefs::instance()->mExcludeHolidays && 1328 bool showHoliday = KOPrefs::instance()->mExcludeHolidays &&
1315 !KOCore::self()->holiday(date).isEmpty(); 1329 !KOCore::self()->holiday(date).isEmpty();
1316 bool showDay = showSaturday || showSunday || showHoliday;
1317#else
1318 bool showDay = showSaturday || showSunday;
1319#endif 1330#endif
1331 bool showDay = showSaturday || showSunday || showHoliday;
1332
1320 if (showDay) { 1333 if (showDay) {
1321 mHolidayMask.at(i) = true; 1334 mHolidayMask.at(i) = true;
1322 } else { 1335 } else {
1323 mHolidayMask.at(i) = false; 1336 mHolidayMask.at(i) = false;
1324 } 1337 }
1325 } 1338 }
1326 1339
1327 mAgenda->setHolidayMask(&mHolidayMask); 1340 mAgenda->setHolidayMask(&mHolidayMask);
1328 mAllDayAgenda->setHolidayMask(&mHolidayMask); 1341 mAllDayAgenda->setHolidayMask(&mHolidayMask);
1329} 1342}
1330 1343
1331void KOAgendaView::setContentsPos(int y) 1344void KOAgendaView::setContentsPos(int y)
1332{ 1345{
1333 mAgenda->setContentsPos(0,y); 1346 mAgenda->setContentsPos(0,y);
1334} 1347}
1335 1348
1336void KOAgendaView::setExpandedButton( bool expanded ) 1349void KOAgendaView::setExpandedButton( bool expanded )
1337{ 1350{
1338 if ( expanded ) { 1351 if ( expanded ) {
1339 mExpandButton->setPixmap( mExpandedPixmap ); 1352 mExpandButton->setPixmap( mExpandedPixmap );
1340 } else { 1353 } else {
1341 mExpandButton->setPixmap( mNotExpandedPixmap ); 1354 mExpandButton->setPixmap( mNotExpandedPixmap );
1342 } 1355 }
1343} 1356}
1344 1357
1345void KOAgendaView::clearSelection() 1358void KOAgendaView::clearSelection()
1346{ 1359{
1347 mAgenda->deselectItem(); 1360 mAgenda->deselectItem();
1348 mAllDayAgenda->deselectItem(); 1361 mAllDayAgenda->deselectItem();
1349} 1362}
1350 1363
1351void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, 1364void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart,
1352 int gxEnd, int gyEnd) 1365 int gxEnd, int gyEnd)
1353{ 1366{
1354 mTimeSpanInAllDay = true; 1367 mTimeSpanInAllDay = true;
1355 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); 1368 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd);
1356} 1369}
1357 1370
1358 1371
1359 1372
1360 1373
1361void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, 1374void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart,
1362 int gxEnd, int gyEnd) 1375 int gxEnd, int gyEnd)
1363{ 1376{
1364 if (!mSelectedDates.count()) return; 1377 if (!mSelectedDates.count()) return;
1365 1378
1366 QDate dayStart = mSelectedDates[gxStart]; 1379 QDate dayStart = mSelectedDates[gxStart];
1367 QDate dayEnd = mSelectedDates[gxEnd]; 1380 QDate dayEnd = mSelectedDates[gxEnd];
1368 1381
1369 QTime timeStart = mAgenda->gyToTime(gyStart); 1382 QTime timeStart = mAgenda->gyToTime(gyStart);
1370 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1383 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1371 1384
1372 QDateTime dtStart(dayStart,timeStart); 1385 QDateTime dtStart(dayStart,timeStart);
1373 QDateTime dtEnd(dayEnd,timeEnd); 1386 QDateTime dtEnd(dayEnd,timeEnd);
1374 1387
1375 mTimeSpanBegin = dtStart; 1388 mTimeSpanBegin = dtStart;
1376 mTimeSpanEnd = dtEnd; 1389 mTimeSpanEnd = dtEnd;
1377 1390
1378} 1391}
1379 1392
1380void KOAgendaView::deleteSelectedDateTime() 1393void KOAgendaView::deleteSelectedDateTime()
1381{ 1394{
1382 mTimeSpanBegin.setDate(QDate()); 1395 mTimeSpanBegin.setDate(QDate());
1383 mTimeSpanEnd.setDate(QDate()); 1396 mTimeSpanEnd.setDate(QDate());
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 688d9e1..7d1e82f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -324,129 +324,129 @@ QDate MonthViewCell::date() const
324 324
325void MonthViewCell::setPrimary( bool primary ) 325void MonthViewCell::setPrimary( bool primary )
326{ 326{
327 mPrimary = primary; 327 mPrimary = primary;
328 //setMyPalette(); 328 //setMyPalette();
329} 329}
330void MonthViewCell::setMyPalette() 330void MonthViewCell::setMyPalette()
331{ 331{
332 332
333 if ( mHoliday) { 333 if ( mHoliday) {
334 setPalette( mHolidayPalette ); 334 setPalette( mHolidayPalette );
335 } else { 335 } else {
336 if ( mPrimary ) { 336 if ( mPrimary ) {
337 setPalette( mPrimaryPalette ); 337 setPalette( mPrimaryPalette );
338 } else { 338 } else {
339 setPalette( mNonPrimaryPalette ); 339 setPalette( mNonPrimaryPalette );
340 } 340 }
341 } 341 }
342 QPalette pal = palette(); 342 QPalette pal = palette();
343 343
344 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 344 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
345} 345}
346QPalette MonthViewCell::getPalette () 346QPalette MonthViewCell::getPalette ()
347{ 347{
348 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 348 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
349 return mStandardPalette; 349 return mStandardPalette;
350 if ( mHoliday) { 350 if ( mHoliday) {
351 return mHolidayPalette ; 351 return mHolidayPalette ;
352 } else { 352 } else {
353 if ( mPrimary ) { 353 if ( mPrimary ) {
354 return mPrimaryPalette ; 354 return mPrimaryPalette ;
355 } 355 }
356 } 356 }
357 return mNonPrimaryPalette; 357 return mNonPrimaryPalette;
358} 358}
359bool MonthViewCell::isPrimary() const 359bool MonthViewCell::isPrimary() const
360{ 360{
361 return mPrimary; 361 return mPrimary;
362} 362}
363 363
364void MonthViewCell::setHoliday( bool holiday ) 364void MonthViewCell::setHoliday( bool holiday )
365{ 365{
366 mHoliday = holiday; 366 mHoliday = holiday;
367 //setMyPalette(); 367 //setMyPalette();
368} 368}
369 369
370void MonthViewCell::setHoliday( const QString &holiday ) 370void MonthViewCell::setHoliday( const QString &holiday )
371{ 371{
372 mHolidayString = holiday; 372 mHolidayString = holiday;
373 373
374 if ( !holiday.isEmpty() ) { 374 if ( !holiday.isEmpty() ) {
375 setHoliday( true ); 375 setHoliday( true );
376 } 376 }
377} 377}
378void MonthViewCell::keyPressEvent ( QKeyEvent * e ) 378void MonthViewCell::keyPressEvent ( QKeyEvent * e )
379{ 379{
380 380
381 e->ignore(); 381 e->ignore();
382 382
383} 383}
384void MonthViewCell::updateCell() 384void MonthViewCell::updateCell()
385{ 385{
386 386
387 setPrimary( mDate.month()%2 ); 387 setPrimary( mDate.month()%2 );
388 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() ); 388 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
389 if ( mDate == QDate::currentDate() ) { 389 if ( mDate == QDate::currentDate() ) {
390 mItemList->setLineWidth( 3 ); 390 mItemList->setLineWidth( 3 );
391 } else { 391 } else {
392 mItemList->setLineWidth( 1 ); 392 mItemList->setLineWidth( 1 );
393 } 393 }
394 mItemList->clear(); 394 mItemList->clear();
395 //qApp->processEvents(); 395 //qApp->processEvents();
396 if ( !mHolidayString.isEmpty() ) { 396 if ( !mHolidayString.isEmpty() ) {
397 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 397 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
398 item->setPalette( mHolidayPalette ); 398 item->setPalette( mHolidayPalette );
399 mItemList->insertItem( item ); 399 mItemList->insertItem( item );
400 } 400 }
401 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 401 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
402 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 402 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
403 Event *event; 403 Event *event;
404 for( event = events.first(); event; event = events.next() ) { 404 for( event = events.first(); event; event = events.next() ) {
405 if ( event->categories().contains("Holiday") || 405 if ( event->categories().contains("Holiday") ||
406 event->categories().contains(i18n("Holiday"))) { 406 event->categories().contains(i18n("Holiday"))) {
407 setHoliday( true ); 407 setHoliday( true );
408 if ( mDate.dayOfWeek() == 7 ) 408 if ( mDate.dayOfWeek() == 7 )
409 mItemList->setLineWidth( 3 ); 409 mItemList->setLineWidth( 3 );
410 } 410 }
411 QString text; 411 QString text;
412 if (event->isMultiDay()) { 412 if (event->isMultiDay()) {
413 QString prefix = "<->"; 413 QString prefix = "<->";
414 if ( event->doesRecur() ) { 414 if ( event->doesRecur() ) {
415 if ( event->recursOn( mDate) ) 415 if ( event->recursOn( mDate) )
416 prefix ="->" ; 416 prefix ="->" ;
417 else { 417 else {
418 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 418 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
419 if ( event->recursOn( mDate.addDays( -days)) ) 419 if ( event->recursOn( mDate.addDays( -days)) )
420 prefix ="<-" ; 420 prefix ="<-" ;
421 } 421 }
422 422
423 } else { 423 } else {
424 if (mDate == event->dtStart().date()) { 424 if (mDate == event->dtStart().date()) {
425 prefix ="->" ; 425 prefix ="->" ;
426 } else if (mDate == event->dtEnd().date()) { 426 } else if (mDate == event->dtEnd().date()) {
427 prefix ="<-" ; 427 prefix ="<-" ;
428 } 428 }
429 } 429 }
430 text = prefix + event->summary(); 430 text = prefix + event->summary();
431 } else { 431 } else {
432 if (event->doesFloat()) 432 if (event->doesFloat())
433 text = event->summary(); 433 text = event->summary();
434 else { 434 else {
435 text = KGlobal::locale()->formatTime(event->dtStart().time()); 435 text = KGlobal::locale()->formatTime(event->dtStart().time());
436 text += " " + event->summary(); 436 text += " " + event->summary();
437 } 437 }
438 } 438 }
439 439
440 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 440 MonthViewItem *item = new MonthViewItem( event, mDate, text );
441 QPalette pal; 441 QPalette pal;
442 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 442 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
443 QStringList categories = event->categories(); 443 QStringList categories = event->categories();
444 QString cat = categories.first(); 444 QString cat = categories.first();
445 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 445 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
446 pal = getPalette(); 446 pal = getPalette();
447 if (cat.isEmpty()) { 447 if (cat.isEmpty()) {
448 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 448 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
449 } else { 449 } else {
450 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 450 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
451 } 451 }
452 452