File indexing completed on 2024-12-01 04:37:04

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 "searchteamwidget.h"
0008 #include "searchteamcompletionlineedit.h"
0009 #include <KLocalizedString>
0010 #include <QHBoxLayout>
0011 #include <QLabel>
0012 
0013 SearchTeamWidget::SearchTeamWidget(RocketChatAccount *account, QWidget *parent)
0014     : QWidget(parent)
0015     , mSearchLine(new SearchTeamCompletionLineEdit(account, this))
0016 {
0017     auto mainLayout = new QHBoxLayout(this);
0018     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0019 
0020     auto label = new QLabel(i18n("Team Name:"), this);
0021     label->setObjectName(QStringLiteral("label"));
0022     mainLayout->addWidget(label);
0023 
0024     mSearchLine->setObjectName(QStringLiteral("mSearchLine"));
0025     mainLayout->addWidget(mSearchLine);
0026     mainLayout->addStretch(1);
0027     connect(mSearchLine, &SearchTeamCompletionLineEdit::teamIdChanged, this, [this](bool isEmpty) {
0028         Q_EMIT updateOkButton(!isEmpty);
0029     });
0030 }
0031 
0032 SearchTeamWidget::~SearchTeamWidget() = default;
0033 
0034 const QString &SearchTeamWidget::teamId() const
0035 {
0036     return mSearchLine->teamId();
0037 }
0038 
0039 #include "moc_searchteamwidget.cpp"