From 4cbb59835b52b524c9fcbb377159d91a97e1b626 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Fri, 06 Aug 2004 20:34:07 +0000 Subject: kcmultidialog can now handle the configuration of multiple applications at once --- (limited to 'kaddressbook/kcmconfigs/kabconfigwidget.cpp') 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 ) tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); - // mailclient page - QWidget *mailclientPage = new QWidget( this ); - layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(), - KDialog::spacingHintSmall() ); - - groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage ); - boxLayout = new QVBoxLayout( groupBox->layout() ); - boxLayout->setAlignment( Qt::AlignTop ); -// boxLayout->setMargin(KDialog::marginHintSmall() ); -// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; -// groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); -// boxLayout->setSpacing( KDialog::spacingHintSmall() ); - - mEmailClient = new QComboBox( groupBox ); - mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI ); - mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA ); - mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE ); - mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER ); - boxLayout->addWidget( mEmailClient ); - - connect( mEmailClient, SIGNAL( activated( int ) ), - this, SLOT (emailclient_changed( int ) ) ); - - QLabel* lab = new QLabel( i18n("Channel:"), groupBox); - boxLayout->addWidget( lab ); - mEmailChannel = new QLineEdit(groupBox); - mEmailChannel->setReadOnly(true); - boxLayout->addWidget( mEmailChannel ); - - layout->addWidget( groupBox ); - tabWidget->addTab( mailclientPage, i18n( "Mail" ) ); - - - } - -void KABConfigWidget::emailclient_changed( int newClient ) +void KABConfigWidget::restoreSettings(KABPrefs* prefs) { - if (newClient == KABPrefs::OTHER) - mEmailChannel->setReadOnly(false); - else - mEmailChannel->setReadOnly(true); - - QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); - QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); - - if (opiepath.isEmpty()) - opiepath = qtopiapath; - - QString text = mEmailChannel->text(); - - if (newClient == KABPrefs::OPIE) - { - if ( QFile::exists( opiepath + "/bin/opiemail" )) - text = "QPE/Application/opiemail"; - else - text = "FILENOTFOUND: " + opiepath + "/bin/opiemail"; - } - else if (newClient == KABPrefs::QTOPIA) - { - if ( QFile::exists( qtopiapath + "/bin/qtmail" )) - text = "QPE/Application/qtmail"; - else - text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail"; +//US prefs was KABPrefs::instance() before - } - else if (newClient == KABPrefs::OMPI) - { - if ( QFile::exists( qtopiapath + "/bin/ompi" )) - text = "QPE/Application/ompi"; - else if ( QFile::exists( opiepath + "/bin/ompi" )) - text = "QPE/Application/ompi"; - else - text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi"; - - } - else - { - //do nothing if we choosed other - } - - mEmailChannel->setText( text ); - - -} - - -void KABConfigWidget::restoreSettings() -{ bool blocked = signalsBlocked(); blockSignals( true ); - mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); - mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); - - mEmailChannel->setText( KABPrefs::instance()->mEmailChannel ); - mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient); + mNameParsing->setChecked( prefs->mAutomaticNameParsing ); + mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); mAddresseeWidget->restoreSettings(); @@ -262,13 +175,10 @@ void KABConfigWidget::restoreSettings() emit changed( false ); } -void KABConfigWidget::saveSettings() +void KABConfigWidget::saveSettings(KABPrefs* prefs) { - KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); - KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); - - KABPrefs::instance()->mEmailClient = mEmailClient->currentItem(); - KABPrefs::instance()->mEmailChannel = mEmailChannel->text(); + prefs->mAutomaticNameParsing = mNameParsing->isChecked(); + prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); mAddresseeWidget->saveSettings(); @@ -278,15 +188,11 @@ void KABConfigWidget::saveSettings() emit changed( false ); } -void KABConfigWidget::defaults() +void KABConfigWidget::defaults(KABPrefs* prefs) { mNameParsing->setChecked( true ); mViewsSingleClickBox->setChecked( false ); - mEmailClient->setCurrentItem(KABPrefs::OMPI); - emailclient_changed( KABPrefs::OMPI ); - - emit changed( true ); } -- cgit v0.9.0.2