/
webqqshowgetinfo.cpp
152 lines (138 loc) · 5.21 KB
/
webqqshowgetinfo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
webqqshowgetinfo.cpp - Webqq show info
Copyright (c) 2014 by Jun Zhang <jun.zhang@i-soft.com.cn>
Kopete (c) 2002-2006 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
*************************************************************************
*/
#include "webqqshowgetinfo.h"
#include <QtGui/QtGui>
#include <klocale.h>
ShowGetInfoDialog::ShowGetInfoDialog(QWidget *parent)
: QDialog(parent)
{
m_okButton = new QPushButton();
m_cancelButton = new QPushButton();
m_showLabel = new QLabel();
m_inputverififyEdit = new QLineEdit();
m_infoEdit = new QTextEdit();
m_refuseButton = new QRadioButton(i18n("Refuse"));
m_agreeButton = new QRadioButton(i18n("Agree"));
m_agreeAddButton = new QRadioButton(i18n("Agree and add back"));
connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(onCancleButtonClicked()));
connect(m_okButton, SIGNAL(clicked()), this, SLOT(onOkButtonClicked()));
}
void ShowGetInfoDialog::setVerifify()
{
m_showLabel->setText(i18n("Verification info"));
m_okButton->setText(i18n("OK"));
m_cancelButton->setText(i18n("Cancel"));
setWindowTitle(i18n("add friend"));
QGridLayout* pGridLayout = new QGridLayout();
pGridLayout->addWidget(m_showLabel, 1, 1, 1, 2);
pGridLayout->addWidget(m_inputverififyEdit, 1, 4, 1, 3);
pGridLayout->addWidget(m_cancelButton, 2, 2, 1, 2);
pGridLayout->addWidget(m_okButton, 2, 5, 1, 2);
setLayout(pGridLayout);
resize(400, 200);
}
void ShowGetInfoDialog::setLongNick(const QString &inputStr)
{
m_showLabel->setText(i18n("LongNick"));
m_okButton->setText(i18n("OK"));
m_cancelButton->setText(i18n("Cancel"));
m_inputverififyEdit->setText(inputStr);
setWindowTitle(i18n("Change LongNick"));
QGridLayout* pGridLayout = new QGridLayout();
pGridLayout->addWidget(m_showLabel, 1, 1, 1, 2);
pGridLayout->addWidget(m_inputverififyEdit, 1, 2, 1, 3);
pGridLayout->addWidget(m_cancelButton, 2, 2, 1, 1);
pGridLayout->addWidget(m_okButton, 2, 3, 1, 1);
setLayout(pGridLayout);
resize(400, 200);
}
QString ShowGetInfoDialog::getVerificationString()
{
return m_inputverififyEdit->text();
}
void ShowGetInfoDialog::setAddInfo(QString info)
{
m_okButton->setText(i18n("close"));
m_showLabel->setText(i18n("Find Results"));
m_infoEdit->setText(info);
setWindowTitle(i18n("find friend"));
QGridLayout* pGridLayout = new QGridLayout();
pGridLayout->addWidget(m_showLabel, 1, 1, 1, 2);
pGridLayout->addWidget(m_infoEdit, 2, 1, 4, 3);
pGridLayout->addWidget(m_okButton, 6, 2, 1, 2);
setLayout(pGridLayout);
resize(300, 400);
}
void ShowGetInfoDialog::setUserInfo(QString info)
{
}
void ShowGetInfoDialog::setRequired(QString info)
{
m_okButton->setText(i18n("OK"));
m_cancelButton->setText(i18n("Ignore"));
QGroupBox *groupBox = new QGroupBox(i18n("Please select"));
m_refuseButton->setChecked(true);
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(m_refuseButton);
vbox->addWidget(m_agreeButton);
vbox->addWidget(m_agreeAddButton);
vbox->addStretch(1);
groupBox->setLayout(vbox);
QGridLayout* pGridLayout = new QGridLayout();
if(info.isEmpty())
{
setWindowTitle(i18n("Block Message"));
m_refuseButton->setText(i18n("No Block"));
m_agreeButton->setText(i18n("Slience Receive"));
m_agreeAddButton->setText(i18n("Block"));
pGridLayout->addWidget(groupBox, 1, 1, 3, 3);
pGridLayout->addWidget(m_cancelButton, 9, 1, 1,1);
pGridLayout->addWidget(m_okButton, 9, 2, 1, 1);
}else
{
setWindowTitle(i18n("Friends confirm"));
m_showLabel->setText(i18n("Friends confirm"));
QLabel *refuseLabel = new QLabel(i18n("Grounds for refusal"));
m_infoEdit->setText(info);
pGridLayout->addWidget(m_showLabel, 1, 1, 1, 2);
pGridLayout->addWidget(m_infoEdit, 2, 1, 4, 3);
pGridLayout->addWidget(groupBox, 6, 1, 3, 3);
pGridLayout->addWidget(refuseLabel, 9, 1, 1, 1);
pGridLayout->addWidget(m_inputverififyEdit, 9, 2, 1, 2);
pGridLayout->addWidget(m_cancelButton, 10, 1, 1, 1);
pGridLayout->addWidget(m_okButton, 10, 2, 1, 1);
}
setLayout(pGridLayout);
resize(300, 400);
}
LwqqAnswer ShowGetInfoDialog::webqqAnswer()
{
if(m_refuseButton->isChecked())
return LWQQ_NO;
else if(m_agreeButton->isChecked())
return LWQQ_YES;
else if(m_agreeAddButton->isChecked())
return LWQQ_EXTRA_ANSWER;
}
void ShowGetInfoDialog::onCancleButtonClicked()
{
this->hide();
m_okOrCancle ="Cancle";
}
void ShowGetInfoDialog::onOkButtonClicked()
{
this->hide();
m_okOrCancle = "OK";
}
#include "webqqshowgetinfo.moc"