author | zautrix <zautrix> | 2005-02-07 10:32:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 10:32:40 (UTC) |
commit | afc19166fcdc09d3d5b757a84abfeb0b2746f35f (patch) (unidiff) | |
tree | 91b1de5d4154eace5ddb2c0dc5c3243a53ed8661 /korganizer | |
parent | 363a0e27d630452762e76131b4606e14a3231f01 (diff) | |
download | kdepimpi-afc19166fcdc09d3d5b757a84abfeb0b2746f35f.zip kdepimpi-afc19166fcdc09d3d5b757a84abfeb0b2746f35f.tar.gz kdepimpi-afc19166fcdc09d3d5b757a84abfeb0b2746f35f.tar.bz2 |
month fixes
-rw-r--r-- | korganizer/komonthview.cpp | 144 | ||||
-rw-r--r-- | korganizer/komonthview.h | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 2 |
3 files changed, 86 insertions, 68 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 70cbf96..234375b 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,49 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qtimer.h> | ||
26 | #include <qvbox.h> | 25 | #include <qvbox.h> |
27 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
28 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
29 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
30 | #include <qpainter.h> | 29 | #include <qpainter.h> |
31 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 31 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
34 | #else | 33 | #else |
35 | #include <qapplication.h> | 34 | #include <qapplication.h> |
36 | #endif | 35 | #endif |
37 | 36 | ||
38 | #include <kdebug.h> | 37 | #include <kdebug.h> |
39 | #include <klocale.h> | 38 | #include <klocale.h> |
40 | #include <kglobal.h> | 39 | #include <kglobal.h> |
41 | #include <kconfig.h> | 40 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
43 | 42 | ||
44 | #include <kcalendarsystem.h> | 43 | #include <kcalendarsystem.h> |
45 | 44 | ||
46 | #ifndef KORG_NOPRINTER | 45 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 46 | #include "calprinter.h" |
48 | #endif | 47 | #endif |
49 | #include "koprefs.h" | 48 | #include "koprefs.h" |
@@ -386,55 +385,48 @@ bool MonthViewCell::isPrimary() const | |||
386 | { | 385 | { |
387 | return mPrimary; | 386 | return mPrimary; |
388 | } | 387 | } |
389 | 388 | ||
390 | void MonthViewCell::setHoliday( bool holiday ) | 389 | void MonthViewCell::setHoliday( bool holiday ) |
391 | { | 390 | { |
392 | mHoliday = holiday; | 391 | mHoliday = holiday; |
393 | //setMyPalette(); | 392 | //setMyPalette(); |
394 | } | 393 | } |
395 | 394 | ||
396 | void MonthViewCell::setHoliday( const QString &holiday ) | 395 | void MonthViewCell::setHoliday( const QString &holiday ) |
397 | { | 396 | { |
398 | mHolidayString = holiday; | 397 | mHolidayString = holiday; |
399 | 398 | ||
400 | if ( !holiday.isEmpty() ) { | 399 | if ( !holiday.isEmpty() ) { |
401 | setHoliday( true ); | 400 | setHoliday( true ); |
402 | } | 401 | } |
403 | } | 402 | } |
404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 403 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
405 | { | 404 | { |
406 | 405 | ||
407 | e->ignore(); | 406 | e->ignore(); |
408 | 407 | ||
409 | } | 408 | } |
410 | void MonthViewCell::clear() | ||
411 | { | ||
412 | mItemList->clear(); | ||
413 | QApplication::removePostedEvents ( mItemList ); | ||
414 | QApplication::removePostedEvents ( mLabel ); | ||
415 | QApplication::removePostedEvents ( this ); | ||
416 | } | ||
417 | 409 | ||
418 | void MonthViewCell::startUpdateCell() | 410 | void MonthViewCell::startUpdateCell() |
419 | { | 411 | { |
420 | 412 | ||
421 | mItemList->setFocusPolicy(NoFocus); | 413 | mItemList->setFocusPolicy(NoFocus); |
422 | if ( !mMonthView->isUpdatePossible() ) | 414 | if ( !mMonthView->isUpdatePossible() ) |
423 | return; | 415 | return; |
424 | 416 | ||
425 | /* | 417 | /* |
426 | if ( !isVisible() ){ | 418 | if ( !isVisible() ){ |
427 | return; | 419 | return; |
428 | } | 420 | } |
429 | */ | 421 | */ |
430 | // qDebug("MonthViewCell::updateCell() "); | 422 | // qDebug("MonthViewCell::updateCell() "); |
431 | setPrimary( mDate.month()%2 ); | 423 | setPrimary( mDate.month()%2 ); |
432 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 424 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
433 | if ( mDate == QDate::currentDate() ) { | 425 | if ( mDate == QDate::currentDate() ) { |
434 | mItemList->setLineWidth( 3 ); | 426 | mItemList->setLineWidth( 3 ); |
435 | } else { | 427 | } else { |
436 | mItemList->setLineWidth( 1 ); | 428 | mItemList->setLineWidth( 1 ); |
437 | } | 429 | } |
438 | mItemList->clear(); | 430 | mItemList->clear(); |
439 | 431 | ||
440 | #ifdef DESKTOP_VERSION | 432 | #ifdef DESKTOP_VERSION |
@@ -531,57 +523,57 @@ void MonthViewCell::insertEvent(Event *event) | |||
531 | 523 | ||
532 | } else { | 524 | } else { |
533 | pal = mStandardPalette ; | 525 | pal = mStandardPalette ; |
534 | } | 526 | } |
535 | item->setPalette( pal ); | 527 | item->setPalette( pal ); |
536 | item->setRecur( event->recurrence()->doesRecur() ); | 528 | item->setRecur( event->recurrence()->doesRecur() ); |
537 | item->setAlarm( event->isAlarmEnabled() ); | 529 | item->setAlarm( event->isAlarmEnabled() ); |
538 | item->setMoreInfo( event->description().length() > 0 ); | 530 | item->setMoreInfo( event->description().length() > 0 ); |
539 | #ifdef DESKTOP_VERSION | 531 | #ifdef DESKTOP_VERSION |
540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 532 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
541 | KOPrefs::instance()->email()); | 533 | KOPrefs::instance()->email()); |
542 | if ( me != 0 ) { | 534 | if ( me != 0 ) { |
543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 535 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
544 | item->setReply(true); | 536 | item->setReply(true); |
545 | else | 537 | else |
546 | item->setReply(false); | 538 | item->setReply(false); |
547 | } else | 539 | } else |
548 | item->setReply(false); | 540 | item->setReply(false); |
549 | #endif | 541 | #endif |
550 | mItemList->insertItem( item ); | 542 | mItemList->insertItem( item ); |
551 | mToolTip += "\n"; | 543 | mToolTip += "\n"; |
552 | } | 544 | } |
553 | void MonthViewCell::insertTodo(Todo *todo) | 545 | void MonthViewCell::insertTodo(Todo *todo) |
554 | { | 546 | { |
555 | QString text; | ||
556 | mItemList->setFocusPolicy(WheelFocus); | 547 | mItemList->setFocusPolicy(WheelFocus); |
548 | QString text; | ||
557 | if (todo->hasDueDate()) { | 549 | if (todo->hasDueDate()) { |
558 | if (!todo->doesFloat()) { | 550 | if (!todo->doesFloat()) { |
559 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 551 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
560 | text += " "; | 552 | text += " "; |
561 | } | 553 | } |
562 | } | 554 | } |
563 | text += i18n("T: %1").arg(todo->summary()); | 555 | text += i18n("Td: %1").arg(todo->summary()); |
564 | 556 | ||
565 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 557 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
566 | //item->setPalette( mStandardPalette ); | 558 | //item->setPalette( mStandardPalette ); |
567 | QPalette pal; | 559 | QPalette pal; |
568 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 560 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
569 | QStringList categories = todo->categories(); | 561 | QStringList categories = todo->categories(); |
570 | QString cat = categories.first(); | 562 | QString cat = categories.first(); |
571 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 563 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
572 | pal = getPalette(); | 564 | pal = getPalette(); |
573 | if (cat.isEmpty()) { | 565 | if (cat.isEmpty()) { |
574 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 566 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
575 | } else { | 567 | } else { |
576 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 568 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
577 | } | 569 | } |
578 | 570 | ||
579 | } else { | 571 | } else { |
580 | if (cat.isEmpty()) { | 572 | if (cat.isEmpty()) { |
581 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 573 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
582 | } else { | 574 | } else { |
583 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 575 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
584 | } | 576 | } |
585 | } | 577 | } |
586 | 578 | ||
587 | } else { | 579 | } else { |
@@ -595,48 +587,49 @@ void MonthViewCell::finishUpdateCell() | |||
595 | { | 587 | { |
596 | #ifdef DESKTOP_VERSION | 588 | #ifdef DESKTOP_VERSION |
597 | if (mToolTip != "") | 589 | if (mToolTip != "") |
598 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 590 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
599 | #endif | 591 | #endif |
600 | mItemList->sort(); | 592 | mItemList->sort(); |
601 | //setMyPalette(); | 593 | //setMyPalette(); |
602 | setMyPalette(); | 594 | setMyPalette(); |
603 | QString text; | 595 | QString text; |
604 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 596 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
605 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 597 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
606 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 598 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
607 | mLabel->resize( mLabelBigSize ); | 599 | mLabel->resize( mLabelBigSize ); |
608 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 600 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
609 | } else { | 601 | } else { |
610 | mLabel->resize( mLabelSize ); | 602 | mLabel->resize( mLabelSize ); |
611 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 603 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
612 | } | 604 | } |
613 | 605 | ||
614 | mLabel->setText( text ); | 606 | mLabel->setText( text ); |
615 | resizeEvent( 0 ); | 607 | resizeEvent( 0 ); |
616 | } | 608 | } |
617 | void MonthViewCell::updateCell() | 609 | void MonthViewCell::updateCell() |
618 | { | 610 | { |
611 | qDebug("MonthViewCell::updateCell() "); | ||
619 | if ( !mMonthView->isUpdatePossible() ) | 612 | if ( !mMonthView->isUpdatePossible() ) |
620 | return; | 613 | return; |
621 | startUpdateCell(); | 614 | startUpdateCell(); |
622 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 615 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
623 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 616 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
624 | Event *event; | 617 | Event *event; |
625 | for( event = events.first(); event; event = events.next() ) { // for event | 618 | for( event = events.first(); event; event = events.next() ) { // for event |
626 | insertEvent(event); | 619 | insertEvent(event); |
627 | } | 620 | } |
628 | // insert due todos | 621 | // insert due todos |
629 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 622 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
630 | Todo *todo; | 623 | Todo *todo; |
631 | for(todo = todos.first(); todo; todo = todos.next()) { | 624 | for(todo = todos.first(); todo; todo = todos.next()) { |
632 | insertTodo( todo ); | 625 | insertTodo( todo ); |
633 | } | 626 | } |
634 | finishUpdateCell(); | 627 | finishUpdateCell(); |
635 | // if ( isVisible()) | 628 | // if ( isVisible()) |
636 | //qApp->processEvents(); | 629 | //qApp->processEvents(); |
637 | } | 630 | } |
638 | 631 | ||
639 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 632 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
640 | { | 633 | { |
641 | 634 | ||
642 | if ( bigFont ) { | 635 | if ( bigFont ) { |
@@ -762,84 +755,84 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) | |||
762 | if ( lastClicked ) | 755 | if ( lastClicked ) |
763 | if ( ! item ) { | 756 | if ( ! item ) { |
764 | if ( lastClicked->listBox() != item->listBox() ) | 757 | if ( lastClicked->listBox() != item->listBox() ) |
765 | lastClicked->listBox()->clearSelection(); | 758 | lastClicked->listBox()->clearSelection(); |
766 | } | 759 | } |
767 | */ | 760 | */ |
768 | 761 | ||
769 | mMonthView->setSelectedCell( this ); | 762 | mMonthView->setSelectedCell( this ); |
770 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 763 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
771 | select(); | 764 | select(); |
772 | } | 765 | } |
773 | 766 | ||
774 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 767 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
775 | { | 768 | { |
776 | if ( !item ) return; | 769 | if ( !item ) return; |
777 | 770 | ||
778 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 771 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
779 | Incidence *incidence = eventItem->incidence(); | 772 | Incidence *incidence = eventItem->incidence(); |
780 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 773 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
781 | } | 774 | } |
782 | 775 | ||
783 | void MonthViewCell::selection( QListBoxItem *item ) | 776 | void MonthViewCell::selection( QListBoxItem *item ) |
784 | { | 777 | { |
785 | if ( !item ) return; | 778 | if ( !item ) return; |
779 | |||
786 | mMonthView->setSelectedCell( this ); | 780 | mMonthView->setSelectedCell( this ); |
787 | } | 781 | } |
788 | 782 | ||
789 | 783 | ||
790 | // ******************************************************************************* | 784 | // ******************************************************************************* |
791 | // ******************************************************************************* | 785 | // ******************************************************************************* |
792 | // ******************************************************************************* | 786 | // ******************************************************************************* |
793 | 787 | ||
794 | 788 | ||
795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 789 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
796 | : KOEventView( calendar, parent, name ), | 790 | : KOEventView( calendar, parent, name ), |
797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 791 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 792 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
799 | { | 793 | { |
800 | ignoreResizeEvent = 0; | 794 | skipResize = false; |
801 | mShortDayLabelsW = false; | ||
802 | mShortDayLabelsM = false; | ||
803 | clPending = true; | 795 | clPending = true; |
804 | mWidStack = new QWidgetStack( this ); | 796 | mWidStack = new QWidgetStack( this ); |
805 | QHBoxLayout* hb = new QHBoxLayout( this ); | 797 | QHBoxLayout* hb = new QHBoxLayout( this ); |
806 | mMonthView = new QWidget( mWidStack ); | 798 | mMonthView = new QWidget( mWidStack ); |
807 | mWeekView = new QWidget( mWidStack ); | 799 | mWeekView = new QWidget( mWidStack ); |
808 | #if QT_VERSION >= 0x030000 | 800 | #if QT_VERSION >= 0x030000 |
809 | mWidStack->addWidget(mMonthView ); | 801 | mWidStack->addWidget(mMonthView ); |
810 | mWidStack->addWidget(mWeekView ); | 802 | mWidStack->addWidget(mWeekView ); |
811 | #else | 803 | #else |
812 | mWidStack->addWidget( mMonthView, 1 ); | 804 | mWidStack->addWidget( mMonthView, 1 ); |
813 | mWidStack->addWidget( mWeekView , 1 ); | 805 | mWidStack->addWidget( mWeekView , 1 ); |
814 | #endif | 806 | #endif |
815 | hb->addWidget( mWidStack ); | 807 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 808 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 809 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
818 | if ( mShowWeekView ) | 810 | if ( mShowWeekView ) |
819 | mWeekStartsMonday = true; | 811 | mWeekStartsMonday = true; |
820 | updatePossible = false; | 812 | updatePossible = false; |
821 | mCells.setAutoDelete( true ); | 813 | mCells.setAutoDelete( true ); |
814 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | ||
822 | mDayLabels.resize( mDaysPerWeek ); | 815 | mDayLabels.resize( mDaysPerWeek ); |
823 | mDayLabelsW.resize( mDaysPerWeek ); | 816 | mDayLabelsW.resize( mDaysPerWeek ); |
824 | QFont bfont = font(); | 817 | QFont bfont = font(); |
825 | if ( QApplication::desktop()->width() < 650 ) { | 818 | if ( QApplication::desktop()->width() < 650 ) { |
826 | bfont.setPointSize( bfont.pointSize() - 2 ); | 819 | bfont.setPointSize( bfont.pointSize() - 2 ); |
827 | } | 820 | } |
828 | bfont.setBold( true ); | 821 | bfont.setBold( true ); |
829 | int i; | 822 | int i; |
830 | 823 | ||
831 | for( i = 0; i < mDaysPerWeek; i++ ) { | 824 | for( i = 0; i < mDaysPerWeek; i++ ) { |
832 | QLabel *label = new QLabel( mMonthView ); | 825 | QLabel *label = new QLabel( mMonthView ); |
833 | label->setFont(bfont); | 826 | label->setFont(bfont); |
834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 827 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
835 | label->setLineWidth(1); | 828 | label->setLineWidth(1); |
836 | label->setAlignment(AlignCenter); | 829 | label->setAlignment(AlignCenter); |
837 | mDayLabels.insert( i, label ); | 830 | mDayLabels.insert( i, label ); |
838 | label = new QLabel( mWeekView ); | 831 | label = new QLabel( mWeekView ); |
839 | label->setFont(bfont); | 832 | label->setFont(bfont); |
840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 833 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
841 | label->setLineWidth(1); | 834 | label->setLineWidth(1); |
842 | label->setAlignment(AlignCenter); | 835 | label->setAlignment(AlignCenter); |
843 | mDayLabelsW.insert( i, label ); | 836 | mDayLabelsW.insert( i, label ); |
844 | } | 837 | } |
845 | 838 | ||
@@ -993,100 +986,104 @@ DateList KOMonthView::selectedDates() | |||
993 | if ( qd.isValid() ) selected.append( qd ); | 986 | if ( qd.isValid() ) selected.append( qd ); |
994 | } | 987 | } |
995 | 988 | ||
996 | return selected; | 989 | return selected; |
997 | } | 990 | } |
998 | 991 | ||
999 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 992 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1000 | const QDate &td) | 993 | const QDate &td) |
1001 | { | 994 | { |
1002 | #ifndef KORG_NOPRINTER | 995 | #ifndef KORG_NOPRINTER |
1003 | calPrinter->preview(CalPrinter::Month, fd, td); | 996 | calPrinter->preview(CalPrinter::Month, fd, td); |
1004 | #endif | 997 | #endif |
1005 | } | 998 | } |
1006 | 999 | ||
1007 | void KOMonthView::updateConfig() | 1000 | void KOMonthView::updateConfig() |
1008 | { | 1001 | { |
1009 | 1002 | ||
1010 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1003 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1011 | 1004 | ||
1012 | if ( mShowWeekView ) { | 1005 | if ( mShowWeekView ) { |
1013 | mWeekStartsMonday = true; | 1006 | mWeekStartsMonday = true; |
1014 | } | 1007 | } |
1015 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1008 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1016 | mWidthLongDayLabel = 0; | 1009 | mWidthLongDayLabel = 0; |
1010 | |||
1017 | for (int i = 0; i < 7; i++) { | 1011 | for (int i = 0; i < 7; i++) { |
1018 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1012 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1019 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1013 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1020 | } | 1014 | } |
1015 | bool temp = mShowSatSunComp ; | ||
1016 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | ||
1021 | if ( ! mShowWeekView ) { | 1017 | if ( ! mShowWeekView ) { |
1018 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | ||
1022 | computeLayout(); | 1019 | computeLayout(); |
1023 | } | 1020 | } |
1024 | updateDayLabels(); | 1021 | updateDayLabels(); |
1025 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1022 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1026 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1023 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1027 | //resizeEvent( 0 ); | 1024 | //resizeEvent( 0 ); |
1028 | for (uint i = 0; i < mCells.count(); ++i) { | 1025 | for (uint i = 0; i < mCells.count(); ++i) { |
1029 | mCells[i]->updateConfig(); | 1026 | mCells[i]->updateConfig(); |
1030 | } | 1027 | } |
1031 | 1028 | ||
1032 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1029 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1033 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1030 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1034 | } | 1031 | } |
1035 | #ifdef DESKTOP_VERSION | 1032 | #ifdef DESKTOP_VERSION |
1036 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1033 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1037 | #endif | 1034 | #endif |
1038 | updateView(); | 1035 | updateView(); |
1039 | } | 1036 | } |
1040 | 1037 | ||
1041 | void KOMonthView::updateDayLabels() | 1038 | void KOMonthView::updateDayLabels() |
1042 | { | 1039 | { |
1043 | 1040 | ||
1044 | QPtrVector<QLabel> *mDayLabelsT; | 1041 | QPtrVector<QLabel> *mDayLabelsT; |
1045 | 1042 | ||
1046 | mDayLabelsT = &mDayLabelsW; | 1043 | mDayLabelsT = &mDayLabelsW; |
1047 | for (int i = 0; i < 7; i++) { | 1044 | for (int i = 0; i < 7; i++) { |
1048 | if (mWeekStartsMonday) { | 1045 | if (mWeekStartsMonday) { |
1049 | bool show = mShortDayLabelsW; | 1046 | bool show = mShortDayLabels; |
1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1047 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1051 | show = true; | 1048 | show = true; |
1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1049 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1053 | } else { | 1050 | } else { |
1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1051 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1052 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
1056 | 1053 | ||
1057 | } | 1054 | } |
1058 | } | 1055 | } |
1059 | mDayLabelsT = &mDayLabels; | 1056 | mDayLabelsT = &mDayLabels; |
1060 | for (int i = 0; i < 7; i++) { | 1057 | for (int i = 0; i < 7; i++) { |
1061 | if (mWeekStartsMonday) { | 1058 | if (mWeekStartsMonday) { |
1062 | bool show = mShortDayLabelsM; | 1059 | bool show = mShortDayLabels; |
1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1060 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1064 | show = true; | 1061 | show = true; |
1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1062 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1066 | } else { | 1063 | } else { |
1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1064 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1065 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
1069 | 1066 | ||
1070 | } | 1067 | } |
1071 | } | 1068 | } |
1072 | 1069 | ||
1073 | } | 1070 | } |
1074 | 1071 | ||
1075 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1072 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1076 | { | 1073 | { |
1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1074 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1078 | 1075 | ||
1079 | QPtrVector<MonthViewCell> *cells; | 1076 | QPtrVector<MonthViewCell> *cells; |
1080 | QPtrVector<QLabel> *dayLabels; | 1077 | QPtrVector<QLabel> *dayLabels; |
1081 | QPtrVector<KOWeekButton> *weekLabels; | 1078 | QPtrVector<KOWeekButton> *weekLabels; |
1082 | int weekNum = 6; | 1079 | int weekNum = 6; |
1083 | if ( mShowWeekView ) { | 1080 | if ( mShowWeekView ) { |
1084 | weekNum = 1; | 1081 | weekNum = 1; |
1085 | cells = &mCellsW; | 1082 | cells = &mCellsW; |
1086 | dayLabels = &mDayLabelsW; | 1083 | dayLabels = &mDayLabelsW; |
1087 | weekLabels = &mWeekLabelsW; | 1084 | weekLabels = &mWeekLabelsW; |
1088 | } else { | 1085 | } else { |
1089 | cells = &mCells; | 1086 | cells = &mCells; |
1090 | dayLabels = &mDayLabels; | 1087 | dayLabels = &mDayLabels; |
1091 | weekLabels = &mWeekLabels; | 1088 | weekLabels = &mWeekLabels; |
1092 | } | 1089 | } |
@@ -1242,81 +1239,95 @@ void KOMonthView::updateView() | |||
1242 | } | 1239 | } |
1243 | processSelectionChange(); | 1240 | processSelectionChange(); |
1244 | (*cells)[0]->setFocus(); | 1241 | (*cells)[0]->setFocus(); |
1245 | 1242 | ||
1246 | 1243 | ||
1247 | #else | 1244 | #else |
1248 | // old code | 1245 | // old code |
1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1246 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1250 | int i; | 1247 | int i; |
1251 | for( i = 0; i < (*cells).count(); ++i ) { | 1248 | for( i = 0; i < (*cells).count(); ++i ) { |
1252 | (*cells)[i]->updateCell(); | 1249 | (*cells)[i]->updateCell(); |
1253 | } | 1250 | } |
1254 | 1251 | ||
1255 | //qDebug("KOMonthView::updateView() "); | 1252 | //qDebug("KOMonthView::updateView() "); |
1256 | processSelectionChange(); | 1253 | processSelectionChange(); |
1257 | // qDebug("---------------------------------------------------------------------+ "); | 1254 | // qDebug("---------------------------------------------------------------------+ "); |
1258 | (*cells)[0]->setFocus(); | 1255 | (*cells)[0]->setFocus(); |
1259 | #endif | 1256 | #endif |
1260 | 1257 | ||
1261 | //qDebug("update time %d ", ti.elapsed()); | 1258 | //qDebug("update time %d ", ti.elapsed()); |
1262 | } | 1259 | } |
1263 | 1260 | ||
1264 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1261 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1265 | { | 1262 | { |
1266 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1263 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1267 | if ( ignoreResizeEvent ) { | 1264 | if ( skipResize ) { |
1268 | //qDebug("KOMonthView::resizeEvent ignored "); | 1265 | skipResize = false; |
1269 | --ignoreResizeEvent; | 1266 | qDebug("skipResize "); |
1270 | return; | 1267 | return; |
1271 | } | 1268 | } |
1272 | if ( e->size().width()+ e->size().height() < 240 ) | ||
1273 | return; | ||
1274 | computeLayout(); | 1269 | computeLayout(); |
1275 | clPending = true; | 1270 | clPending = true; |
1276 | if ( mShowWeekView ) | 1271 | if ( mShowWeekView ) |
1277 | mCellsW[0]->setFocus(); | 1272 | mCellsW[0]->setFocus(); |
1278 | else | 1273 | else |
1279 | mCells[0]->setFocus(); | 1274 | mCells[0]->setFocus(); |
1280 | } | 1275 | } |
1281 | void KOMonthView::computeLayoutWeek() | 1276 | void KOMonthView::computeLayoutWeek() |
1282 | { | 1277 | { |
1283 | static int widd = 0; | 1278 | static int lastWid = 0; |
1284 | static int heigg = 0; | 1279 | static int lastHei = 0; |
1285 | if ( widd == width() && heigg == height () ) { | ||
1286 | return; | ||
1287 | } | ||
1288 | widd = width() ; | ||
1289 | heigg = height (); | ||
1290 | int daysToShow; | 1280 | int daysToShow; |
1281 | bool combinedSatSun = false; | ||
1282 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | ||
1283 | daysToShow = 6; | ||
1284 | combinedSatSun = true; | ||
1285 | } | ||
1286 | int tWid = topLevelWidget()->size().width(); | ||
1287 | int tHei = topLevelWidget()->size().height(); | ||
1288 | |||
1291 | int wid = size().width();//e | 1289 | int wid = size().width();//e |
1292 | int hei = size().height()-1; | 1290 | int hei = size().height()-1; |
1291 | |||
1292 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1293 | return; | ||
1294 | |||
1295 | |||
1296 | if ( lastWid == width() && lastHei ==height() ) | ||
1297 | return; | ||
1298 | lastWid =width(); | ||
1299 | lastHei = height(); | ||
1300 | |||
1301 | |||
1293 | if ( wid < hei ) | 1302 | if ( wid < hei ) |
1294 | daysToShow = 2; | 1303 | daysToShow = 2; |
1295 | else | 1304 | else |
1296 | daysToShow = 3; | 1305 | daysToShow = 3; |
1297 | bool combinedSatSun = true; | 1306 | mShowSatSunComp = true; |
1307 | combinedSatSun = true; | ||
1298 | 1308 | ||
1309 | qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | ||
1299 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1310 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1300 | int weeklabelwid = fm.width( "888" ); | 1311 | int weeklabelwid = fm.width( "888" ); |
1301 | wid -= weeklabelwid; | 1312 | wid -= weeklabelwid; |
1302 | 1313 | ||
1303 | int colWid = wid / daysToShow; | 1314 | int colWid = wid / daysToShow; |
1304 | int lastCol = wid - ( colWid*6 ); | 1315 | int lastCol = wid - ( colWid*6 ); |
1305 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1316 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1306 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1317 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1307 | int colModulo = wid % daysToShow; | 1318 | int colModulo = wid % daysToShow; |
1308 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1319 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1309 | //qDebug("rowmod %d ", rowModulo); | 1320 | //qDebug("rowmod %d ", rowModulo); |
1310 | int i; | 1321 | int i; |
1311 | int x,y,w,h; | 1322 | int x,y,w,h; |
1312 | x= 0; | 1323 | x= 0; |
1313 | y= 0; | 1324 | y= 0; |
1314 | w = colWid; | 1325 | w = colWid; |
1315 | h = dayLabelHei ; | 1326 | h = dayLabelHei ; |
1316 | for ( i = 0; i < 7; i++) { | 1327 | for ( i = 0; i < 7; i++) { |
1317 | if ( i && !( i % daysToShow) && i < 6) { | 1328 | if ( i && !( i % daysToShow) && i < 6) { |
1318 | y += hei/(5-daysToShow); | 1329 | y += hei/(5-daysToShow); |
1319 | x = 0; | 1330 | x = 0; |
1320 | w = colWid; | 1331 | w = colWid; |
1321 | } | 1332 | } |
1322 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1333 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
@@ -1351,190 +1362,199 @@ void KOMonthView::computeLayoutWeek() | |||
1351 | if ( i ==5 ) { | 1362 | if ( i ==5 ) { |
1352 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1363 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1353 | x -= w ;y += h/2; | 1364 | x -= w ;y += h/2; |
1354 | } else { | 1365 | } else { |
1355 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1366 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1356 | ++w; | 1367 | ++w; |
1357 | } | 1368 | } |
1358 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1369 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1359 | y -= h/2; | 1370 | y -= h/2; |
1360 | } | 1371 | } |
1361 | } else | 1372 | } else |
1362 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1373 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1363 | 1374 | ||
1364 | 1375 | ||
1365 | x += w; | 1376 | x += w; |
1366 | if ( x + w/2 > wid ) { | 1377 | if ( x + w/2 > wid ) { |
1367 | x = 0; | 1378 | x = 0; |
1368 | y += h+dayLabelHei ; | 1379 | y += h+dayLabelHei ; |
1369 | } | 1380 | } |
1370 | } | 1381 | } |
1371 | y= dayLabelHei; | 1382 | y= dayLabelHei; |
1372 | h = cellHei ; | 1383 | h = cellHei ; |
1373 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1384 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1374 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1385 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1375 | 1386 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | |
1376 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1387 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1388 | mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | ||
1377 | updateDayLabels(); | 1389 | updateDayLabels(); |
1378 | bool forceUpdate = !updatePossible; | 1390 | bool forceUpdate = !updatePossible; |
1379 | updatePossible = true; | 1391 | updatePossible = true; |
1380 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1392 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1381 | if ( forceUpdate ) | 1393 | if ( forceUpdate ) |
1382 | updateView(); | 1394 | updateView(); |
1383 | } | 1395 | } |
1384 | void KOMonthView::computeLayout() | 1396 | void KOMonthView::computeLayout() |
1385 | { | 1397 | { |
1386 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | ||
1387 | // note this only changes the text if the requested size crosses the | ||
1388 | // threshold between big enough to support the full name and not big | ||
1389 | // enough. | ||
1390 | 1398 | ||
1391 | int tWid = topLevelWidget()->size().width(); | ||
1392 | int tHei = topLevelWidget()->size().height(); | ||
1393 | |||
1394 | int wid = size().width();//e | ||
1395 | int hei = size().height()-1; | ||
1396 | |||
1397 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1398 | return; | ||
1399 | 1399 | ||
1400 | static int lastWid = 0; | ||
1401 | static int lastHei = 0; | ||
1400 | 1402 | ||
1401 | if ( mShowWeekView ){ | 1403 | if ( mShowWeekView ){ |
1402 | computeLayoutWeek(); | 1404 | computeLayoutWeek(); |
1403 | return; | 1405 | return; |
1404 | } | 1406 | } |
1405 | static int widd = 0; | ||
1406 | static int heigg = 0; | ||
1407 | if ( widd == width() && heigg == height () ) { | ||
1408 | return; | ||
1409 | } | ||
1410 | widd = width() ; | ||
1411 | heigg = height (); | ||
1412 | |||
1413 | int daysToShow = 7; | 1407 | int daysToShow = 7; |
1414 | bool combinedSatSun = false; | 1408 | bool combinedSatSun = false; |
1415 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { | 1409 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1416 | daysToShow = 6; | 1410 | daysToShow = 6; |
1417 | combinedSatSun = true; | 1411 | combinedSatSun = true; |
1418 | } | 1412 | } |
1413 | int tWid = topLevelWidget()->size().width(); | ||
1414 | int tHei = topLevelWidget()->size().height(); | ||
1415 | |||
1416 | int wid = size().width();//e | ||
1417 | int hei = size().height()-1; | ||
1418 | |||
1419 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1420 | return; | ||
1421 | if ( lastWid == width() && lastHei ==height() ) | ||
1422 | return; | ||
1423 | lastWid =width(); | ||
1424 | lastHei = height(); | ||
1425 | qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); | ||
1419 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1426 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1420 | int weeklabelwid = fm.width( "888" ); | 1427 | int weeklabelwid = fm.width( "888" ); |
1421 | wid -= weeklabelwid; | 1428 | wid -= weeklabelwid; |
1422 | 1429 | ||
1423 | int colWid = wid / daysToShow; | 1430 | int colWid = wid / daysToShow; |
1424 | int lastCol = wid - ( colWid*6 ); | 1431 | int lastCol = wid - ( colWid*6 ); |
1425 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1432 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1426 | int cellHei = (hei - dayLabelHei) /6; | 1433 | int cellHei = (hei - dayLabelHei) /6; |
1427 | int colModulo = wid % daysToShow; | 1434 | int colModulo = wid % daysToShow; |
1428 | int rowModulo = (hei- dayLabelHei) % 6; | 1435 | int rowModulo = (hei- dayLabelHei) % 6; |
1429 | //qDebug("rowmod %d ", rowModulo); | 1436 | //qDebug("rowmod %d ", rowModulo); |
1430 | int i; | 1437 | int i; |
1431 | int x,y,w,h; | 1438 | int x,y,w,h; |
1432 | x= 0; | 1439 | x= 0; |
1433 | y= 0; | 1440 | y= 0; |
1434 | w = colWid; | 1441 | w = colWid; |
1435 | h = dayLabelHei ; | 1442 | h = dayLabelHei ; |
1436 | for ( i = 0; i < 7; i++) { | 1443 | for ( i = 0; i < 7; i++) { |
1437 | if ( i == daysToShow-colModulo ) | 1444 | if ( i == daysToShow-colModulo ) |
1438 | ++w; | 1445 | ++w; |
1439 | if ( combinedSatSun ) { | 1446 | if ( combinedSatSun ) { |
1440 | if ( i >= daysToShow-1 ) { | 1447 | if ( i >= daysToShow-1 ) { |
1441 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1448 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1442 | x -= w/2 ; | 1449 | x -= w/2 ; |
1443 | } | 1450 | } |
1444 | else | 1451 | else |
1445 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1452 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1446 | } else | 1453 | } else |
1447 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1454 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1448 | x += w; | 1455 | x += w; |
1449 | } | 1456 | } |
1450 | x= 0; | 1457 | x= 0; |
1451 | y= dayLabelHei; | 1458 | y= dayLabelHei; |
1452 | w = colWid; | 1459 | w = colWid; |
1453 | h = cellHei ; | 1460 | h = cellHei ; |
1454 | for ( i = 0; i < mCells.count(); ++i) { | 1461 | for ( i = 0; i < mCells.count(); ++i) { |
1462 | //qDebug("iii %d ", i); | ||
1455 | w = colWid; | 1463 | w = colWid; |
1456 | if ( ((i) % 7) >= 7-colModulo ) { | 1464 | if ( ((i) % 7) >= 7-colModulo ) { |
1457 | ++w; | 1465 | ++w; |
1458 | } | 1466 | } |
1459 | if ( i == (6-rowModulo)*7) | 1467 | if ( i == (6-rowModulo)*7) |
1460 | ++h; | 1468 | ++h; |
1461 | if ( combinedSatSun ) { | 1469 | if ( combinedSatSun ) { |
1462 | if ( (i)%7 >= daysToShow-1 ) { | 1470 | if ( (i)%7 >= daysToShow-1 ) { |
1463 | if ( (i)%7 == daysToShow-1 ) { | 1471 | if ( (i)%7 == daysToShow-1 ) { |
1464 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1472 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1465 | x -= w ;y += h/2; | 1473 | x -= w ;y += h/2; |
1466 | } else { | 1474 | } else { |
1467 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1475 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1468 | y -= h/2; | 1476 | y -= h/2; |
1469 | } | 1477 | } |
1470 | } else | 1478 | } else |
1471 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1479 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1472 | 1480 | ||
1473 | } | 1481 | } |
1474 | else | 1482 | else |
1475 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1483 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1476 | x += w; | 1484 | x += w; |
1477 | if ( x + w/2 > wid ) { | 1485 | if ( x + w/2 > wid ) { |
1478 | x = 0; | 1486 | x = 0; |
1479 | y += h; | 1487 | y += h; |
1480 | } | 1488 | } |
1481 | } | 1489 | } |
1482 | y= dayLabelHei; | 1490 | y= dayLabelHei; |
1483 | h = cellHei ; | 1491 | h = cellHei ; |
1484 | for ( i = 0; i < 6; i++) { | 1492 | for ( i = 0; i < 6; i++) { |
1485 | if ( i == (6-rowModulo)) | 1493 | if ( i == (6-rowModulo)) |
1486 | ++h; | 1494 | ++h; |
1487 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1495 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1488 | y += h; | 1496 | y += h; |
1489 | } | 1497 | } |
1490 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1498 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1491 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1499 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1492 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); | 1500 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1501 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | ||
1493 | updateDayLabels(); | 1502 | updateDayLabels(); |
1494 | bool forceUpdate = !updatePossible; | 1503 | bool forceUpdate = !updatePossible; |
1495 | updatePossible = true; | 1504 | updatePossible = true; |
1505 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | ||
1496 | if ( forceUpdate ) | 1506 | if ( forceUpdate ) |
1497 | updateView(); | 1507 | updateView(); |
1498 | } | 1508 | } |
1499 | 1509 | ||
1500 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1510 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1501 | { | 1511 | { |
1502 | mContextMenu->showIncidencePopup(incidence); | 1512 | mContextMenu->showIncidencePopup(incidence); |
1503 | 1513 | /* | |
1514 | if( incidence && incidence->type() == "Event" ) { | ||
1515 | Event *event = static_cast<Event *>(incidence); | ||
1516 | mContextMenu->showEventPopup(event); | ||
1517 | } else { | ||
1518 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | ||
1519 | } | ||
1520 | */ | ||
1504 | } | 1521 | } |
1505 | MonthViewCell * KOMonthView::selectedCell( ) | 1522 | MonthViewCell * KOMonthView::selectedCell( ) |
1506 | { | 1523 | { |
1507 | return mSelectedCell; | 1524 | return mSelectedCell; |
1508 | } | 1525 | } |
1509 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1526 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1510 | { | 1527 | { |
1528 | // qDebug("KOMonthView::setSelectedCell "); | ||
1511 | if ( mSelectedCell && mSelectedCell != cell ) { | 1529 | if ( mSelectedCell && mSelectedCell != cell ) { |
1512 | MonthViewCell * mvc = mSelectedCell; | 1530 | MonthViewCell * mvc = mSelectedCell; |
1513 | mSelectedCell = cell; | 1531 | mSelectedCell = cell; |
1514 | mvc->deselect(); | 1532 | mvc->deselect(); |
1515 | } else | 1533 | } else |
1516 | mSelectedCell = cell; | 1534 | mSelectedCell = cell; |
1535 | // if ( mSelectedCell ) | ||
1536 | // mSelectedCell->select(); | ||
1517 | if ( !mSelectedCell ) | 1537 | if ( !mSelectedCell ) |
1518 | emit incidenceSelected( 0 ); | 1538 | emit incidenceSelected( 0 ); |
1519 | else | 1539 | else |
1520 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1540 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1521 | } | 1541 | } |
1522 | 1542 | ||
1523 | void KOMonthView::processSelectionChange() | 1543 | void KOMonthView::processSelectionChange() |
1524 | { | 1544 | { |
1525 | QPtrList<Incidence> incidences = selectedIncidences(); | 1545 | QPtrList<Incidence> incidences = selectedIncidences(); |
1526 | if (incidences.count() > 0) { | 1546 | if (incidences.count() > 0) { |
1527 | emit incidenceSelected( incidences.first() ); | 1547 | emit incidenceSelected( incidences.first() ); |
1528 | } else { | 1548 | } else { |
1529 | emit incidenceSelected( 0 ); | 1549 | emit incidenceSelected( 0 ); |
1530 | } | 1550 | } |
1531 | } | 1551 | } |
1532 | 1552 | ||
1533 | void KOMonthView::clearSelection() | 1553 | void KOMonthView::clearSelection() |
1534 | { | 1554 | { |
1535 | if ( mSelectedCell ) { | 1555 | if ( mSelectedCell ) { |
1536 | mSelectedCell->deselect(); | 1556 | mSelectedCell->deselect(); |
1537 | mSelectedCell = 0; | 1557 | mSelectedCell = 0; |
1538 | } | 1558 | } |
1539 | } | 1559 | } |
1540 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1560 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 9dbe319..a29a1a8 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -133,49 +133,48 @@ class MonthViewCell : public QWidget | |||
133 | void setDate( const QDate & ); | 133 | void setDate( const QDate & ); |
134 | QDate date() const; | 134 | QDate date() const; |
135 | 135 | ||
136 | void setPrimary( bool ); | 136 | void setPrimary( bool ); |
137 | bool isPrimary() const; | 137 | bool isPrimary() const; |
138 | 138 | ||
139 | void setHoliday( bool ); | 139 | void setHoliday( bool ); |
140 | void setHoliday( const QString & ); | 140 | void setHoliday( const QString & ); |
141 | 141 | ||
142 | void updateCell(); | 142 | void updateCell(); |
143 | void startUpdateCell(); | 143 | void startUpdateCell(); |
144 | void finishUpdateCell(); | 144 | void finishUpdateCell(); |
145 | void insertEvent(Event *); | 145 | void insertEvent(Event *); |
146 | void insertTodo(Todo *); | 146 | void insertTodo(Todo *); |
147 | 147 | ||
148 | void updateConfig( bool bigFont = false ); | 148 | void updateConfig( bool bigFont = false ); |
149 | 149 | ||
150 | void enableScrollBars( bool ); | 150 | void enableScrollBars( bool ); |
151 | 151 | ||
152 | Incidence *selectedIncidence(); | 152 | Incidence *selectedIncidence(); |
153 | QDate selectedIncidenceDate(); | 153 | QDate selectedIncidenceDate(); |
154 | 154 | ||
155 | void deselect(); | 155 | void deselect(); |
156 | void select(); | 156 | void select(); |
157 | void clear(); | ||
158 | 157 | ||
159 | #ifdef DESKTOP_VERSION | 158 | #ifdef DESKTOP_VERSION |
160 | static QToolTipGroup *toolTipGroup(); | 159 | static QToolTipGroup *toolTipGroup(); |
161 | #endif | 160 | #endif |
162 | signals: | 161 | signals: |
163 | void defaultAction( Incidence * ); | 162 | void defaultAction( Incidence * ); |
164 | void newEventSignal( QDateTime ); | 163 | void newEventSignal( QDateTime ); |
165 | void showDaySignal( QDate ); | 164 | void showDaySignal( QDate ); |
166 | 165 | ||
167 | protected: | 166 | protected: |
168 | QString mToolTip; | 167 | QString mToolTip; |
169 | void resizeEvent( QResizeEvent * ); | 168 | void resizeEvent( QResizeEvent * ); |
170 | 169 | ||
171 | protected slots: | 170 | protected slots: |
172 | void defaultAction( QListBoxItem * ); | 171 | void defaultAction( QListBoxItem * ); |
173 | void contextMenu( QListBoxItem * ); | 172 | void contextMenu( QListBoxItem * ); |
174 | void selection( QListBoxItem * ); | 173 | void selection( QListBoxItem * ); |
175 | void cellClicked( QListBoxItem * ); | 174 | void cellClicked( QListBoxItem * ); |
176 | void newEvent(); | 175 | void newEvent(); |
177 | void showDay(); | 176 | void showDay(); |
178 | 177 | ||
179 | private: | 178 | private: |
180 | KOMonthView *mMonthView; | 179 | KOMonthView *mMonthView; |
181 | 180 | ||
@@ -205,93 +204,92 @@ class MonthViewCell : public QWidget | |||
205 | 204 | ||
206 | class KOMonthView: public KOEventView | 205 | class KOMonthView: public KOEventView |
207 | { | 206 | { |
208 | Q_OBJECT | 207 | Q_OBJECT |
209 | public: | 208 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 209 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 210 | ~KOMonthView(); |
212 | 211 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 212 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 213 | virtual int maxDatesHint(); |
215 | 214 | ||
216 | /** Returns number of currently shown dates. */ | 215 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 216 | virtual int currentDateCount(); |
218 | 217 | ||
219 | /** returns the currently selected events */ | 218 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 219 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 220 | ||
222 | /** returns dates of the currently selected events */ | 221 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 222 | virtual DateList selectedDates(); |
224 | 223 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 224 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 225 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 226 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 227 | bool isUpdatePossible() { return updatePossible; } |
229 | void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} | ||
230 | 228 | ||
231 | MonthViewCell * selectedCell(); | 229 | MonthViewCell * selectedCell(); |
230 | bool skipResize; | ||
232 | public slots: | 231 | public slots: |
233 | virtual void updateView(); | 232 | virtual void updateView(); |
234 | virtual void updateConfig(); | 233 | virtual void updateConfig(); |
235 | virtual void showDates(const QDate &start, const QDate &end); | 234 | virtual void showDates(const QDate &start, const QDate &end); |
236 | virtual void showEvents(QPtrList<Event> eventList); | 235 | virtual void showEvents(QPtrList<Event> eventList); |
237 | 236 | ||
238 | void changeEventDisplay(Event *, int); | 237 | void changeEventDisplay(Event *, int); |
239 | 238 | ||
240 | void clearSelection(); | 239 | void clearSelection(); |
241 | 240 | ||
242 | void showContextMenu( Incidence * ); | 241 | void showContextMenu( Incidence * ); |
243 | 242 | ||
244 | void setSelectedCell( MonthViewCell * ); | 243 | void setSelectedCell( MonthViewCell * ); |
245 | 244 | ||
246 | protected slots: | 245 | protected slots: |
247 | void selectInternalWeekNum ( int ); | 246 | void selectInternalWeekNum ( int ); |
248 | void switchView(); | 247 | void switchView(); |
249 | void processSelectionChange(); | 248 | void processSelectionChange(); |
250 | signals: | 249 | signals: |
251 | void nextMonth(); | 250 | void nextMonth(); |
252 | void prevMonth(); | 251 | void prevMonth(); |
253 | void showNavigator( bool ); | 252 | void showNavigator( bool ); |
254 | void selectWeekNum ( int ); | 253 | void selectWeekNum ( int ); |
255 | void showDaySignal( QDate ); | 254 | void showDaySignal( QDate ); |
256 | protected: | 255 | protected: |
257 | void resizeEvent(QResizeEvent *); | 256 | void resizeEvent(QResizeEvent *); |
258 | void viewChanged(); | 257 | void viewChanged(); |
259 | void updateDayLabels(); | 258 | void updateDayLabels(); |
260 | 259 | ||
261 | private: | 260 | private: |
262 | int ignoreResizeEvent; | ||
263 | int currentWeek(); | 261 | int currentWeek(); |
264 | bool clPending; | 262 | bool clPending; |
265 | QWidgetStack * mWidStack; | 263 | QWidgetStack * mWidStack; |
266 | QWidget* mMonthView; | 264 | QWidget* mMonthView; |
267 | QWidget* mWeekView; | 265 | QWidget* mWeekView; |
268 | bool mShowWeekView; | 266 | bool mShowWeekView; |
269 | bool updatePossible; | 267 | bool updatePossible; |
270 | int mDaysPerWeek; | 268 | int mDaysPerWeek; |
271 | int mNumWeeks; | 269 | int mNumWeeks; |
272 | int mNumCells; | 270 | int mNumCells; |
273 | bool mWeekStartsMonday; | 271 | bool mWeekStartsMonday; |
272 | bool mShowSatSunComp; | ||
274 | void computeLayout(); | 273 | void computeLayout(); |
275 | void computeLayoutWeek(); | 274 | void computeLayoutWeek(); |
276 | 275 | ||
277 | QPtrVector<MonthViewCell> mCells; | 276 | QPtrVector<MonthViewCell> mCells; |
278 | QPtrVector<QLabel> mDayLabels; | 277 | QPtrVector<QLabel> mDayLabels; |
279 | QPtrVector<KOWeekButton> mWeekLabels; | 278 | QPtrVector<KOWeekButton> mWeekLabels; |
280 | QPtrVector<MonthViewCell> mCellsW; | 279 | QPtrVector<MonthViewCell> mCellsW; |
281 | QPtrVector<QLabel> mDayLabelsW; | 280 | QPtrVector<QLabel> mDayLabelsW; |
282 | QPtrVector<KOWeekButton> mWeekLabelsW; | 281 | QPtrVector<KOWeekButton> mWeekLabelsW; |
283 | 282 | ||
284 | bool mShortDayLabelsM; | 283 | bool mShortDayLabels; |
285 | bool mShortDayLabelsW; | ||
286 | int mWidthLongDayLabel; | 284 | int mWidthLongDayLabel; |
287 | 285 | ||
288 | QDate mStartDate; | 286 | QDate mStartDate; |
289 | 287 | ||
290 | MonthViewCell *mSelectedCell; | 288 | MonthViewCell *mSelectedCell; |
291 | 289 | ||
292 | KOEventPopupMenu *mContextMenu; | 290 | KOEventPopupMenu *mContextMenu; |
293 | void keyPressEvent ( QKeyEvent * ) ; | 291 | void keyPressEvent ( QKeyEvent * ) ; |
294 | 292 | ||
295 | }; | 293 | }; |
296 | 294 | ||
297 | #endif | 295 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 62d3e7f..ba15f7f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -180,49 +180,49 @@ void KOViewManager::writeSettings(KConfig *config) | |||
180 | mListView->writeSettings(config); | 180 | mListView->writeSettings(config); |
181 | } | 181 | } |
182 | if (mTodoView) { | 182 | if (mTodoView) { |
183 | mTodoView->saveLayout(config,"Todo View"); | 183 | mTodoView->saveLayout(config,"Todo View"); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
188 | { | 188 | { |
189 | 189 | ||
190 | //mFlagShowNextxDays = false; | 190 | //mFlagShowNextxDays = false; |
191 | //if(view == mCurrentView) return; | 191 | //if(view == mCurrentView) return; |
192 | if ( view == 0 ) { | 192 | if ( view == 0 ) { |
193 | view = mCurrentView; | 193 | view = mCurrentView; |
194 | if ( view == 0 ) | 194 | if ( view == 0 ) |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | bool full = fullScreen; | 197 | bool full = fullScreen; |
198 | if(view == mCurrentView && view != mWhatsNextView ) { | 198 | if(view == mCurrentView && view != mWhatsNextView ) { |
199 | if ( mCurrentAgendaView < 0 ) | 199 | if ( mCurrentAgendaView < 0 ) |
200 | return; | 200 | return; |
201 | full = mMainView->leftFrame()->isVisible(); | 201 | full = mMainView->leftFrame()->isVisible(); |
202 | } else { | 202 | } else { |
203 | if ( view == mMonthView && mMonthView) | 203 | if ( view == mMonthView && mMonthView) |
204 | mMonthView->setIgnoreResizeEvent( 1 ); | 204 | mMonthView->skipResize = true ; |
205 | mCurrentView = view; | 205 | mCurrentView = view; |
206 | // bool full = fullScreen; | 206 | // bool full = fullScreen; |
207 | bool isFull = !mMainView->leftFrame()->isVisible(); | 207 | bool isFull = !mMainView->leftFrame()->isVisible(); |
208 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 208 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
209 | full = true; | 209 | full = true; |
210 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 210 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
211 | full = false; | 211 | full = false; |
212 | } | 212 | } |
213 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 213 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
214 | //raiseCurrentView( full ); | 214 | //raiseCurrentView( full ); |
215 | mMainView->processIncidenceSelection( 0 ); | 215 | mMainView->processIncidenceSelection( 0 ); |
216 | //mMainView->updateView(); | 216 | //mMainView->updateView(); |
217 | raiseCurrentView( full, true ); | 217 | raiseCurrentView( full, true ); |
218 | mMainView->adaptNavigationUnits(); | 218 | mMainView->adaptNavigationUnits(); |
219 | } | 219 | } |
220 | 220 | ||
221 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 221 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
222 | { | 222 | { |
223 | mCurrentAgendaView = 0; | 223 | mCurrentAgendaView = 0; |
224 | int wid = mMainView->width() ; | 224 | int wid = mMainView->width() ; |
225 | int hei = mMainView->height(); | 225 | int hei = mMainView->height(); |
226 | if ( mCurrentView == mMonthView ) { | 226 | if ( mCurrentView == mMonthView ) { |
227 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { | 227 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
228 | mMainView->navigatorBar()->show(); | 228 | mMainView->navigatorBar()->show(); |