File indexing completed on 2024-12-08 04:34:20
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "directorytabwidget.h" 0007 #include "directorystackedwidget.h" 0008 #include "rocketchataccount.h" 0009 #include <KLocalizedString> 0010 0011 DirectoryTabWidget::DirectoryTabWidget(RocketChatAccount *account, QWidget *parent) 0012 : QTabWidget(parent) 0013 , mRooms(new DirectoryStackedWidget(account, DirectoryWidget::Room, this)) 0014 , mUsers(new DirectoryStackedWidget(account, DirectoryWidget::User, this)) 0015 , mTeams(new DirectoryStackedWidget(account, DirectoryWidget::Team, this)) 0016 { 0017 mRooms->setObjectName(QStringLiteral("mRooms")); 0018 mUsers->setObjectName(QStringLiteral("mUsers")); 0019 mTeams->setObjectName(QStringLiteral("mTeams")); 0020 addTab(mRooms, i18n("Rooms")); 0021 addTab(mUsers, i18n("Users")); 0022 addTab(mTeams, i18n("Teams")); 0023 0024 if (account && !account->hasPermission(QStringLiteral("view-c-room"))) { 0025 mRooms->setIsAutorized(false); 0026 mTeams->setIsAutorized(false); 0027 } 0028 if (account && (!account->hasPermission(QStringLiteral("view-outside-room")) || !account->hasPermission(QStringLiteral("view-d-room")))) { 0029 mUsers->setIsAutorized(false); 0030 } 0031 } 0032 0033 DirectoryTabWidget::~DirectoryTabWidget() = default; 0034 0035 void DirectoryTabWidget::fillTabs() 0036 { 0037 mRooms->fillDirectory(); 0038 mTeams->fillDirectory(); 0039 mUsers->fillDirectory(); 0040 } 0041 0042 #include "moc_directorytabwidget.cpp"