author | ulf69 <ulf69> | 2004-08-06 01:40:28 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-06 01:40:28 (UTC) |
commit | b82b4b1efe9edddfb7b7d5eaa9fe8da4a9698138 (patch) (unidiff) | |
tree | 6e407c4b61128e5d16f657f6ae788ebcaadb7862 | |
parent | 422cea307a0a85064db6b5b64a847375da9311e1 (diff) | |
download | kdepimpi-b82b4b1efe9edddfb7b7d5eaa9fe8da4a9698138.zip kdepimpi-b82b4b1efe9edddfb7b7d5eaa9fe8da4a9698138.tar.gz kdepimpi-b82b4b1efe9edddfb7b7d5eaa9fe8da4a9698138.tar.bz2 |
enabled beaming and sending of emails
-rw-r--r-- | kaddressbook/kabcore.cpp | 134 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 42 |
2 files changed, 162 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2a54900..d891b07 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -40,96 +40,97 @@ | |||
40 | #include <kabc/vcardconverter.h> | 40 | #include <kabc/vcardconverter.h> |
41 | #include <kapplication.h> | 41 | #include <kapplication.h> |
42 | #include <kactionclasses.h> | 42 | #include <kactionclasses.h> |
43 | #include <kcmultidialog.h> | 43 | #include <kcmultidialog.h> |
44 | #include <kdebug.h> | 44 | #include <kdebug.h> |
45 | #include <kdeversion.h> | 45 | #include <kdeversion.h> |
46 | #include <kkeydialog.h> | 46 | #include <kkeydialog.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kprinter.h> | 48 | #include <kprinter.h> |
49 | #include <kprotocolinfo.h> | 49 | #include <kprotocolinfo.h> |
50 | #include <kresources/selectdialog.h> | 50 | #include <kresources/selectdialog.h> |
51 | #include <kstandarddirs.h> | 51 | #include <kstandarddirs.h> |
52 | #include <ktempfile.h> | 52 | #include <ktempfile.h> |
53 | #include <kxmlguiclient.h> | 53 | #include <kxmlguiclient.h> |
54 | #include <kaboutdata.h> | 54 | #include <kaboutdata.h> |
55 | #include <libkdepim/categoryselectdialog.h> | 55 | #include <libkdepim/categoryselectdialog.h> |
56 | 56 | ||
57 | #include "addresseeutil.h" | 57 | #include "addresseeutil.h" |
58 | #include "addresseeeditordialog.h" | 58 | #include "addresseeeditordialog.h" |
59 | #include "extensionmanager.h" | 59 | #include "extensionmanager.h" |
60 | #include "kstdaction.h" | 60 | #include "kstdaction.h" |
61 | #include "kaddressbookservice.h" | 61 | #include "kaddressbookservice.h" |
62 | #include "ldapsearchdialog.h" | 62 | #include "ldapsearchdialog.h" |
63 | #include "printing/printingwizard.h" | 63 | #include "printing/printingwizard.h" |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | 65 | ||
66 | #include <kapplication.h> | 66 | #include <kapplication.h> |
67 | #include "KDGanttMinimizeSplitter.h" | 67 | #include "KDGanttMinimizeSplitter.h" |
68 | #include "kaddressbookmain.h" | 68 | #include "kaddressbookmain.h" |
69 | #include "kactioncollection.h" | 69 | #include "kactioncollection.h" |
70 | #include <qapp.h> | 70 | #include <qapp.h> |
71 | #include <qmenubar.h> | 71 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 72 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 73 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 74 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 75 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 76 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | #include <kcmkabconfig.h> | 79 | #include <kcmkabconfig.h> |
80 | 80 | ||
81 | //#include <qlabel.h> | 81 | //#include <qlabel.h> |
82 | 82 | ||
83 | 83 | ||
84 | #ifdef Q_WS_QWS | 84 | #ifdef Q_WS_QWS |
85 | #include <qtopia/services.h> | 85 | #include <qtopia/services.h> |
86 | #include <qtopia/qcopenvelope_qws.h> | 86 | #include <qtopia/qcopenvelope_qws.h> |
87 | #endif | 87 | #endif |
88 | #include <qpe/ir.h> | ||
88 | 89 | ||
89 | #endif // KAB_EMBEDDED | 90 | #endif // KAB_EMBEDDED |
90 | #include <kcmkabconfig.h> | 91 | #include <kcmkabconfig.h> |
91 | 92 | ||
92 | 93 | ||
93 | #include <kresources/selectdialog.h> | 94 | #include <kresources/selectdialog.h> |
94 | #include <kmessagebox.h> | 95 | #include <kmessagebox.h> |
95 | 96 | ||
96 | #include <picture.h> | 97 | #include <picture.h> |
97 | #include <resource.h> | 98 | #include <resource.h> |
98 | 99 | ||
99 | //US#include <qsplitter.h> | 100 | //US#include <qsplitter.h> |
100 | #include <qmap.h> | 101 | #include <qmap.h> |
101 | #include <qdir.h> | 102 | #include <qdir.h> |
102 | #include <qfile.h> | 103 | #include <qfile.h> |
103 | #include <qvbox.h> | 104 | #include <qvbox.h> |
104 | #include <qlayout.h> | 105 | #include <qlayout.h> |
105 | #include <qclipboard.h> | 106 | #include <qclipboard.h> |
106 | #include <qtextstream.h> | 107 | #include <qtextstream.h> |
107 | 108 | ||
108 | #include <libkdepim/categoryselectdialog.h> | 109 | #include <libkdepim/categoryselectdialog.h> |
109 | #include <kabc/vcardconverter.h> | 110 | #include <kabc/vcardconverter.h> |
110 | 111 | ||
111 | 112 | ||
112 | #include "addresseeutil.h" | 113 | #include "addresseeutil.h" |
113 | #include "undocmds.h" | 114 | #include "undocmds.h" |
114 | #include "addresseeeditordialog.h" | 115 | #include "addresseeeditordialog.h" |
115 | #include "viewmanager.h" | 116 | #include "viewmanager.h" |
116 | #include "details/detailsviewcontainer.h" | 117 | #include "details/detailsviewcontainer.h" |
117 | #include "kabprefs.h" | 118 | #include "kabprefs.h" |
118 | #include "xxportmanager.h" | 119 | #include "xxportmanager.h" |
119 | #include "incsearchwidget.h" | 120 | #include "incsearchwidget.h" |
120 | #include "jumpbuttonbar.h" | 121 | #include "jumpbuttonbar.h" |
121 | #include "extensionmanager.h" | 122 | #include "extensionmanager.h" |
122 | #include "addresseeconfig.h" | 123 | #include "addresseeconfig.h" |
123 | #include <kcmultidialog.h> | 124 | #include <kcmultidialog.h> |
124 | 125 | ||
125 | #ifdef _WIN32_ | 126 | #ifdef _WIN32_ |
126 | 127 | ||
127 | #include "kaimportoldialog.h" | 128 | #include "kaimportoldialog.h" |
128 | #endif | 129 | #endif |
129 | 130 | ||
130 | bool pasteWithNewUid = true; | 131 | bool pasteWithNewUid = true; |
131 | 132 | ||
132 | #ifdef KAB_EMBEDDED | 133 | #ifdef KAB_EMBEDDED |
133 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 134 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
134 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 135 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
135 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 136 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
@@ -404,211 +405,325 @@ void KABCore::createAboutData() | |||
404 | "Greg Stern DCOP interface\n" | 405 | "Greg Stern DCOP interface\n" |
405 | "Mark Westcot Contact pinning\n" | 406 | "Mark Westcot Contact pinning\n" |
406 | "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" |
407 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" | 408 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" |
408 | #ifdef _WIN32_ | 409 | #ifdef _WIN32_ |
409 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" | 410 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" |
410 | #endif | 411 | #endif |
411 | ); | 412 | ); |
412 | } | 413 | } |
413 | 414 | ||
414 | void KABCore::setContactSelected( const QString &uid ) | 415 | void KABCore::setContactSelected( const QString &uid ) |
415 | { | 416 | { |
416 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 417 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
417 | if ( !mDetails->isHidden() ) | 418 | if ( !mDetails->isHidden() ) |
418 | mDetails->setAddressee( addr ); | 419 | mDetails->setAddressee( addr ); |
419 | 420 | ||
420 | if ( !addr.isEmpty() ) { | 421 | if ( !addr.isEmpty() ) { |
421 | emit contactSelected( addr.formattedName() ); | 422 | emit contactSelected( addr.formattedName() ); |
422 | KABC::Picture pic = addr.photo(); | 423 | KABC::Picture pic = addr.photo(); |
423 | if ( pic.isIntern() ) { | 424 | if ( pic.isIntern() ) { |
424 | //US emit contactSelected( pic.data() ); | 425 | //US emit contactSelected( pic.data() ); |
425 | //US instead use: | 426 | //US instead use: |
426 | QPixmap px; | 427 | QPixmap px; |
427 | if (pic.data().isNull() != true) | 428 | if (pic.data().isNull() != true) |
428 | { | 429 | { |
429 | px.convertFromImage(pic.data()); | 430 | px.convertFromImage(pic.data()); |
430 | } | 431 | } |
431 | 432 | ||
432 | emit contactSelected( px ); | 433 | emit contactSelected( px ); |
433 | } | 434 | } |
434 | } | 435 | } |
435 | 436 | ||
436 | 437 | ||
437 | mExtensionManager->setSelectionChanged(); | 438 | mExtensionManager->setSelectionChanged(); |
438 | 439 | ||
439 | // update the actions | 440 | // update the actions |
440 | bool selected = !uid.isEmpty(); | 441 | bool selected = !uid.isEmpty(); |
441 | 442 | ||
442 | if ( mReadWrite ) { | 443 | if ( mReadWrite ) { |
443 | mActionCut->setEnabled( selected ); | 444 | mActionCut->setEnabled( selected ); |
444 | mActionPaste->setEnabled( selected ); | 445 | mActionPaste->setEnabled( selected ); |
445 | } | 446 | } |
446 | 447 | ||
447 | mActionCopy->setEnabled( selected ); | 448 | mActionCopy->setEnabled( selected ); |
448 | mActionDelete->setEnabled( selected ); | 449 | mActionDelete->setEnabled( selected ); |
449 | mActionEditAddressee->setEnabled( selected ); | 450 | mActionEditAddressee->setEnabled( selected ); |
450 | mActionMail->setEnabled( selected ); | 451 | mActionMail->setEnabled( selected ); |
451 | mActionMailVCard->setEnabled( selected ); | 452 | mActionMailVCard->setEnabled( selected ); |
453 | if (mActionBeam) | ||
454 | mActionBeam->setEnabled( selected ); | ||
455 | |||
456 | if (mActionBeam) | ||
457 | mActionBeamVCard->setEnabled( selected ); | ||
458 | |||
452 | mActionWhoAmI->setEnabled( selected ); | 459 | mActionWhoAmI->setEnabled( selected ); |
453 | mActionCategories->setEnabled( selected ); | 460 | mActionCategories->setEnabled( selected ); |
454 | } | 461 | } |
455 | 462 | ||
456 | void KABCore::sendMail() | 463 | void KABCore::sendMail() |
457 | { | 464 | { |
458 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 465 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
459 | } | 466 | } |
460 | 467 | ||
461 | void KABCore::sendMail( const QString& email ) | 468 | void KABCore::sendMail( const QString& email ) |
462 | { | 469 | { |
463 | //US original kde implementation : kapp->invokeMailer( email, "" ); | 470 | //US original kde implementation : kapp->invokeMailer( email, "" ); |
464 | 471 | ||
465 | /*US original qtopia implementation | 472 | /*US original qtopia implementation |
466 | PimContact c = abList->currentEntry(); | 473 | PimContact c = abList->currentEntry(); |
467 | QString name = c.fileAs(); | 474 | QString name = c.fileAs(); |
468 | QString email = c.defaultEmail(); | 475 | QString email = c.defaultEmail(); |
469 | #ifndef QT_NO_COP | 476 | #ifndef QT_NO_COP |
470 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); | 477 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); |
471 | e << name << email; | 478 | e << name << email; |
472 | #else | 479 | #else |
473 | */ | 480 | */ |
474 | 481 | ||
475 | 482 | ||
476 | #ifndef QT_NO_COP | 483 | #ifndef QT_NO_COP |
477 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | 484 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); |
478 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | 485 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); |
479 | 486 | ||
480 | QCopEnvelope e(channel, "writeMail(QString,QString)"); | 487 | QCopEnvelope e(channel, "writeMail(QString,QString)"); |
481 | //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 |
482 | e << "" << email; | 489 | e << "" << email; |
483 | #else | 490 | #else |
484 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | 491 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); |
485 | #endif | 492 | #endif |
486 | } | 493 | } |
487 | 494 | ||
495 | |||
496 | |||
488 | void KABCore::mailVCard() | 497 | void KABCore::mailVCard() |
489 | { | 498 | { |
490 | QStringList uids = mViewManager->selectedUids(); | 499 | QStringList uids = mViewManager->selectedUids(); |
491 | if ( !uids.isEmpty() ) | 500 | if ( !uids.isEmpty() ) |
492 | mailVCard( uids ); | 501 | mailVCard( uids ); |
493 | } | 502 | } |
494 | 503 | ||
495 | void KABCore::mailVCard( const QStringList& uids ) | 504 | void KABCore::mailVCard( const QStringList& uids ) |
496 | { | 505 | { |
497 | QStringList urls; | 506 | QStringList urls; |
498 | 507 | ||
499 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 508 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
500 | 509 | ||
501 | /*US | 510 | /*US |
502 | // 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 |
503 | KTempFile tempDir; | 512 | KTempFile tempDir; |
504 | if ( tempDir.status() != 0 ) { | 513 | if ( tempDir.status() != 0 ) { |
505 | kdWarning() << strerror( tempDir.status() ) << endl; | 514 | kdWarning() << strerror( tempDir.status() ) << endl; |
506 | return; | 515 | return; |
507 | } | 516 | } |
508 | 517 | ||
509 | QString dirName = tempDir.name(); | 518 | QString dirName = tempDir.name(); |
510 | tempDir.unlink(); | 519 | tempDir.unlink(); |
511 | */ | 520 | */ |
512 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 521 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
513 | 522 | ||
514 | 523 | ||
515 | 524 | ||
516 | QDir().mkdir( dirName, true ); | 525 | QDir().mkdir( dirName, true ); |
517 | 526 | ||
518 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
519 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 528 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
520 | 529 | ||
521 | if ( a.isEmpty() ) | 530 | if ( a.isEmpty() ) |
522 | continue; | 531 | continue; |
523 | 532 | ||
524 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
525 | 534 | ||
526 | QString fileName = dirName + "/" + name; | 535 | QString fileName = dirName + "/" + name; |
527 | 536 | ||
528 | QFile outFile(fileName); | 537 | QFile outFile(fileName); |
529 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 538 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
530 | KABC::VCardConverter converter; | 539 | KABC::VCardConverter converter; |
531 | QString vcard; | 540 | QString vcard; |
532 | 541 | ||
533 | converter.addresseeToVCard( a, vcard ); | 542 | converter.addresseeToVCard( a, vcard ); |
534 | 543 | ||
535 | QTextStream t( &outFile ); // use a text stream | 544 | QTextStream t( &outFile ); // use a text stream |
536 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 545 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
537 | t << vcard; | 546 | t << vcard; |
538 | 547 | ||
539 | outFile.close(); | 548 | outFile.close(); |
540 | 549 | ||
541 | urls.append( fileName ); | 550 | urls.append( fileName ); |
542 | } | 551 | } |
543 | } | 552 | } |
544 | /*US | 553 | /*US |
545 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 554 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
546 | QString::null, // subject | 555 | QString::null, // subject |
547 | QString::null, // body | 556 | QString::null, // body |
548 | QString::null, | 557 | QString::null, |
549 | urls ); // attachments | 558 | urls ); // attachments |
550 | */ | 559 | */ |
551 | #ifndef QT_NO_COP | 560 | #ifndef QT_NO_COP |
552 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | 561 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); |
553 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | 562 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); |
554 | 563 | ||
555 | QMap<QString, QString> parameterMap; | 564 | QMap<QString, QString> parameterMap; |
556 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); | 565 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); |
557 | 566 | ||
558 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); | 567 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); |
559 | e << parameterMap; | 568 | e << parameterMap; |
560 | #else | 569 | #else |
561 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | 570 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); |
562 | #endif | 571 | #endif |
563 | 572 | ||
564 | 573 | ||
565 | } | 574 | } |
566 | 575 | ||
576 | /** | ||
577 | Beams the "WhoAmI contact. | ||
578 | */ | ||
579 | void KABCore::beamMySelf() | ||
580 | { | ||
581 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | ||
582 | if (!a.isEmpty()) | ||
583 | { | ||
584 | QStringList uids; | ||
585 | uids << a.uid(); | ||
586 | |||
587 | beamVCard(uids); | ||
588 | } | ||
589 | } | ||
590 | |||
591 | void KABCore::beamVCard() | ||
592 | { | ||
593 | QStringList uids = mViewManager->selectedUids(); | ||
594 | if ( !uids.isEmpty() ) | ||
595 | beamVCard( uids ); | ||
596 | } | ||
597 | |||
598 | |||
599 | void KABCore::beamVCard(const QStringList& uids) | ||
600 | { | ||
601 | /*US | ||
602 | QString beamFilename; | ||
603 | Opie::OPimContact c; | ||
604 | if ( actionPersonal->isOn() ) { | ||
605 | beamFilename = addressbookPersonalVCardName(); | ||
606 | if ( !QFile::exists( beamFilename ) ) | ||
607 | return; // can't beam a non-existent file | ||
608 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | ||
609 | beamFilename ); | ||
610 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | ||
611 | Opie::OPimContactAccess::List allList = access->allRecords(); | ||
612 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | ||
613 | c = *it; | ||
614 | |||
615 | delete access; | ||
616 | } else { | ||
617 | unlink( beamfile ); // delete if exists | ||
618 | mkdir("/tmp/obex/", 0755); | ||
619 | c = m_abView -> currentEntry(); | ||
620 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | ||
621 | beamfile ); | ||
622 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | ||
623 | access->add( c ); | ||
624 | access->save(); | ||
625 | delete access; | ||
626 | |||
627 | beamFilename = beamfile; | ||
628 | } | ||
629 | |||
630 | owarn << "Beaming: " << beamFilename << oendl; | ||
631 | */ | ||
632 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | ||
633 | |||
634 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | ||
635 | |||
636 | QString name = "contact.vcf"; | ||
637 | |||
638 | QString fileName = dirName + "/" + name; | ||
639 | |||
640 | |||
641 | QDir().mkdir( dirName, true ); | ||
642 | |||
643 | QFile outFile(fileName); | ||
644 | KABC::VCardConverter converter; | ||
645 | QString description; | ||
646 | |||
647 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | ||
648 | |||
649 | QTextStream t( &outFile ); // use a text stream | ||
650 | t.setEncoding( QTextStream::UnicodeUTF8 ); | ||
651 | |||
652 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | ||
653 | KABC::Addressee a = mAddressBook->findByUid( *it ); | ||
654 | |||
655 | if ( a.isEmpty() ) | ||
656 | continue; | ||
657 | |||
658 | if (description.isEmpty()) | ||
659 | description = a.formattedName(); | ||
660 | |||
661 | QString vcard; | ||
662 | converter.addresseeToVCard( a, vcard ); | ||
663 | t << vcard; | ||
664 | |||
665 | } | ||
666 | } | ||
667 | |||
668 | outFile.close(); | ||
669 | |||
670 | Ir *ir = new Ir( this ); | ||
671 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | ||
672 | ir->send( fileName, description, "text/x-vCard" ); | ||
673 | |||
674 | } | ||
675 | |||
676 | void KABCore::beamDone( Ir *ir ) | ||
677 | { | ||
678 | delete ir; | ||
679 | } | ||
680 | |||
681 | |||
567 | void KABCore::browse( const QString& url ) | 682 | void KABCore::browse( const QString& url ) |
568 | { | 683 | { |
569 | #ifndef KAB_EMBEDDED | 684 | #ifndef KAB_EMBEDDED |
570 | kapp->invokeBrowser( url ); | 685 | kapp->invokeBrowser( url ); |
571 | #else //KAB_EMBEDDED | 686 | #else //KAB_EMBEDDED |
572 | qDebug("KABCore::browse must be fixed"); | 687 | qDebug("KABCore::browse must be fixed"); |
573 | #endif //KAB_EMBEDDED | 688 | #endif //KAB_EMBEDDED |
574 | } | 689 | } |
575 | 690 | ||
576 | void KABCore::selectAllContacts() | 691 | void KABCore::selectAllContacts() |
577 | { | 692 | { |
578 | mViewManager->setSelected( QString::null, true ); | 693 | mViewManager->setSelected( QString::null, true ); |
579 | } | 694 | } |
580 | 695 | ||
581 | void KABCore::deleteContacts() | 696 | void KABCore::deleteContacts() |
582 | { | 697 | { |
583 | QStringList uidList = mViewManager->selectedUids(); | 698 | QStringList uidList = mViewManager->selectedUids(); |
584 | deleteContacts( uidList ); | 699 | deleteContacts( uidList ); |
585 | } | 700 | } |
586 | 701 | ||
587 | void KABCore::deleteContacts( const QStringList &uids ) | 702 | void KABCore::deleteContacts( const QStringList &uids ) |
588 | { | 703 | { |
589 | if ( uids.count() > 0 ) { | 704 | if ( uids.count() > 0 ) { |
590 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 705 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
591 | UndoStack::instance()->push( command ); | 706 | UndoStack::instance()->push( command ); |
592 | RedoStack::instance()->clear(); | 707 | RedoStack::instance()->clear(); |
593 | 708 | ||
594 | // now if we deleted anything, refresh | 709 | // now if we deleted anything, refresh |
595 | setContactSelected( QString::null ); | 710 | setContactSelected( QString::null ); |
596 | setModified( true ); | 711 | setModified( true ); |
597 | } | 712 | } |
598 | } | 713 | } |
599 | 714 | ||
600 | void KABCore::copyContacts() | 715 | void KABCore::copyContacts() |
601 | { | 716 | { |
602 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 717 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
603 | 718 | ||
604 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 719 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
605 | 720 | ||
606 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 721 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
607 | 722 | ||
608 | QClipboard *cb = QApplication::clipboard(); | 723 | QClipboard *cb = QApplication::clipboard(); |
609 | cb->setText( clipText ); | 724 | cb->setText( clipText ); |
610 | } | 725 | } |
611 | 726 | ||
612 | void KABCore::cutContacts() | 727 | void KABCore::cutContacts() |
613 | { | 728 | { |
614 | QStringList uidList = mViewManager->selectedUids(); | 729 | QStringList uidList = mViewManager->selectedUids(); |
@@ -1318,106 +1433,115 @@ void KABCore::initGUI() | |||
1318 | 1433 | ||
1319 | #ifdef KAB_EMBEDDED | 1434 | #ifdef KAB_EMBEDDED |
1320 | addActionsManually(); | 1435 | addActionsManually(); |
1321 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1436 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1322 | mXXPortManager = new XXPortManager( this, this ); | 1437 | mXXPortManager = new XXPortManager( this, this ); |
1323 | 1438 | ||
1324 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1439 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1325 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1440 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1326 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1441 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1327 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1442 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1328 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1443 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1329 | // mIncSearchWidget->hide(); | 1444 | // mIncSearchWidget->hide(); |
1330 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1445 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1331 | SLOT( incrementalSearch( const QString& ) ) ); | 1446 | SLOT( incrementalSearch( const QString& ) ) ); |
1332 | 1447 | ||
1333 | 1448 | ||
1334 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1449 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1335 | 1450 | ||
1336 | topLayout->addWidget( mJumpButtonBar ); | 1451 | topLayout->addWidget( mJumpButtonBar ); |
1337 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1452 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1338 | 1453 | ||
1339 | // mMainWindow->getIconToolBar()->raise(); | 1454 | // mMainWindow->getIconToolBar()->raise(); |
1340 | 1455 | ||
1341 | #endif //KAB_EMBEDDED | 1456 | #endif //KAB_EMBEDDED |
1342 | 1457 | ||
1343 | } | 1458 | } |
1344 | void KABCore::initActions() | 1459 | void KABCore::initActions() |
1345 | { | 1460 | { |
1346 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1461 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1347 | 1462 | ||
1348 | #ifndef KAB_EMBEDDED | 1463 | #ifndef KAB_EMBEDDED |
1349 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1464 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1350 | SLOT( clipboardDataChanged() ) ); | 1465 | SLOT( clipboardDataChanged() ) ); |
1351 | #endif //KAB_EMBEDDED | 1466 | #endif //KAB_EMBEDDED |
1352 | 1467 | ||
1353 | // file menu | 1468 | // file menu |
1354 | if ( mIsPart ) { | 1469 | if ( mIsPart ) { |
1355 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1470 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1356 | SLOT( sendMail() ), actionCollection(), | 1471 | SLOT( sendMail() ), actionCollection(), |
1357 | "kaddressbook_mail" ); | 1472 | "kaddressbook_mail" ); |
1358 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1473 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1359 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1474 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1360 | 1475 | ||
1361 | } else { | 1476 | } else { |
1362 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1477 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1363 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1478 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1364 | } | 1479 | } |
1365 | 1480 | ||
1481 | |||
1366 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1482 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1367 | SLOT( save() ), actionCollection(), "file_sync" ); | 1483 | SLOT( save() ), actionCollection(), "file_sync" ); |
1368 | 1484 | ||
1369 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1485 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1370 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1486 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1371 | 1487 | ||
1372 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1488 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1373 | this, SLOT( mailVCard() ), | 1489 | this, SLOT( mailVCard() ), |
1374 | actionCollection(), "file_mail_vcard"); | 1490 | actionCollection(), "file_mail_vcard"); |
1375 | 1491 | ||
1492 | mActionBeamVCard = 0; | ||
1493 | if ( Ir::supported() ) { | ||
1494 | mActionBeamVCard = new KAction( i18n( "Beam v&Card" ), "beam", 0, this, | ||
1495 | SLOT( beamVCard() ), actionCollection(), | ||
1496 | "kaddressbook_beam_vcard" ); | ||
1497 | } | ||
1498 | |||
1499 | |||
1376 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1500 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1377 | this, SLOT( editContact2() ), | 1501 | this, SLOT( editContact2() ), |
1378 | actionCollection(), "file_properties" ); | 1502 | actionCollection(), "file_properties" ); |
1379 | 1503 | ||
1380 | #ifdef KAB_EMBEDDED | 1504 | #ifdef KAB_EMBEDDED |
1381 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1505 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1382 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1506 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1383 | mMainWindow, SLOT( exit() ), | 1507 | mMainWindow, SLOT( exit() ), |
1384 | actionCollection(), "quit" ); | 1508 | actionCollection(), "quit" ); |
1385 | #endif //KAB_EMBEDDED | 1509 | #endif //KAB_EMBEDDED |
1386 | 1510 | ||
1387 | // edit menu | 1511 | // edit menu |
1388 | if ( mIsPart ) { | 1512 | if ( mIsPart ) { |
1389 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1513 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1390 | SLOT( copyContacts() ), actionCollection(), | 1514 | SLOT( copyContacts() ), actionCollection(), |
1391 | "kaddressbook_copy" ); | 1515 | "kaddressbook_copy" ); |
1392 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1516 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1393 | SLOT( cutContacts() ), actionCollection(), | 1517 | SLOT( cutContacts() ), actionCollection(), |
1394 | "kaddressbook_cut" ); | 1518 | "kaddressbook_cut" ); |
1395 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1519 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1396 | SLOT( pasteContacts() ), actionCollection(), | 1520 | SLOT( pasteContacts() ), actionCollection(), |
1397 | "kaddressbook_paste" ); | 1521 | "kaddressbook_paste" ); |
1398 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1522 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1399 | SLOT( selectAllContacts() ), actionCollection(), | 1523 | SLOT( selectAllContacts() ), actionCollection(), |
1400 | "kaddressbook_select_all" ); | 1524 | "kaddressbook_select_all" ); |
1401 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1525 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1402 | SLOT( undo() ), actionCollection(), | 1526 | SLOT( undo() ), actionCollection(), |
1403 | "kaddressbook_undo" ); | 1527 | "kaddressbook_undo" ); |
1404 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1528 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1405 | this, SLOT( redo() ), actionCollection(), | 1529 | this, SLOT( redo() ), actionCollection(), |
1406 | "kaddressbook_redo" ); | 1530 | "kaddressbook_redo" ); |
1407 | } else { | 1531 | } else { |
1408 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1532 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1409 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1533 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1410 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1534 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1411 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1535 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1412 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1536 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1413 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1537 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1414 | } | 1538 | } |
1415 | 1539 | ||
1416 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1540 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1417 | Key_Delete, this, SLOT( deleteContacts() ), | 1541 | Key_Delete, this, SLOT( deleteContacts() ), |
1418 | actionCollection(), "edit_delete" ); | 1542 | actionCollection(), "edit_delete" ); |
1419 | 1543 | ||
1420 | mActionUndo->setEnabled( false ); | 1544 | mActionUndo->setEnabled( false ); |
1421 | mActionRedo->setEnabled( false ); | 1545 | mActionRedo->setEnabled( false ); |
1422 | 1546 | ||
1423 | // settings menu | 1547 | // settings menu |
@@ -1428,224 +1552,234 @@ void KABCore::initActions() | |||
1428 | SLOT( configureResources() ), actionCollection(), | 1552 | SLOT( configureResources() ), actionCollection(), |
1429 | "kaddressbook_configure_resources" ); | 1553 | "kaddressbook_configure_resources" ); |
1430 | #endif //KAB_EMBEDDED | 1554 | #endif //KAB_EMBEDDED |
1431 | 1555 | ||
1432 | if ( mIsPart ) { | 1556 | if ( mIsPart ) { |
1433 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1557 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1434 | SLOT( openConfigDialog() ), actionCollection(), | 1558 | SLOT( openConfigDialog() ), actionCollection(), |
1435 | "kaddressbook_configure" ); | 1559 | "kaddressbook_configure" ); |
1436 | 1560 | ||
1437 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1561 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1438 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1562 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1439 | "kaddressbook_configure_shortcuts" ); | 1563 | "kaddressbook_configure_shortcuts" ); |
1440 | #ifdef KAB_EMBEDDED | 1564 | #ifdef KAB_EMBEDDED |
1441 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1565 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1442 | mActionConfigureToolbars->setEnabled( false ); | 1566 | mActionConfigureToolbars->setEnabled( false ); |
1443 | #endif //KAB_EMBEDDED | 1567 | #endif //KAB_EMBEDDED |
1444 | 1568 | ||
1445 | } else { | 1569 | } else { |
1446 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1570 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1447 | 1571 | ||
1448 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1572 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1449 | } | 1573 | } |
1450 | 1574 | ||
1451 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1575 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1452 | actionCollection(), "options_show_jump_bar" ); | 1576 | actionCollection(), "options_show_jump_bar" ); |
1453 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1577 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1454 | 1578 | ||
1455 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1579 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1456 | actionCollection(), "options_show_details" ); | 1580 | actionCollection(), "options_show_details" ); |
1457 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1581 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1458 | 1582 | ||
1459 | // misc | 1583 | // misc |
1460 | // only enable LDAP lookup if we can handle the protocol | 1584 | // only enable LDAP lookup if we can handle the protocol |
1461 | #ifndef KAB_EMBEDDED | 1585 | #ifndef KAB_EMBEDDED |
1462 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1586 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1463 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1587 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1464 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1588 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1465 | "ldap_lookup" ); | 1589 | "ldap_lookup" ); |
1466 | } | 1590 | } |
1467 | #else //KAB_EMBEDDED | 1591 | #else //KAB_EMBEDDED |
1468 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1592 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1469 | #endif //KAB_EMBEDDED | 1593 | #endif //KAB_EMBEDDED |
1470 | 1594 | ||
1471 | 1595 | ||
1472 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1596 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1473 | SLOT( setWhoAmI() ), actionCollection(), | 1597 | SLOT( setWhoAmI() ), actionCollection(), |
1474 | "set_personal" ); | 1598 | "set_personal" ); |
1475 | 1599 | ||
1600 | mActionBeam = 0; | ||
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 | |||
1607 | |||
1476 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1608 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1477 | SLOT( setCategories() ), actionCollection(), | 1609 | SLOT( setCategories() ), actionCollection(), |
1478 | "edit_set_categories" ); | 1610 | "edit_set_categories" ); |
1479 | 1611 | ||
1480 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1612 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1481 | SLOT( removeVoice() ), actionCollection(), | 1613 | SLOT( removeVoice() ), actionCollection(), |
1482 | "remove_voice" ); | 1614 | "remove_voice" ); |
1483 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1615 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1484 | SLOT( importFromOL() ), actionCollection(), | 1616 | SLOT( importFromOL() ), actionCollection(), |
1485 | "import_OL" ); | 1617 | "import_OL" ); |
1486 | #ifdef KAB_EMBEDDED | 1618 | #ifdef KAB_EMBEDDED |
1487 | 1619 | ||
1488 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1620 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1489 | this, SLOT( createAboutData() ), actionCollection(), | 1621 | this, SLOT( createAboutData() ), actionCollection(), |
1490 | "kaddressbook_about_data" ); | 1622 | "kaddressbook_about_data" ); |
1491 | #endif //KAB_EMBEDDED | 1623 | #endif //KAB_EMBEDDED |
1492 | 1624 | ||
1493 | clipboardDataChanged(); | 1625 | clipboardDataChanged(); |
1494 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1626 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1495 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1627 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1496 | } | 1628 | } |
1497 | 1629 | ||
1498 | //US we need this function, to plug all actions into the correct menues. | 1630 | //US we need this function, to plug all actions into the correct menues. |
1499 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1631 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1500 | void KABCore::addActionsManually() | 1632 | void KABCore::addActionsManually() |
1501 | { | 1633 | { |
1502 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1634 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1503 | 1635 | ||
1504 | #ifdef KAB_EMBEDDED | 1636 | #ifdef KAB_EMBEDDED |
1505 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1637 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1506 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1638 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1507 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1639 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1508 | 1640 | ||
1509 | KToolBar* tb = mMainWindow->toolBar(); | 1641 | KToolBar* tb = mMainWindow->toolBar(); |
1510 | 1642 | ||
1511 | #ifdef DESKTOP_VERSION | 1643 | #ifdef DESKTOP_VERSION |
1512 | QMenuBar* mb = mMainWindow->menuBar(); | 1644 | QMenuBar* mb = mMainWindow->menuBar(); |
1513 | 1645 | ||
1514 | //US setup menubar. | 1646 | //US setup menubar. |
1515 | //Disable the following block if you do not want to have a menubar. | 1647 | //Disable the following block if you do not want to have a menubar. |
1516 | mb->insertItem( "&File", fileMenu ); | 1648 | mb->insertItem( "&File", fileMenu ); |
1517 | mb->insertItem( "&Edit", editMenu ); | 1649 | mb->insertItem( "&Edit", editMenu ); |
1518 | mb->insertItem( "&View", viewMenu ); | 1650 | mb->insertItem( "&View", viewMenu ); |
1519 | mb->insertItem( "&Settings", settingsMenu ); | 1651 | mb->insertItem( "&Settings", settingsMenu ); |
1520 | mb->insertItem( "&Change selected", changeMenu ); | 1652 | mb->insertItem( "&Change selected", changeMenu ); |
1521 | mb->insertItem( "&Help", helpMenu ); | 1653 | mb->insertItem( "&Help", helpMenu ); |
1522 | mIncSearchWidget = new IncSearchWidget( tb ); | 1654 | mIncSearchWidget = new IncSearchWidget( tb ); |
1523 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1655 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1524 | 1656 | ||
1525 | #else | 1657 | #else |
1526 | //US setup toolbar | 1658 | //US setup toolbar |
1527 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1659 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1528 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1660 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1529 | menuBarTB->insertItem( "ME", popupBarTB); | 1661 | menuBarTB->insertItem( "ME", popupBarTB); |
1530 | tb->insertWidget(-1, 0, menuBarTB); | 1662 | tb->insertWidget(-1, 0, menuBarTB); |
1531 | mIncSearchWidget = new IncSearchWidget( tb ); | 1663 | mIncSearchWidget = new IncSearchWidget( tb ); |
1532 | 1664 | ||
1533 | tb->enableMoving(false); | 1665 | tb->enableMoving(false); |
1534 | popupBarTB->insertItem( "&File", fileMenu ); | 1666 | popupBarTB->insertItem( "&File", fileMenu ); |
1535 | popupBarTB->insertItem( "&Edit", editMenu ); | 1667 | popupBarTB->insertItem( "&Edit", editMenu ); |
1536 | popupBarTB->insertItem( "&View", viewMenu ); | 1668 | popupBarTB->insertItem( "&View", viewMenu ); |
1537 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1669 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1538 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1670 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1539 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1671 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1540 | popupBarTB->insertItem( "&Help", helpMenu ); | 1672 | popupBarTB->insertItem( "&Help", helpMenu ); |
1541 | if (QApplication::desktop()->width() > 320 ) { | 1673 | if (QApplication::desktop()->width() > 320 ) { |
1542 | // mViewManager->getFilterAction()->plug ( tb); | 1674 | // mViewManager->getFilterAction()->plug ( tb); |
1543 | } | 1675 | } |
1544 | #endif | 1676 | #endif |
1545 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1677 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1546 | 1678 | ||
1547 | 1679 | ||
1548 | 1680 | ||
1549 | //US Now connect the actions with the menue entries. | 1681 | //US Now connect the actions with the menue entries. |
1550 | mActionPrint->plug( fileMenu ); | 1682 | mActionPrint->plug( fileMenu ); |
1551 | mActionMail->plug( fileMenu ); | 1683 | mActionMail->plug( fileMenu ); |
1552 | fileMenu->insertSeparator(); | 1684 | fileMenu->insertSeparator(); |
1553 | 1685 | ||
1554 | mActionNewContact->plug( fileMenu ); | 1686 | mActionNewContact->plug( fileMenu ); |
1555 | mActionNewContact->plug( tb ); | 1687 | mActionNewContact->plug( tb ); |
1556 | 1688 | ||
1557 | mActionEditAddressee->plug( fileMenu ); | 1689 | mActionEditAddressee->plug( fileMenu ); |
1558 | fileMenu->insertSeparator(); | 1690 | fileMenu->insertSeparator(); |
1559 | mActionSave->plug( fileMenu ); | 1691 | mActionSave->plug( fileMenu ); |
1560 | fileMenu->insertItem( "&Import", ImportMenu ); | 1692 | fileMenu->insertItem( "&Import", ImportMenu ); |
1561 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1693 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1562 | fileMenu->insertSeparator(); | 1694 | fileMenu->insertSeparator(); |
1563 | mActionMailVCard->plug( fileMenu ); | 1695 | mActionMailVCard->plug( fileMenu ); |
1696 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | ||
1564 | fileMenu->insertSeparator(); | 1697 | fileMenu->insertSeparator(); |
1565 | mActionQuit->plug( fileMenu ); | 1698 | mActionQuit->plug( fileMenu ); |
1566 | #ifdef _WIN32_ | 1699 | #ifdef _WIN32_ |
1567 | mActionImportOL->plug( ImportMenu ); | 1700 | mActionImportOL->plug( ImportMenu ); |
1568 | #endif | 1701 | #endif |
1569 | // edit menu | 1702 | // edit menu |
1570 | mActionUndo->plug( editMenu ); | 1703 | mActionUndo->plug( editMenu ); |
1571 | mActionRedo->plug( editMenu ); | 1704 | mActionRedo->plug( editMenu ); |
1572 | editMenu->insertSeparator(); | 1705 | editMenu->insertSeparator(); |
1573 | mActionCut->plug( editMenu ); | 1706 | mActionCut->plug( editMenu ); |
1574 | mActionCopy->plug( editMenu ); | 1707 | mActionCopy->plug( editMenu ); |
1575 | mActionPaste->plug( editMenu ); | 1708 | mActionPaste->plug( editMenu ); |
1576 | mActionDelete->plug( editMenu ); | 1709 | mActionDelete->plug( editMenu ); |
1577 | editMenu->insertSeparator(); | 1710 | editMenu->insertSeparator(); |
1578 | mActionSelectAll->plug( editMenu ); | 1711 | mActionSelectAll->plug( editMenu ); |
1579 | 1712 | ||
1580 | mActionRemoveVoice->plug( changeMenu ); | 1713 | mActionRemoveVoice->plug( changeMenu ); |
1581 | // settings menu | 1714 | // settings menu |
1582 | //US special menuentry to configure the addressbook resources. On KDE | 1715 | //US special menuentry to configure the addressbook resources. On KDE |
1583 | // you do that through the control center !!! | 1716 | // you do that through the control center !!! |
1584 | mActionConfigResources->plug( settingsMenu ); | 1717 | mActionConfigResources->plug( settingsMenu ); |
1585 | settingsMenu->insertSeparator(); | 1718 | settingsMenu->insertSeparator(); |
1586 | 1719 | ||
1587 | mActionConfigKAddressbook->plug( settingsMenu ); | 1720 | mActionConfigKAddressbook->plug( settingsMenu ); |
1588 | 1721 | ||
1589 | if ( mIsPart ) { | 1722 | if ( mIsPart ) { |
1590 | mActionConfigShortcuts->plug( settingsMenu ); | 1723 | mActionConfigShortcuts->plug( settingsMenu ); |
1591 | mActionConfigureToolbars->plug( settingsMenu ); | 1724 | mActionConfigureToolbars->plug( settingsMenu ); |
1592 | 1725 | ||
1593 | } else { | 1726 | } else { |
1594 | mActionKeyBindings->plug( settingsMenu ); | 1727 | mActionKeyBindings->plug( settingsMenu ); |
1595 | } | 1728 | } |
1596 | 1729 | ||
1597 | settingsMenu->insertSeparator(); | 1730 | settingsMenu->insertSeparator(); |
1598 | 1731 | ||
1599 | mActionJumpBar->plug( settingsMenu ); | 1732 | mActionJumpBar->plug( settingsMenu ); |
1600 | mActionDetails->plug( settingsMenu ); | 1733 | mActionDetails->plug( settingsMenu ); |
1601 | settingsMenu->insertSeparator(); | 1734 | settingsMenu->insertSeparator(); |
1602 | 1735 | ||
1603 | mActionWhoAmI->plug( settingsMenu ); | 1736 | mActionWhoAmI->plug( settingsMenu ); |
1737 | if ( Ir::supported() ) mActionBeam->plug( settingsMenu ); | ||
1604 | mActionCategories->plug( settingsMenu ); | 1738 | mActionCategories->plug( settingsMenu ); |
1605 | 1739 | ||
1606 | mActionAboutKAddressbook->plug( helpMenu ); | 1740 | mActionAboutKAddressbook->plug( helpMenu ); |
1607 | 1741 | ||
1608 | 1742 | ||
1609 | if (QApplication::desktop()->width() > 320 ) { | 1743 | if (QApplication::desktop()->width() > 320 ) { |
1610 | 1744 | ||
1611 | mActionEditAddressee->plug( tb ); | 1745 | mActionEditAddressee->plug( tb ); |
1612 | mActionSave->plug( tb ); | 1746 | mActionSave->plug( tb ); |
1613 | mViewManager->getFilterAction()->plug ( tb); | 1747 | mViewManager->getFilterAction()->plug ( tb); |
1614 | if (QApplication::desktop()->width() > 480 ) { | 1748 | if (QApplication::desktop()->width() > 480 ) { |
1615 | mActionUndo->plug( tb ); | 1749 | mActionUndo->plug( tb ); |
1616 | mActionDelete->plug( tb ); | 1750 | mActionDelete->plug( tb ); |
1617 | mActionRedo->plug( tb ); | 1751 | mActionRedo->plug( tb ); |
1618 | } | 1752 | } |
1619 | } | 1753 | } |
1620 | //mActionQuit->plug ( tb ); | 1754 | //mActionQuit->plug ( tb ); |
1621 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1755 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1622 | 1756 | ||
1623 | //US link the searchwidget first to this. | 1757 | //US link the searchwidget first to this. |
1624 | // The real linkage to the toolbar happens later. | 1758 | // The real linkage to the toolbar happens later. |
1625 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1759 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1626 | //US tb->insertItem( mIncSearchWidget ); | 1760 | //US tb->insertItem( mIncSearchWidget ); |
1627 | /*US | 1761 | /*US |
1628 | mIncSearchWidget = new IncSearchWidget( tb ); | 1762 | mIncSearchWidget = new IncSearchWidget( tb ); |
1629 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1763 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1630 | SLOT( incrementalSearch( const QString& ) ) ); | 1764 | SLOT( incrementalSearch( const QString& ) ) ); |
1631 | 1765 | ||
1632 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1766 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1633 | 1767 | ||
1634 | //US topLayout->addWidget( mJumpButtonBar ); | 1768 | //US topLayout->addWidget( mJumpButtonBar ); |
1635 | this->layout()->add( mJumpButtonBar ); | 1769 | this->layout()->add( mJumpButtonBar ); |
1636 | */ | 1770 | */ |
1637 | 1771 | ||
1638 | #endif //KAB_EMBEDDED | 1772 | #endif //KAB_EMBEDDED |
1639 | } | 1773 | } |
1640 | void KABCore::removeVoice() | 1774 | void KABCore::removeVoice() |
1641 | { | 1775 | { |
1642 | 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 ) | 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 ) |
1643 | return; | 1777 | return; |
1644 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1778 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1645 | KABC::Addressee::List::Iterator it; | 1779 | KABC::Addressee::List::Iterator it; |
1646 | for ( it = list.begin(); it != list.end(); ++it ) { | 1780 | for ( it = list.begin(); it != list.end(); ++it ) { |
1647 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1781 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1648 | PhoneNumber::List::Iterator phoneIt; | 1782 | PhoneNumber::List::Iterator phoneIt; |
1649 | bool found = false; | 1783 | bool found = false; |
1650 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1784 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1651 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1785 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 6446974..be39148 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -19,195 +19,206 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | 32 | ||
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | 35 | ||
36 | namespace KABC { | 36 | namespace KABC { |
37 | class AddressBook; | 37 | class AddressBook; |
38 | } | 38 | } |
39 | 39 | ||
40 | #ifndef KAB_EMBEDDED | 40 | #ifndef KAB_EMBEDDED |
41 | class KAboutData; | 41 | class KAboutData; |
42 | class KConfig; | 42 | class KConfig; |
43 | 43 | ||
44 | class KAddressBookService; | 44 | class KAddressBookService; |
45 | class LDAPSearchDialog; | 45 | class LDAPSearchDialog; |
46 | #else //KAB_EMBEDDED | 46 | #else //KAB_EMBEDDED |
47 | class KAddressBookMain; | 47 | class KAddressBookMain; |
48 | //US class QAction; | 48 | //US class QAction; |
49 | #endif //KAB_EMBEDDED | 49 | #endif //KAB_EMBEDDED |
50 | class KCMultiDialog; | 50 | class KCMultiDialog; |
51 | class KXMLGUIClient; | 51 | class KXMLGUIClient; |
52 | class ExtensionManager; | 52 | class ExtensionManager; |
53 | class XXPortManager; | 53 | class XXPortManager; |
54 | class JumpButtonBar; | 54 | class JumpButtonBar; |
55 | class IncSearchWidget; | 55 | class IncSearchWidget; |
56 | class KDGanttMinimizeSplitter; | 56 | class KDGanttMinimizeSplitter; |
57 | class KAction; | 57 | class KAction; |
58 | class KActionCollection; | 58 | class KActionCollection; |
59 | class KToggleAction; | 59 | class KToggleAction; |
60 | 60 | ||
61 | class QAction; | 61 | class QAction; |
62 | class QMenuBar; | 62 | class QMenuBar; |
63 | class QSplitter; | 63 | class QSplitter; |
64 | class ViewContainer; | 64 | class ViewContainer; |
65 | class ViewManager; | 65 | class ViewManager; |
66 | class AddresseeEditorDialog; | 66 | class AddresseeEditorDialog; |
67 | class Ir; | ||
67 | 68 | ||
68 | class KABCore : public QWidget | 69 | class KABCore : public QWidget |
69 | { | 70 | { |
70 | Q_OBJECT | 71 | Q_OBJECT |
71 | 72 | ||
72 | public: | 73 | public: |
73 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 74 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
74 | 75 | ||
75 | 76 | ||
76 | ~KABCore(); | 77 | ~KABCore(); |
77 | 78 | ||
78 | 79 | ||
79 | #ifdef KAB_EMBEDDED | 80 | #ifdef KAB_EMBEDDED |
80 | //US added functionality | 81 | //US added functionality |
81 | QPopupMenu* getViewMenu() {return viewMenu;} | 82 | QPopupMenu* getViewMenu() {return viewMenu;} |
82 | QPopupMenu* getFilterMenu() {return filterMenu;} | 83 | QPopupMenu* getFilterMenu() {return filterMenu;} |
83 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 84 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
84 | void addActionsManually(); | 85 | void addActionsManually(); |
85 | #endif //KAB_EMBEDDED | 86 | #endif //KAB_EMBEDDED |
86 | /** | 87 | /** |
87 | Restores the global settings. | 88 | Restores the global settings. |
88 | */ | 89 | */ |
89 | void restoreSettings(); | 90 | void restoreSettings(); |
90 | 91 | ||
91 | /** | 92 | /** |
92 | Saves the global settings. | 93 | Saves the global settings. |
93 | */ | 94 | */ |
94 | void saveSettings(); | 95 | void saveSettings(); |
95 | 96 | ||
96 | /** | 97 | /** |
97 | Returns a pointer to the StdAddressBook of the application. | 98 | Returns a pointer to the StdAddressBook of the application. |
98 | */ | 99 | */ |
99 | KABC::AddressBook *addressBook() const; | 100 | KABC::AddressBook *addressBook() const; |
100 | 101 | ||
101 | /** | 102 | /** |
102 | Returns a pointer to the KConfig object of the application. | 103 | Returns a pointer to the KConfig object of the application. |
103 | */ | 104 | */ |
104 | static KConfig *config(); | 105 | static KConfig *config(); |
105 | 106 | ||
106 | /** | 107 | /** |
107 | Returns a pointer to the global KActionCollection object. So | 108 | Returns a pointer to the global KActionCollection object. So |
108 | other classes can register their actions easily. | 109 | other classes can register their actions easily. |
109 | */ | 110 | */ |
110 | KActionCollection *actionCollection() const; | 111 | KActionCollection *actionCollection() const; |
111 | 112 | ||
112 | /** | 113 | /** |
113 | Returns the current search field of the Incremental Search Widget. | 114 | Returns the current search field of the Incremental Search Widget. |
114 | */ | 115 | */ |
115 | KABC::Field *currentSearchField() const; | 116 | KABC::Field *currentSearchField() const; |
116 | 117 | ||
117 | /** | 118 | /** |
118 | Returns the uid list of the currently selected contacts. | 119 | Returns the uid list of the currently selected contacts. |
119 | */ | 120 | */ |
120 | QStringList selectedUIDs() const; | 121 | QStringList selectedUIDs() const; |
121 | 122 | ||
122 | /** | 123 | /** |
123 | Displays the ResourceSelectDialog and returns the selected | 124 | Displays the ResourceSelectDialog and returns the selected |
124 | resource or a null pointer if no resource was selected by | 125 | resource or a null pointer if no resource was selected by |
125 | the user. | 126 | the user. |
126 | */ | 127 | */ |
127 | KABC::Resource *requestResource( QWidget *parent ); | 128 | KABC::Resource *requestResource( QWidget *parent ); |
128 | 129 | ||
129 | #ifndef KAB_EMBEDDED | 130 | #ifndef KAB_EMBEDDED |
130 | static KAboutData *createAboutData(); | 131 | static KAboutData *createAboutData(); |
131 | #endif //KAB_EMBEDDED | 132 | #endif //KAB_EMBEDDED |
132 | 133 | ||
133 | #ifdef KAB_EMBEDDED | 134 | #ifdef KAB_EMBEDDED |
134 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 135 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
135 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 136 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
136 | #endif //KAB_EMBEDDED | 137 | #endif //KAB_EMBEDDED |
137 | 138 | ||
138 | public slots: | 139 | public slots: |
139 | #ifdef KAB_EMBEDDED | 140 | #ifdef KAB_EMBEDDED |
140 | void createAboutData(); | 141 | void createAboutData(); |
141 | #endif //KAB_EMBEDDED | 142 | #endif //KAB_EMBEDDED |
142 | 143 | ||
143 | void statusMessage(QString, int time = 0 ); | 144 | void statusMessage(QString, int time = 0 ); |
144 | /** | 145 | /** |
145 | Is called whenever a contact is selected in the view. | 146 | Is called whenever a contact is selected in the view. |
146 | */ | 147 | */ |
147 | void setContactSelected( const QString &uid ); | 148 | void setContactSelected( const QString &uid ); |
148 | 149 | ||
149 | /** | 150 | /** |
150 | Opens the preferred mail composer with all selected contacts as | 151 | Opens the preferred mail composer with all selected contacts as |
151 | arguments. | 152 | arguments. |
152 | */ | 153 | */ |
153 | void sendMail(); | 154 | void sendMail(); |
154 | 155 | ||
155 | /** | 156 | /** |
156 | Opens the preferred mail composer with the given contacts as | 157 | Opens the preferred mail composer with the given contacts as |
157 | arguments. | 158 | arguments. |
158 | */ | 159 | */ |
159 | void sendMail( const QString& email ); | 160 | void sendMail( const QString& email ); |
160 | 161 | ||
161 | 162 | ||
162 | void mailVCard(); | 163 | void mailVCard(); |
163 | void mailVCard(const QStringList& uids); | 164 | void mailVCard(const QStringList& uids); |
164 | 165 | ||
165 | /** | 166 | /** |
167 | Beams the "WhoAmI contact. | ||
168 | */ | ||
169 | void beamMySelf(); | ||
170 | |||
171 | void beamVCard(); | ||
172 | void beamVCard(const QStringList& uids); | ||
173 | void beamDone( Ir *ir ); | ||
174 | |||
175 | |||
176 | /** | ||
166 | Starts the preferred web browser with the given URL as argument. | 177 | Starts the preferred web browser with the given URL as argument. |
167 | */ | 178 | */ |
168 | void browse( const QString& url ); | 179 | void browse( const QString& url ); |
169 | 180 | ||
170 | /** | 181 | /** |
171 | Select all contacts in the view. | 182 | Select all contacts in the view. |
172 | */ | 183 | */ |
173 | void selectAllContacts(); | 184 | void selectAllContacts(); |
174 | 185 | ||
175 | /** | 186 | /** |
176 | Deletes all selected contacts from the address book. | 187 | Deletes all selected contacts from the address book. |
177 | */ | 188 | */ |
178 | void deleteContacts(); | 189 | void deleteContacts(); |
179 | 190 | ||
180 | /** | 191 | /** |
181 | Deletes given contacts from the address book. | 192 | Deletes given contacts from the address book. |
182 | 193 | ||
183 | @param uids The uids of the contacts, which shall be deleted. | 194 | @param uids The uids of the contacts, which shall be deleted. |
184 | */ | 195 | */ |
185 | void deleteContacts( const QStringList &uids ); | 196 | void deleteContacts( const QStringList &uids ); |
186 | 197 | ||
187 | /** | 198 | /** |
188 | Copys the selected contacts into clipboard for later pasting. | 199 | Copys the selected contacts into clipboard for later pasting. |
189 | */ | 200 | */ |
190 | void copyContacts(); | 201 | void copyContacts(); |
191 | 202 | ||
192 | /** | 203 | /** |
193 | Cuts the selected contacts and stores them for later pasting. | 204 | Cuts the selected contacts and stores them for later pasting. |
194 | */ | 205 | */ |
195 | void cutContacts(); | 206 | void cutContacts(); |
196 | 207 | ||
197 | /** | 208 | /** |
198 | Paste contacts from clipboard into the address book. | 209 | Paste contacts from clipboard into the address book. |
199 | */ | 210 | */ |
200 | void pasteContacts(); | 211 | void pasteContacts(); |
201 | 212 | ||
202 | /** | 213 | /** |
203 | Paste given contacts into the address book. | 214 | Paste given contacts into the address book. |
204 | 215 | ||
205 | @param list The list of addressee, which shall be pasted. | 216 | @param list The list of addressee, which shall be pasted. |
206 | */ | 217 | */ |
207 | void pasteContacts( KABC::Addressee::List &list ); | 218 | void pasteContacts( KABC::Addressee::List &list ); |
208 | 219 | ||
209 | /** | 220 | /** |
210 | Sets the whoAmI contact, that is used by many other programs to | 221 | Sets the whoAmI contact, that is used by many other programs to |
211 | get personal information about the current user. | 222 | get personal information about the current user. |
212 | */ | 223 | */ |
213 | void setWhoAmI(); | 224 | void setWhoAmI(); |
@@ -241,184 +252,187 @@ class KABCore : public QWidget | |||
241 | /** | 252 | /** |
242 | Marks the address book as modified concerning the argument. | 253 | Marks the address book as modified concerning the argument. |
243 | */ | 254 | */ |
244 | void setModified( bool modified ); | 255 | void setModified( bool modified ); |
245 | 256 | ||
246 | /** | 257 | /** |
247 | Returns whether the address book is modified. | 258 | Returns whether the address book is modified. |
248 | */ | 259 | */ |
249 | bool modified() const; | 260 | bool modified() const; |
250 | 261 | ||
251 | /** | 262 | /** |
252 | Called whenever an contact is modified in the contact editor | 263 | Called whenever an contact is modified in the contact editor |
253 | dialog or the quick edit. | 264 | dialog or the quick edit. |
254 | */ | 265 | */ |
255 | void contactModified( const KABC::Addressee &addr ); | 266 | void contactModified( const KABC::Addressee &addr ); |
256 | 267 | ||
257 | /** | 268 | /** |
258 | DCOP METHODS. | 269 | DCOP METHODS. |
259 | */ | 270 | */ |
260 | void addEmail( QString addr ); | 271 | void addEmail( QString addr ); |
261 | void importVCard( const KURL& url, bool showPreview ); | 272 | void importVCard( const KURL& url, bool showPreview ); |
262 | void importVCard( const QString& vCard, bool showPreview ); | 273 | void importVCard( const QString& vCard, bool showPreview ); |
263 | void newContact(); | 274 | void newContact(); |
264 | QString getNameByPhone( const QString& phone ); | 275 | QString getNameByPhone( const QString& phone ); |
265 | /** | 276 | /** |
266 | END DCOP METHODS | 277 | END DCOP METHODS |
267 | */ | 278 | */ |
268 | 279 | ||
269 | /** | 280 | /** |
270 | Saves the contents of the AddressBook back to disk. | 281 | Saves the contents of the AddressBook back to disk. |
271 | */ | 282 | */ |
272 | void save(); | 283 | void save(); |
273 | 284 | ||
274 | /** | 285 | /** |
275 | Undos the last command using the undo stack. | 286 | Undos the last command using the undo stack. |
276 | */ | 287 | */ |
277 | void undo(); | 288 | void undo(); |
278 | 289 | ||
279 | /** | 290 | /** |
280 | Redos the last command that was undone, using the redo stack. | 291 | Redos the last command that was undone, using the redo stack. |
281 | */ | 292 | */ |
282 | void redo(); | 293 | void redo(); |
283 | 294 | ||
284 | /** | 295 | /** |
285 | Shows the edit dialog for the given uid. If the uid is QString::null, | 296 | Shows the edit dialog for the given uid. If the uid is QString::null, |
286 | the method will try to find a selected addressee in the view. | 297 | the method will try to find a selected addressee in the view. |
287 | */ | 298 | */ |
288 | void editContact( const QString &uid /*US = QString::null*/ ); | 299 | void editContact( const QString &uid /*US = QString::null*/ ); |
289 | //US added a second method without defaultparameter | 300 | //US added a second method without defaultparameter |
290 | void editContact2(); | 301 | void editContact2(); |
291 | 302 | ||
292 | /** | 303 | /** |
293 | Launches the configuration dialog. | 304 | Launches the configuration dialog. |
294 | */ | 305 | */ |
295 | void openConfigDialog(); | 306 | void openConfigDialog(); |
296 | 307 | ||
297 | /** | 308 | /** |
298 | Launches the ldap search dialog. | 309 | Launches the ldap search dialog. |
299 | */ | 310 | */ |
300 | void openLDAPDialog(); | 311 | void openLDAPDialog(); |
301 | 312 | ||
302 | /** | 313 | /** |
303 | Creates a KAddressBookPrinter, which will display the print | 314 | Creates a KAddressBookPrinter, which will display the print |
304 | dialog and do the printing. | 315 | dialog and do the printing. |
305 | */ | 316 | */ |
306 | void print(); | 317 | void print(); |
307 | 318 | ||
308 | /** | 319 | /** |
309 | Registers a new GUI client, so plugins can register its actions. | 320 | Registers a new GUI client, so plugins can register its actions. |
310 | */ | 321 | */ |
311 | void addGUIClient( KXMLGUIClient *client ); | 322 | void addGUIClient( KXMLGUIClient *client ); |
312 | 323 | ||
313 | signals: | 324 | signals: |
314 | void contactSelected( const QString &name ); | 325 | void contactSelected( const QString &name ); |
315 | void contactSelected( const QPixmap &pixmap ); | 326 | void contactSelected( const QPixmap &pixmap ); |
316 | public slots: | 327 | public slots: |
317 | void setDetailsVisible( bool visible ); | 328 | void setDetailsVisible( bool visible ); |
318 | void setDetailsToState(); | 329 | void setDetailsToState(); |
319 | private slots: | 330 | private slots: |
320 | void setJumpButtonBarVisible( bool visible ); | 331 | void setJumpButtonBarVisible( bool visible ); |
321 | void importFromOL(); | 332 | void importFromOL(); |
322 | void extensionModified( const KABC::Addressee::List &list ); | 333 | void extensionModified( const KABC::Addressee::List &list ); |
323 | void clipboardDataChanged(); | 334 | void clipboardDataChanged(); |
324 | void updateActionMenu(); | 335 | void updateActionMenu(); |
325 | void configureKeyBindings(); | 336 | void configureKeyBindings(); |
326 | void removeVoice(); | 337 | void removeVoice(); |
327 | #ifdef KAB_EMBEDDED | 338 | #ifdef KAB_EMBEDDED |
328 | void configureResources(); | 339 | void configureResources(); |
329 | #endif //KAB_EMBEDDED | 340 | #endif //KAB_EMBEDDED |
330 | 341 | ||
331 | void slotEditorDestroyed( const QString &uid ); | 342 | void slotEditorDestroyed( const QString &uid ); |
332 | void configurationChanged(); | 343 | void configurationChanged(); |
333 | void addressBookChanged(); | 344 | void addressBookChanged(); |
334 | 345 | ||
335 | private: | 346 | private: |
336 | void initGUI(); | 347 | void initGUI(); |
337 | void initActions(); | 348 | void initActions(); |
338 | 349 | ||
339 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 350 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
340 | const char *name = 0 ); | 351 | const char *name = 0 ); |
341 | 352 | ||
342 | KXMLGUIClient *mGUIClient; | 353 | KXMLGUIClient *mGUIClient; |
343 | 354 | ||
344 | KABC::AddressBook *mAddressBook; | 355 | KABC::AddressBook *mAddressBook; |
345 | 356 | ||
346 | ViewManager *mViewManager; | 357 | ViewManager *mViewManager; |
347 | // QSplitter *mDetailsSplitter; | 358 | // QSplitter *mDetailsSplitter; |
348 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 359 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
349 | ViewContainer *mDetails; | 360 | ViewContainer *mDetails; |
350 | KDGanttMinimizeSplitter* mMiniSplitter; | 361 | KDGanttMinimizeSplitter* mMiniSplitter; |
351 | XXPortManager *mXXPortManager; | 362 | XXPortManager *mXXPortManager; |
352 | JumpButtonBar *mJumpButtonBar; | 363 | JumpButtonBar *mJumpButtonBar; |
353 | IncSearchWidget *mIncSearchWidget; | 364 | IncSearchWidget *mIncSearchWidget; |
354 | ExtensionManager *mExtensionManager; | 365 | ExtensionManager *mExtensionManager; |
355 | 366 | ||
356 | KCMultiDialog *mConfigureDialog; | 367 | KCMultiDialog *mConfigureDialog; |
357 | 368 | ||
358 | #ifndef KAB_EMBEDDED | 369 | #ifndef KAB_EMBEDDED |
359 | LDAPSearchDialog *mLdapSearchDialog; | 370 | LDAPSearchDialog *mLdapSearchDialog; |
360 | #endif //KAB_EMBEDDED | 371 | #endif //KAB_EMBEDDED |
361 | // QDict<AddresseeEditorDialog> mEditorDict; | 372 | // QDict<AddresseeEditorDialog> mEditorDict; |
362 | AddresseeEditorDialog *mEditorDialog; | 373 | AddresseeEditorDialog *mEditorDialog; |
363 | bool mReadWrite; | 374 | bool mReadWrite; |
364 | bool mModified; | 375 | bool mModified; |
365 | bool mIsPart; | 376 | bool mIsPart; |
366 | 377 | ||
367 | //US file menu | 378 | //US file menu |
368 | KAction *mActionMail; | 379 | KAction *mActionMail; |
380 | KAction *mActionBeam; | ||
369 | KAction* mActionPrint; | 381 | KAction* mActionPrint; |
370 | KAction* mActionNewContact; | 382 | KAction* mActionNewContact; |
371 | KAction *mActionSave; | 383 | KAction *mActionSave; |
372 | KAction *mActionEditAddressee; | 384 | KAction *mActionEditAddressee; |
373 | KAction *mActionMailVCard; | 385 | KAction *mActionMailVCard; |
386 | KAction *mActionBeamVCard; | ||
387 | |||
374 | KAction *mActionQuit; | 388 | KAction *mActionQuit; |
375 | 389 | ||
376 | //US edit menu | 390 | //US edit menu |
377 | KAction *mActionCopy; | 391 | KAction *mActionCopy; |
378 | KAction *mActionCut; | 392 | KAction *mActionCut; |
379 | KAction *mActionPaste; | 393 | KAction *mActionPaste; |
380 | KAction *mActionSelectAll; | 394 | KAction *mActionSelectAll; |
381 | KAction *mActionUndo; | 395 | KAction *mActionUndo; |
382 | KAction *mActionRedo; | 396 | KAction *mActionRedo; |
383 | KAction *mActionDelete; | 397 | KAction *mActionDelete; |
384 | 398 | ||
385 | //US settings menu | 399 | //US settings menu |
386 | KAction *mActionConfigResources; | 400 | KAction *mActionConfigResources; |
387 | KAction *mActionConfigKAddressbook; | 401 | KAction *mActionConfigKAddressbook; |
388 | KAction *mActionConfigShortcuts; | 402 | KAction *mActionConfigShortcuts; |
389 | KAction *mActionConfigureToolbars; | 403 | KAction *mActionConfigureToolbars; |
390 | KAction *mActionKeyBindings; | 404 | KAction *mActionKeyBindings; |
391 | KToggleAction *mActionJumpBar; | 405 | KToggleAction *mActionJumpBar; |
392 | KToggleAction *mActionDetails; | 406 | KToggleAction *mActionDetails; |
393 | KAction *mActionWhoAmI; | 407 | KAction *mActionWhoAmI; |
394 | KAction *mActionCategories; | 408 | KAction *mActionCategories; |
395 | KAction *mActionAboutKAddressbook; | 409 | KAction *mActionAboutKAddressbook; |
396 | 410 | ||
397 | KAction *mActionDeleteView; | 411 | KAction *mActionDeleteView; |
398 | 412 | ||
399 | QPopupMenu *viewMenu; | 413 | QPopupMenu *viewMenu; |
400 | QPopupMenu *filterMenu; | 414 | QPopupMenu *filterMenu; |
401 | QPopupMenu *settingsMenu; | 415 | QPopupMenu *settingsMenu; |
402 | QPopupMenu *changeMenu; | 416 | QPopupMenu *changeMenu; |
403 | 417 | ||
404 | //US QAction *mActionSave; | 418 | //US QAction *mActionSave; |
405 | QPopupMenu *ImportMenu; | 419 | QPopupMenu *ImportMenu; |
406 | QPopupMenu *ExportMenu; | 420 | QPopupMenu *ExportMenu; |
407 | //LR additional methods | 421 | //LR additional methods |
408 | KAction *mActionRemoveVoice; | 422 | KAction *mActionRemoveVoice; |
409 | KAction * mActionImportOL; | 423 | KAction * mActionImportOL; |
410 | 424 | ||
411 | #ifndef KAB_EMBEDDED | 425 | #ifndef KAB_EMBEDDED |
412 | KAddressBookService *mAddressBookService; | 426 | KAddressBookService *mAddressBookService; |
413 | #endif //KAB_EMBEDDED | 427 | #endif //KAB_EMBEDDED |
414 | 428 | ||
415 | class KABCorePrivate; | 429 | class KABCorePrivate; |
416 | KABCorePrivate *d; | 430 | KABCorePrivate *d; |
417 | 431 | ||
418 | #ifdef KAB_EMBEDDED | 432 | #ifdef KAB_EMBEDDED |
419 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 433 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
420 | #endif //KAB_EMBEDDED | 434 | #endif //KAB_EMBEDDED |
421 | 435 | ||
422 | }; | 436 | }; |
423 | 437 | ||
424 | #endif | 438 | #endif |