Skip to content

Commit

Permalink
Properly convert url to file
Browse files Browse the repository at this point in the history
file:// prefix removal commonly works except when it surprisingly doesn't.
  • Loading branch information
pvuorela committed Aug 21, 2020
1 parent 4939756 commit 8790cc5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/notifications/notificationfeedbackplayer.cpp
Expand Up @@ -14,6 +14,8 @@

#include <NgfClient>
#include <QWaylandSurface>
#include <QUrl>

#include "lipstickcompositor.h"
#include "notificationmanager.h"
#include "lipsticknotification.h"
Expand Down Expand Up @@ -77,8 +79,9 @@ void NotificationFeedbackPlayer::addNotification(uint id)

QString soundFile = notification->hints().value(LipstickNotification::HINT_SOUND_FILE).toString();
if (!soundFile.isEmpty()) {
if (soundFile.startsWith(QStringLiteral("file://")))
soundFile.remove(0, 7);
if (soundFile.startsWith(QStringLiteral("file://"))) {
soundFile = QUrl(soundFile).toLocalFile();
}

properties.insert(QStringLiteral("sound.filename"), soundFile);
// Sound is enabled explicitly if sound-file hint is set.
Expand Down

0 comments on commit 8790cc5

Please sign in to comment.