summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs/kabconfigwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kcmconfigs/kabconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp110
1 files changed, 8 insertions, 102 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 1bac26f..b5309c0 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -153,105 +153,18 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
153 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 153 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
154 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 154 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
155 155
156 // mailclient page
157 QWidget *mailclientPage = new QWidget( this );
158 layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
159 KDialog::spacingHintSmall() );
160
161 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
162 boxLayout = new QVBoxLayout( groupBox->layout() );
163 boxLayout->setAlignment( Qt::AlignTop );
164// boxLayout->setMargin(KDialog::marginHintSmall() );
165// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
166// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
167// boxLayout->setSpacing( KDialog::spacingHintSmall() );
168
169 mEmailClient = new QComboBox( groupBox );
170 mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI );
171 mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA );
172 mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE );
173 mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER );
174 boxLayout->addWidget( mEmailClient );
175
176 connect( mEmailClient, SIGNAL( activated( int ) ),
177 this, SLOT (emailclient_changed( int ) ) );
178
179 QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
180 boxLayout->addWidget( lab );
181 mEmailChannel = new QLineEdit(groupBox);
182 mEmailChannel->setReadOnly(true);
183 boxLayout->addWidget( mEmailChannel );
184
185 layout->addWidget( groupBox );
186 tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
187
188
189
190} 156}
191 157
192 158
193 159void KABConfigWidget::restoreSettings(KABPrefs* prefs)
194void KABConfigWidget::emailclient_changed( int newClient )
195{ 160{
196 if (newClient == KABPrefs::OTHER) 161//US prefs was KABPrefs::instance() before
197 mEmailChannel->setReadOnly(false);
198 else
199 mEmailChannel->setReadOnly(true);
200
201 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
202 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
203
204 if (opiepath.isEmpty())
205 opiepath = qtopiapath;
206
207 QString text = mEmailChannel->text();
208
209 if (newClient == KABPrefs::OPIE)
210 {
211 if ( QFile::exists( opiepath + "/bin/opiemail" ))
212 text = "QPE/Application/opiemail";
213 else
214 text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
215 }
216 else if (newClient == KABPrefs::QTOPIA)
217 {
218 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
219 text = "QPE/Application/qtmail";
220 else
221 text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
222 162
223 }
224 else if (newClient == KABPrefs::OMPI)
225 {
226 if ( QFile::exists( qtopiapath + "/bin/ompi" ))
227 text = "QPE/Application/ompi";
228 else if ( QFile::exists( opiepath + "/bin/ompi" ))
229 text = "QPE/Application/ompi";
230 else
231 text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
232
233 }
234 else
235 {
236 //do nothing if we choosed other
237 }
238
239 mEmailChannel->setText( text );
240
241
242}
243
244
245void KABConfigWidget::restoreSettings()
246{
247 bool blocked = signalsBlocked(); 163 bool blocked = signalsBlocked();
248 blockSignals( true ); 164 blockSignals( true );
249 165
250 mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); 166 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
251 mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); 167 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
252
253 mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
254 mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
255 168
256 mAddresseeWidget->restoreSettings(); 169 mAddresseeWidget->restoreSettings();
257 170
@@ -262,13 +175,10 @@ void KABConfigWidget::restoreSettings()
262 emit changed( false ); 175 emit changed( false );
263} 176}
264 177
265void KABConfigWidget::saveSettings() 178void KABConfigWidget::saveSettings(KABPrefs* prefs)
266{ 179{
267 KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); 180 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
268 KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 181 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
269
270 KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
271 KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
272 182
273 mAddresseeWidget->saveSettings(); 183 mAddresseeWidget->saveSettings();
274 184
@@ -278,15 +188,11 @@ void KABConfigWidget::saveSettings()
278 emit changed( false ); 188 emit changed( false );
279} 189}
280 190
281void KABConfigWidget::defaults() 191void KABConfigWidget::defaults(KABPrefs* prefs)
282{ 192{
283 mNameParsing->setChecked( true ); 193 mNameParsing->setChecked( true );
284 mViewsSingleClickBox->setChecked( false ); 194 mViewsSingleClickBox->setChecked( false );
285 195
286 mEmailClient->setCurrentItem(KABPrefs::OMPI);
287 emailclient_changed( KABPrefs::OMPI );
288
289
290 emit changed( true ); 196 emit changed( true );
291} 197}
292 198