[Pkg-owncloud-commits] [owncloud-client] 63/171: OS X: Also show desktop notifications when app is active

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit 60a6b2b0c38e8ea54a0d47735b1a7ec18d2460c4
Author: Markus Goetz <markus at woboq.com>
Date:   Tue Jan 5 13:32:46 2016 +0100

    OS X: Also show desktop notifications when app is active
---
 src/gui/systray.mm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/gui/systray.mm b/src/gui/systray.mm
index fea8db1..ea30a38 100644
--- a/src/gui/systray.mm
+++ b/src/gui/systray.mm
@@ -2,6 +2,19 @@
 #include <QDebug>
 #import <Cocoa/Cocoa.h>
 
+ at interface NotificationCenterDelegate : NSObject
+ at end
+ at implementation NotificationCenterDelegate
+// Always show, even if app is active at the moment.
+- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center
+     shouldPresentNotification:(NSUserNotification *)notification
+{
+    Q_UNUSED(center);
+    Q_UNUSED(notification);
+    return YES;
+}
+ at end
+
 namespace OCC {
 
 bool canOsXSendUserNotification()
@@ -15,6 +28,12 @@ void sendOsXUserNotification(const QString &title, const QString &message)
     Class cuserNotificationCenter = NSClassFromString(@"NSUserNotificationCenter");
     id userNotificationCenter = [cuserNotificationCenter defaultUserNotificationCenter];
 
+    static dispatch_once_t once;
+    dispatch_once(&once, ^{
+            id delegate = [[NotificationCenterDelegate alloc] init];
+            [userNotificationCenter setDelegate:delegate];
+    });
+
     Class cuserNotification = NSClassFromString(@"NSUserNotification");
     id notification = [[cuserNotification alloc] init];
     [notification setTitle:[NSString stringWithUTF8String:title.toUtf8().data()]];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list