File indexing completed on 2025-03-09 04:54:30
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 "dkimmanagerulescombobox.h" 0008 #include <KLocalizedString> 0009 using namespace MessageViewer; 0010 DKIMManageRulesComboBox::DKIMManageRulesComboBox(QWidget *parent) 0011 : QComboBox(parent) 0012 { 0013 init(); 0014 } 0015 0016 DKIMManageRulesComboBox::~DKIMManageRulesComboBox() = default; 0017 0018 void DKIMManageRulesComboBox::init() 0019 { 0020 addItem(i18n("Must be signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::MustBeSigned)); 0021 addItem(i18n("Can be signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::CanBeSigned)); 0022 addItem(i18n("Ignore if not signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::IgnoreEmailNotSigned)); 0023 } 0024 0025 MessageViewer::DKIMRule::RuleType DKIMManageRulesComboBox::ruleType() const 0026 { 0027 return currentData().value<MessageViewer::DKIMRule::RuleType>(); 0028 } 0029 0030 void DKIMManageRulesComboBox::setRuleType(MessageViewer::DKIMRule::RuleType type) 0031 { 0032 const int index = findData(QVariant::fromValue(type)); 0033 if (index != -1) { 0034 setCurrentIndex(index); 0035 } 0036 } 0037 0038 #include "moc_dkimmanagerulescombobox.cpp"