summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp9
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/kofilterview.cpp4
3 files changed, 11 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 5c88abd..6746de2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -375,378 +375,385 @@ void CalendarView::init()
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#ifdef DESKTOP_VERSION 449#ifdef DESKTOP_VERSION
450 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); 450 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
451 topLayout->addWidget( mDateScrollBar ); 451 topLayout->addWidget( mDateScrollBar );
452 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 452 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
453 if ( QApplication::desktop()->width() < 800 ) 453 if ( QApplication::desktop()->width() < 800 )
454 mDateScrollBar->hide(); 454 mDateScrollBar->hide();
455#endif 455#endif
456 //mainBoxLayout->addWidget (mLeftFrame); 456 //mainBoxLayout->addWidget (mLeftFrame);
457 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 457 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
458 "CalendarView::DateNavigator" ); 458 "CalendarView::DateNavigator" );
459#if 0 459#if 0
460 // FIXME 460 // FIXME
461 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 461 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
462 "CalendarView::DateNavigator", QDate::currentDate()); 462 "CalendarView::DateNavigator", QDate::currentDate());
463#endif 463#endif
464 // mDateNavigator->blockSignals( true ); 464 // mDateNavigator->blockSignals( true );
465 //leftFrameLayout->addWidget( mDateNavigator ); 465 //leftFrameLayout->addWidget( mDateNavigator );
466 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 466 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
467 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 467 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
468 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 468 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
469 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 469 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
470 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 470 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
471 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 471 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) );
472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
474 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 474 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
475 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 475 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
477 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); 477 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() ));
478 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 478 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
479 479
480 mTodoList->setNavigator( mNavigator ); 480 mTodoList->setNavigator( mNavigator );
481#if 0 481#if 0
482 if ( QApplication::desktop()->width() < 480 ) { 482 if ( QApplication::desktop()->width() < 480 ) {
483 leftFrameLayout->addWidget(mFilterView); 483 leftFrameLayout->addWidget(mFilterView);
484 leftFrameLayout->addWidget(mTodoList, 2 ); 484 leftFrameLayout->addWidget(mTodoList, 2 );
485 485
486 } else { 486 } else {
487 leftFrameLayout->addWidget(mTodoList,2 ); 487 leftFrameLayout->addWidget(mTodoList,2 );
488 leftFrameLayout->addWidget(mFilterView ); 488 leftFrameLayout->addWidget(mFilterView );
489 } 489 }
490#endif 490#endif
491 mFilterView->hide(); 491 mFilterView->hide();
492 mCalEditView->hide(); 492 mCalEditView->hide();
493 QWidget *rightBox = new QWidget( mMainFrame ); 493 QWidget *rightBox = new QWidget( mMainFrame );
494 //mainBoxLayout->addWidget ( rightBox, 10 ); 494 //mainBoxLayout->addWidget ( rightBox, 10 );
495 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 495 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
496 mRightFrame = new QWidgetStack( rightBox ); 496 mRightFrame = new QWidgetStack( rightBox );
497 rightLayout->addWidget( mRightFrame, 10 ); 497 rightLayout->addWidget( mRightFrame, 10 );
498 498
499 //mLeftFrame = (QWidget *)leftFrame; 499 //mLeftFrame = (QWidget *)leftFrame;
500 if ( KOPrefs::instance()->mVerticalScreen ) { 500 if ( KOPrefs::instance()->mVerticalScreen ) {
501 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 501 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
502 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 502 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
503 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 503 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
504 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 504 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
505 } else { 505 } else {
506 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 506 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
507 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
508 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 508 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
509 } 509 }
510 if ( !KOPrefs::instance()->mShowDateNavigator) 510 if ( !KOPrefs::instance()->mShowDateNavigator)
511 mDateNavigator->hide(); 511 mDateNavigator->hide();
512 //qDebug("Calendarview Size %d %d ", width(), height()); 512 //qDebug("Calendarview Size %d %d ", width(), height());
513#endif 513#endif
514 514
515 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 515 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
516 SLOT( showDates( const KCal::DateList & ) ) ); 516 SLOT( showDates( const KCal::DateList & ) ) );
517 517
518 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 518 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
519 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 519 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
520 520
521 521
522 522
523 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 523 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
524 mViewManager, SLOT( showMonth( const QDate & ) ) ); 524 mViewManager, SLOT( showMonth( const QDate & ) ) );
525 525
526 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 526 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
527 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 527 mNavigator, SLOT( selectWeek( const QDate & ) ) );
528 528
529 connect( mDateNavigator, SIGNAL( goPrevYear() ), 529 connect( mDateNavigator, SIGNAL( goPrevYear() ),
530 mNavigator, SLOT( selectPreviousYear() ) ); 530 mNavigator, SLOT( selectPreviousYear() ) );
531 connect( mDateNavigator, SIGNAL( goNextYear() ), 531 connect( mDateNavigator, SIGNAL( goNextYear() ),
532 mNavigator, SLOT( selectNextYear() ) ); 532 mNavigator, SLOT( selectNextYear() ) );
533 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 533 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
534 mNavigator, SLOT( selectPreviousMonth() ) ); 534 mNavigator, SLOT( selectPreviousMonth() ) );
535 connect( mDateNavigator, SIGNAL( goNextMonth() ), 535 connect( mDateNavigator, SIGNAL( goNextMonth() ),
536 mNavigator, SLOT( selectNextMonth() ) ); 536 mNavigator, SLOT( selectNextMonth() ) );
537 537
538 connect( mDateNavigator, SIGNAL( goPrevious() ), 538 connect( mDateNavigator, SIGNAL( goPrevious() ),
539 mNavigator, SLOT( selectPrevious() ) ); 539 mNavigator, SLOT( selectPrevious() ) );
540 connect( mDateNavigator, SIGNAL( goNext() ), 540 connect( mDateNavigator, SIGNAL( goNext() ),
541 mNavigator, SLOT( selectNext() ) ); 541 mNavigator, SLOT( selectNext() ) );
542 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 542 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
543 mNavigator, SLOT( slotMonthSelect( int ) ) ); 543 mNavigator, SLOT( slotMonthSelect( int ) ) );
544 544
545 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 545 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
546 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 546 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
547#if 0 547#if 0
548 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 548 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
549 SLOT( incidenceAdded( Incidence *) ) ); 549 SLOT( incidenceAdded( Incidence *) ) );
550#endif 550#endif
551 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 551 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
552 552
553 connect( this, SIGNAL( configChanged() ), 553 connect( this, SIGNAL( configChanged() ),
554 mDateNavigator, SLOT( updateConfig() ) ); 554 mDateNavigator, SLOT( updateConfig() ) );
555 555
556 connect( mTodoList, SIGNAL( newTodoSignal() ), 556 connect( mTodoList, SIGNAL( newTodoSignal() ),
557 SLOT( newTodo() ) ); 557 SLOT( newTodo() ) );
558 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 558 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
559 SLOT( newSubTodo( Todo * ) ) ); 559 SLOT( newSubTodo( Todo * ) ) );
560 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 560 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
561 SLOT( editTodo( Todo * ) ) ); 561 SLOT( editTodo( Todo * ) ) );
562 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 562 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
563 SLOT( showTodo( Todo *) ) ); 563 SLOT( showTodo( Todo *) ) );
564 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 564 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
565 SLOT( deleteTodo( Todo *) ) ); 565 SLOT( deleteTodo( Todo *) ) );
566 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 566 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
567 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 567 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
568 SLOT( purgeCompleted() ) ); 568 SLOT( purgeCompleted() ) );
569 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 569 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
570 SIGNAL( todoModified( Todo *, int ) ) ); 570 SIGNAL( todoModified( Todo *, int ) ) );
571 571
572 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 572 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
573 this, SLOT ( cloneIncidence( Incidence * ) ) ); 573 this, SLOT ( cloneIncidence( Incidence * ) ) );
574 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 574 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
575 this, SLOT (cancelIncidence( Incidence * ) ) ); 575 this, SLOT (cancelIncidence( Incidence * ) ) );
576 576
577 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 577 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
578 this, SLOT ( moveIncidence( Incidence * ) ) ); 578 this, SLOT ( moveIncidence( Incidence * ) ) );
579 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 579 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
580 this, SLOT ( beamIncidence( Incidence * ) ) ); 580 this, SLOT ( beamIncidence( Incidence * ) ) );
581 581
582 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 582 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
583 this, SLOT ( todo_unsub( Todo * ) ) ); 583 this, SLOT ( todo_unsub( Todo * ) ) );
584 584
585 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 585 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
586 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 586 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
587 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 587 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
588 SLOT( updateTodo( Todo *, int ) ) ); 588 SLOT( updateTodo( Todo *, int ) ) );
589 connect( this, SIGNAL( todoModified( Todo *, int )), this, 589 connect( this, SIGNAL( todoModified( Todo *, int )), this,
590 SLOT( changeTodoDisplay( Todo *, int ) ) ); 590 SLOT( changeTodoDisplay( Todo *, int ) ) );
591 591
592 592
593 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 593 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
594 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 594 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
595 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 595 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
596 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 596 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
597 597
598 598
599 599
600 600
601 601
602 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 602 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
603 SLOT(checkClipboard())); 603 SLOT(checkClipboard()));
604 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 604 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
605 SLOT( processTodoListSelection( Incidence * ) ) ); 605 SLOT( processTodoListSelection( Incidence * ) ) );
606 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 606 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
607 607
608 // kdDebug() << "CalendarView::CalendarView() done" << endl; 608 // kdDebug() << "CalendarView::CalendarView() done" << endl;
609 609
610 mDateFrame = new QVBox(0,0,WType_Popup); 610 mDateFrame = new QVBox(0,0,WType_Popup);
611 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 611 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
612 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 612 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
613 mDateFrame->setLineWidth(3); 613 mDateFrame->setLineWidth(3);
614 mDateFrame->hide(); 614 mDateFrame->hide();
615 mDateFrame->setCaption( i18n( "Pick a date to display")); 615 mDateFrame->setCaption( i18n( "Pick a date to display"));
616 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 616 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
617 617
618 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 618 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
619 619
620 mEventEditor = mDialogManager->getEventEditor(); 620 mEventEditor = mDialogManager->getEventEditor();
621 mTodoEditor = mDialogManager->getTodoEditor(); 621 mTodoEditor = mDialogManager->getTodoEditor();
622 622
623 mFlagEditDescription = false; 623 mFlagEditDescription = false;
624 624
625 mSuspendTimer = new QTimer( this ); 625 mSuspendTimer = new QTimer( this );
626 mAlarmTimer = new QTimer( this ); 626 mAlarmTimer = new QTimer( this );
627 mRecheckAlarmTimer = new QTimer( this ); 627 mRecheckAlarmTimer = new QTimer( this );
628 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 628 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
629 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 629 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
630 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 630 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
631 mAlarmDialog = new AlarmDialog( this ); 631 mAlarmDialog = new AlarmDialog( this );
632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
633 mAlarmDialog->setServerNotification( false ); 633 mAlarmDialog->setServerNotification( false );
634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
635 635
636 636
637#ifndef DESKTOP_VERSION 637#ifndef DESKTOP_VERSION
638//US listen for arriving address resultsets 638//US listen for arriving address resultsets
639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
641#endif 641#endif
642 mDateNavigator->setCalendar( mCalendar ); 642 mDateNavigator->setCalendar( mCalendar );
643} 643}
644 644
645 645
646CalendarView::~CalendarView() 646CalendarView::~CalendarView()
647{ 647{
648 // kdDebug() << "~CalendarView()" << endl; 648 // kdDebug() << "~CalendarView()" << endl;
649 //qDebug("CalendarView::~CalendarView() "); 649 //qDebug("CalendarView::~CalendarView() ");
650 delete mDialogManager; 650 delete mDialogManager;
651 delete mViewManager; 651 delete mViewManager;
652 delete mStorage; 652 delete mStorage;
653 delete mDateFrame ; 653 delete mDateFrame ;
654 delete mEventViewerDialog; 654 delete mEventViewerDialog;
655 //kdDebug() << "~CalendarView() done" << endl; 655 //kdDebug() << "~CalendarView() done" << endl;
656} 656}
657void CalendarView::setCalReadOnly( int id, bool readO )
658{
659 if ( readO ) {
660 emit save();
661 }
662 mCalendar->setReadOnly( id, readO );
663}
657void CalendarView::setScrollBarStep(int val ) 664void CalendarView::setScrollBarStep(int val )
658{ 665{
659#ifdef DESKTOP_VERSION 666#ifdef DESKTOP_VERSION
660 mDateScrollBar->setLineStep ( val ); 667 mDateScrollBar->setLineStep ( val );
661#endif 668#endif
662} 669}
663void CalendarView::scrollBarValue(int val ) 670void CalendarView::scrollBarValue(int val )
664{ 671{
665#ifdef DESKTOP_VERSION 672#ifdef DESKTOP_VERSION
666 if ( QApplication::desktop()->width() < 800 ) return; 673 if ( QApplication::desktop()->width() < 800 ) return;
667 static bool block = false; 674 static bool block = false;
668 if ( block ) return; 675 if ( block ) return;
669 block = true; 676 block = true;
670 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 677 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
671 //qDebug("VAL %d ",val ); 678 //qDebug("VAL %d ",val );
672 int count = mNavigator->selectedDates().count(); 679 int count = mNavigator->selectedDates().count();
673 int year = mNavigator->selectedDates().first().year(); 680 int year = mNavigator->selectedDates().first().year();
674 int day = mNavigator->selectedDates().first().dayOfYear(); 681 int day = mNavigator->selectedDates().first().dayOfYear();
675 if ( val == day -1 ) { 682 if ( val == day -1 ) {
676 block = false; 683 block = false;
677 return; 684 return;
678 } 685 }
679 QDate d ( year,1,1 ); 686 QDate d ( year,1,1 );
680 mNavigator->selectDates( d.addDays( val ), count ); 687 mNavigator->selectDates( d.addDays( val ), count );
681 block = false; 688 block = false;
682#endif 689#endif
683 690
684} 691}
685void CalendarView::checkFiles() 692void CalendarView::checkFiles()
686{ 693{
687 QString message; 694 QString message;
688 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 695 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
689 KopiCalendarFile * cal = calendars.first(); 696 KopiCalendarFile * cal = calendars.first();
690 while ( cal ) { 697 while ( cal ) {
691 if ( cal->mErrorOnLoad ) { 698 if ( cal->mErrorOnLoad ) {
692 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 699 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
693 } 700 }
694 cal = calendars.next(); 701 cal = calendars.next();
695 } 702 }
696 if ( !message.isEmpty() ) { 703 if ( !message.isEmpty() ) {
697 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 704 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
698 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 705 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
699 } 706 }
700 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 707 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
701} 708}
702void CalendarView::checkAlarms() 709void CalendarView::checkAlarms()
703{ 710{
704 711
705 712
706 KConfig *config = KOGlobals::config(); 713 KConfig *config = KOGlobals::config();
707 config->setGroup( "AppRun" ); 714 config->setGroup( "AppRun" );
708 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 715 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
709 int daysto = dt.daysTo( QDate::currentDate() ); 716 int daysto = dt.daysTo( QDate::currentDate() );
710 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 717 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
711 dt = dt.addDays( days ); 718 dt = dt.addDays( days );
712 int secto = dt.secsTo( QDateTime::currentDateTime() ); 719 int secto = dt.secsTo( QDateTime::currentDateTime() );
713 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 720 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
714 //qDebug("KO: Reading program stop %d ", secs); 721 //qDebug("KO: Reading program stop %d ", secs);
715 //secs -= ( 3600 * 24*3 ); // debug only 722 //secs -= ( 3600 * 24*3 ); // debug only
716 QDateTime latest = dt.addSecs ( secs ); 723 QDateTime latest = dt.addSecs ( secs );
717 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 724 qDebug("KO: Last termination on %s ", latest.toString().latin1());
718 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 725 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
719 QPtrList<Incidence> el = mCalendar->rawIncidences(); 726 QPtrList<Incidence> el = mCalendar->rawIncidences();
720 QPtrList<Incidence> al; 727 QPtrList<Incidence> al;
721 Incidence* inL = el.first(); 728 Incidence* inL = el.first();
722 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 729 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
723 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 730 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
724 while ( inL ) { 731 while ( inL ) {
725 bool ok = false; 732 bool ok = false;
726 int offset = 0; 733 int offset = 0;
727 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 734 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
728 if ( ok ) { 735 if ( ok ) {
729 //qDebug("OK %s",next.toString().latin1()); 736 //qDebug("OK %s",next.toString().latin1());
730 if ( next < cur ) { 737 if ( next < cur ) {
731 al.append( inL ); 738 al.append( inL );
732 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 739 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
733 } 740 }
734 } 741 }
735 inL = el.next(); 742 inL = el.next();
736 } 743 }
737 if ( al.count() ) { 744 if ( al.count() ) {
738 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 745 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
739 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 746 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
740 QVBoxLayout* lay = new QVBoxLayout( dia ); 747 QVBoxLayout* lay = new QVBoxLayout( dia );
741 lay->setSpacing( 0 ); 748 lay->setSpacing( 0 );
742 lay->setMargin( 0 ); 749 lay->setMargin( 0 );
743 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 750 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
744 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 751 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
745 lay->addWidget( matb ); 752 lay->addWidget( matb );
746 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 753 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
747 int wid = 210; 754 int wid = 210;
748 int x = QApplication::desktop()->width() - wid - 7; 755 int x = QApplication::desktop()->width() - wid - 7;
749 int y = QApplication::desktop()->height() - wid - 70; 756 int y = QApplication::desktop()->height() - wid - 70;
750 dia->setGeometry ( x,y,wid,wid); 757 dia->setGeometry ( x,y,wid,wid);
751 } else { 758 } else {
752 int si = 220; 759 int si = 220;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 651194b..a5f230a 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -107,192 +107,193 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 /** 109 /**
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm(); 140 void checkSuspendAlarm();
141 141
142 signals: 142 signals:
143 void save (); 143 void save ();
144 void saveStopTimer (); 144 void saveStopTimer ();
145 void tempDisableBR(bool); 145 void tempDisableBR(bool);
146 /** This todo has been modified */ 146 /** This todo has been modified */
147 void todoModified(Todo *, int); 147 void todoModified(Todo *, int);
148 148
149 /** when change is made to options dialog, the topwidget will catch this 149 /** when change is made to options dialog, the topwidget will catch this
150 * and emit this signal which notifies all widgets which have registered 150 * and emit this signal which notifies all widgets which have registered
151 * for notification to update their settings. */ 151 * for notification to update their settings. */
152 void configChanged(); 152 void configChanged();
153 /** emitted when the topwidget is closing down, so that any attached 153 /** emitted when the topwidget is closing down, so that any attached
154 child windows can also close. */ 154 child windows can also close. */
155 void closingDown(); 155 void closingDown();
156 /** emitted right before we die */ 156 /** emitted right before we die */
157 void closed(QWidget *); 157 void closed(QWidget *);
158 158
159 /** Emitted when state of modified flag changes */ 159 /** Emitted when state of modified flag changes */
160 void modifiedChanged(bool); 160 void modifiedChanged(bool);
161 void signalmodified(); 161 void signalmodified();
162 162
163 /** Emitted when state of read-only flag changes */ 163 /** Emitted when state of read-only flag changes */
164 void readOnlyChanged(bool); 164 void readOnlyChanged(bool);
165 165
166 /** Emitted when the unit of navigation changes */ 166 /** Emitted when the unit of navigation changes */
167 void changeNavStringPrev(const QString &); 167 void changeNavStringPrev(const QString &);
168 void changeNavStringNext(const QString &); 168 void changeNavStringNext(const QString &);
169 169
170 /** Emitted when state of events selection has changed and user is organizer*/ 170 /** Emitted when state of events selection has changed and user is organizer*/
171 void organizerEventsSelected(bool); 171 void organizerEventsSelected(bool);
172 /** Emitted when state of events selection has changed and user is attendee*/ 172 /** Emitted when state of events selection has changed and user is attendee*/
173 void groupEventsSelected(bool); 173 void groupEventsSelected(bool);
174 /** 174 /**
175 Emitted when an incidence gets selected. If the selection is cleared the 175 Emitted when an incidence gets selected. If the selection is cleared the
176 signal is emitted with 0 as argument. 176 signal is emitted with 0 as argument.
177 */ 177 */
178 void incidenceSelected( Incidence * ); 178 void incidenceSelected( Incidence * );
179 /** Emitted, when a todoitem is selected or deselected. */ 179 /** Emitted, when a todoitem is selected or deselected. */
180 void todoSelected( bool ); 180 void todoSelected( bool );
181 181
182 /** 182 /**
183 Emitted, when clipboard content changes. Parameter indicates if paste 183 Emitted, when clipboard content changes. Parameter indicates if paste
184 is possible or not. 184 is possible or not.
185 */ 185 */
186 void pasteEnabled(bool); 186 void pasteEnabled(bool);
187 187
188 /** Emitted, when the number of incoming messages has changed. */ 188 /** Emitted, when the number of incoming messages has changed. */
189 void numIncomingChanged(int); 189 void numIncomingChanged(int);
190 190
191 /** Emitted, when the number of outgoing messages has changed. */ 191 /** Emitted, when the number of outgoing messages has changed. */
192 void numOutgoingChanged(int); 192 void numOutgoingChanged(int);
193 193
194 /** Send status message, which can e.g. be displayed in the status bar. */ 194 /** Send status message, which can e.g. be displayed in the status bar. */
195 void statusMessage(const QString &); 195 void statusMessage(const QString &);
196 196
197 void calendarViewExpanded( bool ); 197 void calendarViewExpanded( bool );
198 void updateSearchDialog(); 198 void updateSearchDialog();
199 void filtersUpdated(); 199 void filtersUpdated();
200 200
201 201
202 public slots: 202 public slots:
203 void setCalReadOnly( int id, bool readO );
203 void checkAlarms(); 204 void checkAlarms();
204 void checkFiles(); 205 void checkFiles();
205 void slotprintSelInc(); 206 void slotprintSelInc();
206 void showNextAlarms(); 207 void showNextAlarms();
207 void showOpenError(); 208 void showOpenError();
208 void watchSavedFile(); 209 void watchSavedFile();
209 void recheckTimerAlarm(); 210 void recheckTimerAlarm();
210 void checkNextTimerAlarm(); 211 void checkNextTimerAlarm();
211 void addAlarm(const QDateTime &qdt, const QString &noti ); 212 void addAlarm(const QDateTime &qdt, const QString &noti );
212 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 213 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
213 void removeAlarm(const QDateTime &qdt, const QString &noti ); 214 void removeAlarm(const QDateTime &qdt, const QString &noti );
214 215
215 /** options dialog made a changed to the configuration. we catch this 216 /** options dialog made a changed to the configuration. we catch this
216 * and notify all widgets which need to update their configuration. */ 217 * and notify all widgets which need to update their configuration. */
217 void updateConfig(); 218 void updateConfig();
218 219
219 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 220 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
220 const QStringList& anniversaryList, const QStringList& realNameList, 221 const QStringList& anniversaryList, const QStringList& realNameList,
221 const QStringList& emailList, const QStringList& assembledNameList, 222 const QStringList& emailList, const QStringList& assembledNameList,
222 const QStringList& uidList); 223 const QStringList& uidList);
223 224
224 /** 225 /**
225 Load calendar from file \a filename. If \a merge is true, load 226 Load calendar from file \a filename. If \a merge is true, load
226 calendar into existing one, if it is false, clear calendar, before 227 calendar into existing one, if it is false, clear calendar, before
227 loading. Return true, if calendar could be successfully loaded. 228 loading. Return true, if calendar could be successfully loaded.
228 */ 229 */
229 bool openCalendar(QString filename, bool merge=false); 230 bool openCalendar(QString filename, bool merge=false);
230 bool loadCalendars(); 231 bool loadCalendars();
231 bool saveCalendars(); 232 bool saveCalendars();
232 bool restoreCalendarSettings(); 233 bool restoreCalendarSettings();
233 bool addCalendar( KopiCalendarFile * ); 234 bool addCalendar( KopiCalendarFile * );
234 void addCalendarId( int id ); 235 void addCalendarId( int id );
235 bool syncCalendar(QString filename,int mode = 0 ); 236 bool syncCalendar(QString filename,int mode = 0 );
236 237
237 /** 238 /**
238 Save calendar data to file. Return true if calendar could be 239 Save calendar data to file. Return true if calendar could be
239 successfully saved. 240 successfully saved.
240 */ 241 */
241 bool saveCalendar(QString filename); 242 bool saveCalendar(QString filename);
242 243
243 /** 244 /**
244 Close calendar. Clear calendar data and reset views to display an empty 245 Close calendar. Clear calendar data and reset views to display an empty
245 calendar. 246 calendar.
246 */ 247 */
247 void closeCalendar(); 248 void closeCalendar();
248 249
249 /** Archive old events of calendar */ 250 /** Archive old events of calendar */
250 void archiveCalendar(); 251 void archiveCalendar();
251 252
252 void showIncidence(); 253 void showIncidence();
253 void editIncidence(); 254 void editIncidence();
254 void editIncidenceDescription(); 255 void editIncidenceDescription();
255 void deleteIncidence(); 256 void deleteIncidence();
256 void cloneIncidence(); 257 void cloneIncidence();
257 void moveIncidence(); 258 void moveIncidence();
258 void beamIncidence(); 259 void beamIncidence();
259 void toggleCancelIncidence(); 260 void toggleCancelIncidence();
260 261
261 /** create an editeventwin with supplied date/time, and if bool is true, 262 /** create an editeventwin with supplied date/time, and if bool is true,
262 * make the event take all day. */ 263 * make the event take all day. */
263 void newEvent(QDateTime, QDateTime, bool allDay ); 264 void newEvent(QDateTime, QDateTime, bool allDay );
264 void newEvent(QDateTime, QDateTime); 265 void newEvent(QDateTime, QDateTime);
265 void newEvent(QDateTime fh); 266 void newEvent(QDateTime fh);
266 void newEvent(QDate dt); 267 void newEvent(QDate dt);
267 /** create new event without having a date hint. Takes current date as 268 /** create new event without having a date hint. Takes current date as
268 default hint. */ 269 default hint. */
269 void newEvent(); 270 void newEvent();
270 void newFloatingEvent(); 271 void newFloatingEvent();
271 272
272 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 273 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
273 void showIncidence(Incidence *); 274 void showIncidence(Incidence *);
274 void showIncidence(QString uid); 275 void showIncidence(QString uid);
275 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 276 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
276 void editIncidence(Incidence *); 277 void editIncidence(Incidence *);
277 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 278 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
278 void deleteIncidence(Incidence *); 279 void deleteIncidence(Incidence *);
279 void cloneIncidence(Incidence *); 280 void cloneIncidence(Incidence *);
280 void cancelIncidence(Incidence *); 281 void cancelIncidence(Incidence *);
281 /** Create an editor for the supplied event. */ 282 /** Create an editor for the supplied event. */
282 void editEvent(Event *); 283 void editEvent(Event *);
283 /** Delete the supplied event. */ 284 /** Delete the supplied event. */
284 void deleteEvent(Event *); 285 void deleteEvent(Event *);
285 /** Delete the event with the given unique ID. Returns false, if event wasn't 286 /** Delete the event with the given unique ID. Returns false, if event wasn't
286 found. */ 287 found. */
287 bool deleteEvent(const QString &uid); 288 bool deleteEvent(const QString &uid);
288 /** Create a read-only viewer dialog for the supplied event. */ 289 /** Create a read-only viewer dialog for the supplied event. */
289 void showEvent(Event *); 290 void showEvent(Event *);
290 291
291 void editJournal(Journal *); 292 void editJournal(Journal *);
292 void showJournal(Journal *); 293 void showJournal(Journal *);
293 void deleteJournal(Journal *); 294 void deleteJournal(Journal *);
294 /** Create an editor dialog for a todo */ 295 /** Create an editor dialog for a todo */
295 void editTodo(Todo *); 296 void editTodo(Todo *);
296 /** Create a read-only viewer dialog for the supplied todo */ 297 /** Create a read-only viewer dialog for the supplied todo */
297 void showTodo(Todo *); 298 void showTodo(Todo *);
298 /** create new todo */ 299 /** create new todo */
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 1335d7e..3f08ef8 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -64,209 +64,209 @@ bool KOFilterView::filtersEnabled()
64{ 64{
65 return mEnabledCheck->isChecked(); 65 return mEnabledCheck->isChecked();
66} 66}
67 67
68void KOFilterView::setFiltersEnabled(bool set) 68void KOFilterView::setFiltersEnabled(bool set)
69{ 69{
70 mEnabledCheck->setChecked(set); 70 mEnabledCheck->setChecked(set);
71 emit filterChanged(); 71 emit filterChanged();
72} 72}
73 73
74 74
75void KOFilterView::updateFilters() 75void KOFilterView::updateFilters()
76{ 76{
77 mSelectionCombo->clear(); 77 mSelectionCombo->clear();
78 78
79 CalFilter *filter = mFilters->first(); 79 CalFilter *filter = mFilters->first();
80 while(filter) { 80 while(filter) {
81 mSelectionCombo->insertItem(filter->name()); 81 mSelectionCombo->insertItem(filter->name());
82 filter = mFilters->next(); 82 filter = mFilters->next();
83 } 83 }
84} 84}
85 85
86CalFilter *KOFilterView::selectedFilter() 86CalFilter *KOFilterView::selectedFilter()
87{ 87{
88 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 88 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
89 return f; 89 return f;
90} 90}
91 91
92void KOFilterView::setSelectedFilter(QString filterName) 92void KOFilterView::setSelectedFilter(QString filterName)
93{ 93{
94 int filter_num = mSelectionCombo->count(); 94 int filter_num = mSelectionCombo->count();
95 int i; 95 int i;
96 for (i=0;i<filter_num;i++) { 96 for (i=0;i<filter_num;i++) {
97 if (mSelectionCombo->text(i)==filterName) 97 if (mSelectionCombo->text(i)==filterName)
98 mSelectionCombo->setCurrentItem(i); 98 mSelectionCombo->setCurrentItem(i);
99 } 99 }
100 emit filterChanged(); 100 emit filterChanged();
101} 101}
102void KOFilterView::setSelectedFilter( int fil ) 102void KOFilterView::setSelectedFilter( int fil )
103{ 103{
104 if ( fil >= mSelectionCombo->count() ) 104 if ( fil >= mSelectionCombo->count() )
105 return; 105 return;
106 mSelectionCombo->setCurrentItem( fil ); 106 mSelectionCombo->setCurrentItem( fil );
107 emit filterChanged(); 107 emit filterChanged();
108} 108}
109 109
110 110
111 111
112KOCalEditView::KOCalEditView(QWidget* parent, 112KOCalEditView::KOCalEditView(QWidget* parent,
113 const char* name ) 113 const char* name )
114 : QScrollView(parent,name) 114 : QScrollView(parent,name)
115{ 115{
116 mw = 0; 116 mw = 0;
117 setResizePolicy( AutoOneFit ); 117 setResizePolicy( AutoOneFit );
118 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 118 setFrameStyle ( QFrame::Panel | QFrame::Plain );
119 setLineWidth ( 1 ); 119 setLineWidth ( 1 );
120 setMidLineWidth ( 1 ); 120 setMidLineWidth ( 1 );
121 setFocusPolicy(NoFocus); 121 setFocusPolicy(NoFocus);
122} 122}
123 123
124KOCalEditView::~KOCalEditView() 124KOCalEditView::~KOCalEditView()
125{ 125{
126 // no need to delete child widgets, Qt does it all for us 126 // no need to delete child widgets, Qt does it all for us
127} 127}
128void KOCalEditView::selectCal(int id ,bool b) 128void KOCalEditView::selectCal(int id ,bool b)
129{ 129{
130 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 130 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
131 emit calendarEnabled ( id, b ); 131 emit calendarEnabled ( id, b );
132 emit needsUpdate(); 132 emit needsUpdate();
133 133
134} 134}
135void KOCalEditView::selectStdCal( int id ) 135void KOCalEditView::selectStdCal( int id )
136{ 136{
137 KOCalRadioButton* it = mStdandardB.first(); 137 KOCalRadioButton* it = mStdandardB.first();
138 while ( it ) { 138 while ( it ) {
139 it->blockSignals( true ); 139 it->blockSignals( true );
140 it->setChecked( it->num() == id ); 140 it->setChecked( it->num() == id );
141 it->blockSignals( false ); 141 it->blockSignals( false );
142 it = mStdandardB.next(); 142 it = mStdandardB.next();
143 } 143 }
144 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 144 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
145 while ( kkf ) { 145 while ( kkf ) {
146 kkf->isStandard = (kkf->mCalNumber == id ); 146 kkf->isStandard = (kkf->mCalNumber == id );
147 kkf = KOPrefs::instance()->mCalendars.next(); 147 kkf = KOPrefs::instance()->mCalendars.next();
148 } 148 }
149 emit setCalendarDefault ( id ); 149 emit setCalendarDefault ( id );
150} 150}
151 151
152void KOCalEditView::selectCalAlarm(int id ,bool b ) 152void KOCalEditView::selectCalAlarm(int id ,bool b )
153{ 153{
154 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 154 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
155 emit alarmEnabled ( id , b ); 155 emit alarmEnabled ( id , b );
156 emit needsUpdate(); 156 emit needsUpdate();
157} 157}
158void KOCalEditView::selectReadOnly(int id ,bool b ) 158void KOCalEditView::selectReadOnly(int id ,bool b )
159{ 159{
160 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
161 emit calendarReadonly ( id , b );
162 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) { 160 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) {
163 findNewStandard(); 161 findNewStandard();
164 } else { 162 } else {
165 if ( !b ){ 163 if ( !b ){
166 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 164 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
167 while ( kkf ) { 165 while ( kkf ) {
168 if (kkf->isReadOnly && kkf->isStandard ) { 166 if (kkf->isReadOnly && kkf->isStandard ) {
169 selectStdCal( id ); 167 selectStdCal( id );
170 break; 168 break;
171 } 169 }
172 kkf = KOPrefs::instance()->mCalendars.next(); 170 kkf = KOPrefs::instance()->mCalendars.next();
173 } 171 }
174 } 172 }
175 } 173 }
176 mStdandardB.at(id-1)->setEnabled( !b ); 174 mStdandardB.at(id-1)->setEnabled( !b );
175 emit calendarReadonly ( id , b );
176 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
177 emit needsUpdate(); 177 emit needsUpdate();
178 178
179} 179}
180void KOCalEditView::findNewStandard() 180void KOCalEditView::findNewStandard()
181{ 181{
182 bool found = false; 182 bool found = false;
183 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 183 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
184 while ( kkf ) { 184 while ( kkf ) {
185 if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) { 185 if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) {
186 found = true; 186 found = true;
187 selectStdCal( kkf->mCalNumber ); 187 selectStdCal( kkf->mCalNumber );
188 break; 188 break;
189 } 189 }
190 kkf = KOPrefs::instance()->mCalendars.next(); 190 kkf = KOPrefs::instance()->mCalendars.next();
191 } 191 }
192 if ( !found ) { 192 if ( !found ) {
193 KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"), 193 KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"),
194 i18n("Houston, we have a problem!") ); 194 i18n("Houston, we have a problem!") );
195 195
196 } 196 }
197} 197}
198 198
199void KOCalEditView::setColor( const QColor& c, int id ) 199void KOCalEditView::setColor( const QColor& c, int id )
200{ 200{
201 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 201 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
202 emit needsUpdate(); 202 emit needsUpdate();
203} 203}
204void KOCalEditView::deleteCal( int id ) 204void KOCalEditView::deleteCal( int id )
205{ 205{
206 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 206 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
207 QString name = kkf->mName; 207 QString name = kkf->mName;
208 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); 208 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 );
209 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 209 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
210 bool findnewstd = kkf->isStandard; 210 bool findnewstd = kkf->isStandard;
211 emit removeCalendar ( id ); 211 emit removeCalendar ( id );
212 KOPrefs::instance()->mCalendars.remove ( kkf ); 212 KOPrefs::instance()->mCalendars.remove ( kkf );
213 if ( findnewstd ) findNewStandard(); 213 if ( findnewstd ) findNewStandard();
214 emit needsUpdate(); 214 emit needsUpdate();
215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
216} 216}
217void KOCalEditView::infoCal( int id ) 217void KOCalEditView::infoCal( int id )
218{ 218{
219 QString name = KOPrefs::instance()->getCalendar( id )->mName; 219 QString name = KOPrefs::instance()->getCalendar( id )->mName;
220 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); 220 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
221 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 221 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
222 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) ) ) { 222 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) ) ) {
223 emit calendarAdded( id ); 223 emit calendarAdded( id );
224 emit needsUpdate(); 224 emit needsUpdate();
225 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 225 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
226 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); 226 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
227 } 227 }
228 } 228 }
229 else 229 else
230 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 230 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
231} 231}
232void KOCalEditView::readConfig() 232void KOCalEditView::readConfig()
233{ 233{
234 234
235 mStdandardB.clear(); 235 mStdandardB.clear();
236 mEnabledB.clear(); 236 mEnabledB.clear();
237 mAlarmB.clear(); 237 mAlarmB.clear();
238 mROB.clear(); 238 mROB.clear();
239 239
240 if ( mw ) delete mw; 240 if ( mw ) delete mw;
241 mw = new QWidget ( viewport() ); 241 mw = new QWidget ( viewport() );
242 addChild(mw); 242 addChild(mw);
243 int ii = 0; 243 int ii = 0;
244 mainLayout = new QGridLayout ( mw , 2, 8 ); 244 mainLayout = new QGridLayout ( mw , 2, 8 );
245 mainLayout->setMargin( 2 ); 245 mainLayout->setMargin( 2 );
246 mainLayout->setSpacing( 2 ); 246 mainLayout->setSpacing( 2 );
247 QPushButton * addBut = new QPushButton ( mw ); 247 QPushButton * addBut = new QPushButton ( mw );
248 addBut->setFocusPolicy(NoFocus); 248 addBut->setFocusPolicy(NoFocus);
249 mainLayout->addWidget( addBut,0,0 ); 249 mainLayout->addWidget( addBut,0,0 );
250 addBut->setText( "D"); 250 addBut->setText( "D");
251 connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo())); 251 connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo()));
252 //addBut->setPixmap ( SmallIcon("greenhook16")); 252 //addBut->setPixmap ( SmallIcon("greenhook16"));
253 addBut->setMaximumWidth( addBut->sizeHint().height() ); 253 addBut->setMaximumWidth( addBut->sizeHint().height() );
254 int max = addBut->sizeHint().height(); 254 int max = addBut->sizeHint().height();
255 addBut = new QPushButton ( mw ); 255 addBut = new QPushButton ( mw );
256 addBut->setFocusPolicy(NoFocus); 256 addBut->setFocusPolicy(NoFocus);
257 mainLayout->addWidget( addBut,0,++ii ); 257 mainLayout->addWidget( addBut,0,++ii );
258 addBut->setPixmap ( SmallIcon("eye")); 258 addBut->setPixmap ( SmallIcon("eye"));
259 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 259 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
260 addBut->setMaximumWidth( addBut->sizeHint().height() ); 260 addBut->setMaximumWidth( addBut->sizeHint().height() );
261 261
262 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 262 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
263 mainLayout->addWidget( lab,0,++ii ); 263 mainLayout->addWidget( lab,0,++ii );
264 //lab = new QLabel ( i18n(" "), mw ); 264 //lab = new QLabel ( i18n(" "), mw );
265 //mainLayout->addWidget( lab,0,++ii ); 265 //mainLayout->addWidget( lab,0,++ii );
266 //lab->setFixedWidth( 1 ); 266 //lab->setFixedWidth( 1 );
267 addBut = new QPushButton ( mw ); 267 addBut = new QPushButton ( mw );
268 addBut->setFocusPolicy(NoFocus); 268 addBut->setFocusPolicy(NoFocus);
269 mainLayout->addWidget( addBut,0,++ii ); 269 mainLayout->addWidget( addBut,0,++ii );
270 addBut->setPixmap ( SmallIcon("bell")); 270 addBut->setPixmap ( SmallIcon("bell"));
271 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 271 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
272 addBut->setMaximumWidth( addBut->sizeHint().height() ); 272 addBut->setMaximumWidth( addBut->sizeHint().height() );