removed hack

This commit is contained in:
Patrick von Reth 2014-07-23 23:54:11 +02:00
parent 985cbb6dd5
commit c5d5cf03e3

View File

@ -14,19 +14,6 @@ using namespace Snore;
// store some variables that are needed (since obj-c++ does not allow having obj-c classes as c++ members)
namespace {
NSUserNotificationCenter *notification_center;
NSString *appID = @"dummyID.snorenotify";
// make sure __bundleIdentifier is called on every NSBundle object instead of bundleIdentifier
// see http://stackoverflow.com/a/14698543
bool installNSBundleHook() {
Class cls = objc_getClass("NSBundle");
if (cls) {
method_exchangeImplementations(class_getInstanceMethod(cls, @selector(bundleIdentifier)),
class_getInstanceMethod(cls, @selector(__bundleIdentifier)));
return true;
}
return false;
}
NSString *NSStringFromQString(QString qstr) {
return [NSString stringWithUTF8String: qstr.toUtf8().data()];
@ -52,7 +39,6 @@ OSXNotificationCenter::~OSXNotificationCenter()
bool OSXNotificationCenter::initialize(SnoreCore *snore)
{
installNSBundleHook();
notification_center = [NSUserNotificationCenter defaultUserNotificationCenter];
return SnoreBackend::initialize(snore);
@ -60,12 +46,6 @@ bool OSXNotificationCenter::initialize(SnoreCore *snore)
void OSXNotificationCenter::slotNotify(Snore::Notification notification)
{
QString qAppID = QString("%1.%2").arg(qApp->organizationName(), qApp->applicationName()).remove(" ");
appID = NSStringFromQString(qAppID);
snoreDebug(SNORE_DEBUG) << "bundle identifier for notification:" << [[[NSBundle mainBundle] bundleIdentifier] UTF8String];
NSUserNotification *osx_notification = [[NSUserNotification alloc] init];
osx_notification.title = NSStringFromQString(Snore::toPlainText(notification.title()));
osx_notification.informativeText = NSStringFromQString(Snore::toPlainText(notification.text()));