-rw-r--r-- | kaddressbook/kabcore.cpp | 254 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 47 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 58 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 167 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 48 |
5 files changed, 367 insertions, 207 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a7ca0ce..2a54900 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -20,9 +20,9 @@ | |||
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "kabcore.h" | 24 | #include "kabcore.h" |
25 | 25 | ||
26 | #include <stdaddressbook.h> | 26 | #include <stdaddressbook.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
@@ -77,10 +77,16 @@ | |||
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | #include <kcmkabconfig.h> | 79 | #include <kcmkabconfig.h> |
80 | 80 | ||
81 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap | ||
82 | //#include <qlabel.h> | 81 | //#include <qlabel.h> |
82 | |||
83 | |||
84 | #ifdef Q_WS_QWS | ||
85 | #include <qtopia/services.h> | ||
86 | #include <qtopia/qcopenvelope_qws.h> | ||
87 | #endif | ||
88 | |||
83 | #endif // KAB_EMBEDDED | 89 | #endif // KAB_EMBEDDED |
84 | #include <kcmkabconfig.h> | 90 | #include <kcmkabconfig.h> |
85 | 91 | ||
86 | 92 | ||
@@ -90,13 +96,19 @@ | |||
90 | #include <picture.h> | 96 | #include <picture.h> |
91 | #include <resource.h> | 97 | #include <resource.h> |
92 | 98 | ||
93 | //US#include <qsplitter.h> | 99 | //US#include <qsplitter.h> |
100 | #include <qmap.h> | ||
101 | #include <qdir.h> | ||
102 | #include <qfile.h> | ||
94 | #include <qvbox.h> | 103 | #include <qvbox.h> |
95 | #include <qlayout.h> | 104 | #include <qlayout.h> |
96 | #include <qclipboard.h> | 105 | #include <qclipboard.h> |
106 | #include <qtextstream.h> | ||
97 | 107 | ||
98 | #include <libkdepim/categoryselectdialog.h> | 108 | #include <libkdepim/categoryselectdialog.h> |
109 | #include <kabc/vcardconverter.h> | ||
110 | |||
99 | 111 | ||
100 | #include "addresseeutil.h" | 112 | #include "addresseeutil.h" |
101 | #include "undocmds.h" | 113 | #include "undocmds.h" |
102 | #include "addresseeeditordialog.h" | 114 | #include "addresseeeditordialog.h" |
@@ -128,12 +140,9 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
128 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 140 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
129 | mReadWrite( readWrite ), mModified( false ) | 141 | mReadWrite( readWrite ), mModified( false ) |
130 | #endif //KAB_EMBEDDED | 142 | #endif //KAB_EMBEDDED |
131 | { | 143 | { |
132 | #ifdef KAB_EMBEDDED | 144 | |
133 | //US we define here our own global actioncollection. | ||
134 | //mActionCollection = new KActionCollection(this); | ||
135 | #endif //KAB_EMBEDDED | ||
136 | mExtensionBarSplitter = 0; | 145 | mExtensionBarSplitter = 0; |
137 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 146 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
138 | 147 | ||
139 | mAddressBook = KABC::StdAddressBook::self(); | 148 | mAddressBook = KABC::StdAddressBook::self(); |
@@ -141,9 +150,9 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
141 | 150 | ||
142 | #ifndef KAB_EMBEDDED | 151 | #ifndef KAB_EMBEDDED |
143 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 152 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
144 | #endif //KAB_EMBEDDED | 153 | #endif //KAB_EMBEDDED |
145 | 154 | ||
146 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 155 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
147 | SLOT( addressBookChanged() ) ); | 156 | SLOT( addressBookChanged() ) ); |
148 | 157 | ||
149 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 158 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
@@ -161,10 +170,10 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
161 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 170 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
162 | "X-IMAddress", "KADDRESSBOOK" ); | 171 | "X-IMAddress", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 172 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
164 | "X-Anniversary", "KADDRESSBOOK" ); | 173 | "X-Anniversary", "KADDRESSBOOK" ); |
165 | 174 | ||
166 | //US added this field to become compatible with Opie/qtopia addressbook | 175 | //US added this field to become compatible with Opie/qtopia addressbook |
167 | // values can be "female" or "male" or "". An empty field represents undefined. | 176 | // values can be "female" or "male" or "". An empty field represents undefined. |
168 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 177 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
169 | "X-Gender", "KADDRESSBOOK" ); | 178 | "X-Gender", "KADDRESSBOOK" ); |
170 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 179 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
@@ -194,15 +203,16 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
194 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 203 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
195 | SLOT( incrementalSearch( const QString& ) ) ); | 204 | SLOT( incrementalSearch( const QString& ) ) ); |
196 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 205 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
197 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 206 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
198 | 207 | ||
208 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | ||
209 | SLOT( sendMail( const QString& ) ) ); | ||
210 | |||
199 | #ifndef KAB_EMBEDDED | 211 | #ifndef KAB_EMBEDDED |
200 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 212 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
201 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 213 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
202 | 214 | ||
203 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | ||
204 | SLOT( sendMail( const QString& ) ) ); | ||
205 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 215 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
206 | SLOT( browse( const QString& ) ) ); | 216 | SLOT( browse( const QString& ) ) ); |
207 | 217 | ||
208 | mAddressBookService = new KAddressBookService( this ); | 218 | mAddressBookService = new KAddressBookService( this ); |
@@ -220,23 +230,17 @@ KABCore::~KABCore() | |||
220 | //KABPrefs::instance()->writeConfig(); | 230 | //KABPrefs::instance()->writeConfig(); |
221 | delete AddresseeConfig::instance(); | 231 | delete AddresseeConfig::instance(); |
222 | mAddressBook = 0; | 232 | mAddressBook = 0; |
223 | KABC::StdAddressBook::close(); | 233 | KABC::StdAddressBook::close(); |
224 | |||
225 | #ifdef KAB_EMBEDDED | ||
226 | //US we define here our own global actioncollection. | ||
227 | // delete mActionCollection; | ||
228 | #endif //KAB_EMBEDDED | ||
229 | |||
230 | } | 234 | } |
231 | 235 | ||
232 | void KABCore::restoreSettings() | 236 | void KABCore::restoreSettings() |
233 | { | 237 | { |
234 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 238 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
235 | 239 | ||
236 | mActionJumpBar->setChecked( state ); | 240 | mActionJumpBar->setChecked( state ); |
237 | setJumpButtonBarVisible( state ); | 241 | setJumpButtonBarVisible( state ); |
238 | 242 | ||
239 | state = KABPrefs::instance()->mDetailsPageVisible; | 243 | state = KABPrefs::instance()->mDetailsPageVisible; |
240 | 244 | ||
241 | mActionDetails->setChecked( state ); | 245 | mActionDetails->setChecked( state ); |
242 | setDetailsVisible( state ); | 246 | setDetailsVisible( state ); |
@@ -293,11 +297,11 @@ void KABCore::saveSettings() | |||
293 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 297 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
294 | #endif //KAB_EMBEDDED | 298 | #endif //KAB_EMBEDDED |
295 | mExtensionManager->saveSettings(); | 299 | mExtensionManager->saveSettings(); |
296 | mViewManager->saveSettings(); | 300 | mViewManager->saveSettings(); |
297 | 301 | ||
298 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 302 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
299 | 303 | ||
300 | } | 304 | } |
301 | 305 | ||
302 | KABC::AddressBook *KABCore::addressBook() const | 306 | KABC::AddressBook *KABCore::addressBook() const |
303 | { | 307 | { |
@@ -377,11 +381,11 @@ void KABCore::createAboutData() | |||
377 | "hansen@kde.org" ); | 381 | "hansen@kde.org" ); |
378 | 382 | ||
379 | return about; | 383 | return about; |
380 | #endif //KAB_EMBEDDED | 384 | #endif //KAB_EMBEDDED |
381 | 385 | ||
382 | QString version; | 386 | QString version; |
383 | #include <../version> | 387 | #include <../version> |
384 | QMessageBox::about( this, "About KAddressbook/Pi", | 388 | QMessageBox::about( this, "About KAddressbook/Pi", |
385 | "KAddressbook/Platform-independent\n" | 389 | "KAddressbook/Platform-independent\n" |
386 | "(KA/Pi) " +version + " - " + | 390 | "(KA/Pi) " +version + " - " + |
387 | #ifdef DESKTOP_VERSION | 391 | #ifdef DESKTOP_VERSION |
@@ -389,9 +393,9 @@ void KABCore::createAboutData() | |||
389 | #else | 393 | #else |
390 | "PDA-Edition\n" | 394 | "PDA-Edition\n" |
391 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 395 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
392 | #endif | 396 | #endif |
393 | 397 | ||
394 | "(c) 2004 Ulf Schenk\n" | 398 | "(c) 2004 Ulf Schenk\n" |
395 | "(c) 1997-2003, The KDE PIM Team\n" | 399 | "(c) 1997-2003, The KDE PIM Team\n" |
396 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 400 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
397 | "Don Sanders Original author\n" | 401 | "Don Sanders Original author\n" |
@@ -417,15 +421,15 @@ void KABCore::setContactSelected( const QString &uid ) | |||
417 | emit contactSelected( addr.formattedName() ); | 421 | emit contactSelected( addr.formattedName() ); |
418 | KABC::Picture pic = addr.photo(); | 422 | KABC::Picture pic = addr.photo(); |
419 | if ( pic.isIntern() ) { | 423 | if ( pic.isIntern() ) { |
420 | //US emit contactSelected( pic.data() ); | 424 | //US emit contactSelected( pic.data() ); |
421 | //US instead use: | 425 | //US instead use: |
422 | QPixmap px; | 426 | QPixmap px; |
423 | if (pic.data().isNull() != true) | 427 | if (pic.data().isNull() != true) |
424 | { | 428 | { |
425 | px.convertFromImage(pic.data()); | 429 | px.convertFromImage(pic.data()); |
426 | } | 430 | } |
427 | 431 | ||
428 | emit contactSelected( px ); | 432 | emit contactSelected( px ); |
429 | } | 433 | } |
430 | } | 434 | } |
431 | 435 | ||
@@ -450,40 +454,52 @@ void KABCore::setContactSelected( const QString &uid ) | |||
450 | } | 454 | } |
451 | 455 | ||
452 | void KABCore::sendMail() | 456 | void KABCore::sendMail() |
453 | { | 457 | { |
454 | #ifndef KAB_EMBEDDED | ||
455 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 458 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
456 | #else //KAB_EMBEDDED | ||
457 | qDebug("KABCore::sendMail() ust be fixed"); | ||
458 | #endif //KAB_EMBEDDED | ||
459 | } | 459 | } |
460 | 460 | ||
461 | void KABCore::sendMail( const QString& email ) | 461 | void KABCore::sendMail( const QString& email ) |
462 | { | 462 | { |
463 | #ifndef KAB_EMBEDDED | 463 | //US original kde implementation : kapp->invokeMailer( email, "" ); |
464 | kapp->invokeMailer( email, "" ); | 464 | |
465 | #else //KAB_EMBEDDED | 465 | /*US original qtopia implementation |
466 | qDebug("KABCore::sendMail(const QString& email) ust be fixed"); | 466 | PimContact c = abList->currentEntry(); |
467 | #endif //KAB_EMBEDDED | 467 | QString name = c.fileAs(); |
468 | QString email = c.defaultEmail(); | ||
469 | #ifndef QT_NO_COP | ||
470 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); | ||
471 | e << name << email; | ||
472 | #else | ||
473 | */ | ||
474 | |||
475 | |||
476 | #ifndef QT_NO_COP | ||
477 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | ||
478 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | ||
479 | |||
480 | QCopEnvelope e(channel, "writeMail(QString,QString)"); | ||
481 | //US we need no names in the To field. The emailadresses are enough | ||
482 | e << "" << email; | ||
483 | #else | ||
484 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | ||
485 | #endif | ||
468 | } | 486 | } |
469 | 487 | ||
470 | void KABCore::mailVCard() | 488 | void KABCore::mailVCard() |
471 | { | 489 | { |
472 | #ifndef KAB_EMBEDDED | ||
473 | QStringList uids = mViewManager->selectedUids(); | 490 | QStringList uids = mViewManager->selectedUids(); |
474 | if ( !uids.isEmpty() ) | 491 | if ( !uids.isEmpty() ) |
475 | mailVCard( uids ); | 492 | mailVCard( uids ); |
476 | #else //KAB_EMBEDDED | ||
477 | qDebug("KABCore::mailVCard() must be fixed"); | ||
478 | #endif //KAB_EMBEDDED | ||
479 | } | 493 | } |
480 | 494 | ||
481 | void KABCore::mailVCard( const QStringList& uids ) | 495 | void KABCore::mailVCard( const QStringList& uids ) |
482 | { | 496 | { |
483 | #ifndef KAB_EMBEDDED | ||
484 | QStringList urls; | 497 | QStringList urls; |
485 | 498 | ||
499 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | ||
500 | |||
501 | /*US | ||
486 | // Create a temp dir, so that we can put the files in it with proper names | 502 | // Create a temp dir, so that we can put the files in it with proper names |
487 | KTempFile tempDir; | 503 | KTempFile tempDir; |
488 | if ( tempDir.status() != 0 ) { | 504 | if ( tempDir.status() != 0 ) { |
489 | kdWarning() << strerror( tempDir.status() ) << endl; | 505 | kdWarning() << strerror( tempDir.status() ) << endl; |
@@ -491,8 +507,13 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
491 | } | 507 | } |
492 | 508 | ||
493 | QString dirName = tempDir.name(); | 509 | QString dirName = tempDir.name(); |
494 | tempDir.unlink(); | 510 | tempDir.unlink(); |
511 | */ | ||
512 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | ||
513 | |||
514 | |||
515 | |||
495 | QDir().mkdir( dirName, true ); | 516 | QDir().mkdir( dirName, true ); |
496 | 517 | ||
497 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 518 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
498 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 519 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
@@ -519,17 +540,28 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
519 | 540 | ||
520 | urls.append( fileName ); | 541 | urls.append( fileName ); |
521 | } | 542 | } |
522 | } | 543 | } |
523 | 544 | /*US | |
524 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 545 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
525 | QString::null, // subject | 546 | QString::null, // subject |
526 | QString::null, // body | 547 | QString::null, // body |
527 | QString::null, | 548 | QString::null, |
528 | urls ); // attachments | 549 | urls ); // attachments |
529 | #else //KAB_EMBEDDED | 550 | */ |
530 | qDebug("KABCore::mailVCard( must be fixed"); | 551 | #ifndef QT_NO_COP |
531 | #endif //KAB_EMBEDDED | 552 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); |
553 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | ||
554 | |||
555 | QMap<QString, QString> parameterMap; | ||
556 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); | ||
557 | |||
558 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); | ||
559 | e << parameterMap; | ||
560 | #else | ||
561 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | ||
562 | #endif | ||
563 | |||
532 | 564 | ||
533 | } | 565 | } |
534 | 566 | ||
535 | void KABCore::browse( const QString& url ) | 567 | void KABCore::browse( const QString& url ) |
@@ -751,9 +783,9 @@ void KABCore::setModified( bool modified ) | |||
751 | mJumpButtonBar->recreateButtons(); | 783 | mJumpButtonBar->recreateButtons(); |
752 | 784 | ||
753 | mViewManager->refreshView(); | 785 | mViewManager->refreshView(); |
754 | mDetails->refreshView(); | 786 | mDetails->refreshView(); |
755 | 787 | ||
756 | } | 788 | } |
757 | 789 | ||
758 | bool KABCore::modified() const | 790 | bool KABCore::modified() const |
759 | { | 791 | { |
@@ -761,9 +793,9 @@ bool KABCore::modified() const | |||
761 | } | 793 | } |
762 | 794 | ||
763 | void KABCore::contactModified( const KABC::Addressee &addr ) | 795 | void KABCore::contactModified( const KABC::Addressee &addr ) |
764 | { | 796 | { |
765 | 797 | ||
766 | Command *command = 0; | 798 | Command *command = 0; |
767 | QString uid; | 799 | QString uid; |
768 | 800 | ||
769 | // check if it exists already | 801 | // check if it exists already |
@@ -805,16 +837,16 @@ void KABCore::newContact() | |||
805 | if ( resource ) { | 837 | if ( resource ) { |
806 | KABC::Addressee addr; | 838 | KABC::Addressee addr; |
807 | addr.setResource( resource ); | 839 | addr.setResource( resource ); |
808 | mEditorDialog->setAddressee( addr ); | 840 | mEditorDialog->setAddressee( addr ); |
809 | KApplication::execDialog ( mEditorDialog ); | 841 | KApplication::execDialog ( mEditorDialog ); |
810 | 842 | ||
811 | } else | 843 | } else |
812 | return; | 844 | return; |
813 | 845 | ||
814 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 846 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
815 | 847 | ||
816 | 848 | ||
817 | } | 849 | } |
818 | 850 | ||
819 | void KABCore::addEmail( QString aStr ) | 851 | void KABCore::addEmail( QString aStr ) |
820 | { | 852 | { |
@@ -887,9 +919,9 @@ void KABCore::importVCard( const QString &vCard, bool showPreview ) | |||
887 | { | 919 | { |
888 | mXXPortManager->importVCard( vCard, showPreview ); | 920 | mXXPortManager->importVCard( vCard, showPreview ); |
889 | } | 921 | } |
890 | 922 | ||
891 | //US added a second method without defaultparameter | 923 | //US added a second method without defaultparameter |
892 | void KABCore::editContact2() { | 924 | void KABCore::editContact2() { |
893 | editContact( QString::null ); | 925 | editContact( QString::null ); |
894 | } | 926 | } |
895 | 927 | ||
@@ -980,24 +1012,24 @@ void KABCore::setDetailsVisible( bool visible ) | |||
980 | } | 1012 | } |
981 | 1013 | ||
982 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1014 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
983 | { | 1015 | { |
984 | 1016 | ||
985 | if ( list.count() != 0 ) { | 1017 | if ( list.count() != 0 ) { |
986 | KABC::Addressee::List::ConstIterator it; | 1018 | KABC::Addressee::List::ConstIterator it; |
987 | for ( it = list.begin(); it != list.end(); ++it ) | 1019 | for ( it = list.begin(); it != list.end(); ++it ) |
988 | mAddressBook->insertAddressee( *it ); | 1020 | mAddressBook->insertAddressee( *it ); |
989 | if ( list.count() > 1 ) | 1021 | if ( list.count() > 1 ) |
990 | setModified(); | 1022 | setModified(); |
991 | else | 1023 | else |
992 | setModifiedWOrefresh(); | 1024 | setModifiedWOrefresh(); |
993 | } | 1025 | } |
994 | if ( list.count() == 0 ) | 1026 | if ( list.count() == 0 ) |
995 | mViewManager->refreshView(); | 1027 | mViewManager->refreshView(); |
996 | else | 1028 | else |
997 | mViewManager->refreshView( list[ 0 ].uid() ); | 1029 | mViewManager->refreshView( list[ 0 ].uid() ); |
998 | 1030 | ||
999 | 1031 | ||
1000 | 1032 | ||
1001 | } | 1033 | } |
1002 | 1034 | ||
1003 | QString KABCore::getNameByPhone( const QString &phone ) | 1035 | QString KABCore::getNameByPhone( const QString &phone ) |
@@ -1027,9 +1059,9 @@ QString KABCore::getNameByPhone( const QString &phone ) | |||
1027 | #else //KAB_EMBEDDED | 1059 | #else //KAB_EMBEDDED |
1028 | qDebug("KABCore::getNameByPhone finsih method"); | 1060 | qDebug("KABCore::getNameByPhone finsih method"); |
1029 | return ""; | 1061 | return ""; |
1030 | #endif //KAB_EMBEDDED | 1062 | #endif //KAB_EMBEDDED |
1031 | 1063 | ||
1032 | } | 1064 | } |
1033 | 1065 | ||
1034 | void KABCore::openConfigDialog() | 1066 | void KABCore::openConfigDialog() |
1035 | { | 1067 | { |
@@ -1184,9 +1216,9 @@ void KABCore::initGUI() | |||
1184 | 1216 | ||
1185 | mXXPortManager = new XXPortManager( this, this ); | 1217 | mXXPortManager = new XXPortManager( this, this ); |
1186 | 1218 | ||
1187 | #else //KAB_EMBEDDED | 1219 | #else //KAB_EMBEDDED |
1188 | //US initialize viewMenu before settingup viewmanager. | 1220 | //US initialize viewMenu before settingup viewmanager. |
1189 | // Viewmanager needs this menu to plugin submenues. | 1221 | // Viewmanager needs this menu to plugin submenues. |
1190 | viewMenu = new QPopupMenu( this ); | 1222 | viewMenu = new QPopupMenu( this ); |
1191 | settingsMenu = new QPopupMenu( this ); | 1223 | settingsMenu = new QPopupMenu( this ); |
1192 | //filterMenu = new QPopupMenu( this ); | 1224 | //filterMenu = new QPopupMenu( this ); |
@@ -1201,19 +1233,19 @@ void KABCore::initGUI() | |||
1201 | QBoxLayout *topLayout; | 1233 | QBoxLayout *topLayout; |
1202 | 1234 | ||
1203 | // = new QHBoxLayout( this ); | 1235 | // = new QHBoxLayout( this ); |
1204 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1236 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1205 | 1237 | ||
1206 | // QWidget *mainBox = new QWidget( this ); | 1238 | // QWidget *mainBox = new QWidget( this ); |
1207 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1239 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1208 | 1240 | ||
1209 | #ifdef DESKTOP_VERSION | 1241 | #ifdef DESKTOP_VERSION |
1210 | topLayout = new QHBoxLayout( this ); | 1242 | topLayout = new QHBoxLayout( this ); |
1211 | 1243 | ||
1212 | 1244 | ||
1213 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1245 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1214 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1246 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1215 | 1247 | ||
1216 | topLayout->addWidget(mMiniSplitter ); | 1248 | topLayout->addWidget(mMiniSplitter ); |
1217 | 1249 | ||
1218 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1250 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1219 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1251 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
@@ -1230,20 +1262,20 @@ void KABCore::initGUI() | |||
1230 | topLayout = new QHBoxLayout( this ); | 1262 | topLayout = new QHBoxLayout( this ); |
1231 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1263 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1232 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1264 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1233 | } | 1265 | } |
1234 | 1266 | ||
1235 | topLayout->addWidget(mMiniSplitter ); | 1267 | topLayout->addWidget(mMiniSplitter ); |
1236 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1268 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1237 | mDetails = new ViewContainer( mMiniSplitter ); | 1269 | mDetails = new ViewContainer( mMiniSplitter ); |
1238 | 1270 | ||
1239 | 1271 | ||
1240 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1272 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1241 | #endif | 1273 | #endif |
1242 | //eh->hide(); | 1274 | //eh->hide(); |
1243 | // topLayout->addWidget(mExtensionManager ); | 1275 | // topLayout->addWidget(mExtensionManager ); |
1244 | 1276 | ||
1245 | 1277 | ||
1246 | /*US | 1278 | /*US |
1247 | #ifndef KAB_NOSPLITTER | 1279 | #ifndef KAB_NOSPLITTER |
1248 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1280 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1249 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1281 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
@@ -1256,9 +1288,9 @@ void KABCore::initGUI() | |||
1256 | mViewManager = new ViewManager( this, viewSpace ); | 1288 | mViewManager = new ViewManager( this, viewSpace ); |
1257 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1289 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1258 | 1290 | ||
1259 | mDetails = new ViewContainer( mDetailsSplitter ); | 1291 | mDetails = new ViewContainer( mDetailsSplitter ); |
1260 | 1292 | ||
1261 | topLayout->addWidget( mDetailsSplitter ); | 1293 | topLayout->addWidget( mDetailsSplitter ); |
1262 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1294 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1263 | #else //KAB_NOSPLITTER | 1295 | #else //KAB_NOSPLITTER |
1264 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1296 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
@@ -1279,9 +1311,9 @@ void KABCore::initGUI() | |||
1279 | topLayout->addWidget( mDetails ); | 1311 | topLayout->addWidget( mDetails ); |
1280 | #endif //KAB_NOSPLITTER | 1312 | #endif //KAB_NOSPLITTER |
1281 | */ | 1313 | */ |
1282 | 1314 | ||
1283 | 1315 | ||
1284 | #endif //KAB_EMBEDDED | 1316 | #endif //KAB_EMBEDDED |
1285 | initActions(); | 1317 | initActions(); |
1286 | 1318 | ||
1287 | #ifdef KAB_EMBEDDED | 1319 | #ifdef KAB_EMBEDDED |
@@ -1297,28 +1329,28 @@ void KABCore::initGUI() | |||
1297 | // mIncSearchWidget->hide(); | 1329 | // mIncSearchWidget->hide(); |
1298 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1330 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1299 | SLOT( incrementalSearch( const QString& ) ) ); | 1331 | SLOT( incrementalSearch( const QString& ) ) ); |
1300 | 1332 | ||
1301 | 1333 | ||
1302 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1334 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1303 | 1335 | ||
1304 | topLayout->addWidget( mJumpButtonBar ); | 1336 | topLayout->addWidget( mJumpButtonBar ); |
1305 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1337 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1306 | 1338 | ||
1307 | // mMainWindow->getIconToolBar()->raise(); | 1339 | // mMainWindow->getIconToolBar()->raise(); |
1308 | 1340 | ||
1309 | #endif //KAB_EMBEDDED | 1341 | #endif //KAB_EMBEDDED |
1310 | 1342 | ||
1311 | } | 1343 | } |
1312 | void KABCore::initActions() | 1344 | void KABCore::initActions() |
1313 | { | 1345 | { |
1314 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1346 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1315 | 1347 | ||
1316 | #ifndef KAB_EMBEDDED | 1348 | #ifndef KAB_EMBEDDED |
1317 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1349 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1318 | SLOT( clipboardDataChanged() ) ); | 1350 | SLOT( clipboardDataChanged() ) ); |
1319 | #endif //KAB_EMBEDDED | 1351 | #endif //KAB_EMBEDDED |
1320 | 1352 | ||
1321 | // file menu | 1353 | // file menu |
1322 | if ( mIsPart ) { | 1354 | if ( mIsPart ) { |
1323 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1355 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1324 | SLOT( sendMail() ), actionCollection(), | 1356 | SLOT( sendMail() ), actionCollection(), |
@@ -1329,15 +1361,15 @@ void KABCore::initActions() | |||
1329 | } else { | 1361 | } else { |
1330 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1362 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1331 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1363 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1332 | } | 1364 | } |
1333 | 1365 | ||
1334 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1366 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1335 | SLOT( save() ), actionCollection(), "file_sync" ); | 1367 | SLOT( save() ), actionCollection(), "file_sync" ); |
1336 | 1368 | ||
1337 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1369 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1338 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1370 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1339 | 1371 | ||
1340 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1372 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1341 | this, SLOT( mailVCard() ), | 1373 | this, SLOT( mailVCard() ), |
1342 | actionCollection(), "file_mail_vcard"); | 1374 | actionCollection(), "file_mail_vcard"); |
1343 | 1375 | ||
@@ -1350,9 +1382,9 @@ void KABCore::initActions() | |||
1350 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1382 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1351 | mMainWindow, SLOT( exit() ), | 1383 | mMainWindow, SLOT( exit() ), |
1352 | actionCollection(), "quit" ); | 1384 | actionCollection(), "quit" ); |
1353 | #endif //KAB_EMBEDDED | 1385 | #endif //KAB_EMBEDDED |
1354 | 1386 | ||
1355 | // edit menu | 1387 | // edit menu |
1356 | if ( mIsPart ) { | 1388 | if ( mIsPart ) { |
1357 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1389 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1358 | SLOT( copyContacts() ), actionCollection(), | 1390 | SLOT( copyContacts() ), actionCollection(), |
@@ -1386,57 +1418,57 @@ void KABCore::initActions() | |||
1386 | actionCollection(), "edit_delete" ); | 1418 | actionCollection(), "edit_delete" ); |
1387 | 1419 | ||
1388 | mActionUndo->setEnabled( false ); | 1420 | mActionUndo->setEnabled( false ); |
1389 | mActionRedo->setEnabled( false ); | 1421 | mActionRedo->setEnabled( false ); |
1390 | 1422 | ||
1391 | // settings menu | 1423 | // settings menu |
1392 | #ifdef KAB_EMBEDDED | 1424 | #ifdef KAB_EMBEDDED |
1393 | //US special menuentry to configure the addressbook resources. On KDE | 1425 | //US special menuentry to configure the addressbook resources. On KDE |
1394 | // you do that through the control center !!! | 1426 | // you do that through the control center !!! |
1395 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1427 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1396 | SLOT( configureResources() ), actionCollection(), | 1428 | SLOT( configureResources() ), actionCollection(), |
1397 | "kaddressbook_configure_resources" ); | 1429 | "kaddressbook_configure_resources" ); |
1398 | #endif //KAB_EMBEDDED | 1430 | #endif //KAB_EMBEDDED |
1399 | 1431 | ||
1400 | if ( mIsPart ) { | 1432 | if ( mIsPart ) { |
1401 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1433 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1402 | SLOT( openConfigDialog() ), actionCollection(), | 1434 | SLOT( openConfigDialog() ), actionCollection(), |
1403 | "kaddressbook_configure" ); | 1435 | "kaddressbook_configure" ); |
1404 | 1436 | ||
1405 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1437 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1406 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1438 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1407 | "kaddressbook_configure_shortcuts" ); | 1439 | "kaddressbook_configure_shortcuts" ); |
1408 | #ifdef KAB_EMBEDDED | 1440 | #ifdef KAB_EMBEDDED |
1409 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1441 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1410 | mActionConfigureToolbars->setEnabled( false ); | 1442 | mActionConfigureToolbars->setEnabled( false ); |
1411 | #endif //KAB_EMBEDDED | 1443 | #endif //KAB_EMBEDDED |
1412 | 1444 | ||
1413 | } else { | 1445 | } else { |
1414 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1446 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1415 | 1447 | ||
1416 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1448 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1417 | } | 1449 | } |
1418 | 1450 | ||
1419 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1451 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1420 | actionCollection(), "options_show_jump_bar" ); | 1452 | actionCollection(), "options_show_jump_bar" ); |
1421 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1453 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1422 | 1454 | ||
1423 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1455 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1424 | actionCollection(), "options_show_details" ); | 1456 | actionCollection(), "options_show_details" ); |
1425 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1457 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1426 | 1458 | ||
1427 | // misc | 1459 | // misc |
1428 | // only enable LDAP lookup if we can handle the protocol | 1460 | // only enable LDAP lookup if we can handle the protocol |
1429 | #ifndef KAB_EMBEDDED | 1461 | #ifndef KAB_EMBEDDED |
1430 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1462 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1431 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1463 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1432 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1464 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1433 | "ldap_lookup" ); | 1465 | "ldap_lookup" ); |
1434 | } | 1466 | } |
1435 | #else //KAB_EMBEDDED | 1467 | #else //KAB_EMBEDDED |
1436 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1468 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1437 | #endif //KAB_EMBEDDED | 1469 | #endif //KAB_EMBEDDED |
1438 | 1470 | ||
1439 | 1471 | ||
1440 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1472 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1441 | SLOT( setWhoAmI() ), actionCollection(), | 1473 | SLOT( setWhoAmI() ), actionCollection(), |
1442 | "set_personal" ); | 1474 | "set_personal" ); |
@@ -1456,9 +1488,9 @@ void KABCore::initActions() | |||
1456 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1488 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1457 | this, SLOT( createAboutData() ), actionCollection(), | 1489 | this, SLOT( createAboutData() ), actionCollection(), |
1458 | "kaddressbook_about_data" ); | 1490 | "kaddressbook_about_data" ); |
1459 | #endif //KAB_EMBEDDED | 1491 | #endif //KAB_EMBEDDED |
1460 | 1492 | ||
1461 | clipboardDataChanged(); | 1493 | clipboardDataChanged(); |
1462 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1494 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1463 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1495 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1464 | } | 1496 | } |
@@ -1477,9 +1509,9 @@ void KABCore::addActionsManually() | |||
1477 | KToolBar* tb = mMainWindow->toolBar(); | 1509 | KToolBar* tb = mMainWindow->toolBar(); |
1478 | 1510 | ||
1479 | #ifdef DESKTOP_VERSION | 1511 | #ifdef DESKTOP_VERSION |
1480 | QMenuBar* mb = mMainWindow->menuBar(); | 1512 | QMenuBar* mb = mMainWindow->menuBar(); |
1481 | 1513 | ||
1482 | //US setup menubar. | 1514 | //US setup menubar. |
1483 | //Disable the following block if you do not want to have a menubar. | 1515 | //Disable the following block if you do not want to have a menubar. |
1484 | mb->insertItem( "&File", fileMenu ); | 1516 | mb->insertItem( "&File", fileMenu ); |
1485 | mb->insertItem( "&Edit", editMenu ); | 1517 | mb->insertItem( "&Edit", editMenu ); |
@@ -1488,17 +1520,17 @@ void KABCore::addActionsManually() | |||
1488 | mb->insertItem( "&Change selected", changeMenu ); | 1520 | mb->insertItem( "&Change selected", changeMenu ); |
1489 | mb->insertItem( "&Help", helpMenu ); | 1521 | mb->insertItem( "&Help", helpMenu ); |
1490 | mIncSearchWidget = new IncSearchWidget( tb ); | 1522 | mIncSearchWidget = new IncSearchWidget( tb ); |
1491 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1523 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1492 | 1524 | ||
1493 | #else | 1525 | #else |
1494 | //US setup toolbar | 1526 | //US setup toolbar |
1495 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1527 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1496 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1528 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1497 | menuBarTB->insertItem( "ME", popupBarTB); | 1529 | menuBarTB->insertItem( "ME", popupBarTB); |
1498 | tb->insertWidget(-1, 0, menuBarTB); | 1530 | tb->insertWidget(-1, 0, menuBarTB); |
1499 | mIncSearchWidget = new IncSearchWidget( tb ); | 1531 | mIncSearchWidget = new IncSearchWidget( tb ); |
1500 | 1532 | ||
1501 | tb->enableMoving(false); | 1533 | tb->enableMoving(false); |
1502 | popupBarTB->insertItem( "&File", fileMenu ); | 1534 | popupBarTB->insertItem( "&File", fileMenu ); |
1503 | popupBarTB->insertItem( "&Edit", editMenu ); | 1535 | popupBarTB->insertItem( "&Edit", editMenu ); |
1504 | popupBarTB->insertItem( "&View", viewMenu ); | 1536 | popupBarTB->insertItem( "&View", viewMenu ); |
@@ -1517,12 +1549,12 @@ void KABCore::addActionsManually() | |||
1517 | //US Now connect the actions with the menue entries. | 1549 | //US Now connect the actions with the menue entries. |
1518 | mActionPrint->plug( fileMenu ); | 1550 | mActionPrint->plug( fileMenu ); |
1519 | mActionMail->plug( fileMenu ); | 1551 | mActionMail->plug( fileMenu ); |
1520 | fileMenu->insertSeparator(); | 1552 | fileMenu->insertSeparator(); |
1521 | 1553 | ||
1522 | mActionNewContact->plug( fileMenu ); | 1554 | mActionNewContact->plug( fileMenu ); |
1523 | mActionNewContact->plug( tb ); | 1555 | mActionNewContact->plug( tb ); |
1524 | 1556 | ||
1525 | mActionEditAddressee->plug( fileMenu ); | 1557 | mActionEditAddressee->plug( fileMenu ); |
1526 | fileMenu->insertSeparator(); | 1558 | fileMenu->insertSeparator(); |
1527 | mActionSave->plug( fileMenu ); | 1559 | mActionSave->plug( fileMenu ); |
1528 | fileMenu->insertItem( "&Import", ImportMenu ); | 1560 | fileMenu->insertItem( "&Import", ImportMenu ); |
@@ -1532,9 +1564,9 @@ void KABCore::addActionsManually() | |||
1532 | fileMenu->insertSeparator(); | 1564 | fileMenu->insertSeparator(); |
1533 | mActionQuit->plug( fileMenu ); | 1565 | mActionQuit->plug( fileMenu ); |
1534 | #ifdef _WIN32_ | 1566 | #ifdef _WIN32_ |
1535 | mActionImportOL->plug( ImportMenu ); | 1567 | mActionImportOL->plug( ImportMenu ); |
1536 | #endif | 1568 | #endif |
1537 | // edit menu | 1569 | // edit menu |
1538 | mActionUndo->plug( editMenu ); | 1570 | mActionUndo->plug( editMenu ); |
1539 | mActionRedo->plug( editMenu ); | 1571 | mActionRedo->plug( editMenu ); |
1540 | editMenu->insertSeparator(); | 1572 | editMenu->insertSeparator(); |
@@ -1543,67 +1575,67 @@ void KABCore::addActionsManually() | |||
1543 | mActionPaste->plug( editMenu ); | 1575 | mActionPaste->plug( editMenu ); |
1544 | mActionDelete->plug( editMenu ); | 1576 | mActionDelete->plug( editMenu ); |
1545 | editMenu->insertSeparator(); | 1577 | editMenu->insertSeparator(); |
1546 | mActionSelectAll->plug( editMenu ); | 1578 | mActionSelectAll->plug( editMenu ); |
1547 | 1579 | ||
1548 | mActionRemoveVoice->plug( changeMenu ); | 1580 | mActionRemoveVoice->plug( changeMenu ); |
1549 | // settings menu | 1581 | // settings menu |
1550 | //US special menuentry to configure the addressbook resources. On KDE | 1582 | //US special menuentry to configure the addressbook resources. On KDE |
1551 | // you do that through the control center !!! | 1583 | // you do that through the control center !!! |
1552 | mActionConfigResources->plug( settingsMenu ); | 1584 | mActionConfigResources->plug( settingsMenu ); |
1553 | settingsMenu->insertSeparator(); | 1585 | settingsMenu->insertSeparator(); |
1554 | 1586 | ||
1555 | mActionConfigKAddressbook->plug( settingsMenu ); | 1587 | mActionConfigKAddressbook->plug( settingsMenu ); |
1556 | 1588 | ||
1557 | if ( mIsPart ) { | 1589 | if ( mIsPart ) { |
1558 | mActionConfigShortcuts->plug( settingsMenu ); | 1590 | mActionConfigShortcuts->plug( settingsMenu ); |
1559 | mActionConfigureToolbars->plug( settingsMenu ); | 1591 | mActionConfigureToolbars->plug( settingsMenu ); |
1560 | 1592 | ||
1561 | } else { | 1593 | } else { |
1562 | mActionKeyBindings->plug( settingsMenu ); | 1594 | mActionKeyBindings->plug( settingsMenu ); |
1563 | } | 1595 | } |
1564 | 1596 | ||
1565 | settingsMenu->insertSeparator(); | 1597 | settingsMenu->insertSeparator(); |
1566 | 1598 | ||
1567 | mActionJumpBar->plug( settingsMenu ); | 1599 | mActionJumpBar->plug( settingsMenu ); |
1568 | mActionDetails->plug( settingsMenu ); | 1600 | mActionDetails->plug( settingsMenu ); |
1569 | settingsMenu->insertSeparator(); | 1601 | settingsMenu->insertSeparator(); |
1570 | 1602 | ||
1571 | mActionWhoAmI->plug( settingsMenu ); | 1603 | mActionWhoAmI->plug( settingsMenu ); |
1572 | mActionCategories->plug( settingsMenu ); | 1604 | mActionCategories->plug( settingsMenu ); |
1573 | 1605 | ||
1574 | mActionAboutKAddressbook->plug( helpMenu ); | 1606 | mActionAboutKAddressbook->plug( helpMenu ); |
1575 | 1607 | ||
1576 | 1608 | ||
1577 | if (QApplication::desktop()->width() > 320 ) { | 1609 | if (QApplication::desktop()->width() > 320 ) { |
1578 | 1610 | ||
1579 | mActionEditAddressee->plug( tb ); | 1611 | mActionEditAddressee->plug( tb ); |
1580 | mActionSave->plug( tb ); | 1612 | mActionSave->plug( tb ); |
1581 | mViewManager->getFilterAction()->plug ( tb); | 1613 | mViewManager->getFilterAction()->plug ( tb); |
1582 | if (QApplication::desktop()->width() > 480 ) { | 1614 | if (QApplication::desktop()->width() > 480 ) { |
1583 | mActionUndo->plug( tb ); | 1615 | mActionUndo->plug( tb ); |
1584 | mActionDelete->plug( tb ); | 1616 | mActionDelete->plug( tb ); |
1585 | mActionRedo->plug( tb ); | 1617 | mActionRedo->plug( tb ); |
1586 | } | 1618 | } |
1587 | } | 1619 | } |
1588 | //mActionQuit->plug ( tb ); | 1620 | //mActionQuit->plug ( tb ); |
1589 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1621 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1590 | 1622 | ||
1591 | //US link the searchwidget first to this. | 1623 | //US link the searchwidget first to this. |
1592 | // The real linkage to the toolbar happens later. | 1624 | // The real linkage to the toolbar happens later. |
1593 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1625 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1594 | //US tb->insertItem( mIncSearchWidget ); | 1626 | //US tb->insertItem( mIncSearchWidget ); |
1595 | /*US | 1627 | /*US |
1596 | mIncSearchWidget = new IncSearchWidget( tb ); | 1628 | mIncSearchWidget = new IncSearchWidget( tb ); |
1597 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1629 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1598 | SLOT( incrementalSearch( const QString& ) ) ); | 1630 | SLOT( incrementalSearch( const QString& ) ) ); |
1599 | 1631 | ||
1600 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1632 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1601 | 1633 | ||
1602 | //US topLayout->addWidget( mJumpButtonBar ); | 1634 | //US topLayout->addWidget( mJumpButtonBar ); |
1603 | this->layout()->add( mJumpButtonBar ); | 1635 | this->layout()->add( mJumpButtonBar ); |
1604 | */ | 1636 | */ |
1605 | 1637 | ||
1606 | #endif //KAB_EMBEDDED | 1638 | #endif //KAB_EMBEDDED |
1607 | } | 1639 | } |
1608 | void KABCore::removeVoice() | 1640 | void KABCore::removeVoice() |
1609 | { | 1641 | { |
@@ -1622,9 +1654,9 @@ void KABCore::removeVoice() | |||
1622 | (*it).insertPhoneNumber( (*phoneIt) ); | 1654 | (*it).insertPhoneNumber( (*phoneIt) ); |
1623 | found = true; | 1655 | found = true; |
1624 | } | 1656 | } |
1625 | } | 1657 | } |
1626 | 1658 | ||
1627 | } | 1659 | } |
1628 | if ( found ) | 1660 | if ( found ) |
1629 | contactModified((*it) ); | 1661 | contactModified((*it) ); |
1630 | } | 1662 | } |
@@ -1633,9 +1665,9 @@ void KABCore::removeVoice() | |||
1633 | 1665 | ||
1634 | 1666 | ||
1635 | void KABCore::clipboardDataChanged() | 1667 | void KABCore::clipboardDataChanged() |
1636 | { | 1668 | { |
1637 | 1669 | ||
1638 | if ( mReadWrite ) | 1670 | if ( mReadWrite ) |
1639 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1671 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1640 | 1672 | ||
1641 | } | 1673 | } |
@@ -1672,9 +1704,9 @@ void KABCore::configureKeyBindings() | |||
1672 | #ifdef KAB_EMBEDDED | 1704 | #ifdef KAB_EMBEDDED |
1673 | void KABCore::configureResources() | 1705 | void KABCore::configureResources() |
1674 | { | 1706 | { |
1675 | KRES::KCMKResources dlg( this, "" , 0 ); | 1707 | KRES::KCMKResources dlg( this, "" , 0 ); |
1676 | 1708 | ||
1677 | if ( !dlg.exec() ) | 1709 | if ( !dlg.exec() ) |
1678 | return; | 1710 | return; |
1679 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 1711 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
1680 | } | 1712 | } |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 5b3b1ab..8bd4b15 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | //US#ifdef KAB_EMBEDDED | 24 | //US#ifdef KAB_EMBEDDED |
@@ -45,14 +45,17 @@ KABPrefs::KABPrefs() | |||
45 | KPrefs::setCurrentGroup( "General" ); | 45 | KPrefs::setCurrentGroup( "General" ); |
46 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 46 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
48 | 48 | ||
49 | #ifdef KAB_EMBEDDED | 49 | #ifdef KAB_EMBEDDED |
50 | addItemBool("AskForQuit",&mAskForQuit,false); | 50 | addItemBool("AskForQuit",&mAskForQuit,false); |
51 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 51 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
52 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 52 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
53 | addItemInt( "EmailChannelType", &mEmailClient, OMPI ); | ||
54 | addItemString( "EmailChannelOther", &mEmailChannel, "" ); | ||
55 | |||
53 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
54 | 57 | ||
55 | KPrefs::setCurrentGroup( "MainWindow" ); | 58 | KPrefs::setCurrentGroup( "MainWindow" ); |
56 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 59 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
57 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 60 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
58 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 61 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
@@ -96,9 +99,9 @@ KABPrefs *KABPrefs::instance() | |||
96 | 99 | ||
97 | void KABPrefs::setCategoryDefaults() | 100 | void KABPrefs::setCategoryDefaults() |
98 | { | 101 | { |
99 | mCustomCategories.clear(); | 102 | mCustomCategories.clear(); |
100 | 103 | ||
101 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 104 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
102 | << i18n( "Customer" ) << i18n( "Friend" ); | 105 | << i18n( "Customer" ) << i18n( "Friend" ); |
103 | } | 106 | } |
104 | 107 | ||
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 370fc5b..c81a9a9 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABPREFS_H | 24 | #ifndef KABPREFS_H |
25 | #define KABPREFS_H | 25 | #define KABPREFS_H |
26 | 26 | ||
@@ -35,9 +35,17 @@ class KABPrefs : public KPimPrefs | |||
35 | public: | 35 | public: |
36 | virtual ~KABPrefs(); | 36 | virtual ~KABPrefs(); |
37 | 37 | ||
38 | static KABPrefs *instance(); | 38 | static KABPrefs *instance(); |
39 | 39 | ||
40 | enum EMailClients { | ||
41 | OMPI = 0, | ||
42 | QTOPIA = 1, | ||
43 | OPIE = 2, | ||
44 | OTHER = 3 | ||
45 | }; | ||
46 | |||
47 | |||
40 | // General | 48 | // General |
41 | bool mHonorSingleClick; | 49 | bool mHonorSingleClick; |
42 | bool mAutomaticNameParsing; | 50 | bool mAutomaticNameParsing; |
43 | int mCurrentIncSearchField; | 51 | int mCurrentIncSearchField; |
@@ -48,8 +56,12 @@ class KABPrefs : public KPimPrefs | |||
48 | 56 | ||
49 | bool mToolBarHor; | 57 | bool mToolBarHor; |
50 | bool mToolBarUp; | 58 | bool mToolBarUp; |
51 | bool mAskForQuit; | 59 | bool mAskForQuit; |
60 | |||
61 | int mEmailClient; | ||
62 | QString mEmailChannel; | ||
63 | |||
52 | /** Set preferences to default values */ | 64 | /** Set preferences to default values */ |
53 | // void usrSetDefaults(); | 65 | // void usrSetDefaults(); |
54 | 66 | ||
55 | /** Read preferences from config file */ | 67 | /** Read preferences from config file */ |
@@ -58,9 +70,9 @@ class KABPrefs : public KPimPrefs | |||
58 | /** Write preferences to config file */ | 70 | /** Write preferences to config file */ |
59 | // void usrWriteConfig(); | 71 | // void usrWriteConfig(); |
60 | #endif //KAB_EMBEDDED | 72 | #endif //KAB_EMBEDDED |
61 | 73 | ||
62 | 74 | ||
63 | // GUI | 75 | // GUI |
64 | bool mJumpButtonBarVisible; | 76 | bool mJumpButtonBarVisible; |
65 | bool mDetailsPageVisible; | 77 | bool mDetailsPageVisible; |
66 | QValueList<int> mExtensionsSplitter; | 78 | QValueList<int> mExtensionsSplitter; |
@@ -77,12 +89,12 @@ class KABPrefs : public KPimPrefs | |||
77 | // Filter | 89 | // Filter |
78 | int mCurrentFilter; | 90 | int mCurrentFilter; |
79 | 91 | ||
80 | void setCategoryDefaults(); | 92 | void setCategoryDefaults(); |
81 | 93 | ||
82 | private: | 94 | private: |
83 | KABPrefs(); | 95 | KABPrefs(); |
84 | 96 | ||
85 | static KABPrefs *sInstance; | 97 | static KABPrefs *sInstance; |
86 | }; | 98 | }; |
87 | 99 | ||
88 | #endif | 100 | #endif |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 38c7946..1bac26f 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -1,33 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | ||
31 | #include <qlineedit.h> | ||
32 | #include <qlabel.h> | ||
33 | #include <qfile.h> | ||
30 | 34 | ||
31 | #include <kconfig.h> | 35 | #include <kconfig.h> |
32 | #include <kdebug.h> | 36 | #include <kdebug.h> |
33 | #include <kdialog.h> | 37 | #include <kdialog.h> |
@@ -74,11 +78,11 @@ class ExtensionItem : public QCheckListItem | |||
74 | #else //KAB_EMBEDDED | 78 | #else //KAB_EMBEDDED |
75 | ExtensionFactory* mFactory; | 79 | ExtensionFactory* mFactory; |
76 | QString mName; | 80 | QString mName; |
77 | QString mComment; | 81 | QString mComment; |
78 | 82 | ||
79 | #endif //KAB_EMBEDDED | 83 | #endif //KAB_EMBEDDED |
80 | 84 | ||
81 | }; | 85 | }; |
82 | 86 | ||
83 | KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | 87 | KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) |
84 | : QWidget( parent, name ) | 88 | : QWidget( parent, name ) |
@@ -92,9 +96,9 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
92 | // General page | 96 | // General page |
93 | QWidget *generalPage = new QWidget( this ); | 97 | QWidget *generalPage = new QWidget( this ); |
94 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 98 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
95 | KDialog::spacingHintSmall() ); | 99 | KDialog::spacingHintSmall() ); |
96 | 100 | //general groupbox | |
97 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); | 101 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); |
98 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); | 102 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); |
99 | boxLayout->setAlignment( Qt::AlignTop ); | 103 | boxLayout->setAlignment( Qt::AlignTop ); |
100 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 104 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
@@ -108,8 +112,11 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
108 | boxLayout->addWidget( mNameParsing ); | 112 | boxLayout->addWidget( mNameParsing ); |
109 | 113 | ||
110 | layout->addWidget( groupBox ); | 114 | layout->addWidget( groupBox ); |
111 | 115 | ||
116 | |||
117 | //extensions groupbox | ||
118 | |||
112 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); | 119 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); |
113 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 120 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
114 | boxLayout->setAlignment( Qt::AlignTop ); | 121 | boxLayout->setAlignment( Qt::AlignTop ); |
115 | boxLayout->setMargin(KDialog::marginHintSmall()); | 122 | boxLayout->setMargin(KDialog::marginHintSmall()); |
@@ -120,9 +127,9 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
120 | mExtensionView->setAllColumnsShowFocus( true ); | 127 | mExtensionView->setAllColumnsShowFocus( true ); |
121 | mExtensionView->addColumn( i18n( "Name" ) ); | 128 | mExtensionView->addColumn( i18n( "Name" ) ); |
122 | mExtensionView->addColumn( i18n( "Description" ) ); | 129 | mExtensionView->addColumn( i18n( "Description" ) ); |
123 | mExtensionView->setMaximumHeight(80); | 130 | mExtensionView->setMaximumHeight(80); |
124 | 131 | ||
125 | boxLayout->addWidget( mExtensionView ); | 132 | boxLayout->addWidget( mExtensionView ); |
126 | 133 | ||
127 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 134 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
128 | mConfigureButton->setEnabled( false ); | 135 | mConfigureButton->setEnabled( false ); |
@@ -144,17 +151,109 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
144 | // Addressee page | 151 | // Addressee page |
145 | mAddresseeWidget = new AddresseeWidget( this ); | 152 | mAddresseeWidget = new AddresseeWidget( this ); |
146 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 153 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
147 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 154 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
155 | |||
156 | // mailclient page | ||
157 | QWidget *mailclientPage = new QWidget( this ); | ||
158 | layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(), | ||
159 | KDialog::spacingHintSmall() ); | ||
160 | |||
161 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage ); | ||
162 | boxLayout = new QVBoxLayout( groupBox->layout() ); | ||
163 | boxLayout->setAlignment( Qt::AlignTop ); | ||
164 | // boxLayout->setMargin(KDialog::marginHintSmall() ); | ||
165 | // groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; | ||
166 | // groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); | ||
167 | // boxLayout->setSpacing( KDialog::spacingHintSmall() ); | ||
168 | |||
169 | mEmailClient = new QComboBox( groupBox ); | ||
170 | mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI ); | ||
171 | mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA ); | ||
172 | mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE ); | ||
173 | mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER ); | ||
174 | boxLayout->addWidget( mEmailClient ); | ||
175 | |||
176 | connect( mEmailClient, SIGNAL( activated( int ) ), | ||
177 | this, SLOT (emailclient_changed( int ) ) ); | ||
178 | |||
179 | QLabel* lab = new QLabel( i18n("Channel:"), groupBox); | ||
180 | boxLayout->addWidget( lab ); | ||
181 | mEmailChannel = new QLineEdit(groupBox); | ||
182 | mEmailChannel->setReadOnly(true); | ||
183 | boxLayout->addWidget( mEmailChannel ); | ||
184 | |||
185 | layout->addWidget( groupBox ); | ||
186 | tabWidget->addTab( mailclientPage, i18n( "Mail" ) ); | ||
187 | |||
188 | |||
189 | |||
148 | } | 190 | } |
149 | 191 | ||
192 | |||
193 | |||
194 | void KABConfigWidget::emailclient_changed( int newClient ) | ||
195 | { | ||
196 | if (newClient == KABPrefs::OTHER) | ||
197 | mEmailChannel->setReadOnly(false); | ||
198 | else | ||
199 | mEmailChannel->setReadOnly(true); | ||
200 | |||
201 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | ||
202 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | ||
203 | |||
204 | if (opiepath.isEmpty()) | ||
205 | opiepath = qtopiapath; | ||
206 | |||
207 | QString text = mEmailChannel->text(); | ||
208 | |||
209 | if (newClient == KABPrefs::OPIE) | ||
210 | { | ||
211 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | ||
212 | text = "QPE/Application/opiemail"; | ||
213 | else | ||
214 | text = "FILENOTFOUND: " + opiepath + "/bin/opiemail"; | ||
215 | } | ||
216 | else if (newClient == KABPrefs::QTOPIA) | ||
217 | { | ||
218 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | ||
219 | text = "QPE/Application/qtmail"; | ||
220 | else | ||
221 | text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail"; | ||
222 | |||
223 | } | ||
224 | else if (newClient == KABPrefs::OMPI) | ||
225 | { | ||
226 | if ( QFile::exists( qtopiapath + "/bin/ompi" )) | ||
227 | text = "QPE/Application/ompi"; | ||
228 | else if ( QFile::exists( opiepath + "/bin/ompi" )) | ||
229 | text = "QPE/Application/ompi"; | ||
230 | else | ||
231 | text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi"; | ||
232 | |||
233 | } | ||
234 | else | ||
235 | { | ||
236 | //do nothing if we choosed other | ||
237 | } | ||
238 | |||
239 | mEmailChannel->setText( text ); | ||
240 | |||
241 | |||
242 | } | ||
243 | |||
244 | |||
150 | void KABConfigWidget::restoreSettings() | 245 | void KABConfigWidget::restoreSettings() |
151 | { | 246 | { |
152 | bool blocked = signalsBlocked(); | 247 | bool blocked = signalsBlocked(); |
153 | blockSignals( true ); | 248 | blockSignals( true ); |
154 | 249 | ||
155 | mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); | 250 | mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); |
156 | mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); | 251 | mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); |
252 | |||
253 | mEmailChannel->setText( KABPrefs::instance()->mEmailChannel ); | ||
254 | mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient); | ||
255 | |||
157 | mAddresseeWidget->restoreSettings(); | 256 | mAddresseeWidget->restoreSettings(); |
158 | 257 | ||
159 | restoreExtensionSettings(); | 258 | restoreExtensionSettings(); |
160 | 259 | ||
@@ -166,8 +265,12 @@ void KABConfigWidget::restoreSettings() | |||
166 | void KABConfigWidget::saveSettings() | 265 | void KABConfigWidget::saveSettings() |
167 | { | 266 | { |
168 | KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); | 267 | KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); |
169 | KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 268 | KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
269 | |||
270 | KABPrefs::instance()->mEmailClient = mEmailClient->currentItem(); | ||
271 | KABPrefs::instance()->mEmailChannel = mEmailChannel->text(); | ||
272 | |||
170 | mAddresseeWidget->saveSettings(); | 273 | mAddresseeWidget->saveSettings(); |
171 | 274 | ||
172 | saveExtensionSettings(); | 275 | saveExtensionSettings(); |
173 | KABPrefs::instance()->writeConfig(); | 276 | KABPrefs::instance()->writeConfig(); |
@@ -179,8 +282,12 @@ void KABConfigWidget::defaults() | |||
179 | { | 282 | { |
180 | mNameParsing->setChecked( true ); | 283 | mNameParsing->setChecked( true ); |
181 | mViewsSingleClickBox->setChecked( false ); | 284 | mViewsSingleClickBox->setChecked( false ); |
182 | 285 | ||
286 | mEmailClient->setCurrentItem(KABPrefs::OMPI); | ||
287 | emailclient_changed( KABPrefs::OMPI ); | ||
288 | |||
289 | |||
183 | emit changed( true ); | 290 | emit changed( true ); |
184 | } | 291 | } |
185 | 292 | ||
186 | void KABConfigWidget::modified() | 293 | void KABConfigWidget::modified() |
@@ -209,26 +316,26 @@ void KABConfigWidget::restoreExtensionSettings() | |||
209 | #else //KAB_EMBEDDED | 316 | #else //KAB_EMBEDDED |
210 | ExtensionFactory *extensionFactory = new MergeFactory(); | 317 | ExtensionFactory *extensionFactory = new MergeFactory(); |
211 | 318 | ||
212 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 319 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
213 | 320 | ||
214 | item->setFactory( extensionFactory ); | 321 | item->setFactory( extensionFactory ); |
215 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 322 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
216 | item->setOn( true ); | 323 | item->setOn( true ); |
217 | |||
218 | 324 | ||
219 | 325 | ||
326 | |||
220 | extensionFactory = new DistributionListFactory(); | 327 | extensionFactory = new DistributionListFactory(); |
221 | 328 | ||
222 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 329 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
223 | 330 | ||
224 | item->setFactory( extensionFactory ); | 331 | item->setFactory( extensionFactory ); |
225 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 332 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
226 | item->setOn( true ); | 333 | item->setOn( true ); |
227 | 334 | ||
228 | 335 | ||
229 | #endif //KAB_EMBEDDED | 336 | #endif //KAB_EMBEDDED |
230 | 337 | ||
231 | } | 338 | } |
232 | 339 | ||
233 | void KABConfigWidget::saveExtensionSettings() | 340 | void KABConfigWidget::saveExtensionSettings() |
234 | { | 341 | { |
@@ -316,9 +423,9 @@ bool ExtensionItem::configWidgetAvailable() const | |||
316 | 423 | ||
317 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 424 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
318 | if ( !extensionFactory ) | 425 | if ( !extensionFactory ) |
319 | return false; | 426 | return false; |
320 | 427 | ||
321 | return extensionFactory->configureWidgetAvailable(); | 428 | return extensionFactory->configureWidgetAvailable(); |
322 | #else //KAB_EMBEDDED | 429 | #else //KAB_EMBEDDED |
323 | return mFactory->configureWidgetAvailable(); | 430 | return mFactory->configureWidgetAvailable(); |
324 | #endif //KAB_EMBEDDED | 431 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 0f36d9e..9d1363b 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCONFIGWIDGET_H | 24 | #ifndef KABCONFIGWIDGET_H |
25 | #define KABCONFIGWIDGET_H | 25 | #define KABCONFIGWIDGET_H |
26 | 26 | ||
@@ -28,20 +28,21 @@ | |||
28 | 28 | ||
29 | class QCheckBox; | 29 | class QCheckBox; |
30 | class QListViewItem; | 30 | class QListViewItem; |
31 | class QPushButton; | 31 | class QPushButton; |
32 | 32 | class QComboBox; | |
33 | class QLineEdit; | ||
33 | class KListView; | 34 | class KListView; |
34 | 35 | ||
35 | class AddresseeWidget; | 36 | class AddresseeWidget; |
36 | 37 | ||
37 | class KABConfigWidget : public QWidget | 38 | class KABConfigWidget : public QWidget |
38 | { | 39 | { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | 41 | ||
41 | public: | 42 | public: |
42 | KABConfigWidget( QWidget *parent, const char *name = 0 ); | 43 | KABConfigWidget( QWidget *parent, const char *name = 0 ); |
43 | 44 | ||
44 | void restoreSettings(); | 45 | void restoreSettings(); |
45 | void saveSettings(); | 46 | void saveSettings(); |
46 | void defaults(); | 47 | void defaults(); |
47 | 48 | ||
@@ -50,12 +51,15 @@ class KABConfigWidget : public QWidget | |||
50 | 51 | ||
51 | public slots: | 52 | public slots: |
52 | void modified(); | 53 | void modified(); |
53 | 54 | ||
55 | |||
56 | |||
54 | private slots: | 57 | private slots: |
55 | void configureExtension(); | 58 | void configureExtension(); |
56 | void selectionChanged( QListViewItem* ); | 59 | void selectionChanged( QListViewItem* ); |
57 | void itemClicked( QListViewItem* ); | 60 | void itemClicked( QListViewItem* ); |
61 | void emailclient_changed( int newClient ); | ||
58 | 62 | ||
59 | private: | 63 | private: |
60 | void restoreExtensionSettings(); | 64 | void restoreExtensionSettings(); |
61 | void saveExtensionSettings(); | 65 | void saveExtensionSettings(); |
@@ -64,8 +68,10 @@ class KABConfigWidget : public QWidget | |||
64 | 68 | ||
65 | QCheckBox *mNameParsing; | 69 | QCheckBox *mNameParsing; |
66 | QCheckBox *mViewsSingleClickBox; | 70 | QCheckBox *mViewsSingleClickBox; |
67 | QPushButton *mConfigureButton; | 71 | QPushButton *mConfigureButton; |
72 | QComboBox* mEmailClient; | ||
73 | QLineEdit* mEmailChannel; | ||
68 | 74 | ||
69 | AddresseeWidget *mAddresseeWidget; | 75 | AddresseeWidget *mAddresseeWidget; |
70 | }; | 76 | }; |
71 | 77 | ||