Escape HTML characters in notify strings
This commit is contained in:
parent
8095e3ce1e
commit
13c64ac33f
@ -1,6 +1,7 @@
|
|||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
OSD::OSD(QSystemTrayIcon* tray_icon, QObject* parent)
|
OSD::OSD(QSystemTrayIcon* tray_icon, QObject* parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
@ -19,11 +20,11 @@ void OSD::SongChanged(const Song &song) {
|
|||||||
if (!song.album().isEmpty())
|
if (!song.album().isEmpty())
|
||||||
message_parts << song.album();
|
message_parts << song.album();
|
||||||
if (song.disc() > 0)
|
if (song.disc() > 0)
|
||||||
message_parts << QString("Disc %1").arg(song.disc());
|
message_parts << QString("disc %1").arg(song.disc());
|
||||||
if (song.track() > 0)
|
if (song.track() > 0)
|
||||||
message_parts << QString("Track %1").arg(song.track());
|
message_parts << QString("track %1").arg(song.track());
|
||||||
|
|
||||||
ShowMessage(summary, message_parts.join(" "), "notification-audio-play");
|
ShowMessage(summary, message_parts.join(", "), "notification-audio-play");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSD::Paused() {
|
void OSD::Paused() {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QTextDocument>
|
||||||
|
|
||||||
void OSD::Init() {
|
void OSD::Init() {
|
||||||
notification_ = NULL;
|
notification_ = NULL;
|
||||||
@ -22,10 +23,10 @@ void OSD::ShowMessage(const QString& summary, const QString& message,
|
|||||||
|
|
||||||
if (notification_) {
|
if (notification_) {
|
||||||
notify_notification_update(notification_,
|
notify_notification_update(notification_,
|
||||||
STR(summary), STR(message), STR(icon));
|
STR(summary), STR(Qt::escape(message)), STR(icon));
|
||||||
} else {
|
} else {
|
||||||
notification_ = notify_notification_new(
|
notification_ = notify_notification_new(
|
||||||
STR(summary), STR(message), STR(icon), NULL);
|
STR(summary), STR(Qt::escape(message)), STR(icon), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef STR
|
#undef STR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user