增加对通知紧急程度对应默认行为的处理
This commit is contained in:
parent
8882da2edf
commit
87bf44b1f5
|
@ -284,14 +284,18 @@ void PopupNotification::setHints(const QVariantMap &hints)
|
|||
if(ok) {
|
||||
switch (urgency) {
|
||||
default:
|
||||
case 0:
|
||||
case 0: //低等级,不弹窗
|
||||
setUrgency(Urgency::LowUrgency);
|
||||
d->m_popupTimeout = 0;
|
||||
break;
|
||||
case 1:
|
||||
case 1: //中等级,弹窗时间默认6秒
|
||||
setUrgency(Urgency::NormalUrgency);
|
||||
d->m_popupTimeout = 6;
|
||||
break;
|
||||
case 2:
|
||||
case 2: //高等级,默认弹窗常驻,不可折叠
|
||||
setUrgency(Urgency::CriticalUrgency);
|
||||
d->m_popupTimeout = -1;
|
||||
d->m_noFold = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -324,10 +328,14 @@ void PopupNotification::setHints(const QVariantMap &hints)
|
|||
d->m_suppressSound = hints.value(QStringLiteral("suppress-sound")).toBool();
|
||||
d->m_display = hints.value(QStringLiteral("x-ukui-display")).toString();
|
||||
d->m_actionState = hints.value(QStringLiteral("x-ukui-action-state")).toStringList();
|
||||
d->m_noFold = hints.value(QStringLiteral("x-ukui-no-fold")).toBool();
|
||||
d->m_popupTimeout = hints.value(QStringLiteral("x-ukui-popup-timeout")).toInt();
|
||||
if(d->m_popupTimeout == 0) {
|
||||
d->m_popupTimeout = 6;
|
||||
|
||||
QVariant tmp = hints.value(QStringLiteral("x-ukui-no-fold"));
|
||||
if(!tmp.isNull()) {
|
||||
d->m_noFold = tmp.toBool();
|
||||
}
|
||||
tmp = hints.value(QStringLiteral("x-ukui-popup-timeout"));
|
||||
if(!tmp.isNull()) {
|
||||
d->m_popupTimeout = tmp.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue