Skip to content

Commit

Permalink
Merge pull request bitcoin#1204 from Diapolo/messagepage_focus_placeh…
Browse files Browse the repository at this point in the history
…older

GUI messagepage: add placeholder text to address field (like in sendcoins dialog)...
  • Loading branch information
laanwj committed May 11, 2012
2 parents d7eeb35 + eb55bdf commit f215482
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 4 additions & 8 deletions src/qt/bitcoingui.cpp
Expand Up @@ -728,8 +728,11 @@ void BitcoinGUI::gotoSendCoinsPage()
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}

void BitcoinGUI::gotoMessagePage()
void BitcoinGUI::gotoMessagePage(QString addr)
{
if(!addr.isEmpty())
messagePage->setAddress(addr);

#ifdef FIRST_CLASS_MESSAGING
messageAction->setChecked(true);
centralWidget->setCurrentWidget(messagePage);
Expand All @@ -738,16 +741,9 @@ void BitcoinGUI::gotoMessagePage()
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
#else
messagePage->show();
messagePage->setFocus();
#endif
}

void BitcoinGUI::gotoMessagePage(QString addr)
{
gotoMessagePage();
messagePage->setAddress(addr);
}

void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
// Accept only URIs
Expand Down
5 changes: 2 additions & 3 deletions src/qt/bitcoingui.h
Expand Up @@ -46,7 +46,7 @@ class BitcoinGUI : public QMainWindow
functionality.
*/
void setWalletModel(WalletModel *walletModel);

protected:
void changeEvent(QEvent *e);
void closeEvent(QCloseEvent *event);
Expand Down Expand Up @@ -130,8 +130,7 @@ public slots:
void askFee(qint64 nFeeRequired, bool *payFee);
void handleURI(QString strURI);

void gotoMessagePage();
void gotoMessagePage(QString);
void gotoMessagePage(QString addr = "");

private slots:
/** Switch to overview (home) page */
Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/messagepage.ui
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Message</string>
<string>Sign Message Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down
7 changes: 6 additions & 1 deletion src/qt/messagepage.cpp
Expand Up @@ -24,14 +24,17 @@ MessagePage::MessagePage(QWidget *parent) :
ui(new Ui::MessagePage)
{
ui->setupUi(this);

#if (QT_VERSION >= 0x040700)
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
ui->signFrom->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
ui->signature->setPlaceholderText(tr("Click \"Sign Message\" to get signature"));
#endif

GUIUtil::setupAddressWidget(ui->signFrom, this);
ui->signature->installEventFilter(this);

ui->signFrom->setFocus();
}

MessagePage::~MessagePage()
Expand Down Expand Up @@ -117,6 +120,8 @@ void MessagePage::on_clearButton_clicked()
ui->signFrom->clear();
ui->message->clear();
ui->signature->clear();

ui->signFrom->setFocus();
}

bool MessagePage::eventFilter(QObject *object, QEvent *event)
Expand Down

0 comments on commit f215482

Please sign in to comment.