author | ulf69 <ulf69> | 2004-08-10 01:34:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-10 01:34:22 (UTC) |
commit | c9d570427f3d5bead7bee1301514a2d4b82836ea (patch) (unidiff) | |
tree | 8d25f388217c591b7dac1db6c26d0777e6459352 | |
parent | 4f05a9fcbb9e54184aef93883886aaf865104463 (diff) | |
download | kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.zip kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.gz kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.bz2 |
enhancements to configure external apps like email and phones through a
generalized interface
-rw-r--r-- | kaddressbook/kabcore.cpp | 53 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.h | 10 | ||||
-rw-r--r-- | libkdepim/addresseeview.cpp | 31 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kcmkdepimconfig.cpp | 24 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kcmkdepimconfig.h | 10 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 534 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.h | 68 | ||||
-rw-r--r-- | libkdepim/kpimprefs.cpp | 11 | ||||
-rw-r--r-- | libkdepim/kpimprefs.h | 19 | ||||
-rw-r--r-- | libkdepim/libkdepim.pro | 4 | ||||
-rw-r--r-- | libkdepim/libkdepimE.pro | 4 | ||||
-rw-r--r-- | microkde/kdeui/kcmodule.cpp | 16 | ||||
-rw-r--r-- | microkde/kdeui/kcmodule.h | 11 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.cpp | 13 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.h | 5 |
16 files changed, 580 insertions, 253 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4303cab..fe4841a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -68,48 +68,50 @@ | |||
68 | #include "kaddressbookmain.h" | 68 | #include "kaddressbookmain.h" |
69 | #include "kactioncollection.h" | 69 | #include "kactioncollection.h" |
70 | #include <qapp.h> | 70 | #include <qapp.h> |
71 | #include <qmenubar.h> | 71 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 72 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 73 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 74 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 75 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 76 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | 79 | ||
80 | //#include <qlabel.h> | 80 | //#include <qlabel.h> |
81 | 81 | ||
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | #include <qtopia/services.h> | 84 | #include <qtopia/services.h> |
85 | #include <qtopia/qcopenvelope_qws.h> | 85 | #include <qtopia/qcopenvelope_qws.h> |
86 | #include <qpe/ir.h> | 86 | #include <qpe/ir.h> |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | #endif // KAB_EMBEDDED | 89 | #endif // KAB_EMBEDDED |
90 | #include "kcmconfigs/kcmkabconfig.h" | 90 | #include "kcmconfigs/kcmkabconfig.h" |
91 | #include "kcmconfigs/kcmkdepimconfig.h" | 91 | #include "kcmconfigs/kcmkdepimconfig.h" |
92 | #include "kpimglobalprefs.h" | ||
93 | #include "externalapphandler.h" | ||
92 | 94 | ||
93 | 95 | ||
94 | #include <kresources/selectdialog.h> | 96 | #include <kresources/selectdialog.h> |
95 | #include <kmessagebox.h> | 97 | #include <kmessagebox.h> |
96 | 98 | ||
97 | #include <picture.h> | 99 | #include <picture.h> |
98 | #include <resource.h> | 100 | #include <resource.h> |
99 | 101 | ||
100 | //US#include <qsplitter.h> | 102 | //US#include <qsplitter.h> |
101 | #include <qmap.h> | 103 | #include <qmap.h> |
102 | #include <qdir.h> | 104 | #include <qdir.h> |
103 | #include <qfile.h> | 105 | #include <qfile.h> |
104 | #include <qvbox.h> | 106 | #include <qvbox.h> |
105 | #include <qlayout.h> | 107 | #include <qlayout.h> |
106 | #include <qclipboard.h> | 108 | #include <qclipboard.h> |
107 | #include <qtextstream.h> | 109 | #include <qtextstream.h> |
108 | 110 | ||
109 | #include <libkdepim/categoryselectdialog.h> | 111 | #include <libkdepim/categoryselectdialog.h> |
110 | #include <kabc/vcardconverter.h> | 112 | #include <kabc/vcardconverter.h> |
111 | 113 | ||
112 | 114 | ||
113 | #include "addresseeutil.h" | 115 | #include "addresseeutil.h" |
114 | #include "undocmds.h" | 116 | #include "undocmds.h" |
115 | #include "addresseeeditordialog.h" | 117 | #include "addresseeeditordialog.h" |
@@ -446,71 +448,49 @@ void KABCore::setContactSelected( const QString &uid ) | |||
446 | } | 448 | } |
447 | 449 | ||
448 | mActionCopy->setEnabled( selected ); | 450 | mActionCopy->setEnabled( selected ); |
449 | mActionDelete->setEnabled( selected ); | 451 | mActionDelete->setEnabled( selected ); |
450 | mActionEditAddressee->setEnabled( selected ); | 452 | mActionEditAddressee->setEnabled( selected ); |
451 | mActionMail->setEnabled( selected ); | 453 | mActionMail->setEnabled( selected ); |
452 | mActionMailVCard->setEnabled( selected ); | 454 | mActionMailVCard->setEnabled( selected ); |
453 | //if (mActionBeam) | 455 | //if (mActionBeam) |
454 | //mActionBeam->setEnabled( selected ); | 456 | //mActionBeam->setEnabled( selected ); |
455 | 457 | ||
456 | if (mActionBeamVCard) | 458 | if (mActionBeamVCard) |
457 | mActionBeamVCard->setEnabled( selected ); | 459 | mActionBeamVCard->setEnabled( selected ); |
458 | 460 | ||
459 | mActionWhoAmI->setEnabled( selected ); | 461 | mActionWhoAmI->setEnabled( selected ); |
460 | mActionCategories->setEnabled( selected ); | 462 | mActionCategories->setEnabled( selected ); |
461 | } | 463 | } |
462 | 464 | ||
463 | void KABCore::sendMail() | 465 | void KABCore::sendMail() |
464 | { | 466 | { |
465 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 467 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
466 | } | 468 | } |
467 | 469 | ||
468 | void KABCore::sendMail( const QString& email ) | 470 | void KABCore::sendMail( const QString& email ) |
469 | { | 471 | { |
470 | //US original kde implementation : kapp->invokeMailer( email, "" ); | 472 | bool result = ExternalAppHandler::instance()->mailToContacts(email); |
471 | |||
472 | /*US original qtopia implementation | ||
473 | PimContact c = abList->currentEntry(); | ||
474 | QString name = c.fileAs(); | ||
475 | QString email = c.defaultEmail(); | ||
476 | #ifndef QT_NO_COP | ||
477 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); | ||
478 | e << name << email; | ||
479 | #else | ||
480 | */ | ||
481 | |||
482 | |||
483 | #ifndef QT_NO_COP | ||
484 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | ||
485 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | ||
486 | |||
487 | QCopEnvelope e(channel, "writeMail(QString,QString)"); | ||
488 | //US we need no names in the To field. The emailadresses are enough | ||
489 | e << "" << email; | ||
490 | #else | ||
491 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | ||
492 | #endif | ||
493 | } | 473 | } |
494 | 474 | ||
495 | 475 | ||
496 | 476 | ||
497 | void KABCore::mailVCard() | 477 | void KABCore::mailVCard() |
498 | { | 478 | { |
499 | QStringList uids = mViewManager->selectedUids(); | 479 | QStringList uids = mViewManager->selectedUids(); |
500 | if ( !uids.isEmpty() ) | 480 | if ( !uids.isEmpty() ) |
501 | mailVCard( uids ); | 481 | mailVCard( uids ); |
502 | } | 482 | } |
503 | 483 | ||
504 | void KABCore::mailVCard( const QStringList& uids ) | 484 | void KABCore::mailVCard( const QStringList& uids ) |
505 | { | 485 | { |
506 | QStringList urls; | 486 | QStringList urls; |
507 | 487 | ||
508 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 488 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
509 | 489 | ||
510 | /*US | 490 | /*US |
511 | // Create a temp dir, so that we can put the files in it with proper names | 491 | // Create a temp dir, so that we can put the files in it with proper names |
512 | KTempFile tempDir; | 492 | KTempFile tempDir; |
513 | if ( tempDir.status() != 0 ) { | 493 | if ( tempDir.status() != 0 ) { |
514 | kdWarning() << strerror( tempDir.status() ) << endl; | 494 | kdWarning() << strerror( tempDir.status() ) << endl; |
515 | return; | 495 | return; |
516 | } | 496 | } |
@@ -529,68 +509,59 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
529 | 509 | ||
530 | if ( a.isEmpty() ) | 510 | if ( a.isEmpty() ) |
531 | continue; | 511 | continue; |
532 | 512 | ||
533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 513 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
534 | 514 | ||
535 | QString fileName = dirName + "/" + name; | 515 | QString fileName = dirName + "/" + name; |
536 | 516 | ||
537 | QFile outFile(fileName); | 517 | QFile outFile(fileName); |
538 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 518 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
539 | KABC::VCardConverter converter; | 519 | KABC::VCardConverter converter; |
540 | QString vcard; | 520 | QString vcard; |
541 | 521 | ||
542 | converter.addresseeToVCard( a, vcard ); | 522 | converter.addresseeToVCard( a, vcard ); |
543 | 523 | ||
544 | QTextStream t( &outFile ); // use a text stream | 524 | QTextStream t( &outFile ); // use a text stream |
545 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 525 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
546 | t << vcard; | 526 | t << vcard; |
547 | 527 | ||
548 | outFile.close(); | 528 | outFile.close(); |
549 | 529 | ||
550 | urls.append( fileName ); | 530 | urls.append( fileName ); |
551 | } | 531 | } |
552 | } | 532 | } |
533 | |||
534 | bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); | ||
535 | |||
536 | |||
553 | /*US | 537 | /*US |
554 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 538 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
555 | QString::null, // subject | 539 | QString::null, // subject |
556 | QString::null, // body | 540 | QString::null, // body |
557 | QString::null, | 541 | QString::null, |
558 | urls ); // attachments | 542 | urls ); // attachments |
559 | */ | 543 | */ |
560 | #ifndef QT_NO_COP | ||
561 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | ||
562 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | ||
563 | |||
564 | QMap<QString, QString> parameterMap; | ||
565 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); | ||
566 | |||
567 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); | ||
568 | e << parameterMap; | ||
569 | #else | ||
570 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | ||
571 | #endif | ||
572 | |||
573 | 544 | ||
574 | } | 545 | } |
575 | 546 | ||
576 | /** | 547 | /** |
577 | Beams the "WhoAmI contact. | 548 | Beams the "WhoAmI contact. |
578 | */ | 549 | */ |
579 | void KABCore::beamMySelf() | 550 | void KABCore::beamMySelf() |
580 | { | 551 | { |
581 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 552 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
582 | if (!a.isEmpty()) | 553 | if (!a.isEmpty()) |
583 | { | 554 | { |
584 | QStringList uids; | 555 | QStringList uids; |
585 | uids << a.uid(); | 556 | uids << a.uid(); |
586 | 557 | ||
587 | beamVCard(uids); | 558 | beamVCard(uids); |
588 | } else { | 559 | } else { |
589 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 560 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
590 | 561 | ||
591 | 562 | ||
592 | } | 563 | } |
593 | } | 564 | } |
594 | 565 | ||
595 | void KABCore::beamVCard() | 566 | void KABCore::beamVCard() |
596 | { | 567 | { |
@@ -1176,53 +1147,55 @@ QString KABCore::getNameByPhone( const QString &phone ) | |||
1176 | KABC::PhoneNumber::List::Iterator phoneIter; | 1147 | KABC::PhoneNumber::List::Iterator phoneIter; |
1177 | KABC::PhoneNumber::List phoneList; | 1148 | KABC::PhoneNumber::List phoneList; |
1178 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1149 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1179 | phoneList = (*iter).phoneNumbers(); | 1150 | phoneList = (*iter).phoneNumbers(); |
1180 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1151 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1181 | ++phoneIter) { | 1152 | ++phoneIter) { |
1182 | // Get rid of separator chars so just the numbers are compared. | 1153 | // Get rid of separator chars so just the numbers are compared. |
1183 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1154 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1184 | ownerName = (*iter).formattedName(); | 1155 | ownerName = (*iter).formattedName(); |
1185 | found = true; | 1156 | found = true; |
1186 | } | 1157 | } |
1187 | } | 1158 | } |
1188 | } | 1159 | } |
1189 | 1160 | ||
1190 | return ownerName; | 1161 | return ownerName; |
1191 | #else //KAB_EMBEDDED | 1162 | #else //KAB_EMBEDDED |
1192 | qDebug("KABCore::getNameByPhone finsih method"); | 1163 | qDebug("KABCore::getNameByPhone finsih method"); |
1193 | return ""; | 1164 | return ""; |
1194 | #endif //KAB_EMBEDDED | 1165 | #endif //KAB_EMBEDDED |
1195 | 1166 | ||
1196 | } | 1167 | } |
1197 | 1168 | ||
1198 | void KABCore::openConfigDialog() | 1169 | void KABCore::openConfigDialog() |
1199 | { | 1170 | { |
1200 | KABPrefs* prefs = KABPrefs::instance(); | 1171 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1201 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( prefs, "PIM", this ,"kabconfigdialog", true ); | 1172 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1202 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1173 | |
1174 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | ||
1175 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | ||
1203 | ConfigureDialog->addModule(kabcfg ); | 1176 | ConfigureDialog->addModule(kabcfg ); |
1204 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Pim")) , "KCMKdeLibConfig" ); | 1177 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1205 | ConfigureDialog->addModule(kdelibcfg ); | 1178 | ConfigureDialog->addModule(kdelibcfg ); |
1206 | 1179 | ||
1207 | 1180 | ||
1208 | 1181 | ||
1209 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1182 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1210 | this, SLOT( configurationChanged() ) ); | 1183 | this, SLOT( configurationChanged() ) ); |
1211 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1184 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1212 | this, SLOT( configurationChanged() ) ); | 1185 | this, SLOT( configurationChanged() ) ); |
1213 | saveSettings(); | 1186 | saveSettings(); |
1214 | ConfigureDialog->showMaximized(); | 1187 | ConfigureDialog->showMaximized(); |
1215 | if ( ConfigureDialog->exec() ) | 1188 | if ( ConfigureDialog->exec() ) |
1216 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); | 1189 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); |
1217 | delete ConfigureDialog; | 1190 | delete ConfigureDialog; |
1218 | } | 1191 | } |
1219 | 1192 | ||
1220 | void KABCore::openLDAPDialog() | 1193 | void KABCore::openLDAPDialog() |
1221 | { | 1194 | { |
1222 | #ifndef KAB_EMBEDDED | 1195 | #ifndef KAB_EMBEDDED |
1223 | if ( !mLdapSearchDialog ) { | 1196 | if ( !mLdapSearchDialog ) { |
1224 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1197 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1225 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1198 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1226 | SLOT( refreshView() ) ); | 1199 | SLOT( refreshView() ) ); |
1227 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1200 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1228 | SLOT( setModified() ) ); | 1201 | SLOT( setModified() ) ); |
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp index 26398f8..b460a81 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp +++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp | |||
@@ -18,75 +18,75 @@ | |||
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 <qlayout.h> | 24 | #include <qlayout.h> |
25 | 25 | ||
26 | #ifndef KAB_EMBEDDED | 26 | #ifndef KAB_EMBEDDED |
27 | #include <kaboutdata.h> | 27 | #include <kaboutdata.h> |
28 | #endif //KAB_EMBEDDED | 28 | #endif //KAB_EMBEDDED |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | //#include <klocale.h> | 30 | //#include <klocale.h> |
31 | //#include <stdlib.h> | 31 | //#include <stdlib.h> |
32 | 32 | ||
33 | #include "kabconfigwidget.h" | 33 | #include "kabconfigwidget.h" |
34 | 34 | ||
35 | #include "kcmkabconfig.h" | 35 | #include "kcmkabconfig.h" |
36 | 36 | ||
37 | #include "kabprefs.h" | 37 | #include "kabprefs.h" |
38 | #include "kprefs.h" | 38 | #include "kprefs.h" |
39 | 39 | ||
40 | extern "C" | 40 | extern "C" |
41 | { | 41 | { |
42 | KCModule *create_kabconfig( QWidget *parent, const char * ) { | 42 | KCModule *create_kabconfig( KABPrefs* prefs, QWidget *parent, const char * ) { |
43 | return new KCMKabConfig( parent, "kcmkabconfig" ); | 43 | return new KCMKabConfig( prefs, parent, "kcmkabconfig" ); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) | 47 | KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name ) |
48 | : KCModule( parent, name ) | 48 | : KCModule( prefs, parent, name ) |
49 | { | 49 | { |
50 | //abort(); | 50 | //abort(); |
51 | QVBoxLayout *layout = new QVBoxLayout( this ); | 51 | QVBoxLayout *layout = new QVBoxLayout( this ); |
52 | mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); | 52 | mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); |
53 | layout->addWidget( mConfigWidget ); | 53 | layout->addWidget( mConfigWidget ); |
54 | layout->setSpacing( 0 ); | 54 | layout->setSpacing( 0 ); |
55 | layout->setMargin( 0 ); | 55 | layout->setMargin( 0 ); |
56 | 56 | ||
57 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 57 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
58 | } | 58 | } |
59 | 59 | ||
60 | void KCMKabConfig::load(KPrefs* prefs) | 60 | void KCMKabConfig::load() |
61 | { | 61 | { |
62 | mConfigWidget->restoreSettings((KABPrefs*)prefs); | 62 | mConfigWidget->restoreSettings((KABPrefs*)getPreferences()); |
63 | } | 63 | } |
64 | 64 | ||
65 | void KCMKabConfig::save(KPrefs* prefs) | 65 | void KCMKabConfig::save() |
66 | { | 66 | { |
67 | mConfigWidget->saveSettings((KABPrefs*)prefs); | 67 | mConfigWidget->saveSettings((KABPrefs*)getPreferences()); |
68 | } | 68 | } |
69 | 69 | ||
70 | void KCMKabConfig::defaults(KPrefs* prefs) | 70 | void KCMKabConfig::defaults() |
71 | { | 71 | { |
72 | mConfigWidget->defaults((KABPrefs*)prefs); | 72 | mConfigWidget->defaults((KABPrefs*)getPreferences()); |
73 | } | 73 | } |
74 | 74 | ||
75 | #ifndef KAB_EMBEDDED | 75 | #ifndef KAB_EMBEDDED |
76 | const KAboutData* KCMKabConfig::aboutData() const | 76 | const KAboutData* KCMKabConfig::aboutData() const |
77 | { | 77 | { |
78 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), | 78 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), |
79 | I18N_NOOP( "KAddressBook Configure Dialog" ), | 79 | I18N_NOOP( "KAddressBook Configure Dialog" ), |
80 | 0, 0, KAboutData::License_GPL, | 80 | 0, 0, KAboutData::License_GPL, |
81 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); | 81 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); |
82 | 82 | ||
83 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); | 83 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); |
84 | 84 | ||
85 | return about; | 85 | return about; |
86 | 86 | ||
87 | } | 87 | } |
88 | #endif //KAB_EMBEDDED | 88 | #endif //KAB_EMBEDDED |
89 | 89 | ||
90 | #ifndef KAB_EMBEDDED | 90 | #ifndef KAB_EMBEDDED |
91 | #include "kcmkabconfig.moc" | 91 | #include "kcmkabconfig.moc" |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h index b4858c1..1cb6ad3 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.h +++ b/kaddressbook/kcmconfigs/kcmkabconfig.h | |||
@@ -6,42 +6,42 @@ | |||
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 KCMKABCONFIG_H | 24 | #ifndef KCMKABCONFIG_H |
25 | #define KCMKABCONFIG_H | 25 | #define KCMKABCONFIG_H |
26 | 26 | ||
27 | #include <kcmodule.h> | 27 | #include <kcmodule.h> |
28 | 28 | ||
29 | class KABConfigWidget; | 29 | class KABConfigWidget; |
30 | class KPrefs; | 30 | class KABPrefs; |
31 | 31 | ||
32 | class KCMKabConfig : public KCModule | 32 | class KCMKabConfig : public KCModule |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); | 37 | KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); |
38 | 38 | ||
39 | virtual void load(KPrefs* prefs); | 39 | virtual void load(); |
40 | virtual void save(KPrefs* prefs); | 40 | virtual void save(); |
41 | virtual void defaults(KPrefs* prefs); | 41 | virtual void defaults(); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | KABConfigWidget *mConfigWidget; | 44 | KABConfigWidget *mConfigWidget; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #endif | 47 | #endif |
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index 547441c..83aba48 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp | |||
@@ -16,222 +16,222 @@ | |||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kabc/address.h> | 22 | #include <kabc/address.h> |
23 | #include <kabc/addressee.h> | 23 | #include <kabc/addressee.h> |
24 | #include <kabc/phonenumber.h> | 24 | #include <kabc/phonenumber.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | //US#include <kglobalsettings.h> | 26 | //US#include <kglobalsettings.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | //US #include <kstringhandler.h> | 29 | //US #include <kstringhandler.h> |
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | 34 | ||
35 | 35 | ||
36 | #include "addresseeview.h" | 36 | #include "addresseeview.h" |
37 | 37 | ||
38 | 38 | ||
39 | #ifndef DESKTOP_VERSION | 39 | #ifndef DESKTOP_VERSION |
40 | #include <qtopia/qcopenvelope_qws.h> | 40 | #include <qtopia/qcopenvelope_qws.h> |
41 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | static int kphoneInstalled = 0; | 44 | static int kphoneInstalled = 0; |
45 | 45 | ||
46 | using namespace KPIM; | 46 | using namespace KPIM; |
47 | 47 | ||
48 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 48 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
49 | //US : KTextBrowser( parent, name ) | 49 | //US : KTextBrowser( parent, name ) |
50 | : QTextBrowser( parent, name ) | 50 | : QTextBrowser( parent, name ) |
51 | 51 | ||
52 | 52 | ||
53 | { | 53 | { |
54 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 54 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
55 | setLinkUnderline( false ); | 55 | setLinkUnderline( false ); |
56 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 56 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
57 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 57 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
58 | 58 | ||
59 | //US QStyleSheet *sheet = styleSheet(); | 59 | //US QStyleSheet *sheet = styleSheet(); |
60 | //US QStyleSheetItem *link = sheet->item( "a" ); | 60 | //US QStyleSheetItem *link = sheet->item( "a" ); |
61 | //US link->setColor( KGlobalSettings::linkColor() ); | 61 | //US link->setColor( KGlobalSettings::linkColor() ); |
62 | 62 | ||
63 | } | 63 | } |
64 | void AddresseeView::setSource(const QString& n) | 64 | void AddresseeView::setSource(const QString& n) |
65 | { | 65 | { |
66 | qDebug("********AddresseeView::setSource %s", n.latin1()); | 66 | qDebug("********AddresseeView::setSource %s", n.latin1()); |
67 | #ifndef DESKTOP_VERSION | 67 | #ifndef DESKTOP_VERSION |
68 | if ( n.left( 6 ) == "mailto" ) { | 68 | if ( n.left( 6 ) == "mailto" ) { |
69 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)"); | 69 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)"); |
70 | e << n.mid(7); | 70 | e << n.mid(7); |
71 | } | 71 | } |
72 | if ( n.left( 7 ) == "phoneto" ) { | 72 | if ( n.left( 7 ) == "phoneto" ) { |
73 | QString mess = "-ring:" + n.mid(8); | 73 | QString mess = "-ring:" + n.mid(8); |
74 | QCopEnvelope e("QPE/Application/kppi", mess.latin1()); | 74 | QCopEnvelope e("QPE/Application/kppi", mess.latin1()); |
75 | } | 75 | } |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | } | 78 | } |
79 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 79 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
80 | { | 80 | { |
81 | bool kphoneAvail = false; | 81 | bool kphoneAvail = false; |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | if ( ! kphoneInstalled ) { | 84 | if ( ! kphoneInstalled ) { |
85 | if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) ) | 85 | if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) ) |
86 | kphoneInstalled = 1; | 86 | kphoneInstalled = 1; |
87 | else | 87 | else |
88 | kphoneInstalled = -1; | 88 | kphoneInstalled = -1; |
89 | } | 89 | } |
90 | if ( kphoneInstalled > 0 ) | 90 | if ( kphoneInstalled > 0 ) |
91 | kphoneAvail = true; | 91 | kphoneAvail = true; |
92 | #if 0 | 92 | #if 0 |
93 | if ( kphoneAvail ) | 93 | if ( kphoneAvail ) |
94 | qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); | 94 | qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); |
95 | else | 95 | else |
96 | qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); | 96 | qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail "); |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | #endif | 99 | #endif |
100 | mAddressee = addr; | 100 | mAddressee = addr; |
101 | // clear view | 101 | // clear view |
102 | setText( QString::null ); | 102 | setText( QString::null ); |
103 | 103 | ||
104 | if ( mAddressee.isEmpty() ) | 104 | if ( mAddressee.isEmpty() ) |
105 | return; | 105 | return; |
106 | 106 | ||
107 | QString name = ( mAddressee.formattedName().isEmpty() ? | 107 | QString name = ( mAddressee.formattedName().isEmpty() ? |
108 | mAddressee.assembledName() : mAddressee.formattedName() ); | 108 | mAddressee.assembledName() : mAddressee.formattedName() ); |
109 | 109 | ||
110 | QString dynamicPart; | 110 | QString dynamicPart; |
111 | 111 | ||
112 | QStringList emails = mAddressee.emails(); | 112 | QStringList emails = mAddressee.emails(); |
113 | QStringList::ConstIterator emailIt; | 113 | QStringList::ConstIterator emailIt; |
114 | QString type = i18n( "Email" ); | 114 | QString type = i18n( "Email" ); |
115 | emailIt = emails.begin(); | 115 | emailIt = emails.begin(); |
116 | if ( emailIt != emails.end() ) { | 116 | if ( emailIt != emails.end() ) { |
117 | dynamicPart += QString( | 117 | dynamicPart += QString( |
118 | "<tr><td align=\"right\"><b>%1</b></td>" | 118 | "<tr><td align=\"right\"><b>%1</b></td>" |
119 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 119 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
120 | .arg( type ) | 120 | .arg( type ) |
121 | .arg( name ) | 121 | .arg( name ) |
122 | .arg( *emailIt ) | 122 | .arg( *emailIt ) |
123 | .arg( *emailIt ); | 123 | .arg( *emailIt ); |
124 | ++emailIt; | 124 | ++emailIt; |
125 | } | 125 | } |
126 | 126 | ||
127 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); | 127 | KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); |
128 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 128 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
129 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 129 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
130 | if ( kphoneAvail ) { | 130 | if ( kphoneAvail ) { |
131 | dynamicPart += QString( | 131 | dynamicPart += QString( |
132 | "<tr><td align=\"right\"><b>%1</b></td>" | 132 | "<tr><td align=\"right\"><b>%1</b></td>" |
133 | "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" ) | 133 | "<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" ) |
134 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) | 134 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) |
135 | .arg( (*phoneIt).number() ) | 135 | .arg( (*phoneIt).number() ) |
136 | .arg( (*phoneIt).number() ); | 136 | .arg( (*phoneIt).number() ); |
137 | 137 | ||
138 | } else { | 138 | } else { |
139 | dynamicPart += QString( | 139 | dynamicPart += QString( |
140 | "<tr><td align=\"right\"><b>%1</b></td>" | 140 | "<tr><td align=\"right\"><b>%1</b></td>" |
141 | "<td align=\"left\">%2</td></tr>" ) | 141 | "<td align=\"left\">%2</td></tr>" ) |
142 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) | 142 | .arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) ) |
143 | .arg( (*phoneIt).number() ); | 143 | .arg( (*phoneIt).number() ); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | for ( ; emailIt != emails.end(); ++emailIt ) { | 148 | for ( ; emailIt != emails.end(); ++emailIt ) { |
149 | dynamicPart += QString( | 149 | dynamicPart += QString( |
150 | "<tr><td align=\"right\"><b>%1</b></td>" | 150 | "<tr><td align=\"right\"><b>%1</b></td>" |
151 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 151 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
152 | .arg( type ) | 152 | .arg( type ) |
153 | .arg( name ) | 153 | .arg( name ) |
154 | .arg( *emailIt ) | 154 | .arg( *emailIt ) |
155 | .arg( *emailIt ); | 155 | .arg( *emailIt ); |
156 | } | 156 | } |
157 | 157 | ||
158 | if ( !mAddressee.url().url().isEmpty() ) { | 158 | if ( !mAddressee.url().url().isEmpty() ) { |
159 | dynamicPart += QString( | 159 | dynamicPart += QString( |
160 | "<tr><td align=\"right\"><b>%1</b></td>" | 160 | "<tr><td align=\"right\"><b>%1</b></td>" |
161 | "<td align=\"left\">%2</td></tr>" ) | 161 | "<td align=\"left\">%2</td></tr>" ) |
162 | .arg( i18n( "Homepage" ) ) | 162 | .arg( i18n( "Homepage" ) ) |
163 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 163 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
164 | .arg( mAddressee.url().url() ); | 164 | .arg( mAddressee.url().url() ); |
165 | //qDebug("AddresseeView::setAddressee has to be verified."); | 165 | //qDebug("AddresseeView::setAddressee has to be verified."); |
166 | } | 166 | } |
167 | 167 | ||
168 | KABC::Address::List addresses = mAddressee.addresses(); | 168 | KABC::Address::List addresses = mAddressee.addresses(); |
169 | KABC::Address::List::ConstIterator addrIt; | 169 | KABC::Address::List::ConstIterator addrIt; |
170 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 170 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
171 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 171 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |
172 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); | 172 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); |
173 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); | 173 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); |
174 | //qDebug("adresss %s ",formattedAddress.latin1() ); | 174 | //qDebug("adresss %s ",formattedAddress.latin1() ); |
175 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); | 175 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); |
176 | //qDebug("AddresseeView::setAddressee has to be verified."); | 176 | //qDebug("AddresseeView::setAddressee has to be verified."); |
177 | 177 | ||
178 | dynamicPart += QString( | 178 | dynamicPart += QString( |
179 | "<tr><td align=\"right\"><b>%1</b></td>" | 179 | "<tr><td align=\"right\"><b>%1</b></td>" |
180 | "<td align=\"left\">%2</td></tr>" ) | 180 | "<td align=\"left\">%2</td></tr>" ) |
181 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 181 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
182 | .arg( formattedAddress ); | 182 | .arg( formattedAddress ); |
183 | } else { | 183 | } else { |
184 | 184 | ||
185 | dynamicPart += QString( | 185 | dynamicPart += QString( |
186 | "<tr><td align=\"right\"><b>%1</b></td>" | 186 | "<tr><td align=\"right\"><b>%1</b></td>" |
187 | "<td align=\"left\">%2</td></tr>" ) | 187 | "<td align=\"left\">%2</td></tr>" ) |
188 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 188 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
189 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 189 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
190 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 190 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
191 | 191 | ||
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | QString notes; | 195 | QString notes; |
196 | if ( !mAddressee.note().isEmpty() ) { | 196 | if ( !mAddressee.note().isEmpty() ) { |
197 | notes = QString( | 197 | notes = QString( |
198 | "<tr>" | 198 | "<tr>" |
199 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label | 199 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
200 | "<td align=\"left\">%2</td>" // note | 200 | "<td align=\"left\">%2</td>" // note |
201 | "</tr>" ).arg( i18n( "Notes" ) ) | 201 | "</tr>" ).arg( i18n( "Notes" ) ) |
202 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 202 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
203 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 203 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
204 | //qDebug("AddresseeView::setAddressee has to be verified."); | 204 | //qDebug("AddresseeView::setAddressee has to be verified."); |
205 | } | 205 | } |
206 | 206 | ||
207 | QString aRole = ""; | 207 | QString aRole = ""; |
208 | QString aOrga = ""; | 208 | QString aOrga = ""; |
209 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 209 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
210 | aRole = "<tr>" | 210 | aRole = "<tr>" |
211 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 211 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
212 | "</tr>"; | 212 | "</tr>"; |
213 | } | 213 | } |
214 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 214 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
215 | aOrga = "<tr>" | 215 | aOrga = "<tr>" |
216 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; | 216 | "<td align=\"left\">" + mAddressee.organization() + "</td>" ; |
217 | "</tr>"; | 217 | "</tr>"; |
218 | } | 218 | } |
219 | mText = ""; | 219 | mText = ""; |
220 | QString picString = ""; | 220 | QString picString = ""; |
221 | KABC::Picture picture = mAddressee.photo(); | 221 | KABC::Picture picture = mAddressee.photo(); |
222 | bool picAvailintern = false; | 222 | bool picAvailintern = false; |
223 | bool picAvailUrl = false; | 223 | bool picAvailUrl = false; |
224 | if (! picture.undefined() ) { | 224 | if (! picture.undefined() ) { |
225 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 225 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
226 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 226 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
227 | } | 227 | } |
228 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 228 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
229 | if ( picAvailintern ) { | 229 | if ( picAvailintern ) { |
230 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 230 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
231 | } else { | 231 | } else { |
232 | if ( picAvailUrl ) { | 232 | if ( picAvailUrl ) { |
233 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 233 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
234 | } else { | 234 | } else { |
235 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); | 235 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); |
236 | } | 236 | } |
237 | } | 237 | } |
@@ -247,99 +247,100 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
247 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 247 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
248 | "</tr>" | 248 | "</tr>" |
249 | "%5" // role | 249 | "%5" // role |
250 | "%6" // organization | 250 | "%6" // organization |
251 | "<td colspan=\"2\"> </td>" | 251 | "<td colspan=\"2\"> </td>" |
252 | "%7" // dynamic part | 252 | "%7" // dynamic part |
253 | "%8" // notes | 253 | "%8" // notes |
254 | "</table>" | 254 | "</table>" |
255 | "</body>" | 255 | "</body>" |
256 | "</html>") | 256 | "</html>") |
257 | //US | 257 | //US |
258 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 258 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
259 | //US | 259 | //US |
260 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 260 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
261 | .arg( picString ) | 261 | .arg( picString ) |
262 | .arg( name ) | 262 | .arg( name ) |
263 | .arg( aRole ) | 263 | .arg( aRole ) |
264 | .arg( aOrga ) | 264 | .arg( aOrga ) |
265 | .arg( dynamicPart ) | 265 | .arg( dynamicPart ) |
266 | .arg( notes ); | 266 | .arg( notes ); |
267 | 267 | ||
268 | } else { // no picture! | 268 | } else { // no picture! |
269 | 269 | ||
270 | mText = "<table width=\"100%\">\n"; | 270 | mText = "<table width=\"100%\">\n"; |
271 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 271 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
272 | #ifdef DESKTOP_VERSION | 272 | #ifdef DESKTOP_VERSION |
273 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 273 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
274 | #else | 274 | #else |
275 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; | 275 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; |
276 | #endif | 276 | #endif |
277 | 277 | ||
278 | #ifdef DESKTOP_VERSION | 278 | #ifdef DESKTOP_VERSION |
279 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; | 279 | mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; |
280 | #else | 280 | #else |
281 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; | 281 | mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; |
282 | #endif | 282 | #endif |
283 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 283 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
284 | 284 | ||
285 | mText += "<table><td colspan=\"2\"> </td>"; | 285 | mText += "<table><td colspan=\"2\"> </td>"; |
286 | /* | 286 | /* |
287 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 287 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
288 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 288 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
289 | .arg( i18n(" ") ) | 289 | .arg( i18n(" ") ) |
290 | .arg( name ); | 290 | .arg( name ); |
291 | */ | 291 | */ |
292 | if ( ! mAddressee.role().isEmpty() ) | 292 | if ( ! mAddressee.role().isEmpty() ) |
293 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 293 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
294 | "<td align=\"left\">%2</td></tr>" ) | 294 | "<td align=\"left\">%2</td></tr>" ) |
295 | .arg( i18n(" ") ) | 295 | .arg( i18n(" ") ) |
296 | .arg( mAddressee.role()); | 296 | .arg( mAddressee.role()); |
297 | if ( ! mAddressee.organization().isEmpty() ) | 297 | if ( ! mAddressee.organization().isEmpty() ) |
298 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 298 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
299 | "<td align=\"left\">%2</td></tr>" ) | 299 | "<td align=\"left\">%2</td></tr>" ) |
300 | .arg( i18n(" ") ) | 300 | .arg( i18n(" ") ) |
301 | .arg( mAddressee.organization()); | 301 | .arg( mAddressee.organization()); |
302 | mText += dynamicPart; | 302 | mText += dynamicPart; |
303 | mText += notes; | 303 | mText += notes; |
304 | mText += "</table>"; | 304 | mText += "</table>"; |
305 | 305 | ||
306 | } | 306 | } |
307 | 307 | ||
308 | // at last display it... | 308 | // at last display it... |
309 | setText( mText ); | 309 | setText( mText ); |
310 | |||
310 | } | 311 | } |
311 | 312 | ||
312 | KABC::Addressee AddresseeView::addressee() const | 313 | KABC::Addressee AddresseeView::addressee() const |
313 | { | 314 | { |
314 | return mAddressee; | 315 | return mAddressee; |
315 | } | 316 | } |
316 | void AddresseeView::addTag(const QString & tag,const QString & text) | 317 | void AddresseeView::addTag(const QString & tag,const QString & text) |
317 | { | 318 | { |
318 | if ( text.isEmpty() ) | 319 | if ( text.isEmpty() ) |
319 | return; | 320 | return; |
320 | int number=text.contains("\n"); | 321 | int number=text.contains("\n"); |
321 | QString str = "<" + tag + ">"; | 322 | QString str = "<" + tag + ">"; |
322 | QString tmpText=text; | 323 | QString tmpText=text; |
323 | QString tmpStr=str; | 324 | QString tmpStr=str; |
324 | if(number !=-1) | 325 | if(number !=-1) |
325 | { | 326 | { |
326 | if (number > 0) { | 327 | if (number > 0) { |
327 | int pos=0; | 328 | int pos=0; |
328 | QString tmp; | 329 | QString tmp; |
329 | for(int i=0;i<=number;i++) { | 330 | for(int i=0;i<=number;i++) { |
330 | pos=tmpText.find("\n"); | 331 | pos=tmpText.find("\n"); |
331 | tmp=tmpText.left(pos); | 332 | tmp=tmpText.left(pos); |
332 | tmpText=tmpText.right(tmpText.length()-pos-1); | 333 | tmpText=tmpText.right(tmpText.length()-pos-1); |
333 | tmpStr+=tmp+"<br>"; | 334 | tmpStr+=tmp+"<br>"; |
334 | } | 335 | } |
335 | } | 336 | } |
336 | else tmpStr += tmpText; | 337 | else tmpStr += tmpText; |
337 | tmpStr+="</" + tag + ">"; | 338 | tmpStr+="</" + tag + ">"; |
338 | mText.append(tmpStr); | 339 | mText.append(tmpStr); |
339 | } | 340 | } |
340 | else | 341 | else |
341 | { | 342 | { |
342 | str += text + "</" + tag + ">"; | 343 | str += text + "</" + tag + ">"; |
343 | mText.append(str); | 344 | mText.append(str); |
344 | } | 345 | } |
345 | } | 346 | } |
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp index 830d5d2..f26efe0 100644 --- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp +++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp | |||
@@ -18,60 +18,62 @@ | |||
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 | 31 | ||
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | //#include <klocale.h> | 35 | //#include <klocale.h> |
36 | //#include <stdlib.h> | 36 | //#include <stdlib.h> |
37 | 37 | ||
38 | #include "kdepimconfigwidget.h" | 38 | #include "kdepimconfigwidget.h" |
39 | 39 | ||
40 | #include "kcmkdepimconfig.h" | 40 | #include "kcmkdepimconfig.h" |
41 | #include "kprefs.h" | 41 | #include "kprefs.h" |
42 | #include "kpimprefs.h" | 42 | #include "kpimglobalprefs.h" |
43 | |||
43 | #ifndef _WIN32_ | 44 | #ifndef _WIN32_ |
44 | extern "C" | 45 | extern "C" |
45 | { | 46 | { |
46 | KCModule *create_kabconfig( QWidget *parent, const char * ) { | 47 | KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) { |
47 | return new KCMKdePimConfig( parent, "kcmkdepimconfig" ); | 48 | return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" ); |
48 | } | 49 | } |
49 | } | 50 | } |
50 | #endif | 51 | #endif |
51 | KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name ) | 52 | |
52 | : KCModule( parent, name ) | 53 | KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name ) |
54 | : KCModule( prefs, parent, name ) | ||
53 | { | 55 | { |
54 | //abort(); | 56 | //abort(); |
55 | QVBoxLayout *layout = new QVBoxLayout( this ); | 57 | QVBoxLayout *layout = new QVBoxLayout( this ); |
56 | mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" ); | 58 | mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" ); |
57 | layout->addWidget( mConfigWidget ); | 59 | layout->addWidget( mConfigWidget ); |
58 | layout->setSpacing( 0 ); | 60 | layout->setSpacing( 0 ); |
59 | layout->setMargin( 0 ); | 61 | layout->setMargin( 0 ); |
60 | 62 | ||
61 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 63 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
62 | } | 64 | } |
63 | 65 | ||
64 | void KCMKdePimConfig::load(KPrefs* prefs) | 66 | void KCMKdePimConfig::load() |
65 | { | 67 | { |
66 | mConfigWidget->restoreSettings((KPimPrefs*)prefs); | 68 | mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences()); |
67 | } | 69 | } |
68 | 70 | ||
69 | void KCMKdePimConfig::save(KPrefs* prefs) | 71 | void KCMKdePimConfig::save() |
70 | { | 72 | { |
71 | mConfigWidget->saveSettings((KPimPrefs*)prefs); | 73 | mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences()); |
72 | } | 74 | } |
73 | 75 | ||
74 | void KCMKdePimConfig::defaults(KPrefs* prefs) | 76 | void KCMKdePimConfig::defaults() |
75 | { | 77 | { |
76 | mConfigWidget->defaults((KPimPrefs*)prefs); | 78 | mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences()); |
77 | } | 79 | } |
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h index 8cb74f4..fa96eda 100644 --- a/libkdepim/kcmconfigs/kcmkdepimconfig.h +++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h | |||
@@ -13,42 +13,42 @@ | |||
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 | #ifndef KCMKDEPIMCONFIG_H | 31 | #ifndef KCMKDEPIMCONFIG_H |
32 | #define KCMKDEPIMCONFIG_H | 32 | #define KCMKDEPIMCONFIG_H |
33 | 33 | ||
34 | #include <kcmodule.h> | 34 | #include <kcmodule.h> |
35 | 35 | ||
36 | class KDEPIMConfigWidget; | 36 | class KDEPIMConfigWidget; |
37 | class KPrefs; | 37 | class KPimGlobalPrefs; |
38 | 38 | ||
39 | class KCMKdePimConfig : public KCModule | 39 | class KCMKdePimConfig : public KCModule |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 ); | 44 | KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); |
45 | 45 | ||
46 | virtual void load(KPrefs* prefs); | 46 | virtual void load(); |
47 | virtual void save(KPrefs* prefs); | 47 | virtual void save(); |
48 | virtual void defaults(KPrefs* prefs); | 48 | virtual void defaults(); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | KDEPIMConfigWidget *mConfigWidget; | 51 | KDEPIMConfigWidget *mConfigWidget; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | #endif | 54 | #endif |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 477267c..9964eeb 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -50,224 +50,508 @@ $Id$ | |||
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | #include <qfile.h> | 51 | #include <qfile.h> |
52 | 52 | ||
53 | #include <kconfig.h> | 53 | #include <kconfig.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kdialog.h> | 55 | #include <kdialog.h> |
56 | #include <klistview.h> | 56 | #include <klistview.h> |
57 | #include <klocale.h> | 57 | #include <klocale.h> |
58 | #include <kglobal.h> | 58 | #include <kglobal.h> |
59 | #include <kmessagebox.h> | 59 | #include <kmessagebox.h> |
60 | #include <kstandarddirs.h> | 60 | #include <kstandarddirs.h> |
61 | 61 | ||
62 | #ifndef KAB_EMBEDDED | 62 | #ifndef KAB_EMBEDDED |
63 | #include <ktrader.h> | 63 | #include <ktrader.h> |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | #include <mergewidget.h> | 65 | #include <mergewidget.h> |
66 | #include <distributionlistwidget.h> | 66 | #include <distributionlistwidget.h> |
67 | #endif // KAB_EMBEDDED | 67 | #endif // KAB_EMBEDDED |
68 | 68 | ||
69 | #include "addresseewidget.h" | 69 | #include "addresseewidget.h" |
70 | #include "extensionconfigdialog.h" | 70 | #include "extensionconfigdialog.h" |
71 | #include "extensionwidget.h" | 71 | #include "extensionwidget.h" |
72 | */ | 72 | */ |
73 | 73 | ||
74 | #include "kpimprefs.h" | 74 | #include "kpimglobalprefs.h" |
75 | 75 | ||
76 | #include "kdepimconfigwidget.h" | 76 | #include "kdepimconfigwidget.h" |
77 | 77 | ||
78 | 78 | ||
79 | KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | 79 | KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) |
80 | : QWidget( parent, name ) | 80 | : QWidget( parent, name ) |
81 | { | 81 | { |
82 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | ||
83 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | ||
84 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | ||
85 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | ||
86 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | ||
87 | |||
88 | |||
82 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 89 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
83 | KDialog::spacingHint() ); | 90 | KDialog::spacingHint() ); |
84 | 91 | ||
85 | QTabWidget *tabWidget = new QTabWidget( this ); | 92 | QTabWidget *tabWidget = new QTabWidget( this ); |
86 | topLayout->addWidget( tabWidget ); | 93 | topLayout->addWidget( tabWidget ); |
87 | /*US | 94 | |
88 | // General page | 95 | |
89 | QWidget *generalPage = new QWidget( this ); | ||
90 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | ||
91 | KDialog::spacingHintSmall() ); | ||
92 | //general groupbox | ||
93 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); | ||
94 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); | ||
95 | boxLayout->setAlignment( Qt::AlignTop ); | ||
96 | boxLayout->setMargin(KDialog::marginHintSmall() ); | ||
97 | groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; | ||
98 | groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); | ||
99 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | ||
100 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); | ||
101 | boxLayout->addWidget( mViewsSingleClickBox ); | ||
102 | |||
103 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); | ||
104 | boxLayout->addWidget( mNameParsing ); | ||
105 | |||
106 | layout->addWidget( groupBox ); | ||
107 | |||
108 | |||
109 | //extensions groupbox | ||
110 | |||
111 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); | ||
112 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); | ||
113 | boxLayout->setAlignment( Qt::AlignTop ); | ||
114 | boxLayout->setMargin(KDialog::marginHintSmall()); | ||
115 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | ||
116 | groupBox->layout()->setMargin(1) ; | ||
117 | groupBox->layout()->setSpacing(0); | ||
118 | mExtensionView = new KListView( groupBox ); | ||
119 | mExtensionView->setAllColumnsShowFocus( true ); | ||
120 | mExtensionView->addColumn( i18n( "Name" ) ); | ||
121 | mExtensionView->addColumn( i18n( "Description" ) ); | ||
122 | mExtensionView->setMaximumHeight(80); | ||
123 | |||
124 | boxLayout->addWidget( mExtensionView ); | ||
125 | |||
126 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | ||
127 | mConfigureButton->setEnabled( false ); | ||
128 | boxLayout->addWidget( mConfigureButton ); | ||
129 | |||
130 | layout->addWidget( groupBox ); | ||
131 | |||
132 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
133 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
134 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | ||
135 | SLOT( selectionChanged( QListViewItem* ) ) ); | ||
136 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | ||
137 | SLOT( itemClicked( QListViewItem* ) ) ); | ||
138 | connect( mConfigureButton, SIGNAL( clicked() ), | ||
139 | SLOT( configureExtension() ) ); | ||
140 | |||
141 | tabWidget->addTab( generalPage, i18n( "General" ) ); | ||
142 | |||
143 | // Addressee page | ||
144 | mAddresseeWidget = new AddresseeWidget( this ); | ||
145 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | ||
146 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | ||
147 | */ | ||
148 | 96 | ||
149 | // mailclient page | 97 | // mailclient page |
150 | QWidget *mailclientPage = new QWidget( this ); | 98 | QWidget *externalAppsPage = new QWidget( this ); |
151 | QVBoxLayout* layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(), | 99 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
152 | KDialog::spacingHintSmall() ); | 100 | KDialog::spacingHintSmall() ); |
153 | 101 | ||
154 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage ); | 102 | mExternalApps = new QComboBox( externalAppsPage ); |
155 | QVBoxLayout* boxLayout = new QVBoxLayout( groupBox->layout() ); | 103 | |
156 | boxLayout->setAlignment( Qt::AlignTop ); | 104 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
157 | // boxLayout->setMargin(KDialog::marginHintSmall() ); | 105 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
158 | // groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; | 106 | mExternalApps->insertItem( it.data(), it.key() ); |
159 | // groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); | 107 | |
160 | // boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 108 | layout->addWidget( mExternalApps ); |
109 | |||
110 | connect( mExternalApps, SIGNAL( activated( int ) ), | ||
111 | this, SLOT (externalapp_changed( int ) ) ); | ||
112 | |||
113 | |||
114 | |||
115 | |||
116 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | ||
117 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | ||
118 | |||
119 | |||
120 | mClient = new QComboBox( mExternalAppGroupBox ); | ||
121 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | ||
122 | |||
123 | connect( mClient, SIGNAL( activated( int ) ), | ||
124 | this, SLOT (client_changed( int ) ) ); | ||
125 | |||
126 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | ||
127 | boxLayout->addWidget( lab, 1, 0 ); | ||
128 | mChannel = new QLineEdit(mExternalAppGroupBox); | ||
129 | mChannel->setReadOnly(true); | ||
130 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | ||
131 | |||
132 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | ||
133 | boxLayout->addWidget( lab, 3, 0 ); | ||
134 | mMessage = new QLineEdit(mExternalAppGroupBox); | ||
135 | mMessage->setReadOnly(true); | ||
136 | boxLayout->addWidget( mMessage , 4, 0); | ||
137 | |||
138 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | ||
139 | boxLayout->addWidget( lab, 3, 1 ); | ||
140 | mParameters = new QLineEdit(mExternalAppGroupBox); | ||
141 | mParameters->setReadOnly(true); | ||
142 | boxLayout->addWidget( mParameters, 4, 1 ); | ||
143 | |||
144 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | ||
145 | boxLayout->addWidget( lab, 5, 0 ); | ||
146 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | ||
147 | mMessage2->setReadOnly(true); | ||
148 | boxLayout->addWidget( mMessage2 , 6, 0); | ||
149 | |||
150 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | ||
151 | boxLayout->addWidget( lab, 5, 1 ); | ||
152 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | ||
153 | mParameters2->setReadOnly(true); | ||
154 | boxLayout->addWidget( mParameters2, 6, 1 ); | ||
161 | 155 | ||
162 | mEmailClient = new QComboBox( groupBox ); | 156 | lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox); |
163 | mEmailClient->insertItem( i18n("OM/Pi"), KPimPrefs::OMPI ); | 157 | boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 ); |
164 | mEmailClient->insertItem( i18n("Qtopia mail"), KPimPrefs::QTOPIA ); | ||
165 | mEmailClient->insertItem( i18n("Opie mail"), KPimPrefs::OPIE ); | ||
166 | mEmailClient->insertItem( i18n("Other"), KPimPrefs::OTHER ); | ||
167 | boxLayout->addWidget( mEmailClient ); | ||
168 | 158 | ||
169 | connect( mEmailClient, SIGNAL( activated( int ) ), | ||
170 | this, SLOT (emailclient_changed( int ) ) ); | ||
171 | 159 | ||
172 | QLabel* lab = new QLabel( i18n("Channel:"), groupBox); | 160 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
173 | boxLayout->addWidget( lab ); | 161 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
174 | mEmailChannel = new QLineEdit(groupBox); | 162 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
175 | mEmailChannel->setReadOnly(true); | 163 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
176 | boxLayout->addWidget( mEmailChannel ); | 164 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
177 | 165 | ||
178 | layout->addWidget( groupBox ); | ||
179 | tabWidget->addTab( mailclientPage, i18n( "Mail" ) ); | ||
180 | 166 | ||
181 | 167 | ||
168 | layout->addWidget( mExternalAppGroupBox ); | ||
169 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | ||
182 | 170 | ||
183 | } | 171 | } |
184 | 172 | ||
173 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | ||
174 | { | ||
175 | // first store the current data | ||
176 | saveEditFieldSettings(); | ||
177 | |||
178 | // set mCurrentApp | ||
179 | mCurrentApp = (ExternalAppHandler::Types)newApp; | ||
180 | |||
181 | // set mCurrentClient | ||
182 | switch(mCurrentApp) | ||
183 | { | ||
184 | case(ExternalAppHandler::EMAIL): | ||
185 | mCurrentClient = mEmailClient; | ||
186 | break; | ||
187 | case(ExternalAppHandler::PHONE): | ||
188 | mCurrentClient = mPhoneClient; | ||
189 | break; | ||
190 | case(ExternalAppHandler::SMS): | ||
191 | mCurrentClient = mSMSClient; | ||
192 | break; | ||
193 | case(ExternalAppHandler::FAX): | ||
194 | mCurrentClient = mFaxClient; | ||
195 | break; | ||
196 | case(ExternalAppHandler::PAGER): | ||
197 | mCurrentClient = mPagerClient; | ||
198 | break; | ||
199 | default: | ||
200 | return; | ||
201 | } | ||
185 | 202 | ||
203 | // and at last update the widgets | ||
204 | updateClientWidgets(); | ||
205 | } | ||
186 | 206 | ||
187 | void KDEPIMConfigWidget::emailclient_changed( int newClient ) | 207 | |
208 | |||
209 | void KDEPIMConfigWidget::client_changed( int newClient ) | ||
188 | { | 210 | { |
189 | if (newClient == KPimPrefs::OTHER) | 211 | if (newClient == mCurrentClient) |
190 | mEmailChannel->setReadOnly(false); | 212 | return; |
191 | else | ||
192 | mEmailChannel->setReadOnly(true); | ||
193 | 213 | ||
194 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 214 | // first store the current data |
195 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 215 | saveEditFieldSettings(); |
196 | 216 | ||
197 | if (opiepath.isEmpty()) | ||
198 | opiepath = qtopiapath; | ||
199 | 217 | ||
200 | QString text = mEmailChannel->text(); | 218 | //then reset the clientvariable |
219 | mCurrentClient = newClient; | ||
201 | 220 | ||
202 | if (newClient == KPimPrefs::OPIE) | 221 | // and at last update the widgets |
222 | updateClientWidgets(); | ||
223 | |||
224 | modified(); | ||
225 | } | ||
226 | |||
227 | void KDEPIMConfigWidget::saveEditFieldSettings() | ||
228 | { | ||
229 | |||
230 | switch(mCurrentApp) | ||
203 | { | 231 | { |
204 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 232 | case(ExternalAppHandler::EMAIL): |
205 | text = "QPE/Application/opiemail"; | 233 | mEmailClient = mClient->currentItem(); |
206 | else | 234 | break; |
207 | text = "FILENOTFOUND: " + opiepath + "/bin/opiemail"; | 235 | case(ExternalAppHandler::PHONE): |
236 | mPhoneClient= mClient->currentItem(); | ||
237 | break; | ||
238 | case(ExternalAppHandler::SMS): | ||
239 | mSMSClient = mClient->currentItem(); | ||
240 | break; | ||
241 | case(ExternalAppHandler::FAX): | ||
242 | mFaxClient = mClient->currentItem(); | ||
243 | break; | ||
244 | case(ExternalAppHandler::PAGER): | ||
245 | mPagerClient = mClient->currentItem(); | ||
246 | break; | ||
247 | default: | ||
248 | return; | ||
208 | } | 249 | } |
209 | else if (newClient == KPimPrefs::QTOPIA) | ||
210 | { | ||
211 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | ||
212 | text = "QPE/Application/qtmail"; | ||
213 | else | ||
214 | text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail"; | ||
215 | 250 | ||
251 | //store the current data back to the apropriate membervariables if we had set it to "other" | ||
252 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | ||
253 | { | ||
254 | mEmailOtherChannel = mChannel->text(); | ||
255 | mEmailOtherMessage = mMessage->text(); | ||
256 | mEmailOtherMessageParameters = mParameters->text(); | ||
257 | mEmailOtherMessage2 = mMessage2->text(); | ||
258 | mEmailOtherMessageParameters2 = mParameters2->text(); | ||
259 | } | ||
260 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | ||
261 | { | ||
262 | mPhoneOtherChannel = mChannel->text(); | ||
263 | mPhoneOtherMessage = mMessage->text(); | ||
264 | mPhoneOtherMessageParameters = mParameters->text(); | ||
265 | } | ||
266 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | ||
267 | { | ||
268 | mSMSOtherChannel = mChannel->text(); | ||
269 | mSMSOtherMessage = mMessage->text(); | ||
270 | mSMSOtherMessageParameters = mParameters->text(); | ||
271 | } | ||
272 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | ||
273 | { | ||
274 | mFaxOtherChannel = mChannel->text(); | ||
275 | mFaxOtherMessage = mMessage->text(); | ||
276 | mFaxOtherMessageParameters = mParameters->text(); | ||
277 | } | ||
278 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | ||
279 | { | ||
280 | mPagerOtherChannel = mChannel->text(); | ||
281 | mPagerOtherMessage = mMessage->text(); | ||
282 | mPagerOtherMessageParameters = mParameters->text(); | ||
216 | } | 283 | } |
217 | else if (newClient == KPimPrefs::OMPI) | 284 | |
285 | } | ||
286 | |||
287 | void KDEPIMConfigWidget::updateClientWidgets() | ||
288 | { | ||
289 | bool blocked = signalsBlocked(); | ||
290 | blockSignals( true ); | ||
291 | |||
292 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | ||
293 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | ||
294 | if (it == mExternalAppsMap.end()) | ||
295 | return; | ||
296 | |||
297 | // update group box | ||
298 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | ||
299 | |||
300 | //update the entries in the client combobox | ||
301 | mClient->clear(); | ||
302 | |||
303 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | ||
304 | DefaultAppItem* dai; | ||
305 | for ( dai=items.first(); dai != 0; dai=items.next() ) | ||
218 | { | 306 | { |
219 | if ( QFile::exists( qtopiapath + "/bin/ompi" )) | 307 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
220 | text = "QPE/Application/ompi"; | 308 | |
221 | else if ( QFile::exists( opiepath + "/bin/ompi" )) | 309 | if (dai->_id == mCurrentClient) |
222 | text = "QPE/Application/ompi"; | 310 | { |
223 | else | 311 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
224 | text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi"; | 312 | //Otherwise take the default data from externalapphandler. |
313 | mChannel->setText(dai->_channel); | ||
314 | mMessage->setText(dai->_message); | ||
315 | mParameters->setText(dai->_parameters); | ||
316 | mMessage2->setText(dai->_message2); | ||
317 | mParameters2->setText(dai->_parameters2); | ||
318 | |||
319 | |||
320 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | ||
321 | { | ||
322 | mChannel->setText(mEmailOtherChannel); | ||
323 | mMessage->setText(mEmailOtherMessage); | ||
324 | mParameters->setText(mEmailOtherMessageParameters); | ||
325 | mMessage2->setText(mEmailOtherMessage2); | ||
326 | mParameters2->setText(mEmailOtherMessageParameters2); | ||
327 | } | ||
328 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | ||
329 | { | ||
330 | mChannel->setText(mPhoneOtherChannel); | ||
331 | mMessage->setText(mPhoneOtherMessage); | ||
332 | mParameters->setText(mPhoneOtherMessageParameters); | ||
333 | } | ||
334 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | ||
335 | { | ||
336 | mChannel->setText(mSMSOtherChannel); | ||
337 | mMessage->setText(mSMSOtherMessage); | ||
338 | mParameters->setText(mSMSOtherMessageParameters); | ||
339 | } | ||
340 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | ||
341 | { | ||
342 | mChannel->setText(mFaxOtherChannel); | ||
343 | mMessage->setText(mFaxOtherMessage); | ||
344 | mParameters->setText(mFaxOtherMessageParameters); | ||
345 | } | ||
346 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | ||
347 | { | ||
348 | mChannel->setText(mPagerOtherChannel); | ||
349 | mMessage->setText(mPagerOtherMessage); | ||
350 | mParameters->setText(mPagerOtherMessageParameters); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | } | ||
225 | 355 | ||
356 | bool readonly; | ||
357 | bool enabled; | ||
358 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | ||
359 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | ||
360 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | ||
361 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | ||
362 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))) | ||
363 | { | ||
364 | readonly = false; | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | readonly = true; | ||
369 | } | ||
370 | |||
371 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | ||
372 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | ||
373 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | ||
374 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | ||
375 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))) | ||
376 | { | ||
377 | enabled = false; | ||
378 | } | ||
379 | else | ||
380 | { | ||
381 | enabled = true; | ||
382 | } | ||
383 | |||
384 | |||
385 | mChannel->setReadOnly(readonly); | ||
386 | mMessage->setReadOnly(readonly); | ||
387 | mParameters->setReadOnly(readonly); | ||
388 | mMessage2->setReadOnly(readonly); | ||
389 | mParameters2->setReadOnly(readonly); | ||
390 | |||
391 | mChannel->setEnabled(enabled); | ||
392 | mMessage->setEnabled(enabled); | ||
393 | mParameters->setEnabled(enabled); | ||
394 | mMessage2->setEnabled(enabled); | ||
395 | mParameters2->setEnabled(enabled); | ||
396 | |||
397 | |||
398 | |||
399 | mClient->setCurrentItem(mCurrentClient); | ||
400 | |||
401 | |||
402 | // enable/disable the extra message/parameter field | ||
403 | if (mCurrentApp == ExternalAppHandler::EMAIL) | ||
404 | { | ||
226 | } | 405 | } |
227 | else | 406 | else |
228 | { | 407 | { |
229 | //do nothing if we choosed other | 408 | mMessage2->setText( "" ); |
409 | mParameters2->setText( "" ); | ||
230 | } | 410 | } |
231 | 411 | ||
232 | mEmailChannel->setText( text ); | 412 | if (enabled == true) { |
413 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | ||
414 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | ||
415 | } | ||
233 | 416 | ||
234 | 417 | ||
418 | blockSignals( blocked ); | ||
419 | |||
235 | } | 420 | } |
236 | 421 | ||
237 | 422 | ||
238 | void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs) | 423 | |
424 | |||
425 | void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs) | ||
239 | { | 426 | { |
240 | bool blocked = signalsBlocked(); | 427 | bool blocked = signalsBlocked(); |
241 | blockSignals( true ); | 428 | blockSignals( true ); |
242 | 429 | ||
243 | mEmailChannel->setText( prefs->mEmailChannel ); | 430 | mEmailClient = prefs->mEmailClient; |
244 | mEmailClient->setCurrentItem(prefs->mEmailClient); | 431 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
432 | mEmailOtherMessage = prefs->mEmailOtherMessage; | ||
433 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | ||
434 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | ||
435 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | ||
436 | |||
437 | mPhoneClient = prefs->mPhoneClient; | ||
438 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | ||
439 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | ||
440 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | ||
441 | |||
442 | mFaxClient = prefs->mFaxClient; | ||
443 | mFaxOtherChannel = prefs->mFaxOtherChannel; | ||
444 | mFaxOtherMessage = prefs->mFaxOtherMessage; | ||
445 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | ||
446 | |||
447 | mSMSClient = prefs->mSMSClient; | ||
448 | mSMSOtherChannel = prefs->mSMSOtherChannel; | ||
449 | mSMSOtherMessage = prefs->mSMSOtherMessage; | ||
450 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | ||
451 | |||
452 | mPagerClient = prefs->mPagerClient; | ||
453 | mPagerOtherChannel = prefs->mPagerOtherChannel; | ||
454 | mPagerOtherMessage = prefs->mPagerOtherMessage; | ||
455 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | ||
456 | |||
457 | mCurrentApp = ExternalAppHandler::EMAIL; | ||
458 | mCurrentClient = mEmailClient; | ||
459 | |||
460 | updateClientWidgets(); | ||
245 | 461 | ||
246 | blockSignals( blocked ); | 462 | blockSignals( blocked ); |
247 | 463 | ||
248 | emit changed( false ); | 464 | emit changed( false ); |
465 | |||
249 | } | 466 | } |
250 | 467 | ||
251 | void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs) | 468 | void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs) |
252 | { | 469 | { |
253 | prefs->mEmailClient = mEmailClient->currentItem(); | 470 | saveEditFieldSettings(); |
254 | prefs->mEmailChannel = mEmailChannel->text(); | 471 | |
472 | prefs->mEmailClient = mEmailClient; | ||
473 | prefs->mEmailOtherChannel = mEmailOtherChannel; | ||
474 | prefs->mEmailOtherMessage = mEmailOtherMessage; | ||
475 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | ||
476 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | ||
477 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | ||
478 | |||
479 | prefs->mPhoneClient = mPhoneClient; | ||
480 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | ||
481 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | ||
482 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | ||
483 | |||
484 | prefs->mFaxClient = mFaxClient; | ||
485 | prefs->mFaxOtherChannel = mFaxOtherChannel; | ||
486 | prefs->mFaxOtherMessage = mFaxOtherMessage; | ||
487 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | ||
488 | |||
489 | prefs->mSMSClient = mSMSClient; | ||
490 | prefs->mSMSOtherChannel = mSMSOtherChannel; | ||
491 | prefs->mSMSOtherMessage = mSMSOtherMessage; | ||
492 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | ||
493 | |||
494 | prefs->mPagerClient = mPagerClient; | ||
495 | prefs->mPagerOtherChannel = mPagerOtherChannel; | ||
496 | prefs->mPagerOtherMessage = mPagerOtherMessage; | ||
497 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | ||
255 | 498 | ||
256 | prefs->writeConfig(); | 499 | prefs->writeConfig(); |
257 | 500 | ||
258 | emit changed( false ); | 501 | emit changed( false ); |
259 | } | 502 | } |
260 | 503 | ||
261 | void KDEPIMConfigWidget::defaults(KPimPrefs* prefs) | 504 | void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs) |
262 | { | 505 | { |
263 | mEmailClient->setCurrentItem(KPimPrefs::OMPI); | 506 | |
264 | emailclient_changed( KPimPrefs::OMPI ); | 507 | DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC); |
508 | |||
509 | mEmailClient = dai->_id; | ||
510 | mEmailOtherChannel = dai->_channel; | ||
511 | mEmailOtherMessage = dai->_message; | ||
512 | mEmailOtherMessageParameters = dai->_parameters; | ||
513 | mEmailOtherMessage2 = dai->_message2; | ||
514 | mEmailOtherMessageParameters2 = dai->_parameters2; | ||
515 | |||
516 | |||
517 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC); | ||
518 | |||
519 | mPhoneClient = dai->_id; | ||
520 | mPhoneOtherChannel = dai->_channel; | ||
521 | mPhoneOtherMessage = dai->_message; | ||
522 | mPhoneOtherMessageParameters = dai->_parameters; | ||
523 | |||
524 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC); | ||
525 | |||
526 | mFaxClient = dai->_id; | ||
527 | mFaxOtherChannel = dai->_channel; | ||
528 | mFaxOtherMessage = dai->_message; | ||
529 | mFaxOtherMessageParameters = dai->_parameters; | ||
530 | |||
531 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC); | ||
532 | |||
533 | mSMSClient = dai->_id; | ||
534 | mSMSOtherChannel = dai->_channel; | ||
535 | mSMSOtherMessage = dai->_message; | ||
536 | mSMSOtherMessageParameters = dai->_parameters; | ||
537 | |||
538 | dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC); | ||
539 | |||
540 | mPagerClient = dai->_id; | ||
541 | mPagerOtherChannel = dai->_channel; | ||
542 | mPagerOtherMessage = dai->_message; | ||
543 | mPagerOtherMessageParameters = dai->_parameters; | ||
265 | 544 | ||
266 | 545 | ||
267 | emit changed( true ); | 546 | emit changed( true ); |
268 | } | 547 | } |
269 | 548 | ||
270 | void KDEPIMConfigWidget::modified() | 549 | void KDEPIMConfigWidget::modified() |
271 | { | 550 | { |
272 | emit changed( true ); | 551 | emit changed( true ); |
273 | } | 552 | } |
553 | |||
554 | void KDEPIMConfigWidget::textChanged( const QString& text ) | ||
555 | { | ||
556 | emit changed( true ); | ||
557 | } | ||
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h index 109a847..6e02544 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.h +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h | |||
@@ -11,76 +11,130 @@ | |||
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 | /* | 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 | #ifndef KDEPIMCONFIGWIDGET_H | 31 | #ifndef KDEPIMCONFIGWIDGET_H |
32 | #define KDEPIMCONFIGWIDGET_H | 32 | #define KDEPIMCONFIGWIDGET_H |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qmap.h> | ||
36 | |||
37 | #include "externalapphandler.h" | ||
38 | |||
35 | 39 | ||
36 | /* | 40 | /* |
37 | class QCheckBox; | 41 | class QCheckBox; |
38 | class QListViewItem; | 42 | class QListViewItem; |
39 | class QPushButton; | 43 | class QPushButton; |
40 | class KListView; | 44 | class KListView; |
41 | */ | 45 | */ |
42 | class QComboBox; | 46 | class QComboBox; |
43 | class QLineEdit; | 47 | class QLineEdit; |
44 | class KPimPrefs; | 48 | class KPimGlobalPrefs; |
49 | class QGroupBox; | ||
45 | 50 | ||
46 | class KDEPIMConfigWidget : public QWidget | 51 | class KDEPIMConfigWidget : public QWidget |
47 | { | 52 | { |
48 | Q_OBJECT | 53 | Q_OBJECT |
49 | 54 | ||
50 | public: | 55 | public: |
51 | KDEPIMConfigWidget( QWidget *parent, const char *name = 0 ); | 56 | KDEPIMConfigWidget( QWidget *parent, const char *name = 0 ); |
52 | 57 | ||
53 | void restoreSettings(KPimPrefs* prefs); | 58 | void restoreSettings(KPimGlobalPrefs* prefs); |
54 | void saveSettings(KPimPrefs* prefs); | 59 | void saveSettings(KPimGlobalPrefs* prefs); |
55 | void defaults(KPimPrefs* prefs); | 60 | void defaults(KPimGlobalPrefs* prefs); |
56 | 61 | ||
57 | signals: | 62 | signals: |
58 | void changed( bool ); | 63 | void changed( bool ); |
59 | 64 | ||
65 | |||
60 | public slots: | 66 | public slots: |
61 | void modified(); | 67 | void modified(); |
68 | void textChanged( const QString& text ); | ||
62 | 69 | ||
63 | 70 | ||
64 | 71 | ||
65 | private slots: | 72 | private slots: |
66 | // void configureExtension(); | 73 | // void configureExtension(); |
67 | // void selectionChanged( QListViewItem* ); | 74 | // void selectionChanged( QListViewItem* ); |
68 | // void itemClicked( QListViewItem* ); | 75 | // void itemClicked( QListViewItem* ); |
69 | void emailclient_changed( int newClient ); | 76 | void client_changed( int newClient ); |
77 | void externalapp_changed( int newApp ); | ||
70 | 78 | ||
71 | private: | 79 | private: |
80 | void saveEditFieldSettings(); | ||
81 | void updateClientWidgets(); | ||
82 | |||
72 | // void restoreExtensionSettings(); | 83 | // void restoreExtensionSettings(); |
73 | // void saveExtensionSettings(); | 84 | // void saveExtensionSettings(); |
74 | 85 | ||
75 | // KListView *mExtensionView; | 86 | // KListView *mExtensionView; |
76 | 87 | ||
77 | // QCheckBox *mNameParsing; | 88 | // QCheckBox *mNameParsing; |
78 | // QCheckBox *mViewsSingleClickBox; | 89 | // QCheckBox *mViewsSingleClickBox; |
79 | // QPushButton *mConfigureButton; | 90 | // QPushButton *mConfigureButton; |
80 | QComboBox* mEmailClient; | 91 | QComboBox* mExternalApps; |
81 | QLineEdit* mEmailChannel; | 92 | QGroupBox* mExternalAppGroupBox; |
93 | |||
94 | |||
95 | QComboBox* mClient; | ||
96 | QLineEdit* mChannel; | ||
97 | QLineEdit* mMessage; | ||
98 | QLineEdit* mParameters; | ||
99 | QLineEdit* mMessage2; | ||
100 | QLineEdit* mParameters2; | ||
101 | |||
102 | ExternalAppHandler::Types mCurrentApp; | ||
103 | int mCurrentClient; | ||
104 | |||
105 | |||
106 | int mEmailClient; | ||
107 | QString mEmailOtherChannel; | ||
108 | QString mEmailOtherMessage; | ||
109 | QString mEmailOtherMessageParameters; | ||
110 | QString mEmailOtherMessage2; | ||
111 | QString mEmailOtherMessageParameters2; | ||
112 | |||
113 | int mPhoneClient; | ||
114 | QString mPhoneOtherChannel; | ||
115 | QString mPhoneOtherMessage; | ||
116 | QString mPhoneOtherMessageParameters; | ||
117 | |||
118 | int mFaxClient; | ||
119 | QString mFaxOtherChannel; | ||
120 | QString mFaxOtherMessage; | ||
121 | QString mFaxOtherMessageParameters; | ||
122 | |||
123 | int mSMSClient; | ||
124 | QString mSMSOtherChannel; | ||
125 | QString mSMSOtherMessage; | ||
126 | QString mSMSOtherMessageParameters; | ||
127 | |||
128 | int mPagerClient; | ||
129 | QString mPagerOtherChannel; | ||
130 | QString mPagerOtherMessage; | ||
131 | QString mPagerOtherMessageParameters; | ||
132 | |||
133 | |||
134 | |||
135 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; | ||
82 | 136 | ||
83 | // AddresseeWidget *mAddresseeWidget; | 137 | // AddresseeWidget *mAddresseeWidget; |
84 | }; | 138 | }; |
85 | 139 | ||
86 | #endif | 140 | #endif |
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index 15531c7..140a286 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp | |||
@@ -1,61 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@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 | /* | ||
25 | Enhanced Version of the file for platform independent KDE tools. | ||
26 | Copyright (c) 2004 Ulf Schenk | ||
27 | |||
28 | $Id$ | ||
29 | */ | ||
30 | |||
24 | #include <kglobal.h> | 31 | #include <kglobal.h> |
25 | #include <kconfig.h> | 32 | #include <kconfig.h> |
26 | #include <klocale.h> | 33 | #include <klocale.h> |
27 | #include <kdebug.h> | 34 | #include <kdebug.h> |
28 | 35 | ||
29 | #include "kpimprefs.h" | 36 | #include "kpimprefs.h" |
30 | 37 | ||
31 | KPimPrefs::KPimPrefs( const QString &name ) : | 38 | KPimPrefs::KPimPrefs( const QString &name ) : |
32 | KPrefs( name ) | 39 | KPrefs( name ) |
33 | { | 40 | { |
34 | KPrefs::setCurrentGroup( "ExternalApplications" ); | ||
35 | addItemInt( "EmailChannelType", &mEmailClient, OMPI ); | ||
36 | addItemString( "EmailChannelOther", &mEmailChannel, "" ); | ||
37 | |||
38 | } | 41 | } |
39 | 42 | ||
40 | KPimPrefs::~KPimPrefs() | 43 | KPimPrefs::~KPimPrefs() |
41 | { | 44 | { |
42 | } | 45 | } |
43 | 46 | ||
44 | void KPimPrefs::usrSetDefaults() | 47 | void KPimPrefs::usrSetDefaults() |
45 | { | 48 | { |
46 | setCategoryDefaults(); | 49 | setCategoryDefaults(); |
47 | } | 50 | } |
48 | 51 | ||
49 | void KPimPrefs::usrReadConfig() | 52 | void KPimPrefs::usrReadConfig() |
50 | { | 53 | { |
51 | kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl; | 54 | kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl; |
52 | 55 | ||
53 | config()->setGroup("General"); | 56 | config()->setGroup("General"); |
54 | mCustomCategories = config()->readListEntry("Custom Categories"); | 57 | mCustomCategories = config()->readListEntry("Custom Categories"); |
55 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 58 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
56 | } | 59 | } |
57 | 60 | ||
58 | 61 | ||
59 | void KPimPrefs::usrWriteConfig() | 62 | void KPimPrefs::usrWriteConfig() |
60 | { | 63 | { |
61 | config()->setGroup("General"); | 64 | config()->setGroup("General"); |
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index 5186315..9bd9466 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h | |||
@@ -1,67 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@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 | |||
24 | /* | ||
25 | Enhanced Version of the file for platform independent KDE tools. | ||
26 | Copyright (c) 2004 Ulf Schenk | ||
27 | |||
28 | $Id$ | ||
29 | */ | ||
30 | |||
23 | #ifndef KPIMPREFS_H | 31 | #ifndef KPIMPREFS_H |
24 | #define KPIMPREFS_H | 32 | #define KPIMPREFS_H |
25 | 33 | ||
26 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
27 | 35 | ||
28 | #include "kprefs.h" | 36 | #include "kprefs.h" |
29 | 37 | ||
30 | class KPimPrefs : public KPrefs | 38 | class KPimPrefs : public KPrefs |
31 | { | 39 | { |
32 | public: | 40 | public: |
33 | 41 | ||
34 | KPimPrefs( const QString &name = QString::null ); | 42 | KPimPrefs( const QString &name = QString::null ); |
35 | 43 | ||
36 | virtual ~KPimPrefs(); | 44 | virtual ~KPimPrefs(); |
37 | 45 | ||
38 | /** Set preferences to default values */ | 46 | /** Set preferences to default values */ |
39 | void usrSetDefaults(); | 47 | void usrSetDefaults(); |
40 | 48 | ||
41 | /** Read preferences from config file */ | 49 | /** Read preferences from config file */ |
42 | void usrReadConfig(); | 50 | void usrReadConfig(); |
43 | 51 | ||
44 | /** Write preferences to config file */ | 52 | /** Write preferences to config file */ |
45 | void usrWriteConfig(); | 53 | void usrWriteConfig(); |
46 | 54 | ||
47 | enum EMailClients { | ||
48 | OMPI = 0, | ||
49 | QTOPIA = 1, | ||
50 | OPIE = 2, | ||
51 | OTHER = 3 | ||
52 | }; | ||
53 | |||
54 | 55 | ||
55 | public: | 56 | public: |
56 | QStringList mCustomCategories; | 57 | QStringList mCustomCategories; |
57 | 58 | ||
58 | int mEmailClient; | ||
59 | QString mEmailChannel; | ||
60 | |||
61 | |||
62 | 59 | ||
63 | protected: | 60 | protected: |
64 | virtual void setCategoryDefaults() = 0; | 61 | virtual void setCategoryDefaults() = 0; |
65 | }; | 62 | }; |
66 | 63 | ||
67 | #endif | 64 | #endif |
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro index 902f049..e05e681 100644 --- a/libkdepim/libkdepim.pro +++ b/libkdepim/libkdepim.pro | |||
@@ -2,54 +2,58 @@ TEMPLATE = lib | |||
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | DEFINES +=KORG_NOKABC | 3 | DEFINES +=KORG_NOKABC |
4 | TARGET = microkdepim | 4 | TARGET = microkdepim |
5 | INCLUDEPATH += ../microkde ../libkabcwrap ../microkde/kdecore ../microkde/kdeui . .. | 5 | INCLUDEPATH += ../microkde ../libkabcwrap ../microkde/kdecore ../microkde/kdeui . .. |
6 | DESTDIR=../bin | 6 | DESTDIR=../bin |
7 | 7 | ||
8 | DEFINES += DESKTOP_VERSION | 8 | DEFINES += DESKTOP_VERSION |
9 | include( ../variables.pri ) | 9 | include( ../variables.pri ) |
10 | unix : { | 10 | unix : { |
11 | OBJECTS_DIR = obj/unix | 11 | OBJECTS_DIR = obj/unix |
12 | MOC_DIR = moc/unix | 12 | MOC_DIR = moc/unix |
13 | } | 13 | } |
14 | win32: { | 14 | win32: { |
15 | DEFINES += _WIN32_ | 15 | DEFINES += _WIN32_ |
16 | OBJECTS_DIR = obj/win | 16 | OBJECTS_DIR = obj/win |
17 | MOC_DIR = moc/win | 17 | MOC_DIR = moc/win |
18 | } | 18 | } |
19 | INTERFACES = \ | 19 | INTERFACES = \ |
20 | 20 | ||
21 | HEADERS = \ | 21 | HEADERS = \ |
22 | categoryeditdialog.h \ | 22 | categoryeditdialog.h \ |
23 | categoryeditdialog_base.h \ | 23 | categoryeditdialog_base.h \ |
24 | categoryselectdialog.h \ | 24 | categoryselectdialog.h \ |
25 | categoryselectdialog_base.h \ | 25 | categoryselectdialog_base.h \ |
26 | externalapphandler.h \ | ||
26 | kdateedit.h \ | 27 | kdateedit.h \ |
27 | kdatepicker.h \ | 28 | kdatepicker.h \ |
28 | kinputdialog.h \ | 29 | kinputdialog.h \ |
29 | kincidenceformatter.h \ | 30 | kincidenceformatter.h \ |
30 | kpimprefs.h \ | 31 | kpimprefs.h \ |
32 | kpimglobalprefs.h \ | ||
31 | kprefsdialog.h \ | 33 | kprefsdialog.h \ |
32 | addresseeview.h \ | 34 | addresseeview.h \ |
33 | ksyncprofile.h \ | 35 | ksyncprofile.h \ |
34 | ksyncprefsdialog.h \ | 36 | ksyncprefsdialog.h \ |
35 | kcmconfigs/kcmkdepimconfig.h \ | 37 | kcmconfigs/kcmkdepimconfig.h \ |
36 | kcmconfigs/kdepimconfigwidget.h | 38 | kcmconfigs/kdepimconfigwidget.h |
37 | 39 | ||
38 | SOURCES = \ | 40 | SOURCES = \ |
39 | categoryeditdialog.cpp \ | 41 | categoryeditdialog.cpp \ |
40 | categoryeditdialog_base.cpp \ | 42 | categoryeditdialog_base.cpp \ |
41 | categoryselectdialog.cpp \ | 43 | categoryselectdialog.cpp \ |
42 | categoryselectdialog_base.cpp \ | 44 | categoryselectdialog_base.cpp \ |
45 | externalapphandler.cpp \ | ||
43 | kdateedit.cpp \ | 46 | kdateedit.cpp \ |
44 | kdatepicker.cpp \ | 47 | kdatepicker.cpp \ |
45 | kinputdialog.cpp \ | 48 | kinputdialog.cpp \ |
46 | kincidenceformatter.cpp \ | 49 | kincidenceformatter.cpp \ |
47 | kpimprefs.cpp \ | 50 | kpimprefs.cpp \ |
51 | kpimglobalprefs.cpp \ | ||
48 | kprefsdialog.cpp \ | 52 | kprefsdialog.cpp \ |
49 | addresseeview.cpp \ | 53 | addresseeview.cpp \ |
50 | ksyncprofile.cpp \ | 54 | ksyncprofile.cpp \ |
51 | ksyncprefsdialog.cpp \ | 55 | ksyncprefsdialog.cpp \ |
52 | kcmconfigs/kcmkdepimconfig.cpp \ | 56 | kcmconfigs/kcmkdepimconfig.cpp \ |
53 | kcmconfigs/kdepimconfigwidget.cpp | 57 | kcmconfigs/kdepimconfigwidget.cpp |
54 | 58 | ||
55 | 59 | ||
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro index fc8abe1..b322bce 100644 --- a/libkdepim/libkdepimE.pro +++ b/libkdepim/libkdepimE.pro | |||
@@ -1,49 +1,53 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkdepim | 3 | TARGET = microkdepim |
4 | INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore ../microkde/kdeui $(QPEDIR)/include | 4 | INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore ../microkde/kdeui $(QPEDIR)/include |
5 | INCLUDEPATH += . .. | 5 | INCLUDEPATH += . .. |
6 | LIBS += -lmicrokde | 6 | LIBS += -lmicrokde |
7 | LIBS += -L$(QPEDIR)/lib | 7 | LIBS += -L$(QPEDIR)/lib |
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR=$(QPEDIR)/lib | 10 | DESTDIR=$(QPEDIR)/lib |
11 | 11 | ||
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | categoryeditdialog.h \ | 16 | categoryeditdialog.h \ |
17 | categoryeditdialog_base.h \ | 17 | categoryeditdialog_base.h \ |
18 | categoryselectdialog.h \ | 18 | categoryselectdialog.h \ |
19 | categoryselectdialog_base.h \ | 19 | categoryselectdialog_base.h \ |
20 | externalapphandler.h \ | ||
20 | kdateedit.h \ | 21 | kdateedit.h \ |
21 | kdatepicker.h \ | 22 | kdatepicker.h \ |
22 | kinputdialog.h \ | 23 | kinputdialog.h \ |
23 | kincidenceformatter.h \ | 24 | kincidenceformatter.h \ |
24 | kpimprefs.h \ | 25 | kpimprefs.h \ |
26 | kpimglobalprefs.h \ | ||
25 | kprefsdialog.h \ | 27 | kprefsdialog.h \ |
26 | addresseeview.h \ | 28 | addresseeview.h \ |
27 | ksyncprofile.h \ | 29 | ksyncprofile.h \ |
28 | ksyncprefsdialog.h \ | 30 | ksyncprefsdialog.h \ |
29 | kcmconfigs/kcmkdepimconfig.h \ | 31 | kcmconfigs/kcmkdepimconfig.h \ |
30 | kcmconfigs/kdepimconfigwidget.h | 32 | kcmconfigs/kdepimconfigwidget.h |
31 | 33 | ||
32 | 34 | ||
33 | 35 | ||
34 | SOURCES = \ | 36 | SOURCES = \ |
35 | categoryeditdialog.cpp \ | 37 | categoryeditdialog.cpp \ |
36 | categoryeditdialog_base.cpp \ | 38 | categoryeditdialog_base.cpp \ |
37 | categoryselectdialog.cpp \ | 39 | categoryselectdialog.cpp \ |
38 | categoryselectdialog_base.cpp \ | 40 | categoryselectdialog_base.cpp \ |
41 | externalapphandler.cpp \ | ||
39 | kdateedit.cpp \ | 42 | kdateedit.cpp \ |
40 | kinputdialog.cpp \ | 43 | kinputdialog.cpp \ |
41 | kdatepicker.cpp \ | 44 | kdatepicker.cpp \ |
42 | kincidenceformatter.cpp \ | 45 | kincidenceformatter.cpp \ |
43 | kpimprefs.cpp \ | 46 | kpimprefs.cpp \ |
47 | kpimglobalprefs.cpp \ | ||
44 | kprefsdialog.cpp \ | 48 | kprefsdialog.cpp \ |
45 | addresseeview.cpp \ | 49 | addresseeview.cpp \ |
46 | ksyncprofile.cpp \ | 50 | ksyncprofile.cpp \ |
47 | ksyncprefsdialog.cpp \ | 51 | ksyncprefsdialog.cpp \ |
48 | kcmconfigs/kcmkdepimconfig.cpp \ | 52 | kcmconfigs/kcmkdepimconfig.cpp \ |
49 | kcmconfigs/kdepimconfigwidget.cpp | 53 | kcmconfigs/kdepimconfigwidget.cpp |
diff --git a/microkde/kdeui/kcmodule.cpp b/microkde/kdeui/kcmodule.cpp index 915cd0f..f646db3 100644 --- a/microkde/kdeui/kcmodule.cpp +++ b/microkde/kdeui/kcmodule.cpp | |||
@@ -12,95 +12,103 @@ | |||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "kcmodule.h" | 23 | #include "kcmodule.h" |
24 | //US#include <kinstance.h> | 24 | //US#include <kinstance.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | #include <klocale.h> | 26 | #include <klocale.h> |
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | 28 | ||
29 | class KCModulePrivate | 29 | class KCModulePrivate |
30 | { | 30 | { |
31 | public: | 31 | public: |
32 | //US KInstance *_instance; | 32 | //US KInstance *_instance; |
33 | QString _rootOnlyMsg; | 33 | QString _rootOnlyMsg; |
34 | bool _useRootOnlyMsg; | 34 | bool _useRootOnlyMsg; |
35 | bool _hasOwnInstance; | 35 | bool _hasOwnInstance; |
36 | KPrefs* _prefs; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | KCModule::KCModule(QWidget *parent, const char *name, const QStringList &) | 39 | KCModule::KCModule(KPrefs* prefs, QWidget *parent, const char *name, const QStringList &) |
39 | : QWidget(parent, name), _btn(Help|Default|Apply) | 40 | : QWidget(parent, name), _btn(Help|Default|Apply) |
40 | { | 41 | { |
41 | kdDebug() << "KCModule " << name << endl; | 42 | kdDebug() << "KCModule " << name << endl; |
42 | d = new KCModulePrivate; | 43 | d = new KCModulePrivate; |
43 | d->_useRootOnlyMsg = true; | 44 | d->_useRootOnlyMsg = true; |
44 | /*US | 45 | d->_prefs = prefs; |
46 | /*US | ||
45 | d->_instance = new KInstance(name); | 47 | d->_instance = new KInstance(name); |
46 | if (name && strlen(name)) { | 48 | if (name && strlen(name)) { |
47 | d->_instance = new KInstance(name); | 49 | d->_instance = new KInstance(name); |
48 | KGlobal::locale()->insertCatalogue(name); | 50 | KGlobal::locale()->insertCatalogue(name); |
49 | } else | 51 | } else |
50 | d->_instance = new KInstance("kcmunnamed"); | 52 | d->_instance = new KInstance("kcmunnamed"); |
51 | */ | 53 | */ |
52 | d->_hasOwnInstance = true; | 54 | d->_hasOwnInstance = true; |
53 | //US KGlobal::setActiveInstance(this->instance()); | 55 | //US KGlobal::setActiveInstance(this->instance()); |
54 | } | 56 | } |
55 | 57 | ||
56 | /*US | 58 | /*US |
57 | KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) | 59 | KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & ) |
58 | : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply) | 60 | : QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply) |
59 | { | 61 | { |
60 | kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl; | 62 | kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl; |
61 | d = new KCModulePrivate; | 63 | d = new KCModulePrivate; |
62 | d->_useRootOnlyMsg = true; | 64 | d->_useRootOnlyMsg = true; |
63 | d->_instance = instance; | 65 | d->_instance = instance; |
64 | KGlobal::locale()->insertCatalogue(instance->instanceName()); | 66 | KGlobal::locale()->insertCatalogue(instance->instanceName()); |
65 | d->_hasOwnInstance = false; | 67 | d->_hasOwnInstance = false; |
66 | KGlobal::setActiveInstance(this->instance()); | 68 | KGlobal::setActiveInstance(this->instance()); |
67 | } | 69 | } |
68 | */ | 70 | */ |
69 | KCModule::~KCModule() | 71 | KCModule::~KCModule() |
70 | { | 72 | { |
71 | /*US | 73 | /*US |
72 | if (d->_hasOwnInstance) | 74 | if (d->_hasOwnInstance) |
73 | delete d->_instance; | 75 | delete d->_instance; |
74 | */ | 76 | */ |
75 | delete d; | 77 | delete d; |
76 | } | 78 | } |
77 | 79 | ||
78 | void KCModule::setRootOnlyMsg(const QString& msg) | 80 | void KCModule::setRootOnlyMsg(const QString& msg) |
79 | { | 81 | { |
80 | d->_rootOnlyMsg = msg; | 82 | d->_rootOnlyMsg = msg; |
81 | } | 83 | } |
82 | 84 | ||
83 | QString KCModule::rootOnlyMsg() const | 85 | QString KCModule::rootOnlyMsg() const |
84 | { | 86 | { |
85 | return d->_rootOnlyMsg; | 87 | return d->_rootOnlyMsg; |
86 | } | 88 | } |
87 | 89 | ||
88 | void KCModule::setUseRootOnlyMsg(bool on) | 90 | void KCModule::setUseRootOnlyMsg(bool on) |
89 | { | 91 | { |
90 | d->_useRootOnlyMsg = on; | 92 | d->_useRootOnlyMsg = on; |
91 | } | 93 | } |
92 | 94 | ||
93 | bool KCModule::useRootOnlyMsg() const | 95 | bool KCModule::useRootOnlyMsg() const |
94 | { | 96 | { |
95 | return d->_useRootOnlyMsg; | 97 | return d->_useRootOnlyMsg; |
96 | } | 98 | } |
99 | |||
100 | KPrefs* KCModule::getPreferences() | ||
101 | { | ||
102 | return d->_prefs; | ||
103 | } | ||
104 | |||
97 | /*US | 105 | /*US |
98 | KInstance *KCModule::instance() const | 106 | KInstance *KCModule::instance() const |
99 | { | 107 | { |
100 | return d->_instance; | 108 | return d->_instance; |
101 | } | 109 | } |
102 | */ | 110 | */ |
103 | void KCModule::virtual_hook( int, void* ) | 111 | void KCModule::virtual_hook( int, void* ) |
104 | { /*BASE::virtual_hook( id, data );*/ } | 112 | { /*BASE::virtual_hook( id, data );*/ } |
105 | 113 | ||
106 | //US #include "kcmodule.moc" | 114 | //US #include "kcmodule.moc" |
diff --git a/microkde/kdeui/kcmodule.h b/microkde/kdeui/kcmodule.h index bc020bc..874958c 100644 --- a/microkde/kdeui/kcmodule.h +++ b/microkde/kdeui/kcmodule.h | |||
@@ -62,103 +62,103 @@ class KPrefs; | |||
62 | 62 | ||
63 | class KCModule : public QWidget | 63 | class KCModule : public QWidget |
64 | { | 64 | { |
65 | Q_OBJECT | 65 | Q_OBJECT |
66 | 66 | ||
67 | public: | 67 | public: |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * An enumeration type for the buttons used by this module. | 70 | * An enumeration type for the buttons used by this module. |
71 | * You should only use Help, Default and Apply. The rest is obsolete. | 71 | * You should only use Help, Default and Apply. The rest is obsolete. |
72 | * | 72 | * |
73 | * @see KCModule::buttons @see KCModule::setButtons | 73 | * @see KCModule::buttons @see KCModule::setButtons |
74 | */ | 74 | */ |
75 | enum Button {Help=1, Default=2, Apply=16, | 75 | enum Button {Help=1, Default=2, Apply=16, |
76 | Reset=4, /* obsolete, do not use! */ | 76 | Reset=4, /* obsolete, do not use! */ |
77 | Cancel=8, /* obsolete, do not use! */ | 77 | Cancel=8, /* obsolete, do not use! */ |
78 | Ok=32, /* obsolete, do not use! */ | 78 | Ok=32, /* obsolete, do not use! */ |
79 | SysDefault=64 /* obsolete, do not use! */ }; | 79 | SysDefault=64 /* obsolete, do not use! */ }; |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Base class for all KControlModules. | 82 | * Base class for all KControlModules. |
83 | * Make sure you have a QStringList argument in your | 83 | * Make sure you have a QStringList argument in your |
84 | * implementation. | 84 | * implementation. |
85 | */ | 85 | */ |
86 | KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); | 86 | KCModule(KPrefs* prefs, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() ); |
87 | 87 | ||
88 | //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); | 88 | //US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() ); |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * Destroys the module. | 91 | * Destroys the module. |
92 | */ | 92 | */ |
93 | ~KCModule(); | 93 | ~KCModule(); |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Load the configuration data into the module. | 96 | * Load the configuration data into the module. |
97 | * | 97 | * |
98 | * The load method sets the user interface elements of the | 98 | * The load method sets the user interface elements of the |
99 | * module to reflect the current settings stored in the | 99 | * module to reflect the current settings stored in the |
100 | * configuration files. | 100 | * configuration files. |
101 | * | 101 | * |
102 | * This method is invoked whenever the module should read its configuration | 102 | * This method is invoked whenever the module should read its configuration |
103 | * (most of the times from a config file) and update the user interface. | 103 | * (most of the times from a config file) and update the user interface. |
104 | * This happens when the user clicks the "Reset" button in the control | 104 | * This happens when the user clicks the "Reset" button in the control |
105 | * center, to undo all of his changes and restore the currently valid | 105 | * center, to undo all of his changes and restore the currently valid |
106 | * settings. NOTE that this is not called after the modules is loaded, | 106 | * settings. NOTE that this is not called after the modules is loaded, |
107 | * so you probably want to call this method in the constructor. | 107 | * so you probably want to call this method in the constructor. |
108 | */ | 108 | */ |
109 | virtual void load(KPrefs* prefs) {}; | 109 | virtual void load() {}; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Save the configuration data. | 112 | * Save the configuration data. |
113 | * | 113 | * |
114 | * The save method stores the config information as shown | 114 | * The save method stores the config information as shown |
115 | * in the user interface in the config files. | 115 | * in the user interface in the config files. |
116 | * | 116 | * |
117 | * If necessary, this method also updates the running system, | 117 | * If necessary, this method also updates the running system, |
118 | * e.g. by restarting applications. | 118 | * e.g. by restarting applications. |
119 | * | 119 | * |
120 | * save is called when the user clicks "Apply" or "Ok". | 120 | * save is called when the user clicks "Apply" or "Ok". |
121 | */ | 121 | */ |
122 | virtual void save(KPrefs* prefs) {}; | 122 | virtual void save() {}; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Sets the configuration to sensible default values. | 125 | * Sets the configuration to sensible default values. |
126 | * | 126 | * |
127 | * This method is called when the user clicks the "Default" | 127 | * This method is called when the user clicks the "Default" |
128 | * button. It should set the display to useful values. | 128 | * button. It should set the display to useful values. |
129 | */ | 129 | */ |
130 | virtual void defaults(KPrefs* prefs) {}; | 130 | virtual void defaults() {}; |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Set the configuration to system default values. | 133 | * Set the configuration to system default values. |
134 | * | 134 | * |
135 | * This method is called when the user clicks the "System-Default" | 135 | * This method is called when the user clicks the "System-Default" |
136 | * button. It should set the display to the system default values. | 136 | * button. It should set the display to the system default values. |
137 | * | 137 | * |
138 | * NOTE: The default behaviour is to call defaults(). | 138 | * NOTE: The default behaviour is to call defaults(). |
139 | */ | 139 | */ |
140 | virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); }; | 140 | virtual void sysdefaults() { defaults(); }; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Return a quick-help text. | 143 | * Return a quick-help text. |
144 | * | 144 | * |
145 | * This method is called when the module is docked. | 145 | * This method is called when the module is docked. |
146 | * The quick-help text should contain a short description of the module and | 146 | * The quick-help text should contain a short description of the module and |
147 | * links to the module's help files. You can use QML formating tags in the text. | 147 | * links to the module's help files. You can use QML formating tags in the text. |
148 | * | 148 | * |
149 | * NOTE: Please make sure the quick help text gets translated (use i18n()). | 149 | * NOTE: Please make sure the quick help text gets translated (use i18n()). |
150 | */ | 150 | */ |
151 | virtual QString quickHelp() const { return QString::null; }; | 151 | virtual QString quickHelp() const { return QString::null; }; |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Returns a the KAboutData for this module | 154 | * Returns a the KAboutData for this module |
155 | * This is generally only called for the KBugReport. | 155 | * This is generally only called for the KBugReport. |
156 | * Override and have it return a pointer to a constant | 156 | * Override and have it return a pointer to a constant |
157 | */ | 157 | */ |
158 | //US virtual const KAboutData *aboutData() const { return 0; } | 158 | //US virtual const KAboutData *aboutData() const { return 0; } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Indicate which buttons will be used. | 161 | * Indicate which buttons will be used. |
162 | * | 162 | * |
163 | * The return value is a value or'ed together from | 163 | * The return value is a value or'ed together from |
164 | * the Button enumeration type. | 164 | * the Button enumeration type. |
@@ -172,48 +172,49 @@ public: | |||
172 | * | 172 | * |
173 | * When the module must be run as root, or acts differently | 173 | * When the module must be run as root, or acts differently |
174 | * for root and a normal user, it is sometimes useful to | 174 | * for root and a normal user, it is sometimes useful to |
175 | * customize the message that appears at the top of the module | 175 | * customize the message that appears at the top of the module |
176 | * when used as a normal user. This function returns this | 176 | * when used as a normal user. This function returns this |
177 | * customized message. If none has been set, a default message | 177 | * customized message. If none has been set, a default message |
178 | * will be used. | 178 | * will be used. |
179 | * | 179 | * |
180 | * @see KCModule::setRootOnlyMsg | 180 | * @see KCModule::setRootOnlyMsg |
181 | */ | 181 | */ |
182 | QString rootOnlyMsg() const; | 182 | QString rootOnlyMsg() const; |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Tell if KControl should show a RootOnly message when run as | 185 | * Tell if KControl should show a RootOnly message when run as |
186 | * a normal user. | 186 | * a normal user. |
187 | * | 187 | * |
188 | * In some cases, the module don't want a RootOnly message to | 188 | * In some cases, the module don't want a RootOnly message to |
189 | * appear (for example if it has already one). This function | 189 | * appear (for example if it has already one). This function |
190 | * tells KControl if a RootOnly message should be shown | 190 | * tells KControl if a RootOnly message should be shown |
191 | * | 191 | * |
192 | * @see KCModule::setUseRootOnlyMsg | 192 | * @see KCModule::setUseRootOnlyMsg |
193 | */ | 193 | */ |
194 | bool useRootOnlyMsg() const; | 194 | bool useRootOnlyMsg() const; |
195 | 195 | ||
196 | KPrefs* getPreferences(); | ||
196 | 197 | ||
197 | //US KInstance *instance() const; | 198 | //US KInstance *instance() const; |
198 | 199 | ||
199 | signals: | 200 | signals: |
200 | 201 | ||
201 | /** | 202 | /** |
202 | * Indicate that the state of the modules contents has changed. | 203 | * Indicate that the state of the modules contents has changed. |
203 | * | 204 | * |
204 | * This signal is emitted whenever the state of the configuration | 205 | * This signal is emitted whenever the state of the configuration |
205 | * shown in the module changes. It allows the control center to | 206 | * shown in the module changes. It allows the control center to |
206 | * keep track of unsaved changes. | 207 | * keep track of unsaved changes. |
207 | * | 208 | * |
208 | */ | 209 | */ |
209 | void changed(bool state); | 210 | void changed(bool state); |
210 | 211 | ||
211 | /** | 212 | /** |
212 | * Indicate that the module's quickhelp has changed. | 213 | * Indicate that the module's quickhelp has changed. |
213 | * | 214 | * |
214 | * Emit this signal whenever the module's quickhelp changes. | 215 | * Emit this signal whenever the module's quickhelp changes. |
215 | * Modules implemented as tabbed dialogs might want to implement | 216 | * Modules implemented as tabbed dialogs might want to implement |
216 | * per-tab quickhelp for example. | 217 | * per-tab quickhelp for example. |
217 | * | 218 | * |
218 | */ | 219 | */ |
219 | void quickHelpChanged(); | 220 | void quickHelpChanged(); |
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp index c2378fb..6c82e4f 100644 --- a/microkde/kutils/kcmultidialog.cpp +++ b/microkde/kutils/kcmultidialog.cpp | |||
@@ -13,118 +13,117 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
32 | //US #include <klibloader.h> | 32 | //US #include <klibloader.h> |
33 | #include <krun.h> | 33 | #include <krun.h> |
34 | #include <kprocess.h> | 34 | #include <kprocess.h> |
35 | 35 | ||
36 | #include "kcmultidialog.h" | 36 | #include "kcmultidialog.h" |
37 | #include "kprefs.h" | ||
38 | //US #include "kcmultidialog.moc" | 37 | //US #include "kcmultidialog.moc" |
39 | //US #include "kcmoduleloader.h" | 38 | //US #include "kcmoduleloader.h" |
40 | 39 | ||
41 | KCMultiDialog::KCMultiDialog(KPrefs* prefs, const QString& baseGroup, QWidget *parent, const char *name, bool modal) | 40 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) |
42 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, | 41 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, |
43 | parent, name, modal, true), mPrefs(prefs), d(0L) | 42 | parent, name, modal, true), d(0L) |
44 | { | 43 | { |
45 | enableButton(Apply, false); | 44 | enableButton(Apply, false); |
46 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); | 45 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); |
47 | 46 | ||
48 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); | 47 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); |
49 | 48 | ||
50 | _baseGroup = baseGroup; | 49 | _baseGroup = baseGroup; |
51 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); | 50 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); |
52 | setMainWidget(mMainWidget ); | 51 | setMainWidget(mMainWidget ); |
53 | #ifdef DESKTOP_VERSION | 52 | #ifdef DESKTOP_VERSION |
54 | resize(640,480); | 53 | resize(640,480); |
55 | #else | 54 | #else |
56 | resize(640,480); | 55 | resize(640,480); |
57 | setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); | 56 | setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); |
58 | //showMaximized(); | 57 | //showMaximized(); |
59 | #endif | 58 | #endif |
60 | 59 | ||
61 | } | 60 | } |
62 | 61 | ||
63 | KCMultiDialog::~KCMultiDialog() | 62 | KCMultiDialog::~KCMultiDialog() |
64 | { | 63 | { |
65 | //US moduleDict.setAutoDelete(true); | 64 | //US moduleDict.setAutoDelete(true); |
66 | } | 65 | } |
67 | 66 | ||
68 | void KCMultiDialog::slotDefault() | 67 | void KCMultiDialog::slotDefault() |
69 | { | 68 | { |
70 | 69 | ||
71 | int curPageIndex = mMainWidget->activePageIndex(); | 70 | int curPageIndex = mMainWidget->activePageIndex(); |
72 | 71 | ||
73 | QPtrListIterator<KCModule> it(modules); | 72 | QPtrListIterator<KCModule> it(modules); |
74 | for (; it.current(); ++it) | 73 | for (; it.current(); ++it) |
75 | { | 74 | { |
76 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) | 75 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) |
77 | { | 76 | { |
78 | (*it)->defaults(mPrefs); | 77 | (*it)->defaults(); |
79 | clientChanged(true); | 78 | clientChanged(true); |
80 | return; | 79 | return; |
81 | } | 80 | } |
82 | } | 81 | } |
83 | 82 | ||
84 | } | 83 | } |
85 | 84 | ||
86 | void KCMultiDialog::slotApply() | 85 | void KCMultiDialog::slotApply() |
87 | { | 86 | { |
88 | qDebug("KCMultiDialog::slotApply clicked"); | 87 | qDebug("KCMultiDialog::slotApply clicked"); |
89 | 88 | ||
90 | QPtrListIterator<KCModule> it(modules); | 89 | QPtrListIterator<KCModule> it(modules); |
91 | for (; it.current(); ++it) | 90 | for (; it.current(); ++it) |
92 | (*it)->save(mPrefs); | 91 | (*it)->save(); |
93 | clientChanged(false); | 92 | clientChanged(false); |
94 | 93 | ||
95 | emit applyClicked(); | 94 | emit applyClicked(); |
96 | 95 | ||
97 | } | 96 | } |
98 | 97 | ||
99 | 98 | ||
100 | void KCMultiDialog::slotOk() | 99 | void KCMultiDialog::slotOk() |
101 | { | 100 | { |
102 | qDebug("KCMultiDialog::slotOk clicked"); | 101 | qDebug("KCMultiDialog::slotOk clicked"); |
103 | 102 | ||
104 | QPtrListIterator<KCModule> it(modules); | 103 | QPtrListIterator<KCModule> it(modules); |
105 | for (; it.current(); ++it) | 104 | for (; it.current(); ++it) |
106 | (*it)->save(mPrefs); | 105 | (*it)->save(); |
107 | accept(); | 106 | accept(); |
108 | 107 | ||
109 | emit okClicked(); | 108 | emit okClicked(); |
110 | } | 109 | } |
111 | 110 | ||
112 | void KCMultiDialog::slotHelp() | 111 | void KCMultiDialog::slotHelp() |
113 | { | 112 | { |
114 | /*US | 113 | /*US |
115 | KURL url( KURL("help:/"), _docPath ); | 114 | KURL url( KURL("help:/"), _docPath ); |
116 | 115 | ||
117 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { | 116 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { |
118 | KProcess process; | 117 | KProcess process; |
119 | process << "khelpcenter" | 118 | process << "khelpcenter" |
120 | << url.url(); | 119 | << url.url(); |
121 | process.start(KProcess::DontCare); | 120 | process.start(KProcess::DontCare); |
122 | process.detach(); | 121 | process.detach(); |
123 | } else { | 122 | } else { |
124 | new KRun(url); | 123 | new KRun(url); |
125 | } | 124 | } |
126 | */ | 125 | */ |
127 | } | 126 | } |
128 | 127 | ||
129 | void KCMultiDialog::clientChanged(bool state) | 128 | void KCMultiDialog::clientChanged(bool state) |
130 | { | 129 | { |
@@ -141,49 +140,49 @@ void KCMultiDialog::addModule(const QString& path, bool withfallback) | |||
141 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), | 140 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), |
142 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); | 141 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); |
143 | if(!page) { | 142 | if(!page) { |
144 | KCModuleLoader::unloadModule(info); | 143 | KCModuleLoader::unloadModule(info); |
145 | return; | 144 | return; |
146 | } | 145 | } |
147 | moduleDict.insert(page, new LoadInfo(path, withfallback)); | 146 | moduleDict.insert(page, new LoadInfo(path, withfallback)); |
148 | if (modules.isEmpty()) | 147 | if (modules.isEmpty()) |
149 | slotAboutToShow(page); | 148 | slotAboutToShow(page); |
150 | } | 149 | } |
151 | */ | 150 | */ |
152 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) | 151 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) |
153 | { | 152 | { |
154 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); | 153 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); |
155 | return page; | 154 | return page; |
156 | 155 | ||
157 | } | 156 | } |
158 | //US special method for microkde. We dop noty want to load everything dynamically. | 157 | //US special method for microkde. We dop noty want to load everything dynamically. |
159 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) | 158 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) |
160 | { | 159 | { |
161 | 160 | ||
162 | modules.append(module); | 161 | modules.append(module); |
163 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 162 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
164 | //US | 163 | //US |
165 | module->load(mPrefs); | 164 | module->load(); |
166 | 165 | ||
167 | 166 | ||
168 | } | 167 | } |
169 | 168 | ||
170 | void KCMultiDialog::slotAboutToShow(QWidget *page) | 169 | void KCMultiDialog::slotAboutToShow(QWidget *page) |
171 | { | 170 | { |
172 | /*US | 171 | /*US |
173 | LoadInfo *loadInfo = moduleDict[page]; | 172 | LoadInfo *loadInfo = moduleDict[page]; |
174 | if (!loadInfo) | 173 | if (!loadInfo) |
175 | return; | 174 | return; |
176 | 175 | ||
177 | QApplication::setOverrideCursor(Qt::WaitCursor); | 176 | QApplication::setOverrideCursor(Qt::WaitCursor); |
178 | 177 | ||
179 | moduleDict.remove(page); | 178 | moduleDict.remove(page); |
180 | 179 | ||
181 | KCModuleInfo info(loadInfo->path, _baseGroup); | 180 | KCModuleInfo info(loadInfo->path, _baseGroup); |
182 | 181 | ||
183 | KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); | 182 | KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); |
184 | 183 | ||
185 | if (!module) | 184 | if (!module) |
186 | { | 185 | { |
187 | QApplication::restoreOverrideCursor(); | 186 | QApplication::restoreOverrideCursor(); |
188 | KCModuleLoader::showLastLoaderError(this); | 187 | KCModuleLoader::showLastLoaderError(this); |
189 | delete loadInfo; | 188 | delete loadInfo; |
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h index a42555f..1aa66b2 100644 --- a/microkde/kutils/kcmultidialog.h +++ b/microkde/kutils/kcmultidialog.h | |||
@@ -8,74 +8,72 @@ | |||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef KCMULTIDIALOG_H | 22 | #ifndef KCMULTIDIALOG_H |
23 | #define KCMULTIDIALOG_H | 23 | #define KCMULTIDIALOG_H |
24 | 24 | ||
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | #include <qptrdict.h> | 26 | #include <qptrdict.h> |
27 | 27 | ||
28 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
29 | #include <kjanuswidget.h> | 29 | #include <kjanuswidget.h> |
30 | #include <kcmodule.h> | 30 | #include <kcmodule.h> |
31 | 31 | ||
32 | class KPrefs; | ||
33 | |||
34 | /** | 32 | /** |
35 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules | 33 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules |
36 | * | 34 | * |
37 | * @short A method that offers a @ref KDialogBase containing arbitrary | 35 | * @short A method that offers a @ref KDialogBase containing arbitrary |
38 | * KControl Modules. | 36 | * KControl Modules. |
39 | * | 37 | * |
40 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> | 38 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> |
41 | * @since 3.2 | 39 | * @since 3.2 |
42 | */ | 40 | */ |
43 | class KCMultiDialog : public KDialogBase | 41 | class KCMultiDialog : public KDialogBase |
44 | { | 42 | { |
45 | Q_OBJECT | 43 | Q_OBJECT |
46 | 44 | ||
47 | public: | 45 | public: |
48 | /** | 46 | /** |
49 | * Constructs a new KCMultiDialog | 47 | * Constructs a new KCMultiDialog |
50 | * | 48 | * |
51 | * @param parent The parent Widget | 49 | * @param parent The parent Widget |
52 | * @param name The widget name | 50 | * @param name The widget name |
53 | * @param baseGroup The baseGroup, if you want to call a module out of | 51 | * @param baseGroup The baseGroup, if you want to call a module out of |
54 | * kcontrol, just keep "settings" | 52 | * kcontrol, just keep "settings" |
55 | * @param modal If you pass true here, the dialog will be modal | 53 | * @param modal If you pass true here, the dialog will be modal |
56 | **/ | 54 | **/ |
57 | KCMultiDialog(KPrefs* prefs, const QString& baseGroup = QString::fromLatin1("settings"), | 55 | KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"), |
58 | QWidget *parent=0, const char *name=0, | 56 | QWidget *parent=0, const char *name=0, |
59 | bool modal=false); | 57 | bool modal=false); |
60 | 58 | ||
61 | /** | 59 | /** |
62 | * Destructor | 60 | * Destructor |
63 | **/ | 61 | **/ |
64 | virtual ~KCMultiDialog(); | 62 | virtual ~KCMultiDialog(); |
65 | 63 | ||
66 | /** | 64 | /** |
67 | * Add a module. | 65 | * Add a module. |
68 | * | 66 | * |
69 | * @param module Specify the name of the module that is to be added | 67 | * @param module Specify the name of the module that is to be added |
70 | * to the list of modules the dialog will show. | 68 | * to the list of modules the dialog will show. |
71 | * | 69 | * |
72 | * @param withfallback Try harder to load the module. Might result | 70 | * @param withfallback Try harder to load the module. Might result |
73 | * in the module appearing outside the dialog. | 71 | * in the module appearing outside the dialog. |
74 | **/ | 72 | **/ |
75 | //US void addModule(const QString& module, bool withfallback=true); | 73 | //US void addModule(const QString& module, bool withfallback=true); |
76 | 74 | ||
77 | 75 | ||
78 | //US special method for microkde. We dop noty want to load everything dynamically. | 76 | //US special method for microkde. We dop noty want to load everything dynamically. |
79 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); | 77 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); |
80 | QVBox* getNewVBoxPage(const QString & modulename) ; | 78 | QVBox* getNewVBoxPage(const QString & modulename) ; |
81 | 79 | ||
@@ -118,32 +116,31 @@ private slots: | |||
118 | 116 | ||
119 | void slotAboutToShow(QWidget *); | 117 | void slotAboutToShow(QWidget *); |
120 | 118 | ||
121 | void clientChanged(bool state); | 119 | void clientChanged(bool state); |
122 | 120 | ||
123 | private: | 121 | private: |
124 | /*US | 122 | /*US |
125 | struct LoadInfo { | 123 | struct LoadInfo { |
126 | LoadInfo(const QString &_path, bool _withfallback) | 124 | LoadInfo(const QString &_path, bool _withfallback) |
127 | : path(_path), withfallback(_withfallback) | 125 | : path(_path), withfallback(_withfallback) |
128 | { } | 126 | { } |
129 | QString path; | 127 | QString path; |
130 | bool withfallback; | 128 | bool withfallback; |
131 | }; | 129 | }; |
132 | */ | 130 | */ |
133 | QPtrList<KCModule> modules; | 131 | QPtrList<KCModule> modules; |
134 | /* | 132 | /* |
135 | QPtrDict<LoadInfo> moduleDict; | 133 | QPtrDict<LoadInfo> moduleDict; |
136 | QString _docPath; | 134 | QString _docPath; |
137 | */ | 135 | */ |
138 | QString _baseGroup; | 136 | QString _baseGroup; |
139 | 137 | ||
140 | //US | 138 | //US |
141 | KJanusWidget* mMainWidget; | 139 | KJanusWidget* mMainWidget; |
142 | KPrefs* mPrefs; | ||
143 | 140 | ||
144 | // For future use | 141 | // For future use |
145 | class KCMultiDialogPrivate; | 142 | class KCMultiDialogPrivate; |
146 | KCMultiDialogPrivate *d; | 143 | KCMultiDialogPrivate *d; |
147 | }; | 144 | }; |
148 | 145 | ||
149 | #endif //KCMULTIDIALOG_H | 146 | #endif //KCMULTIDIALOG_H |