You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.7 KiB
69 lines
2.7 KiB
6 years ago
|
Description: Correctly handle mountable types
|
||
|
Author: "Hong Jen Yee (PCMan)" <pcman.tw@gmail.com>
|
||
|
Origin: upstream
|
||
|
Applied-Upstream: commit:dc7a575
|
||
|
Last-Update: 2018-07-14
|
||
|
--- a/src/core/basicfilelauncher.cpp
|
||
|
+++ b/src/core/basicfilelauncher.cpp
|
||
|
@@ -28,11 +28,10 @@ bool BasicFileLauncher::launchFiles(cons
|
||
|
// classify files according to different mimetypes
|
||
|
for(auto& fileInfo : fileInfos) {
|
||
|
/*
|
||
|
- qDebug("path: %s, type: %s, target: %s, isDir: %i, isDesktopEntry: %i",
|
||
|
+ qDebug("path: %s, type: %s, target: %s, isDir: %i, isShortcut: %i, isMountable: %i, isDesktopEntry: %i",
|
||
|
fileInfo->path().toString().get(), fileInfo->mimeType()->name(), fileInfo->target().c_str(),
|
||
|
- fileInfo->isDir(), fileInfo->isDesktopEntry());
|
||
|
+ fileInfo->isDir(), fileInfo->isShortcut(), fileInfo->isMountable(), fileInfo->isDesktopEntry());
|
||
|
*/
|
||
|
-
|
||
|
if(fileInfo->isMountable()) {
|
||
|
if(fileInfo->target().empty()) {
|
||
|
// the mountable is not yet mounted so we have no target URI.
|
||
|
@@ -267,6 +266,7 @@ FilePath BasicFileLauncher::handleShortc
|
||
|
// if we know the target is a dir, we are not going to open it using other apps
|
||
|
// for example: `network:///smb-root' is a shortcut targeting `smb:///' and it's also a dir
|
||
|
if(fileInfo->isDir()) {
|
||
|
+ qDebug("shortcut is dir: %s", target.c_str());
|
||
|
return FilePath::fromPathStr(target.c_str());
|
||
|
}
|
||
|
|
||
|
--- a/src/core/fileinfo.cpp
|
||
|
+++ b/src/core/fileinfo.cpp
|
||
|
@@ -118,7 +118,8 @@ void FileInfo::setFromGFileInfo(const GO
|
||
|
isDeletable_ = true;
|
||
|
}
|
||
|
|
||
|
- isShortcut_ = false;
|
||
|
+ isShortcut_ = (type == G_FILE_TYPE_SHORTCUT);
|
||
|
+ isMountable_ = (type == G_FILE_TYPE_MOUNTABLE);
|
||
|
|
||
|
/* special handling for symlinks */
|
||
|
if(g_file_info_get_is_symlink(inf.get())) {
|
||
|
@@ -129,7 +130,6 @@ void FileInfo::setFromGFileInfo(const GO
|
||
|
|
||
|
switch(type) {
|
||
|
case G_FILE_TYPE_SHORTCUT:
|
||
|
- isShortcut_ = true;
|
||
|
/* Falls through. */
|
||
|
case G_FILE_TYPE_MOUNTABLE:
|
||
|
uri = g_file_info_get_attribute_string(inf.get(), G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
|
||
|
--- a/src/core/fileinfo.h
|
||
|
+++ b/src/core/fileinfo.h
|
||
|
@@ -151,7 +151,7 @@ public:
|
||
|
}
|
||
|
|
||
|
bool isMountable() const {
|
||
|
- return mimeType_->isMountable();
|
||
|
+ return isMountable_;
|
||
|
}
|
||
|
|
||
|
bool isShortcut() const {
|
||
|
@@ -239,6 +239,7 @@ private:
|
||
|
std::string target_; /* target of shortcut or mountable. */
|
||
|
|
||
|
bool isShortcut_ : 1; /* TRUE if file is shortcut type */
|
||
|
+ bool isMountable_ : 1; /* TRUE if file is mountable type */
|
||
|
bool isAccessible_ : 1; /* TRUE if can be read by user */
|
||
|
bool isWritable_ : 1; /* TRUE if can be written to by user */
|
||
|
bool isDeletable_ : 1; /* TRUE if can be deleted by user */
|