Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [248935/desktop] click offline smb dir two dfm window opened. #1903

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/dfm-base/base/device/deviceutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ QUrl DeviceUtils::getSambaFileUriFromNative(const QUrl &url)
// /root/.gvfs/smb-share...../helloworld.txt
// /media/user/smbmounts/smb-share...../helloworld.txt
// ======> helloworld.txt
static const QRegularExpression prefix(R"(^/run/user/.*/gvfs/.*/|^/root/.gvfs/.*/|^/media/.*/smbmounts/.*/)");
static const QRegularExpression prefix(R"(^/run/user/.*/gvfs/[^/]*/|^/root/.gvfs/[^/]*/|^/media/.*/smbmounts/[^/]*/)");
QString fileName = fullPath.remove(prefix);
fileName.chop(1); // remove last '/'.

smbUrl.setHost(host);
fileName.isEmpty() ? smbUrl.setPath("/" + share) : smbUrl.setPath("/" + share + "/" + fileName);
Expand Down
12 changes: 5 additions & 7 deletions src/dfm-base/file/local/localfilehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ bool LocalFileHandler::openFilesByApp(const QList<QUrl> &fileUrls, const QString
// the correct approach: let the app add it to the recent list.
// addToRecentFile(DUrl::fromLocalFile(filePath), mimetype);
QString mimetype = d->getFileMimetype(fileUrls.first());
QtConcurrent::run([this, fileUrls, desktopFile, mimetype](){
QtConcurrent::run([this, fileUrls, desktopFile, mimetype]() {
d->asyncAddRecentFile(desktopFile, fileUrls, mimetype);
});
}
Expand Down Expand Up @@ -1057,13 +1057,13 @@ bool LocalFileHandlerPrivate::doOpenFiles(const QList<QUrl> &urls, const QString
isOpenNow = true;
mimeType = QString();
mountOpenInfos.insert(defaultDesktopFile,
DeviceUtils::getSambaFileUriFromNative(fileUrl).toString());
DeviceUtils::getSambaFileUriFromNative(fileUrl).toString());
mountMineTypes.insert(DeviceUtils::getSambaFileUriFromNative(fileUrl).toString(),
QString("inode/directory"));
QString("inode/directory"));
} else {
qCWarning(logDFMBase) << "no default application for" << fileUrl;
continue;
}
continue;
}

if (!isOpenNow && isFileManagerSelf(defaultDesktopFile) && mimeType != "inode/directory") {
Expand Down Expand Up @@ -1105,7 +1105,6 @@ bool LocalFileHandlerPrivate::doOpenFiles(const QList<QUrl> &urls, const QString
paths << url.path();
}


if (MimesAppsManager::getDefaultAppByFileName(transUrls.first().path()) == "org.gnome.font-viewer.desktop") {
QProcess::startDetached("gio", QStringList() << "open" << paths);
QTimer::singleShot(200, [=] {
Expand Down Expand Up @@ -1138,10 +1137,9 @@ bool LocalFileHandlerPrivate::doOpenFiles(const QMultiMap<QString, QString> &inf
// spec: https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/
// the correct approach: let the app add it to the recent list.
// addToRecentFile(DUrl::fromLocalFile(filePath), mimetype);
QtConcurrent::run([urls, key, mimeTypes](){
QtConcurrent::run([urls, key, mimeTypes]() {
asyncAddRecentFile(key, urls, mimeTypes);
});

}
}

Expand Down
Loading