Messagelib

dkimmanagerulescombobox.cpp
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "dkimmanagerulescombobox.h"
8#include <KLocalizedString>
9using namespace MessageViewer;
10DKIMManageRulesComboBox::DKIMManageRulesComboBox(QWidget *parent)
11 : QComboBox(parent)
12{
13 init();
14}
15
16DKIMManageRulesComboBox::~DKIMManageRulesComboBox() = default;
17
18void 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
25MessageViewer::DKIMRule::RuleType DKIMManageRulesComboBox::ruleType() const
26{
27 return currentData().value<MessageViewer::DKIMRule::RuleType>();
28}
29
30void DKIMManageRulesComboBox::setRuleType(MessageViewer::DKIMRule::RuleType type)
31{
32 const int index = findData(QVariant::fromValue(type));
33 if (index != -1) {
34 setCurrentIndex(index);
35 }
36}
37
38#include "moc_dkimmanagerulescombobox.cpp"
QString i18n(const char *text, const TYPE &arg...)
QCA_EXPORT void init()
void addItem(const QIcon &icon, const QString &text, const QVariant &userData)
void setCurrentIndex(int index)
int findData(const QVariant &data, int role, Qt::MatchFlags flags) const const
QVariant fromValue(T &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.