author | zautrix <zautrix> | 2005-06-13 20:42:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-13 20:42:10 (UTC) |
commit | fe1114cea0321405b362d642912f1f72257c7cbd (patch) (unidiff) | |
tree | 89f5cc1050a86c497fc406ebbea88669b6bea1a6 /korganizer | |
parent | 0000f74badd326f62620d818a5e5d9944e55bda0 (diff) | |
download | kdepimpi-fe1114cea0321405b362d642912f1f72257c7cbd.zip kdepimpi-fe1114cea0321405b362d642912f1f72257c7cbd.tar.gz kdepimpi-fe1114cea0321405b362d642912f1f72257c7cbd.tar.bz2 |
fixxxx
-rw-r--r-- | korganizer/calendarview.cpp | 45 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 18 | ||||
-rw-r--r-- | korganizer/koprefs.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 |
5 files changed, 68 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 6e60c56..b0be340 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -346,3222 +346,3251 @@ CalendarView::CalendarView( CalendarResources *calendar, | |||
346 | 346 | ||
347 | mEventEditor = 0; | 347 | mEventEditor = 0; |
348 | mTodoEditor = 0; | 348 | mTodoEditor = 0; |
349 | 349 | ||
350 | init(); | 350 | init(); |
351 | } | 351 | } |
352 | 352 | ||
353 | CalendarView::CalendarView( Calendar *calendar, | 353 | CalendarView::CalendarView( Calendar *calendar, |
354 | QWidget *parent, const char *name ) | 354 | QWidget *parent, const char *name ) |
355 | : CalendarViewBase( parent, name ), | 355 | : CalendarViewBase( parent, name ), |
356 | mCalendar( calendar ), | 356 | mCalendar( calendar ), |
357 | mResourceManager( 0 ) | 357 | mResourceManager( 0 ) |
358 | { | 358 | { |
359 | 359 | ||
360 | mEventEditor = 0; | 360 | mEventEditor = 0; |
361 | mTodoEditor = 0; | 361 | mTodoEditor = 0; |
362 | init(); | 362 | init(); |
363 | } | 363 | } |
364 | 364 | ||
365 | void CalendarView::init() | 365 | 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)) ); | 462 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 463 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); | 464 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); |
465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 465 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
466 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 466 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
467 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 467 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
468 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 468 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
469 | mTodoList->setNavigator( mNavigator ); | 469 | mTodoList->setNavigator( mNavigator ); |
470 | #if 0 | 470 | #if 0 |
471 | if ( QApplication::desktop()->width() < 480 ) { | 471 | if ( QApplication::desktop()->width() < 480 ) { |
472 | leftFrameLayout->addWidget(mFilterView); | 472 | leftFrameLayout->addWidget(mFilterView); |
473 | leftFrameLayout->addWidget(mTodoList, 2 ); | 473 | leftFrameLayout->addWidget(mTodoList, 2 ); |
474 | 474 | ||
475 | } else { | 475 | } else { |
476 | leftFrameLayout->addWidget(mTodoList,2 ); | 476 | leftFrameLayout->addWidget(mTodoList,2 ); |
477 | leftFrameLayout->addWidget(mFilterView ); | 477 | leftFrameLayout->addWidget(mFilterView ); |
478 | } | 478 | } |
479 | #endif | 479 | #endif |
480 | mFilterView->hide(); | 480 | mFilterView->hide(); |
481 | mCalEditView->hide(); | 481 | mCalEditView->hide(); |
482 | QWidget *rightBox = new QWidget( mMainFrame ); | 482 | QWidget *rightBox = new QWidget( mMainFrame ); |
483 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 483 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
484 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 484 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
485 | mRightFrame = new QWidgetStack( rightBox ); | 485 | mRightFrame = new QWidgetStack( rightBox ); |
486 | rightLayout->addWidget( mRightFrame, 10 ); | 486 | rightLayout->addWidget( mRightFrame, 10 ); |
487 | 487 | ||
488 | //mLeftFrame = (QWidget *)leftFrame; | 488 | //mLeftFrame = (QWidget *)leftFrame; |
489 | if ( KOPrefs::instance()->mVerticalScreen ) { | 489 | if ( KOPrefs::instance()->mVerticalScreen ) { |
490 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 490 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
491 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 491 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
492 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 492 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
493 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 493 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
494 | } else { | 494 | } else { |
495 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 495 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
496 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 496 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
497 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 497 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
498 | } | 498 | } |
499 | if ( !KOPrefs::instance()->mShowDateNavigator) | 499 | if ( !KOPrefs::instance()->mShowDateNavigator) |
500 | mDateNavigator->hide(); | 500 | mDateNavigator->hide(); |
501 | //qDebug("Calendarview Size %d %d ", width(), height()); | 501 | //qDebug("Calendarview Size %d %d ", width(), height()); |
502 | #endif | 502 | #endif |
503 | 503 | ||
504 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 504 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
505 | SLOT( showDates( const KCal::DateList & ) ) ); | 505 | SLOT( showDates( const KCal::DateList & ) ) ); |
506 | 506 | ||
507 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 507 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
508 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 508 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
509 | 509 | ||
510 | 510 | ||
511 | 511 | ||
512 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 512 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
513 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 513 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
514 | 514 | ||
515 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 515 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
516 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 516 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
517 | 517 | ||
518 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 518 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
519 | mNavigator, SLOT( selectPreviousYear() ) ); | 519 | mNavigator, SLOT( selectPreviousYear() ) ); |
520 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 520 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
521 | mNavigator, SLOT( selectNextYear() ) ); | 521 | mNavigator, SLOT( selectNextYear() ) ); |
522 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 522 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
523 | mNavigator, SLOT( selectPreviousMonth() ) ); | 523 | mNavigator, SLOT( selectPreviousMonth() ) ); |
524 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 524 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
525 | mNavigator, SLOT( selectNextMonth() ) ); | 525 | mNavigator, SLOT( selectNextMonth() ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 527 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
528 | mNavigator, SLOT( selectPrevious() ) ); | 528 | mNavigator, SLOT( selectPrevious() ) ); |
529 | connect( mDateNavigator, SIGNAL( goNext() ), | 529 | connect( mDateNavigator, SIGNAL( goNext() ), |
530 | mNavigator, SLOT( selectNext() ) ); | 530 | mNavigator, SLOT( selectNext() ) ); |
531 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 531 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
532 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 532 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
533 | 533 | ||
534 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 534 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
535 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 535 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
536 | #if 0 | 536 | #if 0 |
537 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 537 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
538 | SLOT( incidenceAdded( Incidence *) ) ); | 538 | SLOT( incidenceAdded( Incidence *) ) ); |
539 | #endif | 539 | #endif |
540 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 540 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
541 | 541 | ||
542 | connect( this, SIGNAL( configChanged() ), | 542 | connect( this, SIGNAL( configChanged() ), |
543 | mDateNavigator, SLOT( updateConfig() ) ); | 543 | mDateNavigator, SLOT( updateConfig() ) ); |
544 | 544 | ||
545 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 545 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
546 | SLOT( newTodo() ) ); | 546 | SLOT( newTodo() ) ); |
547 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 547 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
548 | SLOT( newSubTodo( Todo * ) ) ); | 548 | SLOT( newSubTodo( Todo * ) ) ); |
549 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 549 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
550 | SLOT( editTodo( Todo * ) ) ); | 550 | SLOT( editTodo( Todo * ) ) ); |
551 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 551 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
552 | SLOT( showTodo( Todo *) ) ); | 552 | SLOT( showTodo( Todo *) ) ); |
553 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 553 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
554 | SLOT( deleteTodo( Todo *) ) ); | 554 | SLOT( deleteTodo( Todo *) ) ); |
555 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 555 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
556 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 556 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
557 | SLOT( purgeCompleted() ) ); | 557 | SLOT( purgeCompleted() ) ); |
558 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 558 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
559 | SIGNAL( todoModified( Todo *, int ) ) ); | 559 | SIGNAL( todoModified( Todo *, int ) ) ); |
560 | 560 | ||
561 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 561 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
562 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 562 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
563 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 563 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
564 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 564 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
565 | 565 | ||
566 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 566 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
567 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 567 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
568 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 568 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
569 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 569 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
570 | 570 | ||
571 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 571 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
572 | this, SLOT ( todo_unsub( Todo * ) ) ); | 572 | this, SLOT ( todo_unsub( Todo * ) ) ); |
573 | 573 | ||
574 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 574 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
575 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 575 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
576 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 576 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
577 | SLOT( updateTodo( Todo *, int ) ) ); | 577 | SLOT( updateTodo( Todo *, int ) ) ); |
578 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 578 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
579 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 579 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
580 | 580 | ||
581 | 581 | ||
582 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 582 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
583 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 583 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
584 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 584 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
585 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 585 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
586 | 586 | ||
587 | 587 | ||
588 | 588 | ||
589 | 589 | ||
590 | 590 | ||
591 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 591 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
592 | SLOT(checkClipboard())); | 592 | SLOT(checkClipboard())); |
593 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 593 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
594 | SLOT( processTodoListSelection( Incidence * ) ) ); | 594 | SLOT( processTodoListSelection( Incidence * ) ) ); |
595 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 595 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
596 | 596 | ||
597 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 597 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
598 | 598 | ||
599 | mDateFrame = new QVBox(0,0,WType_Popup); | 599 | mDateFrame = new QVBox(0,0,WType_Popup); |
600 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 600 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
601 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 601 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
602 | mDateFrame->setLineWidth(3); | 602 | mDateFrame->setLineWidth(3); |
603 | mDateFrame->hide(); | 603 | mDateFrame->hide(); |
604 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 604 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
605 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 605 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
606 | 606 | ||
607 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 607 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
608 | 608 | ||
609 | mEventEditor = mDialogManager->getEventEditor(); | 609 | mEventEditor = mDialogManager->getEventEditor(); |
610 | mTodoEditor = mDialogManager->getTodoEditor(); | 610 | mTodoEditor = mDialogManager->getTodoEditor(); |
611 | 611 | ||
612 | mFlagEditDescription = false; | 612 | mFlagEditDescription = false; |
613 | 613 | ||
614 | mSuspendTimer = new QTimer( this ); | 614 | mSuspendTimer = new QTimer( this ); |
615 | mAlarmTimer = new QTimer( this ); | 615 | mAlarmTimer = new QTimer( this ); |
616 | mRecheckAlarmTimer = new QTimer( this ); | 616 | mRecheckAlarmTimer = new QTimer( this ); |
617 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 617 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
618 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 618 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
619 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 619 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
620 | mAlarmDialog = new AlarmDialog( this ); | 620 | mAlarmDialog = new AlarmDialog( this ); |
621 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 621 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
622 | mAlarmDialog->setServerNotification( false ); | 622 | mAlarmDialog->setServerNotification( false ); |
623 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 623 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
624 | 624 | ||
625 | 625 | ||
626 | #ifndef DESKTOP_VERSION | 626 | #ifndef DESKTOP_VERSION |
627 | //US listen for arriving address resultsets | 627 | //US listen for arriving address resultsets |
628 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 628 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
629 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 629 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
630 | #endif | 630 | #endif |
631 | mDateNavigator->setCalendar( mCalendar ); | 631 | mDateNavigator->setCalendar( mCalendar ); |
632 | } | 632 | } |
633 | 633 | ||
634 | 634 | ||
635 | CalendarView::~CalendarView() | 635 | CalendarView::~CalendarView() |
636 | { | 636 | { |
637 | // kdDebug() << "~CalendarView()" << endl; | 637 | // kdDebug() << "~CalendarView()" << endl; |
638 | //qDebug("CalendarView::~CalendarView() "); | 638 | //qDebug("CalendarView::~CalendarView() "); |
639 | delete mDialogManager; | 639 | delete mDialogManager; |
640 | delete mViewManager; | 640 | delete mViewManager; |
641 | delete mStorage; | 641 | delete mStorage; |
642 | delete mDateFrame ; | 642 | delete mDateFrame ; |
643 | delete beamDialog; | 643 | delete beamDialog; |
644 | delete mEventViewerDialog; | 644 | delete mEventViewerDialog; |
645 | //kdDebug() << "~CalendarView() done" << endl; | 645 | //kdDebug() << "~CalendarView() done" << endl; |
646 | } | 646 | } |
647 | void CalendarView::checkAlarms() | 647 | void CalendarView::checkAlarms() |
648 | { | 648 | { |
649 | KConfig *config = KOGlobals::config(); | 649 | KConfig *config = KOGlobals::config(); |
650 | config->setGroup( "AppRun" ); | 650 | config->setGroup( "AppRun" ); |
651 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 651 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
652 | int daysto = dt.daysTo( QDate::currentDate() ); | 652 | int daysto = dt.daysTo( QDate::currentDate() ); |
653 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 653 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
654 | dt = dt.addDays( days ); | 654 | dt = dt.addDays( days ); |
655 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 655 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
656 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 656 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
657 | //qDebug("KO: Reading program stop %d ", secs); | 657 | //qDebug("KO: Reading program stop %d ", secs); |
658 | //secs -= ( 3600 * 24*3 ); // debug only | 658 | //secs -= ( 3600 * 24*3 ); // debug only |
659 | QDateTime latest = dt.addSecs ( secs ); | 659 | QDateTime latest = dt.addSecs ( secs ); |
660 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 660 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
661 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 661 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
662 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 662 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
663 | QPtrList<Incidence> al; | 663 | QPtrList<Incidence> al; |
664 | Incidence* inL = el.first(); | 664 | Incidence* inL = el.first(); |
665 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 665 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
666 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 666 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
667 | while ( inL ) { | 667 | while ( inL ) { |
668 | bool ok = false; | 668 | bool ok = false; |
669 | int offset = 0; | 669 | int offset = 0; |
670 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 670 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
671 | if ( ok ) { | 671 | if ( ok ) { |
672 | //qDebug("OK %s",next.toString().latin1()); | 672 | //qDebug("OK %s",next.toString().latin1()); |
673 | if ( next < cur ) { | 673 | if ( next < cur ) { |
674 | al.append( inL ); | 674 | al.append( inL ); |
675 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 675 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
676 | } | 676 | } |
677 | } | 677 | } |
678 | inL = el.next(); | 678 | inL = el.next(); |
679 | } | 679 | } |
680 | if ( al.count() ) { | 680 | if ( al.count() ) { |
681 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 681 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
682 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 682 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
683 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 683 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
684 | lay->setSpacing( 0 ); | 684 | lay->setSpacing( 0 ); |
685 | lay->setMargin( 0 ); | 685 | lay->setMargin( 0 ); |
686 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 686 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
687 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 687 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
688 | lay->addWidget( matb ); | 688 | lay->addWidget( matb ); |
689 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 689 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
690 | int wid = 210; | 690 | int wid = 210; |
691 | int x = QApplication::desktop()->width() - wid - 7; | 691 | int x = QApplication::desktop()->width() - wid - 7; |
692 | int y = QApplication::desktop()->height() - wid - 70; | 692 | int y = QApplication::desktop()->height() - wid - 70; |
693 | dia->setGeometry ( x,y,wid,wid); | 693 | dia->setGeometry ( x,y,wid,wid); |
694 | } else { | 694 | } else { |
695 | int si = 220; | 695 | int si = 220; |
696 | if ( QApplication::desktop()->width() > 470 ) | 696 | if ( QApplication::desktop()->width() > 470 ) |
697 | si = 400; | 697 | si = 400; |
698 | dia->resize(si,si/2); | 698 | dia->resize(si,si/2); |
699 | } | 699 | } |
700 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 700 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
701 | dia->show(); | 701 | dia->show(); |
702 | 702 | ||
703 | } | 703 | } |
704 | } | 704 | } |
705 | void CalendarView::showDay( QDate d ) | 705 | void CalendarView::showDay( QDate d ) |
706 | { | 706 | { |
707 | dateNavigator()->blockSignals( true ); | 707 | dateNavigator()->blockSignals( true ); |
708 | dateNavigator()->selectDate( d ); | 708 | dateNavigator()->selectDate( d ); |
709 | dateNavigator()->blockSignals( false ); | 709 | dateNavigator()->blockSignals( false ); |
710 | mViewManager->showDayView(); | 710 | mViewManager->showDayView(); |
711 | //dateNavigator()->selectDate( d ); | 711 | //dateNavigator()->selectDate( d ); |
712 | } | 712 | } |
713 | void CalendarView::timerAlarm() | 713 | void CalendarView::timerAlarm() |
714 | { | 714 | { |
715 | //qDebug("CalendarView::timerAlarm() "); | 715 | //qDebug("CalendarView::timerAlarm() "); |
716 | computeAlarm(mAlarmNotification ); | 716 | computeAlarm(mAlarmNotification ); |
717 | } | 717 | } |
718 | 718 | ||
719 | void CalendarView::suspendAlarm() | 719 | void CalendarView::suspendAlarm() |
720 | { | 720 | { |
721 | //qDebug(" CalendarView::suspendAlarm() "); | 721 | //qDebug(" CalendarView::suspendAlarm() "); |
722 | computeAlarm(mSuspendAlarmNotification ); | 722 | computeAlarm(mSuspendAlarmNotification ); |
723 | 723 | ||
724 | } | 724 | } |
725 | 725 | ||
726 | void CalendarView::startAlarm( QString mess , QString filename) | 726 | void CalendarView::startAlarm( QString mess , QString filename) |
727 | { | 727 | { |
728 | 728 | ||
729 | topLevelWidget()->showNormal(); | 729 | topLevelWidget()->showNormal(); |
730 | topLevelWidget()->setActiveWindow(); | 730 | topLevelWidget()->setActiveWindow(); |
731 | topLevelWidget()->raise(); | 731 | topLevelWidget()->raise(); |
732 | 732 | ||
733 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 733 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
734 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 734 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
735 | 735 | ||
736 | } | 736 | } |
737 | 737 | ||
738 | void CalendarView::checkNextTimerAlarm() | 738 | void CalendarView::checkNextTimerAlarm() |
739 | { | 739 | { |
740 | mCalendar->checkAlarmForIncidence( 0, true ); | 740 | mCalendar->checkAlarmForIncidence( 0, true ); |
741 | } | 741 | } |
742 | 742 | ||
743 | void CalendarView::computeAlarm( QString msg ) | 743 | void CalendarView::computeAlarm( QString msg ) |
744 | { | 744 | { |
745 | 745 | ||
746 | QString mess = msg; | 746 | QString mess = msg; |
747 | QString mAlarmMessage = mess.mid( 9 ); | 747 | QString mAlarmMessage = mess.mid( 9 ); |
748 | QString filename = MainWindow::resourcePath(); | 748 | QString filename = MainWindow::resourcePath(); |
749 | filename += "koalarm.wav"; | 749 | filename += "koalarm.wav"; |
750 | QString tempfilename; | 750 | QString tempfilename; |
751 | if ( mess.left( 13 ) == "suspend_alarm") { | 751 | if ( mess.left( 13 ) == "suspend_alarm") { |
752 | bool error = false; | 752 | bool error = false; |
753 | int len = mess.mid( 13 ).find("+++"); | 753 | int len = mess.mid( 13 ).find("+++"); |
754 | if ( len < 2 ) | 754 | if ( len < 2 ) |
755 | error = true; | 755 | error = true; |
756 | else { | 756 | else { |
757 | tempfilename = mess.mid( 13, len ); | 757 | tempfilename = mess.mid( 13, len ); |
758 | if ( !QFile::exists( tempfilename ) ) | 758 | if ( !QFile::exists( tempfilename ) ) |
759 | error = true; | 759 | error = true; |
760 | } | 760 | } |
761 | if ( ! error ) { | 761 | if ( ! error ) { |
762 | filename = tempfilename; | 762 | filename = tempfilename; |
763 | } | 763 | } |
764 | mAlarmMessage = mess.mid( 13+len+3 ); | 764 | mAlarmMessage = mess.mid( 13+len+3 ); |
765 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 765 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
766 | startAlarm( mAlarmMessage, filename); | 766 | startAlarm( mAlarmMessage, filename); |
767 | return; | 767 | return; |
768 | } | 768 | } |
769 | if ( mess.left( 11 ) == "timer_alarm") { | 769 | if ( mess.left( 11 ) == "timer_alarm") { |
770 | //mTimerTime = 0; | 770 | //mTimerTime = 0; |
771 | startAlarm( mess.mid( 11 ), filename ); | 771 | startAlarm( mess.mid( 11 ), filename ); |
772 | return; | 772 | return; |
773 | } | 773 | } |
774 | if ( mess.left( 10 ) == "proc_alarm") { | 774 | if ( mess.left( 10 ) == "proc_alarm") { |
775 | bool error = false; | 775 | bool error = false; |
776 | int len = mess.mid( 10 ).find("+++"); | 776 | int len = mess.mid( 10 ).find("+++"); |
777 | if ( len < 2 ) | 777 | if ( len < 2 ) |
778 | error = true; | 778 | error = true; |
779 | else { | 779 | else { |
780 | tempfilename = mess.mid( 10, len ); | 780 | tempfilename = mess.mid( 10, len ); |
781 | if ( !QFile::exists( tempfilename ) ) | 781 | if ( !QFile::exists( tempfilename ) ) |
782 | error = true; | 782 | error = true; |
783 | } | 783 | } |
784 | if ( error ) { | 784 | if ( error ) { |
785 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 785 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
786 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 786 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
787 | } else { | 787 | } else { |
788 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 788 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
789 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 789 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
790 | #ifndef _WIN32_ | 790 | #ifndef _WIN32_ |
791 | if ( vfork () == 0 ) { | 791 | if ( vfork () == 0 ) { |
792 | execl ( tempfilename.latin1(), 0 ); | 792 | execl ( tempfilename.latin1(), 0 ); |
793 | return; | 793 | return; |
794 | } | 794 | } |
795 | #else | 795 | #else |
796 | QProcess* p = new QProcess(); | 796 | QProcess* p = new QProcess(); |
797 | p->addArgument( tempfilename.latin1() ); | 797 | p->addArgument( tempfilename.latin1() ); |
798 | p->start(); | 798 | p->start(); |
799 | return; | 799 | return; |
800 | #endif | 800 | #endif |
801 | 801 | ||
802 | return; | 802 | return; |
803 | } | 803 | } |
804 | 804 | ||
805 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 805 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
806 | } | 806 | } |
807 | if ( mess.left( 11 ) == "audio_alarm") { | 807 | if ( mess.left( 11 ) == "audio_alarm") { |
808 | bool error = false; | 808 | bool error = false; |
809 | int len = mess.mid( 11 ).find("+++"); | 809 | int len = mess.mid( 11 ).find("+++"); |
810 | if ( len < 2 ) | 810 | if ( len < 2 ) |
811 | error = true; | 811 | error = true; |
812 | else { | 812 | else { |
813 | tempfilename = mess.mid( 11, len ); | 813 | tempfilename = mess.mid( 11, len ); |
814 | if ( !QFile::exists( tempfilename ) ) | 814 | if ( !QFile::exists( tempfilename ) ) |
815 | error = true; | 815 | error = true; |
816 | } | 816 | } |
817 | if ( ! error ) { | 817 | if ( ! error ) { |
818 | filename = tempfilename; | 818 | filename = tempfilename; |
819 | } | 819 | } |
820 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 820 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
821 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 821 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
822 | } | 822 | } |
823 | if ( mess.left( 9 ) == "cal_alarm") { | 823 | if ( mess.left( 9 ) == "cal_alarm") { |
824 | mAlarmMessage = mess.mid( 9 ) ; | 824 | mAlarmMessage = mess.mid( 9 ) ; |
825 | } | 825 | } |
826 | 826 | ||
827 | startAlarm( mAlarmMessage, filename ); | 827 | startAlarm( mAlarmMessage, filename ); |
828 | 828 | ||
829 | 829 | ||
830 | } | 830 | } |
831 | 831 | ||
832 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 832 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
833 | { | 833 | { |
834 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 834 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
835 | 835 | ||
836 | mSuspendAlarmNotification = noti; | 836 | mSuspendAlarmNotification = noti; |
837 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 837 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
838 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 838 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
839 | mSuspendTimer->start( ms , true ); | 839 | mSuspendTimer->start( ms , true ); |
840 | 840 | ||
841 | } | 841 | } |
842 | 842 | ||
843 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 843 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
844 | { | 844 | { |
845 | mNextAlarmDateTime = qdt; | 845 | mNextAlarmDateTime = qdt; |
846 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 846 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
847 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 847 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
848 | #ifndef DESKTOP_VERSION | 848 | #ifndef DESKTOP_VERSION |
849 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 849 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
850 | #endif | 850 | #endif |
851 | return; | 851 | return; |
852 | } | 852 | } |
853 | int maxSec; | 853 | int maxSec; |
854 | //maxSec = 5; //testing only | 854 | //maxSec = 5; //testing only |
855 | maxSec = 86400+3600; // one day+1hour | 855 | maxSec = 86400+3600; // one day+1hour |
856 | mAlarmNotification = noti; | 856 | mAlarmNotification = noti; |
857 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 857 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
858 | if ( sec > maxSec ) { | 858 | if ( sec > maxSec ) { |
859 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 859 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
860 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 860 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
861 | return; | 861 | return; |
862 | } else { | 862 | } else { |
863 | mRecheckAlarmTimer->stop(); | 863 | mRecheckAlarmTimer->stop(); |
864 | } | 864 | } |
865 | //qDebug("Alarm timer started with secs: %d ", sec); | 865 | //qDebug("Alarm timer started with secs: %d ", sec); |
866 | mAlarmTimer->start( sec *1000 , true ); | 866 | mAlarmTimer->start( sec *1000 , true ); |
867 | 867 | ||
868 | } | 868 | } |
869 | // called by mRecheckAlarmTimer to get next alarm | 869 | // called by mRecheckAlarmTimer to get next alarm |
870 | // we need this, because a QTimer has only a max range of 25 days | 870 | // we need this, because a QTimer has only a max range of 25 days |
871 | void CalendarView::recheckTimerAlarm() | 871 | void CalendarView::recheckTimerAlarm() |
872 | { | 872 | { |
873 | mAlarmTimer->stop(); | 873 | mAlarmTimer->stop(); |
874 | mRecheckAlarmTimer->stop(); | 874 | mRecheckAlarmTimer->stop(); |
875 | mCalendar->checkAlarmForIncidence( 0, true ); | 875 | mCalendar->checkAlarmForIncidence( 0, true ); |
876 | } | 876 | } |
877 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 877 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
878 | { | 878 | { |
879 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 879 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
880 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 880 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
881 | #ifndef DESKTOP_VERSION | 881 | #ifndef DESKTOP_VERSION |
882 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 882 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
883 | #endif | 883 | #endif |
884 | return; | 884 | return; |
885 | } | 885 | } |
886 | mAlarmTimer->stop(); | 886 | mAlarmTimer->stop(); |
887 | } | 887 | } |
888 | void CalendarView::selectWeekNum ( int num ) | 888 | void CalendarView::selectWeekNum ( int num ) |
889 | { | 889 | { |
890 | dateNavigator()->blockSignals( true ); | 890 | dateNavigator()->blockSignals( true ); |
891 | dateNavigator()->selectWeek( num ); | 891 | dateNavigator()->selectWeek( num ); |
892 | dateNavigator()->blockSignals( false ); | 892 | dateNavigator()->blockSignals( false ); |
893 | mViewManager->showWeekView(); | 893 | mViewManager->showWeekView(); |
894 | } | 894 | } |
895 | KOViewManager *CalendarView::viewManager() | 895 | KOViewManager *CalendarView::viewManager() |
896 | { | 896 | { |
897 | return mViewManager; | 897 | return mViewManager; |
898 | } | 898 | } |
899 | 899 | ||
900 | KODialogManager *CalendarView::dialogManager() | 900 | KODialogManager *CalendarView::dialogManager() |
901 | { | 901 | { |
902 | return mDialogManager; | 902 | return mDialogManager; |
903 | } | 903 | } |
904 | 904 | ||
905 | QDate CalendarView::startDate() | 905 | QDate CalendarView::startDate() |
906 | { | 906 | { |
907 | DateList dates = mNavigator->selectedDates(); | 907 | DateList dates = mNavigator->selectedDates(); |
908 | 908 | ||
909 | return dates.first(); | 909 | return dates.first(); |
910 | } | 910 | } |
911 | 911 | ||
912 | QDate CalendarView::endDate() | 912 | QDate CalendarView::endDate() |
913 | { | 913 | { |
914 | DateList dates = mNavigator->selectedDates(); | 914 | DateList dates = mNavigator->selectedDates(); |
915 | 915 | ||
916 | return dates.last(); | 916 | return dates.last(); |
917 | } | 917 | } |
918 | 918 | ||
919 | 919 | ||
920 | void CalendarView::createPrinter() | 920 | void CalendarView::createPrinter() |
921 | { | 921 | { |
922 | #ifndef KORG_NOPRINTER | 922 | #ifndef KORG_NOPRINTER |
923 | if (!mCalPrinter) { | 923 | if (!mCalPrinter) { |
924 | mCalPrinter = new CalPrinter(this, mCalendar); | 924 | mCalPrinter = new CalPrinter(this, mCalendar); |
925 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 925 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
926 | } | 926 | } |
927 | #endif | 927 | #endif |
928 | } | 928 | } |
929 | 929 | ||
930 | 930 | ||
931 | //KOPrefs::instance()->mWriteBackFile | 931 | //KOPrefs::instance()->mWriteBackFile |
932 | //KOPrefs::instance()->mWriteBackExistingOnly | 932 | //KOPrefs::instance()->mWriteBackExistingOnly |
933 | 933 | ||
934 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 934 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
935 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 935 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
936 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 936 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
937 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 937 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
938 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 938 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
939 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 939 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
940 | 940 | ||
941 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 941 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
942 | { | 942 | { |
943 | 943 | ||
944 | // 0 equal | 944 | // 0 equal |
945 | // 1 take local | 945 | // 1 take local |
946 | // 2 take remote | 946 | // 2 take remote |
947 | // 3 cancel | 947 | // 3 cancel |
948 | QDateTime lastSync = mLastCalendarSync; | 948 | QDateTime lastSync = mLastCalendarSync; |
949 | QDateTime localMod = local->lastModified(); | 949 | QDateTime localMod = local->lastModified(); |
950 | QDateTime remoteMod = remote->lastModified(); | 950 | QDateTime remoteMod = remote->lastModified(); |
951 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 951 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
952 | bool remCh, locCh; | 952 | bool remCh, locCh; |
953 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 953 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
954 | //if ( remCh ) | 954 | //if ( remCh ) |
955 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 955 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
956 | locCh = ( localMod > mLastCalendarSync ); | 956 | locCh = ( localMod > mLastCalendarSync ); |
957 | if ( !remCh && ! locCh ) { | 957 | if ( !remCh && ! locCh ) { |
958 | //qDebug("both not changed "); | 958 | //qDebug("both not changed "); |
959 | lastSync = localMod.addDays(1); | 959 | lastSync = localMod.addDays(1); |
960 | if ( mode <= SYNC_PREF_ASK ) | 960 | if ( mode <= SYNC_PREF_ASK ) |
961 | return 0; | 961 | return 0; |
962 | } else { | 962 | } else { |
963 | if ( locCh ) { | 963 | if ( locCh ) { |
964 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 964 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
965 | lastSync = localMod.addDays( -1 ); | 965 | lastSync = localMod.addDays( -1 ); |
966 | if ( !remCh ) | 966 | if ( !remCh ) |
967 | remoteMod = ( lastSync.addDays( -1 ) ); | 967 | remoteMod = ( lastSync.addDays( -1 ) ); |
968 | } else { | 968 | } else { |
969 | //qDebug(" not loc changed "); | 969 | //qDebug(" not loc changed "); |
970 | lastSync = localMod.addDays( 1 ); | 970 | lastSync = localMod.addDays( 1 ); |
971 | if ( remCh ) | 971 | if ( remCh ) |
972 | remoteMod =( lastSync.addDays( 1 ) ); | 972 | remoteMod =( lastSync.addDays( 1 ) ); |
973 | 973 | ||
974 | } | 974 | } |
975 | } | 975 | } |
976 | full = true; | 976 | full = true; |
977 | if ( mode < SYNC_PREF_ASK ) | 977 | if ( mode < SYNC_PREF_ASK ) |
978 | mode = SYNC_PREF_ASK; | 978 | mode = SYNC_PREF_ASK; |
979 | } else { | 979 | } else { |
980 | if ( localMod == remoteMod ) | 980 | if ( localMod == remoteMod ) |
981 | // if ( local->revision() == remote->revision() ) | 981 | // if ( local->revision() == remote->revision() ) |
982 | return 0; | 982 | return 0; |
983 | 983 | ||
984 | } | 984 | } |
985 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 985 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
986 | 986 | ||
987 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 987 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
988 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 988 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
989 | //full = true; //debug only | 989 | //full = true; //debug only |
990 | if ( full ) { | 990 | if ( full ) { |
991 | bool equ = false; | 991 | bool equ = false; |
992 | if ( local->typeID() == eventID ) { | 992 | if ( local->typeID() == eventID ) { |
993 | equ = (*((Event*) local) == *((Event*) remote)); | 993 | equ = (*((Event*) local) == *((Event*) remote)); |
994 | } | 994 | } |
995 | else if ( local->typeID() == todoID ) | 995 | else if ( local->typeID() == todoID ) |
996 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 996 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
997 | else if ( local->typeID() == journalID ) | 997 | else if ( local->typeID() == journalID ) |
998 | equ = (*((Journal*) local) == *((Journal*) remote)); | 998 | equ = (*((Journal*) local) == *((Journal*) remote)); |
999 | if ( equ ) { | 999 | if ( equ ) { |
1000 | //qDebug("equal "); | 1000 | //qDebug("equal "); |
1001 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1001 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1002 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 1002 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
1003 | } | 1003 | } |
1004 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 1004 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
1005 | return 0; | 1005 | return 0; |
1006 | 1006 | ||
1007 | }//else //debug only | 1007 | }//else //debug only |
1008 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 1008 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
1009 | } | 1009 | } |
1010 | int result; | 1010 | int result; |
1011 | bool localIsNew; | 1011 | bool localIsNew; |
1012 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 1012 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
1013 | 1013 | ||
1014 | 1014 | ||
1015 | // ************************************************ | 1015 | // ************************************************ |
1016 | // ************************************************ | 1016 | // ************************************************ |
1017 | // ************************************************ | 1017 | // ************************************************ |
1018 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1018 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1019 | // BUT remoteMod != localMod | 1019 | // BUT remoteMod != localMod |
1020 | 1020 | ||
1021 | 1021 | ||
1022 | if ( full && mode < SYNC_PREF_NEWEST ) | 1022 | if ( full && mode < SYNC_PREF_NEWEST ) |
1023 | mode = SYNC_PREF_ASK; | 1023 | mode = SYNC_PREF_ASK; |
1024 | 1024 | ||
1025 | switch( mode ) { | 1025 | switch( mode ) { |
1026 | case SYNC_PREF_LOCAL: | 1026 | case SYNC_PREF_LOCAL: |
1027 | if ( lastSync > remoteMod ) | 1027 | if ( lastSync > remoteMod ) |
1028 | return 1; | 1028 | return 1; |
1029 | if ( lastSync > localMod ) | 1029 | if ( lastSync > localMod ) |
1030 | return 2; | 1030 | return 2; |
1031 | return 1; | 1031 | return 1; |
1032 | break; | 1032 | break; |
1033 | case SYNC_PREF_REMOTE: | 1033 | case SYNC_PREF_REMOTE: |
1034 | if ( lastSync > localMod ) | 1034 | if ( lastSync > localMod ) |
1035 | return 2; | 1035 | return 2; |
1036 | if ( lastSync > remoteMod ) | 1036 | if ( lastSync > remoteMod ) |
1037 | return 1; | 1037 | return 1; |
1038 | return 2; | 1038 | return 2; |
1039 | break; | 1039 | break; |
1040 | case SYNC_PREF_NEWEST: | 1040 | case SYNC_PREF_NEWEST: |
1041 | if ( localMod >= remoteMod ) | 1041 | if ( localMod >= remoteMod ) |
1042 | return 1; | 1042 | return 1; |
1043 | else | 1043 | else |
1044 | return 2; | 1044 | return 2; |
1045 | break; | 1045 | break; |
1046 | case SYNC_PREF_ASK: | 1046 | case SYNC_PREF_ASK: |
1047 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1047 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1048 | if ( lastSync > remoteMod && lastSync > localMod) | 1048 | if ( lastSync > remoteMod && lastSync > localMod) |
1049 | return 0; | 1049 | return 0; |
1050 | if ( lastSync > remoteMod ) | 1050 | if ( lastSync > remoteMod ) |
1051 | return 1; | 1051 | return 1; |
1052 | if ( lastSync > localMod ) | 1052 | if ( lastSync > localMod ) |
1053 | return 2; | 1053 | return 2; |
1054 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1054 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1055 | localIsNew = localMod >= remoteMod; | 1055 | localIsNew = localMod >= remoteMod; |
1056 | if ( localIsNew ) | 1056 | if ( localIsNew ) |
1057 | getEventViewerDialog()->setColorMode( 1 ); | 1057 | getEventViewerDialog()->setColorMode( 1 ); |
1058 | else | 1058 | else |
1059 | getEventViewerDialog()->setColorMode( 2 ); | 1059 | getEventViewerDialog()->setColorMode( 2 ); |
1060 | getEventViewerDialog()->setIncidence(local); | 1060 | getEventViewerDialog()->setIncidence(local); |
1061 | if ( localIsNew ) | 1061 | if ( localIsNew ) |
1062 | getEventViewerDialog()->setColorMode( 2 ); | 1062 | getEventViewerDialog()->setColorMode( 2 ); |
1063 | else | 1063 | else |
1064 | getEventViewerDialog()->setColorMode( 1 ); | 1064 | getEventViewerDialog()->setColorMode( 1 ); |
1065 | getEventViewerDialog()->addIncidence(remote); | 1065 | getEventViewerDialog()->addIncidence(remote); |
1066 | getEventViewerDialog()->setColorMode( 0 ); | 1066 | getEventViewerDialog()->setColorMode( 0 ); |
1067 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 1067 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
1068 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 1068 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
1069 | getEventViewerDialog()->showMe(); | 1069 | getEventViewerDialog()->showMe(); |
1070 | result = getEventViewerDialog()->executeS( localIsNew ); | 1070 | result = getEventViewerDialog()->executeS( localIsNew ); |
1071 | return result; | 1071 | return result; |
1072 | 1072 | ||
1073 | break; | 1073 | break; |
1074 | case SYNC_PREF_FORCE_LOCAL: | 1074 | case SYNC_PREF_FORCE_LOCAL: |
1075 | return 1; | 1075 | return 1; |
1076 | break; | 1076 | break; |
1077 | case SYNC_PREF_FORCE_REMOTE: | 1077 | case SYNC_PREF_FORCE_REMOTE: |
1078 | return 2; | 1078 | return 2; |
1079 | break; | 1079 | break; |
1080 | 1080 | ||
1081 | default: | 1081 | default: |
1082 | // SYNC_PREF_TAKE_BOTH not implemented | 1082 | // SYNC_PREF_TAKE_BOTH not implemented |
1083 | break; | 1083 | break; |
1084 | } | 1084 | } |
1085 | return 0; | 1085 | return 0; |
1086 | } | 1086 | } |
1087 | Event* CalendarView::getLastSyncEvent() | 1087 | Event* CalendarView::getLastSyncEvent() |
1088 | { | 1088 | { |
1089 | Event* lse; | 1089 | Event* lse; |
1090 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1090 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1091 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1091 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1092 | if (!lse) { | 1092 | if (!lse) { |
1093 | lse = new Event(); | 1093 | lse = new Event(); |
1094 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1094 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1095 | QString sum = ""; | 1095 | QString sum = ""; |
1096 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1096 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1097 | sum = "E: "; | 1097 | sum = "E: "; |
1098 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1098 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1099 | lse->setDtStart( mLastCalendarSync ); | 1099 | lse->setDtStart( mLastCalendarSync ); |
1100 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1100 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1101 | lse->setCategories( i18n("SyncEvent") ); | 1101 | lse->setCategories( i18n("SyncEvent") ); |
1102 | lse->setReadOnly( true ); | 1102 | lse->setReadOnly( true ); |
1103 | mCalendar->addEvent( lse ); | 1103 | mCalendar->addEvent( lse ); |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | return lse; | 1106 | return lse; |
1107 | 1107 | ||
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | // we check, if the to delete event has a id for a profile | 1110 | // we check, if the to delete event has a id for a profile |
1111 | // if yes, we set this id in the profile to delete | 1111 | // if yes, we set this id in the profile to delete |
1112 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1112 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1113 | { | 1113 | { |
1114 | if ( lastSync.count() == 0 ) { | 1114 | if ( lastSync.count() == 0 ) { |
1115 | //qDebug(" lastSync.count() == 0"); | 1115 | //qDebug(" lastSync.count() == 0"); |
1116 | return; | 1116 | return; |
1117 | } | 1117 | } |
1118 | if ( toDelete->typeID() == journalID ) | 1118 | if ( toDelete->typeID() == journalID ) |
1119 | return; | 1119 | return; |
1120 | 1120 | ||
1121 | Event* eve = lastSync.first(); | 1121 | Event* eve = lastSync.first(); |
1122 | 1122 | ||
1123 | while ( eve ) { | 1123 | while ( eve ) { |
1124 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1124 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1125 | if ( !id.isEmpty() ) { | 1125 | if ( !id.isEmpty() ) { |
1126 | QString des = eve->description(); | 1126 | QString des = eve->description(); |
1127 | QString pref = "e"; | 1127 | QString pref = "e"; |
1128 | if ( toDelete->typeID() == todoID ) | 1128 | if ( toDelete->typeID() == todoID ) |
1129 | pref = "t"; | 1129 | pref = "t"; |
1130 | des += pref+ id + ","; | 1130 | des += pref+ id + ","; |
1131 | eve->setReadOnly( false ); | 1131 | eve->setReadOnly( false ); |
1132 | eve->setDescription( des ); | 1132 | eve->setDescription( des ); |
1133 | //qDebug("setdes %s ", des.latin1()); | 1133 | //qDebug("setdes %s ", des.latin1()); |
1134 | eve->setReadOnly( true ); | 1134 | eve->setReadOnly( true ); |
1135 | } | 1135 | } |
1136 | eve = lastSync.next(); | 1136 | eve = lastSync.next(); |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | } | 1139 | } |
1140 | void CalendarView::checkExternalId( Incidence * inc ) | 1140 | void CalendarView::checkExternalId( Incidence * inc ) |
1141 | { | 1141 | { |
1142 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1142 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1143 | checkExternSyncEvent( lastSync, inc ); | 1143 | checkExternSyncEvent( lastSync, inc ); |
1144 | 1144 | ||
1145 | } | 1145 | } |
1146 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1146 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1147 | { | 1147 | { |
1148 | bool syncOK = true; | 1148 | bool syncOK = true; |
1149 | int addedEvent = 0; | 1149 | int addedEvent = 0; |
1150 | int addedEventR = 0; | 1150 | int addedEventR = 0; |
1151 | int deletedEventR = 0; | 1151 | int deletedEventR = 0; |
1152 | int deletedEventL = 0; | 1152 | int deletedEventL = 0; |
1153 | int changedLocal = 0; | 1153 | int changedLocal = 0; |
1154 | int changedRemote = 0; | 1154 | int changedRemote = 0; |
1155 | int filteredIN = 0; | 1155 | int filteredIN = 0; |
1156 | int filteredOUT = 0; | 1156 | int filteredOUT = 0; |
1157 | //QPtrList<Event> el = local->rawEvents(); | 1157 | //QPtrList<Event> el = local->rawEvents(); |
1158 | Event* eventR; | 1158 | Event* eventR; |
1159 | QString uid; | 1159 | QString uid; |
1160 | int take; | 1160 | int take; |
1161 | Event* eventL; | 1161 | Event* eventL; |
1162 | Event* eventRSync; | 1162 | Event* eventRSync; |
1163 | Event* eventLSync; | 1163 | Event* eventLSync; |
1164 | clearAllViews(); | 1164 | clearAllViews(); |
1165 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1165 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1166 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1166 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1167 | bool fullDateRange = false; | 1167 | bool fullDateRange = false; |
1168 | local->resetTempSyncStat(); | 1168 | local->resetTempSyncStat(); |
1169 | mLastCalendarSync = QDateTime::currentDateTime(); | 1169 | mLastCalendarSync = QDateTime::currentDateTime(); |
1170 | if ( mSyncManager->syncWithDesktop() ) { | 1170 | if ( mSyncManager->syncWithDesktop() ) { |
1171 | remote->resetPilotStat(1); | 1171 | remote->resetPilotStat(1); |
1172 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1172 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1173 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1173 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1174 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1174 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1175 | } else { | 1175 | } else { |
1176 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1176 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1177 | } | 1177 | } |
1178 | } | 1178 | } |
1179 | QDateTime modifiedCalendar = mLastCalendarSync; | 1179 | QDateTime modifiedCalendar = mLastCalendarSync; |
1180 | eventLSync = getLastSyncEvent(); | 1180 | eventLSync = getLastSyncEvent(); |
1181 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1181 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1182 | if ( eventR ) { | 1182 | if ( eventR ) { |
1183 | eventRSync = (Event*) eventR->clone(); | 1183 | eventRSync = (Event*) eventR->clone(); |
1184 | remote->deleteEvent(eventR ); | 1184 | remote->deleteEvent(eventR ); |
1185 | 1185 | ||
1186 | } else { | 1186 | } else { |
1187 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1187 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1188 | eventRSync = (Event*)eventLSync->clone(); | 1188 | eventRSync = (Event*)eventLSync->clone(); |
1189 | } else { | 1189 | } else { |
1190 | fullDateRange = true; | 1190 | fullDateRange = true; |
1191 | eventRSync = new Event(); | 1191 | eventRSync = new Event(); |
1192 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1192 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1193 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1193 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1194 | eventRSync->setDtStart( mLastCalendarSync ); | 1194 | eventRSync->setDtStart( mLastCalendarSync ); |
1195 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1195 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1196 | eventRSync->setCategories( i18n("SyncEvent") ); | 1196 | eventRSync->setCategories( i18n("SyncEvent") ); |
1197 | } | 1197 | } |
1198 | } | 1198 | } |
1199 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1199 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1200 | fullDateRange = true; | 1200 | fullDateRange = true; |
1201 | 1201 | ||
1202 | if ( ! fullDateRange ) { | 1202 | if ( ! fullDateRange ) { |
1203 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1203 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1204 | 1204 | ||
1205 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1205 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1206 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1206 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1207 | fullDateRange = true; | 1207 | fullDateRange = true; |
1208 | } | 1208 | } |
1209 | } | 1209 | } |
1210 | if ( mSyncManager->syncWithDesktop() ) { | 1210 | if ( mSyncManager->syncWithDesktop() ) { |
1211 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1211 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1212 | } | 1212 | } |
1213 | if ( fullDateRange ) | 1213 | if ( fullDateRange ) |
1214 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1214 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1215 | else | 1215 | else |
1216 | mLastCalendarSync = eventLSync->dtStart(); | 1216 | mLastCalendarSync = eventLSync->dtStart(); |
1217 | // for resyncing if own file has changed | 1217 | // for resyncing if own file has changed |
1218 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1218 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1219 | mLastCalendarSync = loadedFileVersion; | 1219 | mLastCalendarSync = loadedFileVersion; |
1220 | //qDebug("setting mLastCalendarSync "); | 1220 | //qDebug("setting mLastCalendarSync "); |
1221 | } | 1221 | } |
1222 | //qDebug("*************************** "); | 1222 | //qDebug("*************************** "); |
1223 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1223 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1224 | QPtrList<Incidence> er = remote->rawIncidences(); | 1224 | QPtrList<Incidence> er = remote->rawIncidences(); |
1225 | Incidence* inR = er.first(); | 1225 | Incidence* inR = er.first(); |
1226 | Incidence* inL; | 1226 | Incidence* inL; |
1227 | QProgressBar bar( er.count(),0 ); | 1227 | QProgressBar bar( er.count(),0 ); |
1228 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1228 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1229 | 1229 | ||
1230 | // ************** setting up filter ************* | 1230 | // ************** setting up filter ************* |
1231 | CalFilter *filterIN = 0; | 1231 | CalFilter *filterIN = 0; |
1232 | CalFilter *filterOUT = 0; | 1232 | CalFilter *filterOUT = 0; |
1233 | CalFilter *filter = mFilters.first(); | 1233 | CalFilter *filter = mFilters.first(); |
1234 | while(filter) { | 1234 | while(filter) { |
1235 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1235 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1236 | filterIN = filter; | 1236 | filterIN = filter; |
1237 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1237 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1238 | filterOUT = filter; | 1238 | filterOUT = filter; |
1239 | filter = mFilters.next(); | 1239 | filter = mFilters.next(); |
1240 | } | 1240 | } |
1241 | int w = 300; | 1241 | int w = 300; |
1242 | if ( QApplication::desktop()->width() < 320 ) | 1242 | if ( QApplication::desktop()->width() < 320 ) |
1243 | w = 220; | 1243 | w = 220; |
1244 | int h = bar.sizeHint().height() ; | 1244 | int h = bar.sizeHint().height() ; |
1245 | int dw = QApplication::desktop()->width(); | 1245 | int dw = QApplication::desktop()->width(); |
1246 | int dh = QApplication::desktop()->height(); | 1246 | int dh = QApplication::desktop()->height(); |
1247 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1247 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1248 | bar.show(); | 1248 | bar.show(); |
1249 | int modulo = (er.count()/10)+1; | 1249 | int modulo = (er.count()/10)+1; |
1250 | int incCounter = 0; | 1250 | int incCounter = 0; |
1251 | while ( inR ) { | 1251 | while ( inR ) { |
1252 | if ( ! bar.isVisible() ) | 1252 | if ( ! bar.isVisible() ) |
1253 | return false; | 1253 | return false; |
1254 | if ( incCounter % modulo == 0 ) | 1254 | if ( incCounter % modulo == 0 ) |
1255 | bar.setProgress( incCounter ); | 1255 | bar.setProgress( incCounter ); |
1256 | ++incCounter; | 1256 | ++incCounter; |
1257 | uid = inR->uid(); | 1257 | uid = inR->uid(); |
1258 | bool skipIncidence = false; | 1258 | bool skipIncidence = false; |
1259 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1259 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1260 | skipIncidence = true; | 1260 | skipIncidence = true; |
1261 | QString idS; | 1261 | QString idS; |
1262 | qApp->processEvents(); | 1262 | qApp->processEvents(); |
1263 | if ( !skipIncidence ) { | 1263 | if ( !skipIncidence ) { |
1264 | inL = local->incidence( uid ); | 1264 | inL = local->incidence( uid ); |
1265 | if ( inL ) { // maybe conflict - same uid in both calendars | 1265 | if ( inL ) { // maybe conflict - same uid in both calendars |
1266 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1266 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1267 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1267 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1268 | if ( take == 3 ) | 1268 | if ( take == 3 ) |
1269 | return false; | 1269 | return false; |
1270 | if ( take == 1 ) {// take local ********************** | 1270 | if ( take == 1 ) {// take local ********************** |
1271 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1271 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1272 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1272 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1273 | else | 1273 | else |
1274 | idS = inR->IDStr(); | 1274 | idS = inR->IDStr(); |
1275 | remote->deleteIncidence( inR ); | 1275 | remote->deleteIncidence( inR ); |
1276 | inR = inL->clone(); | 1276 | inR = inL->clone(); |
1277 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1277 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1278 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1278 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1279 | inR->setIDStr( idS ); | 1279 | inR->setIDStr( idS ); |
1280 | remote->addIncidence( inR ); | 1280 | remote->addIncidence( inR ); |
1281 | if ( mSyncManager->syncWithDesktop() ) | 1281 | if ( mSyncManager->syncWithDesktop() ) |
1282 | inR->setPilotId( 2 ); | 1282 | inR->setPilotId( 2 ); |
1283 | ++changedRemote; | 1283 | ++changedRemote; |
1284 | } else {// take remote ********************** | 1284 | } else {// take remote ********************** |
1285 | idS = inL->IDStr(); | 1285 | idS = inL->IDStr(); |
1286 | int pid = inL->pilotId(); | 1286 | int pid = inL->pilotId(); |
1287 | local->deleteIncidence( inL ); | 1287 | local->deleteIncidence( inL ); |
1288 | inL = inR->clone(); | 1288 | inL = inR->clone(); |
1289 | if ( mSyncManager->syncWithDesktop() ) | 1289 | if ( mSyncManager->syncWithDesktop() ) |
1290 | inL->setPilotId( pid ); | 1290 | inL->setPilotId( pid ); |
1291 | inL->setIDStr( idS ); | 1291 | inL->setIDStr( idS ); |
1292 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1292 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1293 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1293 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1294 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1294 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1295 | } | 1295 | } |
1296 | local->addIncidence( inL ); | 1296 | local->addIncidence( inL ); |
1297 | ++changedLocal; | 1297 | ++changedLocal; |
1298 | } | 1298 | } |
1299 | } | 1299 | } |
1300 | } else { // no conflict ********** add or delete remote | 1300 | } else { // no conflict ********** add or delete remote |
1301 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1301 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1302 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1302 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1303 | QString des = eventLSync->description(); | 1303 | QString des = eventLSync->description(); |
1304 | QString pref = "e"; | 1304 | QString pref = "e"; |
1305 | if ( inR->typeID() == todoID ) | 1305 | if ( inR->typeID() == todoID ) |
1306 | pref = "t"; | 1306 | pref = "t"; |
1307 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1307 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1308 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1308 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1309 | //remote->deleteIncidence( inR ); | 1309 | //remote->deleteIncidence( inR ); |
1310 | ++deletedEventR; | 1310 | ++deletedEventR; |
1311 | } else { | 1311 | } else { |
1312 | inR->setLastModified( modifiedCalendar ); | 1312 | inR->setLastModified( modifiedCalendar ); |
1313 | inL = inR->clone(); | 1313 | inL = inR->clone(); |
1314 | inL->setIDStr( ":" ); | 1314 | inL->setIDStr( ":" ); |
1315 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1315 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1316 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1316 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1317 | local->addIncidence( inL ); | 1317 | local->addIncidence( inL ); |
1318 | ++addedEvent; | 1318 | ++addedEvent; |
1319 | 1319 | ||
1320 | } | 1320 | } |
1321 | } else { | 1321 | } else { |
1322 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1322 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1323 | inR->setLastModified( modifiedCalendar ); | 1323 | inR->setLastModified( modifiedCalendar ); |
1324 | inL = inR->clone(); | 1324 | inL = inR->clone(); |
1325 | inL->setIDStr( ":" ); | 1325 | inL->setIDStr( ":" ); |
1326 | local->addIncidence( inL ); | 1326 | local->addIncidence( inL ); |
1327 | ++addedEvent; | 1327 | ++addedEvent; |
1328 | 1328 | ||
1329 | } else { | 1329 | } else { |
1330 | checkExternSyncEvent(eventRSyncSharp, inR); | 1330 | checkExternSyncEvent(eventRSyncSharp, inR); |
1331 | remote->deleteIncidence( inR ); | 1331 | remote->deleteIncidence( inR ); |
1332 | ++deletedEventR; | 1332 | ++deletedEventR; |
1333 | } | 1333 | } |
1334 | } | 1334 | } |
1335 | } else { | 1335 | } else { |
1336 | ++filteredIN; | 1336 | ++filteredIN; |
1337 | } | 1337 | } |
1338 | } | 1338 | } |
1339 | } | 1339 | } |
1340 | inR = er.next(); | 1340 | inR = er.next(); |
1341 | } | 1341 | } |
1342 | QPtrList<Incidence> el = local->rawIncidences(); | 1342 | QPtrList<Incidence> el = local->rawIncidences(); |
1343 | inL = el.first(); | 1343 | inL = el.first(); |
1344 | modulo = (el.count()/10)+1; | 1344 | modulo = (el.count()/10)+1; |
1345 | bar.setCaption (i18n("Add / remove events") ); | 1345 | bar.setCaption (i18n("Add / remove events") ); |
1346 | bar.setTotalSteps ( el.count() ) ; | 1346 | bar.setTotalSteps ( el.count() ) ; |
1347 | bar.show(); | 1347 | bar.show(); |
1348 | incCounter = 0; | 1348 | incCounter = 0; |
1349 | 1349 | ||
1350 | while ( inL ) { | 1350 | while ( inL ) { |
1351 | 1351 | ||
1352 | qApp->processEvents(); | 1352 | qApp->processEvents(); |
1353 | if ( ! bar.isVisible() ) | 1353 | if ( ! bar.isVisible() ) |
1354 | return false; | 1354 | return false; |
1355 | if ( incCounter % modulo == 0 ) | 1355 | if ( incCounter % modulo == 0 ) |
1356 | bar.setProgress( incCounter ); | 1356 | bar.setProgress( incCounter ); |
1357 | ++incCounter; | 1357 | ++incCounter; |
1358 | uid = inL->uid(); | 1358 | uid = inL->uid(); |
1359 | bool skipIncidence = false; | 1359 | bool skipIncidence = false; |
1360 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1360 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1361 | skipIncidence = true; | 1361 | skipIncidence = true; |
1362 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1362 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1363 | skipIncidence = true; | 1363 | skipIncidence = true; |
1364 | if ( !skipIncidence ) { | 1364 | if ( !skipIncidence ) { |
1365 | inR = remote->incidence( uid ); | 1365 | inR = remote->incidence( uid ); |
1366 | if ( ! inR ) { | 1366 | if ( ! inR ) { |
1367 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1367 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1368 | // no conflict ********** add or delete local | 1368 | // no conflict ********** add or delete local |
1369 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1369 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1370 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1370 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1371 | checkExternSyncEvent(eventLSyncSharp, inL); | 1371 | checkExternSyncEvent(eventLSyncSharp, inL); |
1372 | local->deleteIncidence( inL ); | 1372 | local->deleteIncidence( inL ); |
1373 | ++deletedEventL; | 1373 | ++deletedEventL; |
1374 | } else { | 1374 | } else { |
1375 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1375 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1376 | inL->removeID(mCurrentSyncDevice ); | 1376 | inL->removeID(mCurrentSyncDevice ); |
1377 | ++addedEventR; | 1377 | ++addedEventR; |
1378 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1378 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1379 | inL->setLastModified( modifiedCalendar ); | 1379 | inL->setLastModified( modifiedCalendar ); |
1380 | inR = inL->clone(); | 1380 | inR = inL->clone(); |
1381 | inR->setIDStr( ":" ); | 1381 | inR->setIDStr( ":" ); |
1382 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1382 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1383 | remote->addIncidence( inR ); | 1383 | remote->addIncidence( inR ); |
1384 | } | 1384 | } |
1385 | } | 1385 | } |
1386 | } else { | 1386 | } else { |
1387 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1387 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1388 | checkExternSyncEvent(eventLSyncSharp, inL); | 1388 | checkExternSyncEvent(eventLSyncSharp, inL); |
1389 | local->deleteIncidence( inL ); | 1389 | local->deleteIncidence( inL ); |
1390 | ++deletedEventL; | 1390 | ++deletedEventL; |
1391 | } else { | 1391 | } else { |
1392 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1392 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1393 | ++addedEventR; | 1393 | ++addedEventR; |
1394 | inL->setLastModified( modifiedCalendar ); | 1394 | inL->setLastModified( modifiedCalendar ); |
1395 | inR = inL->clone(); | 1395 | inR = inL->clone(); |
1396 | inR->setIDStr( ":" ); | 1396 | inR->setIDStr( ":" ); |
1397 | remote->addIncidence( inR ); | 1397 | remote->addIncidence( inR ); |
1398 | } | 1398 | } |
1399 | } | 1399 | } |
1400 | } | 1400 | } |
1401 | } else { | 1401 | } else { |
1402 | ++filteredOUT; | 1402 | ++filteredOUT; |
1403 | } | 1403 | } |
1404 | } | 1404 | } |
1405 | } | 1405 | } |
1406 | inL = el.next(); | 1406 | inL = el.next(); |
1407 | } | 1407 | } |
1408 | int delFut = 0; | 1408 | int delFut = 0; |
1409 | int remRem = 0; | 1409 | int remRem = 0; |
1410 | if ( mSyncManager->mWriteBackInFuture ) { | 1410 | if ( mSyncManager->mWriteBackInFuture ) { |
1411 | er = remote->rawIncidences(); | 1411 | er = remote->rawIncidences(); |
1412 | remRem = er.count(); | 1412 | remRem = er.count(); |
1413 | inR = er.first(); | 1413 | inR = er.first(); |
1414 | QDateTime dt; | 1414 | QDateTime dt; |
1415 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1415 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1416 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1416 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1417 | while ( inR ) { | 1417 | while ( inR ) { |
1418 | if ( inR->typeID() == todoID ) { | 1418 | if ( inR->typeID() == todoID ) { |
1419 | Todo * t = (Todo*)inR; | 1419 | Todo * t = (Todo*)inR; |
1420 | if ( t->hasDueDate() ) | 1420 | if ( t->hasDueDate() ) |
1421 | dt = t->dtDue(); | 1421 | dt = t->dtDue(); |
1422 | else | 1422 | else |
1423 | dt = cur.addSecs( 62 ); | 1423 | dt = cur.addSecs( 62 ); |
1424 | } | 1424 | } |
1425 | else if (inR->typeID() == eventID ) { | 1425 | else if (inR->typeID() == eventID ) { |
1426 | bool ok; | 1426 | bool ok; |
1427 | dt = inR->getNextOccurence( cur, &ok ); | 1427 | dt = inR->getNextOccurence( cur, &ok ); |
1428 | if ( !ok ) | 1428 | if ( !ok ) |
1429 | dt = cur.addSecs( -62 ); | 1429 | dt = cur.addSecs( -62 ); |
1430 | } | 1430 | } |
1431 | else | 1431 | else |
1432 | dt = inR->dtStart(); | 1432 | dt = inR->dtStart(); |
1433 | if ( dt < cur || dt > end ) { | 1433 | if ( dt < cur || dt > end ) { |
1434 | remote->deleteIncidence( inR ); | 1434 | remote->deleteIncidence( inR ); |
1435 | ++delFut; | 1435 | ++delFut; |
1436 | } | 1436 | } |
1437 | inR = er.next(); | 1437 | inR = er.next(); |
1438 | } | 1438 | } |
1439 | } | 1439 | } |
1440 | bar.hide(); | 1440 | bar.hide(); |
1441 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1441 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1442 | eventLSync->setReadOnly( false ); | 1442 | eventLSync->setReadOnly( false ); |
1443 | eventLSync->setDtStart( mLastCalendarSync ); | 1443 | eventLSync->setDtStart( mLastCalendarSync ); |
1444 | eventRSync->setDtStart( mLastCalendarSync ); | 1444 | eventRSync->setDtStart( mLastCalendarSync ); |
1445 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1445 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1446 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1446 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1447 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1447 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1448 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1448 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1449 | eventLSync->setReadOnly( true ); | 1449 | eventLSync->setReadOnly( true ); |
1450 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1450 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1451 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1451 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1452 | remote->addEvent( eventRSync ); | 1452 | remote->addEvent( eventRSync ); |
1453 | else | 1453 | else |
1454 | delete eventRSync; | 1454 | delete eventRSync; |
1455 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1455 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1456 | QString mes; | 1456 | QString mes; |
1457 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); | 1457 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); |
1458 | QString delmess; | 1458 | QString delmess; |
1459 | if ( delFut ) { | 1459 | if ( delFut ) { |
1460 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1460 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1461 | mes += delmess; | 1461 | mes += delmess; |
1462 | } | 1462 | } |
1463 | mes = i18n("Local calendar changed!\n") +mes; | 1463 | mes = i18n("Local calendar changed!\n") +mes; |
1464 | mCalendar->checkAlarmForIncidence( 0, true ); | 1464 | mCalendar->checkAlarmForIncidence( 0, true ); |
1465 | qDebug( mes ); | 1465 | qDebug( mes ); |
1466 | if ( mSyncManager->mShowSyncSummary ) { | 1466 | if ( mSyncManager->mShowSyncSummary ) { |
1467 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1467 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1468 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1468 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1469 | qDebug("KO: WB cancelled "); | 1469 | qDebug("KO: WB cancelled "); |
1470 | mSyncManager->mWriteBackFile = false; | 1470 | mSyncManager->mWriteBackFile = false; |
1471 | return syncOK; | 1471 | return syncOK; |
1472 | } | 1472 | } |
1473 | } | 1473 | } |
1474 | return syncOK; | 1474 | return syncOK; |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | void CalendarView::setSyncDevice( QString s ) | 1477 | void CalendarView::setSyncDevice( QString s ) |
1478 | { | 1478 | { |
1479 | mCurrentSyncDevice= s; | 1479 | mCurrentSyncDevice= s; |
1480 | } | 1480 | } |
1481 | void CalendarView::setSyncName( QString s ) | 1481 | void CalendarView::setSyncName( QString s ) |
1482 | { | 1482 | { |
1483 | mCurrentSyncName= s; | 1483 | mCurrentSyncName= s; |
1484 | } | 1484 | } |
1485 | bool CalendarView::syncCalendar(QString filename, int mode) | 1485 | bool CalendarView::syncCalendar(QString filename, int mode) |
1486 | { | 1486 | { |
1487 | //qDebug("syncCalendar %s ", filename.latin1()); | 1487 | //qDebug("syncCalendar %s ", filename.latin1()); |
1488 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1488 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1489 | CalendarLocal* calendar = new CalendarLocal(); | 1489 | CalendarLocal* calendar = new CalendarLocal(); |
1490 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1490 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1491 | FileStorage* storage = new FileStorage( calendar ); | 1491 | FileStorage* storage = new FileStorage( calendar ); |
1492 | bool syncOK = false; | 1492 | bool syncOK = false; |
1493 | storage->setFileName( filename ); | 1493 | storage->setFileName( filename ); |
1494 | // qDebug("loading ... "); | 1494 | // qDebug("loading ... "); |
1495 | if ( storage->load() ) { | 1495 | if ( storage->load() ) { |
1496 | getEventViewerDialog()->setSyncMode( true ); | 1496 | getEventViewerDialog()->setSyncMode( true ); |
1497 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1497 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1498 | getEventViewerDialog()->setSyncMode( false ); | 1498 | getEventViewerDialog()->setSyncMode( false ); |
1499 | if ( syncOK ) { | 1499 | if ( syncOK ) { |
1500 | if ( mSyncManager->mWriteBackFile ) | 1500 | if ( mSyncManager->mWriteBackFile ) |
1501 | { | 1501 | { |
1502 | storage->setSaveFormat( new ICalFormat() ); | 1502 | storage->setSaveFormat( new ICalFormat() ); |
1503 | storage->save(); | 1503 | storage->save(); |
1504 | } | 1504 | } |
1505 | } | 1505 | } |
1506 | setModified( true ); | 1506 | setModified( true ); |
1507 | } | 1507 | } |
1508 | delete storage; | 1508 | delete storage; |
1509 | delete calendar; | 1509 | delete calendar; |
1510 | if ( syncOK ) | 1510 | if ( syncOK ) |
1511 | updateView(); | 1511 | updateView(); |
1512 | return syncOK; | 1512 | return syncOK; |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | void CalendarView::syncExternal( int mode ) | 1515 | void CalendarView::syncExternal( int mode ) |
1516 | { | 1516 | { |
1517 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1517 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1518 | 1518 | ||
1519 | qApp->processEvents(); | 1519 | qApp->processEvents(); |
1520 | CalendarLocal* calendar = new CalendarLocal(); | 1520 | CalendarLocal* calendar = new CalendarLocal(); |
1521 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1521 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1522 | bool syncOK = false; | 1522 | bool syncOK = false; |
1523 | bool loadSuccess = false; | 1523 | bool loadSuccess = false; |
1524 | PhoneFormat* phoneFormat = 0; | 1524 | PhoneFormat* phoneFormat = 0; |
1525 | emit tempDisableBR(true); | 1525 | emit tempDisableBR(true); |
1526 | #ifndef DESKTOP_VERSION | 1526 | #ifndef DESKTOP_VERSION |
1527 | SharpFormat* sharpFormat = 0; | 1527 | SharpFormat* sharpFormat = 0; |
1528 | if ( mode == 0 ) { // sharp | 1528 | if ( mode == 0 ) { // sharp |
1529 | sharpFormat = new SharpFormat () ; | 1529 | sharpFormat = new SharpFormat () ; |
1530 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1530 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1531 | 1531 | ||
1532 | } else | 1532 | } else |
1533 | #endif | 1533 | #endif |
1534 | if ( mode == 1 ) { // phone | 1534 | if ( mode == 1 ) { // phone |
1535 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1535 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1536 | mSyncManager->mPhoneDevice, | 1536 | mSyncManager->mPhoneDevice, |
1537 | mSyncManager->mPhoneConnection, | 1537 | mSyncManager->mPhoneConnection, |
1538 | mSyncManager->mPhoneModel); | 1538 | mSyncManager->mPhoneModel); |
1539 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1539 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1540 | 1540 | ||
1541 | } else { | 1541 | } else { |
1542 | emit tempDisableBR(false); | 1542 | emit tempDisableBR(false); |
1543 | return; | 1543 | return; |
1544 | } | 1544 | } |
1545 | if ( loadSuccess ) { | 1545 | if ( loadSuccess ) { |
1546 | getEventViewerDialog()->setSyncMode( true ); | 1546 | getEventViewerDialog()->setSyncMode( true ); |
1547 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1547 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1548 | getEventViewerDialog()->setSyncMode( false ); | 1548 | getEventViewerDialog()->setSyncMode( false ); |
1549 | qApp->processEvents(); | 1549 | qApp->processEvents(); |
1550 | if ( syncOK ) { | 1550 | if ( syncOK ) { |
1551 | if ( mSyncManager->mWriteBackFile ) | 1551 | if ( mSyncManager->mWriteBackFile ) |
1552 | { | 1552 | { |
1553 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1553 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1554 | Incidence* inc = iL.first(); | 1554 | Incidence* inc = iL.first(); |
1555 | if ( phoneFormat ) { | 1555 | if ( phoneFormat ) { |
1556 | while ( inc ) { | 1556 | while ( inc ) { |
1557 | inc->removeID(mCurrentSyncDevice); | 1557 | inc->removeID(mCurrentSyncDevice); |
1558 | inc = iL.next(); | 1558 | inc = iL.next(); |
1559 | } | 1559 | } |
1560 | } | 1560 | } |
1561 | #ifndef DESKTOP_VERSION | 1561 | #ifndef DESKTOP_VERSION |
1562 | if ( sharpFormat ) | 1562 | if ( sharpFormat ) |
1563 | sharpFormat->save(calendar); | 1563 | sharpFormat->save(calendar); |
1564 | #endif | 1564 | #endif |
1565 | if ( phoneFormat ) | 1565 | if ( phoneFormat ) |
1566 | phoneFormat->save(calendar); | 1566 | phoneFormat->save(calendar); |
1567 | iL = calendar->rawIncidences(); | 1567 | iL = calendar->rawIncidences(); |
1568 | inc = iL.first(); | 1568 | inc = iL.first(); |
1569 | Incidence* loc; | 1569 | Incidence* loc; |
1570 | while ( inc ) { | 1570 | while ( inc ) { |
1571 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1571 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1572 | loc = mCalendar->incidence(inc->uid() ); | 1572 | loc = mCalendar->incidence(inc->uid() ); |
1573 | if ( loc ) { | 1573 | if ( loc ) { |
1574 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1574 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1575 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1575 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1576 | } | 1576 | } |
1577 | } | 1577 | } |
1578 | inc = iL.next(); | 1578 | inc = iL.next(); |
1579 | } | 1579 | } |
1580 | Incidence* lse = getLastSyncEvent(); | 1580 | Incidence* lse = getLastSyncEvent(); |
1581 | if ( lse ) { | 1581 | if ( lse ) { |
1582 | lse->setReadOnly( false ); | 1582 | lse->setReadOnly( false ); |
1583 | lse->setDescription( "" ); | 1583 | lse->setDescription( "" ); |
1584 | lse->setReadOnly( true ); | 1584 | lse->setReadOnly( true ); |
1585 | } | 1585 | } |
1586 | } | 1586 | } |
1587 | } else { | 1587 | } else { |
1588 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1588 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1589 | } | 1589 | } |
1590 | setModified( true ); | 1590 | setModified( true ); |
1591 | } else { | 1591 | } else { |
1592 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1592 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1593 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1593 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1594 | question, i18n("Ok")) ; | 1594 | question, i18n("Ok")) ; |
1595 | 1595 | ||
1596 | } | 1596 | } |
1597 | delete calendar; | 1597 | delete calendar; |
1598 | updateView(); | 1598 | updateView(); |
1599 | emit tempDisableBR(false); | 1599 | emit tempDisableBR(false); |
1600 | return ;//syncOK; | 1600 | return ;//syncOK; |
1601 | 1601 | ||
1602 | } | 1602 | } |
1603 | 1603 | ||
1604 | bool CalendarView::importBday() | 1604 | bool CalendarView::importBday() |
1605 | { | 1605 | { |
1606 | #ifndef KORG_NOKABC | 1606 | #ifndef KORG_NOKABC |
1607 | 1607 | ||
1608 | #ifdef DESKTOP_VERSION | 1608 | #ifdef DESKTOP_VERSION |
1609 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1609 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1610 | KABC::AddressBook::Iterator it; | 1610 | KABC::AddressBook::Iterator it; |
1611 | int count = 0; | 1611 | int count = 0; |
1612 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1612 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1613 | ++count; | 1613 | ++count; |
1614 | } | 1614 | } |
1615 | QProgressBar bar(count,0 ); | 1615 | QProgressBar bar(count,0 ); |
1616 | int w = 300; | 1616 | int w = 300; |
1617 | if ( QApplication::desktop()->width() < 320 ) | 1617 | if ( QApplication::desktop()->width() < 320 ) |
1618 | w = 220; | 1618 | w = 220; |
1619 | int h = bar.sizeHint().height() ; | 1619 | int h = bar.sizeHint().height() ; |
1620 | int dw = QApplication::desktop()->width(); | 1620 | int dw = QApplication::desktop()->width(); |
1621 | int dh = QApplication::desktop()->height(); | 1621 | int dh = QApplication::desktop()->height(); |
1622 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1622 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1623 | bar.show(); | 1623 | bar.show(); |
1624 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1624 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1625 | qApp->processEvents(); | 1625 | qApp->processEvents(); |
1626 | count = 0; | 1626 | count = 0; |
1627 | int addCount = 0; | 1627 | int addCount = 0; |
1628 | KCal::Attendee* a = 0; | 1628 | KCal::Attendee* a = 0; |
1629 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1629 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1630 | if ( ! bar.isVisible() ) | 1630 | if ( ! bar.isVisible() ) |
1631 | return false; | 1631 | return false; |
1632 | bar.setProgress( count++ ); | 1632 | bar.setProgress( count++ ); |
1633 | qApp->processEvents(); | 1633 | qApp->processEvents(); |
1634 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1634 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1635 | if ( (*it).birthday().date().isValid() ){ | 1635 | if ( (*it).birthday().date().isValid() ){ |
1636 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1636 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1637 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1637 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1638 | ++addCount; | 1638 | ++addCount; |
1639 | } | 1639 | } |
1640 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1640 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1641 | if ( anni.isValid() ){ | 1641 | if ( anni.isValid() ){ |
1642 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1642 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1643 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1643 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1644 | ++addCount; | 1644 | ++addCount; |
1645 | } | 1645 | } |
1646 | } | 1646 | } |
1647 | updateView(); | 1647 | updateView(); |
1648 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1648 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1649 | #else //DESKTOP_VERSION | 1649 | #else //DESKTOP_VERSION |
1650 | 1650 | ||
1651 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1651 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1652 | // the result should now arrive through method insertBirthdays | 1652 | // the result should now arrive through method insertBirthdays |
1653 | 1653 | ||
1654 | #endif //DESKTOP_VERSION | 1654 | #endif //DESKTOP_VERSION |
1655 | 1655 | ||
1656 | #endif //KORG_NOKABC | 1656 | #endif //KORG_NOKABC |
1657 | 1657 | ||
1658 | 1658 | ||
1659 | return true; | 1659 | return true; |
1660 | } | 1660 | } |
1661 | 1661 | ||
1662 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1662 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1663 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1663 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1664 | const QStringList& anniversaryList, const QStringList& realNameList, | 1664 | const QStringList& anniversaryList, const QStringList& realNameList, |
1665 | const QStringList& emailList, const QStringList& assembledNameList, | 1665 | const QStringList& emailList, const QStringList& assembledNameList, |
1666 | const QStringList& uidList) | 1666 | const QStringList& uidList) |
1667 | { | 1667 | { |
1668 | //qDebug("KO::CalendarView::insertBirthdays"); | 1668 | //qDebug("KO::CalendarView::insertBirthdays"); |
1669 | if (uid == this->name()) | 1669 | if (uid == this->name()) |
1670 | { | 1670 | { |
1671 | int count = birthdayList.count(); | 1671 | int count = birthdayList.count(); |
1672 | int addCount = 0; | 1672 | int addCount = 0; |
1673 | KCal::Attendee* a = 0; | 1673 | KCal::Attendee* a = 0; |
1674 | 1674 | ||
1675 | //qDebug("CalView 1 %i", count); | 1675 | //qDebug("CalView 1 %i", count); |
1676 | 1676 | ||
1677 | QProgressBar bar(count,0 ); | 1677 | QProgressBar bar(count,0 ); |
1678 | int w = 300; | 1678 | int w = 300; |
1679 | if ( QApplication::desktop()->width() < 320 ) | 1679 | if ( QApplication::desktop()->width() < 320 ) |
1680 | w = 220; | 1680 | w = 220; |
1681 | int h = bar.sizeHint().height() ; | 1681 | int h = bar.sizeHint().height() ; |
1682 | int dw = QApplication::desktop()->width(); | 1682 | int dw = QApplication::desktop()->width(); |
1683 | int dh = QApplication::desktop()->height(); | 1683 | int dh = QApplication::desktop()->height(); |
1684 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1684 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1685 | bar.show(); | 1685 | bar.show(); |
1686 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1686 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1687 | qApp->processEvents(); | 1687 | qApp->processEvents(); |
1688 | 1688 | ||
1689 | QDate birthday; | 1689 | QDate birthday; |
1690 | QDate anniversary; | 1690 | QDate anniversary; |
1691 | QString realName; | 1691 | QString realName; |
1692 | QString email; | 1692 | QString email; |
1693 | QString assembledName; | 1693 | QString assembledName; |
1694 | QString uid; | 1694 | QString uid; |
1695 | bool ok = true; | 1695 | bool ok = true; |
1696 | for ( int i = 0; i < count; i++) | 1696 | for ( int i = 0; i < count; i++) |
1697 | { | 1697 | { |
1698 | if ( ! bar.isVisible() ) | 1698 | if ( ! bar.isVisible() ) |
1699 | return; | 1699 | return; |
1700 | bar.setProgress( i ); | 1700 | bar.setProgress( i ); |
1701 | qApp->processEvents(); | 1701 | qApp->processEvents(); |
1702 | 1702 | ||
1703 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1703 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1704 | if (!ok) { | 1704 | if (!ok) { |
1705 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1705 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1708 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1709 | if (!ok) { | 1709 | if (!ok) { |
1710 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1710 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1711 | } | 1711 | } |
1712 | realName = realNameList[i]; | 1712 | realName = realNameList[i]; |
1713 | email = emailList[i]; | 1713 | email = emailList[i]; |
1714 | assembledName = assembledNameList[i]; | 1714 | assembledName = assembledNameList[i]; |
1715 | uid = uidList[i]; | 1715 | uid = uidList[i]; |
1716 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1716 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1717 | 1717 | ||
1718 | if ( birthday.isValid() ){ | 1718 | if ( birthday.isValid() ){ |
1719 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1719 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1720 | KCal::Attendee::ReqParticipant,uid) ; | 1720 | KCal::Attendee::ReqParticipant,uid) ; |
1721 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1721 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1722 | ++addCount; | 1722 | ++addCount; |
1723 | } | 1723 | } |
1724 | 1724 | ||
1725 | if ( anniversary.isValid() ){ | 1725 | if ( anniversary.isValid() ){ |
1726 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1726 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1727 | KCal::Attendee::ReqParticipant,uid) ; | 1727 | KCal::Attendee::ReqParticipant,uid) ; |
1728 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1728 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1729 | ++addCount; | 1729 | ++addCount; |
1730 | } | 1730 | } |
1731 | } | 1731 | } |
1732 | 1732 | ||
1733 | updateView(); | 1733 | updateView(); |
1734 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1734 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1735 | 1735 | ||
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | 1740 | ||
1741 | 1741 | ||
1742 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1742 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1743 | { | 1743 | { |
1744 | //qDebug("addAnni "); | 1744 | //qDebug("addAnni "); |
1745 | Event * ev = new Event(); | 1745 | Event * ev = new Event(); |
1746 | ev->setOrganizer(KOPrefs::instance()->email()); | 1746 | ev->setOrganizer(KOPrefs::instance()->email()); |
1747 | if ( a ) { | 1747 | if ( a ) { |
1748 | ev->addAttendee( a ); | 1748 | ev->addAttendee( a ); |
1749 | } | 1749 | } |
1750 | QString kind; | 1750 | QString kind; |
1751 | if ( birthday ) { | 1751 | if ( birthday ) { |
1752 | kind = i18n( "Birthday" ); | 1752 | kind = i18n( "Birthday" ); |
1753 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1753 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1754 | } | 1754 | } |
1755 | else { | 1755 | else { |
1756 | kind = i18n( "Anniversary" ); | 1756 | kind = i18n( "Anniversary" ); |
1757 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1757 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1758 | } | 1758 | } |
1759 | ev->setCategories( kind ); | 1759 | ev->setCategories( kind ); |
1760 | ev->setDtStart( QDateTime(date) ); | 1760 | ev->setDtStart( QDateTime(date) ); |
1761 | ev->setDtEnd( QDateTime(date) ); | 1761 | ev->setDtEnd( QDateTime(date) ); |
1762 | ev->setFloats( true ); | 1762 | ev->setFloats( true ); |
1763 | Recurrence * rec = ev->recurrence(); | 1763 | Recurrence * rec = ev->recurrence(); |
1764 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1764 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1765 | rec->addYearlyNum( date.month() ); | 1765 | rec->addYearlyNum( date.month() ); |
1766 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1766 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1767 | delete ev; | 1767 | delete ev; |
1768 | return false; | 1768 | return false; |
1769 | } | 1769 | } |
1770 | return true; | 1770 | return true; |
1771 | 1771 | ||
1772 | } | 1772 | } |
1773 | bool CalendarView::importQtopia( const QString &categories, | 1773 | bool CalendarView::importQtopia( const QString &categories, |
1774 | const QString &datebook, | 1774 | const QString &datebook, |
1775 | const QString &todolist ) | 1775 | const QString &todolist ) |
1776 | { | 1776 | { |
1777 | 1777 | ||
1778 | QtopiaFormat qtopiaFormat; | 1778 | QtopiaFormat qtopiaFormat; |
1779 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1779 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1780 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1780 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1781 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1781 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1782 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1782 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1783 | 1783 | ||
1784 | updateView(); | 1784 | updateView(); |
1785 | return true; | 1785 | return true; |
1786 | 1786 | ||
1787 | #if 0 | 1787 | #if 0 |
1788 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1788 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1789 | mCurrentSyncDevice = "qtopia-XML"; | 1789 | mCurrentSyncDevice = "qtopia-XML"; |
1790 | if ( mSyncManager->mAskForPreferences ) | 1790 | if ( mSyncManager->mAskForPreferences ) |
1791 | edit_sync_options(); | 1791 | edit_sync_options(); |
1792 | qApp->processEvents(); | 1792 | qApp->processEvents(); |
1793 | CalendarLocal* calendar = new CalendarLocal(); | 1793 | CalendarLocal* calendar = new CalendarLocal(); |
1794 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1794 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1795 | bool syncOK = false; | 1795 | bool syncOK = false; |
1796 | QtopiaFormat qtopiaFormat; | 1796 | QtopiaFormat qtopiaFormat; |
1797 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1797 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1798 | bool loadOk = true; | 1798 | bool loadOk = true; |
1799 | if ( !categories.isEmpty() ) | 1799 | if ( !categories.isEmpty() ) |
1800 | loadOk = qtopiaFormat.load( calendar, categories ); | 1800 | loadOk = qtopiaFormat.load( calendar, categories ); |
1801 | if ( loadOk && !datebook.isEmpty() ) | 1801 | if ( loadOk && !datebook.isEmpty() ) |
1802 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1802 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1803 | if ( loadOk && !todolist.isEmpty() ) | 1803 | if ( loadOk && !todolist.isEmpty() ) |
1804 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1804 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1805 | 1805 | ||
1806 | if ( loadOk ) { | 1806 | if ( loadOk ) { |
1807 | getEventViewerDialog()->setSyncMode( true ); | 1807 | getEventViewerDialog()->setSyncMode( true ); |
1808 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1808 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1809 | getEventViewerDialog()->setSyncMode( false ); | 1809 | getEventViewerDialog()->setSyncMode( false ); |
1810 | qApp->processEvents(); | 1810 | qApp->processEvents(); |
1811 | if ( syncOK ) { | 1811 | if ( syncOK ) { |
1812 | if ( mSyncManager->mWriteBackFile ) | 1812 | if ( mSyncManager->mWriteBackFile ) |
1813 | { | 1813 | { |
1814 | // write back XML file | 1814 | // write back XML file |
1815 | 1815 | ||
1816 | } | 1816 | } |
1817 | setModified( true ); | 1817 | setModified( true ); |
1818 | } | 1818 | } |
1819 | } else { | 1819 | } else { |
1820 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1820 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1821 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1821 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1822 | question, i18n("Ok")) ; | 1822 | question, i18n("Ok")) ; |
1823 | } | 1823 | } |
1824 | delete calendar; | 1824 | delete calendar; |
1825 | updateView(); | 1825 | updateView(); |
1826 | return syncOK; | 1826 | return syncOK; |
1827 | 1827 | ||
1828 | 1828 | ||
1829 | #endif | 1829 | #endif |
1830 | 1830 | ||
1831 | } | 1831 | } |
1832 | 1832 | ||
1833 | void CalendarView::setSyncEventsReadOnly() | 1833 | void CalendarView::setSyncEventsReadOnly() |
1834 | { | 1834 | { |
1835 | Event * ev; | 1835 | Event * ev; |
1836 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1836 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1837 | ev = eL.first(); | 1837 | ev = eL.first(); |
1838 | while ( ev ) { | 1838 | while ( ev ) { |
1839 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1839 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1840 | ev->setReadOnly( true ); | 1840 | ev->setReadOnly( true ); |
1841 | ev = eL.next(); | 1841 | ev = eL.next(); |
1842 | } | 1842 | } |
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | bool CalendarView::loadCalendars() | 1845 | bool CalendarView::loadCalendars() |
1846 | { | 1846 | { |
1847 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1847 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1848 | KopiCalendarFile * cal = calendars.first(); | 1848 | KopiCalendarFile * cal = calendars.first(); |
1849 | mCalendar->setDefaultCalendar( 1 ); | 1849 | mCalendar->setDefaultCalendar( 1 ); |
1850 | openCalendar( MainWindow::defaultFileName(), false ); | 1850 | openCalendar( MainWindow::defaultFileName(), false ); |
1851 | cal = calendars.next(); | 1851 | cal = calendars.next(); |
1852 | while ( cal ) { | 1852 | while ( cal ) { |
1853 | addCalendar( cal ); | 1853 | addCalendar( cal ); |
1854 | cal = calendars.next(); | 1854 | cal = calendars.next(); |
1855 | } | 1855 | } |
1856 | restoreCalendarSettings(); | 1856 | restoreCalendarSettings(); |
1857 | mCalendar->reInitAlarmSettings(); | 1857 | mCalendar->reInitAlarmSettings(); |
1858 | setSyncEventsReadOnly(); | 1858 | setSyncEventsReadOnly(); |
1859 | updateUnmanagedViews(); | 1859 | updateUnmanagedViews(); |
1860 | updateView(); | 1860 | updateView(); |
1861 | } | 1861 | } |
1862 | bool CalendarView::restoreCalendarSettings() | 1862 | bool CalendarView::restoreCalendarSettings() |
1863 | { | 1863 | { |
1864 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1864 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1865 | KopiCalendarFile * cal = calendars.first(); | 1865 | KopiCalendarFile * cal = calendars.first(); |
1866 | while ( cal ) { | 1866 | while ( cal ) { |
1867 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 1867 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
1868 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 1868 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
1869 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 1869 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
1870 | if ( cal->isStandard ) | 1870 | if ( cal->isStandard ) |
1871 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 1871 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
1872 | cal = calendars.next(); | 1872 | cal = calendars.next(); |
1873 | } | 1873 | } |
1874 | } | 1874 | } |
1875 | void CalendarView::addCalendarId( int id ) | 1875 | void CalendarView::addCalendarId( int id ) |
1876 | { | 1876 | { |
1877 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | 1877 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); |
1878 | addCalendar( cal ); | 1878 | addCalendar( cal ); |
1879 | } | 1879 | } |
1880 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 1880 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
1881 | { | 1881 | { |
1882 | 1882 | cal->mErrorOnLoad = false; | |
1883 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) | 1883 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { |
1884 | cal->mLoadDt = QDateTime::currentDateTime(); | ||
1884 | return true; | 1885 | return true; |
1886 | } | ||
1885 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); | 1887 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); |
1886 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); | 1888 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); |
1889 | cal->mErrorOnLoad = true; | ||
1887 | return false; | 1890 | return false; |
1888 | } | 1891 | } |
1889 | bool CalendarView::openCalendar(QString filename, bool merge) | 1892 | bool CalendarView::openCalendar(QString filename, bool merge) |
1890 | { | 1893 | { |
1891 | 1894 | ||
1892 | if (filename.isEmpty()) { | 1895 | if (filename.isEmpty()) { |
1893 | return false; | 1896 | return false; |
1894 | } | 1897 | } |
1895 | 1898 | ||
1896 | if (!QFile::exists(filename)) { | 1899 | if (!QFile::exists(filename)) { |
1897 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1900 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1898 | return false; | 1901 | return false; |
1899 | } | 1902 | } |
1900 | 1903 | ||
1901 | globalFlagBlockAgenda = 1; | 1904 | globalFlagBlockAgenda = 1; |
1902 | clearAllViews(); | 1905 | clearAllViews(); |
1903 | if (!merge) { | 1906 | if (!merge) { |
1904 | mViewManager->setDocumentId( filename ); | 1907 | mViewManager->setDocumentId( filename ); |
1905 | mCalendar->close(); | 1908 | mCalendar->close(); |
1906 | } | 1909 | } |
1907 | mStorage->setFileName( filename ); | 1910 | mStorage->setFileName( filename ); |
1908 | 1911 | ||
1909 | if ( mStorage->load() ) { | 1912 | if ( mStorage->load() ) { |
1910 | if ( merge ) ;//setModified( true ); | 1913 | if ( merge ) ;//setModified( true ); |
1911 | else { | 1914 | else { |
1912 | //setModified( true ); | 1915 | //setModified( true ); |
1913 | mViewManager->setDocumentId( filename ); | 1916 | mViewManager->setDocumentId( filename ); |
1914 | mDialogManager->setDocumentId( filename ); | 1917 | mDialogManager->setDocumentId( filename ); |
1915 | mTodoList->setDocumentId( filename ); | 1918 | mTodoList->setDocumentId( filename ); |
1916 | } | 1919 | } |
1917 | globalFlagBlockAgenda = 2; | 1920 | globalFlagBlockAgenda = 2; |
1918 | // if ( getLastSyncEvent() ) | 1921 | // if ( getLastSyncEvent() ) |
1919 | // getLastSyncEvent()->setReadOnly( true ); | 1922 | // getLastSyncEvent()->setReadOnly( true ); |
1920 | mCalendar->reInitAlarmSettings(); | 1923 | mCalendar->reInitAlarmSettings(); |
1921 | setSyncEventsReadOnly(); | 1924 | setSyncEventsReadOnly(); |
1922 | updateUnmanagedViews(); | 1925 | updateUnmanagedViews(); |
1923 | updateView(); | 1926 | updateView(); |
1924 | if ( filename != MainWindow::defaultFileName() ) { | 1927 | if ( filename != MainWindow::defaultFileName() ) { |
1925 | saveCalendar( MainWindow::defaultFileName() ); | 1928 | saveCalendar( MainWindow::defaultFileName() ); |
1926 | } else { | 1929 | } else { |
1927 | QFileInfo finf ( MainWindow::defaultFileName()); | 1930 | QFileInfo finf ( MainWindow::defaultFileName()); |
1928 | if ( finf.exists() ) { | 1931 | if ( finf.exists() ) { |
1929 | setLoadedFileVersion( finf.lastModified () ); | 1932 | setLoadedFileVersion( finf.lastModified () ); |
1930 | } | 1933 | } |
1931 | } | 1934 | } |
1932 | return true; | 1935 | return true; |
1933 | } else { | 1936 | } else { |
1934 | // while failing to load, the calendar object could | 1937 | // while failing to load, the calendar object could |
1935 | // have become partially populated. Clear it out. | 1938 | // have become partially populated. Clear it out. |
1936 | if ( !merge ) { | 1939 | if ( !merge ) { |
1937 | mCalendar->close(); | 1940 | mCalendar->close(); |
1938 | mViewManager->setDocumentId( filename ); | 1941 | mViewManager->setDocumentId( filename ); |
1939 | mDialogManager->setDocumentId( filename ); | 1942 | mDialogManager->setDocumentId( filename ); |
1940 | mTodoList->setDocumentId( filename ); | 1943 | mTodoList->setDocumentId( filename ); |
1941 | } | 1944 | } |
1942 | 1945 | ||
1943 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1946 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1944 | 1947 | ||
1945 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1948 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1946 | globalFlagBlockAgenda = 2; | 1949 | globalFlagBlockAgenda = 2; |
1947 | mCalendar->reInitAlarmSettings(); | 1950 | mCalendar->reInitAlarmSettings(); |
1948 | setSyncEventsReadOnly(); | 1951 | setSyncEventsReadOnly(); |
1949 | updateUnmanagedViews(); | 1952 | updateUnmanagedViews(); |
1950 | updateView(); | 1953 | updateView(); |
1951 | } | 1954 | } |
1952 | return false; | 1955 | return false; |
1953 | } | 1956 | } |
1954 | void CalendarView::showOpenError() | 1957 | void CalendarView::showOpenError() |
1955 | { | 1958 | { |
1956 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1959 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1957 | } | 1960 | } |
1958 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1961 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1959 | { | 1962 | { |
1960 | loadedFileVersion = dt; | 1963 | loadedFileVersion = dt; |
1961 | } | 1964 | } |
1962 | bool CalendarView::checkFileChanged(QString fn) | 1965 | bool CalendarView::checkFileChanged(QString fn) |
1963 | { | 1966 | { |
1964 | QFileInfo finf ( fn ); | 1967 | QFileInfo finf ( fn ); |
1965 | if ( !finf.exists() ) | 1968 | if ( !finf.exists() ) |
1966 | return true; | 1969 | return true; |
1967 | QDateTime dt = finf.lastModified (); | 1970 | QDateTime dt = finf.lastModified (); |
1968 | if ( dt <= loadedFileVersion ) | 1971 | if ( dt <= loadedFileVersion ) |
1969 | return false; | 1972 | return false; |
1970 | return true; | 1973 | return true; |
1971 | 1974 | ||
1972 | } | 1975 | } |
1973 | void CalendarView::watchSavedFile() | 1976 | void CalendarView::watchSavedFile() |
1974 | { | 1977 | { |
1975 | QFileInfo finf ( MainWindow::defaultFileName()); | 1978 | QFileInfo finf ( MainWindow::defaultFileName()); |
1976 | if ( !finf.exists() ) | 1979 | if ( !finf.exists() ) |
1977 | return; | 1980 | return; |
1978 | QDateTime dt = finf.lastModified (); | 1981 | QDateTime dt = finf.lastModified (); |
1979 | if ( dt < loadedFileVersion ) { | 1982 | if ( dt < loadedFileVersion ) { |
1980 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1983 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1981 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1984 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1982 | return; | 1985 | return; |
1983 | } | 1986 | } |
1984 | loadedFileVersion = dt; | 1987 | loadedFileVersion = dt; |
1985 | } | 1988 | } |
1986 | 1989 | bool CalendarView::checkAllFileVersions() | |
1990 | { | ||
1991 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
1992 | KopiCalendarFile * cal = calendars.first(); | ||
1993 | mCalendar->setDefaultCalendar( 1 ); | ||
1994 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
1995 | if ( !checkFileVersion(MainWindow::defaultFileName())) | ||
1996 | return false; | ||
1997 | cal = calendars.next(); | ||
1998 | QDateTime storeTemp = loadedFileVersion; | ||
1999 | while ( cal ) { | ||
2000 | if ( !cal->mErrorOnLoad ) { | ||
2001 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | ||
2002 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
2003 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); | ||
2004 | if ( !checkFileVersion(cal->mFileName )) { | ||
2005 | loadedFileVersion = storeTemp; | ||
2006 | updateView(); | ||
2007 | return false; | ||
2008 | } | ||
2009 | } | ||
2010 | cal = calendars.next(); | ||
2011 | } | ||
2012 | loadedFileVersion = storeTemp; | ||
2013 | updateView(); | ||
2014 | return true; | ||
2015 | } | ||
1987 | bool CalendarView::checkFileVersion(QString fn) | 2016 | bool CalendarView::checkFileVersion(QString fn) |
1988 | { | 2017 | { |
1989 | QFileInfo finf ( fn ); | 2018 | QFileInfo finf ( fn ); |
1990 | if ( !finf.exists() ) | 2019 | if ( !finf.exists() ) |
1991 | return true; | 2020 | return true; |
1992 | QDateTime dt = finf.lastModified (); | 2021 | QDateTime dt = finf.lastModified (); |
1993 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 2022 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1994 | //qDebug("file on disk version %s",dt.toString().latin1()); | 2023 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1995 | if ( dt <= loadedFileVersion ) | 2024 | if ( dt <= loadedFileVersion ) |
1996 | return true; | 2025 | return true; |
1997 | 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)) , | 2026 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1998 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 2027 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1999 | i18n("Sync+save")); | 2028 | i18n("Sync+save")); |
2000 | 2029 | ||
2001 | if ( km == KMessageBox::Cancel ) | 2030 | if ( km == KMessageBox::Cancel ) |
2002 | return false; | 2031 | return false; |
2003 | if ( km == KMessageBox::Yes ) | 2032 | if ( km == KMessageBox::Yes ) |
2004 | return true; | 2033 | return true; |
2005 | 2034 | ||
2006 | setSyncDevice("deleteaftersync" ); | 2035 | setSyncDevice("deleteaftersync" ); |
2007 | mSyncManager->mAskForPreferences = true; | 2036 | mSyncManager->mAskForPreferences = true; |
2008 | mSyncManager->mSyncAlgoPrefs = 3; | 2037 | mSyncManager->mSyncAlgoPrefs = 3; |
2009 | mSyncManager->mWriteBackFile = false; | 2038 | mSyncManager->mWriteBackFile = false; |
2010 | mSyncManager->mWriteBackExistingOnly = false; | 2039 | mSyncManager->mWriteBackExistingOnly = false; |
2011 | mSyncManager->mShowSyncSummary = false; | 2040 | mSyncManager->mShowSyncSummary = false; |
2012 | syncCalendar( fn, 3 ); | 2041 | syncCalendar( fn, 3 ); |
2013 | Event * e = getLastSyncEvent(); | 2042 | Event * e = getLastSyncEvent(); |
2014 | if ( e ) | 2043 | if ( e ) |
2015 | deleteEvent ( e ); | 2044 | mCalendar->deleteEvent( e ); |
2016 | updateView(); | ||
2017 | return true; | 2045 | return true; |
2018 | } | 2046 | } |
2019 | bool CalendarView::saveCalendars() | 2047 | bool CalendarView::saveCalendars() |
2020 | { | 2048 | { |
2021 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2049 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2022 | KopiCalendarFile * cal = calendars.first(); | 2050 | KopiCalendarFile * cal = calendars.first(); |
2023 | mCalendar->setDefaultCalendar( 1 ); | 2051 | mCalendar->setDefaultCalendar( 1 ); |
2024 | mCalendar->setDefaultCalendarEnabledOnly(); | 2052 | mCalendar->setDefaultCalendarEnabledOnly(); |
2025 | saveCalendar( MainWindow::defaultFileName() ); | 2053 | saveCalendar( MainWindow::defaultFileName() ); |
2026 | cal = calendars.next(); | 2054 | cal = calendars.next(); |
2027 | while ( cal ) { | 2055 | while ( cal ) { |
2028 | if ( !cal->isReadOnly ) { | 2056 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2029 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2057 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2030 | mCalendar->setDefaultCalendarEnabledOnly(); | 2058 | mCalendar->setDefaultCalendarEnabledOnly(); |
2031 | saveCalendar( cal->mFileName ); | 2059 | if ( saveCalendar( cal->mFileName ) ) |
2060 | cal->mLoadDt = QDateTime::currentDateTime(); | ||
2032 | } | 2061 | } |
2033 | cal = calendars.next(); | 2062 | cal = calendars.next(); |
2034 | } | 2063 | } |
2035 | restoreCalendarSettings(); | 2064 | restoreCalendarSettings(); |
2036 | } | 2065 | } |
2037 | bool CalendarView::saveCalendar( QString filename ) | 2066 | bool CalendarView::saveCalendar( QString filename ) |
2038 | { | 2067 | { |
2039 | 2068 | ||
2040 | // Store back all unsaved data into calendar object | 2069 | // Store back all unsaved data into calendar object |
2041 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 2070 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
2042 | if ( mViewManager->currentView() ) | 2071 | if ( mViewManager->currentView() ) |
2043 | mViewManager->currentView()->flushView(); | 2072 | mViewManager->currentView()->flushView(); |
2044 | 2073 | ||
2045 | 2074 | ||
2046 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 2075 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
2047 | mStorage->setSaveFormat( new ICalFormat() ); | 2076 | mStorage->setSaveFormat( new ICalFormat() ); |
2048 | mStorage->setFileName( filename ); | 2077 | mStorage->setFileName( filename ); |
2049 | bool success; | 2078 | bool success; |
2050 | success = mStorage->save(); | 2079 | success = mStorage->save(); |
2051 | if ( !success ) { | 2080 | if ( !success ) { |
2052 | return false; | 2081 | return false; |
2053 | } | 2082 | } |
2054 | if ( filename == MainWindow::defaultFileName() ) { | 2083 | if ( filename == MainWindow::defaultFileName() ) { |
2055 | setLoadedFileVersion( lfv ); | 2084 | setLoadedFileVersion( lfv ); |
2056 | watchSavedFile(); | 2085 | watchSavedFile(); |
2057 | } | 2086 | } |
2058 | return true; | 2087 | return true; |
2059 | } | 2088 | } |
2060 | 2089 | ||
2061 | void CalendarView::closeCalendar() | 2090 | void CalendarView::closeCalendar() |
2062 | { | 2091 | { |
2063 | 2092 | ||
2064 | // child windows no longer valid | 2093 | // child windows no longer valid |
2065 | clearAllViews(); | 2094 | clearAllViews(); |
2066 | emit closingDown(); | 2095 | emit closingDown(); |
2067 | 2096 | ||
2068 | mCalendar->close(); | 2097 | mCalendar->close(); |
2069 | setModified(false); | 2098 | setModified(false); |
2070 | updateView(); | 2099 | updateView(); |
2071 | } | 2100 | } |
2072 | 2101 | ||
2073 | void CalendarView::archiveCalendar() | 2102 | void CalendarView::archiveCalendar() |
2074 | { | 2103 | { |
2075 | mDialogManager->showArchiveDialog(); | 2104 | mDialogManager->showArchiveDialog(); |
2076 | } | 2105 | } |
2077 | 2106 | ||
2078 | 2107 | ||
2079 | void CalendarView::readSettings() | 2108 | void CalendarView::readSettings() |
2080 | { | 2109 | { |
2081 | 2110 | ||
2082 | 2111 | ||
2083 | // mViewManager->showAgendaView(); | 2112 | // mViewManager->showAgendaView(); |
2084 | QString str; | 2113 | QString str; |
2085 | //qDebug("CalendarView::readSettings() "); | 2114 | //qDebug("CalendarView::readSettings() "); |
2086 | // read settings from the KConfig, supplying reasonable | 2115 | // read settings from the KConfig, supplying reasonable |
2087 | // defaults where none are to be found | 2116 | // defaults where none are to be found |
2088 | KConfig *config = KOGlobals::config(); | 2117 | KConfig *config = KOGlobals::config(); |
2089 | #ifndef KORG_NOSPLITTER | 2118 | #ifndef KORG_NOSPLITTER |
2090 | config->setGroup("KOrganizer Geometry"); | 2119 | config->setGroup("KOrganizer Geometry"); |
2091 | 2120 | ||
2092 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2121 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2093 | if (sizes.count() != 2) { | 2122 | if (sizes.count() != 2) { |
2094 | sizes << mDateNavigator->minimumSizeHint().width(); | 2123 | sizes << mDateNavigator->minimumSizeHint().width(); |
2095 | sizes << 300; | 2124 | sizes << 300; |
2096 | } | 2125 | } |
2097 | mPanner->setSizes(sizes); | 2126 | mPanner->setSizes(sizes); |
2098 | 2127 | ||
2099 | sizes = config->readIntListEntry("Separator2"); | 2128 | sizes = config->readIntListEntry("Separator2"); |
2100 | if ( ( mResourceView && sizes.count() == 4 ) || | 2129 | if ( ( mResourceView && sizes.count() == 4 ) || |
2101 | ( !mResourceView && sizes.count() == 3 ) ) { | 2130 | ( !mResourceView && sizes.count() == 3 ) ) { |
2102 | mLeftSplitter->setSizes(sizes); | 2131 | mLeftSplitter->setSizes(sizes); |
2103 | } | 2132 | } |
2104 | #endif | 2133 | #endif |
2105 | globalFlagBlockAgenda = 1; | 2134 | globalFlagBlockAgenda = 1; |
2106 | mViewManager->showAgendaView(); | 2135 | mViewManager->showAgendaView(); |
2107 | //mViewManager->readSettings( config ); | 2136 | //mViewManager->readSettings( config ); |
2108 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2137 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2109 | readFilterSettings(config); | 2138 | readFilterSettings(config); |
2110 | 2139 | ||
2111 | #ifdef DESKTOP_VERSION | 2140 | #ifdef DESKTOP_VERSION |
2112 | config->setGroup("WidgetLayout"); | 2141 | config->setGroup("WidgetLayout"); |
2113 | QStringList list; | 2142 | QStringList list; |
2114 | list = config->readListEntry("MainLayout"); | 2143 | list = config->readListEntry("MainLayout"); |
2115 | int x,y,w,h; | 2144 | int x,y,w,h; |
2116 | if ( ! list.isEmpty() ) { | 2145 | if ( ! list.isEmpty() ) { |
2117 | x = list[0].toInt(); | 2146 | x = list[0].toInt(); |
2118 | y = list[1].toInt(); | 2147 | y = list[1].toInt(); |
2119 | w = list[2].toInt(); | 2148 | w = list[2].toInt(); |
2120 | h = list[3].toInt(); | 2149 | h = list[3].toInt(); |
2121 | KApplication::testCoords( &x,&y,&w,&h ); | 2150 | KApplication::testCoords( &x,&y,&w,&h ); |
2122 | topLevelWidget()->setGeometry(x,y,w,h); | 2151 | topLevelWidget()->setGeometry(x,y,w,h); |
2123 | 2152 | ||
2124 | } else { | 2153 | } else { |
2125 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2154 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2126 | } | 2155 | } |
2127 | list = config->readListEntry("EditEventLayout"); | 2156 | list = config->readListEntry("EditEventLayout"); |
2128 | if ( ! list.isEmpty() ) { | 2157 | if ( ! list.isEmpty() ) { |
2129 | x = list[0].toInt(); | 2158 | x = list[0].toInt(); |
2130 | y = list[1].toInt(); | 2159 | y = list[1].toInt(); |
2131 | w = list[2].toInt(); | 2160 | w = list[2].toInt(); |
2132 | h = list[3].toInt(); | 2161 | h = list[3].toInt(); |
2133 | KApplication::testCoords( &x,&y,&w,&h ); | 2162 | KApplication::testCoords( &x,&y,&w,&h ); |
2134 | mEventEditor->setGeometry(x,y,w,h); | 2163 | mEventEditor->setGeometry(x,y,w,h); |
2135 | 2164 | ||
2136 | } | 2165 | } |
2137 | list = config->readListEntry("EditTodoLayout"); | 2166 | list = config->readListEntry("EditTodoLayout"); |
2138 | if ( ! list.isEmpty() ) { | 2167 | if ( ! list.isEmpty() ) { |
2139 | x = list[0].toInt(); | 2168 | x = list[0].toInt(); |
2140 | y = list[1].toInt(); | 2169 | y = list[1].toInt(); |
2141 | w = list[2].toInt(); | 2170 | w = list[2].toInt(); |
2142 | h = list[3].toInt(); | 2171 | h = list[3].toInt(); |
2143 | KApplication::testCoords( &x,&y,&w,&h ); | 2172 | KApplication::testCoords( &x,&y,&w,&h ); |
2144 | mTodoEditor->setGeometry(x,y,w,h); | 2173 | mTodoEditor->setGeometry(x,y,w,h); |
2145 | 2174 | ||
2146 | } | 2175 | } |
2147 | list = config->readListEntry("ViewerLayout"); | 2176 | list = config->readListEntry("ViewerLayout"); |
2148 | if ( ! list.isEmpty() ) { | 2177 | if ( ! list.isEmpty() ) { |
2149 | x = list[0].toInt(); | 2178 | x = list[0].toInt(); |
2150 | y = list[1].toInt(); | 2179 | y = list[1].toInt(); |
2151 | w = list[2].toInt(); | 2180 | w = list[2].toInt(); |
2152 | h = list[3].toInt(); | 2181 | h = list[3].toInt(); |
2153 | KApplication::testCoords( &x,&y,&w,&h ); | 2182 | KApplication::testCoords( &x,&y,&w,&h ); |
2154 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2183 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2155 | } | 2184 | } |
2156 | #endif | 2185 | #endif |
2157 | config->setGroup( "Views" ); | 2186 | config->setGroup( "Views" ); |
2158 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2187 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2159 | 2188 | ||
2160 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2189 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2161 | 2190 | ||
2162 | int resetval = 0; | 2191 | int resetval = 0; |
2163 | int maxVal = 0; | 2192 | int maxVal = 0; |
2164 | if (sizes.count() != 3) { | 2193 | if (sizes.count() != 3) { |
2165 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2194 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2166 | resetval = mDateNavigator->sizeHint().width()+2; | 2195 | resetval = mDateNavigator->sizeHint().width()+2; |
2167 | } else { | 2196 | } else { |
2168 | resetval = mDateNavigator->sizeHint().height()+2; | 2197 | resetval = mDateNavigator->sizeHint().height()+2; |
2169 | } | 2198 | } |
2170 | } | 2199 | } |
2171 | if ( resetval ) { | 2200 | if ( resetval ) { |
2172 | sizes.clear(); | 2201 | sizes.clear(); |
2173 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2202 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2174 | maxVal = QApplication::desktop()->width() -10; | 2203 | maxVal = QApplication::desktop()->width() -10; |
2175 | } else { | 2204 | } else { |
2176 | maxVal = QApplication::desktop()->height()-10; | 2205 | maxVal = QApplication::desktop()->height()-10; |
2177 | } | 2206 | } |
2178 | sizes << resetval; | 2207 | sizes << resetval; |
2179 | if ( maxVal < resetval + resetval) | 2208 | if ( maxVal < resetval + resetval) |
2180 | resetval = maxVal - resetval; | 2209 | resetval = maxVal - resetval; |
2181 | sizes << resetval; | 2210 | sizes << resetval; |
2182 | sizes << 100; | 2211 | sizes << 100; |
2183 | } | 2212 | } |
2184 | mLeftFrame->setSizes(sizes); | 2213 | mLeftFrame->setSizes(sizes); |
2185 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2214 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2186 | resetval = 0; | 2215 | resetval = 0; |
2187 | maxVal = 0; | 2216 | maxVal = 0; |
2188 | if (sizes.count() != 2) { | 2217 | if (sizes.count() != 2) { |
2189 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2218 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2190 | resetval = mDateNavigator->sizeHint().width()+2; | 2219 | resetval = mDateNavigator->sizeHint().width()+2; |
2191 | } else { | 2220 | } else { |
2192 | resetval = mDateNavigator->sizeHint().height()+2; | 2221 | resetval = mDateNavigator->sizeHint().height()+2; |
2193 | } | 2222 | } |
2194 | } | 2223 | } |
2195 | if ( resetval ) { | 2224 | if ( resetval ) { |
2196 | sizes.clear(); | 2225 | sizes.clear(); |
2197 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2226 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2198 | maxVal = QApplication::desktop()->width() -10; | 2227 | maxVal = QApplication::desktop()->width() -10; |
2199 | } else { | 2228 | } else { |
2200 | maxVal = QApplication::desktop()->height()-10; | 2229 | maxVal = QApplication::desktop()->height()-10; |
2201 | } | 2230 | } |
2202 | sizes << resetval; | 2231 | sizes << resetval; |
2203 | if ( maxVal < resetval + resetval) | 2232 | if ( maxVal < resetval + resetval) |
2204 | resetval = maxVal - resetval; | 2233 | resetval = maxVal - resetval; |
2205 | sizes << resetval; | 2234 | sizes << resetval; |
2206 | } | 2235 | } |
2207 | mMainFrame->setSizes(sizes); | 2236 | mMainFrame->setSizes(sizes); |
2208 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2237 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2209 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2238 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2210 | else mNavigator->selectDates( dateCount ); | 2239 | else mNavigator->selectDates( dateCount ); |
2211 | // mViewManager->readSettings( config ); | 2240 | // mViewManager->readSettings( config ); |
2212 | updateConfig(); | 2241 | updateConfig(); |
2213 | globalFlagBlockAgenda = 2; | 2242 | globalFlagBlockAgenda = 2; |
2214 | mViewManager->readSettings( config ); | 2243 | mViewManager->readSettings( config ); |
2215 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2244 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2216 | } | 2245 | } |
2217 | 2246 | ||
2218 | 2247 | ||
2219 | void CalendarView::writeSettings() | 2248 | void CalendarView::writeSettings() |
2220 | { | 2249 | { |
2221 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2250 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2222 | 2251 | ||
2223 | KConfig *config = KOGlobals::config(); | 2252 | KConfig *config = KOGlobals::config(); |
2224 | 2253 | ||
2225 | mViewManager->writeSettings( config ); | 2254 | mViewManager->writeSettings( config ); |
2226 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2255 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2227 | mDialogManager->writeSettings( config ); | 2256 | mDialogManager->writeSettings( config ); |
2228 | //KOPrefs::instance()->usrWriteConfig(); | 2257 | //KOPrefs::instance()->usrWriteConfig(); |
2229 | KOPrefs::instance()->writeConfig(); | 2258 | KOPrefs::instance()->writeConfig(); |
2230 | 2259 | ||
2231 | writeFilterSettings(config); | 2260 | writeFilterSettings(config); |
2232 | config->setGroup( "AppRun" ); | 2261 | config->setGroup( "AppRun" ); |
2233 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2262 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2234 | int days = dt.daysTo( QDate::currentDate() ); | 2263 | int days = dt.daysTo( QDate::currentDate() ); |
2235 | dt = dt.addDays( days ); | 2264 | dt = dt.addDays( days ); |
2236 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2265 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2237 | config->writeEntry( "LatestProgramStopDays", days ); | 2266 | config->writeEntry( "LatestProgramStopDays", days ); |
2238 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2267 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2239 | //qDebug("KO: Writing stop time: %d ", secs); | 2268 | //qDebug("KO: Writing stop time: %d ", secs); |
2240 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2269 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2241 | //QDateTime latest = dt.addSecs ( secs ); | 2270 | //QDateTime latest = dt.addSecs ( secs ); |
2242 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | 2271 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); |
2243 | config->setGroup( "Views" ); | 2272 | config->setGroup( "Views" ); |
2244 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2273 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2245 | 2274 | ||
2246 | #if 0 | 2275 | #if 0 |
2247 | qDebug("********************* "); | 2276 | qDebug("********************* "); |
2248 | qDebug("Testcode secsto "); | 2277 | qDebug("Testcode secsto "); |
2249 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | 2278 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); |
2250 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | 2279 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); |
2251 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | 2280 | int secsto = dt_nodaylight.secsTo( dt_daylight ); |
2252 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | 2281 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); |
2253 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | 2282 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); |
2254 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | 2283 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); |
2255 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | 2284 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); |
2256 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | 2285 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); |
2257 | qDebug("********************* testcode end"); | 2286 | qDebug("********************* testcode end"); |
2258 | 2287 | ||
2259 | #endif | 2288 | #endif |
2260 | 2289 | ||
2261 | QValueList<int> listINT = mLeftFrame->sizes(); | 2290 | QValueList<int> listINT = mLeftFrame->sizes(); |
2262 | config->writeEntry("Left Splitter Frame",listINT); | 2291 | config->writeEntry("Left Splitter Frame",listINT); |
2263 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2292 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2264 | config->writeEntry("Main Splitter Frame",listINT2); | 2293 | config->writeEntry("Main Splitter Frame",listINT2); |
2265 | #ifdef DESKTOP_VERSION | 2294 | #ifdef DESKTOP_VERSION |
2266 | config->setGroup("WidgetLayout"); | 2295 | config->setGroup("WidgetLayout"); |
2267 | QStringList list ;//= config->readListEntry("MainLayout"); | 2296 | QStringList list ;//= config->readListEntry("MainLayout"); |
2268 | int x,y,w,h; | 2297 | int x,y,w,h; |
2269 | QWidget* wid; | 2298 | QWidget* wid; |
2270 | wid = topLevelWidget(); | 2299 | wid = topLevelWidget(); |
2271 | x = wid->geometry().x(); | 2300 | x = wid->geometry().x(); |
2272 | y = wid->geometry().y(); | 2301 | y = wid->geometry().y(); |
2273 | w = wid->width(); | 2302 | w = wid->width(); |
2274 | h = wid->height(); | 2303 | h = wid->height(); |
2275 | list.clear(); | 2304 | list.clear(); |
2276 | list << QString::number( x ); | 2305 | list << QString::number( x ); |
2277 | list << QString::number( y ); | 2306 | list << QString::number( y ); |
2278 | list << QString::number( w ); | 2307 | list << QString::number( w ); |
2279 | list << QString::number( h ); | 2308 | list << QString::number( h ); |
2280 | config->writeEntry("MainLayout",list ); | 2309 | config->writeEntry("MainLayout",list ); |
2281 | 2310 | ||
2282 | wid = mEventEditor; | 2311 | wid = mEventEditor; |
2283 | x = wid->geometry().x(); | 2312 | x = wid->geometry().x(); |
2284 | y = wid->geometry().y(); | 2313 | y = wid->geometry().y(); |
2285 | w = wid->width(); | 2314 | w = wid->width(); |
2286 | h = wid->height(); | 2315 | h = wid->height(); |
2287 | list.clear(); | 2316 | list.clear(); |
2288 | list << QString::number( x ); | 2317 | list << QString::number( x ); |
2289 | list << QString::number( y ); | 2318 | list << QString::number( y ); |
2290 | list << QString::number( w ); | 2319 | list << QString::number( w ); |
2291 | list << QString::number( h ); | 2320 | list << QString::number( h ); |
2292 | config->writeEntry("EditEventLayout",list ); | 2321 | config->writeEntry("EditEventLayout",list ); |
2293 | 2322 | ||
2294 | wid = mTodoEditor; | 2323 | wid = mTodoEditor; |
2295 | x = wid->geometry().x(); | 2324 | x = wid->geometry().x(); |
2296 | y = wid->geometry().y(); | 2325 | y = wid->geometry().y(); |
2297 | w = wid->width(); | 2326 | w = wid->width(); |
2298 | h = wid->height(); | 2327 | h = wid->height(); |
2299 | list.clear(); | 2328 | list.clear(); |
2300 | list << QString::number( x ); | 2329 | list << QString::number( x ); |
2301 | list << QString::number( y ); | 2330 | list << QString::number( y ); |
2302 | list << QString::number( w ); | 2331 | list << QString::number( w ); |
2303 | list << QString::number( h ); | 2332 | list << QString::number( h ); |
2304 | config->writeEntry("EditTodoLayout",list ); | 2333 | config->writeEntry("EditTodoLayout",list ); |
2305 | wid = getEventViewerDialog(); | 2334 | wid = getEventViewerDialog(); |
2306 | x = wid->geometry().x(); | 2335 | x = wid->geometry().x(); |
2307 | y = wid->geometry().y(); | 2336 | y = wid->geometry().y(); |
2308 | w = wid->width(); | 2337 | w = wid->width(); |
2309 | h = wid->height(); | 2338 | h = wid->height(); |
2310 | list.clear(); | 2339 | list.clear(); |
2311 | list << QString::number( x ); | 2340 | list << QString::number( x ); |
2312 | list << QString::number( y ); | 2341 | list << QString::number( y ); |
2313 | list << QString::number( w ); | 2342 | list << QString::number( w ); |
2314 | list << QString::number( h ); | 2343 | list << QString::number( h ); |
2315 | config->writeEntry("ViewerLayout",list ); | 2344 | config->writeEntry("ViewerLayout",list ); |
2316 | wid = mDialogManager->getSearchDialog(); | 2345 | wid = mDialogManager->getSearchDialog(); |
2317 | if ( wid ) { | 2346 | if ( wid ) { |
2318 | x = wid->geometry().x(); | 2347 | x = wid->geometry().x(); |
2319 | y = wid->geometry().y(); | 2348 | y = wid->geometry().y(); |
2320 | w = wid->width(); | 2349 | w = wid->width(); |
2321 | h = wid->height(); | 2350 | h = wid->height(); |
2322 | list.clear(); | 2351 | list.clear(); |
2323 | list << QString::number( x ); | 2352 | list << QString::number( x ); |
2324 | list << QString::number( y ); | 2353 | list << QString::number( y ); |
2325 | list << QString::number( w ); | 2354 | list << QString::number( w ); |
2326 | list << QString::number( h ); | 2355 | list << QString::number( h ); |
2327 | config->writeEntry("SearchLayout",list ); | 2356 | config->writeEntry("SearchLayout",list ); |
2328 | } | 2357 | } |
2329 | #endif | 2358 | #endif |
2330 | 2359 | ||
2331 | 2360 | ||
2332 | config->sync(); | 2361 | config->sync(); |
2333 | } | 2362 | } |
2334 | 2363 | ||
2335 | void CalendarView::readFilterSettings(KConfig *config) | 2364 | void CalendarView::readFilterSettings(KConfig *config) |
2336 | { | 2365 | { |
2337 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2366 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2338 | 2367 | ||
2339 | mFilters.clear(); | 2368 | mFilters.clear(); |
2340 | 2369 | ||
2341 | config->setGroup("General"); | 2370 | config->setGroup("General"); |
2342 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2371 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2343 | 2372 | ||
2344 | QStringList::ConstIterator it = filterList.begin(); | 2373 | QStringList::ConstIterator it = filterList.begin(); |
2345 | QStringList::ConstIterator end = filterList.end(); | 2374 | QStringList::ConstIterator end = filterList.end(); |
2346 | while(it != end) { | 2375 | while(it != end) { |
2347 | // kdDebug() << " filter: " << (*it) << endl; | 2376 | // kdDebug() << " filter: " << (*it) << endl; |
2348 | 2377 | ||
2349 | CalFilter *filter; | 2378 | CalFilter *filter; |
2350 | filter = new CalFilter(*it); | 2379 | filter = new CalFilter(*it); |
2351 | config->setGroup("Filter_" + (*it).utf8()); | 2380 | config->setGroup("Filter_" + (*it).utf8()); |
2352 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2381 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2353 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2382 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2354 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2383 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2355 | mFilters.append(filter); | 2384 | mFilters.append(filter); |
2356 | 2385 | ||
2357 | ++it; | 2386 | ++it; |
2358 | } | 2387 | } |
2359 | 2388 | ||
2360 | if (mFilters.count() == 0) { | 2389 | if (mFilters.count() == 0) { |
2361 | CalFilter *filter = new CalFilter(i18n("Default")); | 2390 | CalFilter *filter = new CalFilter(i18n("Default")); |
2362 | mFilters.append(filter); | 2391 | mFilters.append(filter); |
2363 | } | 2392 | } |
2364 | mFilterView->updateFilters(); | 2393 | mFilterView->updateFilters(); |
2365 | config->setGroup("FilterView"); | 2394 | config->setGroup("FilterView"); |
2366 | 2395 | ||
2367 | mFilterView->blockSignals(true); | 2396 | mFilterView->blockSignals(true); |
2368 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2397 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2369 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2398 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2370 | mFilterView->blockSignals(false); | 2399 | mFilterView->blockSignals(false); |
2371 | // We do it manually to avoid it being done twice by the above calls | 2400 | // We do it manually to avoid it being done twice by the above calls |
2372 | updateFilter(); | 2401 | updateFilter(); |
2373 | } | 2402 | } |
2374 | 2403 | ||
2375 | void CalendarView::writeFilterSettings(KConfig *config) | 2404 | void CalendarView::writeFilterSettings(KConfig *config) |
2376 | { | 2405 | { |
2377 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2406 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2378 | 2407 | ||
2379 | QStringList filterList; | 2408 | QStringList filterList; |
2380 | 2409 | ||
2381 | CalFilter *filter = mFilters.first(); | 2410 | CalFilter *filter = mFilters.first(); |
2382 | while(filter) { | 2411 | while(filter) { |
2383 | // kdDebug() << " fn: " << filter->name() << endl; | 2412 | // kdDebug() << " fn: " << filter->name() << endl; |
2384 | filterList << filter->name(); | 2413 | filterList << filter->name(); |
2385 | config->setGroup("Filter_" + filter->name().utf8()); | 2414 | config->setGroup("Filter_" + filter->name().utf8()); |
2386 | config->writeEntry("Criteria",filter->criteria()); | 2415 | config->writeEntry("Criteria",filter->criteria()); |
2387 | config->writeEntry("CategoryList",filter->categoryList()); | 2416 | config->writeEntry("CategoryList",filter->categoryList()); |
2388 | filter = mFilters.next(); | 2417 | filter = mFilters.next(); |
2389 | } | 2418 | } |
2390 | config->setGroup("General"); | 2419 | config->setGroup("General"); |
2391 | config->writeEntry("CalendarFilters",filterList); | 2420 | config->writeEntry("CalendarFilters",filterList); |
2392 | 2421 | ||
2393 | config->setGroup("FilterView"); | 2422 | config->setGroup("FilterView"); |
2394 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2423 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2395 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2424 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2396 | } | 2425 | } |
2397 | 2426 | ||
2398 | 2427 | ||
2399 | void CalendarView::goToday() | 2428 | void CalendarView::goToday() |
2400 | { | 2429 | { |
2401 | if ( mViewManager->currentView()->isMonthView() ) | 2430 | if ( mViewManager->currentView()->isMonthView() ) |
2402 | mNavigator->selectTodayMonth(); | 2431 | mNavigator->selectTodayMonth(); |
2403 | else | 2432 | else |
2404 | mNavigator->selectToday(); | 2433 | mNavigator->selectToday(); |
2405 | } | 2434 | } |
2406 | 2435 | ||
2407 | void CalendarView::goNext() | 2436 | void CalendarView::goNext() |
2408 | { | 2437 | { |
2409 | mNavigator->selectNext(); | 2438 | mNavigator->selectNext(); |
2410 | } | 2439 | } |
2411 | 2440 | ||
2412 | void CalendarView::goPrevious() | 2441 | void CalendarView::goPrevious() |
2413 | { | 2442 | { |
2414 | mNavigator->selectPrevious(); | 2443 | mNavigator->selectPrevious(); |
2415 | } | 2444 | } |
2416 | void CalendarView::goNextMonth() | 2445 | void CalendarView::goNextMonth() |
2417 | { | 2446 | { |
2418 | mNavigator->selectNextMonth(); | 2447 | mNavigator->selectNextMonth(); |
2419 | } | 2448 | } |
2420 | 2449 | ||
2421 | void CalendarView::goPreviousMonth() | 2450 | void CalendarView::goPreviousMonth() |
2422 | { | 2451 | { |
2423 | mNavigator->selectPreviousMonth(); | 2452 | mNavigator->selectPreviousMonth(); |
2424 | } | 2453 | } |
2425 | void CalendarView::writeLocale() | 2454 | void CalendarView::writeLocale() |
2426 | { | 2455 | { |
2427 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2456 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2428 | #if 0 | 2457 | #if 0 |
2429 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2458 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2430 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2459 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2431 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2460 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2432 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2461 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2433 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2462 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2434 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2463 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2435 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2464 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2436 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2465 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2437 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2466 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2438 | KOPrefs::instance()->mDaylightsavingStart, | 2467 | KOPrefs::instance()->mDaylightsavingStart, |
2439 | KOPrefs::instance()->mDaylightsavingEnd ); | 2468 | KOPrefs::instance()->mDaylightsavingEnd ); |
2440 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2469 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2441 | #endif | 2470 | #endif |
2442 | } | 2471 | } |
2443 | void CalendarView::updateConfig() | 2472 | void CalendarView::updateConfig() |
2444 | { | 2473 | { |
2445 | writeLocale(); | 2474 | writeLocale(); |
2446 | if ( KOPrefs::instance()->mUseAppColors ) | 2475 | if ( KOPrefs::instance()->mUseAppColors ) |
2447 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2476 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2448 | emit configChanged(); | 2477 | emit configChanged(); |
2449 | mTodoList->updateConfig(); | 2478 | mTodoList->updateConfig(); |
2450 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2479 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2451 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2480 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2452 | // To make the "fill window" configurations work | 2481 | // To make the "fill window" configurations work |
2453 | //mViewManager->raiseCurrentView(); | 2482 | //mViewManager->raiseCurrentView(); |
2454 | } | 2483 | } |
2455 | 2484 | ||
2456 | 2485 | ||
2457 | void CalendarView::eventChanged(Event *event) | 2486 | void CalendarView::eventChanged(Event *event) |
2458 | { | 2487 | { |
2459 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2488 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2460 | //updateUnmanagedViews(); | 2489 | //updateUnmanagedViews(); |
2461 | } | 2490 | } |
2462 | 2491 | ||
2463 | void CalendarView::eventAdded(Event *event) | 2492 | void CalendarView::eventAdded(Event *event) |
2464 | { | 2493 | { |
2465 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2494 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2466 | } | 2495 | } |
2467 | 2496 | ||
2468 | void CalendarView::eventToBeDeleted(Event *) | 2497 | void CalendarView::eventToBeDeleted(Event *) |
2469 | { | 2498 | { |
2470 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2499 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2471 | } | 2500 | } |
2472 | 2501 | ||
2473 | void CalendarView::eventDeleted() | 2502 | void CalendarView::eventDeleted() |
2474 | { | 2503 | { |
2475 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2504 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2476 | } | 2505 | } |
2477 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2506 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2478 | { | 2507 | { |
2479 | changeIncidenceDisplay((Incidence *)which, action); | 2508 | changeIncidenceDisplay((Incidence *)which, action); |
2480 | mDateNavigator->updateView(); //LR | 2509 | mDateNavigator->updateView(); //LR |
2481 | //mDialogManager->updateSearchDialog(); | 2510 | //mDialogManager->updateSearchDialog(); |
2482 | 2511 | ||
2483 | if (which) { | 2512 | if (which) { |
2484 | mViewManager->updateWNview(); | 2513 | mViewManager->updateWNview(); |
2485 | //mTodoList->updateView(); | 2514 | //mTodoList->updateView(); |
2486 | } | 2515 | } |
2487 | 2516 | ||
2488 | } | 2517 | } |
2489 | 2518 | ||
2490 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2519 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2491 | { | 2520 | { |
2492 | updateUnmanagedViews(); | 2521 | updateUnmanagedViews(); |
2493 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2522 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2494 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2523 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2495 | mCalendar->checkAlarmForIncidence( 0, true ); | 2524 | mCalendar->checkAlarmForIncidence( 0, true ); |
2496 | if ( mEventViewerDialog ) | 2525 | if ( mEventViewerDialog ) |
2497 | mEventViewerDialog->hide(); | 2526 | mEventViewerDialog->hide(); |
2498 | } | 2527 | } |
2499 | else | 2528 | else |
2500 | mCalendar->checkAlarmForIncidence( which , false ); | 2529 | mCalendar->checkAlarmForIncidence( which , false ); |
2501 | } | 2530 | } |
2502 | 2531 | ||
2503 | // most of the changeEventDisplays() right now just call the view's | 2532 | // most of the changeEventDisplays() right now just call the view's |
2504 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2533 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2505 | void CalendarView::changeEventDisplay(Event *which, int action) | 2534 | void CalendarView::changeEventDisplay(Event *which, int action) |
2506 | { | 2535 | { |
2507 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2536 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2508 | changeIncidenceDisplay((Incidence *)which, action); | 2537 | changeIncidenceDisplay((Incidence *)which, action); |
2509 | mDateNavigator->updateView(); | 2538 | mDateNavigator->updateView(); |
2510 | //mDialogManager->updateSearchDialog(); | 2539 | //mDialogManager->updateSearchDialog(); |
2511 | 2540 | ||
2512 | if (which) { | 2541 | if (which) { |
2513 | // If there is an event view visible update the display | 2542 | // If there is an event view visible update the display |
2514 | mViewManager->currentView()->changeEventDisplay(which,action); | 2543 | mViewManager->currentView()->changeEventDisplay(which,action); |
2515 | // TODO: check, if update needed | 2544 | // TODO: check, if update needed |
2516 | // if (which->getTodoStatus()) { | 2545 | // if (which->getTodoStatus()) { |
2517 | mTodoList->updateView(); | 2546 | mTodoList->updateView(); |
2518 | // } | 2547 | // } |
2519 | } else { | 2548 | } else { |
2520 | mViewManager->currentView()->updateView(); | 2549 | mViewManager->currentView()->updateView(); |
2521 | } | 2550 | } |
2522 | } | 2551 | } |
2523 | 2552 | ||
2524 | 2553 | ||
2525 | void CalendarView::updateTodoViews() | 2554 | void CalendarView::updateTodoViews() |
2526 | { | 2555 | { |
2527 | mTodoList->updateView(); | 2556 | mTodoList->updateView(); |
2528 | mViewManager->currentView()->updateView(); | 2557 | mViewManager->currentView()->updateView(); |
2529 | 2558 | ||
2530 | } | 2559 | } |
2531 | 2560 | ||
2532 | 2561 | ||
2533 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2562 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2534 | { | 2563 | { |
2535 | mTodoList->updateView(); | 2564 | mTodoList->updateView(); |
2536 | mViewManager->updateView(start, end); | 2565 | mViewManager->updateView(start, end); |
2537 | //mDateNavigator->updateView(); | 2566 | //mDateNavigator->updateView(); |
2538 | } | 2567 | } |
2539 | 2568 | ||
2540 | void CalendarView::clearAllViews() | 2569 | void CalendarView::clearAllViews() |
2541 | { | 2570 | { |
2542 | mTodoList->clearList(); | 2571 | mTodoList->clearList(); |
2543 | mViewManager->clearAllViews(); | 2572 | mViewManager->clearAllViews(); |
2544 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2573 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2545 | if ( sd ) { | 2574 | if ( sd ) { |
2546 | KOListView* kol = sd->listview(); | 2575 | KOListView* kol = sd->listview(); |
2547 | if ( kol ) | 2576 | if ( kol ) |
2548 | kol->clearList(); | 2577 | kol->clearList(); |
2549 | } | 2578 | } |
2550 | } | 2579 | } |
2551 | void CalendarView::updateView() | 2580 | void CalendarView::updateView() |
2552 | { | 2581 | { |
2553 | DateList tmpList = mNavigator->selectedDates(); | 2582 | DateList tmpList = mNavigator->selectedDates(); |
2554 | 2583 | ||
2555 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2584 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2556 | mTodoList->updateView(); | 2585 | mTodoList->updateView(); |
2557 | // We assume that the navigator only selects consecutive days. | 2586 | // We assume that the navigator only selects consecutive days. |
2558 | updateView( tmpList.first(), tmpList.last() ); | 2587 | updateView( tmpList.first(), tmpList.last() ); |
2559 | } | 2588 | } |
2560 | 2589 | ||
2561 | void CalendarView::updateUnmanagedViews() | 2590 | void CalendarView::updateUnmanagedViews() |
2562 | { | 2591 | { |
2563 | mDateNavigator->updateDayMatrix(); | 2592 | mDateNavigator->updateDayMatrix(); |
2564 | } | 2593 | } |
2565 | 2594 | ||
2566 | int CalendarView::msgItemDelete(const QString name) | 2595 | int CalendarView::msgItemDelete(const QString name) |
2567 | { | 2596 | { |
2568 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2597 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2569 | i18n("This item will be\npermanently deleted."), | 2598 | i18n("This item will be\npermanently deleted."), |
2570 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2599 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2571 | } | 2600 | } |
2572 | 2601 | ||
2573 | 2602 | ||
2574 | void CalendarView::edit_cut() | 2603 | void CalendarView::edit_cut() |
2575 | { | 2604 | { |
2576 | Event *anEvent=0; | 2605 | Event *anEvent=0; |
2577 | 2606 | ||
2578 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2607 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2579 | 2608 | ||
2580 | if (mViewManager->currentView()->isEventView()) { | 2609 | if (mViewManager->currentView()->isEventView()) { |
2581 | if ( incidence && incidence->typeID() == eventID ) { | 2610 | if ( incidence && incidence->typeID() == eventID ) { |
2582 | anEvent = static_cast<Event *>(incidence); | 2611 | anEvent = static_cast<Event *>(incidence); |
2583 | } | 2612 | } |
2584 | } | 2613 | } |
2585 | 2614 | ||
2586 | if (!anEvent) { | 2615 | if (!anEvent) { |
2587 | KNotifyClient::beep(); | 2616 | KNotifyClient::beep(); |
2588 | return; | 2617 | return; |
2589 | } | 2618 | } |
2590 | DndFactory factory( mCalendar ); | 2619 | DndFactory factory( mCalendar ); |
2591 | factory.cutIncidence(anEvent); | 2620 | factory.cutIncidence(anEvent); |
2592 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2621 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2593 | } | 2622 | } |
2594 | 2623 | ||
2595 | void CalendarView::edit_copy() | 2624 | void CalendarView::edit_copy() |
2596 | { | 2625 | { |
2597 | Event *anEvent=0; | 2626 | Event *anEvent=0; |
2598 | 2627 | ||
2599 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2628 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2600 | 2629 | ||
2601 | if (mViewManager->currentView()->isEventView()) { | 2630 | if (mViewManager->currentView()->isEventView()) { |
2602 | if ( incidence && incidence->typeID() == eventID ) { | 2631 | if ( incidence && incidence->typeID() == eventID ) { |
2603 | anEvent = static_cast<Event *>(incidence); | 2632 | anEvent = static_cast<Event *>(incidence); |
2604 | } | 2633 | } |
2605 | } | 2634 | } |
2606 | 2635 | ||
2607 | if (!anEvent) { | 2636 | if (!anEvent) { |
2608 | KNotifyClient::beep(); | 2637 | KNotifyClient::beep(); |
2609 | return; | 2638 | return; |
2610 | } | 2639 | } |
2611 | DndFactory factory( mCalendar ); | 2640 | DndFactory factory( mCalendar ); |
2612 | factory.copyIncidence(anEvent); | 2641 | factory.copyIncidence(anEvent); |
2613 | } | 2642 | } |
2614 | 2643 | ||
2615 | void CalendarView::edit_paste() | 2644 | void CalendarView::edit_paste() |
2616 | { | 2645 | { |
2617 | QDate date = mNavigator->selectedDates().first(); | 2646 | QDate date = mNavigator->selectedDates().first(); |
2618 | 2647 | ||
2619 | DndFactory factory( mCalendar ); | 2648 | DndFactory factory( mCalendar ); |
2620 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2649 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2621 | 2650 | ||
2622 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2651 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2623 | } | 2652 | } |
2624 | void CalendarView::edit_global_options() | 2653 | void CalendarView::edit_global_options() |
2625 | { | 2654 | { |
2626 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2655 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2627 | emit save(); | 2656 | emit save(); |
2628 | emit saveStopTimer(); | 2657 | emit saveStopTimer(); |
2629 | mDialogManager->showGlobalOptionsDialog(); | 2658 | mDialogManager->showGlobalOptionsDialog(); |
2630 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2659 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2631 | emit saveStopTimer(); | 2660 | emit saveStopTimer(); |
2632 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2661 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2633 | i18n("Timezone settings"),i18n("Reload"))) { | 2662 | i18n("Timezone settings"),i18n("Reload"))) { |
2634 | qDebug("KO: TZ reload cancelled "); | 2663 | qDebug("KO: TZ reload cancelled "); |
2635 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2664 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2636 | return; | 2665 | return; |
2637 | } | 2666 | } |
2638 | qDebug("KO: Timezone change "); | 2667 | qDebug("KO: Timezone change "); |
2639 | openCalendar( MainWindow::defaultFileName() ); | 2668 | openCalendar( MainWindow::defaultFileName() ); |
2640 | setModified(true); | 2669 | setModified(true); |
2641 | } | 2670 | } |
2642 | else | 2671 | else |
2643 | qDebug("KO: No tz change "); | 2672 | qDebug("KO: No tz change "); |
2644 | } | 2673 | } |
2645 | void CalendarView::edit_options() | 2674 | void CalendarView::edit_options() |
2646 | { | 2675 | { |
2647 | mDialogManager->showOptionsDialog(); | 2676 | mDialogManager->showOptionsDialog(); |
2648 | } | 2677 | } |
2649 | 2678 | ||
2650 | 2679 | ||
2651 | void CalendarView::slotSelectPickerDate( QDate d) | 2680 | void CalendarView::slotSelectPickerDate( QDate d) |
2652 | { | 2681 | { |
2653 | mDateFrame->hide(); | 2682 | mDateFrame->hide(); |
2654 | if ( mDatePickerMode == 1 ) { | 2683 | if ( mDatePickerMode == 1 ) { |
2655 | mNavigator->slotDaySelect( d ); | 2684 | mNavigator->slotDaySelect( d ); |
2656 | } else if ( mDatePickerMode == 2 ) { | 2685 | } else if ( mDatePickerMode == 2 ) { |
2657 | if ( mMoveIncidence->typeID() == todoID ) { | 2686 | if ( mMoveIncidence->typeID() == todoID ) { |
2658 | Todo * to = (Todo *) mMoveIncidence; | 2687 | Todo * to = (Todo *) mMoveIncidence; |
2659 | QTime tim; | 2688 | QTime tim; |
2660 | int len = 0; | 2689 | int len = 0; |
2661 | if ( to->hasStartDate() && to->hasDueDate() ) | 2690 | if ( to->hasStartDate() && to->hasDueDate() ) |
2662 | len = to->dtStart().secsTo( to->dtDue()); | 2691 | len = to->dtStart().secsTo( to->dtDue()); |
2663 | if ( to->hasDueDate() ) | 2692 | if ( to->hasDueDate() ) |
2664 | tim = to->dtDue().time(); | 2693 | tim = to->dtDue().time(); |
2665 | else { | 2694 | else { |
2666 | tim = QTime ( 0,0,0 ); | 2695 | tim = QTime ( 0,0,0 ); |
2667 | to->setFloats( true ); | 2696 | to->setFloats( true ); |
2668 | to->setHasDueDate( true ); | 2697 | to->setHasDueDate( true ); |
2669 | } | 2698 | } |
2670 | QDateTime dt ( d,tim ); | 2699 | QDateTime dt ( d,tim ); |
2671 | to->setDtDue( dt ); | 2700 | to->setDtDue( dt ); |
2672 | 2701 | ||
2673 | if ( to->hasStartDate() ) { | 2702 | if ( to->hasStartDate() ) { |
2674 | if ( len>0 ) | 2703 | if ( len>0 ) |
2675 | to->setDtStart(to->dtDue().addSecs( -len )); | 2704 | to->setDtStart(to->dtDue().addSecs( -len )); |
2676 | else | 2705 | else |
2677 | if (to->dtStart() > to->dtDue() ) | 2706 | if (to->dtStart() > to->dtDue() ) |
2678 | to->setDtStart(to->dtDue().addDays( -3 )); | 2707 | to->setDtStart(to->dtDue().addDays( -3 )); |
2679 | } | 2708 | } |
2680 | 2709 | ||
2681 | todoChanged( to ); | 2710 | todoChanged( to ); |
2682 | } else { | 2711 | } else { |
2683 | if ( mMoveIncidence->doesRecur() ) { | 2712 | if ( mMoveIncidence->doesRecur() ) { |
2684 | #if 0 | 2713 | #if 0 |
2685 | // PENDING implement this | 2714 | // PENDING implement this |
2686 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2715 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2687 | mCalendar()->addIncidence( newInc ); | 2716 | mCalendar()->addIncidence( newInc ); |
2688 | if ( mMoveIncidence->typeID() == todoID ) | 2717 | if ( mMoveIncidence->typeID() == todoID ) |
2689 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2718 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2690 | else | 2719 | else |
2691 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2720 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2692 | mMoveIncidence = newInc; | 2721 | mMoveIncidence = newInc; |
2693 | 2722 | ||
2694 | #endif | 2723 | #endif |
2695 | } | 2724 | } |
2696 | QTime tim = mMoveIncidence->dtStart().time(); | 2725 | QTime tim = mMoveIncidence->dtStart().time(); |
2697 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2726 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2698 | QDateTime dt ( d,tim ); | 2727 | QDateTime dt ( d,tim ); |
2699 | mMoveIncidence->setDtStart( dt ); | 2728 | mMoveIncidence->setDtStart( dt ); |
2700 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2729 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2701 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2730 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2702 | } | 2731 | } |
2703 | 2732 | ||
2704 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2733 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2705 | } | 2734 | } |
2706 | } | 2735 | } |
2707 | 2736 | ||
2708 | void CalendarView::removeCategories() | 2737 | void CalendarView::removeCategories() |
2709 | { | 2738 | { |
2710 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2739 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2711 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2740 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2712 | QStringList catIncList; | 2741 | QStringList catIncList; |
2713 | QStringList newCatList; | 2742 | QStringList newCatList; |
2714 | Incidence* inc = incList.first(); | 2743 | Incidence* inc = incList.first(); |
2715 | int i; | 2744 | int i; |
2716 | int count = 0; | 2745 | int count = 0; |
2717 | while ( inc ) { | 2746 | while ( inc ) { |
2718 | newCatList.clear(); | 2747 | newCatList.clear(); |
2719 | catIncList = inc->categories() ; | 2748 | catIncList = inc->categories() ; |
2720 | for( i = 0; i< catIncList.count(); ++i ) { | 2749 | for( i = 0; i< catIncList.count(); ++i ) { |
2721 | if ( catList.contains (catIncList[i])) | 2750 | if ( catList.contains (catIncList[i])) |
2722 | newCatList.append( catIncList[i] ); | 2751 | newCatList.append( catIncList[i] ); |
2723 | } | 2752 | } |
2724 | newCatList.sort(); | 2753 | newCatList.sort(); |
2725 | inc->setCategories( newCatList.join(",") ); | 2754 | inc->setCategories( newCatList.join(",") ); |
2726 | inc = incList.next(); | 2755 | inc = incList.next(); |
2727 | } | 2756 | } |
2728 | } | 2757 | } |
2729 | 2758 | ||
2730 | int CalendarView::addCategories() | 2759 | int CalendarView::addCategories() |
2731 | { | 2760 | { |
2732 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2761 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2733 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2762 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2734 | QStringList catIncList; | 2763 | QStringList catIncList; |
2735 | Incidence* inc = incList.first(); | 2764 | Incidence* inc = incList.first(); |
2736 | int i; | 2765 | int i; |
2737 | int count = 0; | 2766 | int count = 0; |
2738 | while ( inc ) { | 2767 | while ( inc ) { |
2739 | catIncList = inc->categories() ; | 2768 | catIncList = inc->categories() ; |
2740 | for( i = 0; i< catIncList.count(); ++i ) { | 2769 | for( i = 0; i< catIncList.count(); ++i ) { |
2741 | if ( !catList.contains (catIncList[i])) { | 2770 | if ( !catList.contains (catIncList[i])) { |
2742 | catList.append( catIncList[i] ); | 2771 | catList.append( catIncList[i] ); |
2743 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2772 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2744 | ++count; | 2773 | ++count; |
2745 | } | 2774 | } |
2746 | } | 2775 | } |
2747 | inc = incList.next(); | 2776 | inc = incList.next(); |
2748 | } | 2777 | } |
2749 | catList.sort(); | 2778 | catList.sort(); |
2750 | KOPrefs::instance()->mCustomCategories = catList; | 2779 | KOPrefs::instance()->mCustomCategories = catList; |
2751 | return count; | 2780 | return count; |
2752 | } | 2781 | } |
2753 | 2782 | ||
2754 | void CalendarView::manageCategories() | 2783 | void CalendarView::manageCategories() |
2755 | { | 2784 | { |
2756 | KOCatPrefs* cp = new KOCatPrefs(); | 2785 | KOCatPrefs* cp = new KOCatPrefs(); |
2757 | cp->show(); | 2786 | cp->show(); |
2758 | int w =cp->sizeHint().width() ; | 2787 | int w =cp->sizeHint().width() ; |
2759 | int h = cp->sizeHint().height() ; | 2788 | int h = cp->sizeHint().height() ; |
2760 | int dw = QApplication::desktop()->width(); | 2789 | int dw = QApplication::desktop()->width(); |
2761 | int dh = QApplication::desktop()->height(); | 2790 | int dh = QApplication::desktop()->height(); |
2762 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2791 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2763 | if ( !cp->exec() ) { | 2792 | if ( !cp->exec() ) { |
2764 | delete cp; | 2793 | delete cp; |
2765 | return; | 2794 | return; |
2766 | } | 2795 | } |
2767 | int count = 0; | 2796 | int count = 0; |
2768 | if ( cp->addCat() ) { | 2797 | if ( cp->addCat() ) { |
2769 | count = addCategories(); | 2798 | count = addCategories(); |
2770 | if ( count ) { | 2799 | if ( count ) { |
2771 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2800 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2772 | writeSettings(); | 2801 | writeSettings(); |
2773 | } else | 2802 | } else |
2774 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2803 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2775 | } else { | 2804 | } else { |
2776 | removeCategories(); | 2805 | removeCategories(); |
2777 | updateView(); | 2806 | updateView(); |
2778 | } | 2807 | } |
2779 | delete cp; | 2808 | delete cp; |
2780 | } | 2809 | } |
2781 | 2810 | ||
2782 | void CalendarView::beamIncidence(Incidence * Inc) | 2811 | void CalendarView::beamIncidence(Incidence * Inc) |
2783 | { | 2812 | { |
2784 | QPtrList<Incidence> delSel ; | 2813 | QPtrList<Incidence> delSel ; |
2785 | delSel.append(Inc); | 2814 | delSel.append(Inc); |
2786 | beamIncidenceList( delSel ); | 2815 | beamIncidenceList( delSel ); |
2787 | } | 2816 | } |
2788 | void CalendarView::beamCalendar() | 2817 | void CalendarView::beamCalendar() |
2789 | { | 2818 | { |
2790 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2819 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2791 | //qDebug("beamCalendar() "); | 2820 | //qDebug("beamCalendar() "); |
2792 | beamIncidenceList( delSel ); | 2821 | beamIncidenceList( delSel ); |
2793 | } | 2822 | } |
2794 | void CalendarView::beamFilteredCalendar() | 2823 | void CalendarView::beamFilteredCalendar() |
2795 | { | 2824 | { |
2796 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2825 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2797 | //qDebug("beamFilteredCalendar() "); | 2826 | //qDebug("beamFilteredCalendar() "); |
2798 | beamIncidenceList( delSel ); | 2827 | beamIncidenceList( delSel ); |
2799 | } | 2828 | } |
2800 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2829 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2801 | { | 2830 | { |
2802 | if ( beamDialog->exec () == QDialog::Rejected ) | 2831 | if ( beamDialog->exec () == QDialog::Rejected ) |
2803 | return; | 2832 | return; |
2804 | #ifdef DESKTOP_VERSION | 2833 | #ifdef DESKTOP_VERSION |
2805 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2834 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2806 | #else | 2835 | #else |
2807 | QString fn = "/tmp/kopibeamfile"; | 2836 | QString fn = "/tmp/kopibeamfile"; |
2808 | #endif | 2837 | #endif |
2809 | QString mes; | 2838 | QString mes; |
2810 | bool createbup = true; | 2839 | bool createbup = true; |
2811 | if ( createbup ) { | 2840 | if ( createbup ) { |
2812 | QString description = "\n"; | 2841 | QString description = "\n"; |
2813 | CalendarLocal* cal = new CalendarLocal(); | 2842 | CalendarLocal* cal = new CalendarLocal(); |
2814 | if ( beamDialog->beamLocal() ) | 2843 | if ( beamDialog->beamLocal() ) |
2815 | cal->setLocalTime(); | 2844 | cal->setLocalTime(); |
2816 | else | 2845 | else |
2817 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2846 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2818 | Incidence *incidence = delSel.first(); | 2847 | Incidence *incidence = delSel.first(); |
2819 | bool addText = false; | 2848 | bool addText = false; |
2820 | if ( delSel.count() < 10 ) | 2849 | if ( delSel.count() < 10 ) |
2821 | addText = true; | 2850 | addText = true; |
2822 | else { | 2851 | else { |
2823 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2852 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2824 | } | 2853 | } |
2825 | while ( incidence ) { | 2854 | while ( incidence ) { |
2826 | Incidence *in = incidence->clone(); | 2855 | Incidence *in = incidence->clone(); |
2827 | if ( ! in->summary().isEmpty() ) { | 2856 | if ( ! in->summary().isEmpty() ) { |
2828 | in->setDescription(""); | 2857 | in->setDescription(""); |
2829 | } else { | 2858 | } else { |
2830 | in->setSummary( in->description().left(20)); | 2859 | in->setSummary( in->description().left(20)); |
2831 | in->setDescription(""); | 2860 | in->setDescription(""); |
2832 | } | 2861 | } |
2833 | if ( addText ) | 2862 | if ( addText ) |
2834 | description += in->summary() + "\n"; | 2863 | description += in->summary() + "\n"; |
2835 | cal->addIncidence( in ); | 2864 | cal->addIncidence( in ); |
2836 | incidence = delSel.next(); | 2865 | incidence = delSel.next(); |
2837 | } | 2866 | } |
2838 | if ( beamDialog->beamVcal() ) { | 2867 | if ( beamDialog->beamVcal() ) { |
2839 | fn += ".vcs"; | 2868 | fn += ".vcs"; |
2840 | FileStorage storage( cal, fn, new VCalFormat ); | 2869 | FileStorage storage( cal, fn, new VCalFormat ); |
2841 | storage.save(); | 2870 | storage.save(); |
2842 | } else { | 2871 | } else { |
2843 | fn += ".ics"; | 2872 | fn += ".ics"; |
2844 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2873 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2845 | storage.save(); | 2874 | storage.save(); |
2846 | } | 2875 | } |
2847 | delete cal; | 2876 | delete cal; |
2848 | mes = i18n("KO/Pi: Ready for beaming"); | 2877 | mes = i18n("KO/Pi: Ready for beaming"); |
2849 | topLevelWidget()->setCaption(mes); | 2878 | topLevelWidget()->setCaption(mes); |
2850 | KApplication::convert2latin1( fn ); | 2879 | KApplication::convert2latin1( fn ); |
2851 | #ifndef DESKTOP_VERSION | 2880 | #ifndef DESKTOP_VERSION |
2852 | Ir *ir = new Ir( this ); | 2881 | Ir *ir = new Ir( this ); |
2853 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2882 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2854 | ir->send( fn, description, "text/x-vCalendar" ); | 2883 | ir->send( fn, description, "text/x-vCalendar" ); |
2855 | #endif | 2884 | #endif |
2856 | } | 2885 | } |
2857 | } | 2886 | } |
2858 | void CalendarView::beamDone( Ir *ir ) | 2887 | void CalendarView::beamDone( Ir *ir ) |
2859 | { | 2888 | { |
2860 | #ifndef DESKTOP_VERSION | 2889 | #ifndef DESKTOP_VERSION |
2861 | delete ir; | 2890 | delete ir; |
2862 | #endif | 2891 | #endif |
2863 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2892 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2864 | topLevelWidget()->raise(); | 2893 | topLevelWidget()->raise(); |
2865 | } | 2894 | } |
2866 | 2895 | ||
2867 | void CalendarView::moveIncidence(Incidence * inc ) | 2896 | void CalendarView::moveIncidence(Incidence * inc ) |
2868 | { | 2897 | { |
2869 | if ( !inc ) return; | 2898 | if ( !inc ) return; |
2870 | showDatePickerPopup(); | 2899 | showDatePickerPopup(); |
2871 | mDatePickerMode = 2; | 2900 | mDatePickerMode = 2; |
2872 | mMoveIncidence = inc ; | 2901 | mMoveIncidence = inc ; |
2873 | QDate da; | 2902 | QDate da; |
2874 | if ( mMoveIncidence->typeID() == todoID ) { | 2903 | if ( mMoveIncidence->typeID() == todoID ) { |
2875 | Todo * to = (Todo *) mMoveIncidence; | 2904 | Todo * to = (Todo *) mMoveIncidence; |
2876 | if ( to->hasDueDate() ) | 2905 | if ( to->hasDueDate() ) |
2877 | da = to->dtDue().date(); | 2906 | da = to->dtDue().date(); |
2878 | else | 2907 | else |
2879 | da = QDate::currentDate(); | 2908 | da = QDate::currentDate(); |
2880 | } else { | 2909 | } else { |
2881 | da = mMoveIncidence->dtStart().date(); | 2910 | da = mMoveIncidence->dtStart().date(); |
2882 | } | 2911 | } |
2883 | //PENDING set date for recurring incidence to date of recurrence | 2912 | //PENDING set date for recurring incidence to date of recurrence |
2884 | //mMoveIncidenceOldDate; | 2913 | //mMoveIncidenceOldDate; |
2885 | mDatePicker->setDate( da ); | 2914 | mDatePicker->setDate( da ); |
2886 | } | 2915 | } |
2887 | void CalendarView::showDatePickerPopup() | 2916 | void CalendarView::showDatePickerPopup() |
2888 | { | 2917 | { |
2889 | if ( mDateFrame->isVisible() ) | 2918 | if ( mDateFrame->isVisible() ) |
2890 | mDateFrame->hide(); | 2919 | mDateFrame->hide(); |
2891 | else { | 2920 | else { |
2892 | int offX = 0, offY = 0; | 2921 | int offX = 0, offY = 0; |
2893 | #ifdef DESKTOP_VERSION | 2922 | #ifdef DESKTOP_VERSION |
2894 | int w =mDatePicker->sizeHint().width() ; | 2923 | int w =mDatePicker->sizeHint().width() ; |
2895 | int h = mDatePicker->sizeHint().height() ; | 2924 | int h = mDatePicker->sizeHint().height() ; |
2896 | int dw = topLevelWidget()->width(); | 2925 | int dw = topLevelWidget()->width(); |
2897 | int dh = topLevelWidget()->height(); | 2926 | int dh = topLevelWidget()->height(); |
2898 | offX = topLevelWidget()->x(); | 2927 | offX = topLevelWidget()->x(); |
2899 | offY = topLevelWidget()->y(); | 2928 | offY = topLevelWidget()->y(); |
2900 | #else | 2929 | #else |
2901 | int w =mDatePicker->sizeHint().width() ; | 2930 | int w =mDatePicker->sizeHint().width() ; |
2902 | int h = mDatePicker->sizeHint().height() ; | 2931 | int h = mDatePicker->sizeHint().height() ; |
2903 | int dw = QApplication::desktop()->width(); | 2932 | int dw = QApplication::desktop()->width(); |
2904 | int dh = QApplication::desktop()->height(); | 2933 | int dh = QApplication::desktop()->height(); |
2905 | #endif | 2934 | #endif |
2906 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 2935 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
2907 | mDateFrame->show(); | 2936 | mDateFrame->show(); |
2908 | } | 2937 | } |
2909 | } | 2938 | } |
2910 | void CalendarView::showDatePicker( ) | 2939 | void CalendarView::showDatePicker( ) |
2911 | { | 2940 | { |
2912 | showDatePickerPopup(); | 2941 | showDatePickerPopup(); |
2913 | mDatePickerMode = 1; | 2942 | mDatePickerMode = 1; |
2914 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2943 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2915 | } | 2944 | } |
2916 | 2945 | ||
2917 | void CalendarView::showEventEditor() | 2946 | void CalendarView::showEventEditor() |
2918 | { | 2947 | { |
2919 | #ifdef DESKTOP_VERSION | 2948 | #ifdef DESKTOP_VERSION |
2920 | int x,y,w,h; | 2949 | int x,y,w,h; |
2921 | x = mEventEditor->geometry().x(); | 2950 | x = mEventEditor->geometry().x(); |
2922 | y = mEventEditor->geometry().y(); | 2951 | y = mEventEditor->geometry().y(); |
2923 | w = mEventEditor->width(); | 2952 | w = mEventEditor->width(); |
2924 | h = mEventEditor->height(); | 2953 | h = mEventEditor->height(); |
2925 | mEventEditor->show(); | 2954 | mEventEditor->show(); |
2926 | mEventEditor->setGeometry(x,y,w,h); | 2955 | mEventEditor->setGeometry(x,y,w,h); |
2927 | #else | 2956 | #else |
2928 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2957 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2929 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2958 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2930 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2959 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2931 | qApp->processEvents(); | 2960 | qApp->processEvents(); |
2932 | delete mEventEditor; | 2961 | delete mEventEditor; |
2933 | mEventEditor = mDialogManager->getEventEditor(); | 2962 | mEventEditor = mDialogManager->getEventEditor(); |
2934 | topLevelWidget()->setCaption( i18n("") ); | 2963 | topLevelWidget()->setCaption( i18n("") ); |
2935 | } | 2964 | } |
2936 | mEventEditor->showMaximized(); | 2965 | mEventEditor->showMaximized(); |
2937 | #endif | 2966 | #endif |
2938 | } | 2967 | } |
2939 | void CalendarView::showTodoEditor() | 2968 | void CalendarView::showTodoEditor() |
2940 | { | 2969 | { |
2941 | #ifdef DESKTOP_VERSION | 2970 | #ifdef DESKTOP_VERSION |
2942 | int x,y,w,h; | 2971 | int x,y,w,h; |
2943 | x = mTodoEditor->geometry().x(); | 2972 | x = mTodoEditor->geometry().x(); |
2944 | y = mTodoEditor->geometry().y(); | 2973 | y = mTodoEditor->geometry().y(); |
2945 | w = mTodoEditor->width(); | 2974 | w = mTodoEditor->width(); |
2946 | h = mTodoEditor->height(); | 2975 | h = mTodoEditor->height(); |
2947 | mTodoEditor->show(); | 2976 | mTodoEditor->show(); |
2948 | mTodoEditor->setGeometry(x,y,w,h); | 2977 | mTodoEditor->setGeometry(x,y,w,h); |
2949 | #else | 2978 | #else |
2950 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2979 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2951 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2980 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2952 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2981 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2953 | qApp->processEvents(); | 2982 | qApp->processEvents(); |
2954 | delete mTodoEditor; | 2983 | delete mTodoEditor; |
2955 | mTodoEditor = mDialogManager->getTodoEditor(); | 2984 | mTodoEditor = mDialogManager->getTodoEditor(); |
2956 | topLevelWidget()->setCaption( i18n("") ); | 2985 | topLevelWidget()->setCaption( i18n("") ); |
2957 | } | 2986 | } |
2958 | mTodoEditor->showMaximized(); | 2987 | mTodoEditor->showMaximized(); |
2959 | #endif | 2988 | #endif |
2960 | } | 2989 | } |
2961 | 2990 | ||
2962 | void CalendarView::cloneIncidence() | 2991 | void CalendarView::cloneIncidence() |
2963 | { | 2992 | { |
2964 | Incidence *incidence = currentSelection(); | 2993 | Incidence *incidence = currentSelection(); |
2965 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2994 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2966 | if ( incidence ) { | 2995 | if ( incidence ) { |
2967 | cloneIncidence(incidence); | 2996 | cloneIncidence(incidence); |
2968 | } | 2997 | } |
2969 | } | 2998 | } |
2970 | void CalendarView::moveIncidence() | 2999 | void CalendarView::moveIncidence() |
2971 | { | 3000 | { |
2972 | Incidence *incidence = currentSelection(); | 3001 | Incidence *incidence = currentSelection(); |
2973 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3002 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2974 | if ( incidence ) { | 3003 | if ( incidence ) { |
2975 | moveIncidence(incidence); | 3004 | moveIncidence(incidence); |
2976 | } | 3005 | } |
2977 | } | 3006 | } |
2978 | void CalendarView::beamIncidence() | 3007 | void CalendarView::beamIncidence() |
2979 | { | 3008 | { |
2980 | Incidence *incidence = currentSelection(); | 3009 | Incidence *incidence = currentSelection(); |
2981 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3010 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2982 | if ( incidence ) { | 3011 | if ( incidence ) { |
2983 | beamIncidence(incidence); | 3012 | beamIncidence(incidence); |
2984 | } | 3013 | } |
2985 | } | 3014 | } |
2986 | void CalendarView::toggleCancelIncidence() | 3015 | void CalendarView::toggleCancelIncidence() |
2987 | { | 3016 | { |
2988 | Incidence *incidence = currentSelection(); | 3017 | Incidence *incidence = currentSelection(); |
2989 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3018 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2990 | if ( incidence ) { | 3019 | if ( incidence ) { |
2991 | cancelIncidence(incidence); | 3020 | cancelIncidence(incidence); |
2992 | } | 3021 | } |
2993 | } | 3022 | } |
2994 | 3023 | ||
2995 | 3024 | ||
2996 | void CalendarView::cancelIncidence(Incidence * inc ) | 3025 | void CalendarView::cancelIncidence(Incidence * inc ) |
2997 | { | 3026 | { |
2998 | inc->setCancelled( ! inc->cancelled() ); | 3027 | inc->setCancelled( ! inc->cancelled() ); |
2999 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 3028 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
3000 | updateView(); | 3029 | updateView(); |
3001 | } | 3030 | } |
3002 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 3031 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
3003 | { | 3032 | { |
3004 | Incidence * newInc = orgInc->clone(); | 3033 | Incidence * newInc = orgInc->clone(); |
3005 | newInc->recreate(); | 3034 | newInc->recreate(); |
3006 | 3035 | ||
3007 | if ( newInc->typeID() == todoID ) { | 3036 | if ( newInc->typeID() == todoID ) { |
3008 | Todo* t = (Todo*) newInc; | 3037 | Todo* t = (Todo*) newInc; |
3009 | bool cloneSub = false; | 3038 | bool cloneSub = false; |
3010 | if ( orgInc->relations().count() ) { | 3039 | if ( orgInc->relations().count() ) { |
3011 | int result = KMessageBox::warningYesNoCancel(this, | 3040 | int result = KMessageBox::warningYesNoCancel(this, |
3012 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), | 3041 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), |
3013 | i18n("Todo has subtodos"), | 3042 | i18n("Todo has subtodos"), |
3014 | i18n("Yes"), | 3043 | i18n("Yes"), |
3015 | i18n("No")); | 3044 | i18n("No")); |
3016 | 3045 | ||
3017 | if ( result == KMessageBox::Cancel ) { | 3046 | if ( result == KMessageBox::Cancel ) { |
3018 | delete t; | 3047 | delete t; |
3019 | return; | 3048 | return; |
3020 | } | 3049 | } |
3021 | if (result == KMessageBox::Yes) cloneSub = true; | 3050 | if (result == KMessageBox::Yes) cloneSub = true; |
3022 | } | 3051 | } |
3023 | showTodoEditor(); | 3052 | showTodoEditor(); |
3024 | mTodoEditor->editTodo( t ); | 3053 | mTodoEditor->editTodo( t ); |
3025 | if ( mTodoEditor->exec() ) { | 3054 | if ( mTodoEditor->exec() ) { |
3026 | if ( cloneSub ) { | 3055 | if ( cloneSub ) { |
3027 | orgInc->cloneRelations( t ); | 3056 | orgInc->cloneRelations( t ); |
3028 | mCalendar->addIncidenceBranch( t ); | 3057 | mCalendar->addIncidenceBranch( t ); |
3029 | updateView(); | 3058 | updateView(); |
3030 | 3059 | ||
3031 | } else { | 3060 | } else { |
3032 | mCalendar->addTodo( t ); | 3061 | mCalendar->addTodo( t ); |
3033 | updateView(); | 3062 | updateView(); |
3034 | } | 3063 | } |
3035 | } else { | 3064 | } else { |
3036 | delete t; | 3065 | delete t; |
3037 | } | 3066 | } |
3038 | } | 3067 | } |
3039 | else { | 3068 | else { |
3040 | Event* e = (Event*) newInc; | 3069 | Event* e = (Event*) newInc; |
3041 | showEventEditor(); | 3070 | showEventEditor(); |
3042 | mEventEditor->editEvent( e ); | 3071 | mEventEditor->editEvent( e ); |
3043 | if ( mEventEditor->exec() ) { | 3072 | if ( mEventEditor->exec() ) { |
3044 | mCalendar->addEvent( e ); | 3073 | mCalendar->addEvent( e ); |
3045 | updateView(); | 3074 | updateView(); |
3046 | } else { | 3075 | } else { |
3047 | delete e; | 3076 | delete e; |
3048 | } | 3077 | } |
3049 | } | 3078 | } |
3050 | setActiveWindow(); | 3079 | setActiveWindow(); |
3051 | } | 3080 | } |
3052 | 3081 | ||
3053 | void CalendarView::newEvent() | 3082 | void CalendarView::newEvent() |
3054 | { | 3083 | { |
3055 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 3084 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
3056 | KOAgendaView *aView = mViewManager->agendaView(); | 3085 | KOAgendaView *aView = mViewManager->agendaView(); |
3057 | if (aView) { | 3086 | if (aView) { |
3058 | if (aView->selectionStart().isValid()) { | 3087 | if (aView->selectionStart().isValid()) { |
3059 | if (aView->selectedIsAllDay()) { | 3088 | if (aView->selectedIsAllDay()) { |
3060 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 3089 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
3061 | } else { | 3090 | } else { |
3062 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3091 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3063 | } | 3092 | } |
3064 | return; | 3093 | return; |
3065 | } | 3094 | } |
3066 | } | 3095 | } |
3067 | 3096 | ||
3068 | QDate date = mNavigator->selectedDates().first(); | 3097 | QDate date = mNavigator->selectedDates().first(); |
3069 | QDateTime current = QDateTime::currentDateTime(); | 3098 | QDateTime current = QDateTime::currentDateTime(); |
3070 | if ( date <= current.date() ) { | 3099 | if ( date <= current.date() ) { |
3071 | int hour = current.time().hour() +1; | 3100 | int hour = current.time().hour() +1; |
3072 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3101 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3073 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3102 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3074 | } else | 3103 | } else |
3075 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3104 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3076 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3105 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3077 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3106 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3078 | } | 3107 | } |
3079 | 3108 | ||
3080 | void CalendarView::newEvent(QDateTime fh) | 3109 | void CalendarView::newEvent(QDateTime fh) |
3081 | { | 3110 | { |
3082 | newEvent(fh, | 3111 | newEvent(fh, |
3083 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 3112 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
3084 | } | 3113 | } |
3085 | 3114 | ||
3086 | void CalendarView::newEvent(QDate dt) | 3115 | void CalendarView::newEvent(QDate dt) |
3087 | { | 3116 | { |
3088 | newEvent(QDateTime(dt, QTime(0,0,0)), | 3117 | newEvent(QDateTime(dt, QTime(0,0,0)), |
3089 | QDateTime(dt, QTime(0,0,0)), true); | 3118 | QDateTime(dt, QTime(0,0,0)), true); |
3090 | } | 3119 | } |
3091 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 3120 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
3092 | { | 3121 | { |
3093 | newEvent(fromHint, toHint, false); | 3122 | newEvent(fromHint, toHint, false); |
3094 | } | 3123 | } |
3095 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 3124 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
3096 | { | 3125 | { |
3097 | 3126 | ||
3098 | showEventEditor(); | 3127 | showEventEditor(); |
3099 | mEventEditor->newEvent(fromHint,toHint,allDay); | 3128 | mEventEditor->newEvent(fromHint,toHint,allDay); |
3100 | if ( mFilterView->filtersEnabled() ) { | 3129 | if ( mFilterView->filtersEnabled() ) { |
3101 | CalFilter *filter = mFilterView->selectedFilter(); | 3130 | CalFilter *filter = mFilterView->selectedFilter(); |
3102 | if (filter && filter->showCategories()) { | 3131 | if (filter && filter->showCategories()) { |
3103 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 3132 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
3104 | } | 3133 | } |
3105 | if ( filter ) | 3134 | if ( filter ) |
3106 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 3135 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
3107 | } | 3136 | } |
3108 | mEventEditor->exec(); | 3137 | mEventEditor->exec(); |
3109 | setActiveWindow(); | 3138 | setActiveWindow(); |
3110 | } | 3139 | } |
3111 | void CalendarView::todoAdded(Todo * t) | 3140 | void CalendarView::todoAdded(Todo * t) |
3112 | { | 3141 | { |
3113 | 3142 | ||
3114 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 3143 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
3115 | updateTodoViews(); | 3144 | updateTodoViews(); |
3116 | } | 3145 | } |
3117 | void CalendarView::todoChanged(Todo * t) | 3146 | void CalendarView::todoChanged(Todo * t) |
3118 | { | 3147 | { |
3119 | emit todoModified( t, 4 ); | 3148 | emit todoModified( t, 4 ); |
3120 | // updateTodoViews(); | 3149 | // updateTodoViews(); |
3121 | } | 3150 | } |
3122 | void CalendarView::todoToBeDeleted(Todo *) | 3151 | void CalendarView::todoToBeDeleted(Todo *) |
3123 | { | 3152 | { |
3124 | //qDebug("todoToBeDeleted(Todo *) "); | 3153 | //qDebug("todoToBeDeleted(Todo *) "); |
3125 | updateTodoViews(); | 3154 | updateTodoViews(); |
3126 | } | 3155 | } |
3127 | void CalendarView::todoDeleted() | 3156 | void CalendarView::todoDeleted() |
3128 | { | 3157 | { |
3129 | //qDebug(" todoDeleted()"); | 3158 | //qDebug(" todoDeleted()"); |
3130 | updateTodoViews(); | 3159 | updateTodoViews(); |
3131 | } | 3160 | } |
3132 | 3161 | ||
3133 | 3162 | ||
3134 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 3163 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
3135 | { | 3164 | { |
3136 | showTodoEditor(); | 3165 | showTodoEditor(); |
3137 | mTodoEditor->newTodo(dt,0,allday); | 3166 | mTodoEditor->newTodo(dt,0,allday); |
3138 | if ( mFilterView->filtersEnabled() ) { | 3167 | if ( mFilterView->filtersEnabled() ) { |
3139 | CalFilter *filter = mFilterView->selectedFilter(); | 3168 | CalFilter *filter = mFilterView->selectedFilter(); |
3140 | if (filter && filter->showCategories()) { | 3169 | if (filter && filter->showCategories()) { |
3141 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 3170 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
3142 | } | 3171 | } |
3143 | if ( filter ) | 3172 | if ( filter ) |
3144 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 3173 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
3145 | } | 3174 | } |
3146 | mTodoEditor->exec(); | 3175 | mTodoEditor->exec(); |
3147 | setActiveWindow(); | 3176 | setActiveWindow(); |
3148 | } | 3177 | } |
3149 | 3178 | ||
3150 | void CalendarView::newTodo() | 3179 | void CalendarView::newTodo() |
3151 | { | 3180 | { |
3152 | newTodoDateTime( QDateTime(),true ); | 3181 | newTodoDateTime( QDateTime(),true ); |
3153 | } | 3182 | } |
3154 | 3183 | ||
3155 | void CalendarView::newSubTodo() | 3184 | void CalendarView::newSubTodo() |
3156 | { | 3185 | { |
3157 | Todo *todo = selectedTodo(); | 3186 | Todo *todo = selectedTodo(); |
3158 | if ( todo ) newSubTodo( todo ); | 3187 | if ( todo ) newSubTodo( todo ); |
3159 | } | 3188 | } |
3160 | 3189 | ||
3161 | void CalendarView::newSubTodo(Todo *parentEvent) | 3190 | void CalendarView::newSubTodo(Todo *parentEvent) |
3162 | { | 3191 | { |
3163 | 3192 | ||
3164 | showTodoEditor(); | 3193 | showTodoEditor(); |
3165 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 3194 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
3166 | mTodoEditor->exec(); | 3195 | mTodoEditor->exec(); |
3167 | setActiveWindow(); | 3196 | setActiveWindow(); |
3168 | } | 3197 | } |
3169 | 3198 | ||
3170 | void CalendarView::newFloatingEvent() | 3199 | void CalendarView::newFloatingEvent() |
3171 | { | 3200 | { |
3172 | DateList tmpList = mNavigator->selectedDates(); | 3201 | DateList tmpList = mNavigator->selectedDates(); |
3173 | QDate date = tmpList.first(); | 3202 | QDate date = tmpList.first(); |
3174 | 3203 | ||
3175 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 3204 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
3176 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 3205 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
3177 | } | 3206 | } |
3178 | 3207 | ||
3179 | 3208 | ||
3180 | void CalendarView::editEvent( Event *event ) | 3209 | void CalendarView::editEvent( Event *event ) |
3181 | { | 3210 | { |
3182 | 3211 | ||
3183 | if ( !event ) return; | 3212 | if ( !event ) return; |
3184 | if ( event->isReadOnly() ) { | 3213 | if ( event->isReadOnly() ) { |
3185 | showEvent( event ); | 3214 | showEvent( event ); |
3186 | return; | 3215 | return; |
3187 | } | 3216 | } |
3188 | showEventEditor(); | 3217 | showEventEditor(); |
3189 | mEventEditor->editEvent( event , mFlagEditDescription); | 3218 | mEventEditor->editEvent( event , mFlagEditDescription); |
3190 | mEventEditor->exec(); | 3219 | mEventEditor->exec(); |
3191 | setActiveWindow(); | 3220 | setActiveWindow(); |
3192 | 3221 | ||
3193 | } | 3222 | } |
3194 | void CalendarView::editJournal( Journal *jour ) | 3223 | void CalendarView::editJournal( Journal *jour ) |
3195 | { | 3224 | { |
3196 | if ( !jour ) return; | 3225 | if ( !jour ) return; |
3197 | mDialogManager->hideSearchDialog(); | 3226 | mDialogManager->hideSearchDialog(); |
3198 | mViewManager->showJournalView(); | 3227 | mViewManager->showJournalView(); |
3199 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 3228 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
3200 | } | 3229 | } |
3201 | void CalendarView::editTodo( Todo *todo ) | 3230 | void CalendarView::editTodo( Todo *todo ) |
3202 | { | 3231 | { |
3203 | if ( !todo ) return; | 3232 | if ( !todo ) return; |
3204 | 3233 | ||
3205 | if ( todo->isReadOnly() ) { | 3234 | if ( todo->isReadOnly() ) { |
3206 | showTodo( todo ); | 3235 | showTodo( todo ); |
3207 | return; | 3236 | return; |
3208 | } | 3237 | } |
3209 | showTodoEditor(); | 3238 | showTodoEditor(); |
3210 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 3239 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
3211 | mTodoEditor->exec(); | 3240 | mTodoEditor->exec(); |
3212 | setActiveWindow(); | 3241 | setActiveWindow(); |
3213 | 3242 | ||
3214 | } | 3243 | } |
3215 | 3244 | ||
3216 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 3245 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
3217 | { | 3246 | { |
3218 | if ( !mEventViewerDialog ) { | 3247 | if ( !mEventViewerDialog ) { |
3219 | mEventViewerDialog = new KOEventViewerDialog(0); | 3248 | mEventViewerDialog = new KOEventViewerDialog(0); |
3220 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 3249 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
3221 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 3250 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
3222 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 3251 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
3223 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 3252 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
3224 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 3253 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
3225 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 3254 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
3226 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 3255 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
3227 | this, SLOT( slotViewerClosed() ) ); | 3256 | this, SLOT( slotViewerClosed() ) ); |
3228 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3257 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3229 | this, SLOT( todoChanged(Todo *) ) ); | 3258 | this, SLOT( todoChanged(Todo *) ) ); |
3230 | mEventViewerDialog->resize( 640, 480 ); | 3259 | mEventViewerDialog->resize( 640, 480 ); |
3231 | 3260 | ||
3232 | } | 3261 | } |
3233 | return mEventViewerDialog; | 3262 | return mEventViewerDialog; |
3234 | } | 3263 | } |
3235 | void CalendarView::showEvent(Event *event) | 3264 | void CalendarView::showEvent(Event *event) |
3236 | { | 3265 | { |
3237 | getEventViewerDialog()->setEvent(event); | 3266 | getEventViewerDialog()->setEvent(event); |
3238 | getEventViewerDialog()->showMe(); | 3267 | getEventViewerDialog()->showMe(); |
3239 | } | 3268 | } |
3240 | 3269 | ||
3241 | void CalendarView::showTodo(Todo *event) | 3270 | void CalendarView::showTodo(Todo *event) |
3242 | { | 3271 | { |
3243 | getEventViewerDialog()->setTodo(event); | 3272 | getEventViewerDialog()->setTodo(event); |
3244 | getEventViewerDialog()->showMe(); | 3273 | getEventViewerDialog()->showMe(); |
3245 | } | 3274 | } |
3246 | void CalendarView::showJournal( Journal *jour ) | 3275 | void CalendarView::showJournal( Journal *jour ) |
3247 | { | 3276 | { |
3248 | getEventViewerDialog()->setJournal(jour); | 3277 | getEventViewerDialog()->setJournal(jour); |
3249 | getEventViewerDialog()->showMe(); | 3278 | getEventViewerDialog()->showMe(); |
3250 | 3279 | ||
3251 | } | 3280 | } |
3252 | // void CalendarView::todoModified (Todo *event, int changed) | 3281 | // void CalendarView::todoModified (Todo *event, int changed) |
3253 | // { | 3282 | // { |
3254 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 3283 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
3255 | // // kdDebug() << "Todo modified and open" << endl; | 3284 | // // kdDebug() << "Todo modified and open" << endl; |
3256 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 3285 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
3257 | // // temp->modified (changed); | 3286 | // // temp->modified (changed); |
3258 | 3287 | ||
3259 | // // } | 3288 | // // } |
3260 | 3289 | ||
3261 | // mViewManager->updateView(); | 3290 | // mViewManager->updateView(); |
3262 | // } | 3291 | // } |
3263 | 3292 | ||
3264 | void CalendarView::appointment_show() | 3293 | void CalendarView::appointment_show() |
3265 | { | 3294 | { |
3266 | Event *anEvent = 0; | 3295 | Event *anEvent = 0; |
3267 | 3296 | ||
3268 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3297 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3269 | 3298 | ||
3270 | if (mViewManager->currentView()->isEventView()) { | 3299 | if (mViewManager->currentView()->isEventView()) { |
3271 | if ( incidence && incidence->typeID() == eventID ) { | 3300 | if ( incidence && incidence->typeID() == eventID ) { |
3272 | anEvent = static_cast<Event *>(incidence); | 3301 | anEvent = static_cast<Event *>(incidence); |
3273 | } | 3302 | } |
3274 | } | 3303 | } |
3275 | 3304 | ||
3276 | if (!anEvent) { | 3305 | if (!anEvent) { |
3277 | KNotifyClient::beep(); | 3306 | KNotifyClient::beep(); |
3278 | return; | 3307 | return; |
3279 | } | 3308 | } |
3280 | 3309 | ||
3281 | showEvent(anEvent); | 3310 | showEvent(anEvent); |
3282 | } | 3311 | } |
3283 | 3312 | ||
3284 | void CalendarView::appointment_edit() | 3313 | void CalendarView::appointment_edit() |
3285 | { | 3314 | { |
3286 | Event *anEvent = 0; | 3315 | Event *anEvent = 0; |
3287 | 3316 | ||
3288 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3317 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3289 | 3318 | ||
3290 | if (mViewManager->currentView()->isEventView()) { | 3319 | if (mViewManager->currentView()->isEventView()) { |
3291 | if ( incidence && incidence->typeID() == eventID ) { | 3320 | if ( incidence && incidence->typeID() == eventID ) { |
3292 | anEvent = static_cast<Event *>(incidence); | 3321 | anEvent = static_cast<Event *>(incidence); |
3293 | } | 3322 | } |
3294 | } | 3323 | } |
3295 | 3324 | ||
3296 | if (!anEvent) { | 3325 | if (!anEvent) { |
3297 | KNotifyClient::beep(); | 3326 | KNotifyClient::beep(); |
3298 | return; | 3327 | return; |
3299 | } | 3328 | } |
3300 | 3329 | ||
3301 | editEvent(anEvent); | 3330 | editEvent(anEvent); |
3302 | } | 3331 | } |
3303 | 3332 | ||
3304 | void CalendarView::appointment_delete() | 3333 | void CalendarView::appointment_delete() |
3305 | { | 3334 | { |
3306 | Event *anEvent = 0; | 3335 | Event *anEvent = 0; |
3307 | 3336 | ||
3308 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3337 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3309 | 3338 | ||
3310 | if (mViewManager->currentView()->isEventView()) { | 3339 | if (mViewManager->currentView()->isEventView()) { |
3311 | if ( incidence && incidence->typeID() == eventID ) { | 3340 | if ( incidence && incidence->typeID() == eventID ) { |
3312 | anEvent = static_cast<Event *>(incidence); | 3341 | anEvent = static_cast<Event *>(incidence); |
3313 | } | 3342 | } |
3314 | } | 3343 | } |
3315 | 3344 | ||
3316 | if (!anEvent) { | 3345 | if (!anEvent) { |
3317 | KNotifyClient::beep(); | 3346 | KNotifyClient::beep(); |
3318 | return; | 3347 | return; |
3319 | } | 3348 | } |
3320 | 3349 | ||
3321 | deleteEvent(anEvent); | 3350 | deleteEvent(anEvent); |
3322 | } | 3351 | } |
3323 | 3352 | ||
3324 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3353 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3325 | { | 3354 | { |
3326 | if (!sub) return; | 3355 | if (!sub) return; |
3327 | if ( sub->relatedTo() == parent ) | 3356 | if ( sub->relatedTo() == parent ) |
3328 | return; | 3357 | return; |
3329 | sub->setRelatedTo(parent); | 3358 | sub->setRelatedTo(parent); |
3330 | sub->updated(); | 3359 | sub->updated(); |
3331 | setModified(true); | 3360 | setModified(true); |
3332 | updateView(); | 3361 | updateView(); |
3333 | } | 3362 | } |
3334 | void CalendarView::todo_unsub(Todo *anTodo ) | 3363 | void CalendarView::todo_unsub(Todo *anTodo ) |
3335 | { | 3364 | { |
3336 | todo_resub( 0, anTodo ); | 3365 | todo_resub( 0, anTodo ); |
3337 | } | 3366 | } |
3338 | 3367 | ||
3339 | void CalendarView::deleteTodo(Todo *todo) | 3368 | void CalendarView::deleteTodo(Todo *todo) |
3340 | { | 3369 | { |
3341 | if (!todo) { | 3370 | if (!todo) { |
3342 | KNotifyClient::beep(); | 3371 | KNotifyClient::beep(); |
3343 | return; | 3372 | return; |
3344 | } | 3373 | } |
3345 | if (KOPrefs::instance()->mConfirm) { | 3374 | if (KOPrefs::instance()->mConfirm) { |
3346 | QString text = todo->summary().left(20); | 3375 | QString text = todo->summary().left(20); |
3347 | if (!todo->relations().isEmpty()) { | 3376 | if (!todo->relations().isEmpty()) { |
3348 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3377 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3349 | 3378 | ||
3350 | } | 3379 | } |
3351 | switch (msgItemDelete(text)) { | 3380 | switch (msgItemDelete(text)) { |
3352 | case KMessageBox::Continue: // OK | 3381 | case KMessageBox::Continue: // OK |
3353 | bool deleteT = false; | 3382 | bool deleteT = false; |
3354 | if (!todo->relations().isEmpty()) { | 3383 | if (!todo->relations().isEmpty()) { |
3355 | deleteT = removeCompletedSubTodos( todo ); | 3384 | deleteT = removeCompletedSubTodos( todo ); |
3356 | } | 3385 | } |
3357 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3386 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3358 | if ( !deleteT ) { | 3387 | if ( !deleteT ) { |
3359 | checkExternalId( todo ); | 3388 | checkExternalId( todo ); |
3360 | calendar()->deleteTodo(todo); | 3389 | calendar()->deleteTodo(todo); |
3361 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3390 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3362 | updateView(); | 3391 | updateView(); |
3363 | } | 3392 | } |
3364 | break; | 3393 | break; |
3365 | } // switch | 3394 | } // switch |
3366 | } else { | 3395 | } else { |
3367 | checkExternalId( todo ); | 3396 | checkExternalId( todo ); |
3368 | mCalendar->deleteTodo(todo); | 3397 | mCalendar->deleteTodo(todo); |
3369 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3398 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3370 | updateView(); | 3399 | updateView(); |
3371 | } | 3400 | } |
3372 | 3401 | ||
3373 | emit updateSearchDialog(); | 3402 | emit updateSearchDialog(); |
3374 | } | 3403 | } |
3375 | void CalendarView::deleteJournal(Journal *jour) | 3404 | void CalendarView::deleteJournal(Journal *jour) |
3376 | { | 3405 | { |
3377 | if (!jour) { | 3406 | if (!jour) { |
3378 | KNotifyClient::beep(); | 3407 | KNotifyClient::beep(); |
3379 | return; | 3408 | return; |
3380 | } | 3409 | } |
3381 | if (KOPrefs::instance()->mConfirm) { | 3410 | if (KOPrefs::instance()->mConfirm) { |
3382 | switch (msgItemDelete( jour->description().left(20))) { | 3411 | switch (msgItemDelete( jour->description().left(20))) { |
3383 | case KMessageBox::Continue: // OK | 3412 | case KMessageBox::Continue: // OK |
3384 | calendar()->deleteJournal(jour); | 3413 | calendar()->deleteJournal(jour); |
3385 | updateView(); | 3414 | updateView(); |
3386 | break; | 3415 | break; |
3387 | } // switch | 3416 | } // switch |
3388 | } else { | 3417 | } else { |
3389 | calendar()->deleteJournal(jour);; | 3418 | calendar()->deleteJournal(jour);; |
3390 | updateView(); | 3419 | updateView(); |
3391 | } | 3420 | } |
3392 | emit updateSearchDialog(); | 3421 | emit updateSearchDialog(); |
3393 | } | 3422 | } |
3394 | 3423 | ||
3395 | void CalendarView::deleteEvent(Event *anEvent) | 3424 | void CalendarView::deleteEvent(Event *anEvent) |
3396 | { | 3425 | { |
3397 | if (!anEvent) { | 3426 | if (!anEvent) { |
3398 | KNotifyClient::beep(); | 3427 | KNotifyClient::beep(); |
3399 | return; | 3428 | return; |
3400 | } | 3429 | } |
3401 | 3430 | ||
3402 | if (anEvent->recurrence()->doesRecur()) { | 3431 | if (anEvent->recurrence()->doesRecur()) { |
3403 | QDate itemDate = mViewManager->currentSelectionDate(); | 3432 | QDate itemDate = mViewManager->currentSelectionDate(); |
3404 | int km; | 3433 | int km; |
3405 | if (!itemDate.isValid()) { | 3434 | if (!itemDate.isValid()) { |
3406 | //kdDebug() << "Date Not Valid" << endl; | 3435 | //kdDebug() << "Date Not Valid" << endl; |
3407 | if (KOPrefs::instance()->mConfirm) { | 3436 | if (KOPrefs::instance()->mConfirm) { |
3408 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3437 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3409 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3438 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3410 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3439 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3411 | if ( km == KMessageBox::Continue ) | 3440 | if ( km == KMessageBox::Continue ) |
3412 | km = KMessageBox::No; // No = all below | 3441 | km = KMessageBox::No; // No = all below |
3413 | } else | 3442 | } else |
3414 | km = KMessageBox::No; | 3443 | km = KMessageBox::No; |
3415 | } else { | 3444 | } else { |
3416 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + | 3445 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + |
3417 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3446 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3418 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3447 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3419 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3448 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3420 | i18n("All")); | 3449 | i18n("All")); |
3421 | } | 3450 | } |
3422 | switch(km) { | 3451 | switch(km) { |
3423 | 3452 | ||
3424 | case KMessageBox::No: // Continue // all | 3453 | case KMessageBox::No: // Continue // all |
3425 | //qDebug("KMessageBox::No "); | 3454 | //qDebug("KMessageBox::No "); |
3426 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3455 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3427 | schedule(Scheduler::Cancel,anEvent); | 3456 | schedule(Scheduler::Cancel,anEvent); |
3428 | 3457 | ||
3429 | checkExternalId( anEvent); | 3458 | checkExternalId( anEvent); |
3430 | mCalendar->deleteEvent(anEvent); | 3459 | mCalendar->deleteEvent(anEvent); |
3431 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3460 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3432 | break; | 3461 | break; |
3433 | 3462 | ||
3434 | // Disabled because it does not work | 3463 | // Disabled because it does not work |
3435 | //#if 0 | 3464 | //#if 0 |
3436 | case KMessageBox::Yes: // just this one | 3465 | case KMessageBox::Yes: // just this one |
3437 | //QDate qd = mNavigator->selectedDates().first(); | 3466 | //QDate qd = mNavigator->selectedDates().first(); |
3438 | //if (!qd.isValid()) { | 3467 | //if (!qd.isValid()) { |
3439 | // kdDebug() << "no date selected, or invalid date" << endl; | 3468 | // kdDebug() << "no date selected, or invalid date" << endl; |
3440 | // KNotifyClient::beep(); | 3469 | // KNotifyClient::beep(); |
3441 | // return; | 3470 | // return; |
3442 | //} | 3471 | //} |
3443 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3472 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3444 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3473 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3445 | anEvent->addExDate(itemDate); | 3474 | anEvent->addExDate(itemDate); |
3446 | int duration = anEvent->recurrence()->duration(); | 3475 | int duration = anEvent->recurrence()->duration(); |
3447 | if ( duration > 0 ) { | 3476 | if ( duration > 0 ) { |
3448 | anEvent->recurrence()->setDuration( duration - 1 ); | 3477 | anEvent->recurrence()->setDuration( duration - 1 ); |
3449 | } | 3478 | } |
3450 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3479 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3451 | } | 3480 | } |
3452 | break; | 3481 | break; |
3453 | //#endif | 3482 | //#endif |
3454 | } // switch | 3483 | } // switch |
3455 | } else { | 3484 | } else { |
3456 | if (KOPrefs::instance()->mConfirm) { | 3485 | if (KOPrefs::instance()->mConfirm) { |
3457 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3486 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3458 | i18n("\nAre you sure you want\nto delete this event?"), | 3487 | i18n("\nAre you sure you want\nto delete this event?"), |
3459 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3488 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3460 | case KMessageBox::Continue: // OK | 3489 | case KMessageBox::Continue: // OK |
3461 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3490 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3462 | schedule(Scheduler::Cancel,anEvent); | 3491 | schedule(Scheduler::Cancel,anEvent); |
3463 | checkExternalId( anEvent); | 3492 | checkExternalId( anEvent); |
3464 | mCalendar->deleteEvent(anEvent); | 3493 | mCalendar->deleteEvent(anEvent); |
3465 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3494 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3466 | break; | 3495 | break; |
3467 | } // switch | 3496 | } // switch |
3468 | } else { | 3497 | } else { |
3469 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3498 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3470 | schedule(Scheduler::Cancel,anEvent); | 3499 | schedule(Scheduler::Cancel,anEvent); |
3471 | checkExternalId( anEvent); | 3500 | checkExternalId( anEvent); |
3472 | mCalendar->deleteEvent(anEvent); | 3501 | mCalendar->deleteEvent(anEvent); |
3473 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3502 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3474 | } | 3503 | } |
3475 | } // if-else | 3504 | } // if-else |
3476 | emit updateSearchDialog(); | 3505 | emit updateSearchDialog(); |
3477 | } | 3506 | } |
3478 | 3507 | ||
3479 | bool CalendarView::deleteEvent(const QString &uid) | 3508 | bool CalendarView::deleteEvent(const QString &uid) |
3480 | { | 3509 | { |
3481 | Event *ev = mCalendar->event(uid); | 3510 | Event *ev = mCalendar->event(uid); |
3482 | if (ev) { | 3511 | if (ev) { |
3483 | deleteEvent(ev); | 3512 | deleteEvent(ev); |
3484 | return true; | 3513 | return true; |
3485 | } else { | 3514 | } else { |
3486 | return false; | 3515 | return false; |
3487 | } | 3516 | } |
3488 | } | 3517 | } |
3489 | 3518 | ||
3490 | /*****************************************************************************/ | 3519 | /*****************************************************************************/ |
3491 | 3520 | ||
3492 | void CalendarView::action_mail() | 3521 | void CalendarView::action_mail() |
3493 | { | 3522 | { |
3494 | #ifndef KORG_NOMAIL | 3523 | #ifndef KORG_NOMAIL |
3495 | KOMailClient mailClient; | 3524 | KOMailClient mailClient; |
3496 | 3525 | ||
3497 | Incidence *incidence = currentSelection(); | 3526 | Incidence *incidence = currentSelection(); |
3498 | 3527 | ||
3499 | if (!incidence) { | 3528 | if (!incidence) { |
3500 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3529 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3501 | return; | 3530 | return; |
3502 | } | 3531 | } |
3503 | if(incidence->attendeeCount() == 0 ) { | 3532 | if(incidence->attendeeCount() == 0 ) { |
3504 | KMessageBox::sorry(this, | 3533 | KMessageBox::sorry(this, |
3505 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3534 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3506 | return; | 3535 | return; |
3507 | } | 3536 | } |
3508 | 3537 | ||
3509 | CalendarLocal cal_tmp; | 3538 | CalendarLocal cal_tmp; |
3510 | Event *event = 0; | 3539 | Event *event = 0; |
3511 | Event *ev = 0; | 3540 | Event *ev = 0; |
3512 | if ( incidence && incidence->typeID() == eventID ) { | 3541 | if ( incidence && incidence->typeID() == eventID ) { |
3513 | event = static_cast<Event *>(incidence); | 3542 | event = static_cast<Event *>(incidence); |
3514 | ev = new Event(*event); | 3543 | ev = new Event(*event); |
3515 | cal_tmp.addEvent(ev); | 3544 | cal_tmp.addEvent(ev); |
3516 | } | 3545 | } |
3517 | ICalFormat mForm(); | 3546 | ICalFormat mForm(); |
3518 | QString attachment = mForm.toString( &cal_tmp ); | 3547 | QString attachment = mForm.toString( &cal_tmp ); |
3519 | if (ev) delete(ev); | 3548 | if (ev) delete(ev); |
3520 | 3549 | ||
3521 | mailClient.mailAttendees(currentSelection(), attachment); | 3550 | mailClient.mailAttendees(currentSelection(), attachment); |
3522 | 3551 | ||
3523 | #endif | 3552 | #endif |
3524 | 3553 | ||
3525 | #if 0 | 3554 | #if 0 |
3526 | Event *anEvent = 0; | 3555 | Event *anEvent = 0; |
3527 | if (mViewManager->currentView()->isEventView()) { | 3556 | if (mViewManager->currentView()->isEventView()) { |
3528 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3557 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3529 | } | 3558 | } |
3530 | 3559 | ||
3531 | if (!anEvent) { | 3560 | if (!anEvent) { |
3532 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3561 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3533 | return; | 3562 | return; |
3534 | } | 3563 | } |
3535 | if(anEvent->attendeeCount() == 0 ) { | 3564 | if(anEvent->attendeeCount() == 0 ) { |
3536 | KMessageBox::sorry(this, | 3565 | KMessageBox::sorry(this, |
3537 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3566 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3538 | return; | 3567 | return; |
3539 | } | 3568 | } |
3540 | 3569 | ||
3541 | mailobject.emailEvent(anEvent); | 3570 | mailobject.emailEvent(anEvent); |
3542 | #endif | 3571 | #endif |
3543 | } | 3572 | } |
3544 | 3573 | ||
3545 | 3574 | ||
3546 | void CalendarView::schedule_publish(Incidence *incidence) | 3575 | void CalendarView::schedule_publish(Incidence *incidence) |
3547 | { | 3576 | { |
3548 | Event *event = 0; | 3577 | Event *event = 0; |
3549 | Todo *todo = 0; | 3578 | Todo *todo = 0; |
3550 | 3579 | ||
3551 | if (incidence == 0) { | 3580 | if (incidence == 0) { |
3552 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3581 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3553 | if (incidence == 0) { | 3582 | if (incidence == 0) { |
3554 | incidence = mTodoList->selectedIncidences().first(); | 3583 | incidence = mTodoList->selectedIncidences().first(); |
3555 | } | 3584 | } |
3556 | } | 3585 | } |
3557 | if ( incidence && incidence->typeID() == eventID ) { | 3586 | if ( incidence && incidence->typeID() == eventID ) { |
3558 | event = static_cast<Event *>(incidence); | 3587 | event = static_cast<Event *>(incidence); |
3559 | } else { | 3588 | } else { |
3560 | if ( incidence && incidence->typeID() == todoID ) { | 3589 | if ( incidence && incidence->typeID() == todoID ) { |
3561 | todo = static_cast<Todo *>(incidence); | 3590 | todo = static_cast<Todo *>(incidence); |
3562 | } | 3591 | } |
3563 | } | 3592 | } |
3564 | 3593 | ||
3565 | if (!event && !todo) { | 3594 | if (!event && !todo) { |
3566 | KMessageBox::sorry(this,i18n("No event selected.")); | 3595 | KMessageBox::sorry(this,i18n("No event selected.")); |
3567 | return; | 3596 | return; |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index ec5b7ab..d836fee 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,651 +1,652 @@ | |||
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 | //#include <koprefs.h> |
48 | 48 | ||
49 | class QWidgetStack; | 49 | class QWidgetStack; |
50 | class QSplitter; | 50 | class QSplitter; |
51 | class KopiCalendarFile; | 51 | class KopiCalendarFile; |
52 | class CalPrinter; | 52 | class CalPrinter; |
53 | class KOFilterView; | 53 | class KOFilterView; |
54 | class KOCalEditView; | 54 | class KOCalEditView; |
55 | class KOViewManager; | 55 | class KOViewManager; |
56 | class KODialogManager; | 56 | class KODialogManager; |
57 | class KOTodoView; | 57 | class KOTodoView; |
58 | class KDateNavigator; | 58 | class KDateNavigator; |
59 | class DateNavigatorContainer; | 59 | class DateNavigatorContainer; |
60 | class DateNavigator; | 60 | class DateNavigator; |
61 | class KOIncidenceEditor; | 61 | class KOIncidenceEditor; |
62 | class KDatePicker; | 62 | class KDatePicker; |
63 | class ResourceView; | 63 | class ResourceView; |
64 | class KOEventEditor; | 64 | class KOEventEditor; |
65 | class KOTodoEditor ; | 65 | class KOTodoEditor ; |
66 | class KOEventViewerDialog; | 66 | class KOEventViewerDialog; |
67 | class KOBeamPrefs; | 67 | class KOBeamPrefs; |
68 | class KSyncProfile; | 68 | class KSyncProfile; |
69 | class AlarmDialog; | 69 | class AlarmDialog; |
70 | class KCal::Attendee; | 70 | class KCal::Attendee; |
71 | 71 | ||
72 | namespace KCal { class FileStorage; } | 72 | namespace KCal { class FileStorage; } |
73 | 73 | ||
74 | using namespace KCal; | 74 | using namespace KCal; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | 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 |
78 | 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 |
79 | of the different views and controls the different dialogs like preferences, | 79 | of the different views and controls the different dialogs like preferences, |
80 | event editor, search dialog etc. | 80 | event editor, search dialog etc. |
81 | 81 | ||
82 | @short main calendar view widget | 82 | @short main calendar view widget |
83 | @author Cornelius Schumacher | 83 | @author Cornelius Schumacher |
84 | */ | 84 | */ |
85 | 85 | ||
86 | #include <qtextbrowser.h> | 86 | #include <qtextbrowser.h> |
87 | #include <qtextcodec.h> | 87 | #include <qtextcodec.h> |
88 | 88 | ||
89 | class MissedAlarmTextBrowser : public QTextBrowser { | 89 | class MissedAlarmTextBrowser : public QTextBrowser { |
90 | Q_OBJECT | 90 | Q_OBJECT |
91 | public: | 91 | public: |
92 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); | 92 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); |
93 | ~MissedAlarmTextBrowser(); | 93 | ~MissedAlarmTextBrowser(); |
94 | void setSource(const QString & n); | 94 | void setSource(const QString & n); |
95 | 95 | ||
96 | private: | 96 | private: |
97 | Incidence * getNextInc(QDateTime start ); | 97 | Incidence * getNextInc(QDateTime start ); |
98 | QPtrList<Incidence> mAlarms; | 98 | QPtrList<Incidence> mAlarms; |
99 | signals: | 99 | signals: |
100 | void showIncidence( QString uid); | 100 | void showIncidence( QString uid); |
101 | }; | 101 | }; |
102 | 102 | ||
103 | 103 | ||
104 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 104 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
105 | { | 105 | { |
106 | Q_OBJECT | 106 | Q_OBJECT |
107 | public: | 107 | public: |
108 | /** | 108 | /** |
109 | Constructs a new calendar view widget. | 109 | Constructs a new calendar view widget. |
110 | 110 | ||
111 | @param calendar calendar document | 111 | @param calendar calendar document |
112 | @param parent parent window | 112 | @param parent parent window |
113 | @param name Qt internal widget object name | 113 | @param name Qt internal widget object name |
114 | */ | 114 | */ |
115 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 115 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
116 | const char *name = 0 ); | 116 | const char *name = 0 ); |
117 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 117 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
118 | const char *name = 0 ); | 118 | const char *name = 0 ); |
119 | virtual ~CalendarView(); | 119 | virtual ~CalendarView(); |
120 | 120 | ||
121 | Calendar *calendar() { return mCalendar; } | 121 | Calendar *calendar() { return mCalendar; } |
122 | 122 | ||
123 | KOViewManager *viewManager(); | 123 | KOViewManager *viewManager(); |
124 | KODialogManager *dialogManager(); | 124 | KODialogManager *dialogManager(); |
125 | 125 | ||
126 | QDate startDate(); | 126 | QDate startDate(); |
127 | QDate endDate(); | 127 | QDate endDate(); |
128 | 128 | ||
129 | QWidgetStack *viewStack(); | 129 | QWidgetStack *viewStack(); |
130 | QWidget *leftFrame(); | 130 | QWidget *leftFrame(); |
131 | 131 | ||
132 | DateNavigator *dateNavigator(); | 132 | DateNavigator *dateNavigator(); |
133 | KDateNavigator *dateNavigatorWidget(); | 133 | KDateNavigator *dateNavigatorWidget(); |
134 | 134 | ||
135 | void addView(KOrg::BaseView *); | 135 | void addView(KOrg::BaseView *); |
136 | void showView(KOrg::BaseView *); | 136 | void showView(KOrg::BaseView *); |
137 | KOEventViewerDialog* getEventViewerDialog(); | 137 | KOEventViewerDialog* getEventViewerDialog(); |
138 | Incidence *currentSelection(); | 138 | Incidence *currentSelection(); |
139 | 139 | ||
140 | signals: | 140 | signals: |
141 | void save (); | 141 | void save (); |
142 | void saveStopTimer (); | 142 | void saveStopTimer (); |
143 | void tempDisableBR(bool); | 143 | void tempDisableBR(bool); |
144 | /** This todo has been modified */ | 144 | /** This todo has been modified */ |
145 | void todoModified(Todo *, int); | 145 | void todoModified(Todo *, int); |
146 | 146 | ||
147 | /** 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 |
148 | * and emit this signal which notifies all widgets which have registered | 148 | * and emit this signal which notifies all widgets which have registered |
149 | * for notification to update their settings. */ | 149 | * for notification to update their settings. */ |
150 | void configChanged(); | 150 | void configChanged(); |
151 | /** emitted when the topwidget is closing down, so that any attached | 151 | /** emitted when the topwidget is closing down, so that any attached |
152 | child windows can also close. */ | 152 | child windows can also close. */ |
153 | void closingDown(); | 153 | void closingDown(); |
154 | /** emitted right before we die */ | 154 | /** emitted right before we die */ |
155 | void closed(QWidget *); | 155 | void closed(QWidget *); |
156 | 156 | ||
157 | /** Emitted when state of modified flag changes */ | 157 | /** Emitted when state of modified flag changes */ |
158 | void modifiedChanged(bool); | 158 | void modifiedChanged(bool); |
159 | void signalmodified(); | 159 | void signalmodified(); |
160 | 160 | ||
161 | /** Emitted when state of read-only flag changes */ | 161 | /** Emitted when state of read-only flag changes */ |
162 | void readOnlyChanged(bool); | 162 | void readOnlyChanged(bool); |
163 | 163 | ||
164 | /** Emitted when the unit of navigation changes */ | 164 | /** Emitted when the unit of navigation changes */ |
165 | void changeNavStringPrev(const QString &); | 165 | void changeNavStringPrev(const QString &); |
166 | void changeNavStringNext(const QString &); | 166 | void changeNavStringNext(const QString &); |
167 | 167 | ||
168 | /** 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*/ |
169 | void organizerEventsSelected(bool); | 169 | void organizerEventsSelected(bool); |
170 | /** 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*/ |
171 | void groupEventsSelected(bool); | 171 | void groupEventsSelected(bool); |
172 | /** | 172 | /** |
173 | 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 |
174 | signal is emitted with 0 as argument. | 174 | signal is emitted with 0 as argument. |
175 | */ | 175 | */ |
176 | void incidenceSelected( Incidence * ); | 176 | void incidenceSelected( Incidence * ); |
177 | /** Emitted, when a todoitem is selected or deselected. */ | 177 | /** Emitted, when a todoitem is selected or deselected. */ |
178 | void todoSelected( bool ); | 178 | void todoSelected( bool ); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | Emitted, when clipboard content changes. Parameter indicates if paste | 181 | Emitted, when clipboard content changes. Parameter indicates if paste |
182 | is possible or not. | 182 | is possible or not. |
183 | */ | 183 | */ |
184 | void pasteEnabled(bool); | 184 | void pasteEnabled(bool); |
185 | 185 | ||
186 | /** Emitted, when the number of incoming messages has changed. */ | 186 | /** Emitted, when the number of incoming messages has changed. */ |
187 | void numIncomingChanged(int); | 187 | void numIncomingChanged(int); |
188 | 188 | ||
189 | /** Emitted, when the number of outgoing messages has changed. */ | 189 | /** Emitted, when the number of outgoing messages has changed. */ |
190 | void numOutgoingChanged(int); | 190 | void numOutgoingChanged(int); |
191 | 191 | ||
192 | /** 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. */ |
193 | void statusMessage(const QString &); | 193 | void statusMessage(const QString &); |
194 | 194 | ||
195 | void calendarViewExpanded( bool ); | 195 | void calendarViewExpanded( bool ); |
196 | void updateSearchDialog(); | 196 | void updateSearchDialog(); |
197 | 197 | ||
198 | 198 | ||
199 | public slots: | 199 | public slots: |
200 | void checkAlarms(); | 200 | void checkAlarms(); |
201 | void slotprintSelInc(); | 201 | void slotprintSelInc(); |
202 | void showNextAlarms(); | 202 | void showNextAlarms(); |
203 | void showOpenError(); | 203 | void showOpenError(); |
204 | void watchSavedFile(); | 204 | void watchSavedFile(); |
205 | void recheckTimerAlarm(); | 205 | void recheckTimerAlarm(); |
206 | void checkNextTimerAlarm(); | 206 | void checkNextTimerAlarm(); |
207 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 207 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
208 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 208 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
209 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 209 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
210 | 210 | ||
211 | /** options dialog made a changed to the configuration. we catch this | 211 | /** options dialog made a changed to the configuration. we catch this |
212 | * and notify all widgets which need to update their configuration. */ | 212 | * and notify all widgets which need to update their configuration. */ |
213 | void updateConfig(); | 213 | void updateConfig(); |
214 | 214 | ||
215 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 215 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
216 | const QStringList& anniversaryList, const QStringList& realNameList, | 216 | const QStringList& anniversaryList, const QStringList& realNameList, |
217 | const QStringList& emailList, const QStringList& assembledNameList, | 217 | const QStringList& emailList, const QStringList& assembledNameList, |
218 | const QStringList& uidList); | 218 | const QStringList& uidList); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | 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 |
222 | calendar into existing one, if it is false, clear calendar, before | 222 | calendar into existing one, if it is false, clear calendar, before |
223 | loading. Return true, if calendar could be successfully loaded. | 223 | loading. Return true, if calendar could be successfully loaded. |
224 | */ | 224 | */ |
225 | bool openCalendar(QString filename, bool merge=false); | 225 | bool openCalendar(QString filename, bool merge=false); |
226 | bool loadCalendars(); | 226 | bool loadCalendars(); |
227 | bool saveCalendars(); | 227 | bool saveCalendars(); |
228 | bool restoreCalendarSettings(); | 228 | bool restoreCalendarSettings(); |
229 | bool addCalendar( KopiCalendarFile * ); | 229 | bool addCalendar( KopiCalendarFile * ); |
230 | void addCalendarId( int id ); | 230 | void addCalendarId( int id ); |
231 | bool syncCalendar(QString filename,int mode = 0 ); | 231 | bool syncCalendar(QString filename,int mode = 0 ); |
232 | 232 | ||
233 | /** | 233 | /** |
234 | Save calendar data to file. Return true if calendar could be | 234 | Save calendar data to file. Return true if calendar could be |
235 | successfully saved. | 235 | successfully saved. |
236 | */ | 236 | */ |
237 | bool saveCalendar(QString filename); | 237 | bool saveCalendar(QString filename); |
238 | 238 | ||
239 | /** | 239 | /** |
240 | Close calendar. Clear calendar data and reset views to display an empty | 240 | Close calendar. Clear calendar data and reset views to display an empty |
241 | calendar. | 241 | calendar. |
242 | */ | 242 | */ |
243 | void closeCalendar(); | 243 | void closeCalendar(); |
244 | 244 | ||
245 | /** Archive old events of calendar */ | 245 | /** Archive old events of calendar */ |
246 | void archiveCalendar(); | 246 | void archiveCalendar(); |
247 | 247 | ||
248 | void showIncidence(); | 248 | void showIncidence(); |
249 | void editIncidence(); | 249 | void editIncidence(); |
250 | void editIncidenceDescription(); | 250 | void editIncidenceDescription(); |
251 | void deleteIncidence(); | 251 | void deleteIncidence(); |
252 | void cloneIncidence(); | 252 | void cloneIncidence(); |
253 | void moveIncidence(); | 253 | void moveIncidence(); |
254 | void beamIncidence(); | 254 | void beamIncidence(); |
255 | void toggleCancelIncidence(); | 255 | void toggleCancelIncidence(); |
256 | 256 | ||
257 | /** create an editeventwin with supplied date/time, and if bool is true, | 257 | /** create an editeventwin with supplied date/time, and if bool is true, |
258 | * make the event take all day. */ | 258 | * make the event take all day. */ |
259 | void newEvent(QDateTime, QDateTime, bool allDay ); | 259 | void newEvent(QDateTime, QDateTime, bool allDay ); |
260 | void newEvent(QDateTime, QDateTime); | 260 | void newEvent(QDateTime, QDateTime); |
261 | void newEvent(QDateTime fh); | 261 | void newEvent(QDateTime fh); |
262 | void newEvent(QDate dt); | 262 | void newEvent(QDate dt); |
263 | /** create new event without having a date hint. Takes current date as | 263 | /** create new event without having a date hint. Takes current date as |
264 | default hint. */ | 264 | default hint. */ |
265 | void newEvent(); | 265 | void newEvent(); |
266 | void newFloatingEvent(); | 266 | void newFloatingEvent(); |
267 | 267 | ||
268 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 268 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
269 | void showIncidence(Incidence *); | 269 | void showIncidence(Incidence *); |
270 | void showIncidence(QString uid); | 270 | void showIncidence(QString uid); |
271 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 271 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
272 | void editIncidence(Incidence *); | 272 | void editIncidence(Incidence *); |
273 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 273 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
274 | void deleteIncidence(Incidence *); | 274 | void deleteIncidence(Incidence *); |
275 | void cloneIncidence(Incidence *); | 275 | void cloneIncidence(Incidence *); |
276 | void cancelIncidence(Incidence *); | 276 | void cancelIncidence(Incidence *); |
277 | /** Create an editor for the supplied event. */ | 277 | /** Create an editor for the supplied event. */ |
278 | void editEvent(Event *); | 278 | void editEvent(Event *); |
279 | /** Delete the supplied event. */ | 279 | /** Delete the supplied event. */ |
280 | void deleteEvent(Event *); | 280 | void deleteEvent(Event *); |
281 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 281 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
282 | found. */ | 282 | found. */ |
283 | bool deleteEvent(const QString &uid); | 283 | bool deleteEvent(const QString &uid); |
284 | /** Create a read-only viewer dialog for the supplied event. */ | 284 | /** Create a read-only viewer dialog for the supplied event. */ |
285 | void showEvent(Event *); | 285 | void showEvent(Event *); |
286 | 286 | ||
287 | void editJournal(Journal *); | 287 | void editJournal(Journal *); |
288 | void showJournal(Journal *); | 288 | void showJournal(Journal *); |
289 | void deleteJournal(Journal *); | 289 | void deleteJournal(Journal *); |
290 | /** Create an editor dialog for a todo */ | 290 | /** Create an editor dialog for a todo */ |
291 | void editTodo(Todo *); | 291 | void editTodo(Todo *); |
292 | /** Create a read-only viewer dialog for the supplied todo */ | 292 | /** Create a read-only viewer dialog for the supplied todo */ |
293 | void showTodo(Todo *); | 293 | void showTodo(Todo *); |
294 | /** create new todo */ | 294 | /** create new todo */ |
295 | void newTodo(); | 295 | void newTodo(); |
296 | void newTodoDateTime(QDateTime, bool allday); | 296 | void newTodoDateTime(QDateTime, bool allday); |
297 | /** create new todo with a parent todo */ | 297 | /** create new todo with a parent todo */ |
298 | void newSubTodo(); | 298 | void newSubTodo(); |
299 | /** create new todo with a parent todo */ | 299 | /** create new todo with a parent todo */ |
300 | void newSubTodo(Todo *); | 300 | void newSubTodo(Todo *); |
301 | /** Delete todo */ | 301 | /** Delete todo */ |
302 | void deleteTodo(Todo *); | 302 | void deleteTodo(Todo *); |
303 | 303 | ||
304 | 304 | ||
305 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 305 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
306 | * emitted as result. */ | 306 | * emitted as result. */ |
307 | void checkClipboard(); | 307 | void checkClipboard(); |
308 | 308 | ||
309 | /** using the KConfig associated with the kapp variable, read in the | 309 | /** using the KConfig associated with the kapp variable, read in the |
310 | * settings from the config file. | 310 | * settings from the config file. |
311 | */ | 311 | */ |
312 | void readSettings(); | 312 | void readSettings(); |
313 | 313 | ||
314 | /** write current state to config file. */ | 314 | /** write current state to config file. */ |
315 | void writeSettings(); | 315 | void writeSettings(); |
316 | 316 | ||
317 | /** read settings for calendar filters */ | 317 | /** read settings for calendar filters */ |
318 | void readFilterSettings(KConfig *config); | 318 | void readFilterSettings(KConfig *config); |
319 | 319 | ||
320 | /** write settings for calendar filters */ | 320 | /** write settings for calendar filters */ |
321 | void writeFilterSettings(KConfig *config); | 321 | void writeFilterSettings(KConfig *config); |
322 | 322 | ||
323 | /** passes on the message that an event has changed to the currently | 323 | /** passes on the message that an event has changed to the currently |
324 | * activated view so that it can make appropriate display changes. */ | 324 | * activated view so that it can make appropriate display changes. */ |
325 | void changeEventDisplay(Event *, int); | 325 | void changeEventDisplay(Event *, int); |
326 | void changeIncidenceDisplay(Incidence *, int); | 326 | void changeIncidenceDisplay(Incidence *, int); |
327 | void changeTodoDisplay(Todo *, int); | 327 | void changeTodoDisplay(Todo *, int); |
328 | 328 | ||
329 | void eventAdded(Event *); | 329 | void eventAdded(Event *); |
330 | void eventChanged(Event *); | 330 | void eventChanged(Event *); |
331 | void eventToBeDeleted(Event *); | 331 | void eventToBeDeleted(Event *); |
332 | void eventDeleted(); | 332 | void eventDeleted(); |
333 | 333 | ||
334 | void todoAdded(Todo *); | 334 | void todoAdded(Todo *); |
335 | void todoChanged(Todo *); | 335 | void todoChanged(Todo *); |
336 | void todoToBeDeleted(Todo *); | 336 | void todoToBeDeleted(Todo *); |
337 | void todoDeleted(); | 337 | void todoDeleted(); |
338 | 338 | ||
339 | void updateView(const QDate &start, const QDate &end); | 339 | void updateView(const QDate &start, const QDate &end); |
340 | void updateView(); | 340 | void updateView(); |
341 | void clearAllViews(); | 341 | void clearAllViews(); |
342 | 342 | ||
343 | /** Full update of visible todo views */ | 343 | /** Full update of visible todo views */ |
344 | void updateTodoViews(); | 344 | void updateTodoViews(); |
345 | 345 | ||
346 | void updateUnmanagedViews(); | 346 | void updateUnmanagedViews(); |
347 | 347 | ||
348 | /** cut the current appointment to the clipboard */ | 348 | /** cut the current appointment to the clipboard */ |
349 | void edit_cut(); | 349 | void edit_cut(); |
350 | 350 | ||
351 | /** copy the current appointment(s) to the clipboard */ | 351 | /** copy the current appointment(s) to the clipboard */ |
352 | void edit_copy(); | 352 | void edit_copy(); |
353 | 353 | ||
354 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 354 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
355 | void edit_paste(); | 355 | void edit_paste(); |
356 | 356 | ||
357 | /** edit viewing and configuration options. */ | 357 | /** edit viewing and configuration options. */ |
358 | void edit_options(); | 358 | void edit_options(); |
359 | void edit_global_options(); | 359 | void edit_global_options(); |
360 | /** | 360 | /** |
361 | Functions for printing, previewing a print, and setting up printing | 361 | Functions for printing, previewing a print, and setting up printing |
362 | parameters. | 362 | parameters. |
363 | */ | 363 | */ |
364 | void print(); | 364 | void print(); |
365 | void printSetup(); | 365 | void printSetup(); |
366 | void printPreview(); | 366 | void printPreview(); |
367 | 367 | ||
368 | /** Export as iCalendar file */ | 368 | /** Export as iCalendar file */ |
369 | void exportICalendar(); | 369 | void exportICalendar(); |
370 | 370 | ||
371 | /** Export as vCalendar file */ | 371 | /** Export as vCalendar file */ |
372 | bool exportVCalendar( QString fn); | 372 | bool exportVCalendar( QString fn); |
373 | 373 | ||
374 | /** pop up a dialog to show an existing appointment. */ | 374 | /** pop up a dialog to show an existing appointment. */ |
375 | void appointment_show(); | 375 | void appointment_show(); |
376 | /** | 376 | /** |
377 | * pop up an Appointment Dialog to edit an existing appointment.Get | 377 | * pop up an Appointment Dialog to edit an existing appointment.Get |
378 | * information on the appointment from the list of unique IDs that is | 378 | * information on the appointment from the list of unique IDs that is |
379 | * currently in the View, called currIds. | 379 | * currently in the View, called currIds. |
380 | */ | 380 | */ |
381 | void appointment_edit(); | 381 | void appointment_edit(); |
382 | /** | 382 | /** |
383 | * pop up dialog confirming deletion of currently selected event in the | 383 | * pop up dialog confirming deletion of currently selected event in the |
384 | * View. | 384 | * View. |
385 | */ | 385 | */ |
386 | void appointment_delete(); | 386 | void appointment_delete(); |
387 | 387 | ||
388 | /** mails the currently selected event to a particular user as a vCalendar | 388 | /** mails the currently selected event to a particular user as a vCalendar |
389 | attachment. */ | 389 | attachment. */ |
390 | void action_mail(); | 390 | void action_mail(); |
391 | 391 | ||
392 | /* frees a subtodo from it's relation */ | 392 | /* frees a subtodo from it's relation */ |
393 | void todo_unsub( Todo * ); | 393 | void todo_unsub( Todo * ); |
394 | void todo_resub( Todo * parent, Todo * sub ); | 394 | void todo_resub( Todo * parent, Todo * sub ); |
395 | 395 | ||
396 | /** Take ownership of selected event. */ | 396 | /** Take ownership of selected event. */ |
397 | void takeOverEvent(); | 397 | void takeOverEvent(); |
398 | 398 | ||
399 | /** Take ownership of all events in calendar. */ | 399 | /** Take ownership of all events in calendar. */ |
400 | void takeOverCalendar(); | 400 | void takeOverCalendar(); |
401 | 401 | ||
402 | /** query whether or not the calendar is "dirty". */ | 402 | /** query whether or not the calendar is "dirty". */ |
403 | bool isModified(); | 403 | bool isModified(); |
404 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 404 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
405 | void setModified(bool modified=true); | 405 | void setModified(bool modified=true); |
406 | 406 | ||
407 | /** query if the calendar is read-only. */ | 407 | /** query if the calendar is read-only. */ |
408 | bool isReadOnly(); | 408 | bool isReadOnly(); |
409 | /** set state of calendar to read-only */ | 409 | /** set state of calendar to read-only */ |
410 | void setReadOnly(bool readOnly=true); | 410 | void setReadOnly(bool readOnly=true); |
411 | 411 | ||
412 | void eventUpdated(Incidence *); | 412 | void eventUpdated(Incidence *); |
413 | 413 | ||
414 | /* iTIP scheduling actions */ | 414 | /* iTIP scheduling actions */ |
415 | void schedule_publish(Incidence *incidence = 0); | 415 | void schedule_publish(Incidence *incidence = 0); |
416 | void schedule_request(Incidence *incidence = 0); | 416 | void schedule_request(Incidence *incidence = 0); |
417 | void schedule_refresh(Incidence *incidence = 0); | 417 | void schedule_refresh(Incidence *incidence = 0); |
418 | void schedule_cancel(Incidence *incidence = 0); | 418 | void schedule_cancel(Incidence *incidence = 0); |
419 | void schedule_add(Incidence *incidence = 0); | 419 | void schedule_add(Incidence *incidence = 0); |
420 | void schedule_reply(Incidence *incidence = 0); | 420 | void schedule_reply(Incidence *incidence = 0); |
421 | void schedule_counter(Incidence *incidence = 0); | 421 | void schedule_counter(Incidence *incidence = 0); |
422 | void schedule_declinecounter(Incidence *incidence = 0); | 422 | void schedule_declinecounter(Incidence *incidence = 0); |
423 | void schedule_publish_freebusy(int daysToPublish = 30); | 423 | void schedule_publish_freebusy(int daysToPublish = 30); |
424 | 424 | ||
425 | void openAddressbook(); | 425 | void openAddressbook(); |
426 | 426 | ||
427 | void editFilters(); | 427 | void editFilters(); |
428 | void toggleFilerEnabled(); | 428 | void toggleFilerEnabled(); |
429 | QPtrList<CalFilter> filters(); | 429 | QPtrList<CalFilter> filters(); |
430 | void toggleFilter(); | 430 | void toggleFilter(); |
431 | void showFilter(bool visible); | 431 | void showFilter(bool visible); |
432 | void updateFilter(); | 432 | void updateFilter(); |
433 | void filterEdited(); | 433 | void filterEdited(); |
434 | void selectFilter( int ); | 434 | void selectFilter( int ); |
435 | KOFilterView *filterView(); | 435 | KOFilterView *filterView(); |
436 | 436 | ||
437 | void showIntro(); | 437 | void showIntro(); |
438 | 438 | ||
439 | /** Move the curdatepient view date to today */ | 439 | /** Move the curdatepient view date to today */ |
440 | void goToday(); | 440 | void goToday(); |
441 | 441 | ||
442 | /** Move to the next date(s) in the current view */ | 442 | /** Move to the next date(s) in the current view */ |
443 | void goNext(); | 443 | void goNext(); |
444 | 444 | ||
445 | /** Move to the previous date(s) in the current view */ | 445 | /** Move to the previous date(s) in the current view */ |
446 | void goPrevious(); | 446 | void goPrevious(); |
447 | /** Move to the next date(s) in the current view */ | 447 | /** Move to the next date(s) in the current view */ |
448 | void goNextMonth(); | 448 | void goNextMonth(); |
449 | 449 | ||
450 | /** Move to the previous date(s) in the current view */ | 450 | /** Move to the previous date(s) in the current view */ |
451 | void goPreviousMonth(); | 451 | void goPreviousMonth(); |
452 | 452 | ||
453 | void toggleExpand(); | 453 | void toggleExpand(); |
454 | void toggleDateNavigatorWidget(); | 454 | void toggleDateNavigatorWidget(); |
455 | void toggleAllDaySize(); | 455 | void toggleAllDaySize(); |
456 | void dialogClosing(Incidence *); | 456 | void dialogClosing(Incidence *); |
457 | 457 | ||
458 | /** Look for new messages in the inbox */ | 458 | /** Look for new messages in the inbox */ |
459 | void lookForIncomingMessages(); | 459 | void lookForIncomingMessages(); |
460 | /** Look for new messages in the outbox */ | 460 | /** Look for new messages in the outbox */ |
461 | void lookForOutgoingMessages(); | 461 | void lookForOutgoingMessages(); |
462 | 462 | ||
463 | void processMainViewSelection( Incidence * ); | 463 | void processMainViewSelection( Incidence * ); |
464 | void processTodoListSelection( Incidence * ); | 464 | void processTodoListSelection( Incidence * ); |
465 | 465 | ||
466 | void processIncidenceSelection( Incidence * ); | 466 | void processIncidenceSelection( Incidence * ); |
467 | 467 | ||
468 | void purgeCompleted(); | 468 | void purgeCompleted(); |
469 | bool removeCompletedSubTodos( Todo* ); | 469 | bool removeCompletedSubTodos( Todo* ); |
470 | void slotCalendarChanged(); | 470 | void slotCalendarChanged(); |
471 | bool importBday(); | 471 | bool importBday(); |
472 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 472 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
473 | bool importQtopia( const QString &categoriesFile, | 473 | bool importQtopia( const QString &categoriesFile, |
474 | const QString &datebookFile, | 474 | const QString &datebookFile, |
475 | const QString &tasklistFile ); | 475 | const QString &tasklistFile ); |
476 | void syncExternal( int mode ); | 476 | void syncExternal( int mode ); |
477 | void slotSelectPickerDate( QDate ) ; | 477 | void slotSelectPickerDate( QDate ) ; |
478 | void showDatePicker() ; | 478 | void showDatePicker() ; |
479 | void showDatePickerPopup() ; | 479 | void showDatePickerPopup() ; |
480 | void moveIncidence(Incidence *) ; | 480 | void moveIncidence(Incidence *) ; |
481 | void beamIncidence(Incidence *) ; | 481 | void beamIncidence(Incidence *) ; |
482 | void beamCalendar() ; | 482 | void beamCalendar() ; |
483 | void beamFilteredCalendar() ; | 483 | void beamFilteredCalendar() ; |
484 | void beamIncidenceList(QPtrList<Incidence>) ; | 484 | void beamIncidenceList(QPtrList<Incidence>) ; |
485 | void manageCategories(); | 485 | void manageCategories(); |
486 | int addCategories(); | 486 | int addCategories(); |
487 | void removeCategories(); | 487 | void removeCategories(); |
488 | void setSyncDevice( QString ); | 488 | void setSyncDevice( QString ); |
489 | void setSyncName( QString ); | 489 | void setSyncName( QString ); |
490 | void showDay( QDate ); | 490 | void showDay( QDate ); |
491 | void undo_delete(); | 491 | void undo_delete(); |
492 | protected slots: | 492 | protected slots: |
493 | void resetFocus(); | 493 | void resetFocus(); |
494 | void slotViewerClosed(); | 494 | void slotViewerClosed(); |
495 | void timerAlarm(); | 495 | void timerAlarm(); |
496 | void suspendAlarm(); | 496 | void suspendAlarm(); |
497 | void beamDone( Ir *ir ); | 497 | void beamDone( Ir *ir ); |
498 | /** Select a view or adapt the current view to display the specified dates. */ | 498 | /** Select a view or adapt the current view to display the specified dates. */ |
499 | void showDates( const KCal::DateList & ); | 499 | void showDates( const KCal::DateList & ); |
500 | void selectWeekNum ( int ); | 500 | void selectWeekNum ( int ); |
501 | 501 | ||
502 | public: | 502 | public: |
503 | // show a standard warning | 503 | // show a standard warning |
504 | // returns KMsgBox::yesNoCancel() | 504 | // returns KMsgBox::yesNoCancel() |
505 | int msgCalModified(); | 505 | int msgCalModified(); |
506 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 506 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
507 | 507 | ||
508 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 508 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
509 | virtual void removeSyncInfo( QString syncProfile); | 509 | virtual void removeSyncInfo( QString syncProfile); |
510 | void setSyncManager(KSyncManager* manager); | 510 | void setSyncManager(KSyncManager* manager); |
511 | void setLoadedFileVersion(QDateTime); | 511 | void setLoadedFileVersion(QDateTime); |
512 | bool checkFileVersion(QString fn); | 512 | bool checkFileVersion(QString fn); |
513 | bool checkAllFileVersions(); | ||
513 | bool checkFileChanged(QString fn); | 514 | bool checkFileChanged(QString fn); |
514 | Event* getLastSyncEvent(); | 515 | Event* getLastSyncEvent(); |
515 | /** Adapt navigation units correpsonding to step size of navigation of the | 516 | /** Adapt navigation units correpsonding to step size of navigation of the |
516 | * current view. | 517 | * current view. |
517 | */ | 518 | */ |
518 | void adaptNavigationUnits(); | 519 | void adaptNavigationUnits(); |
519 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 520 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
520 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 521 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
521 | //Attendee* getYourAttendee(Event *event); | 522 | //Attendee* getYourAttendee(Event *event); |
522 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 523 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
523 | protected: | 524 | protected: |
524 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 525 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
525 | 526 | ||
526 | // returns KMsgBox::OKCandel() | 527 | // returns KMsgBox::OKCandel() |
527 | int msgItemDelete(const QString name); | 528 | int msgItemDelete(const QString name); |
528 | void showEventEditor(); | 529 | void showEventEditor(); |
529 | void showTodoEditor(); | 530 | void showTodoEditor(); |
530 | void writeLocale(); | 531 | void writeLocale(); |
531 | Todo *selectedTodo(); | 532 | Todo *selectedTodo(); |
532 | 533 | ||
533 | private: | 534 | private: |
534 | QDateTime mNextAlarmDateTime; | 535 | QDateTime mNextAlarmDateTime; |
535 | bool mViewerCallerIsSearchDialog; | 536 | bool mViewerCallerIsSearchDialog; |
536 | bool mBlockShowDates; | 537 | bool mBlockShowDates; |
537 | KSyncManager* mSyncManager; | 538 | KSyncManager* mSyncManager; |
538 | AlarmDialog * mAlarmDialog; | 539 | AlarmDialog * mAlarmDialog; |
539 | QString mAlarmNotification; | 540 | QString mAlarmNotification; |
540 | QString mSuspendAlarmNotification; | 541 | QString mSuspendAlarmNotification; |
541 | QTimer* mSuspendTimer; | 542 | QTimer* mSuspendTimer; |
542 | QTimer* mAlarmTimer; | 543 | QTimer* mAlarmTimer; |
543 | QTimer* mRecheckAlarmTimer; | 544 | QTimer* mRecheckAlarmTimer; |
544 | void computeAlarm( QString ); | 545 | void computeAlarm( QString ); |
545 | void startAlarm( QString, QString ); | 546 | void startAlarm( QString, QString ); |
546 | void setSyncEventsReadOnly(); | 547 | void setSyncEventsReadOnly(); |
547 | 548 | ||
548 | QDateTime loadedFileVersion; | 549 | QDateTime loadedFileVersion; |
549 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 550 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
550 | void checkExternalId( Incidence * inc ); | 551 | void checkExternalId( Incidence * inc ); |
551 | int mGlobalSyncMode; | 552 | int mGlobalSyncMode; |
552 | QString mCurrentSyncDevice; | 553 | QString mCurrentSyncDevice; |
553 | QString mCurrentSyncName; | 554 | QString mCurrentSyncName; |
554 | KOBeamPrefs* beamDialog; | 555 | KOBeamPrefs* beamDialog; |
555 | void init(); | 556 | void init(); |
556 | int mDatePickerMode; | 557 | int mDatePickerMode; |
557 | bool mFlagEditDescription; | 558 | bool mFlagEditDescription; |
558 | QDateTime mLastCalendarSync; | 559 | QDateTime mLastCalendarSync; |
559 | void createPrinter(); | 560 | void createPrinter(); |
560 | 561 | ||
561 | void calendarModified( bool, Calendar * ); | 562 | void calendarModified( bool, Calendar * ); |
562 | 563 | ||
563 | CalPrinter *mCalPrinter; | 564 | CalPrinter *mCalPrinter; |
564 | 565 | ||
565 | QSplitter *mPanner; | 566 | QSplitter *mPanner; |
566 | QSplitter *mLeftSplitter; | 567 | QSplitter *mLeftSplitter; |
567 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 568 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
568 | QWidgetStack *mRightFrame; | 569 | QWidgetStack *mRightFrame; |
569 | 570 | ||
570 | KDatePicker* mDatePicker; | 571 | KDatePicker* mDatePicker; |
571 | QVBox* mDateFrame; | 572 | QVBox* mDateFrame; |
572 | 573 | ||
573 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 574 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
574 | 575 | ||
575 | KOFilterView *mFilterView; | 576 | KOFilterView *mFilterView; |
576 | KOCalEditView *mCalEditView; | 577 | KOCalEditView *mCalEditView; |
577 | 578 | ||
578 | ResourceView *mResourceView; | 579 | ResourceView *mResourceView; |
579 | 580 | ||
580 | // calendar object for this viewing instance | 581 | // calendar object for this viewing instance |
581 | Calendar *mCalendar; | 582 | Calendar *mCalendar; |
582 | 583 | ||
583 | CalendarResourceManager *mResourceManager; | 584 | CalendarResourceManager *mResourceManager; |
584 | 585 | ||
585 | FileStorage *mStorage; | 586 | FileStorage *mStorage; |
586 | 587 | ||
587 | DateNavigator *mNavigator; | 588 | DateNavigator *mNavigator; |
588 | 589 | ||
589 | KOViewManager *mViewManager; | 590 | KOViewManager *mViewManager; |
590 | KODialogManager *mDialogManager; | 591 | KODialogManager *mDialogManager; |
591 | 592 | ||
592 | // Calendar filters | 593 | // Calendar filters |
593 | QPtrList<CalFilter> mFilters; | 594 | QPtrList<CalFilter> mFilters; |
594 | 595 | ||
595 | // various housekeeping variables. | 596 | // various housekeeping variables. |
596 | bool mModified; // flag indicating if calendar is modified | 597 | bool mModified; // flag indicating if calendar is modified |
597 | bool mReadOnly; // flag indicating if calendar is read-only | 598 | bool mReadOnly; // flag indicating if calendar is read-only |
598 | QDate mSaveSingleDate; | 599 | QDate mSaveSingleDate; |
599 | 600 | ||
600 | Incidence *mSelectedIncidence; | 601 | Incidence *mSelectedIncidence; |
601 | Incidence *mMoveIncidence; | 602 | Incidence *mMoveIncidence; |
602 | QDate mMoveIncidenceOldDate; | 603 | QDate mMoveIncidenceOldDate; |
603 | KOTodoView *mTodoList; | 604 | KOTodoView *mTodoList; |
604 | KOEventEditor * mEventEditor; | 605 | KOEventEditor * mEventEditor; |
605 | KOTodoEditor * mTodoEditor; | 606 | KOTodoEditor * mTodoEditor; |
606 | KOEventViewerDialog * mEventViewerDialog; | 607 | KOEventViewerDialog * mEventViewerDialog; |
607 | void keyPressEvent ( QKeyEvent *e) ; | 608 | void keyPressEvent ( QKeyEvent *e) ; |
608 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 609 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
609 | }; | 610 | }; |
610 | 611 | ||
611 | 612 | ||
612 | class CalendarViewVisitor : public Incidence::Visitor | 613 | class CalendarViewVisitor : public Incidence::Visitor |
613 | { | 614 | { |
614 | public: | 615 | public: |
615 | CalendarViewVisitor() : mView( 0 ) {} | 616 | CalendarViewVisitor() : mView( 0 ) {} |
616 | 617 | ||
617 | bool act( Incidence *incidence, CalendarView *view ) | 618 | bool act( Incidence *incidence, CalendarView *view ) |
618 | { | 619 | { |
619 | mView = view; | 620 | mView = view; |
620 | return incidence->accept( *this ); | 621 | return incidence->accept( *this ); |
621 | } | 622 | } |
622 | 623 | ||
623 | protected: | 624 | protected: |
624 | CalendarView *mView; | 625 | CalendarView *mView; |
625 | }; | 626 | }; |
626 | 627 | ||
627 | class ShowIncidenceVisitor : public CalendarViewVisitor | 628 | class ShowIncidenceVisitor : public CalendarViewVisitor |
628 | { | 629 | { |
629 | protected: | 630 | protected: |
630 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 631 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
631 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 632 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
632 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 633 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
633 | }; | 634 | }; |
634 | 635 | ||
635 | class EditIncidenceVisitor : public CalendarViewVisitor | 636 | class EditIncidenceVisitor : public CalendarViewVisitor |
636 | { | 637 | { |
637 | protected: | 638 | protected: |
638 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 639 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
639 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 640 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
640 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 641 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
641 | }; | 642 | }; |
642 | 643 | ||
643 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 644 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
644 | { | 645 | { |
645 | protected: | 646 | protected: |
646 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 647 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
647 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 648 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
648 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 649 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
649 | }; | 650 | }; |
650 | 651 | ||
651 | #endif | 652 | #endif |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 361eec8..19d731f 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,391 +1,407 @@ | |||
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 | emit needsUpdate(); | 161 | emit needsUpdate(); |
162 | 162 | ||
163 | } | 163 | } |
164 | void KOCalEditView::selectStdCal( int id, bool b ) | 164 | void KOCalEditView::selectStdCal( int id, bool b ) |
165 | { | 165 | { |
166 | 166 | ||
167 | if ( !b ) { | 167 | if ( !b ) { |
168 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 168 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
169 | if ( it ) { | 169 | if ( it ) { |
170 | it->blockSignals( true ); | 170 | it->blockSignals( true ); |
171 | it->setChecked( true ); | 171 | it->setChecked( true ); |
172 | it->blockSignals( false ); | 172 | it->blockSignals( false ); |
173 | return; | 173 | return; |
174 | } | 174 | } |
175 | return; | 175 | return; |
176 | } | 176 | } |
177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
178 | KOCalCheckButton* it = mStdandardB.first(); | 178 | KOCalCheckButton* it = mStdandardB.first(); |
179 | while ( it ) { | 179 | while ( it ) { |
180 | if ( it->isChecked() ) { | 180 | if ( it->isChecked() ) { |
181 | if ( it != sen ) { | 181 | if ( it != sen ) { |
182 | it->blockSignals( true ); | 182 | it->blockSignals( true ); |
183 | it->setChecked( false ); | 183 | it->setChecked( false ); |
184 | it->blockSignals( false ); | 184 | it->blockSignals( false ); |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | it = mStdandardB.next(); | 188 | it = mStdandardB.next(); |
189 | } | 189 | } |
190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
191 | while ( kkf ) { | 191 | while ( kkf ) { |
192 | kkf->isStandard = false; | 192 | kkf->isStandard = false; |
193 | kkf = KOPrefs::instance()->mCalendars.next(); | 193 | kkf = KOPrefs::instance()->mCalendars.next(); |
194 | } | 194 | } |
195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
196 | emit setCalendarDefault ( id ); | 196 | emit setCalendarDefault ( id ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
200 | { | 200 | { |
201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
202 | emit alarmEnabled ( id , b ); | 202 | emit alarmEnabled ( id , b ); |
203 | emit needsUpdate(); | 203 | emit needsUpdate(); |
204 | } | 204 | } |
205 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 205 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
206 | { | 206 | { |
207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
208 | emit calendarReadonly ( id , b ); | 208 | emit calendarReadonly ( id , b ); |
209 | emit needsUpdate(); | 209 | emit needsUpdate(); |
210 | 210 | ||
211 | } | 211 | } |
212 | void KOCalEditView::setColor( const QColor& c, int id ) | 212 | void KOCalEditView::setColor( const QColor& c, int id ) |
213 | { | 213 | { |
214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
215 | emit needsUpdate(); | 215 | emit needsUpdate(); |
216 | } | 216 | } |
217 | void KOCalEditView::deleteCal( int id ) | 217 | void KOCalEditView::deleteCal( int id ) |
218 | { | 218 | { |
219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
220 | QString name = kkf->mName; | 220 | QString name = kkf->mName; |
221 | QString file = kkf->mFileName; | 221 | QString file = kkf->mFileName; |
222 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 222 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
223 | if ( kkf->isStandard ) | 223 | if ( kkf->isStandard ) |
224 | selectStdCal( 1, true ); | 224 | selectStdCal( 1, true ); |
225 | emit removeCalendar ( id ); | 225 | emit removeCalendar ( id ); |
226 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 226 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
227 | emit needsUpdate(); | 227 | emit needsUpdate(); |
228 | readConfig(); | 228 | readConfig(); |
229 | } | 229 | } |
230 | void KOCalEditView::infoCal( int id ) | 230 | void KOCalEditView::infoCal( int id ) |
231 | { | 231 | { |
232 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 232 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
233 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 233 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; |
234 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 234 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { |
235 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { | ||
236 | emit calendarAdded( id ); | ||
237 | readConfig(); | ||
238 | emit needsUpdate(); | ||
239 | } | ||
240 | } | ||
241 | else | ||
242 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | ||
235 | } | 243 | } |
236 | void KOCalEditView::readConfig() | 244 | void KOCalEditView::readConfig() |
237 | { | 245 | { |
238 | 246 | ||
239 | mStdandardB.clear(); | 247 | mStdandardB.clear(); |
240 | mEnabledB.clear(); | 248 | mEnabledB.clear(); |
241 | mAlarmB.clear(); | 249 | mAlarmB.clear(); |
242 | mROB.clear(); | 250 | mROB.clear(); |
243 | 251 | ||
244 | if ( mw ) delete mw; | 252 | if ( mw ) delete mw; |
245 | mw = new QWidget ( this ); | 253 | mw = new QWidget ( this ); |
246 | ml->addWidget ( mw ); | 254 | ml->addWidget ( mw ); |
247 | 255 | ||
248 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 256 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
249 | //mainLayout->setSpacing( 3 ); | 257 | //mainLayout->setSpacing( 3 ); |
250 | QPushButton * addBut = new QPushButton ( mw ); | 258 | QPushButton * addBut = new QPushButton ( mw ); |
251 | mainLayout->addWidget( addBut,0,0 ); | 259 | mainLayout->addWidget( addBut,0,0 ); |
252 | addBut->setPixmap ( SmallIcon("plus")); | 260 | addBut->setPixmap ( SmallIcon("plus")); |
253 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 261 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
254 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 262 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
255 | 263 | ||
256 | addBut = new QPushButton ( mw ); | 264 | addBut = new QPushButton ( mw ); |
257 | mainLayout->addWidget( addBut,0,1 ); | 265 | mainLayout->addWidget( addBut,0,1 ); |
258 | addBut->setPixmap ( SmallIcon("eye")); | 266 | addBut->setPixmap ( SmallIcon("eye")); |
259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 267 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 268 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
261 | 269 | ||
262 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); | 270 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); |
263 | mainLayout->addWidget( lab,0,2 ); | 271 | mainLayout->addWidget( lab,0,2 ); |
264 | 272 | ||
265 | addBut = new QPushButton ( mw ); | 273 | addBut = new QPushButton ( mw ); |
266 | mainLayout->addWidget( addBut,0,3 ); | 274 | mainLayout->addWidget( addBut,0,3 ); |
267 | addBut->setPixmap ( SmallIcon("bell")); | 275 | addBut->setPixmap ( SmallIcon("bell")); |
268 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 276 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
269 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 277 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
270 | 278 | ||
271 | addBut = new QPushButton ( mw ); | 279 | addBut = new QPushButton ( mw ); |
272 | mainLayout->addWidget( addBut,0,4 ); | 280 | mainLayout->addWidget( addBut,0,4 ); |
273 | addBut->setPixmap ( SmallIcon("pencil")); | 281 | addBut->setPixmap ( SmallIcon("pencil")); |
274 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 282 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
275 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 283 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
276 | 284 | ||
277 | lab = new QLabel ( i18n(" Color "), mw ); | 285 | lab = new QLabel ( i18n(" Color "), mw ); |
278 | mainLayout->addWidget( lab,0,5 ); | 286 | mainLayout->addWidget( lab,0,5 ); |
279 | #if 0 | 287 | #if 0 |
280 | addBut = new QPushButton ( mw ); | 288 | addBut = new QPushButton ( mw ); |
281 | mainLayout->addWidget( addBut,0,6 ); | 289 | mainLayout->addWidget( addBut,0,6 ); |
282 | addBut->setPixmap ( SmallIcon("minus")); | 290 | addBut->setPixmap ( SmallIcon("minus")); |
283 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 291 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
284 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 292 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
285 | #endif | 293 | #endif |
286 | 294 | ||
287 | 295 | ||
288 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 296 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
289 | int row = 1; | 297 | int row = 1; |
290 | while ( kkf ) { | 298 | while ( kkf ) { |
291 | 299 | ||
292 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 300 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
293 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 301 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
294 | cb->setChecked( kkf->isStandard ); | 302 | cb->setChecked( kkf->isStandard ); |
295 | cb->setNum( kkf->mCalNumber ); | 303 | cb->setNum( kkf->mCalNumber ); |
296 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 304 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
305 | if ( kkf->mErrorOnLoad ) | ||
306 | cb->setEnabled( false ); | ||
297 | cb = new KOCalCheckButton( mw ); | 307 | cb = new KOCalCheckButton( mw ); |
298 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); | 308 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); |
299 | cb->setChecked( kkf->isEnabled ); | 309 | cb->setChecked( kkf->isEnabled ); |
300 | cb->setNum( kkf->mCalNumber ); | 310 | cb->setNum( kkf->mCalNumber ); |
311 | if ( kkf->mErrorOnLoad ) | ||
312 | cb->setEnabled( false ); | ||
301 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 313 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
302 | KOCalButton* name = new KOCalButton( mw ); | 314 | KOCalButton* name = new KOCalButton( mw ); |
303 | name->setNum( kkf->mCalNumber ); | 315 | name->setNum( kkf->mCalNumber ); |
304 | name->setText( kkf->mName ); | 316 | name->setText( kkf->mName ); |
305 | mainLayout->addWidget( name,row,2 ); | 317 | mainLayout->addWidget( name,row,2 ); |
306 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 318 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
307 | cb = new KOCalCheckButton( mw ); | 319 | cb = new KOCalCheckButton( mw ); |
308 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); | 320 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); |
309 | cb->setChecked( kkf->isAlarmEnabled ); | 321 | cb->setChecked( kkf->isAlarmEnabled ); |
310 | cb->setNum( kkf->mCalNumber ); | 322 | cb->setNum( kkf->mCalNumber ); |
311 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 323 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
324 | if ( kkf->mErrorOnLoad ) | ||
325 | cb->setEnabled( false ); | ||
312 | cb = new KOCalCheckButton( mw ); | 326 | cb = new KOCalCheckButton( mw ); |
313 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); | 327 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); |
314 | cb->setChecked( kkf->isReadOnly ); | 328 | cb->setChecked( kkf->isReadOnly ); |
315 | cb->setNum( kkf->mCalNumber ); | 329 | cb->setNum( kkf->mCalNumber ); |
316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 330 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
331 | if ( kkf->mErrorOnLoad ) | ||
332 | cb->setEnabled( false ); | ||
317 | KColorButton *colb = new KColorButton( mw ); | 333 | KColorButton *colb = new KColorButton( mw ); |
318 | mainLayout->addWidget( colb,row,5 ); | 334 | mainLayout->addWidget( colb,row,5 ); |
319 | colb->setID( kkf->mCalNumber ); | 335 | colb->setID( kkf->mCalNumber ); |
320 | colb->setColor( kkf->mDefaultColor ); | 336 | colb->setColor( kkf->mDefaultColor ); |
321 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 337 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
322 | if ( row > 1) { | 338 | if ( row > 1) { |
323 | KOCalButton* calb = new KOCalButton( mw ); | 339 | KOCalButton* calb = new KOCalButton( mw ); |
324 | mainLayout->addWidget( calb,row,6 ); | 340 | mainLayout->addWidget( calb,row,6 ); |
325 | calb->setNum( kkf->mCalNumber ); | 341 | calb->setNum( kkf->mCalNumber ); |
326 | calb->setPixmap ( SmallIcon("minus")); | 342 | calb->setPixmap ( SmallIcon("minus")); |
327 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 343 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
328 | int hei = calb->sizeHint().height(); | 344 | int hei = calb->sizeHint().height(); |
329 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 345 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
330 | } | 346 | } |
331 | ++row; | 347 | ++row; |
332 | kkf = KOPrefs::instance()->mCalendars.next(); | 348 | kkf = KOPrefs::instance()->mCalendars.next(); |
333 | } | 349 | } |
334 | lab = new QLabel ( "", mw ); | 350 | lab = new QLabel ( "", mw ); |
335 | mainLayout->addWidget( lab,row,0 ); | 351 | mainLayout->addWidget( lab,row,0 ); |
336 | mw->show(); | 352 | mw->show(); |
337 | 353 | ||
338 | } | 354 | } |
339 | void KOCalEditView::addCal() | 355 | void KOCalEditView::addCal() |
340 | { | 356 | { |
341 | qDebug("addcal "); | 357 | qDebug("addcal "); |
342 | KONewCalPrefs prefs ( this ); | 358 | KONewCalPrefs prefs ( this ); |
343 | if ( ! prefs.exec() ) | 359 | if ( ! prefs.exec() ) |
344 | return; | 360 | return; |
345 | QString name = prefs.calName(); | 361 | QString name = prefs.calName(); |
346 | QString file = prefs.calFileName(); | 362 | QString file = prefs.calFileName(); |
347 | QFileInfo fi ( file ); | 363 | QFileInfo fi ( file ); |
348 | if (!fi.exists() ) { | 364 | if (!fi.exists() ) { |
349 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); | 365 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); |
350 | return; | 366 | return; |
351 | } | 367 | } |
352 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 368 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
353 | kkf->mName = name; | 369 | kkf->mName = name; |
354 | kkf->mFileName = file; | 370 | kkf->mFileName = file; |
355 | emit calendarAdded( kkf->mCalNumber ); | 371 | emit calendarAdded( kkf->mCalNumber ); |
356 | readConfig(); | 372 | readConfig(); |
357 | emit needsUpdate(); | 373 | emit needsUpdate(); |
358 | } | 374 | } |
359 | void KOCalEditView::enableAll() | 375 | void KOCalEditView::enableAll() |
360 | { | 376 | { |
361 | toggleList( mEnabledB ); | 377 | toggleList( mEnabledB ); |
362 | } | 378 | } |
363 | void KOCalEditView::enableAlarm() | 379 | void KOCalEditView::enableAlarm() |
364 | { | 380 | { |
365 | toggleList( mAlarmB ); | 381 | toggleList( mAlarmB ); |
366 | } | 382 | } |
367 | void KOCalEditView::disableRO() | 383 | void KOCalEditView::disableRO() |
368 | { | 384 | { |
369 | toggleList( mROB ); | 385 | toggleList( mROB ); |
370 | } | 386 | } |
371 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 387 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
372 | { | 388 | { |
373 | bool dis = false; | 389 | bool dis = false; |
374 | KOCalCheckButton* it = list.first(); | 390 | KOCalCheckButton* it = list.first(); |
375 | while ( it ) { | 391 | while ( it ) { |
376 | if ( !it->isChecked() ) { | 392 | if ( !it->isChecked() ) { |
377 | dis = true; | 393 | dis = true; |
378 | break; | 394 | break; |
379 | } | 395 | } |
380 | it = list.next(); | 396 | it = list.next(); |
381 | } | 397 | } |
382 | it = list.first(); | 398 | it = list.first(); |
383 | while ( it ) { | 399 | while ( it ) { |
384 | it->setChecked(dis); | 400 | it->setChecked(dis); |
385 | it = list.next(); | 401 | it = list.next(); |
386 | } | 402 | } |
387 | } | 403 | } |
388 | void KOCalEditView::deleteAll() | 404 | void KOCalEditView::deleteAll() |
389 | { | 405 | { |
390 | qDebug("delteAll"); | 406 | qDebug("delteAll"); |
391 | } | 407 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index f114d88..463fc33 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,352 +1,355 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | 31 | ||
32 | class KConfig; | 32 | class KConfig; |
33 | class QFont; | 33 | class QFont; |
34 | class QColor; | 34 | class QColor; |
35 | class QStringList; | 35 | class QStringList; |
36 | 36 | ||
37 | #define VIEW_WN_VIEW 1 | 37 | #define VIEW_WN_VIEW 1 |
38 | #define VIEW_NX_VIEW 2 | 38 | #define VIEW_NX_VIEW 2 |
39 | #define VIEW_J_VIEW 3 | 39 | #define VIEW_J_VIEW 3 |
40 | #define VIEW_A_VIEW 4 | 40 | #define VIEW_A_VIEW 4 |
41 | #define VIEW_ML_VIEW 5 | 41 | #define VIEW_ML_VIEW 5 |
42 | #define VIEW_M_VIEW 6 | 42 | #define VIEW_M_VIEW 6 |
43 | #define VIEW_L_VIEW 7 | 43 | #define VIEW_L_VIEW 7 |
44 | #define VIEW_T_VIEW 8 | 44 | #define VIEW_T_VIEW 8 |
45 | 45 | ||
46 | class KopiCalendarFile : public QObject | 46 | class KopiCalendarFile : public QObject |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | KopiCalendarFile( ) : QObject( ) | 49 | KopiCalendarFile( ) : QObject( ) |
50 | { | 50 | { |
51 | isStandard = false; | 51 | isStandard = false; |
52 | isEnabled = true; | 52 | isEnabled = true; |
53 | isAlarmEnabled = true; | 53 | isAlarmEnabled = true; |
54 | isReadOnly = false; | 54 | isReadOnly = false; |
55 | mName = "Calendar"; | 55 | mName = "Calendar"; |
56 | mFileName = QDir::homeDirPath() + "/icalfile.ics"; | 56 | mFileName = QDir::homeDirPath() + "/icalfile.ics"; |
57 | mCalNumber = 0; | 57 | mCalNumber = 0; |
58 | mDefaultColor = Qt::red; | 58 | mDefaultColor = Qt::red; |
59 | mErrorOnLoad = false; | ||
59 | } | 60 | } |
60 | bool isStandard; | 61 | bool isStandard; |
61 | bool isEnabled; | 62 | bool isEnabled; |
62 | bool isAlarmEnabled; | 63 | bool isAlarmEnabled; |
63 | bool isReadOnly; | 64 | bool isReadOnly; |
65 | bool mErrorOnLoad; | ||
64 | QString mName; | 66 | QString mName; |
65 | QString mFileName; | 67 | QString mFileName; |
66 | int mCalNumber; | 68 | int mCalNumber; |
67 | QColor mDefaultColor; | 69 | QColor mDefaultColor; |
70 | QDateTime mLoadDt; | ||
68 | }; | 71 | }; |
69 | class KOPrefs : public KPimPrefs | 72 | class KOPrefs : public KPimPrefs |
70 | { | 73 | { |
71 | public: | 74 | public: |
72 | enum { FormatVCalendar, FormatICalendar }; | 75 | enum { FormatVCalendar, FormatICalendar }; |
73 | enum { MailClientKMail, MailClientSendmail }; | 76 | enum { MailClientKMail, MailClientSendmail }; |
74 | enum { IMIPDummy, IMIPKMail }; | 77 | enum { IMIPDummy, IMIPKMail }; |
75 | enum { IMIPOutbox, IMIPdirectsend }; | 78 | enum { IMIPOutbox, IMIPdirectsend }; |
76 | enum { neverAuto, addressbookAuto, selectedAuto }; | 79 | enum { neverAuto, addressbookAuto, selectedAuto }; |
77 | enum { standardDestination, askDestination }; | 80 | enum { standardDestination, askDestination }; |
78 | 81 | ||
79 | virtual ~KOPrefs(); | 82 | virtual ~KOPrefs(); |
80 | 83 | ||
81 | /** Get instance of KOPrefs. It is made sure that there is only one | 84 | /** Get instance of KOPrefs. It is made sure that there is only one |
82 | instance. */ | 85 | instance. */ |
83 | static KOPrefs *instance(); | 86 | static KOPrefs *instance(); |
84 | 87 | ||
85 | /** Set preferences to default values */ | 88 | /** Set preferences to default values */ |
86 | void usrSetDefaults(); | 89 | void usrSetDefaults(); |
87 | 90 | ||
88 | /** Read preferences from config file */ | 91 | /** Read preferences from config file */ |
89 | void usrReadConfig(); | 92 | void usrReadConfig(); |
90 | 93 | ||
91 | /** Write preferences to config file */ | 94 | /** Write preferences to config file */ |
92 | void usrWriteConfig(); | 95 | void usrWriteConfig(); |
93 | void setCategoryDefaults(); | 96 | void setCategoryDefaults(); |
94 | void setAllDefaults(); | 97 | void setAllDefaults(); |
95 | KopiCalendarFile * getNewCalendar(); | 98 | KopiCalendarFile * getNewCalendar(); |
96 | KopiCalendarFile * getCalendar( int ); | 99 | KopiCalendarFile * getCalendar( int ); |
97 | void deleteCalendar( int ); | 100 | void deleteCalendar( int ); |
98 | QColor defaultColor( int ) const; | 101 | QColor defaultColor( int ) const; |
99 | protected: | 102 | protected: |
100 | void setTimeZoneIdDefault(); | 103 | void setTimeZoneIdDefault(); |
101 | 104 | ||
102 | /** Fill empty mail fields with default values. */ | 105 | /** Fill empty mail fields with default values. */ |
103 | void fillMailDefaults(); | 106 | void fillMailDefaults(); |
104 | 107 | ||
105 | private: | 108 | private: |
106 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 109 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
107 | object. */ | 110 | object. */ |
108 | KOPrefs(); | 111 | KOPrefs(); |
109 | 112 | ||
110 | static KOPrefs *mInstance; | 113 | static KOPrefs *mInstance; |
111 | QStringList getDefaultList(); | 114 | QStringList getDefaultList(); |
112 | QStringList getLocationDefaultList(); | 115 | QStringList getLocationDefaultList(); |
113 | public: | 116 | public: |
114 | // preferences data | 117 | // preferences data |
115 | KConfig* getConfig(); | 118 | KConfig* getConfig(); |
116 | void setFullName(const QString &); | 119 | void setFullName(const QString &); |
117 | QString fullName(); | 120 | QString fullName(); |
118 | void setEmail(const QString &); | 121 | void setEmail(const QString &); |
119 | QString email(); | 122 | QString email(); |
120 | 123 | ||
121 | QString mAdditional; | 124 | QString mAdditional; |
122 | 125 | ||
123 | bool mEmailControlCenter; | 126 | bool mEmailControlCenter; |
124 | 127 | ||
125 | bool mBcc; | 128 | bool mBcc; |
126 | bool mAutoSave; | 129 | bool mAutoSave; |
127 | int mAutoSaveInterval; | 130 | int mAutoSaveInterval; |
128 | bool mConfirm; | 131 | bool mConfirm; |
129 | 132 | ||
130 | bool mEnableGroupScheduling; | 133 | bool mEnableGroupScheduling; |
131 | bool mEnableProjectView; | 134 | bool mEnableProjectView; |
132 | 135 | ||
133 | int mDefaultFormat; | 136 | int mDefaultFormat; |
134 | int mMailClient; | 137 | int mMailClient; |
135 | 138 | ||
136 | int mStartTime; | 139 | int mStartTime; |
137 | int mDefaultDuration; | 140 | int mDefaultDuration; |
138 | int mAlarmTime; | 141 | int mAlarmTime; |
139 | 142 | ||
140 | int mWorkingHoursStart; | 143 | int mWorkingHoursStart; |
141 | int mWorkingHoursEnd; | 144 | int mWorkingHoursEnd; |
142 | bool mExcludeHolidays; | 145 | bool mExcludeHolidays; |
143 | bool mExcludeSaturdays; | 146 | bool mExcludeSaturdays; |
144 | bool mMarcusBainsShowSeconds; | 147 | bool mMarcusBainsShowSeconds; |
145 | 148 | ||
146 | QFont mTimeBarFont; | 149 | QFont mTimeBarFont; |
147 | QFont mMonthViewFont; | 150 | QFont mMonthViewFont; |
148 | QFont mAgendaViewFont; | 151 | QFont mAgendaViewFont; |
149 | QFont mMarcusBainsFont; | 152 | QFont mMarcusBainsFont; |
150 | QFont mTimeLabelsFont; | 153 | QFont mTimeLabelsFont; |
151 | QFont mTodoViewFont; | 154 | QFont mTodoViewFont; |
152 | QFont mListViewFont; | 155 | QFont mListViewFont; |
153 | QFont mDateNavigatorFont; | 156 | QFont mDateNavigatorFont; |
154 | QFont mEditBoxFont; | 157 | QFont mEditBoxFont; |
155 | QFont mJornalViewFont; | 158 | QFont mJornalViewFont; |
156 | QFont mWhatsNextFont; | 159 | QFont mWhatsNextFont; |
157 | QFont mEventViewFont; | 160 | QFont mEventViewFont; |
158 | 161 | ||
159 | 162 | ||
160 | 163 | ||
161 | 164 | ||
162 | QColor mHolidayColor; | 165 | QColor mHolidayColor; |
163 | QColor mHighlightColor; | 166 | QColor mHighlightColor; |
164 | QColor mEventColor; | 167 | QColor mEventColor; |
165 | QColor mTodoDoneColor; | 168 | QColor mTodoDoneColor; |
166 | QColor mAgendaBgColor; | 169 | QColor mAgendaBgColor; |
167 | QColor mWorkingHoursColor; | 170 | QColor mWorkingHoursColor; |
168 | QColor mTodoDueTodayColor; | 171 | QColor mTodoDueTodayColor; |
169 | QColor mTodoOverdueColor; | 172 | QColor mTodoOverdueColor; |
170 | QColor mTodoRunColor; | 173 | QColor mTodoRunColor; |
171 | QColor mMonthViewEvenColor; | 174 | QColor mMonthViewEvenColor; |
172 | QColor mMonthViewOddColor; | 175 | QColor mMonthViewOddColor; |
173 | QColor mMonthViewHolidayColor; | 176 | QColor mMonthViewHolidayColor; |
174 | bool mMonthViewUsesDayColors; | 177 | bool mMonthViewUsesDayColors; |
175 | bool mMonthViewSatSunTog; | 178 | bool mMonthViewSatSunTog; |
176 | bool mMonthViewWeek; | 179 | bool mMonthViewWeek; |
177 | QColor mAppColor1; | 180 | QColor mAppColor1; |
178 | QColor mAppColor2; | 181 | QColor mAppColor2; |
179 | bool mUseAppColors; | 182 | bool mUseAppColors; |
180 | 183 | ||
181 | int mDayBegins; | 184 | int mDayBegins; |
182 | int mHourSize; | 185 | int mHourSize; |
183 | int mAllDaySize; | 186 | int mAllDaySize; |
184 | bool mShowFullMenu; | 187 | bool mShowFullMenu; |
185 | bool mDailyRecur; | 188 | bool mDailyRecur; |
186 | bool mWeeklyRecur; | 189 | bool mWeeklyRecur; |
187 | bool mMonthDailyRecur; | 190 | bool mMonthDailyRecur; |
188 | bool mMonthWeeklyRecur; | 191 | bool mMonthWeeklyRecur; |
189 | bool mMonthShowIcons; | 192 | bool mMonthShowIcons; |
190 | bool mMonthShowTimes; | 193 | bool mMonthShowTimes; |
191 | bool mMonthShowShort; | 194 | bool mMonthShowShort; |
192 | bool mEnableToolTips; | 195 | bool mEnableToolTips; |
193 | bool mEnableMonthScroll; | 196 | bool mEnableMonthScroll; |
194 | bool mFullViewMonth; | 197 | bool mFullViewMonth; |
195 | bool mMonthViewUsesCategoryColor; | 198 | bool mMonthViewUsesCategoryColor; |
196 | bool mFullViewTodo; | 199 | bool mFullViewTodo; |
197 | bool mShowCompletedTodo; | 200 | bool mShowCompletedTodo; |
198 | bool mMarcusBainsEnabled; | 201 | bool mMarcusBainsEnabled; |
199 | int mNextXDays; | 202 | int mNextXDays; |
200 | int mWhatsNextDays; | 203 | int mWhatsNextDays; |
201 | int mWhatsNextPrios; | 204 | int mWhatsNextPrios; |
202 | bool mEnableQuickTodo; | 205 | bool mEnableQuickTodo; |
203 | 206 | ||
204 | bool mCompactDialogs; | 207 | bool mCompactDialogs; |
205 | bool mVerticalScreen; | 208 | bool mVerticalScreen; |
206 | 209 | ||
207 | bool mShowIconNewTodo; | 210 | bool mShowIconNewTodo; |
208 | bool mShowIconNewEvent; | 211 | bool mShowIconNewEvent; |
209 | bool mShowIconSearch; | 212 | bool mShowIconSearch; |
210 | bool mShowIconList; | 213 | bool mShowIconList; |
211 | bool mShowIconDay1; | 214 | bool mShowIconDay1; |
212 | bool mShowIconDay5; | 215 | bool mShowIconDay5; |
213 | bool mShowIconDay6; | 216 | bool mShowIconDay6; |
214 | bool mShowIconDay7; | 217 | bool mShowIconDay7; |
215 | bool mShowIconMonth; | 218 | bool mShowIconMonth; |
216 | bool mShowIconTodoview; | 219 | bool mShowIconTodoview; |
217 | bool mShowIconBackFast; | 220 | bool mShowIconBackFast; |
218 | bool mShowIconBack; | 221 | bool mShowIconBack; |
219 | bool mShowIconToday; | 222 | bool mShowIconToday; |
220 | bool mShowIconForward; | 223 | bool mShowIconForward; |
221 | bool mShowIconForwardFast; | 224 | bool mShowIconForwardFast; |
222 | bool mShowIconWhatsThis; | 225 | bool mShowIconWhatsThis; |
223 | bool mShowIconWeekNum; | 226 | bool mShowIconWeekNum; |
224 | bool mShowIconNextDays; | 227 | bool mShowIconNextDays; |
225 | bool mShowIconNext; | 228 | bool mShowIconNext; |
226 | bool mShowIconJournal; | 229 | bool mShowIconJournal; |
227 | bool mShowIconFilter; | 230 | bool mShowIconFilter; |
228 | bool mShowIconOnetoolbar; | 231 | bool mShowIconOnetoolbar; |
229 | bool mShowIconNavigator; | 232 | bool mShowIconNavigator; |
230 | bool mShowIconAllday; | 233 | bool mShowIconAllday; |
231 | bool mShowIconFilterview; | 234 | bool mShowIconFilterview; |
232 | bool mShowIconToggleFull; | 235 | bool mShowIconToggleFull; |
233 | 236 | ||
234 | bool mShowIconStretch; | 237 | bool mShowIconStretch; |
235 | 238 | ||
236 | bool mToolBarHor; | 239 | bool mToolBarHor; |
237 | bool mToolBarUp; | 240 | bool mToolBarUp; |
238 | bool mToolBarHorV; | 241 | bool mToolBarHorV; |
239 | bool mToolBarUpV; | 242 | bool mToolBarUpV; |
240 | bool mToolBarHorN; | 243 | bool mToolBarHorN; |
241 | bool mToolBarUpN; | 244 | bool mToolBarUpN; |
242 | bool mToolBarHorF; | 245 | bool mToolBarHorF; |
243 | bool mToolBarUpF; | 246 | bool mToolBarUpF; |
244 | bool mToolBarMiniIcons; | 247 | bool mToolBarMiniIcons; |
245 | 248 | ||
246 | bool mAskForQuit; | 249 | bool mAskForQuit; |
247 | bool mUsePassWd; | 250 | bool mUsePassWd; |
248 | bool mShowSyncEvents; | 251 | bool mShowSyncEvents; |
249 | bool mShowTodoInAgenda; | 252 | bool mShowTodoInAgenda; |
250 | bool mShowCompletedTodoInAgenda; | 253 | bool mShowCompletedTodoInAgenda; |
251 | bool mShowTimeInAgenda; | 254 | bool mShowTimeInAgenda; |
252 | bool mHideNonStartedTodos; | 255 | bool mHideNonStartedTodos; |
253 | 256 | ||
254 | bool mBlockPopupMenu; | 257 | bool mBlockPopupMenu; |
255 | 258 | ||
256 | int mLastSyncTime; | 259 | int mLastSyncTime; |
257 | void setCategoryColor(QString cat,const QColor & color); | 260 | void setCategoryColor(QString cat,const QColor & color); |
258 | QColor *categoryColor(QString cat); | 261 | QColor *categoryColor(QString cat); |
259 | 262 | ||
260 | QString mArchiveFile; | 263 | QString mArchiveFile; |
261 | QString mHtmlExportFile; | 264 | QString mHtmlExportFile; |
262 | bool mHtmlWithSave; | 265 | bool mHtmlWithSave; |
263 | 266 | ||
264 | QStringList mSelectedPlugins; | 267 | QStringList mSelectedPlugins; |
265 | 268 | ||
266 | QString mLastImportFile; | 269 | QString mLastImportFile; |
267 | QString mLastVcalFile; | 270 | QString mLastVcalFile; |
268 | QString mLastSaveFile; | 271 | QString mLastSaveFile; |
269 | QString mLastLoadFile; | 272 | QString mLastLoadFile; |
270 | 273 | ||
271 | 274 | ||
272 | QString mDefaultAlarmFile; | 275 | QString mDefaultAlarmFile; |
273 | int mIMIPScheduler; | 276 | int mIMIPScheduler; |
274 | int mIMIPSend; | 277 | int mIMIPSend; |
275 | QStringList mAdditionalMails; | 278 | QStringList mAdditionalMails; |
276 | int mIMIPAutoRefresh; | 279 | int mIMIPAutoRefresh; |
277 | int mIMIPAutoInsertReply; | 280 | int mIMIPAutoInsertReply; |
278 | int mIMIPAutoInsertRequest; | 281 | int mIMIPAutoInsertRequest; |
279 | int mIMIPAutoFreeBusy; | 282 | int mIMIPAutoFreeBusy; |
280 | int mIMIPAutoFreeBusyReply; | 283 | int mIMIPAutoFreeBusyReply; |
281 | 284 | ||
282 | QStringList mTodoTemplates; | 285 | QStringList mTodoTemplates; |
283 | QStringList mEventTemplates; | 286 | QStringList mEventTemplates; |
284 | 287 | ||
285 | int mDestination; | 288 | int mDestination; |
286 | 289 | ||
287 | 290 | ||
288 | bool mEditOnDoubleClick; | 291 | bool mEditOnDoubleClick; |
289 | bool mViewChangeHoldFullscreen; | 292 | bool mViewChangeHoldFullscreen; |
290 | bool mViewChangeHoldNonFullscreen; | 293 | bool mViewChangeHoldNonFullscreen; |
291 | bool mCenterOnCurrentTime; | 294 | bool mCenterOnCurrentTime; |
292 | bool mSetTimeToDayStartAt; | 295 | bool mSetTimeToDayStartAt; |
293 | bool mHighlightCurrentDay; | 296 | bool mHighlightCurrentDay; |
294 | bool mUseHighlightLightColor; | 297 | bool mUseHighlightLightColor; |
295 | bool mListViewMonthTimespan; | 298 | bool mListViewMonthTimespan; |
296 | bool mWNViewShowsParents; | 299 | bool mWNViewShowsParents; |
297 | bool mWNViewShowsPast; | 300 | bool mWNViewShowsPast; |
298 | bool mWNViewShowLocation; | 301 | bool mWNViewShowLocation; |
299 | bool mTodoViewShowsPercentage; | 302 | bool mTodoViewShowsPercentage; |
300 | bool mTodoViewUsesCatColors; | 303 | bool mTodoViewUsesCatColors; |
301 | bool mMonthViewUsesBigFont; | 304 | bool mMonthViewUsesBigFont; |
302 | bool mTodoViewUsesSmallFont; | 305 | bool mTodoViewUsesSmallFont; |
303 | bool mTodoViewUsesForegroundColor; | 306 | bool mTodoViewUsesForegroundColor; |
304 | bool mMonthViewUsesForegroundColor; | 307 | bool mMonthViewUsesForegroundColor; |
305 | 308 | ||
306 | bool mHightlightDateTimeEdit; | 309 | bool mHightlightDateTimeEdit; |
307 | bool mShortDateInViewer; | 310 | bool mShortDateInViewer; |
308 | 311 | ||
309 | bool mShowDateNavigator; | 312 | bool mShowDateNavigator; |
310 | 313 | ||
311 | QStringList mLocationDefaults; | 314 | QStringList mLocationDefaults; |
312 | QStringList mEventSummaryUser; | 315 | QStringList mEventSummaryUser; |
313 | QStringList mTodoSummaryUser; | 316 | QStringList mTodoSummaryUser; |
314 | 317 | ||
315 | bool mUseInternalAlarmNotification; | 318 | bool mUseInternalAlarmNotification; |
316 | int mAlarmPlayBeeps; | 319 | int mAlarmPlayBeeps; |
317 | int mAlarmSuspendTime; | 320 | int mAlarmSuspendTime; |
318 | int mAlarmSuspendCount; | 321 | int mAlarmSuspendCount; |
319 | int mAlarmBeepInterval; | 322 | int mAlarmBeepInterval; |
320 | int mOldLanguage; | 323 | int mOldLanguage; |
321 | int mOldLoadedLanguage; | 324 | int mOldLoadedLanguage; |
322 | 325 | ||
323 | 326 | ||
324 | QString mActiveSyncPort; | 327 | QString mActiveSyncPort; |
325 | QString mActiveSyncIP; | 328 | QString mActiveSyncIP; |
326 | 329 | ||
327 | // settings for eventviewer | 330 | // settings for eventviewer |
328 | bool mEVshowDetails; | 331 | bool mEVshowDetails; |
329 | bool mEVshowCreated; | 332 | bool mEVshowCreated; |
330 | bool mEVshowChanged; | 333 | bool mEVshowChanged; |
331 | bool mWTshowDetails; | 334 | bool mWTshowDetails; |
332 | bool mWTshowCreated; | 335 | bool mWTshowCreated; |
333 | bool mWTshowChanged; | 336 | bool mWTshowChanged; |
334 | 337 | ||
335 | int mCurrentDisplayedView; | 338 | int mCurrentDisplayedView; |
336 | QPtrList<KopiCalendarFile> mCalendars; | 339 | QPtrList<KopiCalendarFile> mCalendars; |
337 | int mNextAvailableCalendar; | 340 | int mNextAvailableCalendar; |
338 | 341 | ||
339 | private: | 342 | private: |
340 | QDict<QColor> mCategoryColors; | 343 | QDict<QColor> mCategoryColors; |
341 | QArray<KopiCalendarFile*> mDefCalColors; | 344 | QArray<KopiCalendarFile*> mDefCalColors; |
342 | QColor mDefaultCategoryColor; | 345 | QColor mDefaultCategoryColor; |
343 | 346 | ||
344 | QFont mDefaultTimeBarFont; | 347 | QFont mDefaultTimeBarFont; |
345 | QFont mDefaultViewFont; | 348 | QFont mDefaultViewFont; |
346 | QFont mDefaultMonthViewFont; | 349 | QFont mDefaultMonthViewFont; |
347 | 350 | ||
348 | QString mName; | 351 | QString mName; |
349 | QString mEmail; | 352 | QString mEmail; |
350 | }; | 353 | }; |
351 | 354 | ||
352 | #endif | 355 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index f05ada5..472a978 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -291,2228 +291,2236 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
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->loadCalendars(); | 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 |
408 | // toggleBeamReceive(); | 408 | // toggleBeamReceive(); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | #endif | 411 | #endif |
412 | 412 | ||
413 | } | 413 | } |
414 | bool MainWindow::beamReceiveEnabled() | 414 | bool MainWindow::beamReceiveEnabled() |
415 | { | 415 | { |
416 | #ifndef DESKTOP_VERSION | 416 | #ifndef DESKTOP_VERSION |
417 | return ( infrared != 0 ); | 417 | return ( infrared != 0 ); |
418 | #endif | 418 | #endif |
419 | return false; | 419 | return false; |
420 | } | 420 | } |
421 | 421 | ||
422 | void MainWindow::toggleBeamReceive() | 422 | void MainWindow::toggleBeamReceive() |
423 | { | 423 | { |
424 | if ( mBRdisabled ) | 424 | if ( mBRdisabled ) |
425 | return; | 425 | return; |
426 | #ifndef DESKTOP_VERSION | 426 | #ifndef DESKTOP_VERSION |
427 | if ( infrared ) { | 427 | if ( infrared ) { |
428 | qDebug("KO: Disable BeamReceive "); | 428 | qDebug("KO: Disable BeamReceive "); |
429 | delete infrared; | 429 | delete infrared; |
430 | infrared = 0; | 430 | infrared = 0; |
431 | brAction->setOn(false); | 431 | brAction->setOn(false); |
432 | return; | 432 | return; |
433 | } | 433 | } |
434 | qDebug("KO: Enable BeamReceive "); | 434 | qDebug("KO: Enable BeamReceive "); |
435 | brAction->setOn(true); | 435 | brAction->setOn(true); |
436 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 436 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
437 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 437 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
438 | #endif | 438 | #endif |
439 | } | 439 | } |
440 | void MainWindow::showMaximized () | 440 | void MainWindow::showMaximized () |
441 | { | 441 | { |
442 | #ifndef DESKTOP_VERSION | 442 | #ifndef DESKTOP_VERSION |
443 | if ( ! globalFlagBlockStartup ) | 443 | if ( ! globalFlagBlockStartup ) |
444 | if ( mClosed ) | 444 | if ( mClosed ) |
445 | mView->goToday(); | 445 | mView->goToday(); |
446 | #endif | 446 | #endif |
447 | QWidget::showMaximized () ; | 447 | QWidget::showMaximized () ; |
448 | mClosed = false; | 448 | mClosed = false; |
449 | } | 449 | } |
450 | void MainWindow::closeEvent( QCloseEvent* ce ) | 450 | void MainWindow::closeEvent( QCloseEvent* ce ) |
451 | { | 451 | { |
452 | 452 | ||
453 | 453 | ||
454 | 454 | ||
455 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 455 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
456 | saveOnClose(); | 456 | saveOnClose(); |
457 | mClosed = true; | 457 | mClosed = true; |
458 | ce->accept(); | 458 | ce->accept(); |
459 | return; | 459 | return; |
460 | 460 | ||
461 | } | 461 | } |
462 | 462 | ||
463 | switch( QMessageBox::information( this, "KO/Pi", | 463 | switch( QMessageBox::information( this, "KO/Pi", |
464 | i18n("Do you really want\nto close KO/Pi?"), | 464 | i18n("Do you really want\nto close KO/Pi?"), |
465 | i18n("Close"), i18n("No"), | 465 | i18n("Close"), i18n("No"), |
466 | 0, 0 ) ) { | 466 | 0, 0 ) ) { |
467 | case 0: | 467 | case 0: |
468 | saveOnClose(); | 468 | saveOnClose(); |
469 | mClosed = true; | 469 | mClosed = true; |
470 | ce->accept(); | 470 | ce->accept(); |
471 | break; | 471 | break; |
472 | case 1: | 472 | case 1: |
473 | ce->ignore(); | 473 | ce->ignore(); |
474 | break; | 474 | break; |
475 | case 2: | 475 | case 2: |
476 | 476 | ||
477 | default: | 477 | default: |
478 | break; | 478 | break; |
479 | } | 479 | } |
480 | 480 | ||
481 | 481 | ||
482 | } | 482 | } |
483 | 483 | ||
484 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 484 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
485 | { | 485 | { |
486 | QDataStream stream( data, IO_ReadOnly ); | 486 | QDataStream stream( data, IO_ReadOnly ); |
487 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 487 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
488 | //QString datamess; | 488 | //QString datamess; |
489 | //qDebug("message "); | 489 | //qDebug("message "); |
490 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 490 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
491 | 491 | ||
492 | if ( cmsg == "setDocument(QString)" ) { | 492 | if ( cmsg == "setDocument(QString)" ) { |
493 | QDataStream stream( data, IO_ReadOnly ); | 493 | QDataStream stream( data, IO_ReadOnly ); |
494 | QString fileName; | 494 | QString fileName; |
495 | stream >> fileName; | 495 | stream >> fileName; |
496 | //qDebug("filename %s ", fileName.latin1()); | 496 | //qDebug("filename %s ", fileName.latin1()); |
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 499 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
500 | mSyncManager->slotSyncMenu( 1002 ); | 500 | mSyncManager->slotSyncMenu( 1002 ); |
501 | return; | 501 | return; |
502 | } | 502 | } |
503 | 503 | ||
504 | if ( cmsg == "-writeFile" ) { | 504 | if ( cmsg == "-writeFile" ) { |
505 | // I made from the "-writeFile" an "-writeAlarm" | 505 | // I made from the "-writeFile" an "-writeAlarm" |
506 | mView->viewManager()->showWhatsNextView(); | 506 | mView->viewManager()->showWhatsNextView(); |
507 | mCalendar->checkAlarmForIncidence( 0, true); | 507 | mCalendar->checkAlarmForIncidence( 0, true); |
508 | showMaximized(); | 508 | showMaximized(); |
509 | raise(); | 509 | raise(); |
510 | return; | 510 | return; |
511 | 511 | ||
512 | } | 512 | } |
513 | if ( cmsg == "-writeFileSilent" ) { | 513 | if ( cmsg == "-writeFileSilent" ) { |
514 | // I made from the "-writeFile" an "-writeAlarm" | 514 | // I made from the "-writeFile" an "-writeAlarm" |
515 | // mView->viewManager()->showWhatsNextView(); | 515 | // mView->viewManager()->showWhatsNextView(); |
516 | mCalendar->checkAlarmForIncidence( 0, true); | 516 | mCalendar->checkAlarmForIncidence( 0, true); |
517 | //showMaximized(); | 517 | //showMaximized(); |
518 | //raise(); | 518 | //raise(); |
519 | hide(); | 519 | hide(); |
520 | return; | 520 | return; |
521 | } | 521 | } |
522 | if ( cmsg == "-newCountdown" ) { | 522 | if ( cmsg == "-newCountdown" ) { |
523 | qDebug("newCountdown "); | 523 | qDebug("newCountdown "); |
524 | 524 | ||
525 | } | 525 | } |
526 | QString msg ; | 526 | QString msg ; |
527 | QString allmsg = cmsg; | 527 | QString allmsg = cmsg; |
528 | while ( allmsg.length() > 0 ) { | 528 | while ( allmsg.length() > 0 ) { |
529 | int nextC = allmsg.find( "-", 1 ); | 529 | int nextC = allmsg.find( "-", 1 ); |
530 | if ( nextC == -1 ) { | 530 | if ( nextC == -1 ) { |
531 | msg = allmsg; | 531 | msg = allmsg; |
532 | allmsg = ""; | 532 | allmsg = ""; |
533 | } else{ | 533 | } else{ |
534 | msg = allmsg.left( nextC ); | 534 | msg = allmsg.left( nextC ); |
535 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 535 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
536 | } | 536 | } |
537 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 537 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
538 | if ( msg == "-newEvent" ) { | 538 | if ( msg == "-newEvent" ) { |
539 | mView->newEvent(); | 539 | mView->newEvent(); |
540 | } | 540 | } |
541 | if ( msg == "-newTodo" ) { | 541 | if ( msg == "-newTodo" ) { |
542 | mView->newTodo(); | 542 | mView->newTodo(); |
543 | 543 | ||
544 | } | 544 | } |
545 | if ( msg == "-showWN" ) { | 545 | if ( msg == "-showWN" ) { |
546 | mView->viewManager()->showWhatsNextView(); | 546 | mView->viewManager()->showWhatsNextView(); |
547 | } | 547 | } |
548 | if ( msg == "-showTodo" ) { | 548 | if ( msg == "-showTodo" ) { |
549 | mView->viewManager()->showTodoView(); | 549 | mView->viewManager()->showTodoView(); |
550 | } | 550 | } |
551 | if ( msg == "-showList" ) { | 551 | if ( msg == "-showList" ) { |
552 | mView->viewManager()->showListView(); | 552 | mView->viewManager()->showListView(); |
553 | } | 553 | } |
554 | else if ( msg == "-showDay" ) { | 554 | else if ( msg == "-showDay" ) { |
555 | mView->viewManager()->showDayView(); | 555 | mView->viewManager()->showDayView(); |
556 | } | 556 | } |
557 | else if ( msg == "-showWWeek" ) { | 557 | else if ( msg == "-showWWeek" ) { |
558 | mView->viewManager()->showWorkWeekView(); | 558 | mView->viewManager()->showWorkWeekView(); |
559 | } | 559 | } |
560 | else if ( msg == "-ringSync" ) { | 560 | else if ( msg == "-ringSync" ) { |
561 | mSyncManager->multiSync( false ); | 561 | mSyncManager->multiSync( false ); |
562 | } | 562 | } |
563 | else if ( msg == "-showWeek" ) { | 563 | else if ( msg == "-showWeek" ) { |
564 | mView->viewManager()->showWeekView(); | 564 | mView->viewManager()->showWeekView(); |
565 | } | 565 | } |
566 | else if ( msg == "-showTodo" ) { | 566 | else if ( msg == "-showTodo" ) { |
567 | mView->viewManager()->showTodoView(); | 567 | mView->viewManager()->showTodoView(); |
568 | } | 568 | } |
569 | else if ( msg == "-showJournal" ) { | 569 | else if ( msg == "-showJournal" ) { |
570 | mView->dateNavigator()->selectDates( 1 ); | 570 | mView->dateNavigator()->selectDates( 1 ); |
571 | mView->dateNavigator()->selectToday(); | 571 | mView->dateNavigator()->selectToday(); |
572 | mView->viewManager()->showJournalView(); | 572 | mView->viewManager()->showJournalView(); |
573 | } | 573 | } |
574 | else if ( msg == "-showKO" ) { | 574 | else if ( msg == "-showKO" ) { |
575 | mView->viewManager()->showNextXView(); | 575 | mView->viewManager()->showNextXView(); |
576 | } | 576 | } |
577 | else if ( msg == "-showWNext" ) { | 577 | else if ( msg == "-showWNext" ) { |
578 | mView->viewManager()->showWhatsNextView(); | 578 | mView->viewManager()->showWhatsNextView(); |
579 | } | 579 | } |
580 | else if ( msg == "nextView()" ) { | 580 | else if ( msg == "nextView()" ) { |
581 | mView->viewManager()->showNextView(); | 581 | mView->viewManager()->showNextView(); |
582 | } | 582 | } |
583 | else if ( msg == "-showNextXView" ) { | 583 | else if ( msg == "-showNextXView" ) { |
584 | mView->viewManager()->showNextXView(); | 584 | mView->viewManager()->showNextXView(); |
585 | } | 585 | } |
586 | 586 | ||
587 | 587 | ||
588 | } | 588 | } |
589 | 589 | ||
590 | showMaximized(); | 590 | showMaximized(); |
591 | raise(); | 591 | raise(); |
592 | } | 592 | } |
593 | 593 | ||
594 | QPixmap MainWindow::loadPixmap( QString name ) | 594 | QPixmap MainWindow::loadPixmap( QString name ) |
595 | { | 595 | { |
596 | return SmallIcon( name ); | 596 | return SmallIcon( name ); |
597 | 597 | ||
598 | } | 598 | } |
599 | void MainWindow::setUsesBigPixmaps ( bool b ) | 599 | void MainWindow::setUsesBigPixmaps ( bool b ) |
600 | { | 600 | { |
601 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 601 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
602 | if ( b ) | 602 | if ( b ) |
603 | qDebug("KO: BigPixmaps are not supported "); | 603 | qDebug("KO: BigPixmaps are not supported "); |
604 | } | 604 | } |
605 | void MainWindow::initActions() | 605 | void MainWindow::initActions() |
606 | { | 606 | { |
607 | //KOPrefs::instance()->mShowFullMenu | 607 | //KOPrefs::instance()->mShowFullMenu |
608 | iconToolBar->clear(); | 608 | iconToolBar->clear(); |
609 | KOPrefs *p = KOPrefs::instance(); | 609 | KOPrefs *p = KOPrefs::instance(); |
610 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 610 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
611 | 611 | ||
612 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 612 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
613 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 613 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
614 | QPopupMenu *importMenu = new QPopupMenu( this ); | 614 | QPopupMenu *importMenu = new QPopupMenu( this ); |
615 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 615 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
616 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 616 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
617 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 617 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
618 | selectFilterMenu = new QPopupMenu( this ); | 618 | selectFilterMenu = new QPopupMenu( this ); |
619 | selectFilterMenu->setCheckable( true ); | 619 | selectFilterMenu->setCheckable( true ); |
620 | syncMenu = new QPopupMenu( this ); | 620 | syncMenu = new QPopupMenu( this ); |
621 | configureAgendaMenu = new QPopupMenu( this ); | 621 | configureAgendaMenu = new QPopupMenu( this ); |
622 | configureToolBarMenu = new QPopupMenu( this ); | 622 | configureToolBarMenu = new QPopupMenu( this ); |
623 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 623 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
624 | QIconSet icon; | 624 | QIconSet icon; |
625 | int pixWid = 22, pixHei = 22; | 625 | int pixWid = 22, pixHei = 22; |
626 | QString pathString = ""; | 626 | QString pathString = ""; |
627 | if ( !p->mToolBarMiniIcons ) { | 627 | if ( !p->mToolBarMiniIcons ) { |
628 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 628 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
629 | pathString += "icons16/"; | 629 | pathString += "icons16/"; |
630 | pixWid = 18; pixHei = 16; | 630 | pixWid = 18; pixHei = 16; |
631 | } | 631 | } |
632 | } else { | 632 | } else { |
633 | pathString += "iconsmini/"; | 633 | pathString += "iconsmini/"; |
634 | pixWid = 18; pixHei = 16; | 634 | pixWid = 18; pixHei = 16; |
635 | } | 635 | } |
636 | if ( KOPrefs::instance()->mShowFullMenu ) { | 636 | if ( KOPrefs::instance()->mShowFullMenu ) { |
637 | QMenuBar *menuBar1; | 637 | QMenuBar *menuBar1; |
638 | menuBar1 = menuBar(); | 638 | menuBar1 = menuBar(); |
639 | menuBar1->insertItem( i18n("File"), importMenu ); | 639 | menuBar1->insertItem( i18n("File"), importMenu ); |
640 | menuBar1->insertItem( i18n("View"), viewMenu ); | 640 | menuBar1->insertItem( i18n("View"), viewMenu ); |
641 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 641 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
642 | #ifdef DESKTOP_VERSION | 642 | #ifdef DESKTOP_VERSION |
643 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 643 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
644 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 644 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
645 | #else | 645 | #else |
646 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 646 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
647 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 647 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
648 | #endif | 648 | #endif |
649 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 649 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
650 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 650 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
651 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 651 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
652 | } else { | 652 | } else { |
653 | QPEMenuBar *menuBar1; | 653 | QPEMenuBar *menuBar1; |
654 | menuBar1 = new QPEMenuBar( iconToolBar ); | 654 | menuBar1 = new QPEMenuBar( iconToolBar ); |
655 | QPopupMenu *menuBar = new QPopupMenu( this ); | 655 | QPopupMenu *menuBar = new QPopupMenu( this ); |
656 | icon = loadPixmap( pathString + "z_menu" ); | 656 | icon = loadPixmap( pathString + "z_menu" ); |
657 | menuBar1->insertItem( icon.pixmap(), menuBar); | 657 | menuBar1->insertItem( icon.pixmap(), menuBar); |
658 | //menuBar1->insertItem( i18n("ME"), menuBar); | 658 | //menuBar1->insertItem( i18n("ME"), menuBar); |
659 | menuBar->insertItem( i18n("File"), importMenu ); | 659 | menuBar->insertItem( i18n("File"), importMenu ); |
660 | menuBar->insertItem( i18n("View"), viewMenu ); | 660 | menuBar->insertItem( i18n("View"), viewMenu ); |
661 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 661 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
662 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 662 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
663 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 663 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
664 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 664 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
665 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 665 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
666 | menuBar->insertItem( i18n("Help"), helpMenu ); | 666 | menuBar->insertItem( i18n("Help"), helpMenu ); |
667 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 667 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
668 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 668 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
669 | } | 669 | } |
670 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 670 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
671 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 671 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
672 | 672 | ||
673 | 673 | ||
674 | mWeekBgColor = iconToolBar->backgroundColor(); | 674 | mWeekBgColor = iconToolBar->backgroundColor(); |
675 | mWeekPixmap.resize( pixWid , pixHei ); | 675 | mWeekPixmap.resize( pixWid , pixHei ); |
676 | mWeekPixmap.fill( mWeekBgColor ); | 676 | mWeekPixmap.fill( mWeekBgColor ); |
677 | icon = mWeekPixmap; | 677 | icon = mWeekPixmap; |
678 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 678 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
679 | if ( p-> mShowIconWeekNum ) | 679 | if ( p-> mShowIconWeekNum ) |
680 | mWeekAction->addTo( iconToolBar ); | 680 | mWeekAction->addTo( iconToolBar ); |
681 | mWeekFont = font(); | 681 | mWeekFont = font(); |
682 | 682 | ||
683 | int fontPoint = mWeekFont.pointSize(); | 683 | int fontPoint = mWeekFont.pointSize(); |
684 | QFontMetrics f( mWeekFont ); | 684 | QFontMetrics f( mWeekFont ); |
685 | int fontWid = f.width( "30" ); | 685 | int fontWid = f.width( "30" ); |
686 | while ( fontWid > pixWid ) { | 686 | while ( fontWid > pixWid ) { |
687 | --fontPoint; | 687 | --fontPoint; |
688 | mWeekFont.setPointSize( fontPoint ); | 688 | mWeekFont.setPointSize( fontPoint ); |
689 | QFontMetrics f( mWeekFont ); | 689 | QFontMetrics f( mWeekFont ); |
690 | fontWid = f.width( "30" ); | 690 | fontWid = f.width( "30" ); |
691 | //qDebug("dec-- "); | 691 | //qDebug("dec-- "); |
692 | } | 692 | } |
693 | 693 | ||
694 | connect( mWeekAction, SIGNAL( activated() ), | 694 | connect( mWeekAction, SIGNAL( activated() ), |
695 | this, SLOT( weekAction() ) ); | 695 | this, SLOT( weekAction() ) ); |
696 | 696 | ||
697 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 697 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
698 | if ( p->mShowIconFilterview ) { | 698 | if ( p->mShowIconFilterview ) { |
699 | icon = loadPixmap( pathString + "filter" ); | 699 | icon = loadPixmap( pathString + "filter" ); |
700 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 700 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
701 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 701 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
702 | this, SLOT( fillFilterMenuTB() ) ); | 702 | this, SLOT( fillFilterMenuTB() ) ); |
703 | actionFilterMenuTB->addTo( iconToolBar ); | 703 | actionFilterMenuTB->addTo( iconToolBar ); |
704 | selectFilterMenuTB = new QPopupMenu( this ); | 704 | selectFilterMenuTB = new QPopupMenu( this ); |
705 | selectFilterMenuTB->setCheckable( true ); | 705 | selectFilterMenuTB->setCheckable( true ); |
706 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 706 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
707 | } | 707 | } |
708 | 708 | ||
709 | //#endif | 709 | //#endif |
710 | // ****************** | 710 | // ****************** |
711 | QAction *action; | 711 | QAction *action; |
712 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 712 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
713 | configureToolBarMenu->setCheckable( true ); | 713 | configureToolBarMenu->setCheckable( true ); |
714 | 714 | ||
715 | 715 | ||
716 | configureAgendaMenu->setCheckable( true ); | 716 | configureAgendaMenu->setCheckable( true ); |
717 | int iii ; | 717 | int iii ; |
718 | for ( iii = 1;iii<= 10 ;++iii ){ | 718 | for ( iii = 1;iii<= 10 ;++iii ){ |
719 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 719 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
720 | } | 720 | } |
721 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 721 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
722 | 722 | ||
723 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 723 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
724 | this, SLOT( showConfigureAgenda( ) ) ); | 724 | this, SLOT( showConfigureAgenda( ) ) ); |
725 | 725 | ||
726 | icon = loadPixmap( pathString + "configure" ); | 726 | icon = loadPixmap( pathString + "configure" ); |
727 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 727 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
728 | action->addTo( actionMenu ); | 728 | action->addTo( actionMenu ); |
729 | connect( action, SIGNAL( activated() ), | 729 | connect( action, SIGNAL( activated() ), |
730 | mView, SLOT( edit_options() ) ); | 730 | mView, SLOT( edit_options() ) ); |
731 | icon = loadPixmap( pathString + "configure" ); | 731 | icon = loadPixmap( pathString + "configure" ); |
732 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 732 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
733 | action->addTo( actionMenu ); | 733 | action->addTo( actionMenu ); |
734 | connect( action, SIGNAL( activated() ), | 734 | connect( action, SIGNAL( activated() ), |
735 | mView, SLOT( edit_global_options() ) ); | 735 | mView, SLOT( edit_global_options() ) ); |
736 | actionMenu->insertSeparator(); | 736 | actionMenu->insertSeparator(); |
737 | 737 | ||
738 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 738 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
739 | action->addTo( actionMenu ); | 739 | action->addTo( actionMenu ); |
740 | connect( action, SIGNAL( activated() ), | 740 | connect( action, SIGNAL( activated() ), |
741 | mView, SLOT( undo_delete() ) ); | 741 | mView, SLOT( undo_delete() ) ); |
742 | actionMenu->insertSeparator(); | 742 | actionMenu->insertSeparator(); |
743 | 743 | ||
744 | icon = loadPixmap( pathString + "newevent" ); | 744 | icon = loadPixmap( pathString + "newevent" ); |
745 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 745 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
746 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 746 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
747 | configureToolBarMenu->insertSeparator(); | 747 | configureToolBarMenu->insertSeparator(); |
748 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 748 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
749 | configureToolBarMenu->insertSeparator(); | 749 | configureToolBarMenu->insertSeparator(); |
750 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 750 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
751 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 751 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
752 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 752 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
753 | ne_action->addTo( actionMenu ); | 753 | ne_action->addTo( actionMenu ); |
754 | connect( ne_action, SIGNAL( activated() ), | 754 | connect( ne_action, SIGNAL( activated() ), |
755 | mView, SLOT( newEvent() ) ); | 755 | mView, SLOT( newEvent() ) ); |
756 | icon = loadPixmap( pathString + "newtodo" ); | 756 | icon = loadPixmap( pathString + "newtodo" ); |
757 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 757 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
758 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 758 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
759 | nt_action->addTo( actionMenu ); | 759 | nt_action->addTo( actionMenu ); |
760 | connect( nt_action, SIGNAL( activated() ), | 760 | connect( nt_action, SIGNAL( activated() ), |
761 | mView, SLOT( newTodo() ) ); | 761 | mView, SLOT( newTodo() ) ); |
762 | 762 | ||
763 | icon = loadPixmap( pathString + "today" ); | 763 | icon = loadPixmap( pathString + "today" ); |
764 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 764 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
765 | today_action->addTo( viewMenu ); | 765 | today_action->addTo( viewMenu ); |
766 | connect( today_action, SIGNAL( activated() ), | 766 | connect( today_action, SIGNAL( activated() ), |
767 | mView, SLOT( goToday() ) ); | 767 | mView, SLOT( goToday() ) ); |
768 | viewMenu->insertSeparator(); | 768 | viewMenu->insertSeparator(); |
769 | 769 | ||
770 | // *********************** | 770 | // *********************** |
771 | if ( KOPrefs::instance()->mVerticalScreen ) { | 771 | if ( KOPrefs::instance()->mVerticalScreen ) { |
772 | icon = SmallIcon( "1updownarrow" ); | 772 | icon = SmallIcon( "1updownarrow" ); |
773 | } else { | 773 | } else { |
774 | icon = SmallIcon("1leftrightarrow" ); | 774 | icon = SmallIcon("1leftrightarrow" ); |
775 | } | 775 | } |
776 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 776 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
777 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 777 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
778 | FSaction->addTo( viewMenu ); | 778 | FSaction->addTo( viewMenu ); |
779 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 779 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
780 | 780 | ||
781 | icon = loadPixmap( pathString + "navi" ); | 781 | icon = loadPixmap( pathString + "navi" ); |
782 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 782 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
783 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 783 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
784 | action->addTo( viewMenu ); | 784 | action->addTo( viewMenu ); |
785 | connect( action, SIGNAL( activated() ), | 785 | connect( action, SIGNAL( activated() ), |
786 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 786 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
787 | mToggleNav = action ; | 787 | mToggleNav = action ; |
788 | icon = loadPixmap( pathString + "filter" ); | 788 | icon = loadPixmap( pathString + "filter" ); |
789 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 789 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
790 | icon = loadPixmap( pathString + "configure" ); | 790 | icon = loadPixmap( pathString + "configure" ); |
791 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 791 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
792 | action->addTo( viewMenu ); | 792 | action->addTo( viewMenu ); |
793 | connect( action, SIGNAL( activated() ), | 793 | connect( action, SIGNAL( activated() ), |
794 | mView, SLOT( toggleFilter() ) ); | 794 | mView, SLOT( toggleFilter() ) ); |
795 | mToggleFilter = action; | 795 | mToggleFilter = action; |
796 | icon = loadPixmap( pathString + "allday" ); | 796 | icon = loadPixmap( pathString + "allday" ); |
797 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 797 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
798 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 798 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
799 | action->addTo( viewMenu ); | 799 | action->addTo( viewMenu ); |
800 | connect( action, SIGNAL( activated() ), | 800 | connect( action, SIGNAL( activated() ), |
801 | mView, SLOT( toggleAllDaySize() ) ); | 801 | mView, SLOT( toggleAllDaySize() ) ); |
802 | mToggleAllday = action; | 802 | mToggleAllday = action; |
803 | 803 | ||
804 | 804 | ||
805 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 805 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
806 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 806 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
807 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 807 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
808 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 808 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
809 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 809 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
810 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 810 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
811 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 811 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
812 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 812 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
813 | 813 | ||
814 | viewMenu->insertSeparator(); | 814 | viewMenu->insertSeparator(); |
815 | icon = loadPixmap( pathString + "picker" ); | 815 | icon = loadPixmap( pathString + "picker" ); |
816 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 816 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
817 | action->addTo( viewMenu ); | 817 | action->addTo( viewMenu ); |
818 | connect( action, SIGNAL( activated() ), | 818 | connect( action, SIGNAL( activated() ), |
819 | mView, SLOT( showDatePicker() ) ); | 819 | mView, SLOT( showDatePicker() ) ); |
820 | action->addTo( iconToolBar ); | 820 | action->addTo( iconToolBar ); |
821 | viewMenu->insertSeparator(); | 821 | viewMenu->insertSeparator(); |
822 | 822 | ||
823 | if ( p-> mShowIconToggleFull ) | 823 | if ( p-> mShowIconToggleFull ) |
824 | FSaction->addTo( iconToolBar ); | 824 | FSaction->addTo( iconToolBar ); |
825 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 825 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
826 | 826 | ||
827 | //******************** | 827 | //******************** |
828 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 828 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
829 | 829 | ||
830 | 830 | ||
831 | icon = loadPixmap( pathString + "whatsnext" ); | 831 | icon = loadPixmap( pathString + "whatsnext" ); |
832 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 832 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
833 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 833 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
834 | whatsnext_action->addTo( viewMenu ); | 834 | whatsnext_action->addTo( viewMenu ); |
835 | connect( whatsnext_action, SIGNAL( activated() ), | 835 | connect( whatsnext_action, SIGNAL( activated() ), |
836 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 836 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
837 | 837 | ||
838 | icon = loadPixmap( pathString + "xdays" ); | 838 | icon = loadPixmap( pathString + "xdays" ); |
839 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 839 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
840 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 840 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
841 | xdays_action->addTo( viewMenu ); | 841 | xdays_action->addTo( viewMenu ); |
842 | connect( xdays_action, SIGNAL( activated() ), | 842 | connect( xdays_action, SIGNAL( activated() ), |
843 | mView->viewManager(), SLOT( showNextXView() ) ); | 843 | mView->viewManager(), SLOT( showNextXView() ) ); |
844 | 844 | ||
845 | 845 | ||
846 | icon = loadPixmap( pathString + "journal" ); | 846 | icon = loadPixmap( pathString + "journal" ); |
847 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 847 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
848 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 848 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
849 | viewjournal_action->addTo( viewMenu ); | 849 | viewjournal_action->addTo( viewMenu ); |
850 | connect( viewjournal_action, SIGNAL( activated() ), | 850 | connect( viewjournal_action, SIGNAL( activated() ), |
851 | mView->viewManager(), SLOT( showJournalView() ) ); | 851 | mView->viewManager(), SLOT( showJournalView() ) ); |
852 | 852 | ||
853 | 853 | ||
854 | icon = loadPixmap( pathString + "day" ); | 854 | icon = loadPixmap( pathString + "day" ); |
855 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 855 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
856 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 856 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
857 | day1_action->addTo( viewMenu ); | 857 | day1_action->addTo( viewMenu ); |
858 | // action->addTo( toolBar ); | 858 | // action->addTo( toolBar ); |
859 | connect( day1_action, SIGNAL( activated() ), | 859 | connect( day1_action, SIGNAL( activated() ), |
860 | mView->viewManager(), SLOT( showDayView() ) ); | 860 | mView->viewManager(), SLOT( showDayView() ) ); |
861 | 861 | ||
862 | icon = loadPixmap( pathString + "workweek" ); | 862 | icon = loadPixmap( pathString + "workweek" ); |
863 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 863 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
864 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 864 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
865 | day5_action->addTo( viewMenu ); | 865 | day5_action->addTo( viewMenu ); |
866 | connect( day5_action, SIGNAL( activated() ), | 866 | connect( day5_action, SIGNAL( activated() ), |
867 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 867 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
868 | 868 | ||
869 | icon = loadPixmap( pathString + "week" ); | 869 | icon = loadPixmap( pathString + "week" ); |
870 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 870 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
871 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 871 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
872 | day7_action->addTo( viewMenu ); | 872 | day7_action->addTo( viewMenu ); |
873 | connect( day7_action, SIGNAL( activated() ), | 873 | connect( day7_action, SIGNAL( activated() ), |
874 | mView->viewManager(), SLOT( showWeekView() ) ); | 874 | mView->viewManager(), SLOT( showWeekView() ) ); |
875 | 875 | ||
876 | icon = loadPixmap( pathString + "workweek2" ); | 876 | icon = loadPixmap( pathString + "workweek2" ); |
877 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 877 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
878 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 878 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
879 | day6_action->addTo( viewMenu ); | 879 | day6_action->addTo( viewMenu ); |
880 | connect( day6_action, SIGNAL( activated() ), | 880 | connect( day6_action, SIGNAL( activated() ), |
881 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 881 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
882 | 882 | ||
883 | icon = loadPixmap( pathString + "month" ); | 883 | icon = loadPixmap( pathString + "month" ); |
884 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 884 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
885 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 885 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
886 | month_action->addTo( viewMenu ); | 886 | month_action->addTo( viewMenu ); |
887 | connect( month_action, SIGNAL( activated() ), | 887 | connect( month_action, SIGNAL( activated() ), |
888 | mView->viewManager(), SLOT( showMonthView() ) ); | 888 | mView->viewManager(), SLOT( showMonthView() ) ); |
889 | 889 | ||
890 | icon = loadPixmap( pathString + "list" ); | 890 | icon = loadPixmap( pathString + "list" ); |
891 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 891 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
892 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 892 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
893 | showlist_action->addTo( viewMenu ); | 893 | showlist_action->addTo( viewMenu ); |
894 | connect( showlist_action, SIGNAL( activated() ), | 894 | connect( showlist_action, SIGNAL( activated() ), |
895 | mView->viewManager(), SLOT( showListView() ) ); | 895 | mView->viewManager(), SLOT( showListView() ) ); |
896 | 896 | ||
897 | icon = loadPixmap( pathString + "todo" ); | 897 | icon = loadPixmap( pathString + "todo" ); |
898 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 898 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
899 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 899 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
900 | todoview_action->addTo( viewMenu ); | 900 | todoview_action->addTo( viewMenu ); |
901 | connect( todoview_action, SIGNAL( activated() ), | 901 | connect( todoview_action, SIGNAL( activated() ), |
902 | mView->viewManager(), SLOT( showTodoView() ) ); | 902 | mView->viewManager(), SLOT( showTodoView() ) ); |
903 | 903 | ||
904 | 904 | ||
905 | 905 | ||
906 | #if 0 | 906 | #if 0 |
907 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 907 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
908 | action->addTo( viewMenu ); | 908 | action->addTo( viewMenu ); |
909 | connect( action, SIGNAL( activated() ), | 909 | connect( action, SIGNAL( activated() ), |
910 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 910 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
911 | #endif | 911 | #endif |
912 | 912 | ||
913 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 913 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
914 | this ); | 914 | this ); |
915 | mNewSubTodoAction->addTo( actionMenu ); | 915 | mNewSubTodoAction->addTo( actionMenu ); |
916 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 916 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
917 | mView, SLOT( newSubTodo() ) ); | 917 | mView, SLOT( newSubTodo() ) ); |
918 | 918 | ||
919 | actionMenu->insertSeparator(); | 919 | actionMenu->insertSeparator(); |
920 | 920 | ||
921 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 921 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
922 | mShowAction->addTo( actionMenu ); | 922 | mShowAction->addTo( actionMenu ); |
923 | connect( mShowAction, SIGNAL( activated() ), | 923 | connect( mShowAction, SIGNAL( activated() ), |
924 | mView, SLOT( showIncidence() ) ); | 924 | mView, SLOT( showIncidence() ) ); |
925 | 925 | ||
926 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 926 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
927 | mEditAction->addTo( actionMenu ); | 927 | mEditAction->addTo( actionMenu ); |
928 | connect( mEditAction, SIGNAL( activated() ), | 928 | connect( mEditAction, SIGNAL( activated() ), |
929 | mView, SLOT( editIncidence() ) ); | 929 | mView, SLOT( editIncidence() ) ); |
930 | 930 | ||
931 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 931 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
932 | mDeleteAction->addTo( actionMenu ); | 932 | mDeleteAction->addTo( actionMenu ); |
933 | connect( mDeleteAction, SIGNAL( activated() ), | 933 | connect( mDeleteAction, SIGNAL( activated() ), |
934 | mView, SLOT( deleteIncidence() ) ); | 934 | mView, SLOT( deleteIncidence() ) ); |
935 | 935 | ||
936 | 936 | ||
937 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 937 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
938 | mCloneAction->addTo( actionMenu ); | 938 | mCloneAction->addTo( actionMenu ); |
939 | connect( mCloneAction, SIGNAL( activated() ), | 939 | connect( mCloneAction, SIGNAL( activated() ), |
940 | mView, SLOT( cloneIncidence() ) ); | 940 | mView, SLOT( cloneIncidence() ) ); |
941 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 941 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
942 | mMoveAction->addTo( actionMenu ); | 942 | mMoveAction->addTo( actionMenu ); |
943 | connect( mMoveAction, SIGNAL( activated() ), | 943 | connect( mMoveAction, SIGNAL( activated() ), |
944 | mView, SLOT( moveIncidence() ) ); | 944 | mView, SLOT( moveIncidence() ) ); |
945 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 945 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
946 | mBeamAction->addTo( actionMenu ); | 946 | mBeamAction->addTo( actionMenu ); |
947 | connect( mBeamAction, SIGNAL( activated() ), | 947 | connect( mBeamAction, SIGNAL( activated() ), |
948 | mView, SLOT( beamIncidence() ) ); | 948 | mView, SLOT( beamIncidence() ) ); |
949 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 949 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
950 | mCancelAction->addTo( actionMenu ); | 950 | mCancelAction->addTo( actionMenu ); |
951 | connect( mCancelAction, SIGNAL( activated() ), | 951 | connect( mCancelAction, SIGNAL( activated() ), |
952 | mView, SLOT( toggleCancelIncidence() ) ); | 952 | mView, SLOT( toggleCancelIncidence() ) ); |
953 | 953 | ||
954 | actionMenu->insertSeparator(); | 954 | actionMenu->insertSeparator(); |
955 | 955 | ||
956 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 956 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
957 | this ); | 957 | this ); |
958 | action->addTo( actionMenu ); | 958 | action->addTo( actionMenu ); |
959 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 959 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
960 | 960 | ||
961 | icon = loadPixmap( pathString + "search" ); | 961 | icon = loadPixmap( pathString + "search" ); |
962 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 962 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
963 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 963 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
964 | search_action->addTo( actionMenu ); | 964 | search_action->addTo( actionMenu ); |
965 | connect( search_action, SIGNAL( activated() ), | 965 | connect( search_action, SIGNAL( activated() ), |
966 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 966 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
967 | 967 | ||
968 | 968 | ||
969 | 969 | ||
970 | if ( KOPrefs::instance()->mShowFullMenu ) { | 970 | if ( KOPrefs::instance()->mShowFullMenu ) { |
971 | actionMenu->insertSeparator(); | 971 | actionMenu->insertSeparator(); |
972 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 972 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
973 | 973 | ||
974 | } | 974 | } |
975 | // actionMenu->insertSeparator(); | 975 | // actionMenu->insertSeparator(); |
976 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 976 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
977 | this ); | 977 | this ); |
978 | action->addTo( importMenu_X ); | 978 | action->addTo( importMenu_X ); |
979 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 979 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
980 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 980 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
981 | this ); | 981 | this ); |
982 | action->addTo( importMenu_X ); | 982 | action->addTo( importMenu_X ); |
983 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 983 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
984 | importMenu_X->insertSeparator(); | 984 | importMenu_X->insertSeparator(); |
985 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 985 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
986 | this ); | 986 | this ); |
987 | action->addTo( importMenu_X ); | 987 | action->addTo( importMenu_X ); |
988 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 988 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
989 | //#ifndef DESKTOP_VERSION | 989 | //#ifndef DESKTOP_VERSION |
990 | importMenu_X->insertSeparator(); | 990 | importMenu_X->insertSeparator(); |
991 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 991 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
992 | this ); | 992 | this ); |
993 | action->addTo( importMenu_X ); | 993 | action->addTo( importMenu_X ); |
994 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 994 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
995 | //#else | 995 | //#else |
996 | #ifdef _OL_IMPORT_ | 996 | #ifdef _OL_IMPORT_ |
997 | importMenu_X->insertSeparator(); | 997 | importMenu_X->insertSeparator(); |
998 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 998 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
999 | this ); | 999 | this ); |
1000 | action->addTo( importMenu_X ); | 1000 | action->addTo( importMenu_X ); |
1001 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1001 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1002 | #endif | 1002 | #endif |
1003 | //#endif | 1003 | //#endif |
1004 | 1004 | ||
1005 | //importMenu->insertSeparator(); | 1005 | //importMenu->insertSeparator(); |
1006 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1006 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1007 | this ); | 1007 | this ); |
1008 | action->addTo( importMenu ); | 1008 | action->addTo( importMenu ); |
1009 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1009 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1010 | 1010 | ||
1011 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 1011 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
1012 | this ); | 1012 | this ); |
1013 | action->addTo( importMenu ); | 1013 | action->addTo( importMenu ); |
1014 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1014 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1015 | importMenu->insertSeparator(); | 1015 | importMenu->insertSeparator(); |
1016 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1016 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1017 | //importMenu->insertSeparator(); | 1017 | //importMenu->insertSeparator(); |
1018 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1018 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1019 | this ); | 1019 | this ); |
1020 | action->addTo( exportMenu_X ); | 1020 | action->addTo( exportMenu_X ); |
1021 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1021 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1022 | 1022 | ||
1023 | 1023 | ||
1024 | //LR | 1024 | //LR |
1025 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1025 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1026 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1026 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1027 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1027 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1028 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1028 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1029 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1029 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1030 | 1030 | ||
1031 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1031 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1032 | #ifndef DESKTOP_VERSION | 1032 | #ifndef DESKTOP_VERSION |
1033 | //importMenu->insertSeparator(); | 1033 | //importMenu->insertSeparator(); |
1034 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1034 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1035 | this ); | 1035 | this ); |
1036 | brAction->addTo( beamMenu_X ); | 1036 | brAction->addTo( beamMenu_X ); |
1037 | brAction->setToggleAction (true ) ; | 1037 | brAction->setToggleAction (true ) ; |
1038 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1038 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1039 | 1039 | ||
1040 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1040 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1041 | this ); | 1041 | this ); |
1042 | action->addTo( beamMenu_X ); | 1042 | action->addTo( beamMenu_X ); |
1043 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1043 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1044 | 1044 | ||
1045 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1045 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1046 | this ); | 1046 | this ); |
1047 | action->addTo( beamMenu_X ); | 1047 | action->addTo( beamMenu_X ); |
1048 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1048 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1049 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1049 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1050 | #else | 1050 | #else |
1051 | //importMenu->insertSeparator(); | 1051 | //importMenu->insertSeparator(); |
1052 | icon = loadPixmap( pathString + "print" ); | 1052 | icon = loadPixmap( pathString + "print" ); |
1053 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1053 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1054 | action->addTo( beamMenu_X ); | 1054 | action->addTo( beamMenu_X ); |
1055 | connect( action, SIGNAL( activated() ), | 1055 | connect( action, SIGNAL( activated() ), |
1056 | this, SLOT( printCal() ) ); | 1056 | this, SLOT( printCal() ) ); |
1057 | 1057 | ||
1058 | icon = loadPixmap( pathString + "print" ); | 1058 | icon = loadPixmap( pathString + "print" ); |
1059 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1059 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1060 | action->addTo( beamMenu_X ); | 1060 | action->addTo( beamMenu_X ); |
1061 | connect( action, SIGNAL( activated() ), | 1061 | connect( action, SIGNAL( activated() ), |
1062 | this, SLOT( printSel() ) ); | 1062 | this, SLOT( printSel() ) ); |
1063 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1063 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1064 | action->addTo( beamMenu_X ); | 1064 | action->addTo( beamMenu_X ); |
1065 | connect( action, SIGNAL( activated() ), | 1065 | connect( action, SIGNAL( activated() ), |
1066 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1066 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1067 | 1067 | ||
1068 | 1068 | ||
1069 | icon = loadPixmap( pathString + "print" ); | 1069 | icon = loadPixmap( pathString + "print" ); |
1070 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1070 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1071 | action->addTo( beamMenu_X ); | 1071 | action->addTo( beamMenu_X ); |
1072 | connect( action, SIGNAL( activated() ), | 1072 | connect( action, SIGNAL( activated() ), |
1073 | this, SLOT( printListView() ) ); | 1073 | this, SLOT( printListView() ) ); |
1074 | 1074 | ||
1075 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1075 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1076 | action->addTo( beamMenu_X ); | 1076 | action->addTo( beamMenu_X ); |
1077 | connect( action, SIGNAL( activated() ), | 1077 | connect( action, SIGNAL( activated() ), |
1078 | mView, SLOT( slotprintSelInc() ) ); | 1078 | mView, SLOT( slotprintSelInc() ) ); |
1079 | 1079 | ||
1080 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1080 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1081 | #endif | 1081 | #endif |
1082 | importMenu->insertSeparator(); | 1082 | importMenu->insertSeparator(); |
1083 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1083 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1084 | this ); | 1084 | this ); |
1085 | action->addTo( importMenu ); | 1085 | action->addTo( importMenu ); |
1086 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1086 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1087 | importMenu->insertSeparator(); | 1087 | importMenu->insertSeparator(); |
1088 | action = new QAction( "beam all", i18n("Save"), 0, | 1088 | action = new QAction( "beam all", i18n("Save"), 0, |
1089 | this ); | 1089 | this ); |
1090 | action->addTo( importMenu ); | 1090 | action->addTo( importMenu ); |
1091 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1091 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1092 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1092 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1093 | this ); | 1093 | this ); |
1094 | action->addTo( importMenu ); | 1094 | action->addTo( importMenu ); |
1095 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1095 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1096 | 1096 | ||
1097 | //menuBar->insertItem( "Configure",configureMenu ); | 1097 | //menuBar->insertItem( "Configure",configureMenu ); |
1098 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1098 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1099 | icon = loadPixmap( "korganizer/korganizer" ); | 1099 | icon = loadPixmap( "korganizer/korganizer" ); |
1100 | 1100 | ||
1101 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1101 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1102 | action->addTo( helpMenu ); | 1102 | action->addTo( helpMenu ); |
1103 | connect( action, SIGNAL( activated() ), | 1103 | connect( action, SIGNAL( activated() ), |
1104 | SLOT( whatsNew() ) ); | 1104 | SLOT( whatsNew() ) ); |
1105 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1105 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1106 | action->addTo( helpMenu ); | 1106 | action->addTo( helpMenu ); |
1107 | connect( action, SIGNAL( activated() ), | 1107 | connect( action, SIGNAL( activated() ), |
1108 | SLOT( features() ) ); | 1108 | SLOT( features() ) ); |
1109 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1109 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1110 | action->addTo( helpMenu ); | 1110 | action->addTo( helpMenu ); |
1111 | connect( action, SIGNAL( activated() ), | 1111 | connect( action, SIGNAL( activated() ), |
1112 | SLOT( keyBindings() ) ); | 1112 | SLOT( keyBindings() ) ); |
1113 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1113 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1114 | action->addTo( helpMenu ); | 1114 | action->addTo( helpMenu ); |
1115 | connect( action, SIGNAL( activated() ), | 1115 | connect( action, SIGNAL( activated() ), |
1116 | SLOT( storagehowto() ) ); | 1116 | SLOT( storagehowto() ) ); |
1117 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1117 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1118 | action->addTo( helpMenu ); | 1118 | action->addTo( helpMenu ); |
1119 | connect( action, SIGNAL( activated() ), | 1119 | connect( action, SIGNAL( activated() ), |
1120 | SLOT( timetrackinghowto() ) ); | 1120 | SLOT( timetrackinghowto() ) ); |
1121 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1121 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1122 | action->addTo( helpMenu ); | 1122 | action->addTo( helpMenu ); |
1123 | connect( action, SIGNAL( activated() ), | 1123 | connect( action, SIGNAL( activated() ), |
1124 | SLOT( synchowto() ) ); | 1124 | SLOT( synchowto() ) ); |
1125 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1125 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1126 | action->addTo( helpMenu ); | 1126 | action->addTo( helpMenu ); |
1127 | connect( action, SIGNAL( activated() ), | 1127 | connect( action, SIGNAL( activated() ), |
1128 | SLOT( kdesynchowto() ) ); | 1128 | SLOT( kdesynchowto() ) ); |
1129 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1129 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1130 | action->addTo( helpMenu ); | 1130 | action->addTo( helpMenu ); |
1131 | connect( action, SIGNAL( activated() ), | 1131 | connect( action, SIGNAL( activated() ), |
1132 | SLOT( multisynchowto() ) ); | 1132 | SLOT( multisynchowto() ) ); |
1133 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1133 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1134 | action->addTo( helpMenu ); | 1134 | action->addTo( helpMenu ); |
1135 | connect( action, SIGNAL( activated() ), | 1135 | connect( action, SIGNAL( activated() ), |
1136 | SLOT( aboutAutoSaving() ) ); | 1136 | SLOT( aboutAutoSaving() ) ); |
1137 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1137 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1138 | action->addTo( helpMenu ); | 1138 | action->addTo( helpMenu ); |
1139 | connect( action, SIGNAL( activated() ), | 1139 | connect( action, SIGNAL( activated() ), |
1140 | SLOT( aboutKnownBugs() ) ); | 1140 | SLOT( aboutKnownBugs() ) ); |
1141 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1141 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1142 | action->addTo( helpMenu ); | 1142 | action->addTo( helpMenu ); |
1143 | connect( action, SIGNAL( activated() ), | 1143 | connect( action, SIGNAL( activated() ), |
1144 | SLOT( usertrans() ) ); | 1144 | SLOT( usertrans() ) ); |
1145 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1145 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1146 | action->addTo( helpMenu ); | 1146 | action->addTo( helpMenu ); |
1147 | connect( action, SIGNAL( activated() ), | 1147 | connect( action, SIGNAL( activated() ), |
1148 | SLOT( faq() ) ); | 1148 | SLOT( faq() ) ); |
1149 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1149 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1150 | action->addTo( helpMenu ); | 1150 | action->addTo( helpMenu ); |
1151 | connect( action, SIGNAL( activated() ), | 1151 | connect( action, SIGNAL( activated() ), |
1152 | SLOT( licence() ) ); | 1152 | SLOT( licence() ) ); |
1153 | action = new QAction( "about", i18n("About..."), 0, this ); | 1153 | action = new QAction( "about", i18n("About..."), 0, this ); |
1154 | action->addTo( helpMenu ); | 1154 | action->addTo( helpMenu ); |
1155 | connect( action, SIGNAL( activated() ), | 1155 | connect( action, SIGNAL( activated() ), |
1156 | SLOT( about() ) ); | 1156 | SLOT( about() ) ); |
1157 | //menuBar->insertSeparator(); | 1157 | //menuBar->insertSeparator(); |
1158 | 1158 | ||
1159 | // ****************************************************** | 1159 | // ****************************************************** |
1160 | // menubar icons | 1160 | // menubar icons |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | 1163 | ||
1164 | //menuBar->insertItem( iconToolBar ); | 1164 | //menuBar->insertItem( iconToolBar ); |
1165 | //xdays_action | 1165 | //xdays_action |
1166 | if (p-> mShowIconNewEvent) | 1166 | if (p-> mShowIconNewEvent) |
1167 | ne_action->addTo( iconToolBar ); | 1167 | ne_action->addTo( iconToolBar ); |
1168 | if (p->mShowIconNewTodo ) | 1168 | if (p->mShowIconNewTodo ) |
1169 | nt_action->addTo( iconToolBar ); | 1169 | nt_action->addTo( iconToolBar ); |
1170 | if (p-> mShowIconSearch) | 1170 | if (p-> mShowIconSearch) |
1171 | search_action->addTo( iconToolBar ); | 1171 | search_action->addTo( iconToolBar ); |
1172 | if (p-> mShowIconWhatsThis) | 1172 | if (p-> mShowIconWhatsThis) |
1173 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1173 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1174 | if (p-> mShowIconNext) | 1174 | if (p-> mShowIconNext) |
1175 | whatsnext_action->addTo( viewToolBar ); | 1175 | whatsnext_action->addTo( viewToolBar ); |
1176 | if (p-> mShowIconNextDays) | 1176 | if (p-> mShowIconNextDays) |
1177 | xdays_action->addTo( viewToolBar ); | 1177 | xdays_action->addTo( viewToolBar ); |
1178 | if (p-> mShowIconJournal) | 1178 | if (p-> mShowIconJournal) |
1179 | viewjournal_action->addTo( viewToolBar ); | 1179 | viewjournal_action->addTo( viewToolBar ); |
1180 | if (p-> mShowIconDay1) | 1180 | if (p-> mShowIconDay1) |
1181 | day1_action->addTo( viewToolBar ); | 1181 | day1_action->addTo( viewToolBar ); |
1182 | if (p-> mShowIconDay5) | 1182 | if (p-> mShowIconDay5) |
1183 | day5_action->addTo( viewToolBar ); | 1183 | day5_action->addTo( viewToolBar ); |
1184 | if (p-> mShowIconDay7) | 1184 | if (p-> mShowIconDay7) |
1185 | day7_action->addTo( viewToolBar ); | 1185 | day7_action->addTo( viewToolBar ); |
1186 | if (p-> mShowIconDay6) | 1186 | if (p-> mShowIconDay6) |
1187 | day6_action->addTo( viewToolBar ); | 1187 | day6_action->addTo( viewToolBar ); |
1188 | if (p-> mShowIconMonth) | 1188 | if (p-> mShowIconMonth) |
1189 | month_action->addTo( viewToolBar ); | 1189 | month_action->addTo( viewToolBar ); |
1190 | if (p-> mShowIconList) | 1190 | if (p-> mShowIconList) |
1191 | showlist_action->addTo( viewToolBar ); | 1191 | showlist_action->addTo( viewToolBar ); |
1192 | if (p-> mShowIconTodoview) | 1192 | if (p-> mShowIconTodoview) |
1193 | todoview_action->addTo( viewToolBar ); | 1193 | todoview_action->addTo( viewToolBar ); |
1194 | 1194 | ||
1195 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1195 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1196 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1196 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1197 | if (p-> mShowIconBackFast) { | 1197 | if (p-> mShowIconBackFast) { |
1198 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1198 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1199 | connect( action, SIGNAL( activated() ), | 1199 | connect( action, SIGNAL( activated() ), |
1200 | mView, SLOT( goPreviousMonth() ) ); | 1200 | mView, SLOT( goPreviousMonth() ) ); |
1201 | action->addTo( navigatorToolBar ); | 1201 | action->addTo( navigatorToolBar ); |
1202 | } | 1202 | } |
1203 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1203 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1204 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1204 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1205 | if (p-> mShowIconBack) { | 1205 | if (p-> mShowIconBack) { |
1206 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1206 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1207 | connect( action, SIGNAL( activated() ), | 1207 | connect( action, SIGNAL( activated() ), |
1208 | mView, SLOT( goPrevious() ) ); | 1208 | mView, SLOT( goPrevious() ) ); |
1209 | action->addTo( navigatorToolBar ); | 1209 | action->addTo( navigatorToolBar ); |
1210 | } | 1210 | } |
1211 | icon = loadPixmap( pathString + "today" ); | 1211 | icon = loadPixmap( pathString + "today" ); |
1212 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1212 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1213 | if (p-> mShowIconToday) | 1213 | if (p-> mShowIconToday) |
1214 | today_action->addTo( navigatorToolBar ); | 1214 | today_action->addTo( navigatorToolBar ); |
1215 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1215 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1216 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1216 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1217 | if (p-> mShowIconForward) { | 1217 | if (p-> mShowIconForward) { |
1218 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1218 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1219 | connect( action, SIGNAL( activated() ), | 1219 | connect( action, SIGNAL( activated() ), |
1220 | mView, SLOT( goNext() ) ); | 1220 | mView, SLOT( goNext() ) ); |
1221 | action->addTo( navigatorToolBar ); | 1221 | action->addTo( navigatorToolBar ); |
1222 | } | 1222 | } |
1223 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1223 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1224 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1224 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1225 | if (p-> mShowIconForwardFast) { | 1225 | if (p-> mShowIconForwardFast) { |
1226 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1226 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1227 | connect( action, SIGNAL( activated() ), | 1227 | connect( action, SIGNAL( activated() ), |
1228 | mView, SLOT( goNextMonth() ) ); | 1228 | mView, SLOT( goNextMonth() ) ); |
1229 | action->addTo( navigatorToolBar ); | 1229 | action->addTo( navigatorToolBar ); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | 1232 | ||
1233 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1233 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1234 | 1234 | ||
1235 | 1235 | ||
1236 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1236 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1237 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1237 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1238 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1238 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1239 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1239 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1240 | 1240 | ||
1241 | if (p-> mShowIconNewEvent) | 1241 | if (p-> mShowIconNewEvent) |
1242 | configureToolBarMenu->setItemChecked( 10, true ); | 1242 | configureToolBarMenu->setItemChecked( 10, true ); |
1243 | if (p->mShowIconNewTodo ) | 1243 | if (p->mShowIconNewTodo ) |
1244 | configureToolBarMenu->setItemChecked( 20, true ); | 1244 | configureToolBarMenu->setItemChecked( 20, true ); |
1245 | if (p-> mShowIconSearch) | 1245 | if (p-> mShowIconSearch) |
1246 | configureToolBarMenu->setItemChecked( 120, true ); | 1246 | configureToolBarMenu->setItemChecked( 120, true ); |
1247 | if (p-> mShowIconList) | 1247 | if (p-> mShowIconList) |
1248 | configureToolBarMenu->setItemChecked( 30, true ); | 1248 | configureToolBarMenu->setItemChecked( 30, true ); |
1249 | if (p-> mShowIconDay1) | 1249 | if (p-> mShowIconDay1) |
1250 | configureToolBarMenu->setItemChecked( 40, true ); | 1250 | configureToolBarMenu->setItemChecked( 40, true ); |
1251 | if (p-> mShowIconDay5) | 1251 | if (p-> mShowIconDay5) |
1252 | configureToolBarMenu->setItemChecked( 50, true ); | 1252 | configureToolBarMenu->setItemChecked( 50, true ); |
1253 | if (p-> mShowIconDay6) | 1253 | if (p-> mShowIconDay6) |
1254 | configureToolBarMenu->setItemChecked( 75, true ); | 1254 | configureToolBarMenu->setItemChecked( 75, true ); |
1255 | if (p-> mShowIconDay7) | 1255 | if (p-> mShowIconDay7) |
1256 | configureToolBarMenu->setItemChecked( 60, true ); | 1256 | configureToolBarMenu->setItemChecked( 60, true ); |
1257 | if (p-> mShowIconMonth) | 1257 | if (p-> mShowIconMonth) |
1258 | configureToolBarMenu->setItemChecked( 70, true ); | 1258 | configureToolBarMenu->setItemChecked( 70, true ); |
1259 | if (p-> mShowIconTodoview) | 1259 | if (p-> mShowIconTodoview) |
1260 | configureToolBarMenu->setItemChecked( 80, true ); | 1260 | configureToolBarMenu->setItemChecked( 80, true ); |
1261 | if (p-> mShowIconBackFast) | 1261 | if (p-> mShowIconBackFast) |
1262 | configureToolBarMenu->setItemChecked( 200, true ); | 1262 | configureToolBarMenu->setItemChecked( 200, true ); |
1263 | if (p-> mShowIconBack) | 1263 | if (p-> mShowIconBack) |
1264 | configureToolBarMenu->setItemChecked( 210, true ); | 1264 | configureToolBarMenu->setItemChecked( 210, true ); |
1265 | if (p-> mShowIconToday) | 1265 | if (p-> mShowIconToday) |
1266 | configureToolBarMenu->setItemChecked( 130, true ); | 1266 | configureToolBarMenu->setItemChecked( 130, true ); |
1267 | if (p-> mShowIconForward) | 1267 | if (p-> mShowIconForward) |
1268 | configureToolBarMenu->setItemChecked( 220, true ); | 1268 | configureToolBarMenu->setItemChecked( 220, true ); |
1269 | if (p-> mShowIconForwardFast) | 1269 | if (p-> mShowIconForwardFast) |
1270 | configureToolBarMenu->setItemChecked( 230, true ); | 1270 | configureToolBarMenu->setItemChecked( 230, true ); |
1271 | if (p-> mShowIconNextDays) | 1271 | if (p-> mShowIconNextDays) |
1272 | configureToolBarMenu->setItemChecked( 100, true ); | 1272 | configureToolBarMenu->setItemChecked( 100, true ); |
1273 | if (p-> mShowIconNext) | 1273 | if (p-> mShowIconNext) |
1274 | configureToolBarMenu->setItemChecked( 110, true ); | 1274 | configureToolBarMenu->setItemChecked( 110, true ); |
1275 | if (p-> mShowIconJournal) | 1275 | if (p-> mShowIconJournal) |
1276 | configureToolBarMenu->setItemChecked( 90, true ); | 1276 | configureToolBarMenu->setItemChecked( 90, true ); |
1277 | if (p-> mShowIconWhatsThis) | 1277 | if (p-> mShowIconWhatsThis) |
1278 | configureToolBarMenu->setItemChecked( 300, true ); | 1278 | configureToolBarMenu->setItemChecked( 300, true ); |
1279 | if (p-> mShowIconWeekNum) | 1279 | if (p-> mShowIconWeekNum) |
1280 | configureToolBarMenu->setItemChecked( 400, true ); | 1280 | configureToolBarMenu->setItemChecked( 400, true ); |
1281 | if (!p-> mShowIconStretch) { | 1281 | if (!p-> mShowIconStretch) { |
1282 | QLabel* dummy = new QLabel( iconToolBar ); | 1282 | QLabel* dummy = new QLabel( iconToolBar ); |
1283 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1283 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1284 | dummy->setMinimumWidth( 0 ); | 1284 | dummy->setMinimumWidth( 0 ); |
1285 | iconToolBar->setStretchableWidget ( dummy ) ; | 1285 | iconToolBar->setStretchableWidget ( dummy ) ; |
1286 | } | 1286 | } |
1287 | else { | 1287 | else { |
1288 | iconToolBar->setHorizontalStretchable (true ); | 1288 | iconToolBar->setHorizontalStretchable (true ); |
1289 | viewToolBar->setHorizontalStretchable (true ); | 1289 | viewToolBar->setHorizontalStretchable (true ); |
1290 | navigatorToolBar->setHorizontalStretchable (true ); | 1290 | navigatorToolBar->setHorizontalStretchable (true ); |
1291 | iconToolBar->setVerticalStretchable (true ); | 1291 | iconToolBar->setVerticalStretchable (true ); |
1292 | viewToolBar->setVerticalStretchable (true ); | 1292 | viewToolBar->setVerticalStretchable (true ); |
1293 | navigatorToolBar->setVerticalStretchable (true ); | 1293 | navigatorToolBar->setVerticalStretchable (true ); |
1294 | configureToolBarMenu->setItemChecked( 5, true ); | 1294 | configureToolBarMenu->setItemChecked( 5, true ); |
1295 | } | 1295 | } |
1296 | if (p-> mShowIconFilter) | 1296 | if (p-> mShowIconFilter) |
1297 | configureToolBarMenu->setItemChecked( 7, true ); | 1297 | configureToolBarMenu->setItemChecked( 7, true ); |
1298 | if (p-> mShowIconOnetoolbar) | 1298 | if (p-> mShowIconOnetoolbar) |
1299 | configureToolBarMenu->setItemChecked( 6, true ); | 1299 | configureToolBarMenu->setItemChecked( 6, true ); |
1300 | 1300 | ||
1301 | 1301 | ||
1302 | if ( filterMenubar ) { | 1302 | if ( filterMenubar ) { |
1303 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1303 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1304 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | 1304 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); |
1305 | } | 1305 | } |
1306 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1306 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1307 | configureAgenda( p->mHourSize ); | 1307 | configureAgenda( p->mHourSize ); |
1308 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1308 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | void MainWindow::exportToPhone( int mode ) | 1311 | void MainWindow::exportToPhone( int mode ) |
1312 | { | 1312 | { |
1313 | 1313 | ||
1314 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1314 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1315 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1315 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1316 | KOex2phonePrefs ex2phone; | 1316 | KOex2phonePrefs ex2phone; |
1317 | 1317 | ||
1318 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1318 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1319 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1319 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1320 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1320 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1321 | if ( mode == 1 ) | 1321 | if ( mode == 1 ) |
1322 | ex2phone.setCaption(i18n("Export complete calendar")); | 1322 | ex2phone.setCaption(i18n("Export complete calendar")); |
1323 | if ( mode == 2 ) | 1323 | if ( mode == 2 ) |
1324 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1324 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1325 | 1325 | ||
1326 | if ( !ex2phone.exec() ) { | 1326 | if ( !ex2phone.exec() ) { |
1327 | return; | 1327 | return; |
1328 | } | 1328 | } |
1329 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1329 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1330 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1330 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1331 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1331 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1332 | 1332 | ||
1333 | int inFuture = 0; | 1333 | int inFuture = 0; |
1334 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1334 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1335 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1335 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1336 | QPtrList<Incidence> delSel; | 1336 | QPtrList<Incidence> delSel; |
1337 | if ( mode == 1 ) | 1337 | if ( mode == 1 ) |
1338 | delSel = mCalendar->rawIncidences(); | 1338 | delSel = mCalendar->rawIncidences(); |
1339 | if ( mode == 2 ) | 1339 | if ( mode == 2 ) |
1340 | delSel = mCalendar->incidences(); | 1340 | delSel = mCalendar->incidences(); |
1341 | CalendarLocal* cal = new CalendarLocal(); | 1341 | CalendarLocal* cal = new CalendarLocal(); |
1342 | cal->setLocalTime(); | 1342 | cal->setLocalTime(); |
1343 | Incidence *incidence = delSel.first(); | 1343 | Incidence *incidence = delSel.first(); |
1344 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1344 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1345 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1345 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1346 | while ( incidence ) { | 1346 | while ( incidence ) { |
1347 | if ( incidence->typeID() != journalID ) { | 1347 | if ( incidence->typeID() != journalID ) { |
1348 | bool add = true; | 1348 | bool add = true; |
1349 | if ( inFuture ) { | 1349 | if ( inFuture ) { |
1350 | QDateTime dt; | 1350 | QDateTime dt; |
1351 | if ( incidence->typeID() == todoID ) { | 1351 | if ( incidence->typeID() == todoID ) { |
1352 | Todo * t = (Todo*)incidence; | 1352 | Todo * t = (Todo*)incidence; |
1353 | if ( t->hasDueDate() ) | 1353 | if ( t->hasDueDate() ) |
1354 | dt = t->dtDue(); | 1354 | dt = t->dtDue(); |
1355 | else | 1355 | else |
1356 | dt = cur.addSecs( 62 ); | 1356 | dt = cur.addSecs( 62 ); |
1357 | } | 1357 | } |
1358 | else { | 1358 | else { |
1359 | bool ok; | 1359 | bool ok; |
1360 | dt = incidence->getNextOccurence( cur, &ok ); | 1360 | dt = incidence->getNextOccurence( cur, &ok ); |
1361 | if ( !ok ) | 1361 | if ( !ok ) |
1362 | dt = cur.addSecs( -62 ); | 1362 | dt = cur.addSecs( -62 ); |
1363 | } | 1363 | } |
1364 | if ( dt < cur || dt > end ) { | 1364 | if ( dt < cur || dt > end ) { |
1365 | add = false; | 1365 | add = false; |
1366 | } | 1366 | } |
1367 | } | 1367 | } |
1368 | if ( add ) { | 1368 | if ( add ) { |
1369 | Incidence *in = incidence->clone(); | 1369 | Incidence *in = incidence->clone(); |
1370 | cal->addIncidence( in ); | 1370 | cal->addIncidence( in ); |
1371 | } | 1371 | } |
1372 | } | 1372 | } |
1373 | incidence = delSel.next(); | 1373 | incidence = delSel.next(); |
1374 | } | 1374 | } |
1375 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1375 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1376 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1376 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1377 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1377 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1378 | 1378 | ||
1379 | setCaption( i18n("Writing to phone...")); | 1379 | setCaption( i18n("Writing to phone...")); |
1380 | if ( PhoneFormat::writeToPhone( cal ) ) | 1380 | if ( PhoneFormat::writeToPhone( cal ) ) |
1381 | setCaption( i18n("Export to phone successful!")); | 1381 | setCaption( i18n("Export to phone successful!")); |
1382 | else | 1382 | else |
1383 | setCaption( i18n("Error exporting to phone!")); | 1383 | setCaption( i18n("Error exporting to phone!")); |
1384 | delete cal; | 1384 | delete cal; |
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | 1387 | ||
1388 | void MainWindow::setDefaultPreferences() | 1388 | void MainWindow::setDefaultPreferences() |
1389 | { | 1389 | { |
1390 | KOPrefs *p = KOPrefs::instance(); | 1390 | KOPrefs *p = KOPrefs::instance(); |
1391 | 1391 | ||
1392 | p->mCompactDialogs = true; | 1392 | p->mCompactDialogs = true; |
1393 | p->mConfirm = true; | 1393 | p->mConfirm = true; |
1394 | // p->mEnableQuickTodo = false; | 1394 | // p->mEnableQuickTodo = false; |
1395 | 1395 | ||
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | QString MainWindow::resourcePath() | 1398 | QString MainWindow::resourcePath() |
1399 | { | 1399 | { |
1400 | return KGlobal::iconLoader()->iconPath(); | 1400 | return KGlobal::iconLoader()->iconPath(); |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | void MainWindow::displayText( QString text ,QString cap ) | 1403 | void MainWindow::displayText( QString text ,QString cap ) |
1404 | { | 1404 | { |
1405 | QDialog dia( this, "name", true ); ; | 1405 | QDialog dia( this, "name", true ); ; |
1406 | dia.setCaption( cap ); | 1406 | dia.setCaption( cap ); |
1407 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1407 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1408 | lay->setSpacing( 3 ); | 1408 | lay->setSpacing( 3 ); |
1409 | lay->setMargin( 3 ); | 1409 | lay->setMargin( 3 ); |
1410 | QTextBrowser tb ( &dia ); | 1410 | QTextBrowser tb ( &dia ); |
1411 | lay->addWidget( &tb ); | 1411 | lay->addWidget( &tb ); |
1412 | tb.setText( text ); | 1412 | tb.setText( text ); |
1413 | #ifdef DESKTOP_VERSION | 1413 | #ifdef DESKTOP_VERSION |
1414 | dia.resize( 640, 480); | 1414 | dia.resize( 640, 480); |
1415 | #else | 1415 | #else |
1416 | dia.showMaximized(); | 1416 | dia.showMaximized(); |
1417 | #endif | 1417 | #endif |
1418 | dia.exec(); | 1418 | dia.exec(); |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | void MainWindow::features() | 1421 | void MainWindow::features() |
1422 | { | 1422 | { |
1423 | 1423 | ||
1424 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1424 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | void MainWindow::usertrans() | 1427 | void MainWindow::usertrans() |
1428 | { | 1428 | { |
1429 | 1429 | ||
1430 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1430 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | void MainWindow::storagehowto() | 1433 | void MainWindow::storagehowto() |
1434 | { | 1434 | { |
1435 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1435 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1436 | } | 1436 | } |
1437 | void MainWindow::timetrackinghowto() | 1437 | void MainWindow::timetrackinghowto() |
1438 | { | 1438 | { |
1439 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1439 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1440 | } | 1440 | } |
1441 | void MainWindow::kdesynchowto() | 1441 | void MainWindow::kdesynchowto() |
1442 | { | 1442 | { |
1443 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1443 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1444 | } | 1444 | } |
1445 | void MainWindow::multisynchowto() | 1445 | void MainWindow::multisynchowto() |
1446 | { | 1446 | { |
1447 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1447 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1448 | } | 1448 | } |
1449 | void MainWindow::synchowto() | 1449 | void MainWindow::synchowto() |
1450 | { | 1450 | { |
1451 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1451 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1452 | } | 1452 | } |
1453 | void MainWindow::faq() | 1453 | void MainWindow::faq() |
1454 | { | 1454 | { |
1455 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1455 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1456 | 1456 | ||
1457 | } | 1457 | } |
1458 | void MainWindow::whatsNew() | 1458 | void MainWindow::whatsNew() |
1459 | { | 1459 | { |
1460 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1460 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1461 | 1461 | ||
1462 | } | 1462 | } |
1463 | void MainWindow::licence() | 1463 | void MainWindow::licence() |
1464 | { | 1464 | { |
1465 | KApplication::showLicence(); | 1465 | KApplication::showLicence(); |
1466 | 1466 | ||
1467 | } | 1467 | } |
1468 | void MainWindow::about() | 1468 | void MainWindow::about() |
1469 | { | 1469 | { |
1470 | QString version; | 1470 | QString version; |
1471 | #include <../version> | 1471 | #include <../version> |
1472 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1472 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1473 | i18n("KOrganizer/Platform-independent\n") + | 1473 | i18n("KOrganizer/Platform-independent\n") + |
1474 | "(KO/Pi) " + version + " - " + | 1474 | "(KO/Pi) " + version + " - " + |
1475 | 1475 | ||
1476 | #ifdef DESKTOP_VERSION | 1476 | #ifdef DESKTOP_VERSION |
1477 | i18n("Desktop Edition\n") + | 1477 | i18n("Desktop Edition\n") + |
1478 | #else | 1478 | #else |
1479 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1479 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1480 | #endif | 1480 | #endif |
1481 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1481 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1482 | } | 1482 | } |
1483 | void MainWindow::keyBindings() | 1483 | void MainWindow::keyBindings() |
1484 | { | 1484 | { |
1485 | QString cap = i18n("KO/Pi Keys + Colors"); | 1485 | QString cap = i18n("KO/Pi Keys + Colors"); |
1486 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1486 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1487 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1487 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1488 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1488 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1489 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1489 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1490 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1490 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1491 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1491 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1492 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1492 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1493 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1493 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1494 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1494 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1495 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1495 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1496 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1496 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1497 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1497 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1498 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1498 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1499 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1499 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1500 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1500 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1501 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1501 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1502 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1502 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1503 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1503 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1504 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1504 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1505 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1505 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1506 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1506 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1507 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1507 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1508 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1508 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1509 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1509 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1510 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1510 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1511 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1511 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1512 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1512 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1513 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1513 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1514 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1514 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1515 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1515 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1516 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1516 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1517 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1517 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1518 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1518 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1519 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1519 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1520 | i18n("<p><h3>In list view:</h3></p>\n") + | 1520 | i18n("<p><h3>In list view:</h3></p>\n") + |
1521 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1521 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1522 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1522 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1523 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1523 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1524 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1524 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1525 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1525 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1526 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1526 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1527 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1527 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1528 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1528 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1529 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1529 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1530 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1530 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1531 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1531 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1532 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1532 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1533 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1533 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1534 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1534 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1535 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1535 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1536 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1536 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1537 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1537 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1538 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1538 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1539 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1539 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1540 | displayText( text, cap); | 1540 | displayText( text, cap); |
1541 | } | 1541 | } |
1542 | void MainWindow::aboutAutoSaving() | 1542 | void MainWindow::aboutAutoSaving() |
1543 | { | 1543 | { |
1544 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1544 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1545 | 1545 | ||
1546 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1546 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1547 | 1547 | ||
1548 | } | 1548 | } |
1549 | void MainWindow::aboutKnownBugs() | 1549 | void MainWindow::aboutKnownBugs() |
1550 | { | 1550 | { |
1551 | QMessageBox* msg; | 1551 | QMessageBox* msg; |
1552 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1552 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1553 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1553 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1554 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1554 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1555 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1555 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1556 | i18n("\nor report them in the bugtracker on\n") + | 1556 | i18n("\nor report them in the bugtracker on\n") + |
1557 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1557 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1558 | QMessageBox::NoIcon, | 1558 | QMessageBox::NoIcon, |
1559 | QMessageBox::Ok, | 1559 | QMessageBox::Ok, |
1560 | QMessageBox::NoButton, | 1560 | QMessageBox::NoButton, |
1561 | QMessageBox::NoButton); | 1561 | QMessageBox::NoButton); |
1562 | msg->exec(); | 1562 | msg->exec(); |
1563 | delete msg; | 1563 | delete msg; |
1564 | 1564 | ||
1565 | } | 1565 | } |
1566 | 1566 | ||
1567 | QString MainWindow::defaultFileName() | 1567 | QString MainWindow::defaultFileName() |
1568 | { | 1568 | { |
1569 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1569 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1570 | } | 1570 | } |
1571 | QString MainWindow::syncFileName() | 1571 | QString MainWindow::syncFileName() |
1572 | { | 1572 | { |
1573 | #ifdef DESKTOP_VERSION | 1573 | #ifdef DESKTOP_VERSION |
1574 | return locateLocal( "tmp", "synccalendar.ics" ); | 1574 | return locateLocal( "tmp", "synccalendar.ics" ); |
1575 | #else | 1575 | #else |
1576 | return QString( "/tmp/synccalendar.ics" ); | 1576 | return QString( "/tmp/synccalendar.ics" ); |
1577 | #endif | 1577 | #endif |
1578 | } | 1578 | } |
1579 | #include "koglobals.h" | 1579 | #include "koglobals.h" |
1580 | #include <kcalendarsystem.h> | 1580 | #include <kcalendarsystem.h> |
1581 | void MainWindow::updateWeek(QDate seda) | 1581 | void MainWindow::updateWeek(QDate seda) |
1582 | { | 1582 | { |
1583 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1583 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1584 | mWeekPixmap.fill( mWeekBgColor ); | 1584 | mWeekPixmap.fill( mWeekBgColor ); |
1585 | QPainter p ( &mWeekPixmap ); | 1585 | QPainter p ( &mWeekPixmap ); |
1586 | p.setFont( mWeekFont ); | 1586 | p.setFont( mWeekFont ); |
1587 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1587 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1588 | p.end(); | 1588 | p.end(); |
1589 | QIconSet icon3 ( mWeekPixmap ); | 1589 | QIconSet icon3 ( mWeekPixmap ); |
1590 | mWeekAction->setIconSet ( icon3 ); | 1590 | mWeekAction->setIconSet ( icon3 ); |
1591 | 1591 | ||
1592 | } | 1592 | } |
1593 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1593 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1594 | { | 1594 | { |
1595 | updateWeek( selectedDates.first() ); | 1595 | updateWeek( selectedDates.first() ); |
1596 | } | 1596 | } |
1597 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1597 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1598 | { | 1598 | { |
1599 | 1599 | ||
1600 | if ( !incidence ) { | 1600 | if ( !incidence ) { |
1601 | enableIncidenceActions( false ); | 1601 | enableIncidenceActions( false ); |
1602 | 1602 | ||
1603 | mNewSubTodoAction->setEnabled( false ); | 1603 | mNewSubTodoAction->setEnabled( false ); |
1604 | setCaptionToDates(); | 1604 | setCaptionToDates(); |
1605 | return; | 1605 | return; |
1606 | 1606 | ||
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | //KGlobal::locale()->formatDateTime(nextA, true); | 1609 | //KGlobal::locale()->formatDateTime(nextA, true); |
1610 | QString startString = ""; | 1610 | QString startString = ""; |
1611 | if ( incidence->typeID() != todoID ) { | 1611 | if ( incidence->typeID() != todoID ) { |
1612 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1612 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1613 | if ( incidence->doesFloat() ) { | 1613 | if ( incidence->doesFloat() ) { |
1614 | startString += ": "+incidence->dtStartDateStr( true ); | 1614 | startString += ": "+incidence->dtStartDateStr( true ); |
1615 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1615 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1616 | 1616 | ||
1617 | } else { | 1617 | } else { |
1618 | startString = ": "+incidence->dtStartStr(true); | 1618 | startString = ": "+incidence->dtStartStr(true); |
1619 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1619 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1620 | 1620 | ||
1621 | } | 1621 | } |
1622 | 1622 | ||
1623 | } else { | 1623 | } else { |
1624 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1624 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1625 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1625 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1626 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1626 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1627 | 1627 | ||
1628 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1628 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1629 | bool ok; | 1629 | bool ok; |
1630 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1630 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1631 | if ( ok ) { | 1631 | if ( ok ) { |
1632 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1632 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1633 | startString += i18n(" (%1 y.)"). arg( years ); | 1633 | startString += i18n(" (%1 y.)"). arg( years ); |
1634 | } | 1634 | } |
1635 | } | 1635 | } |
1636 | else | 1636 | else |
1637 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1637 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | } | 1640 | } |
1641 | else | 1641 | else |
1642 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1642 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1643 | if ( !incidence->location().isEmpty() ) | 1643 | if ( !incidence->location().isEmpty() ) |
1644 | startString += " (" +incidence->location()+")"; | 1644 | startString += " (" +incidence->location()+")"; |
1645 | setCaption( incidence->summary()+startString); | 1645 | setCaption( incidence->summary()+startString); |
1646 | 1646 | ||
1647 | enableIncidenceActions( true ); | 1647 | enableIncidenceActions( true ); |
1648 | 1648 | ||
1649 | if ( incidence->typeID() == eventID ) { | 1649 | if ( incidence->typeID() == eventID ) { |
1650 | mShowAction->setText( i18n("Show Event...") ); | 1650 | mShowAction->setText( i18n("Show Event...") ); |
1651 | mEditAction->setText( i18n("Edit Event...") ); | 1651 | mEditAction->setText( i18n("Edit Event...") ); |
1652 | mDeleteAction->setText( i18n("Delete Event...") ); | 1652 | mDeleteAction->setText( i18n("Delete Event...") ); |
1653 | 1653 | ||
1654 | mNewSubTodoAction->setEnabled( false ); | 1654 | mNewSubTodoAction->setEnabled( false ); |
1655 | } else if ( incidence->typeID() == todoID ) { | 1655 | } else if ( incidence->typeID() == todoID ) { |
1656 | mShowAction->setText( i18n("Show Todo...") ); | 1656 | mShowAction->setText( i18n("Show Todo...") ); |
1657 | mEditAction->setText( i18n("Edit Todo...") ); | 1657 | mEditAction->setText( i18n("Edit Todo...") ); |
1658 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1658 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1659 | 1659 | ||
1660 | mNewSubTodoAction->setEnabled( true ); | 1660 | mNewSubTodoAction->setEnabled( true ); |
1661 | } else { | 1661 | } else { |
1662 | mShowAction->setText( i18n("Show...") ); | 1662 | mShowAction->setText( i18n("Show...") ); |
1663 | mShowAction->setText( i18n("Edit...") ); | 1663 | mShowAction->setText( i18n("Edit...") ); |
1664 | mShowAction->setText( i18n("Delete...") ); | 1664 | mShowAction->setText( i18n("Delete...") ); |
1665 | 1665 | ||
1666 | mNewSubTodoAction->setEnabled( false ); | 1666 | mNewSubTodoAction->setEnabled( false ); |
1667 | } | 1667 | } |
1668 | } | 1668 | } |
1669 | 1669 | ||
1670 | void MainWindow::enableIncidenceActions( bool enabled ) | 1670 | void MainWindow::enableIncidenceActions( bool enabled ) |
1671 | { | 1671 | { |
1672 | mShowAction->setEnabled( enabled ); | 1672 | mShowAction->setEnabled( enabled ); |
1673 | mEditAction->setEnabled( enabled ); | 1673 | mEditAction->setEnabled( enabled ); |
1674 | mDeleteAction->setEnabled( enabled ); | 1674 | mDeleteAction->setEnabled( enabled ); |
1675 | 1675 | ||
1676 | mCloneAction->setEnabled( enabled ); | 1676 | mCloneAction->setEnabled( enabled ); |
1677 | mMoveAction->setEnabled( enabled ); | 1677 | mMoveAction->setEnabled( enabled ); |
1678 | mBeamAction->setEnabled( enabled ); | 1678 | mBeamAction->setEnabled( enabled ); |
1679 | mCancelAction->setEnabled( enabled ); | 1679 | mCancelAction->setEnabled( enabled ); |
1680 | } | 1680 | } |
1681 | 1681 | ||
1682 | void MainWindow::importOL() | 1682 | void MainWindow::importOL() |
1683 | { | 1683 | { |
1684 | #ifdef _OL_IMPORT_ | 1684 | #ifdef _OL_IMPORT_ |
1685 | mView->clearAllViews(); | 1685 | mView->clearAllViews(); |
1686 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1686 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1687 | id->exec(); | 1687 | id->exec(); |
1688 | delete id; | 1688 | delete id; |
1689 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1689 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1690 | mView->updateView(); | 1690 | mView->updateView(); |
1691 | #endif | 1691 | #endif |
1692 | } | 1692 | } |
1693 | void MainWindow::importBday() | 1693 | void MainWindow::importBday() |
1694 | { | 1694 | { |
1695 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1695 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1696 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1696 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1697 | i18n("Import!"), i18n("Cancel"), 0, | 1697 | i18n("Import!"), i18n("Cancel"), 0, |
1698 | 0, 1 ); | 1698 | 0, 1 ); |
1699 | if ( result == 0 ) { | 1699 | if ( result == 0 ) { |
1700 | mView->importBday(); | 1700 | mView->importBday(); |
1701 | 1701 | ||
1702 | } | 1702 | } |
1703 | 1703 | ||
1704 | 1704 | ||
1705 | } | 1705 | } |
1706 | void MainWindow::importQtopia() | 1706 | void MainWindow::importQtopia() |
1707 | { | 1707 | { |
1708 | //#ifndef DESKTOP_VERSION | 1708 | //#ifndef DESKTOP_VERSION |
1709 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1709 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1710 | #ifdef DESKTOP_VERSION | 1710 | #ifdef DESKTOP_VERSION |
1711 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1711 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1712 | #endif | 1712 | #endif |
1713 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1713 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1714 | i18n("Import!"), i18n("Cancel"), 0, | 1714 | i18n("Import!"), i18n("Cancel"), 0, |
1715 | 0, 1 ); | 1715 | 0, 1 ); |
1716 | if ( result == 0 ) { | 1716 | if ( result == 0 ) { |
1717 | #ifndef DESKTOP_VERSION | 1717 | #ifndef DESKTOP_VERSION |
1718 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1718 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1719 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1719 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1720 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1720 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1721 | #else | 1721 | #else |
1722 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1722 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1723 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1723 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1724 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1724 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1725 | #endif | 1725 | #endif |
1726 | mView->importQtopia( categories, datebook, todolist ); | 1726 | mView->importQtopia( categories, datebook, todolist ); |
1727 | } | 1727 | } |
1728 | mView->calendar()->reInitAlarmSettings(); | 1728 | mView->calendar()->reInitAlarmSettings(); |
1729 | #if 0 | 1729 | #if 0 |
1730 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1730 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1731 | i18n("Not supported \non desktop!\n"), | 1731 | i18n("Not supported \non desktop!\n"), |
1732 | i18n("Ok"), i18n("Cancel"), 0, | 1732 | i18n("Ok"), i18n("Cancel"), 0, |
1733 | 0, 1 ); | 1733 | 0, 1 ); |
1734 | 1734 | ||
1735 | #endif | 1735 | #endif |
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | void MainWindow::saveOnClose() | 1738 | void MainWindow::saveOnClose() |
1739 | { | 1739 | { |
1740 | KOPrefs *p = KOPrefs::instance(); | 1740 | KOPrefs *p = KOPrefs::instance(); |
1741 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1741 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1742 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1742 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1743 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1743 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1744 | if ( filterToolBar ) { | 1744 | if ( filterToolBar ) { |
1745 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1745 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1746 | } | 1746 | } |
1747 | #ifdef DESKTOP_VERSION | 1747 | #ifdef DESKTOP_VERSION |
1748 | 1748 | ||
1749 | QPoint myP; | 1749 | QPoint myP; |
1750 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1750 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1751 | if ( p->mToolBarHor ) | 1751 | if ( p->mToolBarHor ) |
1752 | p->mToolBarUp = myP.y() > height()/2; | 1752 | p->mToolBarUp = myP.y() > height()/2; |
1753 | else | 1753 | else |
1754 | p->mToolBarUp = myP.x() > width()/2; | 1754 | p->mToolBarUp = myP.x() > width()/2; |
1755 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1755 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1756 | if ( p->mToolBarHorV ) | 1756 | if ( p->mToolBarHorV ) |
1757 | p->mToolBarUpV = myP.y() > height()/2; | 1757 | p->mToolBarUpV = myP.y() > height()/2; |
1758 | else | 1758 | else |
1759 | p->mToolBarUpV = myP.x() > width()/2 ; | 1759 | p->mToolBarUpV = myP.x() > width()/2 ; |
1760 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1760 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1761 | if ( p->mToolBarHorN ) | 1761 | if ( p->mToolBarHorN ) |
1762 | p->mToolBarUpN = myP.y() > height()/2; | 1762 | p->mToolBarUpN = myP.y() > height()/2; |
1763 | else | 1763 | else |
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->checkAllFileVersions() ) { |
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 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
1847 | KopiCalendarFile * cal = calendars.first(); | ||
1848 | cal = calendars.next(); | ||
1849 | while ( cal ) { | ||
1850 | if ( !cal->mErrorOnLoad ) { | ||
1851 | int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | ||
1852 | } | ||
1853 | cal = calendars.next(); | ||
1854 | } | ||
1846 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1855 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1847 | |||
1848 | } else if ( retval == 2 ){ | 1856 | } else if ( retval == 2 ){ |
1849 | qDebug("KO: Backup globally cancelled."); | 1857 | qDebug("KO: Backup globally cancelled."); |
1850 | // backup globally cancelled | 1858 | // backup globally cancelled |
1851 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1859 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1852 | } | 1860 | } |
1853 | // retval == 3: do nothing, try again later | 1861 | // retval == 3: do nothing, try again later |
1854 | } | 1862 | } |
1855 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1863 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1856 | } | 1864 | } |
1857 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1865 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1858 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1866 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1859 | qDebug("KO: Start saving data to file!"); | 1867 | qDebug("KO: Start saving data to file!"); |
1860 | mView->saveCalendars(); | 1868 | mView->saveCalendars(); |
1861 | mCalendarModifiedFlag = false; | 1869 | mCalendarModifiedFlag = false; |
1862 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1870 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1863 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1871 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1864 | QString savemes; | 1872 | QString savemes; |
1865 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1873 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1866 | setCaption(savemes); | 1874 | setCaption(savemes); |
1867 | } else | 1875 | } else |
1868 | setCaption(i18n("Saving cancelled!")); | 1876 | setCaption(i18n("Saving cancelled!")); |
1869 | mSyncManager->setBlockSave( false ); | 1877 | mSyncManager->setBlockSave( false ); |
1870 | } | 1878 | } |
1871 | 1879 | ||
1872 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1880 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1873 | { | 1881 | { |
1874 | if ( !e->isAutoRepeat() ) { | 1882 | if ( !e->isAutoRepeat() ) { |
1875 | mFlagKeyPressed = false; | 1883 | mFlagKeyPressed = false; |
1876 | } | 1884 | } |
1877 | } | 1885 | } |
1878 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1886 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1879 | { | 1887 | { |
1880 | qApp->processEvents(); | 1888 | qApp->processEvents(); |
1881 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1889 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1882 | e->ignore(); | 1890 | e->ignore(); |
1883 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1891 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1884 | return; | 1892 | return; |
1885 | } | 1893 | } |
1886 | if (! e->isAutoRepeat() ) | 1894 | if (! e->isAutoRepeat() ) |
1887 | mFlagKeyPressed = true; | 1895 | mFlagKeyPressed = true; |
1888 | KOPrefs *p = KOPrefs::instance(); | 1896 | KOPrefs *p = KOPrefs::instance(); |
1889 | bool showSelectedDates = false; | 1897 | bool showSelectedDates = false; |
1890 | int size; | 1898 | int size; |
1891 | int pro = 0; | 1899 | int pro = 0; |
1892 | //qDebug("MainWindow::keyPressEvent "); | 1900 | //qDebug("MainWindow::keyPressEvent "); |
1893 | switch ( e->key() ) { | 1901 | switch ( e->key() ) { |
1894 | case Qt::Key_Right: | 1902 | case Qt::Key_Right: |
1895 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1903 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1896 | mView->goNextMonth(); | 1904 | mView->goNextMonth(); |
1897 | else | 1905 | else |
1898 | mView->goNext(); | 1906 | mView->goNext(); |
1899 | showSelectedDates = true; | 1907 | showSelectedDates = true; |
1900 | break; | 1908 | break; |
1901 | case Qt::Key_Left: | 1909 | case Qt::Key_Left: |
1902 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1910 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1903 | mView->goPreviousMonth(); | 1911 | mView->goPreviousMonth(); |
1904 | else | 1912 | else |
1905 | mView->goPrevious(); | 1913 | mView->goPrevious(); |
1906 | showSelectedDates = true; | 1914 | showSelectedDates = true; |
1907 | break; | 1915 | break; |
1908 | case Qt::Key_Down: | 1916 | case Qt::Key_Down: |
1909 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1917 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1910 | break; | 1918 | break; |
1911 | case Qt::Key_Up: | 1919 | case Qt::Key_Up: |
1912 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1920 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1913 | break; | 1921 | break; |
1914 | case Qt::Key_K: | 1922 | case Qt::Key_K: |
1915 | mView->viewManager()->showMonthViewWeek(); | 1923 | mView->viewManager()->showMonthViewWeek(); |
1916 | break; | 1924 | break; |
1917 | case Qt::Key_I: | 1925 | case Qt::Key_I: |
1918 | mView->showIncidence(); | 1926 | mView->showIncidence(); |
1919 | break; | 1927 | break; |
1920 | case Qt::Key_Delete: | 1928 | case Qt::Key_Delete: |
1921 | case Qt::Key_Backspace: | 1929 | case Qt::Key_Backspace: |
1922 | mView->deleteIncidence(); | 1930 | mView->deleteIncidence(); |
1923 | break; | 1931 | break; |
1924 | case Qt::Key_D: | 1932 | case Qt::Key_D: |
1925 | mView->viewManager()->showDayView(); | 1933 | mView->viewManager()->showDayView(); |
1926 | showSelectedDates = true; | 1934 | showSelectedDates = true; |
1927 | break; | 1935 | break; |
1928 | case Qt::Key_O: | 1936 | case Qt::Key_O: |
1929 | mView->toggleFilerEnabled( ); | 1937 | mView->toggleFilerEnabled( ); |
1930 | break; | 1938 | break; |
1931 | case Qt::Key_0: | 1939 | case Qt::Key_0: |
1932 | case Qt::Key_1: | 1940 | case Qt::Key_1: |
1933 | case Qt::Key_2: | 1941 | case Qt::Key_2: |
1934 | case Qt::Key_3: | 1942 | case Qt::Key_3: |
1935 | case Qt::Key_4: | 1943 | case Qt::Key_4: |
1936 | case Qt::Key_5: | 1944 | case Qt::Key_5: |
1937 | case Qt::Key_6: | 1945 | case Qt::Key_6: |
1938 | case Qt::Key_7: | 1946 | case Qt::Key_7: |
1939 | case Qt::Key_8: | 1947 | case Qt::Key_8: |
1940 | case Qt::Key_9: | 1948 | case Qt::Key_9: |
1941 | pro = e->key()-48; | 1949 | pro = e->key()-48; |
1942 | if ( pro == 0 ) | 1950 | if ( pro == 0 ) |
1943 | pro = 10; | 1951 | pro = 10; |
1944 | if ( e->state() == Qt::ControlButton) | 1952 | if ( e->state() == Qt::ControlButton) |
1945 | pro += 10; | 1953 | pro += 10; |
1946 | break; | 1954 | break; |
1947 | case Qt::Key_M: | 1955 | case Qt::Key_M: |
1948 | mView->viewManager()->showMonthView(); | 1956 | mView->viewManager()->showMonthView(); |
1949 | showSelectedDates = true; | 1957 | showSelectedDates = true; |
1950 | break; | 1958 | break; |
1951 | case Qt::Key_Insert: | 1959 | case Qt::Key_Insert: |
1952 | mView->newEvent(); | 1960 | mView->newEvent(); |
1953 | break; | 1961 | break; |
1954 | case Qt::Key_S : | 1962 | case Qt::Key_S : |
1955 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1963 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1956 | mView->newSubTodo(); | 1964 | mView->newSubTodo(); |
1957 | else | 1965 | else |
1958 | mView->dialogManager()->showSearchDialog(); | 1966 | mView->dialogManager()->showSearchDialog(); |
1959 | break; | 1967 | break; |
1960 | case Qt::Key_Y : | 1968 | case Qt::Key_Y : |
1961 | case Qt::Key_Z : | 1969 | case Qt::Key_Z : |
1962 | mView->viewManager()->showWorkWeekView(); | 1970 | mView->viewManager()->showWorkWeekView(); |
1963 | showSelectedDates = true; | 1971 | showSelectedDates = true; |
1964 | break; | 1972 | break; |
1965 | case Qt::Key_U : | 1973 | case Qt::Key_U : |
1966 | mView->viewManager()->showWeekView(); | 1974 | mView->viewManager()->showWeekView(); |
1967 | showSelectedDates = true; | 1975 | showSelectedDates = true; |
1968 | break; | 1976 | break; |
1969 | case Qt::Key_H : | 1977 | case Qt::Key_H : |
1970 | keyBindings(); | 1978 | keyBindings(); |
1971 | break; | 1979 | break; |
1972 | case Qt::Key_W: | 1980 | case Qt::Key_W: |
1973 | mView->viewManager()->showWhatsNextView(); | 1981 | mView->viewManager()->showWhatsNextView(); |
1974 | break; | 1982 | break; |
1975 | case Qt::Key_L: | 1983 | case Qt::Key_L: |
1976 | mView->viewManager()->showListView(); | 1984 | mView->viewManager()->showListView(); |
1977 | break; | 1985 | break; |
1978 | case Qt::Key_N: | 1986 | case Qt::Key_N: |
1979 | mView->viewManager()->showNextView(); | 1987 | mView->viewManager()->showNextView(); |
1980 | break; | 1988 | break; |
1981 | case Qt::Key_V: | 1989 | case Qt::Key_V: |
1982 | mView->viewManager()->showTodoView(); | 1990 | mView->viewManager()->showTodoView(); |
1983 | break; | 1991 | break; |
1984 | case Qt::Key_C: | 1992 | case Qt::Key_C: |
1985 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1993 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1986 | break; | 1994 | break; |
1987 | case Qt::Key_P: | 1995 | case Qt::Key_P: |
1988 | mView->showDatePicker( ); | 1996 | mView->showDatePicker( ); |
1989 | break; | 1997 | break; |
1990 | case Qt::Key_F: | 1998 | case Qt::Key_F: |
1991 | mView->editFilters(); | 1999 | mView->editFilters(); |
1992 | break; | 2000 | break; |
1993 | case Qt::Key_R: | 2001 | case Qt::Key_R: |
1994 | mView->toggleFilter(); | 2002 | mView->toggleFilter(); |
1995 | break; | 2003 | break; |
1996 | case Qt::Key_X: | 2004 | case Qt::Key_X: |
1997 | if ( e->state() == Qt::ControlButton ) | 2005 | if ( e->state() == Qt::ControlButton ) |
1998 | mView->toggleDateNavigatorWidget(); | 2006 | mView->toggleDateNavigatorWidget(); |
1999 | else { | 2007 | else { |
2000 | mView->viewManager()->showNextXView(); | 2008 | mView->viewManager()->showNextXView(); |
2001 | showSelectedDates = true; | 2009 | showSelectedDates = true; |
2002 | } | 2010 | } |
2003 | break; | 2011 | break; |
2004 | case Qt::Key_Space: | 2012 | case Qt::Key_Space: |
2005 | mView->toggleExpand(); | 2013 | mView->toggleExpand(); |
2006 | break; | 2014 | break; |
2007 | case Qt::Key_A: | 2015 | case Qt::Key_A: |
2008 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2016 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2009 | mView->showNextAlarms(); | 2017 | mView->showNextAlarms(); |
2010 | else | 2018 | else |
2011 | mView->toggleAllDaySize(); | 2019 | mView->toggleAllDaySize(); |
2012 | break; | 2020 | break; |
2013 | case Qt::Key_T: | 2021 | case Qt::Key_T: |
2014 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2022 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2015 | mView->newTodo(); | 2023 | mView->newTodo(); |
2016 | else { | 2024 | else { |
2017 | mView->goToday(); | 2025 | mView->goToday(); |
2018 | showSelectedDates = true; | 2026 | showSelectedDates = true; |
2019 | } | 2027 | } |
2020 | break; | 2028 | break; |
2021 | case Qt::Key_J: | 2029 | case Qt::Key_J: |
2022 | mView->viewManager()->showJournalView(); | 2030 | mView->viewManager()->showJournalView(); |
2023 | break; | 2031 | break; |
2024 | case Qt::Key_B: | 2032 | case Qt::Key_B: |
2025 | mView->editIncidenceDescription();; | 2033 | mView->editIncidenceDescription();; |
2026 | break; | 2034 | break; |
2027 | // case Qt::Key_Return: | 2035 | // case Qt::Key_Return: |
2028 | case Qt::Key_E: | 2036 | case Qt::Key_E: |
2029 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2037 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2030 | mView->newEvent(); | 2038 | mView->newEvent(); |
2031 | else | 2039 | else |
2032 | mView->editIncidence(); | 2040 | mView->editIncidence(); |
2033 | break; | 2041 | break; |
2034 | case Qt::Key_Plus: | 2042 | case Qt::Key_Plus: |
2035 | size = p->mHourSize +2; | 2043 | size = p->mHourSize +2; |
2036 | if ( size <= 22 ) | 2044 | if ( size <= 22 ) |
2037 | configureAgenda( size ); | 2045 | configureAgenda( size ); |
2038 | break; | 2046 | break; |
2039 | case Qt::Key_Minus: | 2047 | case Qt::Key_Minus: |
2040 | size = p->mHourSize - 2; | 2048 | size = p->mHourSize - 2; |
2041 | if ( size >= 4 ) | 2049 | if ( size >= 4 ) |
2042 | configureAgenda( size ); | 2050 | configureAgenda( size ); |
2043 | break; | 2051 | break; |
2044 | 2052 | ||
2045 | 2053 | ||
2046 | default: | 2054 | default: |
2047 | e->ignore(); | 2055 | e->ignore(); |
2048 | } | 2056 | } |
2049 | if ( pro > 0 ) { | 2057 | if ( pro > 0 ) { |
2050 | mView->selectFilter( pro-1 ); | 2058 | mView->selectFilter( pro-1 ); |
2051 | } | 2059 | } |
2052 | if ( showSelectedDates ) { | 2060 | if ( showSelectedDates ) { |
2053 | ;// setCaptionToDates(); | 2061 | ;// setCaptionToDates(); |
2054 | } | 2062 | } |
2055 | 2063 | ||
2056 | } | 2064 | } |
2057 | void MainWindow::fillFilterMenuTB() | 2065 | void MainWindow::fillFilterMenuTB() |
2058 | { | 2066 | { |
2059 | selectFilterMenuTB->clear(); | 2067 | selectFilterMenuTB->clear(); |
2060 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2068 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2061 | selectFilterMenuTB->insertSeparator(); | 2069 | selectFilterMenuTB->insertSeparator(); |
2062 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2070 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2063 | 2071 | ||
2064 | selectFilterMenuTB->insertSeparator(); | 2072 | selectFilterMenuTB->insertSeparator(); |
2065 | QPtrList<CalFilter> fili = mView->filters(); | 2073 | QPtrList<CalFilter> fili = mView->filters(); |
2066 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2074 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2067 | CalFilter *filter = fili.first(); | 2075 | CalFilter *filter = fili.first(); |
2068 | int iii = 2; | 2076 | int iii = 2; |
2069 | bool checkitem = mView->filterView()->filtersEnabled(); | 2077 | bool checkitem = mView->filterView()->filtersEnabled(); |
2070 | while(filter) { | 2078 | while(filter) { |
2071 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2079 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2072 | if ( filter == curfilter) | 2080 | if ( filter == curfilter) |
2073 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2081 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2074 | filter = fili.next(); | 2082 | filter = fili.next(); |
2075 | ++iii; | 2083 | ++iii; |
2076 | } | 2084 | } |
2077 | if ( !checkitem ) | 2085 | if ( !checkitem ) |
2078 | selectFilterMenuTB->setItemChecked( 1, true ); | 2086 | selectFilterMenuTB->setItemChecked( 1, true ); |
2079 | 2087 | ||
2080 | int x = 0; | 2088 | int x = 0; |
2081 | int y = iconToolBar->height(); | 2089 | int y = iconToolBar->height(); |
2082 | int dX = 0; | 2090 | int dX = 0; |
2083 | int dY = 0; | 2091 | int dY = 0; |
2084 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2092 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2085 | if ( iconToolBar->y() > height()/2 ) { | 2093 | if ( iconToolBar->y() > height()/2 ) { |
2086 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2094 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2087 | y = 0; | 2095 | y = 0; |
2088 | } | 2096 | } |
2089 | } else { | 2097 | } else { |
2090 | if ( iconToolBar->x() > width()/2 ) { // right side | 2098 | if ( iconToolBar->x() > width()/2 ) { // right side |
2091 | x=0; | 2099 | x=0; |
2092 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2100 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2093 | y = 0; | 2101 | y = 0; |
2094 | } else { | 2102 | } else { |
2095 | x= iconToolBar->width(); | 2103 | x= iconToolBar->width(); |
2096 | y = 0; | 2104 | y = 0; |
2097 | } | 2105 | } |
2098 | } | 2106 | } |
2099 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2107 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2100 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2108 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2101 | } | 2109 | } |
2102 | void MainWindow::fillFilterMenu() | 2110 | void MainWindow::fillFilterMenu() |
2103 | { | 2111 | { |
2104 | selectFilterMenu->clear(); | 2112 | selectFilterMenu->clear(); |
2105 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2113 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2106 | selectFilterMenu->insertSeparator(); | 2114 | selectFilterMenu->insertSeparator(); |
2107 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2115 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2108 | 2116 | ||
2109 | selectFilterMenu->insertSeparator(); | 2117 | selectFilterMenu->insertSeparator(); |
2110 | QPtrList<CalFilter> fili = mView->filters(); | 2118 | QPtrList<CalFilter> fili = mView->filters(); |
2111 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2119 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2112 | CalFilter *filter = fili.first(); | 2120 | CalFilter *filter = fili.first(); |
2113 | int iii = 2; | 2121 | int iii = 2; |
2114 | bool checkitem = mView->filterView()->filtersEnabled(); | 2122 | bool checkitem = mView->filterView()->filtersEnabled(); |
2115 | while(filter) { | 2123 | while(filter) { |
2116 | selectFilterMenu->insertItem( filter->name(), iii ); | 2124 | selectFilterMenu->insertItem( filter->name(), iii ); |
2117 | if ( filter == curfilter) | 2125 | if ( filter == curfilter) |
2118 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2126 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2119 | filter = fili.next(); | 2127 | filter = fili.next(); |
2120 | ++iii; | 2128 | ++iii; |
2121 | } | 2129 | } |
2122 | if ( !checkitem ) | 2130 | if ( !checkitem ) |
2123 | selectFilterMenu->setItemChecked( 1, true ); | 2131 | selectFilterMenu->setItemChecked( 1, true ); |
2124 | } | 2132 | } |
2125 | void MainWindow::fillFilterMenuPopup() | 2133 | void MainWindow::fillFilterMenuPopup() |
2126 | { | 2134 | { |
2127 | filterPopupMenu->clear(); | 2135 | filterPopupMenu->clear(); |
2128 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2136 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2129 | 2137 | ||
2130 | filterPopupMenu->insertSeparator(); | 2138 | filterPopupMenu->insertSeparator(); |
2131 | QPtrList<CalFilter> fili = mView->filters(); | 2139 | QPtrList<CalFilter> fili = mView->filters(); |
2132 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2140 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2133 | CalFilter *filter = fili.first(); | 2141 | CalFilter *filter = fili.first(); |
2134 | int iii = 1; | 2142 | int iii = 1; |
2135 | bool checkitem = mView->filterView()->filtersEnabled(); | 2143 | bool checkitem = mView->filterView()->filtersEnabled(); |
2136 | while(filter) { | 2144 | while(filter) { |
2137 | filterPopupMenu->insertItem( filter->name(), iii ); | 2145 | filterPopupMenu->insertItem( filter->name(), iii ); |
2138 | if ( filter == curfilter) | 2146 | if ( filter == curfilter) |
2139 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2147 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2140 | filter = fili.next(); | 2148 | filter = fili.next(); |
2141 | ++iii; | 2149 | ++iii; |
2142 | } | 2150 | } |
2143 | if ( !checkitem ) | 2151 | if ( !checkitem ) |
2144 | filterPopupMenu->setItemChecked( 0, true ); | 2152 | filterPopupMenu->setItemChecked( 0, true ); |
2145 | } | 2153 | } |
2146 | void MainWindow::selectFilter( int fil ) | 2154 | void MainWindow::selectFilter( int fil ) |
2147 | { | 2155 | { |
2148 | 2156 | ||
2149 | if ( fil == 0 ) { | 2157 | if ( fil == 0 ) { |
2150 | mView->editFilters( ); | 2158 | mView->editFilters( ); |
2151 | } else if ( fil == 1 ){ | 2159 | } else if ( fil == 1 ){ |
2152 | if ( mView->filterView()->filtersEnabled() ) | 2160 | if ( mView->filterView()->filtersEnabled() ) |
2153 | mView->toggleFilerEnabled( ); | 2161 | mView->toggleFilerEnabled( ); |
2154 | } else { | 2162 | } else { |
2155 | if ( !mView->filterView()->filtersEnabled() ) { | 2163 | if ( !mView->filterView()->filtersEnabled() ) { |
2156 | mView->filterView()->blockSignals( true ); | 2164 | mView->filterView()->blockSignals( true ); |
2157 | mView->toggleFilerEnabled( ); | 2165 | mView->toggleFilerEnabled( ); |
2158 | mView->filterView()->blockSignals( false ); | 2166 | mView->filterView()->blockSignals( false ); |
2159 | } | 2167 | } |
2160 | mView->selectFilter( fil-2 ); | 2168 | mView->selectFilter( fil-2 ); |
2161 | } | 2169 | } |
2162 | } | 2170 | } |
2163 | void MainWindow::updateFilterToolbar() | 2171 | void MainWindow::updateFilterToolbar() |
2164 | { | 2172 | { |
2165 | if ( filterMenubar ) { | 2173 | if ( filterMenubar ) { |
2166 | if ( !mView->filterView()->filtersEnabled() ) { | 2174 | if ( !mView->filterView()->filtersEnabled() ) { |
2167 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2175 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2168 | } else { | 2176 | } else { |
2169 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2177 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2170 | if ( curfilter ) { | 2178 | if ( curfilter ) { |
2171 | filterMenubar->changeItem( 0, curfilter->name() ); | 2179 | filterMenubar->changeItem( 0, curfilter->name() ); |
2172 | } | 2180 | } |
2173 | } | 2181 | } |
2174 | } | 2182 | } |
2175 | } | 2183 | } |
2176 | void MainWindow::selectFilterPopup( int fil ) | 2184 | void MainWindow::selectFilterPopup( int fil ) |
2177 | { | 2185 | { |
2178 | selectFilter( fil + 1 ); | 2186 | selectFilter( fil + 1 ); |
2179 | 2187 | ||
2180 | } | 2188 | } |
2181 | void MainWindow::configureToolBar( int item ) | 2189 | void MainWindow::configureToolBar( int item ) |
2182 | { | 2190 | { |
2183 | 2191 | ||
2184 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2192 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2185 | KOPrefs *p = KOPrefs::instance(); | 2193 | KOPrefs *p = KOPrefs::instance(); |
2186 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2194 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2187 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2195 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2188 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2196 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2189 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2197 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2190 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2198 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2191 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2199 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2192 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2200 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2193 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2201 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2194 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2202 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2195 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2203 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2196 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2204 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2197 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2205 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2198 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2206 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2199 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2207 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2200 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2208 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2201 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2209 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2202 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2210 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2203 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2211 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2204 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2212 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2205 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2213 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2206 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2214 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2207 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2215 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2208 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2216 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2209 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2217 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2210 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2218 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2211 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2219 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2212 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2220 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2213 | // initActions(); | 2221 | // initActions(); |
2214 | } | 2222 | } |
2215 | void MainWindow::setCaption ( const QString & c ) | 2223 | void MainWindow::setCaption ( const QString & c ) |
2216 | { | 2224 | { |
2217 | QString cap = c; | 2225 | QString cap = c; |
2218 | cap.replace( QRegExp("\n"), " " ); | 2226 | cap.replace( QRegExp("\n"), " " ); |
2219 | cap = cap.stripWhiteSpace(); | 2227 | cap = cap.stripWhiteSpace(); |
2220 | if ( cap.isEmpty() ) | 2228 | if ( cap.isEmpty() ) |
2221 | cap = "KO/Pi"; | 2229 | cap = "KO/Pi"; |
2222 | QWidget::setCaption( cap ); | 2230 | QWidget::setCaption( cap ); |
2223 | } | 2231 | } |
2224 | void MainWindow::setCaptionToDates() | 2232 | void MainWindow::setCaptionToDates() |
2225 | { | 2233 | { |
2226 | QString selDates; | 2234 | QString selDates; |
2227 | QDate date = mView->startDate(); | 2235 | QDate date = mView->startDate(); |
2228 | if ( ! date.isValid() ) { | 2236 | if ( ! date.isValid() ) { |
2229 | setCaption(""); | 2237 | setCaption(""); |
2230 | return; | 2238 | return; |
2231 | } | 2239 | } |
2232 | selDates = KGlobal::locale()->formatDate( date, true); | 2240 | selDates = KGlobal::locale()->formatDate( date, true); |
2233 | if (mView->startDate() < mView->endDate() ) | 2241 | if (mView->startDate() < mView->endDate() ) |
2234 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2242 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2235 | else { | 2243 | else { |
2236 | QString addString; | 2244 | QString addString; |
2237 | if ( date == QDateTime::currentDateTime().date() ) | 2245 | if ( date == QDateTime::currentDateTime().date() ) |
2238 | addString = i18n("Today"); | 2246 | addString = i18n("Today"); |
2239 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2247 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2240 | addString = i18n("Tomorrow"); | 2248 | addString = i18n("Tomorrow"); |
2241 | if ( !addString.isEmpty() ) | 2249 | if ( !addString.isEmpty() ) |
2242 | selDates = addString+", "+selDates ; | 2250 | selDates = addString+", "+selDates ; |
2243 | } | 2251 | } |
2244 | setCaption( i18n("Dates: ") + selDates ); | 2252 | setCaption( i18n("Dates: ") + selDates ); |
2245 | 2253 | ||
2246 | } | 2254 | } |
2247 | void MainWindow::showConfigureAgenda( ) | 2255 | void MainWindow::showConfigureAgenda( ) |
2248 | { | 2256 | { |
2249 | int iii; | 2257 | int iii; |
2250 | for ( iii = 1;iii<= 10 ;++iii ){ | 2258 | for ( iii = 1;iii<= 10 ;++iii ){ |
2251 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2259 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2252 | } | 2260 | } |
2253 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2261 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2254 | } | 2262 | } |
2255 | void MainWindow::configureAgenda( int item ) | 2263 | void MainWindow::configureAgenda( int item ) |
2256 | { | 2264 | { |
2257 | if ( KOPrefs::instance()->mHourSize == item ) | 2265 | if ( KOPrefs::instance()->mHourSize == item ) |
2258 | return; | 2266 | return; |
2259 | KOPrefs::instance()->mHourSize=item; | 2267 | KOPrefs::instance()->mHourSize=item; |
2260 | mView->viewManager()->agendaView()->updateConfig(); | 2268 | mView->viewManager()->agendaView()->updateConfig(); |
2261 | } | 2269 | } |
2262 | 2270 | ||
2263 | void MainWindow::saveCalendar() | 2271 | void MainWindow::saveCalendar() |
2264 | { | 2272 | { |
2265 | QString fn = KOPrefs::instance()->mLastSaveFile; | 2273 | QString fn = KOPrefs::instance()->mLastSaveFile; |
2266 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 2274 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
2267 | 2275 | ||
2268 | if ( fn == "" ) | 2276 | if ( fn == "" ) |
2269 | return; | 2277 | return; |
2270 | QFileInfo info; | 2278 | QFileInfo info; |
2271 | info.setFile( fn ); | 2279 | info.setFile( fn ); |
2272 | QString mes; | 2280 | QString mes; |
2273 | bool createbup = true; | 2281 | bool createbup = true; |
2274 | if ( info. exists() ) { | 2282 | if ( info. exists() ) { |
2275 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 2283 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
2276 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2284 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2277 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2285 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2278 | 0, 1 ); | 2286 | 0, 1 ); |
2279 | if ( result != 0 ) { | 2287 | if ( result != 0 ) { |
2280 | createbup = false; | 2288 | createbup = false; |
2281 | } | 2289 | } |
2282 | } | 2290 | } |
2283 | if ( createbup ) { | 2291 | if ( createbup ) { |
2284 | mView->saveCalendar( fn ); | 2292 | mView->saveCalendar( fn ); |
2285 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 2293 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
2286 | KOPrefs::instance()->mLastSaveFile = fn; | 2294 | KOPrefs::instance()->mLastSaveFile = fn; |
2287 | setCaption(mes); | 2295 | setCaption(mes); |
2288 | } | 2296 | } |
2289 | } | 2297 | } |
2290 | void MainWindow::loadCalendar() | 2298 | void MainWindow::loadCalendar() |
2291 | { | 2299 | { |
2292 | 2300 | ||
2293 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2301 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2294 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2302 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2295 | 2303 | ||
2296 | if ( fn == "" ) | 2304 | if ( fn == "" ) |
2297 | return; | 2305 | return; |
2298 | QFileInfo info; | 2306 | QFileInfo info; |
2299 | info.setFile( fn ); | 2307 | info.setFile( fn ); |
2300 | QString mess; | 2308 | QString mess; |
2301 | bool loadbup = true; | 2309 | bool loadbup = true; |
2302 | if ( info. exists() ) { | 2310 | if ( info. exists() ) { |
2303 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2311 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2304 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2312 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2305 | mess, | 2313 | mess, |
2306 | i18n("Load!"), i18n("Cancel"), 0, | 2314 | i18n("Load!"), i18n("Cancel"), 0, |
2307 | 0, 1 ); | 2315 | 0, 1 ); |
2308 | if ( result != 0 ) { | 2316 | if ( result != 0 ) { |
2309 | loadbup = false; | 2317 | loadbup = false; |
2310 | } | 2318 | } |
2311 | } else { | 2319 | } else { |
2312 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2320 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2313 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2321 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2314 | 0, 1 ); | 2322 | 0, 1 ); |
2315 | 2323 | ||
2316 | return; | 2324 | return; |
2317 | } | 2325 | } |
2318 | if ( loadbup ) { | 2326 | if ( loadbup ) { |
2319 | mView->openCalendar( fn ); | 2327 | mView->openCalendar( fn ); |
2320 | KOPrefs::instance()->mLastLoadFile = fn; | 2328 | KOPrefs::instance()->mLastLoadFile = fn; |
2321 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2329 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2322 | setCaption(mess); | 2330 | setCaption(mess); |
2323 | } | 2331 | } |
2324 | 2332 | ||
2325 | } | 2333 | } |
2326 | void MainWindow::quickImportIcal() | 2334 | void MainWindow::quickImportIcal() |
2327 | { | 2335 | { |
2328 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2336 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2329 | } | 2337 | } |
2330 | void MainWindow::importFile( QString fn, bool quick ) | 2338 | void MainWindow::importFile( QString fn, bool quick ) |
2331 | { | 2339 | { |
2332 | QFileInfo info; | 2340 | QFileInfo info; |
2333 | info.setFile( fn ); | 2341 | info.setFile( fn ); |
2334 | QString mess; | 2342 | QString mess; |
2335 | bool loadbup = true; | 2343 | bool loadbup = true; |
2336 | if ( !info. exists() ) { | 2344 | if ( !info. exists() ) { |
2337 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2345 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2338 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2346 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2339 | mess ); | 2347 | mess ); |
2340 | return; | 2348 | return; |
2341 | } | 2349 | } |
2342 | int result = 0; | 2350 | int result = 0; |
2343 | if ( !quick ) { | 2351 | if ( !quick ) { |
2344 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2352 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2345 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2353 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2346 | mess, | 2354 | mess, |
2347 | "Import", "Cancel", 0, | 2355 | "Import", "Cancel", 0, |
2348 | 0, 1 ); | 2356 | 0, 1 ); |
2349 | } | 2357 | } |
2350 | if ( result == 0 ) { | 2358 | if ( result == 0 ) { |
2351 | if ( mView->openCalendar( fn, true )) { | 2359 | if ( mView->openCalendar( fn, true )) { |
2352 | KOPrefs::instance()->mLastImportFile = fn; | 2360 | KOPrefs::instance()->mLastImportFile = fn; |
2353 | setCaption(i18n("Imported file successfully")); | 2361 | setCaption(i18n("Imported file successfully")); |
2354 | } else { | 2362 | } else { |
2355 | setCaption(i18n("Error importing file")); | 2363 | setCaption(i18n("Error importing file")); |
2356 | } | 2364 | } |
2357 | } | 2365 | } |
2358 | } | 2366 | } |
2359 | 2367 | ||
2360 | void MainWindow::importIcal() | 2368 | void MainWindow::importIcal() |
2361 | { | 2369 | { |
2362 | 2370 | ||
2363 | QString fn =KOPrefs::instance()->mLastImportFile; | 2371 | QString fn =KOPrefs::instance()->mLastImportFile; |
2364 | 2372 | ||
2365 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2373 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2366 | if ( fn == "" ) | 2374 | if ( fn == "" ) |
2367 | return; | 2375 | return; |
2368 | importFile( fn, true ); | 2376 | importFile( fn, true ); |
2369 | 2377 | ||
2370 | } | 2378 | } |
2371 | 2379 | ||
2372 | void MainWindow::exportVCalendar() | 2380 | void MainWindow::exportVCalendar() |
2373 | { | 2381 | { |
2374 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2382 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2375 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2383 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2376 | if ( fn == "" ) | 2384 | if ( fn == "" ) |
2377 | return; | 2385 | return; |
2378 | QFileInfo info; | 2386 | QFileInfo info; |
2379 | info.setFile( fn ); | 2387 | info.setFile( fn ); |
2380 | QString mes; | 2388 | QString mes; |
2381 | bool createbup = true; | 2389 | bool createbup = true; |
2382 | if ( info. exists() ) { | 2390 | if ( info. exists() ) { |
2383 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2391 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2384 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2392 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2385 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2393 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2386 | 0, 1 ); | 2394 | 0, 1 ); |
2387 | if ( result != 0 ) { | 2395 | if ( result != 0 ) { |
2388 | createbup = false; | 2396 | createbup = false; |
2389 | } | 2397 | } |
2390 | } | 2398 | } |
2391 | if ( createbup ) { | 2399 | if ( createbup ) { |
2392 | if ( mView->exportVCalendar( fn ) ) { | 2400 | if ( mView->exportVCalendar( fn ) ) { |
2393 | KOPrefs::instance()->mLastVcalFile = fn; | 2401 | KOPrefs::instance()->mLastVcalFile = fn; |
2394 | if ( fn.length() > 20 ) | 2402 | if ( fn.length() > 20 ) |
2395 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2403 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2396 | else | 2404 | else |
2397 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2405 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2398 | setCaption(mes); | 2406 | setCaption(mes); |
2399 | } | 2407 | } |
2400 | } | 2408 | } |
2401 | 2409 | ||
2402 | } | 2410 | } |
2403 | QString MainWindow::sentSyncFile() | 2411 | QString MainWindow::sentSyncFile() |
2404 | { | 2412 | { |
2405 | #ifdef DESKTOP_VERSION | 2413 | #ifdef DESKTOP_VERSION |
2406 | return locateLocal( "tmp", "copysynccal.ics" ); | 2414 | return locateLocal( "tmp", "copysynccal.ics" ); |
2407 | #else | 2415 | #else |
2408 | return QString( "/tmp/copysynccal.ics" ); | 2416 | return QString( "/tmp/copysynccal.ics" ); |
2409 | #endif | 2417 | #endif |
2410 | } | 2418 | } |
2411 | 2419 | ||
2412 | void MainWindow::syncFileRequest() | 2420 | void MainWindow::syncFileRequest() |
2413 | { | 2421 | { |
2414 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2422 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2415 | mSyncManager->slotSyncMenu( 999 ); | 2423 | mSyncManager->slotSyncMenu( 999 ); |
2416 | } | 2424 | } |
2417 | 2425 | ||
2418 | setCaption(i18n("Saving Data to temp file ..." )); | 2426 | setCaption(i18n("Saving Data to temp file ..." )); |
2419 | mView->saveCalendar( sentSyncFile() ); | 2427 | mView->saveCalendar( sentSyncFile() ); |
2420 | setCaption(i18n("Data saved to temp file!" )); | 2428 | setCaption(i18n("Data saved to temp file!" )); |
2421 | 2429 | ||
2422 | } | 2430 | } |
2423 | void MainWindow::getFile( bool success ) | 2431 | void MainWindow::getFile( bool success ) |
2424 | { | 2432 | { |
2425 | if ( ! success ) { | 2433 | if ( ! success ) { |
2426 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2434 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2427 | return; | 2435 | return; |
2428 | } | 2436 | } |
2429 | mView->openCalendar( sentSyncFile() ); | 2437 | mView->openCalendar( sentSyncFile() ); |
2430 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2438 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2431 | mSyncManager->slotSyncMenu( 999 ); | 2439 | mSyncManager->slotSyncMenu( 999 ); |
2432 | } | 2440 | } |
2433 | setCaption( i18n("Pi-Sync successful!") ); | 2441 | setCaption( i18n("Pi-Sync successful!") ); |
2434 | } | 2442 | } |
2435 | void MainWindow::printListView() | 2443 | void MainWindow::printListView() |
2436 | { | 2444 | { |
2437 | 2445 | ||
2438 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); | 2446 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); |
2439 | 2447 | ||
2440 | KMessageBox::information( this, message); | 2448 | KMessageBox::information( this, message); |
2441 | } | 2449 | } |
2442 | void MainWindow::printSel( ) | 2450 | void MainWindow::printSel( ) |
2443 | { | 2451 | { |
2444 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2452 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2445 | } | 2453 | } |
2446 | 2454 | ||
2447 | void MainWindow::printCal() | 2455 | void MainWindow::printCal() |
2448 | { | 2456 | { |
2449 | mView->print();//mCp->showDialog(); | 2457 | mView->print();//mCp->showDialog(); |
2450 | } | 2458 | } |
2451 | 2459 | ||
2452 | 2460 | ||
2453 | #include "libkdepim/kdatepicker.h" | 2461 | #include "libkdepim/kdatepicker.h" |
2454 | #include <kdatetbl.h> | 2462 | #include <kdatetbl.h> |
2455 | 2463 | ||
2456 | void MainWindow::weekAction() | 2464 | void MainWindow::weekAction() |
2457 | { | 2465 | { |
2458 | int month; | 2466 | int month; |
2459 | KPopupFrame* popup = new KPopupFrame(this); | 2467 | KPopupFrame* popup = new KPopupFrame(this); |
2460 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2468 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2461 | // ----- | 2469 | // ----- |
2462 | picker->resize(picker->sizeHint()); | 2470 | picker->resize(picker->sizeHint()); |
2463 | popup->setMainWidget(picker); | 2471 | popup->setMainWidget(picker); |
2464 | picker->setFocus(); | 2472 | picker->setFocus(); |
2465 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2473 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2466 | int x = 0; | 2474 | int x = 0; |
2467 | int y = iconToolBar->height(); | 2475 | int y = iconToolBar->height(); |
2468 | int dX = 0; | 2476 | int dX = 0; |
2469 | int dY = 0; | 2477 | int dY = 0; |
2470 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2478 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2471 | if ( iconToolBar->y() > height()/2 ) { | 2479 | if ( iconToolBar->y() > height()/2 ) { |
2472 | dY = picker->sizeHint().height()+8; | 2480 | dY = picker->sizeHint().height()+8; |
2473 | y = 0; | 2481 | y = 0; |
2474 | } | 2482 | } |
2475 | } else { | 2483 | } else { |
2476 | if ( iconToolBar->x() > width()/2 ) { // right side | 2484 | if ( iconToolBar->x() > width()/2 ) { // right side |
2477 | x=0; | 2485 | x=0; |
2478 | dX= picker->sizeHint().width()+8; | 2486 | dX= picker->sizeHint().width()+8; |
2479 | y = 0; | 2487 | y = 0; |
2480 | } else { | 2488 | } else { |
2481 | x= iconToolBar->width(); | 2489 | x= iconToolBar->width(); |
2482 | y = 0; | 2490 | y = 0; |
2483 | } | 2491 | } |
2484 | } | 2492 | } |
2485 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2493 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2486 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2494 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2487 | { | 2495 | { |
2488 | month = picker->getResult(); | 2496 | month = picker->getResult(); |
2489 | emit selectWeek ( month ); | 2497 | emit selectWeek ( month ); |
2490 | //qDebug("weekSelected %d ", month); | 2498 | //qDebug("weekSelected %d ", month); |
2491 | } | 2499 | } |
2492 | delete popup; | 2500 | delete popup; |
2493 | } | 2501 | } |
2494 | 2502 | ||
2495 | void MainWindow::hideEvent ( QHideEvent * ) | 2503 | void MainWindow::hideEvent ( QHideEvent * ) |
2496 | { | 2504 | { |
2497 | QString message; | 2505 | QString message; |
2498 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2506 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2499 | if ( nextA.isValid() ) { | 2507 | if ( nextA.isValid() ) { |
2500 | QString sum = mCalendar->nextSummary(); | 2508 | QString sum = mCalendar->nextSummary(); |
2501 | 2509 | ||
2502 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2510 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2503 | setCaption( message ); | 2511 | setCaption( message ); |
2504 | } | 2512 | } |
2505 | } | 2513 | } |
2506 | 2514 | ||
2507 | void MainWindow::resizeEvent( QResizeEvent* e) | 2515 | void MainWindow::resizeEvent( QResizeEvent* e) |
2508 | { | 2516 | { |
2509 | #ifndef DESKTOP_VERSION | 2517 | #ifndef DESKTOP_VERSION |
2510 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { | 2518 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2511 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2519 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2512 | filterToolBar->hide(); | 2520 | filterToolBar->hide(); |
2513 | else | 2521 | else |
2514 | filterToolBar->show(); | 2522 | filterToolBar->show(); |
2515 | } | 2523 | } |
2516 | #endif | 2524 | #endif |
2517 | QMainWindow::resizeEvent( e); | 2525 | QMainWindow::resizeEvent( e); |
2518 | } | 2526 | } |