Debian Codegraph @

kysdk-qtwidgets/test/testsecurityquestiondialog/dialog.cpp

raw
1 /*
2 *
3 * Copyright (C) 2024, KylinSoft Co., Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 3 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this library. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * Authors: Zhenyu Wang <[email protected]>
19 *
20 */
21
22 #include "dialog.h"
23 #include <QDebug>
24
25 #include "ksecurityquestiondialog.h"
26 using namespace kdk;
27
28 Dialog::Dialog(QWidget *parent)
29 : QWidget(parent)
30 {
31 KSecurityQuestionDialog *questionDialog = new KSecurityQuestionDialog();
32 questionDialog->setWindowIcon("ukui-control-center");
33 questionDialog->setWindowTitle("Security Question");
34 questionDialog->setTitleText(tr("Answer the security questions and reset your password"));
35 questionDialog->addSecurityQuestionItem(3, true);
36 QStringList AA;
37 AA << "111"
38 << "222"
39 << "333"
40 << "444";
41 questionDialog->initQustionCombox(AA);
42
43 if (questionDialog->answerLabel(1) != nullptr) {
44 questionDialog->answerLabel(1)->setText("answerLabel1");
45 qDebug() << questionDialog->answerLabel(1)->text();
46 }
47
48 if (questionDialog->questionLabel(1) != nullptr) {
49 questionDialog->questionLabel(1)->setText("test111");
50 qDebug() << questionDialog->questionLabel(1)->text();
51 }
52
53 if (questionDialog->answerLineedit(1) != nullptr) {
54 qDebug() << questionDialog->answerLineedit(1)->text();
55 }
56
57 if (questionDialog->questionCombox(1) != nullptr) {
58 qDebug() << questionDialog->questionCombox(1)->currentText();
59 }
60
61 if (questionDialog->tipsLabel(1) != nullptr) {
62 questionDialog->tipsLabel(1)->setText("Incorrect answer");
63 qDebug() << questionDialog->tipsLabel(1)->text();
64 }
65
66 connect(questionDialog->cancelButton(), &KPushButton::clicked, this, [=]() {
67 questionDialog->close();
68 });
69
70 questionDialog->show();
71 }