Skip to content

Commit c649ba7

Browse files
committed
Merge bitcoin#529: [Qt] Remove Growl support
a9cf1c7 [Qt] Remove Growl support (Fuzzbawls) Tree-SHA512: 978deadb3d687660951ececb9ff338775cd7c818a7dae3e31119065146207317fcbb1f338a037ee2662a757a1d5f552b4ec5ad8a3381d9ef6d9a60049e326878
2 parents 926c073 + a9cf1c7 commit c649ba7

File tree

4 files changed

+1
-86
lines changed

4 files changed

+1
-86
lines changed

src/qt/macnotificationhandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <QObject>
99

10-
/** Macintosh-specific notification handler (supports UserNotificationCenter and Growl).
10+
/** Macintosh-specific notification handler (supports UserNotificationCenter).
1111
*/
1212
class MacNotificationHandler : public QObject
1313
{

src/qt/macnotificationhandler.mm

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ - (NSString *)__bundleIdentifier
4848
}
4949
}
5050

51-
// sendAppleScript just take a QString and executes it as apple script
52-
void MacNotificationHandler::sendAppleScript(const QString &script)
53-
{
54-
QByteArray utf8 = script.toUtf8();
55-
char* cString = (char *)utf8.constData();
56-
NSString *scriptApple = [[NSString alloc] initWithUTF8String:cString];
57-
58-
NSAppleScript *as = [[NSAppleScript alloc] initWithSource:scriptApple];
59-
NSDictionary *err = nil;
60-
[as executeAndReturnError:&err];
61-
[as release];
62-
[scriptApple release];
63-
}
64-
6551
bool MacNotificationHandler::hasUserNotificationCenterSupport(void)
6652
{
6753
Class possibleClass = NSClassFromString(@"NSUserNotificationCenter");

src/qt/notificator.cpp

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,6 @@ Notificator::Notificator(const QString& programName, QSystemTrayIcon* trayicon,
5757
// check if users OS has support for NSUserNotification
5858
if (MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) {
5959
mode = UserNotificationCenter;
60-
} else {
61-
// Check if Growl is installed (based on Qt's tray icon implementation)
62-
CFURLRef cfurl;
63-
OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
64-
if (status != kLSApplicationNotFoundErr) {
65-
CFBundleRef bundle = CFBundleCreate(0, cfurl);
66-
if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), kCFCompareCaseInsensitive | kCFCompareBackwards) == kCFCompareEqualTo) {
67-
if (CFStringHasSuffix(CFURLGetString(cfurl), CFSTR("/Growl.app/")))
68-
mode = Growl13;
69-
else
70-
mode = Growl12;
71-
}
72-
CFRelease(cfurl);
73-
CFRelease(bundle);
74-
}
7560
}
7661
#endif
7762
}
@@ -245,55 +230,6 @@ void Notificator::notifySystray(Class cls, const QString& title, const QString&
245230

246231
// Based on Qt's tray icon implementation
247232
#ifdef Q_OS_MAC
248-
void Notificator::notifyGrowl(Class cls, const QString& title, const QString& text, const QIcon& icon)
249-
{
250-
const QString script(
251-
"tell application \"%5\"\n"
252-
" set the allNotificationsList to {\"Notification\"}\n" // -- Make a list of all the notification types (all)
253-
" set the enabledNotificationsList to {\"Notification\"}\n" // -- Make a list of the notifications (enabled)
254-
" register as application \"%1\" all notifications allNotificationsList default notifications enabledNotificationsList\n" // -- Register our script with Growl
255-
" notify with name \"Notification\" title \"%2\" description \"%3\" application name \"%1\"%4\n" // -- Send a Notification
256-
"end tell");
257-
258-
QString notificationApp(QApplication::applicationName());
259-
if (notificationApp.isEmpty())
260-
notificationApp = "Application";
261-
262-
QPixmap notificationIconPixmap;
263-
if (icon.isNull()) { // If no icon specified, set icon based on class
264-
QStyle::StandardPixmap sicon = QStyle::SP_MessageBoxQuestion;
265-
switch (cls) {
266-
case Information:
267-
sicon = QStyle::SP_MessageBoxInformation;
268-
break;
269-
case Warning:
270-
sicon = QStyle::SP_MessageBoxWarning;
271-
break;
272-
case Critical:
273-
sicon = QStyle::SP_MessageBoxCritical;
274-
break;
275-
}
276-
notificationIconPixmap = QApplication::style()->standardPixmap(sicon);
277-
} else {
278-
QSize size = icon.actualSize(QSize(48, 48));
279-
notificationIconPixmap = icon.pixmap(size);
280-
}
281-
282-
QString notificationIcon;
283-
QTemporaryFile notificationIconFile;
284-
if (!notificationIconPixmap.isNull() && notificationIconFile.open()) {
285-
QImageWriter writer(&notificationIconFile, "PNG");
286-
if (writer.write(notificationIconPixmap.toImage()))
287-
notificationIcon = QString(" image from location \"file://%1\"").arg(notificationIconFile.fileName());
288-
}
289-
290-
QString quotedTitle(title), quotedText(text);
291-
quotedTitle.replace("\\", "\\\\").replace("\"", "\\");
292-
quotedText.replace("\\", "\\\\").replace("\"", "\\");
293-
QString growlApp(this->mode == Notificator::Growl13 ? "Growl" : "GrowlHelperApp");
294-
MacNotificationHandler::instance()->sendAppleScript(script.arg(notificationApp, quotedTitle, quotedText, notificationIcon, growlApp));
295-
}
296-
297233
void Notificator::notifyMacUserNotificationCenter(Class cls, const QString& title, const QString& text, const QIcon& icon)
298234
{
299235
// icon is not supported by the user notification center yet. OSX will use the app icon.
@@ -317,10 +253,6 @@ void Notificator::notify(Class cls, const QString& title, const QString& text, c
317253
case UserNotificationCenter:
318254
notifyMacUserNotificationCenter(cls, title, text, icon);
319255
break;
320-
case Growl12:
321-
case Growl13:
322-
notifyGrowl(cls, title, text, icon);
323-
break;
324256
#endif
325257
default:
326258
if (cls == Critical) {

src/qt/notificator.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ public slots:
5656
None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */
5757
Freedesktop, /**< Use DBus org.freedesktop.Notifications */
5858
QSystemTray, /**< Use QSystemTray::showMessage */
59-
Growl12, /**< Use the Growl 1.2 notification system (Mac only) */
60-
Growl13, /**< Use the Growl 1.3 notification system (Mac only) */
6159
UserNotificationCenter /**< Use the 10.8+ User Notification Center (Mac only) */
6260
};
6361
QString programName;
@@ -70,7 +68,6 @@ public slots:
7068
#endif
7169
void notifySystray(Class cls, const QString& title, const QString& text, const QIcon& icon, int millisTimeout);
7270
#ifdef Q_OS_MAC
73-
void notifyGrowl(Class cls, const QString& title, const QString& text, const QIcon& icon);
7471
void notifyMacUserNotificationCenter(Class cls, const QString& title, const QString& text, const QIcon& icon);
7572
#endif
7673
};

0 commit comments

Comments
 (0)