if the notifications is just clicked emit actionInvoced but dont set the action
This commit is contained in:
parent
e4bdb9b476
commit
bab87aeaf6
|
@ -22,7 +22,7 @@
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
|
|
||||||
QHash<QString,QString> Icon::hasedImages;
|
QHash<QString,QString> Icon::m_localImageCache;
|
||||||
|
|
||||||
Icon::Icon() :
|
Icon::Icon() :
|
||||||
d(NULL)
|
d(NULL)
|
||||||
|
@ -65,15 +65,15 @@ const QImage &Icon::image() const{
|
||||||
QString Icon::localUrl()const{
|
QString Icon::localUrl()const{
|
||||||
if(d->m_localUrl.isEmpty())
|
if(d->m_localUrl.isEmpty())
|
||||||
{
|
{
|
||||||
if(hasedImages.contains(hash()))
|
if(m_localImageCache.contains(hash()))
|
||||||
{
|
{
|
||||||
d->m_localUrl = hasedImages[hash()];
|
d->m_localUrl = m_localImageCache[hash()];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->m_localUrl = QString("%1%2.png").arg(SnoreCore::snoreTMP(), hash());
|
d->m_localUrl = QString("%1%2.png").arg(SnoreCore::snoreTMP(), hash());
|
||||||
image().save(d->m_localUrl ,"PNG");
|
image().save(d->m_localUrl ,"PNG");
|
||||||
hasedImages[hash()] = d->m_localUrl;
|
m_localImageCache[hash()] = d->m_localUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return d->m_localUrl;
|
return d->m_localUrl;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QHash<QString,QString> hasedImages;
|
static QHash<QString,QString> m_localImageCache;
|
||||||
|
|
||||||
QExplicitlySharedDataPointer<IconData> d;
|
QExplicitlySharedDataPointer<IconData> d;
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,8 @@ public:
|
||||||
m_text ( text ),
|
m_text ( text ),
|
||||||
m_icon ( icon ),
|
m_icon ( icon ),
|
||||||
m_priority(priority),
|
m_priority(priority),
|
||||||
m_closeReason(NotificationEnums::CloseReasons::NONE)
|
m_closeReason(NotificationEnums::CloseReasons::NONE),
|
||||||
|
m_actionInvoked( NULL )
|
||||||
{
|
{
|
||||||
notificationCount++;
|
notificationCount++;
|
||||||
qDebug()<< "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
|
qDebug()<< "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
|
||||||
|
@ -42,7 +43,6 @@ public:
|
||||||
uint m_id;
|
uint m_id;
|
||||||
uint m_updateID;
|
uint m_updateID;
|
||||||
int m_timeout;
|
int m_timeout;
|
||||||
Notification::Action *m_actionInvoked;
|
|
||||||
SnoreFrontend *m_source;
|
SnoreFrontend *m_source;
|
||||||
QString m_application;
|
QString m_application;
|
||||||
QString m_alert;
|
QString m_alert;
|
||||||
|
@ -51,6 +51,7 @@ public:
|
||||||
Icon m_icon;
|
Icon m_icon;
|
||||||
NotificationEnums::Prioritys::prioritys m_priority;
|
NotificationEnums::Prioritys::prioritys m_priority;
|
||||||
NotificationEnums::CloseReasons::closeReasons m_closeReason;
|
NotificationEnums::CloseReasons::closeReasons m_closeReason;
|
||||||
|
Notification::Action *m_actionInvoked;
|
||||||
QHash<int,Notification::Action*> m_actions;
|
QHash<int,Notification::Action*> m_actions;
|
||||||
Hint m_hints;
|
Hint m_hints;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef VERSION_H
|
#ifndef SNORE_VERSION_H
|
||||||
#define VERSION_H
|
#define SNORE_VERSION_H
|
||||||
#undef major
|
#undef major
|
||||||
#undef minor
|
#undef minor
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,6 @@ void Growl::gntpCallback(const int &id,const std::string &reason,const std::stri
|
||||||
r = NotificationEnums::CloseReasons::DISMISSED;
|
r = NotificationEnums::CloseReasons::DISMISSED;
|
||||||
else if(reason == "CLICK"){
|
else if(reason == "CLICK"){
|
||||||
r = NotificationEnums::CloseReasons::CLOSED;
|
r = NotificationEnums::CloseReasons::CLOSED;
|
||||||
n.setActionInvoked(QString(data.c_str()).toInt());
|
|
||||||
s_instance->snore()->notificationActionInvoked(n);
|
s_instance->snore()->notificationActionInvoked(n);
|
||||||
}
|
}
|
||||||
s_instance->closeNotification(n,r);
|
s_instance->closeNotification(n,r);
|
||||||
|
|
|
@ -82,6 +82,7 @@ public:
|
||||||
switch(action){
|
switch(action){
|
||||||
case SnarlEnums::CallbackInvoked:
|
case SnarlEnums::CallbackInvoked:
|
||||||
reason = NotificationEnums::CloseReasons::CLOSED;
|
reason = NotificationEnums::CloseReasons::CLOSED;
|
||||||
|
m_snarl->snore()->notificationActionInvoked(notification);
|
||||||
break;
|
break;
|
||||||
case SnarlEnums::NotifyAction:
|
case SnarlEnums::NotifyAction:
|
||||||
reason = NotificationEnums::CloseReasons::CLOSED;
|
reason = NotificationEnums::CloseReasons::CLOSED;
|
||||||
|
|
|
@ -110,11 +110,7 @@ void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
reason = NotificationEnums::CloseReasons::CLOSED;
|
reason = NotificationEnums::CloseReasons::CLOSED;
|
||||||
if(!n.actions().isEmpty())
|
snore()->notificationActionInvoked(n);
|
||||||
{
|
|
||||||
n.setActionInvoked(n.actions().keys().first());
|
|
||||||
snore()->notificationActionInvoked(n);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//hidden;
|
//hidden;
|
||||||
|
|
|
@ -70,12 +70,8 @@ void TrayIconNotifer::actionInvoked(){
|
||||||
|
|
||||||
Notification n = snore()->getActiveNotificationByID(m_displayed);
|
Notification n = snore()->getActiveNotificationByID(m_displayed);
|
||||||
if(n.isValid()){
|
if(n.isValid()){
|
||||||
if(n.actions().isEmpty()){
|
snore()->notificationActionInvoked(n);
|
||||||
n.setActionInvoked(n.actions().keys().first());
|
|
||||||
snore()->notificationActionInvoked(n);
|
|
||||||
}
|
|
||||||
closeNotification(n,NotificationEnums::CloseReasons::CLOSED);
|
closeNotification(n,NotificationEnums::CloseReasons::CLOSED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue