summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-01 17:57:30 (UTC)
committer zautrix <zautrix>2005-07-01 17:57:30 (UTC)
commit98d29d15275c4b8e9a3348742925f6e6d03f7a07 (patch) (unidiff)
treeea0af6d2100287c696bb00e1197d6c99f29f41e8
parentf330b9d0a7f755660ddd59739e3ab9b98d60bc18 (diff)
downloadkdepimpi-98d29d15275c4b8e9a3348742925f6e6d03f7a07.zip
kdepimpi-98d29d15275c4b8e9a3348742925f6e6d03f7a07.tar.gz
kdepimpi-98d29d15275c4b8e9a3348742925f6e6d03f7a07.tar.bz2
fixx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--kalarmd/alarmdialog.cpp5
-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
8 files changed, 43 insertions, 41 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 44e6bdf..593806b 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1445,37 +1445,37 @@
1445{ "female","weiblich" }, 1445{ "female","weiblich" },
1446{ "Hide!","Verbergen!" }, 1446{ "Hide!","Verbergen!" },
1447{ "Show!","Anzeigen!" }, 1447{ "Show!","Anzeigen!" },
1448{ "Details","Details" }, 1448{ "Details","Details" },
1449{ "Profession","Beruf" }, 1449{ "Profession","Beruf" },
1450{ "Children","Kinder" }, 1450{ "Children","Kinder" },
1451{ "Department","Abteilung" }, 1451{ "Department","Abteilung" },
1452{ "Backup cancelled","Backup abgebrochen" }, 1452{ "Backup cancelled","Backup abgebrochen" },
1453{ "Backup globally disabled","Backup global abgeschaltet" }, 1453{ "Backup globally disabled","Backup global abgeschaltet" },
1454{ "Backup succesfully finished","Backup erfolgreich beendet" }, 1454{ "Backup succesfully finished","Backup erfolgreich beendet" },
1455{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, 1455{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" },
1456{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, 1456{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" },
1457{ "Birthdays","Geburtstage" }, 1457{ "Birthdays","Geburtstage" },
1458{ "KO/Pi import information!","KO/Pi Import Information!" }, 1458{ "KO/Pi import information!","KO/Pi Import Information!" },
1459{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, 1459{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" },
1460{ "Cancel - do not start"," Abbrechen - Todo nicht starten" }, 1460{ "Cancel - do not start"," Abbrechen - Todo nicht starten" },
1461{ "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!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, 1461{ "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!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" },
1462{ "Reload","Neu laden" }, 1462{ "Reload","Neu laden" },
1463{ "Timezone settings","Zeitzoneneinstellung" }, 1463{ "Timezone settings","Zeitzoneneinstellung" },
1464{ "Title: ","Titel: " }, 1464{ "Title: ","Titel: " },
1465{ "Journal from: ","Journal vom: " }, 1465{ "Journal from: ","Journal vom: " },
1466{ "Journal: %1 from ","Journal: %1 vom " }, 1466{ "Journal: %1 from ","Journal: %1 vom " },
1467{ "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, 1467{ "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" },
1468{ "Selected Item","Ausgewähltes Item" }, 1468{ "Selected Item","Ausgewähltes Item" },
1469{ "Select Date...","Wähle Datum..." }, 1469{ "Select Date...","Wähle Datum..." },
1470{ "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, 1470{ "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" },
1471{ "Change category list now!","Ändere Kategorieliste jetzt!" }, 1471{ "Change category list now!","Ändere Kategorieliste jetzt!" },
1472{ "Edit category list...","Ändere Kategorieliste..." }, 1472{ "Edit category list...","Ändere Kategorieliste..." },
1473{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, 1473{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" },
1474{ "Filepath: ","Dateipfad: " }, 1474{ "Filepath: ","Dateipfad: " },
1475{ "The loading of one or more calendar failed:","Das Laden eines oder mehrerer Kalender schlug fehl:" }, 1475{ "The loading of one or more calendar failed:","Das Laden eines oder mehrerer Kalender schlug fehl:" },
1476{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, 1476{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" },
1477{ "","" }, 1477{ "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" },
1478{ "","" }, 1478{ "Pending Suspend Alarm","Laufender Suspend Alarm" },
1479{ "","" }, 1479{ "","" },
1480{ "","" }, 1480{ "","" },
1481{ "","" }, \ No newline at end of file 1481{ "","" }, \ No newline at end of file
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 17d4afa..ddb125a 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -69,64 +69,69 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
69 mMessage = new QLabel ( " ", this ); 69 mMessage = new QLabel ( " ", this );
70 int fs = 18; 70 int fs = 18;
71 int fs2 = 12; 71 int fs2 = 12;
72 int baseSize = 6; 72 int baseSize = 6;
73 if ( QApplication::desktop()->width() < 480 ) { 73 if ( QApplication::desktop()->width() < 480 ) {
74 fs2 = 10; 74 fs2 = 10;
75 fs = 12; 75 fs = 12;
76 baseSize = 4; 76 baseSize = 4;
77 } 77 }
78 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
79 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
80 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
81 fo.setBold( true ); 81 fo.setBold( true );
82 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
83 l->setFont( fo ); 83 l->setFont( fo );
84 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
85 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
86 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
87 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
89 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
90 90
91 playSoundTimer = new QTimer( this ); 91 playSoundTimer = new QTimer( this );
92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
93 93
94 playSoundTimer->stop(); 94 playSoundTimer->stop();
95 95
96 layout->addWidget ( mMissedAlarms ); 96 layout->addWidget ( mMissedAlarms );
97 mMissedAlarmsCombo = new QComboBox ( this ); 97 mMissedAlarmsCombo = new QComboBox ( this );
98 layout->addWidget ( mMissedAlarmsCombo ); 98 layout->addWidget ( mMissedAlarmsCombo );
99 99
100 QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this); 100 QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this);
101#ifdef DESKTOP_VERSION
102 fo = font();
103 fo.setPointSize( 12 );
104 labb->setFont ( fo );
105#endif
101 labb->setAlignment(AlignCenter); 106 labb->setAlignment(AlignCenter);
102 //layout->addWidget ( labb ); 107 //layout->addWidget ( labb );
103 fo = font(); 108 fo = font();
104 int pointSize = 36; 109 int pointSize = 36;
105 if ( QApplication::desktop()->width() <= 320 ) 110 if ( QApplication::desktop()->width() <= 320 )
106 pointSize = 18; 111 pointSize = 18;
107 fo.setPointSize( pointSize ); 112 fo.setPointSize( pointSize );
108 mSuspendSpin = new QSpinBox(1,1440,1,this); 113 mSuspendSpin = new QSpinBox(1,1440,1,this);
109 mSuspendSpin->setFont( fo ); 114 mSuspendSpin->setFont( fo );
110 mSuspendSpin->setValue(7); // default suspend duration 115 mSuspendSpin->setValue(7); // default suspend duration
111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 116 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 117 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
113 118
114#if QT_VERSION < 0x030000 119#if QT_VERSION < 0x030000
115 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 120 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
116 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 121 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
117#endif 122#endif
118 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); 123 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
119 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 124 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
120 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 125 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
121 layoutSpin->addStretch (); 126 layoutSpin->addStretch ();
122 layoutSpin->addWidget ( labb ); 127 layoutSpin->addWidget ( labb );
123 layoutSpin->addWidget ( mSuspendSpin ); 128 layoutSpin->addWidget ( mSuspendSpin );
124 layoutSpin->addStretch (); 129 layoutSpin->addStretch ();
125 130
126 QVBox * bbox = new QVBox ( this ); 131 QVBox * bbox = new QVBox ( this );
127 layout->addWidget ( bbox ); 132 layout->addWidget ( bbox );
128 bbox->layout()->setSpacing( 2 ); 133 bbox->layout()->setSpacing( 2 );
129 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); 134 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
130 labb->setAlignment(AlignCenter); 135 labb->setAlignment(AlignCenter);
131 mSuspendButton = new QPushButton( "Suspend", bbox); 136 mSuspendButton = new QPushButton( "Suspend", bbox);
132 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 137 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index fd026fa..70a1d2d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -754,65 +754,65 @@ void CalendarView::checkAlarms()
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);
@@ -897,70 +897,74 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
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();
@@ -1181,65 +1185,64 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
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 );
@@ -2281,69 +2284,74 @@ void CalendarView::readSettings()
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() );
@@ -2765,86 +2773,85 @@ void CalendarView::slotSelectPickerDate( QDate d)
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 );
@@ -2916,73 +2923,75 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
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();
@@ -4278,69 +4287,64 @@ void CalendarView::toggleExpand()
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 ) {
@@ -4403,106 +4407,107 @@ void CalendarView::lookForIncomingMessages()
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?"),
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 3323a98..c9e9870 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -108,64 +108,65 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
108 public: 108 public:
109 /** 109 /**
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm();
140 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*/
@@ -426,65 +427,64 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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();
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index 5455098..ea30fac 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -269,88 +269,84 @@ void KODialogManager::showPluginDialog()
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
@@ -410,65 +410,66 @@ void KOListView::setCalendar( int c )
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() ) {
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b6ce7d5..b797d8c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -105,82 +105,79 @@ class KOex2phonePrefs : public QDialog
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;
@@ -315,65 +312,64 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 ) ) );
@@ -1826,113 +1822,113 @@ void MainWindow::saveOnClose()
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
@@ -2379,68 +2375,67 @@ void MainWindow::loadCalendar()
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}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 953774f..a948a52 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -7,65 +7,65 @@
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();