author | zautrix <zautrix> | 2005-10-26 09:10:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-26 09:10:50 (UTC) |
commit | 15b9123c6c1f9096a4b1a7729c323433d408c8d7 (patch) (unidiff) | |
tree | 3d9a8a521df355641642172ab1200a0f75529910 | |
parent | f696b904526567d45cd01a5b607644f8aa3bfe6b (diff) | |
download | kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.zip kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.tar.gz kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.tar.bz2 |
fix
-rw-r--r-- | korganizer/calendarview.cpp | 42 | ||||
-rw-r--r-- | korganizer/calendarview.h | 5 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 8 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 16 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 7 |
8 files changed, 52 insertions, 34 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 28b17a5..31e103d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -273,192 +273,197 @@ void MissedAlarmTextBrowser::setSource(const QString & n) | |||
273 | class KOBeamPrefs : public QDialog | 273 | class KOBeamPrefs : public QDialog |
274 | { | 274 | { |
275 | public: | 275 | public: |
276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
277 | QDialog( parent, name, true ) | 277 | QDialog( parent, name, true ) |
278 | { | 278 | { |
279 | setCaption( i18n("Beam Options") ); | 279 | setCaption( i18n("Beam Options") ); |
280 | QVBoxLayout* lay = new QVBoxLayout( this ); | 280 | QVBoxLayout* lay = new QVBoxLayout( this ); |
281 | lay->setSpacing( 3 ); | 281 | lay->setSpacing( 3 ); |
282 | lay->setMargin( 3 ); | 282 | lay->setMargin( 3 ); |
283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
284 | lay->addWidget( format ); | 284 | lay->addWidget( format ); |
285 | format->setExclusive ( true ) ; | 285 | format->setExclusive ( true ) ; |
286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
287 | lay->addWidget( time ); time->setExclusive ( true ) ; | 287 | lay->addWidget( time ); time->setExclusive ( true ) ; |
288 | vcal = new QRadioButton(" vCalendar ", format ); | 288 | vcal = new QRadioButton(" vCalendar ", format ); |
289 | ical = new QRadioButton(" iCalendar ", format ); | 289 | ical = new QRadioButton(" iCalendar ", format ); |
290 | vcal->setChecked( true ); | 290 | vcal->setChecked( true ); |
291 | tz = new QRadioButton(i18n(" With timezone "), time ); | 291 | tz = new QRadioButton(i18n(" With timezone "), time ); |
292 | local = new QRadioButton(i18n(" Local time "), time ); | 292 | local = new QRadioButton(i18n(" Local time "), time ); |
293 | tz->setChecked( true ); | 293 | tz->setChecked( true ); |
294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
295 | lay->addWidget( ok ); | 295 | lay->addWidget( ok ); |
296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
297 | lay->addWidget( cancel ); | 297 | lay->addWidget( cancel ); |
298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
300 | resize( 200, 200 ); | 300 | resize( 200, 200 ); |
301 | } | 301 | } |
302 | 302 | ||
303 | bool beamVcal() { return vcal->isChecked(); } | 303 | bool beamVcal() { return vcal->isChecked(); } |
304 | bool beamLocal() { return local->isChecked(); } | 304 | bool beamLocal() { return local->isChecked(); } |
305 | private: | 305 | private: |
306 | QRadioButton* vcal, *ical, *local, *tz; | 306 | QRadioButton* vcal, *ical, *local, *tz; |
307 | }; | 307 | }; |
308 | class KOCatPrefs : public QDialog | 308 | class KOCatPrefs : public QDialog |
309 | { | 309 | { |
310 | public: | 310 | public: |
311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
312 | QDialog( parent, name, true ) | 312 | QDialog( parent, name, true ) |
313 | { | 313 | { |
314 | setCaption( i18n("Manage new Categories") ); | 314 | setCaption( i18n("Manage new Categories") ); |
315 | QVBoxLayout* lay = new QVBoxLayout( this ); | 315 | QVBoxLayout* lay = new QVBoxLayout( this ); |
316 | lay->setSpacing( 3 ); | 316 | lay->setSpacing( 3 ); |
317 | lay->setMargin( 3 ); | 317 | lay->setMargin( 3 ); |
318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); | 318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); |
319 | lay->addWidget( lab ); | 319 | lay->addWidget( lab ); |
320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
321 | lay->addWidget( format ); | 321 | lay->addWidget( format ); |
322 | format->setExclusive ( true ) ; | 322 | format->setExclusive ( true ) ; |
323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
325 | addCatBut->setChecked( true ); | 325 | addCatBut->setChecked( true ); |
326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
327 | lay->addWidget( ok ); | 327 | lay->addWidget( ok ); |
328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
329 | lay->addWidget( cancel ); | 329 | lay->addWidget( cancel ); |
330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
332 | resize( 200, 200 ); | 332 | resize( 200, 200 ); |
333 | } | 333 | } |
334 | 334 | ||
335 | bool addCat() { return addCatBut->isChecked(); } | 335 | bool addCat() { return addCatBut->isChecked(); } |
336 | private: | 336 | private: |
337 | QRadioButton* addCatBut; | 337 | QRadioButton* addCatBut; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | CalendarView::CalendarView( CalendarResources *calendar, | 342 | CalendarView::CalendarView( CalendarResources *calendar, |
343 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
344 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
345 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
346 | mResourceManager( calendar->resourceManager() ) | 346 | mResourceManager( calendar->resourceManager() ) |
347 | { | 347 | { |
348 | 348 | ||
349 | mEventEditor = 0; | 349 | mEventEditor = 0; |
350 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
351 | 351 | ||
352 | init(); | 352 | init(); |
353 | } | 353 | } |
354 | 354 | ||
355 | CalendarView::CalendarView( Calendar *calendar, | 355 | CalendarView::CalendarView( Calendar *calendar, |
356 | QWidget *parent, const char *name ) | 356 | QWidget *parent, const char *name ) |
357 | : CalendarViewBase( parent, name ), | 357 | : CalendarViewBase( parent, name ), |
358 | mCalendar( calendar ), | 358 | mCalendar( calendar ), |
359 | mResourceManager( 0 ) | 359 | mResourceManager( 0 ) |
360 | { | 360 | { |
361 | 361 | ||
362 | mEventEditor = 0; | 362 | mEventEditor = 0; |
363 | mTodoEditor = 0; | 363 | mTodoEditor = 0; |
364 | init(); | 364 | init(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void CalendarView::init() | 367 | void CalendarView::init() |
368 | { | 368 | { |
369 | flag_blockConflict = false; | ||
370 | flag_blockScrollBar = false; | ||
371 | flag_checkFileFirsttime = true; | ||
372 | flag_clearallviewsEventDisplay = false; | ||
373 | flag_clearallviewsupdateView = false; | ||
369 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 374 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
370 | setFocusPolicy (NoFocus ); | 375 | setFocusPolicy (NoFocus ); |
371 | mViewerCallerIsSearchDialog = false; | 376 | mViewerCallerIsSearchDialog = false; |
372 | mBlockShowDates = false; | 377 | mBlockShowDates = false; |
373 | mConflictingEvent = 0; | 378 | mConflictingEvent = 0; |
374 | mDatePickerMode = 0; | 379 | mDatePickerMode = 0; |
375 | mCurrentSyncDevice = ""; | 380 | mCurrentSyncDevice = ""; |
376 | mViewManager = new KOViewManager( this ); | 381 | mViewManager = new KOViewManager( this ); |
377 | mDialogManager = new KODialogManager( this ); | 382 | mDialogManager = new KODialogManager( this ); |
378 | mEventViewerDialog = 0; | 383 | mEventViewerDialog = 0; |
379 | mModified = false; | 384 | mModified = false; |
380 | mReadOnly = false; | 385 | mReadOnly = false; |
381 | mSelectedIncidence = 0; | 386 | mSelectedIncidence = 0; |
382 | mCalPrinter = 0; | 387 | mCalPrinter = 0; |
383 | mFilters.setAutoDelete(true); | 388 | mFilters.setAutoDelete(true); |
384 | 389 | ||
385 | mCalendar->registerObserver( this ); | 390 | mCalendar->registerObserver( this ); |
386 | // TODO: Make sure that view is updated, when calendar is changed. | 391 | // TODO: Make sure that view is updated, when calendar is changed. |
387 | 392 | ||
388 | mStorage = new FileStorage( mCalendar ); | 393 | mStorage = new FileStorage( mCalendar ); |
389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 394 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
390 | 395 | ||
391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 396 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
392 | #ifndef KORG_NOSPLITTER | 397 | #ifndef KORG_NOSPLITTER |
393 | // create the main layout frames. | 398 | // create the main layout frames. |
394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 399 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
395 | topLayout->addWidget(mPanner); | 400 | topLayout->addWidget(mPanner); |
396 | 401 | ||
397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 402 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
398 | "CalendarView::LeftFrame"); | 403 | "CalendarView::LeftFrame"); |
399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 404 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
400 | 405 | ||
401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 406 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
402 | "CalendarView::DateNavigator" ); | 407 | "CalendarView::DateNavigator" ); |
403 | 408 | ||
404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 409 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 410 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
406 | mTodoList->setNavigator( mNavigator ); | 411 | mTodoList->setNavigator( mNavigator ); |
407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 412 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
408 | 413 | ||
409 | #ifdef KORG_NORESOURCEVIEW | 414 | #ifdef KORG_NORESOURCEVIEW |
410 | mResourceView = 0; | 415 | mResourceView = 0; |
411 | #else | 416 | #else |
412 | if ( mResourceManager ) { | 417 | if ( mResourceManager ) { |
413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 418 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
414 | mResourceView->updateView(); | 419 | mResourceView->updateView(); |
415 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 420 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
416 | SLOT( updateView() ) ); | 421 | SLOT( updateView() ) ); |
417 | } else { | 422 | } else { |
418 | mResourceView = 0; | 423 | mResourceView = 0; |
419 | } | 424 | } |
420 | #endif | 425 | #endif |
421 | QWidget *rightBox = new QWidget( mPanner ); | 426 | QWidget *rightBox = new QWidget( mPanner ); |
422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 427 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
423 | 428 | ||
424 | mRightFrame = new QWidgetStack( rightBox ); | 429 | mRightFrame = new QWidgetStack( rightBox ); |
425 | rightLayout->addWidget( mRightFrame, 1 ); | 430 | rightLayout->addWidget( mRightFrame, 1 ); |
426 | 431 | ||
427 | mLeftFrame = mLeftSplitter; | 432 | mLeftFrame = mLeftSplitter; |
428 | #else | 433 | #else |
429 | //QWidget *mainBox = new QWidget( this ); | 434 | //QWidget *mainBox = new QWidget( this ); |
430 | //QWidget *leftFrame = new QWidget( mainBox ); | 435 | //QWidget *leftFrame = new QWidget( mainBox ); |
431 | //QBoxLayout * mainBoxLayout; | 436 | //QBoxLayout * mainBoxLayout; |
432 | if ( KOPrefs::instance()->mVerticalScreen ) { | 437 | if ( KOPrefs::instance()->mVerticalScreen ) { |
433 | //mainBoxLayout = new QVBoxLayout(mainBox); | 438 | //mainBoxLayout = new QVBoxLayout(mainBox); |
434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 439 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 440 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 441 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 442 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 443 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
439 | } else { | 444 | } else { |
440 | //mainBoxLayout = new QHBoxLayout(mainBox); | 445 | //mainBoxLayout = new QHBoxLayout(mainBox); |
441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 446 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 447 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 448 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 449 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 450 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
446 | } | 451 | } |
447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 452 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
448 | //QBoxLayout * leftFrameLayout; | 453 | //QBoxLayout * leftFrameLayout; |
449 | topLayout->addWidget( mMainFrame ); | 454 | topLayout->addWidget( mMainFrame ); |
450 | #ifdef DESKTOP_VERSION | 455 | #ifdef DESKTOP_VERSION |
451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); | 456 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); |
452 | topLayout->addWidget( mDateScrollBar ); | 457 | topLayout->addWidget( mDateScrollBar ); |
453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 458 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); |
454 | if ( QApplication::desktop()->width() < 800 ) | 459 | if ( QApplication::desktop()->width() < 800 ) |
455 | mDateScrollBar->hide(); | 460 | mDateScrollBar->hide(); |
456 | #endif | 461 | #endif |
457 | //mainBoxLayout->addWidget (mLeftFrame); | 462 | //mainBoxLayout->addWidget (mLeftFrame); |
458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 463 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
459 | "CalendarView::DateNavigator" ); | 464 | "CalendarView::DateNavigator" ); |
460 | #if 0 | 465 | #if 0 |
461 | // FIXME | 466 | // FIXME |
462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 467 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
463 | "CalendarView::DateNavigator", QDate::currentDate()); | 468 | "CalendarView::DateNavigator", QDate::currentDate()); |
464 | #endif | 469 | #endif |
@@ -568,373 +573,370 @@ void CalendarView::init() | |||
568 | SLOT( deleteTodo( Todo *) ) ); | 573 | SLOT( deleteTodo( Todo *) ) ); |
569 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 574 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
570 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 575 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
571 | SLOT( purgeCompleted() ) ); | 576 | SLOT( purgeCompleted() ) ); |
572 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 577 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
573 | SIGNAL( todoModified( Todo *, int ) ) ); | 578 | SIGNAL( todoModified( Todo *, int ) ) ); |
574 | 579 | ||
575 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 580 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
576 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 581 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
577 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 582 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
578 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 583 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
579 | 584 | ||
580 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 585 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
581 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 586 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
582 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 587 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
583 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 588 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
584 | 589 | ||
585 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 590 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
586 | this, SLOT ( todo_unsub( Todo * ) ) ); | 591 | this, SLOT ( todo_unsub( Todo * ) ) ); |
587 | 592 | ||
588 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 593 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
589 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 594 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
590 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 595 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
591 | SLOT( updateTodo( Todo *, int ) ) ); | 596 | SLOT( updateTodo( Todo *, int ) ) ); |
592 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 597 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
593 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 598 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
594 | 599 | ||
595 | 600 | ||
596 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 601 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
597 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 602 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
598 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 603 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
599 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 604 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
600 | 605 | ||
601 | 606 | ||
602 | 607 | ||
603 | 608 | ||
604 | 609 | ||
605 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 610 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
606 | SLOT(checkClipboard())); | 611 | SLOT(checkClipboard())); |
607 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 612 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
608 | SLOT( processTodoListSelection( Incidence * ) ) ); | 613 | SLOT( processTodoListSelection( Incidence * ) ) ); |
609 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 614 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
610 | 615 | ||
611 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 616 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
612 | 617 | ||
613 | mDateFrame = new QVBox(0,0,WType_Popup); | 618 | mDateFrame = new QVBox(0,0,WType_Popup); |
614 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 619 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
615 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 620 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
616 | mDateFrame->setLineWidth(3); | 621 | mDateFrame->setLineWidth(3); |
617 | mDateFrame->hide(); | 622 | mDateFrame->hide(); |
618 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 623 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
619 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 624 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
620 | 625 | ||
621 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 626 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
622 | 627 | ||
623 | mEventEditor = mDialogManager->getEventEditor(); | 628 | mEventEditor = mDialogManager->getEventEditor(); |
624 | mTodoEditor = mDialogManager->getTodoEditor(); | 629 | mTodoEditor = mDialogManager->getTodoEditor(); |
625 | 630 | ||
626 | mFlagEditDescription = false; | 631 | mFlagEditDescription = false; |
627 | 632 | ||
628 | mSuspendTimer = new QTimer( this ); | 633 | mSuspendTimer = new QTimer( this ); |
629 | mAlarmTimer = new QTimer( this ); | 634 | mAlarmTimer = new QTimer( this ); |
630 | mRecheckAlarmTimer = new QTimer( this ); | 635 | mRecheckAlarmTimer = new QTimer( this ); |
631 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 636 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
632 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 637 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
633 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 638 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
634 | mAlarmDialog = new AlarmDialog( this ); | 639 | mAlarmDialog = new AlarmDialog( this ); |
635 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 640 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
636 | mAlarmDialog->setServerNotification( false ); | 641 | mAlarmDialog->setServerNotification( false ); |
637 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 642 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
638 | 643 | ||
639 | 644 | ||
640 | #ifndef DESKTOP_VERSION | 645 | #ifndef DESKTOP_VERSION |
641 | //US listen for arriving address resultsets | 646 | //US listen for arriving address resultsets |
642 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 647 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
643 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 648 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
644 | #endif | 649 | #endif |
645 | mDateNavigator->setCalendar( mCalendar ); | 650 | mDateNavigator->setCalendar( mCalendar ); |
646 | } | 651 | } |
647 | 652 | ||
648 | 653 | ||
649 | CalendarView::~CalendarView() | 654 | CalendarView::~CalendarView() |
650 | { | 655 | { |
651 | // kdDebug() << "~CalendarView()" << endl; | 656 | // kdDebug() << "~CalendarView()" << endl; |
652 | //qDebug("CalendarView::~CalendarView() "); | 657 | //qDebug("CalendarView::~CalendarView() "); |
653 | delete mDialogManager; | 658 | delete mDialogManager; |
654 | delete mViewManager; | 659 | delete mViewManager; |
655 | delete mStorage; | 660 | delete mStorage; |
656 | delete mDateFrame ; | 661 | delete mDateFrame ; |
657 | delete mEventViewerDialog; | 662 | delete mEventViewerDialog; |
658 | //kdDebug() << "~CalendarView() done" << endl; | 663 | //kdDebug() << "~CalendarView() done" << endl; |
659 | } | 664 | } |
660 | 665 | ||
661 | 666 | ||
662 | void CalendarView::nextConflict( bool all, bool allday ) | 667 | void CalendarView::nextConflict( bool all, bool allday ) |
663 | { | 668 | { |
664 | static bool block = false; | 669 | if ( flag_blockConflict ) return; |
665 | if ( block ) return; | 670 | flag_blockConflict = true; |
666 | block = true; | ||
667 | QPtrList<Event> testlist = mCalendar->events(); | 671 | QPtrList<Event> testlist = mCalendar->events(); |
668 | Event * test = testlist.first(); | 672 | Event * test = testlist.first(); |
669 | while ( test ) { | 673 | while ( test ) { |
670 | test->setTagged( false ); | 674 | test->setTagged( false ); |
671 | test = testlist.next(); | 675 | test = testlist.next(); |
672 | } | 676 | } |
673 | QTime st ( 0,0,0); | 677 | QTime st ( 0,0,0); |
674 | if ( mViewManager->currentView() == mViewManager->agendaView() ) | 678 | if ( mViewManager->currentView() == mViewManager->agendaView() ) |
675 | st = mViewManager->agendaView()->agenda()->getEndTime(); | 679 | st = mViewManager->agendaView()->agenda()->getEndTime(); |
676 | //qDebug("time %s ", st.toString().latin1()); | 680 | //qDebug("time %s ", st.toString().latin1()); |
677 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); | 681 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); |
678 | QDateTime conflict; | 682 | QDateTime conflict; |
679 | QDateTime retVal; | 683 | QDateTime retVal; |
680 | bool found = false; | 684 | bool found = false; |
681 | Event * cE = 0; | 685 | Event * cE = 0; |
682 | Event * cE2 = 0; | 686 | Event * cE2 = 0; |
683 | QPtrList<Event> testlist2 = testlist; | 687 | QPtrList<Event> testlist2 = testlist; |
684 | test = testlist.first(); | 688 | test = testlist.first(); |
685 | bool skip = false; | 689 | bool skip = false; |
686 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 690 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
687 | //QTime tm; | 691 | //QTime tm; |
688 | //tm.start(); | 692 | //tm.start(); |
689 | while ( test ) { | 693 | while ( test ) { |
690 | qApp->processEvents(); | 694 | qApp->processEvents(); |
691 | skip = false; | 695 | skip = false; |
692 | if ( !all ) skip = ( allday != test->doesFloat() ); | 696 | if ( !all ) skip = ( allday != test->doesFloat() ); |
693 | if ( !skip ) { | 697 | if ( !skip ) { |
694 | if ( found ) | 698 | if ( found ) |
695 | skip = !test->matchTime( &startDT, &conflict ); | 699 | skip = !test->matchTime( &startDT, &conflict ); |
696 | else | 700 | else |
697 | skip = !test->matchTime( &startDT, 0 ); | 701 | skip = !test->matchTime( &startDT, 0 ); |
698 | } | 702 | } |
699 | if ( !skip ) { | 703 | if ( !skip ) { |
700 | Event * test2 = testlist2.first(); | 704 | Event * test2 = testlist2.first(); |
701 | while ( test2 ) { | 705 | while ( test2 ) { |
702 | skip = test2->isTagged(); | 706 | skip = test2->isTagged(); |
703 | if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); | 707 | if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); |
704 | if ( !skip ) { | 708 | if ( !skip ) { |
705 | if ( found ) | 709 | if ( found ) |
706 | skip = !test2->matchTime( &startDT, &conflict ); | 710 | skip = !test2->matchTime( &startDT, &conflict ); |
707 | else | 711 | else |
708 | skip = !test2->matchTime( &startDT, 0 ); | 712 | skip = !test2->matchTime( &startDT, 0 ); |
709 | } | 713 | } |
710 | if ( !skip ) { | 714 | if ( !skip ) { |
711 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { | 715 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { |
712 | //qDebug("overlap "); | 716 | //qDebug("overlap "); |
713 | if ( ! found ) { | 717 | if ( ! found ) { |
714 | if ( retVal >= startDT ) { | 718 | if ( retVal >= startDT ) { |
715 | conflict = retVal; | 719 | conflict = retVal; |
716 | cE = test; | 720 | cE = test; |
717 | cE2 = test2; | 721 | cE2 = test2; |
718 | found = true; | 722 | found = true; |
719 | } | 723 | } |
720 | } else { | 724 | } else { |
721 | if ( retVal >= startDT && retVal < conflict ) { | 725 | if ( retVal >= startDT && retVal < conflict ) { |
722 | conflict = retVal; | 726 | conflict = retVal; |
723 | cE = test; | 727 | cE = test; |
724 | cE2 = test2; | 728 | cE2 = test2; |
725 | } | 729 | } |
726 | } | 730 | } |
727 | } | 731 | } |
728 | } | 732 | } |
729 | test2 = testlist2.next(); | 733 | test2 = testlist2.next(); |
730 | } | 734 | } |
731 | } | 735 | } |
732 | test->setTagged( true ); | 736 | test->setTagged( true ); |
733 | test = testlist.next(); | 737 | test = testlist.next(); |
734 | } | 738 | } |
735 | //qDebug("Search time : %d", tm.elapsed()); | 739 | //qDebug("Search time : %d", tm.elapsed()); |
736 | if ( found ) { | 740 | if ( found ) { |
737 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 741 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
738 | mViewManager->showDayView(); | 742 | mViewManager->showDayView(); |
739 | mNavigator->slotDaySelect( conflict.date() ); | 743 | mNavigator->slotDaySelect( conflict.date() ); |
740 | int hour = conflict.time().hour(); | 744 | int hour = conflict.time().hour(); |
741 | mViewManager->agendaView()->setStartHour( hour ); | 745 | mViewManager->agendaView()->setStartHour( hour ); |
742 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); | 746 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
743 | block = false; | 747 | flag_blockConflict = false; |
744 | return; | 748 | return; |
745 | } | 749 | } |
746 | 750 | ||
747 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 751 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
748 | //qDebug("No conflict found "); | 752 | //qDebug("No conflict found "); |
749 | block = false; | 753 | flag_blockConflict = false; |
750 | return; | 754 | return; |
751 | } | 755 | } |
752 | 756 | ||
753 | void CalendarView::conflictAll() | 757 | void CalendarView::conflictAll() |
754 | { | 758 | { |
755 | nextConflict ( true, true ); | 759 | nextConflict ( true, true ); |
756 | } | 760 | } |
757 | void CalendarView::conflictAllday() | 761 | void CalendarView::conflictAllday() |
758 | { | 762 | { |
759 | nextConflict ( false, true ); | 763 | nextConflict ( false, true ); |
760 | } | 764 | } |
761 | void CalendarView::conflictNotAll() | 765 | void CalendarView::conflictNotAll() |
762 | { | 766 | { |
763 | nextConflict ( false, false ); | 767 | nextConflict ( false, false ); |
764 | } | 768 | } |
765 | 769 | ||
766 | void CalendarView::setCalReadOnly( int id, bool readO ) | 770 | void CalendarView::setCalReadOnly( int id, bool readO ) |
767 | { | 771 | { |
768 | if ( readO ) { | 772 | if ( readO ) { |
769 | emit save(); | 773 | emit save(); |
770 | } | 774 | } |
771 | mCalendar->setReadOnly( id, readO ); | 775 | mCalendar->setReadOnly( id, readO ); |
772 | } | 776 | } |
773 | void CalendarView::setScrollBarStep(int val ) | 777 | void CalendarView::setScrollBarStep(int val ) |
774 | { | 778 | { |
775 | #ifdef DESKTOP_VERSION | 779 | #ifdef DESKTOP_VERSION |
776 | mDateScrollBar->setLineStep ( val ); | 780 | mDateScrollBar->setLineStep ( val ); |
777 | #endif | 781 | #endif |
778 | } | 782 | } |
779 | void CalendarView::scrollBarValue(int val ) | 783 | void CalendarView::scrollBarValue(int val ) |
780 | { | 784 | { |
781 | #ifdef DESKTOP_VERSION | 785 | #ifdef DESKTOP_VERSION |
782 | if ( QApplication::desktop()->width() < 800 ) return; | 786 | if ( QApplication::desktop()->width() < 800 ) return; |
783 | static bool block = false; | 787 | if ( flag_blockScrollBar ) return; |
784 | if ( block ) return; | 788 | flag_blockScrollBar = true; |
785 | block = true; | ||
786 | int count = mNavigator->selectedDates().count(); | 789 | int count = mNavigator->selectedDates().count(); |
787 | int day = mNavigator->selectedDates().first().dayOfYear(); | 790 | int day = mNavigator->selectedDates().first().dayOfYear(); |
788 | int stepdays = val; | 791 | int stepdays = val; |
789 | if ( mDateScrollBar->lineStep () <= count ) { | 792 | if ( mDateScrollBar->lineStep () <= count ) { |
790 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 793 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
791 | //qDebug("VAL %d ",val ); | 794 | //qDebug("VAL %d ",val ); |
792 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 795 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
793 | stepdays = day+stepdays; | 796 | stepdays = day+stepdays; |
794 | if ( stepdays < 0 ) stepdays = 0; | 797 | if ( stepdays < 0 ) stepdays = 0; |
795 | } | 798 | } |
796 | if ( stepdays == day ) { | 799 | if ( stepdays == day ) { |
797 | block = false; | 800 | flag_blockScrollBar = false; |
798 | return; | 801 | return; |
799 | } | 802 | } |
800 | int year = mNavigator->selectedDates().first().year(); | 803 | int year = mNavigator->selectedDates().first().year(); |
801 | QDate d ( year,1,1 ); | 804 | QDate d ( year,1,1 ); |
802 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); | 805 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); |
803 | block = false; | 806 | flag_blockScrollBar = false; |
804 | #endif | 807 | #endif |
805 | 808 | ||
806 | } | 809 | } |
807 | void CalendarView::updateView(const QDate &start, const QDate &end) | 810 | void CalendarView::updateView(const QDate &start, const QDate &end) |
808 | { | 811 | { |
809 | #ifdef DESKTOP_VERSION | 812 | #ifdef DESKTOP_VERSION |
810 | if ( ! mDateScrollBar->draggingSlider () ) { | 813 | if ( ! mDateScrollBar->draggingSlider () ) { |
811 | int dof = start.dayOfYear(); | 814 | int dof = start.dayOfYear(); |
812 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); | 815 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); |
813 | if ( dof != mDateScrollBar->value() ) { | 816 | if ( dof != mDateScrollBar->value() ) { |
814 | mDateScrollBar->blockSignals( true ); | 817 | mDateScrollBar->blockSignals( true ); |
815 | mDateScrollBar->setValue( start.dayOfYear()); | 818 | mDateScrollBar->setValue( start.dayOfYear()); |
816 | mDateScrollBar->blockSignals( false ); | 819 | mDateScrollBar->blockSignals( false ); |
817 | } | 820 | } |
818 | } | 821 | } |
819 | #endif | 822 | #endif |
820 | mTodoList->updateView(); | 823 | mTodoList->updateView(); |
821 | mViewManager->updateView(start, end); | 824 | mViewManager->updateView(start, end); |
822 | //mDateNavigator->updateView(); | 825 | //mDateNavigator->updateView(); |
823 | } | 826 | } |
824 | 827 | ||
825 | 828 | ||
826 | 829 | ||
827 | void CalendarView::checkFiles() | 830 | void CalendarView::checkFiles() |
828 | { | 831 | { |
829 | QString message; | 832 | QString message; |
830 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 833 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
831 | KopiCalendarFile * cal = calendars.first(); | 834 | KopiCalendarFile * cal = calendars.first(); |
832 | while ( cal ) { | 835 | while ( cal ) { |
833 | if ( cal->mErrorOnLoad ) { | 836 | if ( cal->mErrorOnLoad ) { |
834 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | 837 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |
835 | } | 838 | } |
836 | cal = calendars.next(); | 839 | cal = calendars.next(); |
837 | } | 840 | } |
838 | if ( !message.isEmpty() ) { | 841 | if ( !message.isEmpty() ) { |
839 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); | 842 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); |
840 | KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); | 843 | KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); |
841 | } | 844 | } |
842 | static bool firstTime = true; | 845 | if ( flag_checkFileFirsttime ) { |
843 | if ( firstTime ) { | 846 | flag_checkFileFirsttime = false; |
844 | firstTime = false; | ||
845 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); | 847 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); |
846 | } | 848 | } |
847 | } | 849 | } |
848 | void CalendarView::checkAlarms() | 850 | void CalendarView::checkAlarms() |
849 | { | 851 | { |
850 | KConfig *config = KOGlobals::config(); | 852 | KConfig *config = KOGlobals::config(); |
851 | config->setGroup( "AppRun" ); | 853 | config->setGroup( "AppRun" ); |
852 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 854 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
853 | int daysto = dt.daysTo( QDate::currentDate() ); | 855 | int daysto = dt.daysTo( QDate::currentDate() ); |
854 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 856 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
855 | dt = dt.addDays( days ); | 857 | dt = dt.addDays( days ); |
856 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 858 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
857 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 859 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
858 | //qDebug("KO: Reading program stop %d ", secs); | 860 | //qDebug("KO: Reading program stop %d ", secs); |
859 | //secs -= ( 3600 * 24*3 ); // debug only | 861 | //secs -= ( 3600 * 24*3 ); // debug only |
860 | QDateTime latest = dt.addSecs ( secs ); | 862 | QDateTime latest = dt.addSecs ( secs ); |
861 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 863 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
862 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 864 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
863 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 865 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
864 | QPtrList<Incidence> al; | 866 | QPtrList<Incidence> al; |
865 | Incidence* inL = el.first(); | 867 | Incidence* inL = el.first(); |
866 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 868 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
867 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 869 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
868 | while ( inL ) { | 870 | while ( inL ) { |
869 | bool ok = false; | 871 | bool ok = false; |
870 | int offset = 0; | 872 | int offset = 0; |
871 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 873 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
872 | if ( ok ) { | 874 | if ( ok ) { |
873 | //qDebug("OK %s",next.toString().latin1()); | 875 | //qDebug("OK %s",next.toString().latin1()); |
874 | if ( next < cur ) { | 876 | if ( next < cur ) { |
875 | al.append( inL ); | 877 | al.append( inL ); |
876 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 878 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
877 | } | 879 | } |
878 | } | 880 | } |
879 | inL = el.next(); | 881 | inL = el.next(); |
880 | } | 882 | } |
881 | if ( al.count() ) { | 883 | if ( al.count() ) { |
882 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 884 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
883 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 885 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
884 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 886 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
885 | lay->setSpacing( 0 ); | 887 | lay->setSpacing( 0 ); |
886 | lay->setMargin( 0 ); | 888 | lay->setMargin( 0 ); |
887 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 889 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
888 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 890 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
889 | lay->addWidget( matb ); | 891 | lay->addWidget( matb ); |
890 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 892 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
891 | int wid = 210; | 893 | int wid = 210; |
892 | int x = QApplication::desktop()->width() - wid - 7; | 894 | int x = QApplication::desktop()->width() - wid - 7; |
893 | int y = QApplication::desktop()->height() - wid - 70; | 895 | int y = QApplication::desktop()->height() - wid - 70; |
894 | dia->setGeometry ( x,y,wid,wid); | 896 | dia->setGeometry ( x,y,wid,wid); |
895 | } else { | 897 | } else { |
896 | int si = 220; | 898 | int si = 220; |
897 | if ( QApplication::desktop()->width() > 470 ) | 899 | if ( QApplication::desktop()->width() > 470 ) |
898 | si = 400; | 900 | si = 400; |
899 | dia->resize(si,si/2); | 901 | dia->resize(si,si/2); |
900 | } | 902 | } |
901 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 903 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
902 | dia->show(); | 904 | dia->show(); |
903 | 905 | ||
904 | } | 906 | } |
905 | #if 0 | 907 | #if 0 |
906 | // for creating timetracker test data | 908 | // for creating timetracker test data |
907 | qDebug("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCc "); | 909 | qDebug("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCc "); |
908 | Todo * nt; | 910 | Todo * nt; |
909 | mCalendar->close(); | 911 | mCalendar->close(); |
910 | { | 912 | { |
911 | Todo * root1 = new Todo; | 913 | Todo * root1 = new Todo; |
912 | mCalendar->addTodo( root1 ); | 914 | mCalendar->addTodo( root1 ); |
913 | root1->setSummary( "Project1"); | 915 | root1->setSummary( "Project1"); |
914 | root1->setPriority( 1 ); | 916 | root1->setPriority( 1 ); |
915 | root1->setCategories( QString( "Cat_Pro1") ); | 917 | root1->setCategories( QString( "Cat_Pro1") ); |
916 | root1->setDescription( "This is a test description of a root Project" ); | 918 | root1->setDescription( "This is a test description of a root Project" ); |
917 | root1->setPercentComplete( 20 ); | 919 | root1->setPercentComplete( 20 ); |
918 | updateView(); | 920 | updateView(); |
919 | QDateTime start = QDateTime ( QDate( 2004,11,1), QTime ( 7,30,0) ); | 921 | QDateTime start = QDateTime ( QDate( 2004,11,1), QTime ( 7,30,0) ); |
920 | QDateTime end = QDateTime ( QDate( 2005,8,5), QTime ( 0,0,0) ); | 922 | QDateTime end = QDateTime ( QDate( 2005,8,5), QTime ( 0,0,0) ); |
921 | 923 | ||
922 | nt = new Todo; | 924 | nt = new Todo; |
923 | mCalendar->addTodo( nt ); | 925 | mCalendar->addTodo( nt ); |
924 | nt->setSummary( "Planning Project1"); | 926 | nt->setSummary( "Planning Project1"); |
925 | nt->setPriority( 1 ); | 927 | nt->setPriority( 1 ); |
926 | nt->setDescription( "This is a test description of Planning Project1" ); | 928 | nt->setDescription( "This is a test description of Planning Project1" ); |
927 | nt->setPercentComplete( 20 ); | 929 | nt->setPercentComplete( 20 ); |
928 | nt->setCategories( QString( "Cat_Pro1,Cat_Plan_Pro1") ); | 930 | nt->setCategories( QString( "Cat_Pro1,Cat_Plan_Pro1") ); |
929 | 931 | ||
930 | 932 | ||
931 | Todo * sub1 = nt; | 933 | Todo * sub1 = nt; |
932 | sub1->setRelatedTo( root1 ); | 934 | sub1->setRelatedTo( root1 ); |
933 | 935 | ||
934 | nt = new Todo; | 936 | nt = new Todo; |
935 | mCalendar->addTodo( nt ); | 937 | mCalendar->addTodo( nt ); |
936 | nt->setSummary( "Planning Project1: Lutz"); | 938 | nt->setSummary( "Planning Project1: Lutz"); |
937 | nt->setPriority( 1 ); | 939 | nt->setPriority( 1 ); |
938 | nt->setDescription( "This todo counts the actual work of a person on a project" ); | 940 | nt->setDescription( "This todo counts the actual work of a person on a project" ); |
939 | nt->setPercentComplete( 20 ); | 941 | nt->setPercentComplete( 20 ); |
940 | nt->setCategories( QString( "Cat_Pro1,Cat_Plan_Pro1,Cat_Work_Lutz") ); | 942 | nt->setCategories( QString( "Cat_Pro1,Cat_Plan_Pro1,Cat_Work_Lutz") ); |
@@ -2923,362 +2925,360 @@ void CalendarView::writeFilterSettings(KConfig *config) | |||
2923 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2925 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2924 | } | 2926 | } |
2925 | 2927 | ||
2926 | 2928 | ||
2927 | void CalendarView::goToday() | 2929 | void CalendarView::goToday() |
2928 | { | 2930 | { |
2929 | if ( mViewManager->currentView()->isMonthView() ) | 2931 | if ( mViewManager->currentView()->isMonthView() ) |
2930 | mNavigator->selectTodayMonth(); | 2932 | mNavigator->selectTodayMonth(); |
2931 | else | 2933 | else |
2932 | mNavigator->selectToday(); | 2934 | mNavigator->selectToday(); |
2933 | } | 2935 | } |
2934 | 2936 | ||
2935 | void CalendarView::goNext() | 2937 | void CalendarView::goNext() |
2936 | { | 2938 | { |
2937 | mNavigator->selectNext(); | 2939 | mNavigator->selectNext(); |
2938 | } | 2940 | } |
2939 | 2941 | ||
2940 | void CalendarView::goPrevious() | 2942 | void CalendarView::goPrevious() |
2941 | { | 2943 | { |
2942 | mNavigator->selectPrevious(); | 2944 | mNavigator->selectPrevious(); |
2943 | } | 2945 | } |
2944 | void CalendarView::goNextMonth() | 2946 | void CalendarView::goNextMonth() |
2945 | { | 2947 | { |
2946 | mNavigator->selectNextMonth(); | 2948 | mNavigator->selectNextMonth(); |
2947 | } | 2949 | } |
2948 | 2950 | ||
2949 | void CalendarView::goPreviousMonth() | 2951 | void CalendarView::goPreviousMonth() |
2950 | { | 2952 | { |
2951 | mNavigator->selectPreviousMonth(); | 2953 | mNavigator->selectPreviousMonth(); |
2952 | } | 2954 | } |
2953 | 2955 | ||
2954 | void CalendarView::updateConfig() | 2956 | void CalendarView::updateConfig() |
2955 | { | 2957 | { |
2956 | if ( KOPrefs::instance()->mUseAppColors ) | 2958 | if ( KOPrefs::instance()->mUseAppColors ) |
2957 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2959 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2958 | emit configChanged(); | 2960 | emit configChanged(); |
2959 | mTodoList->updateConfig(); | 2961 | mTodoList->updateConfig(); |
2960 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2962 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2961 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2963 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2962 | // To make the "fill window" configurations work | 2964 | // To make the "fill window" configurations work |
2963 | //mViewManager->raiseCurrentView(); | 2965 | //mViewManager->raiseCurrentView(); |
2964 | } | 2966 | } |
2965 | 2967 | ||
2966 | 2968 | ||
2967 | void CalendarView::eventChanged(Event *event) | 2969 | void CalendarView::eventChanged(Event *event) |
2968 | { | 2970 | { |
2969 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2971 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2970 | //updateUnmanagedViews(); | 2972 | //updateUnmanagedViews(); |
2971 | } | 2973 | } |
2972 | 2974 | ||
2973 | void CalendarView::eventAdded(Event *event) | 2975 | void CalendarView::eventAdded(Event *event) |
2974 | { | 2976 | { |
2975 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2977 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2976 | } | 2978 | } |
2977 | 2979 | ||
2978 | void CalendarView::eventToBeDeleted(Event *) | 2980 | void CalendarView::eventToBeDeleted(Event *) |
2979 | { | 2981 | { |
2980 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2982 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2981 | } | 2983 | } |
2982 | 2984 | ||
2983 | void CalendarView::eventDeleted() | 2985 | void CalendarView::eventDeleted() |
2984 | { | 2986 | { |
2985 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2987 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2986 | } | 2988 | } |
2987 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2989 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2988 | { | 2990 | { |
2989 | changeIncidenceDisplay((Incidence *)which, action); | 2991 | changeIncidenceDisplay((Incidence *)which, action); |
2990 | mDateNavigator->updateView(); //LR | 2992 | mDateNavigator->updateView(); //LR |
2991 | //mDialogManager->updateSearchDialog(); | 2993 | //mDialogManager->updateSearchDialog(); |
2992 | 2994 | ||
2993 | if (which) { | 2995 | if (which) { |
2994 | mViewManager->updateWNview(); | 2996 | mViewManager->updateWNview(); |
2995 | //mTodoList->updateView(); | 2997 | //mTodoList->updateView(); |
2996 | } | 2998 | } |
2997 | 2999 | ||
2998 | } | 3000 | } |
2999 | 3001 | ||
3000 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 3002 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
3001 | { | 3003 | { |
3002 | updateUnmanagedViews(); | 3004 | updateUnmanagedViews(); |
3003 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 3005 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
3004 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 3006 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
3005 | mCalendar->checkAlarmForIncidence( 0, true ); | 3007 | mCalendar->checkAlarmForIncidence( 0, true ); |
3006 | if ( mEventViewerDialog ) | 3008 | if ( mEventViewerDialog ) |
3007 | mEventViewerDialog->hide(); | 3009 | mEventViewerDialog->hide(); |
3008 | } | 3010 | } |
3009 | else | 3011 | else |
3010 | mCalendar->checkAlarmForIncidence( which , false ); | 3012 | mCalendar->checkAlarmForIncidence( which , false ); |
3011 | } | 3013 | } |
3012 | 3014 | ||
3013 | // most of the changeEventDisplays() right now just call the view's | 3015 | // most of the changeEventDisplays() right now just call the view's |
3014 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 3016 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
3015 | void CalendarView::changeEventDisplay(Event *which, int action) | 3017 | void CalendarView::changeEventDisplay(Event *which, int action) |
3016 | { | 3018 | { |
3017 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 3019 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
3018 | changeIncidenceDisplay((Incidence *)which, action); | 3020 | changeIncidenceDisplay((Incidence *)which, action); |
3019 | static bool clearallviews = false; | ||
3020 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 3021 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
3021 | if ( clearallviews ) { | 3022 | if ( flag_clearallviewsEventDisplay ) { |
3022 | clearAllViews(); | 3023 | clearAllViews(); |
3023 | clearallviews = false; | 3024 | flag_clearallviewsEventDisplay = false; |
3024 | } | 3025 | } |
3025 | return; | 3026 | return; |
3026 | } | 3027 | } |
3027 | clearallviews = true; | 3028 | flag_clearallviewsEventDisplay = true; |
3028 | mDateNavigator->updateView(); | 3029 | mDateNavigator->updateView(); |
3029 | //mDialogManager->updateSearchDialog(); | 3030 | //mDialogManager->updateSearchDialog(); |
3030 | if (which) { | 3031 | if (which) { |
3031 | // If there is an event view visible update the display | 3032 | // If there is an event view visible update the display |
3032 | mViewManager->currentView()->changeEventDisplay(which,action); | 3033 | mViewManager->currentView()->changeEventDisplay(which,action); |
3033 | // TODO: check, if update needed | 3034 | // TODO: check, if update needed |
3034 | // if (which->getTodoStatus()) { | 3035 | // if (which->getTodoStatus()) { |
3035 | mTodoList->updateView(); | 3036 | mTodoList->updateView(); |
3036 | if ( action != KOGlobals::EVENTDELETED && KOPrefs::instance()->mDetectConflicts ) { | 3037 | if ( action != KOGlobals::EVENTDELETED && KOPrefs::instance()->mDetectConflicts ) { |
3037 | mConflictingEvent = which ; | 3038 | mConflictingEvent = which ; |
3038 | int time = 1000; | 3039 | int time = 1000; |
3039 | #ifdef DESKTOP_VERSION | 3040 | #ifdef DESKTOP_VERSION |
3040 | time = 500; | 3041 | time = 500; |
3041 | #endif | 3042 | #endif |
3042 | bool checkC = false; | 3043 | bool checkC = false; |
3043 | if ( mConflictingEvent->doesFloat() ) { | 3044 | if ( mConflictingEvent->doesFloat() ) { |
3044 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay | 3045 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay |
3045 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; | 3046 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; |
3046 | } else { | 3047 | } else { |
3047 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay | 3048 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay |
3048 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; | 3049 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; |
3049 | } | 3050 | } |
3050 | if ( !KOPrefs::instance()->mIncludeFree && mConflictingEvent->transparency() == KCal::Event::Transparent ) | 3051 | if ( !KOPrefs::instance()->mIncludeFree && mConflictingEvent->transparency() == KCal::Event::Transparent ) |
3051 | checkC = false; | 3052 | checkC = false; |
3052 | if ( checkC ) | 3053 | if ( checkC ) |
3053 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 3054 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
3054 | } | 3055 | } |
3055 | // } | 3056 | // } |
3056 | } else { | 3057 | } else { |
3057 | mViewManager->currentView()->updateView(); | 3058 | mViewManager->currentView()->updateView(); |
3058 | } | 3059 | } |
3059 | } | 3060 | } |
3060 | void CalendarView::checkConflictForEvent() | 3061 | void CalendarView::checkConflictForEvent() |
3061 | { | 3062 | { |
3062 | 3063 | ||
3063 | if (!KOPrefs::instance()->mConfirm) | 3064 | if (!KOPrefs::instance()->mConfirm) |
3064 | return; | 3065 | return; |
3065 | if ( ! mConflictingEvent ) return; | 3066 | if ( ! mConflictingEvent ) return; |
3066 | Event * conflictingEvent = mConflictingEvent; | 3067 | Event * conflictingEvent = mConflictingEvent; |
3067 | mConflictingEvent = 0; | 3068 | mConflictingEvent = 0; |
3068 | QDateTime current = QDateTime::currentDateTime(); | 3069 | QDateTime current = QDateTime::currentDateTime(); |
3069 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { | 3070 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
3070 | return; | 3071 | return; |
3071 | } | 3072 | } |
3072 | CalFilter *filterIN = 0; | 3073 | CalFilter *filterIN = 0; |
3073 | CalFilter *filterALL = 0; | 3074 | CalFilter *filterALL = 0; |
3074 | CalFilter *filter = mFilters.first(); | 3075 | CalFilter *filter = mFilters.first(); |
3075 | while(filter) { | 3076 | while(filter) { |
3076 | if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) | 3077 | if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) |
3077 | filterIN = filter; | 3078 | filterIN = filter; |
3078 | if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) | 3079 | if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) |
3079 | filterALL = filter; | 3080 | filterALL = filter; |
3080 | filter = mFilters.next(); | 3081 | filter = mFilters.next(); |
3081 | } | 3082 | } |
3082 | if ( filterIN ) { | 3083 | if ( filterIN ) { |
3083 | if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { | 3084 | if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { |
3084 | return; | 3085 | return; |
3085 | } | 3086 | } |
3086 | } | 3087 | } |
3087 | QPtrList<Event> testlist = mCalendar->events(); | 3088 | QPtrList<Event> testlist = mCalendar->events(); |
3088 | Event * test = testlist.first(); | 3089 | Event * test = testlist.first(); |
3089 | QDateTime conflict; | 3090 | QDateTime conflict; |
3090 | QDateTime retVal; | 3091 | QDateTime retVal; |
3091 | bool found = false; | 3092 | bool found = false; |
3092 | Event * cE = 0; | 3093 | Event * cE = 0; |
3093 | bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; | 3094 | bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; |
3094 | bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; | 3095 | bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; |
3095 | if ( !conflictingEvent->doesFloat() ) { | 3096 | if ( !conflictingEvent->doesFloat() ) { |
3096 | chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; | 3097 | chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; |
3097 | chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; | 3098 | chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; |
3098 | } | 3099 | } |
3099 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 3100 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
3100 | while ( test ) { | 3101 | while ( test ) { |
3101 | qApp->processEvents(); | 3102 | qApp->processEvents(); |
3102 | bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); | 3103 | bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); |
3103 | 3104 | ||
3104 | if ( !skip ) { | 3105 | if ( !skip ) { |
3105 | if ( !KOPrefs::instance()->mIncludeFree && test->transparency() == KCal::Event::Transparent ) | 3106 | if ( !KOPrefs::instance()->mIncludeFree && test->transparency() == KCal::Event::Transparent ) |
3106 | skip = true; | 3107 | skip = true; |
3107 | } | 3108 | } |
3108 | if ( !skip ) { | 3109 | if ( !skip ) { |
3109 | if ( filterALL ) { | 3110 | if ( filterALL ) { |
3110 | if ( !filterALL->filterCalendarItem( test ) ) { | 3111 | if ( !filterALL->filterCalendarItem( test ) ) { |
3111 | skip = true; | 3112 | skip = true; |
3112 | } | 3113 | } |
3113 | } | 3114 | } |
3114 | if ( !skip ) { | 3115 | if ( !skip ) { |
3115 | if ( found ) | 3116 | if ( found ) |
3116 | skip = !test->matchTime( ¤t, &conflict ); | 3117 | skip = !test->matchTime( ¤t, &conflict ); |
3117 | else | 3118 | else |
3118 | skip = !test->matchTime( ¤t, 0 ); | 3119 | skip = !test->matchTime( ¤t, 0 ); |
3119 | if ( !skip ) { | 3120 | if ( !skip ) { |
3120 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 3121 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
3121 | if ( ! found ) { | 3122 | if ( ! found ) { |
3122 | conflict = retVal; | 3123 | conflict = retVal; |
3123 | cE = test; | 3124 | cE = test; |
3124 | } else { | 3125 | } else { |
3125 | if ( retVal < conflict ) { | 3126 | if ( retVal < conflict ) { |
3126 | conflict = retVal; | 3127 | conflict = retVal; |
3127 | cE = test; | 3128 | cE = test; |
3128 | } | 3129 | } |
3129 | } | 3130 | } |
3130 | found = true; | 3131 | found = true; |
3131 | } | 3132 | } |
3132 | } | 3133 | } |
3133 | } | 3134 | } |
3134 | } | 3135 | } |
3135 | test = testlist.next(); | 3136 | test = testlist.next(); |
3136 | } | 3137 | } |
3137 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 3138 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
3138 | if ( found ) { | 3139 | if ( found ) { |
3139 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 3140 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
3140 | qApp->processEvents(); | 3141 | qApp->processEvents(); |
3141 | int km = KMessageBox::warningContinueCancel(this,mess, | 3142 | int km = KMessageBox::warningContinueCancel(this,mess, |
3142 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); | 3143 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); |
3143 | if ( km != KMessageBox::Continue ) { | 3144 | if ( km != KMessageBox::Continue ) { |
3144 | return; | 3145 | return; |
3145 | } | 3146 | } |
3146 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 3147 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
3147 | mViewManager->showDayView(); | 3148 | mViewManager->showDayView(); |
3148 | mNavigator->slotDaySelect( conflict.date() ); | 3149 | mNavigator->slotDaySelect( conflict.date() ); |
3149 | int hour = conflict.time().hour(); | 3150 | int hour = conflict.time().hour(); |
3150 | mViewManager->agendaView()->setStartHour( hour ); | 3151 | mViewManager->agendaView()->setStartHour( hour ); |
3151 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 3152 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
3152 | } else | 3153 | } else |
3153 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 3154 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
3154 | return; | 3155 | return; |
3155 | 3156 | ||
3156 | } | 3157 | } |
3157 | 3158 | ||
3158 | void CalendarView::updateTodoViews() | 3159 | void CalendarView::updateTodoViews() |
3159 | { | 3160 | { |
3160 | mTodoList->updateView(); | 3161 | mTodoList->updateView(); |
3161 | mViewManager->currentView()->updateView(); | 3162 | mViewManager->currentView()->updateView(); |
3162 | 3163 | ||
3163 | } | 3164 | } |
3164 | 3165 | ||
3165 | 3166 | ||
3166 | 3167 | ||
3167 | void CalendarView::clearAllViews() | 3168 | void CalendarView::clearAllViews() |
3168 | { | 3169 | { |
3169 | mTodoList->clearList(); | 3170 | mTodoList->clearList(); |
3170 | mViewManager->clearAllViews(); | 3171 | mViewManager->clearAllViews(); |
3171 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 3172 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
3172 | if ( sd ) { | 3173 | if ( sd ) { |
3173 | KOListView* kol = sd->listview(); | 3174 | KOListView* kol = sd->listview(); |
3174 | if ( kol ) | 3175 | if ( kol ) |
3175 | kol->clearList(); | 3176 | kol->clearList(); |
3176 | } | 3177 | } |
3177 | } | 3178 | } |
3178 | void CalendarView::updateView() | 3179 | void CalendarView::updateView() |
3179 | { | 3180 | { |
3180 | static bool clearallviews = false; | ||
3181 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 3181 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
3182 | if ( clearallviews ) { | 3182 | if ( flag_clearallviewsupdateView ) { |
3183 | clearAllViews(); | 3183 | clearAllViews(); |
3184 | clearallviews = false; | 3184 | flag_clearallviewsupdateView = false; |
3185 | } | 3185 | } |
3186 | return; | 3186 | return; |
3187 | } | 3187 | } |
3188 | clearallviews = true; | 3188 | flag_clearallviewsupdateView = true; |
3189 | DateList tmpList = mNavigator->selectedDates(); | 3189 | DateList tmpList = mNavigator->selectedDates(); |
3190 | 3190 | ||
3191 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 3191 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
3192 | mTodoList->updateView(); | 3192 | mTodoList->updateView(); |
3193 | // We assume that the navigator only selects consecutive days. | 3193 | // We assume that the navigator only selects consecutive days. |
3194 | updateView( tmpList.first(), tmpList.last() ); | 3194 | updateView( tmpList.first(), tmpList.last() ); |
3195 | } | 3195 | } |
3196 | 3196 | ||
3197 | void CalendarView::updateUnmanagedViews() | 3197 | void CalendarView::updateUnmanagedViews() |
3198 | { | 3198 | { |
3199 | mDateNavigator->updateDayMatrix(); | 3199 | mDateNavigator->updateDayMatrix(); |
3200 | } | 3200 | } |
3201 | 3201 | ||
3202 | int CalendarView::msgItemDelete(const QString name) | 3202 | int CalendarView::msgItemDelete(const QString name) |
3203 | { | 3203 | { |
3204 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 3204 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
3205 | i18n("This item will be\npermanently deleted."), | 3205 | i18n("This item will be\npermanently deleted."), |
3206 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 3206 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
3207 | } | 3207 | } |
3208 | 3208 | ||
3209 | 3209 | ||
3210 | void CalendarView::edit_cut() | 3210 | void CalendarView::edit_cut() |
3211 | { | 3211 | { |
3212 | Event *anEvent=0; | 3212 | Event *anEvent=0; |
3213 | 3213 | ||
3214 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3214 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3215 | 3215 | ||
3216 | if (mViewManager->currentView()->isEventView()) { | 3216 | if (mViewManager->currentView()->isEventView()) { |
3217 | if ( incidence && incidence->typeID() == eventID ) { | 3217 | if ( incidence && incidence->typeID() == eventID ) { |
3218 | anEvent = static_cast<Event *>(incidence); | 3218 | anEvent = static_cast<Event *>(incidence); |
3219 | } | 3219 | } |
3220 | } | 3220 | } |
3221 | 3221 | ||
3222 | if (!anEvent) { | 3222 | if (!anEvent) { |
3223 | KNotifyClient::beep(); | 3223 | KNotifyClient::beep(); |
3224 | return; | 3224 | return; |
3225 | } | 3225 | } |
3226 | DndFactory factory( mCalendar ); | 3226 | DndFactory factory( mCalendar ); |
3227 | factory.cutIncidence(anEvent); | 3227 | factory.cutIncidence(anEvent); |
3228 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3228 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3229 | } | 3229 | } |
3230 | 3230 | ||
3231 | void CalendarView::edit_copy() | 3231 | void CalendarView::edit_copy() |
3232 | { | 3232 | { |
3233 | Event *anEvent=0; | 3233 | Event *anEvent=0; |
3234 | 3234 | ||
3235 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3235 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3236 | 3236 | ||
3237 | if (mViewManager->currentView()->isEventView()) { | 3237 | if (mViewManager->currentView()->isEventView()) { |
3238 | if ( incidence && incidence->typeID() == eventID ) { | 3238 | if ( incidence && incidence->typeID() == eventID ) { |
3239 | anEvent = static_cast<Event *>(incidence); | 3239 | anEvent = static_cast<Event *>(incidence); |
3240 | } | 3240 | } |
3241 | } | 3241 | } |
3242 | 3242 | ||
3243 | if (!anEvent) { | 3243 | if (!anEvent) { |
3244 | KNotifyClient::beep(); | 3244 | KNotifyClient::beep(); |
3245 | return; | 3245 | return; |
3246 | } | 3246 | } |
3247 | DndFactory factory( mCalendar ); | 3247 | DndFactory factory( mCalendar ); |
3248 | factory.copyIncidence(anEvent); | 3248 | factory.copyIncidence(anEvent); |
3249 | } | 3249 | } |
3250 | 3250 | ||
3251 | void CalendarView::edit_paste() | 3251 | void CalendarView::edit_paste() |
3252 | { | 3252 | { |
3253 | QDate date = mNavigator->selectedDates().first(); | 3253 | QDate date = mNavigator->selectedDates().first(); |
3254 | 3254 | ||
3255 | DndFactory factory( mCalendar ); | 3255 | DndFactory factory( mCalendar ); |
3256 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 3256 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
3257 | 3257 | ||
3258 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 3258 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
3259 | } | 3259 | } |
3260 | void CalendarView::edit_global_options() | 3260 | void CalendarView::edit_global_options() |
3261 | { | 3261 | { |
3262 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 3262 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
3263 | emit save(); | 3263 | emit save(); |
3264 | emit saveStopTimer(); | 3264 | emit saveStopTimer(); |
3265 | mDialogManager->showGlobalOptionsDialog(); | 3265 | mDialogManager->showGlobalOptionsDialog(); |
3266 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 3266 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
3267 | emit saveStopTimer(); | 3267 | emit saveStopTimer(); |
3268 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 3268 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
3269 | i18n("Timezone settings"),i18n("Reload"))) { | 3269 | i18n("Timezone settings"),i18n("Reload"))) { |
3270 | qDebug("KO: TZ reload cancelled "); | 3270 | qDebug("KO: TZ reload cancelled "); |
3271 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 3271 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
3272 | return; | 3272 | return; |
3273 | } | 3273 | } |
3274 | qDebug("KO: Timezone change "); | 3274 | qDebug("KO: Timezone change "); |
3275 | loadCalendars(); | 3275 | loadCalendars(); |
3276 | setModified(true); | 3276 | setModified(true); |
3277 | } | 3277 | } |
3278 | else | 3278 | else |
3279 | qDebug("KO: No tz change "); | 3279 | qDebug("KO: No tz change "); |
3280 | } | 3280 | } |
3281 | void CalendarView::edit_options() | 3281 | void CalendarView::edit_options() |
3282 | { | 3282 | { |
3283 | mDialogManager->showOptionsDialog(); | 3283 | mDialogManager->showOptionsDialog(); |
3284 | } | 3284 | } |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 0924f07..80f7ed4 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -458,192 +458,197 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
458 | void goPrevious(); | 458 | void goPrevious(); |
459 | /** Move to the next date(s) in the current view */ | 459 | /** Move to the next date(s) in the current view */ |
460 | void goNextMonth(); | 460 | void goNextMonth(); |
461 | 461 | ||
462 | /** Move to the previous date(s) in the current view */ | 462 | /** Move to the previous date(s) in the current view */ |
463 | void goPreviousMonth(); | 463 | void goPreviousMonth(); |
464 | 464 | ||
465 | void toggleExpand(); | 465 | void toggleExpand(); |
466 | void toggleDateNavigatorWidget(); | 466 | void toggleDateNavigatorWidget(); |
467 | void toggleAllDaySize(); | 467 | void toggleAllDaySize(); |
468 | 468 | ||
469 | /** Look for new messages in the inbox */ | 469 | /** Look for new messages in the inbox */ |
470 | void lookForIncomingMessages(); | 470 | void lookForIncomingMessages(); |
471 | /** Look for new messages in the outbox */ | 471 | /** Look for new messages in the outbox */ |
472 | void lookForOutgoingMessages(); | 472 | void lookForOutgoingMessages(); |
473 | 473 | ||
474 | void processMainViewSelection( Incidence * ); | 474 | void processMainViewSelection( Incidence * ); |
475 | void processTodoListSelection( Incidence * ); | 475 | void processTodoListSelection( Incidence * ); |
476 | 476 | ||
477 | void processIncidenceSelection( Incidence * ); | 477 | void processIncidenceSelection( Incidence * ); |
478 | 478 | ||
479 | void purgeCompleted(); | 479 | void purgeCompleted(); |
480 | bool removeCompletedSubTodos( Todo* ); | 480 | bool removeCompletedSubTodos( Todo* ); |
481 | void slotCalendarChanged(); | 481 | void slotCalendarChanged(); |
482 | bool importBday(); | 482 | bool importBday(); |
483 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 483 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
484 | bool importQtopia( const QString &categoriesFile, | 484 | bool importQtopia( const QString &categoriesFile, |
485 | const QString &datebookFile, | 485 | const QString &datebookFile, |
486 | const QString &tasklistFile ); | 486 | const QString &tasklistFile ); |
487 | void syncExternal( int mode ); | 487 | void syncExternal( int mode ); |
488 | void slotSelectPickerDate( QDate ) ; | 488 | void slotSelectPickerDate( QDate ) ; |
489 | void showDatePicker() ; | 489 | void showDatePicker() ; |
490 | void showDatePickerPopup() ; | 490 | void showDatePickerPopup() ; |
491 | void moveIncidence(Incidence *) ; | 491 | void moveIncidence(Incidence *) ; |
492 | void beamIncidence(Incidence *) ; | 492 | void beamIncidence(Incidence *) ; |
493 | void beamCalendar() ; | 493 | void beamCalendar() ; |
494 | void beamFilteredCalendar() ; | 494 | void beamFilteredCalendar() ; |
495 | void beamIncidenceList(QPtrList<Incidence>) ; | 495 | void beamIncidenceList(QPtrList<Incidence>) ; |
496 | void manageCategories(); | 496 | void manageCategories(); |
497 | void editCategories(); | 497 | void editCategories(); |
498 | int addCategories(); | 498 | int addCategories(); |
499 | void removeCategories(); | 499 | void removeCategories(); |
500 | void setSyncDevice( QString ); | 500 | void setSyncDevice( QString ); |
501 | void setSyncName( QString ); | 501 | void setSyncName( QString ); |
502 | void showDay( QDate ); | 502 | void showDay( QDate ); |
503 | void undo_delete(); | 503 | void undo_delete(); |
504 | protected slots: | 504 | protected slots: |
505 | void resetFocus(); | 505 | void resetFocus(); |
506 | void scrollBarValue(int); | 506 | void scrollBarValue(int); |
507 | void slotViewerClosed(); | 507 | void slotViewerClosed(); |
508 | void timerAlarm(); | 508 | void timerAlarm(); |
509 | void suspendAlarm(); | 509 | void suspendAlarm(); |
510 | void beamDone( Ir *ir ); | 510 | void beamDone( Ir *ir ); |
511 | /** Select a view or adapt the current view to display the specified dates. */ | 511 | /** Select a view or adapt the current view to display the specified dates. */ |
512 | void showDates( const KCal::DateList & ); | 512 | void showDates( const KCal::DateList & ); |
513 | void selectWeekNum ( int ); | 513 | void selectWeekNum ( int ); |
514 | void checkConflictForEvent(); | 514 | void checkConflictForEvent(); |
515 | 515 | ||
516 | public: | 516 | public: |
517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); | 517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); |
518 | // show a standard warning | 518 | // show a standard warning |
519 | // returns KMsgBox::yesNoCancel() | 519 | // returns KMsgBox::yesNoCancel() |
520 | int msgCalModified(); | 520 | int msgCalModified(); |
521 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 521 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
522 | 522 | ||
523 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 523 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
524 | virtual void removeSyncInfo( QString syncProfile); | 524 | virtual void removeSyncInfo( QString syncProfile); |
525 | void setSyncManager(KSyncManager* manager); | 525 | void setSyncManager(KSyncManager* manager); |
526 | void setLoadedFileVersion(QDateTime); | 526 | void setLoadedFileVersion(QDateTime); |
527 | bool checkFileVersion(QString fn); | 527 | bool checkFileVersion(QString fn); |
528 | bool checkAllFileVersions(); | 528 | bool checkAllFileVersions(); |
529 | bool checkFileChanged(QString fn); | 529 | bool checkFileChanged(QString fn); |
530 | Event* getLastSyncEvent(); | 530 | Event* getLastSyncEvent(); |
531 | /** Adapt navigation units correpsonding to step size of navigation of the | 531 | /** Adapt navigation units correpsonding to step size of navigation of the |
532 | * current view. | 532 | * current view. |
533 | */ | 533 | */ |
534 | void adaptNavigationUnits(); | 534 | void adaptNavigationUnits(); |
535 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 535 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
536 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 536 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
537 | //Attendee* getYourAttendee(Event *event); | 537 | //Attendee* getYourAttendee(Event *event); |
538 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 538 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
539 | void setScrollBarStep(int val ); | 539 | void setScrollBarStep(int val ); |
540 | 540 | ||
541 | protected: | 541 | protected: |
542 | Event *mConflictingEvent; | 542 | Event *mConflictingEvent; |
543 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 543 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
544 | 544 | ||
545 | // returns KMsgBox::OKCandel() | 545 | // returns KMsgBox::OKCandel() |
546 | int msgItemDelete(const QString name); | 546 | int msgItemDelete(const QString name); |
547 | void showEventEditor(); | 547 | void showEventEditor(); |
548 | void showTodoEditor(); | 548 | void showTodoEditor(); |
549 | Todo *selectedTodo(); | 549 | Todo *selectedTodo(); |
550 | private: | 550 | private: |
551 | #ifdef DESKTOP_VERSION | 551 | #ifdef DESKTOP_VERSION |
552 | QScrollBar * mDateScrollBar; | 552 | QScrollBar * mDateScrollBar; |
553 | #endif | 553 | #endif |
554 | bool flag_blockConflict; | ||
555 | bool flag_blockScrollBar; | ||
556 | bool flag_checkFileFirsttime; | ||
557 | bool flag_clearallviewsEventDisplay; | ||
558 | bool flag_clearallviewsupdateView; | ||
554 | QDateTime mNextAlarmDateTime; | 559 | QDateTime mNextAlarmDateTime; |
555 | bool mViewerCallerIsSearchDialog; | 560 | bool mViewerCallerIsSearchDialog; |
556 | bool mBlockShowDates; | 561 | bool mBlockShowDates; |
557 | KSyncManager* mSyncManager; | 562 | KSyncManager* mSyncManager; |
558 | AlarmDialog * mAlarmDialog; | 563 | AlarmDialog * mAlarmDialog; |
559 | QString mAlarmNotification; | 564 | QString mAlarmNotification; |
560 | QString mSuspendAlarmNotification; | 565 | QString mSuspendAlarmNotification; |
561 | QTimer* mSuspendTimer; | 566 | QTimer* mSuspendTimer; |
562 | QTimer* mAlarmTimer; | 567 | QTimer* mAlarmTimer; |
563 | QTimer* mRecheckAlarmTimer; | 568 | QTimer* mRecheckAlarmTimer; |
564 | void computeAlarm( QString ); | 569 | void computeAlarm( QString ); |
565 | void startAlarm( QString, QString ); | 570 | void startAlarm( QString, QString ); |
566 | void setSyncEventsReadOnly(); | 571 | void setSyncEventsReadOnly(); |
567 | 572 | ||
568 | QDateTime loadedFileVersion; | 573 | QDateTime loadedFileVersion; |
569 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 574 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
570 | void checkExternalId( Incidence * inc ); | 575 | void checkExternalId( Incidence * inc ); |
571 | int mGlobalSyncMode; | 576 | int mGlobalSyncMode; |
572 | QString mCurrentSyncDevice; | 577 | QString mCurrentSyncDevice; |
573 | QString mCurrentSyncName; | 578 | QString mCurrentSyncName; |
574 | void init(); | 579 | void init(); |
575 | int mDatePickerMode; | 580 | int mDatePickerMode; |
576 | bool mFlagEditDescription; | 581 | bool mFlagEditDescription; |
577 | QDateTime mLastCalendarSync; | 582 | QDateTime mLastCalendarSync; |
578 | void createPrinter(); | 583 | void createPrinter(); |
579 | 584 | ||
580 | void calendarModified( bool, Calendar * ); | 585 | void calendarModified( bool, Calendar * ); |
581 | 586 | ||
582 | CalPrinter *mCalPrinter; | 587 | CalPrinter *mCalPrinter; |
583 | 588 | ||
584 | QSplitter *mPanner; | 589 | QSplitter *mPanner; |
585 | QSplitter *mLeftSplitter; | 590 | QSplitter *mLeftSplitter; |
586 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 591 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
587 | QWidgetStack *mRightFrame; | 592 | QWidgetStack *mRightFrame; |
588 | 593 | ||
589 | KDatePicker* mDatePicker; | 594 | KDatePicker* mDatePicker; |
590 | QVBox* mDateFrame; | 595 | QVBox* mDateFrame; |
591 | 596 | ||
592 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 597 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
593 | 598 | ||
594 | KOFilterView *mFilterView; | 599 | KOFilterView *mFilterView; |
595 | KOCalEditView *mCalEditView; | 600 | KOCalEditView *mCalEditView; |
596 | 601 | ||
597 | ResourceView *mResourceView; | 602 | ResourceView *mResourceView; |
598 | 603 | ||
599 | // calendar object for this viewing instance | 604 | // calendar object for this viewing instance |
600 | Calendar *mCalendar; | 605 | Calendar *mCalendar; |
601 | 606 | ||
602 | CalendarResourceManager *mResourceManager; | 607 | CalendarResourceManager *mResourceManager; |
603 | 608 | ||
604 | FileStorage *mStorage; | 609 | FileStorage *mStorage; |
605 | 610 | ||
606 | DateNavigator *mNavigator; | 611 | DateNavigator *mNavigator; |
607 | 612 | ||
608 | KOViewManager *mViewManager; | 613 | KOViewManager *mViewManager; |
609 | KODialogManager *mDialogManager; | 614 | KODialogManager *mDialogManager; |
610 | 615 | ||
611 | // Calendar filters | 616 | // Calendar filters |
612 | QPtrList<CalFilter> mFilters; | 617 | QPtrList<CalFilter> mFilters; |
613 | 618 | ||
614 | // various housekeeping variables. | 619 | // various housekeeping variables. |
615 | bool mModified; // flag indicating if calendar is modified | 620 | bool mModified; // flag indicating if calendar is modified |
616 | bool mReadOnly; // flag indicating if calendar is read-only | 621 | bool mReadOnly; // flag indicating if calendar is read-only |
617 | QDate mSaveSingleDate; | 622 | QDate mSaveSingleDate; |
618 | 623 | ||
619 | Incidence *mSelectedIncidence; | 624 | Incidence *mSelectedIncidence; |
620 | Incidence *mMoveIncidence; | 625 | Incidence *mMoveIncidence; |
621 | QDate mMoveIncidenceOldDate; | 626 | QDate mMoveIncidenceOldDate; |
622 | KOTodoView *mTodoList; | 627 | KOTodoView *mTodoList; |
623 | KOEventEditor * mEventEditor; | 628 | KOEventEditor * mEventEditor; |
624 | KOTodoEditor * mTodoEditor; | 629 | KOTodoEditor * mTodoEditor; |
625 | KOEventViewerDialog * mEventViewerDialog; | 630 | KOEventViewerDialog * mEventViewerDialog; |
626 | void keyPressEvent ( QKeyEvent *e) ; | 631 | void keyPressEvent ( QKeyEvent *e) ; |
627 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 632 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
628 | }; | 633 | }; |
629 | 634 | ||
630 | 635 | ||
631 | class CalendarViewVisitor : public Incidence::Visitor | 636 | class CalendarViewVisitor : public Incidence::Visitor |
632 | { | 637 | { |
633 | public: | 638 | public: |
634 | CalendarViewVisitor() : mView( 0 ) {} | 639 | CalendarViewVisitor() : mView( 0 ) {} |
635 | 640 | ||
636 | bool act( Incidence *incidence, CalendarView *view ) | 641 | bool act( Incidence *incidence, CalendarView *view ) |
637 | { | 642 | { |
638 | mView = view; | 643 | mView = view; |
639 | return incidence->accept( *this ); | 644 | return incidence->accept( *this ); |
640 | } | 645 | } |
641 | 646 | ||
642 | protected: | 647 | protected: |
643 | CalendarView *mView; | 648 | CalendarView *mView; |
644 | }; | 649 | }; |
645 | 650 | ||
646 | class ShowIncidenceVisitor : public CalendarViewVisitor | 651 | class ShowIncidenceVisitor : public CalendarViewVisitor |
647 | { | 652 | { |
648 | protected: | 653 | protected: |
649 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 654 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c1b149f..6e65a03 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -284,192 +284,193 @@ void TimeLabels::paintEvent(QPaintEvent*) | |||
284 | 284 | ||
285 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 285 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
286 | : QFrame(parent,name) | 286 | : QFrame(parent,name) |
287 | { | 287 | { |
288 | mColumns = 1; | 288 | mColumns = 1; |
289 | mTopBox = 0; | 289 | mTopBox = 0; |
290 | mLocation = loc; | 290 | mLocation = loc; |
291 | mTopLayout = 0; | 291 | mTopLayout = 0; |
292 | mPaintWidget = 0; | 292 | mPaintWidget = 0; |
293 | mXOffset = 0; | 293 | mXOffset = 0; |
294 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 294 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
295 | else mPixmap = SmallIcon("1downarrow"); | 295 | else mPixmap = SmallIcon("1downarrow"); |
296 | mEnabled.resize(mColumns); | 296 | mEnabled.resize(mColumns); |
297 | mEnabled.fill( false ); | 297 | mEnabled.fill( false ); |
298 | setMinimumHeight(mPixmap.height()); | 298 | setMinimumHeight(mPixmap.height()); |
299 | } | 299 | } |
300 | 300 | ||
301 | EventIndicator::~EventIndicator() | 301 | EventIndicator::~EventIndicator() |
302 | { | 302 | { |
303 | } | 303 | } |
304 | 304 | ||
305 | void EventIndicator::drawContents(QPainter *p) | 305 | void EventIndicator::drawContents(QPainter *p) |
306 | { | 306 | { |
307 | 307 | ||
308 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 308 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
309 | KDGanttSplitterHandle* han = 0; | 309 | KDGanttSplitterHandle* han = 0; |
310 | if ( mPaintWidget ) | 310 | if ( mPaintWidget ) |
311 | han = mPaintWidget->firstHandle(); | 311 | han = mPaintWidget->firstHandle(); |
312 | if ( ! han ) { | 312 | if ( ! han ) { |
313 | int i; | 313 | int i; |
314 | for(i=0;i<mColumns;++i) { | 314 | for(i=0;i<mColumns;++i) { |
315 | if (mEnabled[i]) { | 315 | if (mEnabled[i]) { |
316 | int cellWidth = contentsRect().right()/mColumns; | 316 | int cellWidth = contentsRect().right()/mColumns; |
317 | int xOffset = KOGlobals::self()->reverseLayout() ? | 317 | int xOffset = KOGlobals::self()->reverseLayout() ? |
318 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : | 318 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : |
319 | i*cellWidth + (cellWidth -mPixmap.width()) /2; | 319 | i*cellWidth + (cellWidth -mPixmap.width()) /2; |
320 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); | 320 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | } else { | 323 | } else { |
324 | han->repaint(); | 324 | han->repaint(); |
325 | //mPaintWidget->setBackgroundColor( red ); | 325 | //mPaintWidget->setBackgroundColor( red ); |
326 | 326 | ||
327 | QPainter pa( han ); | 327 | QPainter pa( han ); |
328 | int i; | 328 | int i; |
329 | bool setColor = false; | 329 | bool setColor = false; |
330 | for(i=0;i<mColumns;++i) { | 330 | for(i=0;i<mColumns;++i) { |
331 | if (mEnabled[i]) { | 331 | if (mEnabled[i]) { |
332 | setColor = true; | 332 | setColor = true; |
333 | 333 | ||
334 | int cellWidth = contentsRect().right()/mColumns; | 334 | int cellWidth = contentsRect().right()/mColumns; |
335 | int xOffset = KOGlobals::self()->reverseLayout() ? | 335 | int xOffset = KOGlobals::self()->reverseLayout() ? |
336 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 336 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
337 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 337 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
338 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 338 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
339 | //qDebug("222draw pix %d ",xOffset ); | 339 | //qDebug("222draw pix %d ",xOffset ); |
340 | 340 | ||
341 | } | 341 | } |
342 | 342 | ||
343 | } | 343 | } |
344 | pa.end(); | 344 | pa.end(); |
345 | 345 | ||
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | void EventIndicator::setXOffset( int x ) | 349 | void EventIndicator::setXOffset( int x ) |
350 | { | 350 | { |
351 | mXOffset = x; | 351 | mXOffset = x; |
352 | } | 352 | } |
353 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 353 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
354 | { | 354 | { |
355 | mPaintWidget = w; | 355 | mPaintWidget = w; |
356 | setMaximumHeight(0); | 356 | setMaximumHeight(0); |
357 | setMinimumHeight(0); | 357 | setMinimumHeight(0); |
358 | } | 358 | } |
359 | void EventIndicator::changeColumns(int columns) | 359 | void EventIndicator::changeColumns(int columns) |
360 | { | 360 | { |
361 | mColumns = columns; | 361 | mColumns = columns; |
362 | mEnabled.resize(mColumns); | 362 | mEnabled.resize(mColumns); |
363 | 363 | ||
364 | update(); | 364 | update(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void EventIndicator::enableColumn(int column, bool enable) | 367 | void EventIndicator::enableColumn(int column, bool enable) |
368 | { | 368 | { |
369 | mEnabled[column] = enable; | 369 | mEnabled[column] = enable; |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | //////////////////////////////////////////////////////////////////////////// | 373 | //////////////////////////////////////////////////////////////////////////// |
374 | //////////////////////////////////////////////////////////////////////////// | 374 | //////////////////////////////////////////////////////////////////////////// |
375 | //////////////////////////////////////////////////////////////////////////// | 375 | //////////////////////////////////////////////////////////////////////////// |
376 | 376 | ||
377 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 377 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
378 | KOEventView (cal,parent,name) | 378 | KOEventView (cal,parent,name) |
379 | { | 379 | { |
380 | flag_blockfillAgenda = false; | ||
380 | mBlockUpdating = true; | 381 | mBlockUpdating = true; |
381 | mStartHour = 8; | 382 | mStartHour = 8; |
382 | mSelectedDates.append(QDate::currentDate()); | 383 | mSelectedDates.append(QDate::currentDate()); |
383 | 384 | ||
384 | mLayoutDayLabels = 0; | 385 | mLayoutDayLabels = 0; |
385 | mDayLabelsFrame = 0; | 386 | mDayLabelsFrame = 0; |
386 | mDayLabels = 0; | 387 | mDayLabels = 0; |
387 | bool isRTL = KOGlobals::self()->reverseLayout(); | 388 | bool isRTL = KOGlobals::self()->reverseLayout(); |
388 | QPixmap expandPix; | 389 | QPixmap expandPix; |
389 | if ( KOPrefs::instance()->mVerticalScreen ) { | 390 | if ( KOPrefs::instance()->mVerticalScreen ) { |
390 | expandPix = SmallIcon( "1updownarrow" ); | 391 | expandPix = SmallIcon( "1updownarrow" ); |
391 | } else { | 392 | } else { |
392 | expandPix = SmallIcon("1leftrightarrow" ); | 393 | expandPix = SmallIcon("1leftrightarrow" ); |
393 | } | 394 | } |
394 | 395 | ||
395 | QBoxLayout *topLayout = new QVBoxLayout(this); | 396 | QBoxLayout *topLayout = new QVBoxLayout(this); |
396 | 397 | ||
397 | // Create day name labels for agenda columns | 398 | // Create day name labels for agenda columns |
398 | // Create agenda splitter | 399 | // Create agenda splitter |
399 | 400 | ||
400 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
401 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
402 | topLayout->addWidget( mSplitterAgenda ); | 403 | topLayout->addWidget( mSplitterAgenda ); |
403 | mAllDayFrame = new QHBox(mSplitterAgenda); | 404 | mAllDayFrame = new QHBox(mSplitterAgenda); |
404 | mAllDayFrame->setFocusPolicy(NoFocus); | 405 | mAllDayFrame->setFocusPolicy(NoFocus); |
405 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
406 | agendaFrame->setFocusPolicy(NoFocus); | 407 | agendaFrame->setFocusPolicy(NoFocus); |
407 | 408 | ||
408 | // Create all-day agenda widget | 409 | // Create all-day agenda widget |
409 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 410 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
410 | 411 | ||
411 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 412 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
412 | mExpandButton->setPixmap( expandPix ); | 413 | mExpandButton->setPixmap( expandPix ); |
413 | int widebut = mExpandButton->sizeHint().width()+4; | 414 | int widebut = mExpandButton->sizeHint().width()+4; |
414 | int heibut = mExpandButton->sizeHint().height()+4; | 415 | int heibut = mExpandButton->sizeHint().height()+4; |
415 | if ( heibut > widebut ) | 416 | if ( heibut > widebut ) |
416 | widebut = heibut ; | 417 | widebut = heibut ; |
417 | 418 | ||
418 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 419 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
419 | // QSizePolicy::Fixed ) ); | 420 | // QSizePolicy::Fixed ) ); |
420 | mExpandButton->setFixedSize( widebut, widebut); | 421 | mExpandButton->setFixedSize( widebut, widebut); |
421 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
422 | mExpandButton->setFocusPolicy(NoFocus); | 423 | mExpandButton->setFocusPolicy(NoFocus); |
423 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
424 | mAllDayAgenda->setFocusPolicy(NoFocus); | 425 | mAllDayAgenda->setFocusPolicy(NoFocus); |
425 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 426 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
426 | 427 | ||
427 | // Create event context menu for all day agenda | 428 | // Create event context menu for all day agenda |
428 | //mAllDayAgendaPopup = eventPopup(); | 429 | //mAllDayAgendaPopup = eventPopup(); |
429 | 430 | ||
430 | // Create agenda frame | 431 | // Create agenda frame |
431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 432 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 433 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
433 | 434 | ||
434 | // create event indicator bars | 435 | // create event indicator bars |
435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 436 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
436 | #ifndef DESKTOP_VERSION | 437 | #ifndef DESKTOP_VERSION |
437 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 438 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
438 | #endif | 439 | #endif |
439 | mDayLabelsFrame = new QHBox(agendaFrame); | 440 | mDayLabelsFrame = new QHBox(agendaFrame); |
440 | //topLayout->addWidget(mDayLabelsFrame); | 441 | //topLayout->addWidget(mDayLabelsFrame); |
441 | mDayLabels = new QFrame (mDayLabelsFrame); | 442 | mDayLabels = new QFrame (mDayLabelsFrame); |
442 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 443 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
443 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 444 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
444 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 445 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
445 | 446 | ||
446 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 447 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
447 | agendaFrame); | 448 | agendaFrame); |
448 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 449 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
449 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 450 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
450 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 451 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
451 | 452 | ||
452 | // Create time labels | 453 | // Create time labels |
453 | mTimeLabels = new TimeLabels(24,agendaFrame); | 454 | mTimeLabels = new TimeLabels(24,agendaFrame); |
454 | agendaLayout->addWidget(mTimeLabels,2,0); | 455 | agendaLayout->addWidget(mTimeLabels,2,0); |
455 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 456 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
456 | this,SLOT(updateConfig())); | 457 | this,SLOT(updateConfig())); |
457 | 458 | ||
458 | // Create agenda | 459 | // Create agenda |
459 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 460 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
460 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 461 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
461 | agendaLayout->setColStretch(1,1); | 462 | agendaLayout->setColStretch(1,1); |
462 | mAgenda->setFocusPolicy(NoFocus); | 463 | mAgenda->setFocusPolicy(NoFocus); |
463 | // Create event context menu for agenda | 464 | // Create event context menu for agenda |
464 | mAllAgendaPopup = eventPopup(); | 465 | mAllAgendaPopup = eventPopup(); |
465 | 466 | ||
466 | #if 0 | 467 | #if 0 |
467 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 468 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
468 | i18n("Toggle Alarm"),mAgenda, | 469 | i18n("Toggle Alarm"),mAgenda, |
469 | SLOT(popupAlarm()),true); | 470 | SLOT(popupAlarm()),true); |
470 | 471 | ||
471 | #endif | 472 | #endif |
472 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 473 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
473 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 474 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
474 | 475 | ||
475 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 476 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
@@ -1049,196 +1050,195 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | |||
1049 | 1050 | ||
1050 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 1051 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
1051 | if (item->lastMultiItem()) { | 1052 | if (item->lastMultiItem()) { |
1052 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1053 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1053 | endDt.setDate(startDate. | 1054 | endDt.setDate(startDate. |
1054 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1055 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1055 | } else { | 1056 | } else { |
1056 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1057 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1057 | endDt.setDate(startDate); | 1058 | endDt.setDate(startDate); |
1058 | } | 1059 | } |
1059 | } | 1060 | } |
1060 | } else { | 1061 | } else { |
1061 | // todo | 1062 | // todo |
1062 | if (item->lastMultiItem()) { | 1063 | if (item->lastMultiItem()) { |
1063 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1064 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1064 | endDt.setDate(startDate. | 1065 | endDt.setDate(startDate. |
1065 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1066 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1066 | } else { | 1067 | } else { |
1067 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 1068 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
1068 | if ( item->cellYBottom() > 0 ) | 1069 | if ( item->cellYBottom() > 0 ) |
1069 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1070 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1070 | else | 1071 | else |
1071 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1072 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1072 | endDt.setDate(startDate); | 1073 | endDt.setDate(startDate); |
1073 | } | 1074 | } |
1074 | } | 1075 | } |
1075 | } | 1076 | } |
1076 | if ( item->incidence()->typeID() == eventID ) { | 1077 | if ( item->incidence()->typeID() == eventID ) { |
1077 | item->incidence()->setDtStart(startDt); | 1078 | item->incidence()->setDtStart(startDt); |
1078 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1079 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1079 | } else if ( item->incidence()->typeID() == todoID ) { | 1080 | } else if ( item->incidence()->typeID() == todoID ) { |
1080 | Todo* to = static_cast<Todo*>(item->incidence()); | 1081 | Todo* to = static_cast<Todo*>(item->incidence()); |
1081 | 1082 | ||
1082 | to->setDtDue(endDt); | 1083 | to->setDtDue(endDt); |
1083 | if ( to->hasStartDate() ) { | 1084 | if ( to->hasStartDate() ) { |
1084 | if (to->dtStart() >= to->dtDue() ) | 1085 | if (to->dtStart() >= to->dtDue() ) |
1085 | to->setDtStart(to->dtDue().addDays( -2 )); | 1086 | to->setDtStart(to->dtDue().addDays( -2 )); |
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | } | 1089 | } |
1089 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1090 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1090 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1091 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1091 | item->setItemDate(startDt.date()); | 1092 | item->setItemDate(startDt.date()); |
1092 | //item->updateItem(); | 1093 | //item->updateItem(); |
1093 | if ( item->incidence()->typeID() == todoID ) { | 1094 | if ( item->incidence()->typeID() == todoID ) { |
1094 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1095 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1095 | 1096 | ||
1096 | } | 1097 | } |
1097 | else | 1098 | else |
1098 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1099 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1099 | item->updateItem(); | 1100 | item->updateItem(); |
1100 | } | 1101 | } |
1101 | 1102 | ||
1102 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1103 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1103 | { | 1104 | { |
1104 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1105 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1105 | 1106 | ||
1106 | mSelectedDates.clear(); | 1107 | mSelectedDates.clear(); |
1107 | // qDebug("KOAgendaView::showDates "); | 1108 | // qDebug("KOAgendaView::showDates "); |
1108 | QDate d = start; | 1109 | QDate d = start; |
1109 | while (d <= end) { | 1110 | while (d <= end) { |
1110 | mSelectedDates.append(d); | 1111 | mSelectedDates.append(d); |
1111 | d = d.addDays( 1 ); | 1112 | d = d.addDays( 1 ); |
1112 | } | 1113 | } |
1113 | 1114 | ||
1114 | // and update the view | 1115 | // and update the view |
1115 | fillAgenda(); | 1116 | fillAgenda(); |
1116 | } | 1117 | } |
1117 | 1118 | ||
1118 | 1119 | ||
1119 | void KOAgendaView::showEvents(QPtrList<Event>) | 1120 | void KOAgendaView::showEvents(QPtrList<Event>) |
1120 | { | 1121 | { |
1121 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1122 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1122 | } | 1123 | } |
1123 | 1124 | ||
1124 | void KOAgendaView::changeEventDisplay(Event *, int) | 1125 | void KOAgendaView::changeEventDisplay(Event *, int) |
1125 | { | 1126 | { |
1126 | // qDebug("KOAgendaView::changeEventDisplay "); | 1127 | // qDebug("KOAgendaView::changeEventDisplay "); |
1127 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1128 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1128 | // this should be re-written to be MUCH smarter. Right now we | 1129 | // this should be re-written to be MUCH smarter. Right now we |
1129 | // are just playing dumb. | 1130 | // are just playing dumb. |
1130 | fillAgenda(); | 1131 | fillAgenda(); |
1131 | } | 1132 | } |
1132 | 1133 | ||
1133 | void KOAgendaView::fillAgenda(const QDate &) | 1134 | void KOAgendaView::fillAgenda(const QDate &) |
1134 | { | 1135 | { |
1135 | // qDebug("KOAgendaView::fillAgenda "); | 1136 | // qDebug("KOAgendaView::fillAgenda "); |
1136 | fillAgenda(); | 1137 | fillAgenda(); |
1137 | } | 1138 | } |
1138 | 1139 | ||
1139 | void KOAgendaView::fillAgenda() | 1140 | void KOAgendaView::fillAgenda() |
1140 | { | 1141 | { |
1141 | if ( globalFlagBlockStartup ) | 1142 | if ( globalFlagBlockStartup ) |
1142 | return; | 1143 | return; |
1143 | if ( globalFlagBlockAgenda == 1 ) | 1144 | if ( globalFlagBlockAgenda == 1 ) |
1144 | return; | 1145 | return; |
1145 | static bool onlyOne = false; | 1146 | if ( flag_blockfillAgenda ) |
1146 | if ( onlyOne ) | ||
1147 | return; | 1147 | return; |
1148 | onlyOne = true; | 1148 | flag_blockfillAgenda = true; |
1149 | //if ( globalFlagBlockAgenda == 2 ) | 1149 | //if ( globalFlagBlockAgenda == 2 ) |
1150 | //globalFlagBlockAgenda = 0; | 1150 | //globalFlagBlockAgenda = 0; |
1151 | // globalFlagBlockPainting = false; | 1151 | // globalFlagBlockPainting = false; |
1152 | if ( globalFlagBlockAgenda == 0 ) | 1152 | if ( globalFlagBlockAgenda == 0 ) |
1153 | globalFlagBlockAgenda = 1; | 1153 | globalFlagBlockAgenda = 1; |
1154 | // clearView(); | 1154 | // clearView(); |
1155 | //qDebug("fillAgenda()++++ "); | 1155 | //qDebug("fillAgenda()++++ "); |
1156 | globalFlagBlockAgendaItemPaint = 1; | 1156 | globalFlagBlockAgendaItemPaint = 1; |
1157 | 1157 | ||
1158 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1158 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1159 | mAgenda->changeColumns(mSelectedDates.count()); | 1159 | mAgenda->changeColumns(mSelectedDates.count()); |
1160 | qApp->processEvents(); | 1160 | qApp->processEvents(); |
1161 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1161 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1162 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1162 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1163 | setHolidayMasks(); | 1163 | setHolidayMasks(); |
1164 | 1164 | ||
1165 | mMinY.resize(mSelectedDates.count()); | 1165 | mMinY.resize(mSelectedDates.count()); |
1166 | mMaxY.resize(mSelectedDates.count()); | 1166 | mMaxY.resize(mSelectedDates.count()); |
1167 | 1167 | ||
1168 | QPtrList<Event> dayEvents; | 1168 | QPtrList<Event> dayEvents; |
1169 | 1169 | ||
1170 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1170 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1171 | // Therefore, gtodoset all of them. | 1171 | // Therefore, gtodoset all of them. |
1172 | QPtrList<Todo> todos = calendar()->todos(); | 1172 | QPtrList<Todo> todos = calendar()->todos(); |
1173 | 1173 | ||
1174 | mAgenda->setDateList(mSelectedDates); | 1174 | mAgenda->setDateList(mSelectedDates); |
1175 | 1175 | ||
1176 | QDate today = QDate::currentDate(); | 1176 | QDate today = QDate::currentDate(); |
1177 | 1177 | ||
1178 | DateList::ConstIterator dit; | 1178 | DateList::ConstIterator dit; |
1179 | int curCol = 0; | 1179 | int curCol = 0; |
1180 | int maxCol = mSelectedDates.count()-1; | 1180 | int maxCol = mSelectedDates.count()-1; |
1181 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1181 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1182 | QDate currentDate = *dit; | 1182 | QDate currentDate = *dit; |
1183 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1183 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1184 | // << endl; | 1184 | // << endl; |
1185 | 1185 | ||
1186 | dayEvents = calendar()->events(currentDate,false); | 1186 | dayEvents = calendar()->events(currentDate,false); |
1187 | 1187 | ||
1188 | // Default values, which can never be reached | 1188 | // Default values, which can never be reached |
1189 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1189 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1190 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1190 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1191 | 1191 | ||
1192 | unsigned int numEvent; | 1192 | unsigned int numEvent; |
1193 | //qDebug("+++++NUMEVENT %d", dayEvents.count()); | 1193 | //qDebug("+++++NUMEVENT %d", dayEvents.count()); |
1194 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1194 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1195 | Event *event = dayEvents.at(numEvent); | 1195 | Event *event = dayEvents.at(numEvent); |
1196 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1196 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1197 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1197 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1198 | continue; | 1198 | continue; |
1199 | // kdDebug() << " Event: " << event->summary() << endl; | 1199 | // kdDebug() << " Event: " << event->summary() << endl; |
1200 | 1200 | ||
1201 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1201 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1202 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1202 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1203 | 1203 | ||
1204 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1204 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1205 | 1205 | ||
1206 | if (event->doesFloat()) { | 1206 | if (event->doesFloat()) { |
1207 | if (event->doesRecur()) { | 1207 | if (event->doesRecur()) { |
1208 | if (event->isMultiDay() ) { | 1208 | if (event->isMultiDay() ) { |
1209 | endX = endX - beginX;// endX is now number of days | 1209 | endX = endX - beginX;// endX is now number of days |
1210 | if ( event->recursOn( currentDate ) ) { | 1210 | if ( event->recursOn( currentDate ) ) { |
1211 | endX += curCol; | 1211 | endX += curCol; |
1212 | beginX = curCol; | 1212 | beginX = curCol; |
1213 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1213 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1214 | } else { | 1214 | } else { |
1215 | //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1()); | 1215 | //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1()); |
1216 | if ( curCol == maxCol && maxCol+1 < endX ) { | 1216 | if ( curCol == maxCol && maxCol+1 < endX ) { |
1217 | int i; | 1217 | int i; |
1218 | for ( i = 1; i< endX; ++i ) { | 1218 | for ( i = 1; i< endX; ++i ) { |
1219 | if ( event->recursOn( currentDate.addDays( -i ) ) ) | 1219 | if ( event->recursOn( currentDate.addDays( -i ) ) ) |
1220 | break; | 1220 | break; |
1221 | } | 1221 | } |
1222 | if ( i > maxCol ) { | 1222 | if ( i > maxCol ) { |
1223 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1223 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1224 | //qDebug("BINGO "); | 1224 | //qDebug("BINGO "); |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | } else { | 1227 | } else { |
1228 | QDate dateit = currentDate.addDays( -endX ); | 1228 | QDate dateit = currentDate.addDays( -endX ); |
1229 | if ( event->recursOn( dateit ) ) { | 1229 | if ( event->recursOn( dateit ) ) { |
1230 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); | 1230 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); |
1231 | if ( curCol-endX < 0 ) { | 1231 | if ( curCol-endX < 0 ) { |
1232 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1232 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1233 | } | 1233 | } |
1234 | } | 1234 | } |
1235 | } | 1235 | } |
1236 | } | 1236 | } |
1237 | } else { | 1237 | } else { |
1238 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1238 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1239 | } | 1239 | } |
1240 | } else { | 1240 | } else { |
1241 | if (beginX <= 0 && curCol == 0) { | 1241 | if (beginX <= 0 && curCol == 0) { |
1242 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1242 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1243 | } else if (beginX == curCol) { | 1243 | } else if (beginX == curCol) { |
1244 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1244 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
@@ -1261,193 +1261,193 @@ void KOAgendaView::fillAgenda() | |||
1261 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1261 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1262 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1262 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1263 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1263 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1264 | 1264 | ||
1265 | } | 1265 | } |
1266 | } | 1266 | } |
1267 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1267 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1268 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1268 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1269 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1269 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1270 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1270 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1271 | //qDebug("insert!!! "); | 1271 | //qDebug("insert!!! "); |
1272 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1272 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1273 | } | 1273 | } |
1274 | if (beginX == curCol) { | 1274 | if (beginX == curCol) { |
1275 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1275 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1276 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1276 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1277 | } else if (endX == curCol) { | 1277 | } else if (endX == curCol) { |
1278 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1278 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1279 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1279 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1280 | } else { | 1280 | } else { |
1281 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1281 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1282 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1282 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1283 | } | 1283 | } |
1284 | } else { | 1284 | } else { |
1285 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1285 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1286 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1286 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1287 | if (endY < startY) endY = startY; | 1287 | if (endY < startY) endY = startY; |
1288 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1288 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1289 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1289 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1290 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1290 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1291 | } | 1291 | } |
1292 | } | 1292 | } |
1293 | // ---------- [display Todos -------------- | 1293 | // ---------- [display Todos -------------- |
1294 | unsigned int numTodo; | 1294 | unsigned int numTodo; |
1295 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1295 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1296 | Todo *todo = todos.at(numTodo); | 1296 | Todo *todo = todos.at(numTodo); |
1297 | 1297 | ||
1298 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1298 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1299 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; | 1299 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; |
1300 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1300 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1301 | // Already completed items can be displayed on their original due date | 1301 | // Already completed items can be displayed on their original due date |
1302 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1302 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1303 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1303 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1304 | bool fillIn = false; | 1304 | bool fillIn = false; |
1305 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1305 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1306 | fillIn = true; | 1306 | fillIn = true; |
1307 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1307 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1308 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1308 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1309 | if ( fillIn ) { | 1309 | if ( fillIn ) { |
1310 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1310 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1311 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1311 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1312 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1312 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1313 | } | 1313 | } |
1314 | else { | 1314 | else { |
1315 | QDateTime dt; | 1315 | QDateTime dt; |
1316 | if ( todo->hasCompletedDate() ) | 1316 | if ( todo->hasCompletedDate() ) |
1317 | dt = todo->completed(); | 1317 | dt = todo->completed(); |
1318 | else | 1318 | else |
1319 | dt = todo->dtDue();; | 1319 | dt = todo->dtDue();; |
1320 | 1320 | ||
1321 | 1321 | ||
1322 | int endY = mAgenda->timeToY(dt.time()) - 1; | 1322 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1323 | int hi = (18/KOPrefs::instance()->mHourSize); | 1323 | int hi = (18/KOPrefs::instance()->mHourSize); |
1324 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1324 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1325 | int startY = endY -hi; | 1325 | int startY = endY -hi; |
1326 | 1326 | ||
1327 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1327 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1328 | 1328 | ||
1329 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1329 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1330 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1330 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1331 | } | 1331 | } |
1332 | } | 1332 | } |
1333 | } | 1333 | } |
1334 | // ---------- display Todos] -------------- | 1334 | // ---------- display Todos] -------------- |
1335 | 1335 | ||
1336 | ++curCol; | 1336 | ++curCol; |
1337 | } | 1337 | } |
1338 | mAgenda->hideUnused(); | 1338 | mAgenda->hideUnused(); |
1339 | mAllDayAgenda->hideUnused(); | 1339 | mAllDayAgenda->hideUnused(); |
1340 | mAgenda->checkScrollBoundaries(); | 1340 | mAgenda->checkScrollBoundaries(); |
1341 | deleteSelectedDateTime(); | 1341 | deleteSelectedDateTime(); |
1342 | createDayLabels(); | 1342 | createDayLabels(); |
1343 | emit incidenceSelected( 0 ); | 1343 | emit incidenceSelected( 0 ); |
1344 | 1344 | ||
1345 | if ( globalFlagBlockAgenda == 2 ) { | 1345 | if ( globalFlagBlockAgenda == 2 ) { |
1346 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1346 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1347 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1347 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1348 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1348 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1349 | setStartHour( QTime::currentTime ().hour() ); | 1349 | setStartHour( QTime::currentTime ().hour() ); |
1350 | } | 1350 | } |
1351 | qApp->processEvents(); | 1351 | qApp->processEvents(); |
1352 | globalFlagBlockAgenda = 0; | 1352 | globalFlagBlockAgenda = 0; |
1353 | mAllDayAgenda->drawContentsToPainter(); | 1353 | mAllDayAgenda->drawContentsToPainter(); |
1354 | mAgenda->drawContentsToPainter(); | 1354 | mAgenda->drawContentsToPainter(); |
1355 | repaintAgenda(); | 1355 | repaintAgenda(); |
1356 | startIdleTimeout(); | 1356 | startIdleTimeout(); |
1357 | onlyOne = false; | 1357 | flag_blockfillAgenda = false; |
1358 | } | 1358 | } |
1359 | void KOAgendaView::repaintAgenda() | 1359 | void KOAgendaView::repaintAgenda() |
1360 | { | 1360 | { |
1361 | mAgenda->viewport()->repaint( false ); | 1361 | mAgenda->viewport()->repaint( false ); |
1362 | mAllDayAgenda->viewport()->repaint( false ); | 1362 | mAllDayAgenda->viewport()->repaint( false ); |
1363 | mAgenda->finishUpdate(); | 1363 | mAgenda->finishUpdate(); |
1364 | mAllDayAgenda->finishUpdate(); | 1364 | mAllDayAgenda->finishUpdate(); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | 1367 | ||
1368 | void KOAgendaView::clearView() | 1368 | void KOAgendaView::clearView() |
1369 | { | 1369 | { |
1370 | mAllDayAgenda->clear(); | 1370 | mAllDayAgenda->clear(); |
1371 | mAgenda->clear(); | 1371 | mAgenda->clear(); |
1372 | } | 1372 | } |
1373 | void KOAgendaView::clearList() | 1373 | void KOAgendaView::clearList() |
1374 | { | 1374 | { |
1375 | clearView(); | 1375 | clearView(); |
1376 | mAllDayAgenda->hideUnused(); | 1376 | mAllDayAgenda->hideUnused(); |
1377 | mAgenda->hideUnused(); | 1377 | mAgenda->hideUnused(); |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1380 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1381 | const QDate &td) | 1381 | const QDate &td) |
1382 | { | 1382 | { |
1383 | #ifndef KORG_NOPRINTER | 1383 | #ifndef KORG_NOPRINTER |
1384 | if (fd == td) | 1384 | if (fd == td) |
1385 | calPrinter->preview(CalPrinter::Day, fd, td); | 1385 | calPrinter->preview(CalPrinter::Day, fd, td); |
1386 | else | 1386 | else |
1387 | calPrinter->preview(CalPrinter::Week, fd, td); | 1387 | calPrinter->preview(CalPrinter::Week, fd, td); |
1388 | #endif | 1388 | #endif |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | // void KOAgendaView::updateMovedTodo() | 1391 | // void KOAgendaView::updateMovedTodo() |
1392 | // { | 1392 | // { |
1393 | // // updateConfig(); | 1393 | // // updateConfig(); |
1394 | // // emit updateTodoViews(); | 1394 | // // emit updateTodoViews(); |
1395 | // } | 1395 | // } |
1396 | 1396 | ||
1397 | void KOAgendaView::slotShowDateView( int mode , int d ) | 1397 | void KOAgendaView::slotShowDateView( int mode , int d ) |
1398 | { | 1398 | { |
1399 | if ( d >= mSelectedDates.count() ) { | 1399 | if ( d >= mSelectedDates.count() ) { |
1400 | qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() ); | 1400 | qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() ); |
1401 | 1401 | ||
1402 | } else { | 1402 | } else { |
1403 | QDate day = mSelectedDates[d]; | 1403 | QDate day = mSelectedDates[d]; |
1404 | emit showDateView(mode , day ); | 1404 | emit showDateView(mode , day ); |
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | } | 1407 | } |
1408 | void KOAgendaView::newEvent(int gx, int gy) | 1408 | void KOAgendaView::newEvent(int gx, int gy) |
1409 | { | 1409 | { |
1410 | if (!mSelectedDates.count()) return; | 1410 | if (!mSelectedDates.count()) return; |
1411 | 1411 | ||
1412 | QDate day = mSelectedDates[gx]; | 1412 | QDate day = mSelectedDates[gx]; |
1413 | 1413 | ||
1414 | QTime time = mAgenda->gyToTime(gy); | 1414 | QTime time = mAgenda->gyToTime(gy); |
1415 | QDateTime dt(day,time); | 1415 | QDateTime dt(day,time); |
1416 | // if ( dt < QDateTime::currentDateTime () ) | 1416 | // if ( dt < QDateTime::currentDateTime () ) |
1417 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1417 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1418 | emit newEventSignal(dt); | 1418 | emit newEventSignal(dt); |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1421 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1422 | { | 1422 | { |
1423 | if (!mSelectedDates.count()) return; | 1423 | if (!mSelectedDates.count()) return; |
1424 | 1424 | ||
1425 | QDate dayStart = mSelectedDates[gxStart]; | 1425 | QDate dayStart = mSelectedDates[gxStart]; |
1426 | QDate dayEnd = mSelectedDates[gxEnd]; | 1426 | QDate dayEnd = mSelectedDates[gxEnd]; |
1427 | 1427 | ||
1428 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1428 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1429 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1429 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1430 | 1430 | ||
1431 | QDateTime dtStart(dayStart,timeStart); | 1431 | QDateTime dtStart(dayStart,timeStart); |
1432 | QDateTime dtEnd(dayEnd,timeEnd); | 1432 | QDateTime dtEnd(dayEnd,timeEnd); |
1433 | 1433 | ||
1434 | emit newEventSignal(dtStart,dtEnd); | 1434 | emit newEventSignal(dtStart,dtEnd); |
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | void KOAgendaView::newEventAllDay(int gx, int ) | 1437 | void KOAgendaView::newEventAllDay(int gx, int ) |
1438 | { | 1438 | { |
1439 | if (!mSelectedDates.count()) return; | 1439 | if (!mSelectedDates.count()) return; |
1440 | 1440 | ||
1441 | QDate day = mSelectedDates[gx]; | 1441 | QDate day = mSelectedDates[gx]; |
1442 | 1442 | ||
1443 | emit newEventSignal(day); | 1443 | emit newEventSignal(day); |
1444 | } | 1444 | } |
1445 | void KOAgendaView::newTodoAllDay(int gx, int ) | 1445 | void KOAgendaView::newTodoAllDay(int gx, int ) |
1446 | { | 1446 | { |
1447 | if (!mSelectedDates.count()) return; | 1447 | if (!mSelectedDates.count()) return; |
1448 | 1448 | ||
1449 | QDateTime day (mSelectedDates[gx] ); | 1449 | QDateTime day (mSelectedDates[gx] ); |
1450 | emit newTodoSignal(day, true); | 1450 | emit newTodoSignal(day, true); |
1451 | } | 1451 | } |
1452 | void KOAgendaView::newTodo(int gx, int gy ) | 1452 | void KOAgendaView::newTodo(int gx, int gy ) |
1453 | { | 1453 | { |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 4b7ef5b..5e68146 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -163,136 +163,137 @@ class KOAgendaView : public KOEventView { | |||
163 | 163 | ||
164 | /** returns the currently selected events */ | 164 | /** returns the currently selected events */ |
165 | virtual DateList selectedDates(); | 165 | virtual DateList selectedDates(); |
166 | 166 | ||
167 | /** Remove all events from view */ | 167 | /** Remove all events from view */ |
168 | void clearView(); | 168 | void clearView(); |
169 | void clearList(); | 169 | void clearList(); |
170 | KOAgenda *agenda() { return mAgenda;} | 170 | KOAgenda *agenda() { return mAgenda;} |
171 | virtual void printPreview(CalPrinter *calPrinter, | 171 | virtual void printPreview(CalPrinter *calPrinter, |
172 | const QDate &, const QDate &); | 172 | const QDate &, const QDate &); |
173 | 173 | ||
174 | /** start-datetime of selection */ | 174 | /** start-datetime of selection */ |
175 | QDateTime selectionStart() {return mTimeSpanBegin;} | 175 | QDateTime selectionStart() {return mTimeSpanBegin;} |
176 | /** end-datetime of selection */ | 176 | /** end-datetime of selection */ |
177 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 177 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
178 | /** returns true if selection is for whole day */ | 178 | /** returns true if selection is for whole day */ |
179 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 179 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
180 | /** make selected start/end invalid */ | 180 | /** make selected start/end invalid */ |
181 | void deleteSelectedDateTime(); | 181 | void deleteSelectedDateTime(); |
182 | void repaintAgenda(); | 182 | void repaintAgenda(); |
183 | public slots: | 183 | public slots: |
184 | void setInitStartHour(); | 184 | void setInitStartHour(); |
185 | virtual void updateView(); | 185 | virtual void updateView(); |
186 | virtual void updateConfig(); | 186 | virtual void updateConfig(); |
187 | virtual void showDates(const QDate &start, const QDate &end); | 187 | virtual void showDates(const QDate &start, const QDate &end); |
188 | virtual void showEvents(QPtrList<Event> eventList); | 188 | virtual void showEvents(QPtrList<Event> eventList); |
189 | 189 | ||
190 | void updateTodo( Todo *, int ); | 190 | void updateTodo( Todo *, int ); |
191 | void changeEventDisplay(Event *, int); | 191 | void changeEventDisplay(Event *, int); |
192 | 192 | ||
193 | void clearSelection(); | 193 | void clearSelection(); |
194 | 194 | ||
195 | void newTodo(int gx,int gy); | 195 | void newTodo(int gx,int gy); |
196 | void newEvent(int gx,int gy); | 196 | void newEvent(int gx,int gy); |
197 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 197 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
198 | void newEventAllDay(int gx, int gy); | 198 | void newEventAllDay(int gx, int gy); |
199 | void newTodoAllDay(int gx, int gy); | 199 | void newTodoAllDay(int gx, int gy); |
200 | 200 | ||
201 | void startDrag(Event *); | 201 | void startDrag(Event *); |
202 | 202 | ||
203 | void readSettings(); | 203 | void readSettings(); |
204 | void readSettings(KConfig *); | 204 | void readSettings(KConfig *); |
205 | void writeSettings(KConfig *); | 205 | void writeSettings(KConfig *); |
206 | 206 | ||
207 | void setContentsPos(int y); | 207 | void setContentsPos(int y); |
208 | 208 | ||
209 | void scrollOneHourUp(); | 209 | void scrollOneHourUp(); |
210 | void scrollOneHourDown(); | 210 | void scrollOneHourDown(); |
211 | void addToCalSlot(Incidence *, Incidence *); | 211 | void addToCalSlot(Incidence *, Incidence *); |
212 | void slotShowDateView( int, int ); | 212 | void slotShowDateView( int, int ); |
213 | void fillAgenda(); | 213 | void fillAgenda(); |
214 | void startIdleTimeout(); | 214 | void startIdleTimeout(); |
215 | 215 | ||
216 | signals: | 216 | signals: |
217 | void showDateView( int, QDate ); | 217 | void showDateView( int, QDate ); |
218 | void newTodoSignal( QDateTime ,bool ); | 218 | void newTodoSignal( QDateTime ,bool ); |
219 | void toggleExpand(); | 219 | void toggleExpand(); |
220 | void selectWeekNum( int ); | 220 | void selectWeekNum( int ); |
221 | void todoMoved( Todo *, int ); | 221 | void todoMoved( Todo *, int ); |
222 | void incidenceChanged(Incidence * , int ); | 222 | void incidenceChanged(Incidence * , int ); |
223 | // void cloneIncidenceSignal(Incidence *); | 223 | // void cloneIncidenceSignal(Incidence *); |
224 | 224 | ||
225 | protected: | 225 | protected: |
226 | KOAgendaButton* getNewDaylabel(); | 226 | KOAgendaButton* getNewDaylabel(); |
227 | bool mBlockUpdating; | 227 | bool mBlockUpdating; |
228 | int mUpcomingWidth; | 228 | int mUpcomingWidth; |
229 | /** Fill agenda beginning with date startDate */ | 229 | /** Fill agenda beginning with date startDate */ |
230 | void fillAgenda(const QDate &startDate); | 230 | void fillAgenda(const QDate &startDate); |
231 | void resizeEvent( QResizeEvent* e ); | 231 | void resizeEvent( QResizeEvent* e ); |
232 | /** Fill agenda using the current set value for the start date */ | 232 | /** Fill agenda using the current set value for the start date */ |
233 | 233 | ||
234 | /** Create labels for the selected dates. */ | 234 | /** Create labels for the selected dates. */ |
235 | void createDayLabels(); | 235 | void createDayLabels(); |
236 | 236 | ||
237 | /** | 237 | /** |
238 | Set the masks on the agenda widgets indicating, which days are holidays. | 238 | Set the masks on the agenda widgets indicating, which days are holidays. |
239 | */ | 239 | */ |
240 | void setHolidayMasks(); | 240 | void setHolidayMasks(); |
241 | 241 | ||
242 | protected slots: | 242 | protected slots: |
243 | void slotIdleTimeout(); | 243 | void slotIdleTimeout(); |
244 | void categoryChanged( Incidence * ); | 244 | void categoryChanged( Incidence * ); |
245 | void slotDaylabelClicked( int ); | 245 | void slotDaylabelClicked( int ); |
246 | /** Update event belonging to agenda item */ | 246 | /** Update event belonging to agenda item */ |
247 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 247 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
248 | //void updateMovedTodo(); | 248 | //void updateMovedTodo(); |
249 | 249 | ||
250 | void updateEventIndicatorTop(int newY); | 250 | void updateEventIndicatorTop(int newY); |
251 | void updateEventIndicatorBottom(int newY); | 251 | void updateEventIndicatorBottom(int newY); |
252 | 252 | ||
253 | /** Updates data for selected timespan */ | 253 | /** Updates data for selected timespan */ |
254 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 254 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
255 | /** Updates data for selected timespan for all day event*/ | 255 | /** Updates data for selected timespan for all day event*/ |
256 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 256 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
257 | 257 | ||
258 | private: | 258 | private: |
259 | bool flag_blockfillAgenda; | ||
259 | QTimer* mIdleTimer; | 260 | QTimer* mIdleTimer; |
260 | QDateTime mIdleStart; | 261 | QDateTime mIdleStart; |
261 | // view widgets | 262 | // view widgets |
262 | QFrame *mDayLabels; | 263 | QFrame *mDayLabels; |
263 | QHBox *mDayLabelsFrame; | 264 | QHBox *mDayLabelsFrame; |
264 | QBoxLayout *mLayoutDayLabels; | 265 | QBoxLayout *mLayoutDayLabels; |
265 | QFrame *mAllDayFrame; | 266 | QFrame *mAllDayFrame; |
266 | KOAgenda *mAllDayAgenda; | 267 | KOAgenda *mAllDayAgenda; |
267 | KOAgenda *mAgenda; | 268 | KOAgenda *mAgenda; |
268 | TimeLabels *mTimeLabels; | 269 | TimeLabels *mTimeLabels; |
269 | QWidget *mDummyAllDayLeft; | 270 | QWidget *mDummyAllDayLeft; |
270 | 271 | ||
271 | KDGanttMinimizeSplitter* mSplitterAgenda; | 272 | KDGanttMinimizeSplitter* mSplitterAgenda; |
272 | QPushButton *mExpandButton; | 273 | QPushButton *mExpandButton; |
273 | 274 | ||
274 | DateList mSelectedDates; // List of dates to be displayed | 275 | DateList mSelectedDates; // List of dates to be displayed |
275 | int mViewType; | 276 | int mViewType; |
276 | 277 | ||
277 | bool mWeekStartsMonday; | 278 | bool mWeekStartsMonday; |
278 | int mStartHour; | 279 | int mStartHour; |
279 | 280 | ||
280 | KOEventPopupMenu *mAllAgendaPopup; | 281 | KOEventPopupMenu *mAllAgendaPopup; |
281 | //KOEventPopupMenu *mAllDayAgendaPopup; | 282 | //KOEventPopupMenu *mAllDayAgendaPopup; |
282 | 283 | ||
283 | EventIndicator *mEventIndicatorTop; | 284 | EventIndicator *mEventIndicatorTop; |
284 | EventIndicator *mEventIndicatorBottom; | 285 | EventIndicator *mEventIndicatorBottom; |
285 | 286 | ||
286 | QMemArray<int> mMinY; | 287 | QMemArray<int> mMinY; |
287 | QMemArray<int> mMaxY; | 288 | QMemArray<int> mMaxY; |
288 | 289 | ||
289 | QMemArray<bool> mHolidayMask; | 290 | QMemArray<bool> mHolidayMask; |
290 | 291 | ||
291 | QPtrList<KOAgendaButton> mDayLabelsList; | 292 | QPtrList<KOAgendaButton> mDayLabelsList; |
292 | QDateTime mTimeSpanBegin; | 293 | QDateTime mTimeSpanBegin; |
293 | QDateTime mTimeSpanEnd; | 294 | QDateTime mTimeSpanEnd; |
294 | bool mTimeSpanInAllDay; | 295 | bool mTimeSpanInAllDay; |
295 | void keyPressEvent ( QKeyEvent * e ); | 296 | void keyPressEvent ( QKeyEvent * e ); |
296 | }; | 297 | }; |
297 | 298 | ||
298 | #endif // KOAGENDAVIEW_H | 299 | #endif // KOAGENDAVIEW_H |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index a12c43e..d79a9b9 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -420,193 +420,193 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
420 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 420 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
421 | return; | 421 | return; |
422 | } | 422 | } |
423 | if (! e->isAutoRepeat() ) | 423 | if (! e->isAutoRepeat() ) |
424 | mFlagKeyPressed = true; | 424 | mFlagKeyPressed = true; |
425 | QListViewItem* cn; | 425 | QListViewItem* cn; |
426 | if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { | 426 | if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { |
427 | cn = currentItem(); | 427 | cn = currentItem(); |
428 | if ( cn ) { | 428 | if ( cn ) { |
429 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 429 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
430 | if ( ci ){ | 430 | if ( ci ){ |
431 | if ( e->state() == ShiftButton ) | 431 | if ( e->state() == ShiftButton ) |
432 | ci->setOn( false ); | 432 | ci->setOn( false ); |
433 | else | 433 | else |
434 | ci->setOn( true ); | 434 | ci->setOn( true ); |
435 | cn = cn->itemBelow(); | 435 | cn = cn->itemBelow(); |
436 | if ( cn ) { | 436 | if ( cn ) { |
437 | setCurrentItem ( cn ); | 437 | setCurrentItem ( cn ); |
438 | ensureItemVisible ( cn ); | 438 | ensureItemVisible ( cn ); |
439 | } | 439 | } |
440 | 440 | ||
441 | } | 441 | } |
442 | } | 442 | } |
443 | 443 | ||
444 | e->accept(); | 444 | e->accept(); |
445 | return; | 445 | return; |
446 | } | 446 | } |
447 | 447 | ||
448 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 448 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
449 | switch ( e->key() ) { | 449 | switch ( e->key() ) { |
450 | case Qt::Key_Down: | 450 | case Qt::Key_Down: |
451 | case Qt::Key_Up: | 451 | case Qt::Key_Up: |
452 | QListView::keyPressEvent ( e ); | 452 | QListView::keyPressEvent ( e ); |
453 | e->accept(); | 453 | e->accept(); |
454 | break; | 454 | break; |
455 | case Qt::Key_Left: | 455 | case Qt::Key_Left: |
456 | case Qt::Key_Right: | 456 | case Qt::Key_Right: |
457 | QListView::keyPressEvent ( e ); | 457 | QListView::keyPressEvent ( e ); |
458 | e->accept(); | 458 | e->accept(); |
459 | return; | 459 | return; |
460 | break; | 460 | break; |
461 | default: | 461 | default: |
462 | e->ignore(); | 462 | e->ignore(); |
463 | break; | 463 | break; |
464 | } | 464 | } |
465 | return; | 465 | return; |
466 | } | 466 | } |
467 | e->ignore(); | 467 | e->ignore(); |
468 | } | 468 | } |
469 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 469 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
470 | { | 470 | { |
471 | QListView::contentsMouseReleaseEvent(e); | 471 | QListView::contentsMouseReleaseEvent(e); |
472 | mMousePressed = false; | 472 | mMousePressed = false; |
473 | } | 473 | } |
474 | 474 | ||
475 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 475 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
476 | { | 476 | { |
477 | if (!e) return; | 477 | if (!e) return; |
478 | 478 | ||
479 | QPoint vp = contentsToViewport(e->pos()); | 479 | QPoint vp = contentsToViewport(e->pos()); |
480 | 480 | ||
481 | QListViewItem *item = itemAt(vp); | 481 | QListViewItem *item = itemAt(vp); |
482 | 482 | ||
483 | emit double_Clicked(item); | 483 | emit double_Clicked(item); |
484 | if (!item) return; | 484 | if (!item) return; |
485 | 485 | ||
486 | emit doubleClicked(item,vp,0); | 486 | emit doubleClicked(item,vp,0); |
487 | } | 487 | } |
488 | 488 | ||
489 | ///////////////////////////////////////////////////////////////////////////// | 489 | ///////////////////////////////////////////////////////////////////////////// |
490 | 490 | ||
491 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 491 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
492 | QLineEdit(parent) | 492 | QLineEdit(parent) |
493 | { | 493 | { |
494 | setText(i18n("Click to add new Todo")); | 494 | setText(i18n("Click to add new Todo")); |
495 | setFocusPolicy ( QWidget::ClickFocus ); | 495 | setFocusPolicy ( QWidget::ClickFocus ); |
496 | } | 496 | } |
497 | 497 | ||
498 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 498 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
499 | { | 499 | { |
500 | if ( text()==i18n("Click to add new Todo") ) | 500 | if ( text()==i18n("Click to add new Todo") ) |
501 | setText(""); | 501 | setText(""); |
502 | QLineEdit::focusInEvent(ev); | 502 | QLineEdit::focusInEvent(ev); |
503 | } | 503 | } |
504 | 504 | ||
505 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 505 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
506 | { | 506 | { |
507 | setText(i18n("Click to add new Todo")); | 507 | setText(i18n("Click to add new Todo")); |
508 | QLineEdit::focusOutEvent(ev); | 508 | QLineEdit::focusOutEvent(ev); |
509 | } | 509 | } |
510 | 510 | ||
511 | ///////////////////////////////////////////////////////////////////////////// | 511 | ///////////////////////////////////////////////////////////////////////////// |
512 | 512 | ||
513 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 513 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
514 | KOrg::BaseView(calendar,parent,name) | 514 | KOrg::BaseView(calendar,parent,name) |
515 | { | 515 | { |
516 | 516 | mIsActiveWindow = false; | |
517 | mCurItem = 0; | 517 | mCurItem = 0; |
518 | mCurItemRootParent = 0; | 518 | mCurItemRootParent = 0; |
519 | mCurItemParent = 0; | 519 | mCurItemParent = 0; |
520 | mCurItemAbove = 0; | 520 | mCurItemAbove = 0; |
521 | mActiveItem = 0; | 521 | mActiveItem = 0; |
522 | mCategoryPopupMenu = 0; | 522 | mCategoryPopupMenu = 0; |
523 | mPendingUpdateBeforeRepaint = false; | 523 | mPendingUpdateBeforeRepaint = false; |
524 | isFlatDisplay = false; | 524 | isFlatDisplay = false; |
525 | mNavigator = 0; | 525 | mNavigator = 0; |
526 | QBoxLayout *topLayout = new QVBoxLayout(this); | 526 | QBoxLayout *topLayout = new QVBoxLayout(this); |
527 | mName = QString ( name ); | 527 | mName = QString ( name ); |
528 | mBlockUpdate = false; | 528 | mBlockUpdate = false; |
529 | mQuickBar = new QWidget( this ); | 529 | mQuickBar = new QWidget( this ); |
530 | topLayout->addWidget(mQuickBar); | 530 | topLayout->addWidget(mQuickBar); |
531 | 531 | ||
532 | mQuickAdd = new KOQuickTodo(mQuickBar); | 532 | mQuickAdd = new KOQuickTodo(mQuickBar); |
533 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 533 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
534 | quickLayout->addWidget( mQuickAdd ); | 534 | quickLayout->addWidget( mQuickAdd ); |
535 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 535 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
536 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 536 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
537 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 537 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
538 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 538 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
539 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 539 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
540 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 540 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
541 | 541 | ||
542 | int fixwid = mQuickAdd->sizeHint().height(); | 542 | int fixwid = mQuickAdd->sizeHint().height(); |
543 | int fixhei = fixwid; | 543 | int fixhei = fixwid; |
544 | if ( QApplication::desktop()->width() > 800 ) | 544 | if ( QApplication::desktop()->width() > 800 ) |
545 | fixwid = (fixwid*3)/2; | 545 | fixwid = (fixwid*3)/2; |
546 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 546 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
547 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 547 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
548 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 548 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
549 | s_done->setPixmap( SmallIcon("greenhook16")); | 549 | s_done->setPixmap( SmallIcon("greenhook16")); |
550 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | 550 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); |
551 | s_run->setPixmap( SmallIcon("ko16old")); | 551 | s_run->setPixmap( SmallIcon("ko16old")); |
552 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | 552 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); |
553 | 553 | ||
554 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | 554 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); |
555 | 555 | ||
556 | mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); | 556 | mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); |
557 | mNewSubBut->setEnabled( false ); | 557 | mNewSubBut->setEnabled( false ); |
558 | flat->setFixedWidth( fixwid ); | 558 | flat->setFixedWidth( fixwid ); |
559 | s_done->setFixedWidth( fixwid ); | 559 | s_done->setFixedWidth( fixwid ); |
560 | allopen->setFixedWidth( fixwid ); | 560 | allopen->setFixedWidth( fixwid ); |
561 | allclose->setFixedWidth( fixwid ); | 561 | allclose->setFixedWidth( fixwid ); |
562 | s_run->setFixedWidth( fixwid ); | 562 | s_run->setFixedWidth( fixwid ); |
563 | 563 | ||
564 | flat->setFixedHeight(fixhei ); | 564 | flat->setFixedHeight(fixhei ); |
565 | s_done->setFixedHeight(fixhei ); | 565 | s_done->setFixedHeight(fixhei ); |
566 | allopen->setFixedHeight(fixhei ); | 566 | allopen->setFixedHeight(fixhei ); |
567 | allclose->setFixedHeight(fixhei ); | 567 | allclose->setFixedHeight(fixhei ); |
568 | s_run->setFixedHeight(fixhei ); | 568 | s_run->setFixedHeight(fixhei ); |
569 | mNewSubBut->setFixedHeight(fixhei ); | 569 | mNewSubBut->setFixedHeight(fixhei ); |
570 | 570 | ||
571 | flat->setFocusPolicy( NoFocus ); | 571 | flat->setFocusPolicy( NoFocus ); |
572 | s_done->setFocusPolicy( NoFocus ); | 572 | s_done->setFocusPolicy( NoFocus ); |
573 | allopen->setFocusPolicy( NoFocus ); | 573 | allopen->setFocusPolicy( NoFocus ); |
574 | allclose->setFocusPolicy( NoFocus ); | 574 | allclose->setFocusPolicy( NoFocus ); |
575 | s_run->setFocusPolicy( NoFocus ); | 575 | s_run->setFocusPolicy( NoFocus ); |
576 | mNewSubBut->setFocusPolicy( NoFocus ); | 576 | mNewSubBut->setFocusPolicy( NoFocus ); |
577 | 577 | ||
578 | QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); | 578 | QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); |
579 | QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); | 579 | QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); |
580 | QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); | 580 | QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); |
581 | QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); | 581 | QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); |
582 | QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); | 582 | QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); |
583 | QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); | 583 | QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); |
584 | 584 | ||
585 | quickLayout->addWidget( mNewSubBut ); | 585 | quickLayout->addWidget( mNewSubBut ); |
586 | quickLayout->addWidget( s_done ); | 586 | quickLayout->addWidget( s_done ); |
587 | quickLayout->addWidget( s_run ); | 587 | quickLayout->addWidget( s_run ); |
588 | quickLayout->addWidget( allopen ); | 588 | quickLayout->addWidget( allopen ); |
589 | quickLayout->addWidget( allclose ); | 589 | quickLayout->addWidget( allclose ); |
590 | quickLayout->addWidget( flat ); | 590 | quickLayout->addWidget( flat ); |
591 | 591 | ||
592 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 592 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
593 | 593 | ||
594 | mTodoListView = new KOTodoListView(calendar,this, name ); | 594 | mTodoListView = new KOTodoListView(calendar,this, name ); |
595 | topLayout->addWidget(mTodoListView); | 595 | topLayout->addWidget(mTodoListView); |
596 | //mTodoListView->header()->setMaximumHeight(30); | 596 | //mTodoListView->header()->setMaximumHeight(30); |
597 | mTodoListView->setRootIsDecorated(true); | 597 | mTodoListView->setRootIsDecorated(true); |
598 | mTodoListView->setAllColumnsShowFocus(true); | 598 | mTodoListView->setAllColumnsShowFocus(true); |
599 | 599 | ||
600 | mTodoListView->setShowSortIndicator(true); | 600 | mTodoListView->setShowSortIndicator(true); |
601 | 601 | ||
602 | mTodoListView->addColumn(i18n("Todo")); | 602 | mTodoListView->addColumn(i18n("Todo")); |
603 | mTodoListView->addColumn(i18n("Prio")); | 603 | mTodoListView->addColumn(i18n("Prio")); |
604 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 604 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
605 | mTodoListView->addColumn(i18n("Complete")); | 605 | mTodoListView->addColumn(i18n("Complete")); |
606 | mTodoListView->setColumnAlignment(2,AlignCenter); | 606 | mTodoListView->setColumnAlignment(2,AlignCenter); |
607 | 607 | ||
608 | mTodoListView->addColumn(i18n("Due Date")); | 608 | mTodoListView->addColumn(i18n("Due Date")); |
609 | mTodoListView->setColumnAlignment(3,AlignLeft); | 609 | mTodoListView->setColumnAlignment(3,AlignLeft); |
610 | mTodoListView->addColumn(i18n("Due Time")); | 610 | mTodoListView->addColumn(i18n("Due Time")); |
611 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 611 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
612 | 612 | ||
@@ -857,261 +857,263 @@ void KOTodoView::updateView() | |||
857 | clearList (); | 857 | clearList (); |
858 | mPendingUpdateBeforeRepaint = true; | 858 | mPendingUpdateBeforeRepaint = true; |
859 | return; | 859 | return; |
860 | } | 860 | } |
861 | //qDebug("KOTodoView::updateView() %x", this); | 861 | //qDebug("KOTodoView::updateView() %x", this); |
862 | if ( isFlatDisplay ) { | 862 | if ( isFlatDisplay ) { |
863 | displayAllFlat(); | 863 | displayAllFlat(); |
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | //qDebug("update "); | 866 | //qDebug("update "); |
867 | // kdDebug() << "KOTodoView::updateView()" << endl; | 867 | // kdDebug() << "KOTodoView::updateView()" << endl; |
868 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 868 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
869 | 869 | ||
870 | clearList (); | 870 | clearList (); |
871 | 871 | ||
872 | if ( mName == "todolistsmall" ) { | 872 | if ( mName == "todolistsmall" ) { |
873 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 873 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
874 | int ps = fo.pointSize() -2; | 874 | int ps = fo.pointSize() -2; |
875 | if ( ps > 12 ) | 875 | if ( ps > 12 ) |
876 | ps -= 2; | 876 | ps -= 2; |
877 | fo.setPointSize( ps ); | 877 | fo.setPointSize( ps ); |
878 | } | 878 | } |
879 | } | 879 | } |
880 | 880 | ||
881 | mTodoListView->setFont( fo ); | 881 | mTodoListView->setFont( fo ); |
882 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 882 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
883 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 883 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
884 | QPtrList<Todo> todoList = calendar()->todos(); | 884 | QPtrList<Todo> todoList = calendar()->todos(); |
885 | 885 | ||
886 | /* | 886 | /* |
887 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 887 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
888 | Event *t; | 888 | Event *t; |
889 | for(t = todoList.first(); t; t = todoList.next()) { | 889 | for(t = todoList.first(); t; t = todoList.next()) { |
890 | kdDebug() << " " << t->getSummary() << endl; | 890 | kdDebug() << " " << t->getSummary() << endl; |
891 | 891 | ||
892 | if (t->getRelatedTo()) { | 892 | if (t->getRelatedTo()) { |
893 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 893 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
894 | } | 894 | } |
895 | 895 | ||
896 | QPtrList<Event> l = t->getRelations(); | 896 | QPtrList<Event> l = t->getRelations(); |
897 | Event *c; | 897 | Event *c; |
898 | for(c=l.first();c;c=l.next()) { | 898 | for(c=l.first();c;c=l.next()) { |
899 | kdDebug() << " - relation: " << c->getSummary() << endl; | 899 | kdDebug() << " - relation: " << c->getSummary() << endl; |
900 | } | 900 | } |
901 | } | 901 | } |
902 | */ | 902 | */ |
903 | 903 | ||
904 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 904 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
905 | // specific order of events. That means that we have to generate parent items | 905 | // specific order of events. That means that we have to generate parent items |
906 | // recursively for proper hierarchical display of Todos. | 906 | // recursively for proper hierarchical display of Todos. |
907 | Todo *todo; | 907 | Todo *todo; |
908 | todo = todoList.first();// todo; todo = todoList.next()) { | 908 | todo = todoList.first();// todo; todo = todoList.next()) { |
909 | while ( todo ) { | 909 | while ( todo ) { |
910 | bool next = true; | 910 | bool next = true; |
911 | // qDebug("todo %s ", todo->summary().latin1()); | 911 | // qDebug("todo %s ", todo->summary().latin1()); |
912 | Incidence *incidence = todo->relatedTo(); | 912 | Incidence *incidence = todo->relatedTo(); |
913 | while ( incidence ) { | 913 | while ( incidence ) { |
914 | if ( incidence->typeID() == todoID ) { | 914 | if ( incidence->typeID() == todoID ) { |
915 | //qDebug("related %s ",incidence->summary().latin1() ); | 915 | //qDebug("related %s ",incidence->summary().latin1() ); |
916 | if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { | 916 | if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { |
917 | //qDebug("related not found "); | 917 | //qDebug("related not found "); |
918 | todoList.remove( ); | 918 | todoList.remove( ); |
919 | todo = todoList.current(); | 919 | todo = todoList.current(); |
920 | next = false; | 920 | next = false; |
921 | incidence = 0; | 921 | incidence = 0; |
922 | 922 | ||
923 | } else { | 923 | } else { |
924 | //qDebug("related found "); | 924 | //qDebug("related found "); |
925 | incidence = incidence->relatedTo(); | 925 | incidence = incidence->relatedTo(); |
926 | } | 926 | } |
927 | } else | 927 | } else |
928 | incidence = 0; | 928 | incidence = 0; |
929 | } | 929 | } |
930 | if ( next ) | 930 | if ( next ) |
931 | todo = todoList.next(); | 931 | todo = todoList.next(); |
932 | } | 932 | } |
933 | 933 | ||
934 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 934 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
935 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 935 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
936 | { | 936 | { |
937 | insertTodoItem(todo); | 937 | insertTodoItem(todo); |
938 | } | 938 | } |
939 | } | 939 | } |
940 | // Restore opened/closed state | 940 | // Restore opened/closed state |
941 | mTodoListView->blockSignals( true ); | 941 | mTodoListView->blockSignals( true ); |
942 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 942 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
943 | mTodoListView->blockSignals( false ); | 943 | mTodoListView->blockSignals( false ); |
944 | resetCurrentItem(); | 944 | resetCurrentItem(); |
945 | } | 945 | } |
946 | 946 | ||
947 | void KOTodoView::storeCurrentItem() | 947 | void KOTodoView::storeCurrentItem() |
948 | { | 948 | { |
949 | mCurItem = 0; | 949 | mCurItem = 0; |
950 | mCurItemRootParent = 0; | 950 | mCurItemRootParent = 0; |
951 | mCurItemParent = 0; | 951 | mCurItemParent = 0; |
952 | mCurItemAbove = 0; | 952 | mCurItemAbove = 0; |
953 | mIsActiveWindow = topLevelWidget()->isActiveWindow(); | ||
953 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 954 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
954 | if (mActiveItem) { | 955 | if (mActiveItem) { |
955 | mCurItem = mActiveItem->todo(); | 956 | mCurItem = mActiveItem->todo(); |
956 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 957 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
957 | if ( activeItemAbove ) | 958 | if ( activeItemAbove ) |
958 | mCurItemAbove = activeItemAbove->todo(); | 959 | mCurItemAbove = activeItemAbove->todo(); |
959 | mCurItemRootParent = mCurItem; | 960 | mCurItemRootParent = mCurItem; |
960 | mCurItemParent = mCurItemRootParent->relatedTo(); | 961 | mCurItemParent = mCurItemRootParent->relatedTo(); |
961 | while ( mCurItemRootParent->relatedTo() != 0 ) | 962 | while ( mCurItemRootParent->relatedTo() != 0 ) |
962 | mCurItemRootParent = mCurItemRootParent->relatedTo(); | 963 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
963 | } | 964 | } |
964 | mActiveItem = 0; | 965 | mActiveItem = 0; |
965 | } | 966 | } |
966 | 967 | ||
967 | void KOTodoView::resetCurrentItem() | 968 | void KOTodoView::resetCurrentItem() |
968 | { | 969 | { |
969 | //mTodoListView->setFocus(); | 970 | //mTodoListView->setFocus(); |
970 | KOTodoViewItem* foundItem = 0; | 971 | KOTodoViewItem* foundItem = 0; |
971 | KOTodoViewItem* foundItemRoot = 0; | 972 | KOTodoViewItem* foundItemRoot = 0; |
972 | KOTodoViewItem* foundItemParent = 0; | 973 | KOTodoViewItem* foundItemParent = 0; |
973 | KOTodoViewItem* foundItemAbove = 0; | 974 | KOTodoViewItem* foundItemAbove = 0; |
974 | if ( mTodoListView->firstChild () ) { | 975 | if ( mTodoListView->firstChild () ) { |
975 | if ( mCurItem ) { | 976 | if ( mCurItem ) { |
976 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 977 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
977 | while ( item ) { | 978 | while ( item ) { |
978 | if ( item->todo() == mCurItem ) { | 979 | if ( item->todo() == mCurItem ) { |
979 | foundItem = item; | 980 | foundItem = item; |
980 | break; | 981 | break; |
981 | } else if ( item->todo() == mCurItemAbove ) { | 982 | } else if ( item->todo() == mCurItemAbove ) { |
982 | foundItemAbove = item; | 983 | foundItemAbove = item; |
983 | 984 | ||
984 | } | 985 | } |
985 | if ( item->todo() == mCurItemRootParent ) { | 986 | if ( item->todo() == mCurItemRootParent ) { |
986 | foundItemRoot = item; | 987 | foundItemRoot = item; |
987 | } | 988 | } |
988 | if ( item->todo() == mCurItemParent ) { | 989 | if ( item->todo() == mCurItemParent ) { |
989 | foundItemParent = item; | 990 | foundItemParent = item; |
990 | } | 991 | } |
991 | item = (KOTodoViewItem*)item->itemBelow(); | 992 | item = (KOTodoViewItem*)item->itemBelow(); |
992 | } | 993 | } |
993 | if ( ! foundItem ) { | 994 | if ( ! foundItem ) { |
994 | if ( foundItemParent ) { | 995 | if ( foundItemParent ) { |
995 | foundItem = foundItemParent; | 996 | foundItem = foundItemParent; |
996 | } else { | 997 | } else { |
997 | if ( foundItemRoot ) | 998 | if ( foundItemRoot ) |
998 | foundItem = foundItemRoot; | 999 | foundItem = foundItemRoot; |
999 | else | 1000 | else |
1000 | foundItem = foundItemAbove; | 1001 | foundItem = foundItemAbove; |
1001 | } | 1002 | } |
1002 | } | 1003 | } |
1003 | } | 1004 | } |
1004 | if ( foundItem ) { | 1005 | if ( foundItem ) { |
1005 | mTodoListView->setSelected ( foundItem, true ); | 1006 | mTodoListView->setSelected ( foundItem, true ); |
1006 | mTodoListView->setCurrentItem( foundItem ); | 1007 | mTodoListView->setCurrentItem( foundItem ); |
1007 | mTodoListView->ensureItemVisible( foundItem ); | 1008 | mTodoListView->ensureItemVisible( foundItem ); |
1008 | } else { | 1009 | } else { |
1009 | if ( mTodoListView->firstChild () ) { | 1010 | if ( mTodoListView->firstChild () ) { |
1010 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); | 1011 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); |
1011 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 1012 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
1012 | } | 1013 | } |
1013 | } | 1014 | } |
1014 | } | 1015 | } |
1015 | processSelectionChange(); | 1016 | processSelectionChange(); |
1016 | if ( mName != "todolistsmall" ) | 1017 | if ( mName != "todolistsmall" ) |
1017 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); | 1018 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); |
1018 | } | 1019 | } |
1019 | void KOTodoView::resetFocusToList() | 1020 | void KOTodoView::resetFocusToList() |
1020 | { | 1021 | { |
1021 | topLevelWidget()->setActiveWindow(); | 1022 | if ( mIsActiveWindow ) |
1023 | topLevelWidget()->setActiveWindow(); | ||
1022 | mTodoListView->setFocus(); | 1024 | mTodoListView->setFocus(); |
1023 | } | 1025 | } |
1024 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 1026 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
1025 | bool KOTodoView::checkTodo( Todo * todo ) | 1027 | bool KOTodoView::checkTodo( Todo * todo ) |
1026 | { | 1028 | { |
1027 | 1029 | ||
1028 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 1030 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
1029 | return false; | 1031 | return false; |
1030 | if ( !todo->isCompleted() ) { | 1032 | if ( !todo->isCompleted() ) { |
1031 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 1033 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
1032 | return true; | 1034 | return true; |
1033 | } | 1035 | } |
1034 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 1036 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
1035 | if ( todo->hasStartDate() ) | 1037 | if ( todo->hasStartDate() ) |
1036 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 1038 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
1037 | return false; | 1039 | return false; |
1038 | if ( todo->hasDueDate() ) | 1040 | if ( todo->hasDueDate() ) |
1039 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 1041 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
1040 | return false; | 1042 | return false; |
1041 | } | 1043 | } |
1042 | return true; | 1044 | return true; |
1043 | } | 1045 | } |
1044 | 1046 | ||
1045 | void KOTodoView::restoreItemState( QListViewItem *item ) | 1047 | void KOTodoView::restoreItemState( QListViewItem *item ) |
1046 | { | 1048 | { |
1047 | pendingSubtodo = 0; | 1049 | pendingSubtodo = 0; |
1048 | while( item ) { | 1050 | while( item ) { |
1049 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1051 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1050 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 1052 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
1051 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 1053 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
1052 | item = item->nextSibling(); | 1054 | item = item->nextSibling(); |
1053 | } | 1055 | } |
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | 1058 | ||
1057 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 1059 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
1058 | KOTodoView::insertTodoItem(Todo *todo) | 1060 | KOTodoView::insertTodoItem(Todo *todo) |
1059 | { | 1061 | { |
1060 | 1062 | ||
1061 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 1063 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
1062 | // TODO: Check, if dynmaic cast is necessary | 1064 | // TODO: Check, if dynmaic cast is necessary |
1063 | 1065 | ||
1064 | pendingSubtodo = 0; | 1066 | pendingSubtodo = 0; |
1065 | Incidence *incidence = todo->relatedTo(); | 1067 | Incidence *incidence = todo->relatedTo(); |
1066 | while ( incidence && !incidence->calEnabled() ) | 1068 | while ( incidence && !incidence->calEnabled() ) |
1067 | incidence = incidence->relatedTo(); | 1069 | incidence = incidence->relatedTo(); |
1068 | if (incidence && incidence->typeID() == todoID ) { | 1070 | if (incidence && incidence->typeID() == todoID ) { |
1069 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 1071 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
1070 | 1072 | ||
1071 | // kdDebug() << " has Related" << endl; | 1073 | // kdDebug() << " has Related" << endl; |
1072 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1074 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1073 | itemIterator = mTodoMap.find(relatedTodo); | 1075 | itemIterator = mTodoMap.find(relatedTodo); |
1074 | if (itemIterator == mTodoMap.end()) { | 1076 | if (itemIterator == mTodoMap.end()) { |
1075 | // kdDebug() << " related not yet in list" << endl; | 1077 | // kdDebug() << " related not yet in list" << endl; |
1076 | itemIterator = insertTodoItem (relatedTodo); | 1078 | itemIterator = insertTodoItem (relatedTodo); |
1077 | } | 1079 | } |
1078 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 1080 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
1079 | // and one into the map. Sure finding is more easy but why? -zecke | 1081 | // and one into the map. Sure finding is more easy but why? -zecke |
1080 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 1082 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
1081 | return mTodoMap.insert(todo,todoItem); | 1083 | return mTodoMap.insert(todo,todoItem); |
1082 | } else { | 1084 | } else { |
1083 | // kdDebug() << " no Related" << endl; | 1085 | // kdDebug() << " no Related" << endl; |
1084 | // see above -zecke | 1086 | // see above -zecke |
1085 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1087 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1086 | return mTodoMap.insert(todo,todoItem); | 1088 | return mTodoMap.insert(todo,todoItem); |
1087 | } | 1089 | } |
1088 | } | 1090 | } |
1089 | 1091 | ||
1090 | 1092 | ||
1091 | void KOTodoView::updateConfig() | 1093 | void KOTodoView::updateConfig() |
1092 | { | 1094 | { |
1093 | updateView(); | 1095 | updateView(); |
1094 | mTodoListView->repaintContents(); | 1096 | mTodoListView->repaintContents(); |
1095 | } | 1097 | } |
1096 | 1098 | ||
1097 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 1099 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
1098 | { | 1100 | { |
1099 | QPtrList<Incidence> selected; | 1101 | QPtrList<Incidence> selected; |
1100 | 1102 | ||
1101 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1103 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1102 | // if (!item) item = mActiveItem; | 1104 | // if (!item) item = mActiveItem; |
1103 | if (item) selected.append(item->todo()); | 1105 | if (item) selected.append(item->todo()); |
1104 | 1106 | ||
1105 | return selected; | 1107 | return selected; |
1106 | } | 1108 | } |
1107 | 1109 | ||
1108 | QPtrList<Todo> KOTodoView::selectedTodos() | 1110 | QPtrList<Todo> KOTodoView::selectedTodos() |
1109 | { | 1111 | { |
1110 | QPtrList<Todo> selected; | 1112 | QPtrList<Todo> selected; |
1111 | 1113 | ||
1112 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1114 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1113 | // if (!item) item = mActiveItem; | 1115 | // if (!item) item = mActiveItem; |
1114 | if (item) selected.append(item->todo()); | 1116 | if (item) selected.append(item->todo()); |
1115 | 1117 | ||
1116 | return selected; | 1118 | return selected; |
1117 | } | 1119 | } |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index ecd0ad9..161ecb0 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -162,148 +162,149 @@ class KOTodoView : public KOrg::BaseView | |||
162 | 162 | ||
163 | DateList selectedDates() | 163 | DateList selectedDates() |
164 | {DateList q; | 164 | {DateList q; |
165 | return q;} | 165 | return q;} |
166 | 166 | ||
167 | /** Return number of shown dates. TodoView does not show dates, */ | 167 | /** Return number of shown dates. TodoView does not show dates, */ |
168 | int currentDateCount() { return 0; } | 168 | int currentDateCount() { return 0; } |
169 | 169 | ||
170 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 170 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
171 | 171 | ||
172 | void setDocumentId( const QString & ); | 172 | void setDocumentId( const QString & ); |
173 | 173 | ||
174 | void saveLayout(KConfig *config, const QString &group) const; | 174 | void saveLayout(KConfig *config, const QString &group) const; |
175 | void restoreLayout(KConfig *config, const QString &group); | 175 | void restoreLayout(KConfig *config, const QString &group); |
176 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 176 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
177 | QString getWhatsThisText(QPoint p); | 177 | QString getWhatsThisText(QPoint p); |
178 | void clearList( bool saveCurrentItem = true ); | 178 | void clearList( bool saveCurrentItem = true ); |
179 | 179 | ||
180 | public slots: | 180 | public slots: |
181 | void updateView(); | 181 | void updateView(); |
182 | void updateConfig(); | 182 | void updateConfig(); |
183 | 183 | ||
184 | void changeEventDisplay(Event *, int); | 184 | void changeEventDisplay(Event *, int); |
185 | 185 | ||
186 | void showDates(const QDate &start, const QDate &end); | 186 | void showDates(const QDate &start, const QDate &end); |
187 | void showEvents(QPtrList<Event> eventList); | 187 | void showEvents(QPtrList<Event> eventList); |
188 | 188 | ||
189 | void clearSelection(); | 189 | void clearSelection(); |
190 | void jumpToDate (); | 190 | void jumpToDate (); |
191 | 191 | ||
192 | void editItem(QListViewItem *item); | 192 | void editItem(QListViewItem *item); |
193 | void showItem(QListViewItem *item,const QPoint &,int); | 193 | void showItem(QListViewItem *item,const QPoint &,int); |
194 | void popupMenu(QListViewItem *item,const QPoint &,int); | 194 | void popupMenu(QListViewItem *item,const QPoint &,int); |
195 | void newTodo(); | 195 | void newTodo(); |
196 | void newSubTodo(); | 196 | void newSubTodo(); |
197 | void unparentTodo(); | 197 | void unparentTodo(); |
198 | void reparentTodo(); | 198 | void reparentTodo(); |
199 | void showTodo(); | 199 | void showTodo(); |
200 | void editTodo(); | 200 | void editTodo(); |
201 | void cloneTodo(); | 201 | void cloneTodo(); |
202 | void cancelTodo(); | 202 | void cancelTodo(); |
203 | void moveTodo(); | 203 | void moveTodo(); |
204 | void beamTodo(); | 204 | void beamTodo(); |
205 | void deleteTodo(); | 205 | void deleteTodo(); |
206 | 206 | ||
207 | void setNewPriority(int); | 207 | void setNewPriority(int); |
208 | void setNewPercentage(int); | 208 | void setNewPercentage(int); |
209 | void changedCategories(int); | 209 | void changedCategories(int); |
210 | 210 | ||
211 | void setAllOpen(); | 211 | void setAllOpen(); |
212 | void setAllClose(); | 212 | void setAllClose(); |
213 | void setAllFlat(); | 213 | void setAllFlat(); |
214 | void displayAllFlat(); | 214 | void displayAllFlat(); |
215 | 215 | ||
216 | void purgeCompleted(); | 216 | void purgeCompleted(); |
217 | void toggleCompleted(); | 217 | void toggleCompleted(); |
218 | void toggleRunning(); | 218 | void toggleRunning(); |
219 | void toggleQuickTodo(); | 219 | void toggleQuickTodo(); |
220 | void updateTodo( Todo *, int ); | 220 | void updateTodo( Todo *, int ); |
221 | 221 | ||
222 | void itemClicked(QListViewItem *); | 222 | void itemClicked(QListViewItem *); |
223 | void itemStateChanged(QListViewItem *); | 223 | void itemStateChanged(QListViewItem *); |
224 | void modified(bool); | 224 | void modified(bool); |
225 | void itemDoubleClicked(QListViewItem *item); | 225 | void itemDoubleClicked(QListViewItem *item); |
226 | void resetFocusToList(); | 226 | void resetFocusToList(); |
227 | void fillCategories (); | 227 | void fillCategories (); |
228 | void fillCal (); | 228 | void fillCal (); |
229 | void changedCal (int); | 229 | void changedCal (int); |
230 | 230 | ||
231 | signals: | 231 | signals: |
232 | void newTodoSignal(); | 232 | void newTodoSignal(); |
233 | void newSubTodoSignal(Todo *); | 233 | void newSubTodoSignal(Todo *); |
234 | void unparentTodoSignal(Todo *); | 234 | void unparentTodoSignal(Todo *); |
235 | void reparentTodoSignal( Todo *,Todo * ); | 235 | void reparentTodoSignal( Todo *,Todo * ); |
236 | void showTodoSignal(Todo *); | 236 | void showTodoSignal(Todo *); |
237 | 237 | ||
238 | void editTodoSignal(Todo *); | 238 | void editTodoSignal(Todo *); |
239 | void deleteTodoSignal(Todo *); | 239 | void deleteTodoSignal(Todo *); |
240 | void todoModifiedSignal (Todo *, int); | 240 | void todoModifiedSignal (Todo *, int); |
241 | 241 | ||
242 | void isModified(bool); | 242 | void isModified(bool); |
243 | void cloneTodoSignal( Incidence * ); | 243 | void cloneTodoSignal( Incidence * ); |
244 | void cancelTodoSignal( Incidence * ); | 244 | void cancelTodoSignal( Incidence * ); |
245 | void moveTodoSignal( Incidence * ); | 245 | void moveTodoSignal( Incidence * ); |
246 | void beamTodoSignal( Incidence * ); | 246 | void beamTodoSignal( Incidence * ); |
247 | void purgeCompletedSignal(); | 247 | void purgeCompletedSignal(); |
248 | 248 | ||
249 | protected slots: | 249 | protected slots: |
250 | void toggleRunningItem(); | 250 | void toggleRunningItem(); |
251 | void paintNeeded(); | 251 | void paintNeeded(); |
252 | void processSelectionChange(); | 252 | void processSelectionChange(); |
253 | void addQuickTodo(); | 253 | void addQuickTodo(); |
254 | void setTodoModified( Todo* ); | 254 | void setTodoModified( Todo* ); |
255 | void todoModified(Todo *, int ); | 255 | void todoModified(Todo *, int ); |
256 | 256 | ||
257 | private: | 257 | private: |
258 | bool mIsActiveWindow; | ||
258 | void addQuickTodoPar( Todo * parentTodo); | 259 | void addQuickTodoPar( Todo * parentTodo); |
259 | /* | 260 | /* |
260 | * the TodoEditor approach is rather unscaling in the long | 261 | * the TodoEditor approach is rather unscaling in the long |
261 | * run. | 262 | * run. |
262 | * Korganizer keeps it in memory and we need to update | 263 | * Korganizer keeps it in memory and we need to update |
263 | * 1. make KOTodoViewItem a QObject again? | 264 | * 1. make KOTodoViewItem a QObject again? |
264 | * 2. add a public method for setting one todo modified? | 265 | * 2. add a public method for setting one todo modified? |
265 | * 3. add a private method for setting a todo modified + friend here? | 266 | * 3. add a private method for setting a todo modified + friend here? |
266 | * -- zecke 2002-07-08 | 267 | * -- zecke 2002-07-08 |
267 | */ | 268 | */ |
268 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; | 269 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; |
269 | friend class KOTodoListView; | 270 | friend class KOTodoListView; |
270 | void paintEvent(QPaintEvent * pevent); | 271 | void paintEvent(QPaintEvent * pevent); |
271 | bool mPendingUpdateBeforeRepaint; | 272 | bool mPendingUpdateBeforeRepaint; |
272 | friend class KOTodoViewItem; | 273 | friend class KOTodoViewItem; |
273 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 274 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
274 | void restoreItemState( QListViewItem * ); | 275 | void restoreItemState( QListViewItem * ); |
275 | 276 | ||
276 | bool checkTodo( Todo * ); | 277 | bool checkTodo( Todo * ); |
277 | bool isFlatDisplay; | 278 | bool isFlatDisplay; |
278 | void setOpen( QListViewItem*, bool setOpen); | 279 | void setOpen( QListViewItem*, bool setOpen); |
279 | KOTodoListView *mTodoListView; | 280 | KOTodoListView *mTodoListView; |
280 | QPopupMenu *mItemPopupMenu; | 281 | QPopupMenu *mItemPopupMenu; |
281 | QPopupMenu *mPopupMenu; | 282 | QPopupMenu *mPopupMenu; |
282 | QPopupMenu *mPriorityPopupMenu; | 283 | QPopupMenu *mPriorityPopupMenu; |
283 | QPopupMenu *mPercentageCompletedPopupMenu; | 284 | QPopupMenu *mPercentageCompletedPopupMenu; |
284 | QPopupMenu *mCategoryPopupMenu; | 285 | QPopupMenu *mCategoryPopupMenu; |
285 | QPopupMenu *mCalPopupMenu; | 286 | QPopupMenu *mCalPopupMenu; |
286 | 287 | ||
287 | QMap<int, int> mPercentage; | 288 | QMap<int, int> mPercentage; |
288 | QMap<int, int> mPriority; | 289 | QMap<int, int> mPriority; |
289 | QMap<int, QString> mCategory; | 290 | QMap<int, QString> mCategory; |
290 | KOTodoViewItem *mActiveItem; | 291 | KOTodoViewItem *mActiveItem; |
291 | 292 | ||
292 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 293 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
293 | QString mName; | 294 | QString mName; |
294 | QWidget* mQuickBar; | 295 | QWidget* mQuickBar; |
295 | 296 | ||
296 | DocPrefs *mDocPrefs; | 297 | DocPrefs *mDocPrefs; |
297 | QString mCurrentDoc; | 298 | QString mCurrentDoc; |
298 | KOQuickTodo *mQuickAdd; | 299 | KOQuickTodo *mQuickAdd; |
299 | bool mBlockUpdate; | 300 | bool mBlockUpdate; |
300 | void keyPressEvent ( QKeyEvent * ) ; | 301 | void keyPressEvent ( QKeyEvent * ) ; |
301 | KOTodoViewItem * pendingSubtodo; | 302 | KOTodoViewItem * pendingSubtodo; |
302 | DateNavigator* mNavigator; | 303 | DateNavigator* mNavigator; |
303 | void storeCurrentItem(); | 304 | void storeCurrentItem(); |
304 | void resetCurrentItem(); | 305 | void resetCurrentItem(); |
305 | Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; | 306 | Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; |
306 | QPushButton * mNewSubBut; | 307 | QPushButton * mNewSubBut; |
307 | }; | 308 | }; |
308 | 309 | ||
309 | #endif | 310 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index ba3bc05..4057ae0 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,302 +1,304 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
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 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | |||
64 | lastMode = 0; | ||
65 | lastCount = 0; | ||
66 | lastNDMode = false; | ||
67 | selecteddatescount = 0; | ||
68 | selecteddate = QDate ( 2000, 1, 1 ); | ||
69 | baseCycleDate = QDate ( 2000, 1, 1 ); | ||
63 | mCurrentView = 0; | 70 | mCurrentView = 0; |
64 | flagResetViewChangeDate = 0; | 71 | flagResetViewChangeDate = 0; |
65 | mWhatsNextView = 0; | 72 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 73 | mTodoView = 0; |
67 | mAgendaView = 0; | 74 | mAgendaView = 0; |
68 | mMonthView = 0; | 75 | mMonthView = 0; |
69 | mListView = 0; | 76 | mListView = 0; |
70 | mJournalView = 0; | 77 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 78 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 79 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 80 | mFlagShowNextxDays = false; |
74 | } | 81 | } |
75 | 82 | ||
76 | KOViewManager::~KOViewManager() | 83 | KOViewManager::~KOViewManager() |
77 | { | 84 | { |
78 | } | 85 | } |
79 | 86 | ||
80 | 87 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 88 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 89 | { |
83 | return mCurrentView; | 90 | return mCurrentView; |
84 | } | 91 | } |
85 | 92 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 93 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 94 | { |
88 | config->setGroup("General"); | 95 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 96 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 97 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") { | 98 | else if (view == "Month") { |
92 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 99 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
93 | showMonthView(); | 100 | showMonthView(); |
94 | else | 101 | else |
95 | showMonthViewWeek(); | 102 | showMonthViewWeek(); |
96 | } | 103 | } |
97 | else if (view == "List") showListView(); | 104 | else if (view == "List") showListView(); |
98 | else if (view == "Journal") showJournalView(); | 105 | else if (view == "Journal") showJournalView(); |
99 | else if (view == "TimeSpan") showTimeSpanView(); | 106 | else if (view == "TimeSpan") showTimeSpanView(); |
100 | else if (view == "Todo") showTodoView(); | 107 | else if (view == "Todo") showTodoView(); |
101 | else { | 108 | else { |
102 | config->setGroup( "Views" ); | 109 | config->setGroup( "Views" ); |
103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 110 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
104 | mCurrentAgendaView = dateCount; | 111 | mCurrentAgendaView = dateCount; |
105 | showAgendaView(); | 112 | showAgendaView(); |
106 | mCurrentAgendaView = dateCount; | 113 | mCurrentAgendaView = dateCount; |
107 | #ifdef DESKTOP_VERSION | 114 | #ifdef DESKTOP_VERSION |
108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | 115 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); |
109 | #endif | 116 | #endif |
110 | } | 117 | } |
111 | } | 118 | } |
112 | 119 | ||
113 | 120 | ||
114 | void KOViewManager::showDateView( int view, QDate date) | 121 | void KOViewManager::showDateView( int view, QDate date) |
115 | { | 122 | { |
116 | static int lastMode = 0; | 123 | |
117 | static int lastCount = 0; | ||
118 | static bool lastNDMode = false; | ||
119 | static QDate lastDate; | ||
120 | //qDebug("date %d %s", view, date.toString().latin1()); | 124 | //qDebug("date %d %s", view, date.toString().latin1()); |
121 | 125 | ||
122 | if (view != 9) | 126 | if (view != 9) |
123 | lastMode = 0; | 127 | lastMode = 0; |
124 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 128 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
125 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 129 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
126 | mFlagShowNextxDays = false; | 130 | mFlagShowNextxDays = false; |
127 | if ( view == 3 ) { | 131 | if ( view == 3 ) { |
128 | //mCurrentAgendaView = 1 ; | 132 | //mCurrentAgendaView = 1 ; |
129 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 133 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
130 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 134 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
131 | lastNDMode = savemFlagShowNextxDays; | 135 | lastNDMode = savemFlagShowNextxDays; |
132 | mMainView->dateNavigator()->selectDate( date ); | 136 | mMainView->dateNavigator()->selectDate( date ); |
133 | lastMode = 1; | 137 | lastMode = 1; |
134 | mCurrentAgendaView = 1 ; | 138 | mCurrentAgendaView = 1 ; |
135 | } else if (view == 4 ) { | 139 | } else if (view == 4 ) { |
136 | mCurrentAgendaView = 7 ; | 140 | mCurrentAgendaView = 7 ; |
137 | mMainView->dateNavigator()->selectDates( date, 7 ); | 141 | mMainView->dateNavigator()->selectDates( date, 7 ); |
138 | } else if (view == 5 ) { | 142 | } else if (view == 5 ) { |
139 | mCurrentAgendaView = 14 ; | 143 | mCurrentAgendaView = 14 ; |
140 | mMainView->dateNavigator()->selectDates( date, 14); | 144 | mMainView->dateNavigator()->selectDates( date, 14); |
141 | } else if (view == 6 ) { | 145 | } else if (view == 6 ) { |
142 | resetDateSilent( date,1); | 146 | resetDateSilent( date,1); |
143 | showMonthView(); | 147 | showMonthView(); |
144 | } else if (view == 7 ) { | 148 | } else if (view == 7 ) { |
145 | mMainView->dateNavigator()->selectDate( date ); | 149 | mMainView->dateNavigator()->selectDate( date ); |
146 | showJournalView(); | 150 | showJournalView(); |
147 | } else if (view == 8 ) { | 151 | } else if (view == 8 ) { |
148 | globalFlagBlockAgenda = 1; | 152 | globalFlagBlockAgenda = 1; |
149 | if ( mCurrentAgendaView != 3 ) | 153 | if ( mCurrentAgendaView != 3 ) |
150 | mCurrentAgendaView = -1; | 154 | mCurrentAgendaView = -1; |
151 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 155 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
152 | globalFlagBlockAgenda = 2; | 156 | globalFlagBlockAgenda = 2; |
153 | mMainView->dateNavigator()->selectDates( date , | 157 | mMainView->dateNavigator()->selectDates( date , |
154 | KOPrefs::instance()->mNextXDays ); | 158 | KOPrefs::instance()->mNextXDays ); |
155 | mFlagShowNextxDays = true; | 159 | mFlagShowNextxDays = true; |
156 | mCurrentAgendaView = 3 ; | 160 | mCurrentAgendaView = 3 ; |
157 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 161 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
158 | if ( lastMode ) { | 162 | if ( lastMode ) { |
159 | mCurrentAgendaView = lastCount ; | 163 | mCurrentAgendaView = lastCount ; |
160 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 164 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
161 | mFlagShowNextxDays = lastNDMode; | 165 | mFlagShowNextxDays = lastNDMode; |
162 | if ( mFlagShowNextxDays ) { | 166 | if ( mFlagShowNextxDays ) { |
163 | mCurrentAgendaView = 3 ; | 167 | mCurrentAgendaView = 3 ; |
164 | } | 168 | } |
165 | } else | 169 | } else |
166 | showWeekView(); | 170 | showWeekView(); |
167 | } else if (view == 10) { | 171 | } else if (view == 10) { |
168 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 172 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
169 | } | 173 | } |
170 | } | 174 | } |
171 | 175 | ||
172 | 176 | ||
173 | 177 | ||
174 | void KOViewManager::writeSettings(KConfig *config) | 178 | void KOViewManager::writeSettings(KConfig *config) |
175 | { | 179 | { |
176 | config->setGroup("General"); | 180 | config->setGroup("General"); |
177 | 181 | ||
178 | QString view; | 182 | QString view; |
179 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 183 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
180 | else if (mCurrentView == mMonthView) view = "Month"; | 184 | else if (mCurrentView == mMonthView) view = "Month"; |
181 | else if (mCurrentView == mListView) view = "List"; | 185 | else if (mCurrentView == mListView) view = "List"; |
182 | else if (mCurrentView == mJournalView) view = "Journal"; | 186 | else if (mCurrentView == mJournalView) view = "Journal"; |
183 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 187 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
184 | else if (mCurrentView == mTodoView) view = "Todo"; | 188 | else if (mCurrentView == mTodoView) view = "Todo"; |
185 | else view = "Agenda"; | 189 | else view = "Agenda"; |
186 | 190 | ||
187 | config->writeEntry("Current View",view); | 191 | config->writeEntry("Current View",view); |
188 | 192 | ||
189 | if (mAgendaView) { | 193 | if (mAgendaView) { |
190 | mAgendaView->writeSettings(config); | 194 | mAgendaView->writeSettings(config); |
191 | } | 195 | } |
192 | if (mTimeSpanView) { | 196 | if (mTimeSpanView) { |
193 | mTimeSpanView->writeSettings(config); | 197 | mTimeSpanView->writeSettings(config); |
194 | } | 198 | } |
195 | if (mListView) { | 199 | if (mListView) { |
196 | mListView->writeSettings(config); | 200 | mListView->writeSettings(config); |
197 | } | 201 | } |
198 | if (mTodoView) { | 202 | if (mTodoView) { |
199 | mTodoView->saveLayout(config,"Todo View"); | 203 | mTodoView->saveLayout(config,"Todo View"); |
200 | } | 204 | } |
201 | } | 205 | } |
202 | void KOViewManager::showNextView() | 206 | void KOViewManager::showNextView() |
203 | { | 207 | { |
204 | static int selecteddatescount = 0; | 208 | |
205 | static QDate selecteddate = QDate ( 2000, 1, 1 ); | ||
206 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); | ||
207 | int newCount = mMainView->dateNavigator()->selectedDates().count(); | 209 | int newCount = mMainView->dateNavigator()->selectedDates().count(); |
208 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { | 210 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { |
209 | flagResetViewChangeDate = 1; | 211 | flagResetViewChangeDate = 1; |
210 | } | 212 | } |
211 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) | 213 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) |
212 | flagResetViewChangeDate = 1; | 214 | flagResetViewChangeDate = 1; |
213 | if ( flagResetViewChangeDate > 0 ) { | 215 | if ( flagResetViewChangeDate > 0 ) { |
214 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); | 216 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); |
215 | //qDebug("newCycle "); | 217 | //qDebug("newCycle "); |
216 | } | 218 | } |
217 | if (mCurrentView == mWhatsNextView) goto NEXT_X; | 219 | if (mCurrentView == mWhatsNextView) goto NEXT_X; |
218 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; | 220 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; |
219 | if (mCurrentView == mJournalView ) goto DAY_1; | 221 | if (mCurrentView == mJournalView ) goto DAY_1; |
220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; | 222 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; |
221 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; | 223 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; |
222 | if (mCurrentView == mAgendaView ) goto DAY_6; | 224 | if (mCurrentView == mAgendaView ) goto DAY_6; |
223 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; | 225 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; |
224 | if (mCurrentView == mMonthView ) goto LIST; | 226 | if (mCurrentView == mMonthView ) goto LIST; |
225 | if (mCurrentView == mListView ) goto TODO; | 227 | if (mCurrentView == mListView ) goto TODO; |
226 | // if (mCurrentView == mTodoView ) goto NEXT; | 228 | // if (mCurrentView == mTodoView ) goto NEXT; |
227 | NEXT: | 229 | NEXT: |
228 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} | 230 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} |
229 | NEXT_X: | 231 | NEXT_X: |
230 | if ( KOPrefs::instance()->mShowIconNextDays ) { | 232 | if ( KOPrefs::instance()->mShowIconNextDays ) { |
231 | showNextXView(); | 233 | showNextXView(); |
232 | goto ENTE ; | 234 | goto ENTE ; |
233 | } | 235 | } |
234 | JOURNAL: | 236 | JOURNAL: |
235 | if ( KOPrefs::instance()->mShowIconJournal ) { | 237 | if ( KOPrefs::instance()->mShowIconJournal ) { |
236 | resetDateSilent( baseCycleDate , 1 ); | 238 | resetDateSilent( baseCycleDate , 1 ); |
237 | showJournalView() ;goto ENTE ;} | 239 | showJournalView() ;goto ENTE ;} |
238 | DAY_1: | 240 | DAY_1: |
239 | if ( KOPrefs::instance()->mShowIconDay1 ) { | 241 | if ( KOPrefs::instance()->mShowIconDay1 ) { |
240 | resetDateSilent( baseCycleDate , 2 ); | 242 | resetDateSilent( baseCycleDate , 2 ); |
241 | showDayView() ;goto ENTE ;} | 243 | showDayView() ;goto ENTE ;} |
242 | DAY_5: | 244 | DAY_5: |
243 | if ( KOPrefs::instance()->mShowIconDay5 ) { | 245 | if ( KOPrefs::instance()->mShowIconDay5 ) { |
244 | resetDateSilent( baseCycleDate , 2 ); | 246 | resetDateSilent( baseCycleDate , 2 ); |
245 | showWorkWeekView() ;goto ENTE ;} | 247 | showWorkWeekView() ;goto ENTE ;} |
246 | DAY_7: | 248 | DAY_7: |
247 | if ( KOPrefs::instance()->mShowIconDay7 ) { | 249 | if ( KOPrefs::instance()->mShowIconDay7 ) { |
248 | resetDateSilent( baseCycleDate , 2 ); | 250 | resetDateSilent( baseCycleDate , 2 ); |
249 | showWeekView();goto ENTE ;} | 251 | showWeekView();goto ENTE ;} |
250 | DAY_6: | 252 | DAY_6: |
251 | if ( KOPrefs::instance()->mShowIconDay6 ) { | 253 | if ( KOPrefs::instance()->mShowIconDay6 ) { |
252 | resetDateSilent( baseCycleDate , 2 ); | 254 | resetDateSilent( baseCycleDate , 2 ); |
253 | showMonthViewWeek();goto ENTE ;} | 255 | showMonthViewWeek();goto ENTE ;} |
254 | MONTH: | 256 | MONTH: |
255 | if ( KOPrefs::instance()->mShowIconMonth ) { | 257 | if ( KOPrefs::instance()->mShowIconMonth ) { |
256 | resetDateSilent( baseCycleDate , 2 ); | 258 | resetDateSilent( baseCycleDate , 2 ); |
257 | showMonthView();goto ENTE ;} | 259 | showMonthView();goto ENTE ;} |
258 | LIST: | 260 | LIST: |
259 | if ( KOPrefs::instance()->mShowIconList ) { | 261 | if ( KOPrefs::instance()->mShowIconList ) { |
260 | resetDateSilent( baseCycleDate , 2 ); | 262 | resetDateSilent( baseCycleDate , 2 ); |
261 | showListView() ;goto ENTE ;} | 263 | showListView() ;goto ENTE ;} |
262 | TODO: | 264 | TODO: |
263 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} | 265 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} |
264 | if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} | 266 | if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} |
265 | if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} | 267 | if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} |
266 | if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} | 268 | if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} |
267 | if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} | 269 | if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} |
268 | if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} | 270 | if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} |
269 | if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} | 271 | if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} |
270 | if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} | 272 | if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} |
271 | if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} | 273 | if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} |
272 | if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} | 274 | if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} |
273 | //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} | 275 | //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} |
274 | ENTE: | 276 | ENTE: |
275 | flagResetViewChangeDate = 0; | 277 | flagResetViewChangeDate = 0; |
276 | selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); | 278 | selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); |
277 | selecteddate = mMainView->dateNavigator()->selectedDates().first(); | 279 | selecteddate = mMainView->dateNavigator()->selectedDates().first(); |
278 | 280 | ||
279 | } | 281 | } |
280 | void KOViewManager::resetDateSilent( QDate date , int days ) | 282 | void KOViewManager::resetDateSilent( QDate date , int days ) |
281 | { | 283 | { |
282 | mMainView->dateNavigator()->blockSignals( true ); | 284 | mMainView->dateNavigator()->blockSignals( true ); |
283 | mMainView->dateNavigator()->selectDates( date , days ); | 285 | mMainView->dateNavigator()->selectDates( date , days ); |
284 | mMainView->dateNavigator()->blockSignals( false ); | 286 | mMainView->dateNavigator()->blockSignals( false ); |
285 | } | 287 | } |
286 | void KOViewManager::setDefaultCalendar(int) | 288 | void KOViewManager::setDefaultCalendar(int) |
287 | { | 289 | { |
288 | if ( mJournalView && mCurrentView == mJournalView ) | 290 | if ( mJournalView && mCurrentView == mJournalView ) |
289 | mJournalView->updateView(); | 291 | mJournalView->updateView(); |
290 | } | 292 | } |
291 | 293 | ||
292 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 294 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
293 | { | 295 | { |
294 | if ( flagResetViewChangeDate < 10 ) | 296 | if ( flagResetViewChangeDate < 10 ) |
295 | ++flagResetViewChangeDate; | 297 | ++flagResetViewChangeDate; |
296 | //mFlagShowNextxDays = false; | 298 | //mFlagShowNextxDays = false; |
297 | //if(view == mCurrentView) return; | 299 | //if(view == mCurrentView) return; |
298 | if ( view == 0 ) { | 300 | if ( view == 0 ) { |
299 | view = mCurrentView; | 301 | view = mCurrentView; |
300 | if ( view == 0 ) | 302 | if ( view == 0 ) |
301 | return; | 303 | return; |
302 | } | 304 | } |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 2e6aaed..2aa46d0 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -11,119 +11,126 @@ | |||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | void clearAllViews(); | 70 | void clearAllViews(); |
71 | 71 | ||
72 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); | 72 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); |
73 | 73 | ||
74 | void addView(KOrg::BaseView *); | 74 | void addView(KOrg::BaseView *); |
75 | 75 | ||
76 | Incidence *currentSelection(); | 76 | Incidence *currentSelection(); |
77 | QDate currentSelectionDate(); | 77 | QDate currentSelectionDate(); |
78 | 78 | ||
79 | KOAgendaView *agendaView() const { return mAgendaView; } | 79 | KOAgendaView *agendaView() const { return mAgendaView; } |
80 | KOJournalView *journalView() const { return mJournalView; } | 80 | KOJournalView *journalView() const { return mJournalView; } |
81 | 81 | ||
82 | signals: | 82 | signals: |
83 | void printWNV(); | 83 | void printWNV(); |
84 | void signalFullScreen( bool ); | 84 | void signalFullScreen( bool ); |
85 | void signalAgendaView( bool ); | 85 | void signalAgendaView( bool ); |
86 | public slots: | 86 | public slots: |
87 | void setDefaultCalendar(int); | 87 | void setDefaultCalendar(int); |
88 | void slotprintWNV(); | 88 | void slotprintWNV(); |
89 | void showNextView(); | 89 | void showNextView(); |
90 | void showMonth( const QDate & ); | 90 | void showMonth( const QDate & ); |
91 | void showDateView( int, QDate ); | 91 | void showDateView( int, QDate ); |
92 | void updateView(); | 92 | void updateView(); |
93 | void showWhatsNextView(); | 93 | void showWhatsNextView(); |
94 | void showListView(); | 94 | void showListView(); |
95 | void showAgendaView( bool fullScreen = false ); | 95 | void showAgendaView( bool fullScreen = false ); |
96 | void showDayView(); | 96 | void showDayView(); |
97 | void showWorkWeekView(); | 97 | void showWorkWeekView(); |
98 | void showWeekView(); | 98 | void showWeekView(); |
99 | void showNextXView(); | 99 | void showNextXView(); |
100 | void showMonthView(); | 100 | void showMonthView(); |
101 | void showMonthViewWeek(); | 101 | void showMonthViewWeek(); |
102 | void showTodoView(); | 102 | void showTodoView(); |
103 | void showJournalView(); | 103 | void showJournalView(); |
104 | void showTimeSpanView(); | 104 | void showTimeSpanView(); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | int lastMode; | ||
108 | int lastCount; | ||
109 | bool lastNDMode; | ||
110 | QDate lastDate; | ||
111 | int selecteddatescount; | ||
112 | QDate selecteddate; | ||
113 | QDate baseCycleDate; | ||
107 | void resetDateSilent( QDate date , int days ); | 114 | void resetDateSilent( QDate date , int days ); |
108 | int flagResetViewChangeDate; | 115 | int flagResetViewChangeDate; |
109 | QDate currentViewChangeDate; | 116 | QDate currentViewChangeDate; |
110 | void createMonthView(); | 117 | void createMonthView(); |
111 | CalendarView *mMainView; | 118 | CalendarView *mMainView; |
112 | 119 | ||
113 | int mCurrentAgendaView; | 120 | int mCurrentAgendaView; |
114 | KOAgendaView *mAgendaView; | 121 | KOAgendaView *mAgendaView; |
115 | KOListView *mListView; | 122 | KOListView *mListView; |
116 | KOMonthView *mMonthView; | 123 | KOMonthView *mMonthView; |
117 | KOTodoView *mTodoView; | 124 | KOTodoView *mTodoView; |
118 | KOWhatsNextView *mWhatsNextView; | 125 | KOWhatsNextView *mWhatsNextView; |
119 | KOJournalView *mJournalView; | 126 | KOJournalView *mJournalView; |
120 | KOTimeSpanView *mTimeSpanView; | 127 | KOTimeSpanView *mTimeSpanView; |
121 | 128 | ||
122 | KOrg::BaseView *mCurrentView; // currently active event view | 129 | KOrg::BaseView *mCurrentView; // currently active event view |
123 | 130 | ||
124 | int mAgendaViewMode; | 131 | int mAgendaViewMode; |
125 | bool mFlagShowNextxDays; | 132 | bool mFlagShowNextxDays; |
126 | 133 | ||
127 | }; | 134 | }; |
128 | 135 | ||
129 | #endif | 136 | #endif |