mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-09 03:31:41 +00:00
GUI: properly construct a file:// URL when opening the output folder
The GUI tells Qt to open a directory like e.g. "file:////home/mosu/…". Two slashes are needed for the protocol, one for the root folder, and the fourth one is superfluous. Now file managers like Windows Explorer or krusader simply open a directory name called "//home/mosu/…" – that works. But others like Dolphin try to be smart, see that the file name starts with "//…" and think the user wants to visit a share called "mosu" on a Samba/Windows server called "home". Then they prepend the whole URL with "smb://". On Windows the third slash is actually needed when letting Qt parse such a URL. So instead of using #ifdefs create an empty URL and set the scheme and the path components explicitly and don't let Qt parse a stringified URL. Fixes #1479.
This commit is contained in:
parent
e89b9354c2
commit
457ef620a9
@ -1,5 +1,12 @@
|
||||
2015-10-17 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* MKVToolNix GUI: bug fix (Linux): the function "open folder" was
|
||||
inserting a superfluous leading slash in the directory name. This
|
||||
causes some file managers (in this particular case Dolphin on
|
||||
Linux) to interpret a directory name like "//home/mosu/…" as a
|
||||
share called "mosu" on a Samba/Windows server called "home" and to
|
||||
prepend the whole name with the "smb://" protocol. Fixes #1479.
|
||||
|
||||
* Released v8.5.0.
|
||||
|
||||
2015-10-16 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mkvtoolnix-gui/jobs/job.h"
|
||||
#include "mkvtoolnix-gui/jobs/mux_job.h"
|
||||
#include "mkvtoolnix-gui/util/config_file.h"
|
||||
#include "mkvtoolnix-gui/util/file.h"
|
||||
#include "mkvtoolnix-gui/util/settings.h"
|
||||
|
||||
namespace mtx { namespace gui { namespace Jobs {
|
||||
@ -246,7 +247,7 @@ Job::openOutputFolder()
|
||||
auto folder = outputFolder();
|
||||
|
||||
if (!folder.isEmpty())
|
||||
QDesktopServices::openUrl(QUrl{Q("file:///%1").arg(folder)});
|
||||
QDesktopServices::openUrl(Util::pathToFileUrl(folder));
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -3,7 +3,9 @@
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
#include <QIODevice>
|
||||
#include <QUrl>
|
||||
|
||||
#include "common/qt.h"
|
||||
#include "mkvtoolnix-gui/util/file.h"
|
||||
|
||||
namespace mtx { namespace gui { namespace Util {
|
||||
@ -38,4 +40,12 @@ checkForBomAndNonAscii(QString const &fileName) {
|
||||
return result;
|
||||
}
|
||||
|
||||
QUrl
|
||||
pathToFileUrl(QString const &path) {
|
||||
auto url = QUrl{};
|
||||
url.setScheme(Q("file"));
|
||||
url.setPath(path);
|
||||
return url;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "common/common_pch.h"
|
||||
|
||||
class QString;
|
||||
class QUrl;
|
||||
|
||||
namespace mtx { namespace gui { namespace Util {
|
||||
|
||||
@ -15,6 +16,8 @@ struct BomAsciiCheckResult {
|
||||
|
||||
BomAsciiCheckResult checkForBomAndNonAscii(QString const &fileName);
|
||||
|
||||
QUrl pathToFileUrl(QString const &path);
|
||||
|
||||
}}}
|
||||
|
||||
#endif // MTX_MKVTOOLNIX_GUI_UTIL_FILE_H
|
||||
|
Loading…
Reference in New Issue
Block a user