/usr/include/libfm-qt/customactions/fileactioncondition.h is in libfm-qt-dev 0.12.0-14build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | #ifndef FILEACTIONCONDITION_H
#define FILEACTIONCONDITION_H
#include <glib.h>
#include "../core/gioptrs.h"
#include "../core/fileinfo.h"
namespace Fm {
// FIXME: we can use getgroups() to get groups of current process
// then, call stat() and stat.st_gid to handle capabilities
// in this way, we don't have to call euidaccess
enum class FileActionCapability {
OWNER = 0,
READABLE = 1 << 1,
WRITABLE = 1 << 2,
EXECUTABLE = 1 << 3,
LOCAL = 1 << 4
};
class FileActionCondition {
public:
explicit FileActionCondition(GKeyFile* kf, const char* group);
#if 0
bool match_base_name_(const FileInfoList& files, const char* allowed_base_name) {
// all files should match the base_name pattern.
bool allowed = true;
if(allowed_base_name.index_of_char('*') >= 0) {
string allowed_base_name_ci;
if(!match_case) {
allowed_base_name_ci = allowed_base_name.casefold(); // FIXME: is this ok?
allowed_base_name = allowed_base_name_ci;
}
var pattern = new PatternSpec(allowed_base_name);
foreach(unowned FileInfo fi in files) {
unowned string name = fi.get_name();
if(match_case) {
if(!pattern.match_string(name)) {
allowed = false;
break;
}
}
else {
if(!pattern.match_string(name.casefold())) {
allowed = false;
break;
}
}
}
}
else {
foreach(unowned FileInfo fi in files) {
unowned string name = fi.get_name();
if(match_case) {
if(allowed_base_name != name) {
allowed = false;
break;
}
}
else {
if(allowed_base_name.collate(name) != 0) {
allowed = false;
break;
}
}
}
}
return allowed;
}
#endif
bool match_try_exec(const FileInfoList& files);
bool match_show_if_registered(const FileInfoList& files);
bool match_show_if_true(const FileInfoList& files);
bool match_show_if_running(const FileInfoList& files);
bool match_mime_type(const FileInfoList& files, const char* type, bool negated);
bool match_mime_types(const FileInfoList& files);
bool match_base_name(const FileInfoList& files, const char* base_name, bool negated);
bool match_base_names(const FileInfoList& files);
static bool match_scheme(const FileInfoList& files, const char* scheme, bool negated);
bool match_schemes(const FileInfoList& files);
static bool match_folder(const FileInfoList& files, const char* folder, bool negated);
bool match_folders(const FileInfoList& files);
bool match_selection_count(const FileInfoList &files);
bool match_capabilities(const FileInfoList& files);
bool match(const FileInfoList& files);
CStrArrayPtr only_show_in;
CStrArrayPtr not_show_in;
CStrPtr try_exec;
CStrPtr show_if_registered;
CStrPtr show_if_true;
CStrPtr show_if_running;
CStrArrayPtr mime_types;
CStrArrayPtr base_names;
bool match_case;
char selection_count_cmp;
int selection_count;
CStrArrayPtr schemes;
CStrArrayPtr folders;
FileActionCapability capabilities;
};
}
#endif // FILEACTIONCONDITION_H
|