Fixed update of qued notifications
This commit is contained in:
parent
f333e04334
commit
a1a569b242
|
@ -47,16 +47,33 @@ void SnoreNotifier::slotNotify(Snore::Notification notification)
|
|||
{
|
||||
|
||||
if(notification.isUpdate())
|
||||
{
|
||||
if(notification.old().hints().privateValue(this, "id").isValid())
|
||||
{
|
||||
NotifyWidget *w = m_widgets[notification.old().hints().privateValue(this, "id").toInt()];
|
||||
if(w->isVisible() && w->notification().isValid() && w->notification().id() == notification.old().id())
|
||||
{
|
||||
qDebug() << "replacing notification" << w->notification().id() << notification.id();
|
||||
w->update(notification);
|
||||
notification.hints().setPrivateValue(this, "id", w->id());
|
||||
startTimeout(notification);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < m_queue.length(); ++i)
|
||||
{
|
||||
Notification n = m_queue.at(i);
|
||||
if(n.id() == notification.old().id())
|
||||
{
|
||||
qDebug() << "replacing qued notification" << n.id() << notification.id();
|
||||
m_queue.replace(i,notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_queue.isEmpty())
|
||||
{
|
||||
foreach (NotifyWidget *w, m_widgets)
|
||||
|
@ -73,6 +90,7 @@ void SnoreNotifier::slotNotify(Snore::Notification notification)
|
|||
m_queue.append(notification);
|
||||
m_timer->start();
|
||||
}
|
||||
}
|
||||
|
||||
void SnoreNotifier::slotCloseNotification(Snore::Notification notification)
|
||||
{
|
||||
|
@ -104,7 +122,6 @@ void SnoreNotifier::slotProcessQueue()
|
|||
{
|
||||
if(m_queue.isEmpty())
|
||||
{
|
||||
|
||||
snoreDebug( SNORE_DEBUG ) << "queue is empty";
|
||||
m_timer->stop();
|
||||
}
|
||||
|
@ -120,6 +137,7 @@ void SnoreNotifier::slotProcessQueue()
|
|||
startTimeout(notification);
|
||||
if(m_queue.isEmpty())
|
||||
{
|
||||
m_timer->stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue