summaryrefslogtreecommitdiffstats
path: root/src/notifications/ManagerMac.mm
blob: e46b0b82d467a9f63022a486a999deb56f9c5535 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "notifications/Manager.h"

#include <Foundation/Foundation.h>
#include <QtMac>

@interface NSUserNotification (CFIPrivate)
- (void)set_identityImage:(NSImage *)image;
@end

NotificationsManager::NotificationsManager(QObject *parent): QObject(parent)
{

}

void
NotificationsManager::postNotification(
                const QString &roomId,
                const QString &eventId,
                const QString &roomName,
                const QString &senderName,
                const QString &text,
                const QImage &icon)
{
    Q_UNUSED(roomId);
    Q_UNUSED(eventId);
    Q_UNUSED(icon);

    NSUserNotification * notif = [[NSUserNotification alloc] init];

    notif.title           = roomName.toNSString();
    notif.subtitle        = QString("%1 sent a message").arg(senderName).toNSString();
    notif.informativeText = text.toNSString();
    notif.soundName       = NSUserNotificationDefaultSoundName;

    [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: notif];
    [notif autorelease];
}

//unused
void
NotificationsManager::actionInvoked(uint, QString)
{
}

void
NotificationsManager::notificationClosed(uint, uint)
{
}

void
NotificationsManager::removeNotification(const QString &roomId, const QString &eventId)
{}