mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-02 19:53:41 +00:00
automatical register with snarl when snar starts
This commit is contained in:
parent
9b23b6d80c
commit
e371e20e09
@ -40,7 +40,6 @@ Notification_Backend("SnarlBackend",snore)
|
|||||||
activeNotifications = new QHash<int,QSharedPointer<Notification> > ;
|
activeNotifications = new QHash<int,QSharedPointer<Notification> > ;
|
||||||
winIDWidget = new SnarlWidget(this);
|
winIDWidget = new SnarlWidget(this);
|
||||||
SnarlInterface *snarlInterface = new SnarlInterface();
|
SnarlInterface *snarlInterface = new SnarlInterface();
|
||||||
snarlInterface->RegisterApp("SnoreNotify","SnoreNotify",NULL,winIDWidget->winId(),SNORENOTIFIER_MESSAGE_ID);
|
|
||||||
_applications.insert("SnoreNotify",snarlInterface);
|
_applications.insert("SnoreNotify",snarlInterface);
|
||||||
qDebug()<<"Initiating Snarl Backend, Snarl version: "<<snarlInterface->GetVersion();
|
qDebug()<<"Initiating Snarl Backend, Snarl version: "<<snarlInterface->GetVersion();
|
||||||
_defautSnarlinetrface = new SnarlInterface();
|
_defautSnarlinetrface = new SnarlInterface();
|
||||||
@ -58,9 +57,13 @@ Snarl_Backend::~Snarl_Backend()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Snarl_Backend::registerApplication(Application *application){
|
void Snarl_Backend::registerApplication(Application *application){
|
||||||
SnarlInterface *snarlInterface = new SnarlInterface();
|
SnarlInterface *snarlInterface = NULL;
|
||||||
|
if(_applications.contains(application->name())){
|
||||||
|
snarlInterface = _applications.value(application->name());
|
||||||
|
}else{
|
||||||
|
snarlInterface = new SnarlInterface();
|
||||||
_applications.insert(application->name(),snarlInterface);
|
_applications.insert(application->name(),snarlInterface);
|
||||||
|
}
|
||||||
qDebug()<<"Register with Snarl"<<application->name()<<application->icon();
|
qDebug()<<"Register with Snarl"<<application->name()<<application->icon();
|
||||||
snarlInterface->RegisterApp(application->name().toUtf8().constData(),
|
snarlInterface->RegisterApp(application->name().toUtf8().constData(),
|
||||||
application->name().toUtf8().constData(),
|
application->name().toUtf8().constData(),
|
||||||
@ -118,10 +121,19 @@ bool Snarl_Backend::isPrimaryNotificationBackend(){
|
|||||||
SnarlWidget::SnarlWidget(Snarl_Backend * snarl):
|
SnarlWidget::SnarlWidget(Snarl_Backend * snarl):
|
||||||
_snarl(snarl)
|
_snarl(snarl)
|
||||||
{
|
{
|
||||||
|
SNARL_GLOBAL_MESSAGE = SnarlInterface::Broadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnarlWidget::winEvent(MSG * msg, long * result){
|
bool SnarlWidget::winEvent(MSG * msg, long * result){
|
||||||
if(msg->message == SNORENOTIFIER_MESSAGE_ID){
|
if(msg->message == SNARL_GLOBAL_MESSAGE){
|
||||||
|
int action = msg->wParam;
|
||||||
|
if(action == SnarlEnums::SnarlLaunched){
|
||||||
|
foreach(Application *a,_snarl->snore()->aplications()){
|
||||||
|
_snarl->registerApplication(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(msg->message == SNORENOTIFIER_MESSAGE_ID){
|
||||||
int action = msg->wParam;
|
int action = msg->wParam;
|
||||||
int notificationID = msg->lParam;
|
int notificationID = msg->lParam;
|
||||||
QSharedPointer<Notification> notification = _snarl->activeNotifications->value(notificationID);
|
QSharedPointer<Notification> notification = _snarl->activeNotifications->value(notificationID);
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
bool winEvent( MSG * message, long * result );
|
bool winEvent( MSG * message, long * result );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
uint SNARL_GLOBAL_MESSAGE;
|
||||||
Snarl_Backend* _snarl;
|
Snarl_Backend* _snarl;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user