diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-03-28 14:55:29 +0200 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-06-14 07:59:27 +0200 |
commit | 93b7af309904e68d8b7b2f6bdd2b9bcfb18f9e24 (patch) | |
tree | 56f207b07989d0dd4950419990c4db760f228870 /src/qt/bitcoingui.cpp | |
parent | 7a98f19fb6e40e2929abfff6b1f20f13c091d32d (diff) |
URI-handling code update: added safety checks and tray-notifications
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index e15bc6690a..c143411c76 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -744,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(); @@ -757,10 +764,14 @@ void BitcoinGUI::dropEvent(QDropEvent *event) void BitcoinGUI::handleURI(QString strURI) { - gotoSendCoinsPage(); - sendCoinsPage->handleURI(strURI); - - 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) |