add possebility for secondary backends to only perfrom an action when the notification is displayed and not when it is broadcasted
This commit is contained in:
parent
4b0b6e128b
commit
a21fd43b88
|
@ -76,7 +76,7 @@ void SnoreBackend::closeNotification(Notification n, Notification::CloseReasons
|
|||
return;
|
||||
}
|
||||
n.removeActiveIn(this);
|
||||
if (n.isUpdate() && n.old().isActiveIn(this)) {
|
||||
if (n.isUpdate()) {
|
||||
n.old().removeActiveIn(this);
|
||||
}
|
||||
n.data()->setCloseReason(reason);
|
||||
|
@ -111,14 +111,16 @@ bool SnoreSecondaryBackend::initialize()
|
|||
if (!SnorePlugin::initialize()) {
|
||||
return false;
|
||||
}
|
||||
connect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)), Qt::QueuedConnection);
|
||||
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreSecondaryBackend::slotNotify, Qt::QueuedConnection);
|
||||
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notificationDisplayed, this, &SnoreSecondaryBackend::slotNotificationDisplayed, Qt::QueuedConnection);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnoreSecondaryBackend::deinitialize()
|
||||
{
|
||||
if (SnorePlugin::deinitialize()) {
|
||||
disconnect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreSecondaryBackend::slotNotify);
|
||||
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notificationDisplayed, this, &SnoreSecondaryBackend::slotNotificationDisplayed);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -129,6 +131,16 @@ bool SnoreSecondaryBackend::supportsRichtext()
|
|||
return m_supportsRichtext;
|
||||
}
|
||||
|
||||
void SnoreSecondaryBackend::slotNotify(Notification)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SnoreSecondaryBackend::slotNotificationDisplayed(Notification)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool SnoreBackend::canCloseNotification() const
|
||||
{
|
||||
return m_canCloseNotification;
|
||||
|
|
|
@ -87,7 +87,8 @@ public:
|
|||
bool supportsRichtext();
|
||||
|
||||
public slots:
|
||||
virtual void slotNotify(Snore::Notification notification) = 0;
|
||||
virtual void slotNotify(Snore::Notification notification);
|
||||
virtual void slotNotificationDisplayed(Snore::Notification notification);
|
||||
|
||||
protected:
|
||||
bool m_supportsRichtext;
|
||||
|
|
|
@ -47,7 +47,7 @@ PluginSettingsWidget *Sound::settingsWidget()
|
|||
return new SoundSettings(this);
|
||||
}
|
||||
|
||||
void Sound::slotNotify(Snore::Notification notification)
|
||||
void Sound::slotNotificationDisplayed(Snore::Notification notification)
|
||||
{
|
||||
if (notification.hints().value("silent", false).toBool()) {
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
Snore::PluginSettingsWidget *settingsWidget() override;
|
||||
|
||||
public slots:
|
||||
void slotNotify(Snore::Notification notification) override;
|
||||
void slotNotificationDisplayed(Snore::Notification notification) override;
|
||||
private:
|
||||
class QMediaPlayer *m_player;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue