-rw-r--r-- | korganizer/calendarview.cpp | 63 | ||||
-rw-r--r-- | korganizer/calendarview.h | 7 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
4 files changed, 71 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b3686aa..07ec459 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -366,192 +366,196 @@ void CalendarView::init() | |||
366 | { | 366 | { |
367 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 367 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
368 | setFocusPolicy ( NoFocus ); | 368 | setFocusPolicy ( NoFocus ); |
369 | mViewerCallerIsSearchDialog = false; | 369 | mViewerCallerIsSearchDialog = false; |
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)) ); | ||
463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | ||
464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); | ||
465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | ||
462 | mTodoList->setNavigator( mNavigator ); | 466 | mTodoList->setNavigator( mNavigator ); |
463 | #if 0 | 467 | #if 0 |
464 | if ( QApplication::desktop()->width() < 480 ) { | 468 | if ( QApplication::desktop()->width() < 480 ) { |
465 | leftFrameLayout->addWidget(mFilterView); | 469 | leftFrameLayout->addWidget(mFilterView); |
466 | leftFrameLayout->addWidget(mTodoList, 2 ); | 470 | leftFrameLayout->addWidget(mTodoList, 2 ); |
467 | 471 | ||
468 | } else { | 472 | } else { |
469 | leftFrameLayout->addWidget(mTodoList,2 ); | 473 | leftFrameLayout->addWidget(mTodoList,2 ); |
470 | leftFrameLayout->addWidget(mFilterView ); | 474 | leftFrameLayout->addWidget(mFilterView ); |
471 | } | 475 | } |
472 | #endif | 476 | #endif |
473 | mFilterView->hide(); | 477 | mFilterView->hide(); |
474 | mCalEditView->hide(); | 478 | mCalEditView->hide(); |
475 | QWidget *rightBox = new QWidget( mMainFrame ); | 479 | QWidget *rightBox = new QWidget( mMainFrame ); |
476 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 480 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
477 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 481 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
478 | mRightFrame = new QWidgetStack( rightBox ); | 482 | mRightFrame = new QWidgetStack( rightBox ); |
479 | rightLayout->addWidget( mRightFrame, 10 ); | 483 | rightLayout->addWidget( mRightFrame, 10 ); |
480 | 484 | ||
481 | //mLeftFrame = (QWidget *)leftFrame; | 485 | //mLeftFrame = (QWidget *)leftFrame; |
482 | if ( KOPrefs::instance()->mVerticalScreen ) { | 486 | if ( KOPrefs::instance()->mVerticalScreen ) { |
483 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 487 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
484 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 488 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
485 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 489 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
486 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 490 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
487 | } else { | 491 | } else { |
488 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 492 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
489 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 493 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
490 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 494 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
491 | } | 495 | } |
492 | if ( !KOPrefs::instance()->mShowDateNavigator) | 496 | if ( !KOPrefs::instance()->mShowDateNavigator) |
493 | mDateNavigator->hide(); | 497 | mDateNavigator->hide(); |
494 | //qDebug("Calendarview Size %d %d ", width(), height()); | 498 | //qDebug("Calendarview Size %d %d ", width(), height()); |
495 | #endif | 499 | #endif |
496 | 500 | ||
497 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 501 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
498 | SLOT( showDates( const KCal::DateList & ) ) ); | 502 | SLOT( showDates( const KCal::DateList & ) ) ); |
499 | 503 | ||
500 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 504 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
501 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 505 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
502 | 506 | ||
503 | 507 | ||
504 | 508 | ||
505 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 509 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
506 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 510 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
507 | 511 | ||
508 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 512 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
509 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 513 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
510 | 514 | ||
511 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 515 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
512 | mNavigator, SLOT( selectPreviousYear() ) ); | 516 | mNavigator, SLOT( selectPreviousYear() ) ); |
513 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 517 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
514 | mNavigator, SLOT( selectNextYear() ) ); | 518 | mNavigator, SLOT( selectNextYear() ) ); |
515 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 519 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
516 | mNavigator, SLOT( selectPreviousMonth() ) ); | 520 | mNavigator, SLOT( selectPreviousMonth() ) ); |
517 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 521 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
518 | mNavigator, SLOT( selectNextMonth() ) ); | 522 | mNavigator, SLOT( selectNextMonth() ) ); |
519 | 523 | ||
520 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 524 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
521 | mNavigator, SLOT( selectPrevious() ) ); | 525 | mNavigator, SLOT( selectPrevious() ) ); |
522 | connect( mDateNavigator, SIGNAL( goNext() ), | 526 | connect( mDateNavigator, SIGNAL( goNext() ), |
523 | mNavigator, SLOT( selectNext() ) ); | 527 | mNavigator, SLOT( selectNext() ) ); |
524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 528 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 529 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
526 | 530 | ||
527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 531 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 532 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
529 | #if 0 | 533 | #if 0 |
530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 534 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
531 | SLOT( incidenceAdded( Incidence *) ) ); | 535 | SLOT( incidenceAdded( Incidence *) ) ); |
532 | #endif | 536 | #endif |
533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 537 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
534 | 538 | ||
535 | connect( this, SIGNAL( configChanged() ), | 539 | connect( this, SIGNAL( configChanged() ), |
536 | mDateNavigator, SLOT( updateConfig() ) ); | 540 | mDateNavigator, SLOT( updateConfig() ) ); |
537 | 541 | ||
538 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 542 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
539 | SLOT( newTodo() ) ); | 543 | SLOT( newTodo() ) ); |
540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 544 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
541 | SLOT( newSubTodo( Todo * ) ) ); | 545 | SLOT( newSubTodo( Todo * ) ) ); |
542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 546 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
543 | SLOT( editTodo( Todo * ) ) ); | 547 | SLOT( editTodo( Todo * ) ) ); |
544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 548 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
545 | SLOT( showTodo( Todo *) ) ); | 549 | SLOT( showTodo( Todo *) ) ); |
546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 550 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
547 | SLOT( deleteTodo( Todo *) ) ); | 551 | SLOT( deleteTodo( Todo *) ) ); |
548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 552 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 553 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
550 | SLOT( purgeCompleted() ) ); | 554 | SLOT( purgeCompleted() ) ); |
551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 555 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
552 | SIGNAL( todoModified( Todo *, int ) ) ); | 556 | SIGNAL( todoModified( Todo *, int ) ) ); |
553 | 557 | ||
554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 558 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 559 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 560 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
557 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 561 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
@@ -1741,323 +1745,380 @@ bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a | |||
1741 | ev->addAttendee( a ); | 1745 | ev->addAttendee( a ); |
1742 | } | 1746 | } |
1743 | QString kind; | 1747 | QString kind; |
1744 | if ( birthday ) { | 1748 | if ( birthday ) { |
1745 | kind = i18n( "Birthday" ); | 1749 | kind = i18n( "Birthday" ); |
1746 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1750 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1747 | } | 1751 | } |
1748 | else { | 1752 | else { |
1749 | kind = i18n( "Anniversary" ); | 1753 | kind = i18n( "Anniversary" ); |
1750 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1754 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1751 | } | 1755 | } |
1752 | ev->setCategories( kind ); | 1756 | ev->setCategories( kind ); |
1753 | ev->setDtStart( QDateTime(date) ); | 1757 | ev->setDtStart( QDateTime(date) ); |
1754 | ev->setDtEnd( QDateTime(date) ); | 1758 | ev->setDtEnd( QDateTime(date) ); |
1755 | ev->setFloats( true ); | 1759 | ev->setFloats( true ); |
1756 | Recurrence * rec = ev->recurrence(); | 1760 | Recurrence * rec = ev->recurrence(); |
1757 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1761 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1758 | rec->addYearlyNum( date.month() ); | 1762 | rec->addYearlyNum( date.month() ); |
1759 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1763 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1760 | delete ev; | 1764 | delete ev; |
1761 | return false; | 1765 | return false; |
1762 | } | 1766 | } |
1763 | return true; | 1767 | return true; |
1764 | 1768 | ||
1765 | } | 1769 | } |
1766 | bool CalendarView::importQtopia( const QString &categories, | 1770 | bool CalendarView::importQtopia( const QString &categories, |
1767 | const QString &datebook, | 1771 | const QString &datebook, |
1768 | const QString &todolist ) | 1772 | const QString &todolist ) |
1769 | { | 1773 | { |
1770 | 1774 | ||
1771 | QtopiaFormat qtopiaFormat; | 1775 | QtopiaFormat qtopiaFormat; |
1772 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1776 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1773 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1777 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1774 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1778 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1775 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1779 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1776 | 1780 | ||
1777 | updateView(); | 1781 | updateView(); |
1778 | return true; | 1782 | return true; |
1779 | 1783 | ||
1780 | #if 0 | 1784 | #if 0 |
1781 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1785 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1782 | mCurrentSyncDevice = "qtopia-XML"; | 1786 | mCurrentSyncDevice = "qtopia-XML"; |
1783 | if ( mSyncManager->mAskForPreferences ) | 1787 | if ( mSyncManager->mAskForPreferences ) |
1784 | edit_sync_options(); | 1788 | edit_sync_options(); |
1785 | qApp->processEvents(); | 1789 | qApp->processEvents(); |
1786 | CalendarLocal* calendar = new CalendarLocal(); | 1790 | CalendarLocal* calendar = new CalendarLocal(); |
1787 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1791 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1788 | bool syncOK = false; | 1792 | bool syncOK = false; |
1789 | QtopiaFormat qtopiaFormat; | 1793 | QtopiaFormat qtopiaFormat; |
1790 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1794 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1791 | bool loadOk = true; | 1795 | bool loadOk = true; |
1792 | if ( !categories.isEmpty() ) | 1796 | if ( !categories.isEmpty() ) |
1793 | loadOk = qtopiaFormat.load( calendar, categories ); | 1797 | loadOk = qtopiaFormat.load( calendar, categories ); |
1794 | if ( loadOk && !datebook.isEmpty() ) | 1798 | if ( loadOk && !datebook.isEmpty() ) |
1795 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1799 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1796 | if ( loadOk && !todolist.isEmpty() ) | 1800 | if ( loadOk && !todolist.isEmpty() ) |
1797 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1801 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1798 | 1802 | ||
1799 | if ( loadOk ) { | 1803 | if ( loadOk ) { |
1800 | getEventViewerDialog()->setSyncMode( true ); | 1804 | getEventViewerDialog()->setSyncMode( true ); |
1801 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1805 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1802 | getEventViewerDialog()->setSyncMode( false ); | 1806 | getEventViewerDialog()->setSyncMode( false ); |
1803 | qApp->processEvents(); | 1807 | qApp->processEvents(); |
1804 | if ( syncOK ) { | 1808 | if ( syncOK ) { |
1805 | if ( mSyncManager->mWriteBackFile ) | 1809 | if ( mSyncManager->mWriteBackFile ) |
1806 | { | 1810 | { |
1807 | // write back XML file | 1811 | // write back XML file |
1808 | 1812 | ||
1809 | } | 1813 | } |
1810 | setModified( true ); | 1814 | setModified( true ); |
1811 | } | 1815 | } |
1812 | } else { | 1816 | } else { |
1813 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1817 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1814 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1818 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1815 | question, i18n("Ok")) ; | 1819 | question, i18n("Ok")) ; |
1816 | } | 1820 | } |
1817 | delete calendar; | 1821 | delete calendar; |
1818 | updateView(); | 1822 | updateView(); |
1819 | return syncOK; | 1823 | return syncOK; |
1820 | 1824 | ||
1821 | 1825 | ||
1822 | #endif | 1826 | #endif |
1823 | 1827 | ||
1824 | } | 1828 | } |
1825 | 1829 | ||
1826 | void CalendarView::setSyncEventsReadOnly() | 1830 | void CalendarView::setSyncEventsReadOnly() |
1827 | { | 1831 | { |
1828 | Event * ev; | 1832 | Event * ev; |
1829 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1833 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1830 | ev = eL.first(); | 1834 | ev = eL.first(); |
1831 | while ( ev ) { | 1835 | while ( ev ) { |
1832 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1836 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1833 | ev->setReadOnly( true ); | 1837 | ev->setReadOnly( true ); |
1834 | ev = eL.next(); | 1838 | ev = eL.next(); |
1835 | } | 1839 | } |
1836 | } | 1840 | } |
1841 | |||
1842 | bool CalendarView::loadCalendars() | ||
1843 | { | ||
1844 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
1845 | KopiCalendarFile * cal = calendars.first(); | ||
1846 | mCalendar->setDefaultCalendar( 1 ); | ||
1847 | openCalendar( MainWindow::defaultFileName(), false ); | ||
1848 | cal = calendars.next(); | ||
1849 | while ( cal ) { | ||
1850 | addCalendar( cal ); | ||
1851 | cal = calendars.next(); | ||
1852 | } | ||
1853 | restoreCalendarSettings(); | ||
1854 | mCalendar->reInitAlarmSettings(); | ||
1855 | setSyncEventsReadOnly(); | ||
1856 | updateUnmanagedViews(); | ||
1857 | updateView(); | ||
1858 | } | ||
1859 | bool CalendarView::restoreCalendarSettings() | ||
1860 | { | ||
1861 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
1862 | KopiCalendarFile * cal = calendars.first(); | ||
1863 | while ( cal ) { | ||
1864 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | ||
1865 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | ||
1866 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | ||
1867 | if ( cal->isStandard ) | ||
1868 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | ||
1869 | cal = calendars.next(); | ||
1870 | } | ||
1871 | } | ||
1872 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | ||
1873 | { | ||
1874 | |||
1875 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) | ||
1876 | return true; | ||
1877 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); | ||
1878 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); | ||
1879 | return false; | ||
1880 | } | ||
1837 | bool CalendarView::openCalendar(QString filename, bool merge) | 1881 | bool CalendarView::openCalendar(QString filename, bool merge) |
1838 | { | 1882 | { |
1839 | 1883 | ||
1840 | if (filename.isEmpty()) { | 1884 | if (filename.isEmpty()) { |
1841 | return false; | 1885 | return false; |
1842 | } | 1886 | } |
1843 | 1887 | ||
1844 | if (!QFile::exists(filename)) { | 1888 | if (!QFile::exists(filename)) { |
1845 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1889 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1846 | return false; | 1890 | return false; |
1847 | } | 1891 | } |
1848 | 1892 | ||
1849 | globalFlagBlockAgenda = 1; | 1893 | globalFlagBlockAgenda = 1; |
1850 | clearAllViews(); | 1894 | clearAllViews(); |
1851 | if (!merge) { | 1895 | if (!merge) { |
1852 | mViewManager->setDocumentId( filename ); | 1896 | mViewManager->setDocumentId( filename ); |
1853 | mCalendar->close(); | 1897 | mCalendar->close(); |
1854 | } | 1898 | } |
1855 | mStorage->setFileName( filename ); | 1899 | mStorage->setFileName( filename ); |
1856 | 1900 | ||
1857 | if ( mStorage->load() ) { | 1901 | if ( mStorage->load() ) { |
1858 | if ( merge ) ;//setModified( true ); | 1902 | if ( merge ) ;//setModified( true ); |
1859 | else { | 1903 | else { |
1860 | //setModified( true ); | 1904 | //setModified( true ); |
1861 | mViewManager->setDocumentId( filename ); | 1905 | mViewManager->setDocumentId( filename ); |
1862 | mDialogManager->setDocumentId( filename ); | 1906 | mDialogManager->setDocumentId( filename ); |
1863 | mTodoList->setDocumentId( filename ); | 1907 | mTodoList->setDocumentId( filename ); |
1864 | } | 1908 | } |
1865 | globalFlagBlockAgenda = 2; | 1909 | globalFlagBlockAgenda = 2; |
1866 | // if ( getLastSyncEvent() ) | 1910 | // if ( getLastSyncEvent() ) |
1867 | // getLastSyncEvent()->setReadOnly( true ); | 1911 | // getLastSyncEvent()->setReadOnly( true ); |
1868 | mCalendar->reInitAlarmSettings(); | 1912 | mCalendar->reInitAlarmSettings(); |
1869 | setSyncEventsReadOnly(); | 1913 | setSyncEventsReadOnly(); |
1870 | updateUnmanagedViews(); | 1914 | updateUnmanagedViews(); |
1871 | updateView(); | 1915 | updateView(); |
1872 | if ( filename != MainWindow::defaultFileName() ) { | 1916 | if ( filename != MainWindow::defaultFileName() ) { |
1873 | saveCalendar( MainWindow::defaultFileName() ); | 1917 | saveCalendar( MainWindow::defaultFileName() ); |
1874 | } else { | 1918 | } else { |
1875 | QFileInfo finf ( MainWindow::defaultFileName()); | 1919 | QFileInfo finf ( MainWindow::defaultFileName()); |
1876 | if ( finf.exists() ) { | 1920 | if ( finf.exists() ) { |
1877 | setLoadedFileVersion( finf.lastModified () ); | 1921 | setLoadedFileVersion( finf.lastModified () ); |
1878 | } | 1922 | } |
1879 | } | 1923 | } |
1880 | return true; | 1924 | return true; |
1881 | } else { | 1925 | } else { |
1882 | // while failing to load, the calendar object could | 1926 | // while failing to load, the calendar object could |
1883 | // have become partially populated. Clear it out. | 1927 | // have become partially populated. Clear it out. |
1884 | if ( !merge ) { | 1928 | if ( !merge ) { |
1885 | mCalendar->close(); | 1929 | mCalendar->close(); |
1886 | mViewManager->setDocumentId( filename ); | 1930 | mViewManager->setDocumentId( filename ); |
1887 | mDialogManager->setDocumentId( filename ); | 1931 | mDialogManager->setDocumentId( filename ); |
1888 | mTodoList->setDocumentId( filename ); | 1932 | mTodoList->setDocumentId( filename ); |
1889 | } | 1933 | } |
1890 | 1934 | ||
1891 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1935 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1892 | 1936 | ||
1893 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1937 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1894 | globalFlagBlockAgenda = 2; | 1938 | globalFlagBlockAgenda = 2; |
1895 | mCalendar->reInitAlarmSettings(); | 1939 | mCalendar->reInitAlarmSettings(); |
1896 | setSyncEventsReadOnly(); | 1940 | setSyncEventsReadOnly(); |
1897 | updateUnmanagedViews(); | 1941 | updateUnmanagedViews(); |
1898 | updateView(); | 1942 | updateView(); |
1899 | } | 1943 | } |
1900 | return false; | 1944 | return false; |
1901 | } | 1945 | } |
1902 | void CalendarView::showOpenError() | 1946 | void CalendarView::showOpenError() |
1903 | { | 1947 | { |
1904 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1948 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1905 | } | 1949 | } |
1906 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1950 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1907 | { | 1951 | { |
1908 | loadedFileVersion = dt; | 1952 | loadedFileVersion = dt; |
1909 | } | 1953 | } |
1910 | bool CalendarView::checkFileChanged(QString fn) | 1954 | bool CalendarView::checkFileChanged(QString fn) |
1911 | { | 1955 | { |
1912 | QFileInfo finf ( fn ); | 1956 | QFileInfo finf ( fn ); |
1913 | if ( !finf.exists() ) | 1957 | if ( !finf.exists() ) |
1914 | return true; | 1958 | return true; |
1915 | QDateTime dt = finf.lastModified (); | 1959 | QDateTime dt = finf.lastModified (); |
1916 | if ( dt <= loadedFileVersion ) | 1960 | if ( dt <= loadedFileVersion ) |
1917 | return false; | 1961 | return false; |
1918 | return true; | 1962 | return true; |
1919 | 1963 | ||
1920 | } | 1964 | } |
1921 | void CalendarView::watchSavedFile() | 1965 | void CalendarView::watchSavedFile() |
1922 | { | 1966 | { |
1923 | QFileInfo finf ( MainWindow::defaultFileName()); | 1967 | QFileInfo finf ( MainWindow::defaultFileName()); |
1924 | if ( !finf.exists() ) | 1968 | if ( !finf.exists() ) |
1925 | return; | 1969 | return; |
1926 | QDateTime dt = finf.lastModified (); | 1970 | QDateTime dt = finf.lastModified (); |
1927 | if ( dt < loadedFileVersion ) { | 1971 | if ( dt < loadedFileVersion ) { |
1928 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1972 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1929 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1973 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1930 | return; | 1974 | return; |
1931 | } | 1975 | } |
1932 | loadedFileVersion = dt; | 1976 | loadedFileVersion = dt; |
1933 | } | 1977 | } |
1934 | 1978 | ||
1935 | bool CalendarView::checkFileVersion(QString fn) | 1979 | bool CalendarView::checkFileVersion(QString fn) |
1936 | { | 1980 | { |
1937 | QFileInfo finf ( fn ); | 1981 | QFileInfo finf ( fn ); |
1938 | if ( !finf.exists() ) | 1982 | if ( !finf.exists() ) |
1939 | return true; | 1983 | return true; |
1940 | QDateTime dt = finf.lastModified (); | 1984 | QDateTime dt = finf.lastModified (); |
1941 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1985 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1942 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1986 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1943 | if ( dt <= loadedFileVersion ) | 1987 | if ( dt <= loadedFileVersion ) |
1944 | return true; | 1988 | return true; |
1945 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1989 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1946 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1990 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1947 | i18n("Sync+save")); | 1991 | i18n("Sync+save")); |
1948 | 1992 | ||
1949 | if ( km == KMessageBox::Cancel ) | 1993 | if ( km == KMessageBox::Cancel ) |
1950 | return false; | 1994 | return false; |
1951 | if ( km == KMessageBox::Yes ) | 1995 | if ( km == KMessageBox::Yes ) |
1952 | return true; | 1996 | return true; |
1953 | 1997 | ||
1954 | setSyncDevice("deleteaftersync" ); | 1998 | setSyncDevice("deleteaftersync" ); |
1955 | mSyncManager->mAskForPreferences = true; | 1999 | mSyncManager->mAskForPreferences = true; |
1956 | mSyncManager->mSyncAlgoPrefs = 3; | 2000 | mSyncManager->mSyncAlgoPrefs = 3; |
1957 | mSyncManager->mWriteBackFile = false; | 2001 | mSyncManager->mWriteBackFile = false; |
1958 | mSyncManager->mWriteBackExistingOnly = false; | 2002 | mSyncManager->mWriteBackExistingOnly = false; |
1959 | mSyncManager->mShowSyncSummary = false; | 2003 | mSyncManager->mShowSyncSummary = false; |
1960 | syncCalendar( fn, 3 ); | 2004 | syncCalendar( fn, 3 ); |
1961 | Event * e = getLastSyncEvent(); | 2005 | Event * e = getLastSyncEvent(); |
1962 | if ( e ) | 2006 | if ( e ) |
1963 | deleteEvent ( e ); | 2007 | deleteEvent ( e ); |
1964 | updateView(); | 2008 | updateView(); |
1965 | return true; | 2009 | return true; |
1966 | } | 2010 | } |
1967 | 2011 | bool CalendarView::saveCalendars() | |
2012 | { | ||
2013 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
2014 | KopiCalendarFile * cal = calendars.first(); | ||
2015 | mCalendar->setDefaultCalendar( 1 ); | ||
2016 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
2017 | saveCalendar( MainWindow::defaultFileName() ); | ||
2018 | cal = calendars.next(); | ||
2019 | while ( cal ) { | ||
2020 | if ( !cal->isReadOnly ) { | ||
2021 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | ||
2022 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
2023 | saveCalendar( cal->mFileName ); | ||
2024 | } | ||
2025 | cal = calendars.next(); | ||
2026 | } | ||
2027 | restoreCalendarSettings(); | ||
2028 | } | ||
1968 | bool CalendarView::saveCalendar( QString filename ) | 2029 | bool CalendarView::saveCalendar( QString filename ) |
1969 | { | 2030 | { |
1970 | 2031 | ||
1971 | // Store back all unsaved data into calendar object | 2032 | // Store back all unsaved data into calendar object |
1972 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 2033 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1973 | if ( mViewManager->currentView() ) | 2034 | if ( mViewManager->currentView() ) |
1974 | mViewManager->currentView()->flushView(); | 2035 | mViewManager->currentView()->flushView(); |
1975 | 2036 | ||
1976 | 2037 | ||
1977 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 2038 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1978 | mStorage->setSaveFormat( new ICalFormat() ); | 2039 | mStorage->setSaveFormat( new ICalFormat() ); |
1979 | mStorage->setFileName( filename ); | 2040 | mStorage->setFileName( filename ); |
1980 | bool success; | 2041 | bool success; |
1981 | success = mStorage->save(); | 2042 | success = mStorage->save(); |
1982 | if ( !success ) { | 2043 | if ( !success ) { |
1983 | return false; | 2044 | return false; |
1984 | } | 2045 | } |
1985 | if ( filename == MainWindow::defaultFileName() ) { | 2046 | if ( filename == MainWindow::defaultFileName() ) { |
1986 | setLoadedFileVersion( lfv ); | 2047 | setLoadedFileVersion( lfv ); |
1987 | watchSavedFile(); | 2048 | watchSavedFile(); |
1988 | } | 2049 | } |
1989 | return true; | 2050 | return true; |
1990 | } | 2051 | } |
1991 | 2052 | ||
1992 | void CalendarView::closeCalendar() | 2053 | void CalendarView::closeCalendar() |
1993 | { | 2054 | { |
1994 | 2055 | ||
1995 | // child windows no longer valid | 2056 | // child windows no longer valid |
1996 | clearAllViews(); | 2057 | clearAllViews(); |
1997 | emit closingDown(); | 2058 | emit closingDown(); |
1998 | 2059 | ||
1999 | mCalendar->close(); | 2060 | mCalendar->close(); |
2000 | setModified(false); | 2061 | setModified(false); |
2001 | updateView(); | 2062 | updateView(); |
2002 | } | 2063 | } |
2003 | 2064 | ||
2004 | void CalendarView::archiveCalendar() | 2065 | void CalendarView::archiveCalendar() |
2005 | { | 2066 | { |
2006 | mDialogManager->showArchiveDialog(); | 2067 | mDialogManager->showArchiveDialog(); |
2007 | } | 2068 | } |
2008 | 2069 | ||
2009 | 2070 | ||
2010 | void CalendarView::readSettings() | 2071 | void CalendarView::readSettings() |
2011 | { | 2072 | { |
2012 | 2073 | ||
2013 | 2074 | ||
2014 | // mViewManager->showAgendaView(); | 2075 | // mViewManager->showAgendaView(); |
2015 | QString str; | 2076 | QString str; |
2016 | //qDebug("CalendarView::readSettings() "); | 2077 | //qDebug("CalendarView::readSettings() "); |
2017 | // read settings from the KConfig, supplying reasonable | 2078 | // read settings from the KConfig, supplying reasonable |
2018 | // defaults where none are to be found | 2079 | // defaults where none are to be found |
2019 | KConfig *config = KOGlobals::config(); | 2080 | KConfig *config = KOGlobals::config(); |
2020 | #ifndef KORG_NOSPLITTER | 2081 | #ifndef KORG_NOSPLITTER |
2021 | config->setGroup("KOrganizer Geometry"); | 2082 | config->setGroup("KOrganizer Geometry"); |
2022 | 2083 | ||
2023 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2084 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2024 | if (sizes.count() != 2) { | 2085 | if (sizes.count() != 2) { |
2025 | sizes << mDateNavigator->minimumSizeHint().width(); | 2086 | sizes << mDateNavigator->minimumSizeHint().width(); |
2026 | sizes << 300; | 2087 | sizes << 300; |
2027 | } | 2088 | } |
2028 | mPanner->setSizes(sizes); | 2089 | mPanner->setSizes(sizes); |
2029 | 2090 | ||
2030 | sizes = config->readIntListEntry("Separator2"); | 2091 | sizes = config->readIntListEntry("Separator2"); |
2031 | if ( ( mResourceView && sizes.count() == 4 ) || | 2092 | if ( ( mResourceView && sizes.count() == 4 ) || |
2032 | ( !mResourceView && sizes.count() == 3 ) ) { | 2093 | ( !mResourceView && sizes.count() == 3 ) ) { |
2033 | mLeftSplitter->setSizes(sizes); | 2094 | mLeftSplitter->setSizes(sizes); |
2034 | } | 2095 | } |
2035 | #endif | 2096 | #endif |
2036 | globalFlagBlockAgenda = 1; | 2097 | globalFlagBlockAgenda = 1; |
2037 | mViewManager->showAgendaView(); | 2098 | mViewManager->showAgendaView(); |
2038 | //mViewManager->readSettings( config ); | 2099 | //mViewManager->readSettings( config ); |
2039 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2100 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2040 | readFilterSettings(config); | 2101 | readFilterSettings(config); |
2041 | 2102 | ||
2042 | #ifdef DESKTOP_VERSION | 2103 | #ifdef DESKTOP_VERSION |
2043 | config->setGroup("WidgetLayout"); | 2104 | config->setGroup("WidgetLayout"); |
2044 | QStringList list; | 2105 | QStringList list; |
2045 | list = config->readListEntry("MainLayout"); | 2106 | list = config->readListEntry("MainLayout"); |
2046 | int x,y,w,h; | 2107 | int x,y,w,h; |
2047 | if ( ! list.isEmpty() ) { | 2108 | if ( ! list.isEmpty() ) { |
2048 | x = list[0].toInt(); | 2109 | x = list[0].toInt(); |
2049 | y = list[1].toInt(); | 2110 | y = list[1].toInt(); |
2050 | w = list[2].toInt(); | 2111 | w = list[2].toInt(); |
2051 | h = list[3].toInt(); | 2112 | h = list[3].toInt(); |
2052 | KApplication::testCoords( &x,&y,&w,&h ); | 2113 | KApplication::testCoords( &x,&y,&w,&h ); |
2053 | topLevelWidget()->setGeometry(x,y,w,h); | 2114 | topLevelWidget()->setGeometry(x,y,w,h); |
2054 | 2115 | ||
2055 | } else { | 2116 | } else { |
2056 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2117 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2057 | } | 2118 | } |
2058 | list = config->readListEntry("EditEventLayout"); | 2119 | list = config->readListEntry("EditEventLayout"); |
2059 | if ( ! list.isEmpty() ) { | 2120 | if ( ! list.isEmpty() ) { |
2060 | x = list[0].toInt(); | 2121 | x = list[0].toInt(); |
2061 | y = list[1].toInt(); | 2122 | y = list[1].toInt(); |
2062 | w = list[2].toInt(); | 2123 | w = list[2].toInt(); |
2063 | h = list[3].toInt(); | 2124 | h = list[3].toInt(); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index cdce072..0144ba4 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,320 +1,325 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 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 CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <KDGanttMinimizeSplitter.h> | 42 | #include <KDGanttMinimizeSplitter.h> |
43 | 43 | ||
44 | #include <korganizer/calendarviewbase.h> | 44 | #include <korganizer/calendarviewbase.h> |
45 | 45 | ||
46 | #include <ksyncmanager.h> | 46 | #include <ksyncmanager.h> |
47 | //#include <koprefs.h> | ||
47 | 48 | ||
48 | class QWidgetStack; | 49 | class QWidgetStack; |
49 | class QSplitter; | 50 | class QSplitter; |
50 | 51 | class KopiCalendarFile; | |
51 | class CalPrinter; | 52 | class CalPrinter; |
52 | class KOFilterView; | 53 | class KOFilterView; |
53 | class KOCalEditView; | 54 | class KOCalEditView; |
54 | class KOViewManager; | 55 | class KOViewManager; |
55 | class KODialogManager; | 56 | class KODialogManager; |
56 | class KOTodoView; | 57 | class KOTodoView; |
57 | class KDateNavigator; | 58 | class KDateNavigator; |
58 | class DateNavigatorContainer; | 59 | class DateNavigatorContainer; |
59 | class DateNavigator; | 60 | class DateNavigator; |
60 | class KOIncidenceEditor; | 61 | class KOIncidenceEditor; |
61 | class KDatePicker; | 62 | class KDatePicker; |
62 | class ResourceView; | 63 | class ResourceView; |
63 | class KOEventEditor; | 64 | class KOEventEditor; |
64 | class KOTodoEditor ; | 65 | class KOTodoEditor ; |
65 | class KOEventViewerDialog; | 66 | class KOEventViewerDialog; |
66 | class KOBeamPrefs; | 67 | class KOBeamPrefs; |
67 | class KSyncProfile; | 68 | class KSyncProfile; |
68 | class AlarmDialog; | 69 | class AlarmDialog; |
69 | class KCal::Attendee; | 70 | class KCal::Attendee; |
70 | 71 | ||
71 | namespace KCal { class FileStorage; } | 72 | namespace KCal { class FileStorage; } |
72 | 73 | ||
73 | using namespace KCal; | 74 | using namespace KCal; |
74 | 75 | ||
75 | /** | 76 | /** |
76 | This is the main calendar widget. It provides the different vies on t he | 77 | This is the main calendar widget. It provides the different vies on t he |
77 | calendar data as well as the date navigator. It also handles synchronisation | 78 | calendar data as well as the date navigator. It also handles synchronisation |
78 | of the different views and controls the different dialogs like preferences, | 79 | of the different views and controls the different dialogs like preferences, |
79 | event editor, search dialog etc. | 80 | event editor, search dialog etc. |
80 | 81 | ||
81 | @short main calendar view widget | 82 | @short main calendar view widget |
82 | @author Cornelius Schumacher | 83 | @author Cornelius Schumacher |
83 | */ | 84 | */ |
84 | 85 | ||
85 | #include <qtextbrowser.h> | 86 | #include <qtextbrowser.h> |
86 | #include <qtextcodec.h> | 87 | #include <qtextcodec.h> |
87 | 88 | ||
88 | class MissedAlarmTextBrowser : public QTextBrowser { | 89 | class MissedAlarmTextBrowser : public QTextBrowser { |
89 | Q_OBJECT | 90 | Q_OBJECT |
90 | public: | 91 | public: |
91 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); | 92 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); |
92 | ~MissedAlarmTextBrowser(); | 93 | ~MissedAlarmTextBrowser(); |
93 | void setSource(const QString & n); | 94 | void setSource(const QString & n); |
94 | 95 | ||
95 | private: | 96 | private: |
96 | Incidence * getNextInc(QDateTime start ); | 97 | Incidence * getNextInc(QDateTime start ); |
97 | QPtrList<Incidence> mAlarms; | 98 | QPtrList<Incidence> mAlarms; |
98 | signals: | 99 | signals: |
99 | void showIncidence( QString uid); | 100 | void showIncidence( QString uid); |
100 | }; | 101 | }; |
101 | 102 | ||
102 | 103 | ||
103 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 104 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
104 | { | 105 | { |
105 | Q_OBJECT | 106 | Q_OBJECT |
106 | public: | 107 | public: |
107 | /** | 108 | /** |
108 | Constructs a new calendar view widget. | 109 | Constructs a new calendar view widget. |
109 | 110 | ||
110 | @param calendar calendar document | 111 | @param calendar calendar document |
111 | @param parent parent window | 112 | @param parent parent window |
112 | @param name Qt internal widget object name | 113 | @param name Qt internal widget object name |
113 | */ | 114 | */ |
114 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 115 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
115 | const char *name = 0 ); | 116 | const char *name = 0 ); |
116 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 117 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
117 | const char *name = 0 ); | 118 | const char *name = 0 ); |
118 | virtual ~CalendarView(); | 119 | virtual ~CalendarView(); |
119 | 120 | ||
120 | Calendar *calendar() { return mCalendar; } | 121 | Calendar *calendar() { return mCalendar; } |
121 | 122 | ||
122 | KOViewManager *viewManager(); | 123 | KOViewManager *viewManager(); |
123 | KODialogManager *dialogManager(); | 124 | KODialogManager *dialogManager(); |
124 | 125 | ||
125 | QDate startDate(); | 126 | QDate startDate(); |
126 | QDate endDate(); | 127 | QDate endDate(); |
127 | 128 | ||
128 | QWidgetStack *viewStack(); | 129 | QWidgetStack *viewStack(); |
129 | QWidget *leftFrame(); | 130 | QWidget *leftFrame(); |
130 | 131 | ||
131 | DateNavigator *dateNavigator(); | 132 | DateNavigator *dateNavigator(); |
132 | KDateNavigator *dateNavigatorWidget(); | 133 | KDateNavigator *dateNavigatorWidget(); |
133 | 134 | ||
134 | void addView(KOrg::BaseView *); | 135 | void addView(KOrg::BaseView *); |
135 | void showView(KOrg::BaseView *); | 136 | void showView(KOrg::BaseView *); |
136 | KOEventViewerDialog* getEventViewerDialog(); | 137 | KOEventViewerDialog* getEventViewerDialog(); |
137 | Incidence *currentSelection(); | 138 | Incidence *currentSelection(); |
138 | 139 | ||
139 | signals: | 140 | signals: |
140 | void save (); | 141 | void save (); |
141 | void saveStopTimer (); | 142 | void saveStopTimer (); |
142 | void tempDisableBR(bool); | 143 | void tempDisableBR(bool); |
143 | /** This todo has been modified */ | 144 | /** This todo has been modified */ |
144 | void todoModified(Todo *, int); | 145 | void todoModified(Todo *, int); |
145 | 146 | ||
146 | /** when change is made to options dialog, the topwidget will catch this | 147 | /** when change is made to options dialog, the topwidget will catch this |
147 | * and emit this signal which notifies all widgets which have registered | 148 | * and emit this signal which notifies all widgets which have registered |
148 | * for notification to update their settings. */ | 149 | * for notification to update their settings. */ |
149 | void configChanged(); | 150 | void configChanged(); |
150 | /** emitted when the topwidget is closing down, so that any attached | 151 | /** emitted when the topwidget is closing down, so that any attached |
151 | child windows can also close. */ | 152 | child windows can also close. */ |
152 | void closingDown(); | 153 | void closingDown(); |
153 | /** emitted right before we die */ | 154 | /** emitted right before we die */ |
154 | void closed(QWidget *); | 155 | void closed(QWidget *); |
155 | 156 | ||
156 | /** Emitted when state of modified flag changes */ | 157 | /** Emitted when state of modified flag changes */ |
157 | void modifiedChanged(bool); | 158 | void modifiedChanged(bool); |
158 | void signalmodified(); | 159 | void signalmodified(); |
159 | 160 | ||
160 | /** Emitted when state of read-only flag changes */ | 161 | /** Emitted when state of read-only flag changes */ |
161 | void readOnlyChanged(bool); | 162 | void readOnlyChanged(bool); |
162 | 163 | ||
163 | /** Emitted when the unit of navigation changes */ | 164 | /** Emitted when the unit of navigation changes */ |
164 | void changeNavStringPrev(const QString &); | 165 | void changeNavStringPrev(const QString &); |
165 | void changeNavStringNext(const QString &); | 166 | void changeNavStringNext(const QString &); |
166 | 167 | ||
167 | /** Emitted when state of events selection has changed and user is organizer*/ | 168 | /** Emitted when state of events selection has changed and user is organizer*/ |
168 | void organizerEventsSelected(bool); | 169 | void organizerEventsSelected(bool); |
169 | /** Emitted when state of events selection has changed and user is attendee*/ | 170 | /** Emitted when state of events selection has changed and user is attendee*/ |
170 | void groupEventsSelected(bool); | 171 | void groupEventsSelected(bool); |
171 | /** | 172 | /** |
172 | Emitted when an incidence gets selected. If the selection is cleared the | 173 | Emitted when an incidence gets selected. If the selection is cleared the |
173 | signal is emitted with 0 as argument. | 174 | signal is emitted with 0 as argument. |
174 | */ | 175 | */ |
175 | void incidenceSelected( Incidence * ); | 176 | void incidenceSelected( Incidence * ); |
176 | /** Emitted, when a todoitem is selected or deselected. */ | 177 | /** Emitted, when a todoitem is selected or deselected. */ |
177 | void todoSelected( bool ); | 178 | void todoSelected( bool ); |
178 | 179 | ||
179 | /** | 180 | /** |
180 | Emitted, when clipboard content changes. Parameter indicates if paste | 181 | Emitted, when clipboard content changes. Parameter indicates if paste |
181 | is possible or not. | 182 | is possible or not. |
182 | */ | 183 | */ |
183 | void pasteEnabled(bool); | 184 | void pasteEnabled(bool); |
184 | 185 | ||
185 | /** Emitted, when the number of incoming messages has changed. */ | 186 | /** Emitted, when the number of incoming messages has changed. */ |
186 | void numIncomingChanged(int); | 187 | void numIncomingChanged(int); |
187 | 188 | ||
188 | /** Emitted, when the number of outgoing messages has changed. */ | 189 | /** Emitted, when the number of outgoing messages has changed. */ |
189 | void numOutgoingChanged(int); | 190 | void numOutgoingChanged(int); |
190 | 191 | ||
191 | /** Send status message, which can e.g. be displayed in the status bar. */ | 192 | /** Send status message, which can e.g. be displayed in the status bar. */ |
192 | void statusMessage(const QString &); | 193 | void statusMessage(const QString &); |
193 | 194 | ||
194 | void calendarViewExpanded( bool ); | 195 | void calendarViewExpanded( bool ); |
195 | void updateSearchDialog(); | 196 | void updateSearchDialog(); |
196 | 197 | ||
197 | 198 | ||
198 | public slots: | 199 | public slots: |
199 | void checkAlarms(); | 200 | void checkAlarms(); |
200 | void slotprintSelInc(); | 201 | void slotprintSelInc(); |
201 | void showNextAlarms(); | 202 | void showNextAlarms(); |
202 | void showOpenError(); | 203 | void showOpenError(); |
203 | void watchSavedFile(); | 204 | void watchSavedFile(); |
204 | void recheckTimerAlarm(); | 205 | void recheckTimerAlarm(); |
205 | void checkNextTimerAlarm(); | 206 | void checkNextTimerAlarm(); |
206 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 207 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
207 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 208 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
208 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 209 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
209 | 210 | ||
210 | /** options dialog made a changed to the configuration. we catch this | 211 | /** options dialog made a changed to the configuration. we catch this |
211 | * and notify all widgets which need to update their configuration. */ | 212 | * and notify all widgets which need to update their configuration. */ |
212 | void updateConfig(); | 213 | void updateConfig(); |
213 | 214 | ||
214 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 215 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
215 | const QStringList& anniversaryList, const QStringList& realNameList, | 216 | const QStringList& anniversaryList, const QStringList& realNameList, |
216 | const QStringList& emailList, const QStringList& assembledNameList, | 217 | const QStringList& emailList, const QStringList& assembledNameList, |
217 | const QStringList& uidList); | 218 | const QStringList& uidList); |
218 | 219 | ||
219 | /** | 220 | /** |
220 | Load calendar from file \a filename. If \a merge is true, load | 221 | Load calendar from file \a filename. If \a merge is true, load |
221 | calendar into existing one, if it is false, clear calendar, before | 222 | calendar into existing one, if it is false, clear calendar, before |
222 | loading. Return true, if calendar could be successfully loaded. | 223 | loading. Return true, if calendar could be successfully loaded. |
223 | */ | 224 | */ |
224 | bool openCalendar(QString filename, bool merge=false); | 225 | bool openCalendar(QString filename, bool merge=false); |
226 | bool loadCalendars(); | ||
227 | bool saveCalendars(); | ||
228 | bool restoreCalendarSettings(); | ||
229 | bool addCalendar( KopiCalendarFile * ); | ||
225 | bool syncCalendar(QString filename,int mode = 0 ); | 230 | bool syncCalendar(QString filename,int mode = 0 ); |
226 | 231 | ||
227 | /** | 232 | /** |
228 | Save calendar data to file. Return true if calendar could be | 233 | Save calendar data to file. Return true if calendar could be |
229 | successfully saved. | 234 | successfully saved. |
230 | */ | 235 | */ |
231 | bool saveCalendar(QString filename); | 236 | bool saveCalendar(QString filename); |
232 | 237 | ||
233 | /** | 238 | /** |
234 | Close calendar. Clear calendar data and reset views to display an empty | 239 | Close calendar. Clear calendar data and reset views to display an empty |
235 | calendar. | 240 | calendar. |
236 | */ | 241 | */ |
237 | void closeCalendar(); | 242 | void closeCalendar(); |
238 | 243 | ||
239 | /** Archive old events of calendar */ | 244 | /** Archive old events of calendar */ |
240 | void archiveCalendar(); | 245 | void archiveCalendar(); |
241 | 246 | ||
242 | void showIncidence(); | 247 | void showIncidence(); |
243 | void editIncidence(); | 248 | void editIncidence(); |
244 | void editIncidenceDescription(); | 249 | void editIncidenceDescription(); |
245 | void deleteIncidence(); | 250 | void deleteIncidence(); |
246 | void cloneIncidence(); | 251 | void cloneIncidence(); |
247 | void moveIncidence(); | 252 | void moveIncidence(); |
248 | void beamIncidence(); | 253 | void beamIncidence(); |
249 | void toggleCancelIncidence(); | 254 | void toggleCancelIncidence(); |
250 | 255 | ||
251 | /** create an editeventwin with supplied date/time, and if bool is true, | 256 | /** create an editeventwin with supplied date/time, and if bool is true, |
252 | * make the event take all day. */ | 257 | * make the event take all day. */ |
253 | void newEvent(QDateTime, QDateTime, bool allDay ); | 258 | void newEvent(QDateTime, QDateTime, bool allDay ); |
254 | void newEvent(QDateTime, QDateTime); | 259 | void newEvent(QDateTime, QDateTime); |
255 | void newEvent(QDateTime fh); | 260 | void newEvent(QDateTime fh); |
256 | void newEvent(QDate dt); | 261 | void newEvent(QDate dt); |
257 | /** create new event without having a date hint. Takes current date as | 262 | /** create new event without having a date hint. Takes current date as |
258 | default hint. */ | 263 | default hint. */ |
259 | void newEvent(); | 264 | void newEvent(); |
260 | void newFloatingEvent(); | 265 | void newFloatingEvent(); |
261 | 266 | ||
262 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 267 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
263 | void showIncidence(Incidence *); | 268 | void showIncidence(Incidence *); |
264 | void showIncidence(QString uid); | 269 | void showIncidence(QString uid); |
265 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 270 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
266 | void editIncidence(Incidence *); | 271 | void editIncidence(Incidence *); |
267 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 272 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
268 | void deleteIncidence(Incidence *); | 273 | void deleteIncidence(Incidence *); |
269 | void cloneIncidence(Incidence *); | 274 | void cloneIncidence(Incidence *); |
270 | void cancelIncidence(Incidence *); | 275 | void cancelIncidence(Incidence *); |
271 | /** Create an editor for the supplied event. */ | 276 | /** Create an editor for the supplied event. */ |
272 | void editEvent(Event *); | 277 | void editEvent(Event *); |
273 | /** Delete the supplied event. */ | 278 | /** Delete the supplied event. */ |
274 | void deleteEvent(Event *); | 279 | void deleteEvent(Event *); |
275 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 280 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
276 | found. */ | 281 | found. */ |
277 | bool deleteEvent(const QString &uid); | 282 | bool deleteEvent(const QString &uid); |
278 | /** Create a read-only viewer dialog for the supplied event. */ | 283 | /** Create a read-only viewer dialog for the supplied event. */ |
279 | void showEvent(Event *); | 284 | void showEvent(Event *); |
280 | 285 | ||
281 | void editJournal(Journal *); | 286 | void editJournal(Journal *); |
282 | void showJournal(Journal *); | 287 | void showJournal(Journal *); |
283 | void deleteJournal(Journal *); | 288 | void deleteJournal(Journal *); |
284 | /** Create an editor dialog for a todo */ | 289 | /** Create an editor dialog for a todo */ |
285 | void editTodo(Todo *); | 290 | void editTodo(Todo *); |
286 | /** Create a read-only viewer dialog for the supplied todo */ | 291 | /** Create a read-only viewer dialog for the supplied todo */ |
287 | void showTodo(Todo *); | 292 | void showTodo(Todo *); |
288 | /** create new todo */ | 293 | /** create new todo */ |
289 | void newTodo(); | 294 | void newTodo(); |
290 | void newTodoDateTime(QDateTime, bool allday); | 295 | void newTodoDateTime(QDateTime, bool allday); |
291 | /** create new todo with a parent todo */ | 296 | /** create new todo with a parent todo */ |
292 | void newSubTodo(); | 297 | void newSubTodo(); |
293 | /** create new todo with a parent todo */ | 298 | /** create new todo with a parent todo */ |
294 | void newSubTodo(Todo *); | 299 | void newSubTodo(Todo *); |
295 | /** Delete todo */ | 300 | /** Delete todo */ |
296 | void deleteTodo(Todo *); | 301 | void deleteTodo(Todo *); |
297 | 302 | ||
298 | 303 | ||
299 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 304 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
300 | * emitted as result. */ | 305 | * emitted as result. */ |
301 | void checkClipboard(); | 306 | void checkClipboard(); |
302 | 307 | ||
303 | /** using the KConfig associated with the kapp variable, read in the | 308 | /** using the KConfig associated with the kapp variable, read in the |
304 | * settings from the config file. | 309 | * settings from the config file. |
305 | */ | 310 | */ |
306 | void readSettings(); | 311 | void readSettings(); |
307 | 312 | ||
308 | /** write current state to config file. */ | 313 | /** write current state to config file. */ |
309 | void writeSettings(); | 314 | void writeSettings(); |
310 | 315 | ||
311 | /** read settings for calendar filters */ | 316 | /** read settings for calendar filters */ |
312 | void readFilterSettings(KConfig *config); | 317 | void readFilterSettings(KConfig *config); |
313 | 318 | ||
314 | /** write settings for calendar filters */ | 319 | /** write settings for calendar filters */ |
315 | void writeFilterSettings(KConfig *config); | 320 | void writeFilterSettings(KConfig *config); |
316 | 321 | ||
317 | /** passes on the message that an event has changed to the currently | 322 | /** passes on the message that an event has changed to the currently |
318 | * activated view so that it can make appropriate display changes. */ | 323 | * activated view so that it can make appropriate display changes. */ |
319 | void changeEventDisplay(Event *, int); | 324 | void changeEventDisplay(Event *, int); |
320 | void changeIncidenceDisplay(Incidence *, int); | 325 | void changeIncidenceDisplay(Incidence *, int); |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 2dd4567..29a4393 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,165 +1,165 @@ | |||
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 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | 30 | ||
31 | 31 | ||
32 | #include <libkcal/calfilter.h> | 32 | #include <libkcal/calfilter.h> |
33 | 33 | ||
34 | #include "kofilterview.h" | 34 | #include "kofilterview.h" |
35 | #include "koprefs.h" | 35 | #include "koprefs.h" |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kcolorbutton.h> | 38 | #include <kcolorbutton.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | 40 | ||
41 | 41 | ||
42 | #include <kurlrequester.h> | 42 | #include <kurlrequester.h> |
43 | #include <klineedit.h> | 43 | #include <klineedit.h> |
44 | 44 | ||
45 | class KONewCalPrefs : public QDialog | 45 | class KONewCalPrefs : public QDialog |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : | 48 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : |
49 | QDialog( parent, name, true ) | 49 | QDialog( parent, name, true ) |
50 | { | 50 | { |
51 | setCaption( i18n("Add new Calendar") ); | 51 | setCaption( i18n("Add new Calendar") ); |
52 | QVBoxLayout* lay = new QVBoxLayout( this ); | 52 | QVBoxLayout* lay = new QVBoxLayout( this ); |
53 | lay->setSpacing( 3 ); | 53 | lay->setSpacing( 3 ); |
54 | lay->setMargin( 3 ); | 54 | lay->setMargin( 3 ); |
55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); | 55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); |
56 | lay->addWidget( lab ); | 56 | lay->addWidget( lab ); |
57 | nameE = new KLineEdit( this ); | 57 | nameE = new KLineEdit( this ); |
58 | lay->addWidget( nameE ); | 58 | lay->addWidget( nameE ); |
59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); | 59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); |
60 | lay->addWidget( lab ); | 60 | lay->addWidget( lab ); |
61 | url = new KURLRequester ( this ); | 61 | url = new KURLRequester ( this ); |
62 | lay->addWidget( url ); | 62 | lay->addWidget( url ); |
63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
64 | lay->addWidget( ok ); | 64 | lay->addWidget( ok ); |
65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
66 | lay->addWidget( cancel ); | 66 | lay->addWidget( cancel ); |
67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
69 | resize( 200, 200 ); | 69 | //resize( 200, 200 ); |
70 | } | 70 | } |
71 | 71 | ||
72 | QString calName() { return nameE->text(); } | 72 | QString calName() { return nameE->text(); } |
73 | QString calFileName() { return url->url(); } | 73 | QString calFileName() { return url->url(); } |
74 | private: | 74 | private: |
75 | KLineEdit* nameE; | 75 | KLineEdit* nameE; |
76 | KURLRequester *url; | 76 | KURLRequester *url; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
81 | const char* name,WFlags fl ) | 81 | const char* name,WFlags fl ) |
82 | : KOFilterView_base(parent,name,fl) | 82 | : KOFilterView_base(parent,name,fl) |
83 | { | 83 | { |
84 | mFilters = filterList; | 84 | mFilters = filterList; |
85 | 85 | ||
86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
89 | } | 89 | } |
90 | 90 | ||
91 | KOFilterView::~KOFilterView() | 91 | KOFilterView::~KOFilterView() |
92 | { | 92 | { |
93 | // no need to delete child widgets, Qt does it all for us | 93 | // no need to delete child widgets, Qt does it all for us |
94 | } | 94 | } |
95 | 95 | ||
96 | bool KOFilterView::filtersEnabled() | 96 | bool KOFilterView::filtersEnabled() |
97 | { | 97 | { |
98 | return mEnabledCheck->isChecked(); | 98 | return mEnabledCheck->isChecked(); |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOFilterView::setFiltersEnabled(bool set) | 101 | void KOFilterView::setFiltersEnabled(bool set) |
102 | { | 102 | { |
103 | mEnabledCheck->setChecked(set); | 103 | mEnabledCheck->setChecked(set); |
104 | emit filterChanged(); | 104 | emit filterChanged(); |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void KOFilterView::updateFilters() | 108 | void KOFilterView::updateFilters() |
109 | { | 109 | { |
110 | mSelectionCombo->clear(); | 110 | mSelectionCombo->clear(); |
111 | 111 | ||
112 | CalFilter *filter = mFilters->first(); | 112 | CalFilter *filter = mFilters->first(); |
113 | while(filter) { | 113 | while(filter) { |
114 | mSelectionCombo->insertItem(filter->name()); | 114 | mSelectionCombo->insertItem(filter->name()); |
115 | filter = mFilters->next(); | 115 | filter = mFilters->next(); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | CalFilter *KOFilterView::selectedFilter() | 119 | CalFilter *KOFilterView::selectedFilter() |
120 | { | 120 | { |
121 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); | 121 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); |
122 | return f; | 122 | return f; |
123 | } | 123 | } |
124 | 124 | ||
125 | void KOFilterView::setSelectedFilter(QString filterName) | 125 | void KOFilterView::setSelectedFilter(QString filterName) |
126 | { | 126 | { |
127 | int filter_num = mSelectionCombo->count(); | 127 | int filter_num = mSelectionCombo->count(); |
128 | int i; | 128 | int i; |
129 | for (i=0;i<filter_num;i++) { | 129 | for (i=0;i<filter_num;i++) { |
130 | if (mSelectionCombo->text(i)==filterName) | 130 | if (mSelectionCombo->text(i)==filterName) |
131 | mSelectionCombo->setCurrentItem(i); | 131 | mSelectionCombo->setCurrentItem(i); |
132 | } | 132 | } |
133 | emit filterChanged(); | 133 | emit filterChanged(); |
134 | } | 134 | } |
135 | void KOFilterView::setSelectedFilter( int fil ) | 135 | void KOFilterView::setSelectedFilter( int fil ) |
136 | { | 136 | { |
137 | if ( fil >= mSelectionCombo->count() ) | 137 | if ( fil >= mSelectionCombo->count() ) |
138 | return; | 138 | return; |
139 | mSelectionCombo->setCurrentItem( fil ); | 139 | mSelectionCombo->setCurrentItem( fil ); |
140 | emit filterChanged(); | 140 | emit filterChanged(); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | KOCalEditView::KOCalEditView(QWidget* parent, | 145 | KOCalEditView::KOCalEditView(QWidget* parent, |
146 | const char* name ) | 146 | const char* name ) |
147 | : QWidget(parent,name) | 147 | : QWidget(parent,name) |
148 | { | 148 | { |
149 | mw = 0; | 149 | mw = 0; |
150 | ml = new QVBoxLayout ( this ); | 150 | ml = new QVBoxLayout ( this ); |
151 | } | 151 | } |
152 | 152 | ||
153 | KOCalEditView::~KOCalEditView() | 153 | KOCalEditView::~KOCalEditView() |
154 | { | 154 | { |
155 | // no need to delete child widgets, Qt does it all for us | 155 | // no need to delete child widgets, Qt does it all for us |
156 | } | 156 | } |
157 | void KOCalEditView::selectCal(int id ,bool b) | 157 | void KOCalEditView::selectCal(int id ,bool b) |
158 | { | 158 | { |
159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; | 159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; |
160 | emit calendarEnabled ( id, b ); | 160 | emit calendarEnabled ( id, b ); |
161 | 161 | ||
162 | } | 162 | } |
163 | void KOCalEditView::selectStdCal( int id, bool b ) | 163 | void KOCalEditView::selectStdCal( int id, bool b ) |
164 | { | 164 | { |
165 | 165 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 95e1607..f05ada5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -215,193 +215,193 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
215 | navigatorToolBar = iconToolBar ; | 215 | navigatorToolBar = iconToolBar ; |
216 | } else { | 216 | } else { |
217 | #ifndef DESKTOP_VERSION | 217 | #ifndef DESKTOP_VERSION |
218 | setToolBarsMovable( false ); | 218 | setToolBarsMovable( false ); |
219 | #endif | 219 | #endif |
220 | if ( p->mToolBarHorV ) { | 220 | if ( p->mToolBarHorV ) { |
221 | if ( p->mToolBarUpV ) | 221 | if ( p->mToolBarUpV ) |
222 | tbd = Bottom; | 222 | tbd = Bottom; |
223 | else | 223 | else |
224 | tbd = Top; | 224 | tbd = Top; |
225 | } | 225 | } |
226 | else { | 226 | else { |
227 | if ( p->mToolBarUpV ) | 227 | if ( p->mToolBarUpV ) |
228 | tbd = Right; | 228 | tbd = Right; |
229 | else | 229 | else |
230 | tbd = Left; | 230 | tbd = Left; |
231 | } | 231 | } |
232 | viewToolBar = new QPEToolBar( this ); | 232 | viewToolBar = new QPEToolBar( this ); |
233 | addToolBar (viewToolBar , tbd ); | 233 | addToolBar (viewToolBar , tbd ); |
234 | if ( p->mToolBarHorN ) { | 234 | if ( p->mToolBarHorN ) { |
235 | if ( p->mToolBarUpN ) | 235 | if ( p->mToolBarUpN ) |
236 | tbd = Bottom; | 236 | tbd = Bottom; |
237 | else | 237 | else |
238 | tbd = Top; | 238 | tbd = Top; |
239 | } | 239 | } |
240 | else { | 240 | else { |
241 | if ( p->mToolBarUpN ) | 241 | if ( p->mToolBarUpN ) |
242 | tbd = Right; | 242 | tbd = Right; |
243 | else | 243 | else |
244 | tbd = Left; | 244 | tbd = Left; |
245 | } | 245 | } |
246 | navigatorToolBar = new QPEToolBar( this ); | 246 | navigatorToolBar = new QPEToolBar( this ); |
247 | addToolBar (navigatorToolBar , tbd ); | 247 | addToolBar (navigatorToolBar , tbd ); |
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | 251 | ||
252 | mCalendarModifiedFlag = false; | 252 | mCalendarModifiedFlag = false; |
253 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 253 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
254 | splash->setAlignment ( AlignCenter ); | 254 | splash->setAlignment ( AlignCenter ); |
255 | setCentralWidget( splash ); | 255 | setCentralWidget( splash ); |
256 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
257 | showMaximized(); | 257 | showMaximized(); |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 260 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
261 | setDefaultPreferences(); | 261 | setDefaultPreferences(); |
262 | mCalendar = new CalendarLocal(); | 262 | mCalendar = new CalendarLocal(); |
263 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 263 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
264 | mView->hide(); | 264 | mView->hide(); |
265 | //mView->resize(splash->size() ); | 265 | //mView->resize(splash->size() ); |
266 | initActions(); | 266 | initActions(); |
267 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 267 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
268 | mSyncManager->setBlockSave(false); | 268 | mSyncManager->setBlockSave(false); |
269 | mView->setSyncManager(mSyncManager); | 269 | mView->setSyncManager(mSyncManager); |
270 | #ifndef DESKTOP_VERSION | 270 | #ifndef DESKTOP_VERSION |
271 | iconToolBar->show(); | 271 | iconToolBar->show(); |
272 | qApp->processEvents(); | 272 | qApp->processEvents(); |
273 | #endif | 273 | #endif |
274 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 274 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
275 | int vh = height() ; | 275 | int vh = height() ; |
276 | int vw = width(); | 276 | int vw = width(); |
277 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 277 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
278 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 278 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
279 | vh -= iconToolBar->height(); | 279 | vh -= iconToolBar->height(); |
280 | } else { | 280 | } else { |
281 | vw -= iconToolBar->height(); | 281 | vw -= iconToolBar->height(); |
282 | } | 282 | } |
283 | //mView->setMaximumSize( splash->size() ); | 283 | //mView->setMaximumSize( splash->size() ); |
284 | //mView->resize( splash->size() ); | 284 | //mView->resize( splash->size() ); |
285 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 285 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
286 | mView->readSettings(); | 286 | mView->readSettings(); |
287 | bool newFile = false; | 287 | bool newFile = false; |
288 | if( !QFile::exists( defaultFileName() ) ) { | 288 | if( !QFile::exists( defaultFileName() ) ) { |
289 | QFileInfo finfo ( defaultFileName() ); | 289 | QFileInfo finfo ( defaultFileName() ); |
290 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 290 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
291 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 291 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
292 | finfo.setFile( oldFile ); | 292 | finfo.setFile( oldFile ); |
293 | if (finfo.exists() ) { | 293 | if (finfo.exists() ) { |
294 | KMessageBox::information( this, message); | 294 | KMessageBox::information( this, message); |
295 | mView->openCalendar( oldFile ); | 295 | mView->openCalendar( oldFile ); |
296 | qApp->processEvents(); | 296 | qApp->processEvents(); |
297 | } else { | 297 | } else { |
298 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 298 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
299 | finfo.setFile( oldFile ); | 299 | finfo.setFile( oldFile ); |
300 | if (finfo.exists() ) { | 300 | if (finfo.exists() ) { |
301 | KMessageBox::information( this, message); | 301 | KMessageBox::information( this, message); |
302 | mView->openCalendar( oldFile ); | 302 | mView->openCalendar( oldFile ); |
303 | qApp->processEvents(); | 303 | qApp->processEvents(); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | mView->saveCalendar( defaultFileName() ); | 306 | mView->saveCalendar( defaultFileName() ); |
307 | newFile = true; | 307 | newFile = true; |
308 | } | 308 | } |
309 | 309 | ||
310 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 310 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
311 | mView->openCalendar( defaultFileName() ); | 311 | mView->loadCalendars(); |
312 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 312 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
313 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 313 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
314 | 314 | ||
315 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 315 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
316 | KOPrefs::instance()->setAllDefaults(); | 316 | KOPrefs::instance()->setAllDefaults(); |
317 | int count = mView->addCategories(); | 317 | int count = mView->addCategories(); |
318 | } | 318 | } |
319 | processIncidenceSelection( 0 ); | 319 | processIncidenceSelection( 0 ); |
320 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 320 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
321 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 321 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
322 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 322 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
323 | SLOT( slotModifiedChanged( bool ) ) ); | 323 | SLOT( slotModifiedChanged( bool ) ) ); |
324 | 324 | ||
325 | 325 | ||
326 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 326 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
327 | SLOT( disableBR(bool) ) ); | 327 | SLOT( disableBR(bool) ) ); |
328 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 328 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
329 | mView->setModified( false ); | 329 | mView->setModified( false ); |
330 | mBlockAtStartup = false; | 330 | mBlockAtStartup = false; |
331 | mView->setModified( false ); | 331 | mView->setModified( false ); |
332 | setCentralWidget( mView ); | 332 | setCentralWidget( mView ); |
333 | globalFlagBlockStartup = 0; | 333 | globalFlagBlockStartup = 0; |
334 | mView->show(); | 334 | mView->show(); |
335 | delete splash; | 335 | delete splash; |
336 | if ( newFile ) | 336 | if ( newFile ) |
337 | mView->updateConfig(); | 337 | mView->updateConfig(); |
338 | // qApp->processEvents(); | 338 | // qApp->processEvents(); |
339 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 339 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
340 | //fillSyncMenu(); | 340 | //fillSyncMenu(); |
341 | 341 | ||
342 | 342 | ||
343 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 343 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
344 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 344 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
345 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 345 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
346 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 346 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
347 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 347 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
348 | mSyncManager->setDefaultFileName( sentSyncFile()); | 348 | mSyncManager->setDefaultFileName( sentSyncFile()); |
349 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 349 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
350 | mSyncManager->fillSyncMenu(); | 350 | mSyncManager->fillSyncMenu(); |
351 | 351 | ||
352 | 352 | ||
353 | 353 | ||
354 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 354 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
355 | if ( showWarning ) { | 355 | if ( showWarning ) { |
356 | KMessageBox::information( this, | 356 | KMessageBox::information( this, |
357 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 357 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
358 | qApp->processEvents(); | 358 | qApp->processEvents(); |
359 | mView->dialogManager()->showSyncOptions(); | 359 | mView->dialogManager()->showSyncOptions(); |
360 | } | 360 | } |
361 | 361 | ||
362 | //US listen for result adressed from Ka/Pi | 362 | //US listen for result adressed from Ka/Pi |
363 | #ifndef DESKTOP_VERSION | 363 | #ifndef DESKTOP_VERSION |
364 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 364 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
365 | #endif | 365 | #endif |
366 | #ifndef DESKTOP_VERSION | 366 | #ifndef DESKTOP_VERSION |
367 | infrared = 0; | 367 | infrared = 0; |
368 | #endif | 368 | #endif |
369 | updateFilterToolbar(); | 369 | updateFilterToolbar(); |
370 | updateWeek( mView->startDate() ); | 370 | updateWeek( mView->startDate() ); |
371 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 371 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
372 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 372 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
373 | mBRdisabled = false; | 373 | mBRdisabled = false; |
374 | //toggleBeamReceive(); | 374 | //toggleBeamReceive(); |
375 | int tiint= 3000; | 375 | int tiint= 3000; |
376 | #ifndef DESKTOP_VERSION | 376 | #ifndef DESKTOP_VERSION |
377 | tiint = 5000; | 377 | tiint = 5000; |
378 | #endif | 378 | #endif |
379 | QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); | 379 | QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); |
380 | } | 380 | } |
381 | MainWindow::~MainWindow() | 381 | MainWindow::~MainWindow() |
382 | { | 382 | { |
383 | //qDebug("MainWindow::~MainWindow() "); | 383 | //qDebug("MainWindow::~MainWindow() "); |
384 | //save toolbar location | 384 | //save toolbar location |
385 | delete mCalendar; | 385 | delete mCalendar; |
386 | delete mSyncManager; | 386 | delete mSyncManager; |
387 | #ifndef DESKTOP_VERSION | 387 | #ifndef DESKTOP_VERSION |
388 | if ( infrared ) | 388 | if ( infrared ) |
389 | delete infrared; | 389 | delete infrared; |
390 | #endif | 390 | #endif |
391 | 391 | ||
392 | 392 | ||
393 | } | 393 | } |
394 | 394 | ||
395 | void MainWindow::disableBR(bool b) | 395 | void MainWindow::disableBR(bool b) |
396 | { | 396 | { |
397 | #ifndef DESKTOP_VERSION | 397 | #ifndef DESKTOP_VERSION |
398 | if ( b ) { | 398 | if ( b ) { |
399 | if ( infrared ) { | 399 | if ( infrared ) { |
400 | toggleBeamReceive(); | 400 | toggleBeamReceive(); |
401 | mBRdisabled = true; | 401 | mBRdisabled = true; |
402 | } | 402 | } |
403 | mBRdisabled = true; | 403 | mBRdisabled = true; |
404 | } else { | 404 | } else { |
405 | if ( mBRdisabled ) { | 405 | if ( mBRdisabled ) { |
406 | mBRdisabled = false; | 406 | mBRdisabled = false; |
407 | //makes no sense,because other cal ap is probably running | 407 | //makes no sense,because other cal ap is probably running |
@@ -1764,193 +1764,193 @@ void MainWindow::saveOnClose() | |||
1764 | p->mToolBarUpN = myP.x() > width()/2 ; | 1764 | p->mToolBarUpN = myP.x() > width()/2 ; |
1765 | if ( filterToolBar ) { | 1765 | if ( filterToolBar ) { |
1766 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1766 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1767 | if ( p->mToolBarHorF ) | 1767 | if ( p->mToolBarHorF ) |
1768 | p->mToolBarUpF = myP.y() > height()/2; | 1768 | p->mToolBarUpF = myP.y() > height()/2; |
1769 | else | 1769 | else |
1770 | p->mToolBarUpF = myP.x() > width()/2 ; | 1770 | p->mToolBarUpF = myP.x() > width()/2 ; |
1771 | } | 1771 | } |
1772 | #else | 1772 | #else |
1773 | if ( p->mToolBarHor ) | 1773 | if ( p->mToolBarHor ) |
1774 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1774 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1775 | else | 1775 | else |
1776 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1776 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1777 | if ( p->mToolBarHorV ) | 1777 | if ( p->mToolBarHorV ) |
1778 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1778 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1779 | else | 1779 | else |
1780 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1780 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1781 | 1781 | ||
1782 | if ( p->mToolBarHorN ) | 1782 | if ( p->mToolBarHorN ) |
1783 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1783 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1784 | else | 1784 | else |
1785 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1785 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1786 | if ( filterToolBar ) { | 1786 | if ( filterToolBar ) { |
1787 | if ( p->mToolBarHorF ) | 1787 | if ( p->mToolBarHorF ) |
1788 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1788 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1789 | else | 1789 | else |
1790 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1790 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1791 | } | 1791 | } |
1792 | #endif | 1792 | #endif |
1793 | 1793 | ||
1794 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1794 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1795 | save(); | 1795 | save(); |
1796 | mView->writeSettings(); | 1796 | mView->writeSettings(); |
1797 | } | 1797 | } |
1798 | void MainWindow::slotModifiedChanged( bool changed ) | 1798 | void MainWindow::slotModifiedChanged( bool changed ) |
1799 | { | 1799 | { |
1800 | if ( mBlockAtStartup ) | 1800 | if ( mBlockAtStartup ) |
1801 | return; | 1801 | return; |
1802 | 1802 | ||
1803 | int msec; | 1803 | int msec; |
1804 | // we store the changes after 1 minute, | 1804 | // we store the changes after 1 minute, |
1805 | // and for safety reasons after 10 minutes again | 1805 | // and for safety reasons after 10 minutes again |
1806 | if ( !mSyncManager->blockSave() ) | 1806 | if ( !mSyncManager->blockSave() ) |
1807 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1807 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1808 | else | 1808 | else |
1809 | msec = 1000 * 600; | 1809 | msec = 1000 * 600; |
1810 | mSaveTimer.start( msec, true ); // 1 minute | 1810 | mSaveTimer.start( msec, true ); // 1 minute |
1811 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1811 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1812 | mCalendarModifiedFlag = true; | 1812 | mCalendarModifiedFlag = true; |
1813 | } | 1813 | } |
1814 | void MainWindow::saveStopTimer() | 1814 | void MainWindow::saveStopTimer() |
1815 | { | 1815 | { |
1816 | mSaveTimer.stop(); | 1816 | mSaveTimer.stop(); |
1817 | } | 1817 | } |
1818 | void MainWindow::save() | 1818 | void MainWindow::save() |
1819 | { | 1819 | { |
1820 | if ( !mCalendarModifiedFlag ) { | 1820 | if ( !mCalendarModifiedFlag ) { |
1821 | qDebug("KO: Calendar not modified. Nothing saved."); | 1821 | qDebug("KO: Calendar not modified. Nothing saved."); |
1822 | return; | 1822 | return; |
1823 | } | 1823 | } |
1824 | if ( mSyncManager->blockSave() ) | 1824 | if ( mSyncManager->blockSave() ) |
1825 | return; | 1825 | return; |
1826 | mSyncManager->setBlockSave(true); | 1826 | mSyncManager->setBlockSave(true); |
1827 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1827 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1828 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1828 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1829 | QDate reference ( 2000,1,1); | 1829 | QDate reference ( 2000,1,1); |
1830 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1830 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1831 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1831 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1832 | setCaption(i18n("Creating backup ... please wait ..." )); | 1832 | setCaption(i18n("Creating backup ... please wait ..." )); |
1833 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1833 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1834 | // we need the file path, the backup dir and the number of bups as param | 1834 | // we need the file path, the backup dir and the number of bups as param |
1835 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1835 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1836 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1836 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1837 | bupDir = KGlobalSettings::backupDataDir(); | 1837 | bupDir = KGlobalSettings::backupDataDir(); |
1838 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1838 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1839 | if ( retval == 0 ) { | 1839 | if ( retval == 0 ) { |
1840 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1840 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1841 | // retval == 0 : backup skipped for today, try again tomorrow | 1841 | // retval == 0 : backup skipped for today, try again tomorrow |
1842 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1842 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1843 | } else if ( retval == 1 ){ | 1843 | } else if ( retval == 1 ){ |
1844 | qDebug("KO: Backup created."); | 1844 | qDebug("KO: Backup created."); |
1845 | // backup ok | 1845 | // backup ok |
1846 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1846 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1847 | 1847 | ||
1848 | } else if ( retval == 2 ){ | 1848 | } else if ( retval == 2 ){ |
1849 | qDebug("KO: Backup globally cancelled."); | 1849 | qDebug("KO: Backup globally cancelled."); |
1850 | // backup globally cancelled | 1850 | // backup globally cancelled |
1851 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1851 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1852 | } | 1852 | } |
1853 | // retval == 3: do nothing, try again later | 1853 | // retval == 3: do nothing, try again later |
1854 | } | 1854 | } |
1855 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1855 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1856 | } | 1856 | } |
1857 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1857 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1858 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1858 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1859 | qDebug("KO: Start saving data to file!"); | 1859 | qDebug("KO: Start saving data to file!"); |
1860 | mView->saveCalendar( defaultFileName() ); | 1860 | mView->saveCalendars(); |
1861 | mCalendarModifiedFlag = false; | 1861 | mCalendarModifiedFlag = false; |
1862 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1862 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1863 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1863 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1864 | QString savemes; | 1864 | QString savemes; |
1865 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1865 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1866 | setCaption(savemes); | 1866 | setCaption(savemes); |
1867 | } else | 1867 | } else |
1868 | setCaption(i18n("Saving cancelled!")); | 1868 | setCaption(i18n("Saving cancelled!")); |
1869 | mSyncManager->setBlockSave( false ); | 1869 | mSyncManager->setBlockSave( false ); |
1870 | } | 1870 | } |
1871 | 1871 | ||
1872 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1872 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1873 | { | 1873 | { |
1874 | if ( !e->isAutoRepeat() ) { | 1874 | if ( !e->isAutoRepeat() ) { |
1875 | mFlagKeyPressed = false; | 1875 | mFlagKeyPressed = false; |
1876 | } | 1876 | } |
1877 | } | 1877 | } |
1878 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1878 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1879 | { | 1879 | { |
1880 | qApp->processEvents(); | 1880 | qApp->processEvents(); |
1881 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1881 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1882 | e->ignore(); | 1882 | e->ignore(); |
1883 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1883 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1884 | return; | 1884 | return; |
1885 | } | 1885 | } |
1886 | if (! e->isAutoRepeat() ) | 1886 | if (! e->isAutoRepeat() ) |
1887 | mFlagKeyPressed = true; | 1887 | mFlagKeyPressed = true; |
1888 | KOPrefs *p = KOPrefs::instance(); | 1888 | KOPrefs *p = KOPrefs::instance(); |
1889 | bool showSelectedDates = false; | 1889 | bool showSelectedDates = false; |
1890 | int size; | 1890 | int size; |
1891 | int pro = 0; | 1891 | int pro = 0; |
1892 | //qDebug("MainWindow::keyPressEvent "); | 1892 | //qDebug("MainWindow::keyPressEvent "); |
1893 | switch ( e->key() ) { | 1893 | switch ( e->key() ) { |
1894 | case Qt::Key_Right: | 1894 | case Qt::Key_Right: |
1895 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1895 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1896 | mView->goNextMonth(); | 1896 | mView->goNextMonth(); |
1897 | else | 1897 | else |
1898 | mView->goNext(); | 1898 | mView->goNext(); |
1899 | showSelectedDates = true; | 1899 | showSelectedDates = true; |
1900 | break; | 1900 | break; |
1901 | case Qt::Key_Left: | 1901 | case Qt::Key_Left: |
1902 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1902 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1903 | mView->goPreviousMonth(); | 1903 | mView->goPreviousMonth(); |
1904 | else | 1904 | else |
1905 | mView->goPrevious(); | 1905 | mView->goPrevious(); |
1906 | showSelectedDates = true; | 1906 | showSelectedDates = true; |
1907 | break; | 1907 | break; |
1908 | case Qt::Key_Down: | 1908 | case Qt::Key_Down: |
1909 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1909 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1910 | break; | 1910 | break; |
1911 | case Qt::Key_Up: | 1911 | case Qt::Key_Up: |
1912 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1912 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1913 | break; | 1913 | break; |
1914 | case Qt::Key_K: | 1914 | case Qt::Key_K: |
1915 | mView->viewManager()->showMonthViewWeek(); | 1915 | mView->viewManager()->showMonthViewWeek(); |
1916 | break; | 1916 | break; |
1917 | case Qt::Key_I: | 1917 | case Qt::Key_I: |
1918 | mView->showIncidence(); | 1918 | mView->showIncidence(); |
1919 | break; | 1919 | break; |
1920 | case Qt::Key_Delete: | 1920 | case Qt::Key_Delete: |
1921 | case Qt::Key_Backspace: | 1921 | case Qt::Key_Backspace: |
1922 | mView->deleteIncidence(); | 1922 | mView->deleteIncidence(); |
1923 | break; | 1923 | break; |
1924 | case Qt::Key_D: | 1924 | case Qt::Key_D: |
1925 | mView->viewManager()->showDayView(); | 1925 | mView->viewManager()->showDayView(); |
1926 | showSelectedDates = true; | 1926 | showSelectedDates = true; |
1927 | break; | 1927 | break; |
1928 | case Qt::Key_O: | 1928 | case Qt::Key_O: |
1929 | mView->toggleFilerEnabled( ); | 1929 | mView->toggleFilerEnabled( ); |
1930 | break; | 1930 | break; |
1931 | case Qt::Key_0: | 1931 | case Qt::Key_0: |
1932 | case Qt::Key_1: | 1932 | case Qt::Key_1: |
1933 | case Qt::Key_2: | 1933 | case Qt::Key_2: |
1934 | case Qt::Key_3: | 1934 | case Qt::Key_3: |
1935 | case Qt::Key_4: | 1935 | case Qt::Key_4: |
1936 | case Qt::Key_5: | 1936 | case Qt::Key_5: |
1937 | case Qt::Key_6: | 1937 | case Qt::Key_6: |
1938 | case Qt::Key_7: | 1938 | case Qt::Key_7: |
1939 | case Qt::Key_8: | 1939 | case Qt::Key_8: |
1940 | case Qt::Key_9: | 1940 | case Qt::Key_9: |
1941 | pro = e->key()-48; | 1941 | pro = e->key()-48; |
1942 | if ( pro == 0 ) | 1942 | if ( pro == 0 ) |
1943 | pro = 10; | 1943 | pro = 10; |
1944 | if ( e->state() == Qt::ControlButton) | 1944 | if ( e->state() == Qt::ControlButton) |
1945 | pro += 10; | 1945 | pro += 10; |
1946 | break; | 1946 | break; |
1947 | case Qt::Key_M: | 1947 | case Qt::Key_M: |
1948 | mView->viewManager()->showMonthView(); | 1948 | mView->viewManager()->showMonthView(); |
1949 | showSelectedDates = true; | 1949 | showSelectedDates = true; |
1950 | break; | 1950 | break; |
1951 | case Qt::Key_Insert: | 1951 | case Qt::Key_Insert: |
1952 | mView->newEvent(); | 1952 | mView->newEvent(); |
1953 | break; | 1953 | break; |
1954 | case Qt::Key_S : | 1954 | case Qt::Key_S : |
1955 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1955 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1956 | mView->newSubTodo(); | 1956 | mView->newSubTodo(); |