summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp49
1 files changed, 35 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d891b07..25891a0 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -261,610 +261,627 @@ void KABCore::restoreSettings()
261 261
262 } 262 }
263#ifndef KAB_EMBEDDED 263#ifndef KAB_EMBEDDED
264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
265 if ( splitterSize.count() == 0 ) { 265 if ( splitterSize.count() == 0 ) {
266 splitterSize.append( width() / 2 ); 266 splitterSize.append( width() / 2 );
267 splitterSize.append( width() / 2 ); 267 splitterSize.append( width() / 2 );
268 } 268 }
269 mExtensionBarSplitter->setSizes( splitterSize ); 269 mExtensionBarSplitter->setSizes( splitterSize );
270 270
271 splitterSize = KABPrefs::instance()->mDetailsSplitter; 271 splitterSize = KABPrefs::instance()->mDetailsSplitter;
272 if ( splitterSize.count() == 0 ) { 272 if ( splitterSize.count() == 0 ) {
273 splitterSize.append( height() / 2 ); 273 splitterSize.append( height() / 2 );
274 splitterSize.append( height() / 2 ); 274 splitterSize.append( height() / 2 );
275 } 275 }
276 mDetailsSplitter->setSizes( splitterSize ); 276 mDetailsSplitter->setSizes( splitterSize );
277 277
278 mExtensionManager->restoreSettings(); 278 mExtensionManager->restoreSettings();
279 279
280#endif //KAB_EMBEDDED 280#endif //KAB_EMBEDDED
281 281
282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
283 283
284 mViewManager->restoreSettings(); 284 mViewManager->restoreSettings();
285 mExtensionManager->restoreSettings(); 285 mExtensionManager->restoreSettings();
286} 286}
287 287
288void KABCore::saveSettings() 288void KABCore::saveSettings()
289{ 289{
290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
291 if ( mExtensionBarSplitter ) 291 if ( mExtensionBarSplitter )
292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
295#ifndef KAB_EMBEDDED 295#ifndef KAB_EMBEDDED
296 296
297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
299#endif //KAB_EMBEDDED 299#endif //KAB_EMBEDDED
300 mExtensionManager->saveSettings(); 300 mExtensionManager->saveSettings();
301 mViewManager->saveSettings(); 301 mViewManager->saveSettings();
302 302
303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
304 304
305} 305}
306 306
307KABC::AddressBook *KABCore::addressBook() const 307KABC::AddressBook *KABCore::addressBook() const
308{ 308{
309 return mAddressBook; 309 return mAddressBook;
310} 310}
311 311
312KConfig *KABCore::config() 312KConfig *KABCore::config()
313{ 313{
314#ifndef KAB_EMBEDDED 314#ifndef KAB_EMBEDDED
315 return KABPrefs::instance()->config(); 315 return KABPrefs::instance()->config();
316#else //KAB_EMBEDDED 316#else //KAB_EMBEDDED
317 return KABPrefs::instance()->getConfig(); 317 return KABPrefs::instance()->getConfig();
318#endif //KAB_EMBEDDED 318#endif //KAB_EMBEDDED
319} 319}
320 320
321KActionCollection *KABCore::actionCollection() const 321KActionCollection *KABCore::actionCollection() const
322{ 322{
323 return mGUIClient->actionCollection(); 323 return mGUIClient->actionCollection();
324} 324}
325 325
326KABC::Field *KABCore::currentSearchField() const 326KABC::Field *KABCore::currentSearchField() const
327{ 327{
328 if (mIncSearchWidget) 328 if (mIncSearchWidget)
329 return mIncSearchWidget->currentField(); 329 return mIncSearchWidget->currentField();
330 else 330 else
331 return 0; 331 return 0;
332} 332}
333 333
334QStringList KABCore::selectedUIDs() const 334QStringList KABCore::selectedUIDs() const
335{ 335{
336 return mViewManager->selectedUids(); 336 return mViewManager->selectedUids();
337} 337}
338 338
339KABC::Resource *KABCore::requestResource( QWidget *parent ) 339KABC::Resource *KABCore::requestResource( QWidget *parent )
340{ 340{
341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 341 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
342 342
343 QPtrList<KRES::Resource> kresResources; 343 QPtrList<KRES::Resource> kresResources;
344 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 344 QPtrListIterator<KABC::Resource> resIt( kabcResources );
345 KABC::Resource *resource; 345 KABC::Resource *resource;
346 while ( ( resource = resIt.current() ) != 0 ) { 346 while ( ( resource = resIt.current() ) != 0 ) {
347 ++resIt; 347 ++resIt;
348 if ( !resource->readOnly() ) { 348 if ( !resource->readOnly() ) {
349 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 349 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
350 if ( res ) 350 if ( res )
351 kresResources.append( res ); 351 kresResources.append( res );
352 } 352 }
353 } 353 }
354 354
355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 355 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
356 return static_cast<KABC::Resource*>( res ); 356 return static_cast<KABC::Resource*>( res );
357} 357}
358 358
359#ifndef KAB_EMBEDDED 359#ifndef KAB_EMBEDDED
360KAboutData *KABCore::createAboutData() 360KAboutData *KABCore::createAboutData()
361#else //KAB_EMBEDDED 361#else //KAB_EMBEDDED
362void KABCore::createAboutData() 362void KABCore::createAboutData()
363#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
364{ 364{
365#ifndef KAB_EMBEDDED 365#ifndef KAB_EMBEDDED
366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 366 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
367 "3.1", I18N_NOOP( "The KDE Address Book" ), 367 "3.1", I18N_NOOP( "The KDE Address Book" ),
368 KAboutData::License_GPL_V2, 368 KAboutData::License_GPL_V2,
369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 369 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 370 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 371 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
372 about->addAuthor( "Cornelius Schumacher", 372 about->addAuthor( "Cornelius Schumacher",
373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 373 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
374 "schumacher@kde.org" ); 374 "schumacher@kde.org" );
375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 375 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
376 "mpilone@slac.com" ); 376 "mpilone@slac.com" );
377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 377 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 378 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 379 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
380 "michel@klaralvdalens-datakonsult.se" ); 380 "michel@klaralvdalens-datakonsult.se" );
381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 381 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
382 "hansen@kde.org" ); 382 "hansen@kde.org" );
383 383
384 return about; 384 return about;
385#endif //KAB_EMBEDDED 385#endif //KAB_EMBEDDED
386 386
387 QString version; 387 QString version;
388#include <../version> 388#include <../version>
389 QMessageBox::about( this, "About KAddressbook/Pi", 389 QMessageBox::about( this, "About KAddressbook/Pi",
390 "KAddressbook/Platform-independent\n" 390 "KAddressbook/Platform-independent\n"
391 "(KA/Pi) " +version + " - " + 391 "(KA/Pi) " +version + " - " +
392#ifdef DESKTOP_VERSION 392#ifdef DESKTOP_VERSION
393 "Desktop Edition\n" 393 "Desktop Edition\n"
394#else 394#else
395 "PDA-Edition\n" 395 "PDA-Edition\n"
396 "for: Zaurus 5500 / 7x0 / 8x0\n" 396 "for: Zaurus 5500 / 7x0 / 8x0\n"
397#endif 397#endif
398 398
399 "(c) 2004 Ulf Schenk\n" 399 "(c) 2004 Ulf Schenk\n"
400 "(c) 1997-2003, The KDE PIM Team\n" 400 "(c) 1997-2003, The KDE PIM Team\n"
401 "Tobias Koenig Current maintainer tokoe@kde.org\n" 401 "Tobias Koenig Current maintainer tokoe@kde.org\n"
402 "Don Sanders Original author\n" 402 "Don Sanders Original author\n"
403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
405 "Greg Stern DCOP interface\n" 405 "Greg Stern DCOP interface\n"
406 "Mark Westcot Contact pinning\n" 406 "Mark Westcot Contact pinning\n"
407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
408 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 408 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
409#ifdef _WIN32_ 409#ifdef _WIN32_
410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
411#endif 411#endif
412 ); 412 );
413} 413}
414 414
415void KABCore::setContactSelected( const QString &uid ) 415void KABCore::setContactSelected( const QString &uid )
416{ 416{
417 KABC::Addressee addr = mAddressBook->findByUid( uid ); 417 KABC::Addressee addr = mAddressBook->findByUid( uid );
418 if ( !mDetails->isHidden() ) 418 if ( !mDetails->isHidden() )
419 mDetails->setAddressee( addr ); 419 mDetails->setAddressee( addr );
420 420
421 if ( !addr.isEmpty() ) { 421 if ( !addr.isEmpty() ) {
422 emit contactSelected( addr.formattedName() ); 422 emit contactSelected( addr.formattedName() );
423 KABC::Picture pic = addr.photo(); 423 KABC::Picture pic = addr.photo();
424 if ( pic.isIntern() ) { 424 if ( pic.isIntern() ) {
425//US emit contactSelected( pic.data() ); 425//US emit contactSelected( pic.data() );
426//US instead use: 426//US instead use:
427 QPixmap px; 427 QPixmap px;
428 if (pic.data().isNull() != true) 428 if (pic.data().isNull() != true)
429 { 429 {
430 px.convertFromImage(pic.data()); 430 px.convertFromImage(pic.data());
431 } 431 }
432 432
433 emit contactSelected( px ); 433 emit contactSelected( px );
434 } 434 }
435 } 435 }
436 436
437 437
438 mExtensionManager->setSelectionChanged(); 438 mExtensionManager->setSelectionChanged();
439 439
440 // update the actions 440 // update the actions
441 bool selected = !uid.isEmpty(); 441 bool selected = !uid.isEmpty();
442 442
443 if ( mReadWrite ) { 443 if ( mReadWrite ) {
444 mActionCut->setEnabled( selected ); 444 mActionCut->setEnabled( selected );
445 mActionPaste->setEnabled( selected ); 445 mActionPaste->setEnabled( selected );
446 } 446 }
447 447
448 mActionCopy->setEnabled( selected ); 448 mActionCopy->setEnabled( selected );
449 mActionDelete->setEnabled( selected ); 449 mActionDelete->setEnabled( selected );
450 mActionEditAddressee->setEnabled( selected ); 450 mActionEditAddressee->setEnabled( selected );
451 mActionMail->setEnabled( selected ); 451 mActionMail->setEnabled( selected );
452 mActionMailVCard->setEnabled( selected ); 452 mActionMailVCard->setEnabled( selected );
453 if (mActionBeam) 453 //if (mActionBeam)
454 mActionBeam->setEnabled( selected ); 454 //mActionBeam->setEnabled( selected );
455 455
456 if (mActionBeam) 456 if (mActionBeamVCard)
457 mActionBeamVCard->setEnabled( selected ); 457 mActionBeamVCard->setEnabled( selected );
458 458
459 mActionWhoAmI->setEnabled( selected ); 459 mActionWhoAmI->setEnabled( selected );
460 mActionCategories->setEnabled( selected ); 460 mActionCategories->setEnabled( selected );
461} 461}
462 462
463void KABCore::sendMail() 463void KABCore::sendMail()
464{ 464{
465 sendMail( mViewManager->selectedEmails().join( ", " ) ); 465 sendMail( mViewManager->selectedEmails().join( ", " ) );
466} 466}
467 467
468void KABCore::sendMail( const QString& email ) 468void KABCore::sendMail( const QString& email )
469{ 469{
470//US original kde implementation : kapp->invokeMailer( email, "" ); 470//US original kde implementation : kapp->invokeMailer( email, "" );
471 471
472/*US original qtopia implementation 472/*US original qtopia implementation
473 PimContact c = abList->currentEntry(); 473 PimContact c = abList->currentEntry();
474 QString name = c.fileAs(); 474 QString name = c.fileAs();
475 QString email = c.defaultEmail(); 475 QString email = c.defaultEmail();
476#ifndef QT_NO_COP 476#ifndef QT_NO_COP
477 QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); 477 QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)");
478 e << name << email; 478 e << name << email;
479#else 479#else
480*/ 480*/
481 481
482 482
483#ifndef QT_NO_COP 483#ifndef QT_NO_COP
484 QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); 484 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
485 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); 485 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
486 486
487 QCopEnvelope e(channel, "writeMail(QString,QString)"); 487 QCopEnvelope e(channel, "writeMail(QString,QString)");
488 //US we need no names in the To field. The emailadresses are enough 488 //US we need no names in the To field. The emailadresses are enough
489 e << "" << email; 489 e << "" << email;
490#else 490#else
491 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); 491 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
492#endif 492#endif
493} 493}
494 494
495 495
496 496
497void KABCore::mailVCard() 497void KABCore::mailVCard()
498{ 498{
499 QStringList uids = mViewManager->selectedUids(); 499 QStringList uids = mViewManager->selectedUids();
500 if ( !uids.isEmpty() ) 500 if ( !uids.isEmpty() )
501 mailVCard( uids ); 501 mailVCard( uids );
502} 502}
503 503
504void KABCore::mailVCard( const QStringList& uids ) 504void KABCore::mailVCard( const QStringList& uids )
505{ 505{
506 QStringList urls; 506 QStringList urls;
507 507
508 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 508 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
509 509
510/*US 510/*US
511 // Create a temp dir, so that we can put the files in it with proper names 511 // Create a temp dir, so that we can put the files in it with proper names
512 KTempFile tempDir; 512 KTempFile tempDir;
513 if ( tempDir.status() != 0 ) { 513 if ( tempDir.status() != 0 ) {
514 kdWarning() << strerror( tempDir.status() ) << endl; 514 kdWarning() << strerror( tempDir.status() ) << endl;
515 return; 515 return;
516 } 516 }
517 517
518 QString dirName = tempDir.name(); 518 QString dirName = tempDir.name();
519 tempDir.unlink(); 519 tempDir.unlink();
520*/ 520*/
521 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 521 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
522 522
523 523
524 524
525 QDir().mkdir( dirName, true ); 525 QDir().mkdir( dirName, true );
526 526
527 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 527 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
528 KABC::Addressee a = mAddressBook->findByUid( *it ); 528 KABC::Addressee a = mAddressBook->findByUid( *it );
529 529
530 if ( a.isEmpty() ) 530 if ( a.isEmpty() )
531 continue; 531 continue;
532 532
533 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 533 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
534 534
535 QString fileName = dirName + "/" + name; 535 QString fileName = dirName + "/" + name;
536 536
537 QFile outFile(fileName); 537 QFile outFile(fileName);
538 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 538 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
539 KABC::VCardConverter converter; 539 KABC::VCardConverter converter;
540 QString vcard; 540 QString vcard;
541 541
542 converter.addresseeToVCard( a, vcard ); 542 converter.addresseeToVCard( a, vcard );
543 543
544 QTextStream t( &outFile ); // use a text stream 544 QTextStream t( &outFile ); // use a text stream
545 t.setEncoding( QTextStream::UnicodeUTF8 ); 545 t.setEncoding( QTextStream::UnicodeUTF8 );
546 t << vcard; 546 t << vcard;
547 547
548 outFile.close(); 548 outFile.close();
549 549
550 urls.append( fileName ); 550 urls.append( fileName );
551 } 551 }
552 } 552 }
553/*US 553/*US
554 kapp->invokeMailer( QString::null, QString::null, QString::null, 554 kapp->invokeMailer( QString::null, QString::null, QString::null,
555 QString::null, // subject 555 QString::null, // subject
556 QString::null, // body 556 QString::null, // body
557 QString::null, 557 QString::null,
558 urls ); // attachments 558 urls ); // attachments
559*/ 559*/
560#ifndef QT_NO_COP 560#ifndef QT_NO_COP
561 QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); 561 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
562 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); 562 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
563 563
564 QMap<QString, QString> parameterMap; 564 QMap<QString, QString> parameterMap;
565 parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); 565 parameterMap.insert("ATTACHMENT<n>", urls.join(", "));
566 566
567 QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); 567 QCopEnvelope e(channel, "writeMail(QMap(QString,QString))");
568 e << parameterMap; 568 e << parameterMap;
569#else 569#else
570 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); 570 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
571#endif 571#endif
572 572
573 573
574} 574}
575 575
576/** 576/**
577 Beams the "WhoAmI contact. 577 Beams the "WhoAmI contact.
578*/ 578*/
579void KABCore::beamMySelf() 579void KABCore::beamMySelf()
580{ 580{
581 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 581 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
582 if (!a.isEmpty()) 582 if (!a.isEmpty())
583 { 583 {
584 QStringList uids; 584 QStringList uids;
585 uids << a.uid(); 585 uids << a.uid();
586 586
587 beamVCard(uids); 587 beamVCard(uids);
588 } else {
589 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
590
591
588 } 592 }
589} 593}
590 594
591void KABCore::beamVCard() 595void KABCore::beamVCard()
592{ 596{
593 QStringList uids = mViewManager->selectedUids(); 597 QStringList uids = mViewManager->selectedUids();
594 if ( !uids.isEmpty() ) 598 if ( !uids.isEmpty() )
595 beamVCard( uids ); 599 beamVCard( uids );
596} 600}
597 601
598 602
599void KABCore::beamVCard(const QStringList& uids) 603void KABCore::beamVCard(const QStringList& uids)
600{ 604{
601/*US 605/*US
602 QString beamFilename; 606 QString beamFilename;
603 Opie::OPimContact c; 607 Opie::OPimContact c;
604 if ( actionPersonal->isOn() ) { 608 if ( actionPersonal->isOn() ) {
605 beamFilename = addressbookPersonalVCardName(); 609 beamFilename = addressbookPersonalVCardName();
606 if ( !QFile::exists( beamFilename ) ) 610 if ( !QFile::exists( beamFilename ) )
607 return; // can't beam a non-existent file 611 return; // can't beam a non-existent file
608 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 612 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
609 beamFilename ); 613 beamFilename );
610 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 614 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
611 Opie::OPimContactAccess::List allList = access->allRecords(); 615 Opie::OPimContactAccess::List allList = access->allRecords();
612 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 616 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
613 c = *it; 617 c = *it;
614 618
615 delete access; 619 delete access;
616 } else { 620 } else {
617 unlink( beamfile ); // delete if exists 621 unlink( beamfile ); // delete if exists
618 mkdir("/tmp/obex/", 0755); 622 mkdir("/tmp/obex/", 0755);
619 c = m_abView -> currentEntry(); 623 c = m_abView -> currentEntry();
620 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 624 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
621 beamfile ); 625 beamfile );
622 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 626 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
623 access->add( c ); 627 access->add( c );
624 access->save(); 628 access->save();
625 delete access; 629 delete access;
626 630
627 beamFilename = beamfile; 631 beamFilename = beamfile;
628 } 632 }
629 633
630 owarn << "Beaming: " << beamFilename << oendl; 634 owarn << "Beaming: " << beamFilename << oendl;
631*/ 635*/
636
637#if 0
632 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 638 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
633 639
634 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 640 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
635 641
636 QString name = "contact.vcf"; 642 QString name = "contact.vcf";
637 643
638 QString fileName = dirName + "/" + name; 644 QString fileName = dirName + "/" + name;
645#endif
646 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
647 //
648 QString fileName = "/tmp/kdepimbeamfile";
639 649
640 650
641 QDir().mkdir( dirName, true ); 651 //QDir().mkdir( dirName, true );
642 652
643 QFile outFile(fileName); 653 QFile outFile(fileName);
644 KABC::VCardConverter converter; 654 KABC::VCardConverter converter;
645 QString description; 655 QString description;
646 656
647 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 657 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
648 658
649 QTextStream t( &outFile ); // use a text stream 659 QTextStream t( &outFile ); // use a text stream
650 t.setEncoding( QTextStream::UnicodeUTF8 ); 660 t.setEncoding( QTextStream::UnicodeUTF8 );
651 661
652 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 662 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
653 KABC::Addressee a = mAddressBook->findByUid( *it ); 663 KABC::Addressee a = mAddressBook->findByUid( *it );
654 664
655 if ( a.isEmpty() ) 665 if ( a.isEmpty() )
656 continue; 666 continue;
657 667
658 if (description.isEmpty()) 668 if (description.isEmpty())
659 description = a.formattedName(); 669 description = a.formattedName();
660 670
661 QString vcard; 671 QString vcard;
662 converter.addresseeToVCard( a, vcard ); 672 converter.addresseeToVCard( a, vcard );
663 t << vcard; 673 t << vcard;
664 674
665 } 675 }
676 } else {
677 qDebug("Error open temp beam file ");
678 return;
666 } 679 }
667 680
668 outFile.close(); 681 outFile.close();
669 682
683#ifndef DESKTOP_VERSION
670 Ir *ir = new Ir( this ); 684 Ir *ir = new Ir( this );
671 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 685 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
672 ir->send( fileName, description, "text/x-vCard" ); 686 ir->send( fileName, description, "text/x-vCard" );
687#endif
673 688
674} 689}
675 690
676void KABCore::beamDone( Ir *ir ) 691void KABCore::beamDone( Ir *ir )
677{ 692{
693#ifndef DESKTOP_VERSION
678 delete ir; 694 delete ir;
695#endif
679} 696}
680 697
681 698
682void KABCore::browse( const QString& url ) 699void KABCore::browse( const QString& url )
683{ 700{
684#ifndef KAB_EMBEDDED 701#ifndef KAB_EMBEDDED
685 kapp->invokeBrowser( url ); 702 kapp->invokeBrowser( url );
686#else //KAB_EMBEDDED 703#else //KAB_EMBEDDED
687 qDebug("KABCore::browse must be fixed"); 704 qDebug("KABCore::browse must be fixed");
688#endif //KAB_EMBEDDED 705#endif //KAB_EMBEDDED
689} 706}
690 707
691void KABCore::selectAllContacts() 708void KABCore::selectAllContacts()
692{ 709{
693 mViewManager->setSelected( QString::null, true ); 710 mViewManager->setSelected( QString::null, true );
694} 711}
695 712
696void KABCore::deleteContacts() 713void KABCore::deleteContacts()
697{ 714{
698 QStringList uidList = mViewManager->selectedUids(); 715 QStringList uidList = mViewManager->selectedUids();
699 deleteContacts( uidList ); 716 deleteContacts( uidList );
700} 717}
701 718
702void KABCore::deleteContacts( const QStringList &uids ) 719void KABCore::deleteContacts( const QStringList &uids )
703{ 720{
704 if ( uids.count() > 0 ) { 721 if ( uids.count() > 0 ) {
705 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 722 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
706 UndoStack::instance()->push( command ); 723 UndoStack::instance()->push( command );
707 RedoStack::instance()->clear(); 724 RedoStack::instance()->clear();
708 725
709 // now if we deleted anything, refresh 726 // now if we deleted anything, refresh
710 setContactSelected( QString::null ); 727 setContactSelected( QString::null );
711 setModified( true ); 728 setModified( true );
712 } 729 }
713} 730}
714 731
715void KABCore::copyContacts() 732void KABCore::copyContacts()
716{ 733{
717 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 734 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
718 735
719 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 736 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
720 737
721 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 738 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
722 739
723 QClipboard *cb = QApplication::clipboard(); 740 QClipboard *cb = QApplication::clipboard();
724 cb->setText( clipText ); 741 cb->setText( clipText );
725} 742}
726 743
727void KABCore::cutContacts() 744void KABCore::cutContacts()
728{ 745{
729 QStringList uidList = mViewManager->selectedUids(); 746 QStringList uidList = mViewManager->selectedUids();
730 747
731//US if ( uidList.size() > 0 ) { 748//US if ( uidList.size() > 0 ) {
732 if ( uidList.count() > 0 ) { 749 if ( uidList.count() > 0 ) {
733 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 750 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
734 UndoStack::instance()->push( command ); 751 UndoStack::instance()->push( command );
735 RedoStack::instance()->clear(); 752 RedoStack::instance()->clear();
736 753
737 setModified( true ); 754 setModified( true );
738 } 755 }
739} 756}
740 757
741void KABCore::pasteContacts() 758void KABCore::pasteContacts()
742{ 759{
743 QClipboard *cb = QApplication::clipboard(); 760 QClipboard *cb = QApplication::clipboard();
744 761
745 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 762 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
746 763
747 pasteContacts( list ); 764 pasteContacts( list );
748} 765}
749 766
750void KABCore::pasteContacts( KABC::Addressee::List &list ) 767void KABCore::pasteContacts( KABC::Addressee::List &list )
751{ 768{
752 KABC::Resource *resource = requestResource( this ); 769 KABC::Resource *resource = requestResource( this );
753 KABC::Addressee::List::Iterator it; 770 KABC::Addressee::List::Iterator it;
754 for ( it = list.begin(); it != list.end(); ++it ) 771 for ( it = list.begin(); it != list.end(); ++it )
755 (*it).setResource( resource ); 772 (*it).setResource( resource );
756 773
757 PwPasteCommand *command = new PwPasteCommand( this, list ); 774 PwPasteCommand *command = new PwPasteCommand( this, list );
758 UndoStack::instance()->push( command ); 775 UndoStack::instance()->push( command );
759 RedoStack::instance()->clear(); 776 RedoStack::instance()->clear();
760 777
761 setModified( true ); 778 setModified( true );
762} 779}
763 780
764void KABCore::setWhoAmI() 781void KABCore::setWhoAmI()
765{ 782{
766 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 783 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
767 784
768 if ( addrList.count() > 1 ) { 785 if ( addrList.count() > 1 ) {
769 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 786 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
770 return; 787 return;
771 } 788 }
772 789
773 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 790 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
774 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 791 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
775 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 792 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
776} 793}
777 794
778void KABCore::setCategories() 795void KABCore::setCategories()
779{ 796{
780 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 797 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
781 if ( !dlg.exec() ) 798 if ( !dlg.exec() )
782 return; 799 return;
783 800
784 bool merge = false; 801 bool merge = false;
785 QString msg = i18n( "Merge with existing categories?" ); 802 QString msg = i18n( "Merge with existing categories?" );
786 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 803 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
787 merge = true; 804 merge = true;
788 805
789 QStringList categories = dlg.selectedCategories(); 806 QStringList categories = dlg.selectedCategories();
790 807
791 QStringList uids = mViewManager->selectedUids(); 808 QStringList uids = mViewManager->selectedUids();
792 QStringList::Iterator it; 809 QStringList::Iterator it;
793 for ( it = uids.begin(); it != uids.end(); ++it ) { 810 for ( it = uids.begin(); it != uids.end(); ++it ) {
794 KABC::Addressee addr = mAddressBook->findByUid( *it ); 811 KABC::Addressee addr = mAddressBook->findByUid( *it );
795 if ( !addr.isEmpty() ) { 812 if ( !addr.isEmpty() ) {
796 if ( !merge ) 813 if ( !merge )
797 addr.setCategories( categories ); 814 addr.setCategories( categories );
798 else { 815 else {
799 QStringList addrCategories = addr.categories(); 816 QStringList addrCategories = addr.categories();
800 QStringList::Iterator catIt; 817 QStringList::Iterator catIt;
801 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 818 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
802 if ( !addrCategories.contains( *catIt ) ) 819 if ( !addrCategories.contains( *catIt ) )
803 addrCategories.append( *catIt ); 820 addrCategories.append( *catIt );
804 } 821 }
805 addr.setCategories( addrCategories ); 822 addr.setCategories( addrCategories );
806 } 823 }
807 824
808 mAddressBook->insertAddressee( addr ); 825 mAddressBook->insertAddressee( addr );
809 } 826 }
810 } 827 }
811 828
812 if ( uids.count() > 0 ) 829 if ( uids.count() > 0 )
813 setModified( true ); 830 setModified( true );
814} 831}
815 832
816void KABCore::setSearchFields( const KABC::Field::List &fields ) 833void KABCore::setSearchFields( const KABC::Field::List &fields )
817{ 834{
818 mIncSearchWidget->setFields( fields ); 835 mIncSearchWidget->setFields( fields );
819} 836}
820 837
821void KABCore::incrementalSearch( const QString& text ) 838void KABCore::incrementalSearch( const QString& text )
822{ 839{
823 mViewManager->setSelected( QString::null, false ); 840 mViewManager->setSelected( QString::null, false );
824 841
825 if ( !text.isEmpty() ) { 842 if ( !text.isEmpty() ) {
826 KABC::Field *field = mIncSearchWidget->currentField(); 843 KABC::Field *field = mIncSearchWidget->currentField();
827 844
828 QString pattern = text.lower(); 845 QString pattern = text.lower();
829 846
830#if 1 //KDE_VERSION >= 319 847#if 1 //KDE_VERSION >= 319
831 KABC::AddresseeList list( mAddressBook->allAddressees() ); 848 KABC::AddresseeList list( mAddressBook->allAddressees() );
832 if ( field ) { 849 if ( field ) {
833 list.sortByField( field ); 850 list.sortByField( field );
834 KABC::AddresseeList::Iterator it; 851 KABC::AddresseeList::Iterator it;
835 for ( it = list.begin(); it != list.end(); ++it ) { 852 for ( it = list.begin(); it != list.end(); ++it ) {
836 if ( field->value( *it ).lower().startsWith( pattern ) ) { 853 if ( field->value( *it ).lower().startsWith( pattern ) ) {
837 mViewManager->setSelected( (*it).uid(), true ); 854 mViewManager->setSelected( (*it).uid(), true );
838 return; 855 return;
839 } 856 }
840 } 857 }
841 } else { 858 } else {
842 KABC::AddresseeList::Iterator it; 859 KABC::AddresseeList::Iterator it;
843 for ( it = list.begin(); it != list.end(); ++it ) { 860 for ( it = list.begin(); it != list.end(); ++it ) {
844 KABC::Field::List fieldList = mIncSearchWidget->fields(); 861 KABC::Field::List fieldList = mIncSearchWidget->fields();
845 KABC::Field::List::ConstIterator fieldIt; 862 KABC::Field::List::ConstIterator fieldIt;
846 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 863 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
847 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 864 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
848 mViewManager->setSelected( (*it).uid(), true ); 865 mViewManager->setSelected( (*it).uid(), true );
849 return; 866 return;
850 } 867 }
851 } 868 }
852 } 869 }
853 } 870 }
854#else 871#else
855 KABC::AddressBook::Iterator it; 872 KABC::AddressBook::Iterator it;
856 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 873 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
857 if ( field ) { 874 if ( field ) {
858 if ( field->value( *it ).lower().startsWith( pattern ) ) { 875 if ( field->value( *it ).lower().startsWith( pattern ) ) {
859 mViewManager->setSelected( (*it).uid(), true ); 876 mViewManager->setSelected( (*it).uid(), true );
860 return; 877 return;
861 } 878 }
862 } else { 879 } else {
863 KABC::Field::List fieldList = mIncSearchWidget->fields(); 880 KABC::Field::List fieldList = mIncSearchWidget->fields();
864 KABC::Field::List::ConstIterator fieldIt; 881 KABC::Field::List::ConstIterator fieldIt;
865 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 882 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
866 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 883 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
867 mViewManager->setSelected( (*it).uid(), true ); 884 mViewManager->setSelected( (*it).uid(), true );
868 return; 885 return;
869 } 886 }
870 } 887 }
@@ -1301,553 +1318,557 @@ void KABCore::slotEditorDestroyed( const QString &uid )
1301 1318
1302void KABCore::initGUI() 1319void KABCore::initGUI()
1303{ 1320{
1304#ifndef KAB_EMBEDDED 1321#ifndef KAB_EMBEDDED
1305 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1322 QHBoxLayout *topLayout = new QHBoxLayout( this );
1306 topLayout->setSpacing( KDialogBase::spacingHint() ); 1323 topLayout->setSpacing( KDialogBase::spacingHint() );
1307 1324
1308 mExtensionBarSplitter = new QSplitter( this ); 1325 mExtensionBarSplitter = new QSplitter( this );
1309 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1326 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1310 1327
1311 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1328 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1312 1329
1313 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1330 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1314 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1331 mIncSearchWidget = new IncSearchWidget( viewSpace );
1315 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1332 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1316 SLOT( incrementalSearch( const QString& ) ) ); 1333 SLOT( incrementalSearch( const QString& ) ) );
1317 1334
1318 mViewManager = new ViewManager( this, viewSpace ); 1335 mViewManager = new ViewManager( this, viewSpace );
1319 viewSpace->setStretchFactor( mViewManager, 1 ); 1336 viewSpace->setStretchFactor( mViewManager, 1 );
1320 1337
1321 mDetails = new ViewContainer( mDetailsSplitter ); 1338 mDetails = new ViewContainer( mDetailsSplitter );
1322 1339
1323 mJumpButtonBar = new JumpButtonBar( this, this ); 1340 mJumpButtonBar = new JumpButtonBar( this, this );
1324 1341
1325 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1342 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1326 1343
1327 topLayout->addWidget( mExtensionBarSplitter ); 1344 topLayout->addWidget( mExtensionBarSplitter );
1328 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1345 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1329 topLayout->addWidget( mJumpButtonBar ); 1346 topLayout->addWidget( mJumpButtonBar );
1330 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1347 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1331 1348
1332 mXXPortManager = new XXPortManager( this, this ); 1349 mXXPortManager = new XXPortManager( this, this );
1333 1350
1334#else //KAB_EMBEDDED 1351#else //KAB_EMBEDDED
1335 //US initialize viewMenu before settingup viewmanager. 1352 //US initialize viewMenu before settingup viewmanager.
1336 // Viewmanager needs this menu to plugin submenues. 1353 // Viewmanager needs this menu to plugin submenues.
1337 viewMenu = new QPopupMenu( this ); 1354 viewMenu = new QPopupMenu( this );
1338 settingsMenu = new QPopupMenu( this ); 1355 settingsMenu = new QPopupMenu( this );
1339 //filterMenu = new QPopupMenu( this ); 1356 //filterMenu = new QPopupMenu( this );
1340 ImportMenu = new QPopupMenu( this ); 1357 ImportMenu = new QPopupMenu( this );
1341 ExportMenu = new QPopupMenu( this ); 1358 ExportMenu = new QPopupMenu( this );
1342 1359
1343 changeMenu= new QPopupMenu( this ); 1360 changeMenu= new QPopupMenu( this );
1344 1361
1345//US since we have no splitter for the embedded system, setup 1362//US since we have no splitter for the embedded system, setup
1346// a layout with two frames. One left and one right. 1363// a layout with two frames. One left and one right.
1347 1364
1348 QBoxLayout *topLayout; 1365 QBoxLayout *topLayout;
1349 1366
1350 // = new QHBoxLayout( this ); 1367 // = new QHBoxLayout( this );
1351// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1368// QBoxLayout *topLayout = (QBoxLayout*)layout();
1352 1369
1353// QWidget *mainBox = new QWidget( this ); 1370// QWidget *mainBox = new QWidget( this );
1354// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1371// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1355 1372
1356#ifdef DESKTOP_VERSION 1373#ifdef DESKTOP_VERSION
1357 topLayout = new QHBoxLayout( this ); 1374 topLayout = new QHBoxLayout( this );
1358 1375
1359 1376
1360 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1377 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1361 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1378 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1362 1379
1363 topLayout->addWidget(mMiniSplitter ); 1380 topLayout->addWidget(mMiniSplitter );
1364 1381
1365 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1382 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1366 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1383 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1367 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1384 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1368 mDetails = new ViewContainer( mMiniSplitter ); 1385 mDetails = new ViewContainer( mMiniSplitter );
1369 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1386 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1370#else 1387#else
1371 if ( QApplication::desktop()->width() > 480 ) { 1388 if ( QApplication::desktop()->width() > 480 ) {
1372 topLayout = new QHBoxLayout( this ); 1389 topLayout = new QHBoxLayout( this );
1373 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1390 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1374 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1391 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1375 } else { 1392 } else {
1376 1393
1377 topLayout = new QHBoxLayout( this ); 1394 topLayout = new QHBoxLayout( this );
1378 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1395 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1379 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1396 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1380 } 1397 }
1381 1398
1382 topLayout->addWidget(mMiniSplitter ); 1399 topLayout->addWidget(mMiniSplitter );
1383 mViewManager = new ViewManager( this, mMiniSplitter ); 1400 mViewManager = new ViewManager( this, mMiniSplitter );
1384 mDetails = new ViewContainer( mMiniSplitter ); 1401 mDetails = new ViewContainer( mMiniSplitter );
1385 1402
1386 1403
1387 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1404 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1388#endif 1405#endif
1389 //eh->hide(); 1406 //eh->hide();
1390 // topLayout->addWidget(mExtensionManager ); 1407 // topLayout->addWidget(mExtensionManager );
1391 1408
1392 1409
1393/*US 1410/*US
1394#ifndef KAB_NOSPLITTER 1411#ifndef KAB_NOSPLITTER
1395 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1412 QHBoxLayout *topLayout = new QHBoxLayout( this );
1396//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1413//US topLayout->setSpacing( KDialogBase::spacingHint() );
1397 topLayout->setSpacing( 10 ); 1414 topLayout->setSpacing( 10 );
1398 1415
1399 mDetailsSplitter = new QSplitter( this ); 1416 mDetailsSplitter = new QSplitter( this );
1400 1417
1401 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1418 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1402 1419
1403 mViewManager = new ViewManager( this, viewSpace ); 1420 mViewManager = new ViewManager( this, viewSpace );
1404 viewSpace->setStretchFactor( mViewManager, 1 ); 1421 viewSpace->setStretchFactor( mViewManager, 1 );
1405 1422
1406 mDetails = new ViewContainer( mDetailsSplitter ); 1423 mDetails = new ViewContainer( mDetailsSplitter );
1407 1424
1408 topLayout->addWidget( mDetailsSplitter ); 1425 topLayout->addWidget( mDetailsSplitter );
1409 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1426 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1410#else //KAB_NOSPLITTER 1427#else //KAB_NOSPLITTER
1411 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1428 QHBoxLayout *topLayout = new QHBoxLayout( this );
1412//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1429//US topLayout->setSpacing( KDialogBase::spacingHint() );
1413 topLayout->setSpacing( 10 ); 1430 topLayout->setSpacing( 10 );
1414 1431
1415// mDetailsSplitter = new QSplitter( this ); 1432// mDetailsSplitter = new QSplitter( this );
1416 1433
1417 QVBox *viewSpace = new QVBox( this ); 1434 QVBox *viewSpace = new QVBox( this );
1418 1435
1419 mViewManager = new ViewManager( this, viewSpace ); 1436 mViewManager = new ViewManager( this, viewSpace );
1420 viewSpace->setStretchFactor( mViewManager, 1 ); 1437 viewSpace->setStretchFactor( mViewManager, 1 );
1421 1438
1422 mDetails = new ViewContainer( this ); 1439 mDetails = new ViewContainer( this );
1423 1440
1424 topLayout->addWidget( viewSpace ); 1441 topLayout->addWidget( viewSpace );
1425// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1442// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1426 topLayout->addWidget( mDetails ); 1443 topLayout->addWidget( mDetails );
1427#endif //KAB_NOSPLITTER 1444#endif //KAB_NOSPLITTER
1428*/ 1445*/
1429 1446
1430 1447
1431#endif //KAB_EMBEDDED 1448#endif //KAB_EMBEDDED
1432 initActions(); 1449 initActions();
1433 1450
1434#ifdef KAB_EMBEDDED 1451#ifdef KAB_EMBEDDED
1435 addActionsManually(); 1452 addActionsManually();
1436 //US make sure the export and import menues are initialized before creating the xxPortManager. 1453 //US make sure the export and import menues are initialized before creating the xxPortManager.
1437 mXXPortManager = new XXPortManager( this, this ); 1454 mXXPortManager = new XXPortManager( this, this );
1438 1455
1439 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1456 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1440 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1457 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1441 // mActionQuit->plug ( mMainWindow->toolBar()); 1458 // mActionQuit->plug ( mMainWindow->toolBar());
1442 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1459 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1443 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1460 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1444 // mIncSearchWidget->hide(); 1461 // mIncSearchWidget->hide();
1445 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1462 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1446 SLOT( incrementalSearch( const QString& ) ) ); 1463 SLOT( incrementalSearch( const QString& ) ) );
1447 1464
1448 1465
1449 mJumpButtonBar = new JumpButtonBar( this, this ); 1466 mJumpButtonBar = new JumpButtonBar( this, this );
1450 1467
1451 topLayout->addWidget( mJumpButtonBar ); 1468 topLayout->addWidget( mJumpButtonBar );
1452//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1469//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1453 1470
1454// mMainWindow->getIconToolBar()->raise(); 1471// mMainWindow->getIconToolBar()->raise();
1455 1472
1456#endif //KAB_EMBEDDED 1473#endif //KAB_EMBEDDED
1457 1474
1458} 1475}
1459void KABCore::initActions() 1476void KABCore::initActions()
1460{ 1477{
1461//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1478//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1462 1479
1463#ifndef KAB_EMBEDDED 1480#ifndef KAB_EMBEDDED
1464 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1481 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1465 SLOT( clipboardDataChanged() ) ); 1482 SLOT( clipboardDataChanged() ) );
1466#endif //KAB_EMBEDDED 1483#endif //KAB_EMBEDDED
1467 1484
1468 // file menu 1485 // file menu
1469 if ( mIsPart ) { 1486 if ( mIsPart ) {
1470 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1487 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1471 SLOT( sendMail() ), actionCollection(), 1488 SLOT( sendMail() ), actionCollection(),
1472 "kaddressbook_mail" ); 1489 "kaddressbook_mail" );
1473 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1490 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1474 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1491 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1475 1492
1476 } else { 1493 } else {
1477 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1494 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1478 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1495 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1479 } 1496 }
1480 1497
1481 1498
1482 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1499 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1483 SLOT( save() ), actionCollection(), "file_sync" ); 1500 SLOT( save() ), actionCollection(), "file_sync" );
1484 1501
1485 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1502 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1486 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1503 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1487 1504
1488 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1505 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1489 this, SLOT( mailVCard() ), 1506 this, SLOT( mailVCard() ),
1490 actionCollection(), "file_mail_vcard"); 1507 actionCollection(), "file_mail_vcard");
1491 1508
1492 mActionBeamVCard = 0; 1509 mActionBeamVCard = 0;
1510 mActionBeam = 0;
1511
1512#ifndef DESKTOP_VERSION
1493 if ( Ir::supported() ) { 1513 if ( Ir::supported() ) {
1494 mActionBeamVCard = new KAction( i18n( "Beam v&Card" ), "beam", 0, this, 1514 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1495 SLOT( beamVCard() ), actionCollection(), 1515 SLOT( beamVCard() ), actionCollection(),
1496 "kaddressbook_beam_vcard" ); 1516 "kaddressbook_beam_vcard" );
1517
1518 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1519 SLOT( beamMySelf() ), actionCollection(),
1520 "kaddressbook_beam_myself" );
1497 } 1521 }
1498 1522#endif
1499 1523
1500 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1524 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1501 this, SLOT( editContact2() ), 1525 this, SLOT( editContact2() ),
1502 actionCollection(), "file_properties" ); 1526 actionCollection(), "file_properties" );
1503 1527
1504#ifdef KAB_EMBEDDED 1528#ifdef KAB_EMBEDDED
1505 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1529 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1506 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1530 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1507 mMainWindow, SLOT( exit() ), 1531 mMainWindow, SLOT( exit() ),
1508 actionCollection(), "quit" ); 1532 actionCollection(), "quit" );
1509#endif //KAB_EMBEDDED 1533#endif //KAB_EMBEDDED
1510 1534
1511 // edit menu 1535 // edit menu
1512 if ( mIsPart ) { 1536 if ( mIsPart ) {
1513 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1537 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1514 SLOT( copyContacts() ), actionCollection(), 1538 SLOT( copyContacts() ), actionCollection(),
1515 "kaddressbook_copy" ); 1539 "kaddressbook_copy" );
1516 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1540 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1517 SLOT( cutContacts() ), actionCollection(), 1541 SLOT( cutContacts() ), actionCollection(),
1518 "kaddressbook_cut" ); 1542 "kaddressbook_cut" );
1519 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1543 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1520 SLOT( pasteContacts() ), actionCollection(), 1544 SLOT( pasteContacts() ), actionCollection(),
1521 "kaddressbook_paste" ); 1545 "kaddressbook_paste" );
1522 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1546 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1523 SLOT( selectAllContacts() ), actionCollection(), 1547 SLOT( selectAllContacts() ), actionCollection(),
1524 "kaddressbook_select_all" ); 1548 "kaddressbook_select_all" );
1525 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1549 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1526 SLOT( undo() ), actionCollection(), 1550 SLOT( undo() ), actionCollection(),
1527 "kaddressbook_undo" ); 1551 "kaddressbook_undo" );
1528 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1552 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1529 this, SLOT( redo() ), actionCollection(), 1553 this, SLOT( redo() ), actionCollection(),
1530 "kaddressbook_redo" ); 1554 "kaddressbook_redo" );
1531 } else { 1555 } else {
1532 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1556 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1533 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1557 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1534 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1558 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1535 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1559 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1536 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1560 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1537 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1561 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1538 } 1562 }
1539 1563
1540 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1564 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1541 Key_Delete, this, SLOT( deleteContacts() ), 1565 Key_Delete, this, SLOT( deleteContacts() ),
1542 actionCollection(), "edit_delete" ); 1566 actionCollection(), "edit_delete" );
1543 1567
1544 mActionUndo->setEnabled( false ); 1568 mActionUndo->setEnabled( false );
1545 mActionRedo->setEnabled( false ); 1569 mActionRedo->setEnabled( false );
1546 1570
1547 // settings menu 1571 // settings menu
1548#ifdef KAB_EMBEDDED 1572#ifdef KAB_EMBEDDED
1549//US special menuentry to configure the addressbook resources. On KDE 1573//US special menuentry to configure the addressbook resources. On KDE
1550// you do that through the control center !!! 1574// you do that through the control center !!!
1551 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1575 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1552 SLOT( configureResources() ), actionCollection(), 1576 SLOT( configureResources() ), actionCollection(),
1553 "kaddressbook_configure_resources" ); 1577 "kaddressbook_configure_resources" );
1554#endif //KAB_EMBEDDED 1578#endif //KAB_EMBEDDED
1555 1579
1556 if ( mIsPart ) { 1580 if ( mIsPart ) {
1557 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1581 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1558 SLOT( openConfigDialog() ), actionCollection(), 1582 SLOT( openConfigDialog() ), actionCollection(),
1559 "kaddressbook_configure" ); 1583 "kaddressbook_configure" );
1560 1584
1561 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1585 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1562 this, SLOT( configureKeyBindings() ), actionCollection(), 1586 this, SLOT( configureKeyBindings() ), actionCollection(),
1563 "kaddressbook_configure_shortcuts" ); 1587 "kaddressbook_configure_shortcuts" );
1564#ifdef KAB_EMBEDDED 1588#ifdef KAB_EMBEDDED
1565 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1589 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1566 mActionConfigureToolbars->setEnabled( false ); 1590 mActionConfigureToolbars->setEnabled( false );
1567#endif //KAB_EMBEDDED 1591#endif //KAB_EMBEDDED
1568 1592
1569 } else { 1593 } else {
1570 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1594 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1571 1595
1572 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1596 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1573 } 1597 }
1574 1598
1575 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1599 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1576 actionCollection(), "options_show_jump_bar" ); 1600 actionCollection(), "options_show_jump_bar" );
1577 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1601 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1578 1602
1579 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1603 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1580 actionCollection(), "options_show_details" ); 1604 actionCollection(), "options_show_details" );
1581 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1605 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1582 1606
1583 // misc 1607 // misc
1584 // only enable LDAP lookup if we can handle the protocol 1608 // only enable LDAP lookup if we can handle the protocol
1585#ifndef KAB_EMBEDDED 1609#ifndef KAB_EMBEDDED
1586 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1610 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1587 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1611 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1588 this, SLOT( openLDAPDialog() ), actionCollection(), 1612 this, SLOT( openLDAPDialog() ), actionCollection(),
1589 "ldap_lookup" ); 1613 "ldap_lookup" );
1590 } 1614 }
1591#else //KAB_EMBEDDED 1615#else //KAB_EMBEDDED
1592 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1616 //qDebug("KABCore::initActions() LDAP has to be implemented");
1593#endif //KAB_EMBEDDED 1617#endif //KAB_EMBEDDED
1594 1618
1595 1619
1596 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1620 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1597 SLOT( setWhoAmI() ), actionCollection(), 1621 SLOT( setWhoAmI() ), actionCollection(),
1598 "set_personal" ); 1622 "set_personal" );
1599 1623
1600 mActionBeam = 0; 1624
1601 if ( Ir::supported() ) {
1602 mActionBeam = new KAction( i18n( "&Beam Who Am I" ), "beam", 0, this,
1603 SLOT( beamMySelf() ), actionCollection(),
1604 "kaddressbook_beam_myself" );
1605 }
1606 1625
1607 1626
1608 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1627 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1609 SLOT( setCategories() ), actionCollection(), 1628 SLOT( setCategories() ), actionCollection(),
1610 "edit_set_categories" ); 1629 "edit_set_categories" );
1611 1630
1612 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1631 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1613 SLOT( removeVoice() ), actionCollection(), 1632 SLOT( removeVoice() ), actionCollection(),
1614 "remove_voice" ); 1633 "remove_voice" );
1615 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, 1634 mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
1616 SLOT( importFromOL() ), actionCollection(), 1635 SLOT( importFromOL() ), actionCollection(),
1617 "import_OL" ); 1636 "import_OL" );
1618#ifdef KAB_EMBEDDED 1637#ifdef KAB_EMBEDDED
1619 1638
1620 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1639 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1621 this, SLOT( createAboutData() ), actionCollection(), 1640 this, SLOT( createAboutData() ), actionCollection(),
1622 "kaddressbook_about_data" ); 1641 "kaddressbook_about_data" );
1623#endif //KAB_EMBEDDED 1642#endif //KAB_EMBEDDED
1624 1643
1625 clipboardDataChanged(); 1644 clipboardDataChanged();
1626 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1645 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1627 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1646 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1628} 1647}
1629 1648
1630//US we need this function, to plug all actions into the correct menues. 1649//US we need this function, to plug all actions into the correct menues.
1631// KDE uses a XML format to plug the actions, but we work her without this overhead. 1650// KDE uses a XML format to plug the actions, but we work her without this overhead.
1632void KABCore::addActionsManually() 1651void KABCore::addActionsManually()
1633{ 1652{
1634//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1653//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1635 1654
1636#ifdef KAB_EMBEDDED 1655#ifdef KAB_EMBEDDED
1637 QPopupMenu *fileMenu = new QPopupMenu( this ); 1656 QPopupMenu *fileMenu = new QPopupMenu( this );
1638 QPopupMenu *editMenu = new QPopupMenu( this ); 1657 QPopupMenu *editMenu = new QPopupMenu( this );
1639 QPopupMenu *helpMenu = new QPopupMenu( this ); 1658 QPopupMenu *helpMenu = new QPopupMenu( this );
1640 1659
1641 KToolBar* tb = mMainWindow->toolBar(); 1660 KToolBar* tb = mMainWindow->toolBar();
1642 1661
1643#ifdef DESKTOP_VERSION 1662#ifdef DESKTOP_VERSION
1644 QMenuBar* mb = mMainWindow->menuBar(); 1663 QMenuBar* mb = mMainWindow->menuBar();
1645 1664
1646 //US setup menubar. 1665 //US setup menubar.
1647 //Disable the following block if you do not want to have a menubar. 1666 //Disable the following block if you do not want to have a menubar.
1648 mb->insertItem( "&File", fileMenu ); 1667 mb->insertItem( "&File", fileMenu );
1649 mb->insertItem( "&Edit", editMenu ); 1668 mb->insertItem( "&Edit", editMenu );
1650 mb->insertItem( "&View", viewMenu ); 1669 mb->insertItem( "&View", viewMenu );
1651 mb->insertItem( "&Settings", settingsMenu ); 1670 mb->insertItem( "&Settings", settingsMenu );
1652 mb->insertItem( "&Change selected", changeMenu ); 1671 mb->insertItem( "&Change selected", changeMenu );
1653 mb->insertItem( "&Help", helpMenu ); 1672 mb->insertItem( "&Help", helpMenu );
1654 mIncSearchWidget = new IncSearchWidget( tb ); 1673 mIncSearchWidget = new IncSearchWidget( tb );
1655 // tb->insertWidget(-1, 0, mIncSearchWidget); 1674 // tb->insertWidget(-1, 0, mIncSearchWidget);
1656 1675
1657#else 1676#else
1658 //US setup toolbar 1677 //US setup toolbar
1659 QMenuBar *menuBarTB = new QMenuBar( tb ); 1678 QMenuBar *menuBarTB = new QMenuBar( tb );
1660 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1679 QPopupMenu *popupBarTB = new QPopupMenu( this );
1661 menuBarTB->insertItem( "ME", popupBarTB); 1680 menuBarTB->insertItem( "ME", popupBarTB);
1662 tb->insertWidget(-1, 0, menuBarTB); 1681 tb->insertWidget(-1, 0, menuBarTB);
1663 mIncSearchWidget = new IncSearchWidget( tb ); 1682 mIncSearchWidget = new IncSearchWidget( tb );
1664 1683
1665 tb->enableMoving(false); 1684 tb->enableMoving(false);
1666 popupBarTB->insertItem( "&File", fileMenu ); 1685 popupBarTB->insertItem( "&File", fileMenu );
1667 popupBarTB->insertItem( "&Edit", editMenu ); 1686 popupBarTB->insertItem( "&Edit", editMenu );
1668 popupBarTB->insertItem( "&View", viewMenu ); 1687 popupBarTB->insertItem( "&View", viewMenu );
1669 popupBarTB->insertItem( "&Settings", settingsMenu ); 1688 popupBarTB->insertItem( "&Settings", settingsMenu );
1670 mViewManager->getFilterAction()->plug ( popupBarTB); 1689 mViewManager->getFilterAction()->plug ( popupBarTB);
1671 popupBarTB->insertItem( "&Change selected", changeMenu ); 1690 popupBarTB->insertItem( "&Change selected", changeMenu );
1672 popupBarTB->insertItem( "&Help", helpMenu ); 1691 popupBarTB->insertItem( "&Help", helpMenu );
1673 if (QApplication::desktop()->width() > 320 ) { 1692 if (QApplication::desktop()->width() > 320 ) {
1674 // mViewManager->getFilterAction()->plug ( tb); 1693 // mViewManager->getFilterAction()->plug ( tb);
1675 } 1694 }
1676#endif 1695#endif
1677 // mActionQuit->plug ( mMainWindow->toolBar()); 1696 // mActionQuit->plug ( mMainWindow->toolBar());
1678 1697
1679 1698
1680 1699
1681 //US Now connect the actions with the menue entries. 1700 //US Now connect the actions with the menue entries.
1682 mActionPrint->plug( fileMenu ); 1701 mActionPrint->plug( fileMenu );
1683 mActionMail->plug( fileMenu ); 1702 mActionMail->plug( fileMenu );
1684 fileMenu->insertSeparator(); 1703 fileMenu->insertSeparator();
1685 1704
1686 mActionNewContact->plug( fileMenu ); 1705 mActionNewContact->plug( fileMenu );
1687 mActionNewContact->plug( tb ); 1706 mActionNewContact->plug( tb );
1688 1707
1689 mActionEditAddressee->plug( fileMenu ); 1708 mActionEditAddressee->plug( fileMenu );
1690 fileMenu->insertSeparator(); 1709 fileMenu->insertSeparator();
1691 mActionSave->plug( fileMenu ); 1710 mActionSave->plug( fileMenu );
1692 fileMenu->insertItem( "&Import", ImportMenu ); 1711 fileMenu->insertItem( "&Import", ImportMenu );
1693 fileMenu->insertItem( "&Emport", ExportMenu ); 1712 fileMenu->insertItem( "&Emport", ExportMenu );
1694 fileMenu->insertSeparator(); 1713 fileMenu->insertSeparator();
1695 mActionMailVCard->plug( fileMenu ); 1714 mActionMailVCard->plug( fileMenu );
1715#ifndef DESKTOP_VERSION
1696 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1716 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1717 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1718#endif
1697 fileMenu->insertSeparator(); 1719 fileMenu->insertSeparator();
1698 mActionQuit->plug( fileMenu ); 1720 mActionQuit->plug( fileMenu );
1699#ifdef _WIN32_ 1721#ifdef _WIN32_
1700 mActionImportOL->plug( ImportMenu ); 1722 mActionImportOL->plug( ImportMenu );
1701#endif 1723#endif
1702 // edit menu 1724 // edit menu
1703 mActionUndo->plug( editMenu ); 1725 mActionUndo->plug( editMenu );
1704 mActionRedo->plug( editMenu ); 1726 mActionRedo->plug( editMenu );
1705 editMenu->insertSeparator(); 1727 editMenu->insertSeparator();
1706 mActionCut->plug( editMenu ); 1728 mActionCut->plug( editMenu );
1707 mActionCopy->plug( editMenu ); 1729 mActionCopy->plug( editMenu );
1708 mActionPaste->plug( editMenu ); 1730 mActionPaste->plug( editMenu );
1709 mActionDelete->plug( editMenu ); 1731 mActionDelete->plug( editMenu );
1710 editMenu->insertSeparator(); 1732 editMenu->insertSeparator();
1711 mActionSelectAll->plug( editMenu ); 1733 mActionSelectAll->plug( editMenu );
1712 1734
1713 mActionRemoveVoice->plug( changeMenu ); 1735 mActionRemoveVoice->plug( changeMenu );
1714 // settings menu 1736 // settings menu
1715//US special menuentry to configure the addressbook resources. On KDE 1737//US special menuentry to configure the addressbook resources. On KDE
1716// you do that through the control center !!! 1738// you do that through the control center !!!
1717 mActionConfigResources->plug( settingsMenu ); 1739 mActionConfigResources->plug( settingsMenu );
1718 settingsMenu->insertSeparator(); 1740 settingsMenu->insertSeparator();
1719 1741
1720 mActionConfigKAddressbook->plug( settingsMenu ); 1742 mActionConfigKAddressbook->plug( settingsMenu );
1721 1743
1722 if ( mIsPart ) { 1744 if ( mIsPart ) {
1723 mActionConfigShortcuts->plug( settingsMenu ); 1745 mActionConfigShortcuts->plug( settingsMenu );
1724 mActionConfigureToolbars->plug( settingsMenu ); 1746 mActionConfigureToolbars->plug( settingsMenu );
1725 1747
1726 } else { 1748 } else {
1727 mActionKeyBindings->plug( settingsMenu ); 1749 mActionKeyBindings->plug( settingsMenu );
1728 } 1750 }
1729 1751
1730 settingsMenu->insertSeparator(); 1752 settingsMenu->insertSeparator();
1731 1753
1732 mActionJumpBar->plug( settingsMenu ); 1754 mActionJumpBar->plug( settingsMenu );
1733 mActionDetails->plug( settingsMenu ); 1755 mActionDetails->plug( settingsMenu );
1734 settingsMenu->insertSeparator(); 1756 settingsMenu->insertSeparator();
1735 1757
1736 mActionWhoAmI->plug( settingsMenu ); 1758 mActionWhoAmI->plug( settingsMenu );
1737 if ( Ir::supported() ) mActionBeam->plug( settingsMenu );
1738 mActionCategories->plug( settingsMenu ); 1759 mActionCategories->plug( settingsMenu );
1739 1760
1740 mActionAboutKAddressbook->plug( helpMenu ); 1761 mActionAboutKAddressbook->plug( helpMenu );
1741 1762
1742 1763
1743 if (QApplication::desktop()->width() > 320 ) { 1764 if (QApplication::desktop()->width() > 320 ) {
1744 1765
1745 mActionEditAddressee->plug( tb ); 1766 mActionEditAddressee->plug( tb );
1746 mActionSave->plug( tb ); 1767 mActionSave->plug( tb );
1747 mViewManager->getFilterAction()->plug ( tb); 1768 mViewManager->getFilterAction()->plug ( tb);
1748 if (QApplication::desktop()->width() > 480 ) { 1769 if (QApplication::desktop()->width() > 480 ) {
1749 mActionUndo->plug( tb ); 1770 mActionUndo->plug( tb );
1750 mActionDelete->plug( tb ); 1771 mActionDelete->plug( tb );
1751 mActionRedo->plug( tb ); 1772 mActionRedo->plug( tb );
1752 } 1773 }
1753 } 1774 }
1754 //mActionQuit->plug ( tb ); 1775 //mActionQuit->plug ( tb );
1755 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1776 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1756 1777
1757 //US link the searchwidget first to this. 1778 //US link the searchwidget first to this.
1758 // The real linkage to the toolbar happens later. 1779 // The real linkage to the toolbar happens later.
1759//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1780//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1760//US tb->insertItem( mIncSearchWidget ); 1781//US tb->insertItem( mIncSearchWidget );
1761/*US 1782/*US
1762 mIncSearchWidget = new IncSearchWidget( tb ); 1783 mIncSearchWidget = new IncSearchWidget( tb );
1763 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1784 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1764 SLOT( incrementalSearch( const QString& ) ) ); 1785 SLOT( incrementalSearch( const QString& ) ) );
1765 1786
1766 mJumpButtonBar = new JumpButtonBar( this, this ); 1787 mJumpButtonBar = new JumpButtonBar( this, this );
1767 1788
1768//US topLayout->addWidget( mJumpButtonBar ); 1789//US topLayout->addWidget( mJumpButtonBar );
1769 this->layout()->add( mJumpButtonBar ); 1790 this->layout()->add( mJumpButtonBar );
1770*/ 1791*/
1771 1792
1772#endif //KAB_EMBEDDED 1793#endif //KAB_EMBEDDED
1773} 1794}
1774void KABCore::removeVoice() 1795void KABCore::removeVoice()
1775{ 1796{
1776 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 1797 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
1777 return; 1798 return;
1778 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1799 KABC::Addressee::List list = mViewManager->selectedAddressees();
1779 KABC::Addressee::List::Iterator it; 1800 KABC::Addressee::List::Iterator it;
1780 for ( it = list.begin(); it != list.end(); ++it ) { 1801 for ( it = list.begin(); it != list.end(); ++it ) {
1781 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1802 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1782 PhoneNumber::List::Iterator phoneIt; 1803 PhoneNumber::List::Iterator phoneIt;
1783 bool found = false; 1804 bool found = false;
1784 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1805 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1785 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1806 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1786 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1807 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1787 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1808 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1788 (*it).insertPhoneNumber( (*phoneIt) ); 1809 (*it).insertPhoneNumber( (*phoneIt) );
1789 found = true; 1810 found = true;
1790 } 1811 }
1791 } 1812 }
1792 1813
1793 } 1814 }
1794 if ( found ) 1815 if ( found )
1795 contactModified((*it) ); 1816 contactModified((*it) );
1796 } 1817 }
1797} 1818}
1798 1819
1799 1820
1800 1821
1801void KABCore::clipboardDataChanged() 1822void KABCore::clipboardDataChanged()
1802{ 1823{
1803 1824
1804 if ( mReadWrite ) 1825 if ( mReadWrite )
1805 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1826 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1806 1827
1807} 1828}
1808 1829
1809void KABCore::updateActionMenu() 1830void KABCore::updateActionMenu()
1810{ 1831{
1811 UndoStack *undo = UndoStack::instance(); 1832 UndoStack *undo = UndoStack::instance();
1812 RedoStack *redo = RedoStack::instance(); 1833 RedoStack *redo = RedoStack::instance();
1813 1834
1814 if ( undo->isEmpty() ) 1835 if ( undo->isEmpty() )
1815 mActionUndo->setText( i18n( "Undo" ) ); 1836 mActionUndo->setText( i18n( "Undo" ) );
1816 else 1837 else
1817 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1838 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1818 1839
1819 mActionUndo->setEnabled( !undo->isEmpty() ); 1840 mActionUndo->setEnabled( !undo->isEmpty() );
1820 1841
1821 if ( !redo->top() ) 1842 if ( !redo->top() )
1822 mActionRedo->setText( i18n( "Redo" ) ); 1843 mActionRedo->setText( i18n( "Redo" ) );
1823 else 1844 else
1824 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1845 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1825 1846
1826 mActionRedo->setEnabled( !redo->isEmpty() ); 1847 mActionRedo->setEnabled( !redo->isEmpty() );
1827} 1848}
1828 1849
1829void KABCore::configureKeyBindings() 1850void KABCore::configureKeyBindings()
1830{ 1851{
1831#ifndef KAB_EMBEDDED 1852#ifndef KAB_EMBEDDED
1832 KKeyDialog::configure( actionCollection(), true ); 1853 KKeyDialog::configure( actionCollection(), true );
1833#else //KAB_EMBEDDED 1854#else //KAB_EMBEDDED
1834 qDebug("KABCore::configureKeyBindings() not implemented"); 1855 qDebug("KABCore::configureKeyBindings() not implemented");
1835#endif //KAB_EMBEDDED 1856#endif //KAB_EMBEDDED
1836} 1857}
1837 1858
1838#ifdef KAB_EMBEDDED 1859#ifdef KAB_EMBEDDED
1839void KABCore::configureResources() 1860void KABCore::configureResources()
1840{ 1861{
1841 KRES::KCMKResources dlg( this, "" , 0 ); 1862 KRES::KCMKResources dlg( this, "" , 0 );
1842 1863
1843 if ( !dlg.exec() ) 1864 if ( !dlg.exec() )
1844 return; 1865 return;
1845 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1866 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1846} 1867}
1847#endif //KAB_EMBEDDED 1868#endif //KAB_EMBEDDED
1848 1869
1849 1870
1850 1871
1851#ifndef KAB_EMBEDDED 1872#ifndef KAB_EMBEDDED
1852#include "kabcore.moc" 1873#include "kabcore.moc"
1853#endif //KAB_EMBEDDED 1874#endif //KAB_EMBEDDED