summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorulf69 <ulf69>2004-08-10 19:40:27 (UTC)
committer ulf69 <ulf69>2004-08-10 19:40:27 (UTC)
commit20a2709f00d4e99eace87338fefc54701fcc47c0 (patch) (unidiff)
treed0914ea349b33322e837e3e67aacd0bfdc024a81 /libkdepim
parent2666ac52add8d79e34a04a64e4d5f092dd3d3d7e (diff)
downloadkdepimpi-20a2709f00d4e99eace87338fefc54701fcc47c0.zip
kdepimpi-20a2709f00d4e99eace87338fefc54701fcc47c0.tar.gz
kdepimpi-20a2709f00d4e99eace87338fefc54701fcc47c0.tar.bz2
release cache of externalapphandler after changes have been applied
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 9964eeb..c8b94db 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,557 +1,561 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qfile.h> 37#include <qfile.h>
38 38
39#include <kdialog.h> 39#include <kdialog.h>
40#include <klocale.h> 40#include <klocale.h>
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43 43
44/*US 44/*US
45#include <qcheckbox.h> 45#include <qcheckbox.h>
46#include <qframe.h> 46#include <qframe.h>
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qcombobox.h> 48#include <qcombobox.h>
49#include <qlineedit.h> 49#include <qlineedit.h>
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 "kpimglobalprefs.h" 74#include "kpimglobalprefs.h"
75 75
76#include "kdepimconfigwidget.h" 76#include "kdepimconfigwidget.h"
77 77
78 78
79KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) 79KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
80 : QWidget( parent, name ) 80 : QWidget( parent, name )
81{ 81{
82 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 82 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
83 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 83 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
84 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 84 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
85 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 85 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
86 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 86 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
87 87
88 88
89 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 89 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
90 KDialog::spacingHint() ); 90 KDialog::spacingHint() );
91 91
92 QTabWidget *tabWidget = new QTabWidget( this ); 92 QTabWidget *tabWidget = new QTabWidget( this );
93 topLayout->addWidget( tabWidget ); 93 topLayout->addWidget( tabWidget );
94 94
95 95
96 96
97 // mailclient page 97 // mailclient page
98 QWidget *externalAppsPage = new QWidget( this ); 98 QWidget *externalAppsPage = new QWidget( this );
99 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 99 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
100 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
101 101
102 mExternalApps = new QComboBox( externalAppsPage ); 102 mExternalApps = new QComboBox( externalAppsPage );
103 103
104 QMap<ExternalAppHandler::Types, QString>::Iterator it; 104 QMap<ExternalAppHandler::Types, QString>::Iterator it;
105 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 105 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
106 mExternalApps->insertItem( it.data(), it.key() ); 106 mExternalApps->insertItem( it.data(), it.key() );
107 107
108 layout->addWidget( mExternalApps ); 108 layout->addWidget( mExternalApps );
109 109
110 connect( mExternalApps, SIGNAL( activated( int ) ), 110 connect( mExternalApps, SIGNAL( activated( int ) ),
111 this, SLOT (externalapp_changed( int ) ) ); 111 this, SLOT (externalapp_changed( int ) ) );
112 112
113 113
114 114
115 115
116 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 116 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
117 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 117 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
118 118
119 119
120 mClient = new QComboBox( mExternalAppGroupBox ); 120 mClient = new QComboBox( mExternalAppGroupBox );
121 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 121 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
122 122
123 connect( mClient, SIGNAL( activated( int ) ), 123 connect( mClient, SIGNAL( activated( int ) ),
124 this, SLOT (client_changed( int ) ) ); 124 this, SLOT (client_changed( int ) ) );
125 125
126 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 126 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
127 boxLayout->addWidget( lab, 1, 0 ); 127 boxLayout->addWidget( lab, 1, 0 );
128 mChannel = new QLineEdit(mExternalAppGroupBox); 128 mChannel = new QLineEdit(mExternalAppGroupBox);
129 mChannel->setReadOnly(true); 129 mChannel->setReadOnly(true);
130 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 130 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
131 131
132 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 132 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
133 boxLayout->addWidget( lab, 3, 0 ); 133 boxLayout->addWidget( lab, 3, 0 );
134 mMessage = new QLineEdit(mExternalAppGroupBox); 134 mMessage = new QLineEdit(mExternalAppGroupBox);
135 mMessage->setReadOnly(true); 135 mMessage->setReadOnly(true);
136 boxLayout->addWidget( mMessage , 4, 0); 136 boxLayout->addWidget( mMessage , 4, 0);
137 137
138 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 138 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
139 boxLayout->addWidget( lab, 3, 1 ); 139 boxLayout->addWidget( lab, 3, 1 );
140 mParameters = new QLineEdit(mExternalAppGroupBox); 140 mParameters = new QLineEdit(mExternalAppGroupBox);
141 mParameters->setReadOnly(true); 141 mParameters->setReadOnly(true);
142 boxLayout->addWidget( mParameters, 4, 1 ); 142 boxLayout->addWidget( mParameters, 4, 1 );
143 143
144 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 144 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
145 boxLayout->addWidget( lab, 5, 0 ); 145 boxLayout->addWidget( lab, 5, 0 );
146 mMessage2 = new QLineEdit(mExternalAppGroupBox); 146 mMessage2 = new QLineEdit(mExternalAppGroupBox);
147 mMessage2->setReadOnly(true); 147 mMessage2->setReadOnly(true);
148 boxLayout->addWidget( mMessage2 , 6, 0); 148 boxLayout->addWidget( mMessage2 , 6, 0);
149 149
150 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 150 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
151 boxLayout->addWidget( lab, 5, 1 ); 151 boxLayout->addWidget( lab, 5, 1 );
152 mParameters2 = new QLineEdit(mExternalAppGroupBox); 152 mParameters2 = new QLineEdit(mExternalAppGroupBox);
153 mParameters2->setReadOnly(true); 153 mParameters2->setReadOnly(true);
154 boxLayout->addWidget( mParameters2, 6, 1 ); 154 boxLayout->addWidget( mParameters2, 6, 1 );
155 155
156 lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox); 156 lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox);
157 boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 ); 157 boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 );
158 158
159 159
160 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 160 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
161 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 161 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
162 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 162 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
163 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 163 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
164 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 164 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
165 165
166 166
167 167
168 layout->addWidget( mExternalAppGroupBox ); 168 layout->addWidget( mExternalAppGroupBox );
169 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 169 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
170 170
171} 171}
172 172
173void KDEPIMConfigWidget::externalapp_changed( int newApp ) 173void KDEPIMConfigWidget::externalapp_changed( int newApp )
174{ 174{
175 // first store the current data 175 // first store the current data
176 saveEditFieldSettings(); 176 saveEditFieldSettings();
177 177
178 // set mCurrentApp 178 // set mCurrentApp
179 mCurrentApp = (ExternalAppHandler::Types)newApp; 179 mCurrentApp = (ExternalAppHandler::Types)newApp;
180 180
181 // set mCurrentClient 181 // set mCurrentClient
182 switch(mCurrentApp) 182 switch(mCurrentApp)
183 { 183 {
184 case(ExternalAppHandler::EMAIL): 184 case(ExternalAppHandler::EMAIL):
185 mCurrentClient = mEmailClient; 185 mCurrentClient = mEmailClient;
186 break; 186 break;
187 case(ExternalAppHandler::PHONE): 187 case(ExternalAppHandler::PHONE):
188 mCurrentClient = mPhoneClient; 188 mCurrentClient = mPhoneClient;
189 break; 189 break;
190 case(ExternalAppHandler::SMS): 190 case(ExternalAppHandler::SMS):
191 mCurrentClient = mSMSClient; 191 mCurrentClient = mSMSClient;
192 break; 192 break;
193 case(ExternalAppHandler::FAX): 193 case(ExternalAppHandler::FAX):
194 mCurrentClient = mFaxClient; 194 mCurrentClient = mFaxClient;
195 break; 195 break;
196 case(ExternalAppHandler::PAGER): 196 case(ExternalAppHandler::PAGER):
197 mCurrentClient = mPagerClient; 197 mCurrentClient = mPagerClient;
198 break; 198 break;
199 default: 199 default:
200 return; 200 return;
201 } 201 }
202 202
203 // and at last update the widgets 203 // and at last update the widgets
204 updateClientWidgets(); 204 updateClientWidgets();
205} 205}
206 206
207 207
208 208
209void KDEPIMConfigWidget::client_changed( int newClient ) 209void KDEPIMConfigWidget::client_changed( int newClient )
210{ 210{
211 if (newClient == mCurrentClient) 211 if (newClient == mCurrentClient)
212 return; 212 return;
213 213
214 // first store the current data 214 // first store the current data
215 saveEditFieldSettings(); 215 saveEditFieldSettings();
216 216
217 217
218 //then reset the clientvariable 218 //then reset the clientvariable
219 mCurrentClient = newClient; 219 mCurrentClient = newClient;
220 220
221 // and at last update the widgets 221 // and at last update the widgets
222 updateClientWidgets(); 222 updateClientWidgets();
223 223
224 modified(); 224 modified();
225} 225}
226 226
227void KDEPIMConfigWidget::saveEditFieldSettings() 227void KDEPIMConfigWidget::saveEditFieldSettings()
228{ 228{
229 229
230 switch(mCurrentApp) 230 switch(mCurrentApp)
231 { 231 {
232 case(ExternalAppHandler::EMAIL): 232 case(ExternalAppHandler::EMAIL):
233 mEmailClient = mClient->currentItem(); 233 mEmailClient = mClient->currentItem();
234 break; 234 break;
235 case(ExternalAppHandler::PHONE): 235 case(ExternalAppHandler::PHONE):
236 mPhoneClient= mClient->currentItem(); 236 mPhoneClient= mClient->currentItem();
237 break; 237 break;
238 case(ExternalAppHandler::SMS): 238 case(ExternalAppHandler::SMS):
239 mSMSClient = mClient->currentItem(); 239 mSMSClient = mClient->currentItem();
240 break; 240 break;
241 case(ExternalAppHandler::FAX): 241 case(ExternalAppHandler::FAX):
242 mFaxClient = mClient->currentItem(); 242 mFaxClient = mClient->currentItem();
243 break; 243 break;
244 case(ExternalAppHandler::PAGER): 244 case(ExternalAppHandler::PAGER):
245 mPagerClient = mClient->currentItem(); 245 mPagerClient = mClient->currentItem();
246 break; 246 break;
247 default: 247 default:
248 return; 248 return;
249 } 249 }
250 250
251 //store the current data back to the apropriate membervariables if we had set it to "other" 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)) 252 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
253 { 253 {
254 mEmailOtherChannel = mChannel->text(); 254 mEmailOtherChannel = mChannel->text();
255 mEmailOtherMessage = mMessage->text(); 255 mEmailOtherMessage = mMessage->text();
256 mEmailOtherMessageParameters = mParameters->text(); 256 mEmailOtherMessageParameters = mParameters->text();
257 mEmailOtherMessage2 = mMessage2->text(); 257 mEmailOtherMessage2 = mMessage2->text();
258 mEmailOtherMessageParameters2 = mParameters2->text(); 258 mEmailOtherMessageParameters2 = mParameters2->text();
259 } 259 }
260 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 260 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
261 { 261 {
262 mPhoneOtherChannel = mChannel->text(); 262 mPhoneOtherChannel = mChannel->text();
263 mPhoneOtherMessage = mMessage->text(); 263 mPhoneOtherMessage = mMessage->text();
264 mPhoneOtherMessageParameters = mParameters->text(); 264 mPhoneOtherMessageParameters = mParameters->text();
265 } 265 }
266 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 266 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
267 { 267 {
268 mSMSOtherChannel = mChannel->text(); 268 mSMSOtherChannel = mChannel->text();
269 mSMSOtherMessage = mMessage->text(); 269 mSMSOtherMessage = mMessage->text();
270 mSMSOtherMessageParameters = mParameters->text(); 270 mSMSOtherMessageParameters = mParameters->text();
271 } 271 }
272 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 272 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
273 { 273 {
274 mFaxOtherChannel = mChannel->text(); 274 mFaxOtherChannel = mChannel->text();
275 mFaxOtherMessage = mMessage->text(); 275 mFaxOtherMessage = mMessage->text();
276 mFaxOtherMessageParameters = mParameters->text(); 276 mFaxOtherMessageParameters = mParameters->text();
277 } 277 }
278 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 278 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
279 { 279 {
280 mPagerOtherChannel = mChannel->text(); 280 mPagerOtherChannel = mChannel->text();
281 mPagerOtherMessage = mMessage->text(); 281 mPagerOtherMessage = mMessage->text();
282 mPagerOtherMessageParameters = mParameters->text(); 282 mPagerOtherMessageParameters = mParameters->text();
283 } 283 }
284 284
285
285} 286}
286 287
287void KDEPIMConfigWidget::updateClientWidgets() 288void KDEPIMConfigWidget::updateClientWidgets()
288{ 289{
289 bool blocked = signalsBlocked(); 290 bool blocked = signalsBlocked();
290 blockSignals( true ); 291 blockSignals( true );
291 292
292 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 293 // 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 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
294 if (it == mExternalAppsMap.end()) 295 if (it == mExternalAppsMap.end())
295 return; 296 return;
296 297
297 // update group box 298 // update group box
298 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 299 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
299 300
300 //update the entries in the client combobox 301 //update the entries in the client combobox
301 mClient->clear(); 302 mClient->clear();
302 303
303 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 304 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
304 DefaultAppItem* dai; 305 DefaultAppItem* dai;
305 for ( dai=items.first(); dai != 0; dai=items.next() ) 306 for ( dai=items.first(); dai != 0; dai=items.next() )
306 { 307 {
307 mClient->insertItem( i18n(dai->_label), dai->_id ); 308 mClient->insertItem( i18n(dai->_label), dai->_id );
308 309
309 if (dai->_id == mCurrentClient) 310 if (dai->_id == mCurrentClient)
310 { 311 {
311 //restore the edit fields with the data of the local membervariables if we had set it to "other". 312 //restore the edit fields with the data of the local membervariables if we had set it to "other".
312 //Otherwise take the default data from externalapphandler. 313 //Otherwise take the default data from externalapphandler.
313 mChannel->setText(dai->_channel); 314 mChannel->setText(dai->_channel);
314 mMessage->setText(dai->_message); 315 mMessage->setText(dai->_message);
315 mParameters->setText(dai->_parameters); 316 mParameters->setText(dai->_parameters);
316 mMessage2->setText(dai->_message2); 317 mMessage2->setText(dai->_message2);
317 mParameters2->setText(dai->_parameters2); 318 mParameters2->setText(dai->_parameters2);
318 319
319 320
320 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 321 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
321 { 322 {
322 mChannel->setText(mEmailOtherChannel); 323 mChannel->setText(mEmailOtherChannel);
323 mMessage->setText(mEmailOtherMessage); 324 mMessage->setText(mEmailOtherMessage);
324 mParameters->setText(mEmailOtherMessageParameters); 325 mParameters->setText(mEmailOtherMessageParameters);
325 mMessage2->setText(mEmailOtherMessage2); 326 mMessage2->setText(mEmailOtherMessage2);
326 mParameters2->setText(mEmailOtherMessageParameters2); 327 mParameters2->setText(mEmailOtherMessageParameters2);
327 } 328 }
328 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 329 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
329 { 330 {
330 mChannel->setText(mPhoneOtherChannel); 331 mChannel->setText(mPhoneOtherChannel);
331 mMessage->setText(mPhoneOtherMessage); 332 mMessage->setText(mPhoneOtherMessage);
332 mParameters->setText(mPhoneOtherMessageParameters); 333 mParameters->setText(mPhoneOtherMessageParameters);
333 } 334 }
334 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 335 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
335 { 336 {
336 mChannel->setText(mSMSOtherChannel); 337 mChannel->setText(mSMSOtherChannel);
337 mMessage->setText(mSMSOtherMessage); 338 mMessage->setText(mSMSOtherMessage);
338 mParameters->setText(mSMSOtherMessageParameters); 339 mParameters->setText(mSMSOtherMessageParameters);
339 } 340 }
340 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 341 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
341 { 342 {
342 mChannel->setText(mFaxOtherChannel); 343 mChannel->setText(mFaxOtherChannel);
343 mMessage->setText(mFaxOtherMessage); 344 mMessage->setText(mFaxOtherMessage);
344 mParameters->setText(mFaxOtherMessageParameters); 345 mParameters->setText(mFaxOtherMessageParameters);
345 } 346 }
346 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 347 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
347 { 348 {
348 mChannel->setText(mPagerOtherChannel); 349 mChannel->setText(mPagerOtherChannel);
349 mMessage->setText(mPagerOtherMessage); 350 mMessage->setText(mPagerOtherMessage);
350 mParameters->setText(mPagerOtherMessageParameters); 351 mParameters->setText(mPagerOtherMessageParameters);
351 } 352 }
352 } 353 }
353 354
354 } 355 }
355 356
356 bool readonly; 357 bool readonly;
357 bool enabled; 358 bool enabled;
358 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 359 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
359 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 360 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
360 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 361 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
361 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 362 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
362 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))) 363 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)))
363 { 364 {
364 readonly = false; 365 readonly = false;
365 } 366 }
366 else 367 else
367 { 368 {
368 readonly = true; 369 readonly = true;
369 } 370 }
370 371
371 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 372 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
372 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 373 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
373 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 374 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
374 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 375 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
375 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))) 376 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)))
376 { 377 {
377 enabled = false; 378 enabled = false;
378 } 379 }
379 else 380 else
380 { 381 {
381 enabled = true; 382 enabled = true;
382 } 383 }
383 384
384 385
385 mChannel->setReadOnly(readonly); 386 mChannel->setReadOnly(readonly);
386 mMessage->setReadOnly(readonly); 387 mMessage->setReadOnly(readonly);
387 mParameters->setReadOnly(readonly); 388 mParameters->setReadOnly(readonly);
388 mMessage2->setReadOnly(readonly); 389 mMessage2->setReadOnly(readonly);
389 mParameters2->setReadOnly(readonly); 390 mParameters2->setReadOnly(readonly);
390 391
391 mChannel->setEnabled(enabled); 392 mChannel->setEnabled(enabled);
392 mMessage->setEnabled(enabled); 393 mMessage->setEnabled(enabled);
393 mParameters->setEnabled(enabled); 394 mParameters->setEnabled(enabled);
394 mMessage2->setEnabled(enabled); 395 mMessage2->setEnabled(enabled);
395 mParameters2->setEnabled(enabled); 396 mParameters2->setEnabled(enabled);
396 397
397 398
398 399
399 mClient->setCurrentItem(mCurrentClient); 400 mClient->setCurrentItem(mCurrentClient);
400 401
401 402
402 // enable/disable the extra message/parameter field 403 // enable/disable the extra message/parameter field
403 if (mCurrentApp == ExternalAppHandler::EMAIL) 404 if (mCurrentApp == ExternalAppHandler::EMAIL)
404 { 405 {
405 } 406 }
406 else 407 else
407 { 408 {
408 mMessage2->setText( "" ); 409 mMessage2->setText( "" );
409 mParameters2->setText( "" ); 410 mParameters2->setText( "" );
410 } 411 }
411 412
412 if (enabled == true) { 413 if (enabled == true) {
413 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 414 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
414 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 415 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
415 } 416 }
416 417
417 418
418 blockSignals( blocked ); 419 blockSignals( blocked );
419 420
420} 421}
421 422
422 423
423 424
424 425
425void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs) 426void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
426{ 427{
427 bool blocked = signalsBlocked(); 428 bool blocked = signalsBlocked();
428 blockSignals( true ); 429 blockSignals( true );
429 430
430 mEmailClient = prefs->mEmailClient; 431 mEmailClient = prefs->mEmailClient;
431 mEmailOtherChannel = prefs->mEmailOtherChannel; 432 mEmailOtherChannel = prefs->mEmailOtherChannel;
432 mEmailOtherMessage = prefs->mEmailOtherMessage; 433 mEmailOtherMessage = prefs->mEmailOtherMessage;
433 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 434 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
434 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 435 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
435 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 436 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
436 437
437 mPhoneClient = prefs->mPhoneClient; 438 mPhoneClient = prefs->mPhoneClient;
438 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 439 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
439 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 440 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
440 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 441 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
441 442
442 mFaxClient = prefs->mFaxClient; 443 mFaxClient = prefs->mFaxClient;
443 mFaxOtherChannel = prefs->mFaxOtherChannel; 444 mFaxOtherChannel = prefs->mFaxOtherChannel;
444 mFaxOtherMessage = prefs->mFaxOtherMessage; 445 mFaxOtherMessage = prefs->mFaxOtherMessage;
445 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 446 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
446 447
447 mSMSClient = prefs->mSMSClient; 448 mSMSClient = prefs->mSMSClient;
448 mSMSOtherChannel = prefs->mSMSOtherChannel; 449 mSMSOtherChannel = prefs->mSMSOtherChannel;
449 mSMSOtherMessage = prefs->mSMSOtherMessage; 450 mSMSOtherMessage = prefs->mSMSOtherMessage;
450 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 451 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
451 452
452 mPagerClient = prefs->mPagerClient; 453 mPagerClient = prefs->mPagerClient;
453 mPagerOtherChannel = prefs->mPagerOtherChannel; 454 mPagerOtherChannel = prefs->mPagerOtherChannel;
454 mPagerOtherMessage = prefs->mPagerOtherMessage; 455 mPagerOtherMessage = prefs->mPagerOtherMessage;
455 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 456 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
456 457
457 mCurrentApp = ExternalAppHandler::EMAIL; 458 mCurrentApp = ExternalAppHandler::EMAIL;
458 mCurrentClient = mEmailClient; 459 mCurrentClient = mEmailClient;
459 460
460 updateClientWidgets(); 461 updateClientWidgets();
461 462
462 blockSignals( blocked ); 463 blockSignals( blocked );
463 464
464 emit changed( false ); 465 emit changed( false );
465 466
466} 467}
467 468
468void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs) 469void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
469{ 470{
470 saveEditFieldSettings(); 471 saveEditFieldSettings();
471 472
472 prefs->mEmailClient = mEmailClient; 473 prefs->mEmailClient = mEmailClient;
473 prefs->mEmailOtherChannel = mEmailOtherChannel; 474 prefs->mEmailOtherChannel = mEmailOtherChannel;
474 prefs->mEmailOtherMessage = mEmailOtherMessage; 475 prefs->mEmailOtherMessage = mEmailOtherMessage;
475 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 476 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
476 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 477 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
477 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 478 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
478 479
479 prefs->mPhoneClient = mPhoneClient; 480 prefs->mPhoneClient = mPhoneClient;
480 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 481 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
481 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 482 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
482 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 483 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
483 484
484 prefs->mFaxClient = mFaxClient; 485 prefs->mFaxClient = mFaxClient;
485 prefs->mFaxOtherChannel = mFaxOtherChannel; 486 prefs->mFaxOtherChannel = mFaxOtherChannel;
486 prefs->mFaxOtherMessage = mFaxOtherMessage; 487 prefs->mFaxOtherMessage = mFaxOtherMessage;
487 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 488 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
488 489
489 prefs->mSMSClient = mSMSClient; 490 prefs->mSMSClient = mSMSClient;
490 prefs->mSMSOtherChannel = mSMSOtherChannel; 491 prefs->mSMSOtherChannel = mSMSOtherChannel;
491 prefs->mSMSOtherMessage = mSMSOtherMessage; 492 prefs->mSMSOtherMessage = mSMSOtherMessage;
492 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 493 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
493 494
494 prefs->mPagerClient = mPagerClient; 495 prefs->mPagerClient = mPagerClient;
495 prefs->mPagerOtherChannel = mPagerOtherChannel; 496 prefs->mPagerOtherChannel = mPagerOtherChannel;
496 prefs->mPagerOtherMessage = mPagerOtherMessage; 497 prefs->mPagerOtherMessage = mPagerOtherMessage;
497 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 498 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
498 499
499 prefs->writeConfig(); 500 prefs->writeConfig();
500 501
502 //release the cache that other views can access the changed values instantanious
503 ExternalAppHandler::instance()->loadConfig();
504
501 emit changed( false ); 505 emit changed( false );
502} 506}
503 507
504void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs) 508void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs)
505{ 509{
506 510
507 DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC); 511 DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC);
508 512
509 mEmailClient = dai->_id; 513 mEmailClient = dai->_id;
510 mEmailOtherChannel = dai->_channel; 514 mEmailOtherChannel = dai->_channel;
511 mEmailOtherMessage = dai->_message; 515 mEmailOtherMessage = dai->_message;
512 mEmailOtherMessageParameters = dai->_parameters; 516 mEmailOtherMessageParameters = dai->_parameters;
513 mEmailOtherMessage2 = dai->_message2; 517 mEmailOtherMessage2 = dai->_message2;
514 mEmailOtherMessageParameters2 = dai->_parameters2; 518 mEmailOtherMessageParameters2 = dai->_parameters2;
515 519
516 520
517 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC); 521 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC);
518 522
519 mPhoneClient = dai->_id; 523 mPhoneClient = dai->_id;
520 mPhoneOtherChannel = dai->_channel; 524 mPhoneOtherChannel = dai->_channel;
521 mPhoneOtherMessage = dai->_message; 525 mPhoneOtherMessage = dai->_message;
522 mPhoneOtherMessageParameters = dai->_parameters; 526 mPhoneOtherMessageParameters = dai->_parameters;
523 527
524 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC); 528 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC);
525 529
526 mFaxClient = dai->_id; 530 mFaxClient = dai->_id;
527 mFaxOtherChannel = dai->_channel; 531 mFaxOtherChannel = dai->_channel;
528 mFaxOtherMessage = dai->_message; 532 mFaxOtherMessage = dai->_message;
529 mFaxOtherMessageParameters = dai->_parameters; 533 mFaxOtherMessageParameters = dai->_parameters;
530 534
531 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC); 535 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC);
532 536
533 mSMSClient = dai->_id; 537 mSMSClient = dai->_id;
534 mSMSOtherChannel = dai->_channel; 538 mSMSOtherChannel = dai->_channel;
535 mSMSOtherMessage = dai->_message; 539 mSMSOtherMessage = dai->_message;
536 mSMSOtherMessageParameters = dai->_parameters; 540 mSMSOtherMessageParameters = dai->_parameters;
537 541
538 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC); 542 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC);
539 543
540 mPagerClient = dai->_id; 544 mPagerClient = dai->_id;
541 mPagerOtherChannel = dai->_channel; 545 mPagerOtherChannel = dai->_channel;
542 mPagerOtherMessage = dai->_message; 546 mPagerOtherMessage = dai->_message;
543 mPagerOtherMessageParameters = dai->_parameters; 547 mPagerOtherMessageParameters = dai->_parameters;
544 548
545 549
546 emit changed( true ); 550 emit changed( true );
547} 551}
548 552
549void KDEPIMConfigWidget::modified() 553void KDEPIMConfigWidget::modified()
550{ 554{
551 emit changed( true ); 555 emit changed( true );
552} 556}
553 557
554void KDEPIMConfigWidget::textChanged( const QString& text ) 558void KDEPIMConfigWidget::textChanged( const QString& text )
555{ 559{
556 emit changed( true ); 560 emit changed( true );
557} 561}