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 | |||
@@ -91,2 +91,4 @@ | |||
91 | #include "kcmconfigs/kcmkdepimconfig.h" | 91 | #include "kcmconfigs/kcmkdepimconfig.h" |
92 | #include "kpimglobalprefs.h" | ||
93 | #include "externalapphandler.h" | ||
92 | 94 | ||
@@ -469,25 +471,3 @@ 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 | } |
@@ -552,2 +532,6 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
552 | } | 532 | } |
533 | |||
534 | bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); | ||
535 | |||
536 | |||
553 | /*US | 537 | /*US |
@@ -559,15 +543,2 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
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 | ||
@@ -1199,7 +1170,9 @@ 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 ); |
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 | |||
@@ -41,4 +41,4 @@ 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 | } |
@@ -46,4 +46,4 @@ extern "C" | |||
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 | { |
@@ -59,15 +59,15 @@ KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) | |||
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 | } |
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 | |||
@@ -29,3 +29,3 @@ | |||
29 | class KABConfigWidget; | 29 | class KABConfigWidget; |
30 | class KPrefs; | 30 | class KABPrefs; |
31 | 31 | ||
@@ -36,7 +36,7 @@ class KCMKabConfig : public KCModule | |||
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 | ||
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index 547441c..83aba48 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp | |||
@@ -39,4 +39,4 @@ | |||
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 |
@@ -61,3 +61,3 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) | |||
61 | //US link->setColor( KGlobalSettings::linkColor() ); | 61 | //US link->setColor( KGlobalSettings::linkColor() ); |
62 | 62 | ||
63 | } | 63 | } |
@@ -90,3 +90,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
90 | if ( kphoneInstalled > 0 ) | 90 | if ( kphoneInstalled > 0 ) |
91 | kphoneAvail = true; | 91 | kphoneAvail = true; |
92 | #if 0 | 92 | #if 0 |
@@ -97,3 +97,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | #endif | 99 | #endif |
@@ -146,3 +146,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
146 | 146 | ||
147 | 147 | ||
148 | for ( ; emailIt != emails.end(); ++emailIt ) { | 148 | for ( ; emailIt != emails.end(); ++emailIt ) { |
@@ -183,3 +183,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
183 | } else { | 183 | } else { |
184 | 184 | ||
185 | dynamicPart += QString( | 185 | dynamicPart += QString( |
@@ -190,3 +190,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
190 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 190 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
191 | 191 | ||
192 | } | 192 | } |
@@ -210,5 +210,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
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()*/ ) { |
@@ -270,3 +270,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
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 |
@@ -276,3 +276,3 @@ mText = "<table width=\"100%\">\n"; | |||
276 | #endif | 276 | #endif |
277 | 277 | ||
278 | #ifdef DESKTOP_VERSION | 278 | #ifdef DESKTOP_VERSION |
@@ -289,3 +289,3 @@ mText = "<table width=\"100%\">\n"; | |||
289 | .arg( i18n(" ") ) | 289 | .arg( i18n(" ") ) |
290 | .arg( name ); | 290 | .arg( name ); |
291 | */ | 291 | */ |
@@ -304,3 +304,3 @@ mText = "<table width=\"100%\">\n"; | |||
304 | mText += "</table>"; | 304 | mText += "</table>"; |
305 | 305 | ||
306 | } | 306 | } |
@@ -309,2 +309,3 @@ mText = "<table width=\"100%\">\n"; | |||
309 | setText( mText ); | 309 | setText( mText ); |
310 | |||
310 | } | 311 | } |
@@ -323,3 +324,3 @@ void AddresseeView::addTag(const QString & tag,const QString & text) | |||
323 | QString tmpStr=str; | 324 | QString tmpStr=str; |
324 | if(number !=-1) | 325 | if(number !=-1) |
325 | { | 326 | { |
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 | |||
@@ -41,3 +41,4 @@ $Id$ | |||
41 | #include "kprefs.h" | 41 | #include "kprefs.h" |
42 | #include "kpimprefs.h" | 42 | #include "kpimglobalprefs.h" |
43 | |||
43 | #ifndef _WIN32_ | 44 | #ifndef _WIN32_ |
@@ -45,4 +46,4 @@ 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 | } |
@@ -50,4 +51,5 @@ extern "C" | |||
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 | { |
@@ -63,15 +65,15 @@ KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name ) | |||
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 | |||
@@ -36,3 +36,3 @@ $Id$ | |||
36 | class KDEPIMConfigWidget; | 36 | class KDEPIMConfigWidget; |
37 | class KPrefs; | 37 | class KPimGlobalPrefs; |
38 | 38 | ||
@@ -43,7 +43,7 @@ class KCMKdePimConfig : public KCModule | |||
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 | ||
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 | |||
@@ -73,3 +73,3 @@ $Id$ | |||
73 | 73 | ||
74 | #include "kpimprefs.h" | 74 | #include "kpimglobalprefs.h" |
75 | 75 | ||
@@ -81,2 +81,9 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *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, |
@@ -86,97 +93,78 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | |||
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 | ||
@@ -184,43 +172,234 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | |||
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 | } |
@@ -228,8 +407,14 @@ void KDEPIMConfigWidget::emailclient_changed( int newClient ) | |||
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 | } |
@@ -237,3 +422,5 @@ void KDEPIMConfigWidget::emailclient_changed( int newClient ) | |||
237 | 422 | ||
238 | void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs) | 423 | |
424 | |||
425 | void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs) | ||
239 | { | 426 | { |
@@ -242,4 +429,33 @@ void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs) | |||
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 | ||
@@ -248,8 +464,35 @@ void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs) | |||
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 | ||
@@ -260,6 +503,42 @@ void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs) | |||
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 | ||
@@ -273 +552,6 @@ void KDEPIMConfigWidget::modified() | |||
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 | |||
@@ -34,2 +34,6 @@ $Id$ | |||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qmap.h> | ||
36 | |||
37 | #include "externalapphandler.h" | ||
38 | |||
35 | 39 | ||
@@ -43,3 +47,4 @@ class QComboBox; | |||
43 | class QLineEdit; | 47 | class QLineEdit; |
44 | class KPimPrefs; | 48 | class KPimGlobalPrefs; |
49 | class QGroupBox; | ||
45 | 50 | ||
@@ -52,5 +57,5 @@ class KDEPIMConfigWidget : public QWidget | |||
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 | ||
@@ -59,4 +64,6 @@ class KDEPIMConfigWidget : public QWidget | |||
59 | 64 | ||
65 | |||
60 | public slots: | 66 | public slots: |
61 | void modified(); | 67 | void modified(); |
68 | void textChanged( const QString& text ); | ||
62 | 69 | ||
@@ -68,5 +75,9 @@ class KDEPIMConfigWidget : public QWidget | |||
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(); |
@@ -79,4 +90,47 @@ class KDEPIMConfigWidget : public QWidget | |||
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 | ||
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index 15531c7..140a286 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp | |||
@@ -23,2 +23,9 @@ | |||
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> |
@@ -33,6 +40,2 @@ KPimPrefs::KPimPrefs( const QString &name ) : | |||
33 | { | 40 | { |
34 | KPrefs::setCurrentGroup( "ExternalApplications" ); | ||
35 | addItemInt( "EmailChannelType", &mEmailClient, OMPI ); | ||
36 | addItemString( "EmailChannelOther", &mEmailChannel, "" ); | ||
37 | |||
38 | } | 41 | } |
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index 5186315..9bd9466 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h | |||
@@ -22,2 +22,10 @@ | |||
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 |
@@ -46,9 +54,2 @@ class KPimPrefs : public KPrefs | |||
46 | 54 | ||
47 | enum EMailClients { | ||
48 | OMPI = 0, | ||
49 | QTOPIA = 1, | ||
50 | OPIE = 2, | ||
51 | OTHER = 3 | ||
52 | }; | ||
53 | |||
54 | 55 | ||
@@ -57,6 +58,2 @@ class KPimPrefs : public KPrefs | |||
57 | 58 | ||
58 | int mEmailClient; | ||
59 | QString mEmailChannel; | ||
60 | |||
61 | |||
62 | 59 | ||
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro index 902f049..e05e681 100644 --- a/libkdepim/libkdepim.pro +++ b/libkdepim/libkdepim.pro | |||
@@ -25,2 +25,3 @@ HEADERS = \ | |||
25 | categoryselectdialog_base.h \ | 25 | categoryselectdialog_base.h \ |
26 | externalapphandler.h \ | ||
26 | kdateedit.h \ | 27 | kdateedit.h \ |
@@ -30,2 +31,3 @@ HEADERS = \ | |||
30 | kpimprefs.h \ | 31 | kpimprefs.h \ |
32 | kpimglobalprefs.h \ | ||
31 | kprefsdialog.h \ | 33 | kprefsdialog.h \ |
@@ -42,2 +44,3 @@ SOURCES = \ | |||
42 | categoryselectdialog_base.cpp \ | 44 | categoryselectdialog_base.cpp \ |
45 | externalapphandler.cpp \ | ||
43 | kdateedit.cpp \ | 46 | kdateedit.cpp \ |
@@ -47,2 +50,3 @@ SOURCES = \ | |||
47 | kpimprefs.cpp \ | 50 | kpimprefs.cpp \ |
51 | kpimglobalprefs.cpp \ | ||
48 | kprefsdialog.cpp \ | 52 | kprefsdialog.cpp \ |
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro index fc8abe1..b322bce 100644 --- a/libkdepim/libkdepimE.pro +++ b/libkdepim/libkdepimE.pro | |||
@@ -19,2 +19,3 @@ HEADERS = \ | |||
19 | categoryselectdialog_base.h \ | 19 | categoryselectdialog_base.h \ |
20 | externalapphandler.h \ | ||
20 | kdateedit.h \ | 21 | kdateedit.h \ |
@@ -24,2 +25,3 @@ HEADERS = \ | |||
24 | kpimprefs.h \ | 25 | kpimprefs.h \ |
26 | kpimglobalprefs.h \ | ||
25 | kprefsdialog.h \ | 27 | kprefsdialog.h \ |
@@ -38,2 +40,3 @@ SOURCES = \ | |||
38 | categoryselectdialog_base.cpp \ | 40 | categoryselectdialog_base.cpp \ |
41 | externalapphandler.cpp \ | ||
39 | kdateedit.cpp \ | 42 | kdateedit.cpp \ |
@@ -43,2 +46,3 @@ SOURCES = \ | |||
43 | kpimprefs.cpp \ | 46 | kpimprefs.cpp \ |
47 | kpimglobalprefs.cpp \ | ||
44 | kprefsdialog.cpp \ | 48 | kprefsdialog.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 | |||
@@ -35,5 +35,6 @@ public: | |||
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) |
@@ -43,3 +44,4 @@ KCModule::KCModule(QWidget *parent, const char *name, const QStringList &) | |||
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); |
@@ -50,3 +52,3 @@ KCModule::KCModule(QWidget *parent, const char *name, const QStringList &) | |||
50 | d->_instance = new KInstance("kcmunnamed"); | 52 | d->_instance = new KInstance("kcmunnamed"); |
51 | */ | 53 | */ |
52 | d->_hasOwnInstance = true; | 54 | d->_hasOwnInstance = true; |
@@ -73,3 +75,3 @@ KCModule::~KCModule() | |||
73 | delete d->_instance; | 75 | delete d->_instance; |
74 | */ | 76 | */ |
75 | delete d; | 77 | delete d; |
@@ -96,2 +98,8 @@ bool KCModule::useRootOnlyMsg() const | |||
96 | } | 98 | } |
99 | |||
100 | KPrefs* KCModule::getPreferences() | ||
101 | { | ||
102 | return d->_prefs; | ||
103 | } | ||
104 | |||
97 | /*US | 105 | /*US |
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 | |||
@@ -85,3 +85,3 @@ public: | |||
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 | ||
@@ -108,3 +108,3 @@ public: | |||
108 | */ | 108 | */ |
109 | virtual void load(KPrefs* prefs) {}; | 109 | virtual void load() {}; |
110 | 110 | ||
@@ -121,3 +121,3 @@ public: | |||
121 | */ | 121 | */ |
122 | virtual void save(KPrefs* prefs) {}; | 122 | virtual void save() {}; |
123 | 123 | ||
@@ -129,3 +129,3 @@ public: | |||
129 | */ | 129 | */ |
130 | virtual void defaults(KPrefs* prefs) {}; | 130 | virtual void defaults() {}; |
131 | 131 | ||
@@ -139,3 +139,3 @@ public: | |||
139 | */ | 139 | */ |
140 | virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); }; | 140 | virtual void sysdefaults() { defaults(); }; |
141 | 141 | ||
@@ -195,2 +195,3 @@ public: | |||
195 | 195 | ||
196 | KPrefs* getPreferences(); | ||
196 | 197 | ||
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 | |||
@@ -36,3 +36,2 @@ | |||
36 | #include "kcmultidialog.h" | 36 | #include "kcmultidialog.h" |
37 | #include "kprefs.h" | ||
38 | //US #include "kcmultidialog.moc" | 37 | //US #include "kcmultidialog.moc" |
@@ -40,5 +39,5 @@ | |||
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 | { |
@@ -77,3 +76,3 @@ void KCMultiDialog::slotDefault() | |||
77 | { | 76 | { |
78 | (*it)->defaults(mPrefs); | 77 | (*it)->defaults(); |
79 | clientChanged(true); | 78 | clientChanged(true); |
@@ -91,3 +90,3 @@ qDebug("KCMultiDialog::slotApply clicked"); | |||
91 | for (; it.current(); ++it) | 90 | for (; it.current(); ++it) |
92 | (*it)->save(mPrefs); | 91 | (*it)->save(); |
93 | clientChanged(false); | 92 | clientChanged(false); |
@@ -105,3 +104,3 @@ qDebug("KCMultiDialog::slotOk clicked"); | |||
105 | for (; it.current(); ++it) | 104 | for (; it.current(); ++it) |
106 | (*it)->save(mPrefs); | 105 | (*it)->save(); |
107 | accept(); | 106 | accept(); |
@@ -164,3 +163,3 @@ void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, | |||
164 | //US | 163 | //US |
165 | module->load(mPrefs); | 164 | module->load(); |
166 | 165 | ||
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 | |||
@@ -31,4 +31,2 @@ | |||
31 | 31 | ||
32 | class KPrefs; | ||
33 | |||
34 | /** | 32 | /** |
@@ -56,3 +54,3 @@ public: | |||
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, |
@@ -141,3 +139,2 @@ private: | |||
141 | KJanusWidget* mMainWidget; | 139 | KJanusWidget* mMainWidget; |
142 | KPrefs* mPrefs; | ||
143 | 140 | ||