URI-handling code update: added safety checks and tray-notifications

This commit is contained in:
Philip Kaufmann
2012-03-28 14:55:29 +02:00
parent 7a98f19fb6
commit 93b7af3099
4 changed files with 39 additions and 21 deletions

View File

@@ -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)