diff --git a/src/libsnore/notification/notification.cpp b/src/libsnore/notification/notification.cpp index f5f68bf..9a9bdf3 100644 --- a/src/libsnore/notification/notification.cpp +++ b/src/libsnore/notification/notification.cpp @@ -94,20 +94,12 @@ const Application &Notification::application() const QString Notification::title(Utils::MARKUP_FLAGS flags) const { - if(!application().constHints().value("use-markup").toBool()) { - return d->m_title.toHtmlEscaped(); - } else { - return Utils::normaliseMarkup(d->m_title, flags); - } + return d->resolveMarkup(d->m_title, flags); } QString Notification::text(Utils::MARKUP_FLAGS flags) const { - if(!application().constHints().value("use-markup").toBool()) { - return d->m_text.toHtmlEscaped(); - }else { - return Utils::normaliseMarkup(d->m_text, flags); - } + return d->resolveMarkup(d->m_text, flags); } const Alert &Notification::alert() const diff --git a/src/libsnore/notification/notification_p.cpp b/src/libsnore/notification/notification_p.cpp index d7e9e1d..784ac40 100644 --- a/src/libsnore/notification/notification_p.cpp +++ b/src/libsnore/notification/notification_p.cpp @@ -90,6 +90,15 @@ void NotificationData::setTimeoutTimer(QTimer *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() { m_hints.setValue("silent", SnoreCore::instance().value("Silent", LOCAL_SETTING)); diff --git a/src/libsnore/notification/notification_p.h b/src/libsnore/notification/notification_p.h index c70a32b..5efbdb3 100644 --- a/src/libsnore/notification/notification_p.h +++ b/src/libsnore/notification/notification_p.h @@ -48,6 +48,8 @@ public: void setTimeoutTimer(QTimer *timer); + QString resolveMarkup(const QString &string, Utils::MARKUP_FLAGS flags); + private: Q_DISABLE_COPY(NotificationData)