diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2021-04-11 14:59:49 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2021-04-11 14:59:49 +0200 |
commit | a5def4f9a471a83465be8918a443fe96e49e3029 (patch) | |
tree | 3349f71ff3da6a05e11865c55fa3bf8c45516ded /tdefile-plugins/elf/tdefile_elf.cpp | |
parent | 0b1a3e154b35c26c96bb523a956a5bf8b3c5e91c (diff) | |
download | tdelibs-a5def4f9a471a83465be8918a443fe96e49e3029.tar.gz tdelibs-a5def4f9a471a83465be8918a443fe96e49e3029.zip |
Add a definition of MIME type application/x-pie-executable.
This resolves incorrect identification of binary executables with libmagick >= 5.33.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdefile-plugins/elf/tdefile_elf.cpp')
-rw-r--r-- | tdefile-plugins/elf/tdefile_elf.cpp | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/tdefile-plugins/elf/tdefile_elf.cpp b/tdefile-plugins/elf/tdefile_elf.cpp index f87b536ed..f3b399ed1 100644 --- a/tdefile-plugins/elf/tdefile_elf.cpp +++ b/tdefile-plugins/elf/tdefile_elf.cpp @@ -50,54 +50,41 @@ KElfPlugin::KElfPlugin(TQObject *parent, const char *name, : KFilePlugin(parent, name, args) { - // Executables - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-executable" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - KFileMimeTypeInfo::GroupInfo* group2 = 0L; - - group = addGroupInfo(info, "Technical", i18n("Embedded Metadata")); - group2 = addGroupInfo(info, "Icon", i18n("Embedded Icon(s)")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Name", i18n("Internal Name"), TQVariant::String); - item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); - item = addItemInfo(group, "License", i18n("License"), TQVariant::String); - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); - item = addItemInfo(group, "Authors", i18n("Author(s)"), TQVariant::String); - item = addItemInfo(group, "Product", i18n("Product"), TQVariant::String); - item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); - item = addItemInfo(group, "DateTime", i18n("Compilation Date/Time"), TQVariant::String); - item = addItemInfo(group, "SystemIcon", i18n("Requested Icon"), TQVariant::String); - item = addItemInfo(group, "SCMModule", i18n("SCM Module"), TQVariant::String); - item = addItemInfo(group, "SCMRevision", i18n("SCM Revision"), TQVariant::String); - item = addItemInfo(group, "Notes", i18n("Comments"), TQVariant::String); - - item = addItemInfo(group2, "EmbeddedIcon", i18n("Icon Name(s)"), TQVariant::String); - - // Shared libraries - info = addMimeTypeInfo( "application/x-sharedlib" ); - - group = addGroupInfo(info, "Technical", i18n("Embedded Metadata")); - group2 = addGroupInfo(info, "Icon", i18n("Embedded Icon(s)")); - - item = addItemInfo(group, "Name", i18n("Internal Name"), TQVariant::String); - item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); - item = addItemInfo(group, "License", i18n("License"), TQVariant::String); - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); - item = addItemInfo(group, "Authors", i18n("Author(s)"), TQVariant::String); - item = addItemInfo(group, "Product", i18n("Product"), TQVariant::String); - item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); - item = addItemInfo(group, "DateTime", i18n("Compilation Date/Time"), TQVariant::String); - item = addItemInfo(group, "SystemIcon", i18n("Requested Icon"), TQVariant::String); - item = addItemInfo(group, "SCMModule", i18n("SCM Module"), TQVariant::String); - item = addItemInfo(group, "SCMRevision", i18n("SCM Revision"), TQVariant::String); - item = addItemInfo(group, "Notes", i18n("Comments"), TQVariant::String); - - item = addItemInfo(group2, "EmbeddedIcon", i18n("Icon Name(s)"), TQVariant::String); + const TQCString elfMimeTypes[]= { + "application/x-executable", + "application/x-pie-executable", + "application/x-sharedlib" + }; + const int elfMimeTypesCount = sizeof(elfMimeTypes)/sizeof(elfMimeTypes[0]); + + for (int i = 0; i < elfMimeTypesCount; i++) + { + KFileMimeTypeInfo* info = addMimeTypeInfo(elfMimeTypes[i]); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + KFileMimeTypeInfo::GroupInfo* group2 = 0L; + + group = addGroupInfo(info, "Technical", i18n("Embedded Metadata")); + group2 = addGroupInfo(info, "Icon", i18n("Embedded Icon(s)")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Name", i18n("Internal Name"), TQVariant::String); + item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); + item = addItemInfo(group, "License", i18n("License"), TQVariant::String); + item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); + item = addItemInfo(group, "Authors", i18n("Author(s)"), TQVariant::String); + item = addItemInfo(group, "Product", i18n("Product"), TQVariant::String); + item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); + item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); + item = addItemInfo(group, "DateTime", i18n("Compilation Date/Time"), TQVariant::String); + item = addItemInfo(group, "SystemIcon", i18n("Requested Icon"), TQVariant::String); + item = addItemInfo(group, "SCMModule", i18n("SCM Module"), TQVariant::String); + item = addItemInfo(group, "SCMRevision", i18n("SCM Revision"), TQVariant::String); + item = addItemInfo(group, "Notes", i18n("Comments"), TQVariant::String); + + item = addItemInfo(group2, "EmbeddedIcon", i18n("Icon Name(s)"), TQVariant::String); + } } |