fix markup stuff

This commit is contained in:
Patrick von Reth 2015-06-26 11:37:34 +02:00
parent 3031723315
commit 711e880dd7
3 changed files with 13 additions and 10 deletions

View File

@ -94,20 +94,12 @@ const Application &Notification::application() const
QString Notification::title(Utils::MARKUP_FLAGS flags) const QString Notification::title(Utils::MARKUP_FLAGS flags) const
{ {
if(!application().constHints().value("use-markup").toBool()) { return d->resolveMarkup(d->m_title, flags);
return d->m_title.toHtmlEscaped();
} else {
return Utils::normaliseMarkup(d->m_title, flags);
}
} }
QString Notification::text(Utils::MARKUP_FLAGS flags) const QString Notification::text(Utils::MARKUP_FLAGS flags) const
{ {
if(!application().constHints().value("use-markup").toBool()) { return d->resolveMarkup(d->m_text, flags);
return d->m_text.toHtmlEscaped();
}else {
return Utils::normaliseMarkup(d->m_text, flags);
}
} }
const Alert &Notification::alert() const const Alert &Notification::alert() const

View File

@ -90,6 +90,15 @@ void NotificationData::setTimeoutTimer(QTimer *timer)
m_timeoutTimer.reset(timer); m_timeoutTimer.reset(timer);
} }
QString NotificationData::resolveMarkup(const QString &string, Utils::MARKUP_FLAGS flags)
{
if(flags != Utils::NO_MARKUP && !m_application.constHints().value("use-markup").toBool()) {
return string.toHtmlEscaped();
} else {
return Utils::normaliseMarkup(string, flags);
}
}
void NotificationData::initHints() void NotificationData::initHints()
{ {
m_hints.setValue("silent", SnoreCore::instance().value("Silent", LOCAL_SETTING)); m_hints.setValue("silent", SnoreCore::instance().value("Silent", LOCAL_SETTING));

View File

@ -48,6 +48,8 @@ public:
void setTimeoutTimer(QTimer *timer); void setTimeoutTimer(QTimer *timer);
QString resolveMarkup(const QString &string, Utils::MARKUP_FLAGS flags);
private: private:
Q_DISABLE_COPY(NotificationData) Q_DISABLE_COPY(NotificationData)