author | zautrix <zautrix> | 2005-03-15 11:29:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-15 11:29:40 (UTC) |
commit | 79b580aacaa1626ccb8c2657796051bf79701e2d (patch) (unidiff) | |
tree | 3c2d7d61a945e5abb77eb542b943d8b1d5c0d029 | |
parent | 6b748e1b7b4213871a5866a9af50e99800d2a704 (diff) | |
download | kdepimpi-79b580aacaa1626ccb8c2657796051bf79701e2d.zip kdepimpi-79b580aacaa1626ccb8c2657796051bf79701e2d.tar.gz kdepimpi-79b580aacaa1626ccb8c2657796051bf79701e2d.tar.bz2 |
monthview tooltip sort fixed
-rw-r--r-- | korganizer/komonthview.cpp | 24 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4bf9dea..004ff50 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -483,38 +483,38 @@ void MonthViewCell::startUpdateCell() | |||
483 | // qDebug("MonthViewCell::updateCell() "); | 483 | // qDebug("MonthViewCell::updateCell() "); |
484 | setPrimary( mDate.month()%2 ); | 484 | setPrimary( mDate.month()%2 ); |
485 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 485 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
486 | if ( mDate == QDate::currentDate() ) { | 486 | if ( mDate == QDate::currentDate() ) { |
487 | mItemList->setLineWidth( 3 ); | 487 | mItemList->setLineWidth( 3 ); |
488 | } else { | 488 | } else { |
489 | mItemList->setLineWidth( 1 ); | 489 | mItemList->setLineWidth( 1 ); |
490 | } | 490 | } |
491 | mItemList->clear(); | 491 | mItemList->clear(); |
492 | 492 | ||
493 | #ifdef DESKTOP_VERSION | 493 | #ifdef DESKTOP_VERSION |
494 | QToolTip::remove(this); | 494 | QToolTip::remove(this); |
495 | #endif | 495 | #endif |
496 | mToolTip = ""; | 496 | mToolTip.clear(); |
497 | //qApp->processEvents(); | 497 | //qApp->processEvents(); |
498 | if ( !mHolidayString.isEmpty() ) { | 498 | if ( !mHolidayString.isEmpty() ) { |
499 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 499 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
500 | item->setPalette( mHolidayPalette ); | 500 | item->setPalette( mHolidayPalette ); |
501 | mItemList->insertItem( item ); | 501 | mItemList->insertItem( item ); |
502 | mToolTip += mHolidayString+"\n"; | 502 | mToolTip.append ( mHolidayString ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void MonthViewCell::insertEvent(Event *event) | 506 | void MonthViewCell::insertEvent(Event *event) |
507 | { | 507 | { |
508 | 508 | QString mToolTipText; | |
509 | mItemList->setFocusPolicy(WheelFocus); | 509 | mItemList->setFocusPolicy(WheelFocus); |
510 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 510 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
511 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 511 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
512 | return; | 512 | return; |
513 | else | 513 | else |
514 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 514 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | 517 | ||
518 | if ( event->categories().contains("Holiday") || | 518 | if ( event->categories().contains("Holiday") || |
519 | event->categories().contains(i18n("Holiday"))) { | 519 | event->categories().contains(i18n("Holiday"))) { |
520 | setHoliday( true ); | 520 | setHoliday( true ); |
@@ -543,34 +543,34 @@ void MonthViewCell::insertEvent(Event *event) | |||
543 | } else if (mDate == event->dtEnd().date()) { | 543 | } else if (mDate == event->dtEnd().date()) { |
544 | prefix ="<-" ;multiday = 3; | 544 | prefix ="<-" ;multiday = 3; |
545 | } | 545 | } |
546 | } | 546 | } |
547 | if ( !event->doesFloat() ) { | 547 | if ( !event->doesFloat() ) { |
548 | if ( mDate == event->dtStart().date () ) | 548 | if ( mDate == event->dtStart().date () ) |
549 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 549 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
550 | else if ( mDate == event->dtEnd().date () ) | 550 | else if ( mDate == event->dtEnd().date () ) |
551 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 551 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
552 | 552 | ||
553 | } | 553 | } |
554 | text = time + event->summary(); | 554 | text = time + event->summary(); |
555 | mToolTip += prefix + text; | 555 | mToolTipText += prefix + text; |
556 | } else { | 556 | } else { |
557 | if (event->doesFloat()) { | 557 | if (event->doesFloat()) { |
558 | text = event->summary(); | 558 | text = event->summary(); |
559 | mToolTip += text; | 559 | mToolTipText += text; |
560 | } | 560 | } |
561 | else { | 561 | else { |
562 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 562 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
563 | text += " " + event->summary(); | 563 | text += " " + event->summary(); |
564 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 564 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
565 | } | 565 | } |
566 | } | 566 | } |
567 | 567 | ||
568 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 568 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
569 | QPalette pal; | 569 | QPalette pal; |
570 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 570 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
571 | QStringList categories = event->categories(); | 571 | QStringList categories = event->categories(); |
572 | QString cat = categories.first(); | 572 | QString cat = categories.first(); |
573 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 573 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
574 | pal = getPalette(); | 574 | pal = getPalette(); |
575 | if (cat.isEmpty()) { | 575 | if (cat.isEmpty()) { |
576 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 576 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
@@ -597,25 +597,25 @@ void MonthViewCell::insertEvent(Event *event) | |||
597 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 597 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
598 | KOPrefs::instance()->email()); | 598 | KOPrefs::instance()->email()); |
599 | if ( me != 0 ) { | 599 | if ( me != 0 ) { |
600 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 600 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
601 | item->setReply(true && multiday < 2); | 601 | item->setReply(true && multiday < 2); |
602 | else | 602 | else |
603 | item->setReply(false); | 603 | item->setReply(false); |
604 | } else | 604 | } else |
605 | item->setReply(false); | 605 | item->setReply(false); |
606 | #endif | 606 | #endif |
607 | item->setMultiDay( multiday ); | 607 | item->setMultiDay( multiday ); |
608 | mItemList->insertItem( item ); | 608 | mItemList->insertItem( item ); |
609 | mToolTip += "\n"; | 609 | mToolTip.append( mToolTipText ); |
610 | } | 610 | } |
611 | void MonthViewCell::insertTodo(Todo *todo) | 611 | void MonthViewCell::insertTodo(Todo *todo) |
612 | { | 612 | { |
613 | mItemList->setFocusPolicy(WheelFocus); | 613 | mItemList->setFocusPolicy(WheelFocus); |
614 | QString text; | 614 | QString text; |
615 | if (todo->hasDueDate()) { | 615 | if (todo->hasDueDate()) { |
616 | if (!todo->doesFloat()) { | 616 | if (!todo->doesFloat()) { |
617 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 617 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
618 | text += " "; | 618 | text += " "; |
619 | } | 619 | } |
620 | } | 620 | } |
621 | text += todo->summary(); | 621 | text += todo->summary(); |
@@ -641,31 +641,33 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
641 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 641 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
642 | } | 642 | } |
643 | } | 643 | } |
644 | 644 | ||
645 | } else { | 645 | } else { |
646 | pal = mStandardPalette ; | 646 | pal = mStandardPalette ; |
647 | } | 647 | } |
648 | item->setPalette( pal ); | 648 | item->setPalette( pal ); |
649 | item->setRecur( todo->recurrence()->doesRecur() ); | 649 | item->setRecur( todo->recurrence()->doesRecur() ); |
650 | item->setAlarm( todo->isAlarmEnabled() ); | 650 | item->setAlarm( todo->isAlarmEnabled() ); |
651 | item->setMoreInfo( todo->description().length() > 0 ); | 651 | item->setMoreInfo( todo->description().length() > 0 ); |
652 | mItemList->insertItem( item ); | 652 | mItemList->insertItem( item ); |
653 | mToolTip += text+"\n"; | 653 | mToolTip.append( text ); |
654 | } | 654 | } |
655 | void MonthViewCell::finishUpdateCell() | 655 | void MonthViewCell::finishUpdateCell() |
656 | { | 656 | { |
657 | #ifdef DESKTOP_VERSION | 657 | #ifdef DESKTOP_VERSION |
658 | if (mToolTip != "") | 658 | if (mToolTip.count() > 0 ) { |
659 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 659 | mToolTip.sort(); |
660 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | ||
661 | } | ||
660 | #endif | 662 | #endif |
661 | mItemList->sort(); | 663 | mItemList->sort(); |
662 | //setMyPalette(); | 664 | //setMyPalette(); |
663 | setMyPalette(); | 665 | setMyPalette(); |
664 | QString text; | 666 | QString text; |
665 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 667 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
666 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 668 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
667 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 669 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
668 | mLabel->resize( mLabelBigSize ); | 670 | mLabel->resize( mLabelBigSize ); |
669 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 671 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
670 | } else { | 672 | } else { |
671 | mLabel->resize( mLabelSize ); | 673 | mLabel->resize( mLabelSize ); |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index fd8cbf2..a92421b 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -158,25 +158,25 @@ class MonthViewCell : public QWidget | |||
158 | void deselect(); | 158 | void deselect(); |
159 | void select(); | 159 | void select(); |
160 | 160 | ||
161 | #ifdef DESKTOP_VERSION | 161 | #ifdef DESKTOP_VERSION |
162 | static QToolTipGroup *toolTipGroup(); | 162 | static QToolTipGroup *toolTipGroup(); |
163 | #endif | 163 | #endif |
164 | signals: | 164 | signals: |
165 | void defaultAction( Incidence * ); | 165 | void defaultAction( Incidence * ); |
166 | void newEventSignal( QDateTime ); | 166 | void newEventSignal( QDateTime ); |
167 | void showDaySignal( QDate ); | 167 | void showDaySignal( QDate ); |
168 | 168 | ||
169 | protected: | 169 | protected: |
170 | QString mToolTip; | 170 | QStringList mToolTip; |
171 | void resizeEvent( QResizeEvent * ); | 171 | void resizeEvent( QResizeEvent * ); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void showDay(); | 175 | void showDay(); |
176 | 176 | ||
177 | protected slots: | 177 | protected slots: |
178 | void defaultAction( QListBoxItem * ); | 178 | void defaultAction( QListBoxItem * ); |
179 | void contextMenu( QListBoxItem * ); | 179 | void contextMenu( QListBoxItem * ); |
180 | void selection( QListBoxItem * ); | 180 | void selection( QListBoxItem * ); |
181 | void cellClicked( QListBoxItem * ); | 181 | void cellClicked( QListBoxItem * ); |
182 | void newEvent(); | 182 | void newEvent(); |