summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8d992b9..4b82aa8 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -557,375 +557,377 @@ void CalendarView::init()
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
628CalendarView::~CalendarView() 628CalendarView::~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}
640void CalendarView::checkAlarms() 640void 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 //secs -= ( 3600 * 24*3 ); // debug only 647 //secs -= ( 3600 * 24*3 ); // debug only
648 QDateTime latest = dt.addSecs ( secs ); 648 QDateTime latest = dt.addSecs ( secs );
649 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 649 qDebug("KO: Last termination on %s ", latest.toString().latin1());
650 QPtrList<Incidence> el = mCalendar->rawIncidences(); 650 QPtrList<Incidence> el = mCalendar->rawIncidences();
651 QPtrList<Incidence> al; 651 QPtrList<Incidence> al;
652 Incidence* inL = el.first(); 652 Incidence* inL = el.first();
653 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
654 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
653 while ( inL ) { 655 while ( inL ) {
654 bool ok = false; 656 bool ok = false;
655 int offset = 0; 657 int offset = 0;
656 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 658 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
657 if ( ok ) { 659 if ( ok ) {
658 //qDebug("OK %s",next.toString().latin1()); 660 //qDebug("OK %s",next.toString().latin1());
659 if ( next < QDateTime::currentDateTime() ) { 661 if ( next < cur ) {
660 al.append( inL ); 662 al.append( inL );
661 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 663 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
662 } 664 }
663 } 665 }
664 inL = el.next(); 666 inL = el.next();
665 } 667 }
666 if ( al.count() ) { 668 if ( al.count() ) {
667 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 669 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
668 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 670 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
669 QVBoxLayout* lay = new QVBoxLayout( dia ); 671 QVBoxLayout* lay = new QVBoxLayout( dia );
670 lay->setSpacing( 0 ); 672 lay->setSpacing( 0 );
671 lay->setMargin( 0 ); 673 lay->setMargin( 0 );
672 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 674 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
673 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 675 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
674 lay->addWidget( matb ); 676 lay->addWidget( matb );
675 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 677 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
676 int wid = 210; 678 int wid = 210;
677 int x = QApplication::desktop()->width() - wid - 7; 679 int x = QApplication::desktop()->width() - wid - 7;
678 int y = QApplication::desktop()->height() - wid - 70; 680 int y = QApplication::desktop()->height() - wid - 70;
679 dia->setGeometry ( x,y,wid,wid); 681 dia->setGeometry ( x,y,wid,wid);
680 } else { 682 } else {
681 int si = 220; 683 int si = 220;
682 if ( QApplication::desktop()->width() > 470 ) 684 if ( QApplication::desktop()->width() > 470 )
683 si = 400; 685 si = 400;
684 dia->resize(si,si/2); 686 dia->resize(si,si/2);
685 } 687 }
686 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 688 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
687 dia->show(); 689 dia->show();
688 690
689 } 691 }
690} 692}
691void CalendarView::showDay( QDate d ) 693void CalendarView::showDay( QDate d )
692{ 694{
693 dateNavigator()->blockSignals( true ); 695 dateNavigator()->blockSignals( true );
694 dateNavigator()->selectDate( d ); 696 dateNavigator()->selectDate( d );
695 dateNavigator()->blockSignals( false ); 697 dateNavigator()->blockSignals( false );
696 mViewManager->showDayView(); 698 mViewManager->showDayView();
697 //dateNavigator()->selectDate( d ); 699 //dateNavigator()->selectDate( d );
698} 700}
699void CalendarView::timerAlarm() 701void CalendarView::timerAlarm()
700{ 702{
701 //qDebug("CalendarView::timerAlarm() "); 703 //qDebug("CalendarView::timerAlarm() ");
702 computeAlarm(mAlarmNotification ); 704 computeAlarm(mAlarmNotification );
703} 705}
704 706
705void CalendarView::suspendAlarm() 707void CalendarView::suspendAlarm()
706{ 708{
707 //qDebug(" CalendarView::suspendAlarm() "); 709 //qDebug(" CalendarView::suspendAlarm() ");
708 computeAlarm(mSuspendAlarmNotification ); 710 computeAlarm(mSuspendAlarmNotification );
709 711
710} 712}
711 713
712void CalendarView::startAlarm( QString mess , QString filename) 714void CalendarView::startAlarm( QString mess , QString filename)
713{ 715{
714 716
715 topLevelWidget()->showNormal(); 717 topLevelWidget()->showNormal();
716 topLevelWidget()->setActiveWindow(); 718 topLevelWidget()->setActiveWindow();
717 topLevelWidget()->raise(); 719 topLevelWidget()->raise();
718 720
719 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 721 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
720 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 722 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
721 723
722} 724}
723 725
724void CalendarView::checkNextTimerAlarm() 726void CalendarView::checkNextTimerAlarm()
725{ 727{
726 mCalendar->checkAlarmForIncidence( 0, true ); 728 mCalendar->checkAlarmForIncidence( 0, true );
727} 729}
728 730
729void CalendarView::computeAlarm( QString msg ) 731void CalendarView::computeAlarm( QString msg )
730{ 732{
731 733
732 QString mess = msg; 734 QString mess = msg;
733 QString mAlarmMessage = mess.mid( 9 ); 735 QString mAlarmMessage = mess.mid( 9 );
734 QString filename = MainWindow::resourcePath(); 736 QString filename = MainWindow::resourcePath();
735 filename += "koalarm.wav"; 737 filename += "koalarm.wav";
736 QString tempfilename; 738 QString tempfilename;
737 if ( mess.left( 13 ) == "suspend_alarm") { 739 if ( mess.left( 13 ) == "suspend_alarm") {
738 bool error = false; 740 bool error = false;
739 int len = mess.mid( 13 ).find("+++"); 741 int len = mess.mid( 13 ).find("+++");
740 if ( len < 2 ) 742 if ( len < 2 )
741 error = true; 743 error = true;
742 else { 744 else {
743 tempfilename = mess.mid( 13, len ); 745 tempfilename = mess.mid( 13, len );
744 if ( !QFile::exists( tempfilename ) ) 746 if ( !QFile::exists( tempfilename ) )
745 error = true; 747 error = true;
746 } 748 }
747 if ( ! error ) { 749 if ( ! error ) {
748 filename = tempfilename; 750 filename = tempfilename;
749 } 751 }
750 mAlarmMessage = mess.mid( 13+len+3 ); 752 mAlarmMessage = mess.mid( 13+len+3 );
751 //qDebug("suspend file %s ",tempfilename.latin1() ); 753 //qDebug("suspend file %s ",tempfilename.latin1() );
752 startAlarm( mAlarmMessage, filename); 754 startAlarm( mAlarmMessage, filename);
753 return; 755 return;
754 } 756 }
755 if ( mess.left( 11 ) == "timer_alarm") { 757 if ( mess.left( 11 ) == "timer_alarm") {
756 //mTimerTime = 0; 758 //mTimerTime = 0;
757 startAlarm( mess.mid( 11 ), filename ); 759 startAlarm( mess.mid( 11 ), filename );
758 return; 760 return;
759 } 761 }
760 if ( mess.left( 10 ) == "proc_alarm") { 762 if ( mess.left( 10 ) == "proc_alarm") {
761 bool error = false; 763 bool error = false;
762 int len = mess.mid( 10 ).find("+++"); 764 int len = mess.mid( 10 ).find("+++");
763 if ( len < 2 ) 765 if ( len < 2 )
764 error = true; 766 error = true;
765 else { 767 else {
766 tempfilename = mess.mid( 10, len ); 768 tempfilename = mess.mid( 10, len );
767 if ( !QFile::exists( tempfilename ) ) 769 if ( !QFile::exists( tempfilename ) )
768 error = true; 770 error = true;
769 } 771 }
770 if ( error ) { 772 if ( error ) {
771 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 773 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
772 mAlarmMessage += mess.mid( 10+len+3+9 ); 774 mAlarmMessage += mess.mid( 10+len+3+9 );
773 } else { 775 } else {
774 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 776 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
775 //qDebug("-----system command %s ",tempfilename.latin1() ); 777 //qDebug("-----system command %s ",tempfilename.latin1() );
776#ifndef _WIN32_ 778#ifndef _WIN32_
777 if ( vfork () == 0 ) { 779 if ( vfork () == 0 ) {
778 execl ( tempfilename.latin1(), 0 ); 780 execl ( tempfilename.latin1(), 0 );
779 return; 781 return;
780 } 782 }
781#else 783#else
782 QProcess* p = new QProcess(); 784 QProcess* p = new QProcess();
783 p->addArgument( tempfilename.latin1() ); 785 p->addArgument( tempfilename.latin1() );
784 p->start(); 786 p->start();
785 return; 787 return;
786#endif 788#endif
787 789
788 return; 790 return;
789 } 791 }
790 792
791 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 793 //qDebug("+++++++system command %s ",tempfilename.latin1() );
792 } 794 }
793 if ( mess.left( 11 ) == "audio_alarm") { 795 if ( mess.left( 11 ) == "audio_alarm") {
794 bool error = false; 796 bool error = false;
795 int len = mess.mid( 11 ).find("+++"); 797 int len = mess.mid( 11 ).find("+++");
796 if ( len < 2 ) 798 if ( len < 2 )
797 error = true; 799 error = true;
798 else { 800 else {
799 tempfilename = mess.mid( 11, len ); 801 tempfilename = mess.mid( 11, len );
800 if ( !QFile::exists( tempfilename ) ) 802 if ( !QFile::exists( tempfilename ) )
801 error = true; 803 error = true;
802 } 804 }
803 if ( ! error ) { 805 if ( ! error ) {
804 filename = tempfilename; 806 filename = tempfilename;
805 } 807 }
806 mAlarmMessage = mess.mid( 11+len+3+9 ); 808 mAlarmMessage = mess.mid( 11+len+3+9 );
807 //qDebug("audio file command %s ",tempfilename.latin1() ); 809 //qDebug("audio file command %s ",tempfilename.latin1() );
808 } 810 }
809 if ( mess.left( 9 ) == "cal_alarm") { 811 if ( mess.left( 9 ) == "cal_alarm") {
810 mAlarmMessage = mess.mid( 9 ) ; 812 mAlarmMessage = mess.mid( 9 ) ;
811 } 813 }
812 814
813 startAlarm( mAlarmMessage, filename ); 815 startAlarm( mAlarmMessage, filename );
814 816
815 817
816} 818}
817 819
818void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 820void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
819{ 821{
820 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 822 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
821 823
822 mSuspendAlarmNotification = noti; 824 mSuspendAlarmNotification = noti;
823 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 825 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
824 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 826 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
825 mSuspendTimer->start( ms , true ); 827 mSuspendTimer->start( ms , true );
826 828
827} 829}
828 830
829void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 831void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
830{ 832{
831 mNextAlarmDateTime = qdt; 833 mNextAlarmDateTime = qdt;
832 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 834 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
833 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 835 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
834#ifndef DESKTOP_VERSION 836#ifndef DESKTOP_VERSION
835 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 837 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
836#endif 838#endif
837 return; 839 return;
838 } 840 }
839 int maxSec; 841 int maxSec;
840 //maxSec = 5; //testing only 842 //maxSec = 5; //testing only
841 maxSec = 86400+3600; // one day+1hour 843 maxSec = 86400+3600; // one day+1hour
842 mAlarmNotification = noti; 844 mAlarmNotification = noti;
843 int sec = QDateTime::currentDateTime().secsTo( qdt ); 845 int sec = QDateTime::currentDateTime().secsTo( qdt );
844 if ( sec > maxSec ) { 846 if ( sec > maxSec ) {
845 mRecheckAlarmTimer->start( maxSec * 1000 ); 847 mRecheckAlarmTimer->start( maxSec * 1000 );
846 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 848 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
847 return; 849 return;
848 } else { 850 } else {
849 mRecheckAlarmTimer->stop(); 851 mRecheckAlarmTimer->stop();
850 } 852 }
851 //qDebug("Alarm timer started with secs: %d ", sec); 853 //qDebug("Alarm timer started with secs: %d ", sec);
852 mAlarmTimer->start( sec *1000 , true ); 854 mAlarmTimer->start( sec *1000 , true );
853 855
854} 856}
855// called by mRecheckAlarmTimer to get next alarm 857// called by mRecheckAlarmTimer to get next alarm
856// we need this, because a QTimer has only a max range of 25 days 858// we need this, because a QTimer has only a max range of 25 days
857void CalendarView::recheckTimerAlarm() 859void CalendarView::recheckTimerAlarm()
858{ 860{
859 mAlarmTimer->stop(); 861 mAlarmTimer->stop();
860 mRecheckAlarmTimer->stop(); 862 mRecheckAlarmTimer->stop();
861 mCalendar->checkAlarmForIncidence( 0, true ); 863 mCalendar->checkAlarmForIncidence( 0, true );
862} 864}
863void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 865void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
864{ 866{
865 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 867 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
866 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 868 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
867#ifndef DESKTOP_VERSION 869#ifndef DESKTOP_VERSION
868 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 870 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
869#endif 871#endif
870 return; 872 return;
871 } 873 }
872 mAlarmTimer->stop(); 874 mAlarmTimer->stop();
873} 875}
874void CalendarView::selectWeekNum ( int num ) 876void CalendarView::selectWeekNum ( int num )
875{ 877{
876 dateNavigator()->blockSignals( true ); 878 dateNavigator()->blockSignals( true );
877 dateNavigator()->selectWeek( num ); 879 dateNavigator()->selectWeek( num );
878 dateNavigator()->blockSignals( false ); 880 dateNavigator()->blockSignals( false );
879 mViewManager->showWeekView(); 881 mViewManager->showWeekView();
880} 882}
881KOViewManager *CalendarView::viewManager() 883KOViewManager *CalendarView::viewManager()
882{ 884{
883 return mViewManager; 885 return mViewManager;
884} 886}
885 887
886KODialogManager *CalendarView::dialogManager() 888KODialogManager *CalendarView::dialogManager()
887{ 889{
888 return mDialogManager; 890 return mDialogManager;
889} 891}
890 892
891QDate CalendarView::startDate() 893QDate CalendarView::startDate()
892{ 894{
893 DateList dates = mNavigator->selectedDates(); 895 DateList dates = mNavigator->selectedDates();
894 896
895 return dates.first(); 897 return dates.first();
896} 898}
897 899
898QDate CalendarView::endDate() 900QDate CalendarView::endDate()
899{ 901{
900 DateList dates = mNavigator->selectedDates(); 902 DateList dates = mNavigator->selectedDates();
901 903
902 return dates.last(); 904 return dates.last();
903} 905}
904 906
905 907
906void CalendarView::createPrinter() 908void CalendarView::createPrinter()
907{ 909{
908#ifndef KORG_NOPRINTER 910#ifndef KORG_NOPRINTER
909 if (!mCalPrinter) { 911 if (!mCalPrinter) {
910 mCalPrinter = new CalPrinter(this, mCalendar); 912 mCalPrinter = new CalPrinter(this, mCalendar);
911 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 913 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
912 } 914 }
913#endif 915#endif
914} 916}
915 917
916 918
917//KOPrefs::instance()->mWriteBackFile 919//KOPrefs::instance()->mWriteBackFile
918//KOPrefs::instance()->mWriteBackExistingOnly 920//KOPrefs::instance()->mWriteBackExistingOnly
919 921
920// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 922// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
921// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 923// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
922// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 924// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
923// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 925// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
924// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 926// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
925// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 927// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
926 928
927int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 929int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
928{ 930{
929 931
930 // 0 equal 932 // 0 equal
931 // 1 take local 933 // 1 take local