summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-07 12:30:17 (UTC)
committer zautrix <zautrix>2005-07-07 12:30:17 (UTC)
commit766b53919de14b8faec22db32b6a750acde0b760 (patch) (unidiff)
treebb07c0af89b0dddf4257a61e9f5b1cf23c4a282a
parentb4d85da57e2d558ec088af6f3b2a34b1854462c0 (diff)
downloadkdepimpi-766b53919de14b8faec22db32b6a750acde0b760.zip
kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.gz
kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.bz2
fixesss
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp70
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/kolistview.cpp39
-rw-r--r--korganizer/komonthview.cpp124
-rw-r--r--korganizer/komonthview.h2
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp4
8 files changed, 192 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 9a114d0..e766b8f 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2689,70 +2689,140 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2689 mCalendar->checkAlarmForIncidence( which , false ); 2689 mCalendar->checkAlarmForIncidence( which , false );
2690} 2690}
2691 2691
2692// most of the changeEventDisplays() right now just call the view's 2692// most of the changeEventDisplays() right now just call the view's
2693// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2693// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2694void CalendarView::changeEventDisplay(Event *which, int action) 2694void CalendarView::changeEventDisplay(Event *which, int action)
2695{ 2695{
2696 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2696 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2697 changeIncidenceDisplay((Incidence *)which, action); 2697 changeIncidenceDisplay((Incidence *)which, action);
2698 2698
2699 2699
2700 static bool clearallviews = false; 2700 static bool clearallviews = false;
2701 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2701 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2702 if ( clearallviews ) { 2702 if ( clearallviews ) {
2703 clearAllViews(); 2703 clearAllViews();
2704 clearallviews = false; 2704 clearallviews = false;
2705 } 2705 }
2706 return; 2706 return;
2707 } 2707 }
2708 clearallviews = true; 2708 clearallviews = true;
2709 2709
2710 2710
2711 2711
2712 mDateNavigator->updateView(); 2712 mDateNavigator->updateView();
2713 //mDialogManager->updateSearchDialog(); 2713 //mDialogManager->updateSearchDialog();
2714 2714
2715 if (which) { 2715 if (which) {
2716 // If there is an event view visible update the display 2716 // If there is an event view visible update the display
2717 mViewManager->currentView()->changeEventDisplay(which,action); 2717 mViewManager->currentView()->changeEventDisplay(which,action);
2718 // TODO: check, if update needed 2718 // TODO: check, if update needed
2719 // if (which->getTodoStatus()) { 2719 // if (which->getTodoStatus()) {
2720 mTodoList->updateView(); 2720 mTodoList->updateView();
2721 if ( action != KOGlobals::EVENTDELETED ) {
2722 mConflictingEvent = which ;
2723 QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) );
2724 }
2721 // } 2725 // }
2722 } else { 2726 } else {
2723 mViewManager->currentView()->updateView(); 2727 mViewManager->currentView()->updateView();
2724 } 2728 }
2725} 2729}
2730void CalendarView::checkConflictForEvent()
2731{
2732
2733 if (!KOPrefs::instance()->mConfirm)
2734 return;
2735 if ( ! mConflictingEvent ) return;
2736 if ( mConflictingEvent->doesFloat() ) {
2737 mConflictingEvent = 0;
2738 return;
2739 }
2740 bool all = false;
2741 bool allday = false;
2742 Event * ev = mConflictingEvent;
2743 mConflictingEvent = 0;
2744 QDate start = ev->dtStart().date();
2745 QDate end = ev->dtEnd().date().addDays(1);
2746 while ( start < end ) {
2747 QPtrList<Event> test = calendar()->events( start );
2748 //qDebug("found %d on %s ", eventList.count(), start.toString().latin1());
2749 Event * t_ev = test.first();
2750 QDateTime es = ev->dtStart();
2751 QDateTime ee = ev->dtEnd();
2752 if ( ev->doesFloat() )
2753 ee = ee.addDays( 1 );
2754 if ( ! all ) {
2755 if ( ev->doesFloat() != allday )
2756 t_ev = 0;
2757 }
2758 while ( t_ev ) {
2759 bool skip = false;
2760 if ( ! all ) {
2761 if ( t_ev->doesFloat() != allday )
2762 skip = true;
2763 }
2764 if ( !skip && ev != t_ev ) {
2765 QDateTime ets = t_ev->dtStart();
2766 QDateTime ete = t_ev->dtEnd();
2767 if ( t_ev->doesFloat() )
2768 ete = ete.addDays( 1 );
2769 //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() );
2770 if ( es < ete && ets < ee ) {
2771 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( ev->summary(),0 ) ).arg( KGlobal::formatMessage ( t_ev->summary(),0 )).arg(KGlobal::locale()->formatDate(start) ) ;
2772 qApp->processEvents();
2773 int km = KMessageBox::warningContinueCancel(this,mess,
2774 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
2775 if ( km != KMessageBox::Continue )
2776 return;
2777
2778 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
2779 mViewManager->showDayView();
2780 mNavigator->slotDaySelect( start );
2781 int hour = es.time().hour();
2782 if ( ets > es )
2783 hour = ets.time().hour();
2784 mViewManager->agendaView()->setStartHour( hour );
2785 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) );
2786 return;
2787 }
2788 }
2789 t_ev = test.next();
2790 }
2791 start = start.addDays( 1 );
2792 }
2793 qDebug("No conflict found ");
2794
2726 2795
2796}
2727 2797
2728void CalendarView::updateTodoViews() 2798void CalendarView::updateTodoViews()
2729{ 2799{
2730 mTodoList->updateView(); 2800 mTodoList->updateView();
2731 mViewManager->currentView()->updateView(); 2801 mViewManager->currentView()->updateView();
2732 2802
2733} 2803}
2734 2804
2735 2805
2736 2806
2737void CalendarView::clearAllViews() 2807void CalendarView::clearAllViews()
2738{ 2808{
2739 mTodoList->clearList(); 2809 mTodoList->clearList();
2740 mViewManager->clearAllViews(); 2810 mViewManager->clearAllViews();
2741 SearchDialog * sd = mDialogManager->getSearchDialog(); 2811 SearchDialog * sd = mDialogManager->getSearchDialog();
2742 if ( sd ) { 2812 if ( sd ) {
2743 KOListView* kol = sd->listview(); 2813 KOListView* kol = sd->listview();
2744 if ( kol ) 2814 if ( kol )
2745 kol->clearList(); 2815 kol->clearList();
2746 } 2816 }
2747} 2817}
2748void CalendarView::updateView() 2818void CalendarView::updateView()
2749{ 2819{
2750 static bool clearallviews = false; 2820 static bool clearallviews = false;
2751 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2821 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2752 if ( clearallviews ) { 2822 if ( clearallviews ) {
2753 clearAllViews(); 2823 clearAllViews();
2754 clearallviews = false; 2824 clearallviews = false;
2755 } 2825 }
2756 return; 2826 return;
2757 } 2827 }
2758 clearallviews = true; 2828 clearallviews = true;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 51eb1d4..706d05d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -479,90 +479,92 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
479 bool importBday(); 479 bool importBday();
480 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 480 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
481 bool importQtopia( const QString &categoriesFile, 481 bool importQtopia( const QString &categoriesFile,
482 const QString &datebookFile, 482 const QString &datebookFile,
483 const QString &tasklistFile ); 483 const QString &tasklistFile );
484 void syncExternal( int mode ); 484 void syncExternal( int mode );
485 void slotSelectPickerDate( QDate ) ; 485 void slotSelectPickerDate( QDate ) ;
486 void showDatePicker() ; 486 void showDatePicker() ;
487 void showDatePickerPopup() ; 487 void showDatePickerPopup() ;
488 void moveIncidence(Incidence *) ; 488 void moveIncidence(Incidence *) ;
489 void beamIncidence(Incidence *) ; 489 void beamIncidence(Incidence *) ;
490 void beamCalendar() ; 490 void beamCalendar() ;
491 void beamFilteredCalendar() ; 491 void beamFilteredCalendar() ;
492 void beamIncidenceList(QPtrList<Incidence>) ; 492 void beamIncidenceList(QPtrList<Incidence>) ;
493 void manageCategories(); 493 void manageCategories();
494 void editCategories(); 494 void editCategories();
495 int addCategories(); 495 int addCategories();
496 void removeCategories(); 496 void removeCategories();
497 void setSyncDevice( QString ); 497 void setSyncDevice( QString );
498 void setSyncName( QString ); 498 void setSyncName( QString );
499 void showDay( QDate ); 499 void showDay( QDate );
500 void undo_delete(); 500 void undo_delete();
501 protected slots: 501 protected slots:
502 void resetFocus(); 502 void resetFocus();
503 void scrollBarValue(int); 503 void scrollBarValue(int);
504 void slotViewerClosed(); 504 void slotViewerClosed();
505 void timerAlarm(); 505 void timerAlarm();
506 void suspendAlarm(); 506 void suspendAlarm();
507 void beamDone( Ir *ir ); 507 void beamDone( Ir *ir );
508 /** Select a view or adapt the current view to display the specified dates. */ 508 /** Select a view or adapt the current view to display the specified dates. */
509 void showDates( const KCal::DateList & ); 509 void showDates( const KCal::DateList & );
510 void selectWeekNum ( int ); 510 void selectWeekNum ( int );
511 void checkConflictForEvent();
511 512
512 public: 513 public:
513 // show a standard warning 514 // show a standard warning
514 // returns KMsgBox::yesNoCancel() 515 // returns KMsgBox::yesNoCancel()
515 int msgCalModified(); 516 int msgCalModified();
516 virtual bool sync(KSyncManager* manager, QString filename, int mode); 517 virtual bool sync(KSyncManager* manager, QString filename, int mode);
517 518
518 virtual bool syncExternal(KSyncManager* manager, QString resource); 519 virtual bool syncExternal(KSyncManager* manager, QString resource);
519 virtual void removeSyncInfo( QString syncProfile); 520 virtual void removeSyncInfo( QString syncProfile);
520 void setSyncManager(KSyncManager* manager); 521 void setSyncManager(KSyncManager* manager);
521 void setLoadedFileVersion(QDateTime); 522 void setLoadedFileVersion(QDateTime);
522 bool checkFileVersion(QString fn); 523 bool checkFileVersion(QString fn);
523 bool checkAllFileVersions(); 524 bool checkAllFileVersions();
524 bool checkFileChanged(QString fn); 525 bool checkFileChanged(QString fn);
525 Event* getLastSyncEvent(); 526 Event* getLastSyncEvent();
526 /** Adapt navigation units correpsonding to step size of navigation of the 527 /** Adapt navigation units correpsonding to step size of navigation of the
527 * current view. 528 * current view.
528 */ 529 */
529 void adaptNavigationUnits(); 530 void adaptNavigationUnits();
530 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 531 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
531 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 532 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
532 //Attendee* getYourAttendee(Event *event); 533 //Attendee* getYourAttendee(Event *event);
533 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 534 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
534 void setScrollBarStep(int val ); 535 void setScrollBarStep(int val );
535 536
536 protected: 537 protected:
538 Event *mConflictingEvent;
537 void schedule(Scheduler::Method, Incidence *incidence = 0); 539 void schedule(Scheduler::Method, Incidence *incidence = 0);
538 540
539 // returns KMsgBox::OKCandel() 541 // returns KMsgBox::OKCandel()
540 int msgItemDelete(const QString name); 542 int msgItemDelete(const QString name);
541 void showEventEditor(); 543 void showEventEditor();
542 void showTodoEditor(); 544 void showTodoEditor();
543 Todo *selectedTodo(); 545 Todo *selectedTodo();
544 private: 546 private:
545#ifdef DESKTOP_VERSION 547#ifdef DESKTOP_VERSION
546 QScrollBar * mDateScrollBar; 548 QScrollBar * mDateScrollBar;
547#endif 549#endif
548 QDateTime mNextAlarmDateTime; 550 QDateTime mNextAlarmDateTime;
549 bool mViewerCallerIsSearchDialog; 551 bool mViewerCallerIsSearchDialog;
550 bool mBlockShowDates; 552 bool mBlockShowDates;
551 KSyncManager* mSyncManager; 553 KSyncManager* mSyncManager;
552 AlarmDialog * mAlarmDialog; 554 AlarmDialog * mAlarmDialog;
553 QString mAlarmNotification; 555 QString mAlarmNotification;
554 QString mSuspendAlarmNotification; 556 QString mSuspendAlarmNotification;
555 QTimer* mSuspendTimer; 557 QTimer* mSuspendTimer;
556 QTimer* mAlarmTimer; 558 QTimer* mAlarmTimer;
557 QTimer* mRecheckAlarmTimer; 559 QTimer* mRecheckAlarmTimer;
558 void computeAlarm( QString ); 560 void computeAlarm( QString );
559 void startAlarm( QString, QString ); 561 void startAlarm( QString, QString );
560 void setSyncEventsReadOnly(); 562 void setSyncEventsReadOnly();
561 563
562 QDateTime loadedFileVersion; 564 QDateTime loadedFileVersion;
563 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 565 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
564 void checkExternalId( Incidence * inc ); 566 void checkExternalId( Incidence * inc );
565 int mGlobalSyncMode; 567 int mGlobalSyncMode;
566 QString mCurrentSyncDevice; 568 QString mCurrentSyncDevice;
567 QString mCurrentSyncName; 569 QString mCurrentSyncName;
568 void init(); 570 void init();
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7783dd4..d25f671 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -488,89 +488,84 @@ void KOListView::updateList()
488void KOListView::clearList() 488void KOListView::clearList()
489{ 489{
490 clear (); 490 clear ();
491} 491}
492 492
493void KOListView::setCat() 493void KOListView::setCat()
494{ 494{
495 495
496 bool set = true; 496 bool set = true;
497 int result = KMessageBox::warningYesNoCancel(this, 497 int result = KMessageBox::warningYesNoCancel(this,
498 i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), 498 i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"),
499 i18n("Set categories"), 499 i18n("Set categories"),
500 i18n("Add"), 500 i18n("Add"),
501 i18n("Reset")); 501 i18n("Reset"));
502 if (result == KMessageBox::Cancel) return; 502 if (result == KMessageBox::Cancel) return;
503 if (result == KMessageBox::Yes) set = false; 503 if (result == KMessageBox::Yes) set = false;
504 setCategories( set ); 504 setCategories( set );
505} 505}
506 506
507void KOListView::setAlarm() 507void KOListView::setAlarm()
508{ 508{
509 KOAlarmPrefs kap( this); 509 KOAlarmPrefs kap( this);
510 if ( !kap.exec() ) 510 if ( !kap.exec() )
511 return; 511 return;
512 QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos 512 QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos
513 Incidence* inc = delSel.first(); 513 Incidence* inc = delSel.first();
514 int count = 0; 514 int count = 0;
515 while ( inc ) { 515 while ( inc ) {
516 ++count; 516 ++count;
517 if (kap.mAlarmButton->isChecked()) { 517 if (kap.mAlarmButton->isChecked()) {
518 if (inc->alarms().count() == 0) 518 if (inc->alarms().count() == 0)
519 inc->newAlarm(); 519 inc->newAlarm();
520 Alarm *alarm = inc->alarms().first();
521 alarm->setEnabled(true);
522 int j = kap.mAlarmTimeEdit->value()* -60;
523 if (kap.mAlarmIncrCombo->currentItem() == 1)
524 j = j * 60;
525 else if (kap.mAlarmIncrCombo->currentItem() == 2)
526 j = j * (60 * 24);
527 alarm->setStartOffset( j );
528
529 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
530 alarm->setProcedureAlarm(kap.mAlarmProgram);
531 }
532 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
533 alarm->setAudioAlarm(kap.mAlarmSound);
534 else
535 alarm->setType(Alarm::Invalid);
536 } else {
520 QPtrList<Alarm> alarms = inc->alarms(); 537 QPtrList<Alarm> alarms = inc->alarms();
521 Alarm *alarm; 538 Alarm *alarm;
522 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 539 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
523 alarm->setEnabled(true);
524 int j = kap.mAlarmTimeEdit->value()* -60;
525 if (kap.mAlarmIncrCombo->currentItem() == 1)
526 j = j * 60;
527 else if (kap.mAlarmIncrCombo->currentItem() == 2)
528 j = j * (60 * 24);
529 alarm->setStartOffset( j );
530
531 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
532 alarm->setProcedureAlarm(kap.mAlarmProgram);
533 }
534 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
535 alarm->setAudioAlarm(kap.mAlarmSound);
536 else
537 alarm->setType(Alarm::Invalid);
538 //alarm->setAudioAlarm("default");
539 // TODO: Deal with multiple alarms
540 break; // For now, stop after the first alarm
541 }
542 } else {
543 Alarm* alarm = inc->alarms().first();
544 if ( alarm ) {
545 alarm->setEnabled(false); 540 alarm->setEnabled(false);
546 alarm->setType(Alarm::Invalid); 541 alarm->setType(Alarm::Invalid);
547 } 542 }
548 } 543 }
549 KOListViewItem* item = getItemForEvent(inc); 544 KOListViewItem* item = getItemForEvent(inc);
550 if (item) { 545 if (item) {
551 ListItemVisitor v(item, mStartDate ); 546 ListItemVisitor v(item, mStartDate );
552 inc->accept(v); 547 inc->accept(v);
553 } 548 }
554 inc = delSel.next(); 549 inc = delSel.next();
555 } 550 }
556 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); 551 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
557 qDebug("KO: Set alarm for %d items", count); 552 qDebug("KO: Set alarm for %d items", count);
558 calendar()->reInitAlarmSettings(); 553 calendar()->reInitAlarmSettings();
559 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 554 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
560} 555}
561void KOListView::setCategories( bool removeOld ) 556void KOListView::setCategories( bool removeOld )
562{ 557{
563 558
564 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 559 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
565 csd->setColorEnabled(); 560 csd->setColorEnabled();
566 if (! csd->exec()) { 561 if (! csd->exec()) {
567 delete csd; 562 delete csd;
568 return; 563 return;
569 } 564 }
570 QStringList catList = csd->selectedCategories(); 565 QStringList catList = csd->selectedCategories();
571 delete csd; 566 delete csd;
572 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 567 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
573 Incidence* inc = delSel.first(); 568 Incidence* inc = delSel.first();
574 while ( inc ) { 569 while ( inc ) {
575 if ( removeOld ) { 570 if ( removeOld ) {
576 inc->setCategories( catList, false ); 571 inc->setCategories( catList, false );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 2289977..53bbe28 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1495,65 +1495,66 @@ DateList KOMonthView::selectedDates()
1495 1495
1496 return selected; 1496 return selected;
1497} 1497}
1498#if 0 1498#if 0
1499void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1499void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1500 const QDate &td) 1500 const QDate &td)
1501{ 1501{
1502#ifndef KORG_NOPRINTER 1502#ifndef KORG_NOPRINTER
1503 calPrinter->preview(CalPrinter::Month, fd, td); 1503 calPrinter->preview(CalPrinter::Month, fd, td);
1504#endif 1504#endif
1505} 1505}
1506#endif 1506#endif
1507void KOMonthView::updateConfig() 1507void KOMonthView::updateConfig()
1508{ 1508{
1509 1509
1510 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1510 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1511 1511
1512 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1512 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1513 mWeekStartsMonday = true; 1513 mWeekStartsMonday = true;
1514 } 1514 }
1515 QFontMetrics fontmetric(mDayLabels[0]->font()); 1515 QFontMetrics fontmetric(mDayLabels[0]->font());
1516 mWidthLongDayLabel = 0; 1516 mWidthLongDayLabel = 0;
1517 1517
1518 for (int i = 0; i < 7; i++) { 1518 for (int i = 0; i < 7; i++) {
1519 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1519 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1520 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1520 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1521 } 1521 }
1522 bool temp = mShowSatSunComp ; 1522 bool temp = mShowSatSunComp ;
1523 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1523 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1524 if ( ! mShowWeekView ) { 1524 if ( ! mShowWeekView ) {
1525 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1525 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1526 computeLayout(); 1526 computeLayout();
1527 } 1527 } else
1528 doComputeLayoutWeek();
1528 updateDayLabels(); 1529 updateDayLabels();
1529 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1530 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1530 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1531 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1531 //resizeEvent( 0 ); 1532 //resizeEvent( 0 );
1532 for (uint i = 0; i < mCells.count(); ++i) { 1533 for (uint i = 0; i < mCells.count(); ++i) {
1533 mCells[i]->updateConfig(); 1534 mCells[i]->updateConfig();
1534 } 1535 }
1535 1536
1536 for (uint i = 0; i < mCellsW.count(); ++i) { 1537 for (uint i = 0; i < mCellsW.count(); ++i) {
1537 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1538 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1538 } 1539 }
1539#ifdef DESKTOP_VERSION 1540#ifdef DESKTOP_VERSION
1540 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1541 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1541#endif 1542#endif
1542 updateView(); 1543 updateView();
1543} 1544}
1544 1545
1545void KOMonthView::updateDayLabels() 1546void KOMonthView::updateDayLabels()
1546{ 1547{
1547 1548
1548 QPtrVector<QLabel> *mDayLabelsT; 1549 QPtrVector<QLabel> *mDayLabelsT;
1549 1550
1550 mDayLabelsT = &mDayLabelsW; 1551 mDayLabelsT = &mDayLabelsW;
1551 for (int i = 0; i < 7; i++) { 1552 for (int i = 0; i < 7; i++) {
1552 { 1553 {
1553 bool show = mShortDayLabelsW; 1554 bool show = mShortDayLabelsW;
1554 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1555 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1555 show = true; 1556 show = true;
1556 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1557 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1557 } 1558 }
1558 } 1559 }
1559 mDayLabelsT = &mDayLabels; 1560 mDayLabelsT = &mDayLabels;
@@ -1786,212 +1787,277 @@ void KOMonthView::updateView()
1786 1787
1787void KOMonthView::setKeyBoardFocus() 1788void KOMonthView::setKeyBoardFocus()
1788{ 1789{
1789 //qDebug("KOMonthView::setKeyBoardFocus() "); 1790 //qDebug("KOMonthView::setKeyBoardFocus() ");
1790 bool shootAgain = false; 1791 bool shootAgain = false;
1791 if ( mShowWeekView ) { 1792 if ( mShowWeekView ) {
1792 shootAgain = !mWeekLabelsW[1]->hasFocus(); 1793 shootAgain = !mWeekLabelsW[1]->hasFocus();
1793 mWeekLabelsW[1]->setFocus(); 1794 mWeekLabelsW[1]->setFocus();
1794 } 1795 }
1795 else { 1796 else {
1796 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); 1797 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
1797 mWeekLabels[mNumWeeks]->setFocus(); 1798 mWeekLabels[mNumWeeks]->setFocus();
1798 } 1799 }
1799 --mKBFcounter; 1800 --mKBFcounter;
1800 if ( shootAgain && mKBFcounter > 0 ) { 1801 if ( shootAgain && mKBFcounter > 0 ) {
1801 QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); 1802 QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) );
1802 } 1803 }
1803} 1804}
1804void KOMonthView::setKeyBFocus() 1805void KOMonthView::setKeyBFocus()
1805{ 1806{
1806 //qDebug("KOMonthView::setKeyBFocus() "); 1807 //qDebug("KOMonthView::setKeyBFocus() ");
1807 mKBFcounter = 10; 1808 mKBFcounter = 10;
1808 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); 1809 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1809} 1810}
1810void KOMonthView::resizeEvent(QResizeEvent * e) 1811void KOMonthView::resizeEvent(QResizeEvent * e)
1811{ 1812{
1812 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1813 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1813 if ( isVisible() ) { 1814 if ( isVisible() ) {
1814 //qDebug("KOMonthView::isVisible "); 1815 //qDebug("KOMonthView::isVisible ");
1815 slotComputeLayout(); 1816 slotComputeLayout();
1816 } else 1817 } else
1817 mComputeLayoutTimer->start( 100 ); 1818 mComputeLayoutTimer->start( 100 );
1818 KOEventView::resizeEvent( e ); 1819 if ( e )
1820 KOEventView::resizeEvent( e );
1819} 1821}
1820 1822
1821void KOMonthView::slotComputeLayout() 1823void KOMonthView::slotComputeLayout()
1822{ 1824{
1823 mComputeLayoutTimer->stop(); 1825 mComputeLayoutTimer->stop();
1824 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1826 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1825 computeLayout(); 1827 computeLayout();
1826 clPending = true; 1828 clPending = true;
1827 setKeyBFocus(); 1829 setKeyBFocus();
1828} 1830}
1829void KOMonthView::computeLayoutWeek() 1831
1832void KOMonthView::doComputeLayoutWeek()
1830{ 1833{
1831 static int lastWid = 0; 1834
1832 static int lastHei = 0;
1833 int daysToShow; 1835 int daysToShow;
1834 bool combinedSatSun = false; 1836 bool combinedSatSun = false;
1835 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1837 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1836 daysToShow = 6; 1838 daysToShow = 6;
1837 combinedSatSun = true; 1839 combinedSatSun = true;
1838 } 1840 }
1839 int tWid = topLevelWidget()->size().width();
1840 int tHei = topLevelWidget()->size().height();
1841
1842 int wid = width();//e 1841 int wid = width();//e
1843 int hei = height()-1-mNavigatorBar->height(); 1842 int hei = height()-1-mNavigatorBar->height();
1844 1843 if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) {
1845 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1846 return;
1847
1848 if ( lastWid == width() && lastHei == height() ) {
1849 //qDebug("KOListWeekView::No compute layout needed ");
1850 return;
1851 }
1852 lastWid = width();
1853 lastHei = height();
1854
1855
1856 if ( wid < hei )
1857 daysToShow = 2; 1844 daysToShow = 2;
1858 else 1845 } else {
1859 daysToShow = 3; 1846 if ( wid < hei )
1847 daysToShow = 2;
1848 else
1849 daysToShow = 3;
1850 }
1851 bool landscape = (daysToShow == 3);
1860 mShowSatSunComp = true; 1852 mShowSatSunComp = true;
1861 combinedSatSun = true; 1853 combinedSatSun = true;
1862 1854
1863 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1855 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1864 QFontMetrics fm ( mWeekLabels[0]->font() ); 1856 QFontMetrics fm ( mWeekLabels[0]->font() );
1865 int weeklabelwid = fm.width( "888" ); 1857 int weeklabelwid = fm.width( "888" );
1866 wid -= weeklabelwid; 1858 wid -= weeklabelwid;
1867 1859
1868 int colWid = wid / daysToShow; 1860 int colWid = wid / daysToShow;
1869 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1861 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1870 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1862 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1871 int colModulo = wid % daysToShow; 1863 int colModulo = wid % daysToShow;
1872 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1864 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1873 //qDebug("rowmod %d ", rowModulo); 1865 //qDebug("rowmod %d ", rowModulo);
1874 int i; 1866 int i;
1875 int x,y,w,h; 1867 int x,y,w,h;
1876 x= 0; 1868 x= 0;
1877 y= 0; 1869 y= 0;
1878 w = colWid; 1870 w = colWid;
1879 h = dayLabelHei ; 1871 h = dayLabelHei ;
1880 for ( i = 0; i < 7; i++) { 1872 for ( i = 0; i < 7; i++) {
1881 if ( i && !( i % daysToShow) && i < 6) { 1873 if ( i && !( i % daysToShow) && i < 6) {
1882 y += hei/(5-daysToShow); 1874 y += hei/(5-daysToShow);
1883 x = 0; 1875 x = 0;
1884 w = colWid; 1876 w = colWid;
1885 } 1877 }
1886 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1878 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1887 ++w; 1879 ++w;
1888 } 1880 }
1881 int xC,yC,wC,hC;
1889 if ( i >= 5 ) { 1882 if ( i >= 5 ) {
1890 int wi = width() - x - weeklabelwid; 1883 int wi = width() - x - weeklabelwid;
1891 if ( i == 5 ) { 1884 if ( i == 5 ) {
1892 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); 1885 xC = x+weeklabelwid;
1886 yC = y;
1887 wC = wi/2+wi%2;
1888 hC = h;
1893 } else { 1889 } else {
1894 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1890 xC = x+weeklabelwid;
1891 yC = y;
1892 wC = wi;
1893 hC = h;
1895 } 1894 }
1896 x = x - w + wi - (wi/2 ); 1895 x = x - w + wi - (wi/2 );
1897 } 1896 }
1898 else { 1897 else {
1899 int wi = w; 1898 int wi = w;
1900 if ( !(( i+1) % daysToShow)) { 1899 if ( !(( i+1) % daysToShow)) {
1901 wi = width() - x - weeklabelwid; 1900 wi = width() - x - weeklabelwid;
1902 } 1901 }
1903 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1902 xC = x+weeklabelwid;
1903 yC = y;
1904 wC = wi;
1905 hC = h;
1904 } 1906 }
1907 mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC);
1908
1909
1905 x += w; 1910 x += w;
1906 } 1911 }
1907 x= 0; 1912 x= 0;
1908 y= dayLabelHei; 1913 y= dayLabelHei;
1909 w = colWid; 1914 w = colWid;
1910 h = cellHei; 1915 h = cellHei;
1911 int max = 0; 1916 int max = 0;
1912 int w_count = mCellsW.count(); 1917 int w_count = mCellsW.count();
1913 for ( i = 0; i < w_count; ++i) { 1918 for ( i = 0; i < w_count; ++i) {
1914 if ( i > 6 ) { 1919 if ( i > 6 ) {
1915 mCellsW[i]->hide(); 1920 mCellsW[i]->hide();
1916 continue; 1921 continue;
1917 } 1922 }
1918 1923
1919 w = colWid; 1924 w = colWid;
1920 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1925 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1921 ++w; 1926 ++w;
1922 } 1927 }
1923 if ( i == (daysToShow-1-rowModulo)*7) 1928 if ( i == (daysToShow-1-rowModulo)*7)
1924 ++h; 1929 ++h;
1925 1930
1931 int xC,yC,wC,hC;
1926 if ( i >= 5 ) { 1932 if ( i >= 5 ) {
1927 if ( i ==5 ) { 1933 if ( i ==5 ) {
1928 max = h/2; 1934 max = h/2;
1929 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1935 xC = x+weeklabelwid;
1936 yC = y;
1937 wC = w;
1938 hC = max;
1930 x -= w ;y += h/2; 1939 x -= w ;y += h/2;
1931 } else { 1940 } else {
1932 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1941 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1933 ++w; 1942 ++w;
1934 } 1943 }
1935 max = h-h/2; 1944 max = h-h/2;
1936 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1945 xC = x+weeklabelwid;
1946 yC = y;
1947 wC = w;
1948 hC = max;
1937 y -= h/2; 1949 y -= h/2;
1938 } 1950 }
1939 } else { 1951 } else {
1940 max = h; 1952 max = h;
1941 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1953 xC = x+weeklabelwid;
1954 yC = y;
1955 wC = w;
1956 hC = h;
1942 } 1957 }
1958 mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC );
1943 1959
1944 1960
1945 x += w; 1961 x += w;
1946 if ( x + w/2 > wid ) { 1962 if ( x + w/2 > wid ) {
1947 x = 0; 1963 x = 0;
1948 y += h+dayLabelHei ; 1964 y += h+dayLabelHei ;
1949 } 1965 }
1950 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); 1966 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
1951 } 1967 }
1952 y= dayLabelHei; 1968 y= dayLabelHei;
1953 h = cellHei ; 1969 h = cellHei ;
1954 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1970 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1955 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1971 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1956 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1972 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1957 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1973 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1958 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; 1974 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
1959 updateDayLabels(); 1975 updateDayLabels();
1960 //bool forceUpdate = !updatePossible; 1976 //bool forceUpdate = !updatePossible;
1961 updatePossible = true; 1977 updatePossible = true;
1962 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1978 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1963 //if ( forceUpdate ) 1979 //if ( forceUpdate )
1964 // updateView(); 1980 // updateView();
1965} 1981}
1982void KOMonthView::computeLayoutWeek()
1983{
1984 static int lastWid = 0;
1985 static int lastHei = 0;
1986 int tWid = topLevelWidget()->size().width();
1987 int tHei = topLevelWidget()->size().height();
1988 int wid = width();//e
1989 int hei = height()-1-mNavigatorBar->height();
1990 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1991 return;
1992
1993 if ( lastWid == width() && lastHei == height() ) {
1994 //qDebug("KOListWeekView::No compute layout needed ");
1995 return;
1996 }
1997 lastWid = width();
1998 lastHei = height();
1999 doComputeLayoutWeek();
2000}
2001int KOMonthView::mapWeekLayout( int index, bool landscape )
2002{
2003 if ( KOPrefs::instance()->mMonthViewWeekRowlayout )
2004 return index;
2005 int diff = 0;
2006 if ( !landscape ) diff = 1;
2007 switch( index ) {
2008 case 0:
2009 case 5:
2010 case 6:
2011 return index;
2012 break;
2013 case 1:
2014 return 2+diff;
2015 break;
2016 case 2:
2017 return 4-(3*diff);
2018 break;
2019 case 3:
2020 return 1+(3*diff);
2021 break;
2022 case 4:
2023 return 3-diff;
2024 break;
2025 default:
2026 qDebug("KO: Error in mapping week layout ");
2027 return index;
2028 break;
2029 }
2030 return index;
2031}
1966void KOMonthView::computeLayout() 2032void KOMonthView::computeLayout()
1967{ 2033{
1968 2034
1969 2035
1970 static int lastWid = 0; 2036 static int lastWid = 0;
1971 static int lastHei = 0; 2037 static int lastHei = 0;
1972 2038
1973 if ( mShowWeekView ){ 2039 if ( mShowWeekView ){
1974 computeLayoutWeek(); 2040 computeLayoutWeek();
1975 return; 2041 return;
1976 } 2042 }
1977 int daysToShow = 7; 2043 int daysToShow = 7;
1978 bool combinedSatSun = false; 2044 bool combinedSatSun = false;
1979 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 2045 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1980 daysToShow = 6; 2046 daysToShow = 6;
1981 combinedSatSun = true; 2047 combinedSatSun = true;
1982 } 2048 }
1983 int tWid = topLevelWidget()->size().width(); 2049 int tWid = topLevelWidget()->size().width();
1984 int tHei = topLevelWidget()->size().height(); 2050 int tHei = topLevelWidget()->size().height();
1985 2051
1986 int wid = width();//e 2052 int wid = width();//e
1987 int hei = height()-1-mNavigatorBar->height(); 2053 int hei = height()-1-mNavigatorBar->height();
1988 2054
1989 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 2055 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1990 return; 2056 return;
1991 } 2057 }
1992 if ( lastWid == width() && lastHei == height() ){ 2058 if ( lastWid == width() && lastHei == height() ){
1993 //qDebug("KOMonthview::No compute layout needed "); 2059 //qDebug("KOMonthview::No compute layout needed ");
1994 return; 2060 return;
1995 } 2061 }
1996 2062
1997 lastWid = width(); 2063 lastWid = width();
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 4d62e9b..61a141a 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -273,76 +273,78 @@ class KOMonthView: public KOEventView
273 void changeEventDisplay(Event *, int); 273 void changeEventDisplay(Event *, int);
274 274
275 void clearSelection(); 275 void clearSelection();
276 276
277 void showContextMenu( Incidence * ); 277 void showContextMenu( Incidence * );
278 278
279 void setSelectedCell( MonthViewCell * ); 279 void setSelectedCell( MonthViewCell * );
280 void setPopupCell( MonthViewCell * ); 280 void setPopupCell( MonthViewCell * );
281 void switchView(); 281 void switchView();
282 void setKeyBFocus(); 282 void setKeyBFocus();
283 283
284 protected slots: 284 protected slots:
285 void catChanged( Incidence * ); 285 void catChanged( Incidence * );
286 void setKeyBoardFocus(); 286 void setKeyBoardFocus();
287 void slotNewTodo(); 287 void slotNewTodo();
288 void slotNewEvent(); 288 void slotNewEvent();
289 void slotEditJournal(); 289 void slotEditJournal();
290 void slotComputeLayout(); 290 void slotComputeLayout();
291 void selectInternalWeekNum ( int ); 291 void selectInternalWeekNum ( int );
292 void processSelectionChange(); 292 void processSelectionChange();
293 signals: 293 signals:
294 void nextMonth(); 294 void nextMonth();
295 void prevMonth(); 295 void prevMonth();
296 void selectWeekNum ( int ); 296 void selectWeekNum ( int );
297 void selectMonth (); 297 void selectMonth ();
298 void showDaySignal( QDate ); 298 void showDaySignal( QDate );
299 void newTodoSignal( QDateTime, bool ); 299 void newTodoSignal( QDateTime, bool );
300 void showJournalSignal( int,QDate ); 300 void showJournalSignal( int,QDate );
301 protected: 301 protected:
302 void resizeEvent(QResizeEvent *); 302 void resizeEvent(QResizeEvent *);
303 void viewChanged(); 303 void viewChanged();
304 void updateDayLabels(); 304 void updateDayLabels();
305 int mapWeekLayout( int, bool );
305 306
306 private: 307 private:
307 int mKBFcounter; 308 int mKBFcounter;
308 QTimer* mComputeLayoutTimer; 309 QTimer* mComputeLayoutTimer;
309 NavigatorBar* mNavigatorBar; 310 NavigatorBar* mNavigatorBar;
310 int currentWeek(); 311 int currentWeek();
311 bool clPending; 312 bool clPending;
312 QWidgetStack * mWidStack; 313 QWidgetStack * mWidStack;
313 QWidget* mMonthView; 314 QWidget* mMonthView;
314 QWidget* mWeekView; 315 QWidget* mWeekView;
315 bool mShowWeekView; 316 bool mShowWeekView;
316 bool updatePossible; 317 bool updatePossible;
317 int mDaysPerWeek; 318 int mDaysPerWeek;
318 int mNumWeeks; 319 int mNumWeeks;
319 int mNumCells; 320 int mNumCells;
320 //bool mWeekStartsMonday; 321 //bool mWeekStartsMonday;
321 bool mShowSatSunComp; 322 bool mShowSatSunComp;
322 void computeLayout(); 323 void computeLayout();
323 void computeLayoutWeek(); 324 void computeLayoutWeek();
325 void doComputeLayoutWeek();
324 326
325 QPtrVector<MonthViewCell> mCells; 327 QPtrVector<MonthViewCell> mCells;
326 QPtrVector<QLabel> mDayLabels; 328 QPtrVector<QLabel> mDayLabels;
327 QPtrVector<KOWeekButton> mWeekLabels; 329 QPtrVector<KOWeekButton> mWeekLabels;
328 QPtrVector<MonthViewCell> mCellsW; 330 QPtrVector<MonthViewCell> mCellsW;
329 QPtrVector<QLabel> mDayLabelsW; 331 QPtrVector<QLabel> mDayLabelsW;
330 QPtrVector<KOWeekButton> mWeekLabelsW; 332 QPtrVector<KOWeekButton> mWeekLabelsW;
331 333
332 bool mShortDayLabelsM; 334 bool mShortDayLabelsM;
333 bool mShortDayLabelsW; 335 bool mShortDayLabelsW;
334 int mWidthLongDayLabel; 336 int mWidthLongDayLabel;
335 337
336 QDate mStartDate; 338 QDate mStartDate;
337 339
338 MonthViewCell *mSelectedCell; 340 MonthViewCell *mSelectedCell;
339 MonthViewCell *mPopupCell; 341 MonthViewCell *mPopupCell;
340 bool mFlagKeyPressed; 342 bool mFlagKeyPressed;
341 KOEventPopupMenu *mContextMenu; 343 KOEventPopupMenu *mContextMenu;
342 QPopupMenu *mNewItemMenu; 344 QPopupMenu *mNewItemMenu;
343 void keyPressEvent ( QKeyEvent * ) ; 345 void keyPressEvent ( QKeyEvent * ) ;
344 void keyReleaseEvent ( QKeyEvent * ) ; 346 void keyReleaseEvent ( QKeyEvent * ) ;
345 347
346}; 348};
347 349
348#endif 350#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a63297e..9e7f18c 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -235,64 +235,65 @@ KOPrefs::KOPrefs() :
235 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 235 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
236 addItemInt("Hour Size",&mHourSize,8); 236 addItemInt("Hour Size",&mHourSize,8);
237 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 237 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
238 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 238 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
239 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 239 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
240 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 240 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
241 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 241 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
242 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 242 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
243 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); 243 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
244#ifdef DESKTOP_VERION 244#ifdef DESKTOP_VERION
245 addItemBool("Enable ToolTips",&mEnableToolTips,true); 245 addItemBool("Enable ToolTips",&mEnableToolTips,true);
246#else 246#else
247 addItemBool("Enable ToolTips",&mEnableToolTips,false); 247 addItemBool("Enable ToolTips",&mEnableToolTips,false);
248#endif 248#endif
249 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 249 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
250 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 250 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
251 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 251 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
252 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 252 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
253 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 253 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
254 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 254 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
255 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 255 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
256 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 256 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
257 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 257 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
258 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 258 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
259 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 259 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
260 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 260 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
261 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 261 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
262 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 262 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
263 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 263 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
264 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 264 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
265 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 265 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
266 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 266 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
267 addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,true);
267 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 268 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
268 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 269 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
269#ifdef DESKTOP_VERSION 270#ifdef DESKTOP_VERSION
270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 271 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
271#else 272#else
272 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 273 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
273#endif 274#endif
274 addItemInt("Day Begins",&mDayBegins,7); 275 addItemInt("Day Begins",&mDayBegins,7);
275 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 276 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
276 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 277 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
277 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 278 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
278 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 279 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
279 280
280 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 281 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
281 addItemBool("Full View Month",&mFullViewMonth,true); 282 addItemBool("Full View Month",&mFullViewMonth,true);
282 addItemBool("Full View Todo",&mFullViewTodo,true); 283 addItemBool("Full View Todo",&mFullViewTodo,true);
283 addItemBool("Quick Todo",&mEnableQuickTodo,false); 284 addItemBool("Quick Todo",&mEnableQuickTodo,false);
284 285
285 addItemInt("Next X Days",&mNextXDays,3); 286 addItemInt("Next X Days",&mNextXDays,3);
286 287
287 KPrefs::setCurrentGroup("Printer"); 288 KPrefs::setCurrentGroup("Printer");
288 289
289 KPrefs::setCurrentGroup("Layout"); 290 KPrefs::setCurrentGroup("Layout");
290 291
291 addItemBool("CompactDialogs",&mCompactDialogs,false); 292 addItemBool("CompactDialogs",&mCompactDialogs,false);
292 addItemBool("VerticalScreen",&mVerticalScreen,true); 293 addItemBool("VerticalScreen",&mVerticalScreen,true);
293 294
294 KPrefs::setCurrentGroup("KOrganizer Plugins"); 295 KPrefs::setCurrentGroup("KOrganizer Plugins");
295 296
296 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 297 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
297 298
298 KPrefs::setCurrentGroup("Group Scheduling"); 299 KPrefs::setCurrentGroup("Group Scheduling");
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 392360d..2ff03fa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -154,64 +154,65 @@ class KOPrefs : public KPimPrefs
154 154
155 QFont mTimeBarFont; 155 QFont mTimeBarFont;
156 QFont mMonthViewFont; 156 QFont mMonthViewFont;
157 QFont mAgendaViewFont; 157 QFont mAgendaViewFont;
158 QFont mMarcusBainsFont; 158 QFont mMarcusBainsFont;
159 QFont mTimeLabelsFont; 159 QFont mTimeLabelsFont;
160 QFont mTodoViewFont; 160 QFont mTodoViewFont;
161 QFont mListViewFont; 161 QFont mListViewFont;
162 QFont mDateNavigatorFont; 162 QFont mDateNavigatorFont;
163 QFont mEditBoxFont; 163 QFont mEditBoxFont;
164 QFont mJornalViewFont; 164 QFont mJornalViewFont;
165 QFont mWhatsNextFont; 165 QFont mWhatsNextFont;
166 QFont mEventViewFont; 166 QFont mEventViewFont;
167 167
168 168
169 169
170 170
171 QColor mHolidayColor; 171 QColor mHolidayColor;
172 QColor mHighlightColor; 172 QColor mHighlightColor;
173 QColor mEventColor; 173 QColor mEventColor;
174 QColor mTodoDoneColor; 174 QColor mTodoDoneColor;
175 QColor mAgendaBgColor; 175 QColor mAgendaBgColor;
176 QColor mWorkingHoursColor; 176 QColor mWorkingHoursColor;
177 QColor mTodoDueTodayColor; 177 QColor mTodoDueTodayColor;
178 QColor mTodoOverdueColor; 178 QColor mTodoOverdueColor;
179 QColor mTodoRunColor; 179 QColor mTodoRunColor;
180 QColor mMonthViewEvenColor; 180 QColor mMonthViewEvenColor;
181 QColor mMonthViewOddColor; 181 QColor mMonthViewOddColor;
182 QColor mMonthViewHolidayColor; 182 QColor mMonthViewHolidayColor;
183 bool mMonthViewUsesDayColors; 183 bool mMonthViewUsesDayColors;
184 bool mMonthViewSatSunTog; 184 bool mMonthViewSatSunTog;
185 bool mMonthViewWeek; 185 bool mMonthViewWeek;
186 bool mMonthViewWeekRowlayout;
186 QColor mAppColor1; 187 QColor mAppColor1;
187 QColor mAppColor2; 188 QColor mAppColor2;
188 bool mUseAppColors; 189 bool mUseAppColors;
189 190
190 int mDayBegins; 191 int mDayBegins;
191 int mHourSize; 192 int mHourSize;
192 int mAllDaySize; 193 int mAllDaySize;
193 bool mShowFullMenu; 194 bool mShowFullMenu;
194 bool mDailyRecur; 195 bool mDailyRecur;
195 bool mWeeklyRecur; 196 bool mWeeklyRecur;
196 bool mMonthDailyRecur; 197 bool mMonthDailyRecur;
197 bool mMonthWeeklyRecur; 198 bool mMonthWeeklyRecur;
198 bool mMonthShowIcons; 199 bool mMonthShowIcons;
199 bool mMonthShowTimes; 200 bool mMonthShowTimes;
200 bool mMonthShowShort; 201 bool mMonthShowShort;
201 bool mEnableToolTips; 202 bool mEnableToolTips;
202 bool mEnableMonthScroll; 203 bool mEnableMonthScroll;
203 bool mFullViewMonth; 204 bool mFullViewMonth;
204 bool mMonthViewUsesCategoryColor; 205 bool mMonthViewUsesCategoryColor;
205 bool mFullViewTodo; 206 bool mFullViewTodo;
206 bool mShowCompletedTodo; 207 bool mShowCompletedTodo;
207 bool mMarcusBainsEnabled; 208 bool mMarcusBainsEnabled;
208 int mNextXDays; 209 int mNextXDays;
209 int mWhatsNextDays; 210 int mWhatsNextDays;
210 int mWhatsNextPrios; 211 int mWhatsNextPrios;
211 bool mEnableQuickTodo; 212 bool mEnableQuickTodo;
212 213
213 bool mCompactDialogs; 214 bool mCompactDialogs;
214 bool mVerticalScreen; 215 bool mVerticalScreen;
215 216
216 bool mShowIconNewTodo; 217 bool mShowIconNewTodo;
217 bool mShowIconNewEvent; 218 bool mShowIconNewEvent;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index ebcff33..05bd73f 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -674,64 +674,68 @@ void KOPrefsDialog::setupViewsTab()
674 674
675 habo = new QHBox( topFrame ); 675 habo = new QHBox( topFrame );
676 if ( QApplication::desktop()->width() <= 480 ) { 676 if ( QApplication::desktop()->width() <= 480 ) {
677 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 677 lab = new QLabel (i18n("Show in every cell ") , topFrame );
678 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 678 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
679 ii++; 679 ii++;
680 680
681 } else { 681 } else {
682 new QLabel ( i18n("Show in every cell "), habo ); 682 new QLabel ( i18n("Show in every cell "), habo );
683 } 683 }
684 weeklyRecur = 684 weeklyRecur =
685 addWidBool(i18n("short month"), 685 addWidBool(i18n("short month"),
686 &(KOPrefs::instance()->mMonthShowShort),habo); 686 &(KOPrefs::instance()->mMonthShowShort),habo);
687 weeklyRecur = 687 weeklyRecur =
688 addWidBool(i18n("icons"), 688 addWidBool(i18n("icons"),
689 &(KOPrefs::instance()->mMonthShowIcons),habo); 689 &(KOPrefs::instance()->mMonthShowIcons),habo);
690 weeklyRecur = 690 weeklyRecur =
691 addWidBool(i18n("times"), 691 addWidBool(i18n("times"),
692 &(KOPrefs::instance()->mMonthShowTimes),habo); 692 &(KOPrefs::instance()->mMonthShowTimes),habo);
693 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 693 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
694 ii++; 694 ii++;
695#ifdef DESKTOP_VERSION 695#ifdef DESKTOP_VERSION
696 KPrefsDialogWidBool *enableMonthScroll = 696 KPrefsDialogWidBool *enableMonthScroll =
697 addWidBool(i18n("Enable scrollbars in month view cells"), 697 addWidBool(i18n("Enable scrollbars in month view cells"),
698 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 698 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
699 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 699 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
700#endif 700#endif
701 dummy = 701 dummy =
702 addWidBool(i18n("Week view mode uses bigger font"), 702 addWidBool(i18n("Week view mode uses bigger font"),
703 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 703 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
704 topLayout->addWidget(dummy->checkBox(),ii++,0); 704 topLayout->addWidget(dummy->checkBox(),ii++,0);
705 dummy = 705 dummy =
706 addWidBool(i18n("Week view mode uses row layout"),
707 &(KOPrefs::instance()->mMonthViewWeekRowlayout),topFrame);
708 topLayout->addWidget(dummy->checkBox(),ii++,0);
709 dummy =
706 addWidBool(i18n("Show Sat/Sun together"), 710 addWidBool(i18n("Show Sat/Sun together"),
707 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 711 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
708 topLayout->addWidget(dummy->checkBox(),ii++,0); 712 topLayout->addWidget(dummy->checkBox(),ii++,0);
709 713
710 KPrefsDialogWidBool *coloredCategoriesInMonthView = 714 KPrefsDialogWidBool *coloredCategoriesInMonthView =
711 addWidBool(i18n("Month view uses category colors"), 715 addWidBool(i18n("Month view uses category colors"),
712 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 716 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
713 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 717 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
714 718
715 dummy = 719 dummy =
716 addWidBool(i18n("Category colors are applied to text"), 720 addWidBool(i18n("Category colors are applied to text"),
717 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 721 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
718 topLayout->addWidget(dummy->checkBox(),ii++,0); 722 topLayout->addWidget(dummy->checkBox(),ii++,0);
719 723
720 724
721 725
722 if ( QApplication::desktop()->height() <= 240 ) { 726 if ( QApplication::desktop()->height() <= 240 ) {
723 topFrame = addPage(i18n("Month View") +" 2",0,0); 727 topFrame = addPage(i18n("Month View") +" 2",0,0);
724 topLayout = new QGridLayout(topFrame,4,1); 728 topLayout = new QGridLayout(topFrame,4,1);
725 topLayout->setSpacing(2); 729 topLayout->setSpacing(2);
726 topLayout->setMargin(1); 730 topLayout->setMargin(1);
727 ii = 0; 731 ii = 0;
728 } 732 }
729 733
730 734
731 coloredCategoriesInMonthView = 735 coloredCategoriesInMonthView =
732 addWidBool(i18n("Month view uses day colors"), 736 addWidBool(i18n("Month view uses day colors"),
733 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 737 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
734 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 738 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
735 739
736 KPrefsDialogWidColor *holidayColor = 740 KPrefsDialogWidColor *holidayColor =
737 addWidColor(i18n("Day color odd months"), 741 addWidColor(i18n("Day color odd months"),