-rw-r--r-- | korganizer/calendarview.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 4b82aa8..8f5de4d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -519,259 +519,261 @@ void CalendarView::init() | |||
519 | 519 | ||
520 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 520 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
521 | mNavigator, SLOT( selectPrevious() ) ); | 521 | mNavigator, SLOT( selectPrevious() ) ); |
522 | connect( mDateNavigator, SIGNAL( goNext() ), | 522 | connect( mDateNavigator, SIGNAL( goNext() ), |
523 | mNavigator, SLOT( selectNext() ) ); | 523 | mNavigator, SLOT( selectNext() ) ); |
524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
529 | #if 0 | 529 | #if 0 |
530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
531 | SLOT( incidenceAdded( Incidence *) ) ); | 531 | SLOT( incidenceAdded( Incidence *) ) ); |
532 | #endif | 532 | #endif |
533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
534 | 534 | ||
535 | connect( this, SIGNAL( configChanged() ), | 535 | connect( this, SIGNAL( configChanged() ), |
536 | mDateNavigator, SLOT( updateConfig() ) ); | 536 | mDateNavigator, SLOT( updateConfig() ) ); |
537 | 537 | ||
538 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 538 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
539 | SLOT( newTodo() ) ); | 539 | SLOT( newTodo() ) ); |
540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
541 | SLOT( newSubTodo( Todo * ) ) ); | 541 | SLOT( newSubTodo( Todo * ) ) ); |
542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
543 | SLOT( editTodo( Todo * ) ) ); | 543 | SLOT( editTodo( Todo * ) ) ); |
544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
545 | SLOT( showTodo( Todo *) ) ); | 545 | SLOT( showTodo( Todo *) ) ); |
546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
547 | SLOT( deleteTodo( Todo *) ) ); | 547 | SLOT( deleteTodo( Todo *) ) ); |
548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
550 | SLOT( purgeCompleted() ) ); | 550 | SLOT( purgeCompleted() ) ); |
551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
552 | SIGNAL( todoModified( Todo *, int ) ) ); | 552 | SIGNAL( todoModified( Todo *, int ) ) ); |
553 | 553 | ||
554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
557 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 557 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
558 | 558 | ||
559 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 559 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
560 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 560 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
561 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 561 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
562 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 562 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
563 | 563 | ||
564 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 564 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
565 | this, SLOT ( todo_unsub( Todo * ) ) ); | 565 | this, SLOT ( todo_unsub( Todo * ) ) ); |
566 | 566 | ||
567 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 567 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
568 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 568 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
569 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 569 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
570 | SLOT( updateTodo( Todo *, int ) ) ); | 570 | SLOT( updateTodo( Todo *, int ) ) ); |
571 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 571 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
572 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 572 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
573 | 573 | ||
574 | 574 | ||
575 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 575 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
576 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 576 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
577 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 577 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
578 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 578 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
579 | 579 | ||
580 | 580 | ||
581 | 581 | ||
582 | 582 | ||
583 | 583 | ||
584 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 584 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
585 | SLOT(checkClipboard())); | 585 | SLOT(checkClipboard())); |
586 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 586 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
587 | SLOT( processTodoListSelection( Incidence * ) ) ); | 587 | SLOT( processTodoListSelection( Incidence * ) ) ); |
588 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 588 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
589 | 589 | ||
590 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 590 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
591 | 591 | ||
592 | mDateFrame = new QVBox(0,0,WType_Popup); | 592 | mDateFrame = new QVBox(0,0,WType_Popup); |
593 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 593 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
594 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 594 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
595 | mDateFrame->setLineWidth(3); | 595 | mDateFrame->setLineWidth(3); |
596 | mDateFrame->hide(); | 596 | mDateFrame->hide(); |
597 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 597 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
598 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 598 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
599 | 599 | ||
600 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 600 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
601 | 601 | ||
602 | mEventEditor = mDialogManager->getEventEditor(); | 602 | mEventEditor = mDialogManager->getEventEditor(); |
603 | mTodoEditor = mDialogManager->getTodoEditor(); | 603 | mTodoEditor = mDialogManager->getTodoEditor(); |
604 | 604 | ||
605 | mFlagEditDescription = false; | 605 | mFlagEditDescription = false; |
606 | 606 | ||
607 | mSuspendTimer = new QTimer( this ); | 607 | mSuspendTimer = new QTimer( this ); |
608 | mAlarmTimer = new QTimer( this ); | 608 | mAlarmTimer = new QTimer( this ); |
609 | mRecheckAlarmTimer = new QTimer( this ); | 609 | mRecheckAlarmTimer = new QTimer( this ); |
610 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 610 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
611 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 611 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
612 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 612 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
613 | mAlarmDialog = new AlarmDialog( this ); | 613 | mAlarmDialog = new AlarmDialog( this ); |
614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
615 | mAlarmDialog->setServerNotification( false ); | 615 | mAlarmDialog->setServerNotification( false ); |
616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
617 | 617 | ||
618 | 618 | ||
619 | #ifndef DESKTOP_VERSION | 619 | #ifndef DESKTOP_VERSION |
620 | //US listen for arriving address resultsets | 620 | //US listen for arriving address resultsets |
621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
623 | #endif | 623 | #endif |
624 | mDateNavigator->setCalendar( mCalendar ); | 624 | mDateNavigator->setCalendar( mCalendar ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | CalendarView::~CalendarView() | 628 | CalendarView::~CalendarView() |
629 | { | 629 | { |
630 | // kdDebug() << "~CalendarView()" << endl; | 630 | // kdDebug() << "~CalendarView()" << endl; |
631 | //qDebug("CalendarView::~CalendarView() "); | 631 | //qDebug("CalendarView::~CalendarView() "); |
632 | delete mDialogManager; | 632 | delete mDialogManager; |
633 | delete mViewManager; | 633 | delete mViewManager; |
634 | delete mStorage; | 634 | delete mStorage; |
635 | delete mDateFrame ; | 635 | delete mDateFrame ; |
636 | delete beamDialog; | 636 | delete beamDialog; |
637 | delete mEventViewerDialog; | 637 | delete mEventViewerDialog; |
638 | //kdDebug() << "~CalendarView() done" << endl; | 638 | //kdDebug() << "~CalendarView() done" << endl; |
639 | } | 639 | } |
640 | void CalendarView::checkAlarms() | 640 | void CalendarView::checkAlarms() |
641 | { | 641 | { |
642 | KConfig *config = KOGlobals::config(); | 642 | KConfig *config = KOGlobals::config(); |
643 | config->setGroup( "AppRun" ); | 643 | config->setGroup( "AppRun" ); |
644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
645 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 645 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
646 | int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; | 646 | int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; |
647 | qDebug("KO: Reading program stop %d ", secs); | ||
647 | //secs -= ( 3600 * 24*3 ); // debug only | 648 | //secs -= ( 3600 * 24*3 ); // debug only |
648 | QDateTime latest = dt.addSecs ( secs ); | 649 | QDateTime latest = dt.addSecs ( secs ); |
649 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 650 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
651 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | ||
650 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 652 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
651 | QPtrList<Incidence> al; | 653 | QPtrList<Incidence> al; |
652 | Incidence* inL = el.first(); | 654 | Incidence* inL = el.first(); |
653 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 655 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
654 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 656 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
655 | while ( inL ) { | 657 | while ( inL ) { |
656 | bool ok = false; | 658 | bool ok = false; |
657 | int offset = 0; | 659 | int offset = 0; |
658 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 660 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
659 | if ( ok ) { | 661 | if ( ok ) { |
660 | //qDebug("OK %s",next.toString().latin1()); | 662 | //qDebug("OK %s",next.toString().latin1()); |
661 | if ( next < cur ) { | 663 | if ( next < cur ) { |
662 | al.append( inL ); | 664 | al.append( inL ); |
663 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 665 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
664 | } | 666 | } |
665 | } | 667 | } |
666 | inL = el.next(); | 668 | inL = el.next(); |
667 | } | 669 | } |
668 | if ( al.count() ) { | 670 | if ( al.count() ) { |
669 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 671 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
670 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 672 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
671 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 673 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
672 | lay->setSpacing( 0 ); | 674 | lay->setSpacing( 0 ); |
673 | lay->setMargin( 0 ); | 675 | lay->setMargin( 0 ); |
674 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 676 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
675 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 677 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
676 | lay->addWidget( matb ); | 678 | lay->addWidget( matb ); |
677 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 679 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
678 | int wid = 210; | 680 | int wid = 210; |
679 | int x = QApplication::desktop()->width() - wid - 7; | 681 | int x = QApplication::desktop()->width() - wid - 7; |
680 | int y = QApplication::desktop()->height() - wid - 70; | 682 | int y = QApplication::desktop()->height() - wid - 70; |
681 | dia->setGeometry ( x,y,wid,wid); | 683 | dia->setGeometry ( x,y,wid,wid); |
682 | } else { | 684 | } else { |
683 | int si = 220; | 685 | int si = 220; |
684 | if ( QApplication::desktop()->width() > 470 ) | 686 | if ( QApplication::desktop()->width() > 470 ) |
685 | si = 400; | 687 | si = 400; |
686 | dia->resize(si,si/2); | 688 | dia->resize(si,si/2); |
687 | } | 689 | } |
688 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 690 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
689 | dia->show(); | 691 | dia->show(); |
690 | 692 | ||
691 | } | 693 | } |
692 | } | 694 | } |
693 | void CalendarView::showDay( QDate d ) | 695 | void CalendarView::showDay( QDate d ) |
694 | { | 696 | { |
695 | dateNavigator()->blockSignals( true ); | 697 | dateNavigator()->blockSignals( true ); |
696 | dateNavigator()->selectDate( d ); | 698 | dateNavigator()->selectDate( d ); |
697 | dateNavigator()->blockSignals( false ); | 699 | dateNavigator()->blockSignals( false ); |
698 | mViewManager->showDayView(); | 700 | mViewManager->showDayView(); |
699 | //dateNavigator()->selectDate( d ); | 701 | //dateNavigator()->selectDate( d ); |
700 | } | 702 | } |
701 | void CalendarView::timerAlarm() | 703 | void CalendarView::timerAlarm() |
702 | { | 704 | { |
703 | //qDebug("CalendarView::timerAlarm() "); | 705 | //qDebug("CalendarView::timerAlarm() "); |
704 | computeAlarm(mAlarmNotification ); | 706 | computeAlarm(mAlarmNotification ); |
705 | } | 707 | } |
706 | 708 | ||
707 | void CalendarView::suspendAlarm() | 709 | void CalendarView::suspendAlarm() |
708 | { | 710 | { |
709 | //qDebug(" CalendarView::suspendAlarm() "); | 711 | //qDebug(" CalendarView::suspendAlarm() "); |
710 | computeAlarm(mSuspendAlarmNotification ); | 712 | computeAlarm(mSuspendAlarmNotification ); |
711 | 713 | ||
712 | } | 714 | } |
713 | 715 | ||
714 | void CalendarView::startAlarm( QString mess , QString filename) | 716 | void CalendarView::startAlarm( QString mess , QString filename) |
715 | { | 717 | { |
716 | 718 | ||
717 | topLevelWidget()->showNormal(); | 719 | topLevelWidget()->showNormal(); |
718 | topLevelWidget()->setActiveWindow(); | 720 | topLevelWidget()->setActiveWindow(); |
719 | topLevelWidget()->raise(); | 721 | topLevelWidget()->raise(); |
720 | 722 | ||
721 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 723 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
722 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 724 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
723 | 725 | ||
724 | } | 726 | } |
725 | 727 | ||
726 | void CalendarView::checkNextTimerAlarm() | 728 | void CalendarView::checkNextTimerAlarm() |
727 | { | 729 | { |
728 | mCalendar->checkAlarmForIncidence( 0, true ); | 730 | mCalendar->checkAlarmForIncidence( 0, true ); |
729 | } | 731 | } |
730 | 732 | ||
731 | void CalendarView::computeAlarm( QString msg ) | 733 | void CalendarView::computeAlarm( QString msg ) |
732 | { | 734 | { |
733 | 735 | ||
734 | QString mess = msg; | 736 | QString mess = msg; |
735 | QString mAlarmMessage = mess.mid( 9 ); | 737 | QString mAlarmMessage = mess.mid( 9 ); |
736 | QString filename = MainWindow::resourcePath(); | 738 | QString filename = MainWindow::resourcePath(); |
737 | filename += "koalarm.wav"; | 739 | filename += "koalarm.wav"; |
738 | QString tempfilename; | 740 | QString tempfilename; |
739 | if ( mess.left( 13 ) == "suspend_alarm") { | 741 | if ( mess.left( 13 ) == "suspend_alarm") { |
740 | bool error = false; | 742 | bool error = false; |
741 | int len = mess.mid( 13 ).find("+++"); | 743 | int len = mess.mid( 13 ).find("+++"); |
742 | if ( len < 2 ) | 744 | if ( len < 2 ) |
743 | error = true; | 745 | error = true; |
744 | else { | 746 | else { |
745 | tempfilename = mess.mid( 13, len ); | 747 | tempfilename = mess.mid( 13, len ); |
746 | if ( !QFile::exists( tempfilename ) ) | 748 | if ( !QFile::exists( tempfilename ) ) |
747 | error = true; | 749 | error = true; |
748 | } | 750 | } |
749 | if ( ! error ) { | 751 | if ( ! error ) { |
750 | filename = tempfilename; | 752 | filename = tempfilename; |
751 | } | 753 | } |
752 | mAlarmMessage = mess.mid( 13+len+3 ); | 754 | mAlarmMessage = mess.mid( 13+len+3 ); |
753 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 755 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
754 | startAlarm( mAlarmMessage, filename); | 756 | startAlarm( mAlarmMessage, filename); |
755 | return; | 757 | return; |
756 | } | 758 | } |
757 | if ( mess.left( 11 ) == "timer_alarm") { | 759 | if ( mess.left( 11 ) == "timer_alarm") { |
758 | //mTimerTime = 0; | 760 | //mTimerTime = 0; |
759 | startAlarm( mess.mid( 11 ), filename ); | 761 | startAlarm( mess.mid( 11 ), filename ); |
760 | return; | 762 | return; |
761 | } | 763 | } |
762 | if ( mess.left( 10 ) == "proc_alarm") { | 764 | if ( mess.left( 10 ) == "proc_alarm") { |
763 | bool error = false; | 765 | bool error = false; |
764 | int len = mess.mid( 10 ).find("+++"); | 766 | int len = mess.mid( 10 ).find("+++"); |
765 | if ( len < 2 ) | 767 | if ( len < 2 ) |
766 | error = true; | 768 | error = true; |
767 | else { | 769 | else { |
768 | tempfilename = mess.mid( 10, len ); | 770 | tempfilename = mess.mid( 10, len ); |
769 | if ( !QFile::exists( tempfilename ) ) | 771 | if ( !QFile::exists( tempfilename ) ) |
770 | error = true; | 772 | error = true; |
771 | } | 773 | } |
772 | if ( error ) { | 774 | if ( error ) { |
773 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 775 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
774 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 776 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
775 | } else { | 777 | } else { |
776 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 778 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
777 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 779 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
@@ -2031,258 +2033,263 @@ void CalendarView::readSettings() | |||
2031 | globalFlagBlockAgenda = 1; | 2033 | globalFlagBlockAgenda = 1; |
2032 | mViewManager->showAgendaView(); | 2034 | mViewManager->showAgendaView(); |
2033 | //mViewManager->readSettings( config ); | 2035 | //mViewManager->readSettings( config ); |
2034 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2036 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2035 | readFilterSettings(config); | 2037 | readFilterSettings(config); |
2036 | 2038 | ||
2037 | #ifdef DESKTOP_VERSION | 2039 | #ifdef DESKTOP_VERSION |
2038 | config->setGroup("WidgetLayout"); | 2040 | config->setGroup("WidgetLayout"); |
2039 | QStringList list; | 2041 | QStringList list; |
2040 | list = config->readListEntry("MainLayout"); | 2042 | list = config->readListEntry("MainLayout"); |
2041 | int x,y,w,h; | 2043 | int x,y,w,h; |
2042 | if ( ! list.isEmpty() ) { | 2044 | if ( ! list.isEmpty() ) { |
2043 | x = list[0].toInt(); | 2045 | x = list[0].toInt(); |
2044 | y = list[1].toInt(); | 2046 | y = list[1].toInt(); |
2045 | w = list[2].toInt(); | 2047 | w = list[2].toInt(); |
2046 | h = list[3].toInt(); | 2048 | h = list[3].toInt(); |
2047 | KApplication::testCoords( &x,&y,&w,&h ); | 2049 | KApplication::testCoords( &x,&y,&w,&h ); |
2048 | topLevelWidget()->setGeometry(x,y,w,h); | 2050 | topLevelWidget()->setGeometry(x,y,w,h); |
2049 | 2051 | ||
2050 | } else { | 2052 | } else { |
2051 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2053 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2052 | } | 2054 | } |
2053 | list = config->readListEntry("EditEventLayout"); | 2055 | list = config->readListEntry("EditEventLayout"); |
2054 | if ( ! list.isEmpty() ) { | 2056 | if ( ! list.isEmpty() ) { |
2055 | x = list[0].toInt(); | 2057 | x = list[0].toInt(); |
2056 | y = list[1].toInt(); | 2058 | y = list[1].toInt(); |
2057 | w = list[2].toInt(); | 2059 | w = list[2].toInt(); |
2058 | h = list[3].toInt(); | 2060 | h = list[3].toInt(); |
2059 | KApplication::testCoords( &x,&y,&w,&h ); | 2061 | KApplication::testCoords( &x,&y,&w,&h ); |
2060 | mEventEditor->setGeometry(x,y,w,h); | 2062 | mEventEditor->setGeometry(x,y,w,h); |
2061 | 2063 | ||
2062 | } | 2064 | } |
2063 | list = config->readListEntry("EditTodoLayout"); | 2065 | list = config->readListEntry("EditTodoLayout"); |
2064 | if ( ! list.isEmpty() ) { | 2066 | if ( ! list.isEmpty() ) { |
2065 | x = list[0].toInt(); | 2067 | x = list[0].toInt(); |
2066 | y = list[1].toInt(); | 2068 | y = list[1].toInt(); |
2067 | w = list[2].toInt(); | 2069 | w = list[2].toInt(); |
2068 | h = list[3].toInt(); | 2070 | h = list[3].toInt(); |
2069 | KApplication::testCoords( &x,&y,&w,&h ); | 2071 | KApplication::testCoords( &x,&y,&w,&h ); |
2070 | mTodoEditor->setGeometry(x,y,w,h); | 2072 | mTodoEditor->setGeometry(x,y,w,h); |
2071 | 2073 | ||
2072 | } | 2074 | } |
2073 | list = config->readListEntry("ViewerLayout"); | 2075 | list = config->readListEntry("ViewerLayout"); |
2074 | if ( ! list.isEmpty() ) { | 2076 | if ( ! list.isEmpty() ) { |
2075 | x = list[0].toInt(); | 2077 | x = list[0].toInt(); |
2076 | y = list[1].toInt(); | 2078 | y = list[1].toInt(); |
2077 | w = list[2].toInt(); | 2079 | w = list[2].toInt(); |
2078 | h = list[3].toInt(); | 2080 | h = list[3].toInt(); |
2079 | KApplication::testCoords( &x,&y,&w,&h ); | 2081 | KApplication::testCoords( &x,&y,&w,&h ); |
2080 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2082 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2081 | } | 2083 | } |
2082 | #endif | 2084 | #endif |
2083 | config->setGroup( "Views" ); | 2085 | config->setGroup( "Views" ); |
2084 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2086 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2085 | 2087 | ||
2086 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2088 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2087 | 2089 | ||
2088 | int resetval = 0; | 2090 | int resetval = 0; |
2089 | int maxVal = 0; | 2091 | int maxVal = 0; |
2090 | if (sizes.count() != 3) { | 2092 | if (sizes.count() != 3) { |
2091 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2093 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2092 | resetval = mDateNavigator->sizeHint().width()+2; | 2094 | resetval = mDateNavigator->sizeHint().width()+2; |
2093 | } else { | 2095 | } else { |
2094 | resetval = mDateNavigator->sizeHint().height()+2; | 2096 | resetval = mDateNavigator->sizeHint().height()+2; |
2095 | } | 2097 | } |
2096 | } | 2098 | } |
2097 | if ( resetval ) { | 2099 | if ( resetval ) { |
2098 | sizes.clear(); | 2100 | sizes.clear(); |
2099 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2101 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2100 | maxVal = QApplication::desktop()->width() -10; | 2102 | maxVal = QApplication::desktop()->width() -10; |
2101 | } else { | 2103 | } else { |
2102 | maxVal = QApplication::desktop()->height()-10; | 2104 | maxVal = QApplication::desktop()->height()-10; |
2103 | } | 2105 | } |
2104 | sizes << resetval; | 2106 | sizes << resetval; |
2105 | if ( maxVal < resetval + resetval) | 2107 | if ( maxVal < resetval + resetval) |
2106 | resetval = maxVal - resetval; | 2108 | resetval = maxVal - resetval; |
2107 | sizes << resetval; | 2109 | sizes << resetval; |
2108 | sizes << 100; | 2110 | sizes << 100; |
2109 | } | 2111 | } |
2110 | mLeftFrame->setSizes(sizes); | 2112 | mLeftFrame->setSizes(sizes); |
2111 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2113 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2112 | resetval = 0; | 2114 | resetval = 0; |
2113 | maxVal = 0; | 2115 | maxVal = 0; |
2114 | if (sizes.count() != 2) { | 2116 | if (sizes.count() != 2) { |
2115 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2117 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2116 | resetval = mDateNavigator->sizeHint().width()+2; | 2118 | resetval = mDateNavigator->sizeHint().width()+2; |
2117 | } else { | 2119 | } else { |
2118 | resetval = mDateNavigator->sizeHint().height()+2; | 2120 | resetval = mDateNavigator->sizeHint().height()+2; |
2119 | } | 2121 | } |
2120 | } | 2122 | } |
2121 | if ( resetval ) { | 2123 | if ( resetval ) { |
2122 | sizes.clear(); | 2124 | sizes.clear(); |
2123 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2125 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2124 | maxVal = QApplication::desktop()->width() -10; | 2126 | maxVal = QApplication::desktop()->width() -10; |
2125 | } else { | 2127 | } else { |
2126 | maxVal = QApplication::desktop()->height()-10; | 2128 | maxVal = QApplication::desktop()->height()-10; |
2127 | } | 2129 | } |
2128 | sizes << resetval; | 2130 | sizes << resetval; |
2129 | if ( maxVal < resetval + resetval) | 2131 | if ( maxVal < resetval + resetval) |
2130 | resetval = maxVal - resetval; | 2132 | resetval = maxVal - resetval; |
2131 | sizes << resetval; | 2133 | sizes << resetval; |
2132 | } | 2134 | } |
2133 | mMainFrame->setSizes(sizes); | 2135 | mMainFrame->setSizes(sizes); |
2134 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2136 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2135 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2137 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2136 | else mNavigator->selectDates( dateCount ); | 2138 | else mNavigator->selectDates( dateCount ); |
2137 | // mViewManager->readSettings( config ); | 2139 | // mViewManager->readSettings( config ); |
2138 | updateConfig(); | 2140 | updateConfig(); |
2139 | globalFlagBlockAgenda = 2; | 2141 | globalFlagBlockAgenda = 2; |
2140 | mViewManager->readSettings( config ); | 2142 | mViewManager->readSettings( config ); |
2141 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2143 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2142 | } | 2144 | } |
2143 | 2145 | ||
2144 | 2146 | ||
2145 | void CalendarView::writeSettings() | 2147 | void CalendarView::writeSettings() |
2146 | { | 2148 | { |
2147 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2149 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2148 | 2150 | ||
2149 | KConfig *config = KOGlobals::config(); | 2151 | KConfig *config = KOGlobals::config(); |
2150 | 2152 | ||
2151 | mViewManager->writeSettings( config ); | 2153 | mViewManager->writeSettings( config ); |
2152 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2154 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2153 | mDialogManager->writeSettings( config ); | 2155 | mDialogManager->writeSettings( config ); |
2154 | //KOPrefs::instance()->usrWriteConfig(); | 2156 | //KOPrefs::instance()->usrWriteConfig(); |
2155 | KOPrefs::instance()->writeConfig(); | 2157 | KOPrefs::instance()->writeConfig(); |
2156 | 2158 | ||
2157 | writeFilterSettings(config); | 2159 | writeFilterSettings(config); |
2158 | config->setGroup( "AppRun" ); | 2160 | config->setGroup( "AppRun" ); |
2159 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2161 | QDateTime dt ( QDate (2005,3,1), QTime( 0,0,0 ) ); |
2160 | config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) ); | 2162 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2163 | config->writeEntry( "LatestProgramStop", secs ); | ||
2164 | qDebug("KO: Writing stop time: %d ", secs); | ||
2165 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | ||
2166 | QDateTime latest = dt.addSecs ( secs ); | ||
2167 | qDebug("KO: Test termination on %s ", latest.toString().latin1()); | ||
2161 | config->setGroup( "Views" ); | 2168 | config->setGroup( "Views" ); |
2162 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2169 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2163 | 2170 | ||
2164 | QValueList<int> listINT = mLeftFrame->sizes(); | 2171 | QValueList<int> listINT = mLeftFrame->sizes(); |
2165 | config->writeEntry("Left Splitter Frame",listINT); | 2172 | config->writeEntry("Left Splitter Frame",listINT); |
2166 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2173 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2167 | config->writeEntry("Main Splitter Frame",listINT2); | 2174 | config->writeEntry("Main Splitter Frame",listINT2); |
2168 | #ifdef DESKTOP_VERSION | 2175 | #ifdef DESKTOP_VERSION |
2169 | config->setGroup("WidgetLayout"); | 2176 | config->setGroup("WidgetLayout"); |
2170 | QStringList list ;//= config->readListEntry("MainLayout"); | 2177 | QStringList list ;//= config->readListEntry("MainLayout"); |
2171 | int x,y,w,h; | 2178 | int x,y,w,h; |
2172 | QWidget* wid; | 2179 | QWidget* wid; |
2173 | wid = topLevelWidget(); | 2180 | wid = topLevelWidget(); |
2174 | x = wid->geometry().x(); | 2181 | x = wid->geometry().x(); |
2175 | y = wid->geometry().y(); | 2182 | y = wid->geometry().y(); |
2176 | w = wid->width(); | 2183 | w = wid->width(); |
2177 | h = wid->height(); | 2184 | h = wid->height(); |
2178 | list.clear(); | 2185 | list.clear(); |
2179 | list << QString::number( x ); | 2186 | list << QString::number( x ); |
2180 | list << QString::number( y ); | 2187 | list << QString::number( y ); |
2181 | list << QString::number( w ); | 2188 | list << QString::number( w ); |
2182 | list << QString::number( h ); | 2189 | list << QString::number( h ); |
2183 | config->writeEntry("MainLayout",list ); | 2190 | config->writeEntry("MainLayout",list ); |
2184 | 2191 | ||
2185 | wid = mEventEditor; | 2192 | wid = mEventEditor; |
2186 | x = wid->geometry().x(); | 2193 | x = wid->geometry().x(); |
2187 | y = wid->geometry().y(); | 2194 | y = wid->geometry().y(); |
2188 | w = wid->width(); | 2195 | w = wid->width(); |
2189 | h = wid->height(); | 2196 | h = wid->height(); |
2190 | list.clear(); | 2197 | list.clear(); |
2191 | list << QString::number( x ); | 2198 | list << QString::number( x ); |
2192 | list << QString::number( y ); | 2199 | list << QString::number( y ); |
2193 | list << QString::number( w ); | 2200 | list << QString::number( w ); |
2194 | list << QString::number( h ); | 2201 | list << QString::number( h ); |
2195 | config->writeEntry("EditEventLayout",list ); | 2202 | config->writeEntry("EditEventLayout",list ); |
2196 | 2203 | ||
2197 | wid = mTodoEditor; | 2204 | wid = mTodoEditor; |
2198 | x = wid->geometry().x(); | 2205 | x = wid->geometry().x(); |
2199 | y = wid->geometry().y(); | 2206 | y = wid->geometry().y(); |
2200 | w = wid->width(); | 2207 | w = wid->width(); |
2201 | h = wid->height(); | 2208 | h = wid->height(); |
2202 | list.clear(); | 2209 | list.clear(); |
2203 | list << QString::number( x ); | 2210 | list << QString::number( x ); |
2204 | list << QString::number( y ); | 2211 | list << QString::number( y ); |
2205 | list << QString::number( w ); | 2212 | list << QString::number( w ); |
2206 | list << QString::number( h ); | 2213 | list << QString::number( h ); |
2207 | config->writeEntry("EditTodoLayout",list ); | 2214 | config->writeEntry("EditTodoLayout",list ); |
2208 | wid = getEventViewerDialog(); | 2215 | wid = getEventViewerDialog(); |
2209 | x = wid->geometry().x(); | 2216 | x = wid->geometry().x(); |
2210 | y = wid->geometry().y(); | 2217 | y = wid->geometry().y(); |
2211 | w = wid->width(); | 2218 | w = wid->width(); |
2212 | h = wid->height(); | 2219 | h = wid->height(); |
2213 | list.clear(); | 2220 | list.clear(); |
2214 | list << QString::number( x ); | 2221 | list << QString::number( x ); |
2215 | list << QString::number( y ); | 2222 | list << QString::number( y ); |
2216 | list << QString::number( w ); | 2223 | list << QString::number( w ); |
2217 | list << QString::number( h ); | 2224 | list << QString::number( h ); |
2218 | config->writeEntry("ViewerLayout",list ); | 2225 | config->writeEntry("ViewerLayout",list ); |
2219 | wid = mDialogManager->getSearchDialog(); | 2226 | wid = mDialogManager->getSearchDialog(); |
2220 | if ( wid ) { | 2227 | if ( wid ) { |
2221 | x = wid->geometry().x(); | 2228 | x = wid->geometry().x(); |
2222 | y = wid->geometry().y(); | 2229 | y = wid->geometry().y(); |
2223 | w = wid->width(); | 2230 | w = wid->width(); |
2224 | h = wid->height(); | 2231 | h = wid->height(); |
2225 | list.clear(); | 2232 | list.clear(); |
2226 | list << QString::number( x ); | 2233 | list << QString::number( x ); |
2227 | list << QString::number( y ); | 2234 | list << QString::number( y ); |
2228 | list << QString::number( w ); | 2235 | list << QString::number( w ); |
2229 | list << QString::number( h ); | 2236 | list << QString::number( h ); |
2230 | config->writeEntry("SearchLayout",list ); | 2237 | config->writeEntry("SearchLayout",list ); |
2231 | } | 2238 | } |
2232 | #endif | 2239 | #endif |
2233 | 2240 | ||
2234 | 2241 | ||
2235 | config->sync(); | 2242 | config->sync(); |
2236 | } | 2243 | } |
2237 | 2244 | ||
2238 | void CalendarView::readFilterSettings(KConfig *config) | 2245 | void CalendarView::readFilterSettings(KConfig *config) |
2239 | { | 2246 | { |
2240 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2247 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2241 | 2248 | ||
2242 | mFilters.clear(); | 2249 | mFilters.clear(); |
2243 | 2250 | ||
2244 | config->setGroup("General"); | 2251 | config->setGroup("General"); |
2245 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2252 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2246 | 2253 | ||
2247 | QStringList::ConstIterator it = filterList.begin(); | 2254 | QStringList::ConstIterator it = filterList.begin(); |
2248 | QStringList::ConstIterator end = filterList.end(); | 2255 | QStringList::ConstIterator end = filterList.end(); |
2249 | while(it != end) { | 2256 | while(it != end) { |
2250 | // kdDebug() << " filter: " << (*it) << endl; | 2257 | // kdDebug() << " filter: " << (*it) << endl; |
2251 | 2258 | ||
2252 | CalFilter *filter; | 2259 | CalFilter *filter; |
2253 | filter = new CalFilter(*it); | 2260 | filter = new CalFilter(*it); |
2254 | config->setGroup("Filter_" + (*it).utf8()); | 2261 | config->setGroup("Filter_" + (*it).utf8()); |
2255 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2262 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2256 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2263 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2257 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2264 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2258 | mFilters.append(filter); | 2265 | mFilters.append(filter); |
2259 | 2266 | ||
2260 | ++it; | 2267 | ++it; |
2261 | } | 2268 | } |
2262 | 2269 | ||
2263 | if (mFilters.count() == 0) { | 2270 | if (mFilters.count() == 0) { |
2264 | CalFilter *filter = new CalFilter(i18n("Default")); | 2271 | CalFilter *filter = new CalFilter(i18n("Default")); |
2265 | mFilters.append(filter); | 2272 | mFilters.append(filter); |
2266 | } | 2273 | } |
2267 | mFilterView->updateFilters(); | 2274 | mFilterView->updateFilters(); |
2268 | config->setGroup("FilterView"); | 2275 | config->setGroup("FilterView"); |
2269 | 2276 | ||
2270 | mFilterView->blockSignals(true); | 2277 | mFilterView->blockSignals(true); |
2271 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2278 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2272 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2279 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2273 | mFilterView->blockSignals(false); | 2280 | mFilterView->blockSignals(false); |
2274 | // We do it manually to avoid it being done twice by the above calls | 2281 | // We do it manually to avoid it being done twice by the above calls |
2275 | updateFilter(); | 2282 | updateFilter(); |
2276 | } | 2283 | } |
2277 | 2284 | ||
2278 | void CalendarView::writeFilterSettings(KConfig *config) | 2285 | void CalendarView::writeFilterSettings(KConfig *config) |
2279 | { | 2286 | { |
2280 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2287 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2281 | 2288 | ||
2282 | QStringList filterList; | 2289 | QStringList filterList; |
2283 | 2290 | ||
2284 | CalFilter *filter = mFilters.first(); | 2291 | CalFilter *filter = mFilters.first(); |
2285 | while(filter) { | 2292 | while(filter) { |
2286 | // kdDebug() << " fn: " << filter->name() << endl; | 2293 | // kdDebug() << " fn: " << filter->name() << endl; |
2287 | filterList << filter->name(); | 2294 | filterList << filter->name(); |
2288 | config->setGroup("Filter_" + filter->name().utf8()); | 2295 | config->setGroup("Filter_" + filter->name().utf8()); |