Diffstat (limited to 'kaddressbook/kcmconfigs/kabconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 110 |
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 | |||
@@ -144,158 +144,64 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
144 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 144 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
145 | SLOT( itemClicked( QListViewItem* ) ) ); | 145 | SLOT( itemClicked( QListViewItem* ) ) ); |
146 | connect( mConfigureButton, SIGNAL( clicked() ), | 146 | connect( mConfigureButton, SIGNAL( clicked() ), |
147 | SLOT( configureExtension() ) ); | 147 | SLOT( configureExtension() ) ); |
148 | 148 | ||
149 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 149 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
150 | 150 | ||
151 | // Addressee page | 151 | // Addressee page |
152 | mAddresseeWidget = new AddresseeWidget( this ); | 152 | mAddresseeWidget = new AddresseeWidget( this ); |
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 | 159 | void KABConfigWidget::restoreSettings(KABPrefs* prefs) | |
194 | void 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 | |||
245 | void 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 | ||
258 | restoreExtensionSettings(); | 171 | restoreExtensionSettings(); |
259 | 172 | ||
260 | blockSignals( blocked ); | 173 | blockSignals( blocked ); |
261 | 174 | ||
262 | emit changed( false ); | 175 | emit changed( false ); |
263 | } | 176 | } |
264 | 177 | ||
265 | void KABConfigWidget::saveSettings() | 178 | void 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 | ||
275 | saveExtensionSettings(); | 185 | saveExtensionSettings(); |
276 | KABPrefs::instance()->writeConfig(); | 186 | KABPrefs::instance()->writeConfig(); |
277 | 187 | ||
278 | emit changed( false ); | 188 | emit changed( false ); |
279 | } | 189 | } |
280 | 190 | ||
281 | void KABConfigWidget::defaults() | 191 | void 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 | ||
293 | void KABConfigWidget::modified() | 199 | void KABConfigWidget::modified() |
294 | { | 200 | { |
295 | emit changed( true ); | 201 | emit changed( true ); |
296 | } | 202 | } |
297 | 203 | ||
298 | void KABConfigWidget::restoreExtensionSettings() | 204 | void KABConfigWidget::restoreExtensionSettings() |
299 | { | 205 | { |
300 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 206 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
301 | 207 | ||