summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-11 05:36:14 (UTC)
committer zautrix <zautrix>2005-02-11 05:36:14 (UTC)
commit0c1191e3253542b4858261241975c159ee7910c6 (patch) (unidiff)
treebe97b6665d130f0b72db82005726fbf7cc030abb
parent38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940 (diff)
downloadkdepimpi-0c1191e3253542b4858261241975c159ee7910c6.zip
kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.tar.gz
kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.tar.bz2
font fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/ContentLine.cpp8
-rw-r--r--kaddressbook/kabprefs.cpp1
-rw-r--r--kaddressbook/mainembedded.cpp1
-rw-r--r--kmicromail/main.cpp4
-rw-r--r--korganizer/main.cpp2
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp33
-rw-r--r--libkdepim/kpimglobalprefs.cpp3
-rw-r--r--libkdepim/kpimglobalprefs.h1
-rw-r--r--microkde/kglobalsettings.cpp2
-rw-r--r--pwmanager/pwmanager/main.cpp1
11 files changed, 48 insertions, 14 deletions
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp
index 2f88cde..0a2f97d 100644
--- a/kabc/vcard/ContentLine.cpp
+++ b/kabc/vcard/ContentLine.cpp
@@ -1,349 +1,355 @@
1/* 1/*
2 libvcard - vCard parsing library for vCard version 3.0 2 libvcard - vCard parsing library for vCard version 3.0
3 3
4 Copyright (C) 1999 Rik Hemsley rik@kde.org 4 Copyright (C) 1999 Rik Hemsley rik@kde.org
5 5
6 Permission is hereby granted, free of charge, to any person obtaining a copy 6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to 7 of this software and associated documentation files (the "Software"), to
8 deal in the Software without restriction, including without limitation the 8 deal in the Software without restriction, including without limitation the
9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 sell copies of the Software, and to permit persons to whom the Software is 10 sell copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions: 11 furnished to do so, subject to the following conditions:
12 12
13 The above copyright notice and this permission notice shall be included in 13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software. 14 all copies or substantial portions of the Software.
15 15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*/ 22*/
23 23
24#include <qcstring.h> 24#include <qcstring.h>
25#include <qstrlist.h> 25#include <qstrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27 27
28#include <kdebug.h> 28#include <kdebug.h>
29 29
30#include <VCardAdrParam.h> 30#include <VCardAdrParam.h>
31#include <VCardAgentParam.h> 31#include <VCardAgentParam.h>
32#include <VCardDateParam.h> 32#include <VCardDateParam.h>
33#include <VCardEmailParam.h> 33#include <VCardEmailParam.h>
34#include <VCardImageParam.h> 34#include <VCardImageParam.h>
35#include <VCardSourceParam.h> 35#include <VCardSourceParam.h>
36#include <VCardTelParam.h> 36#include <VCardTelParam.h>
37#include <VCardTextBinParam.h> 37#include <VCardTextBinParam.h>
38#include <VCardTextParam.h> 38#include <VCardTextParam.h>
39 39
40#include <VCardAdrValue.h> 40#include <VCardAdrValue.h>
41#include <VCardAgentValue.h> 41#include <VCardAgentValue.h>
42#include <VCardDateValue.h> 42#include <VCardDateValue.h>
43#include <VCardImageValue.h> 43#include <VCardImageValue.h>
44#include <VCardTextValue.h> 44#include <VCardTextValue.h>
45#include <VCardTextBinValue.h> 45#include <VCardTextBinValue.h>
46#include <VCardLangValue.h> 46#include <VCardLangValue.h>
47#include <VCardNValue.h> 47#include <VCardNValue.h>
48#include <VCardURIValue.h> 48#include <VCardURIValue.h>
49#include <VCardSoundValue.h> 49#include <VCardSoundValue.h>
50#include <VCardClassValue.h> 50#include <VCardClassValue.h>
51#include <VCardFloatValue.h> 51#include <VCardFloatValue.h>
52#include <VCardOrgValue.h> 52#include <VCardOrgValue.h>
53#include <VCardTelValue.h> 53#include <VCardTelValue.h>
54#include <VCardTextListValue.h> 54#include <VCardTextListValue.h>
55#include <VCardUTCValue.h> 55#include <VCardUTCValue.h>
56#include <VCardGeoValue.h> 56#include <VCardGeoValue.h>
57 57
58#include <VCardRToken.h> 58#include <VCardRToken.h>
59#include <VCardContentLine.h> 59#include <VCardContentLine.h>
60 60
61#include <VCardEntity.h> 61#include <VCardEntity.h>
62#include <VCardEnum.h> 62#include <VCardEnum.h>
63#include <VCardDefines.h> 63#include <VCardDefines.h>
64 64
65using namespace VCARD; 65using namespace VCARD;
66 66
67ContentLine::ContentLine() 67ContentLine::ContentLine()
68 :Entity(), 68 :Entity(),
69 value_(0), 69 value_(0),
70 paramType_( ParamUnknown ), 70 paramType_( ParamUnknown ),
71 valueType_( ValueUnknown ), 71 valueType_( ValueUnknown ),
72 entityType_( EntityUnknown ) 72 entityType_( EntityUnknown )
73{ 73{
74 paramList_.setAutoDelete( TRUE ); 74 paramList_.setAutoDelete( TRUE );
75} 75}
76 76
77ContentLine::ContentLine(const ContentLine & x) 77ContentLine::ContentLine(const ContentLine & x)
78 :Entity(x), 78 :Entity(x),
79 group_ (x.group_), 79 group_ (x.group_),
80 name_ (x.name_), 80 name_ (x.name_),
81 /*US paramList_(x.paramList_),*/ 81 /*US paramList_(x.paramList_),*/
82 value_(x.value_->clone()), 82 value_(x.value_->clone()),
83 paramType_(x.paramType_), 83 paramType_(x.paramType_),
84 valueType_(x.valueType_), 84 valueType_(x.valueType_),
85 entityType_(x.entityType_) 85 entityType_(x.entityType_)
86{ 86{
87 paramList_.setAutoDelete( TRUE ); 87 paramList_.setAutoDelete( TRUE );
88 88
89 89
90 ParamListIterator it(x.paramList_); 90 ParamListIterator it(x.paramList_);
91 for (; it.current(); ++it) 91 for (; it.current(); ++it)
92 { 92 {
93 Param *p = new Param; 93 Param *p = new Param;
94 p->setName( it.current()->name() ); 94 p->setName( it.current()->name() );
95 p->setValue( it.current()->value() ); 95 p->setValue( it.current()->value() );
96 paramList_.append(p); 96 paramList_.append(p);
97 } 97 }
98 98
99} 99}
100 100
101ContentLine::ContentLine(const QCString & s) 101ContentLine::ContentLine(const QCString & s)
102 :Entity(s), 102 :Entity(s),
103 value_(0), 103 value_(0),
104 paramType_( ParamUnknown ), 104 paramType_( ParamUnknown ),
105 valueType_( ValueUnknown ), 105 valueType_( ValueUnknown ),
106 entityType_( EntityUnknown ) 106 entityType_( EntityUnknown )
107{ 107{
108 paramList_.setAutoDelete( TRUE ); 108 paramList_.setAutoDelete( TRUE );
109} 109}
110 110
111 ContentLine & 111 ContentLine &
112ContentLine::operator = (ContentLine & x) 112ContentLine::operator = (ContentLine & x)
113{ 113{
114 if (*this == x) return *this; 114 if (*this == x) return *this;
115 115
116 ParamListIterator it(x.paramList_); 116 ParamListIterator it(x.paramList_);
117 for (; it.current(); ++it) 117 for (; it.current(); ++it)
118 { 118 {
119 Param *p = new Param; 119 Param *p = new Param;
120 p->setName( it.current()->name() ); 120 p->setName( it.current()->name() );
121 p->setValue( it.current()->value() ); 121 p->setValue( it.current()->value() );
122 paramList_.append(p); 122 paramList_.append(p);
123 } 123 }
124 124
125 value_ = x.value_->clone(); 125 value_ = x.value_->clone();
126 126
127 Entity::operator = (x); 127 Entity::operator = (x);
128 return *this; 128 return *this;
129} 129}
130 130
131 ContentLine & 131 ContentLine &
132ContentLine::operator = (const QCString & s) 132ContentLine::operator = (const QCString & s)
133{ 133{
134 Entity::operator = (s); 134 Entity::operator = (s);
135 delete value_; 135 delete value_;
136 value_ = 0; 136 value_ = 0;
137 return *this; 137 return *this;
138} 138}
139 139
140 bool 140 bool
141ContentLine::operator == (ContentLine & x) 141ContentLine::operator == (ContentLine & x)
142{ 142{
143 x.parse(); 143 x.parse();
144 144
145 QPtrListIterator<Param> it(x.paramList()); 145 QPtrListIterator<Param> it(x.paramList());
146 146
147 if (!paramList_.find(it.current())) 147 if (!paramList_.find(it.current()))
148 return false; 148 return false;
149 149
150 return true; 150 return true;
151} 151}
152 152
153ContentLine::~ContentLine() 153ContentLine::~ContentLine()
154{ 154{
155 delete value_; 155 delete value_;
156 value_ = 0; 156 value_ = 0;
157} 157}
158 158
159 void 159 void
160ContentLine::_parse() 160ContentLine::_parse()
161{ 161{
162 vDebug("parse"); 162 vDebug("parse");
163 163
164 // Unqote newlines 164 // Unfold folded lines
165 // NLR
166 strRep_ = strRep_.replace( QRegExp( "\\r" ), "" );
167 // Unqote newlines
165 strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); 168 strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" );
169 //NLR
170 strRep_ = strRep_.replace( QRegExp( "\\\\r" ), "\r" );
166 171
167 int split = strRep_.find(':'); 172 int split = strRep_.find(':');
168 173
169 if (split == -1) { // invalid content line 174 if (split == -1) { // invalid content line
170 vDebug("No ':'"); 175 vDebug("No ':'");
171 return; 176 return;
172 } 177 }
173 178
174 QCString firstPart(strRep_.left(split)); 179 QCString firstPart(strRep_.left(split));
175 QCString valuePart(strRep_.mid(split + 1)); 180 QCString valuePart(strRep_.mid(split + 1));
176 181
177 split = firstPart.find('.'); 182 split = firstPart.find('.');
178 183
179 if (split != -1) { 184 if (split != -1) {
180 group_ = firstPart.left(split); 185 group_ = firstPart.left(split);
181 firstPart= firstPart.mid(split + 1); 186 firstPart= firstPart.mid(split + 1);
182 } 187 }
183 188
184 vDebug("Group == " + group_); 189 vDebug("Group == " + group_);
185 vDebug("firstPart == " + firstPart); 190 vDebug("firstPart == " + firstPart);
186 vDebug("valuePart == " + valuePart); 191 vDebug("valuePart == " + valuePart);
187 192
188 // Now we have the group, the name and param list together and the value. 193 // Now we have the group, the name and param list together and the value.
189 194
190 QStrList l; 195 QStrList l;
191 196
192 RTokenise(firstPart, ";", l); 197 RTokenise(firstPart, ";", l);
193 198
194 if (l.count() == 0) {// invalid - no name ! 199 if (l.count() == 0) {// invalid - no name !
195 vDebug("No name for this content line !"); 200 vDebug("No name for this content line !");
196 return; 201 return;
197 } 202 }
198 203
199 name_ = l.at(0); 204 name_ = l.at(0);
200 205
201 // Now we have the name, so the rest of 'l' is the params. 206 // Now we have the name, so the rest of 'l' is the params.
202 // Remove the name part. 207 // Remove the name part.
203 l.remove(0u); 208 l.remove(0u);
204 209
205 entityType_= EntityNameToEntityType(name_); 210 entityType_= EntityNameToEntityType(name_);
206 paramType_= EntityTypeToParamType(entityType_); 211 paramType_= EntityTypeToParamType(entityType_);
207 212
208 unsigned int i = 0; 213 unsigned int i = 0;
209 214
210 // For each parameter, create a new parameter of the correct type. 215 // For each parameter, create a new parameter of the correct type.
211 216
212 QStrListIterator it(l); 217 QStrListIterator it(l);
213 218
214 for (; it.current(); ++it, i++) { 219 for (; it.current(); ++it, i++) {
215 220
216 QCString str = *it; 221 QCString str = *it;
217 222
218 split = str.find("="); 223 split = str.find("=");
219 if (split < 0 ) { 224 if (split < 0 ) {
220 vDebug("No '=' in paramter."); 225 vDebug("No '=' in paramter.");
221 continue; 226 continue;
222 } 227 }
223 228
224 QCString paraName = str.left(split); 229 QCString paraName = str.left(split);
225 QCString paraValue = str.mid(split + 1); 230 QCString paraValue = str.mid(split + 1);
226 231
227 QStrList paraValues; 232 QStrList paraValues;
228 RTokenise(paraValue, ",", paraValues); 233 RTokenise(paraValue, ",", paraValues);
229 234
230 QStrListIterator it2( paraValues ); 235 QStrListIterator it2( paraValues );
231 236
232 for(; it2.current(); ++it2) { 237 for(; it2.current(); ++it2) {
233 238
234 Param *p = new Param; 239 Param *p = new Param;
235 p->setName( paraName ); 240 p->setName( paraName );
236 p->setValue( *it2 ); 241 p->setValue( *it2 );
237 242
238 paramList_.append(p); 243 paramList_.append(p);
239 } 244 }
240 } 245 }
241 246
242 // Create a new value of the correct type. 247 // Create a new value of the correct type.
243 248
244 valueType_ = EntityTypeToValueType(entityType_); 249 valueType_ = EntityTypeToValueType(entityType_);
245 250
246 //kdDebug(5710) << "valueType: " << valueType_ << endl; 251 //kdDebug(5710) << "valueType: " << valueType_ << endl;
247 252
248 switch (valueType_) { 253 switch (valueType_) {
249 254
250 case ValueSound: value_ = new SoundValue;break; 255 case ValueSound: value_ = new SoundValue;break;
251 case ValueAgent: value_ = new AgentValue;break; 256 case ValueAgent: value_ = new AgentValue;break;
252 case ValueAddress: value_ = new AdrValue; break; 257 case ValueAddress: value_ = new AdrValue; break;
253 case ValueTel: value_ = new TelValue; break; 258 case ValueTel: value_ = new TelValue; break;
254 case ValueTextBin: value_ = new TextBinValue;break; 259 case ValueTextBin: value_ = new TextBinValue;break;
255 case ValueOrg: value_ = new OrgValue; break; 260 case ValueOrg: value_ = new OrgValue; break;
256 case ValueN: value_ = new NValue; break; 261 case ValueN: value_ = new NValue; break;
257 case ValueUTC: value_ = new UTCValue; break; 262 case ValueUTC: value_ = new UTCValue; break;
258 case ValueURI: value_ = new URIValue; break; 263 case ValueURI: value_ = new URIValue; break;
259 case ValueClass: value_ = new ClassValue;break; 264 case ValueClass: value_ = new ClassValue;break;
260 case ValueFloat: value_ = new FloatValue;break; 265 case ValueFloat: value_ = new FloatValue;break;
261 case ValueImage: value_ = new ImageValue;break; 266 case ValueImage: value_ = new ImageValue;break;
262 case ValueDate: value_ = new DateValue; break; 267 case ValueDate: value_ = new DateValue; break;
263 case ValueTextList: value_ = new TextListValue;break; 268 case ValueTextList: value_ = new TextListValue;break;
264 case ValueGeo: value_ = new GeoValue; break; 269 case ValueGeo: value_ = new GeoValue; break;
265 case ValueText: 270 case ValueText:
266 case ValueUnknown: 271 case ValueUnknown:
267 default: value_ = new TextValue; break; 272 default: value_ = new TextValue; break;
268 } 273 }
269 274
270 *value_ = valuePart; 275 *value_ = valuePart;
271} 276}
272 277
273 void 278 void
274ContentLine::_assemble() 279ContentLine::_assemble()
275{ 280{
276 //strRep_.truncate(0); 281 //strRep_.truncate(0);
277 QString line; 282 QString line;
278 if (!group_.isEmpty()) 283 if (!group_.isEmpty())
279 line = group_ + '.'; 284 line = group_ + '.';
280 line += name_; 285 line += name_;
281 ParamListIterator it(paramList_); 286 ParamListIterator it(paramList_);
282 for (; it.current(); ++it) 287 for (; it.current(); ++it)
283 line += ";" + it.current()->asString(); 288 line += ";" + it.current()->asString();
284 289
285 if (value_ != 0) 290 if (value_ != 0)
286 line += ":" + value_->asString(); 291 line += ":" + value_->asString();
287 292
293 line = line.replace( QRegExp( "\r" ), "\\r" );
288 line = line.replace( QRegExp( "\n" ), "\\n" ); 294 line = line.replace( QRegExp( "\n" ), "\\n" );
289 295
290 // Fold lines longer than 72 chars 296 // Fold lines longer than 72 chars
291 const int maxLen = 72; 297 const int maxLen = 72;
292 uint cursor = 0; 298 uint cursor = 0;
293 QString cut; 299 QString cut;
294 while( line.length() > ( cursor + 1 ) * maxLen ) { 300 while( line.length() > ( cursor + 1 ) * maxLen ) {
295 cut += line.mid( cursor * maxLen, maxLen ); 301 cut += line.mid( cursor * maxLen, maxLen );
296 cut += "\r\n "; 302 cut += "\r\n ";
297 ++cursor; 303 ++cursor;
298 } 304 }
299 cut += line.mid( cursor * maxLen ); 305 cut += line.mid( cursor * maxLen );
300 strRep_ = cut.latin1(); 306 strRep_ = cut.latin1();
301 //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); 307 //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
302#if 0 308#if 0
303 vDebug("Assemble (argl) - my name is \"" + name_ + "\""); 309 vDebug("Assemble (argl) - my name is \"" + name_ + "\"");
304 strRep_.truncate(0); 310 strRep_.truncate(0);
305 311
306 QCString line; 312 QCString line;
307 313
308 if (!group_.isEmpty()) 314 if (!group_.isEmpty())
309 line += group_ + '.'; 315 line += group_ + '.';
310 316
311 line += name_; 317 line += name_;
312 318
313 vDebug("Adding parameters"); 319 vDebug("Adding parameters");
314 ParamListIterator it(paramList_); 320 ParamListIterator it(paramList_);
315 321
316 for (; it.current(); ++it) 322 for (; it.current(); ++it)
317 line += ";" + it.current()->asString(); 323 line += ";" + it.current()->asString();
318 324
319 vDebug("Adding value"); 325 vDebug("Adding value");
320 if (value_ != 0) 326 if (value_ != 0)
321 line += ":" + value_->asString(); 327 line += ":" + value_->asString();
322 else 328 else
323 vDebug("No value"); 329 vDebug("No value");
324 330
325 // Quote newlines 331 // Quote newlines
326 line = line.replace( QRegExp( "\n" ), "\\n" ); 332 line = line.replace( QRegExp( "\n" ), "\\n" );
327 333
328 // Fold lines longer than 72 chars 334 // Fold lines longer than 72 chars
329 const int maxLen = 72; 335 const int maxLen = 72;
330 uint cursor = 0; 336 uint cursor = 0;
331 while( line.length() > ( cursor + 1 ) * maxLen ) { 337 while( line.length() > ( cursor + 1 ) * maxLen ) {
332 strRep_ += line.mid( cursor * maxLen, maxLen ); 338 strRep_ += line.mid( cursor * maxLen, maxLen );
333 strRep_ += "\r\n "; 339 strRep_ += "\r\n ";
334 ++cursor; 340 ++cursor;
335 } 341 }
336 strRep_ += line.mid( cursor * maxLen ); 342 strRep_ += line.mid( cursor * maxLen );
337 qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); 343 qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
338#endif 344#endif
339} 345}
340 346
341 void 347 void
342ContentLine::clear() 348ContentLine::clear()
343{ 349{
344 group_.truncate(0); 350 group_.truncate(0);
345 name_.truncate(0); 351 name_.truncate(0);
346 paramList_.clear(); 352 paramList_.clear();
347 delete value_; 353 delete value_;
348 value_ = 0; 354 value_ = 0;
349} 355}
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 01e84d0..b96d28a 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,155 +1,154 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qregexp.h> 30#include <qregexp.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <libkdepim/kpimglobalprefs.h> 32#include <libkdepim/kpimglobalprefs.h>
33 33
34#include <kconfig.h> 34#include <kconfig.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kstaticdeleter.h> 36#include <kstaticdeleter.h>
37#include <kglobalsettings.h> 37#include <kglobalsettings.h>
38//US#include <kdebug.h> // defines kdDebug() 38//US#include <kdebug.h> // defines kdDebug()
39 39
40#include "kabprefs.h" 40#include "kabprefs.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43#include <qapplication.h> 43#include <qapplication.h>
44#endif 44#endif
45 45
46KABPrefs *KABPrefs::sInstance = 0; 46KABPrefs *KABPrefs::sInstance = 0;
47static KStaticDeleter<KABPrefs> staticDeleterAB; 47static KStaticDeleter<KABPrefs> staticDeleterAB;
48 48
49KABPrefs::KABPrefs() 49KABPrefs::KABPrefs()
50 : KPimPrefs("kaddressbookrc") 50 : KPimPrefs("kaddressbookrc")
51{ 51{
52 KPrefs::setCurrentGroup( "Views" ); 52 KPrefs::setCurrentGroup( "Views" );
53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
54 54
55 KPrefs::setCurrentGroup( "General" ); 55 KPrefs::setCurrentGroup( "General" );
56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
58
59#ifdef KAB_EMBEDDED 58#ifdef KAB_EMBEDDED
60 addItemBool("AskForQuit",&mAskForQuit,true); 59 addItemBool("AskForQuit",&mAskForQuit,true);
61 addItemBool("ToolBarHor",&mToolBarHor, true ); 60 addItemBool("ToolBarHor",&mToolBarHor, true );
62 addItemBool("ToolBarUp",&mToolBarUp, false ); 61 addItemBool("ToolBarUp",&mToolBarUp, false );
63 addItemBool("SearchWithReturn",&mSearchWithReturn, false ); 62 addItemBool("SearchWithReturn",&mSearchWithReturn, false );
64 addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); 63 addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont());
65 64
66 65
67#endif //KAB_EMBEDDED 66#endif //KAB_EMBEDDED
68 67
69 KPrefs::setCurrentGroup( "MainWindow" ); 68 KPrefs::setCurrentGroup( "MainWindow" );
70 bool m_visible = false; 69 bool m_visible = false;
71#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
72 m_visible = true; 71 m_visible = true;
73#endif 72#endif
74 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); 73 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible );
75 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 74 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
76 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 75 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
77 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 76 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
78 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 77 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
79 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 78 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
80 79
81 80
82 KPrefs::setCurrentGroup( "Extensions_General" ); 81 KPrefs::setCurrentGroup( "Extensions_General" );
83 QStringList defaultExtensions; 82 QStringList defaultExtensions;
84 defaultExtensions << "merge"; 83 defaultExtensions << "merge";
85 defaultExtensions << "distribution_list_editor"; 84 defaultExtensions << "distribution_list_editor";
86 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 85 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
87 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 86 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
88 87
89 KPrefs::setCurrentGroup( "Views" ); 88 KPrefs::setCurrentGroup( "Views" );
90 QString defaultView = i18n( "Default Table View" ); 89 QString defaultView = i18n( "Default Table View" );
91 addItemString( "CurrentView", &mCurrentView, defaultView ); 90 addItemString( "CurrentView", &mCurrentView, defaultView );
92 addItemStringList( "ViewNames", &mViewNames, defaultView ); 91 addItemStringList( "ViewNames", &mViewNames, defaultView );
93 92
94 KPrefs::setCurrentGroup( "Filters" ); 93 KPrefs::setCurrentGroup( "Filters" );
95 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 94 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
96 95
97} 96}
98 97
99KABPrefs::~KABPrefs() 98KABPrefs::~KABPrefs()
100{ 99{
101 //qDebug("KABPrefs::~KABPrefs() "); 100 //qDebug("KABPrefs::~KABPrefs() ");
102 if (sInstance == this) 101 if (sInstance == this)
103 sInstance = staticDeleterAB.setObject(0); 102 sInstance = staticDeleterAB.setObject(0);
104} 103}
105 104
106KABPrefs *KABPrefs::instance() 105KABPrefs *KABPrefs::instance()
107{ 106{
108 if ( !sInstance ) { 107 if ( !sInstance ) {
109#ifdef KAB_EMBEDDED 108#ifdef KAB_EMBEDDED
110 sInstance = staticDeleterAB.setObject( new KABPrefs() ); 109 sInstance = staticDeleterAB.setObject( new KABPrefs() );
111#else //KAB_EMBEDDED 110#else //KAB_EMBEDDED
112 //US the following line has changed ???. Why 111 //US the following line has changed ???. Why
113 staticDeleterAB.setObject( sInstance, new KABPrefs() ); 112 staticDeleterAB.setObject( sInstance, new KABPrefs() );
114#endif //KAB_EMBEDDED 113#endif //KAB_EMBEDDED
115 sInstance->readConfig(); 114 sInstance->readConfig();
116 } 115 }
117 116
118 return sInstance; 117 return sInstance;
119} 118}
120 119
121void KABPrefs::setCategoryDefaults() 120void KABPrefs::setCategoryDefaults()
122{ 121{
123 mCustomCategories.clear(); 122 mCustomCategories.clear();
124 123
125 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 124 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
126 << i18n( "Customer" ) << i18n( "Friend" ); 125 << i18n( "Customer" ) << i18n( "Friend" );
127} 126}
128 127
129 // US introduce a nonconst way to return the config object. 128 // US introduce a nonconst way to return the config object.
130KConfig* KABPrefs::getConfig() 129KConfig* KABPrefs::getConfig()
131{ 130{
132 return config(); 131 return config();
133} 132}
134void KABPrefs::usrReadConfig() 133void KABPrefs::usrReadConfig()
135{ 134{
136 KPimPrefs::usrReadConfig(); 135 KPimPrefs::usrReadConfig();
137} 136}
138 137
139 138
140/*US 139/*US
141void KABPrefs::usrSetDefaults() 140void KABPrefs::usrSetDefaults()
142{ 141{
143 KPimPrefs::usrSetDefaults(); 142 KPimPrefs::usrSetDefaults();
144} 143}
145 144
146void KABPrefs::usrReadConfig() 145void KABPrefs::usrReadConfig()
147{ 146{
148 KPimPrefs::usrReadConfig(); 147 KPimPrefs::usrReadConfig();
149} 148}
150 149
151void KABPrefs::usrWriteConfig() 150void KABPrefs::usrWriteConfig()
152{ 151{
153 KPimPrefs::usrWriteConfig(); 152 KPimPrefs::usrWriteConfig();
154} 153}
155*/ 154*/
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index d9968f3..336e350 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,102 +1,103 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#else 5#else
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
8#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
9#include <qmainwindow.h> 9#include <qmainwindow.h>
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <stdlib.h> 11#include <stdlib.h>
12#endif 12#endif
13 13
14#include <qtextcodec.h> 14#include <qtextcodec.h>
15#include <kstandarddirs.h> 15#include <kstandarddirs.h>
16#include <qregexp.h> 16#include <qregexp.h>
17#include <kglobal.h> 17#include <kglobal.h>
18#include <stdio.h> 18#include <stdio.h>
19#include <qdir.h> 19#include <qdir.h>
20#include "kabprefs.h" 20#include "kabprefs.h"
21#include "kaddressbookmain.h" 21#include "kaddressbookmain.h"
22#include "externalapphandler.h" 22#include "externalapphandler.h"
23#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
24void dumpMissing(); 24void dumpMissing();
25int main( int argc, char **argv ) 25int main( int argc, char **argv )
26{ 26{
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
29 a.setKeepRunning (); 29 a.setKeepRunning ();
30#else 30#else
31 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
32 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
33#ifdef _WIN32_ 33#ifdef _WIN32_
34 QString hdir ( getenv( "HOME") ); 34 QString hdir ( getenv( "HOME") );
35 if ( hdir.isEmpty() ) { 35 if ( hdir.isEmpty() ) {
36 QString hd ("C:/" ); 36 QString hd ("C:/" );
37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
38 if ( QDir::homeDirPath().lower() == hd.lower() ) { 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
39 _putenv( "HOME=C:"); 39 _putenv( "HOME=C:");
40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
41 } 41 }
42 } else { 42 } else {
43 QDir app_dir; 43 QDir app_dir;
44 if ( !app_dir.exists(hdir) ) 44 if ( !app_dir.exists(hdir) )
45 app_dir.mkdir (hdir); 45 app_dir.mkdir (hdir);
46 } 46 }
47#endif 47#endif
48#endif 48#endif
49 49
50 bool exitHelp = false; 50 bool exitHelp = false;
51 if ( argc > 1 ) { 51 if ( argc > 1 ) {
52 QString command = argv[1]; 52 QString command = argv[1];
53 if ( command == "-help" ){ 53 if ( command == "-help" ){
54 printf("KA/E command line commands:\n"); 54 printf("KA/E command line commands:\n");
55 printf(" no command: Start KA/E in usual way\n"); 55 printf(" no command: Start KA/E in usual way\n");
56 printf(" -help: This output\n"); 56 printf(" -help: This output\n");
57 printf(" KA/E is exiting now. Bye!\n"); 57 printf(" KA/E is exiting now. Bye!\n");
58 exitHelp = true; 58 exitHelp = true;
59 } 59 }
60 } 60 }
61 if ( ! exitHelp ) { 61 if ( ! exitHelp ) {
62 62
63 KGlobal::setAppName( "kaddressbook" ); 63 KGlobal::setAppName( "kaddressbook" );
64#ifndef DESKTOP_VERSION 64#ifndef DESKTOP_VERSION
65 if ( QApplication::desktop()->width() > 320 ) 65 if ( QApplication::desktop()->width() > 320 )
66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
67 else 67 else
68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
69#else 69#else
70 QString fileName ; 70 QString fileName ;
71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
73 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 73 QApplication::addLibraryPath ( qApp->applicationDirPath () );
74 74
75#endif 75#endif
76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
77 // init language 77 // init language
78 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
79 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
79 KAddressBookMain m ; 80 KAddressBookMain m ;
80//US MainWindow m; 81//US MainWindow m;
81#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
82 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 83 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
83#endif 84#endif
84 85
85 86
86#ifndef DESKTOP_VERSION 87#ifndef DESKTOP_VERSION
87 a.showMainWidget( &m ); 88 a.showMainWidget( &m );
88 89
89#else 90#else
90 a.setMainWidget( &m ); 91 a.setMainWidget( &m );
91 m.resize (640, 480 ); 92 m.resize (640, 480 );
92 m.show(); 93 m.show();
93#endif 94#endif
94 a.exec(); 95 a.exec();
95 96
96 dumpMissing(); 97 dumpMissing();
97 98
98 KPimGlobalPrefs::instance()->writeConfig(); 99 KPimGlobalPrefs::instance()->writeConfig();
99 } 100 }
100 qDebug("KA: Bye! "); 101 qDebug("KA: Bye! ");
101} 102}
102 103
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 1789da0..fe4bc76 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,67 +1,69 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4#ifndef DESKTOP_VERSION 4#ifndef DESKTOP_VERSION
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <libkdepim/externalapphandler.h> 6#include <libkdepim/externalapphandler.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#endif 14#endif
15#include "opiemail.h" 15#include "opiemail.h"
16#include <qdir.h> 16#include <qdir.h>
17#include <kstandarddirs.h> 17#include <kstandarddirs.h>
18#include <kglobal.h> 18#include <kglobal.h>
19#include <stdio.h> 19#include <stdio.h>
20#include "mainwindow.h" 20#include "mainwindow.h"
21#include "koprefs.h" 21#include "koprefs.h"
22#include <libkdepim/kpimglobalprefs.h> 22#include <libkdepim/kpimglobalprefs.h>
23void dumpMissing(); 23void dumpMissing();
24//using namespace Opie::Core; 24//using namespace Opie::Core;
25int main( int argc, char **argv ) { 25int main( int argc, char **argv ) {
26 26
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
29 a.setKeepRunning (); 29 a.setKeepRunning ();
30#else 30#else
31 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
32 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
33#endif 33#endif
34 a.setFont( KOPrefs::instance()->mAppFont ); 34 //a.setFont( KOPrefs::instance()->mAppFont );
35 KGlobal::setAppName( "kopiemail" ); 35 KGlobal::setAppName( "kopiemail" );
36 QString fileName ; 36 QString fileName ;
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38 fileName = getenv("QPEDIR"); 38 fileName = getenv("QPEDIR");
39 if ( QApplication::desktop()->width() > 320 ) 39 if ( QApplication::desktop()->width() > 320 )
40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); 40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/");
41 else 41 else
42 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); 42 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/");
43#else 43#else
44 fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/"; 44 fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/";
45 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 45 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
46#endif 46#endif
47 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); 47 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail")));
48 KPimGlobalPrefs::instance()->setGlobalConfig(); 48 KPimGlobalPrefs::instance()->setGlobalConfig();
49 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
50 QApplication::setFont( KOPrefs::instance()->mAppFont );
49 OpieMail mw; 51 OpieMail mw;
50#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
51 //qDebug("CONNECT "); 53 //qDebug("CONNECT ");
52 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); 54 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
53 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 55 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
54 a.showMainWidget(&mw ); 56 a.showMainWidget(&mw );
55#else 57#else
56 a.setMainWidget(&mw ); 58 a.setMainWidget(&mw );
57 mw.show(); 59 mw.show();
58 //m.resize( 800, 600 ); 60 //m.resize( 800, 600 );
59 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 61 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
60#endif 62#endif
61 int rv = a.exec(); 63 int rv = a.exec();
62 dumpMissing(); 64 dumpMissing();
63 65
64 KPimGlobalPrefs::instance()->writeConfig(); 66 KPimGlobalPrefs::instance()->writeConfig();
65 return rv; 67 return rv;
66 68
67} 69}
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 4b207d9..ee9589c 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,110 +1,112 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#include <stdlib.h> 14#include <stdlib.h>
15#endif 15#endif
16#include <qtextcodec.h> 16#include <qtextcodec.h>
17 17
18#include <qdir.h> 18#include <qdir.h>
19#include <kstandarddirs.h> 19#include <kstandarddirs.h>
20#include <kglobal.h> 20#include <kglobal.h>
21#include <stdio.h> 21#include <stdio.h>
22#include "mainwindow.h" 22#include "mainwindow.h"
23#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
24void dumpMissing(); 24void dumpMissing();
25int main( int argc, char **argv ) 25int main( int argc, char **argv )
26{ 26{
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
29 a.setKeepRunning (); 29 a.setKeepRunning ();
30#else 30#else
31 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
32 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
33#ifdef _WIN32_ 33#ifdef _WIN32_
34 QString hdir ( getenv( "HOME") ); 34 QString hdir ( getenv( "HOME") );
35 if ( hdir.isEmpty() ) { 35 if ( hdir.isEmpty() ) {
36 QString hd ("C:/" ); 36 QString hd ("C:/" );
37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
38 if ( QDir::homeDirPath().lower() == hd.lower() ) { 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
39 _putenv( "HOME=C:"); 39 _putenv( "HOME=C:");
40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
41 } 41 }
42 } else { 42 } else {
43 QDir app_dir; 43 QDir app_dir;
44 if ( !app_dir.exists(hdir) ) 44 if ( !app_dir.exists(hdir) )
45 app_dir.mkdir (hdir); 45 app_dir.mkdir (hdir);
46 } 46 }
47#endif 47#endif
48#endif 48#endif
49 bool exitHelp = false; 49 bool exitHelp = false;
50 if ( argc > 1 ) { 50 if ( argc > 1 ) {
51 QString command = argv[1]; 51 QString command = argv[1];
52 if ( command == "-help" ){ 52 if ( command == "-help" ){
53 printf("KO/Pi command line commands:\n"); 53 printf("KO/Pi command line commands:\n");
54 printf(" no command: Start KO/Pi in usual way\n"); 54 printf(" no command: Start KO/Pi in usual way\n");
55 printf(" -help: This output\n"); 55 printf(" -help: This output\n");
56 printf("Next Option: Open or Show after start:\n"); 56 printf("Next Option: Open or Show after start:\n");
57 printf(" -newTodo: New Todo dialog\n"); 57 printf(" -newTodo: New Todo dialog\n");
58 printf(" -newEvent: New Event dialog\n"); 58 printf(" -newEvent: New Event dialog\n");
59 printf(" -showList: List view\n"); 59 printf(" -showList: List view\n");
60 printf(" -showDay: Day view\n"); 60 printf(" -showDay: Day view\n");
61 printf(" -showWWeek: Work Week view\n"); 61 printf(" -showWWeek: Work Week view\n");
62 printf(" -showWeek: Week view\n"); 62 printf(" -showWeek: Week view\n");
63 printf(" -showTodo: Todo view\n"); 63 printf(" -showTodo: Todo view\n");
64 printf(" -showJournal: Journal view\n"); 64 printf(" -showJournal: Journal view\n");
65 printf(" -showKO: Next Days view\n"); 65 printf(" -showKO: Next Days view\n");
66 printf(" -showWNext: What's Next view\n"); 66 printf(" -showWNext: What's Next view\n");
67 printf(" -showNextXView: Next X View\n"); 67 printf(" -showNextXView: Next X View\n");
68 printf(" -new[Y] and -show[X] may be used togehther\n"); 68 printf(" -new[Y] and -show[X] may be used togehther\n");
69 printf(" KO/Pi is exiting now. Bye!\n"); 69 printf(" KO/Pi is exiting now. Bye!\n");
70 exitHelp = true; 70 exitHelp = true;
71 } 71 }
72 } 72 }
73 if ( ! exitHelp ) { 73 if ( ! exitHelp ) {
74 KGlobal::setAppName( "korganizer" ); 74 KGlobal::setAppName( "korganizer" );
75 QString fileName ; 75 QString fileName ;
76#ifndef DESKTOP_VERSION 76#ifndef DESKTOP_VERSION
77 fileName = getenv("QPEDIR"); 77 fileName = getenv("QPEDIR");
78 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 78 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
79#else 79#else
80 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 80 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
81 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 81 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
82#endif 82#endif
83 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 83 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
84
85 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
84 MainWindow m; 86 MainWindow m;
85#ifndef DESKTOP_VERSION 87#ifndef DESKTOP_VERSION
86 88
87 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 89 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
88 a.showMainWidget(&m ); 90 a.showMainWidget(&m );
89#else 91#else
90 a.setMainWidget(&m ); 92 a.setMainWidget(&m );
91 m.show(); 93 m.show();
92 //m.resize( 800, 600 ); 94 //m.resize( 800, 600 );
93 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 95 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
94#endif 96#endif
95 if ( argc > 1 ) { 97 if ( argc > 1 ) {
96 QCString command = argv[1]; 98 QCString command = argv[1];
97 if ( argc > 2 ) 99 if ( argc > 2 )
98 command += argv[2]; 100 command += argv[2];
99 qApp->processEvents(); 101 qApp->processEvents();
100 m.recieve(command, QByteArray() ); 102 m.recieve(command, QByteArray() );
101 103
102 } 104 }
103 105
104 a.exec(); 106 a.exec();
105 dumpMissing(); 107 dumpMissing();
106 108
107 KPimGlobalPrefs::instance()->writeConfig(); 109 KPimGlobalPrefs::instance()->writeConfig();
108 } 110 }
109 qDebug("KO: Bye! "); 111 qDebug("KO: Bye! ");
110} 112}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 18a4b12..ab0e4d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2078 +1,2074 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136
137#ifdef DESKTOP_VERSION
138 setFont( QFont("Arial"), 14 );
139#endif
140 mClosed = false; 136 mClosed = false;
141 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
142 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
143 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
144 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
145 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
146 mBlockAtStartup = true; 142 mBlockAtStartup = true;
147 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
148 setCaption("KOrganizer/Pi"); 144 setCaption("KOrganizer/Pi");
149 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
150 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
151 if ( p->mHourSize > 22 ) 147 if ( p->mHourSize > 22 )
152 p->mHourSize = 22; 148 p->mHourSize = 22;
153 QMainWindow::ToolBarDock tbd; 149 QMainWindow::ToolBarDock tbd;
154 if ( p->mToolBarHor ) { 150 if ( p->mToolBarHor ) {
155 if ( p->mToolBarUp ) 151 if ( p->mToolBarUp )
156 tbd = Bottom; 152 tbd = Bottom;
157 else 153 else
158 tbd = Top; 154 tbd = Top;
159 } 155 }
160 else { 156 else {
161 if ( p->mToolBarUp ) 157 if ( p->mToolBarUp )
162 tbd = Right; 158 tbd = Right;
163 else 159 else
164 tbd = Left; 160 tbd = Left;
165 } 161 }
166 if ( KOPrefs::instance()->mUseAppColors ) 162 if ( KOPrefs::instance()->mUseAppColors )
167 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
168 globalFlagBlockStartup = 1; 164 globalFlagBlockStartup = 1;
169 iconToolBar = new QPEToolBar( this ); 165 iconToolBar = new QPEToolBar( this );
170 addToolBar (iconToolBar , tbd ); 166 addToolBar (iconToolBar , tbd );
171 mCalendarModifiedFlag = false; 167 mCalendarModifiedFlag = false;
172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
173 splash->setAlignment ( AlignCenter ); 169 splash->setAlignment ( AlignCenter );
174 setCentralWidget( splash ); 170 setCentralWidget( splash );
175#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
176 showMaximized(); 172 showMaximized();
177#endif 173#endif
178 174
179 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
180 setDefaultPreferences(); 176 setDefaultPreferences();
181 mCalendar = new CalendarLocal(); 177 mCalendar = new CalendarLocal();
182 mView = new CalendarView( mCalendar, this,"mCalendar " ); 178 mView = new CalendarView( mCalendar, this,"mCalendar " );
183 mView->hide(); 179 mView->hide();
184 //mView->resize(splash->size() ); 180 //mView->resize(splash->size() );
185 initActions(); 181 initActions();
186 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
187 mSyncManager->setBlockSave(false); 183 mSyncManager->setBlockSave(false);
188 mView->setSyncManager(mSyncManager); 184 mView->setSyncManager(mSyncManager);
189#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
190 iconToolBar->show(); 186 iconToolBar->show();
191 qApp->processEvents(); 187 qApp->processEvents();
192#endif 188#endif
193 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
194 int vh = height() ; 190 int vh = height() ;
195 int vw = width(); 191 int vw = width();
196 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
197 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
198 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
199 } else { 195 } else {
200 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
201 } 197 }
202 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
203 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
204 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
205 mView->readSettings(); 201 mView->readSettings();
206 bool newFile = false; 202 bool newFile = false;
207 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
208 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
209 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
210 qDebug("oldfile %s ", oldFile.latin1()); 206 qDebug("oldfile %s ", oldFile.latin1());
211 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"; 207 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";
212 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 209 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
216 qApp->processEvents(); 212 qApp->processEvents();
217 } else { 213 } else {
218 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
219 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
220 if (finfo.exists() ) { 216 if (finfo.exists() ) {
221 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
222 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
223 qApp->processEvents(); 219 qApp->processEvents();
224 } 220 }
225 } 221 }
226 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
227 newFile = true; 223 newFile = true;
228 } 224 }
229 225
230 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
231 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
232 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
233 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
234 230
235 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
236 KOPrefs::instance()->setAllDefaults(); 232 KOPrefs::instance()->setAllDefaults();
237 int count = mView->addCategories(); 233 int count = mView->addCategories();
238 } 234 }
239 processIncidenceSelection( 0 ); 235 processIncidenceSelection( 0 );
240 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
241 SLOT( processIncidenceSelection( Incidence * ) ) ); 237 SLOT( processIncidenceSelection( Incidence * ) ) );
242 connect( mView, SIGNAL( modifiedChanged( bool ) ), 238 connect( mView, SIGNAL( modifiedChanged( bool ) ),
243 SLOT( slotModifiedChanged( bool ) ) ); 239 SLOT( slotModifiedChanged( bool ) ) );
244 240
245 241
246 connect( mView, SIGNAL( tempDisableBR(bool) ), 242 connect( mView, SIGNAL( tempDisableBR(bool) ),
247 SLOT( disableBR(bool) ) ); 243 SLOT( disableBR(bool) ) );
248 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
249 mView->setModified( false ); 245 mView->setModified( false );
250 mBlockAtStartup = false; 246 mBlockAtStartup = false;
251 mView->setModified( false ); 247 mView->setModified( false );
252 setCentralWidget( mView ); 248 setCentralWidget( mView );
253 globalFlagBlockStartup = 0; 249 globalFlagBlockStartup = 0;
254 mView->show(); 250 mView->show();
255 delete splash; 251 delete splash;
256 if ( newFile ) 252 if ( newFile )
257 mView->updateConfig(); 253 mView->updateConfig();
258 // qApp->processEvents(); 254 // qApp->processEvents();
259 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
260 //fillSyncMenu(); 256 //fillSyncMenu();
261 257
262 258
263 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
264 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
265 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
266 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
267 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
268 mSyncManager->setDefaultFileName( sentSyncFile()); 264 mSyncManager->setDefaultFileName( sentSyncFile());
269 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
270 mSyncManager->fillSyncMenu(); 266 mSyncManager->fillSyncMenu();
271 267
272 268
273 269
274 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
275 if ( showWarning ) { 271 if ( showWarning ) {
276 KMessageBox::information( this, 272 KMessageBox::information( this,
277 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 273 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
278 qApp->processEvents(); 274 qApp->processEvents();
279 mView->dialogManager()->showSyncOptions(); 275 mView->dialogManager()->showSyncOptions();
280 } 276 }
281 277
282 //US listen for result adressed from Ka/Pi 278 //US listen for result adressed from Ka/Pi
283#ifndef DESKTOP_VERSION 279#ifndef DESKTOP_VERSION
284 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
285#endif 281#endif
286#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
287 infrared = 0; 283 infrared = 0;
288#endif 284#endif
289 updateWeek( mView->startDate() ); 285 updateWeek( mView->startDate() );
290 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
291 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 287 SLOT( updateWeekNum( const KCal::DateList & ) ) );
292 mBRdisabled = false; 288 mBRdisabled = false;
293 //toggleBeamReceive(); 289 //toggleBeamReceive();
294} 290}
295MainWindow::~MainWindow() 291MainWindow::~MainWindow()
296{ 292{
297 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
298 //save toolbar location 294 //save toolbar location
299 delete mCalendar; 295 delete mCalendar;
300 delete mSyncManager; 296 delete mSyncManager;
301#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
302 if ( infrared ) 298 if ( infrared )
303 delete infrared; 299 delete infrared;
304#endif 300#endif
305 301
306 302
307} 303}
308 304
309void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
310{ 306{
311#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
312 if ( b ) { 308 if ( b ) {
313 if ( infrared ) { 309 if ( infrared ) {
314 toggleBeamReceive(); 310 toggleBeamReceive();
315 mBRdisabled = true; 311 mBRdisabled = true;
316 } 312 }
317 mBRdisabled = true; 313 mBRdisabled = true;
318 } else { 314 } else {
319 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
320 mBRdisabled = false; 316 mBRdisabled = false;
321 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
322 // toggleBeamReceive(); 318 // toggleBeamReceive();
323 } 319 }
324 } 320 }
325#endif 321#endif
326 322
327} 323}
328bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
329{ 325{
330#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
331 return ( infrared != 0 ); 327 return ( infrared != 0 );
332#endif 328#endif
333 return false; 329 return false;
334} 330}
335 331
336void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
337{ 333{
338 if ( mBRdisabled ) 334 if ( mBRdisabled )
339 return; 335 return;
340#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
341 if ( infrared ) { 337 if ( infrared ) {
342 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
343 delete infrared; 339 delete infrared;
344 infrared = 0; 340 infrared = 0;
345 brAction->setOn(false); 341 brAction->setOn(false);
346 return; 342 return;
347 } 343 }
348 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
349 brAction->setOn(true); 345 brAction->setOn(true);
350 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
351 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
352#endif 348#endif
353} 349}
354void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
355{ 351{
356#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
357 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
358 if ( mClosed ) 354 if ( mClosed )
359 mView->goToday(); 355 mView->goToday();
360#endif 356#endif
361 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
362 mClosed = false; 358 mClosed = false;
363} 359}
364void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
365{ 361{
366 362
367 363
368 364
369 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
370 saveOnClose(); 366 saveOnClose();
371 mClosed = true; 367 mClosed = true;
372 ce->accept(); 368 ce->accept();
373 return; 369 return;
374 370
375 } 371 }
376 372
377 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
378 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
379 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
380 0, 0 ) ) { 376 0, 0 ) ) {
381 case 0: 377 case 0:
382 saveOnClose(); 378 saveOnClose();
383 mClosed = true; 379 mClosed = true;
384 ce->accept(); 380 ce->accept();
385 break; 381 break;
386 case 1: 382 case 1:
387 ce->ignore(); 383 ce->ignore();
388 break; 384 break;
389 case 2: 385 case 2:
390 386
391 default: 387 default:
392 break; 388 break;
393 } 389 }
394 390
395 391
396} 392}
397 393
398void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
399{ 395{
400 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
401 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
402 //QString datamess; 398 //QString datamess;
403 //qDebug("message "); 399 //qDebug("message ");
404 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
405 401
406 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
407 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
408 QString fileName; 404 QString fileName;
409 stream >> fileName; 405 stream >> fileName;
410 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
411 showMaximized(); 407 showMaximized();
412 raise(); 408 raise();
413 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
414 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
415 return; 411 return;
416 } 412 }
417 413
418 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
419 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
420 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
421 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
422 showMaximized(); 418 showMaximized();
423 raise(); 419 raise();
424 return; 420 return;
425 421
426 } 422 }
427 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
428 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
429 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
430 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
431 //showMaximized(); 427 //showMaximized();
432 //raise(); 428 //raise();
433 hide(); 429 hide();
434 return; 430 return;
435 } 431 }
436 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
437 qDebug("newCountdown "); 433 qDebug("newCountdown ");
438 434
439 } 435 }
440 QString msg ; 436 QString msg ;
441 QString allmsg = cmsg; 437 QString allmsg = cmsg;
442 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
443 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
444 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
445 msg = allmsg; 441 msg = allmsg;
446 allmsg = ""; 442 allmsg = "";
447 } else{ 443 } else{
448 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
449 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
450 } 446 }
451 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
452 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
453 mView->newEvent(); 449 mView->newEvent();
454 } 450 }
455 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
456 mView->newTodo(); 452 mView->newTodo();
457 453
458 } 454 }
459 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
460 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
461 } 457 }
462 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
463 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
464 } 460 }
465 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
466 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
467 } 463 }
468 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
469 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
470 } 466 }
471 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
472 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
473 } 469 }
474 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
475 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
476 } 472 }
477 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
478 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
479 } 475 }
480 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
481 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
482 } 478 }
483 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
484 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
485 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
486 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
487 } 483 }
488 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
489 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
490 } 486 }
491 else if ( msg == "-showWNext" || msg == "nextView()" ) { 487 else if ( msg == "-showWNext" || msg == "nextView()" ) {
492 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
493 } 489 }
494 else if ( msg == "-showNextXView" ) { 490 else if ( msg == "-showNextXView" ) {
495 mView->viewManager()->showNextXView(); 491 mView->viewManager()->showNextXView();
496 } 492 }
497 493
498 494
499 } 495 }
500 496
501 showMaximized(); 497 showMaximized();
502 raise(); 498 raise();
503} 499}
504 500
505QPixmap MainWindow::loadPixmap( QString name ) 501QPixmap MainWindow::loadPixmap( QString name )
506{ 502{
507 return SmallIcon( name ); 503 return SmallIcon( name );
508 504
509} 505}
510void MainWindow::initActions() 506void MainWindow::initActions()
511{ 507{
512 //KOPrefs::instance()->mShowFullMenu 508 //KOPrefs::instance()->mShowFullMenu
513 iconToolBar->clear(); 509 iconToolBar->clear();
514 KOPrefs *p = KOPrefs::instance(); 510 KOPrefs *p = KOPrefs::instance();
515 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
516 512
517 QPopupMenu *viewMenu = new QPopupMenu( this ); 513 QPopupMenu *viewMenu = new QPopupMenu( this );
518 QPopupMenu *actionMenu = new QPopupMenu( this ); 514 QPopupMenu *actionMenu = new QPopupMenu( this );
519 QPopupMenu *importMenu = new QPopupMenu( this ); 515 QPopupMenu *importMenu = new QPopupMenu( this );
520 selectFilterMenu = new QPopupMenu( this ); 516 selectFilterMenu = new QPopupMenu( this );
521 selectFilterMenu->setCheckable( true ); 517 selectFilterMenu->setCheckable( true );
522 syncMenu = new QPopupMenu( this ); 518 syncMenu = new QPopupMenu( this );
523 configureAgendaMenu = new QPopupMenu( this ); 519 configureAgendaMenu = new QPopupMenu( this );
524 configureToolBarMenu = new QPopupMenu( this ); 520 configureToolBarMenu = new QPopupMenu( this );
525 QPopupMenu *helpMenu = new QPopupMenu( this ); 521 QPopupMenu *helpMenu = new QPopupMenu( this );
526 if ( KOPrefs::instance()->mShowFullMenu ) { 522 if ( KOPrefs::instance()->mShowFullMenu ) {
527 QMenuBar *menuBar1; 523 QMenuBar *menuBar1;
528 menuBar1 = menuBar(); 524 menuBar1 = menuBar();
529 menuBar1->insertItem( i18n("File"), importMenu ); 525 menuBar1->insertItem( i18n("File"), importMenu );
530 menuBar1->insertItem( i18n("View"), viewMenu ); 526 menuBar1->insertItem( i18n("View"), viewMenu );
531 menuBar1->insertItem( i18n("Actions"), actionMenu ); 527 menuBar1->insertItem( i18n("Actions"), actionMenu );
532#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
533 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 529 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
534 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 530 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
535#else 531#else
536 menuBar1->insertItem( i18n("Sync"), syncMenu ); 532 menuBar1->insertItem( i18n("Sync"), syncMenu );
537 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 533 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
538#endif 534#endif
539 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 535 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
540 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 536 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
541 menuBar1->insertItem( i18n("Help"), helpMenu ); 537 menuBar1->insertItem( i18n("Help"), helpMenu );
542 } else { 538 } else {
543 QPEMenuBar *menuBar1; 539 QPEMenuBar *menuBar1;
544 menuBar1 = new QPEMenuBar( iconToolBar ); 540 menuBar1 = new QPEMenuBar( iconToolBar );
545 QPopupMenu *menuBar = new QPopupMenu( this ); 541 QPopupMenu *menuBar = new QPopupMenu( this );
546 menuBar1->insertItem( i18n("ME"), menuBar); 542 menuBar1->insertItem( i18n("ME"), menuBar);
547 menuBar->insertItem( i18n("File"), importMenu ); 543 menuBar->insertItem( i18n("File"), importMenu );
548 menuBar->insertItem( i18n("View"), viewMenu ); 544 menuBar->insertItem( i18n("View"), viewMenu );
549 menuBar->insertItem( i18n("Actions"), actionMenu ); 545 menuBar->insertItem( i18n("Actions"), actionMenu );
550 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 546 menuBar->insertItem( i18n("Synchronize"), syncMenu );
551 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 547 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
552 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 548 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
553 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 549 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
554 menuBar->insertItem( i18n("Help"), helpMenu ); 550 menuBar->insertItem( i18n("Help"), helpMenu );
555 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 551 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
556 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 552 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
557 } 553 }
558 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 554 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
559 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 555 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
560 QIconSet icon; 556 QIconSet icon;
561 int pixWid = 22, pixHei = 22; 557 int pixWid = 22, pixHei = 22;
562 QString pathString = ""; 558 QString pathString = "";
563 if ( !p->mToolBarMiniIcons ) { 559 if ( !p->mToolBarMiniIcons ) {
564 if ( QApplication::desktop()->width() < 480 ) { 560 if ( QApplication::desktop()->width() < 480 ) {
565 pathString += "icons16/"; 561 pathString += "icons16/";
566 pixWid = 18; pixHei = 16; 562 pixWid = 18; pixHei = 16;
567 } 563 }
568 } else { 564 } else {
569 pathString += "iconsmini/"; 565 pathString += "iconsmini/";
570 pixWid = 18; pixHei = 16; 566 pixWid = 18; pixHei = 16;
571 } 567 }
572 mWeekBgColor = iconToolBar->backgroundColor(); 568 mWeekBgColor = iconToolBar->backgroundColor();
573 mWeekPixmap.resize( pixWid , pixHei ); 569 mWeekPixmap.resize( pixWid , pixHei );
574 mWeekPixmap.fill( mWeekBgColor ); 570 mWeekPixmap.fill( mWeekBgColor );
575 icon = mWeekPixmap; 571 icon = mWeekPixmap;
576 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 572 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
577 mWeekAction->addTo( iconToolBar ); 573 mWeekAction->addTo( iconToolBar );
578 mWeekFont = font(); 574 mWeekFont = font();
579 575
580 int fontPoint = mWeekFont.pointSize(); 576 int fontPoint = mWeekFont.pointSize();
581 QFontMetrics f( mWeekFont ); 577 QFontMetrics f( mWeekFont );
582 int fontWid = f.width( "30" ); 578 int fontWid = f.width( "30" );
583 while ( fontWid > pixWid ) { 579 while ( fontWid > pixWid ) {
584 --fontPoint; 580 --fontPoint;
585 mWeekFont.setPointSize( fontPoint ); 581 mWeekFont.setPointSize( fontPoint );
586 QFontMetrics f( mWeekFont ); 582 QFontMetrics f( mWeekFont );
587 fontWid = f.width( "30" ); 583 fontWid = f.width( "30" );
588 qDebug("dec-- "); 584 qDebug("dec-- ");
589 } 585 }
590 586
591 connect( mWeekAction, SIGNAL( activated() ), 587 connect( mWeekAction, SIGNAL( activated() ),
592 this, SLOT( weekAction() ) ); 588 this, SLOT( weekAction() ) );
593 589
594 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 590 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
595 591
596 //#endif 592 //#endif
597 // ****************** 593 // ******************
598 QAction *action; 594 QAction *action;
599 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 595 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
600 configureToolBarMenu->setCheckable( true ); 596 configureToolBarMenu->setCheckable( true );
601 597
602 598
603 configureAgendaMenu->setCheckable( true ); 599 configureAgendaMenu->setCheckable( true );
604 int iii ; 600 int iii ;
605 for ( iii = 1;iii<= 10 ;++iii ){ 601 for ( iii = 1;iii<= 10 ;++iii ){
606 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 602 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
607 } 603 }
608 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 604 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
609 605
610 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 606 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
611 this, SLOT( showConfigureAgenda( ) ) ); 607 this, SLOT( showConfigureAgenda( ) ) );
612 608
613 icon = loadPixmap( pathString + "configure" ); 609 icon = loadPixmap( pathString + "configure" );
614 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 610 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
615 action->addTo( actionMenu ); 611 action->addTo( actionMenu );
616 connect( action, SIGNAL( activated() ), 612 connect( action, SIGNAL( activated() ),
617 mView, SLOT( edit_options() ) ); 613 mView, SLOT( edit_options() ) );
618 actionMenu->insertSeparator(); 614 actionMenu->insertSeparator();
619 615
620 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 616 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
621 action->addTo( actionMenu ); 617 action->addTo( actionMenu );
622 connect( action, SIGNAL( activated() ), 618 connect( action, SIGNAL( activated() ),
623 mView, SLOT( undo_delete() ) ); 619 mView, SLOT( undo_delete() ) );
624 actionMenu->insertSeparator(); 620 actionMenu->insertSeparator();
625 621
626 icon = loadPixmap( pathString + "newevent" ); 622 icon = loadPixmap( pathString + "newevent" );
627 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 623 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
628 configureToolBarMenu->insertSeparator(); 624 configureToolBarMenu->insertSeparator();
629 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 625 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
630 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 626 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
631 ne_action->addTo( actionMenu ); 627 ne_action->addTo( actionMenu );
632 connect( ne_action, SIGNAL( activated() ), 628 connect( ne_action, SIGNAL( activated() ),
633 mView, SLOT( newEvent() ) ); 629 mView, SLOT( newEvent() ) );
634 icon = loadPixmap( pathString + "newtodo" ); 630 icon = loadPixmap( pathString + "newtodo" );
635 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 631 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
636 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 632 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
637 nt_action->addTo( actionMenu ); 633 nt_action->addTo( actionMenu );
638 connect( nt_action, SIGNAL( activated() ), 634 connect( nt_action, SIGNAL( activated() ),
639 mView, SLOT( newTodo() ) ); 635 mView, SLOT( newTodo() ) );
640 636
641 icon = loadPixmap( pathString + "today" ); 637 icon = loadPixmap( pathString + "today" );
642 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 638 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
643 today_action->addTo( viewMenu ); 639 today_action->addTo( viewMenu );
644 connect( today_action, SIGNAL( activated() ), 640 connect( today_action, SIGNAL( activated() ),
645 mView, SLOT( goToday() ) ); 641 mView, SLOT( goToday() ) );
646 viewMenu->insertSeparator(); 642 viewMenu->insertSeparator();
647 643
648 icon = loadPixmap( pathString + "navi" ); 644 icon = loadPixmap( pathString + "navi" );
649 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 645 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
650 action->addTo( viewMenu ); 646 action->addTo( viewMenu );
651 connect( action, SIGNAL( activated() ), 647 connect( action, SIGNAL( activated() ),
652 mView, SLOT( toggleDateNavigatorWidget() ) ); 648 mView, SLOT( toggleDateNavigatorWidget() ) );
653 mToggleNav = action ; 649 mToggleNav = action ;
654 icon = loadPixmap( pathString + "filter" ); 650 icon = loadPixmap( pathString + "filter" );
655 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 651 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
656 action->addTo( viewMenu ); 652 action->addTo( viewMenu );
657 connect( action, SIGNAL( activated() ), 653 connect( action, SIGNAL( activated() ),
658 mView, SLOT( toggleFilter() ) ); 654 mView, SLOT( toggleFilter() ) );
659 mToggleFilter = action; 655 mToggleFilter = action;
660 icon = loadPixmap( pathString + "allday" ); 656 icon = loadPixmap( pathString + "allday" );
661 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 657 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
662 action->addTo( viewMenu ); 658 action->addTo( viewMenu );
663 connect( action, SIGNAL( activated() ), 659 connect( action, SIGNAL( activated() ),
664 mView, SLOT( toggleAllDaySize() ) ); 660 mView, SLOT( toggleAllDaySize() ) );
665 mToggleAllday = action; 661 mToggleAllday = action;
666 662
667 663
668 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 664 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
669 mToggleNav, SLOT( setEnabled ( bool ) ) ); 665 mToggleNav, SLOT( setEnabled ( bool ) ) );
670 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 666 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
671 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 667 mToggleFilter, SLOT( setEnabled ( bool ) ) );
672 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 668 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
673 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 669 mToggleAllday, SLOT( setEnabled ( bool ) ) );
674 670
675 viewMenu->insertSeparator(); 671 viewMenu->insertSeparator();
676 icon = loadPixmap( pathString + "picker" ); 672 icon = loadPixmap( pathString + "picker" );
677 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 673 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
678 action->addTo( viewMenu ); 674 action->addTo( viewMenu );
679 connect( action, SIGNAL( activated() ), 675 connect( action, SIGNAL( activated() ),
680 mView, SLOT( showDatePicker() ) ); 676 mView, SLOT( showDatePicker() ) );
681 action->addTo( iconToolBar ); 677 action->addTo( iconToolBar );
682 viewMenu->insertSeparator(); 678 viewMenu->insertSeparator();
683 icon = loadPixmap( pathString + "list" ); 679 icon = loadPixmap( pathString + "list" );
684 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 680 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
685 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 681 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
686 showlist_action->addTo( viewMenu ); 682 showlist_action->addTo( viewMenu );
687 connect( showlist_action, SIGNAL( activated() ), 683 connect( showlist_action, SIGNAL( activated() ),
688 mView->viewManager(), SLOT( showListView() ) ); 684 mView->viewManager(), SLOT( showListView() ) );
689 685
690 686
691 icon = loadPixmap( pathString + "day" ); 687 icon = loadPixmap( pathString + "day" );
692 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 688 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
693 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 689 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
694 day1_action->addTo( viewMenu ); 690 day1_action->addTo( viewMenu );
695 // action->addTo( toolBar ); 691 // action->addTo( toolBar );
696 connect( day1_action, SIGNAL( activated() ), 692 connect( day1_action, SIGNAL( activated() ),
697 mView->viewManager(), SLOT( showDayView() ) ); 693 mView->viewManager(), SLOT( showDayView() ) );
698 694
699 icon = loadPixmap( pathString + "workweek" ); 695 icon = loadPixmap( pathString + "workweek" );
700 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 696 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
701 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 697 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
702 day5_action->addTo( viewMenu ); 698 day5_action->addTo( viewMenu );
703 connect( day5_action, SIGNAL( activated() ), 699 connect( day5_action, SIGNAL( activated() ),
704 mView->viewManager(), SLOT( showWorkWeekView() ) ); 700 mView->viewManager(), SLOT( showWorkWeekView() ) );
705 701
706 icon = loadPixmap( pathString + "week" ); 702 icon = loadPixmap( pathString + "week" );
707 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 703 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
708 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 704 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
709 day7_action->addTo( viewMenu ); 705 day7_action->addTo( viewMenu );
710 connect( day7_action, SIGNAL( activated() ), 706 connect( day7_action, SIGNAL( activated() ),
711 mView->viewManager(), SLOT( showWeekView() ) ); 707 mView->viewManager(), SLOT( showWeekView() ) );
712 708
713 icon = loadPixmap( pathString + "month" ); 709 icon = loadPixmap( pathString + "month" );
714 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 710 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
715 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 711 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
716 month_action->addTo( viewMenu ); 712 month_action->addTo( viewMenu );
717 connect( month_action, SIGNAL( activated() ), 713 connect( month_action, SIGNAL( activated() ),
718 mView->viewManager(), SLOT( showMonthView() ) ); 714 mView->viewManager(), SLOT( showMonthView() ) );
719 715
720 icon = loadPixmap( pathString + "todo" ); 716 icon = loadPixmap( pathString + "todo" );
721 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 717 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
722 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 718 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
723 todoview_action->addTo( viewMenu ); 719 todoview_action->addTo( viewMenu );
724 connect( todoview_action, SIGNAL( activated() ), 720 connect( todoview_action, SIGNAL( activated() ),
725 mView->viewManager(), SLOT( showTodoView() ) ); 721 mView->viewManager(), SLOT( showTodoView() ) );
726 722
727 icon = loadPixmap( pathString + "journal" ); 723 icon = loadPixmap( pathString + "journal" );
728 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 724 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
729 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 725 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
730 viewjournal_action->addTo( viewMenu ); 726 viewjournal_action->addTo( viewMenu );
731 connect( viewjournal_action, SIGNAL( activated() ), 727 connect( viewjournal_action, SIGNAL( activated() ),
732 mView->viewManager(), SLOT( showJournalView() ) ); 728 mView->viewManager(), SLOT( showJournalView() ) );
733 729
734 icon = loadPixmap( pathString + "xdays" ); 730 icon = loadPixmap( pathString + "xdays" );
735 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 731 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
736 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 732 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
737 xdays_action->addTo( viewMenu ); 733 xdays_action->addTo( viewMenu );
738 connect( xdays_action, SIGNAL( activated() ), 734 connect( xdays_action, SIGNAL( activated() ),
739 mView->viewManager(), SLOT( showNextXView() ) ); 735 mView->viewManager(), SLOT( showNextXView() ) );
740 736
741 icon = loadPixmap( pathString + "whatsnext" ); 737 icon = loadPixmap( pathString + "whatsnext" );
742 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 738 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
743 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 739 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
744 whatsnext_action->addTo( viewMenu ); 740 whatsnext_action->addTo( viewMenu );
745 connect( whatsnext_action, SIGNAL( activated() ), 741 connect( whatsnext_action, SIGNAL( activated() ),
746 mView->viewManager(), SLOT( showWhatsNextView() ) ); 742 mView->viewManager(), SLOT( showWhatsNextView() ) );
747 743
748#if 0 744#if 0
749 action = new QAction( "view_timespan", "Time Span", 0, this ); 745 action = new QAction( "view_timespan", "Time Span", 0, this );
750 action->addTo( viewMenu ); 746 action->addTo( viewMenu );
751 connect( action, SIGNAL( activated() ), 747 connect( action, SIGNAL( activated() ),
752 mView->viewManager(), SLOT( showTimeSpanView() ) ); 748 mView->viewManager(), SLOT( showTimeSpanView() ) );
753#endif 749#endif
754 750
755 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 751 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
756 this ); 752 this );
757 mNewSubTodoAction->addTo( actionMenu ); 753 mNewSubTodoAction->addTo( actionMenu );
758 connect( mNewSubTodoAction, SIGNAL( activated() ), 754 connect( mNewSubTodoAction, SIGNAL( activated() ),
759 mView, SLOT( newSubTodo() ) ); 755 mView, SLOT( newSubTodo() ) );
760 756
761 actionMenu->insertSeparator(); 757 actionMenu->insertSeparator();
762 758
763 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 759 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
764 mShowAction->addTo( actionMenu ); 760 mShowAction->addTo( actionMenu );
765 connect( mShowAction, SIGNAL( activated() ), 761 connect( mShowAction, SIGNAL( activated() ),
766 mView, SLOT( showIncidence() ) ); 762 mView, SLOT( showIncidence() ) );
767 763
768 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 764 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
769 mEditAction->addTo( actionMenu ); 765 mEditAction->addTo( actionMenu );
770 connect( mEditAction, SIGNAL( activated() ), 766 connect( mEditAction, SIGNAL( activated() ),
771 mView, SLOT( editIncidence() ) ); 767 mView, SLOT( editIncidence() ) );
772 768
773 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 769 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
774 mDeleteAction->addTo( actionMenu ); 770 mDeleteAction->addTo( actionMenu );
775 connect( mDeleteAction, SIGNAL( activated() ), 771 connect( mDeleteAction, SIGNAL( activated() ),
776 mView, SLOT( deleteIncidence() ) ); 772 mView, SLOT( deleteIncidence() ) );
777 773
778 774
779 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 775 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
780 mCloneAction->addTo( actionMenu ); 776 mCloneAction->addTo( actionMenu );
781 connect( mCloneAction, SIGNAL( activated() ), 777 connect( mCloneAction, SIGNAL( activated() ),
782 mView, SLOT( cloneIncidence() ) ); 778 mView, SLOT( cloneIncidence() ) );
783 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 779 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
784 mMoveAction->addTo( actionMenu ); 780 mMoveAction->addTo( actionMenu );
785 connect( mMoveAction, SIGNAL( activated() ), 781 connect( mMoveAction, SIGNAL( activated() ),
786 mView, SLOT( moveIncidence() ) ); 782 mView, SLOT( moveIncidence() ) );
787 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 783 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
788 mBeamAction->addTo( actionMenu ); 784 mBeamAction->addTo( actionMenu );
789 connect( mBeamAction, SIGNAL( activated() ), 785 connect( mBeamAction, SIGNAL( activated() ),
790 mView, SLOT( beamIncidence() ) ); 786 mView, SLOT( beamIncidence() ) );
791 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 787 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
792 mCancelAction->addTo( actionMenu ); 788 mCancelAction->addTo( actionMenu );
793 connect( mCancelAction, SIGNAL( activated() ), 789 connect( mCancelAction, SIGNAL( activated() ),
794 mView, SLOT( toggleCancelIncidence() ) ); 790 mView, SLOT( toggleCancelIncidence() ) );
795 791
796 actionMenu->insertSeparator(); 792 actionMenu->insertSeparator();
797 793
798 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 794 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
799 this ); 795 this );
800 action->addTo( actionMenu ); 796 action->addTo( actionMenu );
801 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 797 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
802 798
803 icon = loadPixmap( pathString + "search" ); 799 icon = loadPixmap( pathString + "search" );
804 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 800 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
805 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 801 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
806 search_action->addTo( actionMenu ); 802 search_action->addTo( actionMenu );
807 connect( search_action, SIGNAL( activated() ), 803 connect( search_action, SIGNAL( activated() ),
808 mView->dialogManager(), SLOT( showSearchDialog() ) ); 804 mView->dialogManager(), SLOT( showSearchDialog() ) );
809 805
810 806
811 807
812 if ( KOPrefs::instance()->mShowFullMenu ) { 808 if ( KOPrefs::instance()->mShowFullMenu ) {
813 actionMenu->insertSeparator(); 809 actionMenu->insertSeparator();
814 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 810 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
815 811
816 } 812 }
817 // actionMenu->insertSeparator(); 813 // actionMenu->insertSeparator();
818 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 814 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
819 this ); 815 this );
820 action->addTo( importMenu ); 816 action->addTo( importMenu );
821 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 817 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
822 action = new QAction( "import_quick", i18n("Import last file"), 0, 818 action = new QAction( "import_quick", i18n("Import last file"), 0,
823 this ); 819 this );
824 action->addTo( importMenu ); 820 action->addTo( importMenu );
825 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 821 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
826 importMenu->insertSeparator(); 822 importMenu->insertSeparator();
827 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 823 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
828 this ); 824 this );
829 action->addTo( importMenu ); 825 action->addTo( importMenu );
830 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 826 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
831#ifndef DESKTOP_VERSION 827#ifndef DESKTOP_VERSION
832 importMenu->insertSeparator(); 828 importMenu->insertSeparator();
833 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 829 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
834 this ); 830 this );
835 action->addTo( importMenu ); 831 action->addTo( importMenu );
836 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 832 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
837#else 833#else
838#ifdef _OL_IMPORT_ 834#ifdef _OL_IMPORT_
839 importMenu->insertSeparator(); 835 importMenu->insertSeparator();
840 action = new QAction( "import_ol", i18n("Import from OL"), 0, 836 action = new QAction( "import_ol", i18n("Import from OL"), 0,
841 this ); 837 this );
842 action->addTo( importMenu ); 838 action->addTo( importMenu );
843 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 839 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
844#endif 840#endif
845#endif 841#endif
846 842
847 importMenu->insertSeparator(); 843 importMenu->insertSeparator();
848 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 844 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
849 this ); 845 this );
850 action->addTo( importMenu ); 846 action->addTo( importMenu );
851 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 847 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
852 848
853 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 849 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
854 this ); 850 this );
855 action->addTo( importMenu ); 851 action->addTo( importMenu );
856 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 852 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
857 853
858 importMenu->insertSeparator(); 854 importMenu->insertSeparator();
859 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 855 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
860 this ); 856 this );
861 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 857 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
862 858
863 859
864 //LR 860 //LR
865 QPopupMenu *ex2phone = new QPopupMenu( this ); 861 QPopupMenu *ex2phone = new QPopupMenu( this );
866 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 862 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
867 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 863 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
868 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 864 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
869 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 865 importMenu->insertItem( i18n("Export to phone"), ex2phone );
870 866
871 importMenu->insertSeparator(); 867 importMenu->insertSeparator();
872 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 868 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
873 this ); 869 this );
874 action->addTo( importMenu ); 870 action->addTo( importMenu );
875 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 871 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
876#ifndef DESKTOP_VERSION 872#ifndef DESKTOP_VERSION
877 importMenu->insertSeparator(); 873 importMenu->insertSeparator();
878 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 874 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
879 this ); 875 this );
880 brAction->addTo( importMenu ); 876 brAction->addTo( importMenu );
881 brAction->setToggleAction (true ) ; 877 brAction->setToggleAction (true ) ;
882 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 878 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
883 879
884 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 880 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
885 this ); 881 this );
886 action->addTo( importMenu ); 882 action->addTo( importMenu );
887 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 883 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
888 884
889 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 885 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
890 this ); 886 this );
891 action->addTo( importMenu ); 887 action->addTo( importMenu );
892 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 888 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
893#else 889#else
894 importMenu->insertSeparator(); 890 importMenu->insertSeparator();
895 icon = loadPixmap( pathString + "print" ); 891 icon = loadPixmap( pathString + "print" );
896 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 892 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
897 action->addTo( importMenu ); 893 action->addTo( importMenu );
898 connect( action, SIGNAL( activated() ), 894 connect( action, SIGNAL( activated() ),
899 this, SLOT( printCal() ) ); 895 this, SLOT( printCal() ) );
900 896
901 icon = loadPixmap( pathString + "print" ); 897 icon = loadPixmap( pathString + "print" );
902 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 898 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
903 action->addTo( importMenu ); 899 action->addTo( importMenu );
904 connect( action, SIGNAL( activated() ), 900 connect( action, SIGNAL( activated() ),
905 this, SLOT( printSel() ) ); 901 this, SLOT( printSel() ) );
906 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 902 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
907 action->addTo( importMenu ); 903 action->addTo( importMenu );
908 connect( action, SIGNAL( activated() ), 904 connect( action, SIGNAL( activated() ),
909 mView->viewManager(), SIGNAL( printWNV() ) ); 905 mView->viewManager(), SIGNAL( printWNV() ) );
910#endif 906#endif
911 importMenu->insertSeparator(); 907 importMenu->insertSeparator();
912 action = new QAction( "beam all", i18n("Save"), 0, 908 action = new QAction( "beam all", i18n("Save"), 0,
913 this ); 909 this );
914 action->addTo( importMenu ); 910 action->addTo( importMenu );
915 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 911 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
916 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 912 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
917 this ); 913 this );
918 action->addTo( importMenu ); 914 action->addTo( importMenu );
919 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 915 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
920 916
921 //menuBar->insertItem( "Configure",configureMenu ); 917 //menuBar->insertItem( "Configure",configureMenu );
922 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 918 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
923 icon = loadPixmap( "korganizer/korganizer" ); 919 icon = loadPixmap( "korganizer/korganizer" );
924 920
925 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 921 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
926 action->addTo( helpMenu ); 922 action->addTo( helpMenu );
927 connect( action, SIGNAL( activated() ), 923 connect( action, SIGNAL( activated() ),
928 SLOT( whatsNew() ) ); 924 SLOT( whatsNew() ) );
929 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 925 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
930 action->addTo( helpMenu ); 926 action->addTo( helpMenu );
931 connect( action, SIGNAL( activated() ), 927 connect( action, SIGNAL( activated() ),
932 SLOT( features() ) ); 928 SLOT( features() ) );
933 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 929 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
934 action->addTo( helpMenu ); 930 action->addTo( helpMenu );
935 connect( action, SIGNAL( activated() ), 931 connect( action, SIGNAL( activated() ),
936 SLOT( keyBindings() ) ); 932 SLOT( keyBindings() ) );
937 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 933 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
938 action->addTo( helpMenu ); 934 action->addTo( helpMenu );
939 connect( action, SIGNAL( activated() ), 935 connect( action, SIGNAL( activated() ),
940 SLOT( synchowto() ) ); 936 SLOT( synchowto() ) );
941 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 937 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
942 action->addTo( helpMenu ); 938 action->addTo( helpMenu );
943 connect( action, SIGNAL( activated() ), 939 connect( action, SIGNAL( activated() ),
944 SLOT( kdesynchowto() ) ); 940 SLOT( kdesynchowto() ) );
945 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 941 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
946 action->addTo( helpMenu ); 942 action->addTo( helpMenu );
947 connect( action, SIGNAL( activated() ), 943 connect( action, SIGNAL( activated() ),
948 SLOT( multisynchowto() ) ); 944 SLOT( multisynchowto() ) );
949 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 945 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
950 action->addTo( helpMenu ); 946 action->addTo( helpMenu );
951 connect( action, SIGNAL( activated() ), 947 connect( action, SIGNAL( activated() ),
952 SLOT( aboutAutoSaving() ) ); 948 SLOT( aboutAutoSaving() ) );
953 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 949 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
954 action->addTo( helpMenu ); 950 action->addTo( helpMenu );
955 connect( action, SIGNAL( activated() ), 951 connect( action, SIGNAL( activated() ),
956 SLOT( aboutKnownBugs() ) ); 952 SLOT( aboutKnownBugs() ) );
957 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 953 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
958 action->addTo( helpMenu ); 954 action->addTo( helpMenu );
959 connect( action, SIGNAL( activated() ), 955 connect( action, SIGNAL( activated() ),
960 SLOT( usertrans() ) ); 956 SLOT( usertrans() ) );
961 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 957 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
962 action->addTo( helpMenu ); 958 action->addTo( helpMenu );
963 connect( action, SIGNAL( activated() ), 959 connect( action, SIGNAL( activated() ),
964 SLOT( faq() ) ); 960 SLOT( faq() ) );
965 action = new QAction( "licence", i18n("Licence..."), 0, this ); 961 action = new QAction( "licence", i18n("Licence..."), 0, this );
966 action->addTo( helpMenu ); 962 action->addTo( helpMenu );
967 connect( action, SIGNAL( activated() ), 963 connect( action, SIGNAL( activated() ),
968 SLOT( licence() ) ); 964 SLOT( licence() ) );
969 action = new QAction( "about", i18n("About..."), 0, this ); 965 action = new QAction( "about", i18n("About..."), 0, this );
970 action->addTo( helpMenu ); 966 action->addTo( helpMenu );
971 connect( action, SIGNAL( activated() ), 967 connect( action, SIGNAL( activated() ),
972 SLOT( about() ) ); 968 SLOT( about() ) );
973 //menuBar->insertSeparator(); 969 //menuBar->insertSeparator();
974 970
975 // ****************************************************** 971 // ******************************************************
976 // menubar icons 972 // menubar icons
977 973
978 974
979 iconToolBar->setHorizontalStretchable (true ); 975 iconToolBar->setHorizontalStretchable (true );
980 //menuBar->insertItem( iconToolBar ); 976 //menuBar->insertItem( iconToolBar );
981 //xdays_action 977 //xdays_action
982 if (p-> mShowIconNewEvent) 978 if (p-> mShowIconNewEvent)
983 ne_action->addTo( iconToolBar ); 979 ne_action->addTo( iconToolBar );
984 if (p->mShowIconNewTodo ) 980 if (p->mShowIconNewTodo )
985 nt_action->addTo( iconToolBar ); 981 nt_action->addTo( iconToolBar );
986 if (p-> mShowIconSearch) 982 if (p-> mShowIconSearch)
987 search_action->addTo( iconToolBar ); 983 search_action->addTo( iconToolBar );
988 if (p-> mShowIconNext) 984 if (p-> mShowIconNext)
989 whatsnext_action->addTo( iconToolBar ); 985 whatsnext_action->addTo( iconToolBar );
990 if (p-> mShowIconNextDays) 986 if (p-> mShowIconNextDays)
991 xdays_action->addTo( iconToolBar ); 987 xdays_action->addTo( iconToolBar );
992 if (p-> mShowIconList) 988 if (p-> mShowIconList)
993 showlist_action->addTo( iconToolBar ); 989 showlist_action->addTo( iconToolBar );
994 if (p-> mShowIconDay1) 990 if (p-> mShowIconDay1)
995 day1_action->addTo( iconToolBar ); 991 day1_action->addTo( iconToolBar );
996 if (p-> mShowIconDay5) 992 if (p-> mShowIconDay5)
997 day5_action->addTo( iconToolBar ); 993 day5_action->addTo( iconToolBar );
998 if (p-> mShowIconDay7) 994 if (p-> mShowIconDay7)
999 day7_action->addTo( iconToolBar ); 995 day7_action->addTo( iconToolBar );
1000 if (p-> mShowIconMonth) 996 if (p-> mShowIconMonth)
1001 month_action->addTo( iconToolBar ); 997 month_action->addTo( iconToolBar );
1002 if (p-> mShowIconTodoview) 998 if (p-> mShowIconTodoview)
1003 todoview_action->addTo( iconToolBar ); 999 todoview_action->addTo( iconToolBar );
1004 if (p-> mShowIconJournal) 1000 if (p-> mShowIconJournal)
1005 viewjournal_action->addTo( iconToolBar ); 1001 viewjournal_action->addTo( iconToolBar );
1006 icon = loadPixmap( pathString + "2leftarrowB" ); 1002 icon = loadPixmap( pathString + "2leftarrowB" );
1007 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1003 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1008 if (p-> mShowIconBackFast) { 1004 if (p-> mShowIconBackFast) {
1009 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1005 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1010 connect( action, SIGNAL( activated() ), 1006 connect( action, SIGNAL( activated() ),
1011 mView, SLOT( goPreviousMonth() ) ); 1007 mView, SLOT( goPreviousMonth() ) );
1012 action->addTo( iconToolBar ); 1008 action->addTo( iconToolBar );
1013 } 1009 }
1014 icon = loadPixmap( pathString + "1leftarrowB" ); 1010 icon = loadPixmap( pathString + "1leftarrowB" );
1015 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1011 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1016 if (p-> mShowIconBack) { 1012 if (p-> mShowIconBack) {
1017 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1013 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1018 connect( action, SIGNAL( activated() ), 1014 connect( action, SIGNAL( activated() ),
1019 mView, SLOT( goPrevious() ) ); 1015 mView, SLOT( goPrevious() ) );
1020 action->addTo( iconToolBar ); 1016 action->addTo( iconToolBar );
1021 } 1017 }
1022 icon = loadPixmap( pathString + "today" ); 1018 icon = loadPixmap( pathString + "today" );
1023 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1019 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1024 if (p-> mShowIconToday) 1020 if (p-> mShowIconToday)
1025 today_action->addTo( iconToolBar ); 1021 today_action->addTo( iconToolBar );
1026 icon = loadPixmap( pathString + "1rightarrowB" ); 1022 icon = loadPixmap( pathString + "1rightarrowB" );
1027 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1023 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1028 if (p-> mShowIconForward) { 1024 if (p-> mShowIconForward) {
1029 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1025 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1030 connect( action, SIGNAL( activated() ), 1026 connect( action, SIGNAL( activated() ),
1031 mView, SLOT( goNext() ) ); 1027 mView, SLOT( goNext() ) );
1032 action->addTo( iconToolBar ); 1028 action->addTo( iconToolBar );
1033 } 1029 }
1034 icon = loadPixmap( pathString + "2rightarrowB" ); 1030 icon = loadPixmap( pathString + "2rightarrowB" );
1035 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1031 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1036 if (p-> mShowIconForwardFast) { 1032 if (p-> mShowIconForwardFast) {
1037 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1033 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1038 connect( action, SIGNAL( activated() ), 1034 connect( action, SIGNAL( activated() ),
1039 mView, SLOT( goNextMonth() ) ); 1035 mView, SLOT( goNextMonth() ) );
1040 action->addTo( iconToolBar ); 1036 action->addTo( iconToolBar );
1041 } 1037 }
1042 1038
1043 1039
1044 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1040 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1045 1041
1046 if (p-> mShowIconNewEvent) 1042 if (p-> mShowIconNewEvent)
1047 configureToolBarMenu->setItemChecked( 10, true ); 1043 configureToolBarMenu->setItemChecked( 10, true );
1048 if (p->mShowIconNewTodo ) 1044 if (p->mShowIconNewTodo )
1049 configureToolBarMenu->setItemChecked( 20, true ); 1045 configureToolBarMenu->setItemChecked( 20, true );
1050 if (p-> mShowIconSearch) 1046 if (p-> mShowIconSearch)
1051 configureToolBarMenu->setItemChecked( 120, true ); 1047 configureToolBarMenu->setItemChecked( 120, true );
1052 if (p-> mShowIconList) 1048 if (p-> mShowIconList)
1053 configureToolBarMenu->setItemChecked( 30, true ); 1049 configureToolBarMenu->setItemChecked( 30, true );
1054 if (p-> mShowIconDay1) 1050 if (p-> mShowIconDay1)
1055 configureToolBarMenu->setItemChecked( 40, true ); 1051 configureToolBarMenu->setItemChecked( 40, true );
1056 if (p-> mShowIconDay5) 1052 if (p-> mShowIconDay5)
1057 configureToolBarMenu->setItemChecked( 50, true ); 1053 configureToolBarMenu->setItemChecked( 50, true );
1058 if (p-> mShowIconDay7) 1054 if (p-> mShowIconDay7)
1059 configureToolBarMenu->setItemChecked( 60, true ); 1055 configureToolBarMenu->setItemChecked( 60, true );
1060 if (p-> mShowIconMonth) 1056 if (p-> mShowIconMonth)
1061 configureToolBarMenu->setItemChecked( 70, true ); 1057 configureToolBarMenu->setItemChecked( 70, true );
1062 if (p-> mShowIconTodoview) 1058 if (p-> mShowIconTodoview)
1063 configureToolBarMenu->setItemChecked( 80, true ); 1059 configureToolBarMenu->setItemChecked( 80, true );
1064 if (p-> mShowIconBackFast) 1060 if (p-> mShowIconBackFast)
1065 configureToolBarMenu->setItemChecked( 200, true ); 1061 configureToolBarMenu->setItemChecked( 200, true );
1066 if (p-> mShowIconBack) 1062 if (p-> mShowIconBack)
1067 configureToolBarMenu->setItemChecked( 210, true ); 1063 configureToolBarMenu->setItemChecked( 210, true );
1068 if (p-> mShowIconToday) 1064 if (p-> mShowIconToday)
1069 configureToolBarMenu->setItemChecked( 130, true ); 1065 configureToolBarMenu->setItemChecked( 130, true );
1070 if (p-> mShowIconForward) 1066 if (p-> mShowIconForward)
1071 configureToolBarMenu->setItemChecked( 220, true ); 1067 configureToolBarMenu->setItemChecked( 220, true );
1072 if (p-> mShowIconForwardFast) 1068 if (p-> mShowIconForwardFast)
1073 configureToolBarMenu->setItemChecked( 230, true ); 1069 configureToolBarMenu->setItemChecked( 230, true );
1074 if (p-> mShowIconNextDays) 1070 if (p-> mShowIconNextDays)
1075 configureToolBarMenu->setItemChecked( 100, true ); 1071 configureToolBarMenu->setItemChecked( 100, true );
1076 if (p-> mShowIconNext) 1072 if (p-> mShowIconNext)
1077 configureToolBarMenu->setItemChecked( 110, true ); 1073 configureToolBarMenu->setItemChecked( 110, true );
1078 if (p-> mShowIconJournal) 1074 if (p-> mShowIconJournal)
1079 configureToolBarMenu->setItemChecked( 90, true ); 1075 configureToolBarMenu->setItemChecked( 90, true );
1080 if (p-> mShowIconWhatsThis) 1076 if (p-> mShowIconWhatsThis)
1081 configureToolBarMenu->setItemChecked( 300, true ); 1077 configureToolBarMenu->setItemChecked( 300, true );
1082 1078
1083 QLabel* dummy = new QLabel( iconToolBar ); 1079 QLabel* dummy = new QLabel( iconToolBar );
1084 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1080 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1085 if (!p-> mShowIconStretch) 1081 if (!p-> mShowIconStretch)
1086 iconToolBar->setStretchableWidget ( dummy ) ; 1082 iconToolBar->setStretchableWidget ( dummy ) ;
1087 else 1083 else
1088 configureToolBarMenu->setItemChecked( 5, true ); 1084 configureToolBarMenu->setItemChecked( 5, true );
1089 if (p-> mShowIconWhatsThis) 1085 if (p-> mShowIconWhatsThis)
1090 QWhatsThis::whatsThisButton ( iconToolBar ); 1086 QWhatsThis::whatsThisButton ( iconToolBar );
1091 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1087 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1092 configureAgenda( p->mHourSize ); 1088 configureAgenda( p->mHourSize );
1093 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1089 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1094} 1090}
1095 1091
1096void MainWindow::exportToPhone( int mode ) 1092void MainWindow::exportToPhone( int mode )
1097{ 1093{
1098 1094
1099 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1095 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1100 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1096 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1101 KOex2phonePrefs ex2phone; 1097 KOex2phonePrefs ex2phone;
1102 1098
1103 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1099 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1104 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1100 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1105 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1101 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1106 if ( mode == 1 ) 1102 if ( mode == 1 )
1107 ex2phone.setCaption(i18n("Export complete calendar")); 1103 ex2phone.setCaption(i18n("Export complete calendar"));
1108 if ( mode == 2 ) 1104 if ( mode == 2 )
1109 ex2phone.setCaption(i18n("Export filtered calendar")); 1105 ex2phone.setCaption(i18n("Export filtered calendar"));
1110 1106
1111 if ( !ex2phone.exec() ) { 1107 if ( !ex2phone.exec() ) {
1112 return; 1108 return;
1113 } 1109 }
1114 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1110 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1115 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1111 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1116 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1112 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1117 1113
1118 int inFuture = 0; 1114 int inFuture = 0;
1119 if ( ex2phone.mWriteBackFuture->isChecked() ) 1115 if ( ex2phone.mWriteBackFuture->isChecked() )
1120 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1116 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1121 QPtrList<Incidence> delSel; 1117 QPtrList<Incidence> delSel;
1122 if ( mode == 1 ) 1118 if ( mode == 1 )
1123 delSel = mCalendar->rawIncidences(); 1119 delSel = mCalendar->rawIncidences();
1124 if ( mode == 2 ) 1120 if ( mode == 2 )
1125 delSel = mCalendar->incidences(); 1121 delSel = mCalendar->incidences();
1126 CalendarLocal* cal = new CalendarLocal(); 1122 CalendarLocal* cal = new CalendarLocal();
1127 cal->setLocalTime(); 1123 cal->setLocalTime();
1128 Incidence *incidence = delSel.first(); 1124 Incidence *incidence = delSel.first();
1129 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1125 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1130 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1126 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1131 while ( incidence ) { 1127 while ( incidence ) {
1132 if ( incidence->type() != "Journal" ) { 1128 if ( incidence->type() != "Journal" ) {
1133 bool add = true; 1129 bool add = true;
1134 if ( inFuture ) { 1130 if ( inFuture ) {
1135 QDateTime dt; 1131 QDateTime dt;
1136 if ( incidence->type() == "Todo" ) { 1132 if ( incidence->type() == "Todo" ) {
1137 Todo * t = (Todo*)incidence; 1133 Todo * t = (Todo*)incidence;
1138 if ( t->hasDueDate() ) 1134 if ( t->hasDueDate() )
1139 dt = t->dtDue(); 1135 dt = t->dtDue();
1140 else 1136 else
1141 dt = cur.addSecs( 62 ); 1137 dt = cur.addSecs( 62 );
1142 } 1138 }
1143 else { 1139 else {
1144 bool ok; 1140 bool ok;
1145 dt = incidence->getNextOccurence( cur, &ok ); 1141 dt = incidence->getNextOccurence( cur, &ok );
1146 if ( !ok ) 1142 if ( !ok )
1147 dt = cur.addSecs( -62 ); 1143 dt = cur.addSecs( -62 );
1148 } 1144 }
1149 if ( dt < cur || dt > end ) { 1145 if ( dt < cur || dt > end ) {
1150 add = false; 1146 add = false;
1151 } 1147 }
1152 } 1148 }
1153 if ( add ) { 1149 if ( add ) {
1154 Incidence *in = incidence->clone(); 1150 Incidence *in = incidence->clone();
1155 cal->addIncidence( in ); 1151 cal->addIncidence( in );
1156 } 1152 }
1157 } 1153 }
1158 incidence = delSel.next(); 1154 incidence = delSel.next();
1159 } 1155 }
1160 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1156 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1161 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1157 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1162 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1158 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1163 1159
1164 setCaption( i18n("Writing to phone...")); 1160 setCaption( i18n("Writing to phone..."));
1165 if ( PhoneFormat::writeToPhone( cal ) ) 1161 if ( PhoneFormat::writeToPhone( cal ) )
1166 setCaption( i18n("Export to phone successful!")); 1162 setCaption( i18n("Export to phone successful!"));
1167 else 1163 else
1168 setCaption( i18n("Error exporting to phone!")); 1164 setCaption( i18n("Error exporting to phone!"));
1169 delete cal; 1165 delete cal;
1170} 1166}
1171 1167
1172 1168
1173void MainWindow::setDefaultPreferences() 1169void MainWindow::setDefaultPreferences()
1174{ 1170{
1175 KOPrefs *p = KOPrefs::instance(); 1171 KOPrefs *p = KOPrefs::instance();
1176 1172
1177 p->mCompactDialogs = true; 1173 p->mCompactDialogs = true;
1178 p->mConfirm = true; 1174 p->mConfirm = true;
1179 // p->mEnableQuickTodo = false; 1175 // p->mEnableQuickTodo = false;
1180 1176
1181} 1177}
1182 1178
1183QString MainWindow::resourcePath() 1179QString MainWindow::resourcePath()
1184{ 1180{
1185 return KGlobal::iconLoader()->iconPath(); 1181 return KGlobal::iconLoader()->iconPath();
1186} 1182}
1187 1183
1188void MainWindow::displayText( QString text ,QString cap ) 1184void MainWindow::displayText( QString text ,QString cap )
1189{ 1185{
1190 QDialog dia( this, "name", true ); ; 1186 QDialog dia( this, "name", true ); ;
1191 dia.setCaption( cap ); 1187 dia.setCaption( cap );
1192 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1188 QVBoxLayout* lay = new QVBoxLayout( &dia );
1193 lay->setSpacing( 3 ); 1189 lay->setSpacing( 3 );
1194 lay->setMargin( 3 ); 1190 lay->setMargin( 3 );
1195 QTextBrowser tb ( &dia ); 1191 QTextBrowser tb ( &dia );
1196 lay->addWidget( &tb ); 1192 lay->addWidget( &tb );
1197 tb.setText( text ); 1193 tb.setText( text );
1198#ifdef DESKTOP_VERSION 1194#ifdef DESKTOP_VERSION
1199 dia.resize( 640, 480); 1195 dia.resize( 640, 480);
1200#else 1196#else
1201 dia.showMaximized(); 1197 dia.showMaximized();
1202#endif 1198#endif
1203 dia.exec(); 1199 dia.exec();
1204} 1200}
1205 1201
1206void MainWindow::features() 1202void MainWindow::features()
1207{ 1203{
1208 1204
1209 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1205 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1210} 1206}
1211 1207
1212void MainWindow::usertrans() 1208void MainWindow::usertrans()
1213{ 1209{
1214 1210
1215 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1211 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1216} 1212}
1217 1213
1218void MainWindow::kdesynchowto() 1214void MainWindow::kdesynchowto()
1219{ 1215{
1220 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1216 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1221} 1217}
1222void MainWindow::multisynchowto() 1218void MainWindow::multisynchowto()
1223{ 1219{
1224 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1220 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1225} 1221}
1226void MainWindow::synchowto() 1222void MainWindow::synchowto()
1227{ 1223{
1228 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1224 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1229} 1225}
1230void MainWindow::faq() 1226void MainWindow::faq()
1231{ 1227{
1232 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1228 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1233 1229
1234} 1230}
1235void MainWindow::whatsNew() 1231void MainWindow::whatsNew()
1236{ 1232{
1237 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1233 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1238 1234
1239} 1235}
1240void MainWindow::licence() 1236void MainWindow::licence()
1241{ 1237{
1242 KApplication::showLicence(); 1238 KApplication::showLicence();
1243 1239
1244} 1240}
1245void MainWindow::about() 1241void MainWindow::about()
1246{ 1242{
1247 QString version; 1243 QString version;
1248#include <../version> 1244#include <../version>
1249 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1245 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1250 i18n("KOrganizer/Platform-independent\n") + 1246 i18n("KOrganizer/Platform-independent\n") +
1251 "(KO/Pi) " + version + " - " + 1247 "(KO/Pi) " + version + " - " +
1252 1248
1253#ifdef DESKTOP_VERSION 1249#ifdef DESKTOP_VERSION
1254 i18n("Desktop Edition\n") + 1250 i18n("Desktop Edition\n") +
1255#else 1251#else
1256 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1252 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1257#endif 1253#endif
1258 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1254 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1259} 1255}
1260void MainWindow::keyBindings() 1256void MainWindow::keyBindings()
1261{ 1257{
1262 QString cap = i18n("KO/Pi Keys + Colors"); 1258 QString cap = i18n("KO/Pi Keys + Colors");
1263 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1259 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1264 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1260 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1265 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1261 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1266 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1262 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1267 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1263 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1268 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1264 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1269 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1265 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1270 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1266 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1271 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1267 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1272 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1268 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1273 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1269 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1274 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1270 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1275 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1271 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1276 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1272 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1277 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1273 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1278 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1274 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1279 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1275 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1280 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1276 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1281 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1277 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1282 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1278 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1283 i18n("<p><h3>In agenda view:</h3></p>\n") + 1279 i18n("<p><h3>In agenda view:</h3></p>\n") +
1284 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1280 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1285 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1281 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1286 i18n("<p><h3>In todo view:</h3></p>\n") + 1282 i18n("<p><h3>In todo view:</h3></p>\n") +
1287 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1283 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1288 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1284 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1289 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1285 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1290 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1286 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1291 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1287 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1292 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1288 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1293 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1289 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1294 i18n("<p><h3>In list view:</h3></p>\n") + 1290 i18n("<p><h3>In list view:</h3></p>\n") +
1295 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1291 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1296 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1292 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1297 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1293 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1298 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1294 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1299 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1295 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1300 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1296 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1301 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1297 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1302 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1298 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1303 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1299 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1304 i18n("<p><b>E</b>: Edit item</p>\n") + 1300 i18n("<p><b>E</b>: Edit item</p>\n") +
1305 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1301 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1306 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1302 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1307 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1303 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1308 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1304 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1309 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1305 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1310 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1306 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1311 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1307 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1312 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1308 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1313 i18n("<p><b>White</b>: Item readonly</p>\n"); 1309 i18n("<p><b>White</b>: Item readonly</p>\n");
1314 displayText( text, cap); 1310 displayText( text, cap);
1315} 1311}
1316void MainWindow::aboutAutoSaving() 1312void MainWindow::aboutAutoSaving()
1317{ 1313{
1318 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1314 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1319 1315
1320 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1316 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1321 1317
1322} 1318}
1323void MainWindow::aboutKnownBugs() 1319void MainWindow::aboutKnownBugs()
1324{ 1320{
1325 QMessageBox* msg; 1321 QMessageBox* msg;
1326 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1322 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1327 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1323 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1328 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1324 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1329 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1325 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1330 i18n("\nor report them in the bugtracker on\n") + 1326 i18n("\nor report them in the bugtracker on\n") +
1331 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1327 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1332 QMessageBox::NoIcon, 1328 QMessageBox::NoIcon,
1333 QMessageBox::Ok, 1329 QMessageBox::Ok,
1334 QMessageBox::NoButton, 1330 QMessageBox::NoButton,
1335 QMessageBox::NoButton); 1331 QMessageBox::NoButton);
1336 msg->exec(); 1332 msg->exec();
1337 delete msg; 1333 delete msg;
1338 1334
1339} 1335}
1340 1336
1341QString MainWindow::defaultFileName() 1337QString MainWindow::defaultFileName()
1342{ 1338{
1343 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1339 return locateLocal( "data", "korganizer/mycalendar.ics" );
1344} 1340}
1345QString MainWindow::syncFileName() 1341QString MainWindow::syncFileName()
1346{ 1342{
1347#ifdef DESKTOP_VERSION 1343#ifdef DESKTOP_VERSION
1348 return locateLocal( "tmp", "synccalendar.ics" ); 1344 return locateLocal( "tmp", "synccalendar.ics" );
1349#else 1345#else
1350 return QString( "/tmp/synccalendar.ics" ); 1346 return QString( "/tmp/synccalendar.ics" );
1351#endif 1347#endif
1352} 1348}
1353void MainWindow::updateWeek(QDate seda) 1349void MainWindow::updateWeek(QDate seda)
1354{ 1350{
1355 int weekNum = 0; 1351 int weekNum = 0;
1356 QDate d = QDate ( seda.year(), 1,1); 1352 QDate d = QDate ( seda.year(), 1,1);
1357 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1353 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1358 if ( seda.addDays(6).year() != seda.year() ) { 1354 if ( seda.addDays(6).year() != seda.year() ) {
1359 if ( seda.year() != d.year() ) { 1355 if ( seda.year() != d.year() ) {
1360 if ( d.dayOfWeek() > 4 ) 1356 if ( d.dayOfWeek() > 4 )
1361 d = QDate ( seda.year(), 1,1); 1357 d = QDate ( seda.year(), 1,1);
1362 else 1358 else
1363 weekNum = 1; 1359 weekNum = 1;
1364 } else { 1360 } else {
1365 QDate dd( seda.year()+1, 1,1); 1361 QDate dd( seda.year()+1, 1,1);
1366 if ( dd.dayOfWeek() <= 4 ) 1362 if ( dd.dayOfWeek() <= 4 )
1367 weekNum = 1; 1363 weekNum = 1;
1368 } 1364 }
1369 } 1365 }
1370 if ( weekNum == 0 ){ 1366 if ( weekNum == 0 ){
1371 int dow = d.dayOfWeek(); 1367 int dow = d.dayOfWeek();
1372 if ( dow <= 4 ) 1368 if ( dow <= 4 )
1373 d = d.addDays( 1-dow ); 1369 d = d.addDays( 1-dow );
1374 else // 5,6,7 1370 else // 5,6,7
1375 d = d.addDays( 8-dow ); 1371 d = d.addDays( 8-dow );
1376 // we have the first week of the year.we are on monday 1372 // we have the first week of the year.we are on monday
1377 weekNum = d.daysTo( seda ) / 7 +1; 1373 weekNum = d.daysTo( seda ) / 7 +1;
1378 } 1374 }
1379 1375
1380 mWeekPixmap.fill( mWeekBgColor ); 1376 mWeekPixmap.fill( mWeekBgColor );
1381 QPainter p ( &mWeekPixmap ); 1377 QPainter p ( &mWeekPixmap );
1382 p.setFont( mWeekFont ); 1378 p.setFont( mWeekFont );
1383 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1379 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1384 p.end(); 1380 p.end();
1385 QIconSet icon3 ( mWeekPixmap ); 1381 QIconSet icon3 ( mWeekPixmap );
1386 mWeekAction->setIconSet ( icon3 ); 1382 mWeekAction->setIconSet ( icon3 );
1387 1383
1388} 1384}
1389void MainWindow::updateWeekNum(const DateList &selectedDates) 1385void MainWindow::updateWeekNum(const DateList &selectedDates)
1390{ 1386{
1391 updateWeek( selectedDates.first() ); 1387 updateWeek( selectedDates.first() );
1392} 1388}
1393void MainWindow::processIncidenceSelection( Incidence *incidence ) 1389void MainWindow::processIncidenceSelection( Incidence *incidence )
1394{ 1390{
1395 1391
1396 if ( !incidence ) { 1392 if ( !incidence ) {
1397 enableIncidenceActions( false ); 1393 enableIncidenceActions( false );
1398 1394
1399 mNewSubTodoAction->setEnabled( false ); 1395 mNewSubTodoAction->setEnabled( false );
1400 setCaptionToDates(); 1396 setCaptionToDates();
1401 return; 1397 return;
1402 1398
1403 } 1399 }
1404 1400
1405 //KGlobal::locale()->formatDateTime(nextA, true); 1401 //KGlobal::locale()->formatDateTime(nextA, true);
1406 QString startString = ""; 1402 QString startString = "";
1407 if ( incidence->type() != "Todo" ) { 1403 if ( incidence->type() != "Todo" ) {
1408 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1404 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1409 if ( incidence->doesFloat() ) { 1405 if ( incidence->doesFloat() ) {
1410 startString += ": "+incidence->dtStartDateStr( true ); 1406 startString += ": "+incidence->dtStartDateStr( true );
1411 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1407 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1412 1408
1413 } else { 1409 } else {
1414 startString = ": "+incidence->dtStartStr(true); 1410 startString = ": "+incidence->dtStartStr(true);
1415 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1411 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1416 1412
1417 } 1413 }
1418 1414
1419 } else { 1415 } else {
1420 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1416 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1421 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1417 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1422 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1418 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1423 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1419 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1424 bool ok; 1420 bool ok;
1425 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1421 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1426 if ( ok ) { 1422 if ( ok ) {
1427 int years = noc.date().year() - incidence->dtStart().date().year(); 1423 int years = noc.date().year() - incidence->dtStart().date().year();
1428 startString += i18n(" (%1 y.)"). arg( years ); 1424 startString += i18n(" (%1 y.)"). arg( years );
1429 } 1425 }
1430 } 1426 }
1431 else 1427 else
1432 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1428 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1433 } 1429 }
1434 1430
1435 } 1431 }
1436 else 1432 else
1437 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1433 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1438 if ( !incidence->location().isEmpty() ) 1434 if ( !incidence->location().isEmpty() )
1439 startString += " (" +incidence->location()+")"; 1435 startString += " (" +incidence->location()+")";
1440 setCaption( incidence->summary()+startString); 1436 setCaption( incidence->summary()+startString);
1441 1437
1442 enableIncidenceActions( true ); 1438 enableIncidenceActions( true );
1443 1439
1444 if ( incidence->type() == "Event" ) { 1440 if ( incidence->type() == "Event" ) {
1445 mShowAction->setText( i18n("Show Event...") ); 1441 mShowAction->setText( i18n("Show Event...") );
1446 mEditAction->setText( i18n("Edit Event...") ); 1442 mEditAction->setText( i18n("Edit Event...") );
1447 mDeleteAction->setText( i18n("Delete Event...") ); 1443 mDeleteAction->setText( i18n("Delete Event...") );
1448 1444
1449 mNewSubTodoAction->setEnabled( false ); 1445 mNewSubTodoAction->setEnabled( false );
1450 } else if ( incidence->type() == "Todo" ) { 1446 } else if ( incidence->type() == "Todo" ) {
1451 mShowAction->setText( i18n("Show Todo...") ); 1447 mShowAction->setText( i18n("Show Todo...") );
1452 mEditAction->setText( i18n("Edit Todo...") ); 1448 mEditAction->setText( i18n("Edit Todo...") );
1453 mDeleteAction->setText( i18n("Delete Todo...") ); 1449 mDeleteAction->setText( i18n("Delete Todo...") );
1454 1450
1455 mNewSubTodoAction->setEnabled( true ); 1451 mNewSubTodoAction->setEnabled( true );
1456 } else { 1452 } else {
1457 mShowAction->setText( i18n("Show...") ); 1453 mShowAction->setText( i18n("Show...") );
1458 mShowAction->setText( i18n("Edit...") ); 1454 mShowAction->setText( i18n("Edit...") );
1459 mShowAction->setText( i18n("Delete...") ); 1455 mShowAction->setText( i18n("Delete...") );
1460 1456
1461 mNewSubTodoAction->setEnabled( false ); 1457 mNewSubTodoAction->setEnabled( false );
1462 } 1458 }
1463} 1459}
1464 1460
1465void MainWindow::enableIncidenceActions( bool enabled ) 1461void MainWindow::enableIncidenceActions( bool enabled )
1466{ 1462{
1467 mShowAction->setEnabled( enabled ); 1463 mShowAction->setEnabled( enabled );
1468 mEditAction->setEnabled( enabled ); 1464 mEditAction->setEnabled( enabled );
1469 mDeleteAction->setEnabled( enabled ); 1465 mDeleteAction->setEnabled( enabled );
1470 1466
1471 mCloneAction->setEnabled( enabled ); 1467 mCloneAction->setEnabled( enabled );
1472 mMoveAction->setEnabled( enabled ); 1468 mMoveAction->setEnabled( enabled );
1473 mBeamAction->setEnabled( enabled ); 1469 mBeamAction->setEnabled( enabled );
1474 mCancelAction->setEnabled( enabled ); 1470 mCancelAction->setEnabled( enabled );
1475} 1471}
1476 1472
1477void MainWindow::importOL() 1473void MainWindow::importOL()
1478{ 1474{
1479#ifdef _OL_IMPORT_ 1475#ifdef _OL_IMPORT_
1480 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1476 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1481 id->exec(); 1477 id->exec();
1482 delete id; 1478 delete id;
1483 mView->updateView(); 1479 mView->updateView();
1484#endif 1480#endif
1485} 1481}
1486void MainWindow::importBday() 1482void MainWindow::importBday()
1487{ 1483{
1488 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1484 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1489 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1485 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1490 i18n("Import!"), i18n("Cancel"), 0, 1486 i18n("Import!"), i18n("Cancel"), 0,
1491 0, 1 ); 1487 0, 1 );
1492 if ( result == 0 ) { 1488 if ( result == 0 ) {
1493 mView->importBday(); 1489 mView->importBday();
1494 1490
1495 } 1491 }
1496 1492
1497 1493
1498} 1494}
1499void MainWindow::importQtopia() 1495void MainWindow::importQtopia()
1500{ 1496{
1501#ifndef DESKTOP_VERSION 1497#ifndef DESKTOP_VERSION
1502 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1498 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1503 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1499 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1504 i18n("Import!"), i18n("Cancel"), 0, 1500 i18n("Import!"), i18n("Cancel"), 0,
1505 0, 1 ); 1501 0, 1 );
1506 if ( result == 0 ) { 1502 if ( result == 0 ) {
1507 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1503 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1508 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1504 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1509 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1505 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1510 mView->importQtopia( categories, datebook, todolist ); 1506 mView->importQtopia( categories, datebook, todolist );
1511 } 1507 }
1512#else 1508#else
1513 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1509 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1514 i18n("Not supported \non desktop!\n"), 1510 i18n("Not supported \non desktop!\n"),
1515 i18n("Ok"), i18n("Cancel"), 0, 1511 i18n("Ok"), i18n("Cancel"), 0,
1516 0, 1 ); 1512 0, 1 );
1517 1513
1518#endif 1514#endif
1519} 1515}
1520 1516
1521void MainWindow::saveOnClose() 1517void MainWindow::saveOnClose()
1522{ 1518{
1523 KOPrefs *p = KOPrefs::instance(); 1519 KOPrefs *p = KOPrefs::instance();
1524 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1520 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1525 p->mToolBarUp = iconToolBar->x() > width()/2 || 1521 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1526 iconToolBar->y() > height()/2; 1522 iconToolBar->y() > height()/2;
1527 mView->writeSettings(); 1523 mView->writeSettings();
1528 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1524 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1529 save(); 1525 save();
1530} 1526}
1531void MainWindow::slotModifiedChanged( bool changed ) 1527void MainWindow::slotModifiedChanged( bool changed )
1532{ 1528{
1533 if ( mBlockAtStartup ) 1529 if ( mBlockAtStartup )
1534 return; 1530 return;
1535 1531
1536 int msec; 1532 int msec;
1537 // we store the changes after 1 minute, 1533 // we store the changes after 1 minute,
1538 // and for safety reasons after 10 minutes again 1534 // and for safety reasons after 10 minutes again
1539 if ( !mSyncManager->blockSave() ) 1535 if ( !mSyncManager->blockSave() )
1540 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1536 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1541 else 1537 else
1542 msec = 1000 * 600; 1538 msec = 1000 * 600;
1543 mSaveTimer.start( msec, true ); // 1 minute 1539 mSaveTimer.start( msec, true ); // 1 minute
1544 qDebug("KO: Saving File in %d secs!", msec/1000); 1540 qDebug("KO: Saving File in %d secs!", msec/1000);
1545 mCalendarModifiedFlag = true; 1541 mCalendarModifiedFlag = true;
1546} 1542}
1547void MainWindow::saveStopTimer() 1543void MainWindow::saveStopTimer()
1548{ 1544{
1549 mSaveTimer.stop(); 1545 mSaveTimer.stop();
1550 if (mSaveTimer.isActive() ) 1546 if (mSaveTimer.isActive() )
1551 qDebug("ti active "); 1547 qDebug("ti active ");
1552 else 1548 else
1553 qDebug("KO: Save timer stopped"); 1549 qDebug("KO: Save timer stopped");
1554} 1550}
1555void MainWindow::save() 1551void MainWindow::save()
1556{ 1552{
1557 if ( !mCalendarModifiedFlag ) { 1553 if ( !mCalendarModifiedFlag ) {
1558 qDebug("KO: Calendar not modified. Nothing saved."); 1554 qDebug("KO: Calendar not modified. Nothing saved.");
1559 return; 1555 return;
1560 } 1556 }
1561 if ( mSyncManager->blockSave() ) 1557 if ( mSyncManager->blockSave() )
1562 return; 1558 return;
1563 mSyncManager->setBlockSave(true); 1559 mSyncManager->setBlockSave(true);
1564 if ( mView->checkFileVersion( defaultFileName()) ) { 1560 if ( mView->checkFileVersion( defaultFileName()) ) {
1565 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1561 QTime neededSaveTime = QDateTime::currentDateTime().time();
1566 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1562 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1567 qDebug("KO: Start saving data to file!"); 1563 qDebug("KO: Start saving data to file!");
1568 mView->saveCalendar( defaultFileName() ); 1564 mView->saveCalendar( defaultFileName() );
1569 mCalendarModifiedFlag = false; 1565 mCalendarModifiedFlag = false;
1570 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1566 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1571 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1567 qDebug("KO: Needed %d ms for saving.",msNeeded );
1572 QString savemes; 1568 QString savemes;
1573 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1569 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1574 setCaption(savemes); 1570 setCaption(savemes);
1575 } else 1571 } else
1576 setCaption(i18n("Saving cancelled!")); 1572 setCaption(i18n("Saving cancelled!"));
1577 mSyncManager->setBlockSave( false ); 1573 mSyncManager->setBlockSave( false );
1578} 1574}
1579 1575
1580void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1576void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1581{ 1577{
1582 if ( !e->isAutoRepeat() ) { 1578 if ( !e->isAutoRepeat() ) {
1583 mFlagKeyPressed = false; 1579 mFlagKeyPressed = false;
1584 } 1580 }
1585} 1581}
1586void MainWindow::keyPressEvent ( QKeyEvent * e ) 1582void MainWindow::keyPressEvent ( QKeyEvent * e )
1587{ 1583{
1588 qApp->processEvents(); 1584 qApp->processEvents();
1589 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1585 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1590 e->ignore(); 1586 e->ignore();
1591 // qDebug(" ignore %d",e->isAutoRepeat() ); 1587 // qDebug(" ignore %d",e->isAutoRepeat() );
1592 return; 1588 return;
1593 } 1589 }
1594 if (! e->isAutoRepeat() ) 1590 if (! e->isAutoRepeat() )
1595 mFlagKeyPressed = true; 1591 mFlagKeyPressed = true;
1596 KOPrefs *p = KOPrefs::instance(); 1592 KOPrefs *p = KOPrefs::instance();
1597 bool showSelectedDates = false; 1593 bool showSelectedDates = false;
1598 int size; 1594 int size;
1599 int pro = 0; 1595 int pro = 0;
1600 //qDebug("MainWindow::keyPressEvent "); 1596 //qDebug("MainWindow::keyPressEvent ");
1601 switch ( e->key() ) { 1597 switch ( e->key() ) {
1602 case Qt::Key_Right: 1598 case Qt::Key_Right:
1603 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1599 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1604 mView->goNextMonth(); 1600 mView->goNextMonth();
1605 else 1601 else
1606 mView->goNext(); 1602 mView->goNext();
1607 showSelectedDates = true; 1603 showSelectedDates = true;
1608 break; 1604 break;
1609 case Qt::Key_Left: 1605 case Qt::Key_Left:
1610 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1606 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1611 mView->goPreviousMonth(); 1607 mView->goPreviousMonth();
1612 else 1608 else
1613 mView->goPrevious(); 1609 mView->goPrevious();
1614 showSelectedDates = true; 1610 showSelectedDates = true;
1615 break; 1611 break;
1616 case Qt::Key_Down: 1612 case Qt::Key_Down:
1617 mView->viewManager()->agendaView()->scrollOneHourDown(); 1613 mView->viewManager()->agendaView()->scrollOneHourDown();
1618 break; 1614 break;
1619 case Qt::Key_Up: 1615 case Qt::Key_Up:
1620 mView->viewManager()->agendaView()->scrollOneHourUp(); 1616 mView->viewManager()->agendaView()->scrollOneHourUp();
1621 break; 1617 break;
1622 case Qt::Key_I: 1618 case Qt::Key_I:
1623 mView->showIncidence(); 1619 mView->showIncidence();
1624 break; 1620 break;
1625 case Qt::Key_Delete: 1621 case Qt::Key_Delete:
1626 case Qt::Key_Backspace: 1622 case Qt::Key_Backspace:
1627 mView->deleteIncidence(); 1623 mView->deleteIncidence();
1628 break; 1624 break;
1629 case Qt::Key_D: 1625 case Qt::Key_D:
1630 mView->viewManager()->showDayView(); 1626 mView->viewManager()->showDayView();
1631 showSelectedDates = true; 1627 showSelectedDates = true;
1632 break; 1628 break;
1633 case Qt::Key_O: 1629 case Qt::Key_O:
1634 mView->toggleFilerEnabled( ); 1630 mView->toggleFilerEnabled( );
1635 break; 1631 break;
1636 case Qt::Key_0: 1632 case Qt::Key_0:
1637 case Qt::Key_1: 1633 case Qt::Key_1:
1638 case Qt::Key_2: 1634 case Qt::Key_2:
1639 case Qt::Key_3: 1635 case Qt::Key_3:
1640 case Qt::Key_4: 1636 case Qt::Key_4:
1641 case Qt::Key_5: 1637 case Qt::Key_5:
1642 case Qt::Key_6: 1638 case Qt::Key_6:
1643 case Qt::Key_7: 1639 case Qt::Key_7:
1644 case Qt::Key_8: 1640 case Qt::Key_8:
1645 case Qt::Key_9: 1641 case Qt::Key_9:
1646 pro = e->key()-48; 1642 pro = e->key()-48;
1647 if ( pro == 0 ) 1643 if ( pro == 0 )
1648 pro = 10; 1644 pro = 10;
1649 if ( e->state() == Qt::ControlButton) 1645 if ( e->state() == Qt::ControlButton)
1650 pro += 10; 1646 pro += 10;
1651 break; 1647 break;
1652 case Qt::Key_M: 1648 case Qt::Key_M:
1653 mView->viewManager()->showMonthView(); 1649 mView->viewManager()->showMonthView();
1654 showSelectedDates = true; 1650 showSelectedDates = true;
1655 break; 1651 break;
1656 case Qt::Key_Insert: 1652 case Qt::Key_Insert:
1657 mView->newEvent(); 1653 mView->newEvent();
1658 break; 1654 break;
1659 case Qt::Key_S : 1655 case Qt::Key_S :
1660 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1656 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1661 mView->newSubTodo(); 1657 mView->newSubTodo();
1662 else 1658 else
1663 mView->dialogManager()->showSearchDialog(); 1659 mView->dialogManager()->showSearchDialog();
1664 break; 1660 break;
1665 case Qt::Key_Y : 1661 case Qt::Key_Y :
1666 case Qt::Key_Z : 1662 case Qt::Key_Z :
1667 mView->viewManager()->showWorkWeekView(); 1663 mView->viewManager()->showWorkWeekView();
1668 showSelectedDates = true; 1664 showSelectedDates = true;
1669 break; 1665 break;
1670 case Qt::Key_U : 1666 case Qt::Key_U :
1671 mView->viewManager()->showWeekView(); 1667 mView->viewManager()->showWeekView();
1672 showSelectedDates = true; 1668 showSelectedDates = true;
1673 break; 1669 break;
1674 case Qt::Key_H : 1670 case Qt::Key_H :
1675 keyBindings(); 1671 keyBindings();
1676 break; 1672 break;
1677 case Qt::Key_W: 1673 case Qt::Key_W:
1678 mView->viewManager()->showWhatsNextView(); 1674 mView->viewManager()->showWhatsNextView();
1679 break; 1675 break;
1680 case Qt::Key_L: 1676 case Qt::Key_L:
1681 mView->viewManager()->showListView(); 1677 mView->viewManager()->showListView();
1682 break; 1678 break;
1683 case Qt::Key_N: 1679 case Qt::Key_N:
1684 mView->viewManager()->showNextXView(); 1680 mView->viewManager()->showNextXView();
1685 showSelectedDates = true; 1681 showSelectedDates = true;
1686 break; 1682 break;
1687 case Qt::Key_V: 1683 case Qt::Key_V:
1688 mView->viewManager()->showTodoView(); 1684 mView->viewManager()->showTodoView();
1689 break; 1685 break;
1690 case Qt::Key_C: 1686 case Qt::Key_C:
1691 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1687 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1692 break; 1688 break;
1693 case Qt::Key_P: 1689 case Qt::Key_P:
1694 mView->showDatePicker( ); 1690 mView->showDatePicker( );
1695 break; 1691 break;
1696 case Qt::Key_F: 1692 case Qt::Key_F:
1697 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1693 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1698 mView->editFilters(); 1694 mView->editFilters();
1699 else 1695 else
1700 mView->toggleFilter(); 1696 mView->toggleFilter();
1701 break; 1697 break;
1702 case Qt::Key_X: 1698 case Qt::Key_X:
1703 mView->toggleDateNavigatorWidget(); 1699 mView->toggleDateNavigatorWidget();
1704 break; 1700 break;
1705 case Qt::Key_Space: 1701 case Qt::Key_Space:
1706 mView->toggleExpand(); 1702 mView->toggleExpand();
1707 break; 1703 break;
1708 case Qt::Key_A: 1704 case Qt::Key_A:
1709 mView->toggleAllDaySize(); 1705 mView->toggleAllDaySize();
1710 break; 1706 break;
1711 case Qt::Key_T: 1707 case Qt::Key_T:
1712 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1708 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1713 mView->newTodo(); 1709 mView->newTodo();
1714 else { 1710 else {
1715 mView->goToday(); 1711 mView->goToday();
1716 showSelectedDates = true; 1712 showSelectedDates = true;
1717 } 1713 }
1718 break; 1714 break;
1719 case Qt::Key_J: 1715 case Qt::Key_J:
1720 mView->viewManager()->showJournalView(); 1716 mView->viewManager()->showJournalView();
1721 break; 1717 break;
1722 case Qt::Key_B: 1718 case Qt::Key_B:
1723 mView->editIncidenceDescription();; 1719 mView->editIncidenceDescription();;
1724 break; 1720 break;
1725 // case Qt::Key_Return: 1721 // case Qt::Key_Return:
1726 case Qt::Key_E: 1722 case Qt::Key_E:
1727 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1723 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1728 mView->newEvent(); 1724 mView->newEvent();
1729 else 1725 else
1730 mView->editIncidence(); 1726 mView->editIncidence();
1731 break; 1727 break;
1732 case Qt::Key_Plus: 1728 case Qt::Key_Plus:
1733 size = p->mHourSize +2; 1729 size = p->mHourSize +2;
1734 if ( size <= 22 ) 1730 if ( size <= 22 )
1735 configureAgenda( size ); 1731 configureAgenda( size );
1736 break; 1732 break;
1737 case Qt::Key_Minus: 1733 case Qt::Key_Minus:
1738 size = p->mHourSize - 2; 1734 size = p->mHourSize - 2;
1739 if ( size >= 4 ) 1735 if ( size >= 4 )
1740 configureAgenda( size ); 1736 configureAgenda( size );
1741 break; 1737 break;
1742 1738
1743 1739
1744 default: 1740 default:
1745 e->ignore(); 1741 e->ignore();
1746 } 1742 }
1747 if ( pro > 0 ) { 1743 if ( pro > 0 ) {
1748 mView->selectFilter( pro-1 ); 1744 mView->selectFilter( pro-1 );
1749 } 1745 }
1750 if ( showSelectedDates ) { 1746 if ( showSelectedDates ) {
1751 ;// setCaptionToDates(); 1747 ;// setCaptionToDates();
1752 } 1748 }
1753 1749
1754} 1750}
1755 1751
1756void MainWindow::fillFilterMenu() 1752void MainWindow::fillFilterMenu()
1757{ 1753{
1758 selectFilterMenu->clear(); 1754 selectFilterMenu->clear();
1759 bool disable = false; 1755 bool disable = false;
1760 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1756 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1761 selectFilterMenu->insertSeparator(); 1757 selectFilterMenu->insertSeparator();
1762 if ( mView->filterView()->filtersEnabled() ) { 1758 if ( mView->filterView()->filtersEnabled() ) {
1763 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1759 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1764 } 1760 }
1765 else { 1761 else {
1766 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1762 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1767 disable = true; 1763 disable = true;
1768 } 1764 }
1769 selectFilterMenu->insertSeparator(); 1765 selectFilterMenu->insertSeparator();
1770 QPtrList<CalFilter> fili = mView->filters(); 1766 QPtrList<CalFilter> fili = mView->filters();
1771 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1767 CalFilter *curfilter = mView->filterView()->selectedFilter();
1772 CalFilter *filter = fili.first(); 1768 CalFilter *filter = fili.first();
1773 int iii = 2; 1769 int iii = 2;
1774 while(filter) { 1770 while(filter) {
1775 selectFilterMenu->insertItem( filter->name(), iii ); 1771 selectFilterMenu->insertItem( filter->name(), iii );
1776 if ( filter == curfilter) 1772 if ( filter == curfilter)
1777 selectFilterMenu->setItemChecked( iii, true ); 1773 selectFilterMenu->setItemChecked( iii, true );
1778 if ( disable ) 1774 if ( disable )
1779 selectFilterMenu->setItemEnabled( iii, false ); 1775 selectFilterMenu->setItemEnabled( iii, false );
1780 filter = fili.next(); 1776 filter = fili.next();
1781 ++iii; 1777 ++iii;
1782 } 1778 }
1783} 1779}
1784void MainWindow::selectFilter( int fil ) 1780void MainWindow::selectFilter( int fil )
1785{ 1781{
1786 if ( fil == 0 ) { 1782 if ( fil == 0 ) {
1787 mView->editFilters( ); 1783 mView->editFilters( );
1788 } else if ( fil == 1 ){ 1784 } else if ( fil == 1 ){
1789 mView->toggleFilerEnabled( ); 1785 mView->toggleFilerEnabled( );
1790 } else { 1786 } else {
1791 mView->selectFilter( fil-2 ); 1787 mView->selectFilter( fil-2 );
1792 } 1788 }
1793} 1789}
1794void MainWindow::configureToolBar( int item ) 1790void MainWindow::configureToolBar( int item )
1795{ 1791{
1796 1792
1797 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1793 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1798 KOPrefs *p = KOPrefs::instance(); 1794 KOPrefs *p = KOPrefs::instance();
1799 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1795 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1800 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1796 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1801 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1797 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1802 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1798 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1803 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1799 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1804 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1800 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1805 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1801 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1806 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1802 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1807 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1803 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1808 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1804 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1809 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1805 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1810 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1806 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1811 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1807 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1812 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1808 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1813 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1809 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1814 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1810 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1815 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1811 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1816 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1812 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1817 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1813 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1818 // initActions(); 1814 // initActions();
1819} 1815}
1820 1816
1821void MainWindow::setCaptionToDates() 1817void MainWindow::setCaptionToDates()
1822{ 1818{
1823 QString selDates; 1819 QString selDates;
1824 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1820 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1825 if (mView->startDate() < mView->endDate() ) 1821 if (mView->startDate() < mView->endDate() )
1826 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1822 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1827 else { 1823 else {
1828 QString addString; 1824 QString addString;
1829 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1825 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1830 addString = i18n("Today"); 1826 addString = i18n("Today");
1831 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1827 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1832 addString = i18n("Tomorrow"); 1828 addString = i18n("Tomorrow");
1833 if ( !addString.isEmpty() ) 1829 if ( !addString.isEmpty() )
1834 selDates = addString+", "+selDates ; 1830 selDates = addString+", "+selDates ;
1835 } 1831 }
1836 setCaption( i18n("Dates: ") + selDates ); 1832 setCaption( i18n("Dates: ") + selDates );
1837 1833
1838} 1834}
1839void MainWindow::showConfigureAgenda( ) 1835void MainWindow::showConfigureAgenda( )
1840{ 1836{
1841 int iii; 1837 int iii;
1842 for ( iii = 1;iii<= 10 ;++iii ){ 1838 for ( iii = 1;iii<= 10 ;++iii ){
1843 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1839 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1844 } 1840 }
1845 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1841 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1846} 1842}
1847void MainWindow::configureAgenda( int item ) 1843void MainWindow::configureAgenda( int item )
1848{ 1844{
1849 if ( KOPrefs::instance()->mHourSize == item ) 1845 if ( KOPrefs::instance()->mHourSize == item )
1850 return; 1846 return;
1851 KOPrefs::instance()->mHourSize=item; 1847 KOPrefs::instance()->mHourSize=item;
1852 mView->viewManager()->agendaView()->updateConfig(); 1848 mView->viewManager()->agendaView()->updateConfig();
1853} 1849}
1854 1850
1855void MainWindow::saveCalendar() 1851void MainWindow::saveCalendar()
1856{ 1852{
1857 QString fn = KOPrefs::instance()->mLastSaveFile; 1853 QString fn = KOPrefs::instance()->mLastSaveFile;
1858 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1854 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1859 1855
1860 if ( fn == "" ) 1856 if ( fn == "" )
1861 return; 1857 return;
1862 QFileInfo info; 1858 QFileInfo info;
1863 info.setFile( fn ); 1859 info.setFile( fn );
1864 QString mes; 1860 QString mes;
1865 bool createbup = true; 1861 bool createbup = true;
1866 if ( info. exists() ) { 1862 if ( info. exists() ) {
1867 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1863 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1868 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1864 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1869 i18n("Overwrite!"), i18n("Cancel"), 0, 1865 i18n("Overwrite!"), i18n("Cancel"), 0,
1870 0, 1 ); 1866 0, 1 );
1871 if ( result != 0 ) { 1867 if ( result != 0 ) {
1872 createbup = false; 1868 createbup = false;
1873 } 1869 }
1874 } 1870 }
1875 if ( createbup ) { 1871 if ( createbup ) {
1876 mView->saveCalendar( fn ); 1872 mView->saveCalendar( fn );
1877 mes = i18n("KO/Pi:Saved %1").arg(fn); 1873 mes = i18n("KO/Pi:Saved %1").arg(fn);
1878 KOPrefs::instance()->mLastSaveFile = fn; 1874 KOPrefs::instance()->mLastSaveFile = fn;
1879 setCaption(mes); 1875 setCaption(mes);
1880 } 1876 }
1881} 1877}
1882void MainWindow::loadCalendar() 1878void MainWindow::loadCalendar()
1883{ 1879{
1884 1880
1885 QString fn = KOPrefs::instance()->mLastLoadFile; 1881 QString fn = KOPrefs::instance()->mLastLoadFile;
1886 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1882 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1887 1883
1888 if ( fn == "" ) 1884 if ( fn == "" )
1889 return; 1885 return;
1890 QFileInfo info; 1886 QFileInfo info;
1891 info.setFile( fn ); 1887 info.setFile( fn );
1892 QString mess; 1888 QString mess;
1893 bool loadbup = true; 1889 bool loadbup = true;
1894 if ( info. exists() ) { 1890 if ( info. exists() ) {
1895 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1891 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1896 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1892 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1897 mess, 1893 mess,
1898 i18n("Load!"), i18n("Cancel"), 0, 1894 i18n("Load!"), i18n("Cancel"), 0,
1899 0, 1 ); 1895 0, 1 );
1900 if ( result != 0 ) { 1896 if ( result != 0 ) {
1901 loadbup = false; 1897 loadbup = false;
1902 } 1898 }
1903 } else { 1899 } else {
1904 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1900 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1905 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1901 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1906 0, 1 ); 1902 0, 1 );
1907 1903
1908 return; 1904 return;
1909 } 1905 }
1910 if ( loadbup ) { 1906 if ( loadbup ) {
1911 mView->openCalendar( fn ); 1907 mView->openCalendar( fn );
1912 KOPrefs::instance()->mLastLoadFile = fn; 1908 KOPrefs::instance()->mLastLoadFile = fn;
1913 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1909 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1914 setCaption(mess); 1910 setCaption(mess);
1915 } 1911 }
1916 1912
1917} 1913}
1918void MainWindow::quickImportIcal() 1914void MainWindow::quickImportIcal()
1919{ 1915{
1920 importFile( KOPrefs::instance()->mLastImportFile, false ); 1916 importFile( KOPrefs::instance()->mLastImportFile, false );
1921} 1917}
1922void MainWindow::importFile( QString fn, bool quick ) 1918void MainWindow::importFile( QString fn, bool quick )
1923{ 1919{
1924 QFileInfo info; 1920 QFileInfo info;
1925 info.setFile( fn ); 1921 info.setFile( fn );
1926 QString mess; 1922 QString mess;
1927 bool loadbup = true; 1923 bool loadbup = true;
1928 if ( !info. exists() ) { 1924 if ( !info. exists() ) {
1929 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1925 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1930 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1926 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1931 mess ); 1927 mess );
1932 return; 1928 return;
1933 } 1929 }
1934 int result = 0; 1930 int result = 0;
1935 if ( !quick ) { 1931 if ( !quick ) {
1936 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 )); 1932 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 ));
1937 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1933 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1938 mess, 1934 mess,
1939 "Import", "Cancel", 0, 1935 "Import", "Cancel", 0,
1940 0, 1 ); 1936 0, 1 );
1941 } 1937 }
1942 if ( result == 0 ) { 1938 if ( result == 0 ) {
1943 if ( mView->openCalendar( fn, true )) { 1939 if ( mView->openCalendar( fn, true )) {
1944 KOPrefs::instance()->mLastImportFile = fn; 1940 KOPrefs::instance()->mLastImportFile = fn;
1945 setCaption(i18n("Imported file successfully")); 1941 setCaption(i18n("Imported file successfully"));
1946 } else { 1942 } else {
1947 setCaption(i18n("Error importing file")); 1943 setCaption(i18n("Error importing file"));
1948 } 1944 }
1949 } 1945 }
1950} 1946}
1951 1947
1952void MainWindow::importIcal() 1948void MainWindow::importIcal()
1953{ 1949{
1954 1950
1955 QString fn =KOPrefs::instance()->mLastImportFile; 1951 QString fn =KOPrefs::instance()->mLastImportFile;
1956 1952
1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1953 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1958 if ( fn == "" ) 1954 if ( fn == "" )
1959 return; 1955 return;
1960 importFile( fn, true ); 1956 importFile( fn, true );
1961 1957
1962} 1958}
1963 1959
1964void MainWindow::exportVCalendar() 1960void MainWindow::exportVCalendar()
1965{ 1961{
1966 QString fn = KOPrefs::instance()->mLastVcalFile; 1962 QString fn = KOPrefs::instance()->mLastVcalFile;
1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1963 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1968 if ( fn == "" ) 1964 if ( fn == "" )
1969 return; 1965 return;
1970 QFileInfo info; 1966 QFileInfo info;
1971 info.setFile( fn ); 1967 info.setFile( fn );
1972 QString mes; 1968 QString mes;
1973 bool createbup = true; 1969 bool createbup = true;
1974 if ( info. exists() ) { 1970 if ( info. exists() ) {
1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1971 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1972 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1977 i18n("Overwrite!"), i18n("Cancel"), 0, 1973 i18n("Overwrite!"), i18n("Cancel"), 0,
1978 0, 1 ); 1974 0, 1 );
1979 if ( result != 0 ) { 1975 if ( result != 0 ) {
1980 createbup = false; 1976 createbup = false;
1981 } 1977 }
1982 } 1978 }
1983 if ( createbup ) { 1979 if ( createbup ) {
1984 if ( mView->exportVCalendar( fn ) ) { 1980 if ( mView->exportVCalendar( fn ) ) {
1985 KOPrefs::instance()->mLastVcalFile = fn; 1981 KOPrefs::instance()->mLastVcalFile = fn;
1986 if ( fn.length() > 20 ) 1982 if ( fn.length() > 20 )
1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1983 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1988 else 1984 else
1989 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1985 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1990 setCaption(mes); 1986 setCaption(mes);
1991 } 1987 }
1992 } 1988 }
1993 1989
1994} 1990}
1995QString MainWindow::sentSyncFile() 1991QString MainWindow::sentSyncFile()
1996{ 1992{
1997#ifdef DESKTOP_VERSION 1993#ifdef DESKTOP_VERSION
1998 return locateLocal( "tmp", "copysynccal.ics" ); 1994 return locateLocal( "tmp", "copysynccal.ics" );
1999#else 1995#else
2000 return QString( "/tmp/copysynccal.ics" ); 1996 return QString( "/tmp/copysynccal.ics" );
2001#endif 1997#endif
2002} 1998}
2003 1999
2004void MainWindow::syncFileRequest() 2000void MainWindow::syncFileRequest()
2005{ 2001{
2006 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2002 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2007 mSyncManager->slotSyncMenu( 999 ); 2003 mSyncManager->slotSyncMenu( 999 );
2008 } 2004 }
2009 2005
2010 setCaption(i18n("Saving Data to temp file ..." )); 2006 setCaption(i18n("Saving Data to temp file ..." ));
2011 mView->saveCalendar( sentSyncFile() ); 2007 mView->saveCalendar( sentSyncFile() );
2012 setCaption(i18n("Data saved to temp file!" )); 2008 setCaption(i18n("Data saved to temp file!" ));
2013 2009
2014} 2010}
2015void MainWindow::getFile( bool success ) 2011void MainWindow::getFile( bool success )
2016{ 2012{
2017 if ( ! success ) { 2013 if ( ! success ) {
2018 setCaption( i18n("Error receiving file. Nothing changed!") ); 2014 setCaption( i18n("Error receiving file. Nothing changed!") );
2019 return; 2015 return;
2020 } 2016 }
2021 mView->openCalendar( sentSyncFile() ); 2017 mView->openCalendar( sentSyncFile() );
2022 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2018 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2023 mSyncManager->slotSyncMenu( 999 ); 2019 mSyncManager->slotSyncMenu( 999 );
2024 } 2020 }
2025 setCaption( i18n("Pi-Sync successful!") ); 2021 setCaption( i18n("Pi-Sync successful!") );
2026} 2022}
2027 2023
2028void MainWindow::printSel( ) 2024void MainWindow::printSel( )
2029{ 2025{
2030 mView->viewManager()->agendaView()->agenda()->printSelection(); 2026 mView->viewManager()->agendaView()->agenda()->printSelection();
2031} 2027}
2032 2028
2033void MainWindow::printCal() 2029void MainWindow::printCal()
2034{ 2030{
2035 mView->print();//mCp->showDialog(); 2031 mView->print();//mCp->showDialog();
2036} 2032}
2037 2033
2038 2034
2039#include "libkdepim/kdatepicker.h" 2035#include "libkdepim/kdatepicker.h"
2040#include <kdatetbl.h> 2036#include <kdatetbl.h>
2041void MainWindow::weekAction() 2037void MainWindow::weekAction()
2042{ 2038{
2043 int month; 2039 int month;
2044 KPopupFrame* popup = new KPopupFrame(this); 2040 KPopupFrame* popup = new KPopupFrame(this);
2045 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2041 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2046 // ----- 2042 // -----
2047 picker->resize(picker->sizeHint()); 2043 picker->resize(picker->sizeHint());
2048 popup->setMainWidget(picker); 2044 popup->setMainWidget(picker);
2049 picker->setFocus(); 2045 picker->setFocus();
2050 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2046 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2051 int x = 0; 2047 int x = 0;
2052 int y = iconToolBar->height(); 2048 int y = iconToolBar->height();
2053 int dX = 0; 2049 int dX = 0;
2054 int dY = 0; 2050 int dY = 0;
2055 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2051 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2056 if ( iconToolBar->y() > height()/2 ) { 2052 if ( iconToolBar->y() > height()/2 ) {
2057 dY = picker->sizeHint().height()+8; 2053 dY = picker->sizeHint().height()+8;
2058 y = 0; 2054 y = 0;
2059 } 2055 }
2060 } else { 2056 } else {
2061 if ( iconToolBar->x() > width()/2 ) { // right side 2057 if ( iconToolBar->x() > width()/2 ) { // right side
2062 x=0; 2058 x=0;
2063 dX= picker->sizeHint().width()+8; 2059 dX= picker->sizeHint().width()+8;
2064 y = 0; 2060 y = 0;
2065 } else { 2061 } else {
2066 x= iconToolBar->width(); 2062 x= iconToolBar->width();
2067 y = 0; 2063 y = 0;
2068 } 2064 }
2069 } 2065 }
2070 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2066 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2071 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2067 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2072 { 2068 {
2073 month = picker->getResult(); 2069 month = picker->getResult();
2074 emit selectWeek ( month ); 2070 emit selectWeek ( month );
2075 //qDebug("weekSelected %d ", month); 2071 //qDebug("weekSelected %d ", month);
2076 } 2072 }
2077 delete popup; 2073 delete popup;
2078} 2074}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 6eaf2f2..bbed38d 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,841 +1,864 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qvbox.h> 39#include <qvbox.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qregexp.h> 41#include <qregexp.h>
42 42
43#include <kdialog.h> 43#include <kdialog.h>
44#include <kprefsdialog.h>
44#include <klocale.h> 45#include <klocale.h>
45#include <kdateedit.h> 46#include <kdateedit.h>
46#include <kglobal.h> 47#include <kglobal.h>
47#include <stdlib.h> 48#include <stdlib.h>
48 49
49/*US 50/*US
50#include <qcheckbox.h> 51#include <qcheckbox.h>
51#include <qframe.h> 52#include <qframe.h>
52#include <qpushbutton.h> 53#include <qpushbutton.h>
53#include <qcombobox.h> 54#include <qcombobox.h>
54#include <qlineedit.h> 55#include <qlineedit.h>
55#include <qlabel.h> 56#include <qlabel.h>
56#include <qfile.h> 57#include <qfile.h>
57 58
58#include <kconfig.h> 59#include <kconfig.h>
59#include <kdebug.h> 60#include <kdebug.h>
60#include <kdialog.h> 61#include <kdialog.h>
61#include <klistview.h> 62#include <klistview.h>
62#include <klocale.h> 63#include <klocale.h>
63#include <kglobal.h> 64#include <kglobal.h>
64#include <kmessagebox.h> 65#include <kmessagebox.h>
65#include <kstandarddirs.h> 66#include <kstandarddirs.h>
66 67
67#ifndef KAB_EMBEDDED 68#ifndef KAB_EMBEDDED
68#include <ktrader.h> 69#include <ktrader.h>
69#else // KAB_EMBEDDED 70#else // KAB_EMBEDDED
70#include <mergewidget.h> 71#include <mergewidget.h>
71#include <distributionlistwidget.h> 72#include <distributionlistwidget.h>
72#endif // KAB_EMBEDDED 73#endif // KAB_EMBEDDED
73 74
74#include "addresseewidget.h" 75#include "addresseewidget.h"
75#include "extensionconfigdialog.h" 76#include "extensionconfigdialog.h"
76#include "extensionwidget.h" 77#include "extensionwidget.h"
77*/ 78*/
78 79
79#include "qapplication.h" 80#include "qapplication.h"
80 81
81#include "kpimglobalprefs.h" 82#include "kpimglobalprefs.h"
82 83
83#include "kdepimconfigwidget.h" 84#include "kdepimconfigwidget.h"
85#include <kprefs.h>
84 86
85 87
86KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 88KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
87 : KPrefsWidget(prefs, parent, name ) 89 : KPrefsWidget(prefs, parent, name )
88{ 90{
89 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 91 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
90 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 92 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
91 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 93 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
92 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 94 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
93 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 95 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
94 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 96 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
95 97
96 98
97 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 99 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
98 KDialog::spacingHint() ); 100 KDialog::spacingHint() );
99 101
100 tabWidget = new QTabWidget( this ); 102 tabWidget = new QTabWidget( this );
101 topLayout->addWidget( tabWidget ); 103 topLayout->addWidget( tabWidget );
102 104
103 105
104 setupLocaleTab(); 106 setupLocaleTab();
105 setupLocaleDateTab(); 107 setupLocaleDateTab();
106 setupTimeZoneTab(); 108 setupTimeZoneTab();
107 setupExternalAppTab(); 109 setupExternalAppTab();
108 setupStoreTab(); 110 setupStoreTab();
109 111
110} 112}
111void KDEPIMConfigWidget::showTimeZoneTab() 113void KDEPIMConfigWidget::showTimeZoneTab()
112{ 114{
113 tabWidget->setCurrentPage ( 3 ) ; 115 tabWidget->setCurrentPage ( 3 ) ;
114} 116}
115void KDEPIMConfigWidget::setupStoreTab() 117void KDEPIMConfigWidget::setupStoreTab()
116{ 118{
117 QVBox *storePage = new QVBox( this ); 119 QVBox *storePage = new QVBox( this );
118 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); 120 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
119 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 121 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
120 mStoreUrl = new KURLRequester( storePage ); 122 mStoreUrl = new KURLRequester( storePage );
121 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 123 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
122 new QLabel( i18n("New dirs are created automatically"), storePage ); 124 new QLabel( i18n("New dirs are created automatically"), storePage );
123 QHBox *bb = new QHBox( storePage ); 125 QHBox *bb = new QHBox( storePage );
124 QPushButton * pb; 126 QPushButton * pb;
125 if ( QApplication::desktop()->width() < 640 ) 127 if ( QApplication::desktop()->width() < 640 )
126 pb = new QPushButton ( i18n("Save"), bb ); 128 pb = new QPushButton ( i18n("Save"), bb );
127 else 129 else
128 pb = new QPushButton ( i18n("Save settings"), bb ); 130 pb = new QPushButton ( i18n("Save settings"), bb );
129 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 131 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
130 pb = new QPushButton ( i18n("Save standard"), bb ); 132 pb = new QPushButton ( i18n("Save standard"), bb );
131 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 133 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
132 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 134 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
133 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 135 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
134 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 136 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
135} 137}
136void KDEPIMConfigWidget::setStandardStore() 138void KDEPIMConfigWidget::setStandardStore()
137{ 139{
138 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 140 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
139 saveStoreSettings(); 141 saveStoreSettings();
140} 142}
141void KDEPIMConfigWidget::saveStoreSettings() 143void KDEPIMConfigWidget::saveStoreSettings()
142{ 144{
143 if ( !mStoreUrl->url().isEmpty() ) { 145 if ( !mStoreUrl->url().isEmpty() ) {
144 KConfig cfg ( QDir::homeDirPath() + "/.microkdehome" ); 146 KConfig cfg ( QDir::homeDirPath() + "/.microkdehome" );
145 cfg.setGroup("Global"); 147 cfg.setGroup("Global");
146 cfg.writeEntry( "MICROKDEHOME", mStoreUrl->url() ); 148 cfg.writeEntry( "MICROKDEHOME", mStoreUrl->url() );
147 qDebug("cfg.writeEntry( MICROKDEHOME, mStoreUrl->url() ); "); 149 qDebug("cfg.writeEntry( MICROKDEHOME, mStoreUrl->url() ); ");
148 cfg.sync(); 150 cfg.sync();
149 } else { 151 } else {
150 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 152 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
151 saveStoreSettings(); 153 saveStoreSettings();
152 } 154 }
153} 155}
154void KDEPIMConfigWidget::setupExternalAppTab() 156void KDEPIMConfigWidget::setupExternalAppTab()
155{ 157{
156 QWidget *externalAppsPage = new QWidget( this ); 158 QWidget *externalAppsPage = new QWidget( this );
157 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 159 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
158 KDialog::spacingHintSmall() ); 160 KDialog::spacingHintSmall() );
159 161
160 mExternalApps = new QComboBox( externalAppsPage ); 162 mExternalApps = new QComboBox( externalAppsPage );
161 163
162 QMap<ExternalAppHandler::Types, QString>::Iterator it; 164 QMap<ExternalAppHandler::Types, QString>::Iterator it;
163 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 165 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
164 mExternalApps->insertItem( it.data(), it.key() ); 166 mExternalApps->insertItem( it.data(), it.key() );
165 167
166 layout->addWidget( mExternalApps ); 168 layout->addWidget( mExternalApps );
167 169
168 connect( mExternalApps, SIGNAL( activated( int ) ), 170 connect( mExternalApps, SIGNAL( activated( int ) ),
169 this, SLOT (externalapp_changed( int ) ) ); 171 this, SLOT (externalapp_changed( int ) ) );
170 172
171 173
172 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 174 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
173 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 175 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
174 mExternalAppGroupBox->layout()->setMargin(5); 176 mExternalAppGroupBox->layout()->setMargin(5);
175 177
176 mClient = new QComboBox( mExternalAppGroupBox ); 178 mClient = new QComboBox( mExternalAppGroupBox );
177 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 179 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
178 180
179 connect( mClient, SIGNAL( activated( int ) ), 181 connect( mClient, SIGNAL( activated( int ) ),
180 this, SLOT (client_changed( int ) ) ); 182 this, SLOT (client_changed( int ) ) );
181 183
182 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 184 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
183 boxLayout->addWidget( lab, 1, 0 ); 185 boxLayout->addWidget( lab, 1, 0 );
184 mChannel = new QLineEdit(mExternalAppGroupBox); 186 mChannel = new QLineEdit(mExternalAppGroupBox);
185 mChannel->setReadOnly(true); 187 mChannel->setReadOnly(true);
186 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 188 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
187 189
188 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 190 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
189 boxLayout->addWidget( lab, 3, 0 ); 191 boxLayout->addWidget( lab, 3, 0 );
190 mMessage = new QLineEdit(mExternalAppGroupBox); 192 mMessage = new QLineEdit(mExternalAppGroupBox);
191 mMessage->setReadOnly(true); 193 mMessage->setReadOnly(true);
192 boxLayout->addWidget( mMessage , 4, 0); 194 boxLayout->addWidget( mMessage , 4, 0);
193 195
194 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 196 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
195 boxLayout->addWidget( lab, 3, 1 ); 197 boxLayout->addWidget( lab, 3, 1 );
196 mParameters = new QLineEdit(mExternalAppGroupBox); 198 mParameters = new QLineEdit(mExternalAppGroupBox);
197 mParameters->setReadOnly(true); 199 mParameters->setReadOnly(true);
198 boxLayout->addWidget( mParameters, 4, 1 ); 200 boxLayout->addWidget( mParameters, 4, 1 );
199 201
200 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 202 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
201 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 203 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
202 204
203 205
204 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 206 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
205 boxLayout->addWidget( lab, 6, 0 ); 207 boxLayout->addWidget( lab, 6, 0 );
206 mMessage2 = new QLineEdit(mExternalAppGroupBox); 208 mMessage2 = new QLineEdit(mExternalAppGroupBox);
207 mMessage2->setReadOnly(true); 209 mMessage2->setReadOnly(true);
208 boxLayout->addWidget( mMessage2 , 7, 0); 210 boxLayout->addWidget( mMessage2 , 7, 0);
209 211
210 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 212 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
211 boxLayout->addWidget( lab, 6, 1 ); 213 boxLayout->addWidget( lab, 6, 1 );
212 mParameters2 = new QLineEdit(mExternalAppGroupBox); 214 mParameters2 = new QLineEdit(mExternalAppGroupBox);
213 mParameters2->setReadOnly(true); 215 mParameters2->setReadOnly(true);
214 boxLayout->addWidget( mParameters2, 7, 1 ); 216 boxLayout->addWidget( mParameters2, 7, 1 );
215 217
216 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 218 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
217 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 219 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
218 220
219 221
220 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 222 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
221 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 223 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
222 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 224 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
223 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 225 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
224 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 226 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
225 227
226 228
227 layout->addWidget( mExternalAppGroupBox ); 229 layout->addWidget( mExternalAppGroupBox );
228 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 230 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
229 231
230} 232}
231 233
232 234
233void KDEPIMConfigWidget::setupLocaleDateTab() 235void KDEPIMConfigWidget::setupLocaleDateTab()
234{ 236{
235 QWidget *topFrame = new QWidget( this ); 237 QWidget *topFrame = new QWidget( this );
236 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 238 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
237 239
238 topLayout->setSpacing(KDialog::spacingHintSmall()); 240 topLayout->setSpacing(KDialog::spacingHintSmall());
239 topLayout->setMargin(KDialog::marginHintSmall()); 241 topLayout->setMargin(KDialog::marginHintSmall());
240 int iii = 0; 242 int iii = 0;
241 243
242 244
243 KPrefsWidRadios *syncPrefsGroup = 245 KPrefsWidRadios *syncPrefsGroup =
244 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); 246 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
245 QString format; 247 QString format;
246 if ( QApplication::desktop()->width() < 480 ) 248 if ( QApplication::desktop()->width() < 480 )
247 format = "(%d.%m.%Y)"; 249 format = "(%d.%m.%Y)";
248 else 250 else
249 format = "(%d.%m.%Y|%A %d %B %Y)"; 251 format = "(%d.%m.%Y|%A %d %B %Y)";
250 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 252 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
251 if ( QApplication::desktop()->width() < 480 ) 253 if ( QApplication::desktop()->width() < 480 )
252 format = "(%m.%d.%Y)"; 254 format = "(%m.%d.%Y)";
253 else 255 else
254 format = "(%m.%d.%Y|%A %B %d %Y)"; 256 format = "(%m.%d.%Y|%A %B %d %Y)";
255 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 257 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
256 if ( QApplication::desktop()->width() < 480 ) 258 if ( QApplication::desktop()->width() < 480 )
257 format = "(%Y-%m-%d)"; 259 format = "(%Y-%m-%d)";
258 else 260 else
259 format = "(%Y-%m-%d|%A %Y %B %d)"; 261 format = "(%Y-%m-%d|%A %Y %B %d)";
260 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 262 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
261 syncPrefsGroup->addRadio(i18n("User defined")); 263 syncPrefsGroup->addRadio(i18n("User defined"));
262 if ( QApplication::desktop()->width() < 480 ) { 264 if ( QApplication::desktop()->width() < 480 ) {
263 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 265 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
264 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 266 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
265 } 267 }
266 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 268 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
267 ++iii; 269 ++iii;
268 ++iii; 270 ++iii;
269 QLabel * lab; 271 QLabel * lab;
270 mUserDateFormatLong = new QLineEdit(topFrame); 272 mUserDateFormatLong = new QLineEdit(topFrame);
271 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 273 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
272 topLayout->addWidget(lab ,iii,0); 274 topLayout->addWidget(lab ,iii,0);
273 topLayout->addWidget(mUserDateFormatLong,iii,1); 275 topLayout->addWidget(mUserDateFormatLong,iii,1);
274 ++iii; 276 ++iii;
275 mUserDateFormatShort = new QLineEdit(topFrame); 277 mUserDateFormatShort = new QLineEdit(topFrame);
276 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 278 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
277 topLayout->addWidget(lab ,iii,0); 279 topLayout->addWidget(lab ,iii,0);
278 topLayout->addWidget(mUserDateFormatShort,iii,1); 280 topLayout->addWidget(mUserDateFormatShort,iii,1);
279 ++iii; 281 ++iii;
280 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 282 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
281 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 283 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
282 ++iii; 284 ++iii;
283 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 285 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
284 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 286 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
285 ++iii; 287 ++iii;
286 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 288 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
287 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 289 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
288 ++iii; 290 ++iii;
289 291
290 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 292 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
291 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 293 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
292 294
293 295
294 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 296 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
295} 297}
296 298
297void KDEPIMConfigWidget::setupLocaleTab() 299void KDEPIMConfigWidget::setupLocaleTab()
298{ 300{
299 301
300 QWidget *topFrame = new QWidget( this ); 302 QWidget *topFrame = new QWidget( this );
301 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 303 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
302 304
303 topLayout->setSpacing(KDialog::spacingHint()); 305 topLayout->setSpacing(KDialog::spacingHint());
304 topLayout->setMargin(KDialog::marginHint()); 306 topLayout->setMargin(KDialog::marginHint());
305 int iii = 0; 307 int iii = 0;
306 KPrefsWidRadios *syncPrefsGroup = 308 KPrefsWidRadios *syncPrefsGroup =
307 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 309 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
308 syncPrefsGroup->addRadio(i18n("English")); 310 syncPrefsGroup->addRadio(i18n("English"));
309 syncPrefsGroup->addRadio(i18n("German")); 311 syncPrefsGroup->addRadio(i18n("German"));
310 syncPrefsGroup->addRadio(i18n("French")); 312 syncPrefsGroup->addRadio(i18n("French"));
311 syncPrefsGroup->addRadio(i18n("Italian")); 313 syncPrefsGroup->addRadio(i18n("Italian"));
312 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 314 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
313 if ( QApplication::desktop()->width() < 300 ) { 315 if ( QApplication::desktop()->width() < 300 ) {
314 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 316 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
315 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 317 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
316 } 318 }
317 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 319 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
318 ++iii; 320 ++iii;
319 321
320 322
321 tabWidget->addTab( topFrame, i18n( "Language" ) ); 323 tabWidget->addTab( topFrame, i18n( "Language" ) );
322 topFrame = new QWidget( this ); 324 topFrame = new QWidget( this );
323 topLayout = new QGridLayout(topFrame,4,2); 325 topLayout = new QGridLayout(topFrame,4,2);
324 326
325 topLayout->setSpacing(KDialog::spacingHint()); 327 topLayout->setSpacing(KDialog::spacingHint());
326 topLayout->setMargin(KDialog::marginHint()); 328 topLayout->setMargin(KDialog::marginHint());
327 iii = 0; 329 iii = 0;
328 syncPrefsGroup = 330 syncPrefsGroup =
329 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 331 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
330 if ( QApplication::desktop()->width() > 300 ) 332 if ( QApplication::desktop()->width() > 300 )
331 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 333 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
332 syncPrefsGroup->addRadio(i18n("24:00")); 334 syncPrefsGroup->addRadio(i18n("24:00"));
333 syncPrefsGroup->addRadio(i18n("12:00am")); 335 syncPrefsGroup->addRadio(i18n("12:00am"));
334 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 336 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
335 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 337 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
336 ++iii; 338 ++iii;
337 339
338 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 340 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
339 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 341 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
340 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 342 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
341 ++iii; 343 ++iii;
342 344
343 345
344 tabWidget->addTab( topFrame, i18n( "Time Format" ) ); 346 tabWidget->addTab( topFrame, i18n( "Time Format" ) );
345 347
346} 348}
347 349
348 350
349void KDEPIMConfigWidget::setupTimeZoneTab() 351void KDEPIMConfigWidget::setupTimeZoneTab()
350{ 352{
351 QWidget *topFrame = new QWidget( this ); 353 QWidget *topFrame;
352 QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); 354 QGridLayout *topLayout ;
355
356
357
358
359
360
361 topFrame = new QWidget( this );
362 topLayout = new QGridLayout( topFrame, 5, 2);
353 topLayout->setSpacing(KDialog::spacingHintSmall()); 363 topLayout->setSpacing(KDialog::spacingHintSmall());
354 topLayout->setMargin(KDialog::marginHintSmall()); 364 topLayout->setMargin(KDialog::marginHintSmall());
355 365
356 QHBox *timeZoneBox = new QHBox( topFrame ); 366 QHBox *timeZoneBox = new QHBox( topFrame );
357 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 367 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
358 368
359 new QLabel( i18n("Timezone:"), timeZoneBox ); 369 new QLabel( i18n("Timezone:"), timeZoneBox );
360 mTimeZoneCombo = new QComboBox( timeZoneBox ); 370 mTimeZoneCombo = new QComboBox( timeZoneBox );
361 if ( QApplication::desktop()->width() < 300 ) { 371 if ( QApplication::desktop()->width() < 300 ) {
362 mTimeZoneCombo->setMaximumWidth(150); 372 mTimeZoneCombo->setMaximumWidth(150);
363 } 373 }
364 374
365 QStringList list; 375 QStringList list;
366 list = KGlobal::locale()->timeZoneList(); 376 list = KGlobal::locale()->timeZoneList();
367 mTimeZoneCombo->insertStringList(list); 377 mTimeZoneCombo->insertStringList(list);
368 378
369 // find the currently set time zone and select it 379 // find the currently set time zone and select it
370 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 380 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
371 int nCurrentlySet = 11; 381 int nCurrentlySet = 11;
372 for (int i = 0; i < mTimeZoneCombo->count(); i++) 382 for (int i = 0; i < mTimeZoneCombo->count(); i++)
373 { 383 {
374 if (mTimeZoneCombo->text(i) == sCurrentlySet) 384 if (mTimeZoneCombo->text(i) == sCurrentlySet)
375 { 385 {
376 nCurrentlySet = i; 386 nCurrentlySet = i;
377 break; 387 break;
378 } 388 }
379 } 389 }
380 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 390 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
381 int iii = 1; 391 int iii = 1;
382 KPrefsWidBool *sb = 392 KPrefsWidBool *sb =
383 addWidBool(i18n("Add 30 min to selected Timezone"), 393 addWidBool(i18n("Add 30 min to selected Timezone"),
384 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); 394 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
385 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 395 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
386 ++iii; 396 ++iii;
387 sb = 397 sb =
388 addWidBool(i18n("Timezone has daylight saving"), 398 addWidBool(i18n("Timezone has daylight saving"),
389 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 399 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
390 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 400 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
391 ++iii; 401 ++iii;
392 QLabel* lab; 402 QLabel* lab;
393 403
394 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 404 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
395 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 405 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
396 ++iii; 406 ++iii;
397 407
398 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 408 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
399 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 409 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
400 ++iii; 410 ++iii;
401 lab = new QLabel( i18n("Daylight start:"), topFrame ); 411 lab = new QLabel( i18n("Daylight start:"), topFrame );
402 topLayout->addWidget(lab, iii,0); 412 topLayout->addWidget(lab, iii,0);
403 mStartDateSavingEdit = new KDateEdit(topFrame); 413 mStartDateSavingEdit = new KDateEdit(topFrame);
404 topLayout->addWidget(mStartDateSavingEdit, iii,1); 414 topLayout->addWidget(mStartDateSavingEdit, iii,1);
405 ++iii; 415 ++iii;
406 416
407 lab = new QLabel( i18n("Daylight end:"), topFrame ); 417 lab = new QLabel( i18n("Daylight end:"), topFrame );
408 topLayout->addWidget(lab, iii,0); 418 topLayout->addWidget(lab, iii,0);
409 mEndDateSavingEdit = new KDateEdit(topFrame); 419 mEndDateSavingEdit = new KDateEdit(topFrame);
410 topLayout->addWidget(mEndDateSavingEdit, iii,1); 420 topLayout->addWidget(mEndDateSavingEdit, iii,1);
411 ++iii; 421 ++iii;
412 QDate current ( 2001, 1,1); 422 QDate current ( 2001, 1,1);
413 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 423 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
414 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 424 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
415 425
416 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 426 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
417 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 427 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
418 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 428 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
419
420
421
422 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 429 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
423 430
431
432 topFrame = new QWidget( this );
433 topLayout = new QGridLayout( topFrame, 3, 2);
434 topLayout->setSpacing(KDialog::spacingHintSmall());
435 topLayout->setMargin(KDialog::marginHintSmall());
436 tabWidget->addTab( topFrame, i18n( "Fonts" ) );
437
438 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame );
439 topLayout->addMultiCellWidget(labb,0,0,0,2);
440 int i = 1;
441 KPrefsWidFont *timeLabelsFont =
442 addWidFont(i18n("Kx/Pi"),i18n("Application Font"),
443 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame);
444 topLayout->addWidget(timeLabelsFont->label(),i,0);
445 topLayout->addWidget(timeLabelsFont->preview(),i,1);
446 topLayout->addWidget(timeLabelsFont->button(),i,2);
424} 447}
425 448
426void KDEPIMConfigWidget::externalapp_changed( int newApp ) 449void KDEPIMConfigWidget::externalapp_changed( int newApp )
427{ 450{
428 // first store the current data 451 // first store the current data
429 saveEditFieldSettings(); 452 saveEditFieldSettings();
430 453
431 // set mCurrentApp 454 // set mCurrentApp
432 mCurrentApp = (ExternalAppHandler::Types)newApp; 455 mCurrentApp = (ExternalAppHandler::Types)newApp;
433 456
434 // set mCurrentClient 457 // set mCurrentClient
435 switch(mCurrentApp) 458 switch(mCurrentApp)
436 { 459 {
437 case(ExternalAppHandler::EMAIL): 460 case(ExternalAppHandler::EMAIL):
438 mCurrentClient = mEmailClient; 461 mCurrentClient = mEmailClient;
439 break; 462 break;
440 case(ExternalAppHandler::PHONE): 463 case(ExternalAppHandler::PHONE):
441 mCurrentClient = mPhoneClient; 464 mCurrentClient = mPhoneClient;
442 break; 465 break;
443 case(ExternalAppHandler::SMS): 466 case(ExternalAppHandler::SMS):
444 mCurrentClient = mSMSClient; 467 mCurrentClient = mSMSClient;
445 break; 468 break;
446 case(ExternalAppHandler::FAX): 469 case(ExternalAppHandler::FAX):
447 mCurrentClient = mFaxClient; 470 mCurrentClient = mFaxClient;
448 break; 471 break;
449 case(ExternalAppHandler::PAGER): 472 case(ExternalAppHandler::PAGER):
450 mCurrentClient = mPagerClient; 473 mCurrentClient = mPagerClient;
451 break; 474 break;
452 case(ExternalAppHandler::SIP): 475 case(ExternalAppHandler::SIP):
453 mCurrentClient = mSipClient; 476 mCurrentClient = mSipClient;
454 break; 477 break;
455 default: 478 default:
456 return; 479 return;
457 } 480 }
458 481
459 // and at last update the widgets 482 // and at last update the widgets
460 updateClientWidgets(); 483 updateClientWidgets();
461} 484}
462 485
463 486
464 487
465void KDEPIMConfigWidget::client_changed( int newClient ) 488void KDEPIMConfigWidget::client_changed( int newClient )
466{ 489{
467 if (newClient == mCurrentClient) 490 if (newClient == mCurrentClient)
468 return; 491 return;
469 492
470 // first store the current data 493 // first store the current data
471 saveEditFieldSettings(); 494 saveEditFieldSettings();
472 495
473 496
474 //then reset the clientvariable 497 //then reset the clientvariable
475 mCurrentClient = newClient; 498 mCurrentClient = newClient;
476 499
477 // and at last update the widgets 500 // and at last update the widgets
478 updateClientWidgets(); 501 updateClientWidgets();
479 502
480 KPrefsWidget::modified(); 503 KPrefsWidget::modified();
481} 504}
482 505
483void KDEPIMConfigWidget::saveEditFieldSettings() 506void KDEPIMConfigWidget::saveEditFieldSettings()
484{ 507{
485 508
486 switch(mCurrentApp) 509 switch(mCurrentApp)
487 { 510 {
488 case(ExternalAppHandler::EMAIL): 511 case(ExternalAppHandler::EMAIL):
489 mEmailClient = mClient->currentItem(); 512 mEmailClient = mClient->currentItem();
490 break; 513 break;
491 case(ExternalAppHandler::PHONE): 514 case(ExternalAppHandler::PHONE):
492 mPhoneClient= mClient->currentItem(); 515 mPhoneClient= mClient->currentItem();
493 break; 516 break;
494 case(ExternalAppHandler::SMS): 517 case(ExternalAppHandler::SMS):
495 mSMSClient = mClient->currentItem(); 518 mSMSClient = mClient->currentItem();
496 break; 519 break;
497 case(ExternalAppHandler::FAX): 520 case(ExternalAppHandler::FAX):
498 mFaxClient = mClient->currentItem(); 521 mFaxClient = mClient->currentItem();
499 break; 522 break;
500 case(ExternalAppHandler::PAGER): 523 case(ExternalAppHandler::PAGER):
501 mPagerClient = mClient->currentItem(); 524 mPagerClient = mClient->currentItem();
502 break; 525 break;
503 case(ExternalAppHandler::SIP): 526 case(ExternalAppHandler::SIP):
504 mSipClient = mClient->currentItem(); 527 mSipClient = mClient->currentItem();
505 break; 528 break;
506 default: 529 default:
507 return; 530 return;
508 } 531 }
509 532
510 //store the current data back to the apropriate membervariables if we had set it to "other" 533 //store the current data back to the apropriate membervariables if we had set it to "other"
511 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 534 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
512 { 535 {
513 mEmailOtherChannel = mChannel->text(); 536 mEmailOtherChannel = mChannel->text();
514 mEmailOtherMessage = mMessage->text(); 537 mEmailOtherMessage = mMessage->text();
515 mEmailOtherMessageParameters = mParameters->text(); 538 mEmailOtherMessageParameters = mParameters->text();
516 mEmailOtherMessage2 = mMessage2->text(); 539 mEmailOtherMessage2 = mMessage2->text();
517 mEmailOtherMessageParameters2 = mParameters2->text(); 540 mEmailOtherMessageParameters2 = mParameters2->text();
518 } 541 }
519 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 542 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
520 { 543 {
521 mPhoneOtherChannel = mChannel->text(); 544 mPhoneOtherChannel = mChannel->text();
522 mPhoneOtherMessage = mMessage->text(); 545 mPhoneOtherMessage = mMessage->text();
523 mPhoneOtherMessageParameters = mParameters->text(); 546 mPhoneOtherMessageParameters = mParameters->text();
524 } 547 }
525 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 548 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
526 { 549 {
527 mSMSOtherChannel = mChannel->text(); 550 mSMSOtherChannel = mChannel->text();
528 mSMSOtherMessage = mMessage->text(); 551 mSMSOtherMessage = mMessage->text();
529 mSMSOtherMessageParameters = mParameters->text(); 552 mSMSOtherMessageParameters = mParameters->text();
530 } 553 }
531 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 554 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
532 { 555 {
533 mFaxOtherChannel = mChannel->text(); 556 mFaxOtherChannel = mChannel->text();
534 mFaxOtherMessage = mMessage->text(); 557 mFaxOtherMessage = mMessage->text();
535 mFaxOtherMessageParameters = mParameters->text(); 558 mFaxOtherMessageParameters = mParameters->text();
536 } 559 }
537 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 560 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
538 { 561 {
539 mPagerOtherChannel = mChannel->text(); 562 mPagerOtherChannel = mChannel->text();
540 mPagerOtherMessage = mMessage->text(); 563 mPagerOtherMessage = mMessage->text();
541 mPagerOtherMessageParameters = mParameters->text(); 564 mPagerOtherMessageParameters = mParameters->text();
542 } 565 }
543 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 566 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
544 { 567 {
545 mSipOtherChannel = mChannel->text(); 568 mSipOtherChannel = mChannel->text();
546 mSipOtherMessage = mMessage->text(); 569 mSipOtherMessage = mMessage->text();
547 mSipOtherMessageParameters = mParameters->text(); 570 mSipOtherMessageParameters = mParameters->text();
548 } 571 }
549 572
550 573
551} 574}
552 575
553void KDEPIMConfigWidget::updateClientWidgets() 576void KDEPIMConfigWidget::updateClientWidgets()
554{ 577{
555 bool blocked = signalsBlocked(); 578 bool blocked = signalsBlocked();
556 blockSignals( true ); 579 blockSignals( true );
557 580
558 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 581 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
559 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 582 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
560 if (it == mExternalAppsMap.end()) 583 if (it == mExternalAppsMap.end())
561 return; 584 return;
562 585
563 // update group box 586 // update group box
564 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 587 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
565 588
566 //update the entries in the client combobox 589 //update the entries in the client combobox
567 mClient->clear(); 590 mClient->clear();
568 591
569 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 592 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
570 DefaultAppItem* dai; 593 DefaultAppItem* dai;
571 for ( dai=items.first(); dai != 0; dai=items.next() ) 594 for ( dai=items.first(); dai != 0; dai=items.next() )
572 { 595 {
573 mClient->insertItem( i18n(dai->_label), dai->_id ); 596 mClient->insertItem( i18n(dai->_label), dai->_id );
574 597
575 if (dai->_id == mCurrentClient) 598 if (dai->_id == mCurrentClient)
576 { 599 {
577 //restore the edit fields with the data of the local membervariables if we had set it to "other". 600 //restore the edit fields with the data of the local membervariables if we had set it to "other".
578 //Otherwise take the default data from externalapphandler. 601 //Otherwise take the default data from externalapphandler.
579 mChannel->setText(dai->_channel); 602 mChannel->setText(dai->_channel);
580 mMessage->setText(dai->_message); 603 mMessage->setText(dai->_message);
581 mParameters->setText(dai->_parameters); 604 mParameters->setText(dai->_parameters);
582 mMessage2->setText(dai->_message2); 605 mMessage2->setText(dai->_message2);
583 mParameters2->setText(dai->_parameters2); 606 mParameters2->setText(dai->_parameters2);
584 607
585 608
586 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 609 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
587 { 610 {
588 mChannel->setText(mEmailOtherChannel); 611 mChannel->setText(mEmailOtherChannel);
589 mMessage->setText(mEmailOtherMessage); 612 mMessage->setText(mEmailOtherMessage);
590 mParameters->setText(mEmailOtherMessageParameters); 613 mParameters->setText(mEmailOtherMessageParameters);
591 mMessage2->setText(mEmailOtherMessage2); 614 mMessage2->setText(mEmailOtherMessage2);
592 mParameters2->setText(mEmailOtherMessageParameters2); 615 mParameters2->setText(mEmailOtherMessageParameters2);
593 } 616 }
594 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 617 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
595 { 618 {
596 mChannel->setText(mPhoneOtherChannel); 619 mChannel->setText(mPhoneOtherChannel);
597 mMessage->setText(mPhoneOtherMessage); 620 mMessage->setText(mPhoneOtherMessage);
598 mParameters->setText(mPhoneOtherMessageParameters); 621 mParameters->setText(mPhoneOtherMessageParameters);
599 } 622 }
600 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 623 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
601 { 624 {
602 mChannel->setText(mSMSOtherChannel); 625 mChannel->setText(mSMSOtherChannel);
603 mMessage->setText(mSMSOtherMessage); 626 mMessage->setText(mSMSOtherMessage);
604 mParameters->setText(mSMSOtherMessageParameters); 627 mParameters->setText(mSMSOtherMessageParameters);
605 } 628 }
606 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 629 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
607 { 630 {
608 mChannel->setText(mFaxOtherChannel); 631 mChannel->setText(mFaxOtherChannel);
609 mMessage->setText(mFaxOtherMessage); 632 mMessage->setText(mFaxOtherMessage);
610 mParameters->setText(mFaxOtherMessageParameters); 633 mParameters->setText(mFaxOtherMessageParameters);
611 } 634 }
612 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 635 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
613 { 636 {
614 mChannel->setText(mPagerOtherChannel); 637 mChannel->setText(mPagerOtherChannel);
615 mMessage->setText(mPagerOtherMessage); 638 mMessage->setText(mPagerOtherMessage);
616 mParameters->setText(mPagerOtherMessageParameters); 639 mParameters->setText(mPagerOtherMessageParameters);
617 } 640 }
618 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 641 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
619 { 642 {
620 mChannel->setText(mSipOtherChannel); 643 mChannel->setText(mSipOtherChannel);
621 mMessage->setText(mSipOtherMessage); 644 mMessage->setText(mSipOtherMessage);
622 mParameters->setText(mSipOtherMessageParameters); 645 mParameters->setText(mSipOtherMessageParameters);
623 } 646 }
624 } 647 }
625 648
626 } 649 }
627 650
628 bool readonly; 651 bool readonly;
629 bool enabled; 652 bool enabled;
630 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 653 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
631 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 654 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
632 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 655 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
633 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 656 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
634 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 657 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
635 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 658 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
636 { 659 {
637 readonly = false; 660 readonly = false;
638 } 661 }
639 else 662 else
640 { 663 {
641 readonly = true; 664 readonly = true;
642 } 665 }
643 666
644 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 667 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
645 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 668 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
646 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 669 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
647 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 670 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
648 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 671 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
649 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 672 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
650 { 673 {
651 enabled = false; 674 enabled = false;
652 } 675 }
653 else 676 else
654 { 677 {
655 enabled = true; 678 enabled = true;
656 } 679 }
657 680
658 681
659 mChannel->setReadOnly(readonly); 682 mChannel->setReadOnly(readonly);
660 mMessage->setReadOnly(readonly); 683 mMessage->setReadOnly(readonly);
661 mParameters->setReadOnly(readonly); 684 mParameters->setReadOnly(readonly);
662 mMessage2->setReadOnly(readonly); 685 mMessage2->setReadOnly(readonly);
663 mParameters2->setReadOnly(readonly); 686 mParameters2->setReadOnly(readonly);
664 687
665 mChannel->setEnabled(enabled); 688 mChannel->setEnabled(enabled);
666 mMessage->setEnabled(enabled); 689 mMessage->setEnabled(enabled);
667 mParameters->setEnabled(enabled); 690 mParameters->setEnabled(enabled);
668 mMessage2->setEnabled(enabled); 691 mMessage2->setEnabled(enabled);
669 mParameters2->setEnabled(enabled); 692 mParameters2->setEnabled(enabled);
670 693
671 694
672 695
673 mClient->setCurrentItem(mCurrentClient); 696 mClient->setCurrentItem(mCurrentClient);
674 697
675 698
676 // enable/disable the extra message/parameter field 699 // enable/disable the extra message/parameter field
677 if (mCurrentApp == ExternalAppHandler::EMAIL) 700 if (mCurrentApp == ExternalAppHandler::EMAIL)
678 { 701 {
679 } 702 }
680 else 703 else
681 { 704 {
682 mMessage2->setText( "" ); 705 mMessage2->setText( "" );
683 mParameters2->setText( "" ); 706 mParameters2->setText( "" );
684 } 707 }
685 708
686 if (enabled == true) { 709 if (enabled == true) {
687 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 710 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
688 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 711 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
689 } 712 }
690 713
691 714
692 blockSignals( blocked ); 715 blockSignals( blocked );
693 716
694} 717}
695 718
696void KDEPIMConfigWidget::usrReadConfig() 719void KDEPIMConfigWidget::usrReadConfig()
697{ 720{
698 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 721 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
699 722
700 bool blocked = signalsBlocked(); 723 bool blocked = signalsBlocked();
701 blockSignals( true ); 724 blockSignals( true );
702 725
703 QString dummy = prefs->mUserDateFormatLong; 726 QString dummy = prefs->mUserDateFormatLong;
704 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 727 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
705 dummy = prefs->mUserDateFormatShort; 728 dummy = prefs->mUserDateFormatShort;
706 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 729 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
707 730
708 QDate current ( 2001, 1,1); 731 QDate current ( 2001, 1,1);
709 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 732 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
710 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 733 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
711 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 734 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
712 735
713 736
714 737
715 738
716 mEmailClient = prefs->mEmailClient; 739 mEmailClient = prefs->mEmailClient;
717 mEmailOtherChannel = prefs->mEmailOtherChannel; 740 mEmailOtherChannel = prefs->mEmailOtherChannel;
718 mEmailOtherMessage = prefs->mEmailOtherMessage; 741 mEmailOtherMessage = prefs->mEmailOtherMessage;
719 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 742 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
720 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 743 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
721 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 744 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
722 745
723 mPhoneClient = prefs->mPhoneClient; 746 mPhoneClient = prefs->mPhoneClient;
724 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 747 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
725 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 748 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
726 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 749 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
727 750
728 mFaxClient = prefs->mFaxClient; 751 mFaxClient = prefs->mFaxClient;
729 mFaxOtherChannel = prefs->mFaxOtherChannel; 752 mFaxOtherChannel = prefs->mFaxOtherChannel;
730 mFaxOtherMessage = prefs->mFaxOtherMessage; 753 mFaxOtherMessage = prefs->mFaxOtherMessage;
731 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 754 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
732 755
733 mSMSClient = prefs->mSMSClient; 756 mSMSClient = prefs->mSMSClient;
734 mSMSOtherChannel = prefs->mSMSOtherChannel; 757 mSMSOtherChannel = prefs->mSMSOtherChannel;
735 mSMSOtherMessage = prefs->mSMSOtherMessage; 758 mSMSOtherMessage = prefs->mSMSOtherMessage;
736 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 759 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
737 760
738 mPagerClient = prefs->mPagerClient; 761 mPagerClient = prefs->mPagerClient;
739 mPagerOtherChannel = prefs->mPagerOtherChannel; 762 mPagerOtherChannel = prefs->mPagerOtherChannel;
740 mPagerOtherMessage = prefs->mPagerOtherMessage; 763 mPagerOtherMessage = prefs->mPagerOtherMessage;
741 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 764 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
742 765
743 mSipClient = prefs->mSipClient; 766 mSipClient = prefs->mSipClient;
744 mSipOtherChannel = prefs->mSipOtherChannel; 767 mSipOtherChannel = prefs->mSipOtherChannel;
745 mSipOtherMessage = prefs->mSipOtherMessage; 768 mSipOtherMessage = prefs->mSipOtherMessage;
746 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 769 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
747 770
748 mCurrentApp = ExternalAppHandler::EMAIL; 771 mCurrentApp = ExternalAppHandler::EMAIL;
749 mCurrentClient = mEmailClient; 772 mCurrentClient = mEmailClient;
750 773
751 updateClientWidgets(); 774 updateClientWidgets();
752 775
753 blockSignals( blocked ); 776 blockSignals( blocked );
754 777
755} 778}
756 779
757void KDEPIMConfigWidget::usrWriteConfig() 780void KDEPIMConfigWidget::usrWriteConfig()
758{ 781{
759 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 782 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
760 783
761 saveEditFieldSettings(); 784 saveEditFieldSettings();
762 785
763 786
764 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 787 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
765 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 788 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
766 789
767 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 790 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
768 QDate date; 791 QDate date;
769 date = mStartDateSavingEdit->date(); 792 date = mStartDateSavingEdit->date();
770 int sub = 0; 793 int sub = 0;
771 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 794 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
772 sub = 1; 795 sub = 1;
773 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 796 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
774 date = mEndDateSavingEdit->date(); 797 date = mEndDateSavingEdit->date();
775 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 798 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
776 sub = 1; 799 sub = 1;
777 else 800 else
778 sub = 0; 801 sub = 0;
779 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 802 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
780 803
781 804
782 prefs->mEmailClient = mEmailClient; 805 prefs->mEmailClient = mEmailClient;
783 prefs->mEmailOtherChannel = mEmailOtherChannel; 806 prefs->mEmailOtherChannel = mEmailOtherChannel;
784 prefs->mEmailOtherMessage = mEmailOtherMessage; 807 prefs->mEmailOtherMessage = mEmailOtherMessage;
785 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 808 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
786 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 809 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
787 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 810 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
788 811
789 prefs->mPhoneClient = mPhoneClient; 812 prefs->mPhoneClient = mPhoneClient;
790 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 813 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
791 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 814 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
792 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 815 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
793 816
794 prefs->mFaxClient = mFaxClient; 817 prefs->mFaxClient = mFaxClient;
795 prefs->mFaxOtherChannel = mFaxOtherChannel; 818 prefs->mFaxOtherChannel = mFaxOtherChannel;
796 prefs->mFaxOtherMessage = mFaxOtherMessage; 819 prefs->mFaxOtherMessage = mFaxOtherMessage;
797 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 820 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
798 821
799 prefs->mSMSClient = mSMSClient; 822 prefs->mSMSClient = mSMSClient;
800 prefs->mSMSOtherChannel = mSMSOtherChannel; 823 prefs->mSMSOtherChannel = mSMSOtherChannel;
801 prefs->mSMSOtherMessage = mSMSOtherMessage; 824 prefs->mSMSOtherMessage = mSMSOtherMessage;
802 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 825 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
803 826
804 prefs->mPagerClient = mPagerClient; 827 prefs->mPagerClient = mPagerClient;
805 prefs->mPagerOtherChannel = mPagerOtherChannel; 828 prefs->mPagerOtherChannel = mPagerOtherChannel;
806 prefs->mPagerOtherMessage = mPagerOtherMessage; 829 prefs->mPagerOtherMessage = mPagerOtherMessage;
807 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 830 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
808 831
809 832
810 prefs->mSipClient = mSipClient; 833 prefs->mSipClient = mSipClient;
811 prefs->mSipOtherChannel = mSipOtherChannel; 834 prefs->mSipOtherChannel = mSipOtherChannel;
812 prefs->mSipOtherMessage = mSipOtherMessage; 835 prefs->mSipOtherMessage = mSipOtherMessage;
813 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; 836 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
814 837
815 //release the cache that other views can access the changed values instantanious 838 //release the cache that other views can access the changed values instantanious
816 ExternalAppHandler::instance()->loadConfig(); 839 ExternalAppHandler::instance()->loadConfig();
817 KPimGlobalPrefs::instance()->setGlobalConfig(); 840 KPimGlobalPrefs::instance()->setGlobalConfig();
818} 841}
819 842
820 843
821void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, 844void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
822 const QStringList *tags) 845 const QStringList *tags)
823{ 846{
824 if (tags) { 847 if (tags) {
825 int i = tags->findIndex(text); 848 int i = tags->findIndex(text);
826 if (i > 0) combo->setCurrentItem(i); 849 if (i > 0) combo->setCurrentItem(i);
827 } else { 850 } else {
828 for(int i=0;i<combo->count();++i) { 851 for(int i=0;i<combo->count();++i) {
829 if (combo->text(i) == text) { 852 if (combo->text(i) == text) {
830 combo->setCurrentItem(i); 853 combo->setCurrentItem(i);
831 break; 854 break;
832 } 855 }
833 } 856 }
834 } 857 }
835} 858}
836 859
837 860
838void KDEPIMConfigWidget::textChanged( const QString& text ) 861void KDEPIMConfigWidget::textChanged( const QString& text )
839{ 862{
840 emit changed( true ); 863 emit changed( true );
841} 864}
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 81e3cb1..ac7d205 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,208 +1,211 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kglobalsettings.h>
35#include <kstaticdeleter.h> 36#include <kstaticdeleter.h>
36 37
37#include <qregexp.h> 38#include <qregexp.h>
38#include <qfile.h> 39#include <qfile.h>
39#include <stdlib.h> 40#include <stdlib.h>
40#include <qtextstream.h> 41#include <qtextstream.h>
41#include <qapplication.h> 42#include <qapplication.h>
42#include "kpimglobalprefs.h" 43#include "kpimglobalprefs.h"
43 44
44KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 45KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
45static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; 46static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP;
46 47
47 48
48KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 49KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
49 : KPrefs("microkdeglobalrc") 50 : KPrefs("microkdeglobalrc")
50{ 51{
51 mLocaleDict = 0; 52 mLocaleDict = 0;
53 KPrefs::setCurrentGroup("Fonts");
54 addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() );
52 KPrefs::setCurrentGroup("Locale"); 55 KPrefs::setCurrentGroup("Locale");
53 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 56 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
54 addItemInt("PreferredTime",&mPreferredTime,0); 57 addItemInt("PreferredTime",&mPreferredTime,0);
55 addItemInt("PreferredDate",&mPreferredDate,0); 58 addItemInt("PreferredDate",&mPreferredDate,0);
56 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 59 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
57 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 60 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
58 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 61 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
59 62
60 KPrefs::setCurrentGroup("Time & Date"); 63 KPrefs::setCurrentGroup("Time & Date");
61 64
62 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); 65 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
63 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 66 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
64 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); 67 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
65 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 68 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
66 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 69 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
67 70
68 KPrefs::setCurrentGroup( "ExternalApplications" ); 71 KPrefs::setCurrentGroup( "ExternalApplications" );
69 72
70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 73 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
71 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 74 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 75 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 76 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 77 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 78 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
76 79
77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 80 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 81 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 82 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 83 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
81 84
82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 85 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
83 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 86 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 87 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 88 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
86 89
87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 90 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
88 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 91 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 92 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 93 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
91 94
92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 95 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
93 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 96 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 97 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 98 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
96 99
97 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); 100 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
98 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 101 addItemString( "SIPChannel", &mSipOtherChannel, "" );
99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 102 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 103 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
101 104
102 KPrefs::setCurrentGroup( "PhoneAccess" ); 105 KPrefs::setCurrentGroup( "PhoneAccess" );
103 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 106 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
104 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 107 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
105 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 108 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
106 109
107} 110}
108 111
109void KPimGlobalPrefs::setGlobalConfig() 112void KPimGlobalPrefs::setGlobalConfig()
110{ 113{
111 if ( mLocaleDict == 0 ) { 114 if ( mLocaleDict == 0 ) {
112 QString fileName ; 115 QString fileName ;
113 QString name = KGlobal::getAppName() +"/"; 116 QString name = KGlobal::getAppName() +"/";
114#ifndef DESKTOP_VERSION 117#ifndef DESKTOP_VERSION
115 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; 118 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name;
116#else 119#else
117 fileName = qApp->applicationDirPath () + "/kdepim/"+ name; 120 fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
118#endif 121#endif
119 mLocaleDict = 0; 122 mLocaleDict = 0;
120 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 123 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
121 124
122 if ( mPreferredLanguage == 1 ) 125 if ( mPreferredLanguage == 1 )
123 fileName = fileName+"germantranslation.txt"; 126 fileName = fileName+"germantranslation.txt";
124 else if ( mPreferredLanguage == 4 ) 127 else if ( mPreferredLanguage == 4 )
125 fileName = fileName+"usertranslation.txt"; 128 fileName = fileName+"usertranslation.txt";
126 else if ( mPreferredLanguage == 2 ) 129 else if ( mPreferredLanguage == 2 )
127 fileName = fileName+"frenchtranslation.txt"; 130 fileName = fileName+"frenchtranslation.txt";
128 else if ( mPreferredLanguage == 3 ) 131 else if ( mPreferredLanguage == 3 )
129 fileName = fileName+"italiantranslation.txt"; 132 fileName = fileName+"italiantranslation.txt";
130 QFile file( fileName ); 133 QFile file( fileName );
131 if (file.open( IO_ReadOnly ) ) { 134 if (file.open( IO_ReadOnly ) ) {
132 QTextStream ts( &file ); 135 QTextStream ts( &file );
133 ts.setEncoding( QTextStream::Latin1 ); 136 ts.setEncoding( QTextStream::Latin1 );
134 //ts.setCodec( QTextCodec::latin1 ); 137 //ts.setCodec( QTextCodec::latin1 );
135 QString text = ts.read(); 138 QString text = ts.read();
136 file.close(); 139 file.close();
137 text.replace( QRegExp("\\\\n"), "\n" ); 140 text.replace( QRegExp("\\\\n"), "\n" );
138 QString line; 141 QString line;
139 QString we; 142 QString we;
140 QString wt; 143 QString wt;
141 int br = 0; 144 int br = 0;
142 int nbr; 145 int nbr;
143 nbr = text.find ( "},", br ); 146 nbr = text.find ( "},", br );
144 line = text.mid( br, nbr - br ); 147 line = text.mid( br, nbr - br );
145 br = nbr+1; 148 br = nbr+1;
146 int se, ee, st, et; 149 int se, ee, st, et;
147 mLocaleDict = new QDict<QString>; 150 mLocaleDict = new QDict<QString>;
148 mLocaleDict->setAutoDelete( true ); 151 mLocaleDict->setAutoDelete( true );
149 QString end = "{ \"\",\"\" }"; 152 QString end = "{ \"\",\"\" }";
150 while ( (line != end) && (br > 1) ) { 153 while ( (line != end) && (br > 1) ) {
151 //qDebug("%d *%s* ", br, line.latin1()); 154 //qDebug("%d *%s* ", br, line.latin1());
152 se = line.find("\"")+1; 155 se = line.find("\"")+1;
153 et = line.findRev("\"",-1); 156 et = line.findRev("\"",-1);
154 ee = line.find("\",\""); 157 ee = line.find("\",\"");
155 st = ee+3; 158 st = ee+3;
156 we = line.mid( se, ee-se ); 159 we = line.mid( se, ee-se );
157 if ( mPreferredLanguage == 4 ) 160 if ( mPreferredLanguage == 4 )
158 wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); 161 wt = QString::fromUtf8(line.mid( st, et-st ).latin1());
159 else 162 else
160 wt = line.mid( st, et-st ); 163 wt = line.mid( st, et-st );
161 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 164 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
162 mLocaleDict->insert( we, new QString (wt) ); 165 mLocaleDict->insert( we, new QString (wt) );
163 nbr = text.find ( "}", br ); 166 nbr = text.find ( "}", br );
164 line = text.mid( br, nbr - br ); 167 line = text.mid( br, nbr - br );
165 br = nbr+1; 168 br = nbr+1;
166 } 169 }
167 //qDebug("end *%s* ", end.latin1()); 170 //qDebug("end *%s* ", end.latin1());
168 171
169 setLocaleDict( mLocaleDict ); 172 setLocaleDict( mLocaleDict );
170 } else { 173 } else {
171 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 174 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
172 } 175 }
173 } 176 }
174 } 177 }
175 178
176 KGlobal::locale()->setHore24Format( !mPreferredTime ); 179 KGlobal::locale()->setHore24Format( !mPreferredTime );
177 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 180 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
178 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 181 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
179 KGlobal::locale()->setLanguage( mPreferredLanguage ); 182 KGlobal::locale()->setLanguage( mPreferredLanguage );
180 QString dummy = mUserDateFormatLong; 183 QString dummy = mUserDateFormatLong;
181 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 184 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
182 dummy = mUserDateFormatShort; 185 dummy = mUserDateFormatShort;
183 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 186 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
184 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 187 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
185 mDaylightsavingStart, 188 mDaylightsavingStart,
186 mDaylightsavingEnd ); 189 mDaylightsavingEnd );
187 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 190 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
188 191
189} 192}
190KPimGlobalPrefs::~KPimGlobalPrefs() 193KPimGlobalPrefs::~KPimGlobalPrefs()
191{ 194{
192 if (sInstance == this) 195 if (sInstance == this)
193 sInstance = staticDeleterGP.setObject(0); 196 sInstance = staticDeleterGP.setObject(0);
194 else 197 else
195 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); 198 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
196 if ( mLocaleDict ) 199 if ( mLocaleDict )
197 delete mLocaleDict; 200 delete mLocaleDict;
198} 201}
199 202
200KPimGlobalPrefs *KPimGlobalPrefs::instance() 203KPimGlobalPrefs *KPimGlobalPrefs::instance()
201{ 204{
202 if ( !sInstance ) { 205 if ( !sInstance ) {
203 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); 206 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
204 sInstance->readConfig(); 207 sInstance->readConfig();
205 } 208 }
206 209
207 return sInstance; 210 return sInstance;
208} 211}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 5e27e85..bf17338 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -1,143 +1,144 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KPIMGLOBALPREFS_H 31#ifndef KPIMGLOBALPREFS_H
32#define KPIMGLOBALPREFS_H 32#define KPIMGLOBALPREFS_H
33 33
34#include "kprefs.h" 34#include "kprefs.h"
35#include <qdict.h> 35#include <qdict.h>
36 36
37class KPimGlobalPrefs : public KPrefs 37class KPimGlobalPrefs : public KPrefs
38{ 38{
39 public: 39 public:
40 40
41 void setGlobalConfig(); 41 void setGlobalConfig();
42 static KPimGlobalPrefs *instance(); 42 static KPimGlobalPrefs *instance();
43 43
44 44
45 virtual ~KPimGlobalPrefs(); 45 virtual ~KPimGlobalPrefs();
46 46
47 47
48 enum EMailClients { 48 enum EMailClients {
49 NONE_EMC = 0, 49 NONE_EMC = 0,
50 OTHER_EMC = 1, 50 OTHER_EMC = 1,
51 OMPI_EMC = 2, 51 OMPI_EMC = 2,
52 QTOPIA_EMC = 3, 52 QTOPIA_EMC = 3,
53 OPIE_EMC = 4, 53 OPIE_EMC = 4,
54 OPIE_MAILIT_EMC = 5 54 OPIE_MAILIT_EMC = 5
55 }; 55 };
56 56
57 enum PhoneClients { 57 enum PhoneClients {
58 NONE_PHC = 0, 58 NONE_PHC = 0,
59 OTHER_PHC = 1, 59 OTHER_PHC = 1,
60 KPPI_PHC = 2 60 KPPI_PHC = 2
61 }; 61 };
62 62
63 enum FaxClients { 63 enum FaxClients {
64 NONE_FAC = 0, 64 NONE_FAC = 0,
65 OTHER_FAC = 1 65 OTHER_FAC = 1
66 }; 66 };
67 67
68 enum SMSClients { 68 enum SMSClients {
69 NONE_SMC = 0, 69 NONE_SMC = 0,
70 OTHER_SMC = 1 70 OTHER_SMC = 1
71 }; 71 };
72 72
73 enum PagerClients { 73 enum PagerClients {
74 NONE_PAC = 0, 74 NONE_PAC = 0,
75 OTHER_PAC = 1 75 OTHER_PAC = 1
76 }; 76 };
77 77
78 enum SIPClients { 78 enum SIPClients {
79 NONE_SIC = 0, 79 NONE_SIC = 0,
80 OTHER_SIC = 1, 80 OTHER_SIC = 1,
81 KPPI_SIC = 2 81 KPPI_SIC = 2
82 }; 82 };
83 83
84 private: 84 private:
85 KPimGlobalPrefs( const QString &name = QString::null ); 85 KPimGlobalPrefs( const QString &name = QString::null );
86 86
87 static KPimGlobalPrefs *sInstance; 87 static KPimGlobalPrefs *sInstance;
88 QDict<QString> *mLocaleDict; 88 QDict<QString> *mLocaleDict;
89 89
90 90
91 public: 91 public:
92 //US I copied the following "locale" settings from KOPrefs 92 //US I copied the following "locale" settings from KOPrefs
93 int mPreferredDate; 93 int mPreferredDate;
94 QString mUserDateFormatLong; 94 QString mUserDateFormatLong;
95 QString mUserDateFormatShort; 95 QString mUserDateFormatShort;
96 int mPreferredLanguage; 96 int mPreferredLanguage;
97 int mPreferredTime; 97 int mPreferredTime;
98 bool mWeekStartsOnSunday; 98 bool mWeekStartsOnSunday;
99 QString mTimeZoneId; 99 QString mTimeZoneId;
100 bool mUseDaylightsaving; 100 bool mUseDaylightsaving;
101 int mDaylightsavingStart; 101 int mDaylightsavingStart;
102 int mDaylightsavingEnd; 102 int mDaylightsavingEnd;
103 bool mTimeZoneAdd30min; 103 bool mTimeZoneAdd30min;
104 QFont mApplicationFont;
104 105
105 int mEmailClient; 106 int mEmailClient;
106 QString mEmailOtherChannel; 107 QString mEmailOtherChannel;
107 QString mEmailOtherMessage; 108 QString mEmailOtherMessage;
108 QString mEmailOtherMessageParameters; 109 QString mEmailOtherMessageParameters;
109 QString mEmailOtherMessage2; 110 QString mEmailOtherMessage2;
110 QString mEmailOtherMessageParameters2; 111 QString mEmailOtherMessageParameters2;
111 112
112 int mPhoneClient; 113 int mPhoneClient;
113 QString mPhoneOtherChannel; 114 QString mPhoneOtherChannel;
114 QString mPhoneOtherMessage; 115 QString mPhoneOtherMessage;
115 QString mPhoneOtherMessageParameters; 116 QString mPhoneOtherMessageParameters;
116 117
117 int mFaxClient; 118 int mFaxClient;
118 QString mFaxOtherChannel; 119 QString mFaxOtherChannel;
119 QString mFaxOtherMessage; 120 QString mFaxOtherMessage;
120 QString mFaxOtherMessageParameters; 121 QString mFaxOtherMessageParameters;
121 122
122 int mSMSClient; 123 int mSMSClient;
123 QString mSMSOtherChannel; 124 QString mSMSOtherChannel;
124 QString mSMSOtherMessage; 125 QString mSMSOtherMessage;
125 QString mSMSOtherMessageParameters; 126 QString mSMSOtherMessageParameters;
126 127
127 int mPagerClient; 128 int mPagerClient;
128 QString mPagerOtherChannel; 129 QString mPagerOtherChannel;
129 QString mPagerOtherMessage; 130 QString mPagerOtherMessage;
130 QString mPagerOtherMessageParameters; 131 QString mPagerOtherMessageParameters;
131 132
132 int mSipClient; 133 int mSipClient;
133 QString mSipOtherChannel; 134 QString mSipOtherChannel;
134 QString mSipOtherMessage; 135 QString mSipOtherMessage;
135 QString mSipOtherMessageParameters; 136 QString mSipOtherMessageParameters;
136 137
137 QString mEx2PhoneDevice; 138 QString mEx2PhoneDevice;
138 QString mEx2PhoneConnection; 139 QString mEx2PhoneConnection;
139 QString mEx2PhoneModel; 140 QString mEx2PhoneModel;
140 141
141}; 142};
142 143
143#endif 144#endif
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index fbbf814..e57defe 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -1,44 +1,44 @@
1#include "kglobalsettings.h" 1#include "kglobalsettings.h"
2#include "kconfig.h" 2#include "kconfig.h"
3#include "kglobal.h" 3#include "kglobal.h"
4#include "kconfigbase.h" 4#include "kconfigbase.h"
5 5
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8QFont KGlobalSettings::generalFont() 8QFont KGlobalSettings::generalFont()
9{ 9{
10 int size = 12; 10 int size = 12;
11 if (QApplication::desktop()->width() < 480 ) 11 if (QApplication::desktop()->width() < 480 )
12 size = 10; 12 size = 10;
13 QFont f = QApplication::font(); 13 QFont f = QApplication::font();
14 //qDebug("pointsize %d ", f.pointSize()); 14 //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1());
15 f.setPointSize( size ); 15 f.setPointSize( size );
16 return f; 16 return f;
17} 17}
18QFont KGlobalSettings::toolBarFont() 18QFont KGlobalSettings::toolBarFont()
19{ 19{
20 return QApplication::font(); 20 return QApplication::font();
21} 21}
22 22
23QColor KGlobalSettings::toolBarHighlightColor() 23QColor KGlobalSettings::toolBarHighlightColor()
24{ 24{
25 return QColor( "black" ); 25 return QColor( "black" );
26} 26}
27 27
28QRect KGlobalSettings::desktopGeometry( QWidget * ) 28QRect KGlobalSettings::desktopGeometry( QWidget * )
29{ 29{
30 return QApplication::desktop()->rect(); 30 return QApplication::desktop()->rect();
31} 31}
32 32
33 /** 33 /**
34 * Returns whether KDE runs in single (default) or double click 34 * Returns whether KDE runs in single (default) or double click
35 * mode. 35 * mode.
36 * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html 36 * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html
37 * @return true if single click mode, or false if double click mode. 37 * @return true if single click mode, or false if double click mode.
38 **/ 38 **/
39bool KGlobalSettings::singleClick() 39bool KGlobalSettings::singleClick()
40{ 40{
41 KConfig *c = KGlobal::config(); 41 KConfig *c = KGlobal::config();
42 KConfigGroupSaver cgs( c, "KDE" ); 42 KConfigGroupSaver cgs( c, "KDE" );
43 return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); 43 return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK);
44} 44}
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp
index 6e449c6..ee26082 100644
--- a/pwmanager/pwmanager/main.cpp
+++ b/pwmanager/pwmanager/main.cpp
@@ -1,222 +1,223 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef PWM_EMBEDDED 20#ifndef PWM_EMBEDDED
21#include <kcmdlineargs.h> 21#include <kcmdlineargs.h>
22#include <kaboutdata.h> 22#include <kaboutdata.h>
23#else 23#else
24#include <qdir.h> 24#include <qdir.h>
25#include <kpimglobalprefs.h> 25#include <kpimglobalprefs.h>
26#endif 26#endif
27 27
28#include <klocale.h> 28#include <klocale.h>
29#include <kstandarddirs.h> 29#include <kstandarddirs.h>
30 30
31#include "pwmexception.h" 31#include "pwmexception.h"
32#include "pwminit.h" 32#include "pwminit.h"
33void dumpMissing(); 33void dumpMissing();
34 34
35 #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) 35 #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text"))
36 36
37int PwMApplication::newInstance() 37int PwMApplication::newInstance()
38{ 38{
39 static bool initial = true; 39 static bool initial = true;
40 if (initial) { 40 if (initial) {
41 initial = false; 41 initial = false;
42 init = new PwMInit(this); 42 init = new PwMInit(this);
43 init->initializeApp(); 43 init->initializeApp();
44 } else { 44 } else {
45 BUG_ON(!init); 45 BUG_ON(!init);
46 printInfo("passing parameters to old instance."); 46 printInfo("passing parameters to old instance.");
47 init->handleCmdLineArgs(false); 47 init->handleCmdLineArgs(false);
48 } 48 }
49 return EXIT_SUCCESS; 49 return EXIT_SUCCESS;
50} 50}
51 51
52 52
53static const char *description = I18N_NOOP("PwManager\n" 53static const char *description = I18N_NOOP("PwManager\n"
54 "The convenient way of managing passwords"); 54 "The convenient way of managing passwords");
55 55
56#ifndef PWM_EMBEDDED 56#ifndef PWM_EMBEDDED
57static KCmdLineOptions options[] = 57static KCmdLineOptions options[] =
58{ 58{
59 { "minimized", I18N_NOOP("Windows minimized"), 0 }, 59 { "minimized", I18N_NOOP("Windows minimized"), 0 },
60 { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, 60 { "mintray", I18N_NOOP("Windows minimized to tray"),0 },
61 { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, 61 { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 },
62 { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, 62 { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 },
63 { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, 63 { "+[files...]", I18N_NOOP("Files to open on startup"), 0 },
64 { 0, 0, 0 } 64 { 0, 0, 0 }
65}; 65};
66#endif 66#endif
67 67
68#ifdef PWM_DEBUG 68#ifdef PWM_DEBUG
69static void printDebugConfigureInfo() 69static void printDebugConfigureInfo()
70{ 70{
71 cout << "================================" << endl; 71 cout << "================================" << endl;
72 cout << PROG_NAME " version " PACKAGE_VER << endl; 72 cout << PROG_NAME " version " PACKAGE_VER << endl;
73#ifdef CONFIG_KEYCARD 73#ifdef CONFIG_KEYCARD
74 cout << "CONFIG_KEYCARD: enabled" << endl; 74 cout << "CONFIG_KEYCARD: enabled" << endl;
75#else 75#else
76 cout << "CONFIG_KEYCARD: disabled" << endl; 76 cout << "CONFIG_KEYCARD: disabled" << endl;
77#endif 77#endif
78#ifdef CONFIG_KWALLETIF 78#ifdef CONFIG_KWALLETIF
79 cout << "CONFIG_KWALLETIF: enabled" << endl; 79 cout << "CONFIG_KWALLETIF: enabled" << endl;
80#else 80#else
81 cout << "CONFIG_KWALLETIF: disabled" << endl; 81 cout << "CONFIG_KWALLETIF: disabled" << endl;
82#endif 82#endif
83#ifdef BIG_ENDIAN_HOST 83#ifdef BIG_ENDIAN_HOST
84 cout << "Endianess: big-endian" << endl; 84 cout << "Endianess: big-endian" << endl;
85#else 85#else
86 cout << "Endianess: little-endian" << endl; 86 cout << "Endianess: little-endian" << endl;
87#endif 87#endif
88#ifdef WORDS_BIGENDIAN 88#ifdef WORDS_BIGENDIAN
89 cout << "Endianess 2: big-endian" << endl; 89 cout << "Endianess 2: big-endian" << endl;
90#else 90#else
91 cout << "Endianess 2: little-endian" << endl; 91 cout << "Endianess 2: little-endian" << endl;
92#endif 92#endif
93 93
94 cout << "sizeof(long): " << sizeof(long) << endl; 94 cout << "sizeof(long): " << sizeof(long) << endl;
95 cout << "================================" << endl; 95 cout << "================================" << endl;
96} 96}
97#else // PWM_DEBUG 97#else // PWM_DEBUG
98static inline void printDebugConfigureInfo() { /* nothing */ } 98static inline void printDebugConfigureInfo() { /* nothing */ }
99#endif // PWM_DEBUG 99#endif // PWM_DEBUG
100 100
101#ifndef PWM_EMBEDDED 101#ifndef PWM_EMBEDDED
102static void addAuthors(KAboutData *aboutData) 102static void addAuthors(KAboutData *aboutData)
103{ 103{
104 aboutData->addAuthor("Michael Buesch", 104 aboutData->addAuthor("Michael Buesch",
105 I18N_NOOP( 105 I18N_NOOP(
106 "main programming and current maintainer"), 106 "main programming and current maintainer"),
107 "mbuesch@freenet.de"); 107 "mbuesch@freenet.de");
108 aboutData->addAuthor("Matt Scifo", 108 aboutData->addAuthor("Matt Scifo",
109 I18N_NOOP( 109 I18N_NOOP(
110 "original implementaion of \n" 110 "original implementaion of \n"
111 "\"categories\" and the password-tree \n" 111 "\"categories\" and the password-tree \n"
112 "in the system-tray. Original implementations of \n" 112 "in the system-tray. Original implementations of \n"
113 "numerous view-improvements."), 113 "numerous view-improvements."),
114 "mscifo@o1.com"); 114 "mscifo@o1.com");
115 aboutData->addCredit("Elias Probst", 115 aboutData->addCredit("Elias Probst",
116 I18N_NOOP( 116 I18N_NOOP(
117 "Gentoo ebuild maintainer."), 117 "Gentoo ebuild maintainer."),
118 "elias.probst@gmx.de"); 118 "elias.probst@gmx.de");
119 aboutData->addCredit("George Staikos", 119 aboutData->addCredit("George Staikos",
120 I18N_NOOP("KWallet"), 120 I18N_NOOP("KWallet"),
121 "staikos@kde.org"); 121 "staikos@kde.org");
122 aboutData->addCredit("Matthew Palmer", 122 aboutData->addCredit("Matthew Palmer",
123 I18N_NOOP("rc2 code"), 123 I18N_NOOP("rc2 code"),
124 "mjp16@uow.edu.au"); 124 "mjp16@uow.edu.au");
125 aboutData->addCredit("Olivier Sessink", 125 aboutData->addCredit("Olivier Sessink",
126 I18N_NOOP("gpasman"), 126 I18N_NOOP("gpasman"),
127 "gpasman@nl.linux.org"); 127 "gpasman@nl.linux.org");
128 aboutData->addCredit("The libgcrypt developers", 128 aboutData->addCredit("The libgcrypt developers",
129 I18N_NOOP("Blowfish and SHA1 algorithms"), 129 I18N_NOOP("Blowfish and SHA1 algorithms"),
130 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); 130 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/");
131 aboutData->addCredit("Troy Engel", 131 aboutData->addCredit("Troy Engel",
132 I18N_NOOP("kpasman"), 132 I18N_NOOP("kpasman"),
133 "tengel@sonic.net"); 133 "tengel@sonic.net");
134 aboutData->addCredit("Wickey", 134 aboutData->addCredit("Wickey",
135 I18N_NOOP("graphics-design in older versions."), 135 I18N_NOOP("graphics-design in older versions."),
136 "wickey@gmx.at"); 136 "wickey@gmx.at");
137 aboutData->addCredit("Ian MacGregor", 137 aboutData->addCredit("Ian MacGregor",
138 I18N_NOOP( 138 I18N_NOOP(
139 "original documentation author.")); 139 "original documentation author."));
140} 140}
141#endif 141#endif
142 142
143int main(int argc, char *argv[]) 143int main(int argc, char *argv[])
144{ 144{
145 printDebugConfigureInfo(); 145 printDebugConfigureInfo();
146#ifndef PWM_EMBEDDED 146#ifndef PWM_EMBEDDED
147 KAboutData aboutData(PACKAGE_NAME, PROG_NAME, 147 KAboutData aboutData(PACKAGE_NAME, PROG_NAME,
148 PACKAGE_VER, description, KAboutData::License_File, 148 PACKAGE_VER, description, KAboutData::License_File,
149 "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, 149 "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0,
150 "http://passwordmanager.sourceforge.net/", 150 "http://passwordmanager.sourceforge.net/",
151 "mbuesch@freenet.de"); 151 "mbuesch@freenet.de");
152 addAuthors(&aboutData); 152 addAuthors(&aboutData);
153 153
154 KCmdLineArgs::init(argc, argv, &aboutData); 154 KCmdLineArgs::init(argc, argv, &aboutData);
155 KCmdLineArgs::addCmdLineOptions(options); 155 KCmdLineArgs::addCmdLineOptions(options);
156 156
157 KUniqueApplication::addCmdLineOptions(); 157 KUniqueApplication::addCmdLineOptions();
158 if (!KUniqueApplication::start()) { 158 if (!KUniqueApplication::start()) {
159 printInfo("already running."); 159 printInfo("already running.");
160 return EXIT_SUCCESS; 160 return EXIT_SUCCESS;
161 } 161 }
162 PwMApplication a; 162 PwMApplication a;
163 aboutData.setLicenseTextFile(LICENSE_FILE); 163 aboutData.setLicenseTextFile(LICENSE_FILE);
164 return a.exec(); 164 return a.exec();
165#else 165#else
166 166
167 bool exitHelp = false; 167 bool exitHelp = false;
168 if ( argc > 1 ) { 168 if ( argc > 1 ) {
169 QString command = argv[1]; 169 QString command = argv[1];
170 if ( command == "-help" ){ 170 if ( command == "-help" ){
171 printf("PWM/PI command line commands:\n"); 171 printf("PWM/PI command line commands:\n");
172 printf(" no command: Start PWM/PI in usual way\n"); 172 printf(" no command: Start PWM/PI in usual way\n");
173 printf(" -help: This output\n"); 173 printf(" -help: This output\n");
174 printf(" PWM/PI is exiting now. Bye!\n"); 174 printf(" PWM/PI is exiting now. Bye!\n");
175 exitHelp = true; 175 exitHelp = true;
176 } 176 }
177 } 177 }
178 if ( ! exitHelp ) { 178 if ( ! exitHelp ) {
179 179
180 PwMApplication a(argc, argv); 180 PwMApplication a(argc, argv);
181 181
182 KGlobal::setAppName( "pwmanager" ); 182 KGlobal::setAppName( "pwmanager" );
183#ifndef DESKTOP_VERSION 183#ifndef DESKTOP_VERSION
184 //qDebug("width %d ",QApplication::desktop()->width() ); 184 //qDebug("width %d ",QApplication::desktop()->width() );
185 if ( QApplication::desktop()->width() > 320 ) 185 if ( QApplication::desktop()->width() > 320 )
186 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); 186 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/");
187 else 187 else
188 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); 188 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/");
189#else 189#else
190 QString fileName ; 190 QString fileName ;
191 fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; 191 fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/";
192 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 192 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
193 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 193 QApplication::addLibraryPath ( qApp->applicationDirPath () );
194 194
195#endif 195#endif
196 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); 196 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager")));
197 KPimGlobalPrefs::instance()->setGlobalConfig(); 197 KPimGlobalPrefs::instance()->setGlobalConfig();
198 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
198 199
199 a.newInstance(); 200 a.newInstance();
200 201
201 //US KAddressBookMain m ; 202 //US KAddressBookMain m ;
202 203
203 //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 204 //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
204 /*US 205 /*US
205#ifndef DESKTOP_VERSION 206#ifndef DESKTOP_VERSION
206 a.showMainWidget( &m ); 207 a.showMainWidget( &m );
207#else 208#else
208 a.setMainWidget( &m ); 209 a.setMainWidget( &m );
209 m.resize (640, 480 ); 210 m.resize (640, 480 );
210 m.show(); 211 m.show();
211#endif 212#endif
212 */ 213 */
213 QObject::connect( &a, SIGNAL( lastWindowClosed()), &a, SLOT (quit())); 214 QObject::connect( &a, SIGNAL( lastWindowClosed()), &a, SLOT (quit()));
214 a.exec(); 215 a.exec();
215 dumpMissing(); 216 dumpMissing();
216 KPimGlobalPrefs::instance()->writeConfig(); 217 KPimGlobalPrefs::instance()->writeConfig();
217 } 218 }
218 qDebug("PWMPI: Bye! "); 219 qDebug("PWMPI: Bye! ");
219 220
220#endif 221#endif
221 222
222} 223}