author | zautrix <zautrix> | 2004-10-06 16:02:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 16:02:56 (UTC) |
commit | a22de800110d8350a5200a994b041e47d51bf4c6 (patch) (unidiff) | |
tree | a4de195003d1ceabc3fd9ca4e5cd0510570bcb97 /kaddressbook | |
parent | ef71411c2f248d1dc908aa2f119c9b281e0e8bb9 (diff) | |
download | kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.zip kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.gz kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.bz2 |
added phone export
-rw-r--r-- | kaddressbook/kabcore.cpp | 143 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 |
2 files changed, 145 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f8359de..185cf46 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -13,48 +13,52 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | ||
38 | #include <qlineedit.h> | ||
39 | #include <qcheckbox.h> | ||
40 | #include <qpushbutton.h> | ||
37 | #include <qprogressbar.h> | 41 | #include <qprogressbar.h> |
38 | 42 | ||
39 | #ifndef KAB_EMBEDDED | 43 | #ifndef KAB_EMBEDDED |
40 | #include <qclipboard.h> | 44 | #include <qclipboard.h> |
41 | #include <qdir.h> | 45 | #include <qdir.h> |
42 | #include <qfile.h> | 46 | #include <qfile.h> |
43 | #include <qapplicaton.h> | 47 | #include <qapplicaton.h> |
44 | #include <qprogressbar.h> | 48 | #include <qprogressbar.h> |
45 | #include <qlayout.h> | 49 | #include <qlayout.h> |
46 | #include <qregexp.h> | 50 | #include <qregexp.h> |
47 | #include <qvbox.h> | 51 | #include <qvbox.h> |
48 | #include <kabc/addresseelist.h> | 52 | #include <kabc/addresseelist.h> |
49 | #include <kabc/errorhandler.h> | 53 | #include <kabc/errorhandler.h> |
50 | #include <kabc/resource.h> | 54 | #include <kabc/resource.h> |
51 | #include <kabc/vcardconverter.h> | 55 | #include <kabc/vcardconverter.h> |
52 | #include <kapplication.h> | 56 | #include <kapplication.h> |
53 | #include <kactionclasses.h> | 57 | #include <kactionclasses.h> |
54 | #include <kcmultidialog.h> | 58 | #include <kcmultidialog.h> |
55 | #include <kdebug.h> | 59 | #include <kdebug.h> |
56 | #include <kdeversion.h> | 60 | #include <kdeversion.h> |
57 | #include <kkeydialog.h> | 61 | #include <kkeydialog.h> |
58 | #include <kmessagebox.h> | 62 | #include <kmessagebox.h> |
59 | #include <kprinter.h> | 63 | #include <kprinter.h> |
60 | #include <kprotocolinfo.h> | 64 | #include <kprotocolinfo.h> |
@@ -132,48 +136,92 @@ $Id$ | |||
132 | 136 | ||
133 | #include "addresseeutil.h" | 137 | #include "addresseeutil.h" |
134 | #include "undocmds.h" | 138 | #include "undocmds.h" |
135 | #include "addresseeeditordialog.h" | 139 | #include "addresseeeditordialog.h" |
136 | #include "viewmanager.h" | 140 | #include "viewmanager.h" |
137 | #include "details/detailsviewcontainer.h" | 141 | #include "details/detailsviewcontainer.h" |
138 | #include "kabprefs.h" | 142 | #include "kabprefs.h" |
139 | #include "xxportmanager.h" | 143 | #include "xxportmanager.h" |
140 | #include "incsearchwidget.h" | 144 | #include "incsearchwidget.h" |
141 | #include "jumpbuttonbar.h" | 145 | #include "jumpbuttonbar.h" |
142 | #include "extensionmanager.h" | 146 | #include "extensionmanager.h" |
143 | #include "addresseeconfig.h" | 147 | #include "addresseeconfig.h" |
144 | #include <kcmultidialog.h> | 148 | #include <kcmultidialog.h> |
145 | 149 | ||
146 | #ifdef _WIN32_ | 150 | #ifdef _WIN32_ |
147 | 151 | ||
148 | #include "kaimportoldialog.h" | 152 | #include "kaimportoldialog.h" |
149 | #else | 153 | #else |
150 | #include <unistd.h> | 154 | #include <unistd.h> |
151 | #endif | 155 | #endif |
152 | // sync includes | 156 | // sync includes |
153 | #include <libkdepim/ksyncprofile.h> | 157 | #include <libkdepim/ksyncprofile.h> |
154 | #include <libkdepim/ksyncprefsdialog.h> | 158 | #include <libkdepim/ksyncprefsdialog.h> |
155 | 159 | ||
160 | class KAex2phonePrefs : public QDialog | ||
161 | { | ||
162 | public: | ||
163 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | ||
164 | QDialog( parent, name, true ) | ||
165 | { | ||
166 | setCaption( i18n("Export to phone options") ); | ||
167 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
168 | lay->setSpacing( 3 ); | ||
169 | lay->setMargin( 3 ); | ||
170 | QLabel *lab; | ||
171 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | ||
172 | lab->setAlignment (AlignHCenter ); | ||
173 | QHBox* temphb; | ||
174 | temphb = new QHBox( this ); | ||
175 | new QLabel( i18n("I/O device: "), temphb ); | ||
176 | mPhoneDevice = new QLineEdit( temphb); | ||
177 | lay->addWidget( temphb ); | ||
178 | temphb = new QHBox( this ); | ||
179 | new QLabel( i18n("Connection: "), temphb ); | ||
180 | mPhoneConnection = new QLineEdit( temphb); | ||
181 | lay->addWidget( temphb ); | ||
182 | temphb = new QHBox( this ); | ||
183 | new QLabel( i18n("Model(opt.): "), temphb ); | ||
184 | mPhoneModel = new QLineEdit( temphb); | ||
185 | lay->addWidget( temphb ); | ||
186 | mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | ||
187 | lay->addWidget( mWriteToSim ); | ||
188 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | ||
189 | lab->setAlignment (AlignHCenter ); | ||
190 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | ||
191 | lay->addWidget( ok ); | ||
192 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | ||
193 | lay->addWidget( cancel ); | ||
194 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
195 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
196 | resize( 220, 240 ); | ||
197 | |||
198 | } | ||
199 | |||
200 | public: | ||
201 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | ||
202 | QCheckBox* mWriteToSim; | ||
203 | }; | ||
156 | 204 | ||
157 | bool pasteWithNewUid = true; | 205 | bool pasteWithNewUid = true; |
158 | 206 | ||
159 | #ifdef KAB_EMBEDDED | 207 | #ifdef KAB_EMBEDDED |
160 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 208 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
161 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 209 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
162 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 210 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
163 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 211 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
164 | #else //KAB_EMBEDDED | 212 | #else //KAB_EMBEDDED |
165 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 213 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
166 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 214 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
167 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 215 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
168 | mReadWrite( readWrite ), mModified( false ) | 216 | mReadWrite( readWrite ), mModified( false ) |
169 | #endif //KAB_EMBEDDED | 217 | #endif //KAB_EMBEDDED |
170 | { | 218 | { |
171 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 219 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
172 | // syncManager->setBlockSave(false); | 220 | // syncManager->setBlockSave(false); |
173 | mExtensionBarSplitter = 0; | 221 | mExtensionBarSplitter = 0; |
174 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 222 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
175 | 223 | ||
176 | mAddressBook = KABC::StdAddressBook::self(); | 224 | mAddressBook = KABC::StdAddressBook::self(); |
177 | KABC::StdAddressBook::setAutomaticSave( false ); | 225 | KABC::StdAddressBook::setAutomaticSave( false ); |
178 | 226 | ||
179 | #ifndef KAB_EMBEDDED | 227 | #ifndef KAB_EMBEDDED |
@@ -489,48 +537,49 @@ void KABCore::setContactSelected( const QString &uid ) | |||
489 | } | 537 | } |
490 | 538 | ||
491 | 539 | ||
492 | mExtensionManager->setSelectionChanged(); | 540 | mExtensionManager->setSelectionChanged(); |
493 | 541 | ||
494 | // update the actions | 542 | // update the actions |
495 | bool selected = !uid.isEmpty(); | 543 | bool selected = !uid.isEmpty(); |
496 | 544 | ||
497 | if ( mReadWrite ) { | 545 | if ( mReadWrite ) { |
498 | mActionCut->setEnabled( selected ); | 546 | mActionCut->setEnabled( selected ); |
499 | mActionPaste->setEnabled( selected ); | 547 | mActionPaste->setEnabled( selected ); |
500 | } | 548 | } |
501 | 549 | ||
502 | mActionCopy->setEnabled( selected ); | 550 | mActionCopy->setEnabled( selected ); |
503 | mActionDelete->setEnabled( selected ); | 551 | mActionDelete->setEnabled( selected ); |
504 | mActionEditAddressee->setEnabled( selected ); | 552 | mActionEditAddressee->setEnabled( selected ); |
505 | mActionMail->setEnabled( selected ); | 553 | mActionMail->setEnabled( selected ); |
506 | mActionMailVCard->setEnabled( selected ); | 554 | mActionMailVCard->setEnabled( selected ); |
507 | //if (mActionBeam) | 555 | //if (mActionBeam) |
508 | //mActionBeam->setEnabled( selected ); | 556 | //mActionBeam->setEnabled( selected ); |
509 | 557 | ||
510 | if (mActionBeamVCard) | 558 | if (mActionBeamVCard) |
511 | mActionBeamVCard->setEnabled( selected ); | 559 | mActionBeamVCard->setEnabled( selected ); |
512 | 560 | ||
561 | mActionExport2phone->setEnabled( selected ); | ||
513 | mActionWhoAmI->setEnabled( selected ); | 562 | mActionWhoAmI->setEnabled( selected ); |
514 | mActionCategories->setEnabled( selected ); | 563 | mActionCategories->setEnabled( selected ); |
515 | } | 564 | } |
516 | 565 | ||
517 | void KABCore::sendMail() | 566 | void KABCore::sendMail() |
518 | { | 567 | { |
519 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 568 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
520 | } | 569 | } |
521 | 570 | ||
522 | void KABCore::sendMail( const QString& emaillist ) | 571 | void KABCore::sendMail( const QString& emaillist ) |
523 | { | 572 | { |
524 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 573 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
525 | if (emaillist.contains(",") > 0) | 574 | if (emaillist.contains(",") > 0) |
526 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 575 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
527 | else | 576 | else |
528 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 577 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
529 | } | 578 | } |
530 | 579 | ||
531 | 580 | ||
532 | 581 | ||
533 | void KABCore::mailVCard() | 582 | void KABCore::mailVCard() |
534 | { | 583 | { |
535 | QStringList uids = mViewManager->selectedUids(); | 584 | QStringList uids = mViewManager->selectedUids(); |
536 | if ( !uids.isEmpty() ) | 585 | if ( !uids.isEmpty() ) |
@@ -588,48 +637,137 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
588 | urls ); // attachments | 637 | urls ); // attachments |
589 | */ | 638 | */ |
590 | 639 | ||
591 | } | 640 | } |
592 | 641 | ||
593 | /** | 642 | /** |
594 | Beams the "WhoAmI contact. | 643 | Beams the "WhoAmI contact. |
595 | */ | 644 | */ |
596 | void KABCore::beamMySelf() | 645 | void KABCore::beamMySelf() |
597 | { | 646 | { |
598 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 647 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
599 | if (!a.isEmpty()) | 648 | if (!a.isEmpty()) |
600 | { | 649 | { |
601 | QStringList uids; | 650 | QStringList uids; |
602 | uids << a.uid(); | 651 | uids << a.uid(); |
603 | 652 | ||
604 | beamVCard(uids); | 653 | beamVCard(uids); |
605 | } else { | 654 | } else { |
606 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 655 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
607 | 656 | ||
608 | 657 | ||
609 | } | 658 | } |
610 | } | 659 | } |
611 | 660 | ||
661 | void KABCore::export2phone() | ||
662 | { | ||
663 | |||
664 | KAex2phonePrefs ex2phone; | ||
665 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | ||
666 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | ||
667 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | ||
668 | |||
669 | if ( !ex2phone.exec() ) { | ||
670 | return; | ||
671 | } | ||
672 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | ||
673 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | ||
674 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | ||
675 | |||
676 | #if 0 | ||
677 | PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | ||
678 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | ||
679 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | ||
680 | |||
681 | |||
682 | |||
683 | |||
684 | |||
685 | QString fileName = "/tmp/kapibeamfile.vcf"; | ||
686 | |||
687 | |||
688 | //QDir().mkdir( dirName, true ); | ||
689 | |||
690 | |||
691 | KABC::VCardConverter converter; | ||
692 | QString description; | ||
693 | QString datastream; | ||
694 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | ||
695 | KABC::Addressee a = mAddressBook->findByUid( *it ); | ||
696 | |||
697 | if ( a.isEmpty() ) | ||
698 | continue; | ||
699 | |||
700 | if (description.isEmpty()) | ||
701 | description = a.formattedName(); | ||
702 | |||
703 | QString vcard; | ||
704 | converter.addresseeToVCard( a, vcard ); | ||
705 | int start = 0; | ||
706 | int next; | ||
707 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | ||
708 | int semi = vcard.find(";", next); | ||
709 | int dopp = vcard.find(":", next); | ||
710 | int sep; | ||
711 | if ( semi < dopp && semi >= 0 ) | ||
712 | sep = semi ; | ||
713 | else | ||
714 | sep = dopp; | ||
715 | datastream +=vcard.mid( start, next - start); | ||
716 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | ||
717 | start = sep; | ||
718 | } | ||
719 | datastream += vcard.mid( start,vcard.length() ); | ||
720 | } | ||
721 | #ifndef DESKTOP_VERSION | ||
722 | QFile outFile(fileName); | ||
723 | if ( outFile.open(IO_WriteOnly) ) { | ||
724 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | ||
725 | QTextStream t( &outFile ); // use a text stream | ||
726 | t.setEncoding( QTextStream::UnicodeUTF8 ); | ||
727 | t <<datastream; | ||
728 | outFile.close(); | ||
729 | Ir *ir = new Ir( this ); | ||
730 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | ||
731 | ir->send( fileName, description, "text/x-vCard" ); | ||
732 | } else { | ||
733 | qDebug("Error open temp beam file "); | ||
734 | return; | ||
735 | } | ||
736 | #endif | ||
737 | |||
738 | |||
739 | |||
740 | |||
741 | setCaption( i18n("Writing to phone...")); | ||
742 | if ( PhoneFormat::writeToPhone( cal ) ) | ||
743 | setCaption( i18n("Export to phone successful!")); | ||
744 | else | ||
745 | setCaption( i18n("Error exporting to phone!")); | ||
746 | #endif | ||
747 | |||
748 | |||
749 | } | ||
612 | void KABCore::beamVCard() | 750 | void KABCore::beamVCard() |
613 | { | 751 | { |
614 | QStringList uids = mViewManager->selectedUids(); | 752 | QStringList uids = mViewManager->selectedUids(); |
615 | if ( !uids.isEmpty() ) | 753 | if ( !uids.isEmpty() ) |
616 | beamVCard( uids ); | 754 | beamVCard( uids ); |
617 | } | 755 | } |
618 | 756 | ||
619 | 757 | ||
620 | void KABCore::beamVCard(const QStringList& uids) | 758 | void KABCore::beamVCard(const QStringList& uids) |
621 | { | 759 | { |
622 | /*US | 760 | /*US |
623 | QString beamFilename; | 761 | QString beamFilename; |
624 | Opie::OPimContact c; | 762 | Opie::OPimContact c; |
625 | if ( actionPersonal->isOn() ) { | 763 | if ( actionPersonal->isOn() ) { |
626 | beamFilename = addressbookPersonalVCardName(); | 764 | beamFilename = addressbookPersonalVCardName(); |
627 | if ( !QFile::exists( beamFilename ) ) | 765 | if ( !QFile::exists( beamFilename ) ) |
628 | return; // can't beam a non-existent file | 766 | return; // can't beam a non-existent file |
629 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 767 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
630 | beamFilename ); | 768 | beamFilename ); |
631 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 769 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
632 | Opie::OPimContactAccess::List allList = access->allRecords(); | 770 | Opie::OPimContactAccess::List allList = access->allRecords(); |
633 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 771 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
634 | c = *it; | 772 | c = *it; |
635 | 773 | ||
@@ -1583,48 +1721,52 @@ void KABCore::initActions() | |||
1583 | // file menu | 1721 | // file menu |
1584 | if ( mIsPart ) { | 1722 | if ( mIsPart ) { |
1585 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1723 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1586 | SLOT( sendMail() ), actionCollection(), | 1724 | SLOT( sendMail() ), actionCollection(), |
1587 | "kaddressbook_mail" ); | 1725 | "kaddressbook_mail" ); |
1588 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1726 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1589 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1727 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1590 | 1728 | ||
1591 | } else { | 1729 | } else { |
1592 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1730 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1593 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1731 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1594 | } | 1732 | } |
1595 | 1733 | ||
1596 | 1734 | ||
1597 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1735 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1598 | SLOT( save() ), actionCollection(), "file_sync" ); | 1736 | SLOT( save() ), actionCollection(), "file_sync" ); |
1599 | 1737 | ||
1600 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1738 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1601 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1739 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1602 | 1740 | ||
1603 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1741 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1604 | this, SLOT( mailVCard() ), | 1742 | this, SLOT( mailVCard() ), |
1605 | actionCollection(), "file_mail_vcard"); | 1743 | actionCollection(), "file_mail_vcard"); |
1606 | 1744 | ||
1745 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | ||
1746 | SLOT( export2phone() ), actionCollection(), | ||
1747 | "kaddressbook_ex2phone" ); | ||
1748 | |||
1607 | mActionBeamVCard = 0; | 1749 | mActionBeamVCard = 0; |
1608 | mActionBeam = 0; | 1750 | mActionBeam = 0; |
1609 | 1751 | ||
1610 | #ifndef DESKTOP_VERSION | 1752 | #ifndef DESKTOP_VERSION |
1611 | if ( Ir::supported() ) { | 1753 | if ( Ir::supported() ) { |
1612 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1754 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1613 | SLOT( beamVCard() ), actionCollection(), | 1755 | SLOT( beamVCard() ), actionCollection(), |
1614 | "kaddressbook_beam_vcard" ); | 1756 | "kaddressbook_beam_vcard" ); |
1615 | 1757 | ||
1616 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1758 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1617 | SLOT( beamMySelf() ), actionCollection(), | 1759 | SLOT( beamMySelf() ), actionCollection(), |
1618 | "kaddressbook_beam_myself" ); | 1760 | "kaddressbook_beam_myself" ); |
1619 | } | 1761 | } |
1620 | #endif | 1762 | #endif |
1621 | 1763 | ||
1622 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1764 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1623 | this, SLOT( editContact2() ), | 1765 | this, SLOT( editContact2() ), |
1624 | actionCollection(), "file_properties" ); | 1766 | actionCollection(), "file_properties" ); |
1625 | 1767 | ||
1626 | #ifdef KAB_EMBEDDED | 1768 | #ifdef KAB_EMBEDDED |
1627 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1769 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1628 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1770 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1629 | mMainWindow, SLOT( exit() ), | 1771 | mMainWindow, SLOT( exit() ), |
1630 | actionCollection(), "quit" ); | 1772 | actionCollection(), "quit" ); |
@@ -1883,48 +2025,49 @@ void KABCore::addActionsManually() | |||
1883 | mActionDelete->plug( tb ); | 2025 | mActionDelete->plug( tb ); |
1884 | mActionRedo->plug( tb ); | 2026 | mActionRedo->plug( tb ); |
1885 | } | 2027 | } |
1886 | } | 2028 | } |
1887 | //mActionQuit->plug ( tb ); | 2029 | //mActionQuit->plug ( tb ); |
1888 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2030 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1889 | 2031 | ||
1890 | //US link the searchwidget first to this. | 2032 | //US link the searchwidget first to this. |
1891 | // The real linkage to the toolbar happens later. | 2033 | // The real linkage to the toolbar happens later. |
1892 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2034 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1893 | //US tb->insertItem( mIncSearchWidget ); | 2035 | //US tb->insertItem( mIncSearchWidget ); |
1894 | /*US | 2036 | /*US |
1895 | mIncSearchWidget = new IncSearchWidget( tb ); | 2037 | mIncSearchWidget = new IncSearchWidget( tb ); |
1896 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2038 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1897 | SLOT( incrementalSearch( const QString& ) ) ); | 2039 | SLOT( incrementalSearch( const QString& ) ) ); |
1898 | 2040 | ||
1899 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2041 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1900 | 2042 | ||
1901 | //US topLayout->addWidget( mJumpButtonBar ); | 2043 | //US topLayout->addWidget( mJumpButtonBar ); |
1902 | this->layout()->add( mJumpButtonBar ); | 2044 | this->layout()->add( mJumpButtonBar ); |
1903 | */ | 2045 | */ |
1904 | 2046 | ||
1905 | #endif //KAB_EMBEDDED | 2047 | #endif //KAB_EMBEDDED |
1906 | 2048 | ||
2049 | mActionExport2phone->plug( ExportMenu ); | ||
1907 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2050 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
1908 | syncManager->fillSyncMenu(); | 2051 | syncManager->fillSyncMenu(); |
1909 | 2052 | ||
1910 | } | 2053 | } |
1911 | void KABCore::showLicence() | 2054 | void KABCore::showLicence() |
1912 | { | 2055 | { |
1913 | KApplication::showLicence(); | 2056 | KApplication::showLicence(); |
1914 | } | 2057 | } |
1915 | void KABCore::removeVoice() | 2058 | void KABCore::removeVoice() |
1916 | { | 2059 | { |
1917 | 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 ) | 2060 | 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 ) |
1918 | return; | 2061 | return; |
1919 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2062 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1920 | KABC::Addressee::List::Iterator it; | 2063 | KABC::Addressee::List::Iterator it; |
1921 | for ( it = list.begin(); it != list.end(); ++it ) { | 2064 | for ( it = list.begin(); it != list.end(); ++it ) { |
1922 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 2065 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1923 | PhoneNumber::List::Iterator phoneIt; | 2066 | PhoneNumber::List::Iterator phoneIt; |
1924 | bool found = false; | 2067 | bool found = false; |
1925 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 2068 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1926 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 2069 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1927 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 2070 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1928 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 2071 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1929 | (*it).insertPhoneNumber( (*phoneIt) ); | 2072 | (*it).insertPhoneNumber( (*phoneIt) ); |
1930 | found = true; | 2073 | found = true; |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 941458d..e6f286b 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -153,48 +153,49 @@ class KABCore : public QWidget, public KSyncInterface | |||
153 | void setContactSelected( const QString &uid ); | 153 | void setContactSelected( const QString &uid ); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Opens the preferred mail composer with all selected contacts as | 156 | Opens the preferred mail composer with all selected contacts as |
157 | arguments. | 157 | arguments. |
158 | */ | 158 | */ |
159 | void sendMail(); | 159 | void sendMail(); |
160 | 160 | ||
161 | /** | 161 | /** |
162 | Opens the preferred mail composer with the given contacts as | 162 | Opens the preferred mail composer with the given contacts as |
163 | arguments. | 163 | arguments. |
164 | */ | 164 | */ |
165 | void sendMail( const QString& email ); | 165 | void sendMail( const QString& email ); |
166 | 166 | ||
167 | 167 | ||
168 | void mailVCard(); | 168 | void mailVCard(); |
169 | void mailVCard(const QStringList& uids); | 169 | void mailVCard(const QStringList& uids); |
170 | 170 | ||
171 | /** | 171 | /** |
172 | Beams the "WhoAmI contact. | 172 | Beams the "WhoAmI contact. |
173 | */ | 173 | */ |
174 | void beamMySelf(); | 174 | void beamMySelf(); |
175 | 175 | ||
176 | void beamVCard(); | 176 | void beamVCard(); |
177 | void export2phone(); | ||
177 | void beamVCard(const QStringList& uids); | 178 | void beamVCard(const QStringList& uids); |
178 | void beamDone( Ir *ir ); | 179 | void beamDone( Ir *ir ); |
179 | 180 | ||
180 | 181 | ||
181 | /** | 182 | /** |
182 | Starts the preferred web browser with the given URL as argument. | 183 | Starts the preferred web browser with the given URL as argument. |
183 | */ | 184 | */ |
184 | void browse( const QString& url ); | 185 | void browse( const QString& url ); |
185 | 186 | ||
186 | /** | 187 | /** |
187 | Select all contacts in the view. | 188 | Select all contacts in the view. |
188 | */ | 189 | */ |
189 | void selectAllContacts(); | 190 | void selectAllContacts(); |
190 | 191 | ||
191 | /** | 192 | /** |
192 | Deletes all selected contacts from the address book. | 193 | Deletes all selected contacts from the address book. |
193 | */ | 194 | */ |
194 | void deleteContacts(); | 195 | void deleteContacts(); |
195 | 196 | ||
196 | /** | 197 | /** |
197 | Deletes given contacts from the address book. | 198 | Deletes given contacts from the address book. |
198 | 199 | ||
199 | @param uids The uids of the contacts, which shall be deleted. | 200 | @param uids The uids of the contacts, which shall be deleted. |
200 | */ | 201 | */ |
@@ -376,48 +377,49 @@ class KABCore : public QWidget, public KSyncInterface | |||
376 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 377 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
377 | ViewContainer *mDetails; | 378 | ViewContainer *mDetails; |
378 | KDGanttMinimizeSplitter* mMiniSplitter; | 379 | KDGanttMinimizeSplitter* mMiniSplitter; |
379 | XXPortManager *mXXPortManager; | 380 | XXPortManager *mXXPortManager; |
380 | JumpButtonBar *mJumpButtonBar; | 381 | JumpButtonBar *mJumpButtonBar; |
381 | IncSearchWidget *mIncSearchWidget; | 382 | IncSearchWidget *mIncSearchWidget; |
382 | ExtensionManager *mExtensionManager; | 383 | ExtensionManager *mExtensionManager; |
383 | 384 | ||
384 | KCMultiDialog *mConfigureDialog; | 385 | KCMultiDialog *mConfigureDialog; |
385 | 386 | ||
386 | #ifndef KAB_EMBEDDED | 387 | #ifndef KAB_EMBEDDED |
387 | LDAPSearchDialog *mLdapSearchDialog; | 388 | LDAPSearchDialog *mLdapSearchDialog; |
388 | #endif //KAB_EMBEDDED | 389 | #endif //KAB_EMBEDDED |
389 | // QDict<AddresseeEditorDialog> mEditorDict; | 390 | // QDict<AddresseeEditorDialog> mEditorDict; |
390 | AddresseeEditorDialog *mEditorDialog; | 391 | AddresseeEditorDialog *mEditorDialog; |
391 | bool mReadWrite; | 392 | bool mReadWrite; |
392 | bool mModified; | 393 | bool mModified; |
393 | bool mIsPart; | 394 | bool mIsPart; |
394 | bool mMultipleViewsAtOnce; | 395 | bool mMultipleViewsAtOnce; |
395 | 396 | ||
396 | 397 | ||
397 | //US file menu | 398 | //US file menu |
398 | KAction *mActionMail; | 399 | KAction *mActionMail; |
399 | KAction *mActionBeam; | 400 | KAction *mActionBeam; |
401 | KAction *mActionExport2phone; | ||
400 | KAction* mActionPrint; | 402 | KAction* mActionPrint; |
401 | KAction* mActionNewContact; | 403 | KAction* mActionNewContact; |
402 | KAction *mActionSave; | 404 | KAction *mActionSave; |
403 | KAction *mActionEditAddressee; | 405 | KAction *mActionEditAddressee; |
404 | KAction *mActionMailVCard; | 406 | KAction *mActionMailVCard; |
405 | KAction *mActionBeamVCard; | 407 | KAction *mActionBeamVCard; |
406 | 408 | ||
407 | KAction *mActionQuit; | 409 | KAction *mActionQuit; |
408 | 410 | ||
409 | //US edit menu | 411 | //US edit menu |
410 | KAction *mActionCopy; | 412 | KAction *mActionCopy; |
411 | KAction *mActionCut; | 413 | KAction *mActionCut; |
412 | KAction *mActionPaste; | 414 | KAction *mActionPaste; |
413 | KAction *mActionSelectAll; | 415 | KAction *mActionSelectAll; |
414 | KAction *mActionUndo; | 416 | KAction *mActionUndo; |
415 | KAction *mActionRedo; | 417 | KAction *mActionRedo; |
416 | KAction *mActionDelete; | 418 | KAction *mActionDelete; |
417 | 419 | ||
418 | //US settings menu | 420 | //US settings menu |
419 | KAction *mActionConfigResources; | 421 | KAction *mActionConfigResources; |
420 | KAction *mActionConfigKAddressbook; | 422 | KAction *mActionConfigKAddressbook; |
421 | KAction *mActionConfigShortcuts; | 423 | KAction *mActionConfigShortcuts; |
422 | KAction *mActionConfigureToolbars; | 424 | KAction *mActionConfigureToolbars; |
423 | KAction *mActionKeyBindings; | 425 | KAction *mActionKeyBindings; |