Messagelib

remotecontentstatustypecombobox.cpp
1 /*
2  SPDX-FileCopyrightText: 2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 #include "remotecontentstatustypecombobox.h"
7 #include <KLocalizedString>
8 using namespace MessageViewer;
9 RemoteContentStatusTypeComboBox::RemoteContentStatusTypeComboBox(QWidget *parent)
10  : QComboBox(parent)
11 {
12  addItem(i18n("Authorized"), QVariant::fromValue(RemoteContentInfo::RemoteContentInfoStatus::Authorized));
13  addItem(i18n("Blocked"), QVariant::fromValue(RemoteContentInfo::RemoteContentInfoStatus::Blocked));
14 }
15 
16 RemoteContentStatusTypeComboBox::~RemoteContentStatusTypeComboBox() = default;
17 
18 void RemoteContentStatusTypeComboBox::setStatus(MessageViewer::RemoteContentInfo::RemoteContentInfoStatus type)
19 {
20  const int index = findData(QVariant::fromValue(type));
21  if (index != -1) {
22  setCurrentIndex(index);
23  }
24 }
25 
26 RemoteContentInfo::RemoteContentInfoStatus RemoteContentStatusTypeComboBox::status() const
27 {
28  return currentData().value<RemoteContentInfo::RemoteContentInfoStatus>();
29 }
QVariant fromValue(const T &value)
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 Sun Dec 5 2021 23:04:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.