parent
af259d5579
commit
f03b3f5c33
@ -0,0 +1,37 @@
|
||||
diff --git a/src/notifybyaudio.cpp b/src/notifybyaudio.cpp
|
||||
index 6ae63b8df8e7aa692e88b03ca7b7538c78101917..903e9969895af543c9ef56b39c88b3072c1a099b 100644
|
||||
--- a/src/notifybyaudio.cpp
|
||||
+++ b/src/notifybyaudio.cpp
|
||||
@@ -60,16 +60,23 @@ void NotifyByAudio::notify(KNotification *notification, KNotifyConfig *config)
|
||||
return;
|
||||
}
|
||||
|
||||
- QUrl soundURL = QUrl(soundFilename); // this CTOR accepts both absolute paths (/usr/share/sounds/blabla.ogg and blabla.ogg) w/o screwing the scheme
|
||||
- if (soundURL.isRelative() && !soundURL.toString().startsWith('/')) { // QUrl considers url.scheme.isEmpty() == url.isRelative()
|
||||
- soundURL = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("sounds/") + soundFilename));
|
||||
-
|
||||
- if (soundURL.isEmpty()) {
|
||||
- qCWarning(LOG_KNOTIFICATIONS) << "Audio notification requested, but sound file from notifyrc file was not found, aborting audio notification";
|
||||
-
|
||||
- finish(notification);
|
||||
- return;
|
||||
+ QUrl soundURL;
|
||||
+ const auto dataLocations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
|
||||
+ foreach (const QString &dataLocation, dataLocations) {
|
||||
+ soundURL = QUrl::fromUserInput(soundFilename,
|
||||
+ dataLocation + "/sounds",
|
||||
+ QUrl::AssumeLocalFile);
|
||||
+ if (soundURL.isLocalFile() && QFile::exists(soundURL.toLocalFile())) {
|
||||
+ break;
|
||||
+ } else if (!soundURL.isLocalFile() && soundURL.isValid()) {
|
||||
+ break;
|
||||
}
|
||||
+ soundURL.clear();
|
||||
+ }
|
||||
+ if (soundURL.isEmpty()) {
|
||||
+ qCWarning(LOG_KNOTIFICATIONS) << "Audio notification requested, but sound file from notifyrc file was not found, aborting audio notification";
|
||||
+ finish(notification);
|
||||
+ return;
|
||||
}
|
||||
|
||||
Phonon::MediaObject *m;
|
Loading…
Reference in new issue