File indexing completed on 2025-03-09 04:54:37
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "remotecontentstatustypecombobox.h" 0007 #include <KLocalizedString> 0008 using namespace MessageViewer; 0009 RemoteContentStatusTypeComboBox::RemoteContentStatusTypeComboBox(QWidget *parent) 0010 : QComboBox(parent) 0011 { 0012 addItem(i18n("Authorized"), QVariant::fromValue(RemoteContentInfo::RemoteContentInfoStatus::Authorized)); 0013 addItem(i18n("Blocked"), QVariant::fromValue(RemoteContentInfo::RemoteContentInfoStatus::Blocked)); 0014 } 0015 0016 RemoteContentStatusTypeComboBox::~RemoteContentStatusTypeComboBox() = default; 0017 0018 void RemoteContentStatusTypeComboBox::setStatus(MessageViewer::RemoteContentInfo::RemoteContentInfoStatus type) 0019 { 0020 const int index = findData(QVariant::fromValue(type)); 0021 if (index != -1) { 0022 setCurrentIndex(index); 0023 } 0024 } 0025 0026 RemoteContentInfo::RemoteContentInfoStatus RemoteContentStatusTypeComboBox::status() const 0027 { 0028 return currentData().value<RemoteContentInfo::RemoteContentInfoStatus>(); 0029 } 0030 0031 #include "moc_remotecontentstatustypecombobox.cpp"