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) {
window->requestActivate();
}
QString App::convertUrlToLocalPath (const QUrl &url) {
return QDir::toNativeSeparators(url.toLocalFile());
}
// -----------------------------------------------------------------------------
bool App::hasFocus () const {
......
......@@ -71,6 +71,8 @@ public:
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
Q_INVOKABLE static QString convertUrlToLocalPath (const QUrl &url);
public slots:
void quit ();
......
......@@ -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)
......
......@@ -98,6 +98,6 @@ int main (int argc, char *argv[]) {
// ---------------------------------------------------------------------------
app.initContentApp();
qInfo() << "Running app...";
qInfo() << QStringLiteral("Running app...");
return app.exec();
}
......@@ -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
......
......@@ -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) {
......
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