diff options
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 85 |
1 files changed, 45 insertions, 40 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a4bb63886b..c642f4aa0b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -409,17 +409,17 @@ void BitcoinGUI::createTrayIcon() // Configuration of the tray icon (or dock icon) icon menu trayIconMenu->addAction(toggleHideAction); - trayIconMenu->addAction(openRPCConsoleAction); trayIconMenu->addSeparator(); - trayIconMenu->addAction(messageAction); - trayIconMenu->addAction(verifyMessageAction); + trayIconMenu->addAction(sendCoinsAction); + trayIconMenu->addAction(receiveCoinsAction); #ifndef FIRST_CLASS_MESSAGING trayIconMenu->addSeparator(); #endif - trayIconMenu->addAction(sendCoinsAction); - trayIconMenu->addAction(receiveCoinsAction); + trayIconMenu->addAction(messageAction); + trayIconMenu->addAction(verifyMessageAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(optionsAction); + trayIconMenu->addAction(openRPCConsoleAction); #ifndef Q_WS_MAC // This is built-in on Mac trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); @@ -439,28 +439,6 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) } #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()) @@ -766,12 +744,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(); @@ -779,13 +764,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) @@ -849,7 +835,7 @@ void BitcoinGUI::changePassphrase() void BitcoinGUI::verifyMessage() { - VerifyMessageDialog *dlg = new VerifyMessageDialog(walletModel->getAddressTableModel(), this); + VerifyMessageDialog *dlg = new VerifyMessageDialog(this); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->show(); } @@ -867,10 +853,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); } |