author | zautrix <zautrix> | 2005-01-20 01:24:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-20 01:24:07 (UTC) |
commit | dbb59deb5c0949f83b2d6fd79ec599e7b9e8ebf1 (patch) (unidiff) | |
tree | 3fac729225892ee1a4570a5852ee287f35e74ce7 /korganizer | |
parent | ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e (diff) | |
download | kdepimpi-dbb59deb5c0949f83b2d6fd79ec599e7b9e8ebf1.zip kdepimpi-dbb59deb5c0949f83b2d6fd79ec599e7b9e8ebf1.tar.gz kdepimpi-dbb59deb5c0949f83b2d6fd79ec599e7b9e8ebf1.tar.bz2 |
more view fixes
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 26 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
4 files changed, 23 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index f9af769..8f05276 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -472,66 +472,66 @@ void CalendarView::init() | |||
472 | mAlarmDialog = new AlarmDialog( this ); | 472 | mAlarmDialog = new AlarmDialog( this ); |
473 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 473 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
474 | mAlarmDialog->setServerNotification( false ); | 474 | mAlarmDialog->setServerNotification( false ); |
475 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 475 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
476 | 476 | ||
477 | 477 | ||
478 | #ifndef DESKTOP_VERSION | 478 | #ifndef DESKTOP_VERSION |
479 | //US listen for arriving address resultsets | 479 | //US listen for arriving address resultsets |
480 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 480 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
481 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 481 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
482 | #endif | 482 | #endif |
483 | 483 | ||
484 | } | 484 | } |
485 | 485 | ||
486 | 486 | ||
487 | CalendarView::~CalendarView() | 487 | CalendarView::~CalendarView() |
488 | { | 488 | { |
489 | // kdDebug() << "~CalendarView()" << endl; | 489 | // kdDebug() << "~CalendarView()" << endl; |
490 | //qDebug("CalendarView::~CalendarView() "); | 490 | //qDebug("CalendarView::~CalendarView() "); |
491 | delete mDialogManager; | 491 | delete mDialogManager; |
492 | delete mViewManager; | 492 | delete mViewManager; |
493 | delete mStorage; | 493 | delete mStorage; |
494 | delete mDateFrame ; | 494 | delete mDateFrame ; |
495 | delete beamDialog; | 495 | delete beamDialog; |
496 | //kdDebug() << "~CalendarView() done" << endl; | 496 | //kdDebug() << "~CalendarView() done" << endl; |
497 | } | 497 | } |
498 | 498 | ||
499 | void CalendarView::showDay( QDate d ) | 499 | void CalendarView::showDay( QDate d ) |
500 | { | 500 | { |
501 | dateNavigator()->blockSignals( true ); | 501 | dateNavigator()->blockSignals( true ); |
502 | dateNavigator()->selectDate( d ); | 502 | dateNavigator()->selectDate( d ); |
503 | dateNavigator()->blockSignals( false ); | 503 | dateNavigator()->blockSignals( false ); |
504 | mViewManager->showWeekView(); | 504 | mViewManager->showDayView(); |
505 | dateNavigator()->selectDate( d ); | 505 | //dateNavigator()->selectDate( d ); |
506 | } | 506 | } |
507 | void CalendarView::timerAlarm() | 507 | void CalendarView::timerAlarm() |
508 | { | 508 | { |
509 | //qDebug("CalendarView::timerAlarm() "); | 509 | //qDebug("CalendarView::timerAlarm() "); |
510 | computeAlarm(mAlarmNotification ); | 510 | computeAlarm(mAlarmNotification ); |
511 | } | 511 | } |
512 | 512 | ||
513 | void CalendarView::suspendAlarm() | 513 | void CalendarView::suspendAlarm() |
514 | { | 514 | { |
515 | //qDebug(" CalendarView::suspendAlarm() "); | 515 | //qDebug(" CalendarView::suspendAlarm() "); |
516 | computeAlarm(mSuspendAlarmNotification ); | 516 | computeAlarm(mSuspendAlarmNotification ); |
517 | 517 | ||
518 | } | 518 | } |
519 | 519 | ||
520 | void CalendarView::startAlarm( QString mess , QString filename) | 520 | void CalendarView::startAlarm( QString mess , QString filename) |
521 | { | 521 | { |
522 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 522 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
523 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 523 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
524 | 524 | ||
525 | } | 525 | } |
526 | 526 | ||
527 | void CalendarView::checkNextTimerAlarm() | 527 | void CalendarView::checkNextTimerAlarm() |
528 | { | 528 | { |
529 | mCalendar->checkAlarmForIncidence( 0, true ); | 529 | mCalendar->checkAlarmForIncidence( 0, true ); |
530 | } | 530 | } |
531 | 531 | ||
532 | void CalendarView::computeAlarm( QString msg ) | 532 | void CalendarView::computeAlarm( QString msg ) |
533 | { | 533 | { |
534 | 534 | ||
535 | QString mess = msg; | 535 | QString mess = msg; |
536 | QString mAlarmMessage = mess.mid( 9 ); | 536 | QString mAlarmMessage = mess.mid( 9 ); |
537 | QString filename = MainWindow::resourcePath(); | 537 | QString filename = MainWindow::resourcePath(); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 842f6eb..b819eec 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -45,65 +45,65 @@ | |||
45 | #include "calprinter.h" | 45 | #include "calprinter.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #ifndef KORG_NOPLUGINS | 48 | #ifndef KORG_NOPLUGINS |
49 | #include "kocore.h" | 49 | #include "kocore.h" |
50 | #endif | 50 | #endif |
51 | #include "koglobals.h" | 51 | #include "koglobals.h" |
52 | #include <libkcal/kincidenceformatter.h> | 52 | #include <libkcal/kincidenceformatter.h> |
53 | 53 | ||
54 | #include "komonthview.h" | 54 | #include "komonthview.h" |
55 | 55 | ||
56 | #define PIXMAP_SIZE 5 | 56 | #define PIXMAP_SIZE 5 |
57 | #ifdef DESKTOP_VERSION | 57 | #ifdef DESKTOP_VERSION |
58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
59 | #endif | 59 | #endif |
60 | class KNOWhatsThis :public QWhatsThis | 60 | class KNOWhatsThis :public QWhatsThis |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 63 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | virtual QString text( const QPoint& p) | 66 | virtual QString text( const QPoint& p) |
67 | { | 67 | { |
68 | return _wid->getWhatsThisText(p) ; | 68 | return _wid->getWhatsThisText(p) ; |
69 | }; | 69 | }; |
70 | private: | 70 | private: |
71 | KNoScrollListBox* _wid; | 71 | KNoScrollListBox* _wid; |
72 | 72 | ||
73 | }; | 73 | }; |
74 | 74 | ||
75 | 75 | ||
76 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 76 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
77 | : QListBox(parent, name) | 77 | : QListBox(parent, name, WRepaintNoErase) |
78 | { | 78 | { |
79 | #ifndef DESKTOP_VERSION | 79 | #ifndef DESKTOP_VERSION |
80 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 80 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
81 | #endif | 81 | #endif |
82 | mWT = new KNOWhatsThis(this); | 82 | mWT = new KNOWhatsThis(this); |
83 | } | 83 | } |
84 | KNoScrollListBox::~KNoScrollListBox() | 84 | KNoScrollListBox::~KNoScrollListBox() |
85 | { | 85 | { |
86 | delete mWT; | 86 | delete mWT; |
87 | } | 87 | } |
88 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 88 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
89 | { | 89 | { |
90 | QListBoxItem* item = itemAt ( p ); | 90 | QListBoxItem* item = itemAt ( p ); |
91 | if ( ! item ) { | 91 | if ( ! item ) { |
92 | return i18n("Click in the cell\nto add an event!"); | 92 | return i18n("Click in the cell\nto add an event!"); |
93 | } | 93 | } |
94 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 94 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
95 | } | 95 | } |
96 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 96 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
97 | { | 97 | { |
98 | 98 | ||
99 | switch(e->key()) { | 99 | switch(e->key()) { |
100 | case Key_Right: | 100 | case Key_Right: |
101 | // if ( e->state() == Qt::ControlButton ) | 101 | // if ( e->state() == Qt::ControlButton ) |
102 | { | 102 | { |
103 | e->ignore(); | 103 | e->ignore(); |
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | scrollBy(4,0); | 106 | scrollBy(4,0); |
107 | break; | 107 | break; |
108 | case Key_Left: | 108 | case Key_Left: |
109 | // if ( e->state() == Qt::ControlButton ) | 109 | // if ( e->state() == Qt::ControlButton ) |
@@ -353,82 +353,90 @@ QPalette MonthViewCell::getPalette () | |||
353 | } else { | 353 | } else { |
354 | if ( mPrimary ) { | 354 | if ( mPrimary ) { |
355 | return mPrimaryPalette ; | 355 | return mPrimaryPalette ; |
356 | } | 356 | } |
357 | } | 357 | } |
358 | return mNonPrimaryPalette; | 358 | return mNonPrimaryPalette; |
359 | } | 359 | } |
360 | bool MonthViewCell::isPrimary() const | 360 | bool MonthViewCell::isPrimary() const |
361 | { | 361 | { |
362 | return mPrimary; | 362 | return mPrimary; |
363 | } | 363 | } |
364 | 364 | ||
365 | void MonthViewCell::setHoliday( bool holiday ) | 365 | void MonthViewCell::setHoliday( bool holiday ) |
366 | { | 366 | { |
367 | mHoliday = holiday; | 367 | mHoliday = holiday; |
368 | //setMyPalette(); | 368 | //setMyPalette(); |
369 | } | 369 | } |
370 | 370 | ||
371 | void MonthViewCell::setHoliday( const QString &holiday ) | 371 | void MonthViewCell::setHoliday( const QString &holiday ) |
372 | { | 372 | { |
373 | mHolidayString = holiday; | 373 | mHolidayString = holiday; |
374 | 374 | ||
375 | if ( !holiday.isEmpty() ) { | 375 | if ( !holiday.isEmpty() ) { |
376 | setHoliday( true ); | 376 | setHoliday( true ); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 379 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
380 | { | 380 | { |
381 | 381 | ||
382 | e->ignore(); | 382 | e->ignore(); |
383 | 383 | ||
384 | } | 384 | } |
385 | void MonthViewCell::clear() | ||
386 | { | ||
387 | mItemList->clear(); | ||
388 | QApplication::removePostedEvents ( mItemList ); | ||
389 | QApplication::removePostedEvents ( mLabel ); | ||
390 | QApplication::removePostedEvents ( this ); | ||
391 | } | ||
385 | void MonthViewCell::updateCell() | 392 | void MonthViewCell::updateCell() |
386 | { | 393 | { |
387 | if ( !mMonthView->isUpdatePossible() ) | 394 | if ( !mMonthView->isUpdatePossible() ) |
388 | return; | 395 | return; |
389 | if ( !isVisible() ){ | 396 | /* |
397 | if ( !isVisible() ){ | ||
390 | return; | 398 | return; |
391 | } | 399 | } |
400 | */ | ||
401 | // qDebug("MonthViewCell::updateCell() "); | ||
392 | setPrimary( mDate.month()%2 ); | 402 | setPrimary( mDate.month()%2 ); |
393 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 403 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
394 | if ( mDate == QDate::currentDate() ) { | 404 | if ( mDate == QDate::currentDate() ) { |
395 | mItemList->setLineWidth( 3 ); | 405 | mItemList->setLineWidth( 3 ); |
396 | } else { | 406 | } else { |
397 | mItemList->setLineWidth( 1 ); | 407 | mItemList->setLineWidth( 1 ); |
398 | } | 408 | } |
399 | mItemList->clear(); | 409 | mItemList->clear(); |
400 | 410 | ||
401 | |||
402 | |||
403 | #ifdef DESKTOP_VERSION | 411 | #ifdef DESKTOP_VERSION |
404 | QToolTip::remove(this); | 412 | QToolTip::remove(this); |
405 | #endif | 413 | #endif |
406 | QString tipText(""); | 414 | QString tipText(""); |
407 | //qApp->processEvents(); | 415 | //qApp->processEvents(); |
408 | if ( !mHolidayString.isEmpty() ) { | 416 | if ( !mHolidayString.isEmpty() ) { |
409 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 417 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
410 | item->setPalette( mHolidayPalette ); | 418 | item->setPalette( mHolidayPalette ); |
411 | mItemList->insertItem( item ); | 419 | mItemList->insertItem( item ); |
412 | tipText += mHolidayString+"\n"; | 420 | tipText += mHolidayString+"\n"; |
413 | } | 421 | } |
414 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 422 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
415 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 423 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
416 | Event *event; | 424 | Event *event; |
417 | for( event = events.first(); event; event = events.next() ) { // for event | 425 | for( event = events.first(); event; event = events.next() ) { // for event |
418 | 426 | ||
419 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 427 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
420 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 428 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
421 | continue; | 429 | continue; |
422 | else | 430 | else |
423 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 431 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
424 | continue; | 432 | continue; |
425 | } | 433 | } |
426 | 434 | ||
427 | if ( event->categories().contains("Holiday") || | 435 | if ( event->categories().contains("Holiday") || |
428 | event->categories().contains(i18n("Holiday"))) { | 436 | event->categories().contains(i18n("Holiday"))) { |
429 | setHoliday( true ); | 437 | setHoliday( true ); |
430 | if ( mDate.dayOfWeek() == 7 ) | 438 | if ( mDate.dayOfWeek() == 7 ) |
431 | mItemList->setLineWidth( 3 ); | 439 | mItemList->setLineWidth( 3 ); |
432 | } | 440 | } |
433 | QString text; | 441 | QString text; |
434 | if (event->isMultiDay()) { | 442 | if (event->isMultiDay()) { |
@@ -537,68 +545,69 @@ void MonthViewCell::updateCell() | |||
537 | } else { | 545 | } else { |
538 | if (cat.isEmpty()) { | 546 | if (cat.isEmpty()) { |
539 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 547 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
540 | } else { | 548 | } else { |
541 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 549 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
542 | } | 550 | } |
543 | } | 551 | } |
544 | 552 | ||
545 | } else { | 553 | } else { |
546 | pal = mStandardPalette ; | 554 | pal = mStandardPalette ; |
547 | } | 555 | } |
548 | item->setPalette( pal ); | 556 | item->setPalette( pal ); |
549 | mItemList->insertItem( item ); | 557 | mItemList->insertItem( item ); |
550 | tipText += text+"\n"; | 558 | tipText += text+"\n"; |
551 | } | 559 | } |
552 | #ifdef DESKTOP_VERSION | 560 | #ifdef DESKTOP_VERSION |
553 | if (tipText != "") | 561 | if (tipText != "") |
554 | QToolTip::add(this,tipText,toolTipGroup(),""); | 562 | QToolTip::add(this,tipText,toolTipGroup(),""); |
555 | #endif | 563 | #endif |
556 | 564 | ||
557 | //setMyPalette(); | 565 | //setMyPalette(); |
558 | setMyPalette(); | 566 | setMyPalette(); |
559 | QString text; | 567 | QString text; |
560 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 568 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
561 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 569 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
562 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 570 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
563 | mLabel->resize( mLabelBigSize ); | 571 | mLabel->resize( mLabelBigSize ); |
564 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 572 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
565 | } else { | 573 | } else { |
566 | mLabel->resize( mLabelSize ); | 574 | mLabel->resize( mLabelSize ); |
567 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 575 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
568 | } | 576 | } |
577 | |||
569 | mLabel->setText( text ); | 578 | mLabel->setText( text ); |
570 | resizeEvent( 0 ); | 579 | resizeEvent( 0 ); |
571 | // if ( isVisible()) | 580 | // if ( isVisible()) |
572 | qApp->processEvents(); | 581 | //qApp->processEvents(); |
573 | } | 582 | } |
574 | 583 | ||
575 | void MonthViewCell::updateConfig() | 584 | void MonthViewCell::updateConfig() |
576 | { | 585 | { |
577 | 586 | ||
578 | setFont( KOPrefs::instance()->mMonthViewFont ); | 587 | setFont( KOPrefs::instance()->mMonthViewFont ); |
579 | 588 | ||
580 | QFontMetrics fm( font() ); | 589 | QFontMetrics fm( font() ); |
581 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 590 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
582 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 591 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
583 | mHolidayPalette = mStandardPalette; | 592 | mHolidayPalette = mStandardPalette; |
584 | mPrimaryPalette = mStandardPalette; | 593 | mPrimaryPalette = mStandardPalette; |
585 | mNonPrimaryPalette = mStandardPalette; | 594 | mNonPrimaryPalette = mStandardPalette; |
586 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 595 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
587 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 596 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
588 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 597 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
589 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 598 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
590 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 599 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
591 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 600 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
592 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 601 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
593 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 602 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
594 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 603 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
595 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 604 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
596 | } | 605 | } |
597 | updateCell(); | 606 | updateCell(); |
598 | } | 607 | } |
599 | 608 | ||
600 | void MonthViewCell::enableScrollBars( bool enabled ) | 609 | void MonthViewCell::enableScrollBars( bool enabled ) |
601 | { | 610 | { |
602 | if ( enabled ) { | 611 | if ( enabled ) { |
603 | mItemList->setVScrollBarMode(QScrollView::Auto); | 612 | mItemList->setVScrollBarMode(QScrollView::Auto); |
604 | mItemList->setHScrollBarMode(QScrollView::Auto); | 613 | mItemList->setHScrollBarMode(QScrollView::Auto); |
@@ -907,74 +916,75 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
907 | } | 916 | } |
908 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 917 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
909 | for( i = 0; i < 6; ++i ) { | 918 | for( i = 0; i < 6; ++i ) { |
910 | int wno; | 919 | int wno; |
911 | // remember, according to ISO 8601, the first week of the year is the | 920 | // remember, according to ISO 8601, the first week of the year is the |
912 | // first week that contains a thursday. Thus we must subtract off 4, | 921 | // first week that contains a thursday. Thus we must subtract off 4, |
913 | // not just 1. | 922 | // not just 1. |
914 | int dayOfYear = date.dayOfYear(); | 923 | int dayOfYear = date.dayOfYear(); |
915 | if (dayOfYear % 7 != 0) | 924 | if (dayOfYear % 7 != 0) |
916 | wno = dayOfYear / 7 + 1; | 925 | wno = dayOfYear / 7 + 1; |
917 | else | 926 | else |
918 | wno =dayOfYear / 7; | 927 | wno =dayOfYear / 7; |
919 | mWeekLabels[i]->setWeekNum( wno ); | 928 | mWeekLabels[i]->setWeekNum( wno ); |
920 | date = date.addDays( 7 ); | 929 | date = date.addDays( 7 ); |
921 | } | 930 | } |
922 | updateView(); | 931 | updateView(); |
923 | } | 932 | } |
924 | 933 | ||
925 | void KOMonthView::showEvents(QPtrList<Event>) | 934 | void KOMonthView::showEvents(QPtrList<Event>) |
926 | { | 935 | { |
927 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 936 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
928 | } | 937 | } |
929 | 938 | ||
930 | void KOMonthView::changeEventDisplay(Event *, int) | 939 | void KOMonthView::changeEventDisplay(Event *, int) |
931 | { | 940 | { |
932 | // this should be re-written to be much more efficient, but this | 941 | // this should be re-written to be much more efficient, but this |
933 | // quick-and-dirty-hack gets the job done for right now. | 942 | // quick-and-dirty-hack gets the job done for right now. |
934 | updateView(); | 943 | updateView(); |
935 | } | 944 | } |
936 | 945 | ||
937 | void KOMonthView::updateView() | 946 | void KOMonthView::updateView() |
938 | { | 947 | { |
939 | static int iii = 0; | ||
940 | ++iii; | ||
941 | if ( !updatePossible ) | 948 | if ( !updatePossible ) |
942 | return; | 949 | return; |
943 | uint i; | 950 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
951 | int i; | ||
944 | for( i = 0; i < mCells.count(); ++i ) { | 952 | for( i = 0; i < mCells.count(); ++i ) { |
945 | mCells[i]->updateCell(); | 953 | mCells[i]->updateCell(); |
946 | } | 954 | } |
955 | |||
947 | //qDebug("KOMonthView::updateView() "); | 956 | //qDebug("KOMonthView::updateView() "); |
948 | processSelectionChange(); | 957 | processSelectionChange(); |
958 | // qDebug("---------------------------------------------------------------------+ "); | ||
949 | } | 959 | } |
950 | 960 | ||
951 | void KOMonthView::resizeEvent(QResizeEvent * e) | 961 | void KOMonthView::resizeEvent(QResizeEvent * e) |
952 | { | 962 | { |
953 | computeLayout(); | 963 | computeLayout(); |
954 | } | 964 | } |
955 | void KOMonthView::computeLayout() | 965 | void KOMonthView::computeLayout() |
956 | { | 966 | { |
957 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 967 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
958 | // note this only changes the text if the requested size crosses the | 968 | // note this only changes the text if the requested size crosses the |
959 | // threshold between big enough to support the full name and not big | 969 | // threshold between big enough to support the full name and not big |
960 | // enough. | 970 | // enough. |
961 | 971 | ||
962 | int daysToShow = 7; | 972 | int daysToShow = 7; |
963 | bool combinedSatSun = false; | 973 | bool combinedSatSun = false; |
964 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 974 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
965 | daysToShow = 6; | 975 | daysToShow = 6; |
966 | combinedSatSun = true; | 976 | combinedSatSun = true; |
967 | } | 977 | } |
968 | int tWid = topLevelWidget()->size().width(); | 978 | int tWid = topLevelWidget()->size().width(); |
969 | int tHei = topLevelWidget()->size().height(); | 979 | int tHei = topLevelWidget()->size().height(); |
970 | 980 | ||
971 | int wid = size().width();//e | 981 | int wid = size().width();//e |
972 | int hei = size().height()-1; | 982 | int hei = size().height()-1; |
973 | 983 | ||
974 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 984 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
975 | return; | 985 | return; |
976 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 986 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
977 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 987 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
978 | int weeklabelwid = fm.width( "888" ); | 988 | int weeklabelwid = fm.width( "888" ); |
979 | wid -= weeklabelwid; | 989 | wid -= weeklabelwid; |
980 | 990 | ||
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 727f511..a965bf3 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -118,64 +118,65 @@ class MonthViewItem: public QListBoxItem | |||
118 | Incidence *mIncidence; | 118 | Incidence *mIncidence; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | 121 | ||
122 | class KOMonthView; | 122 | class KOMonthView; |
123 | 123 | ||
124 | class MonthViewCell : public QWidget | 124 | class MonthViewCell : public QWidget |
125 | { | 125 | { |
126 | Q_OBJECT | 126 | Q_OBJECT |
127 | public: | 127 | public: |
128 | MonthViewCell( KOMonthView * ); | 128 | MonthViewCell( KOMonthView * ); |
129 | 129 | ||
130 | void setDate( const QDate & ); | 130 | void setDate( const QDate & ); |
131 | QDate date() const; | 131 | QDate date() const; |
132 | 132 | ||
133 | void setPrimary( bool ); | 133 | void setPrimary( bool ); |
134 | bool isPrimary() const; | 134 | bool isPrimary() const; |
135 | 135 | ||
136 | void setHoliday( bool ); | 136 | void setHoliday( bool ); |
137 | void setHoliday( const QString & ); | 137 | void setHoliday( const QString & ); |
138 | 138 | ||
139 | void updateCell(); | 139 | void updateCell(); |
140 | 140 | ||
141 | void updateConfig(); | 141 | void updateConfig(); |
142 | 142 | ||
143 | void enableScrollBars( bool ); | 143 | void enableScrollBars( bool ); |
144 | 144 | ||
145 | Incidence *selectedIncidence(); | 145 | Incidence *selectedIncidence(); |
146 | QDate selectedIncidenceDate(); | 146 | QDate selectedIncidenceDate(); |
147 | 147 | ||
148 | void deselect(); | 148 | void deselect(); |
149 | void select(); | 149 | void select(); |
150 | void clear(); | ||
150 | 151 | ||
151 | #ifdef DESKTOP_VERSION | 152 | #ifdef DESKTOP_VERSION |
152 | static QToolTipGroup *toolTipGroup(); | 153 | static QToolTipGroup *toolTipGroup(); |
153 | #endif | 154 | #endif |
154 | signals: | 155 | signals: |
155 | void defaultAction( Incidence * ); | 156 | void defaultAction( Incidence * ); |
156 | void newEventSignal( QDateTime ); | 157 | void newEventSignal( QDateTime ); |
157 | void showDaySignal( QDate ); | 158 | void showDaySignal( QDate ); |
158 | 159 | ||
159 | protected: | 160 | protected: |
160 | void resizeEvent( QResizeEvent * ); | 161 | void resizeEvent( QResizeEvent * ); |
161 | 162 | ||
162 | protected slots: | 163 | protected slots: |
163 | void defaultAction( QListBoxItem * ); | 164 | void defaultAction( QListBoxItem * ); |
164 | void contextMenu( QListBoxItem * ); | 165 | void contextMenu( QListBoxItem * ); |
165 | void selection( QListBoxItem * ); | 166 | void selection( QListBoxItem * ); |
166 | void cellClicked( QListBoxItem * ); | 167 | void cellClicked( QListBoxItem * ); |
167 | void newEvent(); | 168 | void newEvent(); |
168 | void showDay(); | 169 | void showDay(); |
169 | 170 | ||
170 | private: | 171 | private: |
171 | KOMonthView *mMonthView; | 172 | KOMonthView *mMonthView; |
172 | 173 | ||
173 | QDate mDate; | 174 | QDate mDate; |
174 | bool mPrimary; | 175 | bool mPrimary; |
175 | bool mHoliday; | 176 | bool mHoliday; |
176 | QString mHolidayString; | 177 | QString mHolidayString; |
177 | 178 | ||
178 | //QLabel *mLabel; | 179 | //QLabel *mLabel; |
179 | QPushButton *mLabel; | 180 | QPushButton *mLabel; |
180 | QListBox *mItemList; | 181 | QListBox *mItemList; |
181 | #ifdef DESKTOP_VERSION | 182 | #ifdef DESKTOP_VERSION |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 00a5842..f6b7718 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -124,67 +124,68 @@ void KOViewManager::writeSettings(KConfig *config) | |||
124 | } | 124 | } |
125 | if (mTodoView) { | 125 | if (mTodoView) { |
126 | mTodoView->saveLayout(config,"Todo View"); | 126 | mTodoView->saveLayout(config,"Todo View"); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 130 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
131 | { | 131 | { |
132 | 132 | ||
133 | //mFlagShowNextxDays = false; | 133 | //mFlagShowNextxDays = false; |
134 | //if(view == mCurrentView) return; | 134 | //if(view == mCurrentView) return; |
135 | if ( view == 0 ) { | 135 | if ( view == 0 ) { |
136 | view = mCurrentView; | 136 | view = mCurrentView; |
137 | if ( view == 0 ) | 137 | if ( view == 0 ) |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | bool full = fullScreen; | 140 | bool full = fullScreen; |
141 | if(view == mCurrentView && view != mWhatsNextView ) { | 141 | if(view == mCurrentView && view != mWhatsNextView ) { |
142 | if ( mCurrentAgendaView < 0 ) | 142 | if ( mCurrentAgendaView < 0 ) |
143 | return; | 143 | return; |
144 | full = mMainView->leftFrame()->isVisible(); | 144 | full = mMainView->leftFrame()->isVisible(); |
145 | } else { | 145 | } else { |
146 | mCurrentView = view; | 146 | mCurrentView = view; |
147 | 147 | ||
148 | // bool full = fullScreen; | 148 | // bool full = fullScreen; |
149 | bool isFull = !mMainView->leftFrame()->isVisible(); | 149 | bool isFull = !mMainView->leftFrame()->isVisible(); |
150 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 150 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
151 | full = true; | 151 | full = true; |
152 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 152 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
153 | full = false; | 153 | full = false; |
154 | } | 154 | } |
155 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 155 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
156 | raiseCurrentView( full ); | 156 | //raiseCurrentView( full ); |
157 | mMainView->processIncidenceSelection( 0 ); | 157 | mMainView->processIncidenceSelection( 0 ); |
158 | mMainView->updateView(); | 158 | mMainView->updateView(); |
159 | raiseCurrentView( full ); | ||
159 | mMainView->adaptNavigationUnits(); | 160 | mMainView->adaptNavigationUnits(); |
160 | } | 161 | } |
161 | 162 | ||
162 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 163 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
163 | { | 164 | { |
164 | //qDebug("raiseCurrentView "); | 165 | //qDebug("raiseCurrentView "); |
165 | mCurrentAgendaView = 0; | 166 | mCurrentAgendaView = 0; |
166 | int wid = mMainView->width() ; | 167 | int wid = mMainView->width() ; |
167 | int hei = mMainView->height(); | 168 | int hei = mMainView->height(); |
168 | if ( mCurrentView == mMonthView ) { | 169 | if ( mCurrentView == mMonthView ) { |
169 | mMainView->navigatorBar()->show(); | 170 | mMainView->navigatorBar()->show(); |
170 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 171 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
171 | //mMainView->navigatorBar()->hide(); | 172 | //mMainView->navigatorBar()->hide(); |
172 | } else { | 173 | } else { |
173 | mMainView->navigatorBar()->hide(); | 174 | mMainView->navigatorBar()->hide(); |
174 | } | 175 | } |
175 | if ( fullScreen ) { | 176 | if ( fullScreen ) { |
176 | mMainView->leftFrame()->hide(); | 177 | mMainView->leftFrame()->hide(); |
177 | } else { | 178 | } else { |
178 | mMainView->leftFrame()->show(); | 179 | mMainView->leftFrame()->show(); |
179 | if ( KOPrefs::instance()->mVerticalScreen ) | 180 | if ( KOPrefs::instance()->mVerticalScreen ) |
180 | hei -= mMainView->leftFrame()->height(); | 181 | hei -= mMainView->leftFrame()->height(); |
181 | else | 182 | else |
182 | wid -= mMainView->leftFrame()->width(); | 183 | wid -= mMainView->leftFrame()->width(); |
183 | } | 184 | } |
184 | 185 | ||
185 | if ( globalFlagBlockAgenda == 5 ) { | 186 | if ( globalFlagBlockAgenda == 5 ) { |
186 | globalFlagBlockAgenda = 4; | 187 | globalFlagBlockAgenda = 4; |
187 | globalFlagBlockAgendaItemPaint = 1; | 188 | globalFlagBlockAgendaItemPaint = 1; |
188 | } | 189 | } |
189 | mMainView->viewStack()->raiseWidget(mCurrentView); | 190 | mMainView->viewStack()->raiseWidget(mCurrentView); |
190 | if ( globalFlagBlockAgenda == 4 ) { | 191 | if ( globalFlagBlockAgenda == 4 ) { |