fixed snore

This commit is contained in:
Patrick von Reth 2010-07-22 18:55:32 +02:00
parent a6adddebbe
commit cb93ba1fa7
5 changed files with 11 additions and 5 deletions

View File

@ -28,7 +28,7 @@
QString const SnoreServer::snoreTMP=QDir::temp().path()+"/SnoreNotify/";
SnoreServer::SnoreServer(QSystemTrayIcon *trayIcon):
_notificationBackend(0),
_notificationBackend(NULL),
_trayIcon(trayIcon)
{
qDebug()<<"Inititalized";
@ -89,6 +89,7 @@ void SnoreServer::publicatePlugin(SnorePlugin *plugin){
_primaryNotificationBackends.insert(pluginName,nb);
if(_notificationBackend==NULL){
_notificationBackend=nb;
qDebug()<<"Primary NotificationBackend is"<<nb->name();
}else{
connect(this,SIGNAL(notify(QSharedPointer<Notification>)),nb,SLOT(notify(QSharedPointer<Notification>)));
}

View File

@ -43,6 +43,7 @@ public:
void applicationIsInitialized(Application* application);
void removeApplication(const QString& appName);
const ApplicationsList &aplications() const;
const QHash<QString,Notification_Backend*> &primaryNotificationBackends() const;
void setNotificationBackend(Notification_Backend *backend);

View File

@ -23,3 +23,7 @@ int TrayIconNotifer::notify(QSharedPointer<Notification> notification){
void TrayIconNotifer::closeNotification(QSharedPointer<Notification> notification){
}
bool TrayIconNotifer::isPrimaryNotificationBackend(){
return false;
}

View File

@ -9,7 +9,7 @@ class TrayIconNotifer:public Notification_Backend
Q_OBJECT
public:
TrayIconNotifer(class SnoreServer *snore=0,class QSystemTrayIcon *icon=0);
bool isPrimaryNotificationBackend(){return true;}
bool isPrimaryNotificationBackend();
public slots:
void registerApplication(Application *application);

View File

@ -28,7 +28,7 @@ Growl_Backend::Growl_Backend(SnoreServer *snore):
Notification_Backend("Growl",snore),
id(0)
{
const char *n[1] = { "SnoreNotification"};
const char *n[1] = { "Default Alert"};
Growl *growl = new Growl(GROWL_TCP,NULL,"SnoreNotify",n,1);
_applications.insert("SnoreNotify",growl);
@ -71,8 +71,8 @@ int Growl_Backend::notify(QSharedPointer<Notification> notification){
QString title=Notification::toPlainText(notification->title());
QString text=Notification::toPlainText(notification->text());
qDebug()<<notification->application()<<title<<text;
growl->Notify(notification->application().toLatin1().data(),title.toLatin1().data(),text.toLatin1().data(),NULL,notification->icon().toLatin1().data());
qDebug()<<"Notify Growl:"<<notification->application()<<title;
growl->Notify(notification->alert().toLatin1().data(),title.toLatin1().data(),text.toLatin1().data(),"",notification->icon().toLatin1().data());
return ++id;
}