From 0f620acc1f9d77dfb906e8f906a89912e3e822a9 Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Tue, 9 Jun 2020 00:29:42 +0200 Subject: [PATCH] Replace prefixing of paths with file:// by QUrl::fromLocalFile() Signed-off-by: Stephan Beyer --- src/gui/tray/ActivityListModel.cpp | 3 +-- src/gui/tray/UserModel.cpp | 7 +------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gui/tray/ActivityListModel.cpp b/src/gui/tray/ActivityListModel.cpp index 1aea5ee1c..f6c9a1778 100644 --- a/src/gui/tray/ActivityListModel.cpp +++ b/src/gui/tray/ActivityListModel.cpp @@ -96,8 +96,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const relPath.prepend(folder->remotePath()); list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account()); if (list.count() > 0) { - QString path = "file:///" + QString(list.at(0)); - return QUrl(path); + return QUrl::fromLocalFile(list.at(0)); } // File does not exist anymore? Let's try to open its path if (QFileInfo(relPath).exists()) { diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index 106fb36b4..7eb07ec51 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -420,12 +420,7 @@ void User::openLocalFolder() const auto folder = getFolder(); if (folder != nullptr) { -#ifdef Q_OS_WIN - QString path = "file:///" + folder->path(); -#else - QString path = "file://" + folder->path(); -#endif - QDesktopServices::openUrl(path); + QDesktopServices::openUrl(QUrl::fromLocalFile(folder->path())); } }