File indexing completed on 2024-12-22 04:45:37

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "permissionseditwidget.h"
0008 #include "misc/rolescombobox.h"
0009 #include <KLocalizedString>
0010 #include <QHBoxLayout>
0011 #include <QLabel>
0012 PermissionsEditWidget::PermissionsEditWidget(QWidget *parent)
0013     : QWidget(parent)
0014     , mRolesCombobox(new RolesComboBox(this))
0015 {
0016     auto mainLayout = new QHBoxLayout(this);
0017     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0018     mainLayout->setContentsMargins({});
0019     auto label = new QLabel(i18n("Roles:"), this);
0020     label->setObjectName(QStringLiteral("label"));
0021     mRolesCombobox->setObjectName(QStringLiteral("mRolesCombobox"));
0022     mainLayout->addWidget(label);
0023     mainLayout->addWidget(mRolesCombobox, 1);
0024 }
0025 
0026 PermissionsEditWidget::~PermissionsEditWidget() = default;
0027 
0028 void PermissionsEditWidget::setRolesInfo(const QVector<RoleInfo> &rolesinfo)
0029 {
0030     mRolesCombobox->setRolesInfo(rolesinfo);
0031 }
0032 
0033 void PermissionsEditWidget::setRoles(const QStringList &lst)
0034 {
0035     mRolesCombobox->setRoles(lst);
0036 }
0037 
0038 QStringList PermissionsEditWidget::roles() const
0039 {
0040     return mRolesCombobox->roles();
0041 }
0042 
0043 #include "moc_permissionseditwidget.cpp"