diff options
Diffstat (limited to 'x11-libs/libfm-qt/files/libfm-qt-0.13.1-check-if-app-exists-before-opening.patch')
-rw-r--r-- | x11-libs/libfm-qt/files/libfm-qt-0.13.1-check-if-app-exists-before-opening.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/x11-libs/libfm-qt/files/libfm-qt-0.13.1-check-if-app-exists-before-opening.patch b/x11-libs/libfm-qt/files/libfm-qt-0.13.1-check-if-app-exists-before-opening.patch new file mode 100644 index 000000000000..92b45be432fb --- /dev/null +++ b/x11-libs/libfm-qt/files/libfm-qt-0.13.1-check-if-app-exists-before-opening.patch @@ -0,0 +1,45 @@ +From 4923f860094787d14052e9dc416c9388ff1bb53b Mon Sep 17 00:00:00 2001 +From: Tsu Jan <tsujan2000@gmail.com> +Date: Thu, 7 Jun 2018 06:10:37 +0430 +Subject: [PATCH] Check if the opening app exists before using it + +Also, show an error message if there's no app. +--- + src/core/basicfilelauncher.cpp | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/src/core/basicfilelauncher.cpp b/src/core/basicfilelauncher.cpp +index 8390531..2c7f00e 100644 +--- a/src/core/basicfilelauncher.cpp ++++ b/src/core/basicfilelauncher.cpp +@@ -256,18 +256,25 @@ FilePath BasicFileLauncher::handleShortcut(const FileInfoPtr& fileInfo, GAppLaun + || strcmp(scheme.get(), "trash") == 0 + || strcmp(scheme.get(), "network") == 0 + || strcmp(scheme.get(), "computer") == 0) { +- return FilePath::fromUri(fileInfo->target().c_str()); ++ return FilePath::fromUri(target.c_str()); + } + else { + // ask gio to launch the default handler for the uri scheme +- GAppInfoPtr app{g_app_info_get_default_for_uri_scheme(scheme.get()), false}; +- FilePathList uris{FilePath::fromUri(fileInfo->target().c_str())}; +- launchWithApp(app.get(), uris, ctx); ++ if(GAppInfoPtr app{g_app_info_get_default_for_uri_scheme(scheme.get()), false}) { ++ FilePathList uris{FilePath::fromUri(target.c_str())}; ++ launchWithApp(app.get(), uris, ctx); ++ } ++ else { ++ GErrorPtr err{G_IO_ERROR, G_IO_ERROR_FAILED, ++ QObject::tr("No default application is set to launch '%1'") ++ .arg(target.c_str())}; ++ showError(nullptr, err); ++ } + } + } + else { + // see it as a local path +- return FilePath::fromLocalPath(fileInfo->target().c_str()); ++ return FilePath::fromLocalPath(target.c_str()); + } + return FilePath(); + } |