mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Merge branch '0.5.0.x' into 0.5.x
Conflicts: src/qt/notificator.h
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
Code: src/strlcpy.h
|
||||
Author: Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
License: ISC
|
||||
|
||||
Icon: src/qt/res/icons/clock*.png, src/qt/res/icons/tx*.png,
|
||||
src/qt/res/src/*.svg
|
||||
Designer: Wladimir van der Laan
|
||||
|
||||
@@ -659,7 +659,7 @@ void BitcoinGUI::gotoSendCoinsPage()
|
||||
|
||||
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
// Accept only URLs
|
||||
// Accept only URIs
|
||||
if(event->mimeData()->hasUrls())
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
@@ -669,10 +669,10 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
|
||||
if(event->mimeData()->hasUrls())
|
||||
{
|
||||
gotoSendCoinsPage();
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
foreach(const QUrl &url, urls)
|
||||
QList<QUrl> uris = event->mimeData()->urls();
|
||||
foreach(const QUrl &uri, uris)
|
||||
{
|
||||
sendCoinsPage->handleURL(&url);
|
||||
sendCoinsPage->handleURI(&uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,16 +47,16 @@ void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent)
|
||||
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
|
||||
bool GUIUtil::parseBitcoinURI(const QUrl *uri, SendCoinsRecipient *out)
|
||||
{
|
||||
if(url->scheme() != QString("bitcoin"))
|
||||
if(uri->scheme() != QString("bitcoin"))
|
||||
return false;
|
||||
|
||||
SendCoinsRecipient rv;
|
||||
rv.address = url->path();
|
||||
rv.label = url->queryItemValue("label");
|
||||
rv.address = uri->path();
|
||||
rv.label = uri->queryItemValue("label");
|
||||
|
||||
QString amount = url->queryItemValue("amount");
|
||||
QString amount = uri->queryItemValue("amount");
|
||||
if(amount.isEmpty())
|
||||
{
|
||||
rv.amount = 0;
|
||||
@@ -75,18 +75,18 @@ bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GUIUtil::parseBitcoinURL(QString url, SendCoinsRecipient *out)
|
||||
bool GUIUtil::parseBitcoinURI(QString uri, SendCoinsRecipient *out)
|
||||
{
|
||||
// Convert bitcoin:// to bitcoin:
|
||||
//
|
||||
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
|
||||
// which will lowercase it (and thus invalidate the address).
|
||||
if(url.startsWith("bitcoin://"))
|
||||
if(uri.startsWith("bitcoin://"))
|
||||
{
|
||||
url.replace(0, 10, "bitcoin:");
|
||||
uri.replace(0, 10, "bitcoin:");
|
||||
}
|
||||
QUrl urlInstance(url);
|
||||
return parseBitcoinURL(&urlInstance, out);
|
||||
QUrl uriInstance(uri);
|
||||
return parseBitcoinURI(&uriInstance, out);
|
||||
}
|
||||
|
||||
QString GUIUtil::getSaveFileName(QWidget *parent, const QString &caption,
|
||||
|
||||
@@ -28,10 +28,10 @@ public:
|
||||
static void setupAddressWidget(QLineEdit *widget, QWidget *parent);
|
||||
static void setupAmountWidget(QLineEdit *widget, QWidget *parent);
|
||||
|
||||
// Parse "bitcoin:" URL into recipient object, return true on succesful parsing
|
||||
// See Bitcoin URL definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
|
||||
static bool parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out);
|
||||
static bool parseBitcoinURL(QString url, SendCoinsRecipient *out);
|
||||
// Parse "bitcoin:" URI into recipient object, return true on succesful parsing
|
||||
// See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
|
||||
static bool parseBitcoinURI(const QUrl *, SendCoinsRecipient *out);
|
||||
static bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
|
||||
|
||||
/** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
|
||||
when no suffix is provided by the user.
|
||||
|
||||
@@ -52,10 +52,13 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
|
||||
OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
|
||||
if (status != kLSApplicationNotFoundErr) {
|
||||
CFBundleRef bundle = CFBundleCreate(0, cfurl);
|
||||
CFRelease(cfurl);
|
||||
if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), kCFCompareCaseInsensitive | kCFCompareBackwards) == kCFCompareEqualTo) {
|
||||
mode = Growl;
|
||||
if (CFStringHasSuffix(CFURLGetString(cfurl), CFSTR("/Growl.app/")))
|
||||
mode = Growl13;
|
||||
else
|
||||
mode = Growl12;
|
||||
}
|
||||
CFRelease(cfurl);
|
||||
CFRelease(bundle);
|
||||
}
|
||||
#endif
|
||||
@@ -226,7 +229,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString &
|
||||
void Notificator::notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon)
|
||||
{
|
||||
const QString script(
|
||||
"tell application \"GrowlHelperApp\"\n"
|
||||
"tell application \"%5\"\n"
|
||||
" set the allNotificationsList to {\"Notification\"}\n" // -- Make a list of all the notification types (all)
|
||||
" set the enabledNotificationsList to {\"Notification\"}\n" // -- Make a list of the notifications (enabled)
|
||||
" register as application \"%1\" all notifications allNotificationsList default notifications enabledNotificationsList\n" // -- Register our script with Growl
|
||||
@@ -265,7 +268,8 @@ void Notificator::notifyGrowl(Class cls, const QString &title, const QString &te
|
||||
QString quotedTitle(title), quotedText(text);
|
||||
quotedTitle.replace("\\", "\\\\").replace("\"", "\\");
|
||||
quotedText.replace("\\", "\\\\").replace("\"", "\\");
|
||||
qt_mac_execute_apple_script(script.arg(notificationApp, quotedTitle, quotedText, notificationIcon), 0);
|
||||
QString growlApp(this->mode == Notificator::Growl13 ? "Growl" : "GrowlHelperApp");
|
||||
qt_mac_execute_apple_script(script.arg(notificationApp, quotedTitle, quotedText, notificationIcon, growlApp), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -282,7 +286,8 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
|
||||
notifySystray(cls, title, text, icon, millisTimeout);
|
||||
break;
|
||||
#ifdef Q_WS_MAC
|
||||
case Growl:
|
||||
case Growl12:
|
||||
case Growl13:
|
||||
notifyGrowl(cls, title, text, icon);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,8 @@ private:
|
||||
None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */
|
||||
Freedesktop, /**< Use DBus org.freedesktop.Notifications */
|
||||
QSystemTray, /**< Use QSystemTray::showMessage */
|
||||
Growl /**< Use the Growl notification system (Mac only) */
|
||||
Growl12, /**< Use the Growl 1.2 notification system (Mac only) */
|
||||
Growl13 /**< Use the Growl 1.3 notification system (Mac only) */
|
||||
};
|
||||
QString programName;
|
||||
Mode mode;
|
||||
|
||||
@@ -255,20 +255,20 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
|
||||
}
|
||||
|
||||
|
||||
void SendCoinsDialog::handleURL(const QUrl *url)
|
||||
void SendCoinsDialog::handleURI(const QUrl *uri)
|
||||
{
|
||||
SendCoinsRecipient rv;
|
||||
if(!GUIUtil::parseBitcoinURL(url, &rv))
|
||||
if(!GUIUtil::parseBitcoinURI(uri, &rv))
|
||||
{
|
||||
return;
|
||||
}
|
||||
pasteEntry(rv);
|
||||
}
|
||||
|
||||
void SendCoinsDialog::handleURL(const QString &url)
|
||||
void SendCoinsDialog::handleURI(const QString &uri)
|
||||
{
|
||||
SendCoinsRecipient rv;
|
||||
if(!GUIUtil::parseBitcoinURL(url, &rv))
|
||||
if(!GUIUtil::parseBitcoinURI(uri, &rv))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
QWidget *setupTabChain(QWidget *prev);
|
||||
|
||||
void pasteEntry(const SendCoinsRecipient &rv);
|
||||
void handleURL(const QUrl *url);
|
||||
void handleURL(const QString &url);
|
||||
void handleURI(const QUrl *uri);
|
||||
void handleURI(const QString &uri);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user