mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-10 00:25:43 +00:00
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;
|
||||
|
||||
|
||||
QHash<QString,QString> Icon::hasedImages;
|
||||
QHash<QString,QString> Icon::m_localImageCache;
|
||||
|
||||
Icon::Icon() :
|
||||
d(NULL)
|
||||
@ -65,15 +65,15 @@ const QImage &Icon::image() const{
|
||||
QString Icon::localUrl()const{
|
||||
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
|
||||
{
|
||||
d->m_localUrl = QString("%1%2.png").arg(SnoreCore::snoreTMP(), hash());
|
||||
image().save(d->m_localUrl ,"PNG");
|
||||
hasedImages[hash()] = d->m_localUrl;
|
||||
m_localImageCache[hash()] = d->m_localUrl;
|
||||
}
|
||||
}
|
||||
return d->m_localUrl;
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
static QHash<QString,QString> hasedImages;
|
||||
static QHash<QString,QString> m_localImageCache;
|
||||
|
||||
QExplicitlySharedDataPointer<IconData> d;
|
||||
};
|
||||
|
@ -26,7 +26,8 @@ public:
|
||||
m_text ( text ),
|
||||
m_icon ( icon ),
|
||||
m_priority(priority),
|
||||
m_closeReason(NotificationEnums::CloseReasons::NONE)
|
||||
m_closeReason(NotificationEnums::CloseReasons::NONE),
|
||||
m_actionInvoked( NULL )
|
||||
{
|
||||
notificationCount++;
|
||||
qDebug()<< "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
|
||||
@ -42,7 +43,6 @@ public:
|
||||
uint m_id;
|
||||
uint m_updateID;
|
||||
int m_timeout;
|
||||
Notification::Action *m_actionInvoked;
|
||||
SnoreFrontend *m_source;
|
||||
QString m_application;
|
||||
QString m_alert;
|
||||
@ -51,6 +51,7 @@ public:
|
||||
Icon m_icon;
|
||||
NotificationEnums::Prioritys::prioritys m_priority;
|
||||
NotificationEnums::CloseReasons::closeReasons m_closeReason;
|
||||
Notification::Action *m_actionInvoked;
|
||||
QHash<int,Notification::Action*> m_actions;
|
||||
Hint m_hints;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
#ifndef SNORE_VERSION_H
|
||||
#define SNORE_VERSION_H
|
||||
#undef major
|
||||
#undef minor
|
||||
|
||||
|
@ -98,7 +98,6 @@ void Growl::gntpCallback(const int &id,const std::string &reason,const std::stri
|
||||
r = NotificationEnums::CloseReasons::DISMISSED;
|
||||
else if(reason == "CLICK"){
|
||||
r = NotificationEnums::CloseReasons::CLOSED;
|
||||
n.setActionInvoked(QString(data.c_str()).toInt());
|
||||
s_instance->snore()->notificationActionInvoked(n);
|
||||
}
|
||||
s_instance->closeNotification(n,r);
|
||||
|
@ -82,6 +82,7 @@ public:
|
||||
switch(action){
|
||||
case SnarlEnums::CallbackInvoked:
|
||||
reason = NotificationEnums::CloseReasons::CLOSED;
|
||||
m_snarl->snore()->notificationActionInvoked(notification);
|
||||
break;
|
||||
case SnarlEnums::NotifyAction:
|
||||
reason = NotificationEnums::CloseReasons::CLOSED;
|
||||
|
@ -110,11 +110,7 @@ void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus)
|
||||
{
|
||||
case 0:
|
||||
reason = NotificationEnums::CloseReasons::CLOSED;
|
||||
if(!n.actions().isEmpty())
|
||||
{
|
||||
n.setActionInvoked(n.actions().keys().first());
|
||||
snore()->notificationActionInvoked(n);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//hidden;
|
||||
|
@ -70,12 +70,8 @@ void TrayIconNotifer::actionInvoked(){
|
||||
|
||||
Notification n = snore()->getActiveNotificationByID(m_displayed);
|
||||
if(n.isValid()){
|
||||
if(n.actions().isEmpty()){
|
||||
n.setActionInvoked(n.actions().keys().first());
|
||||
snore()->notificationActionInvoked(n);
|
||||
}
|
||||
closeNotification(n,NotificationEnums::CloseReasons::CLOSED);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user