调整通知hints的一些字段处理

This commit is contained in:
iaom 2023-05-04 16:51:49 +08:00
parent 108a10c058
commit 3b584e13ca
1 changed files with 13 additions and 10 deletions

View File

@ -259,7 +259,6 @@ void PopupNotification::setActions(const QStringList &actions)
if (!d->m_hasDefaultAction && key == QLatin1String("default")) {
d->m_hasDefaultAction = true;
d->m_defaultActionLabel = label;
continue;
}
d->m_actions.append({key, label});
}
@ -283,15 +282,16 @@ void PopupNotification::setHints(const QVariantMap &hints)
int urgency = hints.value(QStringLiteral("urgency")).toInt(&ok);
if(ok) {
switch (urgency) {
case 0:
setUrgency(Urgency::LowUrgency);
break;
case 1:
setUrgency(Urgency::NormalUrgency);
break;
case 2:
setUrgency(Urgency::CriticalUrgency);
break;
default:
case 0:
setUrgency(Urgency::LowUrgency);
break;
case 1:
setUrgency(Urgency::NormalUrgency);
break;
case 2:
setUrgency(Urgency::CriticalUrgency);
break;
}
}
d->m_createdTime = QDateTime::fromString(hints.value(QStringLiteral("x-ukui-createdTime")).toString());
@ -324,6 +324,9 @@ void PopupNotification::setHints(const QVariantMap &hints)
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;
}
}
int PopupNotification::timeout() const