Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Only use xdg-open to launch file-manager #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 2 additions & 12 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,12 +1005,7 @@ void MainWindow::saveSpecificedPath(QString path)
QString fileDir = QUrl::fromLocalFile(QFileInfo(savePath).absoluteDir().absolutePath()).toString();
QString filePath = QUrl::fromLocalFile(savePath).toString();
QString command;
if (QFile("/usr/bin/dde-file-manager").exists()) {
command = QString("/usr/bin/dde-file-manager,%1?selectUrl=%2"
).arg(fileDir).arg(filePath);
} else {
command = QString("xdg-open,%1").arg(filePath);
}
command = QString("xdg-open,%1").arg(filePath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change breaks the old behavior, we can't accept that, maybe you can try DDesktopServices::showFileItem from DTK to see if that satisfy your need?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how this breaks the old behavior?
If I understand correctly, on Deepin (the os) this would still
start dde-file-manager because it's default.

Also, any docs on DDesktopServices::showFileItem?

Copy link
Contributor

@hualet hualet Apr 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code

QString("/usr/bin/dde-file-manager,%1?selectUrl=%2).arg(fileDir).arg(filePath)

opens the target directory and select the target file. xdg-open won't do that.

DDesktopServices::showFileItem basically did the same thing.


hints["x-deepin-action-_open"] = command;

Expand Down Expand Up @@ -1382,12 +1377,7 @@ void MainWindow::sendNotify(int saveIndex, QString saveFilePath, const bool succ
QString fileDir = QUrl::fromLocalFile(QFileInfo(saveFilePath).absoluteDir().absolutePath()).toString();
QString filePath = QUrl::fromLocalFile(saveFilePath).toString();
QString command;
if (QFile("/usr/bin/dde-file-manager").exists()) {
command = QString("/usr/bin/dde-file-manager,%1?selectUrl=%2").arg(fileDir).arg(filePath);
}
else {
command = QString("xdg-open,%1").arg(filePath);
}
command = QString("xdg-open,%1").arg(filePath);

hints["x-deepin-action-_open"] = command;
}
Expand Down