summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp47
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/kodialogmanager.cpp4
-rw-r--r--korganizer/kolistview.cpp3
-rw-r--r--korganizer/mainwindow.cpp17
-rw-r--r--korganizer/mainwindow.h2
6 files changed, 36 insertions, 39 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index fd026fa..70a1d2d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -690,341 +690,345 @@ void CalendarView::checkAlarms()
690 KopiCalendarFile * cal = calendars.first(); 690 KopiCalendarFile * cal = calendars.first();
691 while ( cal ) { 691 while ( cal ) {
692 if ( cal->mErrorOnLoad ) { 692 if ( cal->mErrorOnLoad ) {
693 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 693 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
694 } 694 }
695 cal = calendars.next(); 695 cal = calendars.next();
696 } 696 }
697 if ( !message.isEmpty() ) { 697 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); 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);
699 KMessageBox::error(this,message); 699 KMessageBox::error(this,message);
700 } 700 }
701 KConfig *config = KOGlobals::config(); 701 KConfig *config = KOGlobals::config();
702 config->setGroup( "AppRun" ); 702 config->setGroup( "AppRun" );
703 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 703 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
704 int daysto = dt.daysTo( QDate::currentDate() ); 704 int daysto = dt.daysTo( QDate::currentDate() );
705 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 705 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
706 dt = dt.addDays( days ); 706 dt = dt.addDays( days );
707 int secto = dt.secsTo( QDateTime::currentDateTime() ); 707 int secto = dt.secsTo( QDateTime::currentDateTime() );
708 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 708 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
709 //qDebug("KO: Reading program stop %d ", secs); 709 //qDebug("KO: Reading program stop %d ", secs);
710 //secs -= ( 3600 * 24*3 ); // debug only 710 //secs -= ( 3600 * 24*3 ); // debug only
711 QDateTime latest = dt.addSecs ( secs ); 711 QDateTime latest = dt.addSecs ( secs );
712 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 712 qDebug("KO: Last termination on %s ", latest.toString().latin1());
713 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 713 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
714 QPtrList<Incidence> el = mCalendar->rawIncidences(); 714 QPtrList<Incidence> el = mCalendar->rawIncidences();
715 QPtrList<Incidence> al; 715 QPtrList<Incidence> al;
716 Incidence* inL = el.first(); 716 Incidence* inL = el.first();
717 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 717 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
718 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 718 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
719 while ( inL ) { 719 while ( inL ) {
720 bool ok = false; 720 bool ok = false;
721 int offset = 0; 721 int offset = 0;
722 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 722 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
723 if ( ok ) { 723 if ( ok ) {
724 //qDebug("OK %s",next.toString().latin1()); 724 //qDebug("OK %s",next.toString().latin1());
725 if ( next < cur ) { 725 if ( next < cur ) {
726 al.append( inL ); 726 al.append( inL );
727 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 727 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
728 } 728 }
729 } 729 }
730 inL = el.next(); 730 inL = el.next();
731 } 731 }
732 if ( al.count() ) { 732 if ( al.count() ) {
733 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 733 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
734 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 734 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
735 QVBoxLayout* lay = new QVBoxLayout( dia ); 735 QVBoxLayout* lay = new QVBoxLayout( dia );
736 lay->setSpacing( 0 ); 736 lay->setSpacing( 0 );
737 lay->setMargin( 0 ); 737 lay->setMargin( 0 );
738 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 738 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
739 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 739 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
740 lay->addWidget( matb ); 740 lay->addWidget( matb );
741 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 741 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
742 int wid = 210; 742 int wid = 210;
743 int x = QApplication::desktop()->width() - wid - 7; 743 int x = QApplication::desktop()->width() - wid - 7;
744 int y = QApplication::desktop()->height() - wid - 70; 744 int y = QApplication::desktop()->height() - wid - 70;
745 dia->setGeometry ( x,y,wid,wid); 745 dia->setGeometry ( x,y,wid,wid);
746 } else { 746 } else {
747 int si = 220; 747 int si = 220;
748 if ( QApplication::desktop()->width() > 470 ) 748 if ( QApplication::desktop()->width() > 470 )
749 si = 400; 749 si = 400;
750 dia->resize(si,si/2); 750 dia->resize(si,si/2);
751 } 751 }
752 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 752 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
753 dia->show(); 753 dia->show();
754 754
755 } 755 }
756} 756}
757void CalendarView::showDay( QDate d ) 757void CalendarView::showDay( QDate d )
758{ 758{
759 dateNavigator()->blockSignals( true ); 759 dateNavigator()->blockSignals( true );
760 dateNavigator()->selectDate( d ); 760 dateNavigator()->selectDate( d );
761 dateNavigator()->blockSignals( false ); 761 dateNavigator()->blockSignals( false );
762 mViewManager->showDayView(); 762 mViewManager->showDayView();
763 //dateNavigator()->selectDate( d ); 763 //dateNavigator()->selectDate( d );
764} 764}
765void CalendarView::timerAlarm() 765void CalendarView::timerAlarm()
766{ 766{
767 //qDebug("CalendarView::timerAlarm() "); 767 //qDebug("CalendarView::timerAlarm() ");
768 computeAlarm(mAlarmNotification ); 768 computeAlarm(mAlarmNotification );
769} 769}
770 770
771void CalendarView::suspendAlarm() 771void CalendarView::suspendAlarm()
772{ 772{
773 //qDebug(" CalendarView::suspendAlarm() "); 773 //qDebug(" CalendarView::suspendAlarm() ");
774 computeAlarm(mSuspendAlarmNotification ); 774 computeAlarm(mSuspendAlarmNotification );
775 775
776} 776}
777 777
778void CalendarView::startAlarm( QString mess , QString filename) 778void CalendarView::startAlarm( QString mess , QString filename)
779{ 779{
780 780
781 topLevelWidget()->showNormal(); 781 topLevelWidget()->showNormal();
782 topLevelWidget()->setActiveWindow(); 782 topLevelWidget()->setActiveWindow();
783 topLevelWidget()->raise(); 783 topLevelWidget()->raise();
784 784
785 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 785 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
786 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 786 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) );
787 787
788} 788}
789 789
790void CalendarView::checkNextTimerAlarm() 790void CalendarView::checkNextTimerAlarm()
791{ 791{
792 mCalendar->checkAlarmForIncidence( 0, true ); 792 mCalendar->checkAlarmForIncidence( 0, true );
793} 793}
794 794
795void CalendarView::computeAlarm( QString msg ) 795void CalendarView::computeAlarm( QString msg )
796{ 796{
797 797
798 QString mess = msg; 798 QString mess = msg;
799 QString mAlarmMessage = mess.mid( 9 ); 799 QString mAlarmMessage = mess.mid( 9 );
800 QString filename = MainWindow::resourcePath(); 800 QString filename = MainWindow::resourcePath();
801 filename += "koalarm.wav"; 801 filename += "koalarm.wav";
802 QString tempfilename; 802 QString tempfilename;
803 if ( mess.left( 13 ) == "suspend_alarm") { 803 if ( mess.left( 13 ) == "suspend_alarm") {
804 bool error = false; 804 bool error = false;
805 int len = mess.mid( 13 ).find("+++"); 805 int len = mess.mid( 13 ).find("+++");
806 if ( len < 2 ) 806 if ( len < 2 )
807 error = true; 807 error = true;
808 else { 808 else {
809 tempfilename = mess.mid( 13, len ); 809 tempfilename = mess.mid( 13, len );
810 if ( !QFile::exists( tempfilename ) ) 810 if ( !QFile::exists( tempfilename ) )
811 error = true; 811 error = true;
812 } 812 }
813 if ( ! error ) { 813 if ( ! error ) {
814 filename = tempfilename; 814 filename = tempfilename;
815 } 815 }
816 mAlarmMessage = mess.mid( 13+len+3 ); 816 mAlarmMessage = mess.mid( 13+len+3 );
817 //qDebug("suspend file %s ",tempfilename.latin1() ); 817 //qDebug("suspend file %s ",tempfilename.latin1() );
818 startAlarm( mAlarmMessage, filename); 818 startAlarm( mAlarmMessage, filename);
819 return; 819 return;
820 } 820 }
821 if ( mess.left( 11 ) == "timer_alarm") { 821 if ( mess.left( 11 ) == "timer_alarm") {
822 //mTimerTime = 0; 822 //mTimerTime = 0;
823 startAlarm( mess.mid( 11 ), filename ); 823 startAlarm( mess.mid( 11 ), filename );
824 return; 824 return;
825 } 825 }
826 if ( mess.left( 10 ) == "proc_alarm") { 826 if ( mess.left( 10 ) == "proc_alarm") {
827 bool error = false; 827 bool error = false;
828 int len = mess.mid( 10 ).find("+++"); 828 int len = mess.mid( 10 ).find("+++");
829 if ( len < 2 ) 829 if ( len < 2 )
830 error = true; 830 error = true;
831 else { 831 else {
832 tempfilename = mess.mid( 10, len ); 832 tempfilename = mess.mid( 10, len );
833 if ( !QFile::exists( tempfilename ) ) 833 if ( !QFile::exists( tempfilename ) )
834 error = true; 834 error = true;
835 } 835 }
836 if ( error ) { 836 if ( error ) {
837 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 837 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
838 mAlarmMessage += mess.mid( 10+len+3+9 ); 838 mAlarmMessage += mess.mid( 10+len+3+9 );
839 } else { 839 } else {
840 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 840 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
841 //qDebug("-----system command %s ",tempfilename.latin1() ); 841 //qDebug("-----system command %s ",tempfilename.latin1() );
842#ifndef _WIN32_ 842#ifndef _WIN32_
843 if ( vfork () == 0 ) { 843 if ( vfork () == 0 ) {
844 execl ( tempfilename.latin1(), 0 ); 844 execl ( tempfilename.latin1(), 0 );
845 return; 845 return;
846 } 846 }
847#else 847#else
848 QProcess* p = new QProcess(); 848 QProcess* p = new QProcess();
849 p->addArgument( tempfilename.latin1() ); 849 p->addArgument( tempfilename.latin1() );
850 p->start(); 850 p->start();
851 return; 851 return;
852#endif 852#endif
853 853
854 return; 854 return;
855 } 855 }
856 856
857 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 857 //qDebug("+++++++system command %s ",tempfilename.latin1() );
858 } 858 }
859 if ( mess.left( 11 ) == "audio_alarm") { 859 if ( mess.left( 11 ) == "audio_alarm") {
860 bool error = false; 860 bool error = false;
861 int len = mess.mid( 11 ).find("+++"); 861 int len = mess.mid( 11 ).find("+++");
862 if ( len < 2 ) 862 if ( len < 2 )
863 error = true; 863 error = true;
864 else { 864 else {
865 tempfilename = mess.mid( 11, len ); 865 tempfilename = mess.mid( 11, len );
866 if ( !QFile::exists( tempfilename ) ) 866 if ( !QFile::exists( tempfilename ) )
867 error = true; 867 error = true;
868 } 868 }
869 if ( ! error ) { 869 if ( ! error ) {
870 filename = tempfilename; 870 filename = tempfilename;
871 } 871 }
872 mAlarmMessage = mess.mid( 11+len+3+9 ); 872 mAlarmMessage = mess.mid( 11+len+3+9 );
873 //qDebug("audio file command %s ",tempfilename.latin1() ); 873 //qDebug("audio file command %s ",tempfilename.latin1() );
874 } 874 }
875 if ( mess.left( 9 ) == "cal_alarm") { 875 if ( mess.left( 9 ) == "cal_alarm") {
876 mAlarmMessage = mess.mid( 9 ) ; 876 mAlarmMessage = mess.mid( 9 ) ;
877 } 877 }
878 878
879 startAlarm( mAlarmMessage, filename ); 879 startAlarm( mAlarmMessage, filename );
880 880
881 881
882} 882}
883 883
884void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 884void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
885{ 885{
886 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 886 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
887 887
888 mSuspendAlarmNotification = noti; 888 mSuspendAlarmNotification = noti;
889 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 889 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
890 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 890 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
891 mSuspendTimer->start( ms , true ); 891 mSuspendTimer->start( ms , true );
892 892
893} 893}
894 894
895void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 895void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
896{ 896{
897 mNextAlarmDateTime = qdt; 897 mNextAlarmDateTime = qdt;
898 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 898 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
899 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 899 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
900#ifndef DESKTOP_VERSION 900#ifndef DESKTOP_VERSION
901 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 901 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
902#endif 902#endif
903 return; 903 return;
904 } 904 }
905 int maxSec; 905 int maxSec;
906 //maxSec = 5; //testing only 906 //maxSec = 5; //testing only
907 maxSec = 86400+3600; // one day+1hour 907 maxSec = 86400+3600; // one day+1hour
908 mAlarmNotification = noti; 908 mAlarmNotification = noti;
909 int sec = QDateTime::currentDateTime().secsTo( qdt ); 909 int sec = QDateTime::currentDateTime().secsTo( qdt );
910 if ( sec > maxSec ) { 910 if ( sec > maxSec ) {
911 mRecheckAlarmTimer->start( maxSec * 1000 ); 911 mRecheckAlarmTimer->start( maxSec * 1000 );
912 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 912 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
913 return; 913 return;
914 } else { 914 } else {
915 mRecheckAlarmTimer->stop(); 915 mRecheckAlarmTimer->stop();
916 } 916 }
917 //qDebug("Alarm timer started with secs: %d ", sec); 917 //qDebug("Alarm timer started with secs: %d ", sec);
918 mAlarmTimer->start( sec *1000 , true ); 918 mAlarmTimer->start( sec *1000 , true );
919 919
920} 920}
921// called by mRecheckAlarmTimer to get next alarm 921// called by mRecheckAlarmTimer to get next alarm
922// we need this, because a QTimer has only a max range of 25 days 922// we need this, because a QTimer has only a max range of 25 days
923void CalendarView::recheckTimerAlarm() 923void CalendarView::recheckTimerAlarm()
924{ 924{
925 mAlarmTimer->stop(); 925 mAlarmTimer->stop();
926 mRecheckAlarmTimer->stop(); 926 mRecheckAlarmTimer->stop();
927 mCalendar->checkAlarmForIncidence( 0, true ); 927 mCalendar->checkAlarmForIncidence( 0, true );
928} 928}
929#ifndef DESKTOP_VERSION
929void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 930void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
931#else
932void CalendarView::removeAlarm(const QDateTime &, const QString & )
933#endif
930{ 934{
931 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 935 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
932 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 936 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
933#ifndef DESKTOP_VERSION 937#ifndef DESKTOP_VERSION
934 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 938 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() );
935#endif 939#endif
936 return; 940 return;
937 } 941 }
938 mAlarmTimer->stop(); 942 mAlarmTimer->stop();
939} 943}
940void CalendarView::selectWeekNum ( int num ) 944void CalendarView::selectWeekNum ( int num )
941{ 945{
942 dateNavigator()->blockSignals( true ); 946 dateNavigator()->blockSignals( true );
943 dateNavigator()->selectWeek( num ); 947 dateNavigator()->selectWeek( num );
944 dateNavigator()->blockSignals( false ); 948 dateNavigator()->blockSignals( false );
945 mViewManager->showWeekView(); 949 mViewManager->showWeekView();
946} 950}
947KOViewManager *CalendarView::viewManager() 951KOViewManager *CalendarView::viewManager()
948{ 952{
949 return mViewManager; 953 return mViewManager;
950} 954}
951 955
952KODialogManager *CalendarView::dialogManager() 956KODialogManager *CalendarView::dialogManager()
953{ 957{
954 return mDialogManager; 958 return mDialogManager;
955} 959}
956 960
957QDate CalendarView::startDate() 961QDate CalendarView::startDate()
958{ 962{
959 DateList dates = mNavigator->selectedDates(); 963 DateList dates = mNavigator->selectedDates();
960 964
961 return dates.first(); 965 return dates.first();
962} 966}
963 967
964QDate CalendarView::endDate() 968QDate CalendarView::endDate()
965{ 969{
966 DateList dates = mNavigator->selectedDates(); 970 DateList dates = mNavigator->selectedDates();
967 971
968 return dates.last(); 972 return dates.last();
969} 973}
970 974
971 975
972void CalendarView::createPrinter() 976void CalendarView::createPrinter()
973{ 977{
974#ifndef KORG_NOPRINTER 978#ifndef KORG_NOPRINTER
975 if (!mCalPrinter) { 979 if (!mCalPrinter) {
976 mCalPrinter = new CalPrinter(this, mCalendar); 980 mCalPrinter = new CalPrinter(this, mCalendar);
977 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 981 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
978 } 982 }
979#endif 983#endif
980} 984}
981 985
982 986
983//KOPrefs::instance()->mWriteBackFile 987//KOPrefs::instance()->mWriteBackFile
984//KOPrefs::instance()->mWriteBackExistingOnly 988//KOPrefs::instance()->mWriteBackExistingOnly
985 989
986// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 990// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
987// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 991// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
988// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 992// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
989// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 993// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
990// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 994// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
991// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 995// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
992 996
993int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 997int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
994{ 998{
995 999
996 // 0 equal 1000 // 0 equal
997 // 1 take local 1001 // 1 take local
998 // 2 take remote 1002 // 2 take remote
999 // 3 cancel 1003 // 3 cancel
1000 QDateTime lastSync = mLastCalendarSync; 1004 QDateTime lastSync = mLastCalendarSync;
1001 QDateTime localMod = local->lastModified(); 1005 QDateTime localMod = local->lastModified();
1002 QDateTime remoteMod = remote->lastModified(); 1006 QDateTime remoteMod = remote->lastModified();
1003 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1007 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1004 bool remCh, locCh; 1008 bool remCh, locCh;
1005 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 1009 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
1006 //if ( remCh ) 1010 //if ( remCh )
1007 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 1011 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
1008 locCh = ( localMod > mLastCalendarSync ); 1012 locCh = ( localMod > mLastCalendarSync );
1009 if ( !remCh && ! locCh ) { 1013 if ( !remCh && ! locCh ) {
1010 //qDebug("both not changed "); 1014 //qDebug("both not changed ");
1011 lastSync = localMod.addDays(1); 1015 lastSync = localMod.addDays(1);
1012 if ( mode <= SYNC_PREF_ASK ) 1016 if ( mode <= SYNC_PREF_ASK )
1013 return 0; 1017 return 0;
1014 } else { 1018 } else {
1015 if ( locCh ) { 1019 if ( locCh ) {
1016 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 1020 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
1017 lastSync = localMod.addDays( -1 ); 1021 lastSync = localMod.addDays( -1 );
1018 if ( !remCh ) 1022 if ( !remCh )
1019 remoteMod = ( lastSync.addDays( -1 ) ); 1023 remoteMod = ( lastSync.addDays( -1 ) );
1020 } else { 1024 } else {
1021 //qDebug(" not loc changed "); 1025 //qDebug(" not loc changed ");
1022 lastSync = localMod.addDays( 1 ); 1026 lastSync = localMod.addDays( 1 );
1023 if ( remCh ) 1027 if ( remCh )
1024 remoteMod =( lastSync.addDays( 1 ) ); 1028 remoteMod =( lastSync.addDays( 1 ) );
1025 1029
1026 } 1030 }
1027 } 1031 }
1028 full = true; 1032 full = true;
1029 if ( mode < SYNC_PREF_ASK ) 1033 if ( mode < SYNC_PREF_ASK )
1030 mode = SYNC_PREF_ASK; 1034 mode = SYNC_PREF_ASK;
@@ -1117,193 +1121,192 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
1117 getEventViewerDialog()->addIncidence(remote); 1121 getEventViewerDialog()->addIncidence(remote);
1118 getEventViewerDialog()->setColorMode( 0 ); 1122 getEventViewerDialog()->setColorMode( 0 );
1119 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 1123 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
1120 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 1124 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
1121 getEventViewerDialog()->showMe(); 1125 getEventViewerDialog()->showMe();
1122 result = getEventViewerDialog()->executeS( localIsNew ); 1126 result = getEventViewerDialog()->executeS( localIsNew );
1123 return result; 1127 return result;
1124 1128
1125 break; 1129 break;
1126 case SYNC_PREF_FORCE_LOCAL: 1130 case SYNC_PREF_FORCE_LOCAL:
1127 return 1; 1131 return 1;
1128 break; 1132 break;
1129 case SYNC_PREF_FORCE_REMOTE: 1133 case SYNC_PREF_FORCE_REMOTE:
1130 return 2; 1134 return 2;
1131 break; 1135 break;
1132 1136
1133 default: 1137 default:
1134 // SYNC_PREF_TAKE_BOTH not implemented 1138 // SYNC_PREF_TAKE_BOTH not implemented
1135 break; 1139 break;
1136 } 1140 }
1137 return 0; 1141 return 0;
1138} 1142}
1139Event* CalendarView::getLastSyncEvent() 1143Event* CalendarView::getLastSyncEvent()
1140{ 1144{
1141 Event* lse; 1145 Event* lse;
1142 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 1146 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
1143 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 1147 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
1144 if (!lse) { 1148 if (!lse) {
1145 lse = new Event(); 1149 lse = new Event();
1146 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 1150 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
1147 QString sum = ""; 1151 QString sum = "";
1148 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 1152 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
1149 sum = "E: "; 1153 sum = "E: ";
1150 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1154 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
1151 lse->setDtStart( mLastCalendarSync ); 1155 lse->setDtStart( mLastCalendarSync );
1152 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1156 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1153 lse->setCategories( i18n("SyncEvent") ); 1157 lse->setCategories( i18n("SyncEvent") );
1154 lse->setReadOnly( true ); 1158 lse->setReadOnly( true );
1155 mCalendar->addEvent( lse ); 1159 mCalendar->addEvent( lse );
1156 } 1160 }
1157 1161
1158 return lse; 1162 return lse;
1159 1163
1160} 1164}
1161 1165
1162// we check, if the to delete event has a id for a profile 1166// we check, if the to delete event has a id for a profile
1163// if yes, we set this id in the profile to delete 1167// if yes, we set this id in the profile to delete
1164void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1168void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
1165{ 1169{
1166 if ( lastSync.count() == 0 ) { 1170 if ( lastSync.count() == 0 ) {
1167 //qDebug(" lastSync.count() == 0"); 1171 //qDebug(" lastSync.count() == 0");
1168 return; 1172 return;
1169 } 1173 }
1170 if ( toDelete->typeID() == journalID ) 1174 if ( toDelete->typeID() == journalID )
1171 return; 1175 return;
1172 1176
1173 Event* eve = lastSync.first(); 1177 Event* eve = lastSync.first();
1174 1178
1175 while ( eve ) { 1179 while ( eve ) {
1176 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1180 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
1177 if ( !id.isEmpty() ) { 1181 if ( !id.isEmpty() ) {
1178 QString des = eve->description(); 1182 QString des = eve->description();
1179 QString pref = "e"; 1183 QString pref = "e";
1180 if ( toDelete->typeID() == todoID ) 1184 if ( toDelete->typeID() == todoID )
1181 pref = "t"; 1185 pref = "t";
1182 des += pref+ id + ","; 1186 des += pref+ id + ",";
1183 eve->setReadOnly( false ); 1187 eve->setReadOnly( false );
1184 eve->setDescription( des ); 1188 eve->setDescription( des );
1185 //qDebug("setdes %s ", des.latin1()); 1189 //qDebug("setdes %s ", des.latin1());
1186 eve->setReadOnly( true ); 1190 eve->setReadOnly( true );
1187 } 1191 }
1188 eve = lastSync.next(); 1192 eve = lastSync.next();
1189 } 1193 }
1190 1194
1191} 1195}
1192void CalendarView::checkExternalId( Incidence * inc ) 1196void CalendarView::checkExternalId( Incidence * inc )
1193{ 1197{
1194 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1198 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
1195 checkExternSyncEvent( lastSync, inc ); 1199 checkExternSyncEvent( lastSync, inc );
1196 1200
1197} 1201}
1198bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1202bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
1199{ 1203{
1200 bool syncOK = true; 1204 bool syncOK = true;
1201 int addedEvent = 0; 1205 int addedEvent = 0;
1202 int addedEventR = 0; 1206 int addedEventR = 0;
1203 int deletedEventR = 0; 1207 int deletedEventR = 0;
1204 int deletedEventL = 0; 1208 int deletedEventL = 0;
1205 int changedLocal = 0; 1209 int changedLocal = 0;
1206 int changedRemote = 0; 1210 int changedRemote = 0;
1207 int filteredIN = 0; 1211 int filteredIN = 0;
1208 int filteredOUT = 0; 1212 int filteredOUT = 0;
1209 //QPtrList<Event> el = local->rawEvents(); 1213 //QPtrList<Event> el = local->rawEvents();
1210 Event* eventR; 1214 Event* eventR;
1211 QString uid; 1215 QString uid;
1212 int take; 1216 int take;
1213 Event* eventL;
1214 Event* eventRSync; 1217 Event* eventRSync;
1215 Event* eventLSync; 1218 Event* eventLSync;
1216 clearAllViews(); 1219 clearAllViews();
1217 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 1220 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
1218 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 1221 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
1219 bool fullDateRange = false; 1222 bool fullDateRange = false;
1220 local->resetTempSyncStat(); 1223 local->resetTempSyncStat();
1221 mLastCalendarSync = QDateTime::currentDateTime(); 1224 mLastCalendarSync = QDateTime::currentDateTime();
1222 if ( mSyncManager->syncWithDesktop() ) { 1225 if ( mSyncManager->syncWithDesktop() ) {
1223 remote->resetPilotStat(1); 1226 remote->resetPilotStat(1);
1224 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1227 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1225 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 1228 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
1226 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 1229 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
1227 } else { 1230 } else {
1228 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 1231 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
1229 } 1232 }
1230 } 1233 }
1231 QDateTime modifiedCalendar = mLastCalendarSync; 1234 QDateTime modifiedCalendar = mLastCalendarSync;
1232 eventLSync = getLastSyncEvent(); 1235 eventLSync = getLastSyncEvent();
1233 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 1236 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
1234 if ( eventR ) { 1237 if ( eventR ) {
1235 eventRSync = (Event*) eventR->clone(); 1238 eventRSync = (Event*) eventR->clone();
1236 remote->deleteEvent(eventR ); 1239 remote->deleteEvent(eventR );
1237 1240
1238 } else { 1241 } else {
1239 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 1242 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
1240 eventRSync = (Event*)eventLSync->clone(); 1243 eventRSync = (Event*)eventLSync->clone();
1241 } else { 1244 } else {
1242 fullDateRange = true; 1245 fullDateRange = true;
1243 eventRSync = new Event(); 1246 eventRSync = new Event();
1244 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 1247 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
1245 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 1248 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
1246 eventRSync->setDtStart( mLastCalendarSync ); 1249 eventRSync->setDtStart( mLastCalendarSync );
1247 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1250 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1248 eventRSync->setCategories( i18n("SyncEvent") ); 1251 eventRSync->setCategories( i18n("SyncEvent") );
1249 } 1252 }
1250 } 1253 }
1251 if ( eventLSync->dtStart() == mLastCalendarSync ) 1254 if ( eventLSync->dtStart() == mLastCalendarSync )
1252 fullDateRange = true; 1255 fullDateRange = true;
1253 1256
1254 if ( ! fullDateRange ) { 1257 if ( ! fullDateRange ) {
1255 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 1258 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
1256 1259
1257 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 1260 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
1258 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 1261 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
1259 fullDateRange = true; 1262 fullDateRange = true;
1260 } 1263 }
1261 } 1264 }
1262 if ( mSyncManager->syncWithDesktop() ) { 1265 if ( mSyncManager->syncWithDesktop() ) {
1263 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 1266 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
1264 } 1267 }
1265 if ( fullDateRange ) 1268 if ( fullDateRange )
1266 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 1269 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
1267 else 1270 else
1268 mLastCalendarSync = eventLSync->dtStart(); 1271 mLastCalendarSync = eventLSync->dtStart();
1269 // for resyncing if own file has changed 1272 // for resyncing if own file has changed
1270 if ( mCurrentSyncDevice == "deleteaftersync" ) { 1273 if ( mCurrentSyncDevice == "deleteaftersync" ) {
1271 mLastCalendarSync = loadedFileVersion; 1274 mLastCalendarSync = loadedFileVersion;
1272 //qDebug("setting mLastCalendarSync "); 1275 //qDebug("setting mLastCalendarSync ");
1273 } 1276 }
1274 //qDebug("*************************** "); 1277 //qDebug("*************************** ");
1275 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1278 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1276 QPtrList<Incidence> er = remote->rawIncidences(); 1279 QPtrList<Incidence> er = remote->rawIncidences();
1277 Incidence* inR = er.first(); 1280 Incidence* inR = er.first();
1278 Incidence* inL; 1281 Incidence* inL;
1279 QProgressBar bar( er.count(),0 ); 1282 QProgressBar bar( er.count(),0 );
1280 bar.setCaption (i18n("Syncing - close to abort!") ); 1283 bar.setCaption (i18n("Syncing - close to abort!") );
1281 1284
1282 // ************** setting up filter ************* 1285 // ************** setting up filter *************
1283 CalFilter *filterIN = 0; 1286 CalFilter *filterIN = 0;
1284 CalFilter *filterOUT = 0; 1287 CalFilter *filterOUT = 0;
1285 CalFilter *filter = mFilters.first(); 1288 CalFilter *filter = mFilters.first();
1286 while(filter) { 1289 while(filter) {
1287 if ( filter->name() == mSyncManager->mFilterInCal ) 1290 if ( filter->name() == mSyncManager->mFilterInCal )
1288 filterIN = filter; 1291 filterIN = filter;
1289 if ( filter->name() == mSyncManager->mFilterOutCal ) 1292 if ( filter->name() == mSyncManager->mFilterOutCal )
1290 filterOUT = filter; 1293 filterOUT = filter;
1291 filter = mFilters.next(); 1294 filter = mFilters.next();
1292 } 1295 }
1293 int w = 300; 1296 int w = 300;
1294 if ( QApplication::desktop()->width() < 320 ) 1297 if ( QApplication::desktop()->width() < 320 )
1295 w = 220; 1298 w = 220;
1296 int h = bar.sizeHint().height() ; 1299 int h = bar.sizeHint().height() ;
1297 int dw = QApplication::desktop()->width(); 1300 int dw = QApplication::desktop()->width();
1298 int dh = QApplication::desktop()->height(); 1301 int dh = QApplication::desktop()->height();
1299 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1302 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1300 bar.show(); 1303 bar.show();
1301 int modulo = (er.count()/10)+1; 1304 int modulo = (er.count()/10)+1;
1302 int incCounter = 0; 1305 int incCounter = 0;
1303 while ( inR ) { 1306 while ( inR ) {
1304 if ( ! bar.isVisible() ) 1307 if ( ! bar.isVisible() )
1305 return false; 1308 return false;
1306 if ( incCounter % modulo == 0 ) 1309 if ( incCounter % modulo == 0 )
1307 bar.setProgress( incCounter ); 1310 bar.setProgress( incCounter );
1308 ++incCounter; 1311 ++incCounter;
1309 uid = inR->uid(); 1312 uid = inR->uid();
@@ -2217,197 +2220,202 @@ void CalendarView::readSettings()
2217 topLevelWidget()->setGeometry(x,y,w,h); 2220 topLevelWidget()->setGeometry(x,y,w,h);
2218 2221
2219 } else { 2222 } else {
2220 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 2223 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
2221 } 2224 }
2222 list = config->readListEntry("EditEventLayout"); 2225 list = config->readListEntry("EditEventLayout");
2223 if ( ! list.isEmpty() ) { 2226 if ( ! list.isEmpty() ) {
2224 x = list[0].toInt(); 2227 x = list[0].toInt();
2225 y = list[1].toInt(); 2228 y = list[1].toInt();
2226 w = list[2].toInt(); 2229 w = list[2].toInt();
2227 h = list[3].toInt(); 2230 h = list[3].toInt();
2228 KApplication::testCoords( &x,&y,&w,&h ); 2231 KApplication::testCoords( &x,&y,&w,&h );
2229 mEventEditor->setGeometry(x,y,w,h); 2232 mEventEditor->setGeometry(x,y,w,h);
2230 2233
2231 } 2234 }
2232 list = config->readListEntry("EditTodoLayout"); 2235 list = config->readListEntry("EditTodoLayout");
2233 if ( ! list.isEmpty() ) { 2236 if ( ! list.isEmpty() ) {
2234 x = list[0].toInt(); 2237 x = list[0].toInt();
2235 y = list[1].toInt(); 2238 y = list[1].toInt();
2236 w = list[2].toInt(); 2239 w = list[2].toInt();
2237 h = list[3].toInt(); 2240 h = list[3].toInt();
2238 KApplication::testCoords( &x,&y,&w,&h ); 2241 KApplication::testCoords( &x,&y,&w,&h );
2239 mTodoEditor->setGeometry(x,y,w,h); 2242 mTodoEditor->setGeometry(x,y,w,h);
2240 2243
2241 } 2244 }
2242 list = config->readListEntry("ViewerLayout"); 2245 list = config->readListEntry("ViewerLayout");
2243 if ( ! list.isEmpty() ) { 2246 if ( ! list.isEmpty() ) {
2244 x = list[0].toInt(); 2247 x = list[0].toInt();
2245 y = list[1].toInt(); 2248 y = list[1].toInt();
2246 w = list[2].toInt(); 2249 w = list[2].toInt();
2247 h = list[3].toInt(); 2250 h = list[3].toInt();
2248 KApplication::testCoords( &x,&y,&w,&h ); 2251 KApplication::testCoords( &x,&y,&w,&h );
2249 getEventViewerDialog()->setGeometry(x,y,w,h); 2252 getEventViewerDialog()->setGeometry(x,y,w,h);
2250 } 2253 }
2251#endif 2254#endif
2252 config->setGroup( "Views" ); 2255 config->setGroup( "Views" );
2253 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 2256 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
2254 2257
2255 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 2258 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
2256 2259
2257 int resetval = 0; 2260 int resetval = 0;
2258 int maxVal = 0; 2261 int maxVal = 0;
2259 if (sizes.count() != 3) { 2262 if (sizes.count() != 3) {
2260 if ( KOPrefs::instance()->mVerticalScreen ) { 2263 if ( KOPrefs::instance()->mVerticalScreen ) {
2261 resetval = mDateNavigator->sizeHint().width()+2; 2264 resetval = mDateNavigator->sizeHint().width()+2;
2262 } else { 2265 } else {
2263 resetval = mDateNavigator->sizeHint().height()+2; 2266 resetval = mDateNavigator->sizeHint().height()+2;
2264 } 2267 }
2265 } 2268 }
2266 if ( resetval ) { 2269 if ( resetval ) {
2267 sizes.clear(); 2270 sizes.clear();
2268 if ( KOPrefs::instance()->mVerticalScreen ) { 2271 if ( KOPrefs::instance()->mVerticalScreen ) {
2269 maxVal = QApplication::desktop()->width() -10; 2272 maxVal = QApplication::desktop()->width() -10;
2270 } else { 2273 } else {
2271 maxVal = QApplication::desktop()->height()-10; 2274 maxVal = QApplication::desktop()->height()-10;
2272 } 2275 }
2273 sizes << resetval; 2276 sizes << resetval;
2274 if ( maxVal < resetval + resetval) 2277 if ( maxVal < resetval + resetval)
2275 resetval = maxVal - resetval; 2278 resetval = maxVal - resetval;
2276 sizes << resetval; 2279 sizes << resetval;
2277 sizes << 100; 2280 sizes << 100;
2278 } 2281 }
2279 mLeftFrame->setSizes(sizes); 2282 mLeftFrame->setSizes(sizes);
2280 sizes = config->readIntListEntry("Main Splitter Frame"); 2283 sizes = config->readIntListEntry("Main Splitter Frame");
2281 resetval = 0; 2284 resetval = 0;
2282 maxVal = 0; 2285 maxVal = 0;
2283 if (sizes.count() != 2) { 2286 if (sizes.count() != 2) {
2284 if ( !KOPrefs::instance()->mVerticalScreen ) { 2287 if ( !KOPrefs::instance()->mVerticalScreen ) {
2285 resetval = mDateNavigator->sizeHint().width()+2; 2288 resetval = mDateNavigator->sizeHint().width()+2;
2286 } else { 2289 } else {
2287 resetval = mDateNavigator->sizeHint().height()+2; 2290 resetval = mDateNavigator->sizeHint().height()+2;
2288 } 2291 }
2289 } 2292 }
2290 if ( resetval ) { 2293 if ( resetval ) {
2291 sizes.clear(); 2294 sizes.clear();
2292 if ( !KOPrefs::instance()->mVerticalScreen ) { 2295 if ( !KOPrefs::instance()->mVerticalScreen ) {
2293 maxVal = QApplication::desktop()->width() -10; 2296 maxVal = QApplication::desktop()->width() -10;
2294 } else { 2297 } else {
2295 maxVal = QApplication::desktop()->height()-10; 2298 maxVal = QApplication::desktop()->height()-10;
2296 } 2299 }
2297 sizes << resetval; 2300 sizes << resetval;
2298 if ( maxVal < resetval + resetval) 2301 if ( maxVal < resetval + resetval)
2299 resetval = maxVal - resetval; 2302 resetval = maxVal - resetval;
2300 sizes << resetval; 2303 sizes << resetval;
2301 } 2304 }
2302 mMainFrame->setSizes(sizes); 2305 mMainFrame->setSizes(sizes);
2303 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 2306 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
2304 else if ( dateCount == 7 ) mNavigator->selectWeek(); 2307 else if ( dateCount == 7 ) mNavigator->selectWeek();
2305 else mNavigator->selectDates( dateCount ); 2308 else mNavigator->selectDates( dateCount );
2306 // mViewManager->readSettings( config ); 2309 // mViewManager->readSettings( config );
2307 updateConfig(); 2310 updateConfig();
2308 globalFlagBlockAgenda = 2; 2311 globalFlagBlockAgenda = 2;
2309 mViewManager->readSettings( config ); 2312 mViewManager->readSettings( config );
2310 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 2313 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
2311} 2314}
2312 2315
2313 2316void CalendarView::checkSuspendAlarm()
2317{
2318 if ( mSuspendTimer->isActive() ) {
2319 KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm"));
2320 }
2321}
2314void CalendarView::writeSettings() 2322void CalendarView::writeSettings()
2315{ 2323{
2316 // kdDebug() << "CalendarView::writeSettings" << endl; 2324 // kdDebug() << "CalendarView::writeSettings" << endl;
2317 2325
2318 KConfig *config = KOGlobals::config(); 2326 KConfig *config = KOGlobals::config();
2319 2327
2320 mViewManager->writeSettings( config ); 2328 mViewManager->writeSettings( config );
2321 mTodoList->saveLayout(config,QString("Todo Layout")); 2329 mTodoList->saveLayout(config,QString("Todo Layout"));
2322 mDialogManager->writeSettings( config ); 2330 mDialogManager->writeSettings( config );
2323 //KOPrefs::instance()->usrWriteConfig(); 2331 //KOPrefs::instance()->usrWriteConfig();
2324 KOPrefs::instance()->writeConfig(); 2332 KOPrefs::instance()->writeConfig();
2325 2333
2326 writeFilterSettings(config); 2334 writeFilterSettings(config);
2327 config->setGroup( "AppRun" ); 2335 config->setGroup( "AppRun" );
2328 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 2336 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2329 int days = dt.daysTo( QDate::currentDate() ); 2337 int days = dt.daysTo( QDate::currentDate() );
2330 dt = dt.addDays( days ); 2338 dt = dt.addDays( days );
2331 int secs = dt.secsTo( QDateTime::currentDateTime() ); 2339 int secs = dt.secsTo( QDateTime::currentDateTime() );
2332 config->writeEntry( "LatestProgramStopDays", days ); 2340 config->writeEntry( "LatestProgramStopDays", days );
2333 config->writeEntry( "LatestProgramStopSecs", secs ); 2341 config->writeEntry( "LatestProgramStopSecs", secs );
2334 //qDebug("KO: Writing stop time: %d ", secs); 2342 //qDebug("KO: Writing stop time: %d ", secs);
2335 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 2343 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
2336 //QDateTime latest = dt.addSecs ( secs ); 2344 //QDateTime latest = dt.addSecs ( secs );
2337 //qDebug("KO: Termination on %s ", latest.toString().latin1()); 2345 //qDebug("KO: Termination on %s ", latest.toString().latin1());
2338 config->setGroup( "Views" ); 2346 config->setGroup( "Views" );
2339 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2347 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
2340 2348
2341#if 0 2349#if 0
2342 qDebug("********************* "); 2350 qDebug("********************* ");
2343 qDebug("Testcode secsto "); 2351 qDebug("Testcode secsto ");
2344 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); 2352 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
2345 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); 2353 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
2346 int secsto = dt_nodaylight.secsTo( dt_daylight ); 2354 int secsto = dt_nodaylight.secsTo( dt_daylight );
2347 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); 2355 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
2348 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); 2356 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
2349 qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); 2357 qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
2350 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); 2358 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
2351 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); 2359 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
2352 qDebug("********************* testcode end"); 2360 qDebug("********************* testcode end");
2353 2361
2354#endif 2362#endif
2355 2363
2356 QValueList<int> listINT = mLeftFrame->sizes(); 2364 QValueList<int> listINT = mLeftFrame->sizes();
2357 config->writeEntry("Left Splitter Frame",listINT); 2365 config->writeEntry("Left Splitter Frame",listINT);
2358 QValueList<int> listINT2 = mMainFrame->sizes(); 2366 QValueList<int> listINT2 = mMainFrame->sizes();
2359 config->writeEntry("Main Splitter Frame",listINT2); 2367 config->writeEntry("Main Splitter Frame",listINT2);
2360#ifdef DESKTOP_VERSION 2368#ifdef DESKTOP_VERSION
2361 config->setGroup("WidgetLayout"); 2369 config->setGroup("WidgetLayout");
2362 QStringList list ;//= config->readListEntry("MainLayout"); 2370 QStringList list ;//= config->readListEntry("MainLayout");
2363 int x,y,w,h; 2371 int x,y,w,h;
2364 QWidget* wid; 2372 QWidget* wid;
2365 wid = topLevelWidget(); 2373 wid = topLevelWidget();
2366 x = wid->geometry().x(); 2374 x = wid->geometry().x();
2367 y = wid->geometry().y(); 2375 y = wid->geometry().y();
2368 w = wid->width(); 2376 w = wid->width();
2369 h = wid->height(); 2377 h = wid->height();
2370 list.clear(); 2378 list.clear();
2371 list << QString::number( x ); 2379 list << QString::number( x );
2372 list << QString::number( y ); 2380 list << QString::number( y );
2373 list << QString::number( w ); 2381 list << QString::number( w );
2374 list << QString::number( h ); 2382 list << QString::number( h );
2375 config->writeEntry("MainLayout",list ); 2383 config->writeEntry("MainLayout",list );
2376 2384
2377 wid = mEventEditor; 2385 wid = mEventEditor;
2378 x = wid->geometry().x(); 2386 x = wid->geometry().x();
2379 y = wid->geometry().y(); 2387 y = wid->geometry().y();
2380 w = wid->width(); 2388 w = wid->width();
2381 h = wid->height(); 2389 h = wid->height();
2382 list.clear(); 2390 list.clear();
2383 list << QString::number( x ); 2391 list << QString::number( x );
2384 list << QString::number( y ); 2392 list << QString::number( y );
2385 list << QString::number( w ); 2393 list << QString::number( w );
2386 list << QString::number( h ); 2394 list << QString::number( h );
2387 config->writeEntry("EditEventLayout",list ); 2395 config->writeEntry("EditEventLayout",list );
2388 2396
2389 wid = mTodoEditor; 2397 wid = mTodoEditor;
2390 x = wid->geometry().x(); 2398 x = wid->geometry().x();
2391 y = wid->geometry().y(); 2399 y = wid->geometry().y();
2392 w = wid->width(); 2400 w = wid->width();
2393 h = wid->height(); 2401 h = wid->height();
2394 list.clear(); 2402 list.clear();
2395 list << QString::number( x ); 2403 list << QString::number( x );
2396 list << QString::number( y ); 2404 list << QString::number( y );
2397 list << QString::number( w ); 2405 list << QString::number( w );
2398 list << QString::number( h ); 2406 list << QString::number( h );
2399 config->writeEntry("EditTodoLayout",list ); 2407 config->writeEntry("EditTodoLayout",list );
2400 wid = getEventViewerDialog(); 2408 wid = getEventViewerDialog();
2401 x = wid->geometry().x(); 2409 x = wid->geometry().x();
2402 y = wid->geometry().y(); 2410 y = wid->geometry().y();
2403 w = wid->width(); 2411 w = wid->width();
2404 h = wid->height(); 2412 h = wid->height();
2405 list.clear(); 2413 list.clear();
2406 list << QString::number( x ); 2414 list << QString::number( x );
2407 list << QString::number( y ); 2415 list << QString::number( y );
2408 list << QString::number( w ); 2416 list << QString::number( w );
2409 list << QString::number( h ); 2417 list << QString::number( h );
2410 config->writeEntry("ViewerLayout",list ); 2418 config->writeEntry("ViewerLayout",list );
2411 wid = mDialogManager->getSearchDialog(); 2419 wid = mDialogManager->getSearchDialog();
2412 if ( wid ) { 2420 if ( wid ) {
2413 x = wid->geometry().x(); 2421 x = wid->geometry().x();
@@ -2701,352 +2709,353 @@ void CalendarView::edit_paste()
2701 DndFactory factory( mCalendar ); 2709 DndFactory factory( mCalendar );
2702 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2710 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2703 2711
2704 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2712 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2705} 2713}
2706void CalendarView::edit_global_options() 2714void CalendarView::edit_global_options()
2707{ 2715{
2708 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2716 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2709 emit save(); 2717 emit save();
2710 emit saveStopTimer(); 2718 emit saveStopTimer();
2711 mDialogManager->showGlobalOptionsDialog(); 2719 mDialogManager->showGlobalOptionsDialog();
2712 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2720 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2713 emit saveStopTimer(); 2721 emit saveStopTimer();
2714 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2722 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2715 i18n("Timezone settings"),i18n("Reload"))) { 2723 i18n("Timezone settings"),i18n("Reload"))) {
2716 qDebug("KO: TZ reload cancelled "); 2724 qDebug("KO: TZ reload cancelled ");
2717 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2725 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2718 return; 2726 return;
2719 } 2727 }
2720 qDebug("KO: Timezone change "); 2728 qDebug("KO: Timezone change ");
2721 loadCalendars(); 2729 loadCalendars();
2722 setModified(true); 2730 setModified(true);
2723 } 2731 }
2724 else 2732 else
2725 qDebug("KO: No tz change "); 2733 qDebug("KO: No tz change ");
2726} 2734}
2727void CalendarView::edit_options() 2735void CalendarView::edit_options()
2728{ 2736{
2729 mDialogManager->showOptionsDialog(); 2737 mDialogManager->showOptionsDialog();
2730} 2738}
2731 2739
2732 2740
2733void CalendarView::slotSelectPickerDate( QDate d) 2741void CalendarView::slotSelectPickerDate( QDate d)
2734{ 2742{
2735 mDateFrame->hide(); 2743 mDateFrame->hide();
2736 if ( mDatePickerMode == 1 ) { 2744 if ( mDatePickerMode == 1 ) {
2737 mNavigator->slotDaySelect( d ); 2745 mNavigator->slotDaySelect( d );
2738 } else if ( mDatePickerMode == 2 ) { 2746 } else if ( mDatePickerMode == 2 ) {
2739 if ( mMoveIncidence->typeID() == todoID ) { 2747 if ( mMoveIncidence->typeID() == todoID ) {
2740 Todo * to = (Todo *) mMoveIncidence; 2748 Todo * to = (Todo *) mMoveIncidence;
2741 QTime tim; 2749 QTime tim;
2742 int len = 0; 2750 int len = 0;
2743 if ( to->hasStartDate() && to->hasDueDate() ) 2751 if ( to->hasStartDate() && to->hasDueDate() )
2744 len = to->dtStart().secsTo( to->dtDue()); 2752 len = to->dtStart().secsTo( to->dtDue());
2745 if ( to->hasDueDate() ) 2753 if ( to->hasDueDate() )
2746 tim = to->dtDue().time(); 2754 tim = to->dtDue().time();
2747 else { 2755 else {
2748 tim = QTime ( 0,0,0 ); 2756 tim = QTime ( 0,0,0 );
2749 to->setFloats( true ); 2757 to->setFloats( true );
2750 to->setHasDueDate( true ); 2758 to->setHasDueDate( true );
2751 } 2759 }
2752 QDateTime dt ( d,tim ); 2760 QDateTime dt ( d,tim );
2753 to->setDtDue( dt ); 2761 to->setDtDue( dt );
2754 2762
2755 if ( to->hasStartDate() ) { 2763 if ( to->hasStartDate() ) {
2756 if ( len>0 ) 2764 if ( len>0 )
2757 to->setDtStart(to->dtDue().addSecs( -len )); 2765 to->setDtStart(to->dtDue().addSecs( -len ));
2758 else 2766 else
2759 if (to->dtStart() > to->dtDue() ) 2767 if (to->dtStart() > to->dtDue() )
2760 to->setDtStart(to->dtDue().addDays( -3 )); 2768 to->setDtStart(to->dtDue().addDays( -3 ));
2761 } 2769 }
2762 2770
2763 todoChanged( to ); 2771 todoChanged( to );
2764 } else { 2772 } else {
2765 if ( mMoveIncidence->doesRecur() ) { 2773 if ( mMoveIncidence->doesRecur() ) {
2766#if 0 2774#if 0
2767 // PENDING implement this 2775 // PENDING implement this
2768 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2776 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2769 mCalendar()->addIncidence( newInc ); 2777 mCalendar()->addIncidence( newInc );
2770 if ( mMoveIncidence->typeID() == todoID ) 2778 if ( mMoveIncidence->typeID() == todoID )
2771 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2779 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2772 else 2780 else
2773 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2781 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2774 mMoveIncidence = newInc; 2782 mMoveIncidence = newInc;
2775 2783
2776#endif 2784#endif
2777 } 2785 }
2778 QTime tim = mMoveIncidence->dtStart().time(); 2786 QTime tim = mMoveIncidence->dtStart().time();
2779 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2787 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2780 QDateTime dt ( d,tim ); 2788 QDateTime dt ( d,tim );
2781 mMoveIncidence->setDtStart( dt ); 2789 mMoveIncidence->setDtStart( dt );
2782 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2790 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2783 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2791 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2784 } 2792 }
2785 2793
2786 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2794 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2787 } 2795 }
2788} 2796}
2789 2797
2790void CalendarView::removeCategories() 2798void CalendarView::removeCategories()
2791{ 2799{
2792 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2800 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2793 QStringList catList = KOPrefs::instance()->mCustomCategories; 2801 QStringList catList = KOPrefs::instance()->mCustomCategories;
2794 QStringList catIncList; 2802 QStringList catIncList;
2795 QStringList newCatList; 2803 QStringList newCatList;
2796 Incidence* inc = incList.first(); 2804 Incidence* inc = incList.first();
2797 int i; 2805 uint i;
2798 int count = 0;
2799 while ( inc ) { 2806 while ( inc ) {
2800 newCatList.clear(); 2807 newCatList.clear();
2801 catIncList = inc->categories() ; 2808 catIncList = inc->categories() ;
2802 for( i = 0; i< catIncList.count(); ++i ) { 2809 for( i = 0; i< catIncList.count(); ++i ) {
2803 if ( catList.contains (catIncList[i])) 2810 if ( catList.contains (catIncList[i]))
2804 newCatList.append( catIncList[i] ); 2811 newCatList.append( catIncList[i] );
2805 } 2812 }
2806 newCatList.sort(); 2813 newCatList.sort();
2807 inc->setCategories( newCatList.join(",") ); 2814 inc->setCategories( newCatList.join(",") );
2808 inc = incList.next(); 2815 inc = incList.next();
2809 } 2816 }
2810} 2817}
2811 2818
2812int CalendarView::addCategories() 2819int CalendarView::addCategories()
2813{ 2820{
2814 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2821 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2815 QStringList catList = KOPrefs::instance()->mCustomCategories; 2822 QStringList catList = KOPrefs::instance()->mCustomCategories;
2816 QStringList catIncList; 2823 QStringList catIncList;
2817 Incidence* inc = incList.first(); 2824 Incidence* inc = incList.first();
2818 int i; 2825 uint i;
2819 int count = 0; 2826 int count = 0;
2820 while ( inc ) { 2827 while ( inc ) {
2821 catIncList = inc->categories() ; 2828 catIncList = inc->categories() ;
2822 for( i = 0; i< catIncList.count(); ++i ) { 2829 for( i = 0; i< catIncList.count(); ++i ) {
2823 if ( !catList.contains (catIncList[i])) { 2830 if ( !catList.contains (catIncList[i])) {
2824 catList.append( catIncList[i] ); 2831 catList.append( catIncList[i] );
2825 //qDebug("add cat %s ", catIncList[i].latin1()); 2832 //qDebug("add cat %s ", catIncList[i].latin1());
2826 ++count; 2833 ++count;
2827 } 2834 }
2828 } 2835 }
2829 inc = incList.next(); 2836 inc = incList.next();
2830 } 2837 }
2831 catList.sort(); 2838 catList.sort();
2832 KOPrefs::instance()->mCustomCategories = catList; 2839 KOPrefs::instance()->mCustomCategories = catList;
2833 return count; 2840 return count;
2834} 2841}
2835 2842
2836void CalendarView::editCategories() 2843void CalendarView::editCategories()
2837{ 2844{
2838 qDebug("CalendarView::editCategories() "); 2845 qDebug("CalendarView::editCategories() ");
2839 KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); 2846 KPIM::CategoryEditDialog ced (KOPrefs::instance(),this );
2840 ced.exec(); 2847 ced.exec();
2841} 2848}
2842void CalendarView::manageCategories() 2849void CalendarView::manageCategories()
2843{ 2850{
2844 KOCatPrefs* cp = new KOCatPrefs(); 2851 KOCatPrefs* cp = new KOCatPrefs();
2845 cp->show(); 2852 cp->show();
2846 int w =cp->sizeHint().width() ; 2853 int w =cp->sizeHint().width() ;
2847 int h = cp->sizeHint().height() ; 2854 int h = cp->sizeHint().height() ;
2848 int dw = QApplication::desktop()->width(); 2855 int dw = QApplication::desktop()->width();
2849 int dh = QApplication::desktop()->height(); 2856 int dh = QApplication::desktop()->height();
2850 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2857 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2851 if ( !cp->exec() ) { 2858 if ( !cp->exec() ) {
2852 delete cp; 2859 delete cp;
2853 return; 2860 return;
2854 } 2861 }
2855 int count = 0; 2862 int count = 0;
2856 if ( cp->addCat() ) { 2863 if ( cp->addCat() ) {
2857 count = addCategories(); 2864 count = addCategories();
2858 if ( count ) { 2865 if ( count ) {
2859 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2866 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2860 writeSettings(); 2867 writeSettings();
2861 } else 2868 } else
2862 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2869 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2863 } else { 2870 } else {
2864 removeCategories(); 2871 removeCategories();
2865 updateView(); 2872 updateView();
2866 } 2873 }
2867 delete cp; 2874 delete cp;
2868} 2875}
2869 2876
2870void CalendarView::beamIncidence(Incidence * Inc) 2877void CalendarView::beamIncidence(Incidence * Inc)
2871{ 2878{
2872 QPtrList<Incidence> delSel ; 2879 QPtrList<Incidence> delSel ;
2873 delSel.append(Inc); 2880 delSel.append(Inc);
2874 beamIncidenceList( delSel ); 2881 beamIncidenceList( delSel );
2875} 2882}
2876void CalendarView::beamCalendar() 2883void CalendarView::beamCalendar()
2877{ 2884{
2878 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2885 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2879 //qDebug("beamCalendar() "); 2886 //qDebug("beamCalendar() ");
2880 beamIncidenceList( delSel ); 2887 beamIncidenceList( delSel );
2881} 2888}
2882void CalendarView::beamFilteredCalendar() 2889void CalendarView::beamFilteredCalendar()
2883{ 2890{
2884 QPtrList<Incidence> delSel = mCalendar->incidences(); 2891 QPtrList<Incidence> delSel = mCalendar->incidences();
2885 //qDebug("beamFilteredCalendar() "); 2892 //qDebug("beamFilteredCalendar() ");
2886 beamIncidenceList( delSel ); 2893 beamIncidenceList( delSel );
2887} 2894}
2888void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2895void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2889{ 2896{
2890 2897
2891 KOBeamPrefs beamDialog; 2898 KOBeamPrefs beamDialog;
2892 if ( beamDialog.exec () == QDialog::Rejected ) 2899 if ( beamDialog.exec () == QDialog::Rejected )
2893 return; 2900 return;
2894#ifdef DESKTOP_VERSION 2901#ifdef DESKTOP_VERSION
2895 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2902 QString fn = locateLocal( "tmp", "kopibeamfile" );
2896#else 2903#else
2897 QString fn = "/tmp/kopibeamfile"; 2904 QString fn = "/tmp/kopibeamfile";
2898#endif 2905#endif
2899 QString mes; 2906 QString mes;
2900 bool createbup = true; 2907 bool createbup = true;
2901 if ( createbup ) { 2908 if ( createbup ) {
2902 QString description = "\n"; 2909 QString description = "\n";
2903 CalendarLocal* cal = new CalendarLocal(); 2910 CalendarLocal* cal = new CalendarLocal();
2904 if ( beamDialog.beamLocal() ) 2911 if ( beamDialog.beamLocal() )
2905 cal->setLocalTime(); 2912 cal->setLocalTime();
2906 else 2913 else
2907 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2914 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2908 Incidence *incidence = delSel.first(); 2915 Incidence *incidence = delSel.first();
2909 bool addText = false; 2916 bool addText = false;
2910 if ( delSel.count() < 10 ) 2917 if ( delSel.count() < 10 )
2911 addText = true; 2918 addText = true;
2912 else { 2919 else {
2913 description.sprintf(i18n(" %d items?"),delSel.count() ); 2920 description.sprintf(i18n(" %d items?"),delSel.count() );
2914 } 2921 }
2915 while ( incidence ) { 2922 while ( incidence ) {
2916 Incidence *in = incidence->clone(); 2923 Incidence *in = incidence->clone();
2917 if ( ! in->summary().isEmpty() ) { 2924 if ( ! in->summary().isEmpty() ) {
2918 in->setDescription(""); 2925 in->setDescription("");
2919 } else { 2926 } else {
2920 in->setSummary( in->description().left(20)); 2927 in->setSummary( in->description().left(20));
2921 in->setDescription(""); 2928 in->setDescription("");
2922 } 2929 }
2923 if ( addText ) 2930 if ( addText )
2924 description += in->summary() + "\n"; 2931 description += in->summary() + "\n";
2925 cal->addIncidence( in ); 2932 cal->addIncidence( in );
2926 incidence = delSel.next(); 2933 incidence = delSel.next();
2927 } 2934 }
2928 if ( beamDialog.beamVcal() ) { 2935 if ( beamDialog.beamVcal() ) {
2929 fn += ".vcs"; 2936 fn += ".vcs";
2930 FileStorage storage( cal, fn, new VCalFormat ); 2937 FileStorage storage( cal, fn, new VCalFormat );
2931 storage.save(); 2938 storage.save();
2932 } else { 2939 } else {
2933 fn += ".ics"; 2940 fn += ".ics";
2934 FileStorage storage( cal, fn, new ICalFormat( ) ); 2941 FileStorage storage( cal, fn, new ICalFormat( ) );
2935 storage.save(); 2942 storage.save();
2936 } 2943 }
2937 delete cal; 2944 delete cal;
2938 mes = i18n("KO/Pi: Ready for beaming"); 2945 mes = i18n("KO/Pi: Ready for beaming");
2939 topLevelWidget()->setCaption(mes); 2946 topLevelWidget()->setCaption(mes);
2940 KApplication::convert2latin1( fn ); 2947 KApplication::convert2latin1( fn );
2941#ifndef DESKTOP_VERSION 2948#ifndef DESKTOP_VERSION
2942 Ir *ir = new Ir( this ); 2949 Ir *ir = new Ir( this );
2943 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2950 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2944 ir->send( fn, description, "text/x-vCalendar" ); 2951 ir->send( fn, description, "text/x-vCalendar" );
2945#endif 2952#endif
2946 } 2953 }
2947} 2954}
2955
2956#ifndef DESKTOP_VERSION
2948void CalendarView::beamDone( Ir *ir ) 2957void CalendarView::beamDone( Ir *ir )
2949{ 2958{
2950#ifndef DESKTOP_VERSION
2951 delete ir; 2959 delete ir;
2952#endif
2953 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2960 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2954 topLevelWidget()->raise(); 2961 topLevelWidget()->raise();
2955} 2962}
2956 2963#else
2964void CalendarView::beamDone( Ir *){;}
2965#endif
2957void CalendarView::moveIncidence(Incidence * inc ) 2966void CalendarView::moveIncidence(Incidence * inc )
2958{ 2967{
2959 if ( !inc ) return; 2968 if ( !inc ) return;
2960 showDatePickerPopup(); 2969 showDatePickerPopup();
2961 mDatePickerMode = 2; 2970 mDatePickerMode = 2;
2962 mMoveIncidence = inc ; 2971 mMoveIncidence = inc ;
2963 QDate da; 2972 QDate da;
2964 if ( mMoveIncidence->typeID() == todoID ) { 2973 if ( mMoveIncidence->typeID() == todoID ) {
2965 Todo * to = (Todo *) mMoveIncidence; 2974 Todo * to = (Todo *) mMoveIncidence;
2966 if ( to->hasDueDate() ) 2975 if ( to->hasDueDate() )
2967 da = to->dtDue().date(); 2976 da = to->dtDue().date();
2968 else 2977 else
2969 da = QDate::currentDate(); 2978 da = QDate::currentDate();
2970 } else { 2979 } else {
2971 da = mMoveIncidence->dtStart().date(); 2980 da = mMoveIncidence->dtStart().date();
2972 } 2981 }
2973 //PENDING set date for recurring incidence to date of recurrence 2982 //PENDING set date for recurring incidence to date of recurrence
2974 //mMoveIncidenceOldDate; 2983 //mMoveIncidenceOldDate;
2975 mDatePicker->setDate( da ); 2984 mDatePicker->setDate( da );
2976} 2985}
2977void CalendarView::showDatePickerPopup() 2986void CalendarView::showDatePickerPopup()
2978{ 2987{
2979 if ( mDateFrame->isVisible() ) 2988 if ( mDateFrame->isVisible() )
2980 mDateFrame->hide(); 2989 mDateFrame->hide();
2981 else { 2990 else {
2982 int offX = 0, offY = 0; 2991 int offX = 0, offY = 0;
2983#ifdef DESKTOP_VERSION 2992#ifdef DESKTOP_VERSION
2984 int w =mDatePicker->sizeHint().width() ; 2993 int w =mDatePicker->sizeHint().width() ;
2985 int h = mDatePicker->sizeHint().height() ; 2994 int h = mDatePicker->sizeHint().height() ;
2986 int dw = topLevelWidget()->width(); 2995 int dw = topLevelWidget()->width();
2987 int dh = topLevelWidget()->height(); 2996 int dh = topLevelWidget()->height();
2988 offX = topLevelWidget()->x(); 2997 offX = topLevelWidget()->x();
2989 offY = topLevelWidget()->y(); 2998 offY = topLevelWidget()->y();
2990#else 2999#else
2991 int w =mDatePicker->sizeHint().width() ; 3000 int w =mDatePicker->sizeHint().width() ;
2992 int h = mDatePicker->sizeHint().height() ; 3001 int h = mDatePicker->sizeHint().height() ;
2993 int dw = QApplication::desktop()->width(); 3002 int dw = QApplication::desktop()->width();
2994 int dh = QApplication::desktop()->height(); 3003 int dh = QApplication::desktop()->height();
2995#endif 3004#endif
2996 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 3005 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2997 mDateFrame->show(); 3006 mDateFrame->show();
2998 } 3007 }
2999} 3008}
3000void CalendarView::showDatePicker( ) 3009void CalendarView::showDatePicker( )
3001{ 3010{
3002 showDatePickerPopup(); 3011 showDatePickerPopup();
3003 mDatePickerMode = 1; 3012 mDatePickerMode = 1;
3004 mDatePicker->setDate( mNavigator->selectedDates().first() ); 3013 mDatePicker->setDate( mNavigator->selectedDates().first() );
3005} 3014}
3006 3015
3007void CalendarView::showEventEditor() 3016void CalendarView::showEventEditor()
3008{ 3017{
3009#ifdef DESKTOP_VERSION 3018#ifdef DESKTOP_VERSION
3010 int x,y,w,h; 3019 int x,y,w,h;
3011 x = mEventEditor->geometry().x(); 3020 x = mEventEditor->geometry().x();
3012 y = mEventEditor->geometry().y(); 3021 y = mEventEditor->geometry().y();
3013 w = mEventEditor->width(); 3022 w = mEventEditor->width();
3014 h = mEventEditor->height(); 3023 h = mEventEditor->height();
3015 mEventEditor->show(); 3024 mEventEditor->show();
3016 mEventEditor->setGeometry(x,y,w,h); 3025 mEventEditor->setGeometry(x,y,w,h);
3017#else 3026#else
3018 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 3027 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
3019 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 3028 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
3020 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 3029 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
3021 qApp->processEvents(); 3030 qApp->processEvents();
3022 delete mEventEditor; 3031 delete mEventEditor;
3023 mEventEditor = mDialogManager->getEventEditor(); 3032 mEventEditor = mDialogManager->getEventEditor();
3024 topLevelWidget()->setCaption( i18n("") ); 3033 topLevelWidget()->setCaption( i18n("") );
3025 } 3034 }
3026 mEventEditor->showMaximized(); 3035 mEventEditor->showMaximized();
3027#endif 3036#endif
3028} 3037}
3029void CalendarView::showTodoEditor() 3038void CalendarView::showTodoEditor()
3030{ 3039{
3031#ifdef DESKTOP_VERSION 3040#ifdef DESKTOP_VERSION
3032 int x,y,w,h; 3041 int x,y,w,h;
3033 x = mTodoEditor->geometry().x(); 3042 x = mTodoEditor->geometry().x();
3034 y = mTodoEditor->geometry().y(); 3043 y = mTodoEditor->geometry().y();
3035 w = mTodoEditor->width(); 3044 w = mTodoEditor->width();
3036 h = mTodoEditor->height(); 3045 h = mTodoEditor->height();
3037 mTodoEditor->show(); 3046 mTodoEditor->show();
3038 mTodoEditor->setGeometry(x,y,w,h); 3047 mTodoEditor->setGeometry(x,y,w,h);
3039#else 3048#else
3040 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 3049 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
3041 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 3050 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
3042 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 3051 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
3043 qApp->processEvents(); 3052 qApp->processEvents();
3044 delete mTodoEditor; 3053 delete mTodoEditor;
3045 mTodoEditor = mDialogManager->getTodoEditor(); 3054 mTodoEditor = mDialogManager->getTodoEditor();
3046 topLevelWidget()->setCaption( i18n("") ); 3055 topLevelWidget()->setCaption( i18n("") );
3047 } 3056 }
3048 mTodoEditor->showMaximized(); 3057 mTodoEditor->showMaximized();
3049#endif 3058#endif
3050} 3059}
3051 3060
3052void CalendarView::cloneIncidence() 3061void CalendarView::cloneIncidence()
@@ -4214,359 +4223,355 @@ void CalendarView::takeOverCalendar()
4214} 4223}
4215 4224
4216void CalendarView::showIntro() 4225void CalendarView::showIntro()
4217{ 4226{
4218 kdDebug() << "To be implemented." << endl; 4227 kdDebug() << "To be implemented." << endl;
4219} 4228}
4220 4229
4221QWidgetStack *CalendarView::viewStack() 4230QWidgetStack *CalendarView::viewStack()
4222{ 4231{
4223 return mRightFrame; 4232 return mRightFrame;
4224} 4233}
4225 4234
4226QWidget *CalendarView::leftFrame() 4235QWidget *CalendarView::leftFrame()
4227{ 4236{
4228 return ( QWidget *)mLeftFrame; 4237 return ( QWidget *)mLeftFrame;
4229} 4238}
4230 4239
4231DateNavigator *CalendarView::dateNavigator() 4240DateNavigator *CalendarView::dateNavigator()
4232{ 4241{
4233 return mNavigator; 4242 return mNavigator;
4234} 4243}
4235 4244
4236KDateNavigator* CalendarView::dateNavigatorWidget() 4245KDateNavigator* CalendarView::dateNavigatorWidget()
4237{ 4246{
4238 return mDateNavigator->navigatorView(); 4247 return mDateNavigator->navigatorView();
4239} 4248}
4240void CalendarView::toggleDateNavigatorWidget() 4249void CalendarView::toggleDateNavigatorWidget()
4241{ 4250{
4242 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4251 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4243 4252
4244 if (!KOPrefs::instance()->mShowDateNavigator ) 4253 if (!KOPrefs::instance()->mShowDateNavigator )
4245 mDateNavigator->hide(); 4254 mDateNavigator->hide();
4246 else 4255 else
4247 mDateNavigator->show(); 4256 mDateNavigator->show();
4248} 4257}
4249void CalendarView::addView(KOrg::BaseView *view) 4258void CalendarView::addView(KOrg::BaseView *view)
4250{ 4259{
4251 mViewManager->addView(view); 4260 mViewManager->addView(view);
4252} 4261}
4253 4262
4254void CalendarView::showView(KOrg::BaseView *view) 4263void CalendarView::showView(KOrg::BaseView *view)
4255{ 4264{
4256 mViewManager->showView(view, mLeftFrame->isVisible()); 4265 mViewManager->showView(view, mLeftFrame->isVisible());
4257} 4266}
4258 4267
4259Incidence *CalendarView::currentSelection() 4268Incidence *CalendarView::currentSelection()
4260{ 4269{
4261 return mViewManager->currentSelection(); 4270 return mViewManager->currentSelection();
4262} 4271}
4263void CalendarView::toggleAllDaySize() 4272void CalendarView::toggleAllDaySize()
4264{ 4273{
4265 /* 4274 /*
4266 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4275 if ( KOPrefs::instance()->mAllDaySize > 47 )
4267 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4276 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4268 else 4277 else
4269 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4278 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4270 */ 4279 */
4271 viewManager()->agendaView()->toggleAllDay(); 4280 viewManager()->agendaView()->toggleAllDay();
4272} 4281}
4273void CalendarView::toggleExpand() 4282void CalendarView::toggleExpand()
4274{ 4283{
4275 // if ( mLeftFrame->isHidden() ) { 4284 // if ( mLeftFrame->isHidden() ) {
4276 // mLeftFrame->show(); 4285 // mLeftFrame->show();
4277 // emit calendarViewExpanded( false ); 4286 // emit calendarViewExpanded( false );
4278 // } else { 4287 // } else {
4279 // mLeftFrame->hide(); 4288 // mLeftFrame->hide();
4280 // emit calendarViewExpanded( true ); 4289 // emit calendarViewExpanded( true );
4281 // } 4290 // }
4282 //qDebug(" CalendarView::toggleExpand()"); 4291 //qDebug(" CalendarView::toggleExpand()");
4283 globalFlagBlockAgenda = 1; 4292 globalFlagBlockAgenda = 1;
4284 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4293 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4285 globalFlagBlockAgenda = 5; 4294 globalFlagBlockAgenda = 5;
4286 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4295 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4287 //mViewManager->showView( 0, true ); 4296 //mViewManager->showView( 0, true );
4288} 4297}
4289 4298
4290void CalendarView::calendarModified( bool modified, Calendar * ) 4299void CalendarView::calendarModified( bool modified, Calendar * )
4291{ 4300{
4292 setModified( modified ); 4301 setModified( modified );
4293} 4302}
4294 4303
4295Todo *CalendarView::selectedTodo() 4304Todo *CalendarView::selectedTodo()
4296{ 4305{
4297 Incidence *incidence = currentSelection(); 4306 Incidence *incidence = currentSelection();
4298 if ( incidence && incidence->typeID() == todoID ) { 4307 if ( incidence && incidence->typeID() == todoID ) {
4299 return static_cast<Todo *>( incidence ); 4308 return static_cast<Todo *>( incidence );
4300 } 4309 }
4301 4310
4302 incidence = mTodoList->selectedIncidences().first(); 4311 incidence = mTodoList->selectedIncidences().first();
4303 if ( incidence && incidence->typeID() == todoID ) { 4312 if ( incidence && incidence->typeID() == todoID ) {
4304 return static_cast<Todo *>( incidence ); 4313 return static_cast<Todo *>( incidence );
4305 } 4314 }
4306 4315
4307 return 0; 4316 return 0;
4308} 4317}
4309 4318
4310void CalendarView::dialogClosing(Incidence *in)
4311{
4312 // mDialogList.remove(in);
4313}
4314
4315void CalendarView::showIncidence() 4319void CalendarView::showIncidence()
4316{ 4320{
4317 mViewerCallerIsSearchDialog = false; 4321 mViewerCallerIsSearchDialog = false;
4318 Incidence *incidence = currentSelection(); 4322 Incidence *incidence = currentSelection();
4319 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4323 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4320 if ( incidence ) { 4324 if ( incidence ) {
4321 ShowIncidenceVisitor v; 4325 ShowIncidenceVisitor v;
4322 v.act( incidence, this ); 4326 v.act( incidence, this );
4323 } 4327 }
4324} 4328}
4325void CalendarView::editIncidenceDescription() 4329void CalendarView::editIncidenceDescription()
4326{ 4330{
4327 mFlagEditDescription = true; 4331 mFlagEditDescription = true;
4328 editIncidence(); 4332 editIncidence();
4329 mFlagEditDescription = false; 4333 mFlagEditDescription = false;
4330} 4334}
4331void CalendarView::editIncidence() 4335void CalendarView::editIncidence()
4332{ 4336{
4333 // qDebug("editIncidence() "); 4337 // qDebug("editIncidence() ");
4334 Incidence *incidence = currentSelection(); 4338 Incidence *incidence = currentSelection();
4335 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4339 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4336 if ( incidence ) { 4340 if ( incidence ) {
4337 EditIncidenceVisitor v; 4341 EditIncidenceVisitor v;
4338 v.act( incidence, this ); 4342 v.act( incidence, this );
4339 } 4343 }
4340} 4344}
4341 4345
4342void CalendarView::deleteIncidence() 4346void CalendarView::deleteIncidence()
4343{ 4347{
4344 Incidence *incidence = currentSelection(); 4348 Incidence *incidence = currentSelection();
4345 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4349 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4346 if ( incidence ) { 4350 if ( incidence ) {
4347 deleteIncidence(incidence); 4351 deleteIncidence(incidence);
4348 } 4352 }
4349} 4353}
4350void CalendarView::showIncidence(QString uid) 4354void CalendarView::showIncidence(QString uid)
4351{ 4355{
4352 Incidence *inc = mCalendar->incidence( uid ); 4356 Incidence *inc = mCalendar->incidence( uid );
4353 if ( inc ) 4357 if ( inc )
4354 showIncidence( inc ); 4358 showIncidence( inc );
4355} 4359}
4356void CalendarView::showIncidence(Incidence *incidence) 4360void CalendarView::showIncidence(Incidence *incidence)
4357{ 4361{
4358 mViewerCallerIsSearchDialog = false; 4362 mViewerCallerIsSearchDialog = false;
4359 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4363 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4360 if ( sender() && mDialogManager->getSearchDialog() ) { 4364 if ( sender() && mDialogManager->getSearchDialog() ) {
4361 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4365 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4362 mViewerCallerIsSearchDialog = true; 4366 mViewerCallerIsSearchDialog = true;
4363 } 4367 }
4364 } 4368 }
4365 if ( incidence ) { 4369 if ( incidence ) {
4366 ShowIncidenceVisitor v; 4370 ShowIncidenceVisitor v;
4367 v.act( incidence, this ); 4371 v.act( incidence, this );
4368 } 4372 }
4369} 4373}
4370 4374
4371void CalendarView::editIncidence(Incidence *incidence) 4375void CalendarView::editIncidence(Incidence *incidence)
4372{ 4376{
4373 if ( incidence ) { 4377 if ( incidence ) {
4374 4378
4375 EditIncidenceVisitor v; 4379 EditIncidenceVisitor v;
4376 v.act( incidence, this ); 4380 v.act( incidence, this );
4377 4381
4378 } 4382 }
4379} 4383}
4380 4384
4381void CalendarView::deleteIncidence(Incidence *incidence) 4385void CalendarView::deleteIncidence(Incidence *incidence)
4382{ 4386{
4383 //qDebug(" CalendarView::deleteIncidence "); 4387 //qDebug(" CalendarView::deleteIncidence ");
4384 if ( incidence ) { 4388 if ( incidence ) {
4385 DeleteIncidenceVisitor v; 4389 DeleteIncidenceVisitor v;
4386 v.act( incidence, this ); 4390 v.act( incidence, this );
4387 } 4391 }
4388} 4392}
4389 4393
4390 4394
4391void CalendarView::lookForOutgoingMessages() 4395void CalendarView::lookForOutgoingMessages()
4392{ 4396{
4393 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4397 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4394 ogd->loadMessages(); 4398 ogd->loadMessages();
4395} 4399}
4396 4400
4397void CalendarView::lookForIncomingMessages() 4401void CalendarView::lookForIncomingMessages()
4398{ 4402{
4399 IncomingDialog *icd = mDialogManager->incomingDialog(); 4403 IncomingDialog *icd = mDialogManager->incomingDialog();
4400 icd->retrieve(); 4404 icd->retrieve();
4401} 4405}
4402 4406
4403bool CalendarView::removeCompletedSubTodos( Todo* t ) 4407bool CalendarView::removeCompletedSubTodos( Todo* t )
4404{ 4408{
4405 bool deleteTodo = true; 4409 bool deleteTodo = true;
4406 QPtrList<Incidence> subTodos; 4410 QPtrList<Incidence> subTodos;
4407 Incidence *aTodo; 4411 Incidence *aTodo;
4408 subTodos = t->relations(); 4412 subTodos = t->relations();
4409 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4413 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4410 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4414 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4411 deleteTodo = false; 4415 deleteTodo = false;
4412 } 4416 }
4413 if ( deleteTodo ) { 4417 if ( deleteTodo ) {
4414 if ( t->isCompleted() && !t->doesRecur()) { 4418 if ( t->isCompleted() && !t->doesRecur()) {
4415 checkExternalId( t ); 4419 checkExternalId( t );
4416 mCalendar->deleteTodo( t ); 4420 mCalendar->deleteTodo( t );
4417 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4421 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4418 } 4422 }
4419 else 4423 else
4420 deleteTodo = false; 4424 deleteTodo = false;
4421 } 4425 }
4422 return deleteTodo; 4426 return deleteTodo;
4423 4427
4424} 4428}
4425void CalendarView::purgeCompleted() 4429void CalendarView::purgeCompleted()
4426{ 4430{
4427 int result = KMessageBox::warningContinueCancel(this, 4431 int result = KMessageBox::warningContinueCancel(this,
4428 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4432 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4429 4433
4430 if (result == KMessageBox::Continue) { 4434 if (result == KMessageBox::Continue) {
4431 4435
4432 QPtrList<Todo> todoCal; 4436 QPtrList<Todo> todoCal;
4433 QPtrList<Todo> rootTodos; 4437 QPtrList<Todo> rootTodos;
4434 //QPtrList<Incidence> rel; 4438 //QPtrList<Incidence> rel;
4435 Todo *aTodo;//, *rTodo; 4439 Todo *aTodo;
4436 Incidence *rIncidence;
4437 bool childDelete = false;
4438 bool deletedOne = true;
4439 todoCal = calendar()->todos(); 4440 todoCal = calendar()->todos();
4440 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4441 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4441 if ( !aTodo->relatedTo() ) 4442 if ( !aTodo->relatedTo() )
4442 rootTodos.append( aTodo ); 4443 rootTodos.append( aTodo );
4443 } 4444 }
4444 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4445 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4445 removeCompletedSubTodos( aTodo ); 4446 removeCompletedSubTodos( aTodo );
4446 } 4447 }
4447 4448
4448 updateView(); 4449 updateView();
4449 } 4450 }
4450} 4451}
4451 4452
4452void CalendarView::slotCalendarChanged() 4453void CalendarView::slotCalendarChanged()
4453{ 4454{
4454 ; 4455 ;
4455} 4456}
4456 4457
4457void CalendarView::keyPressEvent ( QKeyEvent *e) 4458void CalendarView::keyPressEvent ( QKeyEvent *e)
4458{ 4459{
4459 //qDebug(" alendarView::keyPressEvent "); 4460 //qDebug(" alendarView::keyPressEvent ");
4460 e->ignore(); 4461 e->ignore();
4461} 4462}
4462 4463
4463 4464
4464bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4465bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4465{ 4466{
4466 // mSyncManager = manager; 4467
4468 if ( manager != mSyncManager)
4469 qDebug("KO: Internal error-1. SyncManager mismatch ");
4467 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4470 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4468 qDebug("KO: SyncKDE request detected!"); 4471 qDebug("KO: SyncKDE request detected!");
4469 } 4472 }
4470 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4473 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4471 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4474 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4472 return syncCalendar( filename, mode ); 4475 return syncCalendar( filename, mode );
4473} 4476}
4474bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4477bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4475{ 4478{
4476 //mSyncManager = manager; 4479 //mSyncManager = manager;
4480 if ( manager != mSyncManager)
4481 qDebug("KO: Internal error-2. SyncManager mismatch ");
4477 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4482 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4478 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4483 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4479 if ( resource == "sharp" ) 4484 if ( resource == "sharp" )
4480 syncExternal( 0 ); 4485 syncExternal( 0 );
4481 if ( resource == "phone" ) 4486 if ( resource == "phone" )
4482 syncExternal( 1 ); 4487 syncExternal( 1 );
4483 // pending setmodified 4488 // pending setmodified
4484 return true; 4489 return true;
4485} 4490}
4486void CalendarView::setSyncManager(KSyncManager* manager) 4491void CalendarView::setSyncManager(KSyncManager* manager)
4487{ 4492{
4488 mSyncManager = manager; 4493 mSyncManager = manager;
4489} 4494}
4490 4495
4491void CalendarView::removeSyncInfo( QString syncProfile) 4496void CalendarView::removeSyncInfo( QString syncProfile)
4492{ 4497{
4493 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4498 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4494 mCalendar->removeSyncInfo( syncProfile ); 4499 mCalendar->removeSyncInfo( syncProfile );
4495 4500
4496} 4501}
4497 4502
4498void CalendarView::undo_delete() 4503void CalendarView::undo_delete()
4499{ 4504{
4500 //qDebug("undo_delete() "); 4505 //qDebug("undo_delete() ");
4501 Incidence* undo = mCalendar->undoIncidence(); 4506 Incidence* undo = mCalendar->undoIncidence();
4502 if ( !undo ) { 4507 if ( !undo ) {
4503 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4508 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4504 i18n("KO/Pi")); 4509 i18n("KO/Pi"));
4505 return; 4510 return;
4506 } 4511 }
4507 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4512 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4508 i18n("\nAre you sure you want\nto restore this?"), 4513 i18n("\nAre you sure you want\nto restore this?"),
4509 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4514 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4510 mCalendar->undoDeleteIncidence(); 4515 mCalendar->undoDeleteIncidence();
4511 updateView(); 4516 updateView();
4512 } 4517 }
4513} 4518}
4514 4519
4515void CalendarView::slotViewerClosed() 4520void CalendarView::slotViewerClosed()
4516{ 4521{
4517 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4522 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4518} 4523}
4519 4524
4520void CalendarView::resetFocus() 4525void CalendarView::resetFocus()
4521{ 4526{
4522 if ( mViewerCallerIsSearchDialog ) { 4527 if ( mViewerCallerIsSearchDialog ) {
4523 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4528 if ( mDialogManager->getSearchDialog()->isVisible() ){
4524 mDialogManager->getSearchDialog()->raise(); 4529 mDialogManager->getSearchDialog()->raise();
4525 mDialogManager->getSearchDialog()->setActiveWindow(); 4530 mDialogManager->getSearchDialog()->setActiveWindow();
4526 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4531 mDialogManager->getSearchDialog()->listview()->resetFocus();
4527 } else 4532 } else
4528 mViewerCallerIsSearchDialog = false; 4533 mViewerCallerIsSearchDialog = false;
4529 } 4534 }
4530 if ( !mViewerCallerIsSearchDialog ) { 4535 if ( !mViewerCallerIsSearchDialog ) {
4531 //mViewManager->currentView()->setFocus(); 4536 //mViewManager->currentView()->setFocus();
4532 //qDebug("sssssssssssssssset focus "); 4537 //qDebug("sssssssssssssssset focus ");
4533 topLevelWidget()->raise(); 4538 topLevelWidget()->raise();
4534 setActiveWindow(); 4539 setActiveWindow();
4535 //setFocus(); 4540 //setFocus();
4536 } 4541 }
4537 mViewerCallerIsSearchDialog = false; 4542 mViewerCallerIsSearchDialog = false;
4538} 4543}
4539 4544
4540void CalendarView::showNextAlarms() 4545void CalendarView::showNextAlarms()
4541{ 4546{
4542 QString message; 4547 QString message;
4543 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4548 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4544 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4549 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4545 QString sum = mCalendar->nextSummary(); 4550 QString sum = mCalendar->nextSummary();
4546 QDateTime nextA = mNextAlarmDateTime; 4551 QDateTime nextA = mNextAlarmDateTime;
4547 QDateTime cur = QDateTime::currentDateTime(); 4552 QDateTime cur = QDateTime::currentDateTime();
4548 int secs = cur.secsTo( nextA ); 4553 int secs = cur.secsTo( nextA );
4549 int min = secs /60; 4554 int min = secs /60;
4550 int hours = min /60; 4555 int hours = min /60;
4551 min = min % 60; 4556 min = min % 60;
4552 int days = hours /24; 4557 int days = hours /24;
4553 hours = hours % 24; 4558 hours = hours % 24;
4554 4559
4555 //message = i18n("The next alarm is in:\n"); 4560 //message = i18n("The next alarm is in:\n");
4556 if ( days > 1 ) 4561 if ( days > 1 )
4557 message += i18n("%1 days\n").arg( days ); 4562 message += i18n("%1 days\n").arg( days );
4558 else if ( days == 1 ) 4563 else if ( days == 1 )
4559 message += i18n("1 day\n"); 4564 message += i18n("1 day\n");
4560 if ( hours > 1 ) 4565 if ( hours > 1 )
4561 message += i18n("%1 hours\n").arg( hours ); 4566 message += i18n("%1 hours\n").arg( hours );
4562 else if ( hours == 1 ) 4567 else if ( hours == 1 )
4563 message += i18n("1 hour\n"); 4568 message += i18n("1 hour\n");
4564 if ( min > 1 ) 4569 if ( min > 1 )
4565 message += i18n("%1 minutes\n").arg( min ); 4570 message += i18n("%1 minutes\n").arg( min );
4566 else if ( min == 1 ) 4571 else if ( min == 1 )
4567 message += i18n("1 minute\n"); 4572 message += i18n("1 minute\n");
4568 if ( message.isEmpty() ) 4573 if ( message.isEmpty() )
4569 message = i18n("The next alarm is in\nless than one minute!"); 4574 message = i18n("The next alarm is in\nless than one minute!");
4570 else 4575 else
4571 message = i18n("The next alarm is in:\n") + message; 4576 message = i18n("The next alarm is in:\n") + message;
4572 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4577 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 3323a98..c9e9870 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -44,192 +44,193 @@
44 44
45#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
46 46
47#include <ksyncmanager.h> 47#include <ksyncmanager.h>
48//#include <koprefs.h> 48//#include <koprefs.h>
49 49
50class QWidgetStack; 50class QWidgetStack;
51class QSplitter; 51class QSplitter;
52class KopiCalendarFile; 52class KopiCalendarFile;
53class CalPrinter; 53class CalPrinter;
54class KOFilterView; 54class KOFilterView;
55class KOCalEditView; 55class KOCalEditView;
56class KOViewManager; 56class KOViewManager;
57class KODialogManager; 57class KODialogManager;
58class KOTodoView; 58class KOTodoView;
59class KDateNavigator; 59class KDateNavigator;
60class DateNavigatorContainer; 60class DateNavigatorContainer;
61class DateNavigator; 61class DateNavigator;
62class KOIncidenceEditor; 62class KOIncidenceEditor;
63class KDatePicker; 63class KDatePicker;
64class ResourceView; 64class ResourceView;
65class KOEventEditor; 65class KOEventEditor;
66class KOTodoEditor ; 66class KOTodoEditor ;
67class KOEventViewerDialog; 67class KOEventViewerDialog;
68class KOBeamPrefs; 68class KOBeamPrefs;
69class KSyncProfile; 69class KSyncProfile;
70class AlarmDialog; 70class AlarmDialog;
71class KCal::Attendee; 71class KCal::Attendee;
72 72
73namespace KCal { class FileStorage; } 73namespace KCal { class FileStorage; }
74 74
75using namespace KCal; 75using namespace KCal;
76 76
77/** 77/**
78 This is the main calendar widget. It provides the different vies on t he 78 This is the main calendar widget. It provides the different vies on t he
79 calendar data as well as the date navigator. It also handles synchronisation 79 calendar data as well as the date navigator. It also handles synchronisation
80 of the different views and controls the different dialogs like preferences, 80 of the different views and controls the different dialogs like preferences,
81 event editor, search dialog etc. 81 event editor, search dialog etc.
82 82
83 @short main calendar view widget 83 @short main calendar view widget
84 @author Cornelius Schumacher 84 @author Cornelius Schumacher
85*/ 85*/
86 86
87#include <qtextbrowser.h> 87#include <qtextbrowser.h>
88#include <qtextcodec.h> 88#include <qtextcodec.h>
89 89
90class MissedAlarmTextBrowser : public QTextBrowser { 90class MissedAlarmTextBrowser : public QTextBrowser {
91 Q_OBJECT 91 Q_OBJECT
92 public: 92 public:
93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
94 ~MissedAlarmTextBrowser(); 94 ~MissedAlarmTextBrowser();
95 void setSource(const QString & n); 95 void setSource(const QString & n);
96 96
97 private: 97 private:
98 Incidence * getNextInc(QDateTime start ); 98 Incidence * getNextInc(QDateTime start );
99 QPtrList<Incidence> mAlarms; 99 QPtrList<Incidence> mAlarms;
100 signals: 100 signals:
101 void showIncidence( QString uid); 101 void showIncidence( QString uid);
102}; 102};
103 103
104 104
105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
106{ 106{
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 /** 109 /**
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm();
140 141
141 signals: 142 signals:
142 void save (); 143 void save ();
143 void saveStopTimer (); 144 void saveStopTimer ();
144 void tempDisableBR(bool); 145 void tempDisableBR(bool);
145 /** This todo has been modified */ 146 /** This todo has been modified */
146 void todoModified(Todo *, int); 147 void todoModified(Todo *, int);
147 148
148 /** 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
149 * and emit this signal which notifies all widgets which have registered 150 * and emit this signal which notifies all widgets which have registered
150 * for notification to update their settings. */ 151 * for notification to update their settings. */
151 void configChanged(); 152 void configChanged();
152 /** emitted when the topwidget is closing down, so that any attached 153 /** emitted when the topwidget is closing down, so that any attached
153 child windows can also close. */ 154 child windows can also close. */
154 void closingDown(); 155 void closingDown();
155 /** emitted right before we die */ 156 /** emitted right before we die */
156 void closed(QWidget *); 157 void closed(QWidget *);
157 158
158 /** Emitted when state of modified flag changes */ 159 /** Emitted when state of modified flag changes */
159 void modifiedChanged(bool); 160 void modifiedChanged(bool);
160 void signalmodified(); 161 void signalmodified();
161 162
162 /** Emitted when state of read-only flag changes */ 163 /** Emitted when state of read-only flag changes */
163 void readOnlyChanged(bool); 164 void readOnlyChanged(bool);
164 165
165 /** Emitted when the unit of navigation changes */ 166 /** Emitted when the unit of navigation changes */
166 void changeNavStringPrev(const QString &); 167 void changeNavStringPrev(const QString &);
167 void changeNavStringNext(const QString &); 168 void changeNavStringNext(const QString &);
168 169
169 /** 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*/
170 void organizerEventsSelected(bool); 171 void organizerEventsSelected(bool);
171 /** 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*/
172 void groupEventsSelected(bool); 173 void groupEventsSelected(bool);
173 /** 174 /**
174 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
175 signal is emitted with 0 as argument. 176 signal is emitted with 0 as argument.
176 */ 177 */
177 void incidenceSelected( Incidence * ); 178 void incidenceSelected( Incidence * );
178 /** Emitted, when a todoitem is selected or deselected. */ 179 /** Emitted, when a todoitem is selected or deselected. */
179 void todoSelected( bool ); 180 void todoSelected( bool );
180 181
181 /** 182 /**
182 Emitted, when clipboard content changes. Parameter indicates if paste 183 Emitted, when clipboard content changes. Parameter indicates if paste
183 is possible or not. 184 is possible or not.
184 */ 185 */
185 void pasteEnabled(bool); 186 void pasteEnabled(bool);
186 187
187 /** Emitted, when the number of incoming messages has changed. */ 188 /** Emitted, when the number of incoming messages has changed. */
188 void numIncomingChanged(int); 189 void numIncomingChanged(int);
189 190
190 /** Emitted, when the number of outgoing messages has changed. */ 191 /** Emitted, when the number of outgoing messages has changed. */
191 void numOutgoingChanged(int); 192 void numOutgoingChanged(int);
192 193
193 /** 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. */
194 void statusMessage(const QString &); 195 void statusMessage(const QString &);
195 196
196 void calendarViewExpanded( bool ); 197 void calendarViewExpanded( bool );
197 void updateSearchDialog(); 198 void updateSearchDialog();
198 void filtersUpdated(); 199 void filtersUpdated();
199 200
200 201
201 public slots: 202 public slots:
202 void checkAlarms(); 203 void checkAlarms();
203 void slotprintSelInc(); 204 void slotprintSelInc();
204 void showNextAlarms(); 205 void showNextAlarms();
205 void showOpenError(); 206 void showOpenError();
206 void watchSavedFile(); 207 void watchSavedFile();
207 void recheckTimerAlarm(); 208 void recheckTimerAlarm();
208 void checkNextTimerAlarm(); 209 void checkNextTimerAlarm();
209 void addAlarm(const QDateTime &qdt, const QString &noti ); 210 void addAlarm(const QDateTime &qdt, const QString &noti );
210 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 211 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
211 void removeAlarm(const QDateTime &qdt, const QString &noti ); 212 void removeAlarm(const QDateTime &qdt, const QString &noti );
212 213
213 /** options dialog made a changed to the configuration. we catch this 214 /** options dialog made a changed to the configuration. we catch this
214 * and notify all widgets which need to update their configuration. */ 215 * and notify all widgets which need to update their configuration. */
215 void updateConfig(); 216 void updateConfig();
216 217
217 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 218 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
218 const QStringList& anniversaryList, const QStringList& realNameList, 219 const QStringList& anniversaryList, const QStringList& realNameList,
219 const QStringList& emailList, const QStringList& assembledNameList, 220 const QStringList& emailList, const QStringList& assembledNameList,
220 const QStringList& uidList); 221 const QStringList& uidList);
221 222
222 /** 223 /**
223 Load calendar from file \a filename. If \a merge is true, load 224 Load calendar from file \a filename. If \a merge is true, load
224 calendar into existing one, if it is false, clear calendar, before 225 calendar into existing one, if it is false, clear calendar, before
225 loading. Return true, if calendar could be successfully loaded. 226 loading. Return true, if calendar could be successfully loaded.
226 */ 227 */
227 bool openCalendar(QString filename, bool merge=false); 228 bool openCalendar(QString filename, bool merge=false);
228 bool loadCalendars(); 229 bool loadCalendars();
229 bool saveCalendars(); 230 bool saveCalendars();
230 bool restoreCalendarSettings(); 231 bool restoreCalendarSettings();
231 bool addCalendar( KopiCalendarFile * ); 232 bool addCalendar( KopiCalendarFile * );
232 void addCalendarId( int id ); 233 void addCalendarId( int id );
233 bool syncCalendar(QString filename,int mode = 0 ); 234 bool syncCalendar(QString filename,int mode = 0 );
234 235
235 /** 236 /**
@@ -362,193 +363,192 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
362 /** 363 /**
363 Functions for printing, previewing a print, and setting up printing 364 Functions for printing, previewing a print, and setting up printing
364 parameters. 365 parameters.
365 */ 366 */
366 void print(); 367 void print();
367 void printSetup(); 368 void printSetup();
368 void printPreview(); 369 void printPreview();
369 370
370 /** Export as iCalendar file */ 371 /** Export as iCalendar file */
371 void exportICalendar(); 372 void exportICalendar();
372 373
373 /** Export as vCalendar file */ 374 /** Export as vCalendar file */
374 bool exportVCalendar( QString fn); 375 bool exportVCalendar( QString fn);
375 376
376 /** pop up a dialog to show an existing appointment. */ 377 /** pop up a dialog to show an existing appointment. */
377 void appointment_show(); 378 void appointment_show();
378 /** 379 /**
379 * pop up an Appointment Dialog to edit an existing appointment.Get 380 * pop up an Appointment Dialog to edit an existing appointment.Get
380 * information on the appointment from the list of unique IDs that is 381 * information on the appointment from the list of unique IDs that is
381 * currently in the View, called currIds. 382 * currently in the View, called currIds.
382 */ 383 */
383 void appointment_edit(); 384 void appointment_edit();
384 /** 385 /**
385 * pop up dialog confirming deletion of currently selected event in the 386 * pop up dialog confirming deletion of currently selected event in the
386 * View. 387 * View.
387 */ 388 */
388 void appointment_delete(); 389 void appointment_delete();
389 390
390 /** mails the currently selected event to a particular user as a vCalendar 391 /** mails the currently selected event to a particular user as a vCalendar
391 attachment. */ 392 attachment. */
392 void action_mail(); 393 void action_mail();
393 394
394 /* frees a subtodo from it's relation */ 395 /* frees a subtodo from it's relation */
395 void todo_unsub( Todo * ); 396 void todo_unsub( Todo * );
396 void todo_resub( Todo * parent, Todo * sub ); 397 void todo_resub( Todo * parent, Todo * sub );
397 398
398 /** Take ownership of selected event. */ 399 /** Take ownership of selected event. */
399 void takeOverEvent(); 400 void takeOverEvent();
400 401
401 /** Take ownership of all events in calendar. */ 402 /** Take ownership of all events in calendar. */
402 void takeOverCalendar(); 403 void takeOverCalendar();
403 404
404 /** query whether or not the calendar is "dirty". */ 405 /** query whether or not the calendar is "dirty". */
405 bool isModified(); 406 bool isModified();
406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 407 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
407 void setModified(bool modified=true); 408 void setModified(bool modified=true);
408 409
409 /** query if the calendar is read-only. */ 410 /** query if the calendar is read-only. */
410 bool isReadOnly(); 411 bool isReadOnly();
411 /** set state of calendar to read-only */ 412 /** set state of calendar to read-only */
412 void setReadOnly(bool readOnly=true); 413 void setReadOnly(bool readOnly=true);
413 414
414 void eventUpdated(Incidence *); 415 void eventUpdated(Incidence *);
415 416
416 /* iTIP scheduling actions */ 417 /* iTIP scheduling actions */
417 void schedule_publish(Incidence *incidence = 0); 418 void schedule_publish(Incidence *incidence = 0);
418 void schedule_request(Incidence *incidence = 0); 419 void schedule_request(Incidence *incidence = 0);
419 void schedule_refresh(Incidence *incidence = 0); 420 void schedule_refresh(Incidence *incidence = 0);
420 void schedule_cancel(Incidence *incidence = 0); 421 void schedule_cancel(Incidence *incidence = 0);
421 void schedule_add(Incidence *incidence = 0); 422 void schedule_add(Incidence *incidence = 0);
422 void schedule_reply(Incidence *incidence = 0); 423 void schedule_reply(Incidence *incidence = 0);
423 void schedule_counter(Incidence *incidence = 0); 424 void schedule_counter(Incidence *incidence = 0);
424 void schedule_declinecounter(Incidence *incidence = 0); 425 void schedule_declinecounter(Incidence *incidence = 0);
425 void schedule_publish_freebusy(int daysToPublish = 30); 426 void schedule_publish_freebusy(int daysToPublish = 30);
426 427
427 void openAddressbook(); 428 void openAddressbook();
428 429
429 void editFilters(); 430 void editFilters();
430 void toggleFilerEnabled(); 431 void toggleFilerEnabled();
431 QPtrList<CalFilter> filters(); 432 QPtrList<CalFilter> filters();
432 void toggleFilter(); 433 void toggleFilter();
433 void showFilter(bool visible); 434 void showFilter(bool visible);
434 void updateFilter(); 435 void updateFilter();
435 void filterEdited(); 436 void filterEdited();
436 void selectFilter( int ); 437 void selectFilter( int );
437 KOFilterView *filterView(); 438 KOFilterView *filterView();
438 439
439 void showIntro(); 440 void showIntro();
440 441
441 /** Move the curdatepient view date to today */ 442 /** Move the curdatepient view date to today */
442 void goToday(); 443 void goToday();
443 444
444 /** Move to the next date(s) in the current view */ 445 /** Move to the next date(s) in the current view */
445 void goNext(); 446 void goNext();
446 447
447 /** Move to the previous date(s) in the current view */ 448 /** Move to the previous date(s) in the current view */
448 void goPrevious(); 449 void goPrevious();
449 /** Move to the next date(s) in the current view */ 450 /** Move to the next date(s) in the current view */
450 void goNextMonth(); 451 void goNextMonth();
451 452
452 /** Move to the previous date(s) in the current view */ 453 /** Move to the previous date(s) in the current view */
453 void goPreviousMonth(); 454 void goPreviousMonth();
454 455
455 void toggleExpand(); 456 void toggleExpand();
456 void toggleDateNavigatorWidget(); 457 void toggleDateNavigatorWidget();
457 void toggleAllDaySize(); 458 void toggleAllDaySize();
458 void dialogClosing(Incidence *);
459 459
460 /** Look for new messages in the inbox */ 460 /** Look for new messages in the inbox */
461 void lookForIncomingMessages(); 461 void lookForIncomingMessages();
462 /** Look for new messages in the outbox */ 462 /** Look for new messages in the outbox */
463 void lookForOutgoingMessages(); 463 void lookForOutgoingMessages();
464 464
465 void processMainViewSelection( Incidence * ); 465 void processMainViewSelection( Incidence * );
466 void processTodoListSelection( Incidence * ); 466 void processTodoListSelection( Incidence * );
467 467
468 void processIncidenceSelection( Incidence * ); 468 void processIncidenceSelection( Incidence * );
469 469
470 void purgeCompleted(); 470 void purgeCompleted();
471 bool removeCompletedSubTodos( Todo* ); 471 bool removeCompletedSubTodos( Todo* );
472 void slotCalendarChanged(); 472 void slotCalendarChanged();
473 bool importBday(); 473 bool importBday();
474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
475 bool importQtopia( const QString &categoriesFile, 475 bool importQtopia( const QString &categoriesFile,
476 const QString &datebookFile, 476 const QString &datebookFile,
477 const QString &tasklistFile ); 477 const QString &tasklistFile );
478 void syncExternal( int mode ); 478 void syncExternal( int mode );
479 void slotSelectPickerDate( QDate ) ; 479 void slotSelectPickerDate( QDate ) ;
480 void showDatePicker() ; 480 void showDatePicker() ;
481 void showDatePickerPopup() ; 481 void showDatePickerPopup() ;
482 void moveIncidence(Incidence *) ; 482 void moveIncidence(Incidence *) ;
483 void beamIncidence(Incidence *) ; 483 void beamIncidence(Incidence *) ;
484 void beamCalendar() ; 484 void beamCalendar() ;
485 void beamFilteredCalendar() ; 485 void beamFilteredCalendar() ;
486 void beamIncidenceList(QPtrList<Incidence>) ; 486 void beamIncidenceList(QPtrList<Incidence>) ;
487 void manageCategories(); 487 void manageCategories();
488 void editCategories(); 488 void editCategories();
489 int addCategories(); 489 int addCategories();
490 void removeCategories(); 490 void removeCategories();
491 void setSyncDevice( QString ); 491 void setSyncDevice( QString );
492 void setSyncName( QString ); 492 void setSyncName( QString );
493 void showDay( QDate ); 493 void showDay( QDate );
494 void undo_delete(); 494 void undo_delete();
495 protected slots: 495 protected slots:
496 void resetFocus(); 496 void resetFocus();
497 void scrollBarValue(int); 497 void scrollBarValue(int);
498 void slotViewerClosed(); 498 void slotViewerClosed();
499 void timerAlarm(); 499 void timerAlarm();
500 void suspendAlarm(); 500 void suspendAlarm();
501 void beamDone( Ir *ir ); 501 void beamDone( Ir *ir );
502 /** Select a view or adapt the current view to display the specified dates. */ 502 /** Select a view or adapt the current view to display the specified dates. */
503 void showDates( const KCal::DateList & ); 503 void showDates( const KCal::DateList & );
504 void selectWeekNum ( int ); 504 void selectWeekNum ( int );
505 505
506 public: 506 public:
507 // show a standard warning 507 // show a standard warning
508 // returns KMsgBox::yesNoCancel() 508 // returns KMsgBox::yesNoCancel()
509 int msgCalModified(); 509 int msgCalModified();
510 virtual bool sync(KSyncManager* manager, QString filename, int mode); 510 virtual bool sync(KSyncManager* manager, QString filename, int mode);
511 511
512 virtual bool syncExternal(KSyncManager* manager, QString resource); 512 virtual bool syncExternal(KSyncManager* manager, QString resource);
513 virtual void removeSyncInfo( QString syncProfile); 513 virtual void removeSyncInfo( QString syncProfile);
514 void setSyncManager(KSyncManager* manager); 514 void setSyncManager(KSyncManager* manager);
515 void setLoadedFileVersion(QDateTime); 515 void setLoadedFileVersion(QDateTime);
516 bool checkFileVersion(QString fn); 516 bool checkFileVersion(QString fn);
517 bool checkAllFileVersions(); 517 bool checkAllFileVersions();
518 bool checkFileChanged(QString fn); 518 bool checkFileChanged(QString fn);
519 Event* getLastSyncEvent(); 519 Event* getLastSyncEvent();
520 /** Adapt navigation units correpsonding to step size of navigation of the 520 /** Adapt navigation units correpsonding to step size of navigation of the
521 * current view. 521 * current view.
522 */ 522 */
523 void adaptNavigationUnits(); 523 void adaptNavigationUnits();
524 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 524 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
525 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 525 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
526 //Attendee* getYourAttendee(Event *event); 526 //Attendee* getYourAttendee(Event *event);
527 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 527 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
528 void setScrollBarStep(int val ); 528 void setScrollBarStep(int val );
529 529
530 protected: 530 protected:
531 void schedule(Scheduler::Method, Incidence *incidence = 0); 531 void schedule(Scheduler::Method, Incidence *incidence = 0);
532 532
533 // returns KMsgBox::OKCandel() 533 // returns KMsgBox::OKCandel()
534 int msgItemDelete(const QString name); 534 int msgItemDelete(const QString name);
535 void showEventEditor(); 535 void showEventEditor();
536 void showTodoEditor(); 536 void showTodoEditor();
537 Todo *selectedTodo(); 537 Todo *selectedTodo();
538 private: 538 private:
539#ifdef DESKTOP_VERSION 539#ifdef DESKTOP_VERSION
540 QScrollBar * mDateScrollBar; 540 QScrollBar * mDateScrollBar;
541#endif 541#endif
542 QDateTime mNextAlarmDateTime; 542 QDateTime mNextAlarmDateTime;
543 bool mViewerCallerIsSearchDialog; 543 bool mViewerCallerIsSearchDialog;
544 bool mBlockShowDates; 544 bool mBlockShowDates;
545 KSyncManager* mSyncManager; 545 KSyncManager* mSyncManager;
546 AlarmDialog * mAlarmDialog; 546 AlarmDialog * mAlarmDialog;
547 QString mAlarmNotification; 547 QString mAlarmNotification;
548 QString mSuspendAlarmNotification; 548 QString mSuspendAlarmNotification;
549 QTimer* mSuspendTimer; 549 QTimer* mSuspendTimer;
550 QTimer* mAlarmTimer; 550 QTimer* mAlarmTimer;
551 QTimer* mRecheckAlarmTimer; 551 QTimer* mRecheckAlarmTimer;
552 void computeAlarm( QString ); 552 void computeAlarm( QString );
553 void startAlarm( QString, QString ); 553 void startAlarm( QString, QString );
554 void setSyncEventsReadOnly(); 554 void setSyncEventsReadOnly();
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index 5455098..ea30fac 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -205,152 +205,148 @@ void KODialogManager::showSearchDialog()
205 list = config->readListEntry("SearchLayout"); 205 list = config->readListEntry("SearchLayout");
206 int x,y,w,h; 206 int x,y,w,h;
207 if ( ! list.isEmpty() ) { 207 if ( ! list.isEmpty() ) {
208 x = list[0].toInt(); 208 x = list[0].toInt();
209 y = list[1].toInt(); 209 y = list[1].toInt();
210 w = list[2].toInt(); 210 w = list[2].toInt();
211 h = list[3].toInt(); 211 h = list[3].toInt();
212 KApplication::testCoords( &x,&y,&w,&h ); 212 KApplication::testCoords( &x,&y,&w,&h );
213 mSearchDialog->setGeometry(x,y,w,h); 213 mSearchDialog->setGeometry(x,y,w,h);
214 214
215 } 215 }
216 216
217#endif 217#endif
218 } 218 }
219 // make sure the widget is on top again 219 // make sure the widget is on top again
220#ifdef DESKTOP_VERSION 220#ifdef DESKTOP_VERSION
221 mSearchDialog->show(); 221 mSearchDialog->show();
222#else 222#else
223 mSearchDialog->setMaximumSize( QApplication::desktop()->size()); 223 mSearchDialog->setMaximumSize( QApplication::desktop()->size());
224 mSearchDialog->showMaximized(); 224 mSearchDialog->showMaximized();
225#endif 225#endif
226 mSearchDialog->raiseAndSelect(); 226 mSearchDialog->raiseAndSelect();
227} 227}
228 228
229SearchDialog * KODialogManager::getSearchDialog() 229SearchDialog * KODialogManager::getSearchDialog()
230{ 230{
231 return mSearchDialog; 231 return mSearchDialog;
232} 232}
233void KODialogManager::showArchiveDialog() 233void KODialogManager::showArchiveDialog()
234{ 234{
235#ifndef KORG_NOARCHIVE 235#ifndef KORG_NOARCHIVE
236 if (!mArchiveDialog) { 236 if (!mArchiveDialog) {
237 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 237 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
238 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 238 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
239 mMainView,SLOT(updateView())); 239 mMainView,SLOT(updateView()));
240 } 240 }
241 mArchiveDialog->show(); 241 mArchiveDialog->show();
242 mArchiveDialog->raise(); 242 mArchiveDialog->raise();
243 243
244 // Workaround. 244 // Workaround.
245 QApplication::restoreOverrideCursor(); 245 QApplication::restoreOverrideCursor();
246#endif 246#endif
247} 247}
248 248
249void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) 249void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters)
250{ 250{
251 if (!mFilterEditDialog) { 251 if (!mFilterEditDialog) {
252 mFilterEditDialog = new FilterEditDialog(filters,mMainView); 252 mFilterEditDialog = new FilterEditDialog(filters,mMainView);
253 connect(mFilterEditDialog,SIGNAL(filterChanged()), 253 connect(mFilterEditDialog,SIGNAL(filterChanged()),
254 mMainView,SLOT(filterEdited())); 254 mMainView,SLOT(filterEdited()));
255 255
256 } 256 }
257 257
258#ifndef DESKTOP_VERSION 258#ifndef DESKTOP_VERSION
259 mFilterEditDialog->showMaximized(); 259 mFilterEditDialog->showMaximized();
260#else 260#else
261 mFilterEditDialog->show(); 261 mFilterEditDialog->show();
262#endif 262#endif
263 mFilterEditDialog->raise(); 263 mFilterEditDialog->raise();
264} 264}
265 265
266void KODialogManager::showPluginDialog() 266void KODialogManager::showPluginDialog()
267{ 267{
268#ifndef KORG_NOPLUGINS 268#ifndef KORG_NOPLUGINS
269 if (!mPluginDialog) { 269 if (!mPluginDialog) {
270 mPluginDialog = new PluginDialog(mMainView); 270 mPluginDialog = new PluginDialog(mMainView);
271 connect(mPluginDialog,SIGNAL(configChanged()), 271 connect(mPluginDialog,SIGNAL(configChanged()),
272 mMainView,SLOT(updateConfig())); 272 mMainView,SLOT(updateConfig()));
273 } 273 }
274 mPluginDialog->show(); 274 mPluginDialog->show();
275 mPluginDialog->raise(); 275 mPluginDialog->raise();
276#endif 276#endif
277} 277}
278 278
279KOEventEditor *KODialogManager::getEventEditor() 279KOEventEditor *KODialogManager::getEventEditor()
280{ 280{
281 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), 281 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(),
282 mMainView ); 282 mMainView );
283 283
284 connect(eventEditor,SIGNAL(eventAdded(Event *)), 284 connect(eventEditor,SIGNAL(eventAdded(Event *)),
285 mMainView,SLOT(eventAdded(Event *))); 285 mMainView,SLOT(eventAdded(Event *)));
286 connect(eventEditor,SIGNAL(eventChanged(Event *)), 286 connect(eventEditor,SIGNAL(eventChanged(Event *)),
287 mMainView,SLOT(eventChanged(Event *))); 287 mMainView,SLOT(eventChanged(Event *)));
288 connect(eventEditor,SIGNAL(eventDeleted()), 288 connect(eventEditor,SIGNAL(eventDeleted()),
289 mMainView,SLOT(eventDeleted())); 289 mMainView,SLOT(eventDeleted()));
290 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), 290 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)),
291 mMainView,SLOT(schedule_cancel(Incidence *))); 291 mMainView,SLOT(schedule_cancel(Incidence *)));
292 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), 292 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)),
293 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 293 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
294 connect( eventEditor, SIGNAL( showAgendaView( bool)), 294 connect( eventEditor, SIGNAL( showAgendaView( bool)),
295 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 295 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
296 296
297 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 297 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
298 // eventEditor,SLOT(updateCategoryConfig())); 298 // eventEditor,SLOT(updateCategoryConfig()));
299 // connect(eventEditor,SIGNAL(editCategories()), 299 // connect(eventEditor,SIGNAL(editCategories()),
300 // mCategoryEditDialog,SLOT(show())); 300 // mCategoryEditDialog,SLOT(show()));
301 connect(eventEditor,SIGNAL(dialogClose(Incidence*)),
302 mMainView,SLOT(dialogClosing(Incidence*)));
303 301
304 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); 302 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject()));
305 303
306#ifndef DESKTOP_VERSION 304#ifndef DESKTOP_VERSION
307 eventEditor->resize( QApplication::desktop()->width() -20, 100 ); 305 eventEditor->resize( QApplication::desktop()->width() -20, 100 );
308#endif 306#endif
309 return eventEditor; 307 return eventEditor;
310} 308}
311 309
312KOTodoEditor *KODialogManager::getTodoEditor() 310KOTodoEditor *KODialogManager::getTodoEditor()
313{ 311{
314 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), 312 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(),
315 mMainView ); 313 mMainView );
316 314
317 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 315 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
318 // todoEditor,SLOT(updateCategoryConfig())); 316 // todoEditor,SLOT(updateCategoryConfig()));
319 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); 317 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show()));
320 318
321 connect(todoEditor,SIGNAL(todoAdded(Todo *)), 319 connect(todoEditor,SIGNAL(todoAdded(Todo *)),
322 mMainView,SLOT(todoAdded(Todo *))); 320 mMainView,SLOT(todoAdded(Todo *)));
323 connect(todoEditor,SIGNAL(todoChanged(Todo *)), 321 connect(todoEditor,SIGNAL(todoChanged(Todo *)),
324 mMainView,SLOT(todoChanged(Todo *))); 322 mMainView,SLOT(todoChanged(Todo *)));
325 connect(todoEditor,SIGNAL(todoDeleted()), 323 connect(todoEditor,SIGNAL(todoDeleted()),
326 mMainView,SLOT(todoDeleted())); 324 mMainView,SLOT(todoDeleted()));
327 connect(todoEditor,SIGNAL(dialogClose(Incidence*)),
328 mMainView,SLOT(dialogClosing(Incidence*)));
329 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), 325 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)),
330 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 326 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
331 connect( todoEditor, SIGNAL( showAgendaView( bool)), 327 connect( todoEditor, SIGNAL( showAgendaView( bool)),
332 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 328 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
333 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), 329 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)),
334 // mMainView,SLOT(schedule_cancel(Incidence *))); 330 // mMainView,SLOT(schedule_cancel(Incidence *)));
335 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); 331 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject()));
336#ifndef DESKTOP_VERSION 332#ifndef DESKTOP_VERSION
337 todoEditor->resize( QApplication::desktop()->width() -20, 100 ); 333 todoEditor->resize( QApplication::desktop()->width() -20, 100 );
338#endif 334#endif
339 return todoEditor; 335 return todoEditor;
340} 336}
341 337
342void KODialogManager::updateSearchDialog() 338void KODialogManager::updateSearchDialog()
343{ 339{
344 if (mSearchDialog) mSearchDialog->updateView(); 340 if (mSearchDialog) mSearchDialog->updateView();
345} 341}
346 342
347void KODialogManager::setDocumentId( const QString &id ) 343void KODialogManager::setDocumentId( const QString &id )
348{ 344{
349 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); 345 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id );
350} 346}
351 347
352void KODialogManager::writeSettings( KConfig *config ) 348void KODialogManager::writeSettings( KConfig *config )
353{ 349{
354 if (mSearchDialog) 350 if (mSearchDialog)
355 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); 351 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout");
356} 352}
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 517677c..e5e3704 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -346,193 +346,194 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
346 i18n("Beam selected via IR"),this, 346 i18n("Beam selected via IR"),this,
347 SLOT(beamSelected()),true); 347 SLOT(beamSelected()),true);
348#endif 348#endif
349 /* 349 /*
350 mPopupMenu = new QPopupMenu; 350 mPopupMenu = new QPopupMenu;
351 mPopupMenu->insertItem(i18n("Edit Event"), this, 351 mPopupMenu->insertItem(i18n("Edit Event"), this,
352 SLOT (editEvent())); 352 SLOT (editEvent()));
353 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 353 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
354 SLOT (deleteEvent())); 354 SLOT (deleteEvent()));
355 mPopupMenu->insertSeparator(); 355 mPopupMenu->insertSeparator();
356 mPopupMenu->insertItem(i18n("Show Dates"), this, 356 mPopupMenu->insertItem(i18n("Show Dates"), this,
357 SLOT(showDates())); 357 SLOT(showDates()));
358 mPopupMenu->insertItem(i18n("Hide Dates"), this, 358 mPopupMenu->insertItem(i18n("Hide Dates"), this,
359 SLOT(hideDates())); 359 SLOT(hideDates()));
360 */ 360 */
361 QObject::connect(mListView,SIGNAL( newEvent()), 361 QObject::connect(mListView,SIGNAL( newEvent()),
362 this,SIGNAL(signalNewEvent())); 362 this,SIGNAL(signalNewEvent()));
363 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 363 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
364 this,SLOT(defaultItemAction(QListViewItem *))); 364 this,SLOT(defaultItemAction(QListViewItem *)));
365 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 365 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
366 const QPoint &, int )), 366 const QPoint &, int )),
367 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 367 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
368 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 368 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
369 SLOT(processSelectionChange(QListViewItem *))); 369 SLOT(processSelectionChange(QListViewItem *)));
370 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 370 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
371 SIGNAL(showIncidenceSignal(Incidence *)) ); 371 SIGNAL(showIncidenceSignal(Incidence *)) );
372 372
373 readSettings(KOGlobals::config(),"KOListView Layout"); 373 readSettings(KOGlobals::config(),"KOListView Layout");
374} 374}
375 375
376KOListView::~KOListView() 376KOListView::~KOListView()
377{ 377{
378 delete mPopupMenu; 378 delete mPopupMenu;
379#if QT_VERSION >= 0x030000 379#if QT_VERSION >= 0x030000
380 380
381#else 381#else
382 delete mKOListViewWhatsThis; 382 delete mKOListViewWhatsThis;
383#endif 383#endif
384} 384}
385 385
386QString KOListView::getWhatsThisText(QPoint p) 386QString KOListView::getWhatsThisText(QPoint p)
387{ 387{
388 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 388 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
389 if ( item ) 389 if ( item )
390 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 390 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
391 KOPrefs::instance()->mWTshowDetails, 391 KOPrefs::instance()->mWTshowDetails,
392 KOPrefs::instance()->mWTshowCreated, 392 KOPrefs::instance()->mWTshowCreated,
393 KOPrefs::instance()->mWTshowChanged); 393 KOPrefs::instance()->mWTshowChanged);
394 return i18n("That is the list view" ); 394 return i18n("That is the list view" );
395 395
396} 396}
397 397
398void KOListView::setCalendar( int c ) 398void KOListView::setCalendar( int c )
399{ 399{
400 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 400 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
401 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), 401 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ),
402 i18n("Continue"), i18n("Cancel"), 0, 402 i18n("Continue"), i18n("Cancel"), 0,
403 0, 1 ); 403 0, 1 );
404 if ( result != 0 ) { 404 if ( result != 0 ) {
405 return; 405 return;
406 } 406 }
407 407
408 QPtrList<Incidence> delSel = getSelectedIncidences() ; 408 QPtrList<Incidence> delSel = getSelectedIncidences() ;
409 int icount = delSel.count(); 409 int icount = delSel.count();
410 if ( icount ) { 410 if ( icount ) {
411 Incidence *incidence = delSel.first(); 411 Incidence *incidence = delSel.first();
412 while ( incidence ) { 412 while ( incidence ) {
413 incidence->setCalID( c ); 413 incidence->setCalID( c );
414 KOListViewItem * item = getItemForEvent( incidence ); 414 KOListViewItem * item = getItemForEvent( incidence );
415 if ( item ) { 415 if ( item ) {
416 ListItemVisitor v(item, mStartDate ); 416 ListItemVisitor v(item, mStartDate );
417 incidence->accept(v); 417 incidence->accept(v);
418 } 418 }
419 incidence = delSel.next(); 419 incidence = delSel.next();
420 } 420 }
421 } 421 }
422 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 422 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
423 KopiCalendarFile * cal = calendars.first(); 423 KopiCalendarFile * cal = calendars.first();
424 while ( cal ) { 424 while ( cal ) {
425 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 425 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
426 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 426 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
427 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 427 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
428 if ( cal->isStandard ) 428 if ( cal->isStandard )
429 mCalendar->setDefaultCalendar( cal->mCalNumber ); 429 mCalendar->setDefaultCalendar( cal->mCalNumber );
430 cal = calendars.next(); 430 cal = calendars.next();
431 } 431 }
432 mCalendar->setSyncEventsReadOnly(); 432 mCalendar->setSyncEventsReadOnly();
433 mCalendar->reInitAlarmSettings(); 433 mCalendar->reInitAlarmSettings();
434 434
435} 435}
436void KOListView::populateCalPopup() 436void KOListView::populateCalPopup()
437{ 437{
438 mCalPopup->clear(); 438 mCalPopup->clear();
439 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 439 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
440 while ( kkf ) { 440 while ( kkf ) {
441 int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); 441 int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber);
442 mCalPopup->setItemEnabled( index, !kkf->isReadOnly ); 442 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
443 mCalPopup->setItemEnabled( index, false );
443 kkf = KOPrefs::instance()->mCalendars.next(); 444 kkf = KOPrefs::instance()->mCalendars.next();
444 } 445 }
445} 446}
446void KOListView::updateList() 447void KOListView::updateList()
447{ 448{
448 // qDebug(" KOListView::updateList() "); 449 // qDebug(" KOListView::updateList() ");
449 450
450} 451}
451 452
452void KOListView::clearList() 453void KOListView::clearList()
453{ 454{
454 clear (); 455 clear ();
455} 456}
456void KOListView::addCat( ) 457void KOListView::addCat( )
457{ 458{
458 setCategories( false ); 459 setCategories( false );
459} 460}
460void KOListView::setCat() 461void KOListView::setCat()
461{ 462{
462 setCategories( true ); 463 setCategories( true );
463} 464}
464 465
465void KOListView::setAlarm() 466void KOListView::setAlarm()
466{ 467{
467 KOAlarmPrefs kap( this); 468 KOAlarmPrefs kap( this);
468 if ( !kap.exec() ) 469 if ( !kap.exec() )
469 return; 470 return;
470 QStringList itemList; 471 QStringList itemList;
471 QPtrList<KOListViewItem> sel ; 472 QPtrList<KOListViewItem> sel ;
472 QListViewItem *qitem = mListView->firstChild (); 473 QListViewItem *qitem = mListView->firstChild ();
473 while ( qitem ) { 474 while ( qitem ) {
474 if ( qitem->isSelected() ) { 475 if ( qitem->isSelected() ) {
475 Incidence* inc = ((KOListViewItem *) qitem)->data(); 476 Incidence* inc = ((KOListViewItem *) qitem)->data();
476 if ( inc->typeID() != journalID ) { 477 if ( inc->typeID() != journalID ) {
477 if ( inc->typeID() == todoID ) { 478 if ( inc->typeID() == todoID ) {
478 if ( ((Todo*)inc)->hasDueDate() ) 479 if ( ((Todo*)inc)->hasDueDate() )
479 sel.append(((KOListViewItem *)qitem)); 480 sel.append(((KOListViewItem *)qitem));
480 } else 481 } else
481 sel.append(((KOListViewItem *)qitem)); 482 sel.append(((KOListViewItem *)qitem));
482 } 483 }
483 } 484 }
484 qitem = qitem->nextSibling(); 485 qitem = qitem->nextSibling();
485 } 486 }
486 int count = 0; 487 int count = 0;
487 KOListViewItem * item, *temp; 488 KOListViewItem * item, *temp;
488 item = sel.first(); 489 item = sel.first();
489 Incidence* inc; 490 Incidence* inc;
490 while ( item ) { 491 while ( item ) {
491 inc = item->data(); 492 inc = item->data();
492 ++count; 493 ++count;
493 if (kap.mAlarmButton->isChecked()) { 494 if (kap.mAlarmButton->isChecked()) {
494 if (inc->alarms().count() == 0) 495 if (inc->alarms().count() == 0)
495 inc->newAlarm(); 496 inc->newAlarm();
496 QPtrList<Alarm> alarms = inc->alarms(); 497 QPtrList<Alarm> alarms = inc->alarms();
497 Alarm *alarm; 498 Alarm *alarm;
498 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 499 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
499 alarm->setEnabled(true); 500 alarm->setEnabled(true);
500 int j = kap.mAlarmTimeEdit->value()* -60; 501 int j = kap.mAlarmTimeEdit->value()* -60;
501 if (kap.mAlarmIncrCombo->currentItem() == 1) 502 if (kap.mAlarmIncrCombo->currentItem() == 1)
502 j = j * 60; 503 j = j * 60;
503 else if (kap.mAlarmIncrCombo->currentItem() == 2) 504 else if (kap.mAlarmIncrCombo->currentItem() == 2)
504 j = j * (60 * 24); 505 j = j * (60 * 24);
505 alarm->setStartOffset( j ); 506 alarm->setStartOffset( j );
506 507
507 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 508 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
508 alarm->setProcedureAlarm(kap.mAlarmProgram); 509 alarm->setProcedureAlarm(kap.mAlarmProgram);
509 } 510 }
510 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 511 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
511 alarm->setAudioAlarm(kap.mAlarmSound); 512 alarm->setAudioAlarm(kap.mAlarmSound);
512 else 513 else
513 alarm->setType(Alarm::Invalid); 514 alarm->setType(Alarm::Invalid);
514 //alarm->setAudioAlarm("default"); 515 //alarm->setAudioAlarm("default");
515 // TODO: Deal with multiple alarms 516 // TODO: Deal with multiple alarms
516 break; // For now, stop after the first alarm 517 break; // For now, stop after the first alarm
517 } 518 }
518 } else { 519 } else {
519 Alarm* alarm = inc->alarms().first(); 520 Alarm* alarm = inc->alarms().first();
520 if ( alarm ) { 521 if ( alarm ) {
521 alarm->setEnabled(false); 522 alarm->setEnabled(false);
522 alarm->setType(Alarm::Invalid); 523 alarm->setType(Alarm::Invalid);
523 } 524 }
524 } 525 }
525 ListItemVisitor v(item, mStartDate ); 526 ListItemVisitor v(item, mStartDate );
526 inc->accept(v); 527 inc->accept(v);
527 item = sel.next(); 528 item = sel.next();
528 } 529 }
529 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); 530 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
530 qDebug("KO: Set alarm for %d items", count); 531 qDebug("KO: Set alarm for %d items", count);
531 calendar()->reInitAlarmSettings(); 532 calendar()->reInitAlarmSettings();
532 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 533 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
533} 534}
534void KOListView::setCategories( bool removeOld ) 535void KOListView::setCategories( bool removeOld )
535{ 536{
536 537
537 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 538 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
538 csd->setColorEnabled(); 539 csd->setColorEnabled();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b6ce7d5..b797d8c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -41,403 +41,399 @@
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "kojournalview.h" 50#include "kojournalview.h"
51#include "koagenda.h" 51#include "koagenda.h"
52#include "kodialogmanager.h" 52#include "kodialogmanager.h"
53#include "kdialogbase.h" 53#include "kdialogbase.h"
54#include "kapplication.h" 54#include "kapplication.h"
55#include "kofilterview.h" 55#include "kofilterview.h"
56#include "kstandarddirs.h" 56#include "kstandarddirs.h"
57#include "koprefs.h" 57#include "koprefs.h"
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koglobals.h" 59#include "koglobals.h"
60#include "kglobal.h" 60#include "kglobal.h"
61#include "ktoolbar.h" 61#include "ktoolbar.h"
62#include "klocale.h" 62#include "klocale.h"
63#include "kconfig.h" 63#include "kconfig.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65#include <kglobalsettings.h> 65#include <kglobalsettings.h>
66 66
67using namespace KCal; 67using namespace KCal;
68#ifndef _WIN32_ 68#ifndef _WIN32_
69#include <unistd.h> 69#include <unistd.h>
70#else 70#else
71#ifdef _OL_IMPORT_ 71#ifdef _OL_IMPORT_
72#include "koimportoldialog.h" 72#include "koimportoldialog.h"
73#endif 73#endif
74#endif 74#endif
75#include "mainwindow.h" 75#include "mainwindow.h"
76 76
77 77
78class KOex2phonePrefs : public QDialog 78class KOex2phonePrefs : public QDialog
79{ 79{
80 public: 80 public:
81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
82 QDialog( parent, name, true ) 82 QDialog( parent, name, true )
83 { 83 {
84 setCaption( i18n("Export to phone options") ); 84 setCaption( i18n("Export to phone options") );
85 QVBoxLayout* lay = new QVBoxLayout( this ); 85 QVBoxLayout* lay = new QVBoxLayout( this );
86 lay->setSpacing( 3 ); 86 lay->setSpacing( 3 );
87 lay->setMargin( 3 ); 87 lay->setMargin( 3 );
88 QLabel *lab; 88 QLabel *lab;
89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
90 lab->setAlignment (AlignHCenter ); 90 lab->setAlignment (AlignHCenter );
91 QHBox* temphb; 91 QHBox* temphb;
92 temphb = new QHBox( this ); 92 temphb = new QHBox( this );
93 new QLabel( i18n("I/O device: "), temphb ); 93 new QLabel( i18n("I/O device: "), temphb );
94 mPhoneDevice = new QLineEdit( temphb); 94 mPhoneDevice = new QLineEdit( temphb);
95 lay->addWidget( temphb ); 95 lay->addWidget( temphb );
96 temphb = new QHBox( this ); 96 temphb = new QHBox( this );
97 new QLabel( i18n("Connection: "), temphb ); 97 new QLabel( i18n("Connection: "), temphb );
98 mPhoneConnection = new QLineEdit( temphb); 98 mPhoneConnection = new QLineEdit( temphb);
99 lay->addWidget( temphb ); 99 lay->addWidget( temphb );
100 temphb = new QHBox( this ); 100 temphb = new QHBox( this );
101 new QLabel( i18n("Model(opt.): "), temphb ); 101 new QLabel( i18n("Model(opt.): "), temphb );
102 mPhoneModel = new QLineEdit( temphb); 102 mPhoneModel = new QLineEdit( temphb);
103 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
105 mWriteBackFuture->setChecked( true ); 105 mWriteBackFuture->setChecked( true );
106 lay->addWidget( mWriteBackFuture ); 106 lay->addWidget( mWriteBackFuture );
107 temphb = new QHBox( this ); 107 temphb = new QHBox( this );
108 new QLabel( i18n("Max. weeks in future: ") , temphb ); 108 new QLabel( i18n("Max. weeks in future: ") , temphb );
109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
110 mWriteBackFutureWeeks->setValue( 8 ); 110 mWriteBackFutureWeeks->setValue( 8 );
111 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
113 lab->setAlignment (AlignHCenter ); 113 lab->setAlignment (AlignHCenter );
114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
115 lay->addWidget( ok ); 115 lay->addWidget( ok );
116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
117 lay->addWidget( cancel ); 117 lay->addWidget( cancel );
118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
120 resize( 220, 240 ); 120 resize( 220, 240 );
121 qApp->processEvents(); 121 qApp->processEvents();
122 int dw = QApplication::desktop()->width(); 122 int dw = QApplication::desktop()->width();
123 int dh = QApplication::desktop()->height(); 123 int dh = QApplication::desktop()->height();
124 move( (dw-width())/2, (dh - height() )/2 ); 124 move( (dw-width())/2, (dh - height() )/2 );
125 } 125 }
126 126
127public: 127public:
128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
129 QCheckBox* mWriteBackFuture; 129 QCheckBox* mWriteBackFuture;
130 QSpinBox* mWriteBackFutureWeeks; 130 QSpinBox* mWriteBackFutureWeeks;
131}; 131};
132 132
133QPixmap* sgListViewCompletedPix[6]; 133QPixmap* sgListViewCompletedPix[6];
134 134
135 135
136int globalFlagBlockStartup; 136int globalFlagBlockStartup;
137MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 137MainWindow::MainWindow( QWidget *parent, const char *name ) :
138 QMainWindow( parent, name ) 138 QMainWindow( parent, name )
139{ 139{
140 sgListViewCompletedPix[5] = &listviewPix; 140 sgListViewCompletedPix[5] = &listviewPix;
141 sgListViewCompletedPix[0] = &listviewPix0; 141 sgListViewCompletedPix[0] = &listviewPix0;
142 sgListViewCompletedPix[1] = &listviewPix20; 142 sgListViewCompletedPix[1] = &listviewPix20;
143 sgListViewCompletedPix[2] = &listviewPix40; 143 sgListViewCompletedPix[2] = &listviewPix40;
144 sgListViewCompletedPix[3] = &listviewPix60; 144 sgListViewCompletedPix[3] = &listviewPix60;
145 sgListViewCompletedPix[4] = &listviewPix80; 145 sgListViewCompletedPix[4] = &listviewPix80;
146 if ( sgListViewCompletedPix[5]->height() < 5 ) { 146 if ( sgListViewCompletedPix[5]->height() < 5 ) {
147 int size = 12; 147 //int size = 12;
148 sgListViewCompletedPix[5]->resize( 11, 11 ); 148 sgListViewCompletedPix[5]->resize( 11, 11 );
149 sgListViewCompletedPix[5]->fill( Qt::white ); 149 sgListViewCompletedPix[5]->fill( Qt::white );
150 QPainter p ( sgListViewCompletedPix[5] ); 150 QPainter p ( sgListViewCompletedPix[5] );
151 p.drawRect( 0,0,11,11); 151 p.drawRect( 0,0,11,11);
152 int half = size/2;
153 int heihei = size/2;
154 int x = 1;
155 p.drawLine ( 2, 5, 4 , 7 ) ; 152 p.drawLine ( 2, 5, 4 , 7 ) ;
156 p.drawLine ( 4 , 7 , 8, 3) ; 153 p.drawLine ( 4 , 7 , 8, 3) ;
157 int iii = 0; 154 int iii = 0;
158 for ( iii = 0; iii < 5; ++iii ) { 155 for ( iii = 0; iii < 5; ++iii ) {
159 sgListViewCompletedPix[iii]->resize( 11, 11 ); 156 sgListViewCompletedPix[iii]->resize( 11, 11 );
160 sgListViewCompletedPix[iii]->fill( Qt::white ); 157 sgListViewCompletedPix[iii]->fill( Qt::white );
161 QPainter p ( sgListViewCompletedPix[iii] ); 158 QPainter p ( sgListViewCompletedPix[iii] );
162 p.drawRect( 0,0,11,11); 159 p.drawRect( 0,0,11,11);
163 if ( iii ) 160 if ( iii )
164 p.fillRect( 1,1,iii*2,9,Qt::gray ); 161 p.fillRect( 1,1,iii*2,9,Qt::gray );
165 } 162 }
166 } 163 }
167 mClosed = false; 164 mClosed = false;
168 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 165 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
169 QString confFile = locateLocal("config","korganizerrc"); 166 QString confFile = locateLocal("config","korganizerrc");
170 QFileInfo finf ( confFile ); 167 QFileInfo finf ( confFile );
171 bool showWarning = !finf.exists(); 168 bool showWarning = !finf.exists();
172 setIcon(SmallIcon( "ko24" ) ); 169 setIcon(SmallIcon( "ko24" ) );
173 mBlockAtStartup = true; 170 mBlockAtStartup = true;
174 mFlagKeyPressed = false; 171 mFlagKeyPressed = false;
175 setCaption("KO/Pi"); 172 setCaption("KO/Pi");
176 KOPrefs *p = KOPrefs::instance(); 173 KOPrefs *p = KOPrefs::instance();
177 //KPimGlobalPrefs::instance()->setGlobalConfig(); 174 //KPimGlobalPrefs::instance()->setGlobalConfig();
178 p->mCurrentDisplayedView = 0; 175 p->mCurrentDisplayedView = 0;
179 if ( p->mHourSize > 22 ) 176 if ( p->mHourSize > 22 )
180 p->mHourSize = 22; 177 p->mHourSize = 22;
181 QMainWindow::ToolBarDock tbd; 178 QMainWindow::ToolBarDock tbd;
182 if ( p->mToolBarHor ) { 179 if ( p->mToolBarHor ) {
183 if ( p->mToolBarUp ) 180 if ( p->mToolBarUp )
184 tbd = Bottom; 181 tbd = Bottom;
185 else 182 else
186 tbd = Top; 183 tbd = Top;
187 } 184 }
188 else { 185 else {
189 if ( p->mToolBarUp ) 186 if ( p->mToolBarUp )
190 tbd = Right; 187 tbd = Right;
191 else 188 else
192 tbd = Left; 189 tbd = Left;
193 } 190 }
194 if ( KOPrefs::instance()->mUseAppColors ) 191 if ( KOPrefs::instance()->mUseAppColors )
195 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 192 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
196 globalFlagBlockStartup = 1; 193 globalFlagBlockStartup = 1;
197 iconToolBar = new QPEToolBar( this ); 194 iconToolBar = new QPEToolBar( this );
198 addToolBar (iconToolBar , tbd ); 195 addToolBar (iconToolBar , tbd );
199 196
200#ifdef DESKTOP_VERSION 197#ifdef DESKTOP_VERSION
201 if ( KOPrefs::instance()->mShowIconFilter ) 198 if ( KOPrefs::instance()->mShowIconFilter )
202#else 199#else
203 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 200 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
204#endif 201#endif
205 202
206{ 203{
207 if ( p->mToolBarHorF ) { 204 if ( p->mToolBarHorF ) {
208 if ( p->mToolBarUpF ) 205 if ( p->mToolBarUpF )
209 tbd = Bottom; 206 tbd = Bottom;
210 else 207 else
211 tbd = Top; 208 tbd = Top;
212 } 209 }
213 else { 210 else {
214 if ( p->mToolBarUpF ) 211 if ( p->mToolBarUpF )
215 tbd = Right; 212 tbd = Right;
216 else 213 else
217 tbd = Left; 214 tbd = Left;
218 } 215 }
219 filterToolBar = new QPEToolBar ( this ); 216 filterToolBar = new QPEToolBar ( this );
220 filterMenubar = new QMenuBar( 0 ); 217 filterMenubar = new QMenuBar( 0 );
221 QFontMetrics fm ( filterMenubar->font() ); 218 QFontMetrics fm ( filterMenubar->font() );
222 219
223 filterPopupMenu = new QPopupMenu( this ); 220 filterPopupMenu = new QPopupMenu( this );
224 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 221 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
225 QString addTest = "A"; 222 QString addTest = "A";
226 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 223 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
227#ifdef DESKTOP_VERSION 224#ifdef DESKTOP_VERSION
228 addTest = "AAABBBCCCx"; 225 addTest = "AAABBBCCCx";
229#else 226#else
230 addTest = "AAx"; 227 addTest = "AAx";
231#endif 228#endif
232 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 229 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
233 addToolBar (filterToolBar , tbd ); 230 addToolBar (filterToolBar , tbd );
234 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 231 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
235 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 232 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
236 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 233 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
237 filterToolBar->hide(); 234 filterToolBar->hide();
238 } else { 235 } else {
239 filterToolBar = 0; 236 filterToolBar = 0;
240 filterMenubar = 0; 237 filterMenubar = 0;
241 filterPopupMenu = 0; 238 filterPopupMenu = 0;
242 } 239 }
243 if ( p->mShowIconOnetoolbar ) { 240 if ( p->mShowIconOnetoolbar ) {
244 viewToolBar = iconToolBar ; 241 viewToolBar = iconToolBar ;
245 navigatorToolBar = iconToolBar ; 242 navigatorToolBar = iconToolBar ;
246 } else { 243 } else {
247#ifndef DESKTOP_VERSION 244#ifndef DESKTOP_VERSION
248 setToolBarsMovable( false ); 245 setToolBarsMovable( false );
249#endif 246#endif
250 if ( p->mToolBarHorV ) { 247 if ( p->mToolBarHorV ) {
251 if ( p->mToolBarUpV ) 248 if ( p->mToolBarUpV )
252 tbd = Bottom; 249 tbd = Bottom;
253 else 250 else
254 tbd = Top; 251 tbd = Top;
255 } 252 }
256 else { 253 else {
257 if ( p->mToolBarUpV ) 254 if ( p->mToolBarUpV )
258 tbd = Right; 255 tbd = Right;
259 else 256 else
260 tbd = Left; 257 tbd = Left;
261 } 258 }
262 viewToolBar = new QPEToolBar( this ); 259 viewToolBar = new QPEToolBar( this );
263 addToolBar (viewToolBar , tbd ); 260 addToolBar (viewToolBar , tbd );
264 if ( p->mToolBarHorN ) { 261 if ( p->mToolBarHorN ) {
265 if ( p->mToolBarUpN ) 262 if ( p->mToolBarUpN )
266 tbd = Bottom; 263 tbd = Bottom;
267 else 264 else
268 tbd = Top; 265 tbd = Top;
269 } 266 }
270 else { 267 else {
271 if ( p->mToolBarUpN ) 268 if ( p->mToolBarUpN )
272 tbd = Right; 269 tbd = Right;
273 else 270 else
274 tbd = Left; 271 tbd = Left;
275 } 272 }
276 navigatorToolBar = new QPEToolBar( this ); 273 navigatorToolBar = new QPEToolBar( this );
277 addToolBar (navigatorToolBar , tbd ); 274 addToolBar (navigatorToolBar , tbd );
278 } 275 }
279 276
280 277
281 278
282 mCalendarModifiedFlag = false; 279 mCalendarModifiedFlag = false;
283 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 280 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
284 splash->setAlignment ( AlignCenter ); 281 splash->setAlignment ( AlignCenter );
285 setCentralWidget( splash ); 282 setCentralWidget( splash );
286#ifndef DESKTOP_VERSION 283#ifndef DESKTOP_VERSION
287 showMaximized(); 284 showMaximized();
288#endif 285#endif
289 286
290 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 287 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
291 setDefaultPreferences(); 288 setDefaultPreferences();
292 mCalendar = new CalendarLocal(); 289 mCalendar = new CalendarLocal();
293 mView = new CalendarView( mCalendar, this,"mCalendar " ); 290 mView = new CalendarView( mCalendar, this,"mCalendar " );
294 mView->hide(); 291 mView->hide();
295 //mView->resize(splash->size() ); 292 //mView->resize(splash->size() );
296 initActions(); 293 initActions();
297 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 294 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
298 mSyncManager->setBlockSave(false); 295 mSyncManager->setBlockSave(false);
299 mView->setSyncManager(mSyncManager); 296 mView->setSyncManager(mSyncManager);
300#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
301 iconToolBar->show(); 298 iconToolBar->show();
302 qApp->processEvents(); 299 qApp->processEvents();
303#endif 300#endif
304 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 301 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
305 int vh = height() ; 302 int vh = height() ;
306 int vw = width(); 303 int vw = width();
307 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 304 //qDebug("Toolbar hei %d ",iconToolBar->height() );
308 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 305 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
309 vh -= iconToolBar->height(); 306 vh -= iconToolBar->height();
310 } else { 307 } else {
311 vw -= iconToolBar->height(); 308 vw -= iconToolBar->height();
312 } 309 }
313 //mView->setMaximumSize( splash->size() ); 310 //mView->setMaximumSize( splash->size() );
314 //mView->resize( splash->size() ); 311 //mView->resize( splash->size() );
315 //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 ());
316 mView->readSettings(); 313 mView->readSettings();
317 bool newFile = false; 314 bool newFile = false;
318 if( !QFile::exists( defaultFileName() ) ) { 315 if( !QFile::exists( defaultFileName() ) ) {
319 QFileInfo finfo ( defaultFileName() ); 316 QFileInfo finfo ( defaultFileName() );
320 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
321 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";
322 finfo.setFile( oldFile ); 319 finfo.setFile( oldFile );
323 if (finfo.exists() ) { 320 if (finfo.exists() ) {
324 KMessageBox::information( this, message); 321 KMessageBox::information( this, message);
325 mView->openCalendar( oldFile ); 322 mView->openCalendar( oldFile );
326 qApp->processEvents(); 323 qApp->processEvents();
327 } else { 324 } else {
328 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
329 finfo.setFile( oldFile ); 326 finfo.setFile( oldFile );
330 if (finfo.exists() ) { 327 if (finfo.exists() ) {
331 KMessageBox::information( this, message); 328 KMessageBox::information( this, message);
332 mView->openCalendar( oldFile ); 329 mView->openCalendar( oldFile );
333 qApp->processEvents(); 330 qApp->processEvents();
334 } 331 }
335 } 332 }
336 mView->saveCalendar( defaultFileName() ); 333 mView->saveCalendar( defaultFileName() );
337 newFile = true; 334 newFile = true;
338 } 335 }
339 336
340 QTime neededSaveTime = QDateTime::currentDateTime().time(); 337 QTime neededSaveTime = QDateTime::currentDateTime().time();
341 mView->loadCalendars(); 338 mView->loadCalendars();
342 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
343 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 340 qDebug("KO: Calendar loading time: %d ms",msNeeded );
344 341
345 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
346 KOPrefs::instance()->setAllDefaults(); 343 KOPrefs::instance()->setAllDefaults();
347 int count = mView->addCategories();
348 } 344 }
349 processIncidenceSelection( 0 ); 345 processIncidenceSelection( 0 );
350 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
351 SLOT( processIncidenceSelection( Incidence * ) ) ); 347 SLOT( processIncidenceSelection( Incidence * ) ) );
352 connect( mView, SIGNAL( modifiedChanged( bool ) ), 348 connect( mView, SIGNAL( modifiedChanged( bool ) ),
353 SLOT( slotModifiedChanged( bool ) ) ); 349 SLOT( slotModifiedChanged( bool ) ) );
354 350
355 351
356 connect( mView, SIGNAL( tempDisableBR(bool) ), 352 connect( mView, SIGNAL( tempDisableBR(bool) ),
357 SLOT( disableBR(bool) ) ); 353 SLOT( disableBR(bool) ) );
358 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
359 mView->setModified( false ); 355 mView->setModified( false );
360 mBlockAtStartup = false; 356 mBlockAtStartup = false;
361 mView->setModified( false ); 357 mView->setModified( false );
362 setCentralWidget( mView ); 358 setCentralWidget( mView );
363 globalFlagBlockStartup = 0; 359 globalFlagBlockStartup = 0;
364 mView->show(); 360 mView->show();
365 delete splash; 361 delete splash;
366 if ( newFile ) 362 if ( newFile )
367 mView->updateConfig(); 363 mView->updateConfig();
368 // qApp->processEvents(); 364 // qApp->processEvents();
369 //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 ());
370 //fillSyncMenu(); 366 //fillSyncMenu();
371 367
372 368
373 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
374 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 374 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 376 mSyncManager->fillSyncMenu();
381 377
382 378
383 379
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 381 if ( showWarning ) {
386 KMessageBox::information( this, 382 KMessageBox::information( this,
387 "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");
388 qApp->processEvents(); 384 qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 385 mView->dialogManager()->showSyncOptions();
390 } 386 }
391 387
392 //US listen for result adressed from Ka/Pi 388 //US listen for result adressed from Ka/Pi
393#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
394 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 & )));
395#endif 391#endif
396#ifndef DESKTOP_VERSION 392#ifndef DESKTOP_VERSION
397 infrared = 0; 393 infrared = 0;
398#endif 394#endif
399 updateFilterToolbar(); 395 updateFilterToolbar();
400 updateWeek( mView->startDate() ); 396 updateWeek( mView->startDate() );
401 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
402 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 398 SLOT( updateWeekNum( const KCal::DateList & ) ) );
403 mBRdisabled = false; 399 mBRdisabled = false;
404 //toggleBeamReceive(); 400 //toggleBeamReceive();
405 int tiint= 3000; 401 int tiint= 3000;
406#ifndef DESKTOP_VERSION 402#ifndef DESKTOP_VERSION
407 tiint = 5000; 403 tiint = 5000;
408#endif 404#endif
409 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); 405 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() ));
410} 406}
411MainWindow::~MainWindow() 407MainWindow::~MainWindow()
412{ 408{
413 //qDebug("MainWindow::~MainWindow() "); 409 //qDebug("MainWindow::~MainWindow() ");
414 //save toolbar location 410 //save toolbar location
415 delete mCalendar; 411 delete mCalendar;
416 delete mSyncManager; 412 delete mSyncManager;
417#ifndef DESKTOP_VERSION 413#ifndef DESKTOP_VERSION
418 if ( infrared ) 414 if ( infrared )
419 delete infrared; 415 delete infrared;
420#endif 416#endif
421 417
422 418
423} 419}
424 420
425void MainWindow::disableBR(bool b) 421void MainWindow::disableBR(bool b)
426{ 422{
427#ifndef DESKTOP_VERSION 423#ifndef DESKTOP_VERSION
428 if ( b ) { 424 if ( b ) {
429 if ( infrared ) { 425 if ( infrared ) {
430 toggleBeamReceive(); 426 toggleBeamReceive();
431 mBRdisabled = true; 427 mBRdisabled = true;
432 } 428 }
433 mBRdisabled = true; 429 mBRdisabled = true;
434 } else { 430 } else {
435 if ( mBRdisabled ) { 431 if ( mBRdisabled ) {
436 mBRdisabled = false; 432 mBRdisabled = false;
437 //makes no sense,because other cal ap is probably running 433 //makes no sense,because other cal ap is probably running
438 // toggleBeamReceive(); 434 // toggleBeamReceive();
439 } 435 }
440 } 436 }
441#endif 437#endif
442 438
443} 439}
@@ -1762,241 +1758,241 @@ void MainWindow::importBday()
1762 i18n("Import!"), i18n("Cancel"), 0, 1758 i18n("Import!"), i18n("Cancel"), 0,
1763 0, 1 ); 1759 0, 1 );
1764 if ( result == 0 ) { 1760 if ( result == 0 ) {
1765 mView->importBday(); 1761 mView->importBday();
1766 1762
1767 } 1763 }
1768 1764
1769 1765
1770} 1766}
1771void MainWindow::importQtopia() 1767void MainWindow::importQtopia()
1772{ 1768{
1773 //#ifndef DESKTOP_VERSION 1769 //#ifndef DESKTOP_VERSION
1774 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1770 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1775#ifdef DESKTOP_VERSION 1771#ifdef DESKTOP_VERSION
1776 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1772 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1777#endif 1773#endif
1778 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1774 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1779 i18n("Import!"), i18n("Cancel"), 0, 1775 i18n("Import!"), i18n("Cancel"), 0,
1780 0, 1 ); 1776 0, 1 );
1781 if ( result == 0 ) { 1777 if ( result == 0 ) {
1782#ifndef DESKTOP_VERSION 1778#ifndef DESKTOP_VERSION
1783 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1779 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1784 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1780 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1785 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1781 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1786#else 1782#else
1787 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1783 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1788 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1784 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1789 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1785 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1790#endif 1786#endif
1791 mView->importQtopia( categories, datebook, todolist ); 1787 mView->importQtopia( categories, datebook, todolist );
1792 } 1788 }
1793 mView->calendar()->reInitAlarmSettings(); 1789 mView->calendar()->reInitAlarmSettings();
1794#if 0 1790#if 0
1795 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1791 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1796 i18n("Not supported \non desktop!\n"), 1792 i18n("Not supported \non desktop!\n"),
1797 i18n("Ok"), i18n("Cancel"), 0, 1793 i18n("Ok"), i18n("Cancel"), 0,
1798 0, 1 ); 1794 0, 1 );
1799 1795
1800#endif 1796#endif
1801} 1797}
1802 1798
1803void MainWindow::saveOnClose() 1799void MainWindow::saveOnClose()
1804{ 1800{
1805 KOPrefs *p = KOPrefs::instance(); 1801 KOPrefs *p = KOPrefs::instance();
1806 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1802 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1807 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1803 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1808 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1804 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1809 if ( filterToolBar ) { 1805 if ( filterToolBar ) {
1810 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1806 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1811 } 1807 }
1812#ifdef DESKTOP_VERSION 1808#ifdef DESKTOP_VERSION
1813 1809
1814 QPoint myP; 1810 QPoint myP;
1815 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1811 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1816 if ( p->mToolBarHor ) 1812 if ( p->mToolBarHor )
1817 p->mToolBarUp = myP.y() > height()/2; 1813 p->mToolBarUp = myP.y() > height()/2;
1818 else 1814 else
1819 p->mToolBarUp = myP.x() > width()/2; 1815 p->mToolBarUp = myP.x() > width()/2;
1820 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1816 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1821 if ( p->mToolBarHorV ) 1817 if ( p->mToolBarHorV )
1822 p->mToolBarUpV = myP.y() > height()/2; 1818 p->mToolBarUpV = myP.y() > height()/2;
1823 else 1819 else
1824 p->mToolBarUpV = myP.x() > width()/2 ; 1820 p->mToolBarUpV = myP.x() > width()/2 ;
1825 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1821 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1826 if ( p->mToolBarHorN ) 1822 if ( p->mToolBarHorN )
1827 p->mToolBarUpN = myP.y() > height()/2; 1823 p->mToolBarUpN = myP.y() > height()/2;
1828 else 1824 else
1829 p->mToolBarUpN = myP.x() > width()/2 ; 1825 p->mToolBarUpN = myP.x() > width()/2 ;
1830 if ( filterToolBar ) { 1826 if ( filterToolBar ) {
1831 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1827 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1832 if ( p->mToolBarHorF ) 1828 if ( p->mToolBarHorF )
1833 p->mToolBarUpF = myP.y() > height()/2; 1829 p->mToolBarUpF = myP.y() > height()/2;
1834 else 1830 else
1835 p->mToolBarUpF = myP.x() > width()/2 ; 1831 p->mToolBarUpF = myP.x() > width()/2 ;
1836 } 1832 }
1837#else 1833#else
1838 if ( p->mToolBarHor ) 1834 if ( p->mToolBarHor )
1839 p->mToolBarUp = iconToolBar->y() > height()/2; 1835 p->mToolBarUp = iconToolBar->y() > height()/2;
1840 else 1836 else
1841 p->mToolBarUp = iconToolBar->x() > width()/2; 1837 p->mToolBarUp = iconToolBar->x() > width()/2;
1842 if ( p->mToolBarHorV ) 1838 if ( p->mToolBarHorV )
1843 p->mToolBarUpV = viewToolBar->y() > height()/2; 1839 p->mToolBarUpV = viewToolBar->y() > height()/2;
1844 else 1840 else
1845 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1841 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1846 1842
1847 if ( p->mToolBarHorN ) 1843 if ( p->mToolBarHorN )
1848 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1844 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1849 else 1845 else
1850 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1846 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1851 if ( filterToolBar ) { 1847 if ( filterToolBar ) {
1852 if ( p->mToolBarHorF ) 1848 if ( p->mToolBarHorF )
1853 p->mToolBarUpF = filterToolBar->y() > height()/2; 1849 p->mToolBarUpF = filterToolBar->y() > height()/2;
1854 else 1850 else
1855 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1851 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1856 } 1852 }
1857#endif 1853#endif
1858
1859 save(); 1854 save();
1860 mView->writeSettings(); 1855 mView->writeSettings();
1856 mView->checkSuspendAlarm();
1861} 1857}
1862void MainWindow::slotModifiedChanged( bool changed ) 1858void MainWindow::slotModifiedChanged( bool )
1863{ 1859{
1864 if ( mBlockAtStartup ) 1860 if ( mBlockAtStartup )
1865 return; 1861 return;
1866 1862
1867 int msec; 1863 int msec;
1868 // we store the changes after 1 minute, 1864 // we store the changes after 1 minute,
1869 // and for safety reasons after 10 minutes again 1865 // and for safety reasons after 10 minutes again
1870 if ( !mSyncManager->blockSave() ) 1866 if ( !mSyncManager->blockSave() )
1871 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1867 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1872 else 1868 else
1873 msec = 1000 * 600; 1869 msec = 1000 * 600;
1874 mSaveTimer.start( msec, true ); // 1 minute 1870 mSaveTimer.start( msec, true ); // 1 minute
1875 qDebug("KO: Saving File in %d secs!", msec/1000); 1871 qDebug("KO: Saving File in %d secs!", msec/1000);
1876 mCalendarModifiedFlag = true; 1872 mCalendarModifiedFlag = true;
1877} 1873}
1878void MainWindow::saveStopTimer() 1874void MainWindow::saveStopTimer()
1879{ 1875{
1880 mSaveTimer.stop(); 1876 mSaveTimer.stop();
1881} 1877}
1882void MainWindow::backupAllFiles() 1878void MainWindow::backupAllFiles()
1883{ 1879{
1884 QDate reference ( 2000,1,1); 1880 QDate reference ( 2000,1,1);
1885 int daysTo = reference.daysTo ( QDate::currentDate() ); 1881 int daysTo = reference.daysTo ( QDate::currentDate() );
1886 setCaption(i18n("Creating backup ... please wait ..." )); 1882 setCaption(i18n("Creating backup ... please wait ..." ));
1887 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1883 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1888 // we need the file path, the backup dir and the number of bups as param 1884 // we need the file path, the backup dir and the number of bups as param
1889 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1885 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1890 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1886 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1891 bupDir = KGlobalSettings::backupDataDir(); 1887 bupDir = KGlobalSettings::backupDataDir();
1892 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1888 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1893 if ( retval == 0 ) { 1889 if ( retval == 0 ) {
1894 setCaption(i18n("Backup cancelled" )); 1890 setCaption(i18n("Backup cancelled" ));
1895 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1891 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1896 // retval == 0 : backup skipped for today, try again tomorrow 1892 // retval == 0 : backup skipped for today, try again tomorrow
1897 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1893 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1898 } else if ( retval == 1 ){ 1894 } else if ( retval == 1 ){
1899 qDebug("KO: Backup created."); 1895 qDebug("KO: Backup created.");
1900 // backup ok 1896 // backup ok
1901 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1897 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1902 KopiCalendarFile * cal = calendars.first(); 1898 KopiCalendarFile * cal = calendars.first();
1903 cal = calendars.next(); 1899 cal = calendars.next();
1904 while ( cal ) { 1900 while ( cal ) {
1905 if ( !cal->mErrorOnLoad ) { 1901 if ( !cal->mErrorOnLoad ) {
1906 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1902 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1907 } 1903 }
1908 cal = calendars.next(); 1904 cal = calendars.next();
1909 } 1905 }
1910 KOPrefs::instance()->mLastBackupDate = daysTo; 1906 KOPrefs::instance()->mLastBackupDate = daysTo;
1911 setCaption(i18n("Backup succesfully finished" )); 1907 setCaption(i18n("Backup succesfully finished" ));
1912 } else if ( retval == 2 ){ 1908 } else if ( retval == 2 ){
1913 setCaption(i18n("Backup globally disabled" )); 1909 setCaption(i18n("Backup globally disabled" ));
1914 qDebug("KO: Backup globally cancelled."); 1910 qDebug("KO: Backup globally cancelled.");
1915 // backup globally cancelled 1911 // backup globally cancelled
1916 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1912 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1917 } 1913 }
1918 // retval == 3: do nothing, try again later 1914 // retval == 3: do nothing, try again later
1919} 1915}
1920void MainWindow::save() 1916void MainWindow::save()
1921{ 1917{
1922 if ( mView->viewManager()->journalView() ) 1918 if ( mView->viewManager()->journalView() )
1923 mView->viewManager()->journalView()->checkModified(); 1919 mView->viewManager()->journalView()->checkModified();
1924 if ( !mCalendarModifiedFlag ) { 1920 if ( !mCalendarModifiedFlag ) {
1925 qDebug("KO: Calendar not modified. Nothing saved."); 1921 qDebug("KO: Calendar not modified. Nothing saved.");
1926 return; 1922 return;
1927 } 1923 }
1928 if ( mSyncManager->blockSave() ) 1924 if ( mSyncManager->blockSave() )
1929 return; 1925 return;
1930 mSyncManager->setBlockSave(true); 1926 mSyncManager->setBlockSave(true);
1931 if ( mView->checkAllFileVersions() ) { 1927 if ( mView->checkAllFileVersions() ) {
1932 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1928 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1933 QDate reference ( 2000,1,1); 1929 QDate reference ( 2000,1,1);
1934 int daysTo = reference.daysTo ( QDate::currentDate() ); 1930 int daysTo = reference.daysTo ( QDate::currentDate() );
1935 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1931 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1936 backupAllFiles(); 1932 backupAllFiles();
1937 } 1933 }
1938 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1934 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1939 } 1935 }
1940 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1936 QTime neededSaveTime = QDateTime::currentDateTime().time();
1941 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1937 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1942 qDebug("KO: Start saving data to file!"); 1938 qDebug("KO: Start saving data to file!");
1943 mView->saveCalendars(); 1939 mView->saveCalendars();
1944 mCalendarModifiedFlag = false; 1940 mCalendarModifiedFlag = false;
1945 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1941 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1946 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1942 qDebug("KO: Needed %d ms for saving.",msNeeded );
1947 QString savemes; 1943 QString savemes;
1948 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1944 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1949 setCaption(savemes); 1945 setCaption(savemes);
1950 } else 1946 } else
1951 setCaption(i18n("Saving cancelled!")); 1947 setCaption(i18n("Saving cancelled!"));
1952 mSyncManager->setBlockSave( false ); 1948 mSyncManager->setBlockSave( false );
1953} 1949}
1954 1950
1955void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1951void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1956{ 1952{
1957 if ( !e->isAutoRepeat() ) { 1953 if ( !e->isAutoRepeat() ) {
1958 mFlagKeyPressed = false; 1954 mFlagKeyPressed = false;
1959 } 1955 }
1960} 1956}
1961void MainWindow::keyPressEvent ( QKeyEvent * e ) 1957void MainWindow::keyPressEvent ( QKeyEvent * e )
1962{ 1958{
1963 qApp->processEvents(); 1959 qApp->processEvents();
1964 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1960 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1965 e->ignore(); 1961 e->ignore();
1966 // qDebug(" ignore %d",e->isAutoRepeat() ); 1962 // qDebug(" ignore %d",e->isAutoRepeat() );
1967 return; 1963 return;
1968 } 1964 }
1969 if (! e->isAutoRepeat() ) 1965 if (! e->isAutoRepeat() )
1970 mFlagKeyPressed = true; 1966 mFlagKeyPressed = true;
1971 KOPrefs *p = KOPrefs::instance(); 1967 KOPrefs *p = KOPrefs::instance();
1972 bool showSelectedDates = false; 1968 bool showSelectedDates = false;
1973 int size; 1969 int size;
1974 int pro = 0; 1970 int pro = 0;
1975 //qDebug("MainWindow::keyPressEvent "); 1971 //qDebug("MainWindow::keyPressEvent ");
1976 switch ( e->key() ) { 1972 switch ( e->key() ) {
1977 case Qt::Key_Right: 1973 case Qt::Key_Right:
1978 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1974 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1979 mView->goNextMonth(); 1975 mView->goNextMonth();
1980 else 1976 else
1981 mView->goNext(); 1977 mView->goNext();
1982 showSelectedDates = true; 1978 showSelectedDates = true;
1983 break; 1979 break;
1984 case Qt::Key_Left: 1980 case Qt::Key_Left:
1985 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1981 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1986 mView->goPreviousMonth(); 1982 mView->goPreviousMonth();
1987 else 1983 else
1988 mView->goPrevious(); 1984 mView->goPrevious();
1989 showSelectedDates = true; 1985 showSelectedDates = true;
1990 break; 1986 break;
1991 case Qt::Key_Down: 1987 case Qt::Key_Down:
1992 mView->viewManager()->agendaView()->scrollOneHourDown(); 1988 mView->viewManager()->agendaView()->scrollOneHourDown();
1993 break; 1989 break;
1994 case Qt::Key_Up: 1990 case Qt::Key_Up:
1995 mView->viewManager()->agendaView()->scrollOneHourUp(); 1991 mView->viewManager()->agendaView()->scrollOneHourUp();
1996 break; 1992 break;
1997 case Qt::Key_K: 1993 case Qt::Key_K:
1998 mView->viewManager()->showMonthViewWeek(); 1994 mView->viewManager()->showMonthViewWeek();
1999 break; 1995 break;
2000 case Qt::Key_I: 1996 case Qt::Key_I:
2001 mView->showIncidence(); 1997 mView->showIncidence();
2002 break; 1998 break;
@@ -2315,196 +2311,195 @@ void MainWindow::setCaptionToDates()
2315 } 2311 }
2316 selDates = KGlobal::locale()->formatDate( date, true); 2312 selDates = KGlobal::locale()->formatDate( date, true);
2317 if (mView->startDate() < mView->endDate() ) 2313 if (mView->startDate() < mView->endDate() )
2318 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2314 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2319 else { 2315 else {
2320 QString addString; 2316 QString addString;
2321 if ( date == QDateTime::currentDateTime().date() ) 2317 if ( date == QDateTime::currentDateTime().date() )
2322 addString = i18n("Today"); 2318 addString = i18n("Today");
2323 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2319 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2324 addString = i18n("Tomorrow"); 2320 addString = i18n("Tomorrow");
2325 if ( !addString.isEmpty() ) 2321 if ( !addString.isEmpty() )
2326 selDates = addString+", "+selDates ; 2322 selDates = addString+", "+selDates ;
2327 } 2323 }
2328 setCaption( i18n("Dates: ") + selDates ); 2324 setCaption( i18n("Dates: ") + selDates );
2329 2325
2330} 2326}
2331void MainWindow::showConfigureAgenda( ) 2327void MainWindow::showConfigureAgenda( )
2332{ 2328{
2333 int iii; 2329 int iii;
2334 for ( iii = 1;iii<= 10 ;++iii ){ 2330 for ( iii = 1;iii<= 10 ;++iii ){
2335 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2331 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2336 } 2332 }
2337 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2333 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2338} 2334}
2339void MainWindow::configureAgenda( int item ) 2335void MainWindow::configureAgenda( int item )
2340{ 2336{
2341 if ( KOPrefs::instance()->mHourSize == item ) 2337 if ( KOPrefs::instance()->mHourSize == item )
2342 return; 2338 return;
2343 KOPrefs::instance()->mHourSize=item; 2339 KOPrefs::instance()->mHourSize=item;
2344 mView->viewManager()->agendaView()->updateConfig(); 2340 mView->viewManager()->agendaView()->updateConfig();
2345} 2341}
2346 2342
2347void MainWindow::saveCalendar() 2343void MainWindow::saveCalendar()
2348{ 2344{
2349 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2345 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2350 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2346 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2351 bupDir = KGlobalSettings::backupDataDir(); 2347 bupDir = KGlobalSettings::backupDataDir();
2352 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2348 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2353 QString bupHint; 2349 QString bupHint;
2354 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2350 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2355 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2351 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2356 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2352 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2357 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2353 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2358 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2354 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2359 save(); 2355 save();
2360 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2356 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2361 backupAllFiles(); 2357 backupAllFiles();
2362} 2358}
2363void MainWindow::loadCalendar() 2359void MainWindow::loadCalendar()
2364{ 2360{
2365 2361
2366 2362
2367#if 0 2363#if 0
2368 QString fn = KOPrefs::instance()->mLastLoadFile; 2364 QString fn = KOPrefs::instance()->mLastLoadFile;
2369 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2365 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2370 2366
2371 if ( fn == "" ) 2367 if ( fn == "" )
2372 return; 2368 return;
2373 QFileInfo info; 2369 QFileInfo info;
2374 info.setFile( fn ); 2370 info.setFile( fn );
2375 QString mess; 2371 QString mess;
2376 bool loadbup = true; 2372 bool loadbup = true;
2377 if ( info. exists() ) { 2373 if ( info. exists() ) {
2378 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2374 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2379 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2375 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2380 mess, 2376 mess,
2381 i18n("Load!"), i18n("Cancel"), 0, 2377 i18n("Load!"), i18n("Cancel"), 0,
2382 0, 1 ); 2378 0, 1 );
2383 if ( result != 0 ) { 2379 if ( result != 0 ) {
2384 loadbup = false; 2380 loadbup = false;
2385 } 2381 }
2386 } else { 2382 } else {
2387 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2383 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2388 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2384 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2389 0, 1 ); 2385 0, 1 );
2390 2386
2391 return; 2387 return;
2392 } 2388 }
2393 if ( loadbup ) { 2389 if ( loadbup ) {
2394 mView->openCalendar( fn ); 2390 mView->openCalendar( fn );
2395 KOPrefs::instance()->mLastLoadFile = fn; 2391 KOPrefs::instance()->mLastLoadFile = fn;
2396 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2392 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2397 setCaption(mess); 2393 setCaption(mess);
2398 } 2394 }
2399#endif 2395#endif
2400 2396
2401} 2397}
2402void MainWindow::quickImportIcal() 2398void MainWindow::quickImportIcal()
2403{ 2399{
2404 importFile( KOPrefs::instance()->mLastImportFile, false ); 2400 importFile( KOPrefs::instance()->mLastImportFile, false );
2405} 2401}
2406void MainWindow::importFile( QString fn, bool quick ) 2402void MainWindow::importFile( QString fn, bool quick )
2407{ 2403{
2408 QFileInfo info; 2404 QFileInfo info;
2409 info.setFile( fn ); 2405 info.setFile( fn );
2410 QString mess; 2406 QString mess;
2411 bool loadbup = true;
2412 if ( !info. exists() ) { 2407 if ( !info. exists() ) {
2413 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2408 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2409 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2415 mess ); 2410 mess );
2416 return; 2411 return;
2417 } 2412 }
2418 int result = 0; 2413 int result = 0;
2419 if ( !quick ) { 2414 if ( !quick ) {
2420 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2415 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2421 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2416 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2422 mess, 2417 mess,
2423 "Import", "Cancel", 0, 2418 "Import", "Cancel", 0,
2424 0, 1 ); 2419 0, 1 );
2425 } 2420 }
2426 if ( result == 0 ) { 2421 if ( result == 0 ) {
2427 if ( mView->openCalendar( fn, true )) { 2422 if ( mView->openCalendar( fn, true )) {
2428 KOPrefs::instance()->mLastImportFile = fn; 2423 KOPrefs::instance()->mLastImportFile = fn;
2429 setCaption(i18n("Imported file successfully")); 2424 setCaption(i18n("Imported file successfully"));
2430 } else { 2425 } else {
2431 setCaption(i18n("Error importing file")); 2426 setCaption(i18n("Error importing file"));
2432 } 2427 }
2433 } 2428 }
2434} 2429}
2435 2430
2436void MainWindow::importIcal() 2431void MainWindow::importIcal()
2437{ 2432{
2438 2433
2439 QString fn =KOPrefs::instance()->mLastImportFile; 2434 QString fn =KOPrefs::instance()->mLastImportFile;
2440 2435
2441 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2436 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2442 if ( fn == "" ) 2437 if ( fn == "" )
2443 return; 2438 return;
2444 importFile( fn, true ); 2439 importFile( fn, true );
2445 2440
2446} 2441}
2447 2442
2448void MainWindow::exportVCalendar() 2443void MainWindow::exportVCalendar()
2449{ 2444{
2450 QString fn = KOPrefs::instance()->mLastVcalFile; 2445 QString fn = KOPrefs::instance()->mLastVcalFile;
2451 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2446 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2452 if ( fn == "" ) 2447 if ( fn == "" )
2453 return; 2448 return;
2454 QFileInfo info; 2449 QFileInfo info;
2455 info.setFile( fn ); 2450 info.setFile( fn );
2456 QString mes; 2451 QString mes;
2457 bool createbup = true; 2452 bool createbup = true;
2458 if ( info. exists() ) { 2453 if ( info. exists() ) {
2459 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2454 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2460 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2455 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2461 i18n("Overwrite!"), i18n("Cancel"), 0, 2456 i18n("Overwrite!"), i18n("Cancel"), 0,
2462 0, 1 ); 2457 0, 1 );
2463 if ( result != 0 ) { 2458 if ( result != 0 ) {
2464 createbup = false; 2459 createbup = false;
2465 } 2460 }
2466 } 2461 }
2467 if ( createbup ) { 2462 if ( createbup ) {
2468 if ( mView->exportVCalendar( fn ) ) { 2463 if ( mView->exportVCalendar( fn ) ) {
2469 KOPrefs::instance()->mLastVcalFile = fn; 2464 KOPrefs::instance()->mLastVcalFile = fn;
2470 if ( fn.length() > 20 ) 2465 if ( fn.length() > 20 )
2471 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2466 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2472 else 2467 else
2473 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2468 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2474 setCaption(mes); 2469 setCaption(mes);
2475 } 2470 }
2476 } 2471 }
2477 2472
2478} 2473}
2479QString MainWindow::sentSyncFile() 2474QString MainWindow::sentSyncFile()
2480{ 2475{
2481#ifdef DESKTOP_VERSION 2476#ifdef DESKTOP_VERSION
2482 return locateLocal( "tmp", "copysynccal.ics" ); 2477 return locateLocal( "tmp", "copysynccal.ics" );
2483#else 2478#else
2484 return QString( "/tmp/copysynccal.ics" ); 2479 return QString( "/tmp/copysynccal.ics" );
2485#endif 2480#endif
2486} 2481}
2487 2482
2488void MainWindow::syncFileRequest() 2483void MainWindow::syncFileRequest()
2489{ 2484{
2490 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2485 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2491 mSyncManager->slotSyncMenu( 999 ); 2486 mSyncManager->slotSyncMenu( 999 );
2492 } 2487 }
2493 2488
2494 setCaption(i18n("Saving Data to temp file ..." )); 2489 setCaption(i18n("Saving Data to temp file ..." ));
2495 mView->saveCalendar( sentSyncFile() ); 2490 mView->saveCalendar( sentSyncFile() );
2496 setCaption(i18n("Data saved to temp file!" )); 2491 setCaption(i18n("Data saved to temp file!" ));
2497 2492
2498} 2493}
2499void MainWindow::getFile( bool success ) 2494void MainWindow::getFile( bool success )
2500{ 2495{
2501 if ( ! success ) { 2496 if ( ! success ) {
2502 setCaption( i18n("Error receiving file. Nothing changed!") ); 2497 setCaption( i18n("Error receiving file. Nothing changed!") );
2503 return; 2498 return;
2504 } 2499 }
2505 mView->openCalendar( sentSyncFile() ); 2500 mView->openCalendar( sentSyncFile() );
2506 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2501 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2507 mSyncManager->slotSyncMenu( 999 ); 2502 mSyncManager->slotSyncMenu( 999 );
2508 } 2503 }
2509 setCaption( i18n("Pi-Sync successful!") ); 2504 setCaption( i18n("Pi-Sync successful!") );
2510} 2505}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 953774f..a948a52 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,135 +1,135 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0 );
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setUsesBigPixmaps ( bool ); 46 void setUsesBigPixmaps ( bool );
47 void setCaption ( const QString & ); 47 void setCaption ( const QString & );
48 void updateWeekNum(const KCal::DateList &); 48 void updateWeekNum(const KCal::DateList &);
49 void updateWeek(QDate); 49 void updateWeek(QDate);
50 void updateFilterToolbar(); 50 void updateFilterToolbar();
51 virtual void showMaximized (); 51 virtual void showMaximized ();
52 void configureAgenda( int ); 52 void configureAgenda( int );
53 void recieve( const QCString& msg, const QByteArray& data ); 53 void recieve( const QCString& msg, const QByteArray& data );
54 protected slots: 54 protected slots:
55 void startMultiSync(); 55 void startMultiSync();
56 void setCaptionToDates(); 56 void setCaptionToDates();
57 void weekAction(); 57 void weekAction();
58 void about(); 58 void about();
59 void licence(); 59 void licence();
60 void faq(); 60 void faq();
61 void usertrans(); 61 void usertrans();
62 void features(); 62 void features();
63 void synchowto(); 63 void synchowto();
64 void storagehowto(); 64 void storagehowto();
65 void timetrackinghowto(); 65 void timetrackinghowto();
66 void kdesynchowto(); 66 void kdesynchowto();
67 void multisynchowto(); 67 void multisynchowto();
68 void whatsNew(); 68 void whatsNew();
69 void keyBindings(); 69 void keyBindings();
70 void aboutAutoSaving();; 70 void aboutAutoSaving();;
71 void aboutKnownBugs(); 71 void aboutKnownBugs();
72 72
73 void processIncidenceSelection( Incidence * ); 73 void processIncidenceSelection( Incidence * );
74 74
75 void importQtopia(); 75 void importQtopia();
76 void importBday(); 76 void importBday();
77 void importOL(); 77 void importOL();
78 void importIcal(); 78 void importIcal();
79 void importFile( QString, bool ); 79 void importFile( QString, bool );
80 void quickImportIcal(); 80 void quickImportIcal();
81 81
82 void slotModifiedChanged( bool ); 82 void slotModifiedChanged( bool );
83 83
84 void save(); 84 void save();
85 void backupAllFiles(); 85 void backupAllFiles();
86 void saveStopTimer(); 86 void saveStopTimer();
87 void configureToolBar( int ); 87 void configureToolBar( int );
88 void printSel(); 88 void printSel();
89 void printCal(); 89 void printCal();
90 void printListView(); 90 void printListView();
91 void saveCalendar(); 91 void saveCalendar();
92 void loadCalendar(); 92 void loadCalendar();
93 void exportVCalendar(); 93 void exportVCalendar();
94 void fillFilterMenu(); 94 void fillFilterMenu();
95 void fillFilterMenuTB(); 95 void fillFilterMenuTB();
96 void selectFilter( int ); 96 void selectFilter( int );
97 void fillFilterMenuPopup(); 97 void fillFilterMenuPopup();
98 void selectFilterPopup( int ); 98 void selectFilterPopup( int );
99 void exportToPhone( int ); 99 void exportToPhone( int );
100 void toggleBeamReceive(); 100 void toggleBeamReceive();
101 void disableBR(bool); 101 void disableBR(bool);
102 signals: 102 signals:
103 void selectWeek ( int ); 103 void selectWeek ( int );
104 private slots: 104 private slots:
105 void showConfigureAgenda(); 105 void showConfigureAgenda();
106 void getFile( bool ); 106 void getFile( bool );
107 void syncFileRequest(); 107 void syncFileRequest();
108 108
109 protected: 109 protected:
110 void hideEvent ( QHideEvent * ); 110 void hideEvent ( QHideEvent * );
111 QString sentSyncFile(); 111 QString sentSyncFile();
112 void displayText( QString, QString); 112 void displayText( QString, QString);
113 void enableIncidenceActions( bool ); 113 void enableIncidenceActions( bool );
114 114
115 private: 115 private:
116 bool mBRdisabled; 116 bool mBRdisabled;
117#ifndef DESKTOP_VERSION 117#ifndef DESKTOP_VERSION
118 QCopChannel* infrared; 118 QCopChannel* infrared;
119#endif 119#endif
120 QAction* brAction; 120 QAction* brAction;
121 KSyncManager* mSyncManager; 121 KSyncManager* mSyncManager;
122 bool mClosed; 122 bool mClosed;
123 void saveOnClose(); 123 void saveOnClose();
124 bool mFlagKeyPressed; 124 bool mFlagKeyPressed;
125 bool mBlockAtStartup; 125 bool mBlockAtStartup;
126 QPEToolBar *iconToolBar; 126 QPEToolBar *iconToolBar;
127 QPEToolBar *viewToolBar; 127 QPEToolBar *viewToolBar;
128 QPEToolBar *navigatorToolBar; 128 QPEToolBar *navigatorToolBar;
129 QPEToolBar *filterToolBar; 129 QPEToolBar *filterToolBar;
130 QMenuBar *filterMenubar; 130 QMenuBar *filterMenubar;
131 QPopupMenu * filterPopupMenu; 131 QPopupMenu * filterPopupMenu;
132 QPopupMenu * mCurrentItemMenu; 132 QPopupMenu * mCurrentItemMenu;
133 void initActions(); 133 void initActions();
134 void setDefaultPreferences(); 134 void setDefaultPreferences();
135 void resizeEvent( QResizeEvent* e); 135 void resizeEvent( QResizeEvent* e);