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 "searchteamdialog.h"
0008 #include "searchteamwidget.h"
0009 #include <KLocalizedString>
0010 #include <KSharedConfig>
0011 #include <QDialogButtonBox>
0012 #include <QPushButton>
0013 #include <QVBoxLayout>
0014 
0015 SearchTeamDialog::SearchTeamDialog(RocketChatAccount *account, QWidget *parent)
0016     : QDialog(parent)
0017     , mSearchTeamWidget(new SearchTeamWidget(account, this))
0018 {
0019     setWindowTitle(i18nc("@title:window", "Search Team"));
0020     auto mainLayout = new QVBoxLayout(this);
0021     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0022 
0023     mSearchTeamWidget->setObjectName(QStringLiteral("mSearchTeamWidget"));
0024     mainLayout->addWidget(mSearchTeamWidget);
0025 
0026     auto button = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
0027     button->setObjectName(QStringLiteral("button"));
0028     mainLayout->addWidget(button);
0029     connect(button, &QDialogButtonBox::rejected, this, &SearchTeamDialog::reject);
0030     connect(button, &QDialogButtonBox::accepted, this, &SearchTeamDialog::accept);
0031     auto okButton = button->button(QDialogButtonBox::Ok);
0032     okButton->setEnabled(false); // Disabled by default
0033     connect(mSearchTeamWidget, &SearchTeamWidget::updateOkButton, okButton, &QPushButton::setEnabled);
0034 }
0035 
0036 SearchTeamDialog::~SearchTeamDialog() = default;
0037 
0038 const QString &SearchTeamDialog::teamId() const
0039 {
0040     return mSearchTeamWidget->teamId();
0041 }
0042 
0043 #include "moc_searchteamdialog.cpp"