author | zautrix <zautrix> | 2004-10-19 10:52:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 10:52:21 (UTC) |
commit | 4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69 (patch) (side-by-side diff) | |
tree | 8213284e178e82b6ab3a41bae1ef81379704379f /libkdepim | |
parent | b5d1458a283b624980ec64b10b3f7ec1168fc659 (diff) | |
download | kdepimpi-4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69.zip kdepimpi-4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69.tar.gz kdepimpi-4f780ff70bc13bf9cb7e7c33f869a59dfcc36e69.tar.bz2 |
fixed layout problems in config widgets
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 332f975..6de60fa 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp @@ -68,334 +68,344 @@ $Id$ #include <mergewidget.h> #include <distributionlistwidget.h> #endif // KAB_EMBEDDED #include "addresseewidget.h" #include "extensionconfigdialog.h" #include "extensionwidget.h" */ #include "qapplication.h" #include "kpimglobalprefs.h" #include "kdepimconfigwidget.h" KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) : KPrefsWidget(prefs, parent, name ) { mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); tabWidget = new QTabWidget( this ); topLayout->addWidget( tabWidget ); setupLocaleTab(); setupLocaleDateTab(); setupTimeZoneTab(); setupExternalAppTab(); } void KDEPIMConfigWidget::showTimeZoneTab() { tabWidget->setCurrentPage ( 2 ) ; } void KDEPIMConfigWidget::setupExternalAppTab() { QWidget *externalAppsPage = new QWidget( this ); QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); mExternalApps = new QComboBox( externalAppsPage ); QMap<ExternalAppHandler::Types, QString>::Iterator it; for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) mExternalApps->insertItem( it.data(), it.key() ); layout->addWidget( mExternalApps ); connect( mExternalApps, SIGNAL( activated( int ) ), this, SLOT (externalapp_changed( int ) ) ); mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); - + mExternalAppGroupBox->layout()->setMargin(5); mClient = new QComboBox( mExternalAppGroupBox ); boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); connect( mClient, SIGNAL( activated( int ) ), this, SLOT (client_changed( int ) ) ); QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 1, 0 ); mChannel = new QLineEdit(mExternalAppGroupBox); mChannel->setReadOnly(true); boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 3, 0 ); mMessage = new QLineEdit(mExternalAppGroupBox); mMessage->setReadOnly(true); boxLayout->addWidget( mMessage , 4, 0); lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 3, 1 ); mParameters = new QLineEdit(mExternalAppGroupBox); mParameters->setReadOnly(true); boxLayout->addWidget( mParameters, 4, 1 ); lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); + lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 6, 0 ); mMessage2 = new QLineEdit(mExternalAppGroupBox); mMessage2->setReadOnly(true); boxLayout->addWidget( mMessage2 , 7, 0); lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); boxLayout->addWidget( lab, 6, 1 ); mParameters2 = new QLineEdit(mExternalAppGroupBox); mParameters2->setReadOnly(true); boxLayout->addWidget( mParameters2, 7, 1 ); lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); layout->addWidget( mExternalAppGroupBox ); tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); } void KDEPIMConfigWidget::setupLocaleDateTab() { QWidget *topFrame = new QWidget( this ); QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); - topLayout->setSpacing(KDialog::spacingHint()); - topLayout->setMargin(KDialog::marginHint()); + topLayout->setSpacing(KDialog::spacingHintSmall()); + topLayout->setMargin(KDialog::marginHintSmall()); int iii = 0; KPrefsWidRadios *syncPrefsGroup = addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); QString format; if ( QApplication::desktop()->width() < 480 ) format = "(%d.%m.%Y)"; else format = "(%d.%m.%Y|%A %d %B %Y)"; syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); if ( QApplication::desktop()->width() < 480 ) format = "(%m.%d.%Y)"; else format = "(%m.%d.%Y|%A %B %d %Y)"; syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); if ( QApplication::desktop()->width() < 480 ) format = "(%Y-%m-%d)"; else format = "(%Y-%m-%d|%A %Y %B %d)"; syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); syncPrefsGroup->addRadio(i18n("User defined")); + if ( QApplication::desktop()->width() < 480 ) { + syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); + syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); + } topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); ++iii; ++iii; QLabel * lab; mUserDateFormatLong = new QLineEdit(topFrame); lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mUserDateFormatLong,iii,1); ++iii; mUserDateFormatShort = new QLineEdit(topFrame); lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mUserDateFormatShort,iii,1); ++iii; lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); tabWidget->addTab( topFrame, i18n( "Date Format" ) ); } void KDEPIMConfigWidget::setupLocaleTab() { QWidget *topFrame = new QWidget( this ); QGridLayout *topLayout = new QGridLayout(topFrame,4,2); topLayout->setSpacing(KDialog::spacingHint()); topLayout->setMargin(KDialog::marginHint()); int iii = 0; KPrefsWidRadios *syncPrefsGroup = addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); syncPrefsGroup->addRadio(i18n("English")); syncPrefsGroup->addRadio(i18n("German")); syncPrefsGroup->addRadio(i18n("French")); syncPrefsGroup->addRadio(i18n("Italian")); syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); - if ( QApplication::desktop()->width() < 300 ) - ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + if ( QApplication::desktop()->width() < 300 ) { + syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); + syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); + } topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); ++iii; syncPrefsGroup = addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); if ( QApplication::desktop()->width() > 300 ) syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); syncPrefsGroup->addRadio(i18n("24:00")); syncPrefsGroup->addRadio(i18n("12:00am")); syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); ++iii; KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); ++iii; tabWidget->addTab( topFrame, i18n( "Locale" ) ); } void KDEPIMConfigWidget::setupTimeZoneTab() { QWidget *topFrame = new QWidget( this ); QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); - topLayout->setSpacing(KDialog::spacingHint()); - topLayout->setMargin(KDialog::marginHint()); + topLayout->setSpacing(KDialog::spacingHintSmall()); + topLayout->setMargin(KDialog::marginHintSmall()); QHBox *timeZoneBox = new QHBox( topFrame ); topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); new QLabel( i18n("Timezone:"), timeZoneBox ); mTimeZoneCombo = new QComboBox( timeZoneBox ); if ( QApplication::desktop()->width() < 300 ) { mTimeZoneCombo->setMaximumWidth(150); } QStringList list; list = KGlobal::locale()->timeZoneList(); mTimeZoneCombo->insertStringList(list); // find the currently set time zone and select it QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; int nCurrentlySet = 11; for (int i = 0; i < mTimeZoneCombo->count(); i++) { if (mTimeZoneCombo->text(i) == sCurrentlySet) { nCurrentlySet = i; break; } } mTimeZoneCombo->setCurrentItem(nCurrentlySet); int iii = 1; KPrefsWidBool *sb = addWidBool(i18n("Add 30 min (+00:30) to selected Timezone"), &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); ++iii; sb = addWidBool(i18n("Timezone has daylight saving"), &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); - ++iii; - QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); + ++iii; + QLabel* lab; + + lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); topLayout->addMultiCellWidget(lab, iii,iii,0,1); - ++iii; + ++iii; + lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); topLayout->addMultiCellWidget(lab, iii,iii,0,1); ++iii; lab = new QLabel( i18n("Daylight start:"), topFrame ); topLayout->addWidget(lab, iii,0); mStartDateSavingEdit = new KDateEdit(topFrame); topLayout->addWidget(mStartDateSavingEdit, iii,1); ++iii; lab = new QLabel( i18n("Daylight end:"), topFrame ); topLayout->addWidget(lab, iii,0); mEndDateSavingEdit = new KDateEdit(topFrame); topLayout->addWidget(mEndDateSavingEdit, iii,1); ++iii; QDate current ( 2001, 1,1); mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); } void KDEPIMConfigWidget::externalapp_changed( int newApp ) { // first store the current data saveEditFieldSettings(); // set mCurrentApp mCurrentApp = (ExternalAppHandler::Types)newApp; // set mCurrentClient switch(mCurrentApp) { case(ExternalAppHandler::EMAIL): mCurrentClient = mEmailClient; break; case(ExternalAppHandler::PHONE): mCurrentClient = mPhoneClient; break; case(ExternalAppHandler::SMS): mCurrentClient = mSMSClient; break; case(ExternalAppHandler::FAX): mCurrentClient = mFaxClient; break; case(ExternalAppHandler::PAGER): mCurrentClient = mPagerClient; break; case(ExternalAppHandler::SIP): mCurrentClient = mSipClient; break; default: return; } // and at last update the widgets updateClientWidgets(); } |