5 #include <qt/forms/ui_signverifymessagedialog.h> 23 platformStyle(_platformStyle) {
26 ui->addressBookButton_SM->setIcon(
28 ui->pasteButton_SM->setIcon(
30 ui->copySignatureButton_SM->setIcon(
32 ui->signMessageButton_SM->setIcon(
34 ui->clearButton_SM->setIcon(
36 ui->addressBookButton_VM->setIcon(
38 ui->verifyMessageButton_VM->setIcon(
40 ui->clearButton_VM->setIcon(
46 ui->addressIn_SM->installEventFilter(
this);
47 ui->messageIn_SM->installEventFilter(
this);
48 ui->signatureOut_SM->installEventFilter(
this);
49 ui->addressIn_VM->installEventFilter(
this);
50 ui->messageIn_VM->installEventFilter(
this);
51 ui->signatureIn_VM->installEventFilter(
this);
66 ui->addressIn_SM->setText(address);
67 ui->messageIn_SM->setFocus();
71 ui->addressIn_VM->setText(address);
72 ui->messageIn_VM->setFocus();
76 ui->tabWidget->setCurrentIndex(0);
83 ui->tabWidget->setCurrentIndex(1);
111 ui->signatureOut_SM->clear();
116 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
117 ui->statusLabel_SM->setText(
118 tr(
"The entered address is invalid.") + QString(
" ") +
119 tr(
"Please check the address and try again."));
122 const PKHash *pkhash = boost::get<PKHash>(&destination);
124 ui->addressIn_SM->setValid(
false);
125 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
126 ui->statusLabel_SM->setText(
127 tr(
"The entered address does not refer to a key.") + QString(
" ") +
128 tr(
"Please check the address and try again."));
133 if (!
ctx.isValid()) {
134 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
135 ui->statusLabel_SM->setText(tr(
"Wallet unlock was cancelled."));
139 const std::string &message =
140 ui->messageIn_SM->document()->toPlainText().toStdString();
141 std::string signature;
148 error = tr(
"No error");
151 error = tr(
"Private key for the entered address is not available.");
154 error = tr(
"Message signing failed.");
160 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
161 ui->statusLabel_SM->setText(QString(
"<nobr>") + error +
166 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: green; }");
167 ui->statusLabel_SM->setText(QString(
"<nobr>") + tr(
"Message signed.") +
170 ui->signatureOut_SM->setText(QString::fromStdString(signature));
178 ui->addressIn_SM->clear();
179 ui->messageIn_SM->clear();
180 ui->signatureOut_SM->clear();
181 ui->statusLabel_SM->clear();
183 ui->addressIn_SM->setFocus();
198 const std::string &address =
ui->addressIn_VM->text().toStdString();
199 const std::string &signature =
ui->signatureIn_VM->text().toStdString();
200 const std::string &message =
201 ui->messageIn_VM->document()->toPlainText().toStdString();
207 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: green; }");
209 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
214 ui->statusLabel_VM->setText(QString(
"<nobr>") +
215 tr(
"Message verified.") +
219 ui->statusLabel_VM->setText(
220 tr(
"The entered address is invalid.") + QString(
" ") +
221 tr(
"Please check the address and try again."));
224 ui->addressIn_VM->setValid(
false);
225 ui->statusLabel_VM->setText(
226 tr(
"The entered address does not refer to a key.") +
227 QString(
" ") + tr(
"Please check the address and try again."));
230 ui->signatureIn_VM->setValid(
false);
231 ui->statusLabel_VM->setText(
232 tr(
"The signature could not be decoded.") + QString(
" ") +
233 tr(
"Please check the signature and try again."));
236 ui->signatureIn_VM->setValid(
false);
237 ui->statusLabel_VM->setText(
238 tr(
"The signature did not match the message digest.") +
239 QString(
" ") + tr(
"Please check the signature and try again."));
242 ui->statusLabel_VM->setText(QString(
"<nobr>") +
243 tr(
"Message verification failed.") +
250 ui->addressIn_VM->clear();
251 ui->signatureIn_VM->clear();
252 ui->messageIn_VM->clear();
253 ui->statusLabel_VM->clear();
255 ui->addressIn_VM->setFocus();
259 if (event->type() == QEvent::MouseButtonPress ||
260 event->type() == QEvent::FocusIn) {
261 if (
ui->tabWidget->currentIndex() == 0) {
263 ui->statusLabel_SM->clear();
266 if (
object ==
ui->signatureOut_SM) {
267 ui->signatureOut_SM->selectAll();
270 }
else if (
ui->tabWidget->currentIndex() == 1) {
272 ui->statusLabel_VM->clear();
275 return QDialog::eventFilter(
object, event);
void on_addressBookButton_SM_clicked()
void showTab_SM(bool fShow)
void on_copySignatureButton_SM_clicked()
interfaces::Wallet & wallet() const
The provided signature couldn't be parsed (maybe invalid base64).
void setAddress_VM(const QString &address)
void setModel(AddressTableModel *model)
UnlockContext requestUnlock()
void on_addressBookButton_VM_clicked()
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
void on_pasteButton_SM_clicked()
The message verification was successful.
~SignVerifyMessageDialog()
Open address book to pick address.
virtual SigningResult signMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig)=0
Sign message.
AddressTableModel * getAddressTableModel()
Ui::SignVerifyMessageDialog * ui
void on_signMessageButton_SM_clicked()
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
const CChainParams & getChainParams() const
void setClipboard(const QString &str)
void on_verifyMessageButton_VM_clicked()
void on_clearButton_VM_clicked()
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
Widget that shows a list of sending or receiving addresses.
SignVerifyMessageDialog(const PlatformStyle *platformStyle, QWidget *parent)
void on_clearButton_SM_clicked()
MessageVerificationResult MessageVerify(const CChainParams ¶ms, const std::string &address, const std::string &signature, const std::string &message)
Verify a signed message.
The message was not signed with the private key of the provided address.
Interface to Bitcoin wallet from Qt view code.
bool eventFilter(QObject *object, QEvent *event) override
The provided address is invalid.
const PlatformStyle * platformStyle
A public key could not be recovered from the provided signature and message.
void setModel(WalletModel *model)
bool error(const char *fmt, const Args &... args)
The provided address is valid but does not refer to a public key.
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
void showTab_VM(bool fShow)
const QString & getReturnValue() const
void setAddress_SM(const QString &address)