Commit 65bfcb98 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/app/App): add a `convertUrlToLocalPath` function

parent be46f8cf
...@@ -261,6 +261,10 @@ void App::smartShowWindow (QQuickWindow *window) { ...@@ -261,6 +261,10 @@ void App::smartShowWindow (QQuickWindow *window) {
window->requestActivate(); window->requestActivate();
} }
QString App::convertUrlToLocalPath (const QUrl &url) {
return QDir::toNativeSeparators(url.toLocalFile());
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool App::hasFocus () const { bool App::hasFocus () const {
......
...@@ -71,6 +71,8 @@ public: ...@@ -71,6 +71,8 @@ public:
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window); Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
Q_INVOKABLE static QString convertUrlToLocalPath (const QUrl &url);
public slots: public slots:
void quit (); void quit ();
......
...@@ -428,12 +428,7 @@ void ChatModel::downloadFile (int id, const QString &downloadPath) { ...@@ -428,12 +428,7 @@ void ChatModel::downloadFile (int id, const QString &downloadPath) {
return; return;
} }
message->setFileTransferFilepath( message->setFileTransferFilepath(::Utils::qStringToLinphoneString(downloadPath));
::Utils::qStringToLinphoneString(downloadPath.startsWith("file://")
? downloadPath.mid(sizeof("file://") - 1)
: downloadPath
)
);
message->setListener(mMessageHandlers); message->setListener(mMessageHandlers);
if (message->downloadFile() < 0) if (message->downloadFile() < 0)
......
...@@ -98,6 +98,6 @@ int main (int argc, char *argv[]) { ...@@ -98,6 +98,6 @@ int main (int argc, char *argv[]) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
app.initContentApp(); app.initContentApp();
qInfo() << "Running app..."; qInfo() << QStringLiteral("Running app...");
return app.exec(); return app.exec();
} }
...@@ -186,7 +186,7 @@ Row { ...@@ -186,7 +186,7 @@ Row {
selectExisting: false selectExisting: false
title: qsTr('downloadFileTitle') title: qsTr('downloadFileTitle')
onAccepted: proxyModel.downloadFile(index, fileUrl) onAccepted: proxyModel.downloadFile(index, App.convertUrlToLocalPath(fileUrl))
} }
anchors.fill: parent anchors.fill: parent
......
...@@ -117,8 +117,8 @@ function cancel () { ...@@ -117,8 +117,8 @@ function cancel () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function setAvatar (path) { function setAvatar (url) {
contactEdit._vcard.avatar = path.match(/^(?:file:\/\/)?(.*)$/)[1] contactEdit._vcard.avatar = Linphone.App.convertUrlToLocalPath(url)
} }
function setUsername (username) { function setUsername (username) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment