2 #include "ui_signverifymessagedialog.h"
25 #if (QT_VERSION >= 0x040700)
27 ui->addressIn_SM->setPlaceholderText(tr(
"Enter a Feathercoin address (e.g. 6nqmPL9tX4Uz3uQhbz8GrgLfXQNQEXstVu)"));
28 ui->signatureOut_SM->setPlaceholderText(tr(
"Click \"Sign Message\" to generate signature"));
30 ui->addressIn_VM->setPlaceholderText(tr(
"Enter a Feathercoin address (e.g. 6nqmPL9tX4Uz3uQhbz8GrgLfXQNQEXstVu)"));
31 ui->signatureIn_VM->setPlaceholderText(tr(
"Enter Feathercoin signature"));
37 ui->addressIn_SM->installEventFilter(
this);
38 ui->messageIn_SM->installEventFilter(
this);
39 ui->signatureOut_SM->installEventFilter(
this);
40 ui->addressIn_VM->installEventFilter(
this);
41 ui->messageIn_VM->installEventFilter(
this);
42 ui->signatureIn_VM->installEventFilter(
this);
60 ui->addressIn_SM->setText(address);
61 ui->messageIn_SM->setFocus();
66 ui->addressIn_VM->setText(address);
67 ui->messageIn_VM->setFocus();
72 ui->tabWidget->setCurrentIndex(0);
80 ui->tabWidget->setCurrentIndex(1);
106 ui->signatureOut_SM->clear();
111 ui->addressIn_SM->setValid(
false);
112 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
113 ui->statusLabel_SM->setText(tr(
"The entered address is invalid.") + QString(
" ") + tr(
"Please check the address and try again."));
117 if (!addr.GetKeyID(keyID))
119 ui->addressIn_SM->setValid(
false);
120 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
121 ui->statusLabel_SM->setText(tr(
"The entered address does not refer to a key.") + QString(
" ") + tr(
"Please check the address and try again."));
128 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
129 ui->statusLabel_SM->setText(tr(
"Wallet unlock was cancelled."));
136 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
137 ui->statusLabel_SM->setText(tr(
"Private key for the entered address is not available."));
143 ss <<
ui->messageIn_SM->document()->toPlainText().toStdString();
145 std::vector<unsigned char> vchSig;
148 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: red; }");
149 ui->statusLabel_SM->setText(QString(
"<nobr>") + tr(
"Message signing failed.") + QString(
"</nobr>"));
153 ui->statusLabel_SM->setStyleSheet(
"QLabel { color: green; }");
154 ui->statusLabel_SM->setText(QString(
"<nobr>") + tr(
"Message signed.") + QString(
"</nobr>"));
156 ui->signatureOut_SM->setText(QString::fromStdString(
EncodeBase64(&vchSig[0], vchSig.size())));
161 QApplication::clipboard()->setText(
ui->signatureOut_SM->text());
166 ui->addressIn_SM->clear();
167 ui->messageIn_SM->clear();
168 ui->signatureOut_SM->clear();
169 ui->statusLabel_SM->clear();
171 ui->addressIn_SM->setFocus();
192 ui->addressIn_VM->setValid(
false);
193 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
194 ui->statusLabel_VM->setText(tr(
"The entered address is invalid.") + QString(
" ") + tr(
"Please check the address and try again."));
198 if (!addr.GetKeyID(keyID))
200 ui->addressIn_VM->setValid(
false);
201 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
202 ui->statusLabel_VM->setText(tr(
"The entered address does not refer to a key.") + QString(
" ") + tr(
"Please check the address and try again."));
206 bool fInvalid =
false;
207 std::vector<unsigned char> vchSig =
DecodeBase64(
ui->signatureIn_VM->text().toStdString().c_str(), &fInvalid);
211 ui->signatureIn_VM->setValid(
false);
212 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
213 ui->statusLabel_VM->setText(tr(
"The signature could not be decoded.") + QString(
" ") + tr(
"Please check the signature and try again."));
219 ss <<
ui->messageIn_VM->document()->toPlainText().toStdString();
224 ui->signatureIn_VM->setValid(
false);
225 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
226 ui->statusLabel_VM->setText(tr(
"The signature did not match the message digest.") + QString(
" ") + tr(
"Please check the signature and try again."));
232 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: red; }");
233 ui->statusLabel_VM->setText(QString(
"<nobr>") + tr(
"Message verification failed.") + QString(
"</nobr>"));
237 ui->statusLabel_VM->setStyleSheet(
"QLabel { color: green; }");
238 ui->statusLabel_VM->setText(QString(
"<nobr>") + tr(
"Message verified.") + QString(
"</nobr>"));
243 ui->addressIn_VM->clear();
244 ui->signatureIn_VM->clear();
245 ui->messageIn_VM->clear();
246 ui->statusLabel_VM->clear();
248 ui->addressIn_VM->setFocus();
253 if (event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::FocusIn)
255 if (
ui->tabWidget->currentIndex() == 0)
258 ui->statusLabel_SM->clear();
261 if (
object ==
ui->signatureOut_SM)
263 ui->signatureOut_SM->selectAll();
267 else if (
ui->tabWidget->currentIndex() == 1)
270 ui->statusLabel_VM->clear();
273 return QDialog::eventFilter(
object, event);
void on_addressBookButton_SM_clicked()
void showTab_SM(bool fShow)
void on_copySignatureButton_SM_clicked()
bool eventFilter(QObject *object, QEvent *event)
const_iterator begin() const
void setAddress_VM(const QString &address)
void setModel(AddressTableModel *model)
UnlockContext requestUnlock()
void on_addressBookButton_VM_clicked()
const QString & getReturnValue() const
void on_pasteButton_SM_clicked()
Double ended buffer combining vector and stream-like interfaces.
~SignVerifyMessageDialog()
AddressTableModel * getAddressTableModel()
void setupAddressWidget(QLineEdit *widget, QWidget *parent)
bool GetKey(const CKeyID &address, CKey &keyOut) const
const string strMessageMagic
Ui::SignVerifyMessageDialog * ui
Open address book to pick address for sending.
void on_signMessageButton_SM_clicked()
string EncodeBase64(const unsigned char *pch, size_t len)
SignVerifyMessageDialog(QWidget *parent=0)
bool RecoverCompact(const uint256 &hash, const std::vector< unsigned char > &vchSig)
void on_verifyMessageButton_VM_clicked()
An encapsulated public key.
void on_clearButton_VM_clicked()
uint256 Hash(const T1 pbegin, const T1 pend)
Widget that shows a list of sending or receiving addresses.
void on_clearButton_SM_clicked()
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
Interface to Bitcoin wallet from Qt view code.
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated private key.
vector< unsigned char > DecodeBase64(const char *p, bool *pfInvalid)
void setModel(WalletModel *model)
void showTab_VM(bool fShow)
QFont bitcoinAddressFont()
const_iterator end() const
void setAddress_SM(const QString &address)