-rw-r--r-- | korganizer/calendarview.cpp | 22 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 89 | ||||
-rw-r--r-- | korganizer/komonthview.h | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 6 |
5 files changed, 85 insertions, 42 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 12af655..f9af769 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -220,32 +220,33 @@ CalendarView::CalendarView( CalendarResources *calendar, | |||
220 | init(); | 220 | init(); |
221 | } | 221 | } |
222 | 222 | ||
223 | CalendarView::CalendarView( Calendar *calendar, | 223 | CalendarView::CalendarView( Calendar *calendar, |
224 | QWidget *parent, const char *name ) | 224 | QWidget *parent, const char *name ) |
225 | : CalendarViewBase( parent, name ), | 225 | : CalendarViewBase( parent, name ), |
226 | mCalendar( calendar ), | 226 | mCalendar( calendar ), |
227 | mResourceManager( 0 ) | 227 | mResourceManager( 0 ) |
228 | { | 228 | { |
229 | 229 | ||
230 | mEventEditor = 0; | 230 | mEventEditor = 0; |
231 | mTodoEditor = 0; | 231 | mTodoEditor = 0; |
232 | init();} | 232 | init();} |
233 | 233 | ||
234 | void CalendarView::init() | 234 | void CalendarView::init() |
235 | { | 235 | { |
236 | mBlockShowDates = false; | ||
236 | beamDialog = new KOBeamPrefs(); | 237 | beamDialog = new KOBeamPrefs(); |
237 | mDatePickerMode = 0; | 238 | mDatePickerMode = 0; |
238 | mCurrentSyncDevice = ""; | 239 | mCurrentSyncDevice = ""; |
239 | writeLocale(); | 240 | writeLocale(); |
240 | mViewManager = new KOViewManager( this ); | 241 | mViewManager = new KOViewManager( this ); |
241 | mDialogManager = new KODialogManager( this ); | 242 | mDialogManager = new KODialogManager( this ); |
242 | mEventViewerDialog = 0; | 243 | mEventViewerDialog = 0; |
243 | mModified = false; | 244 | mModified = false; |
244 | mReadOnly = false; | 245 | mReadOnly = false; |
245 | mSelectedIncidence = 0; | 246 | mSelectedIncidence = 0; |
246 | mCalPrinter = 0; | 247 | mCalPrinter = 0; |
247 | mFilters.setAutoDelete(true); | 248 | mFilters.setAutoDelete(true); |
248 | 249 | ||
249 | mCalendar->registerObserver( this ); | 250 | mCalendar->registerObserver( this ); |
250 | // TODO: Make sure that view is updated, when calendar is changed. | 251 | // TODO: Make sure that view is updated, when calendar is changed. |
251 | 252 | ||
@@ -333,47 +334,47 @@ void CalendarView::init() | |||
333 | 334 | ||
334 | mLeftFrame = leftFrame; | 335 | mLeftFrame = leftFrame; |
335 | if ( KOPrefs::instance()->mVerticalScreen ) { | 336 | if ( KOPrefs::instance()->mVerticalScreen ) { |
336 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 337 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
337 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 338 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
338 | } else { | 339 | } else { |
339 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 340 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
340 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 341 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
341 | } | 342 | } |
342 | if ( !KOPrefs::instance()->mShowDateNavigator) | 343 | if ( !KOPrefs::instance()->mShowDateNavigator) |
343 | mDateNavigator->hide(); | 344 | mDateNavigator->hide(); |
344 | //qDebug("Calendarview Size %d %d ", width(), height()); | 345 | //qDebug("Calendarview Size %d %d ", width(), height()); |
345 | #endif | 346 | #endif |
346 | 347 | ||
347 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 348 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
348 | SLOT( showDates( const KCal::DateList & ) ) ); | 349 | SLOT( showDates( const KCal::DateList & ) ) ); |
350 | |||
349 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 351 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
350 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 352 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
351 | |||
352 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
353 | mNavigator, SLOT( selectPreviousYear() ) ); | 354 | mNavigator, SLOT( selectPreviousYear() ) ); |
354 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
355 | mNavigator, SLOT( selectNextYear() ) ); | 356 | mNavigator, SLOT( selectNextYear() ) ); |
356 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 357 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
357 | mNavigator, SLOT( selectPreviousMonth() ) ); | 358 | mNavigator, SLOT( selectPreviousMonth() ) ); |
358 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 359 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
359 | mNavigator, SLOT( selectNextMonth() ) ); | 360 | mNavigator, SLOT( selectNextMonth() ) ); |
360 | 361 | ||
361 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 362 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
362 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 363 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
363 | 364 | ||
364 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 365 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
365 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 366 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
366 | 367 | ||
367 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
368 | mNavigator, SLOT( selectPreviousYear() ) ); | 369 | mNavigator, SLOT( selectPreviousYear() ) ); |
369 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 370 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
370 | mNavigator, SLOT( selectNextYear() ) ); | 371 | mNavigator, SLOT( selectNextYear() ) ); |
371 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 372 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
372 | mNavigator, SLOT( selectPreviousMonth() ) ); | 373 | mNavigator, SLOT( selectPreviousMonth() ) ); |
373 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 374 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
374 | mNavigator, SLOT( selectNextMonth() ) ); | 375 | mNavigator, SLOT( selectNextMonth() ) ); |
375 | 376 | ||
376 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 377 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
377 | mNavigator, SLOT( selectPrevious() ) ); | 378 | mNavigator, SLOT( selectPrevious() ) ); |
378 | connect( mDateNavigator, SIGNAL( goNext() ), | 379 | connect( mDateNavigator, SIGNAL( goNext() ), |
379 | mNavigator, SLOT( selectNext() ) ); | 380 | mNavigator, SLOT( selectNext() ) ); |
@@ -484,33 +485,35 @@ void CalendarView::init() | |||
484 | 485 | ||
485 | 486 | ||
486 | CalendarView::~CalendarView() | 487 | CalendarView::~CalendarView() |
487 | { | 488 | { |
488 | // kdDebug() << "~CalendarView()" << endl; | 489 | // kdDebug() << "~CalendarView()" << endl; |
489 | //qDebug("CalendarView::~CalendarView() "); | 490 | //qDebug("CalendarView::~CalendarView() "); |
490 | delete mDialogManager; | 491 | delete mDialogManager; |
491 | delete mViewManager; | 492 | delete mViewManager; |
492 | delete mStorage; | 493 | delete mStorage; |
493 | delete mDateFrame ; | 494 | delete mDateFrame ; |
494 | delete beamDialog; | 495 | delete beamDialog; |
495 | //kdDebug() << "~CalendarView() done" << endl; | 496 | //kdDebug() << "~CalendarView() done" << endl; |
496 | } | 497 | } |
497 | 498 | ||
498 | void CalendarView::showDay( QDate d ) | 499 | void CalendarView::showDay( QDate d ) |
499 | { | 500 | { |
501 | dateNavigator()->blockSignals( true ); | ||
500 | dateNavigator()->selectDate( d ); | 502 | dateNavigator()->selectDate( d ); |
503 | dateNavigator()->blockSignals( false ); | ||
501 | mViewManager->showWeekView(); | 504 | mViewManager->showWeekView(); |
502 | dateNavigator()->selectDate( d ); | 505 | dateNavigator()->selectDate( d ); |
503 | } | 506 | } |
504 | void CalendarView::timerAlarm() | 507 | void CalendarView::timerAlarm() |
505 | { | 508 | { |
506 | //qDebug("CalendarView::timerAlarm() "); | 509 | //qDebug("CalendarView::timerAlarm() "); |
507 | computeAlarm(mAlarmNotification ); | 510 | computeAlarm(mAlarmNotification ); |
508 | } | 511 | } |
509 | 512 | ||
510 | void CalendarView::suspendAlarm() | 513 | void CalendarView::suspendAlarm() |
511 | { | 514 | { |
512 | //qDebug(" CalendarView::suspendAlarm() "); | 515 | //qDebug(" CalendarView::suspendAlarm() "); |
513 | computeAlarm(mSuspendAlarmNotification ); | 516 | computeAlarm(mSuspendAlarmNotification ); |
514 | 517 | ||
515 | } | 518 | } |
516 | 519 | ||
@@ -659,33 +662,35 @@ void CalendarView::recheckTimerAlarm() | |||
659 | mRecheckAlarmTimer->stop(); | 662 | mRecheckAlarmTimer->stop(); |
660 | mCalendar->checkAlarmForIncidence( 0, true ); | 663 | mCalendar->checkAlarmForIncidence( 0, true ); |
661 | } | 664 | } |
662 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 665 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
663 | { | 666 | { |
664 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 667 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
665 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 668 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
666 | #ifndef DESKTOP_VERSION | 669 | #ifndef DESKTOP_VERSION |
667 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 670 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
668 | #endif | 671 | #endif |
669 | return; | 672 | return; |
670 | } | 673 | } |
671 | mAlarmTimer->stop(); | 674 | mAlarmTimer->stop(); |
672 | } | 675 | } |
673 | void CalendarView::selectWeekNum ( int num ) | 676 | void CalendarView::selectWeekNum ( int num ) |
674 | { | 677 | { |
678 | dateNavigator()->blockSignals( true ); | ||
675 | dateNavigator()->selectWeek( num ); | 679 | dateNavigator()->selectWeek( num ); |
680 | dateNavigator()->blockSignals( false ); | ||
676 | mViewManager->showWeekView(); | 681 | mViewManager->showWeekView(); |
677 | } | 682 | } |
678 | KOViewManager *CalendarView::viewManager() | 683 | KOViewManager *CalendarView::viewManager() |
679 | { | 684 | { |
680 | return mViewManager; | 685 | return mViewManager; |
681 | } | 686 | } |
682 | 687 | ||
683 | KODialogManager *CalendarView::dialogManager() | 688 | KODialogManager *CalendarView::dialogManager() |
684 | { | 689 | { |
685 | return mDialogManager; | 690 | return mDialogManager; |
686 | } | 691 | } |
687 | 692 | ||
688 | QDate CalendarView::startDate() | 693 | QDate CalendarView::startDate() |
689 | { | 694 | { |
690 | DateList dates = mNavigator->selectedDates(); | 695 | DateList dates = mNavigator->selectedDates(); |
691 | 696 | ||
@@ -3452,36 +3457,39 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3452 | 3457 | ||
3453 | void CalendarView::checkClipboard() | 3458 | void CalendarView::checkClipboard() |
3454 | { | 3459 | { |
3455 | #ifndef KORG_NODND | 3460 | #ifndef KORG_NODND |
3456 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3461 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3457 | emit pasteEnabled(true); | 3462 | emit pasteEnabled(true); |
3458 | } else { | 3463 | } else { |
3459 | emit pasteEnabled(false); | 3464 | emit pasteEnabled(false); |
3460 | } | 3465 | } |
3461 | #endif | 3466 | #endif |
3462 | } | 3467 | } |
3463 | 3468 | ||
3464 | void CalendarView::showDates(const DateList &selectedDates) | 3469 | void CalendarView::showDates(const DateList &selectedDates) |
3465 | { | 3470 | { |
3466 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3471 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3467 | 3472 | ||
3468 | if ( mViewManager->currentView() ) { | 3473 | |
3469 | updateView( selectedDates.first(), selectedDates.last() ); | 3474 | if ( !mBlockShowDates ) { |
3470 | } else { | 3475 | if ( mViewManager->currentView() ) { |
3471 | mViewManager->showAgendaView(); | 3476 | updateView( selectedDates.first(), selectedDates.last() ); |
3477 | } else { | ||
3478 | mViewManager->showAgendaView(); | ||
3479 | } | ||
3472 | } | 3480 | } |
3473 | 3481 | ||
3474 | QString selDates; | 3482 | QString selDates; |
3475 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3483 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); |
3476 | if (selectedDates.first() < selectedDates.last() ) | 3484 | if (selectedDates.first() < selectedDates.last() ) |
3477 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3485 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3478 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3486 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3479 | 3487 | ||
3480 | } | 3488 | } |
3481 | 3489 | ||
3482 | QPtrList<CalFilter> CalendarView::filters() | 3490 | QPtrList<CalFilter> CalendarView::filters() |
3483 | { | 3491 | { |
3484 | return mFilters; | 3492 | return mFilters; |
3485 | 3493 | ||
3486 | } | 3494 | } |
3487 | void CalendarView::editFilters() | 3495 | void CalendarView::editFilters() |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 646973d..e27da9a 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -467,43 +467,45 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
467 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 467 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
468 | 468 | ||
469 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 469 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
470 | virtual void removeSyncInfo( QString syncProfile); | 470 | virtual void removeSyncInfo( QString syncProfile); |
471 | void setSyncManager(KSyncManager* manager); | 471 | void setSyncManager(KSyncManager* manager); |
472 | void setLoadedFileVersion(QDateTime); | 472 | void setLoadedFileVersion(QDateTime); |
473 | bool checkFileVersion(QString fn); | 473 | bool checkFileVersion(QString fn); |
474 | bool checkFileChanged(QString fn); | 474 | bool checkFileChanged(QString fn); |
475 | Event* getLastSyncEvent(); | 475 | Event* getLastSyncEvent(); |
476 | /** Adapt navigation units correpsonding to step size of navigation of the | 476 | /** Adapt navigation units correpsonding to step size of navigation of the |
477 | * current view. | 477 | * current view. |
478 | */ | 478 | */ |
479 | void adaptNavigationUnits(); | 479 | void adaptNavigationUnits(); |
480 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 480 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
481 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 481 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
482 | //Attendee* getYourAttendee(Event *event); | 482 | //Attendee* getYourAttendee(Event *event); |
483 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | ||
483 | protected: | 484 | protected: |
484 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 485 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
485 | 486 | ||
486 | // returns KMsgBox::OKCandel() | 487 | // returns KMsgBox::OKCandel() |
487 | int msgItemDelete(); | 488 | int msgItemDelete(); |
488 | void showEventEditor(); | 489 | void showEventEditor(); |
489 | void showTodoEditor(); | 490 | void showTodoEditor(); |
490 | void writeLocale(); | 491 | void writeLocale(); |
491 | Todo *selectedTodo(); | 492 | Todo *selectedTodo(); |
492 | 493 | ||
493 | private: | 494 | private: |
495 | bool mBlockShowDates; | ||
494 | KSyncManager* mSyncManager; | 496 | KSyncManager* mSyncManager; |
495 | AlarmDialog * mAlarmDialog; | 497 | AlarmDialog * mAlarmDialog; |
496 | QString mAlarmNotification; | 498 | QString mAlarmNotification; |
497 | QString mSuspendAlarmNotification; | 499 | QString mSuspendAlarmNotification; |
498 | QTimer* mSuspendTimer; | 500 | QTimer* mSuspendTimer; |
499 | QTimer* mAlarmTimer; | 501 | QTimer* mAlarmTimer; |
500 | QTimer* mRecheckAlarmTimer; | 502 | QTimer* mRecheckAlarmTimer; |
501 | void computeAlarm( QString ); | 503 | void computeAlarm( QString ); |
502 | void startAlarm( QString, QString ); | 504 | void startAlarm( QString, QString ); |
503 | void setSyncEventsReadOnly(); | 505 | void setSyncEventsReadOnly(); |
504 | 506 | ||
505 | QDateTime loadedFileVersion; | 507 | QDateTime loadedFileVersion; |
506 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 508 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
507 | void checkExternalId( Incidence * inc ); | 509 | void checkExternalId( Incidence * inc ); |
508 | int mGlobalSyncMode; | 510 | int mGlobalSyncMode; |
509 | QString mCurrentSyncDevice; | 511 | QString mCurrentSyncDevice; |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9344567..842f6eb 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -66,35 +66,38 @@ protected: | |||
66 | virtual QString text( const QPoint& p) | 66 | virtual QString text( const QPoint& p) |
67 | { | 67 | { |
68 | return _wid->getWhatsThisText(p) ; | 68 | return _wid->getWhatsThisText(p) ; |
69 | }; | 69 | }; |
70 | private: | 70 | private: |
71 | KNoScrollListBox* _wid; | 71 | KNoScrollListBox* _wid; |
72 | 72 | ||
73 | }; | 73 | }; |
74 | 74 | ||
75 | 75 | ||
76 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 76 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
77 | : QListBox(parent, name) | 77 | : QListBox(parent, name) |
78 | { | 78 | { |
79 | #ifndef DESKTOP_VERSION | 79 | #ifndef DESKTOP_VERSION |
80 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 80 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
81 | #endif | 81 | #endif |
82 | new KNOWhatsThis(this); | 82 | mWT = new KNOWhatsThis(this); |
83 | } | ||
84 | KNoScrollListBox::~KNoScrollListBox() | ||
85 | { | ||
86 | delete mWT; | ||
83 | } | 87 | } |
84 | |||
85 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 88 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
86 | { | 89 | { |
87 | QListBoxItem* item = itemAt ( p ); | 90 | QListBoxItem* item = itemAt ( p ); |
88 | if ( ! item ) { | 91 | if ( ! item ) { |
89 | return i18n("Click in the cell\nto add an event!"); | 92 | return i18n("Click in the cell\nto add an event!"); |
90 | } | 93 | } |
91 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 94 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
92 | } | 95 | } |
93 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 96 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
94 | { | 97 | { |
95 | 98 | ||
96 | switch(e->key()) { | 99 | switch(e->key()) { |
97 | case Key_Right: | 100 | case Key_Right: |
98 | // if ( e->state() == Qt::ControlButton ) | 101 | // if ( e->state() == Qt::ControlButton ) |
99 | { | 102 | { |
100 | e->ignore(); | 103 | e->ignore(); |
@@ -295,46 +298,35 @@ MonthViewCell::MonthViewCell( KOMonthView *parent) | |||
295 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 298 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
296 | SLOT( cellClicked( QListBoxItem * ) ) ); | 299 | SLOT( cellClicked( QListBoxItem * ) ) ); |
297 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 300 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
298 | SLOT( selection( QListBoxItem * ) ) ); | 301 | SLOT( selection( QListBoxItem * ) ) ); |
299 | } | 302 | } |
300 | #ifdef DESKTOP_VERSION | 303 | #ifdef DESKTOP_VERSION |
301 | QToolTipGroup *MonthViewCell::toolTipGroup() | 304 | QToolTipGroup *MonthViewCell::toolTipGroup() |
302 | { | 305 | { |
303 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 306 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
304 | return mToolTipGroup; | 307 | return mToolTipGroup; |
305 | } | 308 | } |
306 | #endif | 309 | #endif |
307 | 310 | ||
308 | void MonthViewCell::setDate( const QDate &date ) | 311 | void MonthViewCell::setDate( const QDate &date ) |
309 | { | 312 | { |
310 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 313 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
311 | |||
312 | mDate = date; | 314 | mDate = date; |
313 | 315 | ||
314 | QString text; | 316 | |
315 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | ||
316 | if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | ||
317 | text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; | ||
318 | mLabel->resize( mLabelBigSize ); | ||
319 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | ||
320 | } else { | ||
321 | mLabel->resize( mLabelSize ); | ||
322 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | ||
323 | } | ||
324 | mLabel->setText( text ); | ||
325 | 317 | ||
326 | //resizeEvent( 0 ); | 318 | //resizeEvent( 0 ); |
327 | } | 319 | } |
328 | 320 | ||
329 | QDate MonthViewCell::date() const | 321 | QDate MonthViewCell::date() const |
330 | { | 322 | { |
331 | return mDate; | 323 | return mDate; |
332 | } | 324 | } |
333 | 325 | ||
334 | void MonthViewCell::setPrimary( bool primary ) | 326 | void MonthViewCell::setPrimary( bool primary ) |
335 | { | 327 | { |
336 | mPrimary = primary; | 328 | mPrimary = primary; |
337 | //setMyPalette(); | 329 | //setMyPalette(); |
338 | } | 330 | } |
339 | void MonthViewCell::setMyPalette() | 331 | void MonthViewCell::setMyPalette() |
340 | { | 332 | { |
@@ -379,56 +371,72 @@ void MonthViewCell::setHoliday( bool holiday ) | |||
379 | void MonthViewCell::setHoliday( const QString &holiday ) | 371 | void MonthViewCell::setHoliday( const QString &holiday ) |
380 | { | 372 | { |
381 | mHolidayString = holiday; | 373 | mHolidayString = holiday; |
382 | 374 | ||
383 | if ( !holiday.isEmpty() ) { | 375 | if ( !holiday.isEmpty() ) { |
384 | setHoliday( true ); | 376 | setHoliday( true ); |
385 | } | 377 | } |
386 | } | 378 | } |
387 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 379 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
388 | { | 380 | { |
389 | 381 | ||
390 | e->ignore(); | 382 | e->ignore(); |
391 | 383 | ||
392 | } | 384 | } |
393 | void MonthViewCell::updateCell() | 385 | void MonthViewCell::updateCell() |
394 | { | 386 | { |
395 | 387 | if ( !mMonthView->isUpdatePossible() ) | |
388 | return; | ||
389 | if ( !isVisible() ){ | ||
390 | return; | ||
391 | } | ||
396 | setPrimary( mDate.month()%2 ); | 392 | setPrimary( mDate.month()%2 ); |
397 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 393 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
398 | if ( mDate == QDate::currentDate() ) { | 394 | if ( mDate == QDate::currentDate() ) { |
399 | mItemList->setLineWidth( 3 ); | 395 | mItemList->setLineWidth( 3 ); |
400 | } else { | 396 | } else { |
401 | mItemList->setLineWidth( 1 ); | 397 | mItemList->setLineWidth( 1 ); |
402 | } | 398 | } |
403 | mItemList->clear(); | 399 | mItemList->clear(); |
400 | |||
401 | |||
402 | |||
404 | #ifdef DESKTOP_VERSION | 403 | #ifdef DESKTOP_VERSION |
405 | QToolTip::remove(this); | 404 | QToolTip::remove(this); |
406 | #endif | 405 | #endif |
407 | QString tipText(""); | 406 | QString tipText(""); |
408 | //qApp->processEvents(); | 407 | //qApp->processEvents(); |
409 | if ( !mHolidayString.isEmpty() ) { | 408 | if ( !mHolidayString.isEmpty() ) { |
410 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 409 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
411 | item->setPalette( mHolidayPalette ); | 410 | item->setPalette( mHolidayPalette ); |
412 | mItemList->insertItem( item ); | 411 | mItemList->insertItem( item ); |
413 | tipText += mHolidayString+"\n"; | 412 | tipText += mHolidayString+"\n"; |
414 | } | 413 | } |
415 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 414 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
416 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 415 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
417 | Event *event; | 416 | Event *event; |
418 | for( event = events.first(); event; event = events.next() ) { | 417 | for( event = events.first(); event; event = events.next() ) { // for event |
418 | |||
419 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | ||
420 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | ||
421 | continue; | ||
422 | else | ||
423 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | ||
424 | continue; | ||
425 | } | ||
426 | |||
419 | if ( event->categories().contains("Holiday") || | 427 | if ( event->categories().contains("Holiday") || |
420 | event->categories().contains(i18n("Holiday"))) { | 428 | event->categories().contains(i18n("Holiday"))) { |
421 | setHoliday( true ); | 429 | setHoliday( true ); |
422 | if ( mDate.dayOfWeek() == 7 ) | 430 | if ( mDate.dayOfWeek() == 7 ) |
423 | mItemList->setLineWidth( 3 ); | 431 | mItemList->setLineWidth( 3 ); |
424 | } | 432 | } |
425 | QString text; | 433 | QString text; |
426 | if (event->isMultiDay()) { | 434 | if (event->isMultiDay()) { |
427 | QString prefix = "<->"; | 435 | QString prefix = "<->"; |
428 | if ( event->doesRecur() ) { | 436 | if ( event->doesRecur() ) { |
429 | if ( event->recursOn( mDate) ) | 437 | if ( event->recursOn( mDate) ) |
430 | prefix ="->" ; | 438 | prefix ="->" ; |
431 | else { | 439 | else { |
432 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 440 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
433 | if ( event->recursOn( mDate.addDays( -days)) ) | 441 | if ( event->recursOn( mDate.addDays( -days)) ) |
434 | prefix ="<-" ; | 442 | prefix ="<-" ; |
@@ -470,55 +478,46 @@ void MonthViewCell::updateCell() | |||
470 | 478 | ||
471 | } else { | 479 | } else { |
472 | if (cat.isEmpty()) { | 480 | if (cat.isEmpty()) { |
473 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 481 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
474 | } else { | 482 | } else { |
475 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 483 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
476 | } | 484 | } |
477 | } | 485 | } |
478 | 486 | ||
479 | } else { | 487 | } else { |
480 | pal = mStandardPalette ; | 488 | pal = mStandardPalette ; |
481 | } | 489 | } |
482 | item->setPalette( pal ); | 490 | item->setPalette( pal ); |
483 | item->setRecur( event->recurrence()->doesRecur() ); | 491 | item->setRecur( event->recurrence()->doesRecur() ); |
484 | item->setAlarm( event->isAlarmEnabled() ); | 492 | item->setAlarm( event->isAlarmEnabled() ); |
485 | item->setMoreInfo( event->description().length() > 0 ); | 493 | item->setMoreInfo( event->description().length() > 0 ); |
494 | #ifdef DESKTOP_VERSION | ||
486 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 495 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
487 | KOPrefs::instance()->email()); | 496 | KOPrefs::instance()->email()); |
488 | if ( me != 0 ) { | 497 | if ( me != 0 ) { |
489 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 498 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
490 | item->setReply(true); | 499 | item->setReply(true); |
491 | else | 500 | else |
492 | item->setReply(false); | 501 | item->setReply(false); |
493 | } else | 502 | } else |
494 | item->setReply(false); | 503 | item->setReply(false); |
495 | bool insert = true; | 504 | #endif |
496 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 505 | mItemList->insertItem( item ); |
497 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 506 | tipText += "\n"; |
498 | insert = false; | 507 | |
499 | else | ||
500 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | ||
501 | insert = false; | ||
502 | |||
503 | } | ||
504 | if ( insert ) { | ||
505 | mItemList->insertItem( item ); | ||
506 | tipText += "\n"; | ||
507 | } else | ||
508 | tipText = ""; | ||
509 | } | 508 | } |
510 | 509 | ||
511 | // insert due todos | 510 | // insert due todos |
512 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 511 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
513 | Todo *todo; | 512 | Todo *todo; |
514 | for(todo = todos.first(); todo; todo = todos.next()) { | 513 | for(todo = todos.first(); todo; todo = todos.next()) { |
515 | QString text; | 514 | QString text; |
516 | if (todo->hasDueDate()) { | 515 | if (todo->hasDueDate()) { |
517 | if (!todo->doesFloat()) { | 516 | if (!todo->doesFloat()) { |
518 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 517 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
519 | text += " "; | 518 | text += " "; |
520 | } | 519 | } |
521 | } | 520 | } |
522 | text += i18n("To-Do: %1").arg(todo->summary()); | 521 | text += i18n("To-Do: %1").arg(todo->summary()); |
523 | 522 | ||
524 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 523 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
@@ -544,35 +543,46 @@ void MonthViewCell::updateCell() | |||
544 | } | 543 | } |
545 | 544 | ||
546 | } else { | 545 | } else { |
547 | pal = mStandardPalette ; | 546 | pal = mStandardPalette ; |
548 | } | 547 | } |
549 | item->setPalette( pal ); | 548 | item->setPalette( pal ); |
550 | mItemList->insertItem( item ); | 549 | mItemList->insertItem( item ); |
551 | tipText += text+"\n"; | 550 | tipText += text+"\n"; |
552 | } | 551 | } |
553 | #ifdef DESKTOP_VERSION | 552 | #ifdef DESKTOP_VERSION |
554 | if (tipText != "") | 553 | if (tipText != "") |
555 | QToolTip::add(this,tipText,toolTipGroup(),""); | 554 | QToolTip::add(this,tipText,toolTipGroup(),""); |
556 | #endif | 555 | #endif |
557 | 556 | ||
558 | //setMyPalette(); | 557 | //setMyPalette(); |
559 | setMyPalette(); | 558 | setMyPalette(); |
559 | QString text; | ||
560 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | ||
561 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | ||
562 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | ||
563 | mLabel->resize( mLabelBigSize ); | ||
564 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | ||
565 | } else { | ||
566 | mLabel->resize( mLabelSize ); | ||
567 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | ||
568 | } | ||
569 | mLabel->setText( text ); | ||
560 | resizeEvent( 0 ); | 570 | resizeEvent( 0 ); |
561 | // if ( isVisible()) | 571 | // if ( isVisible()) |
562 | // qApp->processEvents(); | 572 | qApp->processEvents(); |
563 | } | 573 | } |
564 | 574 | ||
565 | void MonthViewCell::updateConfig() | 575 | void MonthViewCell::updateConfig() |
566 | { | 576 | { |
567 | 577 | ||
568 | setFont( KOPrefs::instance()->mMonthViewFont ); | 578 | setFont( KOPrefs::instance()->mMonthViewFont ); |
569 | 579 | ||
570 | QFontMetrics fm( font() ); | 580 | QFontMetrics fm( font() ); |
571 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 581 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
572 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 582 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
573 | mHolidayPalette = mStandardPalette; | 583 | mHolidayPalette = mStandardPalette; |
574 | mPrimaryPalette = mStandardPalette; | 584 | mPrimaryPalette = mStandardPalette; |
575 | mNonPrimaryPalette = mStandardPalette; | 585 | mNonPrimaryPalette = mStandardPalette; |
576 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 586 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
577 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 587 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
578 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 588 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
@@ -625,32 +635,37 @@ QDate MonthViewCell::selectedIncidenceDate() | |||
625 | return item->incidenceDate(); | 635 | return item->incidenceDate(); |
626 | } | 636 | } |
627 | 637 | ||
628 | void MonthViewCell::deselect() | 638 | void MonthViewCell::deselect() |
629 | { | 639 | { |
630 | mItemList->clearSelection(); | 640 | mItemList->clearSelection(); |
631 | enableScrollBars( false ); | 641 | enableScrollBars( false ); |
632 | // updateCell(); | 642 | // updateCell(); |
633 | } | 643 | } |
634 | void MonthViewCell::select() | 644 | void MonthViewCell::select() |
635 | { | 645 | { |
636 | ;// updateCell(); | 646 | ;// updateCell(); |
637 | } | 647 | } |
638 | 648 | ||
639 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 649 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
640 | { | 650 | { |
651 | if ( !mMonthView->isUpdatePossible() ) | ||
652 | return; | ||
653 | if ( !isVisible() ){ | ||
654 | return; | ||
655 | } | ||
641 | int size = height() - mLabel->height(); | 656 | int size = height() - mLabel->height(); |
642 | if ( size > 0 ) | 657 | if ( size > 0 ) |
643 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 658 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
644 | size = width() - mLabel->width(); | 659 | size = width() - mLabel->width(); |
645 | if ( size > 0 ) | 660 | if ( size > 0 ) |
646 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 661 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
647 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 662 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
648 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 663 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
649 | } | 664 | } |
650 | 665 | ||
651 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 666 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
652 | { | 667 | { |
653 | if ( !item ) return; | 668 | if ( !item ) return; |
654 | 669 | ||
655 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 670 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
656 | Incidence *incidence = eventItem->incidence(); | 671 | Incidence *incidence = eventItem->incidence(); |
@@ -700,32 +715,33 @@ void MonthViewCell::selection( QListBoxItem *item ) | |||
700 | if ( !item ) return; | 715 | if ( !item ) return; |
701 | 716 | ||
702 | mMonthView->setSelectedCell( this ); | 717 | mMonthView->setSelectedCell( this ); |
703 | } | 718 | } |
704 | 719 | ||
705 | 720 | ||
706 | // ******************************************************************************* | 721 | // ******************************************************************************* |
707 | // ******************************************************************************* | 722 | // ******************************************************************************* |
708 | // ******************************************************************************* | 723 | // ******************************************************************************* |
709 | 724 | ||
710 | 725 | ||
711 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 726 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
712 | : KOEventView( calendar, parent, name ), | 727 | : KOEventView( calendar, parent, name ), |
713 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 728 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
714 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 729 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
715 | { | 730 | { |
731 | updatePossible = false; | ||
716 | mCells.setAutoDelete( true ); | 732 | mCells.setAutoDelete( true ); |
717 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 733 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
718 | // mDayLayout = new QGridLayout( this ); | 734 | // mDayLayout = new QGridLayout( this ); |
719 | // create the day of the week labels (Sun, Mon, etc) and add them to | 735 | // create the day of the week labels (Sun, Mon, etc) and add them to |
720 | // the layout. | 736 | // the layout. |
721 | mDayLabels.resize( mDaysPerWeek ); | 737 | mDayLabels.resize( mDaysPerWeek ); |
722 | QFont bfont = font(); | 738 | QFont bfont = font(); |
723 | if ( QApplication::desktop()->width() < 650 ) { | 739 | if ( QApplication::desktop()->width() < 650 ) { |
724 | bfont.setPointSize( bfont.pointSize() - 2 ); | 740 | bfont.setPointSize( bfont.pointSize() - 2 ); |
725 | } | 741 | } |
726 | bfont.setBold( true ); | 742 | bfont.setBold( true ); |
727 | int i; | 743 | int i; |
728 | 744 | ||
729 | for( i = 0; i < mDaysPerWeek; i++ ) { | 745 | for( i = 0; i < mDaysPerWeek; i++ ) { |
730 | QLabel *label = new QLabel( this ); | 746 | QLabel *label = new QLabel( this ); |
731 | label->setFont(bfont); | 747 | label->setFont(bfont); |
@@ -907,33 +923,36 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
907 | } | 923 | } |
908 | 924 | ||
909 | void KOMonthView::showEvents(QPtrList<Event>) | 925 | void KOMonthView::showEvents(QPtrList<Event>) |
910 | { | 926 | { |
911 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 927 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
912 | } | 928 | } |
913 | 929 | ||
914 | void KOMonthView::changeEventDisplay(Event *, int) | 930 | void KOMonthView::changeEventDisplay(Event *, int) |
915 | { | 931 | { |
916 | // this should be re-written to be much more efficient, but this | 932 | // this should be re-written to be much more efficient, but this |
917 | // quick-and-dirty-hack gets the job done for right now. | 933 | // quick-and-dirty-hack gets the job done for right now. |
918 | updateView(); | 934 | updateView(); |
919 | } | 935 | } |
920 | 936 | ||
921 | void KOMonthView::updateView() | 937 | void KOMonthView::updateView() |
922 | { | 938 | { |
923 | 939 | static int iii = 0; | |
940 | ++iii; | ||
941 | if ( !updatePossible ) | ||
942 | return; | ||
924 | uint i; | 943 | uint i; |
925 | for( i = 0; i < mCells.count(); ++i ) { | 944 | for( i = 0; i < mCells.count(); ++i ) { |
926 | mCells[i]->updateCell(); | 945 | mCells[i]->updateCell(); |
927 | } | 946 | } |
928 | //qDebug("KOMonthView::updateView() "); | 947 | //qDebug("KOMonthView::updateView() "); |
929 | processSelectionChange(); | 948 | processSelectionChange(); |
930 | } | 949 | } |
931 | 950 | ||
932 | void KOMonthView::resizeEvent(QResizeEvent * e) | 951 | void KOMonthView::resizeEvent(QResizeEvent * e) |
933 | { | 952 | { |
934 | computeLayout(); | 953 | computeLayout(); |
935 | } | 954 | } |
936 | void KOMonthView::computeLayout() | 955 | void KOMonthView::computeLayout() |
937 | { | 956 | { |
938 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 957 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
939 | // note this only changes the text if the requested size crosses the | 958 | // note this only changes the text if the requested size crosses the |
@@ -941,33 +960,33 @@ void KOMonthView::computeLayout() | |||
941 | // enough. | 960 | // enough. |
942 | 961 | ||
943 | int daysToShow = 7; | 962 | int daysToShow = 7; |
944 | bool combinedSatSun = false; | 963 | bool combinedSatSun = false; |
945 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 964 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
946 | daysToShow = 6; | 965 | daysToShow = 6; |
947 | combinedSatSun = true; | 966 | combinedSatSun = true; |
948 | } | 967 | } |
949 | int tWid = topLevelWidget()->size().width(); | 968 | int tWid = topLevelWidget()->size().width(); |
950 | int tHei = topLevelWidget()->size().height(); | 969 | int tHei = topLevelWidget()->size().height(); |
951 | 970 | ||
952 | int wid = size().width();//e | 971 | int wid = size().width();//e |
953 | int hei = size().height()-1; | 972 | int hei = size().height()-1; |
954 | 973 | ||
955 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 974 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
956 | return; | 975 | return; |
957 | 976 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | |
958 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 977 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
959 | int weeklabelwid = fm.width( "888" ); | 978 | int weeklabelwid = fm.width( "888" ); |
960 | wid -= weeklabelwid; | 979 | wid -= weeklabelwid; |
961 | 980 | ||
962 | int colWid = wid / daysToShow; | 981 | int colWid = wid / daysToShow; |
963 | int lastCol = wid - ( colWid*6 ); | 982 | int lastCol = wid - ( colWid*6 ); |
964 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 983 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
965 | int cellHei = (hei - dayLabelHei) /6; | 984 | int cellHei = (hei - dayLabelHei) /6; |
966 | int colModulo = wid % daysToShow; | 985 | int colModulo = wid % daysToShow; |
967 | int rowModulo = (hei- dayLabelHei) % 6; | 986 | int rowModulo = (hei- dayLabelHei) % 6; |
968 | //qDebug("rowmod %d ", rowModulo); | 987 | //qDebug("rowmod %d ", rowModulo); |
969 | int i; | 988 | int i; |
970 | int x,y,w,h; | 989 | int x,y,w,h; |
971 | x= 0; | 990 | x= 0; |
972 | y= 0; | 991 | y= 0; |
973 | w = colWid; | 992 | w = colWid; |
@@ -1019,32 +1038,36 @@ void KOMonthView::computeLayout() | |||
1019 | y += h; | 1038 | y += h; |
1020 | } | 1039 | } |
1021 | } | 1040 | } |
1022 | y= dayLabelHei; | 1041 | y= dayLabelHei; |
1023 | h = cellHei ; | 1042 | h = cellHei ; |
1024 | for ( i = 0; i < 6; i++) { | 1043 | for ( i = 0; i < 6; i++) { |
1025 | if ( i == (6-rowModulo)) | 1044 | if ( i == (6-rowModulo)) |
1026 | ++h; | 1045 | ++h; |
1027 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1046 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1028 | y += h; | 1047 | y += h; |
1029 | } | 1048 | } |
1030 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1049 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1031 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1050 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1032 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1051 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1033 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1052 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1034 | updateDayLabels(); | 1053 | updateDayLabels(); |
1054 | bool forceUpdate = !updatePossible; | ||
1055 | updatePossible = true; | ||
1056 | if ( forceUpdate ) | ||
1057 | updateView(); | ||
1035 | } | 1058 | } |
1036 | 1059 | ||
1037 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1060 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1038 | { | 1061 | { |
1039 | mContextMenu->showIncidencePopup(incidence); | 1062 | mContextMenu->showIncidencePopup(incidence); |
1040 | /* | 1063 | /* |
1041 | if( incidence && incidence->type() == "Event" ) { | 1064 | if( incidence && incidence->type() == "Event" ) { |
1042 | Event *event = static_cast<Event *>(incidence); | 1065 | Event *event = static_cast<Event *>(incidence); |
1043 | mContextMenu->showEventPopup(event); | 1066 | mContextMenu->showEventPopup(event); |
1044 | } else { | 1067 | } else { |
1045 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1068 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1046 | } | 1069 | } |
1047 | */ | 1070 | */ |
1048 | } | 1071 | } |
1049 | MonthViewCell * KOMonthView::selectedCell( ) | 1072 | MonthViewCell * KOMonthView::selectedCell( ) |
1050 | { | 1073 | { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 4c1567c..727f511 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -27,69 +27,73 @@ | |||
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qintdict.h> | 29 | #include <qintdict.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qvaluelist.h> | 31 | #include <qvaluelist.h> |
32 | #include <qptrvector.h> | 32 | #include <qptrvector.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | #include <libkcal/event.h> | 35 | #include <libkcal/event.h> |
36 | 36 | ||
37 | #include "koeventview.h" | 37 | #include "koeventview.h" |
38 | 38 | ||
39 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
40 | class QToolTipGroup; | 40 | class QToolTipGroup; |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | class KNOWhatsThis; | ||
43 | class KOWeekButton : public QPushButton | 44 | class KOWeekButton : public QPushButton |
44 | { | 45 | { |
45 | Q_OBJECT | 46 | Q_OBJECT |
46 | public: | 47 | public: |
47 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 48 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
48 | QPushButton( parent, name) | 49 | QPushButton( parent, name) |
49 | { | 50 | { |
50 | connect( this, SIGNAL( clicked() ), | 51 | connect( this, SIGNAL( clicked() ), |
51 | SLOT( bottonClicked() )); | 52 | SLOT( bottonClicked() )); |
52 | mNumber = -1; | 53 | mNumber = -1; |
53 | } | 54 | } |
54 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 55 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
55 | signals: | 56 | signals: |
56 | void selectWeekNum ( int ); | 57 | void selectWeekNum ( int ); |
57 | private: | 58 | private: |
58 | int mNumber; | 59 | int mNumber; |
59 | private slots : | 60 | private slots : |
60 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 61 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
61 | }; | 62 | }; |
62 | 63 | ||
63 | class KNoScrollListBox: public QListBox | 64 | class KNoScrollListBox: public QListBox |
64 | { | 65 | { |
65 | Q_OBJECT | 66 | Q_OBJECT |
66 | public: | 67 | public: |
67 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 68 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
68 | ~KNoScrollListBox() {} | 69 | ~KNoScrollListBox(); |
69 | QString getWhatsThisText(QPoint p) ; | 70 | QString getWhatsThisText(QPoint p) ; |
70 | 71 | ||
71 | signals: | 72 | signals: |
72 | void shiftDown(); | 73 | void shiftDown(); |
73 | void shiftUp(); | 74 | void shiftUp(); |
74 | void rightClick(); | 75 | void rightClick(); |
75 | 76 | ||
76 | protected slots: | 77 | protected slots: |
77 | void keyPressEvent(QKeyEvent *); | 78 | void keyPressEvent(QKeyEvent *); |
78 | void keyReleaseEvent(QKeyEvent *); | 79 | void keyReleaseEvent(QKeyEvent *); |
79 | void mousePressEvent(QMouseEvent *); | 80 | void mousePressEvent(QMouseEvent *); |
81 | |||
82 | private: | ||
83 | KNOWhatsThis * mWT; | ||
80 | }; | 84 | }; |
81 | 85 | ||
82 | 86 | ||
83 | class MonthViewItem: public QListBoxItem | 87 | class MonthViewItem: public QListBoxItem |
84 | { | 88 | { |
85 | public: | 89 | public: |
86 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 90 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
87 | 91 | ||
88 | void setRecur(bool on) { mRecur = on; } | 92 | void setRecur(bool on) { mRecur = on; } |
89 | void setAlarm(bool on) { mAlarm = on; } | 93 | void setAlarm(bool on) { mAlarm = on; } |
90 | void setReply(bool on) { mReply = on; } | 94 | void setReply(bool on) { mReply = on; } |
91 | void setMoreInfo(bool on) { mInfo = on; } | 95 | void setMoreInfo(bool on) { mInfo = on; } |
92 | 96 | ||
93 | 97 | ||
94 | void setPalette(const QPalette &p) { mPalette = p; } | 98 | void setPalette(const QPalette &p) { mPalette = p; } |
95 | QPalette palette() const { return mPalette; } | 99 | QPalette palette() const { return mPalette; } |
@@ -199,59 +203,61 @@ class KOMonthView: public KOEventView | |||
199 | 203 | ||
200 | /** Returns maximum number of days supported by the komonthview */ | 204 | /** Returns maximum number of days supported by the komonthview */ |
201 | virtual int maxDatesHint(); | 205 | virtual int maxDatesHint(); |
202 | 206 | ||
203 | /** Returns number of currently shown dates. */ | 207 | /** Returns number of currently shown dates. */ |
204 | virtual int currentDateCount(); | 208 | virtual int currentDateCount(); |
205 | 209 | ||
206 | /** returns the currently selected events */ | 210 | /** returns the currently selected events */ |
207 | virtual QPtrList<Incidence> selectedIncidences(); | 211 | virtual QPtrList<Incidence> selectedIncidences(); |
208 | 212 | ||
209 | /** returns dates of the currently selected events */ | 213 | /** returns dates of the currently selected events */ |
210 | virtual DateList selectedDates(); | 214 | virtual DateList selectedDates(); |
211 | 215 | ||
212 | virtual void printPreview(CalPrinter *calPrinter, | 216 | virtual void printPreview(CalPrinter *calPrinter, |
213 | const QDate &, const QDate &); | 217 | const QDate &, const QDate &); |
214 | bool isMonthView() { return true; } | 218 | bool isMonthView() { return true; } |
219 | bool isUpdatePossible() { return updatePossible; } | ||
215 | 220 | ||
216 | MonthViewCell * selectedCell(); | 221 | MonthViewCell * selectedCell(); |
217 | public slots: | 222 | public slots: |
218 | virtual void updateView(); | 223 | virtual void updateView(); |
219 | virtual void updateConfig(); | 224 | virtual void updateConfig(); |
220 | virtual void showDates(const QDate &start, const QDate &end); | 225 | virtual void showDates(const QDate &start, const QDate &end); |
221 | virtual void showEvents(QPtrList<Event> eventList); | 226 | virtual void showEvents(QPtrList<Event> eventList); |
222 | 227 | ||
223 | void changeEventDisplay(Event *, int); | 228 | void changeEventDisplay(Event *, int); |
224 | 229 | ||
225 | void clearSelection(); | 230 | void clearSelection(); |
226 | 231 | ||
227 | void showContextMenu( Incidence * ); | 232 | void showContextMenu( Incidence * ); |
228 | 233 | ||
229 | void setSelectedCell( MonthViewCell * ); | 234 | void setSelectedCell( MonthViewCell * ); |
230 | 235 | ||
231 | protected slots: | 236 | protected slots: |
232 | void processSelectionChange(); | 237 | void processSelectionChange(); |
233 | signals: | 238 | signals: |
234 | void selectWeekNum ( int ); | 239 | void selectWeekNum ( int ); |
235 | void showDaySignal( QDate ); | 240 | void showDaySignal( QDate ); |
236 | protected: | 241 | protected: |
237 | void resizeEvent(QResizeEvent *); | 242 | void resizeEvent(QResizeEvent *); |
238 | void viewChanged(); | 243 | void viewChanged(); |
239 | void updateDayLabels(); | 244 | void updateDayLabels(); |
240 | 245 | ||
241 | private: | 246 | private: |
247 | bool updatePossible; | ||
242 | int mDaysPerWeek; | 248 | int mDaysPerWeek; |
243 | int mNumWeeks; | 249 | int mNumWeeks; |
244 | int mNumCells; | 250 | int mNumCells; |
245 | bool mWeekStartsMonday; | 251 | bool mWeekStartsMonday; |
246 | bool mShowSatSunComp; | 252 | bool mShowSatSunComp; |
247 | void computeLayout(); | 253 | void computeLayout(); |
248 | 254 | ||
249 | QPtrVector<MonthViewCell> mCells; | 255 | QPtrVector<MonthViewCell> mCells; |
250 | QPtrVector<QLabel> mDayLabels; | 256 | QPtrVector<QLabel> mDayLabels; |
251 | QPtrVector<KOWeekButton> mWeekLabels; | 257 | QPtrVector<KOWeekButton> mWeekLabels; |
252 | 258 | ||
253 | bool mShortDayLabels; | 259 | bool mShortDayLabels; |
254 | int mWidthLongDayLabel; | 260 | int mWidthLongDayLabel; |
255 | 261 | ||
256 | QDate mStartDate; | 262 | QDate mStartDate; |
257 | 263 | ||
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index cf56fcf..00a5842 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -32,32 +32,33 @@ | |||
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | ||
48 | 49 | ||
49 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
50 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
51 | 52 | ||
52 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
53 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
54 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
55 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
56 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
57 | 58 | ||
58 | 59 | ||
59 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
60 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
61 | { | 62 | { |
62 | mCurrentView = 0; | 63 | mCurrentView = 0; |
63 | 64 | ||
@@ -263,34 +264,37 @@ void KOViewManager::showListView() | |||
263 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 264 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
264 | connect( mListView, SIGNAL( signalNewEvent() ), | 265 | connect( mListView, SIGNAL( signalNewEvent() ), |
265 | mMainView, SLOT( newEvent() ) ); | 266 | mMainView, SLOT( newEvent() ) ); |
266 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 267 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
267 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 268 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
268 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 269 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
269 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 270 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
270 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 271 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
271 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 272 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
272 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 273 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
273 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 274 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
274 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 275 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
275 | } | 276 | } |
276 | // bool temp = mFlagShowNextxDays; | 277 | // bool temp = mFlagShowNextxDays; |
277 | //globalFlagBlockPainting = true; | 278 | //globalFlagBlockPainting = true; |
278 | globalFlagBlockAgenda = 1; | 279 | globalFlagBlockAgenda = 1; |
279 | if ( KOPrefs::instance()->mListViewMonthTimespan ) | 280 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
281 | mMainView->setBlockShowDates( true ); | ||
280 | mMainView->dateNavigator()->selectMonth(); | 282 | mMainView->dateNavigator()->selectMonth(); |
283 | mMainView->setBlockShowDates( false ); | ||
284 | } | ||
281 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 285 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
282 | //mFlagShowNextxDays = temp; | 286 | //mFlagShowNextxDays = temp; |
283 | } | 287 | } |
284 | 288 | ||
285 | void KOViewManager::showAgendaView( bool fullScreen ) | 289 | void KOViewManager::showAgendaView( bool fullScreen ) |
286 | { | 290 | { |
287 | 291 | ||
288 | mMainView->dialogManager()->hideSearchDialog(); | 292 | mMainView->dialogManager()->hideSearchDialog(); |
289 | // qDebug("KOViewManager::showAgendaView "); | 293 | // qDebug("KOViewManager::showAgendaView "); |
290 | bool full; | 294 | bool full; |
291 | full = fullScreen; | 295 | full = fullScreen; |
292 | if (!mAgendaView) { | 296 | if (!mAgendaView) { |
293 | full = false; | 297 | full = false; |
294 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 298 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
295 | addView(mAgendaView); | 299 | addView(mAgendaView); |
296 | #ifndef DESKTOP_VERSION | 300 | #ifndef DESKTOP_VERSION |