-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 36db9c4..c01be9b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -537,193 +537,193 @@ void CalendarView::init() | |||
537 | SLOT( purgeCompleted() ) ); | 537 | SLOT( purgeCompleted() ) ); |
538 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 538 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
539 | SIGNAL( todoModified( Todo *, int ) ) ); | 539 | SIGNAL( todoModified( Todo *, int ) ) ); |
540 | 540 | ||
541 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 541 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
542 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 542 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
543 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 543 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
544 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 544 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
545 | 545 | ||
546 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 546 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
547 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 547 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
548 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 548 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
549 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 549 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
550 | 550 | ||
551 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 551 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
552 | this, SLOT ( todo_unsub( Todo * ) ) ); | 552 | this, SLOT ( todo_unsub( Todo * ) ) ); |
553 | 553 | ||
554 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 554 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
555 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 555 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
556 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 556 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
557 | SLOT( updateTodo( Todo *, int ) ) ); | 557 | SLOT( updateTodo( Todo *, int ) ) ); |
558 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 558 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
559 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 559 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
560 | 560 | ||
561 | 561 | ||
562 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 562 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
563 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 563 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
564 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 564 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
565 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 565 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
566 | 566 | ||
567 | 567 | ||
568 | 568 | ||
569 | 569 | ||
570 | 570 | ||
571 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 571 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
572 | SLOT(checkClipboard())); | 572 | SLOT(checkClipboard())); |
573 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 573 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
574 | SLOT( processTodoListSelection( Incidence * ) ) ); | 574 | SLOT( processTodoListSelection( Incidence * ) ) ); |
575 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 575 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
576 | 576 | ||
577 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 577 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
578 | 578 | ||
579 | mDateFrame = new QVBox(0,0,WType_Popup); | 579 | mDateFrame = new QVBox(0,0,WType_Popup); |
580 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 580 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
581 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 581 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
582 | mDateFrame->setLineWidth(3); | 582 | mDateFrame->setLineWidth(3); |
583 | mDateFrame->hide(); | 583 | mDateFrame->hide(); |
584 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 584 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
585 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 585 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
586 | 586 | ||
587 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 587 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
588 | 588 | ||
589 | mEventEditor = mDialogManager->getEventEditor(); | 589 | mEventEditor = mDialogManager->getEventEditor(); |
590 | mTodoEditor = mDialogManager->getTodoEditor(); | 590 | mTodoEditor = mDialogManager->getTodoEditor(); |
591 | 591 | ||
592 | mFlagEditDescription = false; | 592 | mFlagEditDescription = false; |
593 | 593 | ||
594 | mSuspendTimer = new QTimer( this ); | 594 | mSuspendTimer = new QTimer( this ); |
595 | mAlarmTimer = new QTimer( this ); | 595 | mAlarmTimer = new QTimer( this ); |
596 | mRecheckAlarmTimer = new QTimer( this ); | 596 | mRecheckAlarmTimer = new QTimer( this ); |
597 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 597 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
598 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 598 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
599 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 599 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
600 | mAlarmDialog = new AlarmDialog( this ); | 600 | mAlarmDialog = new AlarmDialog( this ); |
601 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 601 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
602 | mAlarmDialog->setServerNotification( false ); | 602 | mAlarmDialog->setServerNotification( false ); |
603 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 603 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
604 | 604 | ||
605 | 605 | ||
606 | #ifndef DESKTOP_VERSION | 606 | #ifndef DESKTOP_VERSION |
607 | //US listen for arriving address resultsets | 607 | //US listen for arriving address resultsets |
608 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 608 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
609 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 609 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
610 | #endif | 610 | #endif |
611 | mDateNavigator->setCalendar( mCalendar ); | 611 | mDateNavigator->setCalendar( mCalendar ); |
612 | } | 612 | } |
613 | 613 | ||
614 | 614 | ||
615 | CalendarView::~CalendarView() | 615 | CalendarView::~CalendarView() |
616 | { | 616 | { |
617 | // kdDebug() << "~CalendarView()" << endl; | 617 | // kdDebug() << "~CalendarView()" << endl; |
618 | //qDebug("CalendarView::~CalendarView() "); | 618 | //qDebug("CalendarView::~CalendarView() "); |
619 | delete mDialogManager; | 619 | delete mDialogManager; |
620 | delete mViewManager; | 620 | delete mViewManager; |
621 | delete mStorage; | 621 | delete mStorage; |
622 | delete mDateFrame ; | 622 | delete mDateFrame ; |
623 | delete beamDialog; | 623 | delete beamDialog; |
624 | delete mEventViewerDialog; | 624 | delete mEventViewerDialog; |
625 | //kdDebug() << "~CalendarView() done" << endl; | 625 | //kdDebug() << "~CalendarView() done" << endl; |
626 | } | 626 | } |
627 | void CalendarView::checkAlarms() | 627 | void CalendarView::checkAlarms() |
628 | { | 628 | { |
629 | KConfig *config = KOGlobals::config(); | 629 | KConfig *config = KOGlobals::config(); |
630 | config->setGroup( "AppRun" ); | 630 | config->setGroup( "AppRun" ); |
631 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 631 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
632 | int secs = config->readNumEntry( "LatestProgramStop" ) - 30; | 632 | int secs = config->readNumEntry( "LatestProgramStop" ) - 30; |
633 | //secs -= ( 3600 * 24*3 ); // debug only | 633 | secs -= ( 3600 * 24*3 ); // debug only |
634 | QDateTime latest = dt.addSecs ( secs ); | 634 | QDateTime latest = dt.addSecs ( secs ); |
635 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 635 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
636 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 636 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
637 | QPtrList<Incidence> al; | 637 | QPtrList<Incidence> al; |
638 | Incidence* inL = el.first(); | 638 | Incidence* inL = el.first(); |
639 | while ( inL ) { | 639 | while ( inL ) { |
640 | bool ok = false; | 640 | bool ok = false; |
641 | int offset = 0; | 641 | int offset = 0; |
642 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 642 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
643 | if ( ok ) { | 643 | if ( ok ) { |
644 | //qDebug("OK %s",next.toString().latin1()); | 644 | //qDebug("OK %s",next.toString().latin1()); |
645 | if ( next < QDateTime::currentDateTime() ) { | 645 | if ( next < QDateTime::currentDateTime() ) { |
646 | al.append( inL ); | 646 | al.append( inL ); |
647 | qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 647 | qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | inL = el.next(); | 650 | inL = el.next(); |
651 | } | 651 | } |
652 | if ( al.count() ) { | 652 | if ( al.count() ) { |
653 | QDialog dia ( this, "huhu", true ); | 653 | QDialog dia ( this, "huhu", true ); |
654 | dia.setCaption( i18n("KO/Pi: Missing alarm notification!") ); | 654 | dia.setCaption( i18n("KO/Pi: Missing alarm notification!") ); |
655 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 655 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
656 | lay->setSpacing( 3 ); | 656 | lay->setSpacing( 3 ); |
657 | lay->setMargin( 3 ); | 657 | lay->setMargin( 3 ); |
658 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest ); | 658 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest ); |
659 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 659 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
660 | lay->addWidget( matb ); | 660 | lay->addWidget( matb ); |
661 | dia.resize(240,240); | 661 | dia.resize(240,240); |
662 | dia.exec(); | 662 | dia.exec(); |
663 | 663 | ||
664 | } | 664 | } |
665 | } | 665 | } |
666 | void CalendarView::showDay( QDate d ) | 666 | void CalendarView::showDay( QDate d ) |
667 | { | 667 | { |
668 | dateNavigator()->blockSignals( true ); | 668 | dateNavigator()->blockSignals( true ); |
669 | dateNavigator()->selectDate( d ); | 669 | dateNavigator()->selectDate( d ); |
670 | dateNavigator()->blockSignals( false ); | 670 | dateNavigator()->blockSignals( false ); |
671 | mViewManager->showDayView(); | 671 | mViewManager->showDayView(); |
672 | //dateNavigator()->selectDate( d ); | 672 | //dateNavigator()->selectDate( d ); |
673 | } | 673 | } |
674 | void CalendarView::timerAlarm() | 674 | void CalendarView::timerAlarm() |
675 | { | 675 | { |
676 | //qDebug("CalendarView::timerAlarm() "); | 676 | //qDebug("CalendarView::timerAlarm() "); |
677 | computeAlarm(mAlarmNotification ); | 677 | computeAlarm(mAlarmNotification ); |
678 | } | 678 | } |
679 | 679 | ||
680 | void CalendarView::suspendAlarm() | 680 | void CalendarView::suspendAlarm() |
681 | { | 681 | { |
682 | //qDebug(" CalendarView::suspendAlarm() "); | 682 | //qDebug(" CalendarView::suspendAlarm() "); |
683 | computeAlarm(mSuspendAlarmNotification ); | 683 | computeAlarm(mSuspendAlarmNotification ); |
684 | 684 | ||
685 | } | 685 | } |
686 | 686 | ||
687 | void CalendarView::startAlarm( QString mess , QString filename) | 687 | void CalendarView::startAlarm( QString mess , QString filename) |
688 | { | 688 | { |
689 | 689 | ||
690 | topLevelWidget()->showNormal(); | 690 | topLevelWidget()->showNormal(); |
691 | topLevelWidget()->setActiveWindow(); | 691 | topLevelWidget()->setActiveWindow(); |
692 | topLevelWidget()->raise(); | 692 | topLevelWidget()->raise(); |
693 | 693 | ||
694 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 694 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
695 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 695 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
696 | 696 | ||
697 | } | 697 | } |
698 | 698 | ||
699 | void CalendarView::checkNextTimerAlarm() | 699 | void CalendarView::checkNextTimerAlarm() |
700 | { | 700 | { |
701 | mCalendar->checkAlarmForIncidence( 0, true ); | 701 | mCalendar->checkAlarmForIncidence( 0, true ); |
702 | } | 702 | } |
703 | 703 | ||
704 | void CalendarView::computeAlarm( QString msg ) | 704 | void CalendarView::computeAlarm( QString msg ) |
705 | { | 705 | { |
706 | 706 | ||
707 | QString mess = msg; | 707 | QString mess = msg; |
708 | QString mAlarmMessage = mess.mid( 9 ); | 708 | QString mAlarmMessage = mess.mid( 9 ); |
709 | QString filename = MainWindow::resourcePath(); | 709 | QString filename = MainWindow::resourcePath(); |
710 | filename += "koalarm.wav"; | 710 | filename += "koalarm.wav"; |
711 | QString tempfilename; | 711 | QString tempfilename; |
712 | if ( mess.left( 13 ) == "suspend_alarm") { | 712 | if ( mess.left( 13 ) == "suspend_alarm") { |
713 | bool error = false; | 713 | bool error = false; |
714 | int len = mess.mid( 13 ).find("+++"); | 714 | int len = mess.mid( 13 ).find("+++"); |
715 | if ( len < 2 ) | 715 | if ( len < 2 ) |
716 | error = true; | 716 | error = true; |
717 | else { | 717 | else { |
718 | tempfilename = mess.mid( 13, len ); | 718 | tempfilename = mess.mid( 13, len ); |
719 | if ( !QFile::exists( tempfilename ) ) | 719 | if ( !QFile::exists( tempfilename ) ) |
720 | error = true; | 720 | error = true; |
721 | } | 721 | } |
722 | if ( ! error ) { | 722 | if ( ! error ) { |
723 | filename = tempfilename; | 723 | filename = tempfilename; |
724 | } | 724 | } |
725 | mAlarmMessage = mess.mid( 13+len+3 ); | 725 | mAlarmMessage = mess.mid( 13+len+3 ); |
726 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 726 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
727 | startAlarm( mAlarmMessage, filename); | 727 | startAlarm( mAlarmMessage, filename); |
728 | return; | 728 | return; |
729 | } | 729 | } |