some fixes

This commit is contained in:
Patrick von Reth 2012-01-26 15:55:10 +01:00
parent 9c218b29fc
commit 09da654af4
5 changed files with 13 additions and 11 deletions

View File

@ -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;
}

View File

@ -182,7 +182,8 @@ void SnoreServer::setPrimaryNotificationBackend ( const QString &backend )
return;
qDebug()<<"Setting Notification Backend to:"<<backend;
m_notificationBackend = qobject_cast<Notification_Backend*>(m_plugins[backend]);
m_notificationBackend->init(this);
if(!m_notificationBackend->isInitialized())
m_notificationBackend->init(this);
}
const QString &SnoreServer::primaryNotificationBackend(){

View File

@ -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) {

View File

@ -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: "<<snarlInterface->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"<<application->name();
snarlInterface->AddClass(alert->name().toUtf8().constData(),
alert->name().toUtf8().constData(),
0,0,alert->icon().localUrl().toUtf8().constData());
}

View File

@ -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 <http://www.fullphat.net/>"<<std::endl;
}
return true;
return Notification_Frontend::init(snore);
}