author | zautrix <zautrix> | 2005-06-29 10:36:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-29 10:36:31 (UTC) |
commit | b7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff) | |
tree | b521090cfc8eb6c8c6a6f6f8167c83058ea1361b /korganizer | |
parent | f226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff) | |
download | kdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2 |
journal fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | korganizer/journalentry.cpp | 61 | ||||
-rw-r--r-- | korganizer/journalentry.h | 5 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 110 | ||||
-rw-r--r-- | korganizer/kojournalview.h | 10 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 7 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 1 |
7 files changed, 163 insertions, 32 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a62145a..697093e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -370,192 +370,193 @@ void CalendarView::init() | |||
370 | mBlockShowDates = false; | 370 | mBlockShowDates = false; |
371 | beamDialog = new KOBeamPrefs(); | 371 | beamDialog = new KOBeamPrefs(); |
372 | mDatePickerMode = 0; | 372 | mDatePickerMode = 0; |
373 | mCurrentSyncDevice = ""; | 373 | mCurrentSyncDevice = ""; |
374 | writeLocale(); | 374 | writeLocale(); |
375 | mViewManager = new KOViewManager( this ); | 375 | mViewManager = new KOViewManager( this ); |
376 | mDialogManager = new KODialogManager( this ); | 376 | mDialogManager = new KODialogManager( this ); |
377 | mEventViewerDialog = 0; | 377 | mEventViewerDialog = 0; |
378 | mModified = false; | 378 | mModified = false; |
379 | mReadOnly = false; | 379 | mReadOnly = false; |
380 | mSelectedIncidence = 0; | 380 | mSelectedIncidence = 0; |
381 | mCalPrinter = 0; | 381 | mCalPrinter = 0; |
382 | mFilters.setAutoDelete(true); | 382 | mFilters.setAutoDelete(true); |
383 | 383 | ||
384 | mCalendar->registerObserver( this ); | 384 | mCalendar->registerObserver( this ); |
385 | // TODO: Make sure that view is updated, when calendar is changed. | 385 | // TODO: Make sure that view is updated, when calendar is changed. |
386 | 386 | ||
387 | mStorage = new FileStorage( mCalendar ); | 387 | mStorage = new FileStorage( mCalendar ); |
388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
389 | 389 | ||
390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
391 | #ifndef KORG_NOSPLITTER | 391 | #ifndef KORG_NOSPLITTER |
392 | // create the main layout frames. | 392 | // create the main layout frames. |
393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
394 | topLayout->addWidget(mPanner); | 394 | topLayout->addWidget(mPanner); |
395 | 395 | ||
396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
397 | "CalendarView::LeftFrame"); | 397 | "CalendarView::LeftFrame"); |
398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
399 | 399 | ||
400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
401 | "CalendarView::DateNavigator" ); | 401 | "CalendarView::DateNavigator" ); |
402 | 402 | ||
403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
405 | mTodoList->setNavigator( mNavigator ); | 405 | mTodoList->setNavigator( mNavigator ); |
406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
407 | 407 | ||
408 | #ifdef KORG_NORESOURCEVIEW | 408 | #ifdef KORG_NORESOURCEVIEW |
409 | mResourceView = 0; | 409 | mResourceView = 0; |
410 | #else | 410 | #else |
411 | if ( mResourceManager ) { | 411 | if ( mResourceManager ) { |
412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
413 | mResourceView->updateView(); | 413 | mResourceView->updateView(); |
414 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 414 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
415 | SLOT( updateView() ) ); | 415 | SLOT( updateView() ) ); |
416 | } else { | 416 | } else { |
417 | mResourceView = 0; | 417 | mResourceView = 0; |
418 | } | 418 | } |
419 | #endif | 419 | #endif |
420 | QWidget *rightBox = new QWidget( mPanner ); | 420 | QWidget *rightBox = new QWidget( mPanner ); |
421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
422 | 422 | ||
423 | mRightFrame = new QWidgetStack( rightBox ); | 423 | mRightFrame = new QWidgetStack( rightBox ); |
424 | rightLayout->addWidget( mRightFrame, 1 ); | 424 | rightLayout->addWidget( mRightFrame, 1 ); |
425 | 425 | ||
426 | mLeftFrame = mLeftSplitter; | 426 | mLeftFrame = mLeftSplitter; |
427 | #else | 427 | #else |
428 | //QWidget *mainBox = new QWidget( this ); | 428 | //QWidget *mainBox = new QWidget( this ); |
429 | //QWidget *leftFrame = new QWidget( mainBox ); | 429 | //QWidget *leftFrame = new QWidget( mainBox ); |
430 | //QBoxLayout * mainBoxLayout; | 430 | //QBoxLayout * mainBoxLayout; |
431 | if ( KOPrefs::instance()->mVerticalScreen ) { | 431 | if ( KOPrefs::instance()->mVerticalScreen ) { |
432 | //mainBoxLayout = new QVBoxLayout(mainBox); | 432 | //mainBoxLayout = new QVBoxLayout(mainBox); |
433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
438 | } else { | 438 | } else { |
439 | //mainBoxLayout = new QHBoxLayout(mainBox); | 439 | //mainBoxLayout = new QHBoxLayout(mainBox); |
440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
445 | } | 445 | } |
446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
447 | //QBoxLayout * leftFrameLayout; | 447 | //QBoxLayout * leftFrameLayout; |
448 | topLayout->addWidget( mMainFrame ); | 448 | topLayout->addWidget( mMainFrame ); |
449 | //mainBoxLayout->addWidget (mLeftFrame); | 449 | //mainBoxLayout->addWidget (mLeftFrame); |
450 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 450 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
451 | "CalendarView::DateNavigator" ); | 451 | "CalendarView::DateNavigator" ); |
452 | #if 0 | 452 | #if 0 |
453 | // FIXME | 453 | // FIXME |
454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
455 | "CalendarView::DateNavigator", QDate::currentDate()); | 455 | "CalendarView::DateNavigator", QDate::currentDate()); |
456 | #endif | 456 | #endif |
457 | // mDateNavigator->blockSignals( true ); | 457 | // mDateNavigator->blockSignals( true ); |
458 | //leftFrameLayout->addWidget( mDateNavigator ); | 458 | //leftFrameLayout->addWidget( mDateNavigator ); |
459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
462 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 462 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); | 464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); |
465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
466 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | ||
466 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 467 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
467 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 468 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
468 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 469 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
469 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 470 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
470 | mTodoList->setNavigator( mNavigator ); | 471 | mTodoList->setNavigator( mNavigator ); |
471 | #if 0 | 472 | #if 0 |
472 | if ( QApplication::desktop()->width() < 480 ) { | 473 | if ( QApplication::desktop()->width() < 480 ) { |
473 | leftFrameLayout->addWidget(mFilterView); | 474 | leftFrameLayout->addWidget(mFilterView); |
474 | leftFrameLayout->addWidget(mTodoList, 2 ); | 475 | leftFrameLayout->addWidget(mTodoList, 2 ); |
475 | 476 | ||
476 | } else { | 477 | } else { |
477 | leftFrameLayout->addWidget(mTodoList,2 ); | 478 | leftFrameLayout->addWidget(mTodoList,2 ); |
478 | leftFrameLayout->addWidget(mFilterView ); | 479 | leftFrameLayout->addWidget(mFilterView ); |
479 | } | 480 | } |
480 | #endif | 481 | #endif |
481 | mFilterView->hide(); | 482 | mFilterView->hide(); |
482 | mCalEditView->hide(); | 483 | mCalEditView->hide(); |
483 | QWidget *rightBox = new QWidget( mMainFrame ); | 484 | QWidget *rightBox = new QWidget( mMainFrame ); |
484 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 485 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
485 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 486 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
486 | mRightFrame = new QWidgetStack( rightBox ); | 487 | mRightFrame = new QWidgetStack( rightBox ); |
487 | rightLayout->addWidget( mRightFrame, 10 ); | 488 | rightLayout->addWidget( mRightFrame, 10 ); |
488 | 489 | ||
489 | //mLeftFrame = (QWidget *)leftFrame; | 490 | //mLeftFrame = (QWidget *)leftFrame; |
490 | if ( KOPrefs::instance()->mVerticalScreen ) { | 491 | if ( KOPrefs::instance()->mVerticalScreen ) { |
491 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 492 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
492 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 493 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
493 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 494 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
494 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 495 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
495 | } else { | 496 | } else { |
496 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 497 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
497 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 498 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
498 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 499 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
499 | } | 500 | } |
500 | if ( !KOPrefs::instance()->mShowDateNavigator) | 501 | if ( !KOPrefs::instance()->mShowDateNavigator) |
501 | mDateNavigator->hide(); | 502 | mDateNavigator->hide(); |
502 | //qDebug("Calendarview Size %d %d ", width(), height()); | 503 | //qDebug("Calendarview Size %d %d ", width(), height()); |
503 | #endif | 504 | #endif |
504 | 505 | ||
505 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 506 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
506 | SLOT( showDates( const KCal::DateList & ) ) ); | 507 | SLOT( showDates( const KCal::DateList & ) ) ); |
507 | 508 | ||
508 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 509 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
509 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 510 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
510 | 511 | ||
511 | 512 | ||
512 | 513 | ||
513 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 514 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
514 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 515 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
515 | 516 | ||
516 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 517 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
517 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 518 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
518 | 519 | ||
519 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 520 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
520 | mNavigator, SLOT( selectPreviousYear() ) ); | 521 | mNavigator, SLOT( selectPreviousYear() ) ); |
521 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 522 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
522 | mNavigator, SLOT( selectNextYear() ) ); | 523 | mNavigator, SLOT( selectNextYear() ) ); |
523 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 524 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
524 | mNavigator, SLOT( selectPreviousMonth() ) ); | 525 | mNavigator, SLOT( selectPreviousMonth() ) ); |
525 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 526 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
526 | mNavigator, SLOT( selectNextMonth() ) ); | 527 | mNavigator, SLOT( selectNextMonth() ) ); |
527 | 528 | ||
528 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 529 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
529 | mNavigator, SLOT( selectPrevious() ) ); | 530 | mNavigator, SLOT( selectPrevious() ) ); |
530 | connect( mDateNavigator, SIGNAL( goNext() ), | 531 | connect( mDateNavigator, SIGNAL( goNext() ), |
531 | mNavigator, SLOT( selectNext() ) ); | 532 | mNavigator, SLOT( selectNext() ) ); |
532 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 533 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
533 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 534 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
534 | 535 | ||
535 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 536 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
536 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 537 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
537 | #if 0 | 538 | #if 0 |
538 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 539 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
539 | SLOT( incidenceAdded( Incidence *) ) ); | 540 | SLOT( incidenceAdded( Incidence *) ) ); |
540 | #endif | 541 | #endif |
541 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 542 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
542 | 543 | ||
543 | connect( this, SIGNAL( configChanged() ), | 544 | connect( this, SIGNAL( configChanged() ), |
544 | mDateNavigator, SLOT( updateConfig() ) ); | 545 | mDateNavigator, SLOT( updateConfig() ) ); |
545 | 546 | ||
546 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 547 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
547 | SLOT( newTodo() ) ); | 548 | SLOT( newTodo() ) ); |
548 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 549 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
549 | SLOT( newSubTodo( Todo * ) ) ); | 550 | SLOT( newSubTodo( Todo * ) ) ); |
550 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 551 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
551 | SLOT( editTodo( Todo * ) ) ); | 552 | SLOT( editTodo( Todo * ) ) ); |
552 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 553 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
553 | SLOT( showTodo( Todo *) ) ); | 554 | SLOT( showTodo( Todo *) ) ); |
554 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 555 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
555 | SLOT( deleteTodo( Todo *) ) ); | 556 | SLOT( deleteTodo( Todo *) ) ); |
556 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 557 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
557 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 558 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
558 | SLOT( purgeCompleted() ) ); | 559 | SLOT( purgeCompleted() ) ); |
559 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 560 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
560 | SIGNAL( todoModified( Todo *, int ) ) ); | 561 | SIGNAL( todoModified( Todo *, int ) ) ); |
561 | 562 | ||
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index c19a5ca..7274849 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -1,250 +1,287 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | // | 24 | // |
25 | // Journal Entry | 25 | // Journal Entry |
26 | 26 | ||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtextcodec.h> | 33 | #include <qtextcodec.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <ktextedit.h> | 41 | #include <ktextedit.h> |
42 | #include <kfiledialog.h> | 42 | #include <kfiledialog.h> |
43 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | 45 | ||
46 | #include <libkcal/journal.h> | 46 | #include <libkcal/journal.h> |
47 | #include <libkcal/calendarresources.h> | 47 | #include <libkcal/calendarresources.h> |
48 | #include <libkcal/resourcecalendar.h> | 48 | #include <libkcal/resourcecalendar.h> |
49 | #include <kresources/resourceselectdialog.h> | 49 | #include <kresources/resourceselectdialog.h> |
50 | 50 | ||
51 | #include "journalentry.h" | 51 | #include "journalentry.h" |
52 | //#include "journalentry.moc" | 52 | //#include "journalentry.moc" |
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 56 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
57 | QFrame(parent) | 57 | QFrame(parent) |
58 | { | 58 | { |
59 | showOnlyMode = false; | ||
59 | mCalendar = calendar; | 60 | mCalendar = calendar; |
60 | mJournal = 0; | 61 | mJournal = 0; |
61 | mDirty = false; | 62 | mDirty = false; |
62 | 63 | ||
63 | QHBox * vb = new QHBox ( this ); | 64 | QHBox * vb = new QHBox ( this ); |
65 | QPushButton * newJournal = new QPushButton( vb ); | ||
66 | QIconSet icon; | ||
67 | if ( QApplication::desktop()->width() < 321 ) | ||
68 | icon = SmallIcon("ko16old"); | ||
69 | else | ||
70 | icon = SmallIcon("ko24old"); | ||
71 | newJournal->setIconSet (icon ) ; | ||
72 | int size = newJournal->sizeHint().height(); | ||
73 | newJournal->setFixedSize( size, size ); | ||
74 | |||
75 | |||
76 | QPushButton * toggleJournal = new QPushButton( vb ); | ||
77 | icon = SmallIcon("1updownarrow"); | ||
78 | toggleJournal->setIconSet (icon ) ; | ||
79 | //int size = toggleJournal->sizeHint().height(); | ||
80 | toggleJournal->setFixedSize( size * 2 /3 , size ); | ||
81 | |||
82 | |||
83 | |||
84 | mTitleLabel = new QLabel(i18n("Title"),vb); | ||
85 | mTitleLabel->setMargin(2); | ||
86 | mTitleLabel->setAlignment(AlignCenter); | ||
64 | QPushButton * loadTemplate = new QPushButton( vb ); | 87 | QPushButton * loadTemplate = new QPushButton( vb ); |
65 | QPushButton * saveTemplate = new QPushButton( vb ); | 88 | QPushButton * saveTemplate = new QPushButton( vb ); |
66 | QIconSet icon; | ||
67 | if ( QApplication::desktop()->width() < 321 ) | 89 | if ( QApplication::desktop()->width() < 321 ) |
68 | icon = SmallIcon("fileexport16"); | 90 | icon = SmallIcon("fileexport16"); |
69 | else | 91 | else |
70 | icon = SmallIcon("fileexport"); | 92 | icon = SmallIcon("fileexport"); |
71 | saveTemplate->setIconSet (icon ) ; | 93 | saveTemplate->setIconSet (icon ) ; |
72 | int size = saveTemplate->sizeHint().height(); | 94 | //size = saveTemplate->sizeHint().height(); |
73 | saveTemplate->setFixedSize( size, size ); | 95 | saveTemplate->setFixedSize( size, size ); |
74 | if ( QApplication::desktop()->width() < 321 ) | 96 | if ( QApplication::desktop()->width() < 321 ) |
75 | icon = SmallIcon("fileimport16"); | 97 | icon = SmallIcon("fileimport16"); |
76 | else | 98 | else |
77 | icon = SmallIcon("fileimport"); | 99 | icon = SmallIcon("fileimport"); |
78 | loadTemplate->setIconSet (icon ) ; | 100 | loadTemplate->setIconSet (icon ) ; |
79 | loadTemplate->setFixedSize( size, size ); | 101 | loadTemplate->setFixedSize( size, size ); |
80 | |||
81 | mTitleLabel = new QLabel(i18n("Title"),vb); | ||
82 | mTitleLabel->setMargin(2); | ||
83 | mTitleLabel->setAlignment(AlignCenter); | ||
84 | |||
85 | mEditor = new KTextEdit(this); | 102 | mEditor = new KTextEdit(this); |
86 | connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); | 103 | connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); |
87 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
88 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 105 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
89 | #endif | 106 | #endif |
90 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 107 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
91 | QBoxLayout *topLayout = new QVBoxLayout(this); | 108 | QBoxLayout *topLayout = new QVBoxLayout(this); |
92 | topLayout->addWidget(vb); | 109 | topLayout->addWidget(vb); |
93 | topLayout->addWidget(mEditor); | 110 | topLayout->addWidget(mEditor); |
94 | mEditor->installEventFilter(this); | 111 | mEditor->installEventFilter(this); |
95 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 112 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
96 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 113 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
114 | connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); | ||
115 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | ||
97 | } | 116 | } |
98 | 117 | ||
99 | JournalEntry::~JournalEntry() | 118 | JournalEntry::~JournalEntry() |
100 | { | 119 | { |
101 | } | 120 | } |
102 | 121 | ||
103 | void JournalEntry::slotSaveTemplate() | 122 | void JournalEntry::slotSaveTemplate() |
104 | { | 123 | { |
105 | QString fileName =locateLocal( "templates", "journals" ); | 124 | QString fileName =locateLocal( "templates", "journals" ); |
106 | QDir t_dir; | 125 | QDir t_dir; |
107 | if ( !t_dir.exists(fileName) ) | 126 | if ( !t_dir.exists(fileName) ) |
108 | t_dir.mkdir ( fileName ); | 127 | t_dir.mkdir ( fileName ); |
109 | fileName += "/journal"; | 128 | fileName += "/journal"; |
110 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 129 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
111 | if ( fileName.length() == 0 ) | 130 | if ( fileName.length() == 0 ) |
112 | return; | 131 | return; |
113 | 132 | ||
114 | QFile fileIn( fileName ); | 133 | QFile fileIn( fileName ); |
115 | if (!fileIn.open( IO_WriteOnly ) ) { | 134 | if (!fileIn.open( IO_WriteOnly ) ) { |
116 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 135 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
117 | .arg( fileName ) ); | 136 | .arg( fileName ) ); |
118 | return; | 137 | return; |
119 | } | 138 | } |
120 | // QString text; | 139 | // QString text; |
121 | QTextStream tsIn( &fileIn ); | 140 | QTextStream tsIn( &fileIn ); |
122 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 141 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
123 | tsIn << mEditor->text(); | 142 | tsIn << mEditor->text(); |
124 | fileIn.close(); | 143 | fileIn.close(); |
125 | } | 144 | } |
126 | void JournalEntry::slotLoadTemplate() | 145 | void JournalEntry::slotLoadTemplate() |
127 | { | 146 | { |
128 | QString fileName =locateLocal( "templates", "journals" ); | 147 | QString fileName =locateLocal( "templates", "journals" ); |
129 | QDir t_dir; | 148 | QDir t_dir; |
130 | if ( !t_dir.exists(fileName) ) | 149 | if ( !t_dir.exists(fileName) ) |
131 | t_dir.mkdir ( fileName ); | 150 | t_dir.mkdir ( fileName ); |
132 | fileName += "/journal"; | 151 | fileName += "/journal"; |
133 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 152 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
134 | if ( fileName.length() == 0 ) | 153 | if ( fileName.length() == 0 ) |
135 | return; | 154 | return; |
136 | QFile fileIn( fileName ); | 155 | QFile fileIn( fileName ); |
137 | if (!fileIn.open( IO_ReadOnly ) ) { | 156 | if (!fileIn.open( IO_ReadOnly ) ) { |
138 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 157 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
139 | .arg( fileName ) ); | 158 | .arg( fileName ) ); |
140 | return; | 159 | return; |
141 | } | 160 | } |
142 | QTextStream tsIn( &fileIn ); | 161 | QTextStream tsIn( &fileIn ); |
143 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 162 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
144 | QString text = tsIn.read(); | 163 | QString text = tsIn.read(); |
145 | fileIn.close(); | 164 | fileIn.close(); |
146 | int line, col; | 165 | int line, col; |
147 | mEditor->getCursorPosition (& line, & col ); | 166 | mEditor->getCursorPosition (& line, & col ); |
148 | mEditor-> insertAt ( text, line, col, true ); | 167 | mEditor-> insertAt ( text, line, col, true ); |
149 | //mEditor->setIgnoreMark( true ); | 168 | //mEditor->setIgnoreMark( true ); |
150 | setDirty(); | 169 | setDirty(); |
151 | } | 170 | } |
152 | void JournalEntry::setDate(const QDate &date) | 171 | void JournalEntry::setDate(const QDate &date) |
153 | { | 172 | { |
173 | showOnlyMode = false; | ||
174 | mDate = date; | ||
154 | writeJournal(); | 175 | writeJournal(); |
176 | int id = mCalendar->defaultCalendar(); | ||
177 | if ( id == 1 ) { | ||
178 | mTitleLabel->setText(KGlobal::locale()->formatDate(date)); | ||
179 | } else { | ||
180 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | ||
181 | mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); | ||
182 | } | ||
183 | } | ||
155 | 184 | ||
156 | mTitleLabel->setText(KGlobal::locale()->formatDate(date)); | 185 | void JournalEntry::toggleShowJournal() |
157 | 186 | { | |
158 | 187 | if ( showOnlyMode ) | |
159 | mDate = date; | 188 | emit showJournalOnly( 0 ); |
189 | else | ||
190 | emit showJournalOnly( mJournal ); | ||
160 | } | 191 | } |
161 | 192 | ||
162 | void JournalEntry::setJournal(Journal *journal) | 193 | void JournalEntry::setJournal(Journal *journal) |
163 | { | 194 | { |
164 | writeJournal(); | 195 | writeJournal(); |
165 | 196 | ||
166 | mJournal = journal; | 197 | mJournal = journal; |
167 | 198 | ||
168 | mEditor->setText(mJournal->description()); | 199 | mEditor->setText(mJournal->description()); |
169 | 200 | int id = mJournal->calID(); | |
201 | if ( id > 1 ) { | ||
202 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | ||
203 | mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); | ||
204 | } else { | ||
205 | mTitleLabel->setText(KGlobal::locale()->formatDate(mDate)); | ||
206 | } | ||
170 | mDirty = false; | 207 | mDirty = false; |
171 | } | 208 | } |
172 | 209 | ||
173 | Journal *JournalEntry::journal() const | 210 | Journal *JournalEntry::journal() const |
174 | { | 211 | { |
175 | return mJournal; | 212 | return mJournal; |
176 | } | 213 | } |
177 | 214 | ||
178 | void JournalEntry::setDirty() | 215 | void JournalEntry::setDirty() |
179 | { | 216 | { |
180 | mDirty = true; | 217 | mDirty = true; |
181 | 218 | ||
182 | // kdDebug() << "JournalEntry::setDirty()" << endl; | 219 | // kdDebug() << "JournalEntry::setDirty()" << endl; |
183 | } | 220 | } |
184 | 221 | ||
185 | void JournalEntry::clear() | 222 | void JournalEntry::clear() |
186 | { | 223 | { |
187 | mJournal = 0; | 224 | mJournal = 0; |
188 | mEditor->setText(""); | 225 | mEditor->setText(""); |
189 | } | 226 | } |
190 | 227 | ||
191 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 228 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
192 | { | 229 | { |
193 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 230 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
194 | 231 | ||
195 | if ( e->type() == QEvent::FocusOut ) { | 232 | if ( e->type() == QEvent::FocusOut ) { |
196 | writeJournal(); | 233 | writeJournal(); |
197 | } | 234 | } |
198 | if ( e->type() == QEvent::KeyPress ) { | 235 | if ( e->type() == QEvent::KeyPress ) { |
199 | QKeyEvent * k = (QKeyEvent *) e; | 236 | QKeyEvent * k = (QKeyEvent *) e; |
200 | if ( k->state() == Qt::ControlButton ) { | 237 | if ( k->state() == Qt::ControlButton ) { |
201 | k->ignore(); | 238 | k->ignore(); |
202 | //return true; | 239 | //return true; |
203 | } | 240 | } |
204 | } | 241 | } |
205 | 242 | ||
206 | return QFrame::eventFilter( o, e ); // standard event processing | 243 | return QFrame::eventFilter( o, e ); // standard event processing |
207 | } | 244 | } |
208 | 245 | ||
209 | void JournalEntry::writeJournal() | 246 | void JournalEntry::writeJournal() |
210 | { | 247 | { |
211 | // kdDebug() << "JournalEntry::writeJournal()" << endl; | 248 | // kdDebug() << "JournalEntry::writeJournal()" << endl; |
212 | if (!mDirty) return; | 249 | if (!mDirty) return; |
213 | 250 | ||
214 | if (mEditor->text().isEmpty()) { | 251 | if (mEditor->text().isEmpty()) { |
215 | if ( mJournal ) { | 252 | if ( mJournal ) { |
216 | mDirty = false; | 253 | mDirty = false; |
217 | bool conf = KOPrefs::instance()->mConfirm; | 254 | bool conf = KOPrefs::instance()->mConfirm; |
218 | KOPrefs::instance()->mConfirm = false; | 255 | KOPrefs::instance()->mConfirm = false; |
219 | emit deleteJournal(mJournal); | 256 | emit deleteJournal(mJournal); |
220 | KOPrefs::instance()->mConfirm = conf; | 257 | KOPrefs::instance()->mConfirm = conf; |
221 | mJournal = 0; | 258 | mJournal = 0; |
222 | } | 259 | } |
223 | return; | 260 | return; |
224 | } | 261 | } |
225 | 262 | ||
226 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 263 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
227 | 264 | ||
228 | if (!mJournal) { | 265 | if (!mJournal) { |
229 | mJournal = new Journal; | 266 | mJournal = new Journal; |
230 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 267 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
231 | mCalendar->addJournal(mJournal); | 268 | mCalendar->addJournal(mJournal); |
232 | } | 269 | } |
233 | 270 | ||
234 | mJournal->setDescription(mEditor->text()); | 271 | mJournal->setDescription(mEditor->text()); |
235 | //qDebug("tttt%s ", mEditor->text().latin1()); | 272 | //qDebug("tttt%s ", mEditor->text().latin1()); |
236 | 273 | ||
237 | mDirty = false; | 274 | mDirty = false; |
238 | } | 275 | } |
239 | 276 | ||
240 | void JournalEntry::flushEntry() | 277 | void JournalEntry::flushEntry() |
241 | { | 278 | { |
242 | if (!mDirty) return; | 279 | if (!mDirty) return; |
243 | 280 | ||
244 | writeJournal(); | 281 | writeJournal(); |
245 | } | 282 | } |
246 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 283 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
247 | { | 284 | { |
248 | e->ignore(); | 285 | e->ignore(); |
249 | 286 | ||
250 | } | 287 | } |
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index f1a1fef..85ad5df 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h | |||
@@ -1,75 +1,80 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef JOURNALENTRY_H | 23 | #ifndef JOURNALENTRY_H |
24 | #define JOURNALENTRY_H | 24 | #define JOURNALENTRY_H |
25 | // | 25 | // |
26 | // Widget showing one Journal entry | 26 | // Widget showing one Journal entry |
27 | 27 | ||
28 | #include <qframe.h> | 28 | #include <qframe.h> |
29 | 29 | ||
30 | #include <libkcal/calendar.h> | 30 | #include <libkcal/calendar.h> |
31 | 31 | ||
32 | class QLabel; | 32 | class QLabel; |
33 | class KTextEdit; | 33 | class KTextEdit; |
34 | 34 | ||
35 | using namespace KCal; | 35 | using namespace KCal; |
36 | 36 | ||
37 | class JournalEntry : public QFrame { | 37 | class JournalEntry : public QFrame { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | 39 | public: |
40 | JournalEntry(Calendar *,QWidget *parent); | 40 | JournalEntry(Calendar *,QWidget *parent); |
41 | virtual ~JournalEntry(); | 41 | virtual ~JournalEntry(); |
42 | 42 | ||
43 | void setJournal(Journal *); | 43 | void setJournal(Journal *); |
44 | Journal *journal() const; | 44 | Journal *journal() const; |
45 | 45 | ||
46 | void setDate(const QDate &); | 46 | void setDate(const QDate &); |
47 | 47 | ||
48 | void clear(); | 48 | void clear(); |
49 | 49 | ||
50 | void flushEntry(); | 50 | void flushEntry(); |
51 | void setShowOnly() {showOnlyMode = true;} | ||
51 | 52 | ||
52 | protected slots: | 53 | protected slots: |
53 | void slotSaveTemplate(); | 54 | void slotSaveTemplate(); |
54 | void slotLoadTemplate(); | 55 | void slotLoadTemplate(); |
55 | void setDirty(); | 56 | void setDirty(); |
57 | void toggleShowJournal(); | ||
56 | signals: | 58 | signals: |
57 | void deleteJournal(Journal *); | 59 | void deleteJournal(Journal *); |
60 | void newJournal(); | ||
61 | void showJournalOnly( Journal * ); | ||
58 | 62 | ||
59 | protected: | 63 | protected: |
60 | bool eventFilter( QObject *o, QEvent *e ); | 64 | bool eventFilter( QObject *o, QEvent *e ); |
61 | 65 | ||
62 | void writeJournal(); | 66 | void writeJournal(); |
63 | 67 | ||
64 | private: | 68 | private: |
69 | bool showOnlyMode; | ||
65 | Calendar *mCalendar; | 70 | Calendar *mCalendar; |
66 | Journal *mJournal; | 71 | Journal *mJournal; |
67 | QDate mDate; | 72 | QDate mDate; |
68 | void keyPressEvent ( QKeyEvent * ) ; | 73 | void keyPressEvent ( QKeyEvent * ) ; |
69 | QLabel *mTitleLabel; | 74 | QLabel *mTitleLabel; |
70 | KTextEdit *mEditor; | 75 | KTextEdit *mEditor; |
71 | 76 | ||
72 | bool mDirty; | 77 | bool mDirty; |
73 | }; | 78 | }; |
74 | 79 | ||
75 | #endif | 80 | #endif |
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index bc16037..fae59d6 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp | |||
@@ -1,116 +1,188 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | // | 24 | // |
25 | // View of Journal entries | 25 | // View of Journal entries |
26 | 26 | ||
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | 29 | ||
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include "koprefs.h" | 32 | #include "koprefs.h" |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | 35 | ||
36 | #include "journalentry.h" | 36 | #include "journalentry.h" |
37 | 37 | ||
38 | #include "kojournalview.h" | 38 | #include "kojournalview.h" |
39 | using namespace KOrg; | 39 | using namespace KOrg; |
40 | 40 | ||
41 | KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, | 41 | KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, |
42 | const char *name) | 42 | const char *name) |
43 | : KOrg::BaseView(calendar, parent, name) | 43 | : KOrg::BaseView(calendar, parent, name) |
44 | { | 44 | { |
45 | mEntry = new JournalEntry(calendar,this); | 45 | mCalendar = calendar; |
46 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 46 | mTopLayout = new QVBoxLayout(this); |
47 | QBoxLayout *topLayout = new QVBoxLayout(this); | 47 | getNewEntry(); |
48 | topLayout->addWidget(mEntry); | ||
49 | connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; | ||
50 | } | 48 | } |
51 | 49 | ||
52 | KOJournalView::~KOJournalView() | 50 | KOJournalView::~KOJournalView() |
53 | { | 51 | { |
54 | } | 52 | } |
55 | 53 | ||
56 | int KOJournalView::currentDateCount() | 54 | int KOJournalView::currentDateCount() |
57 | { | 55 | { |
58 | return 0; | 56 | return 0; |
59 | } | 57 | } |
58 | JournalEntry* KOJournalView::getNewEntry() | ||
59 | { | ||
60 | JournalEntry* Entry = new JournalEntry(mCalendar,this); | ||
61 | jEntries.append( Entry ); | ||
62 | mTopLayout->addWidget(Entry); | ||
63 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); | ||
64 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; | ||
65 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; | ||
66 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; | ||
67 | return Entry; | ||
68 | } | ||
60 | 69 | ||
61 | QPtrList<Incidence> KOJournalView::selectedIncidences() | 70 | QPtrList<Incidence> KOJournalView::selectedIncidences() |
62 | { | 71 | { |
63 | QPtrList<Incidence> eventList; | 72 | QPtrList<Incidence> eventList; |
64 | 73 | ||
65 | return eventList; | 74 | return eventList; |
66 | } | 75 | } |
67 | void KOJournalView::updateConfig() | 76 | void KOJournalView::updateConfig() |
68 | { | 77 | { |
69 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 78 | JournalEntry* mEntry = jEntries.first(); |
79 | while ( mEntry ) { | ||
80 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | ||
81 | mEntry = jEntries.next(); | ||
82 | } | ||
70 | } | 83 | } |
71 | void KOJournalView::updateView() | 84 | void KOJournalView::updateView() |
72 | { | 85 | { |
73 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 86 | JournalEntry* mEntry = jEntries.first(); |
87 | while ( mEntry ) { | ||
88 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | ||
89 | mEntry = jEntries.next(); | ||
90 | } | ||
91 | showDates( mDate, QDate() ); | ||
74 | } | 92 | } |
75 | 93 | ||
76 | void KOJournalView::flushView() | 94 | void KOJournalView::flushView() |
77 | { | 95 | { |
78 | mEntry->flushEntry(); | 96 | JournalEntry* mEntry = jEntries.first(); |
97 | while ( mEntry ) { | ||
98 | mEntry->flushEntry(); | ||
99 | mEntry = jEntries.next(); | ||
100 | } | ||
79 | } | 101 | } |
80 | 102 | ||
81 | void KOJournalView::clearList() | 103 | void KOJournalView::clearList() |
82 | { | 104 | { |
83 | mEntry->clear(); | 105 | JournalEntry* mEntry = jEntries.first(); |
106 | while ( mEntry ) { | ||
107 | mEntry->clear(); | ||
108 | mEntry = jEntries.next(); | ||
109 | } | ||
84 | } | 110 | } |
85 | void KOJournalView::showDates(const QDate &start, const QDate &) | 111 | void KOJournalView::newJournal() |
86 | { | 112 | { |
87 | // kdDebug() << "KOJournalView::selectDates()" << endl; | 113 | Journal* mJournal = new Journal; |
114 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | ||
115 | mCalendar->addJournal(mJournal); | ||
116 | showDates( mDate, QDate() ); | ||
117 | } | ||
88 | 118 | ||
89 | mEntry->setDate(start); | 119 | void KOJournalView::showOnly ( Journal* j ) |
120 | { | ||
121 | if ( j == 0 ) { | ||
122 | showDates( mDate, QDate() ); | ||
123 | return; | ||
124 | } | ||
125 | QPtrList<Journal> jl; | ||
126 | jl.append ( j ); | ||
127 | showList( jl ); | ||
128 | JournalEntry* mEntry = jEntries.first(); | ||
129 | mEntry->setShowOnly(); | ||
130 | } | ||
131 | void KOJournalView::showList(QPtrList<Journal> jl) | ||
132 | { | ||
133 | JournalEntry* mEntry = jEntries.first(); | ||
134 | JournalEntry* firstEntry = mEntry; | ||
135 | int count = jl.count(); | ||
136 | int iii = 0; | ||
137 | while ( iii < count ) { | ||
138 | if ( !mEntry ) { | ||
139 | mEntry = getNewEntry(); | ||
140 | mEntry->show(); | ||
141 | mEntry->setDate(mDate); | ||
142 | mEntry->setJournal(jl.at(iii)); | ||
143 | mEntry = 0; | ||
144 | } else { | ||
145 | mEntry->setDate(mDate); | ||
146 | mEntry->setJournal(jl.at(iii)); | ||
147 | mEntry->show(); | ||
148 | mEntry = jEntries.next(); | ||
149 | } | ||
150 | ++iii; | ||
151 | } | ||
152 | while ( mEntry ) { | ||
153 | mEntry->setDate(mDate); | ||
154 | mEntry->clear(); | ||
155 | if ( mEntry != firstEntry ) | ||
156 | mEntry->hide(); | ||
157 | else | ||
158 | mEntry->show(); | ||
159 | mEntry = jEntries.next(); | ||
160 | } | ||
161 | } | ||
90 | 162 | ||
91 | Journal *j = calendar()->journal(start); | 163 | void KOJournalView::showDates(const QDate &start, const QDate &) |
92 | if (j) mEntry->setJournal(j); | 164 | { |
93 | else mEntry->clear(); | 165 | mDate = start; |
94 | 166 | QPtrList<Journal> jl = calendar()->journals4Date( start ); | |
95 | // emit incidenceSelected( 0 ); | 167 | showList( jl ); |
96 | } | 168 | } |
97 | 169 | ||
98 | void KOJournalView::showEvents(QPtrList<Event>) | 170 | void KOJournalView::showEvents(QPtrList<Event>) |
99 | { | 171 | { |
100 | // After new creation of list view no events are selected. | 172 | // After new creation of list view no events are selected. |
101 | // emit incidenceSelected( 0 ); | 173 | // emit incidenceSelected( 0 ); |
102 | } | 174 | } |
103 | 175 | ||
104 | void KOJournalView::changeEventDisplay(Event *, int /*action*/) | 176 | void KOJournalView::changeEventDisplay(Event *, int /*action*/) |
105 | { | 177 | { |
106 | updateView(); | 178 | updateView(); |
107 | } | 179 | } |
108 | 180 | ||
109 | void KOJournalView::keyPressEvent ( QKeyEvent * e ) | 181 | void KOJournalView::keyPressEvent ( QKeyEvent * e ) |
110 | { | 182 | { |
111 | //qDebug("keyPressEven "); | 183 | //qDebug("keyPressEven "); |
112 | if ( e->state() == Qt::ControlButton ) { | 184 | if ( e->state() == Qt::ControlButton ) { |
113 | if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) | 185 | if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) |
114 | e->ignore(); | 186 | e->ignore(); |
115 | } | 187 | } |
116 | } | 188 | } |
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 445f940..aabf11c 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h | |||
@@ -1,68 +1,76 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KOJOURNALVIEW_H | 23 | #ifndef _KOJOURNALVIEW_H |
24 | #define _KOJOURNALVIEW_H | 24 | #define _KOJOURNALVIEW_H |
25 | 25 | ||
26 | #include <korganizer/baseview.h> | 26 | #include <korganizer/baseview.h> |
27 | #include <qlayout.h> | ||
27 | 28 | ||
28 | class JournalEntry; | 29 | class JournalEntry; |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * This class provides a journal view. | 32 | * This class provides a journal view. |
32 | 33 | ||
33 | * @short View for Journal components. | 34 | * @short View for Journal components. |
34 | * @author Cornelius Schumacher <schumacher@kde.org> | 35 | * @author Cornelius Schumacher <schumacher@kde.org> |
35 | * @see KOBaseView | 36 | * @see KOBaseView |
36 | */ | 37 | */ |
37 | class KOJournalView : public KOrg::BaseView | 38 | class KOJournalView : public KOrg::BaseView |
38 | { | 39 | { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | public: | 41 | public: |
41 | KOJournalView(Calendar *calendar, QWidget *parent = 0, | 42 | KOJournalView(Calendar *calendar, QWidget *parent = 0, |
42 | const char *name = 0); | 43 | const char *name = 0); |
43 | ~KOJournalView(); | 44 | ~KOJournalView(); |
44 | 45 | ||
45 | virtual int currentDateCount(); | 46 | virtual int currentDateCount(); |
46 | void clearList(); | 47 | void clearList(); |
47 | virtual QPtrList<Incidence> selectedIncidences(); | 48 | virtual QPtrList<Incidence> selectedIncidences(); |
48 | DateList selectedDates() | 49 | DateList selectedDates() |
49 | {DateList q; | 50 | {DateList q; |
50 | return q;}; | 51 | return q;}; |
51 | signals: | 52 | signals: |
52 | void deleteJournal(Journal *); | 53 | void deleteJournal(Journal *); |
53 | public slots: | 54 | public slots: |
55 | void showOnly ( Journal* ); | ||
56 | void newJournal(); | ||
54 | void updateView(); | 57 | void updateView(); |
55 | void flushView(); | 58 | void flushView(); |
56 | void updateConfig(); | 59 | void updateConfig(); |
57 | void showDates( const QDate &start, const QDate &end ); | 60 | void showDates( const QDate &start, const QDate &end ); |
58 | void showEvents(QPtrList<Event> eventList); | 61 | void showEvents(QPtrList<Event> eventList); |
59 | 62 | ||
60 | void changeEventDisplay(Event *, int); | 63 | void changeEventDisplay(Event *, int); |
61 | 64 | ||
62 | private: | 65 | private: |
63 | JournalEntry *mEntry; | 66 | void showList(QPtrList<Journal> jl); |
67 | Calendar *mCalendar; | ||
68 | JournalEntry* getNewEntry(); | ||
69 | QPtrList<JournalEntry> jEntries; | ||
64 | void keyPressEvent ( QKeyEvent * ) ; | 70 | void keyPressEvent ( QKeyEvent * ) ; |
71 | QBoxLayout *mTopLayout; | ||
72 | QDate mDate; | ||
65 | 73 | ||
66 | }; | 74 | }; |
67 | 75 | ||
68 | #endif | 76 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 5d9af6d..7b307f7 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -17,364 +17,371 @@ | |||
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 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | flagResetViewChangeDate = 0; | 64 | flagResetViewChangeDate = 0; |
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") { | 91 | else if (view == "Month") { |
92 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 92 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
93 | showMonthView(); | 93 | showMonthView(); |
94 | else | 94 | else |
95 | showMonthViewWeek(); | 95 | showMonthViewWeek(); |
96 | } | 96 | } |
97 | else if (view == "List") showListView(); | 97 | else if (view == "List") showListView(); |
98 | else if (view == "Journal") showJournalView(); | 98 | else if (view == "Journal") showJournalView(); |
99 | else if (view == "TimeSpan") showTimeSpanView(); | 99 | else if (view == "TimeSpan") showTimeSpanView(); |
100 | else if (view == "Todo") showTodoView(); | 100 | else if (view == "Todo") showTodoView(); |
101 | else { | 101 | else { |
102 | config->setGroup( "Views" ); | 102 | config->setGroup( "Views" ); |
103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
104 | mCurrentAgendaView = dateCount; | 104 | mCurrentAgendaView = dateCount; |
105 | showAgendaView(); | 105 | showAgendaView(); |
106 | mCurrentAgendaView = dateCount; | 106 | mCurrentAgendaView = dateCount; |
107 | #ifdef DESKTOP_VERSION | 107 | #ifdef DESKTOP_VERSION |
108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | 108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); |
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | |||
113 | void KOViewManager::showDateView( int view, QDate date) | 114 | void KOViewManager::showDateView( int view, QDate date) |
114 | { | 115 | { |
115 | static int lastMode = 0; | 116 | static int lastMode = 0; |
116 | static int lastCount = 0; | 117 | static int lastCount = 0; |
117 | static bool lastNDMode = false; | 118 | static bool lastNDMode = false; |
118 | static QDate lastDate; | 119 | static QDate lastDate; |
119 | //qDebug("date %d %s", view, date.toString().latin1()); | 120 | //qDebug("date %d %s", view, date.toString().latin1()); |
120 | 121 | ||
121 | if (view != 9) | 122 | if (view != 9) |
122 | lastMode = 0; | 123 | lastMode = 0; |
123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 124 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 125 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
125 | mFlagShowNextxDays = false; | 126 | mFlagShowNextxDays = false; |
126 | if ( view == 3 ) { | 127 | if ( view == 3 ) { |
127 | //mCurrentAgendaView = 1 ; | 128 | //mCurrentAgendaView = 1 ; |
128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 129 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 130 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
130 | lastNDMode = savemFlagShowNextxDays; | 131 | lastNDMode = savemFlagShowNextxDays; |
131 | mMainView->dateNavigator()->selectDate( date ); | 132 | mMainView->dateNavigator()->selectDate( date ); |
132 | lastMode = 1; | 133 | lastMode = 1; |
133 | mCurrentAgendaView = 1 ; | 134 | mCurrentAgendaView = 1 ; |
134 | } else if (view == 4 ) { | 135 | } else if (view == 4 ) { |
135 | mCurrentAgendaView = 7 ; | 136 | mCurrentAgendaView = 7 ; |
136 | mMainView->dateNavigator()->selectDates( date, 7 ); | 137 | mMainView->dateNavigator()->selectDates( date, 7 ); |
137 | } else if (view == 5 ) { | 138 | } else if (view == 5 ) { |
138 | mCurrentAgendaView = 14 ; | 139 | mCurrentAgendaView = 14 ; |
139 | mMainView->dateNavigator()->selectDates( date, 14); | 140 | mMainView->dateNavigator()->selectDates( date, 14); |
140 | } else if (view == 6 ) { | 141 | } else if (view == 6 ) { |
141 | resetDateSilent( date,1); | 142 | resetDateSilent( date,1); |
142 | showMonthView(); | 143 | showMonthView(); |
143 | } else if (view == 7 ) { | 144 | } else if (view == 7 ) { |
144 | mMainView->dateNavigator()->selectDate( date ); | 145 | mMainView->dateNavigator()->selectDate( date ); |
145 | showJournalView(); | 146 | showJournalView(); |
146 | } else if (view == 8 ) { | 147 | } else if (view == 8 ) { |
147 | globalFlagBlockAgenda = 1; | 148 | globalFlagBlockAgenda = 1; |
148 | if ( mCurrentAgendaView != 3 ) | 149 | if ( mCurrentAgendaView != 3 ) |
149 | mCurrentAgendaView = -1; | 150 | mCurrentAgendaView = -1; |
150 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 151 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
151 | globalFlagBlockAgenda = 2; | 152 | globalFlagBlockAgenda = 2; |
152 | mMainView->dateNavigator()->selectDates( date , | 153 | mMainView->dateNavigator()->selectDates( date , |
153 | KOPrefs::instance()->mNextXDays ); | 154 | KOPrefs::instance()->mNextXDays ); |
154 | mFlagShowNextxDays = true; | 155 | mFlagShowNextxDays = true; |
155 | mCurrentAgendaView = 3 ; | 156 | mCurrentAgendaView = 3 ; |
156 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 157 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
157 | if ( lastMode ) { | 158 | if ( lastMode ) { |
158 | mCurrentAgendaView = lastCount ; | 159 | mCurrentAgendaView = lastCount ; |
159 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 160 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
160 | mFlagShowNextxDays = lastNDMode; | 161 | mFlagShowNextxDays = lastNDMode; |
161 | if ( mFlagShowNextxDays ) { | 162 | if ( mFlagShowNextxDays ) { |
162 | mCurrentAgendaView = 3 ; | 163 | mCurrentAgendaView = 3 ; |
163 | } | 164 | } |
164 | } else | 165 | } else |
165 | showWeekView(); | 166 | showWeekView(); |
166 | } else if (view == 10) { | 167 | } else if (view == 10) { |
167 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 168 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
168 | } | 169 | } |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | 173 | ||
173 | void KOViewManager::writeSettings(KConfig *config) | 174 | void KOViewManager::writeSettings(KConfig *config) |
174 | { | 175 | { |
175 | config->setGroup("General"); | 176 | config->setGroup("General"); |
176 | 177 | ||
177 | QString view; | 178 | QString view; |
178 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 179 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
179 | else if (mCurrentView == mMonthView) view = "Month"; | 180 | else if (mCurrentView == mMonthView) view = "Month"; |
180 | else if (mCurrentView == mListView) view = "List"; | 181 | else if (mCurrentView == mListView) view = "List"; |
181 | else if (mCurrentView == mJournalView) view = "Journal"; | 182 | else if (mCurrentView == mJournalView) view = "Journal"; |
182 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 183 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
183 | else if (mCurrentView == mTodoView) view = "Todo"; | 184 | else if (mCurrentView == mTodoView) view = "Todo"; |
184 | else view = "Agenda"; | 185 | else view = "Agenda"; |
185 | 186 | ||
186 | config->writeEntry("Current View",view); | 187 | config->writeEntry("Current View",view); |
187 | 188 | ||
188 | if (mAgendaView) { | 189 | if (mAgendaView) { |
189 | mAgendaView->writeSettings(config); | 190 | mAgendaView->writeSettings(config); |
190 | } | 191 | } |
191 | if (mTimeSpanView) { | 192 | if (mTimeSpanView) { |
192 | mTimeSpanView->writeSettings(config); | 193 | mTimeSpanView->writeSettings(config); |
193 | } | 194 | } |
194 | if (mListView) { | 195 | if (mListView) { |
195 | mListView->writeSettings(config); | 196 | mListView->writeSettings(config); |
196 | } | 197 | } |
197 | if (mTodoView) { | 198 | if (mTodoView) { |
198 | mTodoView->saveLayout(config,"Todo View"); | 199 | mTodoView->saveLayout(config,"Todo View"); |
199 | } | 200 | } |
200 | } | 201 | } |
201 | void KOViewManager::showNextView() | 202 | void KOViewManager::showNextView() |
202 | { | 203 | { |
203 | static int selecteddatescount = 0; | 204 | static int selecteddatescount = 0; |
204 | static QDate selecteddate = QDate ( 2000, 1, 1 ); | 205 | static QDate selecteddate = QDate ( 2000, 1, 1 ); |
205 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); | 206 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); |
206 | int newCount = mMainView->dateNavigator()->selectedDates().count(); | 207 | int newCount = mMainView->dateNavigator()->selectedDates().count(); |
207 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { | 208 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { |
208 | flagResetViewChangeDate = 1; | 209 | flagResetViewChangeDate = 1; |
209 | } | 210 | } |
210 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) | 211 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) |
211 | flagResetViewChangeDate = 1; | 212 | flagResetViewChangeDate = 1; |
212 | if ( flagResetViewChangeDate > 0 ) { | 213 | if ( flagResetViewChangeDate > 0 ) { |
213 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); | 214 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); |
214 | //qDebug("newCycle "); | 215 | //qDebug("newCycle "); |
215 | } | 216 | } |
216 | if (mCurrentView == mWhatsNextView) goto NEXT_X; | 217 | if (mCurrentView == mWhatsNextView) goto NEXT_X; |
217 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; | 218 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; |
218 | if (mCurrentView == mJournalView ) goto DAY_1; | 219 | if (mCurrentView == mJournalView ) goto DAY_1; |
219 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; | 220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; |
220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; | 221 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; |
221 | if (mCurrentView == mAgendaView ) goto DAY_6; | 222 | if (mCurrentView == mAgendaView ) goto DAY_6; |
222 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; | 223 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; |
223 | if (mCurrentView == mMonthView ) goto LIST; | 224 | if (mCurrentView == mMonthView ) goto LIST; |
224 | if (mCurrentView == mListView ) goto TODO; | 225 | if (mCurrentView == mListView ) goto TODO; |
225 | // if (mCurrentView == mTodoView ) goto NEXT; | 226 | // if (mCurrentView == mTodoView ) goto NEXT; |
226 | NEXT: | 227 | NEXT: |
227 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} | 228 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} |
228 | NEXT_X: | 229 | NEXT_X: |
229 | if ( KOPrefs::instance()->mShowIconNextDays ) { | 230 | if ( KOPrefs::instance()->mShowIconNextDays ) { |
230 | showNextXView(); | 231 | showNextXView(); |
231 | goto ENTE ; | 232 | goto ENTE ; |
232 | } | 233 | } |
233 | JOURNAL: | 234 | JOURNAL: |
234 | if ( KOPrefs::instance()->mShowIconJournal ) { | 235 | if ( KOPrefs::instance()->mShowIconJournal ) { |
235 | resetDateSilent( baseCycleDate , 1 ); | 236 | resetDateSilent( baseCycleDate , 1 ); |
236 | showJournalView() ;goto ENTE ;} | 237 | showJournalView() ;goto ENTE ;} |
237 | DAY_1: | 238 | DAY_1: |
238 | if ( KOPrefs::instance()->mShowIconDay1 ) { | 239 | if ( KOPrefs::instance()->mShowIconDay1 ) { |
239 | resetDateSilent( baseCycleDate , 2 ); | 240 | resetDateSilent( baseCycleDate , 2 ); |
240 | showDayView() ;goto ENTE ;} | 241 | showDayView() ;goto ENTE ;} |
241 | DAY_5: | 242 | DAY_5: |
242 | if ( KOPrefs::instance()->mShowIconDay5 ) { | 243 | if ( KOPrefs::instance()->mShowIconDay5 ) { |
243 | resetDateSilent( baseCycleDate , 2 ); | 244 | resetDateSilent( baseCycleDate , 2 ); |
244 | showWorkWeekView() ;goto ENTE ;} | 245 | showWorkWeekView() ;goto ENTE ;} |
245 | DAY_7: | 246 | DAY_7: |
246 | if ( KOPrefs::instance()->mShowIconDay7 ) { | 247 | if ( KOPrefs::instance()->mShowIconDay7 ) { |
247 | resetDateSilent( baseCycleDate , 2 ); | 248 | resetDateSilent( baseCycleDate , 2 ); |
248 | showWeekView();goto ENTE ;} | 249 | showWeekView();goto ENTE ;} |
249 | DAY_6: | 250 | DAY_6: |
250 | if ( KOPrefs::instance()->mShowIconDay6 ) { | 251 | if ( KOPrefs::instance()->mShowIconDay6 ) { |
251 | resetDateSilent( baseCycleDate , 2 ); | 252 | resetDateSilent( baseCycleDate , 2 ); |
252 | showMonthViewWeek();goto ENTE ;} | 253 | showMonthViewWeek();goto ENTE ;} |
253 | MONTH: | 254 | MONTH: |
254 | if ( KOPrefs::instance()->mShowIconMonth ) { | 255 | if ( KOPrefs::instance()->mShowIconMonth ) { |
255 | resetDateSilent( baseCycleDate , 2 ); | 256 | resetDateSilent( baseCycleDate , 2 ); |
256 | showMonthView();goto ENTE ;} | 257 | showMonthView();goto ENTE ;} |
257 | LIST: | 258 | LIST: |
258 | if ( KOPrefs::instance()->mShowIconList ) { | 259 | if ( KOPrefs::instance()->mShowIconList ) { |
259 | resetDateSilent( baseCycleDate , 2 ); | 260 | resetDateSilent( baseCycleDate , 2 ); |
260 | showListView() ;goto ENTE ;} | 261 | showListView() ;goto ENTE ;} |
261 | TODO: | 262 | TODO: |
262 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} | 263 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} |
263 | if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} | 264 | if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} |
264 | if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} | 265 | if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} |
265 | if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} | 266 | if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} |
266 | if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} | 267 | if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} |
267 | if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} | 268 | if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} |
268 | if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} | 269 | if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} |
269 | if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} | 270 | if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} |
270 | if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} | 271 | if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} |
271 | if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} | 272 | if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} |
272 | //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} | 273 | //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} |
273 | ENTE: | 274 | ENTE: |
274 | flagResetViewChangeDate = 0; | 275 | flagResetViewChangeDate = 0; |
275 | selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); | 276 | selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); |
276 | selecteddate = mMainView->dateNavigator()->selectedDates().first(); | 277 | selecteddate = mMainView->dateNavigator()->selectedDates().first(); |
277 | 278 | ||
278 | } | 279 | } |
279 | void KOViewManager::resetDateSilent( QDate date , int days ) | 280 | void KOViewManager::resetDateSilent( QDate date , int days ) |
280 | { | 281 | { |
281 | mMainView->dateNavigator()->blockSignals( true ); | 282 | mMainView->dateNavigator()->blockSignals( true ); |
282 | mMainView->dateNavigator()->selectDates( date , days ); | 283 | mMainView->dateNavigator()->selectDates( date , days ); |
283 | mMainView->dateNavigator()->blockSignals( false ); | 284 | mMainView->dateNavigator()->blockSignals( false ); |
284 | } | 285 | } |
286 | void KOViewManager::setDefaultCalendar(int) | ||
287 | { | ||
288 | if ( mJournalView && mCurrentView == mJournalView ) | ||
289 | mJournalView->updateView(); | ||
290 | } | ||
291 | |||
285 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 292 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
286 | { | 293 | { |
287 | if ( flagResetViewChangeDate < 10 ) | 294 | if ( flagResetViewChangeDate < 10 ) |
288 | ++flagResetViewChangeDate; | 295 | ++flagResetViewChangeDate; |
289 | //mFlagShowNextxDays = false; | 296 | //mFlagShowNextxDays = false; |
290 | //if(view == mCurrentView) return; | 297 | //if(view == mCurrentView) return; |
291 | if ( view == 0 ) { | 298 | if ( view == 0 ) { |
292 | view = mCurrentView; | 299 | view = mCurrentView; |
293 | if ( view == 0 ) | 300 | if ( view == 0 ) |
294 | return; | 301 | return; |
295 | } | 302 | } |
296 | bool callupdate = !(view == mCurrentView); | 303 | bool callupdate = !(view == mCurrentView); |
297 | bool full = fullScreen; | 304 | bool full = fullScreen; |
298 | if(view == mCurrentView && view != mWhatsNextView ) { | 305 | if(view == mCurrentView && view != mWhatsNextView ) { |
299 | if ( mCurrentAgendaView < 0 ) | 306 | if ( mCurrentAgendaView < 0 ) |
300 | return; | 307 | return; |
301 | if ( view != mMonthView ) | 308 | if ( view != mMonthView ) |
302 | full = mMainView->leftFrame()->isVisible(); | 309 | full = mMainView->leftFrame()->isVisible(); |
303 | } else { | 310 | } else { |
304 | if ( view == mMonthView && mMonthView) | 311 | if ( view == mMonthView && mMonthView) |
305 | ;//mMonthView->skipResize = true ; | 312 | ;//mMonthView->skipResize = true ; |
306 | mCurrentView = view; | 313 | mCurrentView = view; |
307 | // bool full = fullScreen; | 314 | // bool full = fullScreen; |
308 | bool isFull = !mMainView->leftFrame()->isVisible(); | 315 | bool isFull = !mMainView->leftFrame()->isVisible(); |
309 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 316 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
310 | full = true; | 317 | full = true; |
311 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 318 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
312 | full = false; | 319 | full = false; |
313 | } | 320 | } |
314 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 321 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
315 | //raiseCurrentView( full ); | 322 | //raiseCurrentView( full ); |
316 | mMainView->processIncidenceSelection( 0 ); | 323 | mMainView->processIncidenceSelection( 0 ); |
317 | //mMainView->updateView(); | 324 | //mMainView->updateView(); |
318 | raiseCurrentView( full, callupdate ); | 325 | raiseCurrentView( full, callupdate ); |
319 | mMainView->adaptNavigationUnits(); | 326 | mMainView->adaptNavigationUnits(); |
320 | mMainView->updateUnmanagedViews(); | 327 | mMainView->updateUnmanagedViews(); |
321 | } | 328 | } |
322 | 329 | ||
323 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 330 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
324 | { | 331 | { |
325 | mCurrentAgendaView = 0; | 332 | mCurrentAgendaView = 0; |
326 | if ( fullScreen ) { | 333 | if ( fullScreen ) { |
327 | mMainView->leftFrame()->hide(); | 334 | mMainView->leftFrame()->hide(); |
328 | } else { | 335 | } else { |
329 | mMainView->leftFrame()->show(); | 336 | mMainView->leftFrame()->show(); |
330 | } | 337 | } |
331 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); | 338 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); |
332 | emit signalFullScreen( !fullScreen ); | 339 | emit signalFullScreen( !fullScreen ); |
333 | if ( callUpdateView ) | 340 | if ( callUpdateView ) |
334 | mMainView->updateView(); | 341 | mMainView->updateView(); |
335 | 342 | ||
336 | if ( globalFlagBlockAgenda == 5 ) { | 343 | if ( globalFlagBlockAgenda == 5 ) { |
337 | globalFlagBlockAgenda = 4; | 344 | globalFlagBlockAgenda = 4; |
338 | globalFlagBlockAgendaItemPaint = 1; | 345 | globalFlagBlockAgendaItemPaint = 1; |
339 | } | 346 | } |
340 | mMainView->viewStack()->raiseWidget(mCurrentView); | 347 | mMainView->viewStack()->raiseWidget(mCurrentView); |
341 | if ( globalFlagBlockAgenda == 4 ) { | 348 | if ( globalFlagBlockAgenda == 4 ) { |
342 | if ( mCurrentView == mAgendaView ) { | 349 | if ( mCurrentView == mAgendaView ) { |
343 | //globalFlagBlockAgenda =1 ; | 350 | //globalFlagBlockAgenda =1 ; |
344 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 351 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
345 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 352 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
346 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 353 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
347 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 354 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
348 | qApp->processEvents(); | 355 | qApp->processEvents(); |
349 | //qDebug("qApp->processEvents() "); | 356 | //qDebug("qApp->processEvents() "); |
350 | globalFlagBlockAgenda = 0; | 357 | globalFlagBlockAgenda = 0; |
351 | mAgendaView->repaintAgenda(); | 358 | mAgendaView->repaintAgenda(); |
352 | 359 | ||
353 | } | 360 | } |
354 | globalFlagBlockAgenda = 0; | 361 | globalFlagBlockAgenda = 0; |
355 | } | 362 | } |
356 | emit signalAgendaView( mCurrentView == mAgendaView ); | 363 | emit signalAgendaView( mCurrentView == mAgendaView ); |
357 | //qDebug("raiseCurrentView ende "); | 364 | //qDebug("raiseCurrentView ende "); |
358 | 365 | ||
359 | } | 366 | } |
360 | 367 | ||
361 | void KOViewManager::clearAllViews() | 368 | void KOViewManager::clearAllViews() |
362 | { | 369 | { |
363 | 370 | ||
364 | if ( mTodoView ) mTodoView->clearList(); | 371 | if ( mTodoView ) mTodoView->clearList(); |
365 | if ( mListView ) mListView->clearList(); | 372 | if ( mListView ) mListView->clearList(); |
366 | 373 | ||
367 | if ( mAgendaView ) mAgendaView->clearList(); | 374 | if ( mAgendaView ) mAgendaView->clearList(); |
368 | if ( mMonthView ) mMonthView->clearList(); | 375 | if ( mMonthView ) mMonthView->clearList(); |
369 | if ( mWhatsNextView ) mWhatsNextView->clearList(); | 376 | if ( mWhatsNextView ) mWhatsNextView->clearList(); |
370 | if ( mJournalView ) mJournalView->clearList(); | 377 | if ( mJournalView ) mJournalView->clearList(); |
371 | 378 | ||
372 | } | 379 | } |
373 | void KOViewManager::updateView() | 380 | void KOViewManager::updateView() |
374 | { | 381 | { |
375 | // qDebug("KOViewManager::updateView() "); | 382 | // qDebug("KOViewManager::updateView() "); |
376 | // if we are updating mTodoView, we get endless recursion | 383 | // if we are updating mTodoView, we get endless recursion |
377 | if ( mTodoView == mCurrentView ) | 384 | if ( mTodoView == mCurrentView ) |
378 | return; | 385 | return; |
379 | if ( mCurrentView ) mCurrentView->updateView(); | 386 | if ( mCurrentView ) mCurrentView->updateView(); |
380 | 387 | ||
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 838583b..d5a8e3b 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,127 +1,128 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
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 | 80 | ||
81 | signals: | 81 | signals: |
82 | void printWNV(); | 82 | void printWNV(); |
83 | void signalFullScreen( bool ); | 83 | void signalFullScreen( bool ); |
84 | void signalAgendaView( bool ); | 84 | void signalAgendaView( bool ); |
85 | public slots: | 85 | public slots: |
86 | void setDefaultCalendar(int); | ||
86 | void slotprintWNV(); | 87 | void slotprintWNV(); |
87 | void showNextView(); | 88 | void showNextView(); |
88 | void showMonth( const QDate & ); | 89 | void showMonth( const QDate & ); |
89 | void showDateView( int, QDate ); | 90 | void showDateView( int, QDate ); |
90 | void updateView(); | 91 | void updateView(); |
91 | void showWhatsNextView(); | 92 | void showWhatsNextView(); |
92 | void showListView(); | 93 | void showListView(); |
93 | void showAgendaView( bool fullScreen = false ); | 94 | void showAgendaView( bool fullScreen = false ); |
94 | void showDayView(); | 95 | void showDayView(); |
95 | void showWorkWeekView(); | 96 | void showWorkWeekView(); |
96 | void showWeekView(); | 97 | void showWeekView(); |
97 | void showNextXView(); | 98 | void showNextXView(); |
98 | void showMonthView(); | 99 | void showMonthView(); |
99 | void showMonthViewWeek(); | 100 | void showMonthViewWeek(); |
100 | void showTodoView(); | 101 | void showTodoView(); |
101 | void showJournalView(); | 102 | void showJournalView(); |
102 | void showTimeSpanView(); | 103 | void showTimeSpanView(); |
103 | 104 | ||
104 | private: | 105 | private: |
105 | void resetDateSilent( QDate date , int days ); | 106 | void resetDateSilent( QDate date , int days ); |
106 | int flagResetViewChangeDate; | 107 | int flagResetViewChangeDate; |
107 | QDate currentViewChangeDate; | 108 | QDate currentViewChangeDate; |
108 | void createMonthView(); | 109 | void createMonthView(); |
109 | CalendarView *mMainView; | 110 | CalendarView *mMainView; |
110 | 111 | ||
111 | int mCurrentAgendaView; | 112 | int mCurrentAgendaView; |
112 | KOAgendaView *mAgendaView; | 113 | KOAgendaView *mAgendaView; |
113 | KOListView *mListView; | 114 | KOListView *mListView; |
114 | KOMonthView *mMonthView; | 115 | KOMonthView *mMonthView; |
115 | KOTodoView *mTodoView; | 116 | KOTodoView *mTodoView; |
116 | KOWhatsNextView *mWhatsNextView; | 117 | KOWhatsNextView *mWhatsNextView; |
117 | KOJournalView *mJournalView; | 118 | KOJournalView *mJournalView; |
118 | KOTimeSpanView *mTimeSpanView; | 119 | KOTimeSpanView *mTimeSpanView; |
119 | 120 | ||
120 | KOrg::BaseView *mCurrentView; // currently active event view | 121 | KOrg::BaseView *mCurrentView; // currently active event view |
121 | 122 | ||
122 | int mAgendaViewMode; | 123 | int mAgendaViewMode; |
123 | bool mFlagShowNextxDays; | 124 | bool mFlagShowNextxDays; |
124 | 125 | ||
125 | }; | 126 | }; |
126 | 127 | ||
127 | #endif | 128 | #endif |