diff --git a/linphone-desktop/src/app/App.cpp b/linphone-desktop/src/app/App.cpp index bbea3aad9..2eeb5a9ef 100644 --- a/linphone-desktop/src/app/App.cpp +++ b/linphone-desktop/src/app/App.cpp @@ -261,6 +261,10 @@ void App::smartShowWindow (QQuickWindow *window) { window->requestActivate(); } +QString App::convertUrlToLocalPath (const QUrl &url) { + return QDir::toNativeSeparators(url.toLocalFile()); +} + // ----------------------------------------------------------------------------- bool App::hasFocus () const { diff --git a/linphone-desktop/src/app/App.hpp b/linphone-desktop/src/app/App.hpp index 24b9eeb53..4d2430e6f 100644 --- a/linphone-desktop/src/app/App.hpp +++ b/linphone-desktop/src/app/App.hpp @@ -71,6 +71,8 @@ public: Q_INVOKABLE static void smartShowWindow (QQuickWindow *window); + Q_INVOKABLE static QString convertUrlToLocalPath (const QUrl &url); + public slots: void quit (); diff --git a/linphone-desktop/src/components/chat/ChatModel.cpp b/linphone-desktop/src/components/chat/ChatModel.cpp index 3c7f8fdae..0e0d8de6e 100644 --- a/linphone-desktop/src/components/chat/ChatModel.cpp +++ b/linphone-desktop/src/components/chat/ChatModel.cpp @@ -428,12 +428,7 @@ void ChatModel::downloadFile (int id, const QString &downloadPath) { return; } - message->setFileTransferFilepath( - ::Utils::qStringToLinphoneString(downloadPath.startsWith("file://") - ? downloadPath.mid(sizeof("file://") - 1) - : downloadPath - ) - ); + message->setFileTransferFilepath(::Utils::qStringToLinphoneString(downloadPath)); message->setListener(mMessageHandlers); if (message->downloadFile() < 0) diff --git a/linphone-desktop/src/main.cpp b/linphone-desktop/src/main.cpp index 7ac4a00da..3faeb435c 100644 --- a/linphone-desktop/src/main.cpp +++ b/linphone-desktop/src/main.cpp @@ -98,6 +98,6 @@ int main (int argc, char *argv[]) { // --------------------------------------------------------------------------- app.initContentApp(); - qInfo() << "Running app..."; + qInfo() << QStringLiteral("Running app..."); return app.exec(); } diff --git a/linphone-desktop/ui/modules/Linphone/Chat/FileMessage.qml b/linphone-desktop/ui/modules/Linphone/Chat/FileMessage.qml index 48e23183d..371fea724 100644 --- a/linphone-desktop/ui/modules/Linphone/Chat/FileMessage.qml +++ b/linphone-desktop/ui/modules/Linphone/Chat/FileMessage.qml @@ -186,7 +186,7 @@ Row { selectExisting: false title: qsTr('downloadFileTitle') - onAccepted: proxyModel.downloadFile(index, fileUrl) + onAccepted: proxyModel.downloadFile(index, App.convertUrlToLocalPath(fileUrl)) } anchors.fill: parent diff --git a/linphone-desktop/ui/views/App/Main/ContactEdit.js b/linphone-desktop/ui/views/App/Main/ContactEdit.js index c04406e75..310e5943d 100644 --- a/linphone-desktop/ui/views/App/Main/ContactEdit.js +++ b/linphone-desktop/ui/views/App/Main/ContactEdit.js @@ -117,8 +117,8 @@ function cancel () { // ----------------------------------------------------------------------------- -function setAvatar (path) { - contactEdit._vcard.avatar = path.match(/^(?:file:\/\/)?(.*)$/)[1] +function setAvatar (url) { + contactEdit._vcard.avatar = Linphone.App.convertUrlToLocalPath(url) } function setUsername (username) {