From 09da654af4e022d461486bbe488b9322ce70fda7 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Thu, 26 Jan 2012 15:55:10 +0100 Subject: [PATCH] some fixes --- src/core/interface.cpp | 5 +++++ src/core/snoreserver.cpp | 3 ++- .../freedesktopnotificationfrontend.cpp | 4 +--- src/plugins/snarl/snarl_backend.cpp | 8 ++++---- src/plugins/snarlnetwork/snarlnetwork.cpp | 4 +--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/core/interface.cpp b/src/core/interface.cpp index 28e2052..129db73 100644 --- a/src/core/interface.cpp +++ b/src/core/interface.cpp @@ -100,6 +100,11 @@ bool Notification_Backend::init( SnoreServer *snore ) connect( snore,SIGNAL( applicationRemoved( Snore::Application* ) ),this,SLOT( unregisterApplication( Snore::Application* ) ) ); if(!isPrimaryNotificationBackend()) connect( snore,SIGNAL( notify(Snore::Notification) ),this,SLOT( notify( Snore::Notification ) ) ); + + foreach(Application *a,snore->aplications()){ + this->registerApplication(a); + } + return true; } diff --git a/src/core/snoreserver.cpp b/src/core/snoreserver.cpp index a854849..de55dd2 100644 --- a/src/core/snoreserver.cpp +++ b/src/core/snoreserver.cpp @@ -182,7 +182,8 @@ void SnoreServer::setPrimaryNotificationBackend ( const QString &backend ) return; qDebug()<<"Setting Notification Backend to:"<(m_plugins[backend]); - m_notificationBackend->init(this); + if(!m_notificationBackend->isInitialized()) + m_notificationBackend->init(this); } const QString &SnoreServer::primaryNotificationBackend(){ diff --git a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp index 099f0a1..858fa11 100644 --- a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp +++ b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp @@ -43,13 +43,11 @@ FreedesktopNotification_Frontend::~FreedesktopNotification_Frontend(){ } bool FreedesktopNotification_Frontend::init(SnoreServer *snore){ - if(!Notification_Frontend::init(snore)) - return false; new NotificationsAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.registerService( "org.freedesktop.Notifications" ); dbus.registerObject( "/org/freedesktop/Notifications", this ); - return true; + return Notification_Frontend::init(snore); } void FreedesktopNotification_Frontend::actionInvoked(Notification notification) { diff --git a/src/plugins/snarl/snarl_backend.cpp b/src/plugins/snarl/snarl_backend.cpp index 3d8997d..157c036 100644 --- a/src/plugins/snarl/snarl_backend.cpp +++ b/src/plugins/snarl/snarl_backend.cpp @@ -52,14 +52,13 @@ Snarl_Backend::~Snarl_Backend() bool Snarl_Backend::init(SnoreServer *snore){ - if(!Notification_Backend::init(snore)) - return false; winIDWidget = new SnarlWidget(this); SnarlInterface *snarlInterface = new SnarlInterface(); _applications.insert("SnoreNotify",snarlInterface); qDebug()<<"Initiating Snarl Backend, Snarl version: "<GetVersion(); _defautSnarlinetrface = new SnarlInterface(); - return true; + + return Notification_Backend::init(snore); } void Snarl_Backend::registerApplication(Application *application){ @@ -79,7 +78,8 @@ void Snarl_Backend::registerApplication(Application *application){ 0,winIDWidget->winId(),SNORENOTIFIER_MESSAGE_ID); foreach(Alert *alert,application->alerts()){ - snarlInterface->AddClass(application->name().toUtf8().constData(), + qDebug()<<"registering snarl alert"<name(); + snarlInterface->AddClass(alert->name().toUtf8().constData(), alert->name().toUtf8().constData(), 0,0,alert->icon().localUrl().toUtf8().constData()); } diff --git a/src/plugins/snarlnetwork/snarlnetwork.cpp b/src/plugins/snarlnetwork/snarlnetwork.cpp index 6c5e430..88db3e3 100644 --- a/src/plugins/snarlnetwork/snarlnetwork.cpp +++ b/src/plugins/snarlnetwork/snarlnetwork.cpp @@ -37,8 +37,6 @@ SnarlNetworkFrontend::~SnarlNetworkFrontend(){ } bool SnarlNetworkFrontend::init(SnoreServer *snore){ - if(!Notification_Frontend::init(snore)) - return false; parser=new Parser(this); tcpServer=new QTcpServer(this); if(!tcpServer->listen(QHostAddress::Any,port)){ @@ -48,7 +46,7 @@ bool SnarlNetworkFrontend::init(SnoreServer *snore){ connect(tcpServer, SIGNAL(newConnection()), this, SLOT(handleConnection())); std::cout<<"The Snarl Network Protokoll is developed for Snarl "<