aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp304
1 files changed, 161 insertions, 143 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index d9754b2008..0a99f1637b 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -8,7 +8,7 @@
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "sendcoinsdialog.h"
-#include "messagepage.h"
+#include "signverifymessagedialog.h"
#include "optionsdialog.h"
#include "aboutdialog.h"
#include "clientmodel.h"
@@ -24,8 +24,9 @@
#include "askpassphrasedialog.h"
#include "notificator.h"
#include "guiutil.h"
+#include "rpcconsole.h"
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif
@@ -50,7 +51,6 @@
#include <QFileDialog>
#include <QDesktopServices>
#include <QTimer>
-
#include <QDragEnterEvent>
#include <QUrl>
#include <QStyle>
@@ -65,11 +65,13 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
changePassphraseAction(0),
aboutQtAction(0),
trayIcon(0),
- notificator(0)
+ notificator(0),
+ rpcConsole(0)
{
resize(850, 550);
- setWindowTitle(tr("Bitcoin Wallet"));
-#ifndef Q_WS_MAC
+ setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet"));
+#ifndef Q_OS_MAC
+ qApp->setWindowIcon(QIcon(":icons/bitcoin"));
setWindowIcon(QIcon(":icons/bitcoin"));
#else
setUnifiedTitleAndToolBarOnMac(true);
@@ -105,7 +107,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
sendCoinsPage = new SendCoinsDialog(this);
- messagePage = new MessagePage(this);
+ signVerifyMessageDialog = new SignVerifyMessageDialog(this);
centralWidget = new QStackedWidget(this);
centralWidget->addWidget(overviewPage);
@@ -113,9 +115,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
centralWidget->addWidget(addressBookPage);
centralWidget->addWidget(receiveCoinsPage);
centralWidget->addWidget(sendCoinsPage);
-#ifdef FIRST_CLASS_MESSAGING
- centralWidget->addWidget(messagePage);
-#endif
setCentralWidget(centralWidget);
// Create status bar
@@ -164,16 +163,27 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
+ connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Double-clicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
+ rpcConsole = new RPCConsole(this);
+ connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
+
+ // Clicking on "Verify Message" in the address book sends you to the verify message tab
+ connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
+ // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
+ connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
+
gotoOverviewPage();
}
BitcoinGUI::~BitcoinGUI()
{
-#ifdef Q_WS_MAC
+ if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
+ trayIcon->hide();
+#ifdef Q_OS_MAC
delete appMenuBar;
#endif
}
@@ -188,6 +198,18 @@ void BitcoinGUI::createActions()
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
+ sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
+ sendCoinsAction->setToolTip(tr("Send coins to a Bitcoin address"));
+ sendCoinsAction->setCheckable(true);
+ sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
+ tabGroup->addAction(sendCoinsAction);
+
+ receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
+ receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
+ receiveCoinsAction->setCheckable(true);
+ receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
+ tabGroup->addAction(receiveCoinsAction);
+
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
@@ -200,76 +222,61 @@ void BitcoinGUI::createActions()
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
- receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
- receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
- receiveCoinsAction->setCheckable(true);
- receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
- tabGroup->addAction(receiveCoinsAction);
-
- sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
- sendCoinsAction->setToolTip(tr("Send coins to a bitcoin address"));
- sendCoinsAction->setCheckable(true);
- sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
- tabGroup->addAction(sendCoinsAction);
-
- messageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message"), this);
- messageAction->setToolTip(tr("Prove you control an address"));
-#ifdef FIRST_CLASS_MESSAGING
- messageAction->setCheckable(true);
-#endif
- tabGroup->addAction(messageAction);
-
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
+ connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
+ connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
+ connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
+ connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
- connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
- connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
- connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
- connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
- connect(messageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
- connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
- aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About %1").arg(qApp->applicationName()), this);
+ aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Bitcoin"), this);
aboutAction->setToolTip(tr("Show information about Bitcoin"));
aboutAction->setMenuRole(QAction::AboutRole);
- aboutQtAction = new QAction(tr("About &Qt"), this);
+ aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
- optionsAction->setToolTip(tr("Modify configuration options for bitcoin"));
+ optionsAction->setToolTip(tr("Modify configuration options for Bitcoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
- toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &Bitcoin"), this);
- toggleHideAction->setToolTip(tr("Show or hide the Bitcoin window"));
- exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
- exportAction->setToolTip(tr("Export the data in the current tab to a file"));
- encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this);
+ toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this);
+ encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
- backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet"), this);
+ backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
- changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this);
+ changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
+ signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
+ verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
+
+ exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
+ exportAction->setToolTip(tr("Export the data in the current tab to a file"));
+ openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
+ openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+ connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
+ connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
+ connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
}
void BitcoinGUI::createMenuBar()
{
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
// Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar();
#else
@@ -281,9 +288,8 @@ void BitcoinGUI::createMenuBar()
QMenu *file = appMenuBar->addMenu(tr("&File"));
file->addAction(backupWalletAction);
file->addAction(exportAction);
-#ifndef FIRST_CLASS_MESSAGING
- file->addAction(messageAction);
-#endif
+ file->addAction(signMessageAction);
+ file->addAction(verifyMessageAction);
file->addSeparator();
file->addAction(quitAction);
@@ -294,6 +300,8 @@ void BitcoinGUI::createMenuBar()
settings->addAction(optionsAction);
QMenu *help = appMenuBar->addMenu(tr("&Help"));
+ help->addAction(openRPCConsoleAction);
+ help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
}
@@ -307,9 +315,6 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
-#ifdef FIRST_CLASS_MESSAGING
- toolbar->addAction(messageAction);
-#endif
QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@@ -324,17 +329,18 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
// Replace some strings and icons, when using the testnet
if(clientModel->isTestNet())
{
- QString title_testnet = windowTitle() + QString(" ") + tr("[testnet]");
- setWindowTitle(title_testnet);
-#ifndef Q_WS_MAC
+ setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
+#ifndef Q_OS_MAC
+ qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
#else
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
if(trayIcon)
{
- trayIcon->setToolTip(title_testnet);
+ trayIcon->setToolTip(tr("Bitcoin client") + QString(" ") + tr("[testnet]"));
trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
+ toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
aboutAction->setIcon(QIcon(":/icons/toolbar_testnet"));
@@ -344,11 +350,15 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
setNumConnections(clientModel->getNumConnections());
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
- setNumBlocks(clientModel->getNumBlocks());
- connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int)));
+ setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
+ connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
// Report errors from network/worker thread
- connect(clientModel, SIGNAL(error(QString,QString, bool)), this, SLOT(error(QString,QString,bool)));
+ connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
+
+ rpcConsole->setClientModel(clientModel);
+ addressBookPage->setOptionsModel(clientModel->getOptionsModel());
+ receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
}
}
@@ -367,7 +377,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
addressBookPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel);
- messagePage->setModel(walletModel);
+ signVerifyMessageDialog->setModel(walletModel);
setEncryptionStatus(walletModel->getEncryptionStatus());
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
@@ -384,7 +394,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
void BitcoinGUI::createTrayIcon()
{
QMenu *trayIconMenu;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
trayIcon = new QSystemTrayIcon(this);
trayIconMenu = new QMenu(this);
trayIcon->setContextMenu(trayIconMenu);
@@ -402,55 +412,33 @@ void BitcoinGUI::createTrayIcon()
// Configuration of the tray icon (or dock icon) icon menu
trayIconMenu->addAction(toggleHideAction);
trayIconMenu->addSeparator();
- trayIconMenu->addAction(messageAction);
-#ifndef FIRST_CLASS_MESSAGING
- trayIconMenu->addSeparator();
-#endif
- trayIconMenu->addAction(receiveCoinsAction);
trayIconMenu->addAction(sendCoinsAction);
+ trayIconMenu->addAction(receiveCoinsAction);
+ trayIconMenu->addSeparator();
+ trayIconMenu->addAction(signMessageAction);
+ trayIconMenu->addAction(verifyMessageAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(optionsAction);
-#ifndef Q_WS_MAC // This is built-in on Mac
+ trayIconMenu->addAction(openRPCConsoleAction);
+#ifndef Q_OS_MAC // This is built-in on Mac
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
#endif
- notificator = new Notificator(tr("bitcoin-qt"), trayIcon);
+ notificator = new Notificator(qApp->applicationName(), trayIcon);
}
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if(reason == QSystemTrayIcon::Trigger)
{
- // Click on system tray icon triggers "show/hide bitcoin"
+ // Click on system tray icon triggers show/hide of the main window
toggleHideAction->trigger();
}
}
#endif
-void BitcoinGUI::toggleHidden()
-{
- // activateWindow() (sometimes) helps with keyboard focus on Windows
- if (isHidden())
- {
- show();
- activateWindow();
- }
- else if (isMinimized())
- {
- showNormal();
- activateWindow();
- }
- else if (GUIUtil::isObscured(this))
- {
- raise();
- activateWindow();
- }
- else
- hide();
-}
-
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
@@ -482,9 +470,9 @@ void BitcoinGUI::setNumConnections(int count)
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bitcoin network", "", count));
}
-void BitcoinGUI::setNumBlocks(int count)
+void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
{
- // don't show / hide progressBar and its label if we have no connection(s) to the network
+ // don't show / hide progress bar and its label if we have no connection to the network
if (!clientModel || clientModel->getNumConnections() == 0)
{
progressBarLabel->setVisible(false);
@@ -493,7 +481,7 @@ void BitcoinGUI::setNumBlocks(int count)
return;
}
- int nTotalBlocks = clientModel->getNumBlocksOfPeers();
+ QString strStatusBarWarnings = clientModel->getStatusBarWarnings();
QString tooltip;
if(count < nTotalBlocks)
@@ -501,7 +489,7 @@ void BitcoinGUI::setNumBlocks(int count)
int nRemainingBlocks = nTotalBlocks - count;
float nPercentageDone = count / (nTotalBlocks * 0.01f);
- if (clientModel->getStatusBarWarnings() == "")
+ if (strStatusBarWarnings.isEmpty())
{
progressBarLabel->setText(tr("Synchronizing with network..."));
progressBarLabel->setVisible(true);
@@ -510,30 +498,28 @@ void BitcoinGUI::setNumBlocks(int count)
progressBar->setValue(count);
progressBar->setVisible(true);
}
- else
- {
- progressBarLabel->setText(clientModel->getStatusBarWarnings());
- progressBarLabel->setVisible(true);
- progressBar->setVisible(false);
- }
+
tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2);
}
else
{
- if (clientModel->getStatusBarWarnings() == "")
+ if (strStatusBarWarnings.isEmpty())
progressBarLabel->setVisible(false);
- else
- {
- progressBarLabel->setText(clientModel->getStatusBarWarnings());
- progressBarLabel->setVisible(true);
- }
+
progressBar->setVisible(false);
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
}
- QDateTime now = QDateTime::currentDateTime();
+ // Override progressBarLabel text and hide progress bar, when we have warnings to display
+ if (!strStatusBarWarnings.isEmpty())
+ {
+ progressBarLabel->setText(strStatusBarWarnings);
+ progressBarLabel->setVisible(true);
+ progressBar->setVisible(false);
+ }
+
QDateTime lastBlockDate = clientModel->getLastBlockDate();
- int secs = lastBlockDate.secsTo(now);
+ int secs = lastBlockDate.secsTo(QDateTime::currentDateTime());
QString text;
// Represent time from last generated block in human readable text
@@ -561,22 +547,29 @@ void BitcoinGUI::setNumBlocks(int count)
// Set icon state: spinning if catching up, tick otherwise
if(secs < 90*60 && count >= nTotalBlocks)
{
- tooltip = tr("Up to date") + QString(".\n") + tooltip;
+ tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
+
+ overviewPage->showOutOfSyncWarning(false);
}
else
{
- tooltip = tr("Catching up...") + QString("\n") + tooltip;
+ tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setMovie(syncIconMovie);
syncIconMovie->start();
+
+ overviewPage->showOutOfSyncWarning(true);
}
if(!text.isEmpty())
{
- tooltip += QString("\n");
+ tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1.").arg(text);
}
+ // Don't word-wrap this (fixed-width) tooltip
+ tooltip = QString("<nobr>") + tooltip + QString("</nobr>");
+
labelBlocksIcon->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip);
progressBar->setToolTip(tooltip);
@@ -596,7 +589,7 @@ void BitcoinGUI::error(const QString &title, const QString &message, bool modal)
void BitcoinGUI::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
-#ifndef Q_WS_MAC // Ignored on Mac
+#ifndef Q_OS_MAC // Ignored on Mac
if(e->type() == QEvent::WindowStateChange)
{
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
@@ -616,7 +609,7 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
{
if(clientModel)
{
-#ifndef Q_WS_MAC // Ignored on Mac
+#ifndef Q_OS_MAC // Ignored on Mac
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
!clientModel->getOptionsModel()->getMinimizeOnClose())
{
@@ -633,7 +626,7 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
"which goes to the nodes that process your transaction and helps to support the network. "
"Do you want to pay the fee?").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired));
QMessageBox::StandardButton retval = QMessageBox::question(
- this, tr("Sending..."), strMessage,
+ this, tr("Confirm transaction fee"), strMessage,
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
*payFee = (retval == QMessageBox::Yes);
}
@@ -721,24 +714,22 @@ void BitcoinGUI::gotoSendCoinsPage()
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
-void BitcoinGUI::gotoMessagePage()
+void BitcoinGUI::gotoSignMessageTab(QString addr)
{
-#ifdef FIRST_CLASS_MESSAGING
- messageAction->setChecked(true);
- centralWidget->setCurrentWidget(messagePage);
+ // call show() in showTab_SM()
+ signVerifyMessageDialog->showTab_SM(true);
- exportAction->setEnabled(false);
- disconnect(exportAction, SIGNAL(triggered()), 0, 0);
-#else
- messagePage->show();
- messagePage->setFocus();
-#endif
+ if(!addr.isEmpty())
+ signVerifyMessageDialog->setAddress_SM(addr);
}
-void BitcoinGUI::gotoMessagePage(QString addr)
+void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
- gotoMessagePage();
- messagePage->setAddress(addr);
+ // call show() in showTab_VM()
+ signVerifyMessageDialog->showTab_VM(true);
+
+ if(!addr.isEmpty())
+ signVerifyMessageDialog->setAddress_VM(addr);
}
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
@@ -752,12 +743,19 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
- gotoSendCoinsPage();
+ int nValidUrisFound = 0;
QList<QUrl> uris = event->mimeData()->urls();
foreach(const QUrl &uri, uris)
{
- sendCoinsPage->handleURI(uri.toString());
+ if (sendCoinsPage->handleURI(uri.toString()))
+ nValidUrisFound++;
}
+
+ // if valid URIs were found
+ if (nValidUrisFound)
+ gotoSendCoinsPage();
+ else
+ notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."));
}
event->acceptProposedAction();
@@ -765,13 +763,14 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
void BitcoinGUI::handleURI(QString strURI)
{
- gotoSendCoinsPage();
- sendCoinsPage->handleURI(strURI);
-
- if(!isActiveWindow())
- activateWindow();
-
- showNormalIfMinimized();
+ // URI has to be valid
+ if (sendCoinsPage->handleURI(strURI))
+ {
+ showNormalIfMinimized();
+ gotoSendCoinsPage();
+ }
+ else
+ notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."));
}
void BitcoinGUI::setEncryptionStatus(int status)
@@ -846,10 +845,29 @@ void BitcoinGUI::unlockWallet()
}
}
-void BitcoinGUI::showNormalIfMinimized()
+void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
- if(!isVisible()) // Show, if hidden
+ // activateWindow() (sometimes) helps with keyboard focus on Windows
+ if (isHidden())
+ {
show();
- if(isMinimized()) // Unminimize, if minimized
+ activateWindow();
+ }
+ else if (isMinimized())
+ {
showNormal();
+ activateWindow();
+ }
+ else if (GUIUtil::isObscured(this))
+ {
+ raise();
+ activateWindow();
+ }
+ else if(fToggleHidden)
+ hide();
+}
+
+void BitcoinGUI::toggleHidden()
+{
+ showNormalIfMinimized(true);
}