Messagelib

dkimmanagerulescombobox.cpp
1 /*
2  SPDX-FileCopyrightText: 2019-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "dkimmanagerulescombobox.h"
8 #include <KLocalizedString>
9 using namespace MessageViewer;
10 DKIMManageRulesComboBox::DKIMManageRulesComboBox(QWidget *parent)
11  : QComboBox(parent)
12 {
13  init();
14 }
15 
16 DKIMManageRulesComboBox::~DKIMManageRulesComboBox() = default;
17 
18 void DKIMManageRulesComboBox::init()
19 {
20  addItem(i18n("Must be signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::MustBeSigned));
21  addItem(i18n("Can be signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::CanBeSigned));
22  addItem(i18n("Ignore if not signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::IgnoreEmailNotSigned));
23 }
24 
25 MessageViewer::DKIMRule::RuleType DKIMManageRulesComboBox::ruleType() const
26 {
27  return currentData().value<MessageViewer::DKIMRule::RuleType>();
28 }
29 
30 void DKIMManageRulesComboBox::setRuleType(MessageViewer::DKIMRule::RuleType type)
31 {
32  const int index = findData(QVariant::fromValue(type));
33  if (index != -1) {
34  setCurrentIndex(index);
35  }
36 }
QVariant fromValue(const T &value)
QCA_EXPORT void init()
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.