Fix findthisdevice sound URL

This commit is contained in:
Nicolas Fella 2020-05-14 15:06:49 +02:00
parent dc9da25fc9
commit 4df8dfc882
2 changed files with 3 additions and 3 deletions

View file

@ -47,7 +47,7 @@ bool FindThisDevicePlugin::receivePacket(const NetworkPacket& np)
{ {
Q_UNUSED(np); Q_UNUSED(np);
const QString soundFile = config()->get<QString>(QStringLiteral("ringtone"), defaultSound()); const QString soundFile = config()->get<QString>(QStringLiteral("ringtone"), defaultSound());
const QUrl soundURL = QUrl(soundFile); const QUrl soundURL = QUrl::fromLocalFile(soundFile);
if (soundURL.isEmpty()) { if (soundURL.isEmpty()) {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sound, no valid ring tone specified."; qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sound, no valid ring tone specified.";
return true; return true;

View file

@ -81,7 +81,7 @@ inline QString defaultSound()
soundURL = QUrl::fromUserInput(QStringLiteral("Oxygen-Im-Phone-Ring.ogg"), soundURL = QUrl::fromUserInput(QStringLiteral("Oxygen-Im-Phone-Ring.ogg"),
dirPath, dirPath,
QUrl::AssumeLocalFile); QUrl::AssumeLocalFile);
if ((soundURL.isLocalFile() && QFile::exists(soundURL.toLocalFile())) || soundURL.isValid()) { if ((soundURL.isLocalFile() && soundURL.isValid() && QFile::exists(soundURL.toLocalFile()))) {
break; break;
} }
} }
@ -89,7 +89,7 @@ inline QString defaultSound()
if (soundURL.isEmpty()) { if (soundURL.isEmpty()) {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Could not find default ring tone."; qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Could not find default ring tone.";
} }
return soundURL.toString(); return soundURL.toLocalFile();
} }
#endif //FINDTHISDEVICEPLUGIN_H #endif //FINDTHISDEVICEPLUGIN_H