diff --git a/src/collectionpage/collectionexpirywidget.cpp b/src/collectionpage/collectionexpirywidget.cpp index 8cdae8d..5bd236a 100644 --- a/src/collectionpage/collectionexpirywidget.cpp +++ b/src/collectionpage/collectionexpirywidget.cpp @@ -18,55 +18,68 @@ #include #include #include +#include #include +#include #include #include -#include using namespace MailCommon; -CollectionExpiryWidget::CollectionExpiryWidget(QWidget *parent) - : QWidget(parent) +class DaysSpinBox : public KPluralHandlingSpinBox { - auto globalVBox = new QVBoxLayout(this); - globalVBox->setContentsMargins({}); +public: + DaysSpinBox(QWidget *parent) + : KPluralHandlingSpinBox(parent) + { + setMaximum(999999); + setSuffix(ki18ncp("Expire messages after %1", " day", " days")); + setSpecialValueText(i18n("Never")); + } + + QString textFromValue(int value) const override + { + if (value == 0) { + return i18n("Never"); + } + return KPluralHandlingSpinBox::textFromValue(value); + } - auto daysBox = new QGridLayout; + int valueFromText(const QString &text) const override + { + return KPluralHandlingSpinBox::valueFromText(text); + } - mExpireReadMailCB = new QCheckBox(i18n("Expire read messages after"), this); - connect(mExpireReadMailCB, &QCheckBox::toggled, this, &CollectionExpiryWidget::slotUpdateControls); - daysBox->addWidget(mExpireReadMailCB, 0, 0); + QValidator::State validate(QString &text, int &pos) const override + { + if (text == i18n("Never")) { + return QValidator::Acceptable; + } + return KPluralHandlingSpinBox::validate(text, pos); + } +}; - mExpireReadMailSB = new KPluralHandlingSpinBox(this); - mExpireReadMailSB->setMaximum(999999); - mExpireReadMailSB->setValue(30); - mExpireReadMailSB->setSuffix(ki18ncp("Expire messages after %1", " day", " days")); - daysBox->addWidget(mExpireReadMailSB, 0, 1); - connect(mExpireReadMailSB, QOverload::of(&KPluralHandlingSpinBox::valueChanged), this, &CollectionExpiryWidget::slotChanged); +CollectionExpiryWidget::CollectionExpiryWidget(QWidget *parent) + : QWidget(parent) +{ + auto formLayout = new QFormLayout(this); + formLayout->setContentsMargins({}); - mExpireUnreadMailCB = new QCheckBox(i18n("Expire unread messages after"), this); - connect(mExpireUnreadMailCB, &QCheckBox::toggled, this, &CollectionExpiryWidget::slotUpdateControls); - daysBox->addWidget(mExpireUnreadMailCB, 1, 0); + mExpireReadMailSB = new DaysSpinBox(this); + connect(mExpireReadMailSB, qOverload(&KPluralHandlingSpinBox::valueChanged), this, &CollectionExpiryWidget::slotChanged); + formLayout->addRow(i18n("Expire read messages after:"), mExpireReadMailSB); - mExpireUnreadMailSB = new KPluralHandlingSpinBox(this); - mExpireUnreadMailSB->setMaximum(99999); - mExpireUnreadMailSB->setValue(30); - mExpireUnreadMailSB->setSuffix(ki18ncp("Expire messages after %1", " day", " days")); - daysBox->addWidget(mExpireUnreadMailSB, 1, 1); - connect(mExpireUnreadMailSB, QOverload::of(&KPluralHandlingSpinBox::valueChanged), this, &CollectionExpiryWidget::slotChanged); + mExpireUnreadMailSB = new DaysSpinBox(this); + connect(mExpireUnreadMailSB, qOverload(&KPluralHandlingSpinBox::valueChanged), this, &CollectionExpiryWidget::slotChanged); + formLayout->addRow(i18n("Expire unread messages after:"), mExpireUnreadMailSB); mExpireMailWithInvalidDateCB = new QCheckBox(i18n("Expire messages with invalid date"), this); connect(mExpireMailWithInvalidDateCB, &QCheckBox::toggled, this, &CollectionExpiryWidget::slotChanged); - daysBox->addWidget(mExpireMailWithInvalidDateCB, 2, 0); - - daysBox->setColumnStretch(3, 1); - globalVBox->addLayout(daysBox); - - globalVBox->addSpacing(30); + formLayout->addRow(QString(), mExpireMailWithInvalidDateCB); auto actionsGroup = new QGroupBox(this); actionsGroup->setFlat(true); // for mutual exclusion of the radio buttons - globalVBox->addWidget(actionsGroup); + formLayout->addRow(actionsGroup); auto moveToHBox = new QHBoxLayout(); moveToHBox->setContentsMargins(0, 0, 0, 0); @@ -74,31 +87,28 @@ CollectionExpiryWidget::CollectionExpiryWidget(QWidget *parent) mMoveToRB = new QRadioButton(actionsGroup); mMoveToRB->setText(i18n("Move expired messages to:")); - connect(mMoveToRB, &QRadioButton::toggled, this, &CollectionExpiryWidget::slotUpdateControls); + connect(mMoveToRB, &QRadioButton::toggled, this, &CollectionExpiryWidget::slotChanged); moveToHBox->addWidget(mMoveToRB); mFolderSelector = new FolderRequester(this); mFolderSelector->setMustBeReadWrite(true); mFolderSelector->setShowOutbox(false); moveToHBox->addWidget(mFolderSelector); - globalVBox->addLayout(moveToHBox); + formLayout->addRow(QString(), moveToHBox); connect(mFolderSelector, &FolderRequester::folderChanged, this, &CollectionExpiryWidget::slotChanged); mDeletePermanentlyRB = new QRadioButton(actionsGroup); mDeletePermanentlyRB->setText(i18n("Delete expired messages permanently")); - connect(mDeletePermanentlyRB, &QRadioButton::toggled, this, &CollectionExpiryWidget::slotUpdateControls); - - globalVBox->addWidget(mDeletePermanentlyRB); + connect(mDeletePermanentlyRB, &QRadioButton::toggled, this, &CollectionExpiryWidget::slotChanged); - globalVBox->addSpacing(30); + formLayout->addRow(QString(), mDeletePermanentlyRB); mExpireNowPB = new QPushButton(i18n("Save Settings and Expire Now"), this); connect(mExpireNowPB, &QPushButton::clicked, this, &CollectionExpiryWidget::saveAndExpireRequested); - globalVBox->addWidget(mExpireNowPB, 0, Qt::AlignRight); + formLayout->addRow(QString(), mExpireNowPB); - globalVBox->addStretch(100); // eat all superfluous space mDeletePermanentlyRB->setChecked(true); - slotUpdateControls(); + slotChanged(); } CollectionExpiryWidget::~CollectionExpiryWidget() @@ -112,19 +122,10 @@ void CollectionExpiryWidget::hideExpireNowButton() void CollectionExpiryWidget::slotChanged() { - Q_EMIT configChanged(); -} - -void CollectionExpiryWidget::slotUpdateControls() -{ - const bool showExpiryActions = mExpireReadMailCB->isChecked() || mExpireUnreadMailCB->isChecked(); + const bool showExpiryActions = mExpireReadMailSB->value() != 0 || mExpireUnreadMailSB->value() != 0; mMoveToRB->setEnabled(showExpiryActions); mFolderSelector->setEnabled(showExpiryActions && mMoveToRB->isChecked()); mDeletePermanentlyRB->setEnabled(showExpiryActions); - - mExpireReadMailSB->setEnabled(mExpireReadMailCB->isChecked()); - mExpireUnreadMailSB->setEnabled(mExpireUnreadMailCB->isChecked()); - mExpireNowPB->setEnabled(showExpiryActions); Q_EMIT configChanged(); @@ -135,12 +136,14 @@ void CollectionExpiryWidget::load(const MailCommon::CollectionExpirySettings &se if (settings.isValid()) { bool expiryGloballyOn = settings.expiryGloballyOn; if (expiryGloballyOn && settings.mReadExpireUnits != ExpireCollectionAttribute::ExpireNever && settings.daysToExpireRead >= 0) { - mExpireReadMailCB->setChecked(true); mExpireReadMailSB->setValue(settings.daysToExpireRead); + } else { + mExpireReadMailSB->setValue(0); } if (expiryGloballyOn && settings.mUnreadExpireUnits != ExpireCollectionAttribute::ExpireNever && settings.daysToExpireUnread >= 0) { - mExpireUnreadMailCB->setChecked(true); mExpireUnreadMailSB->setValue(settings.daysToExpireUnread); + } else { + mExpireUnreadMailSB->setValue(0); } if (settings.mExpireAction == ExpireCollectionAttribute::ExpireDelete) { @@ -160,12 +163,12 @@ void CollectionExpiryWidget::load(const MailCommon::CollectionExpirySettings &se } else { mDeletePermanentlyRB->setChecked(true); } - slotUpdateControls(); + slotChanged(); } bool CollectionExpiryWidget::validateExpireFolder(bool expireNow) { - const bool enableGlobally = mExpireReadMailCB->isChecked() || mExpireUnreadMailCB->isChecked(); + const bool enableGlobally = mExpireReadMailSB->value() != 0 || mExpireUnreadMailSB->value() != 0; const Akonadi::Collection expireToFolder = mFolderSelector->collection(); if (enableGlobally && mMoveToRB->isChecked() && !expireToFolder.isValid()) { KMessageBox::error(this, @@ -203,15 +206,15 @@ MailCommon::ExpireCollectionAttribute *CollectionExpiryWidget::assignFolderAttri CollectionExpirySettings CollectionExpiryWidget::settings() const { CollectionExpirySettings settings; - settings.expiryGloballyOn = mExpireReadMailCB->isChecked() || mExpireUnreadMailCB->isChecked(); + settings.expiryGloballyOn = mExpireReadMailSB->value() != 0 || mExpireUnreadMailSB->value() != 0; settings.expiryMessagesWithInvalidDate = mExpireMailWithInvalidDateCB->isChecked(); // we always write out days now settings.daysToExpireRead = mExpireReadMailSB->value(); settings.daysToExpireUnread = mExpireUnreadMailSB->value(); settings.mReadExpireUnits = - mExpireReadMailCB->isChecked() ? MailCommon::ExpireCollectionAttribute::ExpireDays : MailCommon::ExpireCollectionAttribute::ExpireNever; + mExpireReadMailSB->value() != 0 ? MailCommon::ExpireCollectionAttribute::ExpireDays : MailCommon::ExpireCollectionAttribute::ExpireNever; settings.mUnreadExpireUnits = - mExpireUnreadMailCB->isChecked() ? MailCommon::ExpireCollectionAttribute::ExpireDays : MailCommon::ExpireCollectionAttribute::ExpireNever; + mExpireUnreadMailSB->value() != 0 ? MailCommon::ExpireCollectionAttribute::ExpireDays : MailCommon::ExpireCollectionAttribute::ExpireNever; if (mDeletePermanentlyRB->isChecked()) { settings.mExpireAction = ExpireCollectionAttribute::ExpireDelete; diff --git a/src/collectionpage/collectionexpirywidget.h b/src/collectionpage/collectionexpirywidget.h index 9124f25..61710ea 100644 --- a/src/collectionpage/collectionexpirywidget.h +++ b/src/collectionpage/collectionexpirywidget.h @@ -57,10 +57,7 @@ private: Q_REQUIRED_RESULT bool validateExpireFolder(bool expireNow); Q_REQUIRED_RESULT MailCommon::ExpireCollectionAttribute *assignFolderAttribute(Akonadi::Collection &collection, bool &expireNow); void slotChanged(); - void slotUpdateControls(); - QCheckBox *mExpireReadMailCB = nullptr; KPluralHandlingSpinBox *mExpireReadMailSB = nullptr; - QCheckBox *mExpireUnreadMailCB = nullptr; KPluralHandlingSpinBox *mExpireUnreadMailSB = nullptr; QRadioButton *mMoveToRB = nullptr; FolderRequester *mFolderSelector = nullptr; diff --git a/src/collectionpage/collectiongeneralpage.cpp b/src/collectionpage/collectiongeneralpage.cpp index 2c95863..83f62e2 100644 --- a/src/collectionpage/collectiongeneralpage.cpp +++ b/src/collectionpage/collectiongeneralpage.cpp @@ -31,6 +31,8 @@ #include #include +#include +#include #include #include #include @@ -59,23 +61,18 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection) auto topLayout = new QVBoxLayout(this); + mCollectionGeneralWidget = new CollectionGeneralWidget(this); + topLayout->addWidget(mCollectionGeneralWidget); + auto innerLayout = qobject_cast(mCollectionGeneralWidget->layout()); + // Mustn't be able to edit details for a non-resource, system folder. if ((!mIsLocalSystemFolder || mIsResourceFolder) && !mFolderCollection->isReadOnly()) { - auto hl = new QHBoxLayout(); - topLayout->addItem(hl); - label = new QLabel(i18nc("@label:textbox Name of the folder.", "&Name:"), this); - hl->addWidget(label); - mNameEdit = new QLineEdit(this); new KPIM::LineEditCatchReturnKey(mNameEdit, this); - connect(mNameEdit, &QLineEdit::textChanged, this, &CollectionGeneralPage::slotNameChanged); - label->setBuddy(mNameEdit); - hl->addWidget(mNameEdit); + innerLayout->insertRow(0, i18nc("@label:textbox Name of the folder.", "Folder &Name:"), mNameEdit); } - mCollectionGeneralWidget = new CollectionGeneralWidget(this); - topLayout->addWidget(mCollectionGeneralWidget); // Only do make this settable, if the IMAP resource is enabled // and it's not the personal folders (those must not be changed) const QString collectionResource = collection.resource(); @@ -95,11 +92,8 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection) const PimCommon::CollectionTypeUtil::FolderContentsType folderType = collectionUtil.typeFromKolabName(annotations.value(PimCommon::CollectionTypeUtil::kolabFolderType())); - int row = 0; - auto gl = new QGridLayout(); - topLayout->addItem(gl); mContentsComboBox = new PimCommon::ContentTypeWidget(this); - gl->addWidget(mContentsComboBox, row, 0, 1, 2); + innerLayout->addRow(PimCommon::ContentTypeWidget::labelName(), mContentsComboBox); mContentsComboBox->setCurrentIndex(contentsType); connect(mContentsComboBox, &PimCommon::ContentTypeWidget::activated, this, &CollectionGeneralPage::slotFolderContentsSelectionChanged); @@ -113,23 +107,22 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection) // or if it's set to calendar or task (existing folder) const bool folderTypeComboboxEnabled = (folderType == PimCommon::CollectionTypeUtil::ContentsTypeCalendar || folderType == PimCommon::CollectionTypeUtil::ContentsTypeTask); - ++row; - mIncidencesForComboBox = new PimCommon::IncidencesForWidget(this); - gl->addWidget(mIncidencesForComboBox, row, 0, 1, 2); + if (folderTypeComboboxEnabled) { + mIncidencesForComboBox = new PimCommon::IncidencesForWidget(this); + innerLayout->addRow(PimCommon::IncidencesForWidget::labelName(), mIncidencesForComboBox); - mIncidencesForComboBox->setCurrentIndex(incidencesFor); - mIncidencesForComboBox->setEnabled(folderTypeComboboxEnabled); + mIncidencesForComboBox->setCurrentIndex(incidencesFor); + } mSharedSeenFlagsCheckBox = new QCheckBox(this); mSharedSeenFlagsCheckBox->setText(i18n("Share unread state with all users")); mSharedSeenFlagsCheckBox->setChecked(sharedSeen); - ++row; - gl->addWidget(mSharedSeenFlagsCheckBox, row, 0, 1, 1); mSharedSeenFlagsCheckBox->setWhatsThis( i18n("If enabled, the unread state of messages in this folder will be " "the same for all users having access to this folder. If disabled " "(the default), every user with access to this folder has their " "own unread state.")); + innerLayout->addRow(QString(), mSharedSeenFlagsCheckBox); } topLayout->addStretch(100); // eat all superfluous space diff --git a/src/collectionpage/collectiongeneralwidget.cpp b/src/collectionpage/collectiongeneralwidget.cpp index ce4d30d..3174320 100644 --- a/src/collectionpage/collectiongeneralwidget.cpp +++ b/src/collectionpage/collectiongeneralwidget.cpp @@ -12,20 +12,18 @@ #include #include #include +#include #include #include -#include using namespace MailCommon; CollectionGeneralWidget::CollectionGeneralWidget(QWidget *parent) : QWidget(parent) { - auto topLayout = new QVBoxLayout(this); + auto topLayout = new QFormLayout(this); topLayout->setObjectName(QStringLiteral("topLayout")); topLayout->setContentsMargins({}); // should new mail in this folder be ignored? - auto hbl = new QHBoxLayout(); - topLayout->addItem(hbl); mNotifyOnNewMailCheckBox = new QCheckBox(i18n("Act on new/unread mail in this folder"), this); mNotifyOnNewMailCheckBox->setWhatsThis( i18n("

If this option is enabled then you will be notified about " @@ -37,46 +35,29 @@ CollectionGeneralWidget::CollectionGeneralWidget(QWidget *parent) "be skipped when going to the next/previous folder with unread " "messages. This is useful for ignoring any new/unread mail in " "your trash and spam folder.

")); - hbl->addWidget(mNotifyOnNewMailCheckBox); + topLayout->addRow(QString(), mNotifyOnNewMailCheckBox); // should replies to mails in this folder be kept in this same folder? - hbl = new QHBoxLayout(); - topLayout->addItem(hbl); mKeepRepliesInSameFolderCheckBox = new QCheckBox(i18n("Keep replies in this folder"), this); mKeepRepliesInSameFolderCheckBox->setWhatsThis( i18n("Check this option if you want replies you write " "to mails in this folder to be put in this same folder " "after sending, instead of in the configured sent-mail folder.")); - hbl->addWidget(mKeepRepliesInSameFolderCheckBox); - hbl->addStretch(1); + topLayout->addRow(QString(), mKeepRepliesInSameFolderCheckBox); + // should this folder be shown in the folder selection dialog? - hbl = new QHBoxLayout(); - topLayout->addItem(hbl); mHideInSelectionDialogCheckBox = new QCheckBox(i18n("Hide this folder in the folder selection dialog"), this); mHideInSelectionDialogCheckBox->setWhatsThis(xi18nc("@info:whatsthis", "Check this option if you do not want this folder " "to be shown in folder selection dialogs, such as the " "Jump to Folder dialog.")); - hbl->addWidget(mHideInSelectionDialogCheckBox); - hbl->addStretch(1); - - addLine(this, topLayout); - // use grid layout for the following combobox settings - auto gl = new QGridLayout(); - topLayout->addItem(gl); - gl->setColumnStretch(1, 100); // make the second column use all available space - int row = -1; + topLayout->addRow(QString(), mHideInSelectionDialogCheckBox); // sender identity - ++row; mUseDefaultIdentityCheckBox = new QCheckBox(i18n("Use &default identity"), this); - gl->addWidget(mUseDefaultIdentityCheckBox); + topLayout->addRow(QString(), mUseDefaultIdentityCheckBox); connect(mUseDefaultIdentityCheckBox, &QCheckBox::stateChanged, this, &CollectionGeneralWidget::slotIdentityCheckboxChanged); - ++row; - auto label = new QLabel(i18n("&Sender identity:"), this); - gl->addWidget(label, row, 0); + mIdentityComboBox = new KIdentityManagement::IdentityCombo(KernelIf->identityManager(), this); - label->setBuddy(mIdentityComboBox); - gl->addWidget(mIdentityComboBox, row, 1); mIdentityComboBox->setWhatsThis( i18n("Select the sender identity to be used when writing new mail " "or replying to mail in this folder. This means that if you are in " @@ -84,22 +65,13 @@ CollectionGeneralWidget::CollectionGeneralWidget(QWidget *parent) "sender email address, signature and signing or encryption keys " "automatically. Identities can be set up in the main configuration " "dialog. (Settings -> Configure KMail)")); + topLayout->addRow(i18n("&Sender identity:"), mIdentityComboBox); } CollectionGeneralWidget::~CollectionGeneralWidget() { } -void CollectionGeneralWidget::addLine(QWidget *parent, QVBoxLayout *layout) -{ - auto line = new QFrame(parent); - line->setGeometry(QRect(80, 150, 250, 20)); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - line->setFrameShape(QFrame::HLine); - layout->addWidget(line); -} - void CollectionGeneralWidget::slotIdentityCheckboxChanged() { mIdentityComboBox->setEnabled(!mUseDefaultIdentityCheckBox->isChecked()); diff --git a/src/collectionpage/collectiongeneralwidget.h b/src/collectionpage/collectiongeneralwidget.h index d809dc7..ef463ab 100644 --- a/src/collectionpage/collectiongeneralwidget.h +++ b/src/collectionpage/collectiongeneralwidget.h @@ -11,7 +11,7 @@ #include #include class QCheckBox; -class QVBoxLayout; +class QFormLayout; namespace KIdentityManagement { class IdentityCombo; @@ -29,7 +29,6 @@ public: void load(const Akonadi::Collection &col); private: - void addLine(QWidget *parent, QVBoxLayout *layout); void slotIdentityCheckboxChanged(); QCheckBox *mNotifyOnNewMailCheckBox = nullptr; QCheckBox *mKeepRepliesInSameFolderCheckBox = nullptr; diff --git a/src/collectionpage/collectionviewwidget.cpp b/src/collectionpage/collectionviewwidget.cpp index aead1e3..3d9f02b 100644 --- a/src/collectionpage/collectionviewwidget.cpp +++ b/src/collectionpage/collectionviewwidget.cpp @@ -7,6 +7,7 @@ #include "collectionviewwidget.h" #include "mailcommon_debug.h" #include +#include #include #include @@ -26,86 +27,62 @@ using namespace MailCommon; CollectionViewWidget::CollectionViewWidget(QWidget *parent) : QWidget(parent) { - auto topLayout = new QVBoxLayout(this); + auto topLayout = new QFormLayout(this); topLayout->setObjectName(QStringLiteral("topLayout")); topLayout->setContentsMargins({}); // sender or receiver column const QString senderReceiverColumnTip = i18n("Show Sender/Receiver Column in List of Messages"); - auto senderReceiverColumnLabel = new QLabel(i18n("Sho&w column:"), this); mShowSenderReceiverComboBox = new QComboBox(this); mShowSenderReceiverComboBox->setToolTip(senderReceiverColumnTip); - senderReceiverColumnLabel->setBuddy(mShowSenderReceiverComboBox); mShowSenderReceiverComboBox->insertItem(0, i18nc("@item:inlistbox Show default value.", "Default")); mShowSenderReceiverComboBox->insertItem(1, i18nc("@item:inlistbox Show sender.", "Sender")); mShowSenderReceiverComboBox->insertItem(2, i18nc("@item:inlistbox Show receiver.", "Receiver")); - - auto senderReceiverColumnHLayout = new QHBoxLayout(); - senderReceiverColumnHLayout->addWidget(senderReceiverColumnLabel); - senderReceiverColumnHLayout->addWidget(mShowSenderReceiverComboBox); - topLayout->addLayout(senderReceiverColumnHLayout); - - // message list - auto messageListGroup = new QGroupBox(i18n("Message List"), this); - auto messageListGroupLayout = new QVBoxLayout(messageListGroup); - topLayout->addWidget(messageListGroup); + topLayout->addRow(i18n("Sho&w column:"), mShowSenderReceiverComboBox); // message list aggregation - mUseDefaultAggregationCheckBox = new QCheckBox(i18n("Use default aggregation"), messageListGroup); - messageListGroupLayout->addWidget(mUseDefaultAggregationCheckBox); + mUseDefaultAggregationCheckBox = new QCheckBox(i18n("Use default message list aggregation:"), this); connect(mUseDefaultAggregationCheckBox, &QCheckBox::stateChanged, this, &CollectionViewWidget::slotAggregationCheckboxChanged); + topLayout->addRow(QString(), mUseDefaultAggregationCheckBox); - mAggregationComboBox = new MessageList::Utils::AggregationComboBox(messageListGroup); - - auto aggregationLabel = new QLabel(i18n("Aggregation"), messageListGroup); - aggregationLabel->setBuddy(mAggregationComboBox); + mAggregationComboBox = new MessageList::Utils::AggregationComboBox(this); using MessageList::Utils::AggregationConfigButton; - auto aggregationConfigButton = new AggregationConfigButton(messageListGroup, mAggregationComboBox); + auto aggregationConfigButton = new AggregationConfigButton(this, mAggregationComboBox); // Make sure any changes made in the aggregations configure dialog are reflected in the combo. connect(aggregationConfigButton, &AggregationConfigButton::configureDialogCompleted, this, &CollectionViewWidget::slotSelectFolderAggregation); - auto aggregationLayout = new QHBoxLayout(); - aggregationLayout->addWidget(aggregationLabel, 1); + auto aggregationLayout = new QHBoxLayout; aggregationLayout->addWidget(mAggregationComboBox, 1); aggregationLayout->addWidget(aggregationConfigButton, 0); - messageListGroupLayout->addLayout(aggregationLayout); + topLayout->addRow(QString(), aggregationLayout); // message list theme - mUseDefaultThemeCheckBox = new QCheckBox(i18n("Use default theme"), messageListGroup); - messageListGroupLayout->addWidget(mUseDefaultThemeCheckBox); + mUseDefaultThemeCheckBox = new QCheckBox(i18n("Use default message list theme"), this); connect(mUseDefaultThemeCheckBox, &QCheckBox::stateChanged, this, &CollectionViewWidget::slotThemeCheckboxChanged); + topLayout->addRow(QString(), mUseDefaultThemeCheckBox); - mThemeComboBox = new MessageList::Utils::ThemeComboBox(messageListGroup); - - auto themeLabel = new QLabel(i18n("Theme"), messageListGroup); - themeLabel->setBuddy(mThemeComboBox); + mThemeComboBox = new MessageList::Utils::ThemeComboBox(this); using MessageList::Utils::ThemeConfigButton; - auto themeConfigButton = new ThemeConfigButton(messageListGroup, mThemeComboBox); + auto themeConfigButton = new ThemeConfigButton(this, mThemeComboBox); // Make sure any changes made in the themes configure dialog are reflected in the combo. connect(themeConfigButton, &ThemeConfigButton::configureDialogCompleted, this, &CollectionViewWidget::slotSelectFolderTheme); - auto themeLayout = new QHBoxLayout(); - themeLayout->addWidget(themeLabel, 1); + auto themeLayout = new QHBoxLayout; themeLayout->addWidget(mThemeComboBox, 1); themeLayout->addWidget(themeConfigButton, 0); - messageListGroupLayout->addLayout(themeLayout); + topLayout->addRow(QString(), themeLayout); // Message Default Format - auto messageFormatGroup = new QGroupBox(i18n("Message Default Format"), this); - auto messageFormatGroupLayout = new QVBoxLayout(messageFormatGroup); mPreferHtmlToText = new QRadioButton(i18n("Prefer HTML to text"), this); - messageFormatGroupLayout->addWidget(mPreferHtmlToText); + topLayout->addRow(i18n("Message format:"), mPreferHtmlToText); mPreferTextToHtml = new QRadioButton(i18n("Prefer text to HTML"), this); - messageFormatGroupLayout->addWidget(mPreferTextToHtml); + topLayout->addRow(QString(), mPreferTextToHtml); mUseGlobalSettings = new QRadioButton(i18n("Use Global Settings"), this); - messageFormatGroupLayout->addWidget(mUseGlobalSettings); - - topLayout->addWidget(messageFormatGroup); + topLayout->addRow(QString(), mUseGlobalSettings); - topLayout->addStretch(100); } CollectionViewWidget::~CollectionViewWidget()