File indexing completed on 2025-01-19 04:46:52
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "dkimgeneralwidget.h" 0008 #include <KLocalizedString> 0009 #include <MessageViewer/DKIMManager> 0010 #include <MessageViewer/MessageViewerSettings> 0011 #include <QCheckBox> 0012 #include <QComboBox> 0013 #include <QLabel> 0014 #include <QVBoxLayout> 0015 0016 DKIMGeneralWidget::DKIMGeneralWidget(QWidget *parent) 0017 : QWidget(parent) 0018 , mEnableDkimSupport(new QCheckBox(i18n("Enable DKIM Support"), this)) 0019 , mSaveResult(new QCheckBox(i18n("Save DKIM Result"), this)) 0020 , mSaveKey(new QComboBox(this)) 0021 , mUseOnlyAuthenticationResult(new QCheckBox(i18n("Replace DKIM result by Authentication-Result header value"), this)) 0022 { 0023 auto mainLayout = new QVBoxLayout(this); 0024 mainLayout->setObjectName(QLatin1StringView("mainLayout")); 0025 0026 mEnableDkimSupport->setObjectName(QLatin1StringView("kcfg_EnabledDkim")); 0027 mEnableDkimSupport->setChecked(false); 0028 mainLayout->addWidget(mEnableDkimSupport); 0029 0030 mSaveResult->setObjectName(QLatin1StringView("kcfg_SaveDkimResult")); 0031 mSaveResult->setChecked(false); 0032 mainLayout->addWidget(mSaveResult); 0033 0034 auto saveKeyLayout = new QHBoxLayout; 0035 saveKeyLayout->setContentsMargins({}); 0036 mainLayout->addLayout(saveKeyLayout); 0037 auto saveKeyLabel = new QLabel(i18n("Save Record Key:"), this); 0038 saveKeyLabel->setObjectName(QLatin1StringView("saveKeyLabel")); 0039 saveKeyLayout->addWidget(saveKeyLabel); 0040 0041 mSaveKey->setObjectName(QLatin1StringView("kcfg_SaveKey")); 0042 mSaveKey->addItems({i18n("Nothing"), i18n("Save"), i18n("Save and Compare")}); 0043 saveKeyLayout->addWidget(mSaveKey); 0044 saveKeyLayout->addStretch(1); 0045 0046 mUseOnlyAuthenticationResult->setObjectName(QLatin1StringView("kcfg_UseOnlyAuthenticationResults")); 0047 mUseOnlyAuthenticationResult->setChecked(false); 0048 mainLayout->addWidget(mUseOnlyAuthenticationResult); 0049 0050 mainLayout->addStretch(1); 0051 } 0052 0053 DKIMGeneralWidget::~DKIMGeneralWidget() = default; 0054 0055 void DKIMGeneralWidget::saveSettings() 0056 { 0057 if (!mEnableDkimSupport->isChecked()) { 0058 MessageViewer::DKIMManager::self()->clearInfoWidget(); 0059 } 0060 } 0061 0062 #include "moc_dkimgeneralwidget.cpp"