9 #include "ui_signverifymessagedialog.h"
31 ui->signatureOut_SM->setPlaceholderText(tr(
"Click \"Sign Message\" to generate signature"));
36 ui->addressIn_SM->installEventFilter(
this);
37 ui->messageIn_SM->installEventFilter(
this);
38 ui->signatureOut_SM->installEventFilter(
this);
39 ui->addressIn_VM->installEventFilter(
this);
40 ui->messageIn_VM->installEventFilter(
this);
41 ui->signatureIn_VM->installEventFilter(
this);
59 ui->addressIn_SM->setText(address);
60 ui->messageIn_SM->setFocus();
65 ui->addressIn_VM->setText(address);
66 ui->messageIn_VM->setFocus();
71 ui->tabWidget->setCurrentIndex(0);
78 ui->tabWidget->setCurrentIndex(1);
105 ui->signatureOut_SM->clear();
109 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
110 ui->statusLabel_SM->setText(tr(
"The entered address is invalid.") + QString(
" ") + tr(
"Please check the address and try again."));
115 ui->addressIn_SM->setValid(
false);
116 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
117 ui->statusLabel_SM->setText(tr(
"The entered address does not refer to a key.") + QString(
" ") + tr(
"Please check the address and try again."));
123 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
124 ui->statusLabel_SM->setText(tr(
"Wallet unlock was cancelled."));
130 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
131 ui->statusLabel_SM->setText(tr(
"Private key for the entered address is not available."));
137 ss <<
ui->messageIn_SM->document()->toPlainText().toStdString();
139 std::vector<unsigned char> vchSig;
141 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
142 ui->statusLabel_SM->setText(QString(
"<nobr>") + tr(
"Message signing failed.") + QString(
"</nobr>"));
146 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: green; }");
147 ui->statusLabel_SM->setText(QString(
"<nobr>") + tr(
"Message signed.") + QString(
"</nobr>"));
149 ui->signatureOut_SM->setText(QString::fromStdString(
EncodeBase64(&vchSig[0], vchSig.size())));
159 ui->addressIn_SM->clear();
160 ui->messageIn_SM->clear();
161 ui->signatureOut_SM->clear();
162 ui->statusLabel_SM->clear();
164 ui->addressIn_SM->setFocus();
182 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
183 ui->statusLabel_VM->setText(tr(
"The entered address is invalid.") + QString(
" ") + tr(
"Please check the address and try again."));
188 ui->addressIn_VM->setValid(
false);
189 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
190 ui->statusLabel_VM->setText(tr(
"The entered address does not refer to a key.") + QString(
" ") + tr(
"Please check the address and try again."));
194 bool fInvalid =
false;
195 std::vector<unsigned char> vchSig =
DecodeBase64(
ui->signatureIn_VM->text().toStdString().c_str(), &fInvalid);
198 ui->signatureIn_VM->setValid(
false);
199 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
200 ui->statusLabel_VM->setText(tr(
"The signature could not be decoded.") + QString(
" ") + tr(
"Please check the signature and try again."));
206 ss <<
ui->messageIn_VM->document()->toPlainText().toStdString();
210 ui->signatureIn_VM->setValid(
false);
211 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
212 ui->statusLabel_VM->setText(tr(
"The signature did not match the message digest.") + QString(
" ") + tr(
"Please check the signature and try again."));
217 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
218 ui->statusLabel_VM->setText(QString(
"<nobr>") + tr(
"Message verification failed.") + QString(
"</nobr>"));
222 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: green; }");
223 ui->statusLabel_VM->setText(QString(
"<nobr>") + tr(
"Message verified.") + QString(
"</nobr>"));
228 ui->addressIn_VM->clear();
229 ui->signatureIn_VM->clear();
230 ui->messageIn_VM->clear();
231 ui->statusLabel_VM->clear();
233 ui->addressIn_VM->setFocus();
238 if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn) {
239 if (
ui->tabWidget->currentIndex() == 0) {
241 ui->statusLabel_SM->clear();
244 if (
object ==
ui->signatureOut_SM) {
245 ui->signatureOut_SM->selectAll();
248 }
else if (
ui->tabWidget->currentIndex() == 1) {
250 ui->statusLabel_VM->clear();
253 return QDialog::eventFilter(
object, event);