1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-02 18:04:32 +00:00

Fix "caja" file manager opens the file instead of opens the directory. Closes #5003.

Now it opens the directory correctly.
This commit is contained in:
Chocobo1 2016-03-27 16:40:23 +08:00
parent 1eb6b05bbb
commit 851d97d95e

View File

@ -583,24 +583,23 @@ void Utils::Misc::openFolderSelect(const QString& absolutePath)
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC) #elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
if (QFileInfo(path).exists()) { if (QFileInfo(path).exists()) {
QProcess proc; QProcess proc;
QString output;
proc.start("xdg-mime", QStringList() << "query" << "default" << "inode/directory"); proc.start("xdg-mime", QStringList() << "query" << "default" << "inode/directory");
proc.waitForFinished(); proc.waitForFinished();
output = proc.readLine().simplified(); QString output = proc.readLine().simplified();
if (output == "dolphin.desktop" || output == "org.kde.dolphin.desktop") if (output == "dolphin.desktop" || output == "org.kde.dolphin.desktop")
proc.startDetached("dolphin", QStringList() << "--select" << Utils::Fs::toNativePath(path)); proc.startDetached("dolphin", QStringList() << "--select" << Utils::Fs::toNativePath(path));
else if (output == "nautilus.desktop" || output == "org.gnome.Nautilus.desktop" else if (output == "nautilus.desktop" || output == "org.gnome.Nautilus.desktop"
|| output == "nautilus-folder-handler.desktop") || output == "nautilus-folder-handler.desktop")
proc.startDetached("nautilus", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path)); proc.startDetached("nautilus", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
else if (output == "caja-folder-handler.desktop")
proc.startDetached("caja", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
else if (output == "nemo.desktop") else if (output == "nemo.desktop")
proc.startDetached("nemo", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path)); proc.startDetached("nemo", QStringList() << "--no-desktop" << Utils::Fs::toNativePath(path));
else if (output == "konqueror.desktop" || output == "kfmclient_dir.desktop") else if (output == "konqueror.desktop" || output == "kfmclient_dir.desktop")
proc.startDetached("konqueror", QStringList() << "--select" << Utils::Fs::toNativePath(path)); proc.startDetached("konqueror", QStringList() << "--select" << Utils::Fs::toNativePath(path));
else else {
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
openPath(path.left(path.lastIndexOf("/"))); openPath(path.left(path.lastIndexOf("/")));
} }
}
else { else {
// If the item to select doesn't exist, try to open its parent // If the item to select doesn't exist, try to open its parent
openPath(path.left(path.lastIndexOf("/"))); openPath(path.left(path.lastIndexOf("/")));