prevent notification loops
This commit is contained in:
parent
f724133f31
commit
7713c61fdb
|
@ -54,6 +54,19 @@ public:
|
||||||
|
|
||||||
bool isBroadcasted() const;
|
bool isBroadcasted() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the source SnorePlugin.
|
||||||
|
* @see source()
|
||||||
|
*/
|
||||||
|
void setSource(const SnorePlugin *soure);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the source SnorePlugin.
|
||||||
|
* This is used to prevent notification loops between the frontend and the backend.
|
||||||
|
*/
|
||||||
|
const SnorePlugin* source() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(NotificationData)
|
Q_DISABLE_COPY(NotificationData)
|
||||||
|
|
||||||
|
@ -74,6 +87,7 @@ private:
|
||||||
QScopedPointer<QTimer> m_timeoutTimer;
|
QScopedPointer<QTimer> m_timeoutTimer;
|
||||||
QSet<const QObject *> m_activeIn;
|
QSet<const QObject *> m_activeIn;
|
||||||
bool m_isBroadcasted = false;
|
bool m_isBroadcasted = false;
|
||||||
|
SnorePlugin *m_source = nullptr;
|
||||||
|
|
||||||
static uint notificationCount;
|
static uint notificationCount;
|
||||||
static uint m_idCount;
|
static uint m_idCount;
|
||||||
|
|
|
@ -52,6 +52,10 @@ bool FreedesktopBackend::canUpdateNotification() const
|
||||||
|
|
||||||
void FreedesktopBackend::slotNotify(Notification noti)
|
void FreedesktopBackend::slotNotify(Notification noti)
|
||||||
{
|
{
|
||||||
|
if(noti.data()->source()->name() == name()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList actions;
|
QStringList actions;
|
||||||
foreach (int k, noti.actions().keys()) {
|
foreach (int k, noti.actions().keys()) {
|
||||||
actions << QString::number(k) << noti.actions()[k].name();
|
actions << QString::number(k) << noti.actions()[k].name();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{ "type" : "frontend", "name" : "Pushover Frontend" }
|
{ "type" : "frontend", "name" : "Pushover" }
|
|
@ -28,6 +28,10 @@ using namespace Snore;
|
||||||
|
|
||||||
void Pushover::slotNotify(Notification notification)
|
void Pushover::slotNotify(Notification notification)
|
||||||
{
|
{
|
||||||
|
if(notification.data()->source()->name() == name()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString key = settingsValue(QLatin1String("UserKey")).toString();
|
QString key = settingsValue(QLatin1String("UserKey")).toString();
|
||||||
if (key.isEmpty()) {
|
if (key.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue