Replace prefixing of paths with file:// by QUrl::fromLocalFile()
authorStephan Beyer <s-beyer@gmx.net>
Mon, 8 Jun 2020 22:29:42 +0000 (00:29 +0200)
committerStephan Beyer <s-beyer@gmx.net>
Tue, 9 Jun 2020 14:45:46 +0000 (16:45 +0200)
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
src/gui/tray/ActivityListModel.cpp
src/gui/tray/UserModel.cpp

index 1aea5ee1c46228ef11809b6553a9e7890b540eef..f6c9a177855a9a7a3479e86bec0918e242fed830 100644 (file)
@@ -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()) {
index 106fb36b4acfc883fe34a5276a5b0baed98463d3..7eb07ec51f04c2fa5d6841cd3310496c2e623eed 100644 (file)
@@ -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()));
     }
 }