author | zautrix <zautrix> | 2004-10-08 23:38:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-08 23:38:07 (UTC) |
commit | 07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (patch) (unidiff) | |
tree | 03d0e5d20e607e035e17fcdabd6bce789069f41e | |
parent | 44169895703beb3e8b1551a313d2d341bf742905 (diff) | |
download | kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.zip kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.gz kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.bz2 |
some bugfixes
-rw-r--r-- | kabc/addressee.cpp | 16 | ||||
-rw-r--r-- | kabc/addressee.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 8 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 3 | ||||
-rw-r--r-- | kalarmd/simplealarmdaemonapplet.cpp | 1 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp | 381 | ||||
-rw-r--r-- | korganizer/main.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 10 | ||||
-rw-r--r-- | microkde/kstaticdeleter.h | 6 |
11 files changed, 40 insertions, 400 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e571980..19a1845 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -126,384 +126,400 @@ Addressee Addressee::copy() | |||
126 | void Addressee::detach() | 126 | void Addressee::detach() |
127 | { | 127 | { |
128 | if ( mData.count() == 1 ) return; | 128 | if ( mData.count() == 1 ) return; |
129 | *this = copy(); | 129 | *this = copy(); |
130 | } | 130 | } |
131 | 131 | ||
132 | bool Addressee::operator==( const Addressee &a ) const | 132 | bool Addressee::operator==( const Addressee &a ) const |
133 | { | 133 | { |
134 | if ( uid() != a.uid() ) return false; | 134 | if ( uid() != a.uid() ) return false; |
135 | if ( mData->name != a.mData->name ) return false; | 135 | if ( mData->name != a.mData->name ) return false; |
136 | if ( mData->formattedName != a.mData->formattedName ) return false; | 136 | if ( mData->formattedName != a.mData->formattedName ) return false; |
137 | if ( mData->familyName != a.mData->familyName ) return false; | 137 | if ( mData->familyName != a.mData->familyName ) return false; |
138 | if ( mData->givenName != a.mData->givenName ) return false; | 138 | if ( mData->givenName != a.mData->givenName ) return false; |
139 | if ( mData->additionalName != a.mData->additionalName ) return false; | 139 | if ( mData->additionalName != a.mData->additionalName ) return false; |
140 | if ( mData->prefix != a.mData->prefix ) return false; | 140 | if ( mData->prefix != a.mData->prefix ) return false; |
141 | if ( mData->suffix != a.mData->suffix ) return false; | 141 | if ( mData->suffix != a.mData->suffix ) return false; |
142 | if ( mData->nickName != a.mData->nickName ) return false; | 142 | if ( mData->nickName != a.mData->nickName ) return false; |
143 | if ( mData->birthday != a.mData->birthday ) return false; | 143 | if ( mData->birthday != a.mData->birthday ) return false; |
144 | if ( mData->mailer != a.mData->mailer ) return false; | 144 | if ( mData->mailer != a.mData->mailer ) return false; |
145 | if ( mData->timeZone != a.mData->timeZone ) return false; | 145 | if ( mData->timeZone != a.mData->timeZone ) return false; |
146 | if ( mData->geo != a.mData->geo ) return false; | 146 | if ( mData->geo != a.mData->geo ) return false; |
147 | if ( mData->title != a.mData->title ) return false; | 147 | if ( mData->title != a.mData->title ) return false; |
148 | if ( mData->role != a.mData->role ) return false; | 148 | if ( mData->role != a.mData->role ) return false; |
149 | if ( mData->organization != a.mData->organization ) return false; | 149 | if ( mData->organization != a.mData->organization ) return false; |
150 | if ( mData->note != a.mData->note ) return false; | 150 | if ( mData->note != a.mData->note ) return false; |
151 | if ( mData->productId != a.mData->productId ) return false; | 151 | if ( mData->productId != a.mData->productId ) return false; |
152 | //if ( mData->revision != a.mData->revision ) return false; | 152 | //if ( mData->revision != a.mData->revision ) return false; |
153 | if ( mData->sortString != a.mData->sortString ) return false; | 153 | if ( mData->sortString != a.mData->sortString ) return false; |
154 | if ( mData->secrecy != a.mData->secrecy ) return false; | 154 | if ( mData->secrecy != a.mData->secrecy ) return false; |
155 | if ( mData->logo != a.mData->logo ) return false; | 155 | if ( mData->logo != a.mData->logo ) return false; |
156 | if ( mData->photo != a.mData->photo ) return false; | 156 | if ( mData->photo != a.mData->photo ) return false; |
157 | if ( mData->sound != a.mData->sound ) return false; | 157 | if ( mData->sound != a.mData->sound ) return false; |
158 | if ( mData->agent != a.mData->agent ) return false; | 158 | if ( mData->agent != a.mData->agent ) return false; |
159 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 159 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
160 | ( mData->url != a.mData->url ) ) return false; | 160 | ( mData->url != a.mData->url ) ) return false; |
161 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 161 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
162 | if ( mData->addresses != a.mData->addresses ) return false; | 162 | if ( mData->addresses != a.mData->addresses ) return false; |
163 | if ( mData->keys != a.mData->keys ) return false; | 163 | if ( mData->keys != a.mData->keys ) return false; |
164 | if ( mData->emails != a.mData->emails ) return false; | 164 | if ( mData->emails != a.mData->emails ) return false; |
165 | if ( mData->categories != a.mData->categories ) return false; | 165 | if ( mData->categories != a.mData->categories ) return false; |
166 | if ( mData->custom != a.mData->custom ) return false; | 166 | if ( mData->custom != a.mData->custom ) return false; |
167 | 167 | ||
168 | return true; | 168 | return true; |
169 | } | 169 | } |
170 | 170 | ||
171 | bool Addressee::operator!=( const Addressee &a ) const | 171 | bool Addressee::operator!=( const Addressee &a ) const |
172 | { | 172 | { |
173 | return !( a == *this ); | 173 | return !( a == *this ); |
174 | } | 174 | } |
175 | 175 | ||
176 | bool Addressee::isEmpty() const | 176 | bool Addressee::isEmpty() const |
177 | { | 177 | { |
178 | return mData->empty; | 178 | return mData->empty; |
179 | } | 179 | } |
180 | ulong Addressee::getCsum4List( const QStringList & attList) | 180 | ulong Addressee::getCsum4List( const QStringList & attList) |
181 | { | 181 | { |
182 | int max = attList.count(); | 182 | int max = attList.count(); |
183 | ulong cSum = 0; | 183 | ulong cSum = 0; |
184 | int j,k,i; | 184 | int j,k,i; |
185 | int add; | 185 | int add; |
186 | for ( i = 0; i < max ; ++i ) { | 186 | for ( i = 0; i < max ; ++i ) { |
187 | QString s = attList[i]; | 187 | QString s = attList[i]; |
188 | if ( ! s.isEmpty() ){ | 188 | if ( ! s.isEmpty() ){ |
189 | j = s.length(); | 189 | j = s.length(); |
190 | for ( k = 0; k < j; ++k ) { | 190 | for ( k = 0; k < j; ++k ) { |
191 | int mul = k +1; | 191 | int mul = k +1; |
192 | add = s[k].unicode (); | 192 | add = s[k].unicode (); |
193 | if ( k < 16 ) | 193 | if ( k < 16 ) |
194 | mul = mul * mul; | 194 | mul = mul * mul; |
195 | int ii = i+1; | 195 | int ii = i+1; |
196 | add = add * mul *ii*ii*ii; | 196 | add = add * mul *ii*ii*ii; |
197 | cSum += add; | 197 | cSum += add; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | } | 201 | } |
202 | //QString dump = attList.join(","); | 202 | //QString dump = attList.join(","); |
203 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 203 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
204 | 204 | ||
205 | return cSum; | 205 | return cSum; |
206 | 206 | ||
207 | } | 207 | } |
208 | void Addressee::computeCsum(const QString &dev) | 208 | void Addressee::computeCsum(const QString &dev) |
209 | { | 209 | { |
210 | QStringList l; | 210 | QStringList l; |
211 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 211 | if ( !mData->name.isEmpty() ) l.append(mData->name); |
212 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 212 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
213 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 213 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
214 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 214 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
215 | if ( !mData->additionalName ) l.append( mData->additionalName ); | 215 | if ( !mData->additionalName ) l.append( mData->additionalName ); |
216 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 216 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
217 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 217 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
218 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 218 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
219 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 219 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
220 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 220 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
221 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 221 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
222 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 222 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
223 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 223 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
224 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 224 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
225 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 225 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
226 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 226 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
227 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 227 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
228 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 228 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
229 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 229 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
230 | // if ( !mData->logo.isEmpty() ) l.append( ); | 230 | // if ( !mData->logo.isEmpty() ) l.append( ); |
231 | //if ( !mData->photo.isEmpty() ) l.append( ); | 231 | //if ( !mData->photo.isEmpty() ) l.append( ); |
232 | //if ( !mData->sound.isEmpty() ) l.append( ); | 232 | //if ( !mData->sound.isEmpty() ) l.append( ); |
233 | //if ( !mData->agent.isEmpty() ) l.append( ); | 233 | //if ( !mData->agent.isEmpty() ) l.append( ); |
234 | //if ( mData->url.isValid() ) l.append( ); | 234 | //if ( mData->url.isValid() ) l.append( ); |
235 | #if 0 | 235 | #if 0 |
236 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); | 236 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); |
237 | if ( !mData->addresses.isEmpty() ) l.append( ); | 237 | if ( !mData->addresses.isEmpty() ) l.append( ); |
238 | //if ( !mData->keys.isEmpty() ) l.append( ); | 238 | //if ( !mData->keys.isEmpty() ) l.append( ); |
239 | if ( !mData->emails.isEmpty() ) l.append( ); | 239 | if ( !mData->emails.isEmpty() ) l.append( ); |
240 | if ( !mData->categories .isEmpty() ) l.append( ); | 240 | if ( !mData->categories .isEmpty() ) l.append( ); |
241 | if ( !mData->custom.isEmpty() ) l.append( ); | 241 | if ( !mData->custom.isEmpty() ) l.append( ); |
242 | #endif | 242 | #endif |
243 | KABC::PhoneNumber::List phoneNumbers; | 243 | KABC::PhoneNumber::List phoneNumbers; |
244 | KABC::PhoneNumber::List::Iterator phoneIter; | 244 | KABC::PhoneNumber::List::Iterator phoneIter; |
245 | 245 | ||
246 | QStringList t; | 246 | QStringList t; |
247 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 247 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
248 | ++phoneIter ) | 248 | ++phoneIter ) |
249 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 249 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
250 | t.sort(); | 250 | t.sort(); |
251 | uint iii; | 251 | uint iii; |
252 | for ( iii = 0; iii < t.count(); ++iii) | 252 | for ( iii = 0; iii < t.count(); ++iii) |
253 | l.append( t[iii] ); | 253 | l.append( t[iii] ); |
254 | t = mData->emails; | 254 | t = mData->emails; |
255 | t.sort(); | 255 | t.sort(); |
256 | for ( iii = 0; iii < t.count(); ++iii) | 256 | for ( iii = 0; iii < t.count(); ++iii) |
257 | l.append( t[iii] ); | 257 | l.append( t[iii] ); |
258 | t = mData->categories; | 258 | t = mData->categories; |
259 | t.sort(); | 259 | t.sort(); |
260 | for ( iii = 0; iii < t.count(); ++iii) | 260 | for ( iii = 0; iii < t.count(); ++iii) |
261 | l.append( t[iii] ); | 261 | l.append( t[iii] ); |
262 | t = mData->custom; | 262 | t = mData->custom; |
263 | t.sort(); | 263 | t.sort(); |
264 | for ( iii = 0; iii < t.count(); ++iii) | 264 | for ( iii = 0; iii < t.count(); ++iii) |
265 | l.append( t[iii] ); | 265 | l.append( t[iii] ); |
266 | KABC::Address::List::Iterator addressIter; | 266 | KABC::Address::List::Iterator addressIter; |
267 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 267 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
268 | ++addressIter ) { | 268 | ++addressIter ) { |
269 | t = (*addressIter).asList(); | 269 | t = (*addressIter).asList(); |
270 | t.sort(); | 270 | t.sort(); |
271 | for ( iii = 0; iii < t.count(); ++iii) | 271 | for ( iii = 0; iii < t.count(); ++iii) |
272 | l.append( t[iii] ); | 272 | l.append( t[iii] ); |
273 | } | 273 | } |
274 | uint cs = getCsum4List(l); | 274 | uint cs = getCsum4List(l); |
275 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 275 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
276 | setCsum( dev, QString::number (cs )); | 276 | setCsum( dev, QString::number (cs )); |
277 | } | 277 | } |
278 | 278 | ||
279 | void Addressee::mergeContact( const Addressee& ad ) | 279 | void Addressee::mergeContact( const Addressee& ad ) |
280 | { | 280 | { |
281 | 281 | ||
282 | detach(); | 282 | detach(); |
283 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 283 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
284 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 284 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
285 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 285 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
286 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 286 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
287 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 287 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
288 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 288 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
289 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 289 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
290 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 290 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
291 | if ( !mData->birthday.isValid() ) | 291 | if ( !mData->birthday.isValid() ) |
292 | if ( ad.mData->birthday.isValid()) | 292 | if ( ad.mData->birthday.isValid()) |
293 | mData->birthday = ad.mData->birthday; | 293 | mData->birthday = ad.mData->birthday; |
294 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 294 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
295 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 295 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
296 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 296 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
297 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 297 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
298 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 298 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
299 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 299 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
300 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 300 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
301 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 301 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
302 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 302 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
303 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 303 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
304 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 304 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
305 | 305 | ||
306 | // pending: | 306 | // pending: |
307 | // merging phonenumbers | 307 | // merging phonenumbers |
308 | // merging addresses | 308 | // merging addresses |
309 | // merging emails; | 309 | // merging emails; |
310 | // merging categories; | 310 | // merging categories; |
311 | // merging custom; | 311 | // merging custom; |
312 | // merging keys | 312 | // merging keys |
313 | qDebug("merge contact %s ", ad.uid().latin1()); | 313 | qDebug("merge contact %s ", ad.uid().latin1()); |
314 | setUid( ad.uid() ); | 314 | setUid( ad.uid() ); |
315 | setRevision( ad.revision() ); | 315 | setRevision( ad.revision() ); |
316 | } | 316 | } |
317 | 317 | ||
318 | void Addressee::simplifyAddresses() | ||
319 | { | ||
320 | if ( mData->addresses.count() < 3 ) return ; | ||
321 | int count = 0; | ||
322 | Address::List list; | ||
323 | Address::List::Iterator it; | ||
324 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | ||
325 | if ( count > 1 ) | ||
326 | list.append( *it ); | ||
327 | ++count; | ||
328 | } | ||
329 | for( it = list.begin(); it != list.end(); ++it ) { | ||
330 | removeAddress( (*it) ); | ||
331 | } | ||
332 | } | ||
333 | |||
318 | // removes all emails but the first | 334 | // removes all emails but the first |
319 | // needed by phone sync | 335 | // needed by phone sync |
320 | void Addressee::simplifyEmails() | 336 | void Addressee::simplifyEmails() |
321 | { | 337 | { |
322 | if ( mData->emails.count() == 0 ) return ; | 338 | if ( mData->emails.count() == 0 ) return ; |
323 | QString email = mData->emails.first(); | 339 | QString email = mData->emails.first(); |
324 | detach(); | 340 | detach(); |
325 | mData->emails.clear(); | 341 | mData->emails.clear(); |
326 | mData->emails.append( email ); | 342 | mData->emails.append( email ); |
327 | } | 343 | } |
328 | 344 | ||
329 | void Addressee::simplifyPhoneNumbers() | 345 | void Addressee::simplifyPhoneNumbers() |
330 | { | 346 | { |
331 | KABC::PhoneNumber::List removeNumbers; | 347 | KABC::PhoneNumber::List removeNumbers; |
332 | KABC::PhoneNumber::List::Iterator phoneIter; | 348 | KABC::PhoneNumber::List::Iterator phoneIter; |
333 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 349 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
334 | ++phoneIter ) { | 350 | ++phoneIter ) { |
335 | if ( ! ( *phoneIter ).simplifyNumber() ) | 351 | if ( ! ( *phoneIter ).simplifyNumber() ) |
336 | removeNumbers.append( ( *phoneIter ) ); | 352 | removeNumbers.append( ( *phoneIter ) ); |
337 | } | 353 | } |
338 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 354 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
339 | ++phoneIter ) { | 355 | ++phoneIter ) { |
340 | removePhoneNumber(( *phoneIter )); | 356 | removePhoneNumber(( *phoneIter )); |
341 | } | 357 | } |
342 | } | 358 | } |
343 | void Addressee::simplifyPhoneNumberTypes() | 359 | void Addressee::simplifyPhoneNumberTypes() |
344 | { | 360 | { |
345 | KABC::PhoneNumber::List::Iterator phoneIter; | 361 | KABC::PhoneNumber::List::Iterator phoneIter; |
346 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 362 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
347 | ++phoneIter ) | 363 | ++phoneIter ) |
348 | ( *phoneIter ).simplifyType(); | 364 | ( *phoneIter ).simplifyType(); |
349 | } | 365 | } |
350 | void Addressee::removeID(const QString &prof) | 366 | void Addressee::removeID(const QString &prof) |
351 | { | 367 | { |
352 | detach(); | 368 | detach(); |
353 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 369 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
354 | 370 | ||
355 | } | 371 | } |
356 | void Addressee::setID( const QString & prof , const QString & id ) | 372 | void Addressee::setID( const QString & prof , const QString & id ) |
357 | { | 373 | { |
358 | detach(); | 374 | detach(); |
359 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 375 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
360 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 376 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
361 | } | 377 | } |
362 | void Addressee::setTempSyncStat( int id ) | 378 | void Addressee::setTempSyncStat( int id ) |
363 | { | 379 | { |
364 | if ( mData->mTempSyncStat == id ) return; | 380 | if ( mData->mTempSyncStat == id ) return; |
365 | detach(); | 381 | detach(); |
366 | mData->mTempSyncStat = id; | 382 | mData->mTempSyncStat = id; |
367 | } | 383 | } |
368 | int Addressee::tempSyncStat() const | 384 | int Addressee::tempSyncStat() const |
369 | { | 385 | { |
370 | return mData->mTempSyncStat; | 386 | return mData->mTempSyncStat; |
371 | } | 387 | } |
372 | 388 | ||
373 | QString Addressee::getID( const QString & prof) | 389 | QString Addressee::getID( const QString & prof) |
374 | { | 390 | { |
375 | return KIdManager::getId ( mData->mExternalId, prof ); | 391 | return KIdManager::getId ( mData->mExternalId, prof ); |
376 | } | 392 | } |
377 | 393 | ||
378 | void Addressee::setCsum( const QString & prof , const QString & id ) | 394 | void Addressee::setCsum( const QString & prof , const QString & id ) |
379 | { | 395 | { |
380 | detach(); | 396 | detach(); |
381 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 397 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
382 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 398 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
383 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 399 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
384 | } | 400 | } |
385 | 401 | ||
386 | QString Addressee::getCsum( const QString & prof) | 402 | QString Addressee::getCsum( const QString & prof) |
387 | { | 403 | { |
388 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 404 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
389 | } | 405 | } |
390 | 406 | ||
391 | void Addressee::setIDStr( const QString & s ) | 407 | void Addressee::setIDStr( const QString & s ) |
392 | { | 408 | { |
393 | detach(); | 409 | detach(); |
394 | mData->mExternalId = s; | 410 | mData->mExternalId = s; |
395 | } | 411 | } |
396 | 412 | ||
397 | QString Addressee::IDStr() const | 413 | QString Addressee::IDStr() const |
398 | { | 414 | { |
399 | return mData->mExternalId; | 415 | return mData->mExternalId; |
400 | } | 416 | } |
401 | 417 | ||
402 | void Addressee::setExternalUID( const QString &id ) | 418 | void Addressee::setExternalUID( const QString &id ) |
403 | { | 419 | { |
404 | if ( id == mData->externalUID ) return; | 420 | if ( id == mData->externalUID ) return; |
405 | detach(); | 421 | detach(); |
406 | mData->empty = false; | 422 | mData->empty = false; |
407 | mData->externalUID = id; | 423 | mData->externalUID = id; |
408 | } | 424 | } |
409 | 425 | ||
410 | QString Addressee::externalUID() const | 426 | QString Addressee::externalUID() const |
411 | { | 427 | { |
412 | return mData->externalUID; | 428 | return mData->externalUID; |
413 | } | 429 | } |
414 | void Addressee::setOriginalExternalUID( const QString &id ) | 430 | void Addressee::setOriginalExternalUID( const QString &id ) |
415 | { | 431 | { |
416 | if ( id == mData->originalExternalUID ) return; | 432 | if ( id == mData->originalExternalUID ) return; |
417 | detach(); | 433 | detach(); |
418 | mData->empty = false; | 434 | mData->empty = false; |
419 | //qDebug("*******Set orig uid %s ", id.latin1()); | 435 | //qDebug("*******Set orig uid %s ", id.latin1()); |
420 | mData->originalExternalUID = id; | 436 | mData->originalExternalUID = id; |
421 | } | 437 | } |
422 | 438 | ||
423 | QString Addressee::originalExternalUID() const | 439 | QString Addressee::originalExternalUID() const |
424 | { | 440 | { |
425 | return mData->originalExternalUID; | 441 | return mData->originalExternalUID; |
426 | } | 442 | } |
427 | 443 | ||
428 | void Addressee::setUid( const QString &id ) | 444 | void Addressee::setUid( const QString &id ) |
429 | { | 445 | { |
430 | if ( id == mData->uid ) return; | 446 | if ( id == mData->uid ) return; |
431 | detach(); | 447 | detach(); |
432 | //qDebug("****setuid %s ", id.latin1()); | 448 | //qDebug("****setuid %s ", id.latin1()); |
433 | mData->empty = false; | 449 | mData->empty = false; |
434 | mData->uid = id; | 450 | mData->uid = id; |
435 | } | 451 | } |
436 | 452 | ||
437 | QString Addressee::uid() const | 453 | QString Addressee::uid() const |
438 | { | 454 | { |
439 | if ( mData->uid.isEmpty() ) | 455 | if ( mData->uid.isEmpty() ) |
440 | mData->uid = KApplication::randomString( 10 ); | 456 | mData->uid = KApplication::randomString( 10 ); |
441 | 457 | ||
442 | return mData->uid; | 458 | return mData->uid; |
443 | } | 459 | } |
444 | 460 | ||
445 | QString Addressee::uidLabel() | 461 | QString Addressee::uidLabel() |
446 | { | 462 | { |
447 | return i18n("Unique Identifier"); | 463 | return i18n("Unique Identifier"); |
448 | } | 464 | } |
449 | 465 | ||
450 | void Addressee::setName( const QString &name ) | 466 | void Addressee::setName( const QString &name ) |
451 | { | 467 | { |
452 | if ( name == mData->name ) return; | 468 | if ( name == mData->name ) return; |
453 | detach(); | 469 | detach(); |
454 | mData->empty = false; | 470 | mData->empty = false; |
455 | mData->name = name; | 471 | mData->name = name; |
456 | } | 472 | } |
457 | 473 | ||
458 | QString Addressee::name() const | 474 | QString Addressee::name() const |
459 | { | 475 | { |
460 | return mData->name; | 476 | return mData->name; |
461 | } | 477 | } |
462 | 478 | ||
463 | QString Addressee::nameLabel() | 479 | QString Addressee::nameLabel() |
464 | { | 480 | { |
465 | return i18n("Name"); | 481 | return i18n("Name"); |
466 | } | 482 | } |
467 | 483 | ||
468 | 484 | ||
469 | void Addressee::setFormattedName( const QString &formattedName ) | 485 | void Addressee::setFormattedName( const QString &formattedName ) |
470 | { | 486 | { |
471 | if ( formattedName == mData->formattedName ) return; | 487 | if ( formattedName == mData->formattedName ) return; |
472 | detach(); | 488 | detach(); |
473 | mData->empty = false; | 489 | mData->empty = false; |
474 | mData->formattedName = formattedName; | 490 | mData->formattedName = formattedName; |
475 | } | 491 | } |
476 | 492 | ||
477 | QString Addressee::formattedName() const | 493 | QString Addressee::formattedName() const |
478 | { | 494 | { |
479 | return mData->formattedName; | 495 | return mData->formattedName; |
480 | } | 496 | } |
481 | 497 | ||
482 | QString Addressee::formattedNameLabel() | 498 | QString Addressee::formattedNameLabel() |
483 | { | 499 | { |
484 | return i18n("Formatted Name"); | 500 | return i18n("Formatted Name"); |
485 | } | 501 | } |
486 | 502 | ||
487 | 503 | ||
488 | void Addressee::setFamilyName( const QString &familyName ) | 504 | void Addressee::setFamilyName( const QString &familyName ) |
489 | { | 505 | { |
490 | if ( familyName == mData->familyName ) return; | 506 | if ( familyName == mData->familyName ) return; |
491 | detach(); | 507 | detach(); |
492 | mData->empty = false; | 508 | mData->empty = false; |
493 | mData->familyName = familyName; | 509 | mData->familyName = familyName; |
494 | } | 510 | } |
495 | 511 | ||
496 | QString Addressee::familyName() const | 512 | QString Addressee::familyName() const |
497 | { | 513 | { |
498 | return mData->familyName; | 514 | return mData->familyName; |
499 | } | 515 | } |
500 | 516 | ||
501 | QString Addressee::familyNameLabel() | 517 | QString Addressee::familyNameLabel() |
502 | { | 518 | { |
503 | return i18n("Family Name"); | 519 | return i18n("Family Name"); |
504 | } | 520 | } |
505 | 521 | ||
506 | 522 | ||
507 | void Addressee::setGivenName( const QString &givenName ) | 523 | void Addressee::setGivenName( const QString &givenName ) |
508 | { | 524 | { |
509 | if ( givenName == mData->givenName ) return; | 525 | if ( givenName == mData->givenName ) return; |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 4cafa86..44f0629 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -1,312 +1,313 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef KABC_ADDRESSEE_H | 29 | #ifndef KABC_ADDRESSEE_H |
30 | #define KABC_ADDRESSEE_H | 30 | #define KABC_ADDRESSEE_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | 36 | ||
37 | #include <ksharedptr.h> | 37 | #include <ksharedptr.h> |
38 | #include <kurl.h> | 38 | #include <kurl.h> |
39 | 39 | ||
40 | #include "address.h" | 40 | #include "address.h" |
41 | #include "agent.h" | 41 | #include "agent.h" |
42 | #include "geo.h" | 42 | #include "geo.h" |
43 | #include "key.h" | 43 | #include "key.h" |
44 | #include "phonenumber.h" | 44 | #include "phonenumber.h" |
45 | #include "picture.h" | 45 | #include "picture.h" |
46 | #include "secrecy.h" | 46 | #include "secrecy.h" |
47 | #include "sound.h" | 47 | #include "sound.h" |
48 | #include "timezone.h" | 48 | #include "timezone.h" |
49 | 49 | ||
50 | namespace KABC { | 50 | namespace KABC { |
51 | 51 | ||
52 | class Resource; | 52 | class Resource; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | @short address book entry | 55 | @short address book entry |
56 | 56 | ||
57 | This class represents an entry in the address book. | 57 | This class represents an entry in the address book. |
58 | 58 | ||
59 | The data of this class is implicitly shared. You can pass this class by value. | 59 | The data of this class is implicitly shared. You can pass this class by value. |
60 | 60 | ||
61 | If you need the name of a field for presenting it to the user you should use | 61 | If you need the name of a field for presenting it to the user you should use |
62 | the functions ending in Label(). They return a translated string which can be | 62 | the functions ending in Label(). They return a translated string which can be |
63 | used as label for the corresponding field. | 63 | used as label for the corresponding field. |
64 | 64 | ||
65 | About the name fields: | 65 | About the name fields: |
66 | 66 | ||
67 | givenName() is the first name and familyName() the last name. In some | 67 | givenName() is the first name and familyName() the last name. In some |
68 | countries the family name comes first, that's the reason for the | 68 | countries the family name comes first, that's the reason for the |
69 | naming. formattedName() is the full name with the correct formatting. | 69 | naming. formattedName() is the full name with the correct formatting. |
70 | It is used as an override, when the correct formatting can't be generated | 70 | It is used as an override, when the correct formatting can't be generated |
71 | from the other name fields automatically. | 71 | from the other name fields automatically. |
72 | 72 | ||
73 | realName() returns a fully formatted name(). It uses formattedName, if set, | 73 | realName() returns a fully formatted name(). It uses formattedName, if set, |
74 | otherwise it constucts the name from the name fields. As fallback, if | 74 | otherwise it constucts the name from the name fields. As fallback, if |
75 | nothing else is set it uses name(). | 75 | nothing else is set it uses name(). |
76 | 76 | ||
77 | name() is the NAME type of RFC2426. It can be used as internal name for the | 77 | name() is the NAME type of RFC2426. It can be used as internal name for the |
78 | data enty, but shouldn't be used for displaying the data to the user. | 78 | data enty, but shouldn't be used for displaying the data to the user. |
79 | */ | 79 | */ |
80 | class Addressee | 80 | class Addressee |
81 | { | 81 | { |
82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QValueList<Addressee> List; | 86 | typedef QValueList<Addressee> List; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Construct an empty address book entry. | 89 | Construct an empty address book entry. |
90 | */ | 90 | */ |
91 | Addressee(); | 91 | Addressee(); |
92 | ~Addressee(); | 92 | ~Addressee(); |
93 | 93 | ||
94 | Addressee( const Addressee & ); | 94 | Addressee( const Addressee & ); |
95 | Addressee &operator=( const Addressee & ); | 95 | Addressee &operator=( const Addressee & ); |
96 | 96 | ||
97 | bool operator==( const Addressee & ) const; | 97 | bool operator==( const Addressee & ) const; |
98 | bool operator!=( const Addressee & ) const; | 98 | bool operator!=( const Addressee & ) const; |
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | QString IDStr() const; | 103 | QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | QString getID( const QString & ); | 105 | QString getID( const QString & ); |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | QString getCsum( const QString & ); | 107 | QString getCsum( const QString & ); |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | void setExternalUID( const QString &id ); | 115 | void setExternalUID( const QString &id ); |
116 | QString externalUID() const; | 116 | QString externalUID() const; |
117 | void setOriginalExternalUID( const QString &id ); | 117 | void setOriginalExternalUID( const QString &id ); |
118 | QString originalExternalUID() const; | 118 | QString originalExternalUID() const; |
119 | void mergeContact( const Addressee& ad ); | 119 | void mergeContact( const Addressee& ad ); |
120 | void simplifyEmails(); | 120 | void simplifyEmails(); |
121 | void simplifyAddresses(); | ||
121 | void simplifyPhoneNumbers(); | 122 | void simplifyPhoneNumbers(); |
122 | void simplifyPhoneNumberTypes(); | 123 | void simplifyPhoneNumberTypes(); |
123 | 124 | ||
124 | /** | 125 | /** |
125 | Set unique identifier. | 126 | Set unique identifier. |
126 | */ | 127 | */ |
127 | void setUid( const QString &uid ); | 128 | void setUid( const QString &uid ); |
128 | /** | 129 | /** |
129 | Return unique identifier. | 130 | Return unique identifier. |
130 | */ | 131 | */ |
131 | QString uid() const; | 132 | QString uid() const; |
132 | /** | 133 | /** |
133 | Return translated label for uid field. | 134 | Return translated label for uid field. |
134 | */ | 135 | */ |
135 | static QString uidLabel(); | 136 | static QString uidLabel(); |
136 | 137 | ||
137 | /** | 138 | /** |
138 | Set name. | 139 | Set name. |
139 | */ | 140 | */ |
140 | void setName( const QString &name ); | 141 | void setName( const QString &name ); |
141 | /** | 142 | /** |
142 | Return name. | 143 | Return name. |
143 | */ | 144 | */ |
144 | QString name() const; | 145 | QString name() const; |
145 | /** | 146 | /** |
146 | Return translated label for name field. | 147 | Return translated label for name field. |
147 | */ | 148 | */ |
148 | static QString nameLabel(); | 149 | static QString nameLabel(); |
149 | 150 | ||
150 | /** | 151 | /** |
151 | Set formatted name. | 152 | Set formatted name. |
152 | */ | 153 | */ |
153 | void setFormattedName( const QString &formattedName ); | 154 | void setFormattedName( const QString &formattedName ); |
154 | /** | 155 | /** |
155 | Return formatted name. | 156 | Return formatted name. |
156 | */ | 157 | */ |
157 | QString formattedName() const; | 158 | QString formattedName() const; |
158 | /** | 159 | /** |
159 | Return translated label for formattedName field. | 160 | Return translated label for formattedName field. |
160 | */ | 161 | */ |
161 | static QString formattedNameLabel(); | 162 | static QString formattedNameLabel(); |
162 | 163 | ||
163 | /** | 164 | /** |
164 | Set family name. | 165 | Set family name. |
165 | */ | 166 | */ |
166 | void setFamilyName( const QString &familyName ); | 167 | void setFamilyName( const QString &familyName ); |
167 | /** | 168 | /** |
168 | Return family name. | 169 | Return family name. |
169 | */ | 170 | */ |
170 | QString familyName() const; | 171 | QString familyName() const; |
171 | /** | 172 | /** |
172 | Return translated label for familyName field. | 173 | Return translated label for familyName field. |
173 | */ | 174 | */ |
174 | static QString familyNameLabel(); | 175 | static QString familyNameLabel(); |
175 | 176 | ||
176 | /** | 177 | /** |
177 | Set given name. | 178 | Set given name. |
178 | */ | 179 | */ |
179 | void setGivenName( const QString &givenName ); | 180 | void setGivenName( const QString &givenName ); |
180 | /** | 181 | /** |
181 | Return given name. | 182 | Return given name. |
182 | */ | 183 | */ |
183 | QString givenName() const; | 184 | QString givenName() const; |
184 | /** | 185 | /** |
185 | Return translated label for givenName field. | 186 | Return translated label for givenName field. |
186 | */ | 187 | */ |
187 | static QString givenNameLabel(); | 188 | static QString givenNameLabel(); |
188 | 189 | ||
189 | /** | 190 | /** |
190 | Set additional names. | 191 | Set additional names. |
191 | */ | 192 | */ |
192 | void setAdditionalName( const QString &additionalName ); | 193 | void setAdditionalName( const QString &additionalName ); |
193 | /** | 194 | /** |
194 | Return additional names. | 195 | Return additional names. |
195 | */ | 196 | */ |
196 | QString additionalName() const; | 197 | QString additionalName() const; |
197 | /** | 198 | /** |
198 | Return translated label for additionalName field. | 199 | Return translated label for additionalName field. |
199 | */ | 200 | */ |
200 | static QString additionalNameLabel(); | 201 | static QString additionalNameLabel(); |
201 | 202 | ||
202 | /** | 203 | /** |
203 | Set honorific prefixes. | 204 | Set honorific prefixes. |
204 | */ | 205 | */ |
205 | void setPrefix( const QString &prefix ); | 206 | void setPrefix( const QString &prefix ); |
206 | /** | 207 | /** |
207 | Return honorific prefixes. | 208 | Return honorific prefixes. |
208 | */ | 209 | */ |
209 | QString prefix() const; | 210 | QString prefix() const; |
210 | /** | 211 | /** |
211 | Return translated label for prefix field. | 212 | Return translated label for prefix field. |
212 | */ | 213 | */ |
213 | static QString prefixLabel(); | 214 | static QString prefixLabel(); |
214 | 215 | ||
215 | /** | 216 | /** |
216 | Set honorific suffixes. | 217 | Set honorific suffixes. |
217 | */ | 218 | */ |
218 | void setSuffix( const QString &suffix ); | 219 | void setSuffix( const QString &suffix ); |
219 | /** | 220 | /** |
220 | Return honorific suffixes. | 221 | Return honorific suffixes. |
221 | */ | 222 | */ |
222 | QString suffix() const; | 223 | QString suffix() const; |
223 | /** | 224 | /** |
224 | Return translated label for suffix field. | 225 | Return translated label for suffix field. |
225 | */ | 226 | */ |
226 | static QString suffixLabel(); | 227 | static QString suffixLabel(); |
227 | 228 | ||
228 | /** | 229 | /** |
229 | Set nick name. | 230 | Set nick name. |
230 | */ | 231 | */ |
231 | void setNickName( const QString &nickName ); | 232 | void setNickName( const QString &nickName ); |
232 | /** | 233 | /** |
233 | Return nick name. | 234 | Return nick name. |
234 | */ | 235 | */ |
235 | QString nickName() const; | 236 | QString nickName() const; |
236 | /** | 237 | /** |
237 | Return translated label for nickName field. | 238 | Return translated label for nickName field. |
238 | */ | 239 | */ |
239 | static QString nickNameLabel(); | 240 | static QString nickNameLabel(); |
240 | 241 | ||
241 | /** | 242 | /** |
242 | Set birthday. | 243 | Set birthday. |
243 | */ | 244 | */ |
244 | void setBirthday( const QDateTime &birthday ); | 245 | void setBirthday( const QDateTime &birthday ); |
245 | /** | 246 | /** |
246 | Return birthday. | 247 | Return birthday. |
247 | */ | 248 | */ |
248 | QDateTime birthday() const; | 249 | QDateTime birthday() const; |
249 | /** | 250 | /** |
250 | Return translated label for birthday field. | 251 | Return translated label for birthday field. |
251 | */ | 252 | */ |
252 | static QString birthdayLabel(); | 253 | static QString birthdayLabel(); |
253 | 254 | ||
254 | /** | 255 | /** |
255 | Return translated label for homeAddressStreet field. | 256 | Return translated label for homeAddressStreet field. |
256 | */ | 257 | */ |
257 | static QString homeAddressStreetLabel(); | 258 | static QString homeAddressStreetLabel(); |
258 | 259 | ||
259 | /** | 260 | /** |
260 | Return translated label for homeAddressLocality field. | 261 | Return translated label for homeAddressLocality field. |
261 | */ | 262 | */ |
262 | static QString homeAddressLocalityLabel(); | 263 | static QString homeAddressLocalityLabel(); |
263 | 264 | ||
264 | /** | 265 | /** |
265 | Return translated label for homeAddressRegion field. | 266 | Return translated label for homeAddressRegion field. |
266 | */ | 267 | */ |
267 | static QString homeAddressRegionLabel(); | 268 | static QString homeAddressRegionLabel(); |
268 | 269 | ||
269 | /** | 270 | /** |
270 | Return translated label for homeAddressPostalCode field. | 271 | Return translated label for homeAddressPostalCode field. |
271 | */ | 272 | */ |
272 | static QString homeAddressPostalCodeLabel(); | 273 | static QString homeAddressPostalCodeLabel(); |
273 | 274 | ||
274 | /** | 275 | /** |
275 | Return translated label for homeAddressCountry field. | 276 | Return translated label for homeAddressCountry field. |
276 | */ | 277 | */ |
277 | static QString homeAddressCountryLabel(); | 278 | static QString homeAddressCountryLabel(); |
278 | 279 | ||
279 | /** | 280 | /** |
280 | Return translated label for homeAddressLabel field. | 281 | Return translated label for homeAddressLabel field. |
281 | */ | 282 | */ |
282 | static QString homeAddressLabelLabel(); | 283 | static QString homeAddressLabelLabel(); |
283 | 284 | ||
284 | /** | 285 | /** |
285 | Return translated label for businessAddressStreet field. | 286 | Return translated label for businessAddressStreet field. |
286 | */ | 287 | */ |
287 | static QString businessAddressStreetLabel(); | 288 | static QString businessAddressStreetLabel(); |
288 | 289 | ||
289 | /** | 290 | /** |
290 | Return translated label for businessAddressLocality field. | 291 | Return translated label for businessAddressLocality field. |
291 | */ | 292 | */ |
292 | static QString businessAddressLocalityLabel(); | 293 | static QString businessAddressLocalityLabel(); |
293 | 294 | ||
294 | /** | 295 | /** |
295 | Return translated label for businessAddressRegion field. | 296 | Return translated label for businessAddressRegion field. |
296 | */ | 297 | */ |
297 | static QString businessAddressRegionLabel(); | 298 | static QString businessAddressRegionLabel(); |
298 | 299 | ||
299 | /** | 300 | /** |
300 | Return translated label for businessAddressPostalCode field. | 301 | Return translated label for businessAddressPostalCode field. |
301 | */ | 302 | */ |
302 | static QString businessAddressPostalCodeLabel(); | 303 | static QString businessAddressPostalCodeLabel(); |
303 | 304 | ||
304 | /** | 305 | /** |
305 | Return translated label for businessAddressCountry field. | 306 | Return translated label for businessAddressCountry field. |
306 | */ | 307 | */ |
307 | static QString businessAddressCountryLabel(); | 308 | static QString businessAddressCountryLabel(); |
308 | 309 | ||
309 | /** | 310 | /** |
310 | Return translated label for businessAddressLabel field. | 311 | Return translated label for businessAddressLabel field. |
311 | */ | 312 | */ |
312 | static QString businessAddressLabelLabel(); | 313 | static QString businessAddressLabelLabel(); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 939296f..9b059d3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -129,768 +129,770 @@ $Id$ | |||
129 | #include <qfile.h> | 129 | #include <qfile.h> |
130 | #include <qvbox.h> | 130 | #include <qvbox.h> |
131 | #include <qlayout.h> | 131 | #include <qlayout.h> |
132 | #include <qclipboard.h> | 132 | #include <qclipboard.h> |
133 | #include <qtextstream.h> | 133 | #include <qtextstream.h> |
134 | 134 | ||
135 | #include <libkdepim/categoryselectdialog.h> | 135 | #include <libkdepim/categoryselectdialog.h> |
136 | #include <kabc/vcardconverter.h> | 136 | #include <kabc/vcardconverter.h> |
137 | 137 | ||
138 | 138 | ||
139 | #include "addresseeutil.h" | 139 | #include "addresseeutil.h" |
140 | #include "undocmds.h" | 140 | #include "undocmds.h" |
141 | #include "addresseeeditordialog.h" | 141 | #include "addresseeeditordialog.h" |
142 | #include "viewmanager.h" | 142 | #include "viewmanager.h" |
143 | #include "details/detailsviewcontainer.h" | 143 | #include "details/detailsviewcontainer.h" |
144 | #include "kabprefs.h" | 144 | #include "kabprefs.h" |
145 | #include "xxportmanager.h" | 145 | #include "xxportmanager.h" |
146 | #include "incsearchwidget.h" | 146 | #include "incsearchwidget.h" |
147 | #include "jumpbuttonbar.h" | 147 | #include "jumpbuttonbar.h" |
148 | #include "extensionmanager.h" | 148 | #include "extensionmanager.h" |
149 | #include "addresseeconfig.h" | 149 | #include "addresseeconfig.h" |
150 | #include <kcmultidialog.h> | 150 | #include <kcmultidialog.h> |
151 | 151 | ||
152 | #ifdef _WIN32_ | 152 | #ifdef _WIN32_ |
153 | 153 | ||
154 | #include "kaimportoldialog.h" | 154 | #include "kaimportoldialog.h" |
155 | #else | 155 | #else |
156 | #include <unistd.h> | 156 | #include <unistd.h> |
157 | #endif | 157 | #endif |
158 | // sync includes | 158 | // sync includes |
159 | #include <libkdepim/ksyncprofile.h> | 159 | #include <libkdepim/ksyncprofile.h> |
160 | #include <libkdepim/ksyncprefsdialog.h> | 160 | #include <libkdepim/ksyncprefsdialog.h> |
161 | 161 | ||
162 | class KAex2phonePrefs : public QDialog | 162 | class KAex2phonePrefs : public QDialog |
163 | { | 163 | { |
164 | public: | 164 | public: |
165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
166 | QDialog( parent, name, true ) | 166 | QDialog( parent, name, true ) |
167 | { | 167 | { |
168 | setCaption( i18n("Export to phone options") ); | 168 | setCaption( i18n("Export to phone options") ); |
169 | QVBoxLayout* lay = new QVBoxLayout( this ); | 169 | QVBoxLayout* lay = new QVBoxLayout( this ); |
170 | lay->setSpacing( 3 ); | 170 | lay->setSpacing( 3 ); |
171 | lay->setMargin( 3 ); | 171 | lay->setMargin( 3 ); |
172 | QLabel *lab; | 172 | QLabel *lab; |
173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
174 | lab->setAlignment (AlignHCenter ); | 174 | lab->setAlignment (AlignHCenter ); |
175 | QHBox* temphb; | 175 | QHBox* temphb; |
176 | temphb = new QHBox( this ); | 176 | temphb = new QHBox( this ); |
177 | new QLabel( i18n("I/O device: "), temphb ); | 177 | new QLabel( i18n("I/O device: "), temphb ); |
178 | mPhoneDevice = new QLineEdit( temphb); | 178 | mPhoneDevice = new QLineEdit( temphb); |
179 | lay->addWidget( temphb ); | 179 | lay->addWidget( temphb ); |
180 | temphb = new QHBox( this ); | 180 | temphb = new QHBox( this ); |
181 | new QLabel( i18n("Connection: "), temphb ); | 181 | new QLabel( i18n("Connection: "), temphb ); |
182 | mPhoneConnection = new QLineEdit( temphb); | 182 | mPhoneConnection = new QLineEdit( temphb); |
183 | lay->addWidget( temphb ); | 183 | lay->addWidget( temphb ); |
184 | temphb = new QHBox( this ); | 184 | temphb = new QHBox( this ); |
185 | new QLabel( i18n("Model(opt.): "), temphb ); | 185 | new QLabel( i18n("Model(opt.): "), temphb ); |
186 | mPhoneModel = new QLineEdit( temphb); | 186 | mPhoneModel = new QLineEdit( temphb); |
187 | lay->addWidget( temphb ); | 187 | lay->addWidget( temphb ); |
188 | mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 188 | mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
189 | lay->addWidget( mWriteToSim ); | 189 | lay->addWidget( mWriteToSim ); |
190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
191 | lab->setAlignment (AlignHCenter ); | 191 | lab->setAlignment (AlignHCenter ); |
192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
193 | lay->addWidget( ok ); | 193 | lay->addWidget( ok ); |
194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
195 | lay->addWidget( cancel ); | 195 | lay->addWidget( cancel ); |
196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
198 | resize( 220, 240 ); | 198 | resize( 220, 240 ); |
199 | 199 | ||
200 | } | 200 | } |
201 | 201 | ||
202 | public: | 202 | public: |
203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
204 | QCheckBox* mWriteToSim; | 204 | QCheckBox* mWriteToSim; |
205 | }; | 205 | }; |
206 | 206 | ||
207 | bool pasteWithNewUid = true; | 207 | bool pasteWithNewUid = true; |
208 | 208 | ||
209 | #ifdef KAB_EMBEDDED | 209 | #ifdef KAB_EMBEDDED |
210 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 210 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
211 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 211 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
212 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 212 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
213 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 213 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
214 | #else //KAB_EMBEDDED | 214 | #else //KAB_EMBEDDED |
215 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 215 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
216 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 216 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
217 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 217 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
218 | mReadWrite( readWrite ), mModified( false ) | 218 | mReadWrite( readWrite ), mModified( false ) |
219 | #endif //KAB_EMBEDDED | 219 | #endif //KAB_EMBEDDED |
220 | { | 220 | { |
221 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 221 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
222 | // syncManager->setBlockSave(false); | 222 | // syncManager->setBlockSave(false); |
223 | mExtensionBarSplitter = 0; | 223 | mExtensionBarSplitter = 0; |
224 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 224 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
225 | 225 | ||
226 | mAddressBook = KABC::StdAddressBook::self(); | 226 | mAddressBook = KABC::StdAddressBook::self(); |
227 | KABC::StdAddressBook::setAutomaticSave( false ); | 227 | KABC::StdAddressBook::setAutomaticSave( false ); |
228 | 228 | ||
229 | #ifndef KAB_EMBEDDED | 229 | #ifndef KAB_EMBEDDED |
230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
231 | #endif //KAB_EMBEDDED | 231 | #endif //KAB_EMBEDDED |
232 | 232 | ||
233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
234 | SLOT( addressBookChanged() ) ); | 234 | SLOT( addressBookChanged() ) ); |
235 | 235 | ||
236 | #if 0 | 236 | #if 0 |
237 | // LP moved to addressbook init method | 237 | // LP moved to addressbook init method |
238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
239 | "X-Department", "KADDRESSBOOK" ); | 239 | "X-Department", "KADDRESSBOOK" ); |
240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
241 | "X-Profession", "KADDRESSBOOK" ); | 241 | "X-Profession", "KADDRESSBOOK" ); |
242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
243 | "X-AssistantsName", "KADDRESSBOOK" ); | 243 | "X-AssistantsName", "KADDRESSBOOK" ); |
244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
245 | "X-ManagersName", "KADDRESSBOOK" ); | 245 | "X-ManagersName", "KADDRESSBOOK" ); |
246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
247 | "X-SpousesName", "KADDRESSBOOK" ); | 247 | "X-SpousesName", "KADDRESSBOOK" ); |
248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
249 | "X-Office", "KADDRESSBOOK" ); | 249 | "X-Office", "KADDRESSBOOK" ); |
250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
251 | "X-IMAddress", "KADDRESSBOOK" ); | 251 | "X-IMAddress", "KADDRESSBOOK" ); |
252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
253 | "X-Anniversary", "KADDRESSBOOK" ); | 253 | "X-Anniversary", "KADDRESSBOOK" ); |
254 | 254 | ||
255 | //US added this field to become compatible with Opie/qtopia addressbook | 255 | //US added this field to become compatible with Opie/qtopia addressbook |
256 | // values can be "female" or "male" or "". An empty field represents undefined. | 256 | // values can be "female" or "male" or "". An empty field represents undefined. |
257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
258 | "X-Gender", "KADDRESSBOOK" ); | 258 | "X-Gender", "KADDRESSBOOK" ); |
259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
260 | "X-Children", "KADDRESSBOOK" ); | 260 | "X-Children", "KADDRESSBOOK" ); |
261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
263 | #endif | 263 | #endif |
264 | initGUI(); | 264 | initGUI(); |
265 | 265 | ||
266 | mIncSearchWidget->setFocus(); | 266 | mIncSearchWidget->setFocus(); |
267 | 267 | ||
268 | 268 | ||
269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
270 | SLOT( setContactSelected( const QString& ) ) ); | 270 | SLOT( setContactSelected( const QString& ) ) ); |
271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
272 | SLOT( executeContact( const QString& ) ) ); | 272 | SLOT( executeContact( const QString& ) ) ); |
273 | 273 | ||
274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
275 | SLOT( deleteContacts( ) ) ); | 275 | SLOT( deleteContacts( ) ) ); |
276 | connect( mViewManager, SIGNAL( modified() ), | 276 | connect( mViewManager, SIGNAL( modified() ), |
277 | SLOT( setModified() ) ); | 277 | SLOT( setModified() ) ); |
278 | 278 | ||
279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
281 | 281 | ||
282 | connect( mXXPortManager, SIGNAL( modified() ), | 282 | connect( mXXPortManager, SIGNAL( modified() ), |
283 | SLOT( setModified() ) ); | 283 | SLOT( setModified() ) ); |
284 | 284 | ||
285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
286 | SLOT( incrementalSearch( const QString& ) ) ); | 286 | SLOT( incrementalSearch( const QString& ) ) ); |
287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
288 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 288 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
289 | 289 | ||
290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
291 | SLOT( sendMail( const QString& ) ) ); | 291 | SLOT( sendMail( const QString& ) ) ); |
292 | 292 | ||
293 | 293 | ||
294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
297 | 297 | ||
298 | 298 | ||
299 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED |
300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
302 | 302 | ||
303 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
304 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
305 | 305 | ||
306 | 306 | ||
307 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
308 | 308 | ||
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | mEditorDialog = 0; | 310 | mEditorDialog = 0; |
311 | createAddresseeEditorDialog( this ); | 311 | createAddresseeEditorDialog( this ); |
312 | setModified( false ); | 312 | setModified( false ); |
313 | } | 313 | } |
314 | 314 | ||
315 | KABCore::~KABCore() | 315 | KABCore::~KABCore() |
316 | { | 316 | { |
317 | // save(); | 317 | // save(); |
318 | //saveSettings(); | 318 | //saveSettings(); |
319 | //KABPrefs::instance()->writeConfig(); | 319 | //KABPrefs::instance()->writeConfig(); |
320 | delete AddresseeConfig::instance(); | 320 | delete AddresseeConfig::instance(); |
321 | mAddressBook = 0; | 321 | mAddressBook = 0; |
322 | KABC::StdAddressBook::close(); | 322 | KABC::StdAddressBook::close(); |
323 | |||
324 | delete syncManager; | ||
323 | 325 | ||
324 | delete syncManager; | ||
325 | } | 326 | } |
326 | 327 | ||
327 | void KABCore::restoreSettings() | 328 | void KABCore::restoreSettings() |
328 | { | 329 | { |
329 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 330 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
330 | 331 | ||
331 | bool state; | 332 | bool state; |
332 | 333 | ||
333 | if (mMultipleViewsAtOnce) | 334 | if (mMultipleViewsAtOnce) |
334 | state = KABPrefs::instance()->mDetailsPageVisible; | 335 | state = KABPrefs::instance()->mDetailsPageVisible; |
335 | else | 336 | else |
336 | state = false; | 337 | state = false; |
337 | 338 | ||
338 | mActionDetails->setChecked( state ); | 339 | mActionDetails->setChecked( state ); |
339 | setDetailsVisible( state ); | 340 | setDetailsVisible( state ); |
340 | 341 | ||
341 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 342 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
342 | 343 | ||
343 | mActionJumpBar->setChecked( state ); | 344 | mActionJumpBar->setChecked( state ); |
344 | setJumpButtonBarVisible( state ); | 345 | setJumpButtonBarVisible( state ); |
345 | /*US | 346 | /*US |
346 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 347 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
347 | if ( splitterSize.count() == 0 ) { | 348 | if ( splitterSize.count() == 0 ) { |
348 | splitterSize.append( width() / 2 ); | 349 | splitterSize.append( width() / 2 ); |
349 | splitterSize.append( width() / 2 ); | 350 | splitterSize.append( width() / 2 ); |
350 | } | 351 | } |
351 | mMiniSplitter->setSizes( splitterSize ); | 352 | mMiniSplitter->setSizes( splitterSize ); |
352 | if ( mExtensionBarSplitter ) { | 353 | if ( mExtensionBarSplitter ) { |
353 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 354 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
354 | if ( splitterSize.count() == 0 ) { | 355 | if ( splitterSize.count() == 0 ) { |
355 | splitterSize.append( width() / 2 ); | 356 | splitterSize.append( width() / 2 ); |
356 | splitterSize.append( width() / 2 ); | 357 | splitterSize.append( width() / 2 ); |
357 | } | 358 | } |
358 | mExtensionBarSplitter->setSizes( splitterSize ); | 359 | mExtensionBarSplitter->setSizes( splitterSize ); |
359 | 360 | ||
360 | } | 361 | } |
361 | */ | 362 | */ |
362 | mViewManager->restoreSettings(); | 363 | mViewManager->restoreSettings(); |
363 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 364 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
364 | mExtensionManager->restoreSettings(); | 365 | mExtensionManager->restoreSettings(); |
365 | #ifdef DESKTOP_VERSION | 366 | #ifdef DESKTOP_VERSION |
366 | int wid = width(); | 367 | int wid = width(); |
367 | if ( wid < 10 ) | 368 | if ( wid < 10 ) |
368 | wid = 400; | 369 | wid = 400; |
369 | #else | 370 | #else |
370 | int wid = QApplication::desktop()->width(); | 371 | int wid = QApplication::desktop()->width(); |
371 | if ( wid < 640 ) | 372 | if ( wid < 640 ) |
372 | wid = QApplication::desktop()->height(); | 373 | wid = QApplication::desktop()->height(); |
373 | #endif | 374 | #endif |
374 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 375 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
375 | if ( true /*splitterSize.count() == 0*/ ) { | 376 | if ( true /*splitterSize.count() == 0*/ ) { |
376 | splitterSize.append( wid / 2 ); | 377 | splitterSize.append( wid / 2 ); |
377 | splitterSize.append( wid / 2 ); | 378 | splitterSize.append( wid / 2 ); |
378 | } | 379 | } |
379 | mMiniSplitter->setSizes( splitterSize ); | 380 | mMiniSplitter->setSizes( splitterSize ); |
380 | if ( mExtensionBarSplitter ) { | 381 | if ( mExtensionBarSplitter ) { |
381 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 382 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
382 | if ( true /*splitterSize.count() == 0*/ ) { | 383 | if ( true /*splitterSize.count() == 0*/ ) { |
383 | splitterSize.append( wid / 2 ); | 384 | splitterSize.append( wid / 2 ); |
384 | splitterSize.append( wid / 2 ); | 385 | splitterSize.append( wid / 2 ); |
385 | } | 386 | } |
386 | mExtensionBarSplitter->setSizes( splitterSize ); | 387 | mExtensionBarSplitter->setSizes( splitterSize ); |
387 | 388 | ||
388 | } | 389 | } |
389 | 390 | ||
390 | 391 | ||
391 | } | 392 | } |
392 | 393 | ||
393 | void KABCore::saveSettings() | 394 | void KABCore::saveSettings() |
394 | { | 395 | { |
395 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 396 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
396 | if ( mExtensionBarSplitter ) | 397 | if ( mExtensionBarSplitter ) |
397 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 398 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
398 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 399 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
399 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 400 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
400 | #ifndef KAB_EMBEDDED | 401 | #ifndef KAB_EMBEDDED |
401 | 402 | ||
402 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 403 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
403 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 404 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
404 | #endif //KAB_EMBEDDED | 405 | #endif //KAB_EMBEDDED |
405 | mExtensionManager->saveSettings(); | 406 | mExtensionManager->saveSettings(); |
406 | mViewManager->saveSettings(); | 407 | mViewManager->saveSettings(); |
407 | 408 | ||
408 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 409 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
409 | } | 410 | } |
410 | 411 | ||
411 | KABC::AddressBook *KABCore::addressBook() const | 412 | KABC::AddressBook *KABCore::addressBook() const |
412 | { | 413 | { |
413 | return mAddressBook; | 414 | return mAddressBook; |
414 | } | 415 | } |
415 | 416 | ||
416 | KConfig *KABCore::config() | 417 | KConfig *KABCore::config() |
417 | { | 418 | { |
418 | #ifndef KAB_EMBEDDED | 419 | #ifndef KAB_EMBEDDED |
419 | return KABPrefs::instance()->config(); | 420 | return KABPrefs::instance()->config(); |
420 | #else //KAB_EMBEDDED | 421 | #else //KAB_EMBEDDED |
421 | return KABPrefs::instance()->getConfig(); | 422 | return KABPrefs::instance()->getConfig(); |
422 | #endif //KAB_EMBEDDED | 423 | #endif //KAB_EMBEDDED |
423 | } | 424 | } |
424 | 425 | ||
425 | KActionCollection *KABCore::actionCollection() const | 426 | KActionCollection *KABCore::actionCollection() const |
426 | { | 427 | { |
427 | return mGUIClient->actionCollection(); | 428 | return mGUIClient->actionCollection(); |
428 | } | 429 | } |
429 | 430 | ||
430 | KABC::Field *KABCore::currentSearchField() const | 431 | KABC::Field *KABCore::currentSearchField() const |
431 | { | 432 | { |
432 | if (mIncSearchWidget) | 433 | if (mIncSearchWidget) |
433 | return mIncSearchWidget->currentField(); | 434 | return mIncSearchWidget->currentField(); |
434 | else | 435 | else |
435 | return 0; | 436 | return 0; |
436 | } | 437 | } |
437 | 438 | ||
438 | QStringList KABCore::selectedUIDs() const | 439 | QStringList KABCore::selectedUIDs() const |
439 | { | 440 | { |
440 | return mViewManager->selectedUids(); | 441 | return mViewManager->selectedUids(); |
441 | } | 442 | } |
442 | 443 | ||
443 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 444 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
444 | { | 445 | { |
445 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 446 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
446 | 447 | ||
447 | QPtrList<KRES::Resource> kresResources; | 448 | QPtrList<KRES::Resource> kresResources; |
448 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 449 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
449 | KABC::Resource *resource; | 450 | KABC::Resource *resource; |
450 | while ( ( resource = resIt.current() ) != 0 ) { | 451 | while ( ( resource = resIt.current() ) != 0 ) { |
451 | ++resIt; | 452 | ++resIt; |
452 | if ( !resource->readOnly() ) { | 453 | if ( !resource->readOnly() ) { |
453 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 454 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
454 | if ( res ) | 455 | if ( res ) |
455 | kresResources.append( res ); | 456 | kresResources.append( res ); |
456 | } | 457 | } |
457 | } | 458 | } |
458 | 459 | ||
459 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 460 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
460 | return static_cast<KABC::Resource*>( res ); | 461 | return static_cast<KABC::Resource*>( res ); |
461 | } | 462 | } |
462 | 463 | ||
463 | #ifndef KAB_EMBEDDED | 464 | #ifndef KAB_EMBEDDED |
464 | KAboutData *KABCore::createAboutData() | 465 | KAboutData *KABCore::createAboutData() |
465 | #else //KAB_EMBEDDED | 466 | #else //KAB_EMBEDDED |
466 | void KABCore::createAboutData() | 467 | void KABCore::createAboutData() |
467 | #endif //KAB_EMBEDDED | 468 | #endif //KAB_EMBEDDED |
468 | { | 469 | { |
469 | #ifndef KAB_EMBEDDED | 470 | #ifndef KAB_EMBEDDED |
470 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 471 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
471 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 472 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
472 | KAboutData::License_GPL_V2, | 473 | KAboutData::License_GPL_V2, |
473 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 474 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
474 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 475 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
475 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 476 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
476 | about->addAuthor( "Cornelius Schumacher", | 477 | about->addAuthor( "Cornelius Schumacher", |
477 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 478 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
478 | "schumacher@kde.org" ); | 479 | "schumacher@kde.org" ); |
479 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 480 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
480 | "mpilone@slac.com" ); | 481 | "mpilone@slac.com" ); |
481 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 482 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
482 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 483 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
483 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 484 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
484 | "michel@klaralvdalens-datakonsult.se" ); | 485 | "michel@klaralvdalens-datakonsult.se" ); |
485 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 486 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
486 | "hansen@kde.org" ); | 487 | "hansen@kde.org" ); |
487 | 488 | ||
488 | return about; | 489 | return about; |
489 | #endif //KAB_EMBEDDED | 490 | #endif //KAB_EMBEDDED |
490 | 491 | ||
491 | QString version; | 492 | QString version; |
492 | #include <../version> | 493 | #include <../version> |
493 | QMessageBox::about( this, "About KAddressbook/Pi", | 494 | QMessageBox::about( this, "About KAddressbook/Pi", |
494 | "KAddressbook/Platform-independent\n" | 495 | "KAddressbook/Platform-independent\n" |
495 | "(KA/Pi) " +version + " - " + | 496 | "(KA/Pi) " +version + " - " + |
496 | #ifdef DESKTOP_VERSION | 497 | #ifdef DESKTOP_VERSION |
497 | "Desktop Edition\n" | 498 | "Desktop Edition\n" |
498 | #else | 499 | #else |
499 | "PDA-Edition\n" | 500 | "PDA-Edition\n" |
500 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 501 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
501 | #endif | 502 | #endif |
502 | 503 | ||
503 | "(c) 2004 Ulf Schenk\n" | 504 | "(c) 2004 Ulf Schenk\n" |
504 | "(c) 2004 Lutz Rogowski\n" | 505 | "(c) 2004 Lutz Rogowski\n" |
505 | "(c) 1997-2003, The KDE PIM Team\n" | 506 | "(c) 1997-2003, The KDE PIM Team\n" |
506 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 507 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
507 | "Don Sanders Original author\n" | 508 | "Don Sanders Original author\n" |
508 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 509 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
509 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 510 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
510 | "Greg Stern DCOP interface\n" | 511 | "Greg Stern DCOP interface\n" |
511 | "Mark Westcot Contact pinning\n" | 512 | "Mark Westcot Contact pinning\n" |
512 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 513 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
513 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 514 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
514 | #ifdef _WIN32_ | 515 | #ifdef _WIN32_ |
515 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 516 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
516 | #endif | 517 | #endif |
517 | ); | 518 | ); |
518 | } | 519 | } |
519 | 520 | ||
520 | void KABCore::setContactSelected( const QString &uid ) | 521 | void KABCore::setContactSelected( const QString &uid ) |
521 | { | 522 | { |
522 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 523 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
523 | if ( !mDetails->isHidden() ) | 524 | if ( !mDetails->isHidden() ) |
524 | mDetails->setAddressee( addr ); | 525 | mDetails->setAddressee( addr ); |
525 | 526 | ||
526 | if ( !addr.isEmpty() ) { | 527 | if ( !addr.isEmpty() ) { |
527 | emit contactSelected( addr.formattedName() ); | 528 | emit contactSelected( addr.formattedName() ); |
528 | KABC::Picture pic = addr.photo(); | 529 | KABC::Picture pic = addr.photo(); |
529 | if ( pic.isIntern() ) { | 530 | if ( pic.isIntern() ) { |
530 | //US emit contactSelected( pic.data() ); | 531 | //US emit contactSelected( pic.data() ); |
531 | //US instead use: | 532 | //US instead use: |
532 | QPixmap px; | 533 | QPixmap px; |
533 | if (pic.data().isNull() != true) | 534 | if (pic.data().isNull() != true) |
534 | { | 535 | { |
535 | px.convertFromImage(pic.data()); | 536 | px.convertFromImage(pic.data()); |
536 | } | 537 | } |
537 | 538 | ||
538 | emit contactSelected( px ); | 539 | emit contactSelected( px ); |
539 | } | 540 | } |
540 | } | 541 | } |
541 | 542 | ||
542 | 543 | ||
543 | mExtensionManager->setSelectionChanged(); | 544 | mExtensionManager->setSelectionChanged(); |
544 | 545 | ||
545 | // update the actions | 546 | // update the actions |
546 | bool selected = !uid.isEmpty(); | 547 | bool selected = !uid.isEmpty(); |
547 | 548 | ||
548 | if ( mReadWrite ) { | 549 | if ( mReadWrite ) { |
549 | mActionCut->setEnabled( selected ); | 550 | mActionCut->setEnabled( selected ); |
550 | mActionPaste->setEnabled( selected ); | 551 | mActionPaste->setEnabled( selected ); |
551 | } | 552 | } |
552 | 553 | ||
553 | mActionCopy->setEnabled( selected ); | 554 | mActionCopy->setEnabled( selected ); |
554 | mActionDelete->setEnabled( selected ); | 555 | mActionDelete->setEnabled( selected ); |
555 | mActionEditAddressee->setEnabled( selected ); | 556 | mActionEditAddressee->setEnabled( selected ); |
556 | mActionMail->setEnabled( selected ); | 557 | mActionMail->setEnabled( selected ); |
557 | mActionMailVCard->setEnabled( selected ); | 558 | mActionMailVCard->setEnabled( selected ); |
558 | //if (mActionBeam) | 559 | //if (mActionBeam) |
559 | //mActionBeam->setEnabled( selected ); | 560 | //mActionBeam->setEnabled( selected ); |
560 | 561 | ||
561 | if (mActionBeamVCard) | 562 | if (mActionBeamVCard) |
562 | mActionBeamVCard->setEnabled( selected ); | 563 | mActionBeamVCard->setEnabled( selected ); |
563 | 564 | ||
564 | mActionExport2phone->setEnabled( selected ); | 565 | mActionExport2phone->setEnabled( selected ); |
565 | mActionWhoAmI->setEnabled( selected ); | 566 | mActionWhoAmI->setEnabled( selected ); |
566 | mActionCategories->setEnabled( selected ); | 567 | mActionCategories->setEnabled( selected ); |
567 | } | 568 | } |
568 | 569 | ||
569 | void KABCore::sendMail() | 570 | void KABCore::sendMail() |
570 | { | 571 | { |
571 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 572 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
572 | } | 573 | } |
573 | 574 | ||
574 | void KABCore::sendMail( const QString& emaillist ) | 575 | void KABCore::sendMail( const QString& emaillist ) |
575 | { | 576 | { |
576 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 577 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
577 | if (emaillist.contains(",") > 0) | 578 | if (emaillist.contains(",") > 0) |
578 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 579 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
579 | else | 580 | else |
580 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 581 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
581 | } | 582 | } |
582 | 583 | ||
583 | 584 | ||
584 | 585 | ||
585 | void KABCore::mailVCard() | 586 | void KABCore::mailVCard() |
586 | { | 587 | { |
587 | QStringList uids = mViewManager->selectedUids(); | 588 | QStringList uids = mViewManager->selectedUids(); |
588 | if ( !uids.isEmpty() ) | 589 | if ( !uids.isEmpty() ) |
589 | mailVCard( uids ); | 590 | mailVCard( uids ); |
590 | } | 591 | } |
591 | 592 | ||
592 | void KABCore::mailVCard( const QStringList& uids ) | 593 | void KABCore::mailVCard( const QStringList& uids ) |
593 | { | 594 | { |
594 | QStringList urls; | 595 | QStringList urls; |
595 | 596 | ||
596 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 597 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
597 | 598 | ||
598 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 599 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
599 | 600 | ||
600 | 601 | ||
601 | 602 | ||
602 | QDir().mkdir( dirName, true ); | 603 | QDir().mkdir( dirName, true ); |
603 | 604 | ||
604 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 605 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
605 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 606 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
606 | 607 | ||
607 | if ( a.isEmpty() ) | 608 | if ( a.isEmpty() ) |
608 | continue; | 609 | continue; |
609 | 610 | ||
610 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 611 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
611 | 612 | ||
612 | QString fileName = dirName + "/" + name; | 613 | QString fileName = dirName + "/" + name; |
613 | 614 | ||
614 | QFile outFile(fileName); | 615 | QFile outFile(fileName); |
615 | 616 | ||
616 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 617 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
617 | KABC::VCardConverter converter; | 618 | KABC::VCardConverter converter; |
618 | QString vcard; | 619 | QString vcard; |
619 | 620 | ||
620 | converter.addresseeToVCard( a, vcard ); | 621 | converter.addresseeToVCard( a, vcard ); |
621 | 622 | ||
622 | QTextStream t( &outFile ); // use a text stream | 623 | QTextStream t( &outFile ); // use a text stream |
623 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 624 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
624 | t << vcard; | 625 | t << vcard; |
625 | 626 | ||
626 | outFile.close(); | 627 | outFile.close(); |
627 | 628 | ||
628 | urls.append( fileName ); | 629 | urls.append( fileName ); |
629 | } | 630 | } |
630 | } | 631 | } |
631 | 632 | ||
632 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 633 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
633 | 634 | ||
634 | 635 | ||
635 | /*US | 636 | /*US |
636 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 637 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
637 | QString::null, // subject | 638 | QString::null, // subject |
638 | QString::null, // body | 639 | QString::null, // body |
639 | QString::null, | 640 | QString::null, |
640 | urls ); // attachments | 641 | urls ); // attachments |
641 | */ | 642 | */ |
642 | 643 | ||
643 | } | 644 | } |
644 | 645 | ||
645 | /** | 646 | /** |
646 | Beams the "WhoAmI contact. | 647 | Beams the "WhoAmI contact. |
647 | */ | 648 | */ |
648 | void KABCore::beamMySelf() | 649 | void KABCore::beamMySelf() |
649 | { | 650 | { |
650 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 651 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
651 | if (!a.isEmpty()) | 652 | if (!a.isEmpty()) |
652 | { | 653 | { |
653 | QStringList uids; | 654 | QStringList uids; |
654 | uids << a.uid(); | 655 | uids << a.uid(); |
655 | 656 | ||
656 | beamVCard(uids); | 657 | beamVCard(uids); |
657 | } else { | 658 | } else { |
658 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 659 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
659 | 660 | ||
660 | 661 | ||
661 | } | 662 | } |
662 | } | 663 | } |
663 | 664 | ||
664 | void KABCore::export2phone() | 665 | void KABCore::export2phone() |
665 | { | 666 | { |
666 | 667 | ||
667 | KAex2phonePrefs ex2phone; | 668 | KAex2phonePrefs ex2phone; |
668 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 669 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
669 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 670 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
670 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 671 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
671 | 672 | ||
672 | if ( !ex2phone.exec() ) { | 673 | if ( !ex2phone.exec() ) { |
673 | return; | 674 | return; |
674 | } | 675 | } |
675 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 676 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
676 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 677 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
677 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 678 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
678 | 679 | ||
679 | 680 | ||
680 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 681 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
681 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 682 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
682 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 683 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
683 | 684 | ||
684 | QStringList uids = mViewManager->selectedUids(); | 685 | QStringList uids = mViewManager->selectedUids(); |
685 | if ( uids.isEmpty() ) | 686 | if ( uids.isEmpty() ) |
686 | return; | 687 | return; |
687 | 688 | ||
688 | #ifdef _WIN32_ | 689 | #ifdef _WIN32_ |
689 | QString fileName = locateLocal("tmp", "tempfile.vcf"); | 690 | QString fileName = locateLocal("tmp", "tempfile.vcf"); |
690 | #else | 691 | #else |
691 | QString fileName = "/tmp/kdepimtemp.vcf"; | 692 | QString fileName = "/tmp/kdepimtemp.vcf"; |
692 | #endif | 693 | #endif |
693 | 694 | ||
694 | KABC::VCardConverter converter; | 695 | KABC::VCardConverter converter; |
695 | QString description; | 696 | QString description; |
696 | QString datastream; | 697 | QString datastream; |
697 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 698 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
698 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 699 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
699 | 700 | ||
700 | if ( a.isEmpty() ) | 701 | if ( a.isEmpty() ) |
701 | continue; | 702 | continue; |
702 | a.simplifyEmails(); | 703 | a.simplifyEmails(); |
703 | a.simplifyPhoneNumbers(); | 704 | a.simplifyPhoneNumbers(); |
704 | a.simplifyPhoneNumberTypes(); | 705 | a.simplifyPhoneNumberTypes(); |
706 | a.simplifyAddresses(); | ||
705 | 707 | ||
706 | if (description.isEmpty()) | 708 | if (description.isEmpty()) |
707 | description = a.formattedName(); | 709 | description = a.formattedName(); |
708 | QString vcard; | 710 | QString vcard; |
709 | QString vcardnew; | 711 | QString vcardnew; |
710 | converter.addresseeToVCard( a, vcard ); | 712 | converter.addresseeToVCard( a, vcard ); |
711 | int start = 0; | 713 | int start = 0; |
712 | int next; | 714 | int next; |
713 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 715 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
714 | int semi = vcard.find(";", next); | 716 | int semi = vcard.find(";", next); |
715 | int dopp = vcard.find(":", next); | 717 | int dopp = vcard.find(":", next); |
716 | int sep; | 718 | int sep; |
717 | if ( semi < dopp && semi >= 0 ) | 719 | if ( semi < dopp && semi >= 0 ) |
718 | sep = semi ; | 720 | sep = semi ; |
719 | else | 721 | else |
720 | sep = dopp; | 722 | sep = dopp; |
721 | vcardnew +=vcard.mid( start, next - start); | 723 | vcardnew +=vcard.mid( start, next - start); |
722 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); | 724 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); |
723 | start = sep; | 725 | start = sep; |
724 | } | 726 | } |
725 | vcardnew += vcard.mid( start,vcard.length() ); | 727 | vcardnew += vcard.mid( start,vcard.length() ); |
726 | vcard = ""; | 728 | vcard = ""; |
727 | start = 0; | 729 | start = 0; |
728 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { | 730 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { |
729 | int sep = vcardnew.find(":", next); | 731 | int sep = vcardnew.find(":", next); |
730 | vcard +=vcardnew.mid( start, next - start+3); | 732 | vcard +=vcardnew.mid( start, next - start+3); |
731 | start = sep; | 733 | start = sep; |
732 | } | 734 | } |
733 | vcard += vcardnew.mid( start,vcardnew.length() ); | 735 | vcard += vcardnew.mid( start,vcardnew.length() ); |
734 | vcard.replace ( QRegExp(";;;") , "" ); | 736 | vcard.replace ( QRegExp(";;;") , "" ); |
735 | vcard.replace ( QRegExp(";;") , "" ); | 737 | vcard.replace ( QRegExp(";;") , "" ); |
736 | datastream += vcard; | 738 | datastream += vcard; |
737 | 739 | ||
738 | } | 740 | } |
739 | QFile outFile(fileName); | 741 | QFile outFile(fileName); |
740 | if ( outFile.open(IO_WriteOnly) ) { | 742 | if ( outFile.open(IO_WriteOnly) ) { |
741 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 743 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
742 | QTextStream t( &outFile ); // use a text stream | 744 | QTextStream t( &outFile ); // use a text stream |
743 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 745 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
744 | t <<datastream; | 746 | t <<datastream; |
745 | outFile.close(); | 747 | outFile.close(); |
746 | if ( PhoneAccess::writeToPhone( fileName ) ) | 748 | if ( PhoneAccess::writeToPhone( fileName ) ) |
747 | qDebug("Export okay "); | 749 | qDebug("Export okay "); |
748 | else | 750 | else |
749 | qDebug("Error export contacts "); | 751 | qDebug("Error export contacts "); |
750 | 752 | ||
751 | } else { | 753 | } else { |
752 | qDebug("Error open temp file "); | 754 | qDebug("Error open temp file "); |
753 | return; | 755 | return; |
754 | } | 756 | } |
755 | 757 | ||
756 | 758 | ||
757 | #if 0 | 759 | #if 0 |
758 | 760 | ||
759 | setCaption( i18n("Writing to phone...")); | 761 | setCaption( i18n("Writing to phone...")); |
760 | if ( PhoneFormat::writeToPhone( cal ) ) | 762 | if ( PhoneFormat::writeToPhone( cal ) ) |
761 | setCaption( i18n("Export to phone successful!")); | 763 | setCaption( i18n("Export to phone successful!")); |
762 | else | 764 | else |
763 | setCaption( i18n("Error exporting to phone!")); | 765 | setCaption( i18n("Error exporting to phone!")); |
764 | #endif | 766 | #endif |
765 | 767 | ||
766 | 768 | ||
767 | } | 769 | } |
768 | void KABCore::beamVCard() | 770 | void KABCore::beamVCard() |
769 | { | 771 | { |
770 | QStringList uids = mViewManager->selectedUids(); | 772 | QStringList uids = mViewManager->selectedUids(); |
771 | if ( !uids.isEmpty() ) | 773 | if ( !uids.isEmpty() ) |
772 | beamVCard( uids ); | 774 | beamVCard( uids ); |
773 | } | 775 | } |
774 | 776 | ||
775 | 777 | ||
776 | void KABCore::beamVCard(const QStringList& uids) | 778 | void KABCore::beamVCard(const QStringList& uids) |
777 | { | 779 | { |
778 | /*US | 780 | /*US |
779 | QString beamFilename; | 781 | QString beamFilename; |
780 | Opie::OPimContact c; | 782 | Opie::OPimContact c; |
781 | if ( actionPersonal->isOn() ) { | 783 | if ( actionPersonal->isOn() ) { |
782 | beamFilename = addressbookPersonalVCardName(); | 784 | beamFilename = addressbookPersonalVCardName(); |
783 | if ( !QFile::exists( beamFilename ) ) | 785 | if ( !QFile::exists( beamFilename ) ) |
784 | return; // can't beam a non-existent file | 786 | return; // can't beam a non-existent file |
785 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 787 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
786 | beamFilename ); | 788 | beamFilename ); |
787 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 789 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
788 | Opie::OPimContactAccess::List allList = access->allRecords(); | 790 | Opie::OPimContactAccess::List allList = access->allRecords(); |
789 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 791 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
790 | c = *it; | 792 | c = *it; |
791 | 793 | ||
792 | delete access; | 794 | delete access; |
793 | } else { | 795 | } else { |
794 | unlink( beamfile ); // delete if exists | 796 | unlink( beamfile ); // delete if exists |
795 | mkdir("/tmp/obex/", 0755); | 797 | mkdir("/tmp/obex/", 0755); |
796 | c = m_abView -> currentEntry(); | 798 | c = m_abView -> currentEntry(); |
797 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 799 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
798 | beamfile ); | 800 | beamfile ); |
799 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 801 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
800 | access->add( c ); | 802 | access->add( c ); |
801 | access->save(); | 803 | access->save(); |
802 | delete access; | 804 | delete access; |
803 | 805 | ||
804 | beamFilename = beamfile; | 806 | beamFilename = beamfile; |
805 | } | 807 | } |
806 | 808 | ||
807 | owarn << "Beaming: " << beamFilename << oendl; | 809 | owarn << "Beaming: " << beamFilename << oendl; |
808 | */ | 810 | */ |
809 | 811 | ||
810 | #if 0 | 812 | #if 0 |
811 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 813 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
812 | 814 | ||
813 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 815 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
814 | 816 | ||
815 | QString name = "contact.vcf"; | 817 | QString name = "contact.vcf"; |
816 | 818 | ||
817 | QString fileName = dirName + "/" + name; | 819 | QString fileName = dirName + "/" + name; |
818 | #endif | 820 | #endif |
819 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 821 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
820 | // | 822 | // |
821 | QString fileName = "/tmp/kapibeamfile.vcf"; | 823 | QString fileName = "/tmp/kapibeamfile.vcf"; |
822 | 824 | ||
823 | 825 | ||
824 | //QDir().mkdir( dirName, true ); | 826 | //QDir().mkdir( dirName, true ); |
825 | 827 | ||
826 | 828 | ||
827 | KABC::VCardConverter converter; | 829 | KABC::VCardConverter converter; |
828 | QString description; | 830 | QString description; |
829 | QString datastream; | 831 | QString datastream; |
830 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 832 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
831 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 833 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
832 | 834 | ||
833 | if ( a.isEmpty() ) | 835 | if ( a.isEmpty() ) |
834 | continue; | 836 | continue; |
835 | 837 | ||
836 | if (description.isEmpty()) | 838 | if (description.isEmpty()) |
837 | description = a.formattedName(); | 839 | description = a.formattedName(); |
838 | 840 | ||
839 | QString vcard; | 841 | QString vcard; |
840 | converter.addresseeToVCard( a, vcard ); | 842 | converter.addresseeToVCard( a, vcard ); |
841 | int start = 0; | 843 | int start = 0; |
842 | int next; | 844 | int next; |
843 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 845 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
844 | int semi = vcard.find(";", next); | 846 | int semi = vcard.find(";", next); |
845 | int dopp = vcard.find(":", next); | 847 | int dopp = vcard.find(":", next); |
846 | int sep; | 848 | int sep; |
847 | if ( semi < dopp && semi >= 0 ) | 849 | if ( semi < dopp && semi >= 0 ) |
848 | sep = semi ; | 850 | sep = semi ; |
849 | else | 851 | else |
850 | sep = dopp; | 852 | sep = dopp; |
851 | datastream +=vcard.mid( start, next - start); | 853 | datastream +=vcard.mid( start, next - start); |
852 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 854 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
853 | start = sep; | 855 | start = sep; |
854 | } | 856 | } |
855 | datastream += vcard.mid( start,vcard.length() ); | 857 | datastream += vcard.mid( start,vcard.length() ); |
856 | } | 858 | } |
857 | #ifndef DESKTOP_VERSION | 859 | #ifndef DESKTOP_VERSION |
858 | QFile outFile(fileName); | 860 | QFile outFile(fileName); |
859 | if ( outFile.open(IO_WriteOnly) ) { | 861 | if ( outFile.open(IO_WriteOnly) ) { |
860 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 862 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
861 | QTextStream t( &outFile ); // use a text stream | 863 | QTextStream t( &outFile ); // use a text stream |
862 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 864 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
863 | t <<datastream; | 865 | t <<datastream; |
864 | outFile.close(); | 866 | outFile.close(); |
865 | Ir *ir = new Ir( this ); | 867 | Ir *ir = new Ir( this ); |
866 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 868 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
867 | ir->send( fileName, description, "text/x-vCard" ); | 869 | ir->send( fileName, description, "text/x-vCard" ); |
868 | } else { | 870 | } else { |
869 | qDebug("Error open temp beam file "); | 871 | qDebug("Error open temp beam file "); |
870 | return; | 872 | return; |
871 | } | 873 | } |
872 | #endif | 874 | #endif |
873 | 875 | ||
874 | } | 876 | } |
875 | 877 | ||
876 | void KABCore::beamDone( Ir *ir ) | 878 | void KABCore::beamDone( Ir *ir ) |
877 | { | 879 | { |
878 | #ifndef DESKTOP_VERSION | 880 | #ifndef DESKTOP_VERSION |
879 | delete ir; | 881 | delete ir; |
880 | #endif | 882 | #endif |
881 | } | 883 | } |
882 | 884 | ||
883 | 885 | ||
884 | void KABCore::browse( const QString& url ) | 886 | void KABCore::browse( const QString& url ) |
885 | { | 887 | { |
886 | #ifndef KAB_EMBEDDED | 888 | #ifndef KAB_EMBEDDED |
887 | kapp->invokeBrowser( url ); | 889 | kapp->invokeBrowser( url ); |
888 | #else //KAB_EMBEDDED | 890 | #else //KAB_EMBEDDED |
889 | qDebug("KABCore::browse must be fixed"); | 891 | qDebug("KABCore::browse must be fixed"); |
890 | #endif //KAB_EMBEDDED | 892 | #endif //KAB_EMBEDDED |
891 | } | 893 | } |
892 | 894 | ||
893 | void KABCore::selectAllContacts() | 895 | void KABCore::selectAllContacts() |
894 | { | 896 | { |
895 | mViewManager->setSelected( QString::null, true ); | 897 | mViewManager->setSelected( QString::null, true ); |
896 | } | 898 | } |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 552c933..dded2bf 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,132 +1,133 @@ | |||
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 | 28 | ||
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | #include <kstaticdeleter.h> | 31 | #include <kstaticdeleter.h> |
32 | //US#include <kdebug.h> // defines kdDebug() | 32 | //US#include <kdebug.h> // defines kdDebug() |
33 | 33 | ||
34 | #include "kabprefs.h" | 34 | #include "kabprefs.h" |
35 | 35 | ||
36 | KABPrefs *KABPrefs::sInstance = 0; | 36 | KABPrefs *KABPrefs::sInstance = 0; |
37 | static KStaticDeleter<KABPrefs> staticDeleter; | 37 | static KStaticDeleter<KABPrefs> staticDeleter; |
38 | 38 | ||
39 | KABPrefs::KABPrefs() | 39 | KABPrefs::KABPrefs() |
40 | : KPimPrefs("kaddressbookrc") | 40 | : KPimPrefs("kaddressbookrc") |
41 | { | 41 | { |
42 | KPrefs::setCurrentGroup( "Views" ); | 42 | KPrefs::setCurrentGroup( "Views" ); |
43 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 43 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
44 | 44 | ||
45 | KPrefs::setCurrentGroup( "General" ); | 45 | KPrefs::setCurrentGroup( "General" ); |
46 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 46 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
48 | 48 | ||
49 | #ifdef KAB_EMBEDDED | 49 | #ifdef KAB_EMBEDDED |
50 | addItemBool("AskForQuit",&mAskForQuit,true); | 50 | addItemBool("AskForQuit",&mAskForQuit,true); |
51 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 51 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
52 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 52 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
53 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); | 53 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); |
54 | 54 | ||
55 | 55 | ||
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
57 | 57 | ||
58 | KPrefs::setCurrentGroup( "MainWindow" ); | 58 | KPrefs::setCurrentGroup( "MainWindow" ); |
59 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 59 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
60 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 60 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
61 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 61 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
62 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 62 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
63 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 63 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
64 | 64 | ||
65 | 65 | ||
66 | KPrefs::setCurrentGroup( "Extensions_General" ); | 66 | KPrefs::setCurrentGroup( "Extensions_General" ); |
67 | QStringList defaultExtensions; | 67 | QStringList defaultExtensions; |
68 | defaultExtensions << "merge"; | 68 | defaultExtensions << "merge"; |
69 | defaultExtensions << "distribution_list_editor"; | 69 | defaultExtensions << "distribution_list_editor"; |
70 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 70 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
71 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 71 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
72 | 72 | ||
73 | KPrefs::setCurrentGroup( "Views" ); | 73 | KPrefs::setCurrentGroup( "Views" ); |
74 | QString defaultView = i18n( "Default Table View" ); | 74 | QString defaultView = i18n( "Default Table View" ); |
75 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 75 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
76 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 76 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
77 | 77 | ||
78 | KPrefs::setCurrentGroup( "Filters" ); | 78 | KPrefs::setCurrentGroup( "Filters" ); |
79 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 79 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | KABPrefs::~KABPrefs() | 83 | KABPrefs::~KABPrefs() |
84 | { | 84 | { |
85 | //qDebug("KABPrefs::~KABPrefs() "); | ||
85 | } | 86 | } |
86 | 87 | ||
87 | KABPrefs *KABPrefs::instance() | 88 | KABPrefs *KABPrefs::instance() |
88 | { | 89 | { |
89 | if ( !sInstance ) { | 90 | if ( !sInstance ) { |
90 | #ifdef KAB_EMBEDDED | 91 | #ifdef KAB_EMBEDDED |
91 | sInstance = staticDeleter.setObject( new KABPrefs() ); | 92 | sInstance = staticDeleter.setObject( new KABPrefs() ); |
92 | #else //KAB_EMBEDDED | 93 | #else //KAB_EMBEDDED |
93 | //US the following line has changed ???. Why | 94 | //US the following line has changed ???. Why |
94 | staticDeleter.setObject( sInstance, new KABPrefs() ); | 95 | staticDeleter.setObject( sInstance, new KABPrefs() ); |
95 | #endif //KAB_EMBEDDED | 96 | #endif //KAB_EMBEDDED |
96 | sInstance->readConfig(); | 97 | sInstance->readConfig(); |
97 | } | 98 | } |
98 | 99 | ||
99 | return sInstance; | 100 | return sInstance; |
100 | } | 101 | } |
101 | 102 | ||
102 | void KABPrefs::setCategoryDefaults() | 103 | void KABPrefs::setCategoryDefaults() |
103 | { | 104 | { |
104 | mCustomCategories.clear(); | 105 | mCustomCategories.clear(); |
105 | 106 | ||
106 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 107 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
107 | << i18n( "Customer" ) << i18n( "Friend" ); | 108 | << i18n( "Customer" ) << i18n( "Friend" ); |
108 | } | 109 | } |
109 | 110 | ||
110 | // US introduce a nonconst way to return the config object. | 111 | // US introduce a nonconst way to return the config object. |
111 | KConfig* KABPrefs::getConfig() | 112 | KConfig* KABPrefs::getConfig() |
112 | { | 113 | { |
113 | return config(); | 114 | return config(); |
114 | } | 115 | } |
115 | 116 | ||
116 | 117 | ||
117 | /*US | 118 | /*US |
118 | void KABPrefs::usrSetDefaults() | 119 | void KABPrefs::usrSetDefaults() |
119 | { | 120 | { |
120 | KPimPrefs::usrSetDefaults(); | 121 | KPimPrefs::usrSetDefaults(); |
121 | } | 122 | } |
122 | 123 | ||
123 | void KABPrefs::usrReadConfig() | 124 | void KABPrefs::usrReadConfig() |
124 | { | 125 | { |
125 | KPimPrefs::usrReadConfig(); | 126 | KPimPrefs::usrReadConfig(); |
126 | } | 127 | } |
127 | 128 | ||
128 | void KABPrefs::usrWriteConfig() | 129 | void KABPrefs::usrWriteConfig() |
129 | { | 130 | { |
130 | KPimPrefs::usrWriteConfig(); | 131 | KPimPrefs::usrWriteConfig(); |
131 | } | 132 | } |
132 | */ | 133 | */ |
diff --git a/kalarmd/simplealarmdaemonapplet.cpp b/kalarmd/simplealarmdaemonapplet.cpp index bb89606..7e8125d 100644 --- a/kalarmd/simplealarmdaemonapplet.cpp +++ b/kalarmd/simplealarmdaemonapplet.cpp | |||
@@ -1,58 +1,57 @@ | |||
1 | #include "simplealarmdaemonapplet.h" | 1 | #include "simplealarmdaemonapplet.h" |
2 | 2 | ||
3 | #include "simplealarmdaemonimpl.h" | 3 | #include "simplealarmdaemonimpl.h" |
4 | 4 | ||
5 | #include <qpe/global.h> | ||
6 | #include <qcopchannel_qws.h> | 5 | #include <qcopchannel_qws.h> |
7 | #include <qlabel.h> | 6 | #include <qlabel.h> |
8 | #include <qapp.h> | 7 | #include <qapp.h> |
9 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
10 | SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet() | 9 | SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet() |
11 | : mApplet( 0 ), ref( 0 ) | 10 | : mApplet( 0 ), ref( 0 ) |
12 | { | 11 | { |
13 | 12 | ||
14 | } | 13 | } |
15 | 14 | ||
16 | SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet() | 15 | SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet() |
17 | { | 16 | { |
18 | delete mApplet; | 17 | delete mApplet; |
19 | } | 18 | } |
20 | 19 | ||
21 | 20 | ||
22 | QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent ) | 21 | QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent ) |
23 | { | 22 | { |
24 | if ( !mApplet ) { | 23 | if ( !mApplet ) { |
25 | mApplet = new SimpleAlarmDaemonImpl( parent ); | 24 | mApplet = new SimpleAlarmDaemonImpl( parent ); |
26 | if ( QApplication::desktop()->width() < 480 ) | 25 | if ( QApplication::desktop()->width() < 480 ) |
27 | mApplet->setPixmap( Resource::loadPixmap( "ko16" ) ); | 26 | mApplet->setPixmap( Resource::loadPixmap( "ko16" ) ); |
28 | else | 27 | else |
29 | mApplet->setPixmap( Resource::loadPixmap( "ko24" ) ); | 28 | mApplet->setPixmap( Resource::loadPixmap( "ko24" ) ); |
30 | QCopChannel* c = new QCopChannel("koalarm",mApplet , "channel" ) ; | 29 | QCopChannel* c = new QCopChannel("koalarm",mApplet , "channel" ) ; |
31 | QObject::connect( c, SIGNAL (received ( const QCString &, const QByteArray & )),mApplet, SLOT(recieve( const QCString&, const QByteArray& ))); | 30 | QObject::connect( c, SIGNAL (received ( const QCString &, const QByteArray & )),mApplet, SLOT(recieve( const QCString&, const QByteArray& ))); |
32 | mApplet->show(); | 31 | mApplet->show(); |
33 | } | 32 | } |
34 | return mApplet; | 33 | return mApplet; |
35 | } | 34 | } |
36 | 35 | ||
37 | int SimpleAlarmDaemonApplet::position() const | 36 | int SimpleAlarmDaemonApplet::position() const |
38 | { | 37 | { |
39 | return 7; | 38 | return 7; |
40 | } | 39 | } |
41 | 40 | ||
42 | QRESULT SimpleAlarmDaemonApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 41 | QRESULT SimpleAlarmDaemonApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
43 | { | 42 | { |
44 | *iface = 0; | 43 | *iface = 0; |
45 | if ( uuid == IID_QUnknown ) | 44 | if ( uuid == IID_QUnknown ) |
46 | *iface = this; | 45 | *iface = this; |
47 | else if ( uuid == IID_TaskbarApplet ) | 46 | else if ( uuid == IID_TaskbarApplet ) |
48 | *iface = this; | 47 | *iface = this; |
49 | 48 | ||
50 | if ( *iface ) | 49 | if ( *iface ) |
51 | (*iface)->addRef(); | 50 | (*iface)->addRef(); |
52 | return QS_OK; | 51 | return QS_OK; |
53 | } | 52 | } |
54 | 53 | ||
55 | Q_EXPORT_INTERFACE() | 54 | Q_EXPORT_INTERFACE() |
56 | { | 55 | { |
57 | Q_CREATE_INSTANCE( SimpleAlarmDaemonApplet ) | 56 | Q_CREATE_INSTANCE( SimpleAlarmDaemonApplet ) |
58 | } | 57 | } |
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 6484c45..c0200ff 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp | |||
@@ -1,507 +1,128 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | 44 | ||
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "mainwindow.h" | 46 | #include "mainwindow.h" |
47 | 47 | ||
48 | 48 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
51 | 51 | ||
52 | KOPrefs::KOPrefs() : | 52 | KOPrefs::KOPrefs() : |
53 | KPimPrefs("kopiemailrc") | 53 | KPimPrefs("kopiemailrc") |
54 | { | 54 | { |
55 | mAppFont = QFont("helvetica",12); | 55 | mAppFont = QFont("helvetica",12); |
56 | mComposeFont = QFont("helvetica",12); | 56 | mComposeFont = QFont("helvetica",12); |
57 | mReadFont = QFont("helvetica",12); | 57 | mReadFont = QFont("helvetica",12); |
58 | 58 | ||
59 | KPrefs::setCurrentGroup("General"); | 59 | KPrefs::setCurrentGroup("General"); |
60 | addItemString("SenderName",&mName,i18n ("Please set at") ); | 60 | addItemString("SenderName",&mName,i18n ("Please set at") ); |
61 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); | 61 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); |
62 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); | 62 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); |
63 | addItemBool("SendMailLater",&mSendLater,true); | 63 | addItemBool("SendMailLater",&mSendLater,true); |
64 | addItemBool("UseKapi",&mUseKapi,false); | 64 | addItemBool("UseKapi",&mUseKapi,false); |
65 | 65 | ||
66 | KPrefs::setCurrentGroup("Fonts"); | 66 | KPrefs::setCurrentGroup("Fonts"); |
67 | addItemFont("Application Font",&mAppFont); | 67 | addItemFont("Application Font",&mAppFont); |
68 | addItemFont("Compose Font",&mComposeFont); | 68 | addItemFont("Compose Font",&mComposeFont); |
69 | addItemFont("Read Font",&mReadFont); | 69 | addItemFont("Read Font",&mReadFont); |
70 | 70 | ||
71 | #if 0 | ||
72 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | ||
73 | mDefaultViewFont = QFont("helvetica",10); | ||
74 | mDefaultMonthViewFont = QFont("helvetica",8); | ||
75 | mMarcusBainsFont= QFont("helvetica",10); | ||
76 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | ||
77 | mEditBoxFont = QFont("helvetica",12); | ||
78 | mJornalViewFont = QFont("helvetica",12); | ||
79 | |||
80 | KPrefs::setCurrentGroup("General"); | ||
81 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | ||
82 | |||
83 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | ||
84 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | ||
85 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | ||
86 | addItemBool("ShowIconList",&mShowIconList,true); | ||
87 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | ||
88 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | ||
89 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | ||
90 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | ||
91 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | ||
92 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | ||
93 | addItemBool("ShowIconBack",&mShowIconBack,true); | ||
94 | addItemBool("ShowIconToday",&mShowIconToday,true); | ||
95 | addItemBool("ShowIconForward",&mShowIconForward,true); | ||
96 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | ||
97 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | ||
98 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | ||
99 | addItemBool("ShowIconNext",&mShowIconNext,true); | ||
100 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | ||
101 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | ||
102 | addItemBool("LanguageChanged",&mLanguageChanged,false); | ||
103 | |||
104 | addItemBool("AskForQuit",&mAskForQuit,false); | ||
105 | |||
106 | #ifndef DESKTOP_VERSION | ||
107 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | ||
108 | #else | ||
109 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | ||
110 | #endif | ||
111 | addItemBool("ToolBarHor",&mToolBarHor, true ); | ||
112 | addItemBool("ToolBarUp",&mToolBarUp, false ); | ||
113 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | ||
114 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | ||
115 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | ||
116 | |||
117 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | ||
118 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | ||
119 | addItemInt("AllDay Size",&mAllDaySize,28); | ||
120 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | ||
121 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | ||
122 | |||
123 | addItemStringList("LocationDefaults",&mLocationDefaults ); | ||
124 | addItemStringList("EventSummary User",&mEventSummaryUser); | ||
125 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | ||
126 | |||
127 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | ||
128 | addItemBool("Enable Project View",&mEnableProjectView,false); | ||
129 | addItemBool("Auto Save",&mAutoSave,false); | ||
130 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | ||
131 | addItemBool("Confirm Deletes",&mConfirm,true); | ||
132 | addItemString("Archive File",&mArchiveFile); | ||
133 | addItemString("Html Export File",&mHtmlExportFile, | ||
134 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | ||
135 | addItemBool("Html With Save",&mHtmlWithSave,false); | ||
136 | |||
137 | KPrefs::setCurrentGroup("Personal Settings"); | ||
138 | |||
139 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | ||
140 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | ||
141 | addItemBool("Bcc",&mBcc,false); | ||
142 | |||
143 | KPrefs::setCurrentGroup("Time & Date"); | ||
144 | |||
145 | // addItemString("Time Zone",&mTimeZone,"+0100"); | ||
146 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | ||
147 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); | ||
148 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | ||
149 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | ||
150 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | ||
151 | |||
152 | |||
153 | addItemInt("Default Start Time",&mStartTime,10); | ||
154 | addItemInt("Default Duration",&mDefaultDuration,2); | ||
155 | addItemInt("Default Alarm Time",&mAlarmTime,3); | ||
156 | addItemInt("Daylight Savings",&mDaylightSavings,0); | ||
157 | KPrefs::setCurrentGroup("AlarmSettings"); | ||
158 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | ||
159 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | ||
160 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | ||
161 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | ||
162 | |||
163 | |||
164 | KPrefs::setCurrentGroup("Calendar"); | ||
165 | |||
166 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | ||
167 | |||
168 | KPrefs::setCurrentGroup("Fonts"); | ||
169 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | ||
170 | addItemFont("TimeBar Font",&mTimeBarFont); | ||
171 | addItemFont("MonthView Font",&mMonthViewFont); | ||
172 | addItemFont("AgendaView Font",&mAgendaViewFont); | ||
173 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | ||
174 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | ||
175 | addItemFont("TodoView Font",&mTodoViewFont); | ||
176 | addItemFont("ListView Font",&mListViewFont); | ||
177 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | ||
178 | addItemFont("EditBox Font",&mEditBoxFont); | ||
179 | addItemFont("JournalView Font",&mJornalViewFont); | ||
180 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | ||
181 | addItemFont("EventView Font",&mEventViewFont); | ||
182 | |||
183 | // KPrefs::setCurrentGroup("SyncProfiles"); | ||
184 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | ||
185 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | ||
186 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | ||
187 | |||
188 | KPrefs::setCurrentGroup("RemoteSyncing"); | ||
189 | // addItemBool("UsePasswd",&mUsePassWd,false); | ||
190 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | ||
191 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | ||
192 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | ||
193 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | ||
194 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | ||
195 | addItemInt("LastSyncTime",&mLastSyncTime,0); | ||
196 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | ||
197 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | ||
198 | |||
199 | #ifdef _WIN32_ | ||
200 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | ||
201 | #else | ||
202 | QString hdp= locateLocal("data","korganizer")+"/"; | ||
203 | #endif | ||
204 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | ||
205 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); | ||
206 | // addItemString("RemotePassWd",&mRemotePassWd, ""); | ||
207 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | ||
208 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | ||
209 | |||
210 | |||
211 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | ||
212 | |||
213 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | ||
214 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | ||
215 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | ||
216 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | ||
217 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | ||
218 | |||
219 | |||
220 | KPrefs::setCurrentGroup("Locale"); | ||
221 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | ||
222 | addItemInt("PreferredTime",&mPreferredTime,0); | ||
223 | addItemInt("PreferredDate",&mPreferredDate,0); | ||
224 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | ||
225 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | ||
226 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | ||
227 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | ||
228 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | ||
229 | |||
230 | |||
231 | KPrefs::setCurrentGroup("Colors"); | ||
232 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | ||
233 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | ||
234 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | ||
235 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | ||
236 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | ||
237 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | ||
238 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | ||
239 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | ||
240 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | ||
241 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | ||
242 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | ||
243 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | ||
244 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | ||
245 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | ||
246 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | ||
247 | addItemBool("UseAppColors",&mUseAppColors,false); | ||
248 | |||
249 | |||
250 | |||
251 | KPrefs::setCurrentGroup("Views"); | ||
252 | addItemInt("Hour Size",&mHourSize,8); | ||
253 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | ||
254 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | ||
255 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | ||
256 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | ||
257 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | ||
258 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | ||
259 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | ||
260 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | ||
261 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | ||
262 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | ||
263 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | ||
264 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | ||
265 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | ||
266 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | ||
267 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | ||
268 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | ||
269 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | ||
270 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | ||
271 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | ||
272 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | ||
273 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | ||
274 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | ||
275 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | ||
276 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | ||
277 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | ||
278 | #ifdef DESKTOP_VERSION | ||
279 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | ||
280 | #else | ||
281 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | ||
282 | #endif | ||
283 | addItemInt("Day Begins",&mDayBegins,7); | ||
284 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | ||
285 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | ||
286 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | ||
287 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | ||
288 | |||
289 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | ||
290 | addItemBool("Full View Month",&mFullViewMonth,true); | ||
291 | addItemBool("Full View Todo",&mFullViewTodo,true); | ||
292 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | ||
293 | |||
294 | addItemInt("Next X Days",&mNextXDays,3); | ||
295 | |||
296 | KPrefs::setCurrentGroup("Printer"); | ||
297 | |||
298 | KPrefs::setCurrentGroup("Layout"); | ||
299 | |||
300 | addItemBool("CompactDialogs",&mCompactDialogs,false); | ||
301 | addItemBool("VerticalScreen",&mVerticalScreen,true); | ||
302 | |||
303 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | ||
304 | |||
305 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | ||
306 | |||
307 | KPrefs::setCurrentGroup("Group Scheduling"); | ||
308 | |||
309 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | ||
310 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | ||
311 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | ||
312 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | ||
313 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | ||
314 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | ||
315 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | ||
316 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | ||
317 | |||
318 | KPrefs::setCurrentGroup( "Editors" ); | ||
319 | |||
320 | addItemStringList( "EventTemplates", &mEventTemplates ); | ||
321 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | ||
322 | |||
323 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | ||
324 | |||
325 | #endif | ||
326 | 71 | ||
327 | } | 72 | } |
328 | 73 | ||
329 | 74 | ||
330 | KOPrefs::~KOPrefs() | 75 | KOPrefs::~KOPrefs() |
331 | { | 76 | { |
332 | if (mInstance == this) | 77 | if (mInstance == this) |
333 | mInstance = insd.setObject(0); | 78 | mInstance = insd.setObject(0); |
334 | #if 0 | 79 | |
335 | setLocaleDict( 0 ); | ||
336 | if ( mLocaleDict ) | ||
337 | delete mLocaleDict; | ||
338 | //qDebug("KOPrefs::~KOPrefs() "); | ||
339 | #endif | ||
340 | } | 80 | } |
341 | 81 | ||
342 | 82 | ||
343 | KOPrefs *KOPrefs::instance() | 83 | KOPrefs *KOPrefs::instance() |
344 | { | 84 | { |
345 | if (!mInstance) { | 85 | if (!mInstance) { |
346 | mInstance = insd.setObject(new KOPrefs()); | 86 | mInstance = insd.setObject(new KOPrefs()); |
347 | mInstance->readConfig(); | 87 | mInstance->readConfig(); |
348 | } | 88 | } |
349 | 89 | ||
350 | return mInstance; | 90 | return mInstance; |
351 | } | 91 | } |
352 | 92 | ||
353 | void KOPrefs::usrSetDefaults() | 93 | void KOPrefs::usrSetDefaults() |
354 | { | 94 | { |
355 | 95 | ||
356 | } | 96 | } |
357 | 97 | ||
358 | void KOPrefs::fillMailDefaults() | 98 | void KOPrefs::fillMailDefaults() |
359 | { | 99 | { |
360 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 100 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
361 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 101 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
362 | } | 102 | } |
363 | 103 | ||
364 | void KOPrefs::setTimeZoneIdDefault() | 104 | void KOPrefs::setTimeZoneIdDefault() |
365 | { | 105 | { |
366 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); | 106 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); |
367 | } | 107 | } |
368 | 108 | ||
369 | 109 | ||
370 | void KOPrefs::usrReadConfig() | 110 | void KOPrefs::usrReadConfig() |
371 | { | 111 | { |
372 | #if 0 | ||
373 | mLocaleDict = 0; | ||
374 | // pending LR fix translation | ||
375 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | ||
376 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { | ||
377 | if ( mPreferredLanguage == 1 ) { | ||
378 | mLocaleDict = new QDict<QString>; | ||
379 | int i = 0; | ||
380 | QString fw ( germanwords[i] [0]); | ||
381 | while ( !fw.isEmpty() ) { | ||
382 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | ||
383 | ++i; | ||
384 | fw = germanwords[i] [0]; | ||
385 | } | ||
386 | |||
387 | setLocaleDict( mLocaleDict ); | ||
388 | } else { | ||
389 | QString fileName ; | ||
390 | if ( mPreferredLanguage == 3 ) | ||
391 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
392 | else if ( mPreferredLanguage == 2 ) | ||
393 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
394 | QFile file( fileName ); | ||
395 | if (file.open( IO_ReadOnly ) ) { | ||
396 | QTextStream ts( &file ); | ||
397 | ts.setEncoding( QTextStream::Latin1 ); | ||
398 | //ts.setCodec( QTextCodec::latin1 ); | ||
399 | QString text = ts.read(); | ||
400 | file.close(); | ||
401 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
402 | QString line; | ||
403 | QString we; | ||
404 | QString wt; | ||
405 | int br = 0; | ||
406 | int nbr; | ||
407 | nbr = text.find ( "},", br ); | ||
408 | line = text.mid( br, nbr - br ); | ||
409 | br = nbr+1; | ||
410 | int se, ee, st, et; | ||
411 | mLocaleDict = new QDict<QString>; | ||
412 | QString end = "{ \"\",\"\" }"; | ||
413 | while ( (line != end) && (br > 1) ) { | ||
414 | //qDebug("%d *%s* ", br, line.latin1()); | ||
415 | se = line.find("\"")+1; | ||
416 | et = line.findRev("\"",-1); | ||
417 | ee = line.find("\",\""); | ||
418 | st = ee+3; | ||
419 | we = line.mid( se, ee-se ); | ||
420 | wt = line.mid( st, et-st ); | ||
421 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
422 | mLocaleDict->insert( we, new QString (wt) ); | ||
423 | nbr = text.find ( "}", br ); | ||
424 | line = text.mid( br, nbr - br ); | ||
425 | br = nbr+1; | ||
426 | } | ||
427 | //qDebug("end *%s* ", end.latin1()); | ||
428 | |||
429 | setLocaleDict( mLocaleDict ); | ||
430 | } else { | ||
431 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
432 | } | ||
433 | |||
434 | } | ||
435 | } | ||
436 | config()->setGroup("General"); | ||
437 | |||
438 | mCustomCategories = config()->readListEntry("Custom Categories"); | ||
439 | if ( KOPrefs::instance()->mLanguageChanged ) { | ||
440 | mLocationDefaults.clear(); | ||
441 | mEventSummaryUser.clear(); | ||
442 | mTodoSummaryUser.clear(); | ||
443 | } | ||
444 | if (mLocationDefaults.isEmpty()) { | ||
445 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | ||
446 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
447 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
448 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
449 | mLocationDefaults.sort(); | ||
450 | } | ||
451 | |||
452 | if (mEventSummaryUser.isEmpty()) { | ||
453 | mEventSummaryUser = getDefaultList() ; | ||
454 | } | ||
455 | if (mTodoSummaryUser.isEmpty()) { | ||
456 | mTodoSummaryUser = getDefaultList() ; | ||
457 | } | ||
458 | |||
459 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | ||
460 | |||
461 | config()->setGroup("Personal Settings"); | ||
462 | mName = config()->readEntry("user_name",""); | ||
463 | mEmail = config()->readEntry("user_email",""); | ||
464 | fillMailDefaults(); | ||
465 | 112 | ||
466 | config()->setGroup("Category Colors"); | ||
467 | QStringList::Iterator it; | ||
468 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | ||
469 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | ||
470 | |||
471 | } | ||
472 | |||
473 | if (mTimeZoneId.isEmpty()) { | ||
474 | setTimeZoneIdDefault(); | ||
475 | } | ||
476 | #endif | ||
477 | KPimPrefs::usrReadConfig(); | 113 | KPimPrefs::usrReadConfig(); |
478 | } | 114 | } |
479 | 115 | ||
480 | 116 | ||
481 | void KOPrefs::usrWriteConfig() | 117 | void KOPrefs::usrWriteConfig() |
482 | { | 118 | { |
483 | #if 0 | ||
484 | config()->setGroup("General"); | ||
485 | config()->writeEntry("Custom Categories",mCustomCategories); | ||
486 | |||
487 | config()->setGroup("Personal Settings"); | ||
488 | config()->writeEntry("user_name",mName); | ||
489 | config()->writeEntry("user_email",mEmail); | ||
490 | 119 | ||
491 | config()->setGroup("Category Colors"); | ||
492 | QDictIterator<QColor> it(mCategoryColors); | ||
493 | while (it.current()) { | ||
494 | config()->writeEntry(it.currentKey(),*(it.current())); | ||
495 | ++it; | ||
496 | } | ||
497 | |||
498 | #endif | ||
499 | KPimPrefs::usrWriteConfig(); | 120 | KPimPrefs::usrWriteConfig(); |
500 | } | 121 | } |
501 | 122 | ||
502 | 123 | ||
503 | 124 | ||
504 | KConfig* KOPrefs::getConfig() | 125 | KConfig* KOPrefs::getConfig() |
505 | { | 126 | { |
506 | return config(); | 127 | return config(); |
507 | } | 128 | } |
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 7f9b5c6..16186c0 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,102 +1,108 @@ | |||
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 <qpe/global.h> | 6 | #include <qpe/global.h> |
6 | #include <stdlib.h> | 7 | #include <stdlib.h> |
7 | #else | 8 | #else |
8 | #include <qapplication.h> | 9 | #include <qapplication.h> |
9 | #include <qstring.h> | 10 | #include <qstring.h> |
10 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
11 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
12 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
13 | #endif | 14 | #endif |
14 | 15 | ||
15 | #include <qdir.h> | 16 | #include <qdir.h> |
16 | #include <kstandarddirs.h> | 17 | #include <kstandarddirs.h> |
17 | #include <kglobal.h> | 18 | #include <kglobal.h> |
18 | #include <stdio.h> | 19 | #include <stdio.h> |
19 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
20 | 21 | ||
21 | int main( int argc, char **argv ) | 22 | int main( int argc, char **argv ) |
22 | { | 23 | { |
23 | #ifndef DESKTOP_VERSION | 24 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 25 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 26 | a.setKeepRunning (); |
26 | #else | 27 | #else |
27 | QApplication a( argc, argv ); | 28 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 29 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | QString hdir = QDir::homeDirPath(); | 30 | QString hdir = QDir::homeDirPath(); |
30 | // there is a bug when creating dirs for WIN 98 | 31 | // there is a bug when creating dirs for WIN 98 |
31 | // it is difficult to fix, because we have no WIN 98 runnung | 32 | // it is difficult to fix, because we have no WIN 98 runnung |
32 | // such that we try it to create the dirs at startup here | 33 | // such that we try it to create the dirs at startup here |
33 | if ( hdir == "C:\\" ) { // win 98 or ME | 34 | if ( hdir == "C:\\" ) { // win 98 or ME |
34 | QDir app_dir; | 35 | QDir app_dir; |
35 | if ( !app_dir.exists("C:\\kdepim") ) | 36 | if ( !app_dir.exists("C:\\kdepim") ) |
36 | app_dir.mkdir ("C:\\kdepim"); | 37 | app_dir.mkdir ("C:\\kdepim"); |
37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
38 | app_dir.mkdir ("C:\\kdepim\\apps"); | 39 | app_dir.mkdir ("C:\\kdepim\\apps"); |
39 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 40 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
40 | app_dir.mkdir ("C:\\kdepim\\config"); | 41 | app_dir.mkdir ("C:\\kdepim\\config"); |
41 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | 42 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) |
42 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | 43 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); |
43 | } | 44 | } |
44 | #endif | 45 | #endif |
45 | bool exitHelp = false; | 46 | bool exitHelp = false; |
46 | if ( argc > 1 ) { | 47 | if ( argc > 1 ) { |
47 | QString command = argv[1]; | 48 | QString command = argv[1]; |
48 | if ( command == "-help" ){ | 49 | if ( command == "-help" ){ |
49 | printf("KO/Pi command line commands:\n"); | 50 | printf("KO/Pi command line commands:\n"); |
50 | printf(" no command: Start KO/Pi in usual way\n"); | 51 | printf(" no command: Start KO/Pi in usual way\n"); |
51 | printf(" -help: This output\n"); | 52 | printf(" -help: This output\n"); |
52 | printf("Next Option: Open or Show after start:\n"); | 53 | printf("Next Option: Open or Show after start:\n"); |
53 | printf(" -newTodo: New Todo dialog\n"); | 54 | printf(" -newTodo: New Todo dialog\n"); |
54 | printf(" -newEvent: New Event dialog\n"); | 55 | printf(" -newEvent: New Event dialog\n"); |
55 | printf(" -showList: List view\n"); | 56 | printf(" -showList: List view\n"); |
56 | printf(" -showDay: Day view\n"); | 57 | printf(" -showDay: Day view\n"); |
57 | printf(" -showWWeek: Work Week view\n"); | 58 | printf(" -showWWeek: Work Week view\n"); |
58 | printf(" -showWeek: Week view\n"); | 59 | printf(" -showWeek: Week view\n"); |
59 | printf(" -showTodo: Todo view\n"); | 60 | printf(" -showTodo: Todo view\n"); |
60 | printf(" -showJournal: Journal view\n"); | 61 | printf(" -showJournal: Journal view\n"); |
61 | printf(" -showKO: Next Days view\n"); | 62 | printf(" -showKO: Next Days view\n"); |
62 | printf(" -showWNext: What's Next view\n"); | 63 | printf(" -showWNext: What's Next view\n"); |
63 | printf(" -showNextXView: Next X View\n"); | 64 | printf(" -showNextXView: Next X View\n"); |
64 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 65 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
65 | printf(" KO/Pi is exiting now. Bye!\n"); | 66 | printf(" KO/Pi is exiting now. Bye!\n"); |
66 | exitHelp = true; | 67 | exitHelp = true; |
67 | } | 68 | } |
68 | } | 69 | } |
69 | if ( ! exitHelp ) { | 70 | if ( ! exitHelp ) { |
70 | KGlobal::setAppName( "korganizer" ); | 71 | KGlobal::setAppName( "korganizer" ); |
71 | QString fileName ; | 72 | QString fileName ; |
72 | #ifndef DESKTOP_VERSION | 73 | #ifndef DESKTOP_VERSION |
73 | fileName = getenv("QPEDIR"); | 74 | fileName = getenv("QPEDIR"); |
74 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 75 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
75 | #else | 76 | #else |
76 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 77 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
77 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 78 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
78 | #endif | 79 | #endif |
79 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 80 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
80 | MainWindow m; | 81 | MainWindow m; |
81 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; | ||
84 | QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
82 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 85 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
83 | a.showMainWidget(&m ); | 86 | a.showMainWidget(&m ); |
84 | #else | 87 | #else |
85 | a.setMainWidget(&m ); | 88 | a.setMainWidget(&m ); |
86 | m.show(); | 89 | m.show(); |
87 | //m.resize( 800, 600 ); | 90 | //m.resize( 800, 600 ); |
88 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 91 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
89 | #endif | 92 | #endif |
90 | if ( argc > 1 ) { | 93 | if ( argc > 1 ) { |
91 | QCString command = argv[1]; | 94 | QCString command = argv[1]; |
92 | if ( argc > 2 ) | 95 | if ( argc > 2 ) |
93 | command += argv[2]; | 96 | command += argv[2]; |
94 | qApp->processEvents(); | 97 | qApp->processEvents(); |
95 | m.recieve(command, QByteArray() ); | 98 | m.recieve(command, QByteArray() ); |
96 | 99 | ||
97 | } | 100 | } |
98 | a.exec(); | 101 | a.exec(); |
102 | #ifndef DESKTOP_VERSION | ||
103 | delete c1; | ||
104 | #endif | ||
99 | 105 | ||
100 | } | 106 | } |
101 | qDebug("KO: Bye! "); | 107 | qDebug("KO: Bye! "); |
102 | } | 108 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2d17986..3c16458 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,677 +1,673 @@ | |||
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 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #include "koimportoldialog.h" | 69 | #include "koimportoldialog.h" |
70 | #endif | 70 | #endif |
71 | #include "mainwindow.h" | 71 | #include "mainwindow.h" |
72 | 72 | ||
73 | class KOex2phonePrefs : public QDialog | 73 | class KOex2phonePrefs : public QDialog |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
77 | QDialog( parent, name, true ) | 77 | QDialog( parent, name, true ) |
78 | { | 78 | { |
79 | setCaption( i18n("Export to phone options") ); | 79 | setCaption( i18n("Export to phone options") ); |
80 | QVBoxLayout* lay = new QVBoxLayout( this ); | 80 | QVBoxLayout* lay = new QVBoxLayout( this ); |
81 | lay->setSpacing( 3 ); | 81 | lay->setSpacing( 3 ); |
82 | lay->setMargin( 3 ); | 82 | lay->setMargin( 3 ); |
83 | QLabel *lab; | 83 | QLabel *lab; |
84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
85 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
86 | QHBox* temphb; | 86 | QHBox* temphb; |
87 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
88 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
89 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
90 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
93 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
97 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
100 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
101 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
102 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
105 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
106 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
108 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
110 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
112 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
115 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public: | 119 | public: |
120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
121 | QCheckBox* mWriteBackFuture; | 121 | QCheckBox* mWriteBackFuture; |
122 | QSpinBox* mWriteBackFutureWeeks; | 122 | QSpinBox* mWriteBackFutureWeeks; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
127 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
128 | { | 128 | { |
129 | 129 | ||
130 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
131 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
132 | #endif | 132 | #endif |
133 | mServerSocket = 0; | ||
134 | mClosed = false; | 133 | mClosed = false; |
135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
136 | QString confFile = locateLocal("config","korganizerrc"); | 135 | QString confFile = locateLocal("config","korganizerrc"); |
137 | QFileInfo finf ( confFile ); | 136 | QFileInfo finf ( confFile ); |
138 | bool showWarning = !finf.exists(); | 137 | bool showWarning = !finf.exists(); |
139 | setIcon(SmallIcon( "ko24" ) ); | 138 | setIcon(SmallIcon( "ko24" ) ); |
140 | mBlockAtStartup = true; | 139 | mBlockAtStartup = true; |
141 | mFlagKeyPressed = false; | 140 | mFlagKeyPressed = false; |
142 | setCaption("KOrganizer/Pi"); | 141 | setCaption("KOrganizer/Pi"); |
143 | KOPrefs *p = KOPrefs::instance(); | 142 | KOPrefs *p = KOPrefs::instance(); |
144 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 143 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
145 | if ( p->mHourSize > 18 ) | 144 | if ( p->mHourSize > 18 ) |
146 | p->mHourSize = 18; | 145 | p->mHourSize = 18; |
147 | QMainWindow::ToolBarDock tbd; | 146 | QMainWindow::ToolBarDock tbd; |
148 | if ( p->mToolBarHor ) { | 147 | if ( p->mToolBarHor ) { |
149 | if ( p->mToolBarUp ) | 148 | if ( p->mToolBarUp ) |
150 | tbd = Bottom; | 149 | tbd = Bottom; |
151 | else | 150 | else |
152 | tbd = Top; | 151 | tbd = Top; |
153 | } | 152 | } |
154 | else { | 153 | else { |
155 | if ( p->mToolBarUp ) | 154 | if ( p->mToolBarUp ) |
156 | tbd = Right; | 155 | tbd = Right; |
157 | else | 156 | else |
158 | tbd = Left; | 157 | tbd = Left; |
159 | } | 158 | } |
160 | if ( KOPrefs::instance()->mUseAppColors ) | 159 | if ( KOPrefs::instance()->mUseAppColors ) |
161 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
162 | globalFlagBlockStartup = 1; | 161 | globalFlagBlockStartup = 1; |
163 | iconToolBar = new QPEToolBar( this ); | 162 | iconToolBar = new QPEToolBar( this ); |
164 | addToolBar (iconToolBar , tbd ); | 163 | addToolBar (iconToolBar , tbd ); |
165 | mCalendarModifiedFlag = false; | 164 | mCalendarModifiedFlag = false; |
166 | 165 | ||
167 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
168 | splash->setAlignment ( AlignCenter ); | 167 | splash->setAlignment ( AlignCenter ); |
169 | setCentralWidget( splash ); | 168 | setCentralWidget( splash ); |
170 | #ifndef DESKTOP_VERSION | 169 | #ifndef DESKTOP_VERSION |
171 | showMaximized(); | 170 | showMaximized(); |
172 | #endif | 171 | #endif |
173 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
174 | setDefaultPreferences(); | 173 | setDefaultPreferences(); |
175 | mCalendar = new CalendarLocal(); | 174 | mCalendar = new CalendarLocal(); |
176 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
177 | mView->hide(); | 176 | mView->hide(); |
178 | //mView->resize(splash->size() ); | 177 | //mView->resize(splash->size() ); |
179 | initActions(); | 178 | initActions(); |
180 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
181 | mSyncManager->setBlockSave(false); | 180 | mSyncManager->setBlockSave(false); |
182 | mView->setSyncManager(mSyncManager); | 181 | mView->setSyncManager(mSyncManager); |
183 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
184 | iconToolBar->show(); | 183 | iconToolBar->show(); |
185 | qApp->processEvents(); | 184 | qApp->processEvents(); |
186 | #endif | 185 | #endif |
187 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
188 | int vh = height() ; | 187 | int vh = height() ; |
189 | int vw = width(); | 188 | int vw = width(); |
190 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
191 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
192 | vh -= iconToolBar->height(); | 191 | vh -= iconToolBar->height(); |
193 | } else { | 192 | } else { |
194 | vw -= iconToolBar->height(); | 193 | vw -= iconToolBar->height(); |
195 | } | 194 | } |
196 | //mView->setMaximumSize( splash->size() ); | 195 | //mView->setMaximumSize( splash->size() ); |
197 | //mView->resize( splash->size() ); | 196 | //mView->resize( splash->size() ); |
198 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
199 | mView->readSettings(); | 198 | mView->readSettings(); |
200 | bool newFile = false; | 199 | bool newFile = false; |
201 | if( !QFile::exists( defaultFileName() ) ) { | 200 | if( !QFile::exists( defaultFileName() ) ) { |
202 | QFileInfo finfo ( defaultFileName() ); | 201 | QFileInfo finfo ( defaultFileName() ); |
203 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
204 | qDebug("oldfile %s ", oldFile.latin1()); | 203 | qDebug("oldfile %s ", oldFile.latin1()); |
205 | 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"; | 204 | 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"; |
206 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
207 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
208 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
209 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
210 | qApp->processEvents(); | 209 | qApp->processEvents(); |
211 | } else { | 210 | } else { |
212 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
213 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
214 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
215 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
216 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
217 | qApp->processEvents(); | 216 | qApp->processEvents(); |
218 | } | 217 | } |
219 | } | 218 | } |
220 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
221 | newFile = true; | 220 | newFile = true; |
222 | } | 221 | } |
223 | 222 | ||
224 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
225 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
226 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
227 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
228 | 227 | ||
229 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KOPrefs::instance()->mLanguageChanged ) { |
230 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
231 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
232 | KOPrefs::instance()->mLanguageChanged = false; | 231 | KOPrefs::instance()->mLanguageChanged = false; |
233 | } | 232 | } |
234 | processIncidenceSelection( 0 ); | 233 | processIncidenceSelection( 0 ); |
235 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
236 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 235 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
237 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
238 | SLOT( slotModifiedChanged( bool ) ) ); | 237 | SLOT( slotModifiedChanged( bool ) ) ); |
239 | 238 | ||
240 | 239 | ||
241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 240 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
242 | mView->setModified( false ); | 241 | mView->setModified( false ); |
243 | mBlockAtStartup = false; | 242 | mBlockAtStartup = false; |
244 | mView->setModified( false ); | 243 | mView->setModified( false ); |
245 | setCentralWidget( mView ); | 244 | setCentralWidget( mView ); |
246 | globalFlagBlockStartup = 0; | 245 | globalFlagBlockStartup = 0; |
247 | mView->show(); | 246 | mView->show(); |
248 | delete splash; | 247 | delete splash; |
249 | if ( newFile ) | 248 | if ( newFile ) |
250 | mView->updateConfig(); | 249 | mView->updateConfig(); |
251 | // qApp->processEvents(); | 250 | // qApp->processEvents(); |
252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
253 | //fillSyncMenu(); | 252 | //fillSyncMenu(); |
254 | 253 | ||
255 | 254 | ||
256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
259 | mSyncManager->setDefaultFileName( defaultFileName()); | 258 | mSyncManager->setDefaultFileName( defaultFileName()); |
260 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
261 | mSyncManager->fillSyncMenu(); | 260 | mSyncManager->fillSyncMenu(); |
262 | 261 | ||
263 | 262 | ||
264 | 263 | ||
265 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
266 | if ( showWarning ) { | 265 | if ( showWarning ) { |
267 | KMessageBox::information( this, | 266 | KMessageBox::information( this, |
268 | "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"); | 267 | "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"); |
269 | qApp->processEvents(); | 268 | qApp->processEvents(); |
270 | mView->dialogManager()->showSyncOptions(); | 269 | mView->dialogManager()->showSyncOptions(); |
271 | } | 270 | } |
272 | 271 | ||
273 | //US listen for result adressed from Ka/Pi | 272 | //US listen for result adressed from Ka/Pi |
274 | #ifndef DESKTOP_VERSION | 273 | #ifndef DESKTOP_VERSION |
275 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
276 | #endif | 275 | #endif |
277 | } | 276 | } |
278 | MainWindow::~MainWindow() | 277 | MainWindow::~MainWindow() |
279 | { | 278 | { |
280 | //qDebug("MainWindow::~MainWindow() "); | 279 | //qDebug("MainWindow::~MainWindow() "); |
281 | //save toolbar location | 280 | //save toolbar location |
282 | delete mServerSocket; | ||
283 | delete mCalendar; | 281 | delete mCalendar; |
284 | delete KOPrefs::instance(); | 282 | delete mSyncManager; |
285 | delete KIncidenceFormatter::instance(); | ||
286 | 283 | ||
287 | 284 | ||
288 | } | 285 | } |
289 | void MainWindow::showMaximized () | 286 | void MainWindow::showMaximized () |
290 | { | 287 | { |
291 | #ifndef DESKTOP_VERSION | 288 | #ifndef DESKTOP_VERSION |
292 | if ( ! globalFlagBlockStartup ) | 289 | if ( ! globalFlagBlockStartup ) |
293 | if ( mClosed ) | 290 | if ( mClosed ) |
294 | mView->goToday(); | 291 | mView->goToday(); |
295 | #endif | 292 | #endif |
296 | QWidget::showMaximized () ; | 293 | QWidget::showMaximized () ; |
297 | mClosed = false; | 294 | mClosed = false; |
298 | } | 295 | } |
299 | void MainWindow::closeEvent( QCloseEvent* ce ) | 296 | void MainWindow::closeEvent( QCloseEvent* ce ) |
300 | { | 297 | { |
301 | 298 | ||
302 | 299 | ||
303 | 300 | ||
304 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 301 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
305 | saveOnClose(); | 302 | saveOnClose(); |
306 | mClosed = true; | 303 | mClosed = true; |
307 | ce->accept(); | 304 | ce->accept(); |
308 | return; | 305 | return; |
309 | 306 | ||
310 | } | 307 | } |
311 | 308 | ||
312 | switch( QMessageBox::information( this, "KO/Pi", | 309 | switch( QMessageBox::information( this, "KO/Pi", |
313 | i18n("Do you really want\nto close KO/Pi?"), | 310 | i18n("Do you really want\nto close KO/Pi?"), |
314 | i18n("Close"), i18n("No"), | 311 | i18n("Close"), i18n("No"), |
315 | 0, 0 ) ) { | 312 | 0, 0 ) ) { |
316 | case 0: | 313 | case 0: |
317 | saveOnClose(); | 314 | saveOnClose(); |
318 | mClosed = true; | 315 | mClosed = true; |
319 | ce->accept(); | 316 | ce->accept(); |
320 | break; | 317 | break; |
321 | case 1: | 318 | case 1: |
322 | ce->ignore(); | 319 | ce->ignore(); |
323 | break; | 320 | break; |
324 | case 2: | 321 | case 2: |
325 | 322 | ||
326 | default: | 323 | default: |
327 | break; | 324 | break; |
328 | } | 325 | } |
329 | 326 | ||
330 | 327 | ||
331 | } | 328 | } |
332 | 329 | ||
333 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 330 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
334 | { | 331 | { |
335 | QDataStream stream( data, IO_ReadOnly ); | 332 | QDataStream stream( data, IO_ReadOnly ); |
336 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 333 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
337 | //QString datamess; | 334 | //QString datamess; |
338 | //qDebug("message "); | 335 | //qDebug("message "); |
339 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 336 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
340 | 337 | ||
341 | if ( cmsg == "-writeFile" ) { | 338 | if ( cmsg == "-writeFile" ) { |
342 | // I made from the "-writeFile" an "-writeAlarm" | 339 | // I made from the "-writeFile" an "-writeAlarm" |
343 | mView->viewManager()->showWhatsNextView(); | 340 | mView->viewManager()->showWhatsNextView(); |
344 | mCalendar->checkAlarmForIncidence( 0, true); | 341 | mCalendar->checkAlarmForIncidence( 0, true); |
345 | showMaximized(); | 342 | showMaximized(); |
346 | raise(); | 343 | raise(); |
347 | return; | 344 | return; |
348 | } | 345 | } |
349 | 346 | ||
350 | if ( cmsg == "-writeFile" ) { | 347 | if ( cmsg == "-writeFile" ) { |
351 | // I made from the "-writeFile" an "-writeAlarm" | 348 | // I made from the "-writeFile" an "-writeAlarm" |
352 | mView->viewManager()->showWhatsNextView(); | 349 | mView->viewManager()->showWhatsNextView(); |
353 | mCalendar->checkAlarmForIncidence( 0, true); | 350 | mCalendar->checkAlarmForIncidence( 0, true); |
354 | showMaximized(); | 351 | showMaximized(); |
355 | raise(); | 352 | raise(); |
356 | return; | 353 | return; |
357 | 354 | ||
358 | } | 355 | } |
359 | if ( cmsg == "-writeFileSilent" ) { | 356 | if ( cmsg == "-writeFileSilent" ) { |
360 | // I made from the "-writeFile" an "-writeAlarm" | 357 | // I made from the "-writeFile" an "-writeAlarm" |
361 | // mView->viewManager()->showWhatsNextView(); | 358 | // mView->viewManager()->showWhatsNextView(); |
362 | mCalendar->checkAlarmForIncidence( 0, true); | 359 | mCalendar->checkAlarmForIncidence( 0, true); |
363 | //showMaximized(); | 360 | //showMaximized(); |
364 | //raise(); | 361 | //raise(); |
365 | hide(); | 362 | hide(); |
366 | return; | 363 | return; |
367 | } | 364 | } |
368 | if ( cmsg == "-newCountdown" ) { | 365 | if ( cmsg == "-newCountdown" ) { |
369 | qDebug("newCountdown "); | 366 | qDebug("newCountdown "); |
370 | 367 | ||
371 | } | 368 | } |
372 | QString msg ; | 369 | QString msg ; |
373 | QString allmsg = cmsg; | 370 | QString allmsg = cmsg; |
374 | while ( allmsg.length() > 0 ) { | 371 | while ( allmsg.length() > 0 ) { |
375 | int nextC = allmsg.find( "-", 1 ); | 372 | int nextC = allmsg.find( "-", 1 ); |
376 | if ( nextC == -1 ) { | 373 | if ( nextC == -1 ) { |
377 | msg = allmsg; | 374 | msg = allmsg; |
378 | allmsg = ""; | 375 | allmsg = ""; |
379 | } else{ | 376 | } else{ |
380 | msg = allmsg.left( nextC ); | 377 | msg = allmsg.left( nextC ); |
381 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 378 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
382 | } | 379 | } |
383 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 380 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
384 | if ( msg == "-newEvent" ) { | 381 | if ( msg == "-newEvent" ) { |
385 | mView->newEvent(); | 382 | mView->newEvent(); |
386 | } | 383 | } |
387 | if ( msg == "-newTodo" ) { | 384 | if ( msg == "-newTodo" ) { |
388 | mView->newTodo(); | 385 | mView->newTodo(); |
389 | 386 | ||
390 | } | 387 | } |
391 | if ( msg == "-showWN" ) { | 388 | if ( msg == "-showWN" ) { |
392 | mView->viewManager()->showWhatsNextView(); | 389 | mView->viewManager()->showWhatsNextView(); |
393 | } | 390 | } |
394 | if ( msg == "-showTodo" ) { | 391 | if ( msg == "-showTodo" ) { |
395 | mView->viewManager()->showTodoView(); | 392 | mView->viewManager()->showTodoView(); |
396 | } | 393 | } |
397 | if ( msg == "-showList" ) { | 394 | if ( msg == "-showList" ) { |
398 | mView->viewManager()->showListView(); | 395 | mView->viewManager()->showListView(); |
399 | } | 396 | } |
400 | else if ( msg == "-showDay" ) { | 397 | else if ( msg == "-showDay" ) { |
401 | mView->viewManager()->showDayView(); | 398 | mView->viewManager()->showDayView(); |
402 | } | 399 | } |
403 | else if ( msg == "-showWWeek" ) { | 400 | else if ( msg == "-showWWeek" ) { |
404 | mView->viewManager()->showWorkWeekView(); | 401 | mView->viewManager()->showWorkWeekView(); |
405 | } | 402 | } |
406 | else if ( msg == "-ringSync" ) { | 403 | else if ( msg == "-ringSync" ) { |
407 | mSyncManager->multiSync( false ); | 404 | mSyncManager->multiSync( false ); |
408 | } | 405 | } |
409 | else if ( msg == "-showWeek" ) { | 406 | else if ( msg == "-showWeek" ) { |
410 | mView->viewManager()->showWeekView(); | 407 | mView->viewManager()->showWeekView(); |
411 | } | 408 | } |
412 | else if ( msg == "-showTodo" ) { | 409 | else if ( msg == "-showTodo" ) { |
413 | mView->viewManager()->showTodoView(); | 410 | mView->viewManager()->showTodoView(); |
414 | } | 411 | } |
415 | else if ( msg == "-showJournal" ) { | 412 | else if ( msg == "-showJournal" ) { |
416 | mView->dateNavigator()->selectDates( 1 ); | 413 | mView->dateNavigator()->selectDates( 1 ); |
417 | mView->dateNavigator()->selectToday(); | 414 | mView->dateNavigator()->selectToday(); |
418 | mView->viewManager()->showJournalView(); | 415 | mView->viewManager()->showJournalView(); |
419 | } | 416 | } |
420 | else if ( msg == "-showKO" ) { | 417 | else if ( msg == "-showKO" ) { |
421 | mView->viewManager()->showNextXView(); | 418 | mView->viewManager()->showNextXView(); |
422 | } | 419 | } |
423 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 420 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
424 | mView->viewManager()->showWhatsNextView(); | 421 | mView->viewManager()->showWhatsNextView(); |
425 | } | 422 | } |
426 | else if ( msg == "-showNextXView" ) { | 423 | else if ( msg == "-showNextXView" ) { |
427 | mView->viewManager()->showNextXView(); | 424 | mView->viewManager()->showNextXView(); |
428 | } | 425 | } |
429 | 426 | ||
430 | 427 | ||
431 | } | 428 | } |
432 | 429 | ||
433 | showMaximized(); | 430 | showMaximized(); |
434 | raise(); | 431 | raise(); |
435 | } | 432 | } |
436 | 433 | ||
437 | QPixmap MainWindow::loadPixmap( QString name ) | 434 | QPixmap MainWindow::loadPixmap( QString name ) |
438 | { | 435 | { |
439 | return SmallIcon( name ); | 436 | return SmallIcon( name ); |
440 | 437 | ||
441 | } | 438 | } |
442 | void MainWindow::initActions() | 439 | void MainWindow::initActions() |
443 | { | 440 | { |
444 | //KOPrefs::instance()->mShowFullMenu | 441 | //KOPrefs::instance()->mShowFullMenu |
445 | iconToolBar->clear(); | 442 | iconToolBar->clear(); |
446 | KOPrefs *p = KOPrefs::instance(); | 443 | KOPrefs *p = KOPrefs::instance(); |
447 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 444 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
448 | 445 | ||
449 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 446 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
450 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 447 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
451 | QPopupMenu *importMenu = new QPopupMenu( this ); | 448 | QPopupMenu *importMenu = new QPopupMenu( this ); |
452 | selectFilterMenu = new QPopupMenu( this ); | 449 | selectFilterMenu = new QPopupMenu( this ); |
453 | selectFilterMenu->setCheckable( true ); | 450 | selectFilterMenu->setCheckable( true ); |
454 | syncMenu = new QPopupMenu( this ); | 451 | syncMenu = new QPopupMenu( this ); |
455 | configureAgendaMenu = new QPopupMenu( this ); | 452 | configureAgendaMenu = new QPopupMenu( this ); |
456 | configureToolBarMenu = new QPopupMenu( this ); | 453 | configureToolBarMenu = new QPopupMenu( this ); |
457 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 454 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
458 | if ( KOPrefs::instance()->mShowFullMenu ) { | 455 | if ( KOPrefs::instance()->mShowFullMenu ) { |
459 | QMenuBar *menuBar1; | 456 | QMenuBar *menuBar1; |
460 | menuBar1 = menuBar(); | 457 | menuBar1 = menuBar(); |
461 | menuBar1->insertItem( i18n("File"), importMenu ); | 458 | menuBar1->insertItem( i18n("File"), importMenu ); |
462 | menuBar1->insertItem( i18n("View"), viewMenu ); | 459 | menuBar1->insertItem( i18n("View"), viewMenu ); |
463 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 460 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
464 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 461 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
465 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 462 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
466 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 463 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
467 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 464 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
468 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 465 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
469 | } else { | 466 | } else { |
470 | QPEMenuBar *menuBar1; | 467 | QPEMenuBar *menuBar1; |
471 | menuBar1 = new QPEMenuBar( iconToolBar ); | 468 | menuBar1 = new QPEMenuBar( iconToolBar ); |
472 | QPopupMenu *menuBar = new QPopupMenu( this ); | 469 | QPopupMenu *menuBar = new QPopupMenu( this ); |
473 | menuBar1->insertItem( i18n("ME"), menuBar); | 470 | menuBar1->insertItem( i18n("ME"), menuBar); |
474 | menuBar->insertItem( i18n("File"), importMenu ); | 471 | menuBar->insertItem( i18n("File"), importMenu ); |
475 | menuBar->insertItem( i18n("View"), viewMenu ); | 472 | menuBar->insertItem( i18n("View"), viewMenu ); |
476 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 473 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
477 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 474 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
478 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 475 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
479 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 476 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
480 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 477 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
481 | menuBar->insertItem( i18n("Help"), helpMenu ); | 478 | menuBar->insertItem( i18n("Help"), helpMenu ); |
482 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 479 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
483 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 480 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
484 | } | 481 | } |
485 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | ||
486 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 482 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
487 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 483 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
488 | 484 | ||
489 | // ****************** | 485 | // ****************** |
490 | QAction *action; | 486 | QAction *action; |
491 | QIconSet icon; | 487 | QIconSet icon; |
492 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 488 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
493 | configureToolBarMenu->setCheckable( true ); | 489 | configureToolBarMenu->setCheckable( true ); |
494 | 490 | ||
495 | QString pathString = ""; | 491 | QString pathString = ""; |
496 | if ( !p->mToolBarMiniIcons ) { | 492 | if ( !p->mToolBarMiniIcons ) { |
497 | if ( QApplication::desktop()->width() < 480 ) | 493 | if ( QApplication::desktop()->width() < 480 ) |
498 | pathString += "icons16/"; | 494 | pathString += "icons16/"; |
499 | } else | 495 | } else |
500 | pathString += "iconsmini/"; | 496 | pathString += "iconsmini/"; |
501 | configureAgendaMenu->setCheckable( true ); | 497 | configureAgendaMenu->setCheckable( true ); |
502 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 498 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
503 | configureAgendaMenu->insertSeparator(); | 499 | configureAgendaMenu->insertSeparator(); |
504 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 500 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
505 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 501 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
506 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 502 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
507 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 503 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
508 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 504 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
509 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 505 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
510 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 506 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
511 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 507 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
512 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 508 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
513 | 509 | ||
514 | icon = loadPixmap( pathString + "configure" ); | 510 | icon = loadPixmap( pathString + "configure" ); |
515 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 511 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
516 | action->addTo( actionMenu ); | 512 | action->addTo( actionMenu ); |
517 | connect( action, SIGNAL( activated() ), | 513 | connect( action, SIGNAL( activated() ), |
518 | mView, SLOT( edit_options() ) ); | 514 | mView, SLOT( edit_options() ) ); |
519 | actionMenu->insertSeparator(); | 515 | actionMenu->insertSeparator(); |
520 | icon = loadPixmap( pathString + "newevent" ); | 516 | icon = loadPixmap( pathString + "newevent" ); |
521 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 517 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
522 | configureToolBarMenu->insertSeparator(); | 518 | configureToolBarMenu->insertSeparator(); |
523 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 519 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
524 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 520 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
525 | ne_action->addTo( actionMenu ); | 521 | ne_action->addTo( actionMenu ); |
526 | connect( ne_action, SIGNAL( activated() ), | 522 | connect( ne_action, SIGNAL( activated() ), |
527 | mView, SLOT( newEvent() ) ); | 523 | mView, SLOT( newEvent() ) ); |
528 | icon = loadPixmap( pathString + "newtodo" ); | 524 | icon = loadPixmap( pathString + "newtodo" ); |
529 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 525 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
530 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 526 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
531 | nt_action->addTo( actionMenu ); | 527 | nt_action->addTo( actionMenu ); |
532 | connect( nt_action, SIGNAL( activated() ), | 528 | connect( nt_action, SIGNAL( activated() ), |
533 | mView, SLOT( newTodo() ) ); | 529 | mView, SLOT( newTodo() ) ); |
534 | icon = loadPixmap( pathString + "navi" ); | 530 | icon = loadPixmap( pathString + "navi" ); |
535 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 531 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
536 | action->addTo( viewMenu ); | 532 | action->addTo( viewMenu ); |
537 | connect( action, SIGNAL( activated() ), | 533 | connect( action, SIGNAL( activated() ), |
538 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 534 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
539 | icon = loadPixmap( pathString + "filter" ); | 535 | icon = loadPixmap( pathString + "filter" ); |
540 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 536 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
541 | action->addTo( viewMenu ); | 537 | action->addTo( viewMenu ); |
542 | connect( action, SIGNAL( activated() ), | 538 | connect( action, SIGNAL( activated() ), |
543 | mView, SLOT( toggleFilter() ) ); | 539 | mView, SLOT( toggleFilter() ) ); |
544 | 540 | ||
545 | 541 | ||
546 | viewMenu->insertSeparator(); | 542 | viewMenu->insertSeparator(); |
547 | icon = loadPixmap( pathString + "picker" ); | 543 | icon = loadPixmap( pathString + "picker" ); |
548 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 544 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
549 | action->addTo( viewMenu ); | 545 | action->addTo( viewMenu ); |
550 | connect( action, SIGNAL( activated() ), | 546 | connect( action, SIGNAL( activated() ), |
551 | mView, SLOT( showDatePicker() ) ); | 547 | mView, SLOT( showDatePicker() ) ); |
552 | action->addTo( iconToolBar ); | 548 | action->addTo( iconToolBar ); |
553 | viewMenu->insertSeparator(); | 549 | viewMenu->insertSeparator(); |
554 | icon = loadPixmap( pathString + "list" ); | 550 | icon = loadPixmap( pathString + "list" ); |
555 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 551 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
556 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 552 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
557 | showlist_action->addTo( viewMenu ); | 553 | showlist_action->addTo( viewMenu ); |
558 | connect( showlist_action, SIGNAL( activated() ), | 554 | connect( showlist_action, SIGNAL( activated() ), |
559 | mView->viewManager(), SLOT( showListView() ) ); | 555 | mView->viewManager(), SLOT( showListView() ) ); |
560 | 556 | ||
561 | 557 | ||
562 | icon = loadPixmap( pathString + "day" ); | 558 | icon = loadPixmap( pathString + "day" ); |
563 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 559 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
564 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 560 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
565 | day1_action->addTo( viewMenu ); | 561 | day1_action->addTo( viewMenu ); |
566 | // action->addTo( toolBar ); | 562 | // action->addTo( toolBar ); |
567 | connect( day1_action, SIGNAL( activated() ), | 563 | connect( day1_action, SIGNAL( activated() ), |
568 | mView->viewManager(), SLOT( showDayView() ) ); | 564 | mView->viewManager(), SLOT( showDayView() ) ); |
569 | 565 | ||
570 | icon = loadPixmap( pathString + "workweek" ); | 566 | icon = loadPixmap( pathString + "workweek" ); |
571 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 567 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
572 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 568 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
573 | day5_action->addTo( viewMenu ); | 569 | day5_action->addTo( viewMenu ); |
574 | connect( day5_action, SIGNAL( activated() ), | 570 | connect( day5_action, SIGNAL( activated() ), |
575 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 571 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
576 | 572 | ||
577 | icon = loadPixmap( pathString + "week" ); | 573 | icon = loadPixmap( pathString + "week" ); |
578 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 574 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
579 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 575 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
580 | day7_action->addTo( viewMenu ); | 576 | day7_action->addTo( viewMenu ); |
581 | connect( day7_action, SIGNAL( activated() ), | 577 | connect( day7_action, SIGNAL( activated() ), |
582 | mView->viewManager(), SLOT( showWeekView() ) ); | 578 | mView->viewManager(), SLOT( showWeekView() ) ); |
583 | 579 | ||
584 | icon = loadPixmap( pathString + "month" ); | 580 | icon = loadPixmap( pathString + "month" ); |
585 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 581 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
586 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 582 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
587 | month_action->addTo( viewMenu ); | 583 | month_action->addTo( viewMenu ); |
588 | connect( month_action, SIGNAL( activated() ), | 584 | connect( month_action, SIGNAL( activated() ), |
589 | mView->viewManager(), SLOT( showMonthView() ) ); | 585 | mView->viewManager(), SLOT( showMonthView() ) ); |
590 | 586 | ||
591 | icon = loadPixmap( pathString + "todo" ); | 587 | icon = loadPixmap( pathString + "todo" ); |
592 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 588 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
593 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 589 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
594 | todoview_action->addTo( viewMenu ); | 590 | todoview_action->addTo( viewMenu ); |
595 | connect( todoview_action, SIGNAL( activated() ), | 591 | connect( todoview_action, SIGNAL( activated() ), |
596 | mView->viewManager(), SLOT( showTodoView() ) ); | 592 | mView->viewManager(), SLOT( showTodoView() ) ); |
597 | 593 | ||
598 | icon = loadPixmap( pathString + "journal" ); | 594 | icon = loadPixmap( pathString + "journal" ); |
599 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 595 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
600 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 596 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
601 | viewjournal_action->addTo( viewMenu ); | 597 | viewjournal_action->addTo( viewMenu ); |
602 | connect( viewjournal_action, SIGNAL( activated() ), | 598 | connect( viewjournal_action, SIGNAL( activated() ), |
603 | mView->viewManager(), SLOT( showJournalView() ) ); | 599 | mView->viewManager(), SLOT( showJournalView() ) ); |
604 | 600 | ||
605 | icon = loadPixmap( pathString + "xdays" ); | 601 | icon = loadPixmap( pathString + "xdays" ); |
606 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 602 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
607 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 603 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
608 | xdays_action->addTo( viewMenu ); | 604 | xdays_action->addTo( viewMenu ); |
609 | connect( xdays_action, SIGNAL( activated() ), | 605 | connect( xdays_action, SIGNAL( activated() ), |
610 | mView->viewManager(), SLOT( showNextXView() ) ); | 606 | mView->viewManager(), SLOT( showNextXView() ) ); |
611 | 607 | ||
612 | icon = loadPixmap( pathString + "whatsnext" ); | 608 | icon = loadPixmap( pathString + "whatsnext" ); |
613 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 609 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
614 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 610 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
615 | whatsnext_action->addTo( viewMenu ); | 611 | whatsnext_action->addTo( viewMenu ); |
616 | connect( whatsnext_action, SIGNAL( activated() ), | 612 | connect( whatsnext_action, SIGNAL( activated() ), |
617 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 613 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
618 | 614 | ||
619 | #if 0 | 615 | #if 0 |
620 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 616 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
621 | action->addTo( viewMenu ); | 617 | action->addTo( viewMenu ); |
622 | connect( action, SIGNAL( activated() ), | 618 | connect( action, SIGNAL( activated() ), |
623 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 619 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
624 | #endif | 620 | #endif |
625 | 621 | ||
626 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 622 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
627 | this ); | 623 | this ); |
628 | mNewSubTodoAction->addTo( actionMenu ); | 624 | mNewSubTodoAction->addTo( actionMenu ); |
629 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 625 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
630 | mView, SLOT( newSubTodo() ) ); | 626 | mView, SLOT( newSubTodo() ) ); |
631 | 627 | ||
632 | actionMenu->insertSeparator(); | 628 | actionMenu->insertSeparator(); |
633 | 629 | ||
634 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 630 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
635 | mShowAction->addTo( actionMenu ); | 631 | mShowAction->addTo( actionMenu ); |
636 | connect( mShowAction, SIGNAL( activated() ), | 632 | connect( mShowAction, SIGNAL( activated() ), |
637 | mView, SLOT( showIncidence() ) ); | 633 | mView, SLOT( showIncidence() ) ); |
638 | 634 | ||
639 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 635 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
640 | mEditAction->addTo( actionMenu ); | 636 | mEditAction->addTo( actionMenu ); |
641 | connect( mEditAction, SIGNAL( activated() ), | 637 | connect( mEditAction, SIGNAL( activated() ), |
642 | mView, SLOT( editIncidence() ) ); | 638 | mView, SLOT( editIncidence() ) ); |
643 | 639 | ||
644 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 640 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
645 | mDeleteAction->addTo( actionMenu ); | 641 | mDeleteAction->addTo( actionMenu ); |
646 | connect( mDeleteAction, SIGNAL( activated() ), | 642 | connect( mDeleteAction, SIGNAL( activated() ), |
647 | mView, SLOT( deleteIncidence() ) ); | 643 | mView, SLOT( deleteIncidence() ) ); |
648 | 644 | ||
649 | 645 | ||
650 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 646 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
651 | mCloneAction->addTo( actionMenu ); | 647 | mCloneAction->addTo( actionMenu ); |
652 | connect( mCloneAction, SIGNAL( activated() ), | 648 | connect( mCloneAction, SIGNAL( activated() ), |
653 | mView, SLOT( cloneIncidence() ) ); | 649 | mView, SLOT( cloneIncidence() ) ); |
654 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 650 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
655 | mMoveAction->addTo( actionMenu ); | 651 | mMoveAction->addTo( actionMenu ); |
656 | connect( mMoveAction, SIGNAL( activated() ), | 652 | connect( mMoveAction, SIGNAL( activated() ), |
657 | mView, SLOT( moveIncidence() ) ); | 653 | mView, SLOT( moveIncidence() ) ); |
658 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 654 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
659 | mBeamAction->addTo( actionMenu ); | 655 | mBeamAction->addTo( actionMenu ); |
660 | connect( mBeamAction, SIGNAL( activated() ), | 656 | connect( mBeamAction, SIGNAL( activated() ), |
661 | mView, SLOT( beamIncidence() ) ); | 657 | mView, SLOT( beamIncidence() ) ); |
662 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 658 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
663 | mCancelAction->addTo( actionMenu ); | 659 | mCancelAction->addTo( actionMenu ); |
664 | connect( mCancelAction, SIGNAL( activated() ), | 660 | connect( mCancelAction, SIGNAL( activated() ), |
665 | mView, SLOT( toggleCancelIncidence() ) ); | 661 | mView, SLOT( toggleCancelIncidence() ) ); |
666 | 662 | ||
667 | actionMenu->insertSeparator(); | 663 | actionMenu->insertSeparator(); |
668 | 664 | ||
669 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 665 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
670 | this ); | 666 | this ); |
671 | action->addTo( actionMenu ); | 667 | action->addTo( actionMenu ); |
672 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 668 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
673 | 669 | ||
674 | icon = loadPixmap( pathString + "search" ); | 670 | icon = loadPixmap( pathString + "search" ); |
675 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 671 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
676 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 672 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
677 | search_action->addTo( actionMenu ); | 673 | search_action->addTo( actionMenu ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index ee7bd87..e3383ed 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,130 +1,128 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 9 | #include <qregexp.h> |
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | 14 | ||
15 | class QAction; | 15 | class QAction; |
16 | class CalendarView; | 16 | class CalendarView; |
17 | class KSyncProfile; | 17 | class KSyncProfile; |
18 | #ifdef DESKTOP_VERSION | 18 | #ifdef DESKTOP_VERSION |
19 | 19 | ||
20 | #define QPEToolBar QToolBar | 20 | #define QPEToolBar QToolBar |
21 | #define QPEMenuBar QMenuBar | 21 | #define QPEMenuBar QMenuBar |
22 | #endif | 22 | #endif |
23 | class QPEToolBar; | 23 | class QPEToolBar; |
24 | 24 | ||
25 | 25 | ||
26 | namespace KCal { | 26 | namespace KCal { |
27 | class CalendarLocal; | 27 | class CalendarLocal; |
28 | } | 28 | } |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | class MainWindow : public QMainWindow | 32 | class MainWindow : public QMainWindow |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 36 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
37 | ~MainWindow(); | 37 | ~MainWindow(); |
38 | public slots: | 38 | public slots: |
39 | virtual void showMaximized (); | 39 | virtual void showMaximized (); |
40 | void configureAgenda( int ); | 40 | void configureAgenda( int ); |
41 | void recieve( const QCString& msg, const QByteArray& data ); | 41 | void recieve( const QCString& msg, const QByteArray& data ); |
42 | static QString defaultFileName(); | 42 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 43 | static QString syncFileName(); |
44 | static QString resourcePath(); | 44 | static QString resourcePath(); |
45 | protected slots: | 45 | protected slots: |
46 | void setCaptionToDates(); | 46 | void setCaptionToDates(); |
47 | void about(); | 47 | void about(); |
48 | void licence(); | 48 | void licence(); |
49 | void faq(); | 49 | void faq(); |
50 | void usertrans(); | 50 | void usertrans(); |
51 | void features(); | 51 | void features(); |
52 | void synchowto(); | 52 | void synchowto(); |
53 | void whatsNew(); | 53 | void whatsNew(); |
54 | void keyBindings(); | 54 | void keyBindings(); |
55 | void aboutAutoSaving();; | 55 | void aboutAutoSaving();; |
56 | void aboutKnownBugs(); | 56 | void aboutKnownBugs(); |
57 | 57 | ||
58 | void processIncidenceSelection( Incidence * ); | 58 | void processIncidenceSelection( Incidence * ); |
59 | 59 | ||
60 | void importQtopia(); | 60 | void importQtopia(); |
61 | void importBday(); | 61 | void importBday(); |
62 | void importOL(); | 62 | void importOL(); |
63 | void importIcal(); | 63 | void importIcal(); |
64 | void importFile( QString, bool ); | 64 | void importFile( QString, bool ); |
65 | void quickImportIcal(); | 65 | void quickImportIcal(); |
66 | 66 | ||
67 | void slotModifiedChanged( bool ); | 67 | void slotModifiedChanged( bool ); |
68 | 68 | ||
69 | void save(); | 69 | void save(); |
70 | void configureToolBar( int ); | 70 | void configureToolBar( int ); |
71 | void printSel(); | 71 | void printSel(); |
72 | void printCal(); | 72 | void printCal(); |
73 | void saveCalendar(); | 73 | void saveCalendar(); |
74 | void loadCalendar(); | 74 | void loadCalendar(); |
75 | void exportVCalendar(); | 75 | void exportVCalendar(); |
76 | void fillFilterMenu(); | 76 | void fillFilterMenu(); |
77 | void selectFilter( int ); | 77 | void selectFilter( int ); |
78 | void exportToPhone( int ); | 78 | void exportToPhone( int ); |
79 | 79 | ||
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | void displayText( QString, QString); | 82 | void displayText( QString, QString); |
83 | void displayFile( QString, QString); | 83 | void displayFile( QString, QString); |
84 | 84 | ||
85 | void enableIncidenceActions( bool ); | 85 | void enableIncidenceActions( bool ); |
86 | 86 | ||
87 | private slots: | 87 | private slots: |
88 | QSocket* piSocket; | 88 | QSocket* piSocket; |
89 | QString piFileString; | 89 | QString piFileString; |
90 | QTime piTime; | 90 | QTime piTime; |
91 | void getFile( bool ); | 91 | void getFile( bool ); |
92 | void syncFileRequest(); | 92 | void syncFileRequest(); |
93 | private: | 93 | private: |
94 | KSyncManager* mSyncManager; | 94 | KSyncManager* mSyncManager; |
95 | //QTimer* mTimerCommandSocket; | ||
96 | KServerSocket * mServerSocket; | ||
97 | bool mClosed; | 95 | bool mClosed; |
98 | void saveOnClose(); | 96 | void saveOnClose(); |
99 | bool mFlagKeyPressed; | 97 | bool mFlagKeyPressed; |
100 | bool mBlockAtStartup; | 98 | bool mBlockAtStartup; |
101 | QPEToolBar *iconToolBar; | 99 | QPEToolBar *iconToolBar; |
102 | void initActions(); | 100 | void initActions(); |
103 | void setDefaultPreferences(); | 101 | void setDefaultPreferences(); |
104 | void keyPressEvent ( QKeyEvent * ) ; | 102 | void keyPressEvent ( QKeyEvent * ) ; |
105 | void keyReleaseEvent ( QKeyEvent * ) ; | 103 | void keyReleaseEvent ( QKeyEvent * ) ; |
106 | QPopupMenu *configureToolBarMenu; | 104 | QPopupMenu *configureToolBarMenu; |
107 | QPopupMenu *selectFilterMenu; | 105 | QPopupMenu *selectFilterMenu; |
108 | QPopupMenu *configureAgendaMenu, *syncMenu; | 106 | QPopupMenu *configureAgendaMenu, *syncMenu; |
109 | CalendarLocal *mCalendar; | 107 | CalendarLocal *mCalendar; |
110 | CalendarView *mView; | 108 | CalendarView *mView; |
111 | QAction *mNewSubTodoAction; | 109 | QAction *mNewSubTodoAction; |
112 | 110 | ||
113 | QAction *mShowAction; | 111 | QAction *mShowAction; |
114 | QAction *mEditAction; | 112 | QAction *mEditAction; |
115 | QAction *mDeleteAction; | 113 | QAction *mDeleteAction; |
116 | QAction *mCloneAction; | 114 | QAction *mCloneAction; |
117 | QAction *mMoveAction; | 115 | QAction *mMoveAction; |
118 | QAction *mBeamAction; | 116 | QAction *mBeamAction; |
119 | QAction *mCancelAction; | 117 | QAction *mCancelAction; |
120 | 118 | ||
121 | void closeEvent( QCloseEvent* ce ); | 119 | void closeEvent( QCloseEvent* ce ); |
122 | SimpleAlarmClient mAlarmClient; | 120 | SimpleAlarmClient mAlarmClient; |
123 | QTimer mSaveTimer; | 121 | QTimer mSaveTimer; |
124 | //bool mBlockSaveFlag; | 122 | //bool mBlockSaveFlag; |
125 | bool mCalendarModifiedFlag; | 123 | bool mCalendarModifiedFlag; |
126 | QPixmap loadPixmap( QString ); | 124 | QPixmap loadPixmap( QString ); |
127 | }; | 125 | }; |
128 | 126 | ||
129 | 127 | ||
130 | #endif | 128 | #endif |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index b71e18d..5081b26 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,140 +1,138 @@ | |||
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 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (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 <kstaticdeleter.h> | 35 | #include <kstaticdeleter.h> |
36 | 36 | ||
37 | #include <qregexp.h> | 37 | #include <qregexp.h> |
38 | #include "kpimglobalprefs.h" | 38 | #include "kpimglobalprefs.h" |
39 | 39 | ||
40 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 40 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
41 | static KStaticDeleter<KPimGlobalPrefs> staticDeleter; | 41 | static KStaticDeleter<KPimGlobalPrefs> staticDeleter; |
42 | 42 | ||
43 | 43 | ||
44 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 44 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
45 | : KPrefs("microkdeglobalrc") | 45 | : KPrefs("microkdeglobalrc") |
46 | { | 46 | { |
47 | 47 | ||
48 | KPrefs::setCurrentGroup("Locale"); | 48 | KPrefs::setCurrentGroup("Locale"); |
49 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 49 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
50 | addItemInt("PreferredTime",&mPreferredTime,0); | 50 | addItemInt("PreferredTime",&mPreferredTime,0); |
51 | addItemInt("PreferredDate",&mPreferredDate,0); | 51 | addItemInt("PreferredDate",&mPreferredDate,0); |
52 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 52 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
53 | //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | 53 | //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); |
54 | // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 54 | // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
55 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 55 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
56 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 56 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
57 | 57 | ||
58 | KPrefs::setCurrentGroup("Time & Date"); | 58 | KPrefs::setCurrentGroup("Time & Date"); |
59 | 59 | ||
60 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | 60 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); |
61 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 61 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
62 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 62 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
63 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 63 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
64 | 64 | ||
65 | |||
66 | |||
67 | |||
68 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 65 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
69 | 66 | ||
70 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 67 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
71 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 68 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
72 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 69 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
73 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 70 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
74 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 71 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
75 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 72 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
76 | 73 | ||
77 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); | 74 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
78 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 75 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
79 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 76 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
80 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 77 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
81 | 78 | ||
82 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 79 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
83 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 80 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
84 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 81 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
85 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 82 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
86 | 83 | ||
87 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 84 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
88 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 85 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
89 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 86 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
90 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 87 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
91 | 88 | ||
92 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 89 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
93 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 90 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
94 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 91 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
95 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 92 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
96 | 93 | ||
97 | addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); | 94 | addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); |
98 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 95 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
99 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 96 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
100 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 97 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
101 | 98 | ||
102 | |||
103 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 99 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
104 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 100 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
105 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 101 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
106 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 102 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |
107 | 103 | ||
108 | |||
109 | } | 104 | } |
110 | 105 | ||
106 | |||
111 | void KPimGlobalPrefs::setGlobalConfig() | 107 | void KPimGlobalPrefs::setGlobalConfig() |
112 | { | 108 | { |
113 | 109 | ||
114 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 110 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
115 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 111 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
116 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 112 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
117 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 113 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
118 | QString dummy = mUserDateFormatLong; | 114 | QString dummy = mUserDateFormatLong; |
119 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 115 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
120 | dummy = mUserDateFormatShort; | 116 | dummy = mUserDateFormatShort; |
121 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 117 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
122 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 118 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
123 | mDaylightsavingStart, | 119 | mDaylightsavingStart, |
124 | mDaylightsavingEnd ); | 120 | mDaylightsavingEnd ); |
125 | KGlobal::locale()->setTimezone( mTimeZoneId ); | 121 | KGlobal::locale()->setTimezone( mTimeZoneId ); |
126 | 122 | ||
127 | } | 123 | } |
128 | KPimGlobalPrefs::~KPimGlobalPrefs() | 124 | KPimGlobalPrefs::~KPimGlobalPrefs() |
129 | { | 125 | { |
126 | //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() "); | ||
127 | writeConfig(); | ||
130 | } | 128 | } |
131 | 129 | ||
132 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 130 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
133 | { | 131 | { |
134 | if ( !sInstance ) { | 132 | if ( !sInstance ) { |
135 | sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); | 133 | sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); |
136 | sInstance->readConfig(); | 134 | sInstance->readConfig(); |
137 | } | 135 | } |
138 | 136 | ||
139 | return sInstance; | 137 | return sInstance; |
140 | } | 138 | } |
diff --git a/microkde/kstaticdeleter.h b/microkde/kstaticdeleter.h index 190f3e4..dfd3929 100644 --- a/microkde/kstaticdeleter.h +++ b/microkde/kstaticdeleter.h | |||
@@ -1,35 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | * This file is part of the KDE Libraries | 2 | * This file is part of the KDE Libraries |
3 | * Copyright (C) 2000 Stephan Kulow <coolo@kde.org> | 3 | * Copyright (C) 2000 Stephan Kulow <coolo@kde.org> |
4 | * 2001 KDE Team | 4 | * 2001 KDE Team |
5 | * | 5 | * |
6 | * This library is free software; you can redistribute it and/or | 6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public | 7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. | 9 | * version 2 of the License, or (at your option) any later version. |
10 | * | 10 | * |
11 | * This library is distributed in the hope that it will be useful, | 11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. | 14 | * Library General Public License for more details. |
15 | * | 15 | * |
16 | * You should have received a copy of the GNU Library General Public License | 16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to | 17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | * Boston, MA 02111-1307, USA. | 19 | * Boston, MA 02111-1307, USA. |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef _KSTATIC_DELETER_H_ | 23 | #ifndef _KSTATIC_DELETER_H_ |
24 | #define _KSTATIC_DELETER_H_ | 24 | #define _KSTATIC_DELETER_H_ |
25 | 25 | ||
26 | template<class type> | 26 | template<class type> |
27 | class KStaticDeleter | 27 | class KStaticDeleter |
28 | { | 28 | { |
29 | public: | 29 | public: |
30 | KStaticDeleter() {}; | 30 | KStaticDeleter() {}; |
31 | type *setObject( type *obj, bool isArray = false) { return obj; } | 31 | type *setObject( type *obj, bool isArray = false) { _mobj = obj;return obj; } |
32 | virtual ~KStaticDeleter() {}; | 32 | virtual ~KStaticDeleter() {delete _mobj;}; |
33 | private: | ||
34 | type* _mobj; | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | #endif | 37 | #endif |