Handle close on qued notification

This commit is contained in:
Hannah von Reth 2015-10-05 16:18:31 +02:00
parent f5fbb6a7ed
commit 9adfebd339
3 changed files with 12 additions and 4 deletions

View File

@ -280,12 +280,18 @@ public:
bool isActiveIn(const QObject *o) const;
bool removeActiveIn(const QObject *o);
inline bool operator ==(const Notification &other);
private:
QExplicitlySharedDataPointer<NotificationData> d;
friend class NotificationData;
};
inline bool Notification::operator ==(const Notification &other){
return id() == other.id();
}
}
Q_DECLARE_METATYPE(Snore::Notification)

View File

@ -116,7 +116,6 @@ void SnoreCore::broadcastNotification(Notification notification)
{
Q_D(SnoreCore);
if (d->m_activeNotifications.size() > d->maxNumberOfActiveNotifications()) {
#pragma message "TODO: handle updates in queue"
snoreDebug(SNORE_DEBUG) << "queue size:" << d->m_notificationQue.size() << "active size:" << d->m_activeNotifications.size();
d->m_notificationQue.append(notification);
return;
@ -189,8 +188,11 @@ bool SnoreCore::setPrimaryNotificationBackend(const QString &backend)
void SnoreCore::requestCloseNotification(Notification n, Notification::CloseReasons r)
{
Q_D(SnoreCore);
if (d->m_notificationBackend) {
bool wasQued = d->m_notificationQue.removeOne(n);
if(wasQued){
snoreDebug(SNORE_DEBUG) << n << " was qued.";
}
if (!wasQued && d->m_notificationBackend) {
d->m_notificationBackend->requestCloseNotification(n, r);
} else {
if (n.isValid()) {

View File

@ -27,7 +27,7 @@
using namespace Snore;
SnoreNotifier::SnoreNotifier():
m_widgets(1),
m_widgets(3),
m_timer(new QTimer(this))
{
for (int i = 0; i < m_widgets.size(); ++i) {