summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp5
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/komonthview.cpp163
-rw-r--r--korganizer/komonthview.h4
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koviewmanager.cpp16
7 files changed, 174 insertions, 17 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cca73f2..be78057 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3833,48 +3833,53 @@ void CalendarView::purgeCompleted()
3833 bool childDelete = false; 3833 bool childDelete = false;
3834 bool deletedOne = true; 3834 bool deletedOne = true;
3835 todoCal = calendar()->todos(); 3835 todoCal = calendar()->todos();
3836 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3836 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3837 if ( !aTodo->relatedTo() ) 3837 if ( !aTodo->relatedTo() )
3838 rootTodos.append( aTodo ); 3838 rootTodos.append( aTodo );
3839 } 3839 }
3840 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3840 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3841 removeCompletedSubTodos( aTodo ); 3841 removeCompletedSubTodos( aTodo );
3842 } 3842 }
3843 3843
3844 updateView(); 3844 updateView();
3845 } 3845 }
3846} 3846}
3847 3847
3848void CalendarView::slotCalendarChanged() 3848void CalendarView::slotCalendarChanged()
3849{ 3849{
3850 ; 3850 ;
3851} 3851}
3852 3852
3853NavigatorBar *CalendarView::navigatorBar() 3853NavigatorBar *CalendarView::navigatorBar()
3854{ 3854{
3855 return mNavigatorBar; 3855 return mNavigatorBar;
3856} 3856}
3857void CalendarView::showNavigatorBar( bool b)
3858{
3859 if ( b ) mNavigatorBar->show();
3860 else mNavigatorBar->hide();
3861}
3857 3862
3858 3863
3859 3864
3860void CalendarView::keyPressEvent ( QKeyEvent *e) 3865void CalendarView::keyPressEvent ( QKeyEvent *e)
3861{ 3866{
3862 //qDebug(" alendarView::keyPressEvent "); 3867 //qDebug(" alendarView::keyPressEvent ");
3863 e->ignore(); 3868 e->ignore();
3864} 3869}
3865 3870
3866 3871
3867bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3872bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3868{ 3873{
3869 // mSyncManager = manager; 3874 // mSyncManager = manager;
3870 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3875 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3871 qDebug("KO: SyncKDE request detected!"); 3876 qDebug("KO: SyncKDE request detected!");
3872 } 3877 }
3873 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3878 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3874 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3879 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3875 return syncCalendar( filename, mode ); 3880 return syncCalendar( filename, mode );
3876} 3881}
3877bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3882bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3878{ 3883{
3879 //mSyncManager = manager; 3884 //mSyncManager = manager;
3880 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3885 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 7c59a8d..6ea8287 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -153,48 +153,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
153 void incidenceSelected( Incidence * ); 153 void incidenceSelected( Incidence * );
154 /** Emitted, when a todoitem is selected or deselected. */ 154 /** Emitted, when a todoitem is selected or deselected. */
155 void todoSelected( bool ); 155 void todoSelected( bool );
156 156
157 /** 157 /**
158 Emitted, when clipboard content changes. Parameter indicates if paste 158 Emitted, when clipboard content changes. Parameter indicates if paste
159 is possible or not. 159 is possible or not.
160 */ 160 */
161 void pasteEnabled(bool); 161 void pasteEnabled(bool);
162 162
163 /** Emitted, when the number of incoming messages has changed. */ 163 /** Emitted, when the number of incoming messages has changed. */
164 void numIncomingChanged(int); 164 void numIncomingChanged(int);
165 165
166 /** Emitted, when the number of outgoing messages has changed. */ 166 /** Emitted, when the number of outgoing messages has changed. */
167 void numOutgoingChanged(int); 167 void numOutgoingChanged(int);
168 168
169 /** Send status message, which can e.g. be displayed in the status bar. */ 169 /** Send status message, which can e.g. be displayed in the status bar. */
170 void statusMessage(const QString &); 170 void statusMessage(const QString &);
171 171
172 void calendarViewExpanded( bool ); 172 void calendarViewExpanded( bool );
173 void updateSearchDialog(); 173 void updateSearchDialog();
174 174
175 175
176 public slots: 176 public slots:
177 void showNavigatorBar(bool);
177 void showOpenError(); 178 void showOpenError();
178 void watchSavedFile(); 179 void watchSavedFile();
179 void recheckTimerAlarm(); 180 void recheckTimerAlarm();
180 void checkNextTimerAlarm(); 181 void checkNextTimerAlarm();
181 void addAlarm(const QDateTime &qdt, const QString &noti ); 182 void addAlarm(const QDateTime &qdt, const QString &noti );
182 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 183 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
183 void removeAlarm(const QDateTime &qdt, const QString &noti ); 184 void removeAlarm(const QDateTime &qdt, const QString &noti );
184 185
185 /** options dialog made a changed to the configuration. we catch this 186 /** options dialog made a changed to the configuration. we catch this
186 * and notify all widgets which need to update their configuration. */ 187 * and notify all widgets which need to update their configuration. */
187 void updateConfig(); 188 void updateConfig();
188 189
189 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 190 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
190 const QStringList& anniversaryList, const QStringList& realNameList, 191 const QStringList& anniversaryList, const QStringList& realNameList,
191 const QStringList& emailList, const QStringList& assembledNameList, 192 const QStringList& emailList, const QStringList& assembledNameList,
192 const QStringList& uidList); 193 const QStringList& uidList);
193 194
194 /** 195 /**
195 Load calendar from file \a filename. If \a merge is true, load 196 Load calendar from file \a filename. If \a merge is true, load
196 calendar into existing one, if it is false, clear calendar, before 197 calendar into existing one, if it is false, clear calendar, before
197 loading. Return true, if calendar could be successfully loaded. 198 loading. Return true, if calendar could be successfully loaded.
198 */ 199 */
199 bool openCalendar(QString filename, bool merge=false); 200 bool openCalendar(QString filename, bool merge=false);
200 bool syncCalendar(QString filename,int mode = 0 ); 201 bool syncCalendar(QString filename,int mode = 0 );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 6411156..9888566 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -444,48 +444,55 @@ void MonthViewCell::insertEvent(Event *event)
444 event->categories().contains(i18n("Holiday"))) { 444 event->categories().contains(i18n("Holiday"))) {
445 setHoliday( true ); 445 setHoliday( true );
446 if ( mDate.dayOfWeek() == 7 ) 446 if ( mDate.dayOfWeek() == 7 )
447 mItemList->setLineWidth( 3 ); 447 mItemList->setLineWidth( 3 );
448 } 448 }
449 QString text; 449 QString text;
450 if (event->isMultiDay()) { 450 if (event->isMultiDay()) {
451 QString prefix = "<->"; 451 QString prefix = "<->";
452 if ( event->doesRecur() ) { 452 if ( event->doesRecur() ) {
453 if ( event->recursOn( mDate) ) 453 if ( event->recursOn( mDate) )
454 prefix ="->" ; 454 prefix ="->" ;
455 else { 455 else {
456 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 456 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
457 if ( event->recursOn( mDate.addDays( -days)) ) 457 if ( event->recursOn( mDate.addDays( -days)) )
458 prefix ="<-" ; 458 prefix ="<-" ;
459 } 459 }
460 460
461 } else { 461 } else {
462 if (mDate == event->dtStart().date()) { 462 if (mDate == event->dtStart().date()) {
463 prefix ="->" ; 463 prefix ="->" ;
464 } else if (mDate == event->dtEnd().date()) { 464 } else if (mDate == event->dtEnd().date()) {
465 prefix ="<-" ; 465 prefix ="<-" ;
466 } 466 }
467 } 467 }
468 if ( !event->doesFloat() ) {
469 if ( mDate == event->dtStart().date () )
470 prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" ";
471 else if ( mDate == event->dtEnd().date () )
472 prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
473
474 }
468 text = prefix + event->summary(); 475 text = prefix + event->summary();
469 mToolTip += text; 476 mToolTip += text;
470 } else { 477 } else {
471 if (event->doesFloat()) { 478 if (event->doesFloat()) {
472 text = event->summary(); 479 text = event->summary();
473 mToolTip += text; 480 mToolTip += text;
474 } 481 }
475 else { 482 else {
476 text = KGlobal::locale()->formatTime(event->dtStart().time()); 483 text = KGlobal::locale()->formatTime(event->dtStart().time());
477 text += " " + event->summary(); 484 text += " " + event->summary();
478 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 485 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
479 } 486 }
480 } 487 }
481 488
482 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 489 MonthViewItem *item = new MonthViewItem( event, mDate, text );
483 QPalette pal; 490 QPalette pal;
484 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 491 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
485 QStringList categories = event->categories(); 492 QStringList categories = event->categories();
486 QString cat = categories.first(); 493 QString cat = categories.first();
487 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 494 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
488 pal = getPalette(); 495 pal = getPalette();
489 if (cat.isEmpty()) { 496 if (cat.isEmpty()) {
490 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 497 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
491 } else { 498 } else {
@@ -546,54 +553,54 @@ void MonthViewCell::insertTodo(Todo *todo)
546 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 553 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
547 } 554 }
548 555
549 } else { 556 } else {
550 if (cat.isEmpty()) { 557 if (cat.isEmpty()) {
551 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 558 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
552 } else { 559 } else {
553 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 560 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
554 } 561 }
555 } 562 }
556 563
557 } else { 564 } else {
558 pal = mStandardPalette ; 565 pal = mStandardPalette ;
559 } 566 }
560 item->setPalette( pal ); 567 item->setPalette( pal );
561 mItemList->insertItem( item ); 568 mItemList->insertItem( item );
562 mToolTip += text+"\n"; 569 mToolTip += text+"\n";
563} 570}
564void MonthViewCell::finishUpdateCell() 571void MonthViewCell::finishUpdateCell()
565{ 572{
566#ifdef DESKTOP_VERSION 573#ifdef DESKTOP_VERSION
567 if (mToolTip != "") 574 if (mToolTip != "")
568 QToolTip::add(this,mToolTip,toolTipGroup(),""); 575 QToolTip::add(this,mToolTip,toolTipGroup(),"");
569#endif 576#endif
570 577 mItemList->sort();
571 //setMyPalette(); 578 //setMyPalette();
572 setMyPalette(); 579 setMyPalette();
573 QString text; 580 QString text;
574 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 581 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
575 if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 582 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
576 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 583 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
577 mLabel->resize( mLabelBigSize ); 584 mLabel->resize( mLabelBigSize );
578 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 585 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
579 } else { 586 } else {
580 mLabel->resize( mLabelSize ); 587 mLabel->resize( mLabelSize );
581 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 588 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
582 } 589 }
583 590
584 mLabel->setText( text ); 591 mLabel->setText( text );
585 resizeEvent( 0 ); 592 resizeEvent( 0 );
586} 593}
587void MonthViewCell::updateCell() 594void MonthViewCell::updateCell()
588{ 595{
589 if ( !mMonthView->isUpdatePossible() ) 596 if ( !mMonthView->isUpdatePossible() )
590 return; 597 return;
591 startUpdateCell(); 598 startUpdateCell();
592 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 599 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
593 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 600 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
594 Event *event; 601 Event *event;
595 for( event = events.first(); event; event = events.next() ) { // for event 602 for( event = events.first(); event; event = events.next() ) { // for event
596 insertEvent(event); 603 insertEvent(event);
597 } 604 }
598 // insert due todos 605 // insert due todos
599 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 606 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
@@ -667,124 +674,127 @@ QDate MonthViewCell::selectedIncidenceDate()
667 674
668 return item->incidenceDate(); 675 return item->incidenceDate();
669} 676}
670 677
671void MonthViewCell::deselect() 678void MonthViewCell::deselect()
672{ 679{
673 mItemList->clearSelection(); 680 mItemList->clearSelection();
674 enableScrollBars( false ); 681 enableScrollBars( false );
675 // updateCell(); 682 // updateCell();
676} 683}
677void MonthViewCell::select() 684void MonthViewCell::select()
678{ 685{
679 ;// updateCell(); 686 ;// updateCell();
680} 687}
681 688
682void MonthViewCell::resizeEvent ( QResizeEvent * ) 689void MonthViewCell::resizeEvent ( QResizeEvent * )
683{ 690{
684 if ( !mMonthView->isUpdatePossible() ) 691 if ( !mMonthView->isUpdatePossible() )
685 return; 692 return;
686#ifndef DESKTOP_VERSION 693#ifndef DESKTOP_VERSION
687 if ( !isVisible() ){ 694 if ( !isVisible() ){
688 return; 695 return;
689 } 696 }
690#endif 697#endif
691 int size = height() - mLabel->height(); 698 int size = height() - mLabel->height() - 2;
692 if ( size > 0 ) 699 if ( size > 0 )
693 mItemList->verticalScrollBar()->setMaximumHeight( size ); 700 mItemList->verticalScrollBar()->setMaximumHeight( size );
694 size = width() - mLabel->width(); 701 size = width() - mLabel->width() -2;
695 if ( size > 0 ) 702 if ( size > 0 )
696 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 703 mItemList->horizontalScrollBar()->setMaximumWidth( size );
697 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 704 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
698 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 705 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
699} 706}
700 707
701void MonthViewCell::defaultAction( QListBoxItem *item ) 708void MonthViewCell::defaultAction( QListBoxItem *item )
702{ 709{
703 if ( !item ) return; 710 if ( !item ) return;
704 711
705 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 712 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
706 Incidence *incidence = eventItem->incidence(); 713 Incidence *incidence = eventItem->incidence();
707 if ( incidence ) mMonthView->defaultAction( incidence ); 714 if ( incidence ) mMonthView->defaultAction( incidence );
708} 715}
709void MonthViewCell::showDay() 716void MonthViewCell::showDay()
710{ 717{
711 emit showDaySignal( date() ); 718 emit showDaySignal( date() );
712} 719}
713void MonthViewCell::newEvent() 720void MonthViewCell::newEvent()
714{ 721{
715 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 722 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
716 emit newEventSignal( dt ); 723 emit newEventSignal( dt );
717} 724}
718void MonthViewCell::cellClicked( QListBoxItem *item ) 725void MonthViewCell::cellClicked( QListBoxItem *item )
719{ 726{
720 static QListBoxItem * lastClicked = 0; 727 static QListBoxItem * lastClicked = 0;
721 if ( item == 0 ) { 728 if ( item == 0 ) {
722 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 729 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
723 emit newEventSignal( dt ); 730 emit newEventSignal( dt );
724 return; 731 return;
725 } 732 }
726 /* 733 /*
727 if ( lastClicked ) 734 if ( lastClicked )
728 if ( ! item ) { 735 if ( ! item ) {
729 if ( lastClicked->listBox() != item->listBox() ) 736 if ( lastClicked->listBox() != item->listBox() )
730 lastClicked->listBox()->clearSelection(); 737 lastClicked->listBox()->clearSelection();
731 } 738 }
732 */ 739 */
733 740
734 mMonthView->setSelectedCell( this ); 741 mMonthView->setSelectedCell( this );
735 if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); 742 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
736 select(); 743 select();
737} 744}
738 745
739void MonthViewCell::contextMenu( QListBoxItem *item ) 746void MonthViewCell::contextMenu( QListBoxItem *item )
740{ 747{
741 if ( !item ) return; 748 if ( !item ) return;
742 749
743 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 750 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
744 Incidence *incidence = eventItem->incidence(); 751 Incidence *incidence = eventItem->incidence();
745 if ( incidence ) mMonthView->showContextMenu( incidence ); 752 if ( incidence ) mMonthView->showContextMenu( incidence );
746} 753}
747 754
748void MonthViewCell::selection( QListBoxItem *item ) 755void MonthViewCell::selection( QListBoxItem *item )
749{ 756{
750 if ( !item ) return; 757 if ( !item ) return;
751 758
752 mMonthView->setSelectedCell( this ); 759 mMonthView->setSelectedCell( this );
753} 760}
754 761
755 762
756// ******************************************************************************* 763// *******************************************************************************
757// ******************************************************************************* 764// *******************************************************************************
758// ******************************************************************************* 765// *******************************************************************************
759 766
760 767
761KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 768KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
762 : KOEventView( calendar, parent, name ), 769 : KOEventView( calendar, parent, name ),
763 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 770 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
764 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 771 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
765{ 772{
766 773 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
774 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
775 if ( mShowWeekView )
776 mWeekStartsMonday = true;
767 updatePossible = false; 777 updatePossible = false;
768 mCells.setAutoDelete( true ); 778 mCells.setAutoDelete( true );
769 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 779 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
770 // mDayLayout = new QGridLayout( this ); 780 // mDayLayout = new QGridLayout( this );
771 // create the day of the week labels (Sun, Mon, etc) and add them to 781 // create the day of the week labels (Sun, Mon, etc) and add them to
772 // the layout. 782 // the layout.
773 mDayLabels.resize( mDaysPerWeek ); 783 mDayLabels.resize( mDaysPerWeek );
774 QFont bfont = font(); 784 QFont bfont = font();
775 if ( QApplication::desktop()->width() < 650 ) { 785 if ( QApplication::desktop()->width() < 650 ) {
776 bfont.setPointSize( bfont.pointSize() - 2 ); 786 bfont.setPointSize( bfont.pointSize() - 2 );
777 } 787 }
778 bfont.setBold( true ); 788 bfont.setBold( true );
779 int i; 789 int i;
780 790
781 for( i = 0; i < mDaysPerWeek; i++ ) { 791 for( i = 0; i < mDaysPerWeek; i++ ) {
782 QLabel *label = new QLabel( this ); 792 QLabel *label = new QLabel( this );
783 label->setFont(bfont); 793 label->setFont(bfont);
784 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 794 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
785 label->setLineWidth(1); 795 label->setLineWidth(1);
786 label->setAlignment(AlignCenter); 796 label->setAlignment(AlignCenter);
787 mDayLabels.insert( i, label ); 797 mDayLabels.insert( i, label );
788 } 798 }
789 799
790 bfont.setBold( false ); 800 bfont.setBold( false );
@@ -796,106 +806,118 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
796 label->setFlat(true); 806 label->setFlat(true);
797 QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); 807 QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view"));
798 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 808 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
799 //label->setLineWidth(1); 809 //label->setLineWidth(1);
800 //label->setAlignment(AlignCenter); 810 //label->setAlignment(AlignCenter);
801 mWeekLabels.insert( i, label ); 811 mWeekLabels.insert( i, label );
802 } 812 }
803 mWeekLabels[mNumWeeks]->setText( i18n("W")); 813 mWeekLabels[mNumWeeks]->setText( i18n("W"));
804 int row, col; 814 int row, col;
805 mCells.resize( mNumCells ); 815 mCells.resize( mNumCells );
806 for( row = 0; row < mNumWeeks; ++row ) { 816 for( row = 0; row < mNumWeeks; ++row ) {
807 for( col = 0; col < mDaysPerWeek; ++col ) { 817 for( col = 0; col < mDaysPerWeek; ++col ) {
808 MonthViewCell *cell = new MonthViewCell( this ); 818 MonthViewCell *cell = new MonthViewCell( this );
809 mCells.insert( row * mDaysPerWeek + col, cell ); 819 mCells.insert( row * mDaysPerWeek + col, cell );
810 820
811 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 821 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
812 SLOT( defaultAction( Incidence * ) ) ); 822 SLOT( defaultAction( Incidence * ) ) );
813 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 823 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
814 SIGNAL( newEventSignal( QDateTime ) ) ); 824 SIGNAL( newEventSignal( QDateTime ) ) );
815 connect( cell, SIGNAL( showDaySignal( QDate ) ), 825 connect( cell, SIGNAL( showDaySignal( QDate ) ),
816 SIGNAL( showDaySignal( QDate ) ) ); 826 SIGNAL( showDaySignal( QDate ) ) );
817 } 827 }
818 } 828 }
819 829
830 connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ),
831 SLOT( switchView() ) );
820 mContextMenu = eventPopup(); 832 mContextMenu = eventPopup();
821 // updateConfig(); //useless here 833 // updateConfig(); //useless here
822 834
823 emit incidenceSelected( 0 ); 835 emit incidenceSelected( 0 );
824} 836}
825 837
826KOMonthView::~KOMonthView() 838KOMonthView::~KOMonthView()
827{ 839{
828 delete mContextMenu; 840 delete mContextMenu;
829} 841}
842void KOMonthView::switchView()
843{
844 mShowWeekView = !mShowWeekView;
845 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
846 emit showNavigator( !mShowWeekView );
847 computeLayout();
848 updateConfig();
849}
830 850
831int KOMonthView::maxDatesHint() 851int KOMonthView::maxDatesHint()
832{ 852{
833 return mNumCells; 853 return mNumCells;
834} 854}
835 855
836int KOMonthView::currentDateCount() 856int KOMonthView::currentDateCount()
837{ 857{
838 return mNumCells; 858 return mNumCells;
839} 859}
840 860
841QPtrList<Incidence> KOMonthView::selectedIncidences() 861QPtrList<Incidence> KOMonthView::selectedIncidences()
842{ 862{
843 QPtrList<Incidence> selected; 863 QPtrList<Incidence> selected;
844 864
845 if ( mSelectedCell ) { 865 if ( mSelectedCell ) {
846 Incidence *incidence = mSelectedCell->selectedIncidence(); 866 Incidence *incidence = mSelectedCell->selectedIncidence();
847 if ( incidence ) selected.append( incidence ); 867 if ( incidence ) selected.append( incidence );
848 } 868 }
849 869
850 return selected; 870 return selected;
851} 871}
852 872
853DateList KOMonthView::selectedDates() 873DateList KOMonthView::selectedDates()
854{ 874{
855 DateList selected; 875 DateList selected;
856 876
857 if ( mSelectedCell ) { 877 if ( mSelectedCell ) {
858 QDate qd = mSelectedCell->selectedIncidenceDate(); 878 QDate qd = mSelectedCell->selectedIncidenceDate();
859 if ( qd.isValid() ) selected.append( qd ); 879 if ( qd.isValid() ) selected.append( qd );
860 } 880 }
861 881
862 return selected; 882 return selected;
863} 883}
864 884
865void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 885void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
866 const QDate &td) 886 const QDate &td)
867{ 887{
868#ifndef KORG_NOPRINTER 888#ifndef KORG_NOPRINTER
869 calPrinter->preview(CalPrinter::Month, fd, td); 889 calPrinter->preview(CalPrinter::Month, fd, td);
870#endif 890#endif
871} 891}
872 892
873void KOMonthView::updateConfig() 893void KOMonthView::updateConfig()
874{ 894{
875 895
876 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 896 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
877 897
898 if ( mShowWeekView )
899 mWeekStartsMonday = true;
878 QFontMetrics fontmetric(mDayLabels[0]->font()); 900 QFontMetrics fontmetric(mDayLabels[0]->font());
879 mWidthLongDayLabel = 0; 901 mWidthLongDayLabel = 0;
880 902
881 for (int i = 0; i < 7; i++) { 903 for (int i = 0; i < 7; i++) {
882 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 904 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
883 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 905 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
884 } 906 }
885 bool temp = mShowSatSunComp ; 907 bool temp = mShowSatSunComp ;
886 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 908 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
887 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 909 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
888 computeLayout(); 910 computeLayout();
889 updateDayLabels(); 911 updateDayLabels();
890 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 912 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
891 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 913 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
892 //resizeEvent( 0 ); 914 //resizeEvent( 0 );
893 for (uint i = 0; i < mCells.count(); ++i) { 915 for (uint i = 0; i < mCells.count(); ++i) {
894 mCells[i]->updateConfig(); 916 mCells[i]->updateConfig();
895 } 917 }
896#ifdef DESKTOP_VERSION 918#ifdef DESKTOP_VERSION
897 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 919 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
898#endif 920#endif
899 updateView(); 921 updateView();
900} 922}
901 923
@@ -959,57 +981,59 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
959 updateView(); 981 updateView();
960} 982}
961 983
962void KOMonthView::showEvents(QPtrList<Event>) 984void KOMonthView::showEvents(QPtrList<Event>)
963{ 985{
964 qDebug("KOMonthView::selectEvents is not implemented yet. "); 986 qDebug("KOMonthView::selectEvents is not implemented yet. ");
965} 987}
966 988
967void KOMonthView::changeEventDisplay(Event *, int) 989void KOMonthView::changeEventDisplay(Event *, int)
968{ 990{
969 // this should be re-written to be much more efficient, but this 991 // this should be re-written to be much more efficient, but this
970 // quick-and-dirty-hack gets the job done for right now. 992 // quick-and-dirty-hack gets the job done for right now.
971 updateView(); 993 updateView();
972} 994}
973 995
974void KOMonthView::updateView() 996void KOMonthView::updateView()
975{ 997{
976 998
977 if ( !updatePossible ) 999 if ( !updatePossible )
978 return; 1000 return;
979 //QTime ti; 1001 //QTime ti;
980 //ti.start(); 1002 //ti.start();
981#if 1 1003#if 1
982 int i; 1004 int i;
983 for( i = 0; i < mCells.count(); ++i ) { 1005 int timeSpan = mCells.size()-1;
1006 if ( KOPrefs::instance()->mMonthViewWeek )
1007 timeSpan = 6;
1008 for( i = 0; i < timeSpan + 1; ++i ) {
984 mCells[i]->startUpdateCell(); 1009 mCells[i]->startUpdateCell();
985 } 1010 }
986 1011
987 QPtrList<Event> events = calendar()->events(); 1012 QPtrList<Event> events = calendar()->events();
988 Event *event; 1013 Event *event;
989 QDateTime dt; 1014 QDateTime dt;
990 bool ok; 1015 bool ok;
991 int timeSpan = mCells.size()-1;
992 QDate endDate = mStartDate.addDays( timeSpan ); 1016 QDate endDate = mStartDate.addDays( timeSpan );
993 for( event = events.first(); event; event = events.next() ) { // for event 1017 for( event = events.first(); event; event = events.next() ) { // for event
994 if ( event->doesRecur() ) { 1018 if ( event->doesRecur() ) {
995 bool last; 1019 bool last;
996 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1020 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
997 QDateTime incidenceEnd; 1021 QDateTime incidenceEnd;
998 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1022 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
999 bool invalid = false; 1023 bool invalid = false;
1000 while( true ) { 1024 while( true ) {
1001 if ( incidenceStart.isValid() ) { 1025 if ( incidenceStart.isValid() ) {
1002 incidenceEnd = incidenceStart.addDays( eventlen ); 1026 incidenceEnd = incidenceStart.addDays( eventlen );
1003 int st = incidenceStart.date().daysTo( endDate ); 1027 int st = incidenceStart.date().daysTo( endDate );
1004 if ( st >= 0 ) { // start before timeend 1028 if ( st >= 0 ) { // start before timeend
1005 int end = mStartDate.daysTo( incidenceEnd.date() ); 1029 int end = mStartDate.daysTo( incidenceEnd.date() );
1006 if ( end >= 0 ) { // end after timestart --- got one! 1030 if ( end >= 0 ) { // end after timestart --- got one!
1007 //normalize 1031 //normalize
1008 st = timeSpan - st; 1032 st = timeSpan - st;
1009 if ( st < 0 ) st = 0; 1033 if ( st < 0 ) st = 0;
1010 if ( end > timeSpan ) end = timeSpan; 1034 if ( end > timeSpan ) end = timeSpan;
1011 int iii; 1035 int iii;
1012 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1036 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1013 for ( iii = st;iii<= end;++iii) 1037 for ( iii = st;iii<= end;++iii)
1014 mCells[iii]->insertEvent( event ); 1038 mCells[iii]->insertEvent( event );
1015 } 1039 }
@@ -1032,90 +1056,203 @@ void KOMonthView::updateView()
1032 } 1056 }
1033 } else { // no recur 1057 } else { // no recur
1034 int st = event->dtStart().date().daysTo( endDate ); 1058 int st = event->dtStart().date().daysTo( endDate );
1035 if ( st >= 0 ) { // start before timeend 1059 if ( st >= 0 ) { // start before timeend
1036 int end = mStartDate.daysTo( event->dtEnd().date() ); 1060 int end = mStartDate.daysTo( event->dtEnd().date() );
1037 if ( end >= 0 ) { // end after timestart --- got one! 1061 if ( end >= 0 ) { // end after timestart --- got one!
1038 //normalize 1062 //normalize
1039 st = timeSpan - st; 1063 st = timeSpan - st;
1040 if ( st < 0 ) st = 0; 1064 if ( st < 0 ) st = 0;
1041 if ( end > timeSpan ) end = timeSpan; 1065 if ( end > timeSpan ) end = timeSpan;
1042 int iii; 1066 int iii;
1043 for ( iii = st;iii<= end;++iii) 1067 for ( iii = st;iii<= end;++iii)
1044 mCells[iii]->insertEvent( event ); 1068 mCells[iii]->insertEvent( event );
1045 } 1069 }
1046 } 1070 }
1047 } 1071 }
1048 } 1072 }
1049 // insert due todos 1073 // insert due todos
1050 QPtrList<Todo> todos = calendar()->todos( ); 1074 QPtrList<Todo> todos = calendar()->todos( );
1051 Todo *todo; 1075 Todo *todo;
1052 for(todo = todos.first(); todo; todo = todos.next()) { 1076 for(todo = todos.first(); todo; todo = todos.next()) {
1053 //insertTodo( todo ); 1077 //insertTodo( todo );
1054 if ( todo->hasDueDate() ) { 1078 if ( todo->hasDueDate() ) {
1055 int day = mStartDate.daysTo( todo->dtDue().date() ); 1079 int day = mStartDate.daysTo( todo->dtDue().date() );
1056 if ( day >= 0 && day < mCells.size() ) { 1080 if ( day >= 0 && day < timeSpan + 1) {
1057 mCells[day]->insertTodo( todo ); 1081 mCells[day]->insertTodo( todo );
1058 } 1082 }
1059 } 1083 }
1060 } 1084 }
1061 1085
1062 for( i = 0; i < mCells.count(); ++i ) { 1086 for( i = 0; i < timeSpan+1; ++i ) {
1063 mCells[i]->finishUpdateCell(); 1087 mCells[i]->finishUpdateCell();
1064 } 1088 }
1065 processSelectionChange(); 1089 processSelectionChange();
1066 mCells[0]->setFocus(); 1090 mCells[0]->setFocus();
1067 1091
1068 1092
1069#else 1093#else
1070 // old code 1094 // old code
1071 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1095 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1072 int i; 1096 int i;
1073 for( i = 0; i < mCells.count(); ++i ) { 1097 for( i = 0; i < mCells.count(); ++i ) {
1074 mCells[i]->updateCell(); 1098 mCells[i]->updateCell();
1075 } 1099 }
1076 1100
1077 //qDebug("KOMonthView::updateView() "); 1101 //qDebug("KOMonthView::updateView() ");
1078 processSelectionChange(); 1102 processSelectionChange();
1079 // qDebug("---------------------------------------------------------------------+ "); 1103 // qDebug("---------------------------------------------------------------------+ ");
1080 mCells[0]->setFocus(); 1104 mCells[0]->setFocus();
1081#endif 1105#endif
1082 1106
1083 //qDebug("update time %d ", ti.elapsed()); 1107 //qDebug("update time %d ", ti.elapsed());
1084} 1108}
1085 1109
1086void KOMonthView::resizeEvent(QResizeEvent * e) 1110void KOMonthView::resizeEvent(QResizeEvent * e)
1087{ 1111{
1088 computeLayout(); 1112 computeLayout();
1089 mCells[0]->setFocus(); 1113 mCells[0]->setFocus();
1090} 1114}
1115void KOMonthView::computeLayoutWeek()
1116{
1117
1118 int daysToShow;
1119 bool combinedSatSun = false;
1120 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1121 daysToShow = 6;
1122 combinedSatSun = true;
1123 }
1124 int tWid = topLevelWidget()->size().width();
1125 int tHei = topLevelWidget()->size().height();
1126
1127 int wid = size().width();//e
1128 int hei = size().height()-1;
1129
1130 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1131 return;
1132
1133 if ( wid < hei )
1134 daysToShow = 2;
1135 else
1136 daysToShow = 3;
1137 mShowSatSunComp = true;
1138 combinedSatSun = true;
1139
1140 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
1141 QFontMetrics fm ( mWeekLabels[0]->font() );
1142 int weeklabelwid = fm.width( "888" );
1143 wid -= weeklabelwid;
1144
1145 int colWid = wid / daysToShow;
1146 int lastCol = wid - ( colWid*6 );
1147 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1148 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1149 int colModulo = wid % daysToShow;
1150 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1151 //qDebug("rowmod %d ", rowModulo);
1152 int i;
1153 int x,y,w,h;
1154 x= 0;
1155 y= 0;
1156 w = colWid;
1157 h = dayLabelHei ;
1158 for ( i = 0; i < 7; i++) {
1159 if ( i && !( i % daysToShow) && i < 6) {
1160 y += hei/(5-daysToShow);
1161 x = 0;
1162 }
1163 if ( i == daysToShow-colModulo )
1164 ++w;
1165 if ( i >= 5 ) {
1166 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1167 x -= w/2 ;
1168 }
1169 else
1170 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1171 x += w;
1172 }
1173 x= 0;
1174 y= dayLabelHei;
1175 w = colWid;
1176 h = cellHei;
1177 for ( i = 0; i < mCells.count(); ++i) {
1178 if ( i > 6 ) {
1179 mCells[i]->hide();
1180 continue;
1181 }
1182
1183 w = colWid;
1184 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1185 ++w;
1186 }
1187 if ( i == (daysToShow-1-rowModulo)*7)
1188 ++h;
1189
1190 if ( i >= 5 ) {
1191 if ( i ==5 ) {
1192 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1193 x -= w ;y += h/2;
1194 } else {
1195 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1196 y -= h/2;
1197 }
1198 } else
1199 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1200
1201
1202 x += w;
1203 if ( x + w/2 > wid ) {
1204 x = 0;
1205 y += h+dayLabelHei ;
1206 }
1207 }
1208 y= dayLabelHei;
1209 h = cellHei ;
1210 mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1211 for ( i = 1; i < 6; i++) {
1212 mWeekLabels[i]->hide();
1213 }
1214 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1215 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1216 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1217 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
1218 updateDayLabels();
1219 bool forceUpdate = !updatePossible;
1220 updatePossible = true;
1221 mWeekLabels[mNumWeeks]->setText( i18n("M"));
1222 if ( forceUpdate )
1223 updateView();
1224}
1091void KOMonthView::computeLayout() 1225void KOMonthView::computeLayout()
1092{ 1226{
1093 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 1227 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
1094 // note this only changes the text if the requested size crosses the 1228 // note this only changes the text if the requested size crosses the
1095 // threshold between big enough to support the full name and not big 1229 // threshold between big enough to support the full name and not big
1096 // enough. 1230 // enough.
1097 1231 if ( mShowWeekView ){
1232 computeLayoutWeek();
1233 return;
1234 }
1098 int daysToShow = 7; 1235 int daysToShow = 7;
1099 bool combinedSatSun = false; 1236 bool combinedSatSun = false;
1100 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1237 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1101 daysToShow = 6; 1238 daysToShow = 6;
1102 combinedSatSun = true; 1239 combinedSatSun = true;
1103 } 1240 }
1104 int tWid = topLevelWidget()->size().width(); 1241 int tWid = topLevelWidget()->size().width();
1105 int tHei = topLevelWidget()->size().height(); 1242 int tHei = topLevelWidget()->size().height();
1106 1243
1107 int wid = size().width();//e 1244 int wid = size().width();//e
1108 int hei = size().height()-1; 1245 int hei = size().height()-1;
1109 1246
1110 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1247 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1111 return; 1248 return;
1112 //qDebug("KOMonthView::computeLayout()------------------------------------ "); 1249 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
1113 QFontMetrics fm ( mWeekLabels[0]->font() ); 1250 QFontMetrics fm ( mWeekLabels[0]->font() );
1114 int weeklabelwid = fm.width( "888" ); 1251 int weeklabelwid = fm.width( "888" );
1115 wid -= weeklabelwid; 1252 wid -= weeklabelwid;
1116 1253
1117 int colWid = wid / daysToShow; 1254 int colWid = wid / daysToShow;
1118 int lastCol = wid - ( colWid*6 ); 1255 int lastCol = wid - ( colWid*6 );
1119 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1256 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1120 int cellHei = (hei - dayLabelHei) /6; 1257 int cellHei = (hei - dayLabelHei) /6;
1121 int colModulo = wid % daysToShow; 1258 int colModulo = wid % daysToShow;
@@ -1125,91 +1262,93 @@ void KOMonthView::computeLayout()
1125 int x,y,w,h; 1262 int x,y,w,h;
1126 x= 0; 1263 x= 0;
1127 y= 0; 1264 y= 0;
1128 w = colWid; 1265 w = colWid;
1129 h = dayLabelHei ; 1266 h = dayLabelHei ;
1130 for ( i = 0; i < 7; i++) { 1267 for ( i = 0; i < 7; i++) {
1131 if ( i == daysToShow-colModulo ) 1268 if ( i == daysToShow-colModulo )
1132 ++w; 1269 ++w;
1133 if ( combinedSatSun ) { 1270 if ( combinedSatSun ) {
1134 if ( i >= daysToShow-1 ) { 1271 if ( i >= daysToShow-1 ) {
1135 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1272 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1136 x -= w/2 ; 1273 x -= w/2 ;
1137 } 1274 }
1138 else 1275 else
1139 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1276 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1140 } else 1277 } else
1141 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1278 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1142 x += w; 1279 x += w;
1143 } 1280 }
1144 x= 0; 1281 x= 0;
1145 y= dayLabelHei; 1282 y= dayLabelHei;
1146 w = colWid; 1283 w = colWid;
1147 h = cellHei ; 1284 h = cellHei ;
1148 for ( i = 0; i < mCells.count(); ++i) { 1285 for ( i = 0; i < mCells.count(); ++i) {
1149 1286 mCells[i]->show();
1150 w = colWid; 1287 w = colWid;
1151 if ( ((i) % 7) >= 7-colModulo ) { 1288 if ( ((i) % 7) >= 7-colModulo ) {
1152 ++w; 1289 ++w;
1153 } 1290 }
1154 if ( i == (6-rowModulo)*7) 1291 if ( i == (6-rowModulo)*7)
1155 ++h; 1292 ++h;
1156 if ( combinedSatSun ) { 1293 if ( combinedSatSun ) {
1157 if ( (i)%7 >= daysToShow-1 ) { 1294 if ( (i)%7 >= daysToShow-1 ) {
1158 if ( (i)%7 == daysToShow-1 ) { 1295 if ( (i)%7 == daysToShow-1 ) {
1159 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1296 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1160 x -= w ;y += h/2; 1297 x -= w ;y += h/2;
1161 } else { 1298 } else {
1162 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1299 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1163 y -= h/2; 1300 y -= h/2;
1164 } 1301 }
1165 } else 1302 } else
1166 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1303 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1167 1304
1168 } 1305 }
1169 else 1306 else
1170 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1307 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1171 x += w; 1308 x += w;
1172 if ( x + w/2 > wid ) { 1309 if ( x + w/2 > wid ) {
1173 x = 0; 1310 x = 0;
1174 y += h; 1311 y += h;
1175 } 1312 }
1176 } 1313 }
1177 y= dayLabelHei; 1314 y= dayLabelHei;
1178 h = cellHei ; 1315 h = cellHei ;
1179 for ( i = 0; i < 6; i++) { 1316 for ( i = 0; i < 6; i++) {
1317 mWeekLabels[i]->show();
1180 if ( i == (6-rowModulo)) 1318 if ( i == (6-rowModulo))
1181 ++h; 1319 ++h;
1182 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1320 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1183 y += h; 1321 y += h;
1184 } 1322 }
1185 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1323 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1186 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1324 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1187 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1325 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1188 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; 1326 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
1189 updateDayLabels(); 1327 updateDayLabels();
1190 bool forceUpdate = !updatePossible; 1328 bool forceUpdate = !updatePossible;
1191 updatePossible = true; 1329 updatePossible = true;
1330 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1192 if ( forceUpdate ) 1331 if ( forceUpdate )
1193 updateView(); 1332 updateView();
1194} 1333}
1195 1334
1196void KOMonthView::showContextMenu( Incidence *incidence ) 1335void KOMonthView::showContextMenu( Incidence *incidence )
1197{ 1336{
1198 mContextMenu->showIncidencePopup(incidence); 1337 mContextMenu->showIncidencePopup(incidence);
1199 /* 1338 /*
1200 if( incidence && incidence->type() == "Event" ) { 1339 if( incidence && incidence->type() == "Event" ) {
1201 Event *event = static_cast<Event *>(incidence); 1340 Event *event = static_cast<Event *>(incidence);
1202 mContextMenu->showEventPopup(event); 1341 mContextMenu->showEventPopup(event);
1203 } else { 1342 } else {
1204 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1343 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1205 } 1344 }
1206 */ 1345 */
1207} 1346}
1208MonthViewCell * KOMonthView::selectedCell( ) 1347MonthViewCell * KOMonthView::selectedCell( )
1209{ 1348{
1210 return mSelectedCell; 1349 return mSelectedCell;
1211} 1350}
1212void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1351void KOMonthView::setSelectedCell( MonthViewCell *cell )
1213{ 1352{
1214 // qDebug("KOMonthView::setSelectedCell "); 1353 // qDebug("KOMonthView::setSelectedCell ");
1215 if ( mSelectedCell && mSelectedCell != cell ) { 1354 if ( mSelectedCell && mSelectedCell != cell ) {
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index b84065e..0bc3743 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -219,61 +219,65 @@ class KOMonthView: public KOEventView
219 /** returns dates of the currently selected events */ 219 /** returns dates of the currently selected events */
220 virtual DateList selectedDates(); 220 virtual DateList selectedDates();
221 221
222 virtual void printPreview(CalPrinter *calPrinter, 222 virtual void printPreview(CalPrinter *calPrinter,
223 const QDate &, const QDate &); 223 const QDate &, const QDate &);
224 bool isMonthView() { return true; } 224 bool isMonthView() { return true; }
225 bool isUpdatePossible() { return updatePossible; } 225 bool isUpdatePossible() { return updatePossible; }
226 226
227 MonthViewCell * selectedCell(); 227 MonthViewCell * selectedCell();
228 public slots: 228 public slots:
229 virtual void updateView(); 229 virtual void updateView();
230 virtual void updateConfig(); 230 virtual void updateConfig();
231 virtual void showDates(const QDate &start, const QDate &end); 231 virtual void showDates(const QDate &start, const QDate &end);
232 virtual void showEvents(QPtrList<Event> eventList); 232 virtual void showEvents(QPtrList<Event> eventList);
233 233
234 void changeEventDisplay(Event *, int); 234 void changeEventDisplay(Event *, int);
235 235
236 void clearSelection(); 236 void clearSelection();
237 237
238 void showContextMenu( Incidence * ); 238 void showContextMenu( Incidence * );
239 239
240 void setSelectedCell( MonthViewCell * ); 240 void setSelectedCell( MonthViewCell * );
241 241
242 protected slots: 242 protected slots:
243 void switchView();
243 void processSelectionChange(); 244 void processSelectionChange();
244 signals: 245 signals:
245 void nextMonth(); 246 void nextMonth();
246 void prevMonth(); 247 void prevMonth();
248 void showNavigator( bool );
247 void selectWeekNum ( int ); 249 void selectWeekNum ( int );
248 void showDaySignal( QDate ); 250 void showDaySignal( QDate );
249 protected: 251 protected:
250 void resizeEvent(QResizeEvent *); 252 void resizeEvent(QResizeEvent *);
251 void viewChanged(); 253 void viewChanged();
252 void updateDayLabels(); 254 void updateDayLabels();
253 255
254 private: 256 private:
257 bool mShowWeekView;
255 bool updatePossible; 258 bool updatePossible;
256 int mDaysPerWeek; 259 int mDaysPerWeek;
257 int mNumWeeks; 260 int mNumWeeks;
258 int mNumCells; 261 int mNumCells;
259 bool mWeekStartsMonday; 262 bool mWeekStartsMonday;
260 bool mShowSatSunComp; 263 bool mShowSatSunComp;
261 void computeLayout(); 264 void computeLayout();
265 void computeLayoutWeek();
262 266
263 QPtrVector<MonthViewCell> mCells; 267 QPtrVector<MonthViewCell> mCells;
264 QPtrVector<QLabel> mDayLabels; 268 QPtrVector<QLabel> mDayLabels;
265 QPtrVector<KOWeekButton> mWeekLabels; 269 QPtrVector<KOWeekButton> mWeekLabels;
266 270
267 bool mShortDayLabels; 271 bool mShortDayLabels;
268 int mWidthLongDayLabel; 272 int mWidthLongDayLabel;
269 273
270 QDate mStartDate; 274 QDate mStartDate;
271 275
272 MonthViewCell *mSelectedCell; 276 MonthViewCell *mSelectedCell;
273 277
274 KOEventPopupMenu *mContextMenu; 278 KOEventPopupMenu *mContextMenu;
275 void keyPressEvent ( QKeyEvent * ) ; 279 void keyPressEvent ( QKeyEvent * ) ;
276 280
277}; 281};
278 282
279#endif 283#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 0548f14..2fb7c36 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -186,48 +186,49 @@ KOPrefs::KOPrefs() :
186 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 186 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
187 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 187 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
188 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 188 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
189 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 189 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
190 190
191 191
192 KPrefs::setCurrentGroup("Locale"); 192 KPrefs::setCurrentGroup("Locale");
193 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 193 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
194 194
195 195
196 KPrefs::setCurrentGroup("Colors"); 196 KPrefs::setCurrentGroup("Colors");
197 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 197 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
198 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 198 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
199 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 199 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
200 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 200 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
201 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 201 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
202 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 202 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
203 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 203 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
204 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 204 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
205 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 205 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
206 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 206 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
207 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 207 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
208 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 208 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
209 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 209 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
210 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
210 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 211 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
211 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 212 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
212 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 213 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
213 addItemBool("UseAppColors",&mUseAppColors,false); 214 addItemBool("UseAppColors",&mUseAppColors,false);
214 215
215 216
216 217
217 KPrefs::setCurrentGroup("Views"); 218 KPrefs::setCurrentGroup("Views");
218 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 219 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
219 addItemInt("Hour Size",&mHourSize,8); 220 addItemInt("Hour Size",&mHourSize,8);
220 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 221 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
221 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 222 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
222 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 223 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
223 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 224 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
224 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 225 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
225 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 226 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
226#ifdef DESKTOP_VERION 227#ifdef DESKTOP_VERION
227 addItemBool("Enable ToolTips",&mEnableToolTips,true); 228 addItemBool("Enable ToolTips",&mEnableToolTips,true);
228#else 229#else
229 addItemBool("Enable ToolTips",&mEnableToolTips,false); 230 addItemBool("Enable ToolTips",&mEnableToolTips,false);
230#endif 231#endif
231 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 232 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
232 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 233 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
233 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 234 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 8b849fa..6541af2 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -112,48 +112,49 @@ class KOPrefs : public KPimPrefs
112 QFont mTodoViewFont; 112 QFont mTodoViewFont;
113 QFont mListViewFont; 113 QFont mListViewFont;
114 QFont mDateNavigatorFont; 114 QFont mDateNavigatorFont;
115 QFont mEditBoxFont; 115 QFont mEditBoxFont;
116 QFont mJornalViewFont; 116 QFont mJornalViewFont;
117 QFont mWhatsNextFont; 117 QFont mWhatsNextFont;
118 QFont mEventViewFont; 118 QFont mEventViewFont;
119 119
120 120
121 121
122 122
123 QColor mHolidayColor; 123 QColor mHolidayColor;
124 QColor mHighlightColor; 124 QColor mHighlightColor;
125 QColor mEventColor; 125 QColor mEventColor;
126 QColor mTodoDoneColor; 126 QColor mTodoDoneColor;
127 QColor mAgendaBgColor; 127 QColor mAgendaBgColor;
128 QColor mWorkingHoursColor; 128 QColor mWorkingHoursColor;
129 QColor mTodoDueTodayColor; 129 QColor mTodoDueTodayColor;
130 QColor mTodoOverdueColor; 130 QColor mTodoOverdueColor;
131 QColor mMonthViewEvenColor; 131 QColor mMonthViewEvenColor;
132 QColor mMonthViewOddColor; 132 QColor mMonthViewOddColor;
133 QColor mMonthViewHolidayColor; 133 QColor mMonthViewHolidayColor;
134 bool mMonthViewUsesDayColors; 134 bool mMonthViewUsesDayColors;
135 bool mMonthViewSatSunTog; 135 bool mMonthViewSatSunTog;
136 bool mMonthViewWeek;
136 QColor mAppColor1; 137 QColor mAppColor1;
137 QColor mAppColor2; 138 QColor mAppColor2;
138 bool mUseAppColors; 139 bool mUseAppColors;
139 140
140 int mDayBegins; 141 int mDayBegins;
141 int mHourSize; 142 int mHourSize;
142 int mAllDaySize; 143 int mAllDaySize;
143 bool mShowFullMenu; 144 bool mShowFullMenu;
144 bool mDailyRecur; 145 bool mDailyRecur;
145 bool mWeeklyRecur; 146 bool mWeeklyRecur;
146 bool mMonthDailyRecur; 147 bool mMonthDailyRecur;
147 bool mMonthWeeklyRecur; 148 bool mMonthWeeklyRecur;
148 bool mMonthShowIcons; 149 bool mMonthShowIcons;
149 bool mMonthShowShort; 150 bool mMonthShowShort;
150 bool mEnableToolTips; 151 bool mEnableToolTips;
151 bool mEnableMonthScroll; 152 bool mEnableMonthScroll;
152 bool mFullViewMonth; 153 bool mFullViewMonth;
153 bool mMonthViewUsesCategoryColor; 154 bool mMonthViewUsesCategoryColor;
154 bool mFullViewTodo; 155 bool mFullViewTodo;
155 bool mShowCompletedTodo; 156 bool mShowCompletedTodo;
156 bool mMarcusBainsEnabled; 157 bool mMarcusBainsEnabled;
157 int mNextXDays; 158 int mNextXDays;
158 int mWhatsNextDays; 159 int mWhatsNextDays;
159 int mWhatsNextPrios; 160 int mWhatsNextPrios;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 7e126d9..6afd203 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -203,51 +203,53 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
203 return; 203 return;
204 full = mMainView->leftFrame()->isVisible(); 204 full = mMainView->leftFrame()->isVisible();
205 } else { 205 } else {
206 mCurrentView = view; 206 mCurrentView = view;
207 // bool full = fullScreen; 207 // bool full = fullScreen;
208 bool isFull = !mMainView->leftFrame()->isVisible(); 208 bool isFull = !mMainView->leftFrame()->isVisible();
209 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 209 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
210 full = true; 210 full = true;
211 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 211 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
212 full = false; 212 full = false;
213 } 213 }
214 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 214 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
215 //raiseCurrentView( full ); 215 //raiseCurrentView( full );
216 mMainView->processIncidenceSelection( 0 ); 216 mMainView->processIncidenceSelection( 0 );
217 //mMainView->updateView(); 217 //mMainView->updateView();
218 raiseCurrentView( full, true ); 218 raiseCurrentView( full, true );
219 mMainView->adaptNavigationUnits(); 219 mMainView->adaptNavigationUnits();
220} 220}
221 221
222void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 222void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
223{ 223{
224 mCurrentAgendaView = 0; 224 mCurrentAgendaView = 0;
225 int wid = mMainView->width() ; 225 int wid = mMainView->width() ;
226 int hei = mMainView->height(); 226 int hei = mMainView->height();
227 if ( mCurrentView == mMonthView ) { 227 if ( mCurrentView == mMonthView ) {
228 mMainView->navigatorBar()->show(); 228 if ( !KOPrefs::instance()->mMonthViewWeek ) {
229 hei -= mMainView->navigatorBar()->sizeHint().height(); 229 mMainView->navigatorBar()->show();
230 hei -= mMainView->navigatorBar()->sizeHint().height();
231 }
230 //mMainView->navigatorBar()->hide(); 232 //mMainView->navigatorBar()->hide();
231 } else { 233 } else {
232 mMainView->navigatorBar()->hide(); 234 mMainView->navigatorBar()->hide();
233 } 235 }
234 if ( fullScreen ) { 236 if ( fullScreen ) {
235 mMainView->leftFrame()->hide(); 237 mMainView->leftFrame()->hide();
236 } else { 238 } else {
237 mMainView->leftFrame()->show(); 239 mMainView->leftFrame()->show();
238 if ( KOPrefs::instance()->mVerticalScreen ) 240 if ( KOPrefs::instance()->mVerticalScreen )
239 hei -= mMainView->leftFrame()->height(); 241 hei -= mMainView->leftFrame()->height();
240 else 242 else
241 wid -= mMainView->leftFrame()->width(); 243 wid -= mMainView->leftFrame()->width();
242 } 244 }
243 emit signalFullScreen( !fullScreen ); 245 emit signalFullScreen( !fullScreen );
244 if ( callUpdateView ) 246 if ( callUpdateView )
245 mMainView->updateView(); 247 mMainView->updateView();
246 248
247 if ( globalFlagBlockAgenda == 5 ) { 249 if ( globalFlagBlockAgenda == 5 ) {
248 globalFlagBlockAgenda = 4; 250 globalFlagBlockAgenda = 4;
249 globalFlagBlockAgendaItemPaint = 1; 251 globalFlagBlockAgendaItemPaint = 1;
250 } 252 }
251 mMainView->viewStack()->raiseWidget(mCurrentView); 253 mMainView->viewStack()->raiseWidget(mCurrentView);
252 if ( globalFlagBlockAgenda == 4 ) { 254 if ( globalFlagBlockAgenda == 4 ) {
253 if ( mCurrentView == mAgendaView ) { 255 if ( mCurrentView == mAgendaView ) {
@@ -506,55 +508,59 @@ void KOViewManager::showMonthView()
506 mMainView, SLOT(editIncidence(Incidence *))); 508 mMainView, SLOT(editIncidence(Incidence *)));
507 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 509 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
508 mMainView, SLOT(deleteIncidence(Incidence *))); 510 mMainView, SLOT(deleteIncidence(Incidence *)));
509 511
510 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 512 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
511 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 513 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
512 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 514 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
513 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 515 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
514 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 516 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
515 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 517 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
516 518
517 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 519 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
518 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 520 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
519 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 521 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
520 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 522 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
521 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 523 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
522 mMainView, SLOT ( selectWeekNum( int ) ) ); 524 mMainView, SLOT ( selectWeekNum( int ) ) );
523 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 525 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
524 mMainView, SLOT ( showDay( QDate ) ) ); 526 mMainView, SLOT ( showDay( QDate ) ) );
525 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 527 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
526 connect( mMonthView, SIGNAL(nextMonth() ), 528 connect( mMonthView, SIGNAL(nextMonth() ),
527 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); 529 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) );
528 connect( mMonthView, SIGNAL(prevMonth() ), 530 connect( mMonthView, SIGNAL(prevMonth() ),
529 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 531 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) );
530 mMonthView->updateConfig(); 532 connect( mMonthView, SIGNAL( showNavigator(bool) ),
533 mMainView, SLOT ( showNavigatorBar(bool) ) );
531 } 534 }
532 535
533 globalFlagBlockAgenda = 1; 536 globalFlagBlockAgenda = 1;
534 //mFlagShowNextxDays = false; 537 //mFlagShowNextxDays = false;
535 // if(mMonthView == mCurrentView) return; 538 // if(mMonthView == mCurrentView) return;
536 mMainView->dateNavigator()->selectMonth(); 539 if ( KOPrefs::instance()->mMonthViewWeek )
540 mMainView->dateNavigator()->selectWeek();
541 else
542 mMainView->dateNavigator()->selectMonth();
537 543
538 showView(mMonthView, true ); 544 showView(mMonthView, true );
539 545
540} 546}
541 547
542void KOViewManager::showTodoView() 548void KOViewManager::showTodoView()
543{ 549{
544 //mFlagShowNextxDays = false; 550 //mFlagShowNextxDays = false;
545 if ( !mTodoView ) { 551 if ( !mTodoView ) {
546 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 552 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
547 "KOViewManager::TodoView" ); 553 "KOViewManager::TodoView" );
548 554
549 addView( mTodoView ); 555 addView( mTodoView );
550 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 556 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
551 557
552 // SIGNALS/SLOTS FOR TODO VIEW 558 // SIGNALS/SLOTS FOR TODO VIEW
553 connect( mTodoView, SIGNAL( newTodoSignal() ), 559 connect( mTodoView, SIGNAL( newTodoSignal() ),
554 mMainView, SLOT( newTodo() ) ); 560 mMainView, SLOT( newTodo() ) );
555 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 561 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
556 mMainView, SLOT( newSubTodo( Todo *) ) ); 562 mMainView, SLOT( newSubTodo( Todo *) ) );
557 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 563 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
558 mMainView, SLOT( showTodo( Todo * ) ) ); 564 mMainView, SLOT( showTodo( Todo * ) ) );
559 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 565 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
560 mMainView, SLOT( editTodo( Todo * ) ) ); 566 mMainView, SLOT( editTodo( Todo * ) ) );