Escape HTML characters in notify strings

This commit is contained in:
David Sansome 2010-01-08 19:50:29 +00:00
parent 8095e3ce1e
commit 13c64ac33f
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#include "osd.h"
#include <QCoreApplication>
#include <QtDebug>
OSD::OSD(QSystemTrayIcon* tray_icon, QObject* parent)
: QObject(parent),
@ -19,11 +20,11 @@ void OSD::SongChanged(const Song &song) {
if (!song.album().isEmpty())
message_parts << song.album();
if (song.disc() > 0)
message_parts << QString("Disc %1").arg(song.disc());
message_parts << QString("disc %1").arg(song.disc());
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() {

View File

@ -7,6 +7,7 @@
#include <QCoreApplication>
#include <QtDebug>
#include <QTextDocument>
void OSD::Init() {
notification_ = NULL;
@ -22,10 +23,10 @@ void OSD::ShowMessage(const QString& summary, const QString& message,
if (notification_) {
notify_notification_update(notification_,
STR(summary), STR(message), STR(icon));
STR(summary), STR(Qt::escape(message)), STR(icon));
} else {
notification_ = notify_notification_new(
STR(summary), STR(message), STR(icon), NULL);
STR(summary), STR(Qt::escape(message)), STR(icon), NULL);
}
#undef STR