File indexing completed on 2024-05-12 16:27:11

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "asktwoauthenticationpassworddialog.h"
0008 #include "asktwoauthenticationpasswordwidget.h"
0009 #include <KLocalizedString>
0010 #include <QDialogButtonBox>
0011 #include <QPushButton>
0012 #include <QVBoxLayout>
0013 
0014 AskTwoAuthenticationPasswordDialog::AskTwoAuthenticationPasswordDialog(QWidget *parent)
0015     : QDialog(parent)
0016     , mAskTwoAuthicationPasswordWidget(new AskTwoAuthenticationPasswordWidget(this))
0017 {
0018     setWindowTitle(i18nc("@title:window", "Channel Info"));
0019     auto mainLayout = new QVBoxLayout(this);
0020     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0021 
0022     mAskTwoAuthicationPasswordWidget->setObjectName(QStringLiteral("mAskTwoAuthicationPasswordWidget"));
0023     mainLayout->addWidget(mAskTwoAuthicationPasswordWidget);
0024 
0025     auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close, this);
0026     buttonBox->setObjectName(QStringLiteral("button"));
0027     connect(buttonBox, &QDialogButtonBox::rejected, this, &AskTwoAuthenticationPasswordDialog::reject);
0028     connect(buttonBox, &QDialogButtonBox::accepted, this, &AskTwoAuthenticationPasswordDialog::accept);
0029     mainLayout->addWidget(buttonBox);
0030     mOkButton = buttonBox->button(QDialogButtonBox::Ok);
0031     mOkButton->setEnabled(false);
0032     connect(mAskTwoAuthicationPasswordWidget, &AskTwoAuthenticationPasswordWidget::updateButtonOk, mOkButton, &QPushButton::setEnabled);
0033 }
0034 
0035 AskTwoAuthenticationPasswordDialog::~AskTwoAuthenticationPasswordDialog() = default;
0036 
0037 QString AskTwoAuthenticationPasswordDialog::code() const
0038 {
0039     return mAskTwoAuthicationPasswordWidget->code();
0040 }
0041 
0042 RocketChatAccount *AskTwoAuthenticationPasswordDialog::rocketChatAccount() const
0043 {
0044     return mAskTwoAuthicationPasswordWidget->rocketChatAccount();
0045 }
0046 
0047 void AskTwoAuthenticationPasswordDialog::setRocketChatAccount(RocketChatAccount *newRocketChatAccount)
0048 {
0049     mAskTwoAuthicationPasswordWidget->setRocketChatAccount(newRocketChatAccount);
0050 }
0051 
0052 #include "moc_asktwoauthenticationpassworddialog.cpp"