summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp4
-rw-r--r--korganizer/calendarview.cpp6
3 files changed, 8 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index ec6a4ec..a11fab3 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,100 +1,102 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.1.6 ************ 3********** VERSION 2.1.6 ************
4 4
5KO/Pi: 5KO/Pi:
6Added to the list view (the list view is used in search dialog as well) the possibility to print it. 6Added to the list view (the list view is used in search dialog as well) the possibility to print it.
7Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. 7Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
8Added to the list view the possibility to add all subtodos of selected todos to an export/beam. 8Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
9Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. 9Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
10Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
11Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
10 12
11********** VERSION 2.1.5 ************ 13********** VERSION 2.1.5 ************
12 14
13This is the new stable version. 15This is the new stable version.
14Bugfix: 16Bugfix:
15Fixed a problem with agenda popup on the desktop in KO/Pi. 17Fixed a problem with agenda popup on the desktop in KO/Pi.
16Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. 18Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization.
17Added config option to not display completed todos in agenda view. 19Added config option to not display completed todos in agenda view.
18Addressee view is now using the formatted name, if defined. 20Addressee view is now using the formatted name, if defined.
19That makes it possible to display "lastname, firstname" in that view now. 21That makes it possible to display "lastname, firstname" in that view now.
20To set the formatted name for all contacts, please use menu: 22To set the formatted name for all contacts, please use menu:
21Edit->Change->Set formatted name. 23Edit->Change->Set formatted name.
22Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. 24Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows.
23 25
24********** VERSION 2.1.4 ************ 26********** VERSION 2.1.4 ************
25 27
26Fixed two more bugs in the KA/Pi CSV import dialog: 28Fixed two more bugs in the KA/Pi CSV import dialog:
27Made it possible to read multi-line fields and import it to the "Note" field. 29Made it possible to read multi-line fields and import it to the "Note" field.
28Fixed a problem in mapping custom fields, whatever a custem field is... 30Fixed a problem in mapping custom fields, whatever a custem field is...
29 31
30********** VERSION 2.1.3 ************ 32********** VERSION 2.1.3 ************
31 33
32Changed the menu structure of the alarm applet: 34Changed the menu structure of the alarm applet:
33Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". 35Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
34 36
35Fixed several problems in the KA/Pi CSV import dialog: 37Fixed several problems in the KA/Pi CSV import dialog:
36Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. 38Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
37 39
38 40
39********** VERSION 2.1.2 ************ 41********** VERSION 2.1.2 ************
40 42
41Fixed a problem closing the alarm dialog on Zaurus with "OK" button. 43Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
42 44
43Fixed a problem when importing data from Outlook with mutiple categories set. 45Fixed a problem when importing data from Outlook with mutiple categories set.
44 46
45Changed display of days in datenavigator: 47Changed display of days in datenavigator:
46Birthdays are now blue, not dark green. 48Birthdays are now blue, not dark green.
47When todo view is shown, no birtdays are shown and days with due todos are shown blue. 49When todo view is shown, no birtdays are shown and days with due todos are shown blue.
48When journal view is shown, only holidays are shown and days with journals are blue. 50When journal view is shown, only holidays are shown and days with journals are blue.
49 51
50Added Backup options to global config: 52Added Backup options to global config:
51You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). 53You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ).
52It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. 54It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again.
53The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. 55The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups.
54 56
55********** VERSION 2.1.1 ************ 57********** VERSION 2.1.1 ************
56 58
57Stable release 2.1.1! 59Stable release 2.1.1!
58 60
59KO/Pi: 61KO/Pi:
60Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. 62Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display.
61 63
62********** VERSION 2.1.0 ************ 64********** VERSION 2.1.0 ************
63 65
64Stable release 2.1.0! 66Stable release 2.1.0!
65 67
66Summary of changes/fixes compared to version 2.0.6: 68Summary of changes/fixes compared to version 2.0.6:
67 69
68Many bugs of version 2.0.6 fixed. 70Many bugs of version 2.0.6 fixed.
69Most of them were small bugs, but some of them were important. 71Most of them were small bugs, but some of them were important.
70It is recommended to use version 2.1.0 and not version 2.0.6. 72It is recommended to use version 2.1.0 and not version 2.0.6.
71 73
72Important changes: 74Important changes:
73 75
74Added recurring todos to KO/Pi. 76Added recurring todos to KO/Pi.
75 77
76Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. 78Added global application font settings (for all KDE-Pim/Pi apps) to the general settings.
77 79
78Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 80Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
79 81
80Datenavigator can now display many months. Very useful on the desktop. 82Datenavigator can now display many months. Very useful on the desktop.
81 83
82KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. 84KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements.
83 85
84Made alarm sound working on Linux desktop. 86Made alarm sound working on Linux desktop.
85 87
86Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. 88Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details.
87 89
88Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. 90Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details.
89 91
90Many other usebility enhancements. 92Many other usebility enhancements.
91Special thanks to Ben for his suggestions! 93Special thanks to Ben for his suggestions!
92 94
93You can find the complete changelog 95You can find the complete changelog
94from version 1.7.7 to 2.1.0 96from version 1.7.7 to 2.1.0
95in the source package or on 97in the source package or on
96 98
97http://www.pi-sync.net/html/changelog.html 99http://www.pi-sync.net/html/changelog.html
98 100
99 101
100 102
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 37e7d0d..d6e06c8 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -81,616 +81,616 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
81 mSoundPopUp->insertItem( "Wav file", 1 ); 81 mSoundPopUp->insertItem( "Wav file", 1 );
82 mPausePopUp->insertItem( " 1 sec", 1 ); 82 mPausePopUp->insertItem( " 1 sec", 1 );
83 mPausePopUp->insertItem( " 2 sec", 2 ); 83 mPausePopUp->insertItem( " 2 sec", 2 );
84 mPausePopUp->insertItem( " 3 sec", 3 ); 84 mPausePopUp->insertItem( " 3 sec", 3 );
85 mPausePopUp->insertItem( " 5 sec", 5 ); 85 mPausePopUp->insertItem( " 5 sec", 5 );
86 mPausePopUp->insertItem( "10 sec", 10 ); 86 mPausePopUp->insertItem( "10 sec", 10 );
87 mPausePopUp->insertItem( "30 sec", 30 ); 87 mPausePopUp->insertItem( "30 sec", 30 );
88 mPausePopUp->insertItem( " 1 min", 60 ); 88 mPausePopUp->insertItem( " 1 min", 60 );
89 mPausePopUp->insertItem( " 5 min", 300 ); 89 mPausePopUp->insertItem( " 5 min", 300 );
90 mPausePopUp->insertItem( "10 min", 600 ); 90 mPausePopUp->insertItem( "10 min", 600 );
91 mSuspendPopUp = new QPopupMenu( this ); 91 mSuspendPopUp = new QPopupMenu( this );
92 mSuspendPopUp->insertItem( "Off", 0 ); 92 mSuspendPopUp->insertItem( "Off", 0 );
93 mSuspendPopUp->insertItem( " 1x", 1 ); 93 mSuspendPopUp->insertItem( " 1x", 1 );
94 mSuspendPopUp->insertItem( " 2x", 2 ); 94 mSuspendPopUp->insertItem( " 2x", 2 );
95 mSuspendPopUp->insertItem( " 3x", 3 ); 95 mSuspendPopUp->insertItem( " 3x", 3 );
96 mSuspendPopUp->insertItem( " 5x", 5 ); 96 mSuspendPopUp->insertItem( " 5x", 5 );
97 mSuspendPopUp->insertItem( "10x", 10 ); 97 mSuspendPopUp->insertItem( "10x", 10 );
98 mSuspendPopUp->insertItem( "20x", 20 ); 98 mSuspendPopUp->insertItem( "20x", 20 );
99 mSuspendPopUp->insertItem( "30x", 30 ); 99 mSuspendPopUp->insertItem( "30x", 30 );
100 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 100 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
101 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 101 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
102 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 102 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
103 mBeepPopUp->insertItem( "Config",savePopUp ); 103 mBeepPopUp->insertItem( "Config",savePopUp );
104 mBeepPopUp->insertItem( "300", 300 ); 104 mBeepPopUp->insertItem( "300", 300 );
105 mBeepPopUp->insertItem( "180", 180 ); 105 mBeepPopUp->insertItem( "180", 180 );
106 mBeepPopUp->insertItem( "60", 60 ); 106 mBeepPopUp->insertItem( "60", 60 );
107 mBeepPopUp->insertItem( "30", 30 ); 107 mBeepPopUp->insertItem( "30", 30 );
108 mBeepPopUp->insertItem( "10", 10 ); 108 mBeepPopUp->insertItem( "10", 10 );
109 mBeepPopUp->insertItem( "3", 3 ); 109 mBeepPopUp->insertItem( "3", 3 );
110 mBeepPopUp->insertItem( "1", 1 ); 110 mBeepPopUp->insertItem( "1", 1 );
111 mBeepPopUp->insertItem( "Off", 0 ); 111 mBeepPopUp->insertItem( "Off", 0 );
112 mBeepPopUp->insertSeparator(); 112 mBeepPopUp->insertSeparator();
113 mBeepPopUp->insertItem( "Simulate", 1000 ); 113 mBeepPopUp->insertItem( "Simulate", 1000 );
114 mBeepPopUp->setCheckable( true ); 114 mBeepPopUp->setCheckable( true );
115 mPopUp->insertSeparator(); 115 mPopUp->insertSeparator();
116 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 116 mPopUp->insertItem( "Play beeps", mBeepPopUp );
117 mPopUp->insertSeparator(); 117 mPopUp->insertSeparator();
118 mPopUp->insertItem( "Timer", mTimerPopUp ); 118 mPopUp->insertItem( "Timer", mTimerPopUp );
119 //mPopUp->insertSeparator(); 119 //mPopUp->insertSeparator();
120 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 120 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
121 121
122 mPopUp->resize( mPopUp->sizeHint() ); 122 mPopUp->resize( mPopUp->sizeHint() );
123 mPlayBeeps = 60; 123 mPlayBeeps = 60;
124 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 124 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
125 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 125 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
126 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 126 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
127 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 127 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
128 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 128 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
129 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 129 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
130 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 130 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
131 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 131 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
132 mTimerTime = 0; 132 mTimerTime = 0;
133 mCustomText = "Custom Text"; 133 mCustomText = "Custom Text";
134 mCustomMinutes = 7; 134 mCustomMinutes = 7;
135 mTimerPopupConf = 1; 135 mTimerPopupConf = 1;
136 fillTimerPopUp(); 136 fillTimerPopUp();
137 mPausePlay = 0; 137 mPausePlay = 0;
138 confPause( 1 ); 138 confPause( 1 );
139 mSuspend = 0; 139 mSuspend = 0;
140 confSuspend( 0 ); 140 confSuspend( 0 );
141 if ( QApplication::desktop()->width() < 480 ) { 141 if ( QApplication::desktop()->width() < 480 ) {
142 wavAlarm = false; 142 wavAlarm = false;
143 mSoundPopUp->setItemChecked ( 0, true ); 143 mSoundPopUp->setItemChecked ( 0, true );
144 } 144 }
145 else { 145 else {
146 wavAlarm = true; 146 wavAlarm = true;
147 mSoundPopUp->setItemChecked ( 1, true ); 147 mSoundPopUp->setItemChecked ( 1, true );
148 } 148 }
149 saveSlot( 1 ); 149 saveSlot( 1 );
150} 150}
151 151
152SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 152SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
153{ 153{
154 //delete mPopUp; 154 //delete mPopUp;
155 delete mAlarmDialog; 155 delete mAlarmDialog;
156} 156}
157void SimpleAlarmDaemonImpl::saveSlot( int load ) 157void SimpleAlarmDaemonImpl::saveSlot( int load )
158{ 158{
159 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 159 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
160 //qDebug("save %d ", load ); 160 //qDebug("save %d ", load );
161 QFile file( fileName ); 161 QFile file( fileName );
162 if ( load ) { 162 if ( load ) {
163 if( !QFile::exists( fileName) ) 163 if( !QFile::exists( fileName) )
164 return; 164 return;
165 if (!file.open( IO_ReadOnly ) ) { 165 if (!file.open( IO_ReadOnly ) ) {
166 return ; 166 return ;
167 } 167 }
168 QString line; 168 QString line;
169 bool ok; 169 bool ok;
170 int val; 170 int val;
171 int len; 171 int len;
172 while ( file.readLine( line, 1024 ) > 0 ) { 172 while ( file.readLine( line, 1024 ) > 0 ) {
173 //qDebug("read %s ", line.latin1()); 173 //qDebug("read %s ", line.latin1());
174 len = line.length(); 174 len = line.length();
175 if ( line.left(4 ) == "PPAU" ) { 175 if ( line.left(4 ) == "PPAU" ) {
176 val = line.mid( 4,len-5).toInt( &ok ); 176 val = line.mid( 4,len-5).toInt( &ok );
177 if ( ok ) { 177 if ( ok ) {
178 confPause( val ); 178 confPause( val );
179 } 179 }
180 } 180 }
181 if ( line.left(4 ) == "SUCO" ) { 181 if ( line.left(4 ) == "SUCO" ) {
182 val = line.mid( 4,len-5).toInt( &ok ); 182 val = line.mid( 4,len-5).toInt( &ok );
183 if ( ok ) 183 if ( ok )
184 confSuspend ( val ); 184 confSuspend ( val );
185 } 185 }
186 if ( line.left(4 ) == "WAAL" ) { 186 if ( line.left(4 ) == "WAAL" ) {
187 val = line.mid( 4,len-5).toInt( &ok ); 187 val = line.mid( 4,len-5).toInt( &ok );
188 if ( ok ) 188 if ( ok )
189 confSound( val ); 189 confSound( val );
190 190
191 } 191 }
192 if ( line.left(4 ) == "PLBE" ) { 192 if ( line.left(4 ) == "PLBE" ) {
193 val = line.mid( 4,len-5).toInt( &ok ); 193 val = line.mid( 4,len-5).toInt( &ok );
194 if ( ok ) 194 if ( ok )
195 slotPlayBeep( val ); 195 slotPlayBeep( val );
196 196
197 } 197 }
198 if ( line.left(4 ) == "CUTE" ) { 198 if ( line.left(4 ) == "CUTE" ) {
199 mCustomText = line.mid( 5,len-6); 199 mCustomText = line.mid( 5,len-6);
200 // qDebug("text ***%s*** ",mCustomText.latin1() ); 200 // qDebug("text ***%s*** ",mCustomText.latin1() );
201 201
202 } 202 }
203 if ( line.left(4 ) == "CUMI" ) { 203 if ( line.left(4 ) == "CUMI" ) {
204 val = line.mid( 4,len-5).toInt( &ok ); 204 val = line.mid( 4,len-5).toInt( &ok );
205 if ( ok ) 205 if ( ok )
206 mCustomMinutes = val; 206 mCustomMinutes = val;
207 207
208 } 208 }
209 if ( line.left(4 ) == "SUTI" ) { 209 if ( line.left(4 ) == "SUTI" ) {
210 val = line.mid( 4,len-5).toInt( &ok ); 210 val = line.mid( 4,len-5).toInt( &ok );
211 if ( ok ) 211 if ( ok )
212 mAlarmDialog->setSuspendTime( val );; 212 mAlarmDialog->setSuspendTime( val );;
213 213
214 } 214 }
215 } 215 }
216 file.close(); 216 file.close();
217 } else { 217 } else {
218 if (!file.open( IO_WriteOnly ) ) { 218 if (!file.open( IO_WriteOnly ) ) {
219 return; 219 return;
220 } 220 }
221 QString configString ; 221 QString configString ;
222 configString += "PPAU " + QString::number( mPausePlay ) + "\n"; 222 configString += "PPAU " + QString::number( mPausePlay ) + "\n";
223 configString += "SUCO " + QString::number( mSuspend ) + "\n"; 223 configString += "SUCO " + QString::number( mSuspend ) + "\n";
224 configString += "WAAL " + QString::number( wavAlarm ) + "\n"; 224 configString += "WAAL " + QString::number( wavAlarm ) + "\n";
225 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; 225 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n";
226 configString += "CUTE " + mCustomText + "\n"; 226 configString += "CUTE " + mCustomText + "\n";
227 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; 227 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n";
228 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; 228 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n";
229 QTextStream ts( &file ); 229 QTextStream ts( &file );
230 ts << configString ; 230 ts << configString ;
231 file.close(); 231 file.close();
232 } 232 }
233 233
234} 234}
235void SimpleAlarmDaemonImpl::confSuspend( int num ) 235void SimpleAlarmDaemonImpl::confSuspend( int num )
236{ 236{
237 mSuspendPopUp->setItemChecked ( mSuspend,false ); 237 mSuspendPopUp->setItemChecked ( mSuspend,false );
238 mSuspend = num; 238 mSuspend = num;
239 mSuspendPopUp->setItemChecked ( mSuspend,true ); 239 mSuspendPopUp->setItemChecked ( mSuspend,true );
240} 240}
241void SimpleAlarmDaemonImpl::confPause( int num ) 241void SimpleAlarmDaemonImpl::confPause( int num )
242{ 242{
243 mPausePopUp->setItemChecked ( mPausePlay,false ); 243 mPausePopUp->setItemChecked ( mPausePlay,false );
244 mPausePlay = num; 244 mPausePlay = num;
245 mPausePopUp->setItemChecked ( mPausePlay,true ); 245 mPausePopUp->setItemChecked ( mPausePlay,true );
246} 246}
247void SimpleAlarmDaemonImpl::confSound( int num ) 247void SimpleAlarmDaemonImpl::confSound( int num )
248{ 248{
249 if ( num == 0 ) { 249 if ( num == 0 ) {
250 wavAlarm = false; 250 wavAlarm = false;
251 mSoundPopUp->setItemChecked ( 0, true ); 251 mSoundPopUp->setItemChecked ( 0, true );
252 mSoundPopUp->setItemChecked ( 1, false ); 252 mSoundPopUp->setItemChecked ( 1, false );
253 } else { 253 } else {
254 wavAlarm = true; 254 wavAlarm = true;
255 mSoundPopUp->setItemChecked ( 0, false ); 255 mSoundPopUp->setItemChecked ( 0, false );
256 mSoundPopUp->setItemChecked ( 1, true ); 256 mSoundPopUp->setItemChecked ( 1, true );
257 } 257 }
258} 258}
259void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) 259void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
260{ 260{
261 if ( num == 1000 ) { 261 if ( num == 1000 ) {
262 simulate(); 262 simulate();
263 return; 263 return;
264 } 264 }
265 mBeepPopUp->setItemChecked ( mPlayBeeps,false ); 265 mBeepPopUp->setItemChecked ( mPlayBeeps,false );
266 mPlayBeeps = num; 266 mPlayBeeps = num;
267 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 267 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
268} 268}
269 269
270void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) 270void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
271{ 271{
272 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); 272 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
273 QString mess = msg; 273 QString mess = QString::fromUtf8(msg.data());
274 mAlarmMessage = mess.mid( 9 ); 274 mAlarmMessage = mess.mid( 9 );
275 QString filename = getenv("QPEDIR") ; 275 QString filename = getenv("QPEDIR") ;
276 filename += "/pics/kdepim/korganizer/koalarm.wav"; 276 filename += "/pics/kdepim/korganizer/koalarm.wav";
277 QString tempfilename; 277 QString tempfilename;
278 if ( mess.left( 13 ) == "suspend_alarm") { 278 if ( mess.left( 13 ) == "suspend_alarm") {
279 bool error = false; 279 bool error = false;
280 int len = mess.mid( 13 ).find("+++"); 280 int len = mess.mid( 13 ).find("+++");
281 if ( len < 2 ) 281 if ( len < 2 )
282 error = true; 282 error = true;
283 else { 283 else {
284 tempfilename = mess.mid( 13, len ); 284 tempfilename = mess.mid( 13, len );
285 if ( !QFile::exists( tempfilename ) ) 285 if ( !QFile::exists( tempfilename ) )
286 error = true; 286 error = true;
287 } 287 }
288 if ( ! error ) { 288 if ( ! error ) {
289 filename = tempfilename; 289 filename = tempfilename;
290 } 290 }
291 mAlarmMessage = mess.mid( 13+len+3 ); 291 mAlarmMessage = mess.mid( 13+len+3 );
292 //qDebug("suspend file %s ",tempfilename.latin1() ); 292 //qDebug("suspend file %s ",tempfilename.latin1() );
293 startAlarm( mAlarmMessage, filename); 293 startAlarm( mAlarmMessage, filename);
294 return; 294 return;
295 } 295 }
296 if ( mess.left( 11 ) == "timer_alarm") { 296 if ( mess.left( 11 ) == "timer_alarm") {
297 mTimerTime = 0; 297 mTimerTime = 0;
298 startAlarm( mess.mid( 11 ), filename ); 298 startAlarm( mess.mid( 11 ), filename );
299 return; 299 return;
300 } 300 }
301 if ( mess.left( 10 ) == "proc_alarm") { 301 if ( mess.left( 10 ) == "proc_alarm") {
302 bool error = false; 302 bool error = false;
303 int len = mess.mid( 10 ).find("+++"); 303 int len = mess.mid( 10 ).find("+++");
304 if ( len < 2 ) 304 if ( len < 2 )
305 error = true; 305 error = true;
306 else { 306 else {
307 tempfilename = mess.mid( 10, len ); 307 tempfilename = mess.mid( 10, len );
308 if ( !QFile::exists( tempfilename ) ) 308 if ( !QFile::exists( tempfilename ) )
309 error = true; 309 error = true;
310 } 310 }
311 if ( error ) { 311 if ( error ) {
312 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 312 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
313 mAlarmMessage += mess.mid( 10+len+3+9 ); 313 mAlarmMessage += mess.mid( 10+len+3+9 );
314 } else { 314 } else {
315 { 315 {
316 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 316 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
317 } 317 }
318 //qDebug("-----system command %s ",tempfilename.latin1() ); 318 //qDebug("-----system command %s ",tempfilename.latin1() );
319 if ( vfork () == 0 ) { 319 if ( vfork () == 0 ) {
320 execl ( tempfilename.latin1(), 0 ); 320 execl ( tempfilename.latin1(), 0 );
321 return; 321 return;
322 } 322 }
323 return; 323 return;
324 } 324 }
325 325
326 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 326 //qDebug("+++++++system command %s ",tempfilename.latin1() );
327 } 327 }
328 if ( mess.left( 11 ) == "audio_alarm") { 328 if ( mess.left( 11 ) == "audio_alarm") {
329 bool error = false; 329 bool error = false;
330 int len = mess.mid( 11 ).find("+++"); 330 int len = mess.mid( 11 ).find("+++");
331 if ( len < 2 ) 331 if ( len < 2 )
332 error = true; 332 error = true;
333 else { 333 else {
334 tempfilename = mess.mid( 11, len ); 334 tempfilename = mess.mid( 11, len );
335 if ( !QFile::exists( tempfilename ) ) 335 if ( !QFile::exists( tempfilename ) )
336 error = true; 336 error = true;
337 } 337 }
338 if ( ! error ) { 338 if ( ! error ) {
339 filename = tempfilename; 339 filename = tempfilename;
340 } 340 }
341 mAlarmMessage = mess.mid( 11+len+3+9 ); 341 mAlarmMessage = mess.mid( 11+len+3+9 );
342 //qDebug("audio file command %s ",tempfilename.latin1() ); 342 //qDebug("audio file command %s ",tempfilename.latin1() );
343 } 343 }
344 if ( mess.left( 9 ) == "cal_alarm") { 344 if ( mess.left( 9 ) == "cal_alarm") {
345 mAlarmMessage = mess.mid( 9 ) ; 345 mAlarmMessage = mess.mid( 9 ) ;
346 } 346 }
347 347
348 writeFile(); 348 writeFile();
349 startAlarm( mAlarmMessage, filename ); 349 startAlarm( mAlarmMessage, filename );
350 350
351} 351}
352 352
353int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) 353int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
354{ 354{
355 return 0; 355 return 0;
356} 356}
357void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) 357void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
358{ 358{
359 //mAlarmDialog->show(); 359 //mAlarmDialog->show();
360 //mAlarmDialog->raise(); 360 //mAlarmDialog->raise();
361 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); 361 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
362} 362}
363 363
364 364
365void SimpleAlarmDaemonImpl::fillTimerPopUp() 365void SimpleAlarmDaemonImpl::fillTimerPopUp()
366{ 366{
367 367
368 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); 368 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
369 if ( mTimerPopupConf == mTimerTime ) { 369 if ( mTimerPopupConf == mTimerTime ) {
370 if ( mTimerTime ) { 370 if ( mTimerTime ) {
371 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 371 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
372 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 372 QTime t ( secs/3600, (secs/60)%60, secs%60 );
373 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)"); 373 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)");
374 } 374 }
375 else { 375 else {
376 QString text = mCustomText.stripWhiteSpace (); 376 QString text = mCustomText.stripWhiteSpace ();
377 int in = text.find( " " ); 377 int in = text.find( " " );
378 text = text.left ( in ); 378 text = text.left ( in );
379 mTimerPopUp->changeItem ( 3, text ); 379 mTimerPopUp->changeItem ( 3, text );
380 } 380 }
381 return; 381 return;
382 } 382 }
383 mTimerPopupConf = mTimerTime; 383 mTimerPopupConf = mTimerTime;
384 mTimerPopUp->clear(); 384 mTimerPopUp->clear();
385 if ( mTimerTime ) { 385 if ( mTimerTime ) {
386 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 386 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
387 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 387 QTime t ( secs/3600, (secs/60)%60, secs%60 );
388 388
389 389
390 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 ); 390 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 );
391 mTimerPopUp->insertItem( t.toString() + " (countdown)",1); 391 mTimerPopUp->insertItem( t.toString() + " (countdown)",1);
392 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2); 392 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2);
393 } else { 393 } else {
394 394
395 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc"; 395 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc";
396 QFile file( fileName ); 396 QFile file( fileName );
397 if( !QFile::exists( fileName) ) { 397 if( !QFile::exists( fileName) ) {
398 // write defaults 398 // write defaults
399 if (!file.open( IO_WriteOnly ) ) { 399 if (!file.open( IO_WriteOnly ) ) {
400 return; 400 return;
401 } 401 }
402 QString configString ; 402 QString configString ;
403 configString += "#config file for kopi alarm timer\n"; 403 configString += "#config file for kopi alarm timer\n";
404 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n"; 404 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n";
405 configString += "#NOTE: minimum value for timer are 3 minutes!\n"; 405 configString += "#NOTE: minimum value for timer are 3 minutes!\n";
406 configString += "24 h; 1440\n"; 406 configString += "24 h; 1440\n";
407 configString += " 8 h; 480\n"; 407 configString += " 8 h; 480\n";
408 configString += " 5 h; 300\n"; 408 configString += " 5 h; 300\n";
409 configString += " 1 h; 60\n"; 409 configString += " 1 h; 60\n";
410 configString += "30 min; 30\n"; 410 configString += "30 min; 30\n";
411 configString += "15 min; 15\n"; 411 configString += "15 min; 15\n";
412 configString += "SEPARATOR\n"; 412 configString += "SEPARATOR\n";
413 configString += "Pizza; 22\n"; 413 configString += "Pizza; 22\n";
414 configString += "Nap; 45\n"; 414 configString += "Nap; 45\n";
415 configString += "Tea; 5\n"; 415 configString += "Tea; 5\n";
416 QTextStream ts( &file ); 416 QTextStream ts( &file );
417 ts << configString ; 417 ts << configString ;
418 file.close(); 418 file.close();
419 } 419 }
420 420
421 if (!file.open( IO_ReadOnly ) ) { 421 if (!file.open( IO_ReadOnly ) ) {
422 return ; 422 return ;
423 } 423 }
424 QString line; 424 QString line;
425 bool ok; 425 bool ok;
426 while ( file.readLine( line, 1024 ) > 0 ) { 426 while ( file.readLine( line, 1024 ) > 0 ) {
427 //qDebug("read %s ", line.latin1()); 427 //qDebug("read %s ", line.latin1());
428 if ( line.left(1 ) != "#" ) { 428 if ( line.left(1 ) != "#" ) {
429 // no comment 429 // no comment
430 if ( line.left(9 ) == "SEPARATOR" ) { 430 if ( line.left(9 ) == "SEPARATOR" ) {
431 mTimerPopUp->insertSeparator(); 431 mTimerPopUp->insertSeparator();
432 } else { 432 } else {
433 QStringList li = QStringList::split(";",line); 433 QStringList li = QStringList::split(";",line);
434 ok = false; 434 ok = false;
435 if ( li.count() == 2 ) { 435 if ( li.count() == 2 ) {
436 int val = li[1].toInt( &ok ); 436 int val = li[1].toInt( &ok );
437 if ( ok && val > 2 ) { 437 if ( ok && val > 2 ) {
438 mTimerPopUp->insertItem( li[0], val); 438 mTimerPopUp->insertItem( li[0], val);
439 } 439 }
440 } 440 }
441 } 441 }
442 } 442 }
443 } 443 }
444 file.close(); 444 file.close();
445#if 0 445#if 0
446 mTimerPopUp->insertItem( "24 h", 1440 ); 446 mTimerPopUp->insertItem( "24 h", 1440 );
447 // mTimerPopUp->insertItem( i18n("12 h"), 720 ); 447 // mTimerPopUp->insertItem( i18n("12 h"), 720 );
448 mTimerPopUp->insertItem( " 8 h", 480 ); 448 mTimerPopUp->insertItem( " 8 h", 480 );
449 mTimerPopUp->insertItem( " 5 h", 300 ); 449 mTimerPopUp->insertItem( " 5 h", 300 );
450 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); 450 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 );
451 mTimerPopUp->insertItem( " 1 h", 60 ); 451 mTimerPopUp->insertItem( " 1 h", 60 );
452 mTimerPopUp->insertItem( "30 min", 30 ); 452 mTimerPopUp->insertItem( "30 min", 30 );
453 mTimerPopUp->insertItem( "15 min", 15 ); 453 mTimerPopUp->insertItem( "15 min", 15 );
454 mTimerPopUp->insertItem( "10 min", 10 ); 454 mTimerPopUp->insertItem( "10 min", 10 );
455 //mTimerPopUp->insertItem( " 5 min", 5 ); 455 //mTimerPopUp->insertItem( " 5 min", 5 );
456 mTimerPopUp->insertSeparator(); 456 mTimerPopUp->insertSeparator();
457 mTimerPopUp->insertItem( "Pizza", 22 ); 457 mTimerPopUp->insertItem( "Pizza", 22 );
458 mTimerPopUp->insertItem( "Nap", 45 ); 458 mTimerPopUp->insertItem( "Nap", 45 );
459 mTimerPopUp->insertItem( "Tea", 5 ); 459 mTimerPopUp->insertItem( "Tea", 5 );
460#endif 460#endif
461 QString text = mCustomText.stripWhiteSpace (); 461 QString text = mCustomText.stripWhiteSpace ();
462 int in = text.find( " " ); 462 int in = text.find( " " );
463 text = text.left ( in ); 463 text = text.left ( in );
464 mTimerPopUp->insertItem( text, 3 ); 464 mTimerPopUp->insertItem( text, 3 );
465 mTimerPopUp->insertSeparator(); 465 mTimerPopUp->insertSeparator();
466 mTimerPopUp->insertItem( "Customize", 2 ); 466 mTimerPopUp->insertItem( "Customize", 2 );
467 } 467 }
468 468
469} 469}
470 470
471void SimpleAlarmDaemonImpl::showTimer() 471void SimpleAlarmDaemonImpl::showTimer()
472{ 472{
473 fillTimerPopUp(); 473 fillTimerPopUp();
474} 474}
475 475
476void SimpleAlarmDaemonImpl::confTimer( int time ) 476void SimpleAlarmDaemonImpl::confTimer( int time )
477{ 477{
478 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); 478 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time );
479 int minutes = time; 479 int minutes = time;
480 if ( minutes == 0 ) { 480 if ( minutes == 0 ) {
481 if ( ! mTimerTime ) 481 if ( ! mTimerTime )
482 return; 482 return;
483 483
484 QDialog dia ( 0, ("Stop Timer" ), true ); 484 QDialog dia ( 0, ("Stop Timer" ), true );
485 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia ); 485 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia );
486 lab.setAlignment( AlignCenter ); 486 lab.setAlignment( AlignCenter );
487 dia.setCaption(("KO/Pi Timer Stop" )); 487 dia.setCaption(("KO/Pi Timer Stop" ));
488 QVBoxLayout lay( &dia ); 488 QVBoxLayout lay( &dia );
489 lay.addWidget( &lab); 489 lay.addWidget( &lab);
490 QPushButton ok ( "Stop timer!", &dia); 490 QPushButton ok ( "Stop timer!", &dia);
491 QFont fo = dia.font(); 491 QFont fo = dia.font();
492 fo.setPointSize( 36 ); 492 fo.setPointSize( 36 );
493 ok.setFont( fo ); 493 ok.setFont( fo );
494 lay.addWidget( &ok); 494 lay.addWidget( &ok);
495 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 495 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
496 QPushButton con ( "Continue timer!", &dia); 496 QPushButton con ( "Continue timer!", &dia);
497 fo.setPointSize( 36 ); 497 fo.setPointSize( 36 );
498 con.setFont( fo ); 498 con.setFont( fo );
499 lay.addWidget( &con); 499 lay.addWidget( &con);
500 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); 500 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) );
501 lay.setMargin(5); 501 lay.setMargin(5);
502 lay.setSpacing(5); 502 lay.setSpacing(5);
503 dia.resize(dia.sizeHint() ); 503 dia.resize(dia.sizeHint() );
504 504
505 if ( !dia.exec() ) 505 if ( !dia.exec() )
506 return; 506 return;
507 507
508 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); 508 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() );
509 mTimerTime = 0; 509 mTimerTime = 0;
510 return; 510 return;
511 } 511 }
512 if ( mTimerTime ) 512 if ( mTimerTime )
513 return; 513 return;
514 if ( minutes == 1 ) { 514 if ( minutes == 1 ) {
515 return; 515 return;
516 } 516 }
517 QString mess = "timer_alarm"; 517 QString mess = "timer_alarm";
518 mess += ("Timer Alarm!\n"); 518 mess += ("Timer Alarm!\n");
519 if ( minutes == 22 ) { 519 if ( minutes == 22 ) {
520 mess += ( "Pizza is ready"); 520 mess += ( "Pizza is ready");
521 mRunningTimerText = "Pizza"; 521 mRunningTimerText = "Pizza";
522 } 522 }
523 else if ( minutes == 45 ) { 523 else if ( minutes == 45 ) {
524 mess += ( "Please wake up!"); 524 mess += ( "Please wake up!");
525 mRunningTimerText = "Nap"; 525 mRunningTimerText = "Nap";
526 } 526 }
527 else if ( minutes == 5 ) { 527 else if ( minutes == 5 ) {
528 mess += ( "Tea is ready"); 528 mess += ( "Tea is ready");
529 mRunningTimerText = "Tea"; 529 mRunningTimerText = "Tea";
530 } 530 }
531 else if ( minutes == 3 ) { 531 else if ( minutes == 3 ) {
532 mess += mCustomText; 532 mess += mCustomText;
533 minutes = mCustomMinutes ; 533 minutes = mCustomMinutes ;
534 mRunningTimerText = mCustomText.stripWhiteSpace (); 534 mRunningTimerText = mCustomText.stripWhiteSpace ();
535 int in = mRunningTimerText.find( " " ); 535 int in = mRunningTimerText.find( " " );
536 mRunningTimerText = mRunningTimerText.left ( in ); 536 mRunningTimerText = mRunningTimerText.left ( in );
537 } 537 }
538 else { 538 else {
539 if ( minutes == 2 ) { 539 if ( minutes == 2 ) {
540 // ask time 540 // ask time
541 QDialog dia ( 0, ("Customize Timer" ), true ); 541 QDialog dia ( 0, ("Customize Timer" ), true );
542 QLabel lab (("Message Text:"), &dia ); 542 QLabel lab (("Message Text:"), &dia );
543 dia.setCaption(("KO/Pi Timer" )); 543 dia.setCaption(("KO/Pi Timer" ));
544 QVBoxLayout lay( &dia ); 544 QVBoxLayout lay( &dia );
545 lay.setMargin(5); 545 lay.setMargin(5);
546 lay.setSpacing(5); 546 lay.setSpacing(5);
547 lay.addWidget( &lab); 547 lay.addWidget( &lab);
548 QLineEdit lEdit( mCustomText, &dia ); 548 QLineEdit lEdit( mCustomText, &dia );
549 lay.addWidget( &lEdit); 549 lay.addWidget( &lEdit);
550 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 550 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
551 lay.addWidget( &lab2); 551 lay.addWidget( &lab2);
552 QHBox hbox1 ( &dia ); 552 QHBox hbox1 ( &dia );
553 lay.addWidget( &hbox1); 553 lay.addWidget( &hbox1);
554 QLabel lab3 (("Hours"), &hbox1 ); 554 QLabel lab3 (("Hours"), &hbox1 );
555 QLabel lab4 (("Minutes"), &hbox1 ); 555 QLabel lab4 (("Minutes"), &hbox1 );
556 QHBox hbox ( &dia ); 556 QHBox hbox ( &dia );
557 QSpinBox spinh( 0, 24, 1,& hbox ); 557 QSpinBox spinh( 0, 24, 1,& hbox );
558 QFont fo = dia.font(); 558 QFont fo = dia.font();
559 fo.setPointSize( 36 ); 559 fo.setPointSize( 36 );
560 QSpinBox spinm( 0, 59, 1,&hbox ); 560 QSpinBox spinm( 0, 59, 1,&hbox );
561 spinm.setFont( fo ); 561 spinm.setFont( fo );
562 spinh.setFont( fo ); 562 spinh.setFont( fo );
563 spinh.setButtonSymbols( QSpinBox::PlusMinus ); 563 spinh.setButtonSymbols( QSpinBox::PlusMinus );
564 spinm.setButtonSymbols( QSpinBox::PlusMinus ); 564 spinm.setButtonSymbols( QSpinBox::PlusMinus );
565 spinh.upButton ()->setFixedSize( QSize( 48, 30 )); 565 spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
566 spinh.downButton ()->setFixedSize( QSize( 48, 30 )); 566 spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
567 //spinh.editor ()->setFixedSize( QSize( 50, 100 )); 567 //spinh.editor ()->setFixedSize( QSize( 50, 100 ));
568 spinh.setFixedSize( 100,62 ); 568 spinh.setFixedSize( 100,62 );
569 spinm.upButton ()->setFixedSize( QSize( 48, 30 )); 569 spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
570 spinm.downButton ()->setFixedSize( QSize( 48, 30 )); 570 spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
571 spinm.downButton ()->setGeometry( 50,50,50,50); 571 spinm.downButton ()->setGeometry( 50,50,50,50);
572 // spinm.setSuffix( " m" ); 572 // spinm.setSuffix( " m" );
573 //spinh.setSuffix( " h" ); 573 //spinh.setSuffix( " h" );
574 spinm.setWrapping ( true ); 574 spinm.setWrapping ( true );
575 //spinm.editor ()->setFixedSize( QSize( 50, 100 )); 575 //spinm.editor ()->setFixedSize( QSize( 50, 100 ));
576 spinm.setLineStep( 1 ); 576 spinm.setLineStep( 1 );
577 spinm.setFixedSize( 110,62 ); 577 spinm.setFixedSize( 110,62 );
578 lay.addWidget( &hbox); 578 lay.addWidget( &hbox);
579 QLabel lab5 ("Timer fires at:", &dia ); 579 QLabel lab5 ("Timer fires at:", &dia );
580 lab5.setAlignment( AlignCenter ); 580 lab5.setAlignment( AlignCenter );
581 lay.addWidget( &lab5); 581 lay.addWidget( &lab5);
582 KODateLabel dl ( &dia ); 582 KODateLabel dl ( &dia );
583 dl.setAlignment( AlignCenter ); 583 dl.setAlignment( AlignCenter );
584 dl.setFont( fo ); 584 dl.setFont( fo );
585 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); 585 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
586 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); 586 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
587 lay.addWidget( &dl); 587 lay.addWidget( &dl);
588 spinh.setValue( mCustomMinutes/60 ); 588 spinh.setValue( mCustomMinutes/60 );
589 spinm.setValue( mCustomMinutes%60 ); 589 spinm.setValue( mCustomMinutes%60 );
590 QPushButton ok ( "Start timer", &dia); 590 QPushButton ok ( "Start timer", &dia);
591 ok.setDefault( true ); 591 ok.setDefault( true );
592 ok.setFont( fo ); 592 ok.setFont( fo );
593 spinh.setFocus(); 593 spinh.setFocus();
594 lay.addWidget( &ok); 594 lay.addWidget( &ok);
595 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 595 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
596 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 596 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
597 597
598 if ( !dia.exec() ) 598 if ( !dia.exec() )
599 return; 599 return;
600 mCustomText = lEdit.text(); 600 mCustomText = lEdit.text();
601 mCustomMinutes = spinh.value()*60+spinm.value(); 601 mCustomMinutes = spinh.value()*60+spinm.value();
602 if ( mCustomMinutes == 0 ) 602 if ( mCustomMinutes == 0 )
603 mCustomMinutes = 1; 603 mCustomMinutes = 1;
604 if ( mCustomMinutes > 1440 ) 604 if ( mCustomMinutes > 1440 )
605 mCustomMinutes = 1440; 605 mCustomMinutes = 1440;
606 mess += mCustomText; 606 mess += mCustomText;
607 minutes = mCustomMinutes; 607 minutes = mCustomMinutes;
608 mRunningTimerText = mCustomText.stripWhiteSpace (); 608 mRunningTimerText = mCustomText.stripWhiteSpace ();
609 int in = mRunningTimerText.find( " " ); 609 int in = mRunningTimerText.find( " " );
610 mRunningTimerText = mRunningTimerText.left ( in ); 610 mRunningTimerText = mRunningTimerText.left ( in );
611 } 611 }
612 else { 612 else {
613 mess+= QString::number ( minutes ) + ( " minutes are past!"); 613 mess+= QString::number ( minutes ) + ( " minutes are past!");
614 int min = minutes; 614 int min = minutes;
615 if ( min % 60 == 0 ) 615 if ( min % 60 == 0 )
616 mRunningTimerText = QString::number ( min/60 ) + ( " hours"); 616 mRunningTimerText = QString::number ( min/60 ) + ( " hours");
617 else 617 else
618 mRunningTimerText = QString::number ( minutes ) + ( " minutes"); 618 mRunningTimerText = QString::number ( minutes ) + ( " minutes");
619 } 619 }
620 } 620 }
621 //minutes = 1; 621 //minutes = 1;
622 622
623 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 623 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
624 timerMesssage = mess; 624 timerMesssage = mess;
625 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); 625 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
626 mTimerTime = 1; 626 mTimerTime = 1;
627} 627}
628 628
629void SimpleAlarmDaemonImpl::writeFile() 629void SimpleAlarmDaemonImpl::writeFile()
630{ 630{
631 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 631 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
632 //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 632 //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
633} 633}
634void SimpleAlarmDaemonImpl::showWN() 634void SimpleAlarmDaemonImpl::showWN()
635{ 635{
636 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 636 QCopEnvelope e("QPE/Application/kopi", "-showWN");
637} 637}
638void SimpleAlarmDaemonImpl::newTodo() 638void SimpleAlarmDaemonImpl::newTodo()
639{ 639{
640 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 640 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
641} 641}
642 642
643void SimpleAlarmDaemonImpl::newEvent() 643void SimpleAlarmDaemonImpl::newEvent()
644{ 644{
645 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 645 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
646 646
647} 647}
648void SimpleAlarmDaemonImpl::newMail() 648void SimpleAlarmDaemonImpl::newMail()
649{ 649{
650 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 650 QCopEnvelope e("QPE/Application/ompi", "newMail()");
651} 651}
652void SimpleAlarmDaemonImpl::showAdd() 652void SimpleAlarmDaemonImpl::showAdd()
653{ 653{
654 QCopEnvelope e("QPE/Application/kapi", "raise()"); 654 QCopEnvelope e("QPE/Application/kapi", "raise()");
655} 655}
656void SimpleAlarmDaemonImpl::ringSync() 656void SimpleAlarmDaemonImpl::ringSync()
657{ 657{
658 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 658 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
659 659
660} 660}
661void SimpleAlarmDaemonImpl::newCountdown() 661void SimpleAlarmDaemonImpl::newCountdown()
662{ 662{
663 //recieve("cal_alarm", 10 ); 663 //recieve("cal_alarm", 10 );
664} 664}
665void SimpleAlarmDaemonImpl::simulate() 665void SimpleAlarmDaemonImpl::simulate()
666{ 666{
667 writeFile(); 667 writeFile();
668 QString filename = getenv("QPEDIR") ; 668 QString filename = getenv("QPEDIR") ;
669 filename += "/pics/kdepim/korganizer/koalarm.wav"; 669 filename += "/pics/kdepim/korganizer/koalarm.wav";
670 startAlarm("Alarm simulation", filename ); 670 startAlarm("Alarm simulation", filename );
671} 671}
672void SimpleAlarmDaemonImpl::showKO() 672void SimpleAlarmDaemonImpl::showKO()
673{ 673{
674 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 674 QCopEnvelope e("QPE/Application/kopi", "-showKO");
675 // testing only 675 // testing only
676 //QCopEnvelope e("QPE/Application/kopi", "nextView()"); 676 //QCopEnvelope e("QPE/Application/kopi", "nextView()");
677 677
678} 678}
679void SimpleAlarmDaemonImpl::showTodo() 679void SimpleAlarmDaemonImpl::showTodo()
680{ 680{
681 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 681 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
682 682
683} 683}
684void SimpleAlarmDaemonImpl::writeJournal() 684void SimpleAlarmDaemonImpl::writeJournal()
685{ 685{
686 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 686 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
687 687
688} 688}
689 689
690void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) 690void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
691{ 691{
692 692
693 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); 693 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
694 694
695} 695}
696 696
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8d992b9..4b82aa8 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -461,567 +461,569 @@ void CalendarView::init()
461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
462 mTodoList->setNavigator( mNavigator ); 462 mTodoList->setNavigator( mNavigator );
463#if 0 463#if 0
464 if ( QApplication::desktop()->width() < 480 ) { 464 if ( QApplication::desktop()->width() < 480 ) {
465 leftFrameLayout->addWidget(mFilterView); 465 leftFrameLayout->addWidget(mFilterView);
466 leftFrameLayout->addWidget(mTodoList, 2 ); 466 leftFrameLayout->addWidget(mTodoList, 2 );
467 467
468 } else { 468 } else {
469 leftFrameLayout->addWidget(mTodoList,2 ); 469 leftFrameLayout->addWidget(mTodoList,2 );
470 leftFrameLayout->addWidget(mFilterView ); 470 leftFrameLayout->addWidget(mFilterView );
471 } 471 }
472#endif 472#endif
473 mFilterView->hide(); 473 mFilterView->hide();
474 mCalEditView->hide(); 474 mCalEditView->hide();
475 QWidget *rightBox = new QWidget( mMainFrame ); 475 QWidget *rightBox = new QWidget( mMainFrame );
476 //mainBoxLayout->addWidget ( rightBox, 10 ); 476 //mainBoxLayout->addWidget ( rightBox, 10 );
477 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 477 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
478 mRightFrame = new QWidgetStack( rightBox ); 478 mRightFrame = new QWidgetStack( rightBox );
479 rightLayout->addWidget( mRightFrame, 10 ); 479 rightLayout->addWidget( mRightFrame, 10 );
480 480
481 //mLeftFrame = (QWidget *)leftFrame; 481 //mLeftFrame = (QWidget *)leftFrame;
482 if ( KOPrefs::instance()->mVerticalScreen ) { 482 if ( KOPrefs::instance()->mVerticalScreen ) {
483 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 483 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
484 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 484 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
485 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 485 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
486 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 486 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
487 } else { 487 } else {
488 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 488 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
489 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 489 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
490 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 490 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
491 } 491 }
492 if ( !KOPrefs::instance()->mShowDateNavigator) 492 if ( !KOPrefs::instance()->mShowDateNavigator)
493 mDateNavigator->hide(); 493 mDateNavigator->hide();
494 //qDebug("Calendarview Size %d %d ", width(), height()); 494 //qDebug("Calendarview Size %d %d ", width(), height());
495#endif 495#endif
496 496
497 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 497 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
498 SLOT( showDates( const KCal::DateList & ) ) ); 498 SLOT( showDates( const KCal::DateList & ) ) );
499 499
500 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 500 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
501 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 501 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
502 502
503 503
504 504
505 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 505 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
506 mViewManager, SLOT( showMonth( const QDate & ) ) ); 506 mViewManager, SLOT( showMonth( const QDate & ) ) );
507 507
508 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 508 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
509 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 509 mNavigator, SLOT( selectWeek( const QDate & ) ) );
510 510
511 connect( mDateNavigator, SIGNAL( goPrevYear() ), 511 connect( mDateNavigator, SIGNAL( goPrevYear() ),
512 mNavigator, SLOT( selectPreviousYear() ) ); 512 mNavigator, SLOT( selectPreviousYear() ) );
513 connect( mDateNavigator, SIGNAL( goNextYear() ), 513 connect( mDateNavigator, SIGNAL( goNextYear() ),
514 mNavigator, SLOT( selectNextYear() ) ); 514 mNavigator, SLOT( selectNextYear() ) );
515 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 515 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
516 mNavigator, SLOT( selectPreviousMonth() ) ); 516 mNavigator, SLOT( selectPreviousMonth() ) );
517 connect( mDateNavigator, SIGNAL( goNextMonth() ), 517 connect( mDateNavigator, SIGNAL( goNextMonth() ),
518 mNavigator, SLOT( selectNextMonth() ) ); 518 mNavigator, SLOT( selectNextMonth() ) );
519 519
520 connect( mDateNavigator, SIGNAL( goPrevious() ), 520 connect( mDateNavigator, SIGNAL( goPrevious() ),
521 mNavigator, SLOT( selectPrevious() ) ); 521 mNavigator, SLOT( selectPrevious() ) );
522 connect( mDateNavigator, SIGNAL( goNext() ), 522 connect( mDateNavigator, SIGNAL( goNext() ),
523 mNavigator, SLOT( selectNext() ) ); 523 mNavigator, SLOT( selectNext() ) );
524 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 524 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
525 mNavigator, SLOT( slotMonthSelect( int ) ) ); 525 mNavigator, SLOT( slotMonthSelect( int ) ) );
526 526
527 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 527 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
528 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 528 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
529#if 0 529#if 0
530 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 530 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
531 SLOT( incidenceAdded( Incidence *) ) ); 531 SLOT( incidenceAdded( Incidence *) ) );
532#endif 532#endif
533 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 533 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
534 534
535 connect( this, SIGNAL( configChanged() ), 535 connect( this, SIGNAL( configChanged() ),
536 mDateNavigator, SLOT( updateConfig() ) ); 536 mDateNavigator, SLOT( updateConfig() ) );
537 537
538 connect( mTodoList, SIGNAL( newTodoSignal() ), 538 connect( mTodoList, SIGNAL( newTodoSignal() ),
539 SLOT( newTodo() ) ); 539 SLOT( newTodo() ) );
540 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 540 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
541 SLOT( newSubTodo( Todo * ) ) ); 541 SLOT( newSubTodo( Todo * ) ) );
542 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 542 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
543 SLOT( editTodo( Todo * ) ) ); 543 SLOT( editTodo( Todo * ) ) );
544 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 544 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
545 SLOT( showTodo( Todo *) ) ); 545 SLOT( showTodo( Todo *) ) );
546 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 546 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
547 SLOT( deleteTodo( Todo *) ) ); 547 SLOT( deleteTodo( Todo *) ) );
548 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 548 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
549 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 549 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
550 SLOT( purgeCompleted() ) ); 550 SLOT( purgeCompleted() ) );
551 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 551 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
552 SIGNAL( todoModified( Todo *, int ) ) ); 552 SIGNAL( todoModified( Todo *, int ) ) );
553 553
554 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 554 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
555 this, SLOT ( cloneIncidence( Incidence * ) ) ); 555 this, SLOT ( cloneIncidence( Incidence * ) ) );
556 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 556 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
557 this, SLOT (cancelIncidence( Incidence * ) ) ); 557 this, SLOT (cancelIncidence( Incidence * ) ) );
558 558
559 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 559 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
560 this, SLOT ( moveIncidence( Incidence * ) ) ); 560 this, SLOT ( moveIncidence( Incidence * ) ) );
561 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 561 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
562 this, SLOT ( beamIncidence( Incidence * ) ) ); 562 this, SLOT ( beamIncidence( Incidence * ) ) );
563 563
564 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 564 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
565 this, SLOT ( todo_unsub( Todo * ) ) ); 565 this, SLOT ( todo_unsub( Todo * ) ) );
566 566
567 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 567 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
568 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 568 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
569 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 569 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
570 SLOT( updateTodo( Todo *, int ) ) ); 570 SLOT( updateTodo( Todo *, int ) ) );
571 connect( this, SIGNAL( todoModified( Todo *, int )), this, 571 connect( this, SIGNAL( todoModified( Todo *, int )), this,
572 SLOT( changeTodoDisplay( Todo *, int ) ) ); 572 SLOT( changeTodoDisplay( Todo *, int ) ) );
573 573
574 574
575 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 575 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
576 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 576 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
577 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 577 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
578 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 578 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
579 579
580 580
581 581
582 582
583 583
584 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 584 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
585 SLOT(checkClipboard())); 585 SLOT(checkClipboard()));
586 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 586 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
587 SLOT( processTodoListSelection( Incidence * ) ) ); 587 SLOT( processTodoListSelection( Incidence * ) ) );
588 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 588 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
589 589
590 // kdDebug() << "CalendarView::CalendarView() done" << endl; 590 // kdDebug() << "CalendarView::CalendarView() done" << endl;
591 591
592 mDateFrame = new QVBox(0,0,WType_Popup); 592 mDateFrame = new QVBox(0,0,WType_Popup);
593 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 593 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
594 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 594 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
595 mDateFrame->setLineWidth(3); 595 mDateFrame->setLineWidth(3);
596 mDateFrame->hide(); 596 mDateFrame->hide();
597 mDateFrame->setCaption( i18n( "Pick a date to display")); 597 mDateFrame->setCaption( i18n( "Pick a date to display"));
598 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 598 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
599 599
600 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 600 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
601 601
602 mEventEditor = mDialogManager->getEventEditor(); 602 mEventEditor = mDialogManager->getEventEditor();
603 mTodoEditor = mDialogManager->getTodoEditor(); 603 mTodoEditor = mDialogManager->getTodoEditor();
604 604
605 mFlagEditDescription = false; 605 mFlagEditDescription = false;
606 606
607 mSuspendTimer = new QTimer( this ); 607 mSuspendTimer = new QTimer( this );
608 mAlarmTimer = new QTimer( this ); 608 mAlarmTimer = new QTimer( this );
609 mRecheckAlarmTimer = new QTimer( this ); 609 mRecheckAlarmTimer = new QTimer( this );
610 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 610 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
611 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 611 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
612 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 612 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
613 mAlarmDialog = new AlarmDialog( this ); 613 mAlarmDialog = new AlarmDialog( this );
614 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 614 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
615 mAlarmDialog->setServerNotification( false ); 615 mAlarmDialog->setServerNotification( false );
616 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 616 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
617 617
618 618
619#ifndef DESKTOP_VERSION 619#ifndef DESKTOP_VERSION
620//US listen for arriving address resultsets 620//US listen for arriving address resultsets
621 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 621 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
622 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 622 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
623#endif 623#endif
624 mDateNavigator->setCalendar( mCalendar ); 624 mDateNavigator->setCalendar( mCalendar );
625} 625}
626 626
627 627
628CalendarView::~CalendarView() 628CalendarView::~CalendarView()
629{ 629{
630 // kdDebug() << "~CalendarView()" << endl; 630 // kdDebug() << "~CalendarView()" << endl;
631 //qDebug("CalendarView::~CalendarView() "); 631 //qDebug("CalendarView::~CalendarView() ");
632 delete mDialogManager; 632 delete mDialogManager;
633 delete mViewManager; 633 delete mViewManager;
634 delete mStorage; 634 delete mStorage;
635 delete mDateFrame ; 635 delete mDateFrame ;
636 delete beamDialog; 636 delete beamDialog;
637 delete mEventViewerDialog; 637 delete mEventViewerDialog;
638 //kdDebug() << "~CalendarView() done" << endl; 638 //kdDebug() << "~CalendarView() done" << endl;
639} 639}
640void CalendarView::checkAlarms() 640void CalendarView::checkAlarms()
641{ 641{
642 KConfig *config = KOGlobals::config(); 642 KConfig *config = KOGlobals::config();
643 config->setGroup( "AppRun" ); 643 config->setGroup( "AppRun" );
644 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 644 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
645 int secto = dt.secsTo( QDateTime::currentDateTime() ); 645 int secto = dt.secsTo( QDateTime::currentDateTime() );
646 int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; 646 int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30;
647 //secs -= ( 3600 * 24*3 ); // debug only 647 //secs -= ( 3600 * 24*3 ); // debug only
648 QDateTime latest = dt.addSecs ( secs ); 648 QDateTime latest = dt.addSecs ( secs );
649 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 649 qDebug("KO: Last termination on %s ", latest.toString().latin1());
650 QPtrList<Incidence> el = mCalendar->rawIncidences(); 650 QPtrList<Incidence> el = mCalendar->rawIncidences();
651 QPtrList<Incidence> al; 651 QPtrList<Incidence> al;
652 Incidence* inL = el.first(); 652 Incidence* inL = el.first();
653 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
654 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
653 while ( inL ) { 655 while ( inL ) {
654 bool ok = false; 656 bool ok = false;
655 int offset = 0; 657 int offset = 0;
656 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 658 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
657 if ( ok ) { 659 if ( ok ) {
658 //qDebug("OK %s",next.toString().latin1()); 660 //qDebug("OK %s",next.toString().latin1());
659 if ( next < QDateTime::currentDateTime() ) { 661 if ( next < cur ) {
660 al.append( inL ); 662 al.append( inL );
661 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 663 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
662 } 664 }
663 } 665 }
664 inL = el.next(); 666 inL = el.next();
665 } 667 }
666 if ( al.count() ) { 668 if ( al.count() ) {
667 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 669 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
668 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 670 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
669 QVBoxLayout* lay = new QVBoxLayout( dia ); 671 QVBoxLayout* lay = new QVBoxLayout( dia );
670 lay->setSpacing( 0 ); 672 lay->setSpacing( 0 );
671 lay->setMargin( 0 ); 673 lay->setMargin( 0 );
672 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 674 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
673 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 675 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
674 lay->addWidget( matb ); 676 lay->addWidget( matb );
675 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 677 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
676 int wid = 210; 678 int wid = 210;
677 int x = QApplication::desktop()->width() - wid - 7; 679 int x = QApplication::desktop()->width() - wid - 7;
678 int y = QApplication::desktop()->height() - wid - 70; 680 int y = QApplication::desktop()->height() - wid - 70;
679 dia->setGeometry ( x,y,wid,wid); 681 dia->setGeometry ( x,y,wid,wid);
680 } else { 682 } else {
681 int si = 220; 683 int si = 220;
682 if ( QApplication::desktop()->width() > 470 ) 684 if ( QApplication::desktop()->width() > 470 )
683 si = 400; 685 si = 400;
684 dia->resize(si,si/2); 686 dia->resize(si,si/2);
685 } 687 }
686 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 688 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
687 dia->show(); 689 dia->show();
688 690
689 } 691 }
690} 692}
691void CalendarView::showDay( QDate d ) 693void CalendarView::showDay( QDate d )
692{ 694{
693 dateNavigator()->blockSignals( true ); 695 dateNavigator()->blockSignals( true );
694 dateNavigator()->selectDate( d ); 696 dateNavigator()->selectDate( d );
695 dateNavigator()->blockSignals( false ); 697 dateNavigator()->blockSignals( false );
696 mViewManager->showDayView(); 698 mViewManager->showDayView();
697 //dateNavigator()->selectDate( d ); 699 //dateNavigator()->selectDate( d );
698} 700}
699void CalendarView::timerAlarm() 701void CalendarView::timerAlarm()
700{ 702{
701 //qDebug("CalendarView::timerAlarm() "); 703 //qDebug("CalendarView::timerAlarm() ");
702 computeAlarm(mAlarmNotification ); 704 computeAlarm(mAlarmNotification );
703} 705}
704 706
705void CalendarView::suspendAlarm() 707void CalendarView::suspendAlarm()
706{ 708{
707 //qDebug(" CalendarView::suspendAlarm() "); 709 //qDebug(" CalendarView::suspendAlarm() ");
708 computeAlarm(mSuspendAlarmNotification ); 710 computeAlarm(mSuspendAlarmNotification );
709 711
710} 712}
711 713
712void CalendarView::startAlarm( QString mess , QString filename) 714void CalendarView::startAlarm( QString mess , QString filename)
713{ 715{
714 716
715 topLevelWidget()->showNormal(); 717 topLevelWidget()->showNormal();
716 topLevelWidget()->setActiveWindow(); 718 topLevelWidget()->setActiveWindow();
717 topLevelWidget()->raise(); 719 topLevelWidget()->raise();
718 720
719 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 721 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
720 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 722 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
721 723
722} 724}
723 725
724void CalendarView::checkNextTimerAlarm() 726void CalendarView::checkNextTimerAlarm()
725{ 727{
726 mCalendar->checkAlarmForIncidence( 0, true ); 728 mCalendar->checkAlarmForIncidence( 0, true );
727} 729}
728 730
729void CalendarView::computeAlarm( QString msg ) 731void CalendarView::computeAlarm( QString msg )
730{ 732{
731 733
732 QString mess = msg; 734 QString mess = msg;
733 QString mAlarmMessage = mess.mid( 9 ); 735 QString mAlarmMessage = mess.mid( 9 );
734 QString filename = MainWindow::resourcePath(); 736 QString filename = MainWindow::resourcePath();
735 filename += "koalarm.wav"; 737 filename += "koalarm.wav";
736 QString tempfilename; 738 QString tempfilename;
737 if ( mess.left( 13 ) == "suspend_alarm") { 739 if ( mess.left( 13 ) == "suspend_alarm") {
738 bool error = false; 740 bool error = false;
739 int len = mess.mid( 13 ).find("+++"); 741 int len = mess.mid( 13 ).find("+++");
740 if ( len < 2 ) 742 if ( len < 2 )
741 error = true; 743 error = true;
742 else { 744 else {
743 tempfilename = mess.mid( 13, len ); 745 tempfilename = mess.mid( 13, len );
744 if ( !QFile::exists( tempfilename ) ) 746 if ( !QFile::exists( tempfilename ) )
745 error = true; 747 error = true;
746 } 748 }
747 if ( ! error ) { 749 if ( ! error ) {
748 filename = tempfilename; 750 filename = tempfilename;
749 } 751 }
750 mAlarmMessage = mess.mid( 13+len+3 ); 752 mAlarmMessage = mess.mid( 13+len+3 );
751 //qDebug("suspend file %s ",tempfilename.latin1() ); 753 //qDebug("suspend file %s ",tempfilename.latin1() );
752 startAlarm( mAlarmMessage, filename); 754 startAlarm( mAlarmMessage, filename);
753 return; 755 return;
754 } 756 }
755 if ( mess.left( 11 ) == "timer_alarm") { 757 if ( mess.left( 11 ) == "timer_alarm") {
756 //mTimerTime = 0; 758 //mTimerTime = 0;
757 startAlarm( mess.mid( 11 ), filename ); 759 startAlarm( mess.mid( 11 ), filename );
758 return; 760 return;
759 } 761 }
760 if ( mess.left( 10 ) == "proc_alarm") { 762 if ( mess.left( 10 ) == "proc_alarm") {
761 bool error = false; 763 bool error = false;
762 int len = mess.mid( 10 ).find("+++"); 764 int len = mess.mid( 10 ).find("+++");
763 if ( len < 2 ) 765 if ( len < 2 )
764 error = true; 766 error = true;
765 else { 767 else {
766 tempfilename = mess.mid( 10, len ); 768 tempfilename = mess.mid( 10, len );
767 if ( !QFile::exists( tempfilename ) ) 769 if ( !QFile::exists( tempfilename ) )
768 error = true; 770 error = true;
769 } 771 }
770 if ( error ) { 772 if ( error ) {
771 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 773 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
772 mAlarmMessage += mess.mid( 10+len+3+9 ); 774 mAlarmMessage += mess.mid( 10+len+3+9 );
773 } else { 775 } else {
774 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 776 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
775 //qDebug("-----system command %s ",tempfilename.latin1() ); 777 //qDebug("-----system command %s ",tempfilename.latin1() );
776#ifndef _WIN32_ 778#ifndef _WIN32_
777 if ( vfork () == 0 ) { 779 if ( vfork () == 0 ) {
778 execl ( tempfilename.latin1(), 0 ); 780 execl ( tempfilename.latin1(), 0 );
779 return; 781 return;
780 } 782 }
781#else 783#else
782 QProcess* p = new QProcess(); 784 QProcess* p = new QProcess();
783 p->addArgument( tempfilename.latin1() ); 785 p->addArgument( tempfilename.latin1() );
784 p->start(); 786 p->start();
785 return; 787 return;
786#endif 788#endif
787 789
788 return; 790 return;
789 } 791 }
790 792
791 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 793 //qDebug("+++++++system command %s ",tempfilename.latin1() );
792 } 794 }
793 if ( mess.left( 11 ) == "audio_alarm") { 795 if ( mess.left( 11 ) == "audio_alarm") {
794 bool error = false; 796 bool error = false;
795 int len = mess.mid( 11 ).find("+++"); 797 int len = mess.mid( 11 ).find("+++");
796 if ( len < 2 ) 798 if ( len < 2 )
797 error = true; 799 error = true;
798 else { 800 else {
799 tempfilename = mess.mid( 11, len ); 801 tempfilename = mess.mid( 11, len );
800 if ( !QFile::exists( tempfilename ) ) 802 if ( !QFile::exists( tempfilename ) )
801 error = true; 803 error = true;
802 } 804 }
803 if ( ! error ) { 805 if ( ! error ) {
804 filename = tempfilename; 806 filename = tempfilename;
805 } 807 }
806 mAlarmMessage = mess.mid( 11+len+3+9 ); 808 mAlarmMessage = mess.mid( 11+len+3+9 );
807 //qDebug("audio file command %s ",tempfilename.latin1() ); 809 //qDebug("audio file command %s ",tempfilename.latin1() );
808 } 810 }
809 if ( mess.left( 9 ) == "cal_alarm") { 811 if ( mess.left( 9 ) == "cal_alarm") {
810 mAlarmMessage = mess.mid( 9 ) ; 812 mAlarmMessage = mess.mid( 9 ) ;
811 } 813 }
812 814
813 startAlarm( mAlarmMessage, filename ); 815 startAlarm( mAlarmMessage, filename );
814 816
815 817
816} 818}
817 819
818void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 820void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
819{ 821{
820 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 822 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
821 823
822 mSuspendAlarmNotification = noti; 824 mSuspendAlarmNotification = noti;
823 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 825 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
824 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 826 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
825 mSuspendTimer->start( ms , true ); 827 mSuspendTimer->start( ms , true );
826 828
827} 829}
828 830
829void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 831void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
830{ 832{
831 mNextAlarmDateTime = qdt; 833 mNextAlarmDateTime = qdt;
832 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 834 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
833 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 835 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
834#ifndef DESKTOP_VERSION 836#ifndef DESKTOP_VERSION
835 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 837 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
836#endif 838#endif
837 return; 839 return;
838 } 840 }
839 int maxSec; 841 int maxSec;
840 //maxSec = 5; //testing only 842 //maxSec = 5; //testing only
841 maxSec = 86400+3600; // one day+1hour 843 maxSec = 86400+3600; // one day+1hour
842 mAlarmNotification = noti; 844 mAlarmNotification = noti;
843 int sec = QDateTime::currentDateTime().secsTo( qdt ); 845 int sec = QDateTime::currentDateTime().secsTo( qdt );
844 if ( sec > maxSec ) { 846 if ( sec > maxSec ) {
845 mRecheckAlarmTimer->start( maxSec * 1000 ); 847 mRecheckAlarmTimer->start( maxSec * 1000 );
846 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 848 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
847 return; 849 return;
848 } else { 850 } else {
849 mRecheckAlarmTimer->stop(); 851 mRecheckAlarmTimer->stop();
850 } 852 }
851 //qDebug("Alarm timer started with secs: %d ", sec); 853 //qDebug("Alarm timer started with secs: %d ", sec);
852 mAlarmTimer->start( sec *1000 , true ); 854 mAlarmTimer->start( sec *1000 , true );
853 855
854} 856}
855// called by mRecheckAlarmTimer to get next alarm 857// called by mRecheckAlarmTimer to get next alarm
856// we need this, because a QTimer has only a max range of 25 days 858// we need this, because a QTimer has only a max range of 25 days
857void CalendarView::recheckTimerAlarm() 859void CalendarView::recheckTimerAlarm()
858{ 860{
859 mAlarmTimer->stop(); 861 mAlarmTimer->stop();
860 mRecheckAlarmTimer->stop(); 862 mRecheckAlarmTimer->stop();
861 mCalendar->checkAlarmForIncidence( 0, true ); 863 mCalendar->checkAlarmForIncidence( 0, true );
862} 864}
863void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 865void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
864{ 866{
865 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 867 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
866 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 868 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
867#ifndef DESKTOP_VERSION 869#ifndef DESKTOP_VERSION
868 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 870 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
869#endif 871#endif
870 return; 872 return;
871 } 873 }
872 mAlarmTimer->stop(); 874 mAlarmTimer->stop();
873} 875}
874void CalendarView::selectWeekNum ( int num ) 876void CalendarView::selectWeekNum ( int num )
875{ 877{
876 dateNavigator()->blockSignals( true ); 878 dateNavigator()->blockSignals( true );
877 dateNavigator()->selectWeek( num ); 879 dateNavigator()->selectWeek( num );
878 dateNavigator()->blockSignals( false ); 880 dateNavigator()->blockSignals( false );
879 mViewManager->showWeekView(); 881 mViewManager->showWeekView();
880} 882}
881KOViewManager *CalendarView::viewManager() 883KOViewManager *CalendarView::viewManager()
882{ 884{
883 return mViewManager; 885 return mViewManager;
884} 886}
885 887
886KODialogManager *CalendarView::dialogManager() 888KODialogManager *CalendarView::dialogManager()
887{ 889{
888 return mDialogManager; 890 return mDialogManager;
889} 891}
890 892
891QDate CalendarView::startDate() 893QDate CalendarView::startDate()
892{ 894{
893 DateList dates = mNavigator->selectedDates(); 895 DateList dates = mNavigator->selectedDates();
894 896
895 return dates.first(); 897 return dates.first();
896} 898}
897 899
898QDate CalendarView::endDate() 900QDate CalendarView::endDate()
899{ 901{
900 DateList dates = mNavigator->selectedDates(); 902 DateList dates = mNavigator->selectedDates();
901 903
902 return dates.last(); 904 return dates.last();
903} 905}
904 906
905 907
906void CalendarView::createPrinter() 908void CalendarView::createPrinter()
907{ 909{
908#ifndef KORG_NOPRINTER 910#ifndef KORG_NOPRINTER
909 if (!mCalPrinter) { 911 if (!mCalPrinter) {
910 mCalPrinter = new CalPrinter(this, mCalendar); 912 mCalPrinter = new CalPrinter(this, mCalendar);
911 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 913 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
912 } 914 }
913#endif 915#endif
914} 916}
915 917
916 918
917//KOPrefs::instance()->mWriteBackFile 919//KOPrefs::instance()->mWriteBackFile
918//KOPrefs::instance()->mWriteBackExistingOnly 920//KOPrefs::instance()->mWriteBackExistingOnly
919 921
920// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 922// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
921// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 923// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
922// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 924// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
923// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 925// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
924// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 926// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
925// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 927// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
926 928
927int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 929int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
928{ 930{
929 931
930 // 0 equal 932 // 0 equal
931 // 1 take local 933 // 1 take local
932 // 2 take remote 934 // 2 take remote
933 // 3 cancel 935 // 3 cancel
934 QDateTime lastSync = mLastCalendarSync; 936 QDateTime lastSync = mLastCalendarSync;
935 QDateTime localMod = local->lastModified(); 937 QDateTime localMod = local->lastModified();
936 QDateTime remoteMod = remote->lastModified(); 938 QDateTime remoteMod = remote->lastModified();
937 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 939 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
938 bool remCh, locCh; 940 bool remCh, locCh;
939 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 941 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
940 //if ( remCh ) 942 //if ( remCh )
941 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 943 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
942 locCh = ( localMod > mLastCalendarSync ); 944 locCh = ( localMod > mLastCalendarSync );
943 if ( !remCh && ! locCh ) { 945 if ( !remCh && ! locCh ) {
944 //qDebug("both not changed "); 946 //qDebug("both not changed ");
945 lastSync = localMod.addDays(1); 947 lastSync = localMod.addDays(1);
946 if ( mode <= SYNC_PREF_ASK ) 948 if ( mode <= SYNC_PREF_ASK )
947 return 0; 949 return 0;
948 } else { 950 } else {
949 if ( locCh ) { 951 if ( locCh ) {
950 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 952 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
951 lastSync = localMod.addDays( -1 ); 953 lastSync = localMod.addDays( -1 );
952 if ( !remCh ) 954 if ( !remCh )
953 remoteMod = ( lastSync.addDays( -1 ) ); 955 remoteMod = ( lastSync.addDays( -1 ) );
954 } else { 956 } else {
955 //qDebug(" not loc changed "); 957 //qDebug(" not loc changed ");
956 lastSync = localMod.addDays( 1 ); 958 lastSync = localMod.addDays( 1 );
957 if ( remCh ) 959 if ( remCh )
958 remoteMod =( lastSync.addDays( 1 ) ); 960 remoteMod =( lastSync.addDays( 1 ) );
959 961
960 } 962 }
961 } 963 }
962 full = true; 964 full = true;
963 if ( mode < SYNC_PREF_ASK ) 965 if ( mode < SYNC_PREF_ASK )
964 mode = SYNC_PREF_ASK; 966 mode = SYNC_PREF_ASK;
965 } else { 967 } else {
966 if ( localMod == remoteMod ) 968 if ( localMod == remoteMod )
967 // if ( local->revision() == remote->revision() ) 969 // if ( local->revision() == remote->revision() )
968 return 0; 970 return 0;
969 971
970 } 972 }
971 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 973 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
972 974
973 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 975 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
974 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 976 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
975 //full = true; //debug only 977 //full = true; //debug only
976 if ( full ) { 978 if ( full ) {
977 bool equ = false; 979 bool equ = false;
978 if ( local->typeID() == eventID ) { 980 if ( local->typeID() == eventID ) {
979 equ = (*((Event*) local) == *((Event*) remote)); 981 equ = (*((Event*) local) == *((Event*) remote));
980 } 982 }
981 else if ( local->typeID() == todoID ) 983 else if ( local->typeID() == todoID )
982 equ = (*((Todo*) local) == (*(Todo*) remote)); 984 equ = (*((Todo*) local) == (*(Todo*) remote));
983 else if ( local->typeID() == journalID ) 985 else if ( local->typeID() == journalID )
984 equ = (*((Journal*) local) == *((Journal*) remote)); 986 equ = (*((Journal*) local) == *((Journal*) remote));
985 if ( equ ) { 987 if ( equ ) {
986 //qDebug("equal "); 988 //qDebug("equal ");
987 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 989 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
988 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 990 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
989 } 991 }
990 if ( mode < SYNC_PREF_FORCE_LOCAL ) 992 if ( mode < SYNC_PREF_FORCE_LOCAL )
991 return 0; 993 return 0;
992 994
993 }//else //debug only 995 }//else //debug only
994 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 996 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
995 } 997 }
996 int result; 998 int result;
997 bool localIsNew; 999 bool localIsNew;
998 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 1000 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
999 1001
1000 1002
1001 // ************************************************ 1003 // ************************************************
1002 // ************************************************ 1004 // ************************************************
1003 // ************************************************ 1005 // ************************************************
1004 // We may have that lastSync > remoteMod AND lastSync > localMod 1006 // We may have that lastSync > remoteMod AND lastSync > localMod
1005 // BUT remoteMod != localMod 1007 // BUT remoteMod != localMod
1006 1008
1007 1009
1008 if ( full && mode < SYNC_PREF_NEWEST ) 1010 if ( full && mode < SYNC_PREF_NEWEST )
1009 mode = SYNC_PREF_ASK; 1011 mode = SYNC_PREF_ASK;
1010 1012
1011 switch( mode ) { 1013 switch( mode ) {
1012 case SYNC_PREF_LOCAL: 1014 case SYNC_PREF_LOCAL:
1013 if ( lastSync > remoteMod ) 1015 if ( lastSync > remoteMod )
1014 return 1; 1016 return 1;
1015 if ( lastSync > localMod ) 1017 if ( lastSync > localMod )
1016 return 2; 1018 return 2;
1017 return 1; 1019 return 1;
1018 break; 1020 break;
1019 case SYNC_PREF_REMOTE: 1021 case SYNC_PREF_REMOTE:
1020 if ( lastSync > localMod ) 1022 if ( lastSync > localMod )
1021 return 2; 1023 return 2;
1022 if ( lastSync > remoteMod ) 1024 if ( lastSync > remoteMod )
1023 return 1; 1025 return 1;
1024 return 2; 1026 return 2;
1025 break; 1027 break;
1026 case SYNC_PREF_NEWEST: 1028 case SYNC_PREF_NEWEST:
1027 if ( localMod >= remoteMod ) 1029 if ( localMod >= remoteMod )