Simplify determination of whether markup is supported
This should also result in a speed increase (however slight), since the capabilities are now sorted through only once.
This commit is contained in:
parent
4150d75be7
commit
4a86e14d04
@ -9,6 +9,8 @@
|
||||
#include <QImage>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
NotificationsManager::NotificationsManager(QObject *parent)
|
||||
@ -161,9 +163,13 @@ NotificationsManager::notificationClosed(uint id, uint reason)
|
||||
QString
|
||||
NotificationsManager::formatNotification(const QString &text)
|
||||
{
|
||||
static auto capabilites = dbus.call("GetCapabilities").arguments();
|
||||
for (auto x : capabilites)
|
||||
static const auto hasMarkup = std::invoke([this]() -> bool {
|
||||
for (auto x : dbus.call("GetCapabilities").arguments())
|
||||
if (x.toStringList().contains("body-markup"))
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
if (hasMarkup)
|
||||
return QString(text)
|
||||
.replace("<em>", "<i>")
|
||||
.replace("</em>", "</i>")
|
||||
|
Loading…
Reference in New Issue
Block a user