summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-01 18:39:59 (UTC)
committer zautrix <zautrix>2005-07-01 18:39:59 (UTC)
commitc53efbe8f53f468d21d93f5e19b625d1a4beb242 (patch) (unidiff)
treef8fe2180733b6bd3514c02845cefa9f26e967e27 /korganizer
parent98d29d15275c4b8e9a3348742925f6e6d03f7a07 (diff)
downloadkdepimpi-c53efbe8f53f468d21d93f5e19b625d1a4beb242.zip
kdepimpi-c53efbe8f53f468d21d93f5e19b625d1a4beb242.tar.gz
kdepimpi-c53efbe8f53f468d21d93f5e19b625d1a4beb242.tar.bz2
fixxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp15
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/kofilterview.cpp2
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/mainwindow.cpp7
5 files changed, 16 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 70a1d2d..678143d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -381,192 +381,193 @@ void CalendarView::init()
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) ),mCalendar, SLOT( setReadOnly(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( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 478 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
478 479
479 mTodoList->setNavigator( mNavigator ); 480 mTodoList->setNavigator( mNavigator );
480#if 0 481#if 0
481 if ( QApplication::desktop()->width() < 480 ) { 482 if ( QApplication::desktop()->width() < 480 ) {
482 leftFrameLayout->addWidget(mFilterView); 483 leftFrameLayout->addWidget(mFilterView);
483 leftFrameLayout->addWidget(mTodoList, 2 ); 484 leftFrameLayout->addWidget(mTodoList, 2 );
484 485
485 } else { 486 } else {
486 leftFrameLayout->addWidget(mTodoList,2 ); 487 leftFrameLayout->addWidget(mTodoList,2 );
487 leftFrameLayout->addWidget(mFilterView ); 488 leftFrameLayout->addWidget(mFilterView );
488 } 489 }
489#endif 490#endif
490 mFilterView->hide(); 491 mFilterView->hide();
491 mCalEditView->hide(); 492 mCalEditView->hide();
492 QWidget *rightBox = new QWidget( mMainFrame ); 493 QWidget *rightBox = new QWidget( mMainFrame );
493 //mainBoxLayout->addWidget ( rightBox, 10 ); 494 //mainBoxLayout->addWidget ( rightBox, 10 );
494 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 495 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
495 mRightFrame = new QWidgetStack( rightBox ); 496 mRightFrame = new QWidgetStack( rightBox );
496 rightLayout->addWidget( mRightFrame, 10 ); 497 rightLayout->addWidget( mRightFrame, 10 );
497 498
498 //mLeftFrame = (QWidget *)leftFrame; 499 //mLeftFrame = (QWidget *)leftFrame;
499 if ( KOPrefs::instance()->mVerticalScreen ) { 500 if ( KOPrefs::instance()->mVerticalScreen ) {
500 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 501 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
501 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 502 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
502 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 503 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
503 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 504 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
504 } else { 505 } else {
505 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 506 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
506 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
507 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 508 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
508 } 509 }
509 if ( !KOPrefs::instance()->mShowDateNavigator) 510 if ( !KOPrefs::instance()->mShowDateNavigator)
510 mDateNavigator->hide(); 511 mDateNavigator->hide();
511 //qDebug("Calendarview Size %d %d ", width(), height()); 512 //qDebug("Calendarview Size %d %d ", width(), height());
512#endif 513#endif
513 514
514 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 515 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
515 SLOT( showDates( const KCal::DateList & ) ) ); 516 SLOT( showDates( const KCal::DateList & ) ) );
516 517
517 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 518 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
518 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 519 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
519 520
520 521
521 522
522 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 523 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
523 mViewManager, SLOT( showMonth( const QDate & ) ) ); 524 mViewManager, SLOT( showMonth( const QDate & ) ) );
524 525
525 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 526 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
526 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 527 mNavigator, SLOT( selectWeek( const QDate & ) ) );
527 528
528 connect( mDateNavigator, SIGNAL( goPrevYear() ), 529 connect( mDateNavigator, SIGNAL( goPrevYear() ),
529 mNavigator, SLOT( selectPreviousYear() ) ); 530 mNavigator, SLOT( selectPreviousYear() ) );
530 connect( mDateNavigator, SIGNAL( goNextYear() ), 531 connect( mDateNavigator, SIGNAL( goNextYear() ),
531 mNavigator, SLOT( selectNextYear() ) ); 532 mNavigator, SLOT( selectNextYear() ) );
532 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 533 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
533 mNavigator, SLOT( selectPreviousMonth() ) ); 534 mNavigator, SLOT( selectPreviousMonth() ) );
534 connect( mDateNavigator, SIGNAL( goNextMonth() ), 535 connect( mDateNavigator, SIGNAL( goNextMonth() ),
535 mNavigator, SLOT( selectNextMonth() ) ); 536 mNavigator, SLOT( selectNextMonth() ) );
536 537
537 connect( mDateNavigator, SIGNAL( goPrevious() ), 538 connect( mDateNavigator, SIGNAL( goPrevious() ),
538 mNavigator, SLOT( selectPrevious() ) ); 539 mNavigator, SLOT( selectPrevious() ) );
539 connect( mDateNavigator, SIGNAL( goNext() ), 540 connect( mDateNavigator, SIGNAL( goNext() ),
540 mNavigator, SLOT( selectNext() ) ); 541 mNavigator, SLOT( selectNext() ) );
541 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 542 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
542 mNavigator, SLOT( slotMonthSelect( int ) ) ); 543 mNavigator, SLOT( slotMonthSelect( int ) ) );
543 544
544 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 545 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
545 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 546 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
546#if 0 547#if 0
547 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 548 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
548 SLOT( incidenceAdded( Incidence *) ) ); 549 SLOT( incidenceAdded( Incidence *) ) );
549#endif 550#endif
550 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 551 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
551 552
552 connect( this, SIGNAL( configChanged() ), 553 connect( this, SIGNAL( configChanged() ),
553 mDateNavigator, SLOT( updateConfig() ) ); 554 mDateNavigator, SLOT( updateConfig() ) );
554 555
555 connect( mTodoList, SIGNAL( newTodoSignal() ), 556 connect( mTodoList, SIGNAL( newTodoSignal() ),
556 SLOT( newTodo() ) ); 557 SLOT( newTodo() ) );
557 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 558 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
558 SLOT( newSubTodo( Todo * ) ) ); 559 SLOT( newSubTodo( Todo * ) ) );
559 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 560 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
560 SLOT( editTodo( Todo * ) ) ); 561 SLOT( editTodo( Todo * ) ) );
561 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 562 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
562 SLOT( showTodo( Todo *) ) ); 563 SLOT( showTodo( Todo *) ) );
563 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 564 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
564 SLOT( deleteTodo( Todo *) ) ); 565 SLOT( deleteTodo( Todo *) ) );
565 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 566 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
566 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 567 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
567 SLOT( purgeCompleted() ) ); 568 SLOT( purgeCompleted() ) );
568 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 569 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
569 SIGNAL( todoModified( Todo *, int ) ) ); 570 SIGNAL( todoModified( Todo *, int ) ) );
570 571
571 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 572 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
572 this, SLOT ( cloneIncidence( Incidence * ) ) ); 573 this, SLOT ( cloneIncidence( Incidence * ) ) );
@@ -588,209 +589,213 @@ void CalendarView::init()
588 connect( this, SIGNAL( todoModified( Todo *, int )), this, 589 connect( this, SIGNAL( todoModified( Todo *, int )), this,
589 SLOT( changeTodoDisplay( Todo *, int ) ) ); 590 SLOT( changeTodoDisplay( Todo *, int ) ) );
590 591
591 592
592 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 593 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
593 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 594 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
594 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 & ) ) );
595 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 & ) ) );
596 597
597 598
598 599
599 600
600 601
601 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 602 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
602 SLOT(checkClipboard())); 603 SLOT(checkClipboard()));
603 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 604 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
604 SLOT( processTodoListSelection( Incidence * ) ) ); 605 SLOT( processTodoListSelection( Incidence * ) ) );
605 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 606 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
606 607
607 // kdDebug() << "CalendarView::CalendarView() done" << endl; 608 // kdDebug() << "CalendarView::CalendarView() done" << endl;
608 609
609 mDateFrame = new QVBox(0,0,WType_Popup); 610 mDateFrame = new QVBox(0,0,WType_Popup);
610 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 611 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
611 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 612 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
612 mDateFrame->setLineWidth(3); 613 mDateFrame->setLineWidth(3);
613 mDateFrame->hide(); 614 mDateFrame->hide();
614 mDateFrame->setCaption( i18n( "Pick a date to display")); 615 mDateFrame->setCaption( i18n( "Pick a date to display"));
615 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 616 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
616 617
617 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 618 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
618 619
619 mEventEditor = mDialogManager->getEventEditor(); 620 mEventEditor = mDialogManager->getEventEditor();
620 mTodoEditor = mDialogManager->getTodoEditor(); 621 mTodoEditor = mDialogManager->getTodoEditor();
621 622
622 mFlagEditDescription = false; 623 mFlagEditDescription = false;
623 624
624 mSuspendTimer = new QTimer( this ); 625 mSuspendTimer = new QTimer( this );
625 mAlarmTimer = new QTimer( this ); 626 mAlarmTimer = new QTimer( this );
626 mRecheckAlarmTimer = new QTimer( this ); 627 mRecheckAlarmTimer = new QTimer( this );
627 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 628 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
628 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 629 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
629 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 630 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
630 mAlarmDialog = new AlarmDialog( this ); 631 mAlarmDialog = new AlarmDialog( this );
631 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 & ) ) );
632 mAlarmDialog->setServerNotification( false ); 633 mAlarmDialog->setServerNotification( false );
633 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
634 635
635 636
636#ifndef DESKTOP_VERSION 637#ifndef DESKTOP_VERSION
637//US listen for arriving address resultsets 638//US listen for arriving address resultsets
638 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&)),
639 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&)));
640#endif 641#endif
641 mDateNavigator->setCalendar( mCalendar ); 642 mDateNavigator->setCalendar( mCalendar );
642} 643}
643 644
644 645
645CalendarView::~CalendarView() 646CalendarView::~CalendarView()
646{ 647{
647 // kdDebug() << "~CalendarView()" << endl; 648 // kdDebug() << "~CalendarView()" << endl;
648 //qDebug("CalendarView::~CalendarView() "); 649 //qDebug("CalendarView::~CalendarView() ");
649 delete mDialogManager; 650 delete mDialogManager;
650 delete mViewManager; 651 delete mViewManager;
651 delete mStorage; 652 delete mStorage;
652 delete mDateFrame ; 653 delete mDateFrame ;
653 delete mEventViewerDialog; 654 delete mEventViewerDialog;
654 //kdDebug() << "~CalendarView() done" << endl; 655 //kdDebug() << "~CalendarView() done" << endl;
655} 656}
656void CalendarView::setScrollBarStep(int val ) 657void CalendarView::setScrollBarStep(int val )
657{ 658{
658#ifdef DESKTOP_VERSION 659#ifdef DESKTOP_VERSION
659 mDateScrollBar->setLineStep ( val ); 660 mDateScrollBar->setLineStep ( val );
660#endif 661#endif
661} 662}
662void CalendarView::scrollBarValue(int val ) 663void CalendarView::scrollBarValue(int val )
663{ 664{
664#ifdef DESKTOP_VERSION 665#ifdef DESKTOP_VERSION
665 if ( QApplication::desktop()->width() < 800 ) return; 666 if ( QApplication::desktop()->width() < 800 ) return;
666 static bool block = false; 667 static bool block = false;
667 if ( block ) return; 668 if ( block ) return;
668 block = true; 669 block = true;
669 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 670 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
670 //qDebug("VAL %d ",val ); 671 //qDebug("VAL %d ",val );
671 int count = mNavigator->selectedDates().count(); 672 int count = mNavigator->selectedDates().count();
672 int year = mNavigator->selectedDates().first().year(); 673 int year = mNavigator->selectedDates().first().year();
673 int day = mNavigator->selectedDates().first().dayOfYear(); 674 int day = mNavigator->selectedDates().first().dayOfYear();
674 if ( val == day -1 ) { 675 if ( val == day -1 ) {
675 block = false; 676 block = false;
676 return; 677 return;
677 } 678 }
678 QDate d ( year,1,1 ); 679 QDate d ( year,1,1 );
679 mNavigator->selectDates( d.addDays( val ), count ); 680 mNavigator->selectDates( d.addDays( val ), count );
680 block = false; 681 block = false;
681#endif 682#endif
682 683
683} 684}
684 685void CalendarView::checkFiles()
685void CalendarView::checkAlarms()
686{ 686{
687
688 QString message; 687 QString message;
689 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 688 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
690 KopiCalendarFile * cal = calendars.first(); 689 KopiCalendarFile * cal = calendars.first();
691 while ( cal ) { 690 while ( cal ) {
692 if ( cal->mErrorOnLoad ) { 691 if ( cal->mErrorOnLoad ) {
693 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 692 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
694 } 693 }
695 cal = calendars.next(); 694 cal = calendars.next();
696 } 695 }
697 if ( !message.isEmpty() ) { 696 if ( !message.isEmpty() ) {
698 message = KGlobal::formatMessage( i18n("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 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);
699 KMessageBox::error(this,message); 698 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
700 } 699 }
700 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
701}
702void CalendarView::checkAlarms()
703{
704
705
701 KConfig *config = KOGlobals::config(); 706 KConfig *config = KOGlobals::config();
702 config->setGroup( "AppRun" ); 707 config->setGroup( "AppRun" );
703 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 708 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
704 int daysto = dt.daysTo( QDate::currentDate() ); 709 int daysto = dt.daysTo( QDate::currentDate() );
705 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 710 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
706 dt = dt.addDays( days ); 711 dt = dt.addDays( days );
707 int secto = dt.secsTo( QDateTime::currentDateTime() ); 712 int secto = dt.secsTo( QDateTime::currentDateTime() );
708 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 713 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
709 //qDebug("KO: Reading program stop %d ", secs); 714 //qDebug("KO: Reading program stop %d ", secs);
710 //secs -= ( 3600 * 24*3 ); // debug only 715 //secs -= ( 3600 * 24*3 ); // debug only
711 QDateTime latest = dt.addSecs ( secs ); 716 QDateTime latest = dt.addSecs ( secs );
712 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 717 qDebug("KO: Last termination on %s ", latest.toString().latin1());
713 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 718 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
714 QPtrList<Incidence> el = mCalendar->rawIncidences(); 719 QPtrList<Incidence> el = mCalendar->rawIncidences();
715 QPtrList<Incidence> al; 720 QPtrList<Incidence> al;
716 Incidence* inL = el.first(); 721 Incidence* inL = el.first();
717 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 722 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
718 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 723 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
719 while ( inL ) { 724 while ( inL ) {
720 bool ok = false; 725 bool ok = false;
721 int offset = 0; 726 int offset = 0;
722 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 727 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
723 if ( ok ) { 728 if ( ok ) {
724 //qDebug("OK %s",next.toString().latin1()); 729 //qDebug("OK %s",next.toString().latin1());
725 if ( next < cur ) { 730 if ( next < cur ) {
726 al.append( inL ); 731 al.append( inL );
727 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 732 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
728 } 733 }
729 } 734 }
730 inL = el.next(); 735 inL = el.next();
731 } 736 }
732 if ( al.count() ) { 737 if ( al.count() ) {
733 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 738 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
734 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 739 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
735 QVBoxLayout* lay = new QVBoxLayout( dia ); 740 QVBoxLayout* lay = new QVBoxLayout( dia );
736 lay->setSpacing( 0 ); 741 lay->setSpacing( 0 );
737 lay->setMargin( 0 ); 742 lay->setMargin( 0 );
738 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 743 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
739 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 744 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
740 lay->addWidget( matb ); 745 lay->addWidget( matb );
741 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 746 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
742 int wid = 210; 747 int wid = 210;
743 int x = QApplication::desktop()->width() - wid - 7; 748 int x = QApplication::desktop()->width() - wid - 7;
744 int y = QApplication::desktop()->height() - wid - 70; 749 int y = QApplication::desktop()->height() - wid - 70;
745 dia->setGeometry ( x,y,wid,wid); 750 dia->setGeometry ( x,y,wid,wid);
746 } else { 751 } else {
747 int si = 220; 752 int si = 220;
748 if ( QApplication::desktop()->width() > 470 ) 753 if ( QApplication::desktop()->width() > 470 )
749 si = 400; 754 si = 400;
750 dia->resize(si,si/2); 755 dia->resize(si,si/2);
751 } 756 }
752 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 757 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
753 dia->show(); 758 dia->show();
754 759
755 } 760 }
756} 761}
757void CalendarView::showDay( QDate d ) 762void CalendarView::showDay( QDate d )
758{ 763{
759 dateNavigator()->blockSignals( true ); 764 dateNavigator()->blockSignals( true );
760 dateNavigator()->selectDate( d ); 765 dateNavigator()->selectDate( d );
761 dateNavigator()->blockSignals( false ); 766 dateNavigator()->blockSignals( false );
762 mViewManager->showDayView(); 767 mViewManager->showDayView();
763 //dateNavigator()->selectDate( d ); 768 //dateNavigator()->selectDate( d );
764} 769}
765void CalendarView::timerAlarm() 770void CalendarView::timerAlarm()
766{ 771{
767 //qDebug("CalendarView::timerAlarm() "); 772 //qDebug("CalendarView::timerAlarm() ");
768 computeAlarm(mAlarmNotification ); 773 computeAlarm(mAlarmNotification );
769} 774}
770 775
771void CalendarView::suspendAlarm() 776void CalendarView::suspendAlarm()
772{ 777{
773 //qDebug(" CalendarView::suspendAlarm() "); 778 //qDebug(" CalendarView::suspendAlarm() ");
774 computeAlarm(mSuspendAlarmNotification ); 779 computeAlarm(mSuspendAlarmNotification );
775 780
776} 781}
777 782
778void CalendarView::startAlarm( QString mess , QString filename) 783void CalendarView::startAlarm( QString mess , QString filename)
779{ 784{
780 785
781 topLevelWidget()->showNormal(); 786 topLevelWidget()->showNormal();
782 topLevelWidget()->setActiveWindow(); 787 topLevelWidget()->setActiveWindow();
783 topLevelWidget()->raise(); 788 topLevelWidget()->raise();
784 789
785 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 790 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
786 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); 791 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) );
787 792
788} 793}
789 794
790void CalendarView::checkNextTimerAlarm() 795void CalendarView::checkNextTimerAlarm()
791{ 796{
792 mCalendar->checkAlarmForIncidence( 0, true ); 797 mCalendar->checkAlarmForIncidence( 0, true );
793} 798}
794 799
795void CalendarView::computeAlarm( QString msg ) 800void CalendarView::computeAlarm( QString msg )
796{ 801{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index c9e9870..651194b 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -108,192 +108,193 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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 checkAlarms(); 203 void checkAlarms();
204 void checkFiles();
204 void slotprintSelInc(); 205 void slotprintSelInc();
205 void showNextAlarms(); 206 void showNextAlarms();
206 void showOpenError(); 207 void showOpenError();
207 void watchSavedFile(); 208 void watchSavedFile();
208 void recheckTimerAlarm(); 209 void recheckTimerAlarm();
209 void checkNextTimerAlarm(); 210 void checkNextTimerAlarm();
210 void addAlarm(const QDateTime &qdt, const QString &noti ); 211 void addAlarm(const QDateTime &qdt, const QString &noti );
211 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 212 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
212 void removeAlarm(const QDateTime &qdt, const QString &noti ); 213 void removeAlarm(const QDateTime &qdt, const QString &noti );
213 214
214 /** options dialog made a changed to the configuration. we catch this 215 /** options dialog made a changed to the configuration. we catch this
215 * and notify all widgets which need to update their configuration. */ 216 * and notify all widgets which need to update their configuration. */
216 void updateConfig(); 217 void updateConfig();
217 218
218 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 219 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
219 const QStringList& anniversaryList, const QStringList& realNameList, 220 const QStringList& anniversaryList, const QStringList& realNameList,
220 const QStringList& emailList, const QStringList& assembledNameList, 221 const QStringList& emailList, const QStringList& assembledNameList,
221 const QStringList& uidList); 222 const QStringList& uidList);
222 223
223 /** 224 /**
224 Load calendar from file \a filename. If \a merge is true, load 225 Load calendar from file \a filename. If \a merge is true, load
225 calendar into existing one, if it is false, clear calendar, before 226 calendar into existing one, if it is false, clear calendar, before
226 loading. Return true, if calendar could be successfully loaded. 227 loading. Return true, if calendar could be successfully loaded.
227 */ 228 */
228 bool openCalendar(QString filename, bool merge=false); 229 bool openCalendar(QString filename, bool merge=false);
229 bool loadCalendars(); 230 bool loadCalendars();
230 bool saveCalendars(); 231 bool saveCalendars();
231 bool restoreCalendarSettings(); 232 bool restoreCalendarSettings();
232 bool addCalendar( KopiCalendarFile * ); 233 bool addCalendar( KopiCalendarFile * );
233 void addCalendarId( int id ); 234 void addCalendarId( int id );
234 bool syncCalendar(QString filename,int mode = 0 ); 235 bool syncCalendar(QString filename,int mode = 0 );
235 236
236 /** 237 /**
237 Save calendar data to file. Return true if calendar could be 238 Save calendar data to file. Return true if calendar could be
238 successfully saved. 239 successfully saved.
239 */ 240 */
240 bool saveCalendar(QString filename); 241 bool saveCalendar(QString filename);
241 242
242 /** 243 /**
243 Close calendar. Clear calendar data and reset views to display an empty 244 Close calendar. Clear calendar data and reset views to display an empty
244 calendar. 245 calendar.
245 */ 246 */
246 void closeCalendar(); 247 void closeCalendar();
247 248
248 /** Archive old events of calendar */ 249 /** Archive old events of calendar */
249 void archiveCalendar(); 250 void archiveCalendar();
250 251
251 void showIncidence(); 252 void showIncidence();
252 void editIncidence(); 253 void editIncidence();
253 void editIncidenceDescription(); 254 void editIncidenceDescription();
254 void deleteIncidence(); 255 void deleteIncidence();
255 void cloneIncidence(); 256 void cloneIncidence();
256 void moveIncidence(); 257 void moveIncidence();
257 void beamIncidence(); 258 void beamIncidence();
258 void toggleCancelIncidence(); 259 void toggleCancelIncidence();
259 260
260 /** create an editeventwin with supplied date/time, and if bool is true, 261 /** create an editeventwin with supplied date/time, and if bool is true,
261 * make the event take all day. */ 262 * make the event take all day. */
262 void newEvent(QDateTime, QDateTime, bool allDay ); 263 void newEvent(QDateTime, QDateTime, bool allDay );
263 void newEvent(QDateTime, QDateTime); 264 void newEvent(QDateTime, QDateTime);
264 void newEvent(QDateTime fh); 265 void newEvent(QDateTime fh);
265 void newEvent(QDate dt); 266 void newEvent(QDate dt);
266 /** create new event without having a date hint. Takes current date as 267 /** create new event without having a date hint. Takes current date as
267 default hint. */ 268 default hint. */
268 void newEvent(); 269 void newEvent();
269 void newFloatingEvent(); 270 void newFloatingEvent();
270 271
271 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 272 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
272 void showIncidence(Incidence *); 273 void showIncidence(Incidence *);
273 void showIncidence(QString uid); 274 void showIncidence(QString uid);
274 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 275 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
275 void editIncidence(Incidence *); 276 void editIncidence(Incidence *);
276 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 277 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
277 void deleteIncidence(Incidence *); 278 void deleteIncidence(Incidence *);
278 void cloneIncidence(Incidence *); 279 void cloneIncidence(Incidence *);
279 void cancelIncidence(Incidence *); 280 void cancelIncidence(Incidence *);
280 /** Create an editor for the supplied event. */ 281 /** Create an editor for the supplied event. */
281 void editEvent(Event *); 282 void editEvent(Event *);
282 /** Delete the supplied event. */ 283 /** Delete the supplied event. */
283 void deleteEvent(Event *); 284 void deleteEvent(Event *);
284 /** Delete the event with the given unique ID. Returns false, if event wasn't 285 /** Delete the event with the given unique ID. Returns false, if event wasn't
285 found. */ 286 found. */
286 bool deleteEvent(const QString &uid); 287 bool deleteEvent(const QString &uid);
287 /** Create a read-only viewer dialog for the supplied event. */ 288 /** Create a read-only viewer dialog for the supplied event. */
288 void showEvent(Event *); 289 void showEvent(Event *);
289 290
290 void editJournal(Journal *); 291 void editJournal(Journal *);
291 void showJournal(Journal *); 292 void showJournal(Journal *);
292 void deleteJournal(Journal *); 293 void deleteJournal(Journal *);
293 /** Create an editor dialog for a todo */ 294 /** Create an editor dialog for a todo */
294 void editTodo(Todo *); 295 void editTodo(Todo *);
295 /** Create a read-only viewer dialog for the supplied todo */ 296 /** Create a read-only viewer dialog for the supplied todo */
296 void showTodo(Todo *); 297 void showTodo(Todo *);
297 /** create new todo */ 298 /** create new todo */
298 void newTodo(); 299 void newTodo();
299 void newTodoDateTime(QDateTime, bool allday); 300 void newTodoDateTime(QDateTime, bool allday);
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 3cde103..20118aa 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -122,333 +122,335 @@ KOCalEditView::KOCalEditView(QWidget* parent,
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, bool b ) 135void KOCalEditView::selectStdCal( int id, bool b )
136{ 136{
137 137
138 if ( !b ) { 138 if ( !b ) {
139 KOCalCheckButton* it = (KOCalCheckButton*) sender(); 139 KOCalCheckButton* it = (KOCalCheckButton*) sender();
140 if ( it ) { 140 if ( it ) {
141 it->blockSignals( true ); 141 it->blockSignals( true );
142 it->setChecked( true ); 142 it->setChecked( true );
143 it->blockSignals( false ); 143 it->blockSignals( false );
144 return; 144 return;
145 } 145 }
146 return; 146 return;
147 } 147 }
148 KOCalRadioButton* sen = (KOCalRadioButton*) sender(); 148 KOCalRadioButton* sen = (KOCalRadioButton*) sender();
149 KOCalRadioButton* it = mStdandardB.first(); 149 KOCalRadioButton* it = mStdandardB.first();
150 while ( it ) { 150 while ( it ) {
151 if ( it->isChecked() ) { 151 if ( it->isChecked() ) {
152 if ( it != sen ) { 152 if ( it != sen ) {
153 it->blockSignals( true ); 153 it->blockSignals( true );
154 it->setChecked( false ); 154 it->setChecked( false );
155 it->blockSignals( false ); 155 it->blockSignals( false );
156 break; 156 break;
157 } 157 }
158 } 158 }
159 it = mStdandardB.next(); 159 it = mStdandardB.next();
160 } 160 }
161 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 161 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
162 while ( kkf ) { 162 while ( kkf ) {
163 kkf->isStandard = false; 163 kkf->isStandard = false;
164 kkf = KOPrefs::instance()->mCalendars.next(); 164 kkf = KOPrefs::instance()->mCalendars.next();
165 } 165 }
166 KOPrefs::instance()->getCalendar( id )->isStandard = true; 166 KOPrefs::instance()->getCalendar( id )->isStandard = true;
167 emit setCalendarDefault ( id ); 167 emit setCalendarDefault ( id );
168} 168}
169 169
170void KOCalEditView::selectCalAlarm(int id ,bool b ) 170void KOCalEditView::selectCalAlarm(int id ,bool b )
171{ 171{
172 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 172 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
173 emit alarmEnabled ( id , b ); 173 emit alarmEnabled ( id , b );
174 emit needsUpdate(); 174 emit needsUpdate();
175} 175}
176void KOCalEditView::selectReadOnly(int id ,bool b ) 176void KOCalEditView::selectReadOnly(int id ,bool b )
177{ 177{
178 KOPrefs::instance()->getCalendar( id )->isReadOnly = b; 178 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
179 emit calendarReadonly ( id , b ); 179 emit calendarReadonly ( id , b );
180 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { 180 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
181 KOPrefs::instance()->getCalendar( id )->isStandard = false; 181 KOPrefs::instance()->getCalendar( id )->isStandard = false;
182 KOPrefs::instance()->getCalendar( 1 )->isStandard = true; 182 KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
183 mStdandardB.at(0)->setChecked( true ); 183 mStdandardB.at(0)->setChecked( true );
184 mStdandardB.at(id-1)->setChecked( false ); 184 mStdandardB.at(id-1)->setChecked( false );
185 emit setCalendarDefault ( 1 ); 185 emit setCalendarDefault ( 1 );
186 } 186 }
187 mStdandardB.at(id-1)->setEnabled( !b ); 187 mStdandardB.at(id-1)->setEnabled( !b );
188 emit needsUpdate(); 188 emit needsUpdate();
189 189
190} 190}
191void KOCalEditView::setColor( const QColor& c, int id ) 191void KOCalEditView::setColor( const QColor& c, int id )
192{ 192{
193 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 193 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
194 emit needsUpdate(); 194 emit needsUpdate();
195} 195}
196void KOCalEditView::deleteCal( int id ) 196void KOCalEditView::deleteCal( int id )
197{ 197{
198 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 198 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
199 QString name = kkf->mName; 199 QString name = kkf->mName;
200 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); 200 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 );
201 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; 201 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;
202 if ( kkf->isStandard ) 202 if ( kkf->isStandard )
203 selectStdCal( 1, true ); 203 selectStdCal( 1, true );
204 emit removeCalendar ( id ); 204 emit removeCalendar ( id );
205 KOPrefs::instance()->mCalendars.remove ( kkf ); 205 KOPrefs::instance()->mCalendars.remove ( kkf );
206 emit needsUpdate(); 206 emit needsUpdate();
207 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 207 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
208} 208}
209void KOCalEditView::infoCal( int id ) 209void KOCalEditView::infoCal( int id )
210{ 210{
211 QString name = KOPrefs::instance()->getCalendar( id )->mName; 211 QString name = KOPrefs::instance()->getCalendar( id )->mName;
212 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); 212 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
213 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 213 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
214 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) ) ) { 214 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) ) ) {
215 emit calendarAdded( id ); 215 emit calendarAdded( id );
216 emit needsUpdate(); 216 emit needsUpdate();
217 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 217 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
218 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
218 } 219 }
219 } 220 }
220 else 221 else
221 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 222 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
222} 223}
223void KOCalEditView::readConfig() 224void KOCalEditView::readConfig()
224{ 225{
225 226
226 mStdandardB.clear(); 227 mStdandardB.clear();
227 mEnabledB.clear(); 228 mEnabledB.clear();
228 mAlarmB.clear(); 229 mAlarmB.clear();
229 mROB.clear(); 230 mROB.clear();
230 231
231 if ( mw ) delete mw; 232 if ( mw ) delete mw;
232 mw = new QWidget ( viewport() ); 233 mw = new QWidget ( viewport() );
233 addChild(mw); 234 addChild(mw);
234 int ii = 0; 235 int ii = 0;
235 mainLayout = new QGridLayout ( mw , 2, 8 ); 236 mainLayout = new QGridLayout ( mw , 2, 8 );
236 mainLayout->setMargin( 2 ); 237 mainLayout->setMargin( 2 );
237 mainLayout->setSpacing( 2 ); 238 mainLayout->setSpacing( 2 );
238 QPushButton * addBut = new QPushButton ( mw ); 239 QPushButton * addBut = new QPushButton ( mw );
239 addBut->setFocusPolicy(NoFocus); 240 addBut->setFocusPolicy(NoFocus);
240 mainLayout->addWidget( addBut,0,0 ); 241 mainLayout->addWidget( addBut,0,0 );
241 addBut->setText( "D"); 242 addBut->setText( "D");
242 connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo())); 243 connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo()));
243 //addBut->setPixmap ( SmallIcon("greenhook16")); 244 //addBut->setPixmap ( SmallIcon("greenhook16"));
244 addBut->setMaximumWidth( addBut->sizeHint().height() ); 245 addBut->setMaximumWidth( addBut->sizeHint().height() );
245 int max = addBut->sizeHint().height(); 246 int max = addBut->sizeHint().height();
246 addBut = new QPushButton ( mw ); 247 addBut = new QPushButton ( mw );
247 addBut->setFocusPolicy(NoFocus); 248 addBut->setFocusPolicy(NoFocus);
248 mainLayout->addWidget( addBut,0,++ii ); 249 mainLayout->addWidget( addBut,0,++ii );
249 addBut->setPixmap ( SmallIcon("eye")); 250 addBut->setPixmap ( SmallIcon("eye"));
250 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 251 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
251 addBut->setMaximumWidth( addBut->sizeHint().height() ); 252 addBut->setMaximumWidth( addBut->sizeHint().height() );
252 253
253 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 254 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
254 mainLayout->addWidget( lab,0,++ii ); 255 mainLayout->addWidget( lab,0,++ii );
255 //lab = new QLabel ( i18n(" "), mw ); 256 //lab = new QLabel ( i18n(" "), mw );
256 //mainLayout->addWidget( lab,0,++ii ); 257 //mainLayout->addWidget( lab,0,++ii );
257 //lab->setFixedWidth( 1 ); 258 //lab->setFixedWidth( 1 );
258 addBut = new QPushButton ( mw ); 259 addBut = new QPushButton ( mw );
259 addBut->setFocusPolicy(NoFocus); 260 addBut->setFocusPolicy(NoFocus);
260 mainLayout->addWidget( addBut,0,++ii ); 261 mainLayout->addWidget( addBut,0,++ii );
261 addBut->setPixmap ( SmallIcon("bell")); 262 addBut->setPixmap ( SmallIcon("bell"));
262 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 263 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
263 addBut->setMaximumWidth( addBut->sizeHint().height() ); 264 addBut->setMaximumWidth( addBut->sizeHint().height() );
264 265
265 addBut = new QPushButton ( mw ); 266 addBut = new QPushButton ( mw );
266 addBut->setFocusPolicy(NoFocus); 267 addBut->setFocusPolicy(NoFocus);
267 mainLayout->addWidget( addBut,0,++ii ); 268 mainLayout->addWidget( addBut,0,++ii );
268 addBut->setPixmap ( SmallIcon("pencil")); 269 addBut->setPixmap ( SmallIcon("pencil"));
269 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 270 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
270 addBut->setMaximumWidth( addBut->sizeHint().height() ); 271 addBut->setMaximumWidth( addBut->sizeHint().height() );
271 lab = new QLabel ( "", mw ); 272 lab = new QLabel ( "", mw );
272 mainLayout->addWidget( lab,0,++ii ); 273 mainLayout->addWidget( lab,0,++ii );
273 274
274 addBut = new QPushButton ( mw ); 275 addBut = new QPushButton ( mw );
275 addBut->setFocusPolicy(NoFocus); 276 addBut->setFocusPolicy(NoFocus);
276 mainLayout->addWidget( addBut,0,++ii ); 277 mainLayout->addWidget( addBut,0,++ii );
277 addBut->setPixmap ( SmallIcon("plus")); 278 addBut->setPixmap ( SmallIcon("plus"));
278 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 279 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
279 280
280 lab = new QLabel ( " ", mw ); 281 lab = new QLabel ( " ", mw );
281 mainLayout->addWidget( lab,0,++ii ); 282 mainLayout->addWidget( lab,0,++ii );
282 283
283 284
284 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 285 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
285 int row = 1; 286 int row = 1;
286 while ( kkf ) { 287 while ( kkf ) {
287 int iii = 0; 288 int iii = 0;
288 KOCalRadioButton* rb = new KOCalRadioButton( mw ); 289 KOCalRadioButton* rb = new KOCalRadioButton( mw );
289 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); 290 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb );
290 rb->setChecked( kkf->isStandard ); 291 rb->setChecked( kkf->isStandard );
291 rb->setNum( kkf->mCalNumber ); 292 rb->setNum( kkf->mCalNumber );
292 connect (rb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 293 connect (rb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
293 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 294 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
294 rb->setEnabled( false ); 295 rb->setEnabled( false );
295 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 296 KOCalCheckButton* cb = new KOCalCheckButton( mw );
296 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 297 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
297 cb->setChecked( kkf->isEnabled ); 298 cb->setChecked( kkf->isEnabled );
298 cb->setNum( kkf->mCalNumber ); 299 cb->setNum( kkf->mCalNumber );
299 if ( kkf->mErrorOnLoad ) 300 if ( kkf->mErrorOnLoad )
300 cb->setEnabled( false ); 301 cb->setEnabled( false );
301 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 302 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
302 KOCalButton* name = new KOCalButton( mw ); 303 KOCalButton* name = new KOCalButton( mw );
303 name->setNum( kkf->mCalNumber ); 304 name->setNum( kkf->mCalNumber );
304 name->setText( kkf->mName ); 305 name->setText( kkf->mName );
305 mainLayout->addWidget( name,row,++iii ); 306 mainLayout->addWidget( name,row,++iii );
306 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 307 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
307 //lab = new QLabel (" ", mw ); 308 //lab = new QLabel (" ", mw );
308 //mainLayout->addWidget( lab,row,++iii ); 309 //mainLayout->addWidget( lab,row,++iii );
309 cb = new KOCalCheckButton( mw ); 310 cb = new KOCalCheckButton( mw );
310 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 311 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
311 cb->setChecked( kkf->isAlarmEnabled ); 312 cb->setChecked( kkf->isAlarmEnabled );
312 cb->setNum( kkf->mCalNumber ); 313 cb->setNum( kkf->mCalNumber );
313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 314 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
314 if ( kkf->mErrorOnLoad ) 315 if ( kkf->mErrorOnLoad )
315 cb->setEnabled( false ); 316 cb->setEnabled( false );
316 cb = new KOCalCheckButton( mw ); 317 cb = new KOCalCheckButton( mw );
317 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 318 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
318 cb->setChecked( kkf->isReadOnly ); 319 cb->setChecked( kkf->isReadOnly );
319 cb->setNum( kkf->mCalNumber ); 320 cb->setNum( kkf->mCalNumber );
320 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 321 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
321 if ( kkf->mErrorOnLoad ) 322 if ( kkf->mErrorOnLoad )
322 cb->setEnabled( false ); 323 cb->setEnabled( false );
323 if ( row > 1) { 324 if ( row > 1) {
324 KColorButton *colb = new KColorButton( mw ); 325 KColorButton *colb = new KColorButton( mw );
325 mainLayout->addWidget( colb,row,++iii ); 326 mainLayout->addWidget( colb,row,++iii );
326 colb->setID( kkf->mCalNumber ); 327 colb->setID( kkf->mCalNumber );
327 colb->setColor( kkf->mDefaultColor ); 328 colb->setColor( kkf->mDefaultColor );
328 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); 329 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
329 KOCalButton* calb = new KOCalButton( mw ); 330 KOCalButton* calb = new KOCalButton( mw );
330 mainLayout->addWidget( calb,row,++iii ); 331 mainLayout->addWidget( calb,row,++iii );
331 calb->setNum( kkf->mCalNumber ); 332 calb->setNum( kkf->mCalNumber );
332 calb->setPixmap ( SmallIcon("minus")); 333 calb->setPixmap ( SmallIcon("minus"));
333 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 334 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
334 int hei = calb->sizeHint().height(); 335 int hei = calb->sizeHint().height();
335 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 336 //calb->setMaximumSize( hei*9/10, hei*9/10 );
336 } 337 }
337 ++row; 338 ++row;
338 kkf = KOPrefs::instance()->mCalendars.next(); 339 kkf = KOPrefs::instance()->mCalendars.next();
339 } 340 }
340 lab = new QLabel ( "", mw ); 341 lab = new QLabel ( "", mw );
341 mainLayout->addWidget( lab,row,0 ); 342 mainLayout->addWidget( lab,row,0 );
342 mw->show(); 343 mw->show();
343 344
344} 345}
345 346
346 347
347void KOCalEditView::defaultInfo() 348void KOCalEditView::defaultInfo()
348{ 349{
349 KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); 350 KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
350} 351}
351void KOCalEditView::addCal() 352void KOCalEditView::addCal()
352{ 353{
353 bool tryagain = true; 354 bool tryagain = true;
354 QString name, file; 355 QString name, file;
355 while ( tryagain ) { 356 while ( tryagain ) {
356 KONewCalPrefs prefs ( this ); 357 KONewCalPrefs prefs ( this );
357 prefs.nameE->setText( name ); 358 prefs.nameE->setText( name );
358 prefs.url->setURL( file ); 359 prefs.url->setURL( file );
359 if ( ! prefs.exec() ) 360 if ( ! prefs.exec() )
360 return; 361 return;
361 name = prefs.calName(); 362 name = prefs.calName();
362 file = prefs.calFileName(); 363 file = prefs.calFileName();
363 tryagain = false; 364 tryagain = false;
364 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 365 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
365 while ( kkf ) { 366 while ( kkf ) {
366 if ( kkf->mName == name ) { 367 if ( kkf->mName == name ) {
367 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); 368 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
368 name = ""; 369 name = "";
369 tryagain = true; 370 tryagain = true;
370 break; 371 break;
371 } 372 }
372 if ( kkf->mFileName == file ) { 373 if ( kkf->mFileName == file ) {
373 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); 374 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
374 tryagain = true; 375 tryagain = true;
375 file = ""; 376 file = "";
376 break; 377 break;
377 } 378 }
378 kkf = KOPrefs::instance()->mCalendars.next(); 379 kkf = KOPrefs::instance()->mCalendars.next();
379 } 380 }
380 } 381 }
381 addCalendar ( name, file ); 382 addCalendar ( name, file );
383 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
382} 384}
383int KOCalEditView::addCalendar( QString name, QString file, bool ask ) 385int KOCalEditView::addCalendar( QString name, QString file, bool ask )
384{ 386{
385 387
386 QFileInfo fi ( file ); 388 QFileInfo fi ( file );
387 if (!fi.exists() ) { 389 if (!fi.exists() ) {
388 if ( ask ) 390 if ( ask )
389 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) 391 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
390 return 0; 392 return 0;
391 QFile fileIn( file ); 393 QFile fileIn( file );
392 if (!fileIn.open( IO_WriteOnly ) ) { 394 if (!fileIn.open( IO_WriteOnly ) ) {
393 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 395 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
394 return 0; 396 return 0;
395 } 397 }
396 QTextStream tsIn( &fileIn ); 398 QTextStream tsIn( &fileIn );
397 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 399 tsIn.setCodec( QTextCodec::codecForName("utf8") );
398 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 400 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
399 fileIn.close(); 401 fileIn.close();
400 } 402 }
401 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 403 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
402 kkf->mName = name; 404 kkf->mName = name;
403 kkf->mFileName = file; 405 kkf->mFileName = file;
404 emit calendarAdded( kkf->mCalNumber ); 406 emit calendarAdded( kkf->mCalNumber );
405 if ( ask ) 407 if ( ask )
406 emit needsUpdate(); 408 emit needsUpdate();
407 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 409 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
408 return kkf->mCalNumber; 410 return kkf->mCalNumber;
409} 411}
410int KOCalEditView::getBirtdayID() 412int KOCalEditView::getBirtdayID()
411{ 413{
412 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 414 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
413 while ( kkf ) { 415 while ( kkf ) {
414 if ( kkf->mName == i18n("Birthdays") ) 416 if ( kkf->mName == i18n("Birthdays") )
415 return kkf->mCalNumber; 417 return kkf->mCalNumber;
416 kkf = KOPrefs::instance()->mCalendars.next(); 418 kkf = KOPrefs::instance()->mCalendars.next();
417 } 419 }
418 QString file = locateLocal( "data", "korganizer/birthdays.ics" ); 420 QString file = locateLocal( "data", "korganizer/birthdays.ics" );
419 return addCalendar( i18n("Birthdays"), file, false ); 421 return addCalendar( i18n("Birthdays"), file, false );
420} 422}
421 423
422void KOCalEditView::enableAll() 424void KOCalEditView::enableAll()
423{ 425{
424 toggleList( mEnabledB ); 426 toggleList( mEnabledB );
425} 427}
426void KOCalEditView::enableAlarm() 428void KOCalEditView::enableAlarm()
427{ 429{
428 toggleList( mAlarmB ); 430 toggleList( mAlarmB );
429} 431}
430void KOCalEditView::disableRO() 432void KOCalEditView::disableRO()
431{ 433{
432 toggleList( mROB ); 434 toggleList( mROB );
433} 435}
434void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) 436void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
435{ 437{
436 bool dis = false; 438 bool dis = false;
437 KOCalCheckButton* it = list.first(); 439 KOCalCheckButton* it = list.first();
438 while ( it ) { 440 while ( it ) {
439 if ( !it->isChecked() ) { 441 if ( !it->isChecked() ) {
440 dis = true; 442 dis = true;
441 break; 443 break;
442 } 444 }
443 it = list.next(); 445 it = list.next();
444 } 446 }
445 it = list.first(); 447 it = list.first();
446 while ( it ) { 448 while ( it ) {
447 it->setChecked(dis); 449 it->setChecked(dis);
448 it = list.next(); 450 it = list.next();
449 } 451 }
450} 452}
451void KOCalEditView::deleteAll() 453void KOCalEditView::deleteAll()
452{ 454{
453 qDebug("delteAll"); 455 qDebug("delteAll");
454} 456}
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 54fe2c5..02107cf 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -140,110 +140,111 @@ class KOCalCheckButton : public QCheckBox
140 void selectNum ( int, bool ); 140 void selectNum ( int, bool );
141private: 141private:
142 int mNumber; 142 int mNumber;
143 void keyPressEvent ( QKeyEvent * e ) 143 void keyPressEvent ( QKeyEvent * e )
144 { 144 {
145 e->ignore(); 145 e->ignore();
146 } 146 }
147 147
148private slots : 148private slots :
149 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } 149 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
150}; 150};
151 151
152class KOCalRadioButton : public QRadioButton 152class KOCalRadioButton : public QRadioButton
153{ 153{
154 Q_OBJECT 154 Q_OBJECT
155 public: 155 public:
156 KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : 156 KOCalRadioButton( QWidget *parent=0, const char *name=0 ) :
157 QRadioButton( parent, name) 157 QRadioButton( parent, name)
158 { 158 {
159 connect( this, SIGNAL( toggled ( bool ) ), 159 connect( this, SIGNAL( toggled ( bool ) ),
160 SLOT( bottonClicked( bool ) )); 160 SLOT( bottonClicked( bool ) ));
161 mNumber = -1; 161 mNumber = -1;
162 setFocusPolicy(NoFocus); 162 setFocusPolicy(NoFocus);
163 //setMaximumWidth( 10 ); 163 //setMaximumWidth( 10 );
164 164
165 } 165 }
166 void setNum ( int num ) {mNumber = num; } 166 void setNum ( int num ) {mNumber = num; }
167 signals: 167 signals:
168 void selectNum ( int, bool ); 168 void selectNum ( int, bool );
169private: 169private:
170 int mNumber; 170 int mNumber;
171 void keyPressEvent ( QKeyEvent * e ) 171 void keyPressEvent ( QKeyEvent * e )
172 { 172 {
173 e->ignore(); 173 e->ignore();
174 } 174 }
175 175
176private slots : 176private slots :
177 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } 177 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
178}; 178};
179 179
180 180
181 181
182class KOFilterView : public KOFilterView_base 182class KOFilterView : public KOFilterView_base
183{ 183{
184 Q_OBJECT 184 Q_OBJECT
185 public: 185 public:
186 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); 186 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
187 ~KOFilterView(); 187 ~KOFilterView();
188 188
189 void updateFilters(); 189 void updateFilters();
190 190
191 bool filtersEnabled(); 191 bool filtersEnabled();
192 void setFiltersEnabled(bool); 192 void setFiltersEnabled(bool);
193 CalFilter *selectedFilter(); 193 CalFilter *selectedFilter();
194 void setSelectedFilter(QString); 194 void setSelectedFilter(QString);
195 void setSelectedFilter( int ); 195 void setSelectedFilter( int );
196 196
197 signals: 197 signals:
198 void filterChanged(); 198 void filterChanged();
199 void editFilters(); 199 void editFilters();
200 200
201 private: 201 private:
202 QPtrList<CalFilter> *mFilters; 202 QPtrList<CalFilter> *mFilters;
203}; 203};
204 204
205class KOCalEditView : public QScrollView 205class KOCalEditView : public QScrollView
206{ 206{
207 Q_OBJECT 207 Q_OBJECT
208 public: 208 public:
209 KOCalEditView( QWidget* parent=0,const char* name=0); 209 KOCalEditView( QWidget* parent=0,const char* name=0);
210 ~KOCalEditView(); 210 ~KOCalEditView();
211 int addCalendar( QString calName, QString fileName, bool ask = true ); 211 int addCalendar( QString calName, QString fileName, bool ask = true );
212 int getBirtdayID(); 212 int getBirtdayID();
213 public slots: 213 public slots:
214 void addCal(); 214 void addCal();
215 void enableAll(); 215 void enableAll();
216 void enableAlarm(); 216 void enableAlarm();
217 void disableRO(); 217 void disableRO();
218 void deleteAll(); 218 void deleteAll();
219 void selectStdCal(int,bool ); 219 void selectStdCal(int,bool );
220 void selectCal(int,bool ); 220 void selectCal(int,bool );
221 void selectCalAlarm(int,bool ); 221 void selectCalAlarm(int,bool );
222 void selectReadOnly(int,bool ); 222 void selectReadOnly(int,bool );
223 void setColor(const QColor &,int) ; 223 void setColor(const QColor &,int) ;
224 void deleteCal(int) ; 224 void deleteCal(int) ;
225 void infoCal(int) ; 225 void infoCal(int) ;
226 void readConfig(); 226 void readConfig();
227 void defaultInfo(); 227 void defaultInfo();
228 signals: 228 signals:
229 void alarmEnabled ( int cal, bool enable ); 229 void alarmEnabled ( int cal, bool enable );
230 void calendarEnabled ( int cal, bool enable ); 230 void calendarEnabled ( int cal, bool enable );
231 void calendarReadonly ( int cal, bool readonly ); 231 void calendarReadonly ( int cal, bool readonly );
232 void setCalendarDefault ( int cal ); 232 void setCalendarDefault ( int cal );
233 void removeCalendar ( int cal ); 233 void removeCalendar ( int cal );
234 void calendarAdded( int ); 234 void calendarAdded( int );
235 void needsUpdate(); 235 void needsUpdate();
236 void checkCalendar();
236 237
237 private: 238 private:
238 QWidget *mw; 239 QWidget *mw;
239 void toggleList ( QPtrList<KOCalCheckButton> ); 240 void toggleList ( QPtrList<KOCalCheckButton> );
240 QPtrList<KOCalRadioButton> mStdandardB; 241 QPtrList<KOCalRadioButton> mStdandardB;
241 QPtrList<KOCalCheckButton> mEnabledB; 242 QPtrList<KOCalCheckButton> mEnabledB;
242 QPtrList<KOCalCheckButton> mAlarmB; 243 QPtrList<KOCalCheckButton> mAlarmB;
243 QPtrList<KOCalCheckButton> mROB; 244 QPtrList<KOCalCheckButton> mROB;
244 QGridLayout* mainLayout; 245 QGridLayout* mainLayout;
245}; 246};
246 247
247 248
248 249
249#endif // KOFILTERVIEW_H 250#endif // KOFILTERVIEW_H
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b797d8c..501eed5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -305,197 +305,194 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
305 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 305 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
306 vh -= iconToolBar->height(); 306 vh -= iconToolBar->height();
307 } else { 307 } else {
308 vw -= iconToolBar->height(); 308 vw -= iconToolBar->height();
309 } 309 }
310 //mView->setMaximumSize( splash->size() ); 310 //mView->setMaximumSize( splash->size() );
311 //mView->resize( splash->size() ); 311 //mView->resize( splash->size() );
312 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 312 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
313 mView->readSettings(); 313 mView->readSettings();
314 bool newFile = false; 314 bool newFile = false;
315 if( !QFile::exists( defaultFileName() ) ) { 315 if( !QFile::exists( defaultFileName() ) ) {
316 QFileInfo finfo ( defaultFileName() ); 316 QFileInfo finfo ( defaultFileName() );
317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
318 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"; 318 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";
319 finfo.setFile( oldFile ); 319 finfo.setFile( oldFile );
320 if (finfo.exists() ) { 320 if (finfo.exists() ) {
321 KMessageBox::information( this, message); 321 KMessageBox::information( this, message);
322 mView->openCalendar( oldFile ); 322 mView->openCalendar( oldFile );
323 qApp->processEvents(); 323 qApp->processEvents();
324 } else { 324 } else {
325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
326 finfo.setFile( oldFile ); 326 finfo.setFile( oldFile );
327 if (finfo.exists() ) { 327 if (finfo.exists() ) {
328 KMessageBox::information( this, message); 328 KMessageBox::information( this, message);
329 mView->openCalendar( oldFile ); 329 mView->openCalendar( oldFile );
330 qApp->processEvents(); 330 qApp->processEvents();
331 } 331 }
332 } 332 }
333 mView->saveCalendar( defaultFileName() ); 333 mView->saveCalendar( defaultFileName() );
334 newFile = true; 334 newFile = true;
335 } 335 }
336 336
337 QTime neededSaveTime = QDateTime::currentDateTime().time(); 337 QTime neededSaveTime = QDateTime::currentDateTime().time();
338 mView->loadCalendars(); 338 mView->loadCalendars();
339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
340 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 340 qDebug("KO: Calendar loading time: %d ms",msNeeded );
341 341
342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
343 KOPrefs::instance()->setAllDefaults(); 343 KOPrefs::instance()->setAllDefaults();
344 } 344 }
345 processIncidenceSelection( 0 ); 345 processIncidenceSelection( 0 );
346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
347 SLOT( processIncidenceSelection( Incidence * ) ) ); 347 SLOT( processIncidenceSelection( Incidence * ) ) );
348 connect( mView, SIGNAL( modifiedChanged( bool ) ), 348 connect( mView, SIGNAL( modifiedChanged( bool ) ),
349 SLOT( slotModifiedChanged( bool ) ) ); 349 SLOT( slotModifiedChanged( bool ) ) );
350 350
351 351
352 connect( mView, SIGNAL( tempDisableBR(bool) ), 352 connect( mView, SIGNAL( tempDisableBR(bool) ),
353 SLOT( disableBR(bool) ) ); 353 SLOT( disableBR(bool) ) );
354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
355 mView->setModified( false ); 355 mView->setModified( false );
356 mBlockAtStartup = false; 356 mBlockAtStartup = false;
357 mView->setModified( false ); 357 mView->setModified( false );
358 setCentralWidget( mView ); 358 setCentralWidget( mView );
359 globalFlagBlockStartup = 0; 359 globalFlagBlockStartup = 0;
360 mView->show(); 360 mView->show();
361 delete splash; 361 delete splash;
362 if ( newFile ) 362 if ( newFile )
363 mView->updateConfig(); 363 mView->updateConfig();
364 // qApp->processEvents(); 364 // qApp->processEvents();
365 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 365 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
366 //fillSyncMenu(); 366 //fillSyncMenu();
367 367
368 368
369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
374 mSyncManager->setDefaultFileName( sentSyncFile()); 374 mSyncManager->setDefaultFileName( sentSyncFile());
375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
376 mSyncManager->fillSyncMenu(); 376 mSyncManager->fillSyncMenu();
377 377
378 378
379 379
380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
381 if ( showWarning ) { 381 if ( showWarning ) {
382 KMessageBox::information( this, 382 KMessageBox::information( this,
383 "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"); 383 "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");
384 qApp->processEvents(); 384 qApp->processEvents();
385 mView->dialogManager()->showSyncOptions(); 385 mView->dialogManager()->showSyncOptions();
386 } 386 }
387 387
388 //US listen for result adressed from Ka/Pi 388 //US listen for result adressed from Ka/Pi
389#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
390 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 390 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
391#endif 391#endif
392#ifndef DESKTOP_VERSION 392#ifndef DESKTOP_VERSION
393 infrared = 0; 393 infrared = 0;
394#endif 394#endif
395 updateFilterToolbar(); 395 updateFilterToolbar();
396 updateWeek( mView->startDate() ); 396 updateWeek( mView->startDate() );
397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
398 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 398 SLOT( updateWeekNum( const KCal::DateList & ) ) );
399 mBRdisabled = false; 399 mBRdisabled = false;
400 //toggleBeamReceive(); 400 //toggleBeamReceive();
401 int tiint= 3000; 401
402#ifndef DESKTOP_VERSION 402 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
403 tiint = 5000;
404#endif
405 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() ));
406} 403}
407MainWindow::~MainWindow() 404MainWindow::~MainWindow()
408{ 405{
409 //qDebug("MainWindow::~MainWindow() "); 406 //qDebug("MainWindow::~MainWindow() ");
410 //save toolbar location 407 //save toolbar location
411 delete mCalendar; 408 delete mCalendar;
412 delete mSyncManager; 409 delete mSyncManager;
413#ifndef DESKTOP_VERSION 410#ifndef DESKTOP_VERSION
414 if ( infrared ) 411 if ( infrared )
415 delete infrared; 412 delete infrared;
416#endif 413#endif
417 414
418 415
419} 416}
420 417
421void MainWindow::disableBR(bool b) 418void MainWindow::disableBR(bool b)
422{ 419{
423#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
424 if ( b ) { 421 if ( b ) {
425 if ( infrared ) { 422 if ( infrared ) {
426 toggleBeamReceive(); 423 toggleBeamReceive();
427 mBRdisabled = true; 424 mBRdisabled = true;
428 } 425 }
429 mBRdisabled = true; 426 mBRdisabled = true;
430 } else { 427 } else {
431 if ( mBRdisabled ) { 428 if ( mBRdisabled ) {
432 mBRdisabled = false; 429 mBRdisabled = false;
433 //makes no sense,because other cal ap is probably running 430 //makes no sense,because other cal ap is probably running
434 // toggleBeamReceive(); 431 // toggleBeamReceive();
435 } 432 }
436 } 433 }
437#endif 434#endif
438 435
439} 436}
440bool MainWindow::beamReceiveEnabled() 437bool MainWindow::beamReceiveEnabled()
441{ 438{
442#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
443 return ( infrared != 0 ); 440 return ( infrared != 0 );
444#endif 441#endif
445 return false; 442 return false;
446} 443}
447 444
448void MainWindow::toggleBeamReceive() 445void MainWindow::toggleBeamReceive()
449{ 446{
450 if ( mBRdisabled ) 447 if ( mBRdisabled )
451 return; 448 return;
452#ifndef DESKTOP_VERSION 449#ifndef DESKTOP_VERSION
453 if ( infrared ) { 450 if ( infrared ) {
454 qDebug("KO: Disable BeamReceive "); 451 qDebug("KO: Disable BeamReceive ");
455 delete infrared; 452 delete infrared;
456 infrared = 0; 453 infrared = 0;
457 brAction->setOn(false); 454 brAction->setOn(false);
458 return; 455 return;
459 } 456 }
460 qDebug("KO: Enable BeamReceive "); 457 qDebug("KO: Enable BeamReceive ");
461 brAction->setOn(true); 458 brAction->setOn(true);
462 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 459 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
463 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 460 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
464#endif 461#endif
465} 462}
466void MainWindow::showMaximized () 463void MainWindow::showMaximized ()
467{ 464{
468#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
469 if ( ! globalFlagBlockStartup ) 466 if ( ! globalFlagBlockStartup )
470 if ( mClosed ) 467 if ( mClosed )
471 mView->goToday(); 468 mView->goToday();
472#endif 469#endif
473 QWidget::showMaximized () ; 470 QWidget::showMaximized () ;
474 mClosed = false; 471 mClosed = false;
475} 472}
476void MainWindow::closeEvent( QCloseEvent* ce ) 473void MainWindow::closeEvent( QCloseEvent* ce )
477{ 474{
478 475
479 476
480 477
481 if ( ! KOPrefs::instance()->mAskForQuit ) { 478 if ( ! KOPrefs::instance()->mAskForQuit ) {
482 saveOnClose(); 479 saveOnClose();
483 mClosed = true; 480 mClosed = true;
484 ce->accept(); 481 ce->accept();
485 return; 482 return;
486 483
487 } 484 }
488 485
489 switch( QMessageBox::information( this, "KO/Pi", 486 switch( QMessageBox::information( this, "KO/Pi",
490 i18n("Do you really want\nto close KO/Pi?"), 487 i18n("Do you really want\nto close KO/Pi?"),
491 i18n("Close"), i18n("No"), 488 i18n("Close"), i18n("No"),
492 0, 0 ) ) { 489 0, 0 ) ) {
493 case 0: 490 case 0:
494 saveOnClose(); 491 saveOnClose();
495 mClosed = true; 492 mClosed = true;
496 ce->accept(); 493 ce->accept();
497 break; 494 break;
498 case 1: 495 case 1:
499 ce->ignore(); 496 ce->ignore();
500 break; 497 break;
501 case 2: 498 case 2: