author | zautrix <zautrix> | 2004-10-07 22:37:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 22:37:40 (UTC) |
commit | 21ec296f7f2832920dac336bb9f9476c80d746f5 (patch) (unidiff) | |
tree | 69b2897665d70ad45da249b1cf374a01d3be6dc4 | |
parent | 4a01915314201cbe2461ce68cdf9c556c687d727 (diff) | |
download | kdepimpi-21ec296f7f2832920dac336bb9f9476c80d746f5.zip kdepimpi-21ec296f7f2832920dac336bb9f9476c80d746f5.tar.gz kdepimpi-21ec296f7f2832920dac336bb9f9476c80d746f5.tar.bz2 |
ab view fixes
-rw-r--r-- | kabc/addressbook.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 |
5 files changed, 12 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index ed5e9c2..dc3cda1 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -210,384 +210,385 @@ AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int) | |||
210 | } | 210 | } |
211 | 211 | ||
212 | bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) | 212 | bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) |
213 | { | 213 | { |
214 | return ( d->mIt == it.d->mIt ); | 214 | return ( d->mIt == it.d->mIt ); |
215 | } | 215 | } |
216 | 216 | ||
217 | bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) | 217 | bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) |
218 | { | 218 | { |
219 | return ( d->mIt != it.d->mIt ); | 219 | return ( d->mIt != it.d->mIt ); |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | AddressBook::AddressBook() | 223 | AddressBook::AddressBook() |
224 | { | 224 | { |
225 | init(0, "contact"); | 225 | init(0, "contact"); |
226 | } | 226 | } |
227 | 227 | ||
228 | AddressBook::AddressBook( const QString &config ) | 228 | AddressBook::AddressBook( const QString &config ) |
229 | { | 229 | { |
230 | init(config, "contact"); | 230 | init(config, "contact"); |
231 | } | 231 | } |
232 | 232 | ||
233 | AddressBook::AddressBook( const QString &config, const QString &family ) | 233 | AddressBook::AddressBook( const QString &config, const QString &family ) |
234 | { | 234 | { |
235 | init(config, family); | 235 | init(config, family); |
236 | 236 | ||
237 | } | 237 | } |
238 | 238 | ||
239 | // the default family is "contact" | 239 | // the default family is "contact" |
240 | void AddressBook::init(const QString &config, const QString &family ) | 240 | void AddressBook::init(const QString &config, const QString &family ) |
241 | { | 241 | { |
242 | blockLSEchange = false; | 242 | blockLSEchange = false; |
243 | d = new AddressBookData; | 243 | d = new AddressBookData; |
244 | QString fami = family; | 244 | QString fami = family; |
245 | if (config != 0) { | 245 | if (config != 0) { |
246 | if ( family == "syncContact" ) { | 246 | if ( family == "syncContact" ) { |
247 | qDebug("creating sync config "); | 247 | qDebug("creating sync config "); |
248 | fami = "contact"; | 248 | fami = "contact"; |
249 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); | 249 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); |
250 | con->setGroup( "General" ); | 250 | con->setGroup( "General" ); |
251 | con->writeEntry( "ResourceKeys", QString("sync") ); | 251 | con->writeEntry( "ResourceKeys", QString("sync") ); |
252 | con->writeEntry( "Standard", QString("sync") ); | 252 | con->writeEntry( "Standard", QString("sync") ); |
253 | con->setGroup( "Resource_sync" ); | 253 | con->setGroup( "Resource_sync" ); |
254 | con->writeEntry( "FileName", config ); | 254 | con->writeEntry( "FileName", config ); |
255 | con->writeEntry( "FileFormat", QString("vcard") ); | 255 | con->writeEntry( "FileFormat", QString("vcard") ); |
256 | con->writeEntry( "ResourceIdentifier", QString("sync") ); | 256 | con->writeEntry( "ResourceIdentifier", QString("sync") ); |
257 | con->writeEntry( "ResourceName", QString("sync_res") ); | 257 | con->writeEntry( "ResourceName", QString("sync_res") ); |
258 | if ( config.right(4) == ".xml" ) | 258 | if ( config.right(4) == ".xml" ) |
259 | con->writeEntry( "ResourceType", QString("qtopia") ); | 259 | con->writeEntry( "ResourceType", QString("qtopia") ); |
260 | else if ( config == "sharp" ) { | 260 | else if ( config == "sharp" ) { |
261 | con->writeEntry( "ResourceType", QString("sharp") ); | 261 | con->writeEntry( "ResourceType", QString("sharp") ); |
262 | } else { | 262 | } else { |
263 | con->writeEntry( "ResourceType", QString("file") ); | 263 | con->writeEntry( "ResourceType", QString("file") ); |
264 | } | 264 | } |
265 | //con->sync(); | 265 | //con->sync(); |
266 | d->mConfig = con; | 266 | d->mConfig = con; |
267 | } | 267 | } |
268 | else | 268 | else |
269 | d->mConfig = new KConfig( locateLocal("config", config) ); | 269 | d->mConfig = new KConfig( locateLocal("config", config) ); |
270 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); | 270 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); |
271 | } | 271 | } |
272 | else { | 272 | else { |
273 | d->mConfig = 0; | 273 | d->mConfig = 0; |
274 | // qDebug("AddressBook::init 1 config=0"); | 274 | // qDebug("AddressBook::init 1 config=0"); |
275 | } | 275 | } |
276 | 276 | ||
277 | //US d->mErrorHandler = 0; | 277 | //US d->mErrorHandler = 0; |
278 | d->mManager = new KRES::Manager<Resource>( fami, false ); | 278 | d->mManager = new KRES::Manager<Resource>( fami, false ); |
279 | d->mManager->readConfig( d->mConfig ); | 279 | d->mManager->readConfig( d->mConfig ); |
280 | if ( family == "syncContact" ) { | 280 | if ( family == "syncContact" ) { |
281 | KRES::Manager<Resource> *manager = d->mManager; | 281 | KRES::Manager<Resource> *manager = d->mManager; |
282 | KRES::Manager<Resource>::ActiveIterator it; | 282 | KRES::Manager<Resource>::ActiveIterator it; |
283 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 283 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
284 | (*it)->setAddressBook( this ); | 284 | (*it)->setAddressBook( this ); |
285 | if ( !(*it)->open() ) | 285 | if ( !(*it)->open() ) |
286 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); | 286 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); |
287 | } | 287 | } |
288 | Resource *res = standardResource(); | 288 | Resource *res = standardResource(); |
289 | if ( !res ) { | 289 | if ( !res ) { |
290 | qDebug("ERROR: no standard resource"); | 290 | qDebug("ERROR: no standard resource"); |
291 | res = manager->createResource( "file" ); | 291 | res = manager->createResource( "file" ); |
292 | if ( res ) | 292 | if ( res ) |
293 | { | 293 | { |
294 | addResource( res ); | 294 | addResource( res ); |
295 | } | 295 | } |
296 | else | 296 | else |
297 | qDebug(" No resource available!!!"); | 297 | qDebug(" No resource available!!!"); |
298 | } | 298 | } |
299 | setStandardResource( res ); | 299 | setStandardResource( res ); |
300 | manager->writeConfig(); | 300 | manager->writeConfig(); |
301 | } | 301 | } |
302 | addCustomField( i18n( "Department" ), KABC::Field::Organization, | 302 | addCustomField( i18n( "Department" ), KABC::Field::Organization, |
303 | "X-Department", "KADDRESSBOOK" ); | 303 | "X-Department", "KADDRESSBOOK" ); |
304 | addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 304 | addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
305 | "X-Profession", "KADDRESSBOOK" ); | 305 | "X-Profession", "KADDRESSBOOK" ); |
306 | addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 306 | addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
307 | "X-AssistantsName", "KADDRESSBOOK" ); | 307 | "X-AssistantsName", "KADDRESSBOOK" ); |
308 | addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 308 | addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
309 | "X-ManagersName", "KADDRESSBOOK" ); | 309 | "X-ManagersName", "KADDRESSBOOK" ); |
310 | addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 310 | addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
311 | "X-SpousesName", "KADDRESSBOOK" ); | 311 | "X-SpousesName", "KADDRESSBOOK" ); |
312 | addCustomField( i18n( "Office" ), KABC::Field::Personal, | 312 | addCustomField( i18n( "Office" ), KABC::Field::Personal, |
313 | "X-Office", "KADDRESSBOOK" ); | 313 | "X-Office", "KADDRESSBOOK" ); |
314 | addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 314 | addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
315 | "X-IMAddress", "KADDRESSBOOK" ); | 315 | "X-IMAddress", "KADDRESSBOOK" ); |
316 | addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 316 | addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
317 | "X-Anniversary", "KADDRESSBOOK" ); | 317 | "X-Anniversary", "KADDRESSBOOK" ); |
318 | 318 | ||
319 | //US added this field to become compatible with Opie/qtopia addressbook | 319 | //US added this field to become compatible with Opie/qtopia addressbook |
320 | // values can be "female" or "male" or "". An empty field represents undefined. | 320 | // values can be "female" or "male" or "". An empty field represents undefined. |
321 | addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 321 | addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
322 | "X-Gender", "KADDRESSBOOK" ); | 322 | "X-Gender", "KADDRESSBOOK" ); |
323 | addCustomField( i18n( "Children" ), KABC::Field::Personal, | 323 | addCustomField( i18n( "Children" ), KABC::Field::Personal, |
324 | "X-Children", "KADDRESSBOOK" ); | 324 | "X-Children", "KADDRESSBOOK" ); |
325 | addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 325 | addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
326 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 326 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
327 | addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, | 327 | addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, |
328 | "X-ExternalID", "KADDRESSBOOK" ); | 328 | "X-ExternalID", "KADDRESSBOOK" ); |
329 | } | 329 | } |
330 | 330 | ||
331 | AddressBook::~AddressBook() | 331 | AddressBook::~AddressBook() |
332 | { | 332 | { |
333 | delete d->mConfig; d->mConfig = 0; | 333 | delete d->mConfig; d->mConfig = 0; |
334 | delete d->mManager; d->mManager = 0; | 334 | delete d->mManager; d->mManager = 0; |
335 | //US delete d->mErrorHandler; d->mErrorHandler = 0; | 335 | //US delete d->mErrorHandler; d->mErrorHandler = 0; |
336 | delete d; d = 0; | 336 | delete d; d = 0; |
337 | } | 337 | } |
338 | 338 | ||
339 | bool AddressBook::load() | 339 | bool AddressBook::load() |
340 | { | 340 | { |
341 | 341 | ||
342 | 342 | ||
343 | clear(); | 343 | clear(); |
344 | 344 | ||
345 | KRES::Manager<Resource>::ActiveIterator it; | 345 | KRES::Manager<Resource>::ActiveIterator it; |
346 | bool ok = true; | 346 | bool ok = true; |
347 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 347 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
348 | if ( !(*it)->load() ) { | 348 | if ( !(*it)->load() ) { |
349 | error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); | 349 | error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); |
350 | ok = false; | 350 | ok = false; |
351 | } | 351 | } |
352 | 352 | ||
353 | // mark all addressees as unchanged | 353 | // mark all addressees as unchanged |
354 | Addressee::List::Iterator addrIt; | 354 | Addressee::List::Iterator addrIt; |
355 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { | 355 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { |
356 | (*addrIt).setChanged( false ); | 356 | (*addrIt).setChanged( false ); |
357 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); | 357 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); |
358 | if ( !id.isEmpty() ) { | 358 | if ( !id.isEmpty() ) { |
359 | //qDebug("setId aa %s ", id.latin1()); | 359 | //qDebug("setId aa %s ", id.latin1()); |
360 | (*addrIt).setIDStr(id ); | 360 | (*addrIt).setIDStr(id ); |
361 | } | 361 | } |
362 | } | 362 | } |
363 | blockLSEchange = true; | 363 | blockLSEchange = true; |
364 | return ok; | 364 | return ok; |
365 | } | 365 | } |
366 | 366 | ||
367 | bool AddressBook::save( Ticket *ticket ) | 367 | bool AddressBook::save( Ticket *ticket ) |
368 | { | 368 | { |
369 | kdDebug(5700) << "AddressBook::save()"<< endl; | 369 | kdDebug(5700) << "AddressBook::save()"<< endl; |
370 | 370 | ||
371 | if ( ticket->resource() ) { | 371 | if ( ticket->resource() ) { |
372 | deleteRemovedAddressees(); | 372 | deleteRemovedAddressees(); |
373 | return ticket->resource()->save( ticket ); | 373 | return ticket->resource()->save( ticket ); |
374 | } | 374 | } |
375 | 375 | ||
376 | return false; | 376 | return false; |
377 | } | 377 | } |
378 | void AddressBook::export2File( QString fileName ) | 378 | void AddressBook::export2File( QString fileName ) |
379 | { | 379 | { |
380 | 380 | ||
381 | QFile outFile( fileName ); | 381 | QFile outFile( fileName ); |
382 | if ( !outFile.open( IO_WriteOnly ) ) { | 382 | if ( !outFile.open( IO_WriteOnly ) ) { |
383 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 383 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
384 | KMessageBox::error( 0, text.arg( fileName ) ); | 384 | KMessageBox::error( 0, text.arg( fileName ) ); |
385 | return ; | 385 | return ; |
386 | } | 386 | } |
387 | QTextStream t( &outFile ); | 387 | QTextStream t( &outFile ); |
388 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 388 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
389 | Iterator it; | 389 | Iterator it; |
390 | KABC::VCardConverter::Version version; | 390 | KABC::VCardConverter::Version version; |
391 | version = KABC::VCardConverter::v3_0; | 391 | version = KABC::VCardConverter::v3_0; |
392 | for ( it = begin(); it != end(); ++it ) { | 392 | for ( it = begin(); it != end(); ++it ) { |
393 | if ( !(*it).IDStr().isEmpty() ) { | 393 | if ( !(*it).IDStr().isEmpty() ) { |
394 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 394 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); |
395 | } | 395 | } |
396 | KABC::VCardConverter converter; | 396 | KABC::VCardConverter converter; |
397 | QString vcard; | 397 | QString vcard; |
398 | //Resource *resource() const; | 398 | //Resource *resource() const; |
399 | converter.addresseeToVCard( *it, vcard, version ); | 399 | converter.addresseeToVCard( *it, vcard, version ); |
400 | t << vcard << "\r\n"; | 400 | t << vcard << "\r\n"; |
401 | } | 401 | } |
402 | t << "\r\n\r\n"; | ||
402 | outFile.close(); | 403 | outFile.close(); |
403 | } | 404 | } |
404 | void AddressBook::importFromFile( QString fileName ) | 405 | void AddressBook::importFromFile( QString fileName ) |
405 | { | 406 | { |
406 | 407 | ||
407 | KABC::Addressee::List list; | 408 | KABC::Addressee::List list; |
408 | QFile file( fileName ); | 409 | QFile file( fileName ); |
409 | 410 | ||
410 | file.open( IO_ReadOnly ); | 411 | file.open( IO_ReadOnly ); |
411 | QByteArray rawData = file.readAll(); | 412 | QByteArray rawData = file.readAll(); |
412 | file.close(); | 413 | file.close(); |
413 | 414 | ||
414 | QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 415 | QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
415 | KABC::VCardTool tool; | 416 | KABC::VCardTool tool; |
416 | list = tool.parseVCards( data ); | 417 | list = tool.parseVCards( data ); |
417 | KABC::Addressee::List::Iterator it; | 418 | KABC::Addressee::List::Iterator it; |
418 | for ( it = list.begin(); it != list.end(); ++it ) { | 419 | for ( it = list.begin(); it != list.end(); ++it ) { |
419 | (*it).setResource( 0 ); | 420 | (*it).setResource( 0 ); |
420 | insertAddressee( (*it), false, true ); | 421 | insertAddressee( (*it), false, true ); |
421 | } | 422 | } |
422 | 423 | ||
423 | } | 424 | } |
424 | 425 | ||
425 | bool AddressBook::saveAB() | 426 | bool AddressBook::saveAB() |
426 | { | 427 | { |
427 | bool ok = true; | 428 | bool ok = true; |
428 | 429 | ||
429 | deleteRemovedAddressees(); | 430 | deleteRemovedAddressees(); |
430 | Iterator ait; | 431 | Iterator ait; |
431 | for ( ait = begin(); ait != end(); ++ait ) { | 432 | for ( ait = begin(); ait != end(); ++ait ) { |
432 | if ( !(*ait).IDStr().isEmpty() ) { | 433 | if ( !(*ait).IDStr().isEmpty() ) { |
433 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); | 434 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); |
434 | } | 435 | } |
435 | } | 436 | } |
436 | KRES::Manager<Resource>::ActiveIterator it; | 437 | KRES::Manager<Resource>::ActiveIterator it; |
437 | KRES::Manager<Resource> *manager = d->mManager; | 438 | KRES::Manager<Resource> *manager = d->mManager; |
438 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 439 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
439 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 440 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
440 | Ticket *ticket = requestSaveTicket( *it ); | 441 | Ticket *ticket = requestSaveTicket( *it ); |
441 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 442 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
442 | if ( !ticket ) { | 443 | if ( !ticket ) { |
443 | error( i18n( "Unable to save to resource '%1'. It is locked." ) | 444 | error( i18n( "Unable to save to resource '%1'. It is locked." ) |
444 | .arg( (*it)->resourceName() ) ); | 445 | .arg( (*it)->resourceName() ) ); |
445 | return false; | 446 | return false; |
446 | } | 447 | } |
447 | 448 | ||
448 | //if ( !save( ticket ) ) | 449 | //if ( !save( ticket ) ) |
449 | if ( ticket->resource() ) { | 450 | if ( ticket->resource() ) { |
450 | if ( ! ticket->resource()->save( ticket ) ) | 451 | if ( ! ticket->resource()->save( ticket ) ) |
451 | ok = false; | 452 | ok = false; |
452 | } else | 453 | } else |
453 | ok = false; | 454 | ok = false; |
454 | 455 | ||
455 | } | 456 | } |
456 | } | 457 | } |
457 | return ok; | 458 | return ok; |
458 | } | 459 | } |
459 | 460 | ||
460 | AddressBook::Iterator AddressBook::begin() | 461 | AddressBook::Iterator AddressBook::begin() |
461 | { | 462 | { |
462 | Iterator it = Iterator(); | 463 | Iterator it = Iterator(); |
463 | it.d->mIt = d->mAddressees.begin(); | 464 | it.d->mIt = d->mAddressees.begin(); |
464 | return it; | 465 | return it; |
465 | } | 466 | } |
466 | 467 | ||
467 | AddressBook::ConstIterator AddressBook::begin() const | 468 | AddressBook::ConstIterator AddressBook::begin() const |
468 | { | 469 | { |
469 | ConstIterator it = ConstIterator(); | 470 | ConstIterator it = ConstIterator(); |
470 | it.d->mIt = d->mAddressees.begin(); | 471 | it.d->mIt = d->mAddressees.begin(); |
471 | return it; | 472 | return it; |
472 | } | 473 | } |
473 | 474 | ||
474 | AddressBook::Iterator AddressBook::end() | 475 | AddressBook::Iterator AddressBook::end() |
475 | { | 476 | { |
476 | Iterator it = Iterator(); | 477 | Iterator it = Iterator(); |
477 | it.d->mIt = d->mAddressees.end(); | 478 | it.d->mIt = d->mAddressees.end(); |
478 | return it; | 479 | return it; |
479 | } | 480 | } |
480 | 481 | ||
481 | AddressBook::ConstIterator AddressBook::end() const | 482 | AddressBook::ConstIterator AddressBook::end() const |
482 | { | 483 | { |
483 | ConstIterator it = ConstIterator(); | 484 | ConstIterator it = ConstIterator(); |
484 | it.d->mIt = d->mAddressees.end(); | 485 | it.d->mIt = d->mAddressees.end(); |
485 | return it; | 486 | return it; |
486 | } | 487 | } |
487 | 488 | ||
488 | void AddressBook::clear() | 489 | void AddressBook::clear() |
489 | { | 490 | { |
490 | d->mAddressees.clear(); | 491 | d->mAddressees.clear(); |
491 | } | 492 | } |
492 | 493 | ||
493 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 494 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
494 | { | 495 | { |
495 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 496 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
496 | 497 | ||
497 | if ( !resource ) | 498 | if ( !resource ) |
498 | { | 499 | { |
499 | qDebug("AddressBook::requestSaveTicket no resource" ); | 500 | qDebug("AddressBook::requestSaveTicket no resource" ); |
500 | resource = standardResource(); | 501 | resource = standardResource(); |
501 | } | 502 | } |
502 | 503 | ||
503 | KRES::Manager<Resource>::ActiveIterator it; | 504 | KRES::Manager<Resource>::ActiveIterator it; |
504 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 505 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
505 | if ( (*it) == resource ) { | 506 | if ( (*it) == resource ) { |
506 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 507 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
507 | return 0; | 508 | return 0; |
508 | else | 509 | else |
509 | return (*it)->requestSaveTicket(); | 510 | return (*it)->requestSaveTicket(); |
510 | } | 511 | } |
511 | } | 512 | } |
512 | 513 | ||
513 | return 0; | 514 | return 0; |
514 | } | 515 | } |
515 | 516 | ||
516 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) | 517 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) |
517 | { | 518 | { |
518 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { | 519 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { |
519 | //qDebug("block insert "); | 520 | //qDebug("block insert "); |
520 | return; | 521 | return; |
521 | } | 522 | } |
522 | //qDebug("inserting.... %s ",a.uid().latin1() ); | 523 | //qDebug("inserting.... %s ",a.uid().latin1() ); |
523 | bool found = false; | 524 | bool found = false; |
524 | Addressee::List::Iterator it; | 525 | Addressee::List::Iterator it; |
525 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 526 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
526 | if ( a.uid() == (*it).uid() ) { | 527 | if ( a.uid() == (*it).uid() ) { |
527 | 528 | ||
528 | bool changed = false; | 529 | bool changed = false; |
529 | Addressee addr = a; | 530 | Addressee addr = a; |
530 | if ( addr != (*it) ) | 531 | if ( addr != (*it) ) |
531 | changed = true; | 532 | changed = true; |
532 | 533 | ||
533 | if ( takeResource ) { | 534 | if ( takeResource ) { |
534 | Resource * res = (*it).resource(); | 535 | Resource * res = (*it).resource(); |
535 | (*it) = a; | 536 | (*it) = a; |
536 | (*it).setResource( res ); | 537 | (*it).setResource( res ); |
537 | } else { | 538 | } else { |
538 | (*it) = a; | 539 | (*it) = a; |
539 | if ( (*it).resource() == 0 ) | 540 | if ( (*it).resource() == 0 ) |
540 | (*it).setResource( standardResource() ); | 541 | (*it).setResource( standardResource() ); |
541 | } | 542 | } |
542 | if ( changed ) { | 543 | if ( changed ) { |
543 | if ( setRev ) { | 544 | if ( setRev ) { |
544 | 545 | ||
545 | // get rid of micro seconds | 546 | // get rid of micro seconds |
546 | QDateTime dt = QDateTime::currentDateTime(); | 547 | QDateTime dt = QDateTime::currentDateTime(); |
547 | QTime t = dt.time(); | 548 | QTime t = dt.time(); |
548 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 549 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
549 | (*it).setRevision( dt ); | 550 | (*it).setRevision( dt ); |
550 | } | 551 | } |
551 | (*it).setChanged( true ); | 552 | (*it).setChanged( true ); |
552 | } | 553 | } |
553 | 554 | ||
554 | found = true; | 555 | found = true; |
555 | } else { | 556 | } else { |
556 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 557 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
557 | QString name = (*it).uid().mid( 19 ); | 558 | QString name = (*it).uid().mid( 19 ); |
558 | Addressee b = a; | 559 | Addressee b = a; |
559 | QString id = b.getID( name ); | 560 | QString id = b.getID( name ); |
560 | if ( ! id.isEmpty() ) { | 561 | if ( ! id.isEmpty() ) { |
561 | QString des = (*it).note(); | 562 | QString des = (*it).note(); |
562 | int startN; | 563 | int startN; |
563 | if( (startN = des.find( id ) ) >= 0 ) { | 564 | if( (startN = des.find( id ) ) >= 0 ) { |
564 | int endN = des.find( ",", startN+1 ); | 565 | int endN = des.find( ",", startN+1 ); |
565 | des = des.left( startN ) + des.mid( endN+1 ); | 566 | des = des.left( startN ) + des.mid( endN+1 ); |
566 | (*it).setNote( des ); | 567 | (*it).setNote( des ); |
567 | } | 568 | } |
568 | } | 569 | } |
569 | } | 570 | } |
570 | } | 571 | } |
571 | } | 572 | } |
572 | if ( found ) | 573 | if ( found ) |
573 | return; | 574 | return; |
574 | d->mAddressees.append( a ); | 575 | d->mAddressees.append( a ); |
575 | Addressee& addr = d->mAddressees.last(); | 576 | Addressee& addr = d->mAddressees.last(); |
576 | if ( addr.resource() == 0 ) | 577 | if ( addr.resource() == 0 ) |
577 | addr.setResource( standardResource() ); | 578 | addr.setResource( standardResource() ); |
578 | 579 | ||
579 | addr.setChanged( true ); | 580 | addr.setChanged( true ); |
580 | } | 581 | } |
581 | 582 | ||
582 | void AddressBook::removeAddressee( const Addressee &a ) | 583 | void AddressBook::removeAddressee( const Addressee &a ) |
583 | { | 584 | { |
584 | Iterator it; | 585 | Iterator it; |
585 | Iterator it2; | 586 | Iterator it2; |
586 | bool found = false; | 587 | bool found = false; |
587 | for ( it = begin(); it != end(); ++it ) { | 588 | for ( it = begin(); it != end(); ++it ) { |
588 | if ( a.uid() == (*it).uid() ) { | 589 | if ( a.uid() == (*it).uid() ) { |
589 | found = true; | 590 | found = true; |
590 | it2 = it; | 591 | it2 = it; |
591 | } else { | 592 | } else { |
592 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 593 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
593 | QString name = (*it).uid().mid( 19 ); | 594 | QString name = (*it).uid().mid( 19 ); |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 8d0fca1..4babf67 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -142,305 +142,307 @@ void AddresseeCardView::startDrag() | |||
142 | // KAddressBookCardView | 142 | // KAddressBookCardView |
143 | 143 | ||
144 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | 144 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, |
145 | QWidget *parent, const char *name ) | 145 | QWidget *parent, const char *name ) |
146 | : KAddressBookView( ab, parent, name ) | 146 | : KAddressBookView( ab, parent, name ) |
147 | { | 147 | { |
148 | mShowEmptyFields = false; | 148 | mShowEmptyFields = false; |
149 | 149 | ||
150 | // Init the GUI | 150 | // Init the GUI |
151 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 151 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
152 | 152 | ||
153 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 153 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
154 | mCardView->setSelectionMode(CardView::Extended); | 154 | mCardView->setSelectionMode(CardView::Extended); |
155 | layout->addWidget(mCardView); | 155 | layout->addWidget(mCardView); |
156 | 156 | ||
157 | // Connect up the signals | 157 | // Connect up the signals |
158 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 158 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
159 | this, SLOT(addresseeExecuted(CardViewItem *))); | 159 | this, SLOT(addresseeExecuted(CardViewItem *))); |
160 | connect(mCardView, SIGNAL(selectionChanged()), | 160 | connect(mCardView, SIGNAL(selectionChanged()), |
161 | this, SLOT(addresseeSelected())); | 161 | this, SLOT(addresseeSelected())); |
162 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 162 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
163 | this, SIGNAL(dropped(QDropEvent*))); | 163 | this, SIGNAL(dropped(QDropEvent*))); |
164 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 164 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
165 | this, SIGNAL(startDrag())); | 165 | this, SIGNAL(startDrag())); |
166 | } | 166 | } |
167 | 167 | ||
168 | KAddressBookCardView::~KAddressBookCardView() | 168 | KAddressBookCardView::~KAddressBookCardView() |
169 | { | 169 | { |
170 | } | 170 | } |
171 | 171 | ||
172 | void KAddressBookCardView::readConfig(KConfig *config) | 172 | void KAddressBookCardView::readConfig(KConfig *config) |
173 | { | 173 | { |
174 | KAddressBookView::readConfig(config); | 174 | KAddressBookView::readConfig(config); |
175 | 175 | ||
176 | // costum colors? | 176 | // costum colors? |
177 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 177 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
178 | { | 178 | { |
179 | QPalette p( mCardView->palette() ); | 179 | QPalette p( mCardView->palette() ); |
180 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 180 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
181 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 181 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
182 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 182 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
183 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 183 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
184 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 184 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
185 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 185 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
186 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 186 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
187 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 187 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
188 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 188 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
189 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 189 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
190 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 190 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
191 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 191 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
192 | mCardView->viewport()->setPalette( p ); | 192 | mCardView->viewport()->setPalette( p ); |
193 | } | 193 | } |
194 | else | 194 | else |
195 | { | 195 | { |
196 | // needed if turned off during a session. | 196 | // needed if turned off during a session. |
197 | mCardView->viewport()->setPalette( mCardView->palette() ); | 197 | mCardView->viewport()->setPalette( mCardView->palette() ); |
198 | } | 198 | } |
199 | 199 | ||
200 | //custom fonts? | 200 | //custom fonts? |
201 | QFont f( font() ); | 201 | QFont f( font() ); |
202 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 202 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
203 | { | 203 | { |
204 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); | 204 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); |
205 | f.setBold( true ); | 205 | f.setBold( true ); |
206 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 206 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
210 | mCardView->setFont( f ); | 210 | mCardView->setFont( f ); |
211 | f.setBold( true ); | 211 | f.setBold( true ); |
212 | mCardView->setHeaderFont( f ); | 212 | mCardView->setHeaderFont( f ); |
213 | } | 213 | } |
214 | 214 | ||
215 | mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); | 215 | mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); |
216 | mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", | 216 | mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", |
217 | true)); | 217 | true)); |
218 | mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); | 218 | mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); |
219 | mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); | 219 | mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); |
220 | 220 | ||
221 | mCardView->setShowEmptyFields( mShowEmptyFields ); | 221 | mCardView->setShowEmptyFields( mShowEmptyFields ); |
222 | 222 | ||
223 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); | 223 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); |
224 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); | 224 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); |
225 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); | 225 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); |
226 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); | 226 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); |
227 | 227 | ||
228 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), | 228 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), |
229 | this, SLOT(addresseeExecuted(CardViewItem *))); | 229 | this, SLOT(addresseeExecuted(CardViewItem *))); |
230 | 230 | ||
231 | if (KABPrefs::instance()->mHonorSingleClick) | 231 | if (KABPrefs::instance()->mHonorSingleClick) |
232 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 232 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
233 | this, SLOT(addresseeExecuted(CardViewItem *))); | 233 | this, SLOT(addresseeExecuted(CardViewItem *))); |
234 | else | 234 | else |
235 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 235 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
236 | this, SLOT(addresseeExecuted(CardViewItem *))); | 236 | this, SLOT(addresseeExecuted(CardViewItem *))); |
237 | 237 | ||
238 | } | 238 | } |
239 | 239 | ||
240 | void KAddressBookCardView::writeConfig( KConfig *config ) | 240 | void KAddressBookCardView::writeConfig( KConfig *config ) |
241 | { | 241 | { |
242 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); | 242 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); |
243 | KAddressBookView::writeConfig( config ); | 243 | KAddressBookView::writeConfig( config ); |
244 | } | 244 | } |
245 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | 245 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) |
246 | { | 246 | { |
247 | mCardView->clear(); | 247 | mCardView->clear(); |
248 | if ( s.isEmpty() || s == "*" ) { | 248 | if ( s.isEmpty() || s == "*" ) { |
249 | refresh(); | 249 | refresh(); |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | QString pattern = s.lower()+"*"; | 252 | QString pattern = s.lower()+"*"; |
253 | QRegExp re; | 253 | QRegExp re; |
254 | re.setWildcard(true); // most people understand these better. | 254 | re.setWildcard(true); // most people understand these better. |
255 | re.setCaseSensitive(false); | 255 | re.setCaseSensitive(false); |
256 | re.setPattern( pattern ); | 256 | re.setPattern( pattern ); |
257 | if (!re.isValid()) | 257 | if (!re.isValid()) |
258 | return; | 258 | return; |
259 | mCardView->viewport()->setUpdatesEnabled( false ); | 259 | mCardView->viewport()->setUpdatesEnabled( false ); |
260 | KABC::Addressee::List addresseeList = addressees(); | 260 | KABC::Addressee::List addresseeList = addressees(); |
261 | KABC::Addressee::List::Iterator it; | 261 | KABC::Addressee::List::Iterator it; |
262 | if ( field ) { | 262 | if ( field ) { |
263 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 263 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
264 | #if QT_VERSION >= 300 | 264 | #if QT_VERSION >= 300 |
265 | if (re.search(field->value( *it ).lower()) != -1) | 265 | if (re.search(field->value( *it ).lower()) != -1) |
266 | #else | 266 | #else |
267 | if (re.match(field->value( *it ).lower()) != -1) | 267 | if (re.match(field->value( *it ).lower()) != -1) |
268 | #endif | 268 | #endif |
269 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 269 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
270 | addressBook(), *it, mCardView); | 270 | addressBook(), *it, mCardView); |
271 | 271 | ||
272 | } | 272 | } |
273 | } else { | 273 | } else { |
274 | KABC::Field::List fieldList = fields(); | 274 | KABC::Field::List fieldList = fields(); |
275 | KABC::Field::List::ConstIterator fieldIt; | 275 | KABC::Field::List::ConstIterator fieldIt; |
276 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 276 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
277 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 277 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
278 | #if QT_VERSION >= 300 | 278 | #if QT_VERSION >= 300 |
279 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 279 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
280 | #else | 280 | #else |
281 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 281 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
282 | #endif | 282 | #endif |
283 | { | 283 | { |
284 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 284 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
285 | addressBook(), *it, mCardView); | 285 | addressBook(), *it, mCardView); |
286 | continue; | 286 | continue; |
287 | } | 287 | } |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | mCardView->viewport()->setUpdatesEnabled( true ); | 291 | mCardView->viewport()->setUpdatesEnabled( true ); |
292 | mCardView->viewport()->update(); | 292 | mCardView->viewport()->update(); |
293 | // by default nothing is selected | 293 | // by default nothing is selected |
294 | emit selected(QString::null); | 294 | emit selected(QString::null); |
295 | } | 295 | } |
296 | QStringList KAddressBookCardView::selectedUids() | 296 | QStringList KAddressBookCardView::selectedUids() |
297 | { | 297 | { |
298 | QStringList uidList; | 298 | QStringList uidList; |
299 | CardViewItem *item; | 299 | CardViewItem *item; |
300 | AddresseeCardViewItem *aItem; | 300 | AddresseeCardViewItem *aItem; |
301 | 301 | ||
302 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 302 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
303 | { | 303 | { |
304 | if (item->isSelected()) | 304 | if (item->isSelected()) |
305 | { | 305 | { |
306 | #ifndef KAB_EMBEDDED | 306 | #ifndef KAB_EMBEDDED |
307 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 307 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
308 | #else //KAB_EMBEDDED | 308 | #else //KAB_EMBEDDED |
309 | aItem = (AddresseeCardViewItem*)(item); | 309 | aItem = (AddresseeCardViewItem*)(item); |
310 | #endif //KAB_EMBEDDED | 310 | #endif //KAB_EMBEDDED |
311 | if (aItem) | 311 | if (aItem) |
312 | uidList << aItem->addressee().uid(); | 312 | uidList << aItem->addressee().uid(); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | return uidList; | 316 | return uidList; |
317 | } | 317 | } |
318 | 318 | ||
319 | void KAddressBookCardView::refresh(QString uid) | 319 | void KAddressBookCardView::refresh(QString uid) |
320 | { | 320 | { |
321 | CardViewItem *item; | 321 | CardViewItem *item; |
322 | AddresseeCardViewItem *aItem; | 322 | AddresseeCardViewItem *aItem; |
323 | 323 | ||
324 | if (uid.isNull()) | 324 | if (uid.isNull()) |
325 | { | 325 | { |
326 | // Rebuild the view | 326 | // Rebuild the view |
327 | mCardView->viewport()->setUpdatesEnabled( false ); | 327 | mCardView->viewport()->setUpdatesEnabled( false ); |
328 | mCardView->clear(); | 328 | mCardView->clear(); |
329 | 329 | ||
330 | KABC::Addressee::List addresseeList = addressees(); | 330 | KABC::Addressee::List addresseeList = addressees(); |
331 | KABC::Addressee::List::Iterator iter; | 331 | KABC::Addressee::List::Iterator iter; |
332 | for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) | 332 | for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) |
333 | { | 333 | { |
334 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) | ||
335 | continue; | ||
334 | aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, | 336 | aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, |
335 | addressBook(), *iter, mCardView); | 337 | addressBook(), *iter, mCardView); |
336 | } | 338 | } |
337 | mCardView->viewport()->setUpdatesEnabled( true ); | 339 | mCardView->viewport()->setUpdatesEnabled( true ); |
338 | mCardView->viewport()->update(); | 340 | mCardView->viewport()->update(); |
339 | 341 | ||
340 | // by default nothing is selected | 342 | // by default nothing is selected |
341 | emit selected(QString::null); | 343 | emit selected(QString::null); |
342 | } | 344 | } |
343 | else | 345 | else |
344 | { | 346 | { |
345 | // Try to find the one to refresh | 347 | // Try to find the one to refresh |
346 | bool found = false; | 348 | bool found = false; |
347 | for (item = mCardView->firstItem(); item && !found; | 349 | for (item = mCardView->firstItem(); item && !found; |
348 | item = item->nextItem()) | 350 | item = item->nextItem()) |
349 | { | 351 | { |
350 | #ifndef KAB_EMBEDDED | 352 | #ifndef KAB_EMBEDDED |
351 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 353 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
352 | #else //KAB_EMBEDDED | 354 | #else //KAB_EMBEDDED |
353 | aItem = (AddresseeCardViewItem*)(item); | 355 | aItem = (AddresseeCardViewItem*)(item); |
354 | #endif //KAB_EMBEDDED | 356 | #endif //KAB_EMBEDDED |
355 | 357 | ||
356 | if ((aItem) && (aItem->addressee().uid() == uid)) | 358 | if ((aItem) && (aItem->addressee().uid() == uid)) |
357 | { | 359 | { |
358 | aItem->refresh(); | 360 | aItem->refresh(); |
359 | found = true; | 361 | found = true; |
360 | } | 362 | } |
361 | } | 363 | } |
362 | } | 364 | } |
363 | } | 365 | } |
364 | 366 | ||
365 | void KAddressBookCardView::setSelected(QString uid, bool selected) | 367 | void KAddressBookCardView::setSelected(QString uid, bool selected) |
366 | { | 368 | { |
367 | CardViewItem *item; | 369 | CardViewItem *item; |
368 | AddresseeCardViewItem *aItem; | 370 | AddresseeCardViewItem *aItem; |
369 | 371 | ||
370 | if (uid.isNull()) | 372 | if (uid.isNull()) |
371 | { | 373 | { |
372 | mCardView->selectAll(selected); | 374 | mCardView->selectAll(selected); |
373 | } | 375 | } |
374 | else | 376 | else |
375 | { | 377 | { |
376 | bool found = false; | 378 | bool found = false; |
377 | for (item = mCardView->firstItem(); item && !found; | 379 | for (item = mCardView->firstItem(); item && !found; |
378 | item = item->nextItem()) | 380 | item = item->nextItem()) |
379 | { | 381 | { |
380 | #ifndef KAB_EMBEDDED | 382 | #ifndef KAB_EMBEDDED |
381 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 383 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
382 | #else //KAB_EMBEDDED | 384 | #else //KAB_EMBEDDED |
383 | aItem = (AddresseeCardViewItem*)(item); | 385 | aItem = (AddresseeCardViewItem*)(item); |
384 | #endif //KAB_EMBEDDED | 386 | #endif //KAB_EMBEDDED |
385 | 387 | ||
386 | if ((aItem) && (aItem->addressee().uid() == uid)) | 388 | if ((aItem) && (aItem->addressee().uid() == uid)) |
387 | { | 389 | { |
388 | mCardView->setSelected(aItem, selected); | 390 | mCardView->setSelected(aItem, selected); |
389 | mCardView->ensureItemVisible(item); | 391 | mCardView->ensureItemVisible(item); |
390 | found = true; | 392 | found = true; |
391 | } | 393 | } |
392 | } | 394 | } |
393 | } | 395 | } |
394 | } | 396 | } |
395 | 397 | ||
396 | //US added an additional method without parameter | 398 | //US added an additional method without parameter |
397 | void KAddressBookCardView::setSelected() | 399 | void KAddressBookCardView::setSelected() |
398 | { | 400 | { |
399 | setSelected(QString::null, true); | 401 | setSelected(QString::null, true); |
400 | } | 402 | } |
401 | 403 | ||
402 | void KAddressBookCardView::addresseeExecuted(CardViewItem *item) | 404 | void KAddressBookCardView::addresseeExecuted(CardViewItem *item) |
403 | { | 405 | { |
404 | #ifndef KAB_EMBEDDED | 406 | #ifndef KAB_EMBEDDED |
405 | AddresseeCardViewItem *aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 407 | AddresseeCardViewItem *aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
406 | #else //KAB_EMBEDDED | 408 | #else //KAB_EMBEDDED |
407 | AddresseeCardViewItem *aItem = (AddresseeCardViewItem*)(item); | 409 | AddresseeCardViewItem *aItem = (AddresseeCardViewItem*)(item); |
408 | #endif //KAB_EMBEDDED | 410 | #endif //KAB_EMBEDDED |
409 | if (aItem) | 411 | if (aItem) |
410 | { | 412 | { |
411 | //kdDebug()<<"... even has a valid item:)"<<endl; | 413 | //kdDebug()<<"... even has a valid item:)"<<endl; |
412 | emit executed(aItem->addressee().uid()); | 414 | emit executed(aItem->addressee().uid()); |
413 | } | 415 | } |
414 | } | 416 | } |
415 | 417 | ||
416 | void KAddressBookCardView::addresseeSelected() | 418 | void KAddressBookCardView::addresseeSelected() |
417 | { | 419 | { |
418 | CardViewItem *item; | 420 | CardViewItem *item; |
419 | AddresseeCardViewItem *aItem; | 421 | AddresseeCardViewItem *aItem; |
420 | 422 | ||
421 | bool found = false; | 423 | bool found = false; |
422 | for (item = mCardView->firstItem(); item && !found; | 424 | for (item = mCardView->firstItem(); item && !found; |
423 | item = item->nextItem()) | 425 | item = item->nextItem()) |
424 | { | 426 | { |
425 | if (item->isSelected()) | 427 | if (item->isSelected()) |
426 | { | 428 | { |
427 | #ifndef KAB_EMBEDDED | 429 | #ifndef KAB_EMBEDDED |
428 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 430 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
429 | #else //KAB_EMBEDDED | 431 | #else //KAB_EMBEDDED |
430 | aItem = (AddresseeCardViewItem*)(item); | 432 | aItem = (AddresseeCardViewItem*)(item); |
431 | #endif //KAB_EMBEDDED | 433 | #endif //KAB_EMBEDDED |
432 | if ( aItem ) | 434 | if ( aItem ) |
433 | { | 435 | { |
434 | emit selected(aItem->addressee().uid()); | 436 | emit selected(aItem->addressee().uid()); |
435 | found = true; | 437 | found = true; |
436 | } | 438 | } |
437 | } | 439 | } |
438 | } | 440 | } |
439 | 441 | ||
440 | if (!found) | 442 | if (!found) |
441 | emit selected(QString::null); | 443 | emit selected(QString::null); |
442 | 444 | ||
443 | } | 445 | } |
444 | #ifndef KAB_EMBEDDED | 446 | #ifndef KAB_EMBEDDED |
445 | #include "kaddressbookcardview.moc" | 447 | #include "kaddressbookcardview.moc" |
446 | #endif //KAB_EMBEDDED | 448 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index 0ffc674..fdc0db9 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -127,300 +127,303 @@ class AddresseeIconViewItem : public QIconViewItem | |||
127 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 127 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
128 | #else //KAB_EMBEDDED | 128 | #else //KAB_EMBEDDED |
129 | AddresseeIconViewItem(const KABC::Field::List &fields, | 129 | AddresseeIconViewItem(const KABC::Field::List &fields, |
130 | KABC::AddressBook *doc, const KABC::Addressee &a, | 130 | KABC::AddressBook *doc, const KABC::Addressee &a, |
131 | QIconView *parent) | 131 | QIconView *parent) |
132 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 132 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
133 | #endif //KAB_EMBEDDED | 133 | #endif //KAB_EMBEDDED |
134 | { | 134 | { |
135 | if ( mFields.isEmpty() ) { | 135 | if ( mFields.isEmpty() ) { |
136 | mFields = KABC::Field::defaultFields(); | 136 | mFields = KABC::Field::defaultFields(); |
137 | } | 137 | } |
138 | refresh(); | 138 | refresh(); |
139 | } | 139 | } |
140 | 140 | ||
141 | const KABC::Addressee &addressee() const { return mAddressee; } | 141 | const KABC::Addressee &addressee() const { return mAddressee; } |
142 | 142 | ||
143 | void refresh() | 143 | void refresh() |
144 | { | 144 | { |
145 | // Update our addressee, since it may have changed elsewhere | 145 | // Update our addressee, since it may have changed elsewhere |
146 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 146 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
147 | 147 | ||
148 | if (!mAddressee.isEmpty()) | 148 | if (!mAddressee.isEmpty()) |
149 | setText( mAddressee.givenName() + " " + mAddressee.familyName() ); | 149 | setText( mAddressee.givenName() + " " + mAddressee.familyName() ); |
150 | 150 | ||
151 | QPixmap icon; | 151 | QPixmap icon; |
152 | QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); | 152 | QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); |
153 | KABC::Picture pic = mAddressee.photo(); | 153 | KABC::Picture pic = mAddressee.photo(); |
154 | if ( pic.data().isNull() ) | 154 | if ( pic.data().isNull() ) |
155 | pic = mAddressee.logo(); | 155 | pic = mAddressee.logo(); |
156 | 156 | ||
157 | if ( pic.isIntern() && !pic.data().isNull() ) { | 157 | if ( pic.isIntern() && !pic.data().isNull() ) { |
158 | QImage img = pic.data(); | 158 | QImage img = pic.data(); |
159 | #ifndef KAB_EMBEDDED | 159 | #ifndef KAB_EMBEDDED |
160 | if ( img.width() > img.height() ) | 160 | if ( img.width() > img.height() ) |
161 | icon = img.scaleWidth( 32 ); | 161 | icon = img.scaleWidth( 32 ); |
162 | else | 162 | else |
163 | icon = img.scaleHeight( 32 ); | 163 | icon = img.scaleHeight( 32 ); |
164 | #else //KAB_EMBEDDED | 164 | #else //KAB_EMBEDDED |
165 | qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); | 165 | qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); |
166 | icon.convertFromImage(img.smoothScale(32, 32)); | 166 | icon.convertFromImage(img.smoothScale(32, 32)); |
167 | #endif //KAB_EMBEDDED | 167 | #endif //KAB_EMBEDDED |
168 | 168 | ||
169 | } else | 169 | } else |
170 | icon = defaultIcon; | 170 | icon = defaultIcon; |
171 | 171 | ||
172 | setPixmap( icon ); | 172 | setPixmap( icon ); |
173 | } | 173 | } |
174 | 174 | ||
175 | private: | 175 | private: |
176 | KABC::Field::List mFields; | 176 | KABC::Field::List mFields; |
177 | KABC::AddressBook *mDocument; | 177 | KABC::AddressBook *mDocument; |
178 | KABC::Addressee mAddressee; | 178 | KABC::Addressee mAddressee; |
179 | }; | 179 | }; |
180 | 180 | ||
181 | /////////////////////////////// | 181 | /////////////////////////////// |
182 | // KAddressBookView | 182 | // KAddressBookView |
183 | 183 | ||
184 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | 184 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, |
185 | QWidget *parent, const char *name) | 185 | QWidget *parent, const char *name) |
186 | : KAddressBookView( ab, parent, name ) | 186 | : KAddressBookView( ab, parent, name ) |
187 | { | 187 | { |
188 | // Init the GUI | 188 | // Init the GUI |
189 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 189 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
190 | 190 | ||
191 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); | 191 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); |
192 | layout->addWidget(mIconView); | 192 | layout->addWidget(mIconView); |
193 | 193 | ||
194 | // Connect up the signals | 194 | // Connect up the signals |
195 | 195 | ||
196 | //US method executed is part of KIconView | 196 | //US method executed is part of KIconView |
197 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 197 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
198 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 198 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
199 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 199 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
200 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 200 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
201 | 201 | ||
202 | connect(mIconView, SIGNAL(selectionChanged()), | 202 | connect(mIconView, SIGNAL(selectionChanged()), |
203 | this, SLOT(addresseeSelected())); | 203 | this, SLOT(addresseeSelected())); |
204 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 204 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
205 | this, SIGNAL(dropped(QDropEvent*))); | 205 | this, SIGNAL(dropped(QDropEvent*))); |
206 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 206 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
207 | this, SIGNAL(startDrag())); | 207 | this, SIGNAL(startDrag())); |
208 | } | 208 | } |
209 | 209 | ||
210 | KAddressBookIconView::~KAddressBookIconView() | 210 | KAddressBookIconView::~KAddressBookIconView() |
211 | { | 211 | { |
212 | } | 212 | } |
213 | 213 | ||
214 | void KAddressBookIconView::readConfig(KConfig *config) | 214 | void KAddressBookIconView::readConfig(KConfig *config) |
215 | { | 215 | { |
216 | KAddressBookView::readConfig(config); | 216 | KAddressBookView::readConfig(config); |
217 | 217 | ||
218 | //US method executed is part of KIconView | 218 | //US method executed is part of KIconView |
219 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 219 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
220 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 220 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
221 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 221 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
222 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 222 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
223 | 223 | ||
224 | //US method executed is part of KIconView. Use selectionChanged instead | 224 | //US method executed is part of KIconView. Use selectionChanged instead |
225 | /*US | 225 | /*US |
226 | if (KABPrefs::instance()->mHonorSingleClick) | 226 | if (KABPrefs::instance()->mHonorSingleClick) |
227 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 227 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
228 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 228 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
229 | else | 229 | else |
230 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 230 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
231 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 231 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
232 | */ | 232 | */ |
233 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 233 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
234 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 234 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
235 | 235 | ||
236 | } | 236 | } |
237 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 237 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
238 | { | 238 | { |
239 | mIconView->clear(); | 239 | mIconView->clear(); |
240 | mIconList.clear(); | 240 | mIconList.clear(); |
241 | if ( s.isEmpty() || s == "*" ) { | 241 | if ( s.isEmpty() || s == "*" ) { |
242 | refresh(); | 242 | refresh(); |
243 | return; | 243 | return; |
244 | } | 244 | } |
245 | QString pattern = s.lower()+"*"; | 245 | QString pattern = s.lower()+"*"; |
246 | QRegExp re; | 246 | QRegExp re; |
247 | re.setWildcard(true); // most people understand these better. | 247 | re.setWildcard(true); // most people understand these better. |
248 | re.setCaseSensitive(false); | 248 | re.setCaseSensitive(false); |
249 | re.setPattern( pattern ); | 249 | re.setPattern( pattern ); |
250 | if (!re.isValid()) | 250 | if (!re.isValid()) |
251 | return; | 251 | return; |
252 | KABC::Addressee::List addresseeList = addressees(); | 252 | KABC::Addressee::List addresseeList = addressees(); |
253 | KABC::Addressee::List::Iterator it; | 253 | KABC::Addressee::List::Iterator it; |
254 | if ( field ) { | 254 | if ( field ) { |
255 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 255 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
256 | #if QT_VERSION >= 300 | 256 | #if QT_VERSION >= 300 |
257 | if (re.search(field->value( *it ).lower()) != -1) | 257 | if (re.search(field->value( *it ).lower()) != -1) |
258 | #else | 258 | #else |
259 | if (re.match(field->value( *it ).lower()) != -1) | 259 | if (re.match(field->value( *it ).lower()) != -1) |
260 | #endif | 260 | #endif |
261 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 261 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
262 | 262 | ||
263 | 263 | ||
264 | } | 264 | } |
265 | } else { | 265 | } else { |
266 | KABC::Field::List fieldList = fields(); | 266 | KABC::Field::List fieldList = fields(); |
267 | KABC::Field::List::ConstIterator fieldIt; | 267 | KABC::Field::List::ConstIterator fieldIt; |
268 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 268 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
269 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 269 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
270 | #if QT_VERSION >= 300 | 270 | #if QT_VERSION >= 300 |
271 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 271 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
272 | #else | 272 | #else |
273 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 273 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
274 | #endif | 274 | #endif |
275 | { | 275 | { |
276 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 276 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
277 | continue; | 277 | continue; |
278 | } | 278 | } |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | mIconView->arrangeItemsInGrid( true ); | 282 | mIconView->arrangeItemsInGrid( true ); |
283 | } | 283 | } |
284 | QStringList KAddressBookIconView::selectedUids() | 284 | QStringList KAddressBookIconView::selectedUids() |
285 | { | 285 | { |
286 | QStringList uidList; | 286 | QStringList uidList; |
287 | QIconViewItem *item; | 287 | QIconViewItem *item; |
288 | AddresseeIconViewItem *aItem; | 288 | AddresseeIconViewItem *aItem; |
289 | 289 | ||
290 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 290 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
291 | { | 291 | { |
292 | if (item->isSelected()) | 292 | if (item->isSelected()) |
293 | { | 293 | { |
294 | #ifndef KAB_EMBEDDED | 294 | #ifndef KAB_EMBEDDED |
295 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 295 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
296 | #else //KAB_EMBEDDED | 296 | #else //KAB_EMBEDDED |
297 | aItem = (AddresseeIconViewItem*)(item); | 297 | aItem = (AddresseeIconViewItem*)(item); |
298 | #endif //KAB_EMBEDDED | 298 | #endif //KAB_EMBEDDED |
299 | if (aItem) | 299 | if (aItem) |
300 | uidList << aItem->addressee().uid(); | 300 | uidList << aItem->addressee().uid(); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | return uidList; | 304 | return uidList; |
305 | } | 305 | } |
306 | 306 | ||
307 | void KAddressBookIconView::refresh(QString uid) | 307 | void KAddressBookIconView::refresh(QString uid) |
308 | { | 308 | { |
309 | QIconViewItem *item; | 309 | QIconViewItem *item; |
310 | AddresseeIconViewItem *aItem; | 310 | AddresseeIconViewItem *aItem; |
311 | 311 | ||
312 | if ( uid.isNull() ) { | 312 | if ( uid.isNull() ) { |
313 | // Rebuild the view | 313 | // Rebuild the view |
314 | mIconView->clear(); | 314 | mIconView->clear(); |
315 | mIconList.clear(); | 315 | mIconList.clear(); |
316 | 316 | ||
317 | KABC::Addressee::List addresseeList = addressees(); | 317 | KABC::Addressee::List addresseeList = addressees(); |
318 | KABC::Addressee::List::Iterator iter; | 318 | KABC::Addressee::List::Iterator iter; |
319 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) | 319 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { |
320 | aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); | 320 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) |
321 | continue; | ||
322 | aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); | ||
323 | } | ||
321 | 324 | ||
322 | mIconView->arrangeItemsInGrid( true ); | 325 | mIconView->arrangeItemsInGrid( true ); |
323 | 326 | ||
324 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) | 327 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) |
325 | { | 328 | { |
326 | #ifndef KAB_EMBEDDED | 329 | #ifndef KAB_EMBEDDED |
327 | AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); | 330 | AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); |
328 | #else //KAB_EMBEDDED | 331 | #else //KAB_EMBEDDED |
329 | AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); | 332 | AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); |
330 | #endif //KAB_EMBEDDED | 333 | #endif //KAB_EMBEDDED |
331 | mIconList.append( aivi ); | 334 | mIconList.append( aivi ); |
332 | } | 335 | } |
333 | 336 | ||
334 | } else { | 337 | } else { |
335 | // Try to find the one to refresh | 338 | // Try to find the one to refresh |
336 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { | 339 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { |
337 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
338 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 341 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
339 | #else //KAB_EMBEDDED | 342 | #else //KAB_EMBEDDED |
340 | aItem = (AddresseeIconViewItem*)(item); | 343 | aItem = (AddresseeIconViewItem*)(item); |
341 | #endif //KAB_EMBEDDED | 344 | #endif //KAB_EMBEDDED |
342 | if ((aItem) && (aItem->addressee().uid() == uid)) { | 345 | if ((aItem) && (aItem->addressee().uid() == uid)) { |
343 | aItem->refresh(); | 346 | aItem->refresh(); |
344 | mIconView->arrangeItemsInGrid( true ); | 347 | mIconView->arrangeItemsInGrid( true ); |
345 | return; | 348 | return; |
346 | } | 349 | } |
347 | } | 350 | } |
348 | refresh( QString::null ); | 351 | refresh( QString::null ); |
349 | } | 352 | } |
350 | } | 353 | } |
351 | 354 | ||
352 | void KAddressBookIconView::setSelected(QString uid, bool selected) | 355 | void KAddressBookIconView::setSelected(QString uid, bool selected) |
353 | { | 356 | { |
354 | QIconViewItem *item; | 357 | QIconViewItem *item; |
355 | AddresseeIconViewItem *aItem; | 358 | AddresseeIconViewItem *aItem; |
356 | 359 | ||
357 | if (uid.isNull()) | 360 | if (uid.isNull()) |
358 | { | 361 | { |
359 | mIconView->selectAll(selected); | 362 | mIconView->selectAll(selected); |
360 | } | 363 | } |
361 | else | 364 | else |
362 | { | 365 | { |
363 | bool found = false; | 366 | bool found = false; |
364 | for (item = mIconView->firstItem(); item && !found; | 367 | for (item = mIconView->firstItem(); item && !found; |
365 | item = item->nextItem()) | 368 | item = item->nextItem()) |
366 | { | 369 | { |
367 | #ifndef KAB_EMBEDDED | 370 | #ifndef KAB_EMBEDDED |
368 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 371 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
369 | #else //KAB_EMBEDDED | 372 | #else //KAB_EMBEDDED |
370 | aItem = (AddresseeIconViewItem*)(item); | 373 | aItem = (AddresseeIconViewItem*)(item); |
371 | #endif //KAB_EMBEDDED | 374 | #endif //KAB_EMBEDDED |
372 | 375 | ||
373 | if ((aItem) && (aItem->addressee().uid() == uid)) | 376 | if ((aItem) && (aItem->addressee().uid() == uid)) |
374 | { | 377 | { |
375 | mIconView->setSelected(aItem, selected); | 378 | mIconView->setSelected(aItem, selected); |
376 | mIconView->ensureItemVisible( aItem ); | 379 | mIconView->ensureItemVisible( aItem ); |
377 | found = true; | 380 | found = true; |
378 | } | 381 | } |
379 | } | 382 | } |
380 | } | 383 | } |
381 | } | 384 | } |
382 | 385 | ||
383 | void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) | 386 | void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) |
384 | { | 387 | { |
385 | #ifndef KAB_EMBEDDED | 388 | #ifndef KAB_EMBEDDED |
386 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 389 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
387 | #else //KAB_EMBEDDED | 390 | #else //KAB_EMBEDDED |
388 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); | 391 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); |
389 | #endif //KAB_EMBEDDED | 392 | #endif //KAB_EMBEDDED |
390 | 393 | ||
391 | if (aItem) { | 394 | if (aItem) { |
392 | emit executed(aItem->addressee().uid()); | 395 | emit executed(aItem->addressee().uid()); |
393 | } | 396 | } |
394 | } | 397 | } |
395 | 398 | ||
396 | void KAddressBookIconView::addresseeSelected() | 399 | void KAddressBookIconView::addresseeSelected() |
397 | { | 400 | { |
398 | QIconViewItem *item; | 401 | QIconViewItem *item; |
399 | AddresseeIconViewItem *aItem; | 402 | AddresseeIconViewItem *aItem; |
400 | 403 | ||
401 | bool found = false; | 404 | bool found = false; |
402 | for (item = mIconView->firstItem(); item && !found; | 405 | for (item = mIconView->firstItem(); item && !found; |
403 | item = item->nextItem()) | 406 | item = item->nextItem()) |
404 | { | 407 | { |
405 | if (item->isSelected()) | 408 | if (item->isSelected()) |
406 | { | 409 | { |
407 | #ifndef KAB_EMBEDDED | 410 | #ifndef KAB_EMBEDDED |
408 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 411 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
409 | #else //KAB_EMBEDDED | 412 | #else //KAB_EMBEDDED |
410 | aItem = (AddresseeIconViewItem*)(item); | 413 | aItem = (AddresseeIconViewItem*)(item); |
411 | #endif //KAB_EMBEDDED | 414 | #endif //KAB_EMBEDDED |
412 | if (aItem) | 415 | if (aItem) |
413 | { | 416 | { |
414 | emit selected(aItem->addressee().uid()); | 417 | emit selected(aItem->addressee().uid()); |
415 | found = true; | 418 | found = true; |
416 | } | 419 | } |
417 | } | 420 | } |
418 | } | 421 | } |
419 | 422 | ||
420 | if (!found) | 423 | if (!found) |
421 | emit selected(QString::null); | 424 | emit selected(QString::null); |
422 | } | 425 | } |
423 | 426 | ||
424 | #ifndef KAB_EMBEDDED | 427 | #ifndef KAB_EMBEDDED |
425 | #include "kaddressbookiconview.moc" | 428 | #include "kaddressbookiconview.moc" |
426 | #endif //KAB_EMBEDDED | 429 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 1dc9198..fbfddba 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -88,356 +88,358 @@ void KAddressBookTableView::reconstructListView() | |||
88 | 88 | ||
89 | connect(mListView, SIGNAL(selectionChanged()), | 89 | connect(mListView, SIGNAL(selectionChanged()), |
90 | this, SLOT(addresseeSelected())); | 90 | this, SLOT(addresseeSelected())); |
91 | connect(mListView, SIGNAL(startAddresseeDrag()), this, | 91 | connect(mListView, SIGNAL(startAddresseeDrag()), this, |
92 | SIGNAL(startDrag())); | 92 | SIGNAL(startDrag())); |
93 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 93 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
94 | SIGNAL(dropped(QDropEvent*))); | 94 | SIGNAL(dropped(QDropEvent*))); |
95 | 95 | ||
96 | if (KABPrefs::instance()->mHonorSingleClick) | 96 | if (KABPrefs::instance()->mHonorSingleClick) |
97 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 97 | connect(mListView, SIGNAL(executed(QListViewItem*)), |
98 | this, SLOT(addresseeExecuted(QListViewItem*))); | 98 | this, SLOT(addresseeExecuted(QListViewItem*))); |
99 | else | 99 | else |
100 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 100 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
101 | this, SLOT(addresseeExecuted(QListViewItem*))); | 101 | this, SLOT(addresseeExecuted(QListViewItem*))); |
102 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 102 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
103 | this, SLOT(addresseeExecuted(QListViewItem*))); | 103 | this, SLOT(addresseeExecuted(QListViewItem*))); |
104 | connect(mListView, SIGNAL(signalDelete()), | 104 | connect(mListView, SIGNAL(signalDelete()), |
105 | this, SLOT(addresseeDeleted())); | 105 | this, SLOT(addresseeDeleted())); |
106 | 106 | ||
107 | //US performceimprovement. Refresh is done from the outside | 107 | //US performceimprovement. Refresh is done from the outside |
108 | //US refresh(); | 108 | //US refresh(); |
109 | 109 | ||
110 | mListView->setSorting( 0, true ); | 110 | mListView->setSorting( 0, true ); |
111 | mainLayout->addWidget( mListView ); | 111 | mainLayout->addWidget( mListView ); |
112 | mainLayout->activate(); | 112 | mainLayout->activate(); |
113 | mListView->show(); | 113 | mListView->show(); |
114 | } | 114 | } |
115 | 115 | ||
116 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 116 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
117 | { | 117 | { |
118 | mListView->clear(); | 118 | mListView->clear(); |
119 | if ( s.isEmpty() || s == "*" ) { | 119 | if ( s.isEmpty() || s == "*" ) { |
120 | refresh(); | 120 | refresh(); |
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | QString pattern = s.lower()+"*"; | 123 | QString pattern = s.lower()+"*"; |
124 | QRegExp re; | 124 | QRegExp re; |
125 | re.setWildcard(true); // most people understand these better. | 125 | re.setWildcard(true); // most people understand these better. |
126 | re.setCaseSensitive(false); | 126 | re.setCaseSensitive(false); |
127 | re.setPattern( pattern ); | 127 | re.setPattern( pattern ); |
128 | if (!re.isValid()) | 128 | if (!re.isValid()) |
129 | return; | 129 | return; |
130 | KABC::Addressee::List addresseeList = addressees(); | 130 | KABC::Addressee::List addresseeList = addressees(); |
131 | KABC::Addressee::List::Iterator it; | 131 | KABC::Addressee::List::Iterator it; |
132 | if ( field ) { | 132 | if ( field ) { |
133 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 133 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
134 | #if QT_VERSION >= 300 | 134 | #if QT_VERSION >= 300 |
135 | if (re.search(field->value( *it ).lower()) != -1) | 135 | if (re.search(field->value( *it ).lower()) != -1) |
136 | #else | 136 | #else |
137 | if (re.match(field->value( *it ).lower()) != -1) | 137 | if (re.match(field->value( *it ).lower()) != -1) |
138 | #endif | 138 | #endif |
139 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 139 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
140 | 140 | ||
141 | } | 141 | } |
142 | } else { | 142 | } else { |
143 | KABC::Field::List fieldList = fields(); | 143 | KABC::Field::List fieldList = fields(); |
144 | KABC::Field::List::ConstIterator fieldIt; | 144 | KABC::Field::List::ConstIterator fieldIt; |
145 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 145 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
146 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 146 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
147 | #if QT_VERSION >= 300 | 147 | #if QT_VERSION >= 300 |
148 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 148 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
149 | #else | 149 | #else |
150 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 150 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
151 | #endif | 151 | #endif |
152 | { | 152 | { |
153 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 153 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
154 | break; | 154 | break; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | } | 158 | } |
159 | // Sometimes the background pixmap gets messed up when we add lots | 159 | // Sometimes the background pixmap gets messed up when we add lots |
160 | // of items. | 160 | // of items. |
161 | mListView->repaint(); | 161 | mListView->repaint(); |
162 | emit selected(QString::null); | 162 | emit selected(QString::null); |
163 | 163 | ||
164 | } | 164 | } |
165 | void KAddressBookTableView::writeConfig(KConfig *config) | 165 | void KAddressBookTableView::writeConfig(KConfig *config) |
166 | { | 166 | { |
167 | KAddressBookView::writeConfig(config); | 167 | KAddressBookView::writeConfig(config); |
168 | 168 | ||
169 | mListView->saveLayout(config, config->group()); | 169 | mListView->saveLayout(config, config->group()); |
170 | } | 170 | } |
171 | 171 | ||
172 | void KAddressBookTableView::readConfig(KConfig *config) | 172 | void KAddressBookTableView::readConfig(KConfig *config) |
173 | { | 173 | { |
174 | KAddressBookView::readConfig( config ); | 174 | KAddressBookView::readConfig( config ); |
175 | // The config could have changed the fields, so we need to reconstruct | 175 | // The config could have changed the fields, so we need to reconstruct |
176 | // the listview. | 176 | // the listview. |
177 | reconstructListView(); | 177 | reconstructListView(); |
178 | 178 | ||
179 | // costum colors? | 179 | // costum colors? |
180 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 180 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
181 | { | 181 | { |
182 | QPalette p( mListView->palette() ); | 182 | QPalette p( mListView->palette() ); |
183 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 183 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
184 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 184 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
185 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 185 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
186 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 186 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
187 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 187 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
188 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 188 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
189 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 189 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
190 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 190 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
191 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 191 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
192 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 192 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
193 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 193 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
194 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 194 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
195 | #ifndef KAB_EMBEDDED | 195 | #ifndef KAB_EMBEDDED |
196 | c = KGlobalSettings::alternateBackgroundColor(); | 196 | c = KGlobalSettings::alternateBackgroundColor(); |
197 | #else //KAB_EMBEDDED | 197 | #else //KAB_EMBEDDED |
198 | c = QColor(240, 240, 240); | 198 | c = QColor(240, 240, 240); |
199 | #endif //KAB_EMBEDDED | 199 | #endif //KAB_EMBEDDED |
200 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); | 200 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); |
201 | mListView->setAlternateColor(c); | 201 | mListView->setAlternateColor(c); |
202 | 202 | ||
203 | 203 | ||
204 | //US mListView->viewport()->setPalette( p ); | 204 | //US mListView->viewport()->setPalette( p ); |
205 | mListView->setPalette( p ); | 205 | mListView->setPalette( p ); |
206 | } | 206 | } |
207 | else | 207 | else |
208 | { | 208 | { |
209 | // needed if turned off during a session. | 209 | // needed if turned off during a session. |
210 | //US mListView->viewport()->setPalette( mListView->palette() ); | 210 | //US mListView->viewport()->setPalette( mListView->palette() ); |
211 | mListView->setPalette( mListView->palette() ); | 211 | mListView->setPalette( mListView->palette() ); |
212 | } | 212 | } |
213 | 213 | ||
214 | //custom fonts? | 214 | //custom fonts? |
215 | QFont f( font() ); | 215 | QFont f( font() ); |
216 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 216 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
217 | { | 217 | { |
218 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); | 218 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); |
219 | f.setBold( true ); | 219 | f.setBold( true ); |
220 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 220 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
221 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); | 221 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); |
222 | } | 222 | } |
223 | else | 223 | else |
224 | { | 224 | { |
225 | mListView->setFont( f ); | 225 | mListView->setFont( f ); |
226 | f.setBold( true ); | 226 | f.setBold( true ); |
227 | //US mListView->setHeaderFont( f ); | 227 | //US mListView->setHeaderFont( f ); |
228 | mListView->header()->setFont( f ); | 228 | mListView->header()->setFont( f ); |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
232 | 232 | ||
233 | 233 | ||
234 | 234 | ||
235 | // Set the list view options | 235 | // Set the list view options |
236 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", | 236 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |
237 | true)); | 237 | true)); |
238 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); | 238 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); |
239 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); | 239 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); |
240 | 240 | ||
241 | if (config->readBoolEntry("Background", false)) | 241 | if (config->readBoolEntry("Background", false)) |
242 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); | 242 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); |
243 | 243 | ||
244 | // Restore the layout of the listview | 244 | // Restore the layout of the listview |
245 | mListView->restoreLayout(config, config->group()); | 245 | mListView->restoreLayout(config, config->group()); |
246 | } | 246 | } |
247 | 247 | ||
248 | void KAddressBookTableView::refresh(QString uid) | 248 | void KAddressBookTableView::refresh(QString uid) |
249 | { | 249 | { |
250 | // For now just repopulate. In reality this method should | 250 | // For now just repopulate. In reality this method should |
251 | // check the value of uid, and if valid iterate through | 251 | // check the value of uid, and if valid iterate through |
252 | // the listview to find the entry, then tell it to refresh. | 252 | // the listview to find the entry, then tell it to refresh. |
253 | 253 | ||
254 | if (uid.isNull()) { | 254 | if (uid.isNull()) { |
255 | // Clear the list view | 255 | // Clear the list view |
256 | QString currentUID, nextUID; | 256 | QString currentUID, nextUID; |
257 | #ifndef KAB_EMBEDDED | 257 | #ifndef KAB_EMBEDDED |
258 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 258 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |
259 | #else //KAB_EMBEDDED | 259 | #else //KAB_EMBEDDED |
260 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); | 260 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); |
261 | #endif //KAB_EMBEDDED | 261 | #endif //KAB_EMBEDDED |
262 | 262 | ||
263 | if ( currentItem ) { | 263 | if ( currentItem ) { |
264 | #ifndef KAB_EMBEDDED | 264 | #ifndef KAB_EMBEDDED |
265 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); | 265 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); |
266 | #else //KAB_EMBEDDED | 266 | #else //KAB_EMBEDDED |
267 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); | 267 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); |
268 | #endif //KAB_EMBEDDED | 268 | #endif //KAB_EMBEDDED |
269 | if ( nextItem ) | 269 | if ( nextItem ) |
270 | nextUID = nextItem->addressee().uid(); | 270 | nextUID = nextItem->addressee().uid(); |
271 | currentUID = currentItem->addressee().uid(); | 271 | currentUID = currentItem->addressee().uid(); |
272 | } | 272 | } |
273 | 273 | ||
274 | mListView->clear(); | 274 | mListView->clear(); |
275 | 275 | ||
276 | currentItem = 0; | 276 | currentItem = 0; |
277 | KABC::Addressee::List addresseeList = addressees(); | 277 | KABC::Addressee::List addresseeList = addressees(); |
278 | KABC::Addressee::List::Iterator it; | 278 | KABC::Addressee::List::Iterator it; |
279 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 279 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
280 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | ||
281 | continue; | ||
280 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 282 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
281 | if ( (*it).uid() == currentUID ) | 283 | if ( (*it).uid() == currentUID ) |
282 | currentItem = item; | 284 | currentItem = item; |
283 | else if ( (*it).uid() == nextUID && !currentItem ) | 285 | else if ( (*it).uid() == nextUID && !currentItem ) |
284 | currentItem = item; | 286 | currentItem = item; |
285 | } | 287 | } |
286 | 288 | ||
287 | // Sometimes the background pixmap gets messed up when we add lots | 289 | // Sometimes the background pixmap gets messed up when we add lots |
288 | // of items. | 290 | // of items. |
289 | mListView->repaint(); | 291 | mListView->repaint(); |
290 | 292 | ||
291 | if ( currentItem ) { | 293 | if ( currentItem ) { |
292 | mListView->setCurrentItem( currentItem ); | 294 | mListView->setCurrentItem( currentItem ); |
293 | mListView->ensureItemVisible( currentItem ); | 295 | mListView->ensureItemVisible( currentItem ); |
294 | } | 296 | } |
295 | } else { | 297 | } else { |
296 | // Only need to update on entry. Iterate through and try to find it | 298 | // Only need to update on entry. Iterate through and try to find it |
297 | ContactListViewItem *ceItem; | 299 | ContactListViewItem *ceItem; |
298 | QListViewItemIterator it( mListView ); | 300 | QListViewItemIterator it( mListView ); |
299 | while ( it.current() ) { | 301 | while ( it.current() ) { |
300 | #ifndef KAB_EMBEDDED | 302 | #ifndef KAB_EMBEDDED |
301 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 303 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
302 | #else //KAB_EMBEDDED | 304 | #else //KAB_EMBEDDED |
303 | ceItem = (ContactListViewItem*)( it.current() ); | 305 | ceItem = (ContactListViewItem*)( it.current() ); |
304 | #endif //KAB_EMBEDDED | 306 | #endif //KAB_EMBEDDED |
305 | 307 | ||
306 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 308 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
307 | ceItem->refresh(); | 309 | ceItem->refresh(); |
308 | return; | 310 | return; |
309 | } | 311 | } |
310 | ++it; | 312 | ++it; |
311 | } | 313 | } |
312 | 314 | ||
313 | refresh( QString::null ); | 315 | refresh( QString::null ); |
314 | } | 316 | } |
315 | } | 317 | } |
316 | 318 | ||
317 | QStringList KAddressBookTableView::selectedUids() | 319 | QStringList KAddressBookTableView::selectedUids() |
318 | { | 320 | { |
319 | QStringList uidList; | 321 | QStringList uidList; |
320 | QListViewItem *item; | 322 | QListViewItem *item; |
321 | ContactListViewItem *ceItem; | 323 | ContactListViewItem *ceItem; |
322 | 324 | ||
323 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 325 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
324 | { | 326 | { |
325 | if (mListView->isSelected( item )) | 327 | if (mListView->isSelected( item )) |
326 | { | 328 | { |
327 | #ifndef KAB_EMBEDDED | 329 | #ifndef KAB_EMBEDDED |
328 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 330 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
329 | #else //KAB_EMBEDDED | 331 | #else //KAB_EMBEDDED |
330 | ceItem = (ContactListViewItem*)(item); | 332 | ceItem = (ContactListViewItem*)(item); |
331 | #endif //KAB_EMBEDDED | 333 | #endif //KAB_EMBEDDED |
332 | 334 | ||
333 | if (ceItem != 0L) | 335 | if (ceItem != 0L) |
334 | uidList << ceItem->addressee().uid(); | 336 | uidList << ceItem->addressee().uid(); |
335 | } | 337 | } |
336 | } | 338 | } |
337 | if ( uidList.count() == 0 ) | 339 | if ( uidList.count() == 0 ) |
338 | if ( mListView->currentItem() ) { | 340 | if ( mListView->currentItem() ) { |
339 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; | 341 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; |
340 | uidList << ceItem->addressee().uid(); | 342 | uidList << ceItem->addressee().uid(); |
341 | } | 343 | } |
342 | 344 | ||
343 | return uidList; | 345 | return uidList; |
344 | } | 346 | } |
345 | 347 | ||
346 | void KAddressBookTableView::setSelected(QString uid, bool selected) | 348 | void KAddressBookTableView::setSelected(QString uid, bool selected) |
347 | { | 349 | { |
348 | QListViewItem *item; | 350 | QListViewItem *item; |
349 | ContactListViewItem *ceItem; | 351 | ContactListViewItem *ceItem; |
350 | 352 | ||
351 | if (uid.isNull()) | 353 | if (uid.isNull()) |
352 | { | 354 | { |
353 | mListView->selectAll(selected); | 355 | mListView->selectAll(selected); |
354 | } | 356 | } |
355 | else | 357 | else |
356 | { | 358 | { |
357 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 359 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
358 | { | 360 | { |
359 | #ifndef KAB_EMBEDDED | 361 | #ifndef KAB_EMBEDDED |
360 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 362 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
361 | #else //KAB_EMBEDDED | 363 | #else //KAB_EMBEDDED |
362 | ceItem = (ContactListViewItem*)(item); | 364 | ceItem = (ContactListViewItem*)(item); |
363 | #endif //KAB_EMBEDDED | 365 | #endif //KAB_EMBEDDED |
364 | 366 | ||
365 | 367 | ||
366 | if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) | 368 | if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) |
367 | { | 369 | { |
368 | mListView->setSelected(item, selected); | 370 | mListView->setSelected(item, selected); |
369 | 371 | ||
370 | if (selected) | 372 | if (selected) |
371 | mListView->ensureItemVisible(item); | 373 | mListView->ensureItemVisible(item); |
372 | } | 374 | } |
373 | } | 375 | } |
374 | } | 376 | } |
375 | } | 377 | } |
376 | 378 | ||
377 | void KAddressBookTableView::addresseeSelected() | 379 | void KAddressBookTableView::addresseeSelected() |
378 | { | 380 | { |
379 | // We need to try to find the first selected item. This might not be the | 381 | // We need to try to find the first selected item. This might not be the |
380 | // last selected item, but when QListView is in multiselection mode, | 382 | // last selected item, but when QListView is in multiselection mode, |
381 | // there is no way to figure out which one was | 383 | // there is no way to figure out which one was |
382 | // selected last. | 384 | // selected last. |
383 | QListViewItem *item; | 385 | QListViewItem *item; |
384 | bool found =false; | 386 | bool found =false; |
385 | for (item = mListView->firstChild(); item && !found; | 387 | for (item = mListView->firstChild(); item && !found; |
386 | item = item->nextSibling()) | 388 | item = item->nextSibling()) |
387 | { | 389 | { |
388 | if (item->isSelected()) | 390 | if (item->isSelected()) |
389 | { | 391 | { |
390 | found = true; | 392 | found = true; |
391 | #ifndef KAB_EMBEDDED | 393 | #ifndef KAB_EMBEDDED |
392 | ContactListViewItem *ceItem | 394 | ContactListViewItem *ceItem |
393 | = dynamic_cast<ContactListViewItem*>(item); | 395 | = dynamic_cast<ContactListViewItem*>(item); |
394 | #else //KAB_EMBEDDED | 396 | #else //KAB_EMBEDDED |
395 | ContactListViewItem *ceItem | 397 | ContactListViewItem *ceItem |
396 | = (ContactListViewItem*)(item); | 398 | = (ContactListViewItem*)(item); |
397 | #endif //KAB_EMBEDDED | 399 | #endif //KAB_EMBEDDED |
398 | 400 | ||
399 | if ( ceItem ) emit selected(ceItem->addressee().uid()); | 401 | if ( ceItem ) emit selected(ceItem->addressee().uid()); |
400 | } | 402 | } |
401 | } | 403 | } |
402 | 404 | ||
403 | if (!found) | 405 | if (!found) |
404 | emit selected(QString::null); | 406 | emit selected(QString::null); |
405 | } | 407 | } |
406 | 408 | ||
407 | void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | 409 | void KAddressBookTableView::addresseeExecuted(QListViewItem *item) |
408 | { | 410 | { |
409 | if (item) | 411 | if (item) |
410 | { | 412 | { |
411 | #ifndef KAB_EMBEDDED | 413 | #ifndef KAB_EMBEDDED |
412 | ContactListViewItem *ceItem | 414 | ContactListViewItem *ceItem |
413 | = dynamic_cast<ContactListViewItem*>(item); | 415 | = dynamic_cast<ContactListViewItem*>(item); |
414 | #else //KAB_EMBEDDED | 416 | #else //KAB_EMBEDDED |
415 | ContactListViewItem *ceItem | 417 | ContactListViewItem *ceItem |
416 | = (ContactListViewItem*)(item); | 418 | = (ContactListViewItem*)(item); |
417 | #endif //KAB_EMBEDDED | 419 | #endif //KAB_EMBEDDED |
418 | 420 | ||
419 | if (ceItem) | 421 | if (ceItem) |
420 | { | 422 | { |
421 | emit executed(ceItem->addressee().uid()); | 423 | emit executed(ceItem->addressee().uid()); |
422 | } | 424 | } |
423 | } | 425 | } |
424 | else | 426 | else |
425 | { | 427 | { |
426 | emit executed(QString::null); | 428 | emit executed(QString::null); |
427 | } | 429 | } |
428 | } | 430 | } |
429 | 431 | ||
430 | void KAddressBookTableView::addresseeDeleted() | 432 | void KAddressBookTableView::addresseeDeleted() |
431 | { | 433 | { |
432 | 434 | ||
433 | emit deleteRequest(); | 435 | emit deleteRequest(); |
434 | 436 | ||
435 | } | 437 | } |
436 | 438 | ||
437 | 439 | ||
438 | 440 | ||
439 | 441 | ||
440 | 442 | ||
441 | #ifndef KAB_EMBEDDED | 443 | #ifndef KAB_EMBEDDED |
442 | #include "kaddressbooktableview.moc" | 444 | #include "kaddressbooktableview.moc" |
443 | #endif //KAB_EMBEDDED | 445 | #endif //KAB_EMBEDDED |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index f7766f8..c7ce8cb 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -67,385 +67,386 @@ using namespace KCal; | |||
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; | 133 | mServerSocket = 0; |
134 | mClosed = false; | 134 | mClosed = false; |
135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
136 | QString confFile = locateLocal("config","korganizerrc"); | 136 | QString confFile = locateLocal("config","korganizerrc"); |
137 | QFileInfo finf ( confFile ); | 137 | QFileInfo finf ( confFile ); |
138 | bool showWarning = !finf.exists(); | 138 | bool showWarning = !finf.exists(); |
139 | setIcon(SmallIcon( "ko24" ) ); | 139 | setIcon(SmallIcon( "ko24" ) ); |
140 | mBlockAtStartup = true; | 140 | mBlockAtStartup = true; |
141 | mFlagKeyPressed = false; | 141 | mFlagKeyPressed = false; |
142 | setCaption("KOrganizer/Pi"); | 142 | setCaption("KOrganizer/Pi"); |
143 | KOPrefs *p = KOPrefs::instance(); | 143 | KOPrefs *p = KOPrefs::instance(); |
144 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 144 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
145 | if ( p->mHourSize > 18 ) | 145 | if ( p->mHourSize > 18 ) |
146 | p->mHourSize = 18; | 146 | p->mHourSize = 18; |
147 | QMainWindow::ToolBarDock tbd; | 147 | QMainWindow::ToolBarDock tbd; |
148 | if ( p->mToolBarHor ) { | 148 | if ( p->mToolBarHor ) { |
149 | if ( p->mToolBarUp ) | 149 | if ( p->mToolBarUp ) |
150 | tbd = Bottom; | 150 | tbd = Bottom; |
151 | else | 151 | else |
152 | tbd = Top; | 152 | tbd = Top; |
153 | } | 153 | } |
154 | else { | 154 | else { |
155 | if ( p->mToolBarUp ) | 155 | if ( p->mToolBarUp ) |
156 | tbd = Right; | 156 | tbd = Right; |
157 | else | 157 | else |
158 | tbd = Left; | 158 | tbd = Left; |
159 | } | 159 | } |
160 | if ( KOPrefs::instance()->mUseAppColors ) | 160 | if ( KOPrefs::instance()->mUseAppColors ) |
161 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 161 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
162 | globalFlagBlockStartup = 1; | 162 | globalFlagBlockStartup = 1; |
163 | iconToolBar = new QPEToolBar( this ); | 163 | iconToolBar = new QPEToolBar( this ); |
164 | addToolBar (iconToolBar , tbd ); | 164 | addToolBar (iconToolBar , tbd ); |
165 | mCalendarModifiedFlag = false; | 165 | mCalendarModifiedFlag = false; |
166 | 166 | ||
167 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 167 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
168 | splash->setAlignment ( AlignCenter ); | 168 | splash->setAlignment ( AlignCenter ); |
169 | setCentralWidget( splash ); | 169 | setCentralWidget( splash ); |
170 | #ifndef DESKTOP_VERSION | 170 | #ifndef DESKTOP_VERSION |
171 | showMaximized(); | 171 | showMaximized(); |
172 | #endif | 172 | #endif |
173 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 173 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
174 | setDefaultPreferences(); | 174 | setDefaultPreferences(); |
175 | mCalendar = new CalendarLocal(); | 175 | mCalendar = new CalendarLocal(); |
176 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 176 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
177 | mView->hide(); | 177 | mView->hide(); |
178 | //mView->resize(splash->size() ); | 178 | //mView->resize(splash->size() ); |
179 | initActions(); | 179 | initActions(); |
180 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 180 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
181 | mSyncManager->setBlockSave(false); | 181 | mSyncManager->setBlockSave(false); |
182 | mView->setSyncManager(mSyncManager); | 182 | mView->setSyncManager(mSyncManager); |
183 | #ifndef DESKTOP_VERSION | 183 | #ifndef DESKTOP_VERSION |
184 | iconToolBar->show(); | 184 | iconToolBar->show(); |
185 | qApp->processEvents(); | 185 | qApp->processEvents(); |
186 | #endif | 186 | #endif |
187 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 187 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
188 | int vh = height() ; | 188 | int vh = height() ; |
189 | int vw = width(); | 189 | int vw = width(); |
190 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 190 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
191 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 191 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
192 | vh -= iconToolBar->height(); | 192 | vh -= iconToolBar->height(); |
193 | } else { | 193 | } else { |
194 | vw -= iconToolBar->height(); | 194 | vw -= iconToolBar->height(); |
195 | } | 195 | } |
196 | //mView->setMaximumSize( splash->size() ); | 196 | //mView->setMaximumSize( splash->size() ); |
197 | //mView->resize( splash->size() ); | 197 | //mView->resize( splash->size() ); |
198 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 198 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
199 | mView->readSettings(); | 199 | mView->readSettings(); |
200 | bool newFile = false; | 200 | bool newFile = false; |
201 | if( !QFile::exists( defaultFileName() ) ) { | 201 | if( !QFile::exists( defaultFileName() ) ) { |
202 | QFileInfo finfo ( defaultFileName() ); | 202 | QFileInfo finfo ( defaultFileName() ); |
203 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 203 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
204 | qDebug("oldfile %s ", oldFile.latin1()); | 204 | 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"; | 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"; |
206 | finfo.setFile( oldFile ); | 206 | finfo.setFile( oldFile ); |
207 | if (finfo.exists() ) { | 207 | if (finfo.exists() ) { |
208 | KMessageBox::information( this, message); | 208 | KMessageBox::information( this, message); |
209 | mView->openCalendar( oldFile ); | 209 | mView->openCalendar( oldFile ); |
210 | qApp->processEvents(); | 210 | qApp->processEvents(); |
211 | } else { | 211 | } else { |
212 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 212 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
213 | finfo.setFile( oldFile ); | 213 | finfo.setFile( oldFile ); |
214 | if (finfo.exists() ) { | 214 | if (finfo.exists() ) { |
215 | KMessageBox::information( this, message); | 215 | KMessageBox::information( this, message); |
216 | mView->openCalendar( oldFile ); | 216 | mView->openCalendar( oldFile ); |
217 | qApp->processEvents(); | 217 | qApp->processEvents(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | mView->saveCalendar( defaultFileName() ); | 220 | mView->saveCalendar( defaultFileName() ); |
221 | newFile = true; | 221 | newFile = true; |
222 | } | 222 | } |
223 | 223 | ||
224 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 224 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
225 | mView->openCalendar( defaultFileName() ); | 225 | mView->openCalendar( defaultFileName() ); |
226 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 226 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
227 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 227 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
228 | 228 | ||
229 | if ( KOPrefs::instance()->mLanguageChanged ) { | 229 | if ( KOPrefs::instance()->mLanguageChanged ) { |
230 | KOPrefs::instance()->setCategoryDefaults(); | 230 | KOPrefs::instance()->setCategoryDefaults(); |
231 | int count = mView->addCategories(); | 231 | int count = mView->addCategories(); |
232 | KOPrefs::instance()->mLanguageChanged = false; | 232 | KOPrefs::instance()->mLanguageChanged = false; |
233 | } | 233 | } |
234 | processIncidenceSelection( 0 ); | 234 | processIncidenceSelection( 0 ); |
235 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 235 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
236 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 236 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
237 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 237 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
238 | SLOT( slotModifiedChanged( bool ) ) ); | 238 | SLOT( slotModifiedChanged( bool ) ) ); |
239 | 239 | ||
240 | 240 | ||
241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
242 | mView->setModified( false ); | 242 | mView->setModified( false ); |
243 | mBlockAtStartup = false; | 243 | mBlockAtStartup = false; |
244 | mView->setModified( false ); | 244 | mView->setModified( false ); |
245 | setCentralWidget( mView ); | 245 | setCentralWidget( mView ); |
246 | globalFlagBlockStartup = 0; | 246 | globalFlagBlockStartup = 0; |
247 | mView->show(); | 247 | mView->show(); |
248 | delete splash; | 248 | delete splash; |
249 | if ( newFile ) | 249 | if ( newFile ) |
250 | mView->updateConfig(); | 250 | mView->updateConfig(); |
251 | // qApp->processEvents(); | 251 | // qApp->processEvents(); |
252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
253 | //fillSyncMenu(); | 253 | //fillSyncMenu(); |
254 | 254 | ||
255 | 255 | ||
256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
259 | mSyncManager->setDefaultFileName( defaultFileName()); | 259 | mSyncManager->setDefaultFileName( defaultFileName()); |
260 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | ||
260 | mSyncManager->fillSyncMenu(); | 261 | mSyncManager->fillSyncMenu(); |
261 | 262 | ||
262 | 263 | ||
263 | 264 | ||
264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 265 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
265 | if ( showWarning ) { | 266 | if ( showWarning ) { |
266 | KMessageBox::information( this, | 267 | KMessageBox::information( this, |
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"); | 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"); |
268 | qApp->processEvents(); | 269 | qApp->processEvents(); |
269 | mView->dialogManager()->showSyncOptions(); | 270 | mView->dialogManager()->showSyncOptions(); |
270 | } | 271 | } |
271 | 272 | ||
272 | //US listen for result adressed from Ka/Pi | 273 | //US listen for result adressed from Ka/Pi |
273 | #ifndef DESKTOP_VERSION | 274 | #ifndef DESKTOP_VERSION |
274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 275 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
275 | #endif | 276 | #endif |
276 | } | 277 | } |
277 | MainWindow::~MainWindow() | 278 | MainWindow::~MainWindow() |
278 | { | 279 | { |
279 | //qDebug("MainWindow::~MainWindow() "); | 280 | //qDebug("MainWindow::~MainWindow() "); |
280 | //save toolbar location | 281 | //save toolbar location |
281 | delete mServerSocket; | 282 | delete mServerSocket; |
282 | delete mCalendar; | 283 | delete mCalendar; |
283 | delete KOPrefs::instance(); | 284 | delete KOPrefs::instance(); |
284 | delete KIncidenceFormatter::instance(); | 285 | delete KIncidenceFormatter::instance(); |
285 | 286 | ||
286 | 287 | ||
287 | } | 288 | } |
288 | void MainWindow::showMaximized () | 289 | void MainWindow::showMaximized () |
289 | { | 290 | { |
290 | #ifndef DESKTOP_VERSION | 291 | #ifndef DESKTOP_VERSION |
291 | if ( ! globalFlagBlockStartup ) | 292 | if ( ! globalFlagBlockStartup ) |
292 | if ( mClosed ) | 293 | if ( mClosed ) |
293 | mView->goToday(); | 294 | mView->goToday(); |
294 | #endif | 295 | #endif |
295 | QWidget::showMaximized () ; | 296 | QWidget::showMaximized () ; |
296 | mClosed = false; | 297 | mClosed = false; |
297 | } | 298 | } |
298 | void MainWindow::closeEvent( QCloseEvent* ce ) | 299 | void MainWindow::closeEvent( QCloseEvent* ce ) |
299 | { | 300 | { |
300 | 301 | ||
301 | 302 | ||
302 | 303 | ||
303 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 304 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
304 | saveOnClose(); | 305 | saveOnClose(); |
305 | mClosed = true; | 306 | mClosed = true; |
306 | ce->accept(); | 307 | ce->accept(); |
307 | return; | 308 | return; |
308 | 309 | ||
309 | } | 310 | } |
310 | 311 | ||
311 | switch( QMessageBox::information( this, "KO/Pi", | 312 | switch( QMessageBox::information( this, "KO/Pi", |
312 | i18n("Do you really want\nto close KO/Pi?"), | 313 | i18n("Do you really want\nto close KO/Pi?"), |
313 | i18n("Close"), i18n("No"), | 314 | i18n("Close"), i18n("No"), |
314 | 0, 0 ) ) { | 315 | 0, 0 ) ) { |
315 | case 0: | 316 | case 0: |
316 | saveOnClose(); | 317 | saveOnClose(); |
317 | mClosed = true; | 318 | mClosed = true; |
318 | ce->accept(); | 319 | ce->accept(); |
319 | break; | 320 | break; |
320 | case 1: | 321 | case 1: |
321 | ce->ignore(); | 322 | ce->ignore(); |
322 | break; | 323 | break; |
323 | case 2: | 324 | case 2: |
324 | 325 | ||
325 | default: | 326 | default: |
326 | break; | 327 | break; |
327 | } | 328 | } |
328 | 329 | ||
329 | 330 | ||
330 | } | 331 | } |
331 | 332 | ||
332 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 333 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
333 | { | 334 | { |
334 | QDataStream stream( data, IO_ReadOnly ); | 335 | QDataStream stream( data, IO_ReadOnly ); |
335 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 336 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
336 | //QString datamess; | 337 | //QString datamess; |
337 | //qDebug("message "); | 338 | //qDebug("message "); |
338 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 339 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
339 | 340 | ||
340 | if ( cmsg == "-writeFile" ) { | 341 | if ( cmsg == "-writeFile" ) { |
341 | // I made from the "-writeFile" an "-writeAlarm" | 342 | // I made from the "-writeFile" an "-writeAlarm" |
342 | mView->viewManager()->showWhatsNextView(); | 343 | mView->viewManager()->showWhatsNextView(); |
343 | mCalendar->checkAlarmForIncidence( 0, true); | 344 | mCalendar->checkAlarmForIncidence( 0, true); |
344 | showMaximized(); | 345 | showMaximized(); |
345 | raise(); | 346 | raise(); |
346 | return; | 347 | return; |
347 | } | 348 | } |
348 | 349 | ||
349 | if ( cmsg == "-writeFile" ) { | 350 | if ( cmsg == "-writeFile" ) { |
350 | // I made from the "-writeFile" an "-writeAlarm" | 351 | // I made from the "-writeFile" an "-writeAlarm" |
351 | mView->viewManager()->showWhatsNextView(); | 352 | mView->viewManager()->showWhatsNextView(); |
352 | mCalendar->checkAlarmForIncidence( 0, true); | 353 | mCalendar->checkAlarmForIncidence( 0, true); |
353 | showMaximized(); | 354 | showMaximized(); |
354 | raise(); | 355 | raise(); |
355 | return; | 356 | return; |
356 | 357 | ||
357 | } | 358 | } |
358 | if ( cmsg == "-writeFileSilent" ) { | 359 | if ( cmsg == "-writeFileSilent" ) { |
359 | // I made from the "-writeFile" an "-writeAlarm" | 360 | // I made from the "-writeFile" an "-writeAlarm" |
360 | // mView->viewManager()->showWhatsNextView(); | 361 | // mView->viewManager()->showWhatsNextView(); |
361 | mCalendar->checkAlarmForIncidence( 0, true); | 362 | mCalendar->checkAlarmForIncidence( 0, true); |
362 | //showMaximized(); | 363 | //showMaximized(); |
363 | //raise(); | 364 | //raise(); |
364 | hide(); | 365 | hide(); |
365 | return; | 366 | return; |
366 | } | 367 | } |
367 | if ( cmsg == "-newCountdown" ) { | 368 | if ( cmsg == "-newCountdown" ) { |
368 | qDebug("newCountdown "); | 369 | qDebug("newCountdown "); |
369 | 370 | ||
370 | } | 371 | } |
371 | QString msg ; | 372 | QString msg ; |
372 | QString allmsg = cmsg; | 373 | QString allmsg = cmsg; |
373 | while ( allmsg.length() > 0 ) { | 374 | while ( allmsg.length() > 0 ) { |
374 | int nextC = allmsg.find( "-", 1 ); | 375 | int nextC = allmsg.find( "-", 1 ); |
375 | if ( nextC == -1 ) { | 376 | if ( nextC == -1 ) { |
376 | msg = allmsg; | 377 | msg = allmsg; |
377 | allmsg = ""; | 378 | allmsg = ""; |
378 | } else{ | 379 | } else{ |
379 | msg = allmsg.left( nextC ); | 380 | msg = allmsg.left( nextC ); |
380 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 381 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
381 | } | 382 | } |
382 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 383 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
383 | if ( msg == "-newEvent" ) { | 384 | if ( msg == "-newEvent" ) { |
384 | mView->newEvent(); | 385 | mView->newEvent(); |
385 | } | 386 | } |
386 | if ( msg == "-newTodo" ) { | 387 | if ( msg == "-newTodo" ) { |
387 | mView->newTodo(); | 388 | mView->newTodo(); |
388 | 389 | ||
389 | } | 390 | } |
390 | if ( msg == "-showWN" ) { | 391 | if ( msg == "-showWN" ) { |
391 | mView->viewManager()->showWhatsNextView(); | 392 | mView->viewManager()->showWhatsNextView(); |
392 | } | 393 | } |
393 | if ( msg == "-showTodo" ) { | 394 | if ( msg == "-showTodo" ) { |
394 | mView->viewManager()->showTodoView(); | 395 | mView->viewManager()->showTodoView(); |
395 | } | 396 | } |
396 | if ( msg == "-showList" ) { | 397 | if ( msg == "-showList" ) { |
397 | mView->viewManager()->showListView(); | 398 | mView->viewManager()->showListView(); |
398 | } | 399 | } |
399 | else if ( msg == "-showDay" ) { | 400 | else if ( msg == "-showDay" ) { |
400 | mView->viewManager()->showDayView(); | 401 | mView->viewManager()->showDayView(); |
401 | } | 402 | } |
402 | else if ( msg == "-showWWeek" ) { | 403 | else if ( msg == "-showWWeek" ) { |
403 | mView->viewManager()->showWorkWeekView(); | 404 | mView->viewManager()->showWorkWeekView(); |
404 | } | 405 | } |
405 | else if ( msg == "-ringSync" ) { | 406 | else if ( msg == "-ringSync" ) { |
406 | mSyncManager->multiSync( false ); | 407 | mSyncManager->multiSync( false ); |
407 | } | 408 | } |
408 | else if ( msg == "-showWeek" ) { | 409 | else if ( msg == "-showWeek" ) { |
409 | mView->viewManager()->showWeekView(); | 410 | mView->viewManager()->showWeekView(); |
410 | } | 411 | } |
411 | else if ( msg == "-showTodo" ) { | 412 | else if ( msg == "-showTodo" ) { |
412 | mView->viewManager()->showTodoView(); | 413 | mView->viewManager()->showTodoView(); |
413 | } | 414 | } |
414 | else if ( msg == "-showJournal" ) { | 415 | else if ( msg == "-showJournal" ) { |
415 | mView->dateNavigator()->selectDates( 1 ); | 416 | mView->dateNavigator()->selectDates( 1 ); |
416 | mView->dateNavigator()->selectToday(); | 417 | mView->dateNavigator()->selectToday(); |
417 | mView->viewManager()->showJournalView(); | 418 | mView->viewManager()->showJournalView(); |
418 | } | 419 | } |
419 | else if ( msg == "-showKO" ) { | 420 | else if ( msg == "-showKO" ) { |
420 | mView->viewManager()->showNextXView(); | 421 | mView->viewManager()->showNextXView(); |
421 | } | 422 | } |
422 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 423 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
423 | mView->viewManager()->showWhatsNextView(); | 424 | mView->viewManager()->showWhatsNextView(); |
424 | } | 425 | } |
425 | else if ( msg == "-showNextXView" ) { | 426 | else if ( msg == "-showNextXView" ) { |
426 | mView->viewManager()->showNextXView(); | 427 | mView->viewManager()->showNextXView(); |
427 | } | 428 | } |
428 | 429 | ||
429 | 430 | ||
430 | } | 431 | } |
431 | 432 | ||
432 | showMaximized(); | 433 | showMaximized(); |
433 | raise(); | 434 | raise(); |
434 | } | 435 | } |
435 | 436 | ||
436 | QPixmap MainWindow::loadPixmap( QString name ) | 437 | QPixmap MainWindow::loadPixmap( QString name ) |
437 | { | 438 | { |
438 | return SmallIcon( name ); | 439 | return SmallIcon( name ); |
439 | 440 | ||
440 | } | 441 | } |
441 | void MainWindow::initActions() | 442 | void MainWindow::initActions() |
442 | { | 443 | { |
443 | //KOPrefs::instance()->mShowFullMenu | 444 | //KOPrefs::instance()->mShowFullMenu |
444 | iconToolBar->clear(); | 445 | iconToolBar->clear(); |
445 | KOPrefs *p = KOPrefs::instance(); | 446 | KOPrefs *p = KOPrefs::instance(); |
446 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 447 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
447 | 448 | ||
448 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 449 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
449 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 450 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
450 | QPopupMenu *importMenu = new QPopupMenu( this ); | 451 | QPopupMenu *importMenu = new QPopupMenu( this ); |
451 | selectFilterMenu = new QPopupMenu( this ); | 452 | selectFilterMenu = new QPopupMenu( this ); |