Replace prefixing of paths with file:// by QUrl::fromLocalFile()

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
This commit is contained in:
Stephan Beyer 2020-06-09 00:29:42 +02:00
parent 749070a29c
commit 0f620acc1f
2 changed files with 2 additions and 8 deletions

View file

@ -96,8 +96,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
relPath.prepend(folder->remotePath()); relPath.prepend(folder->remotePath());
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account()); list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
if (list.count() > 0) { if (list.count() > 0) {
QString path = "file:///" + QString(list.at(0)); return QUrl::fromLocalFile(list.at(0));
return QUrl(path);
} }
// File does not exist anymore? Let's try to open its path // File does not exist anymore? Let's try to open its path
if (QFileInfo(relPath).exists()) { if (QFileInfo(relPath).exists()) {

View file

@ -420,12 +420,7 @@ void User::openLocalFolder()
const auto folder = getFolder(); const auto folder = getFolder();
if (folder != nullptr) { if (folder != nullptr) {
#ifdef Q_OS_WIN QDesktopServices::openUrl(QUrl::fromLocalFile(folder->path()));
QString path = "file:///" + folder->path();
#else
QString path = "file://" + folder->path();
#endif
QDesktopServices::openUrl(path);
} }
} }