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 16:49:32 +0200 |
commit | 3ba04b2973acc798417d584ca9d1b81d4f55a4fc (patch) | |
tree | 6222cfd22625295e9deb18fa956d34d36d1a48df | |
parent | 83badc2107776a2a0d4afc59bf179d6f57dcf3f8 (diff) | |
download | tdelibs-3ba04b2973acc798417d584ca9d1b81d4f55a4fc.tar.gz tdelibs-3ba04b2973acc798417d584ca9d1b81d4f55a4fc.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>
(cherry picked from commit a5def4f9a471a83465be8918a443fe96e49e3029)
-rw-r--r-- | kded/kbuildservicetypefactory.cpp | 2 | ||||
-rw-r--r-- | mimetypes/application/CMakeLists.txt | 3 | ||||
-rw-r--r-- | mimetypes/application/Makefile.am | 3 | ||||
-rw-r--r-- | mimetypes/application/x-pie-executable.desktop | 6 | ||||
-rw-r--r-- | tdefile-plugins/elf/tdefile_elf.cpp | 83 | ||||
-rw-r--r-- | tdeio/tdeio/krun.cpp | 5 | ||||
-rw-r--r-- | tdeio/tdeio/tdefileitem.cpp | 2 |
7 files changed, 51 insertions, 53 deletions
diff --git a/kded/kbuildservicetypefactory.cpp b/kded/kbuildservicetypefactory.cpp index da2863347..b85776166 100644 --- a/kded/kbuildservicetypefactory.cpp +++ b/kded/kbuildservicetypefactory.cpp @@ -106,7 +106,7 @@ KBuildServiceTypeFactory::createEntry(const TQString &file, const char *resource || (mime == "media/builtin-trash") || (mime == "media/builtin-webbrowser") ) e = new KDEDesktopMimeType( &desktopFile ); - else if ( mime == "application/x-executable" || mime == "application/x-shellscript" ) + else if ( mime == "application/x-executable" || mime == "application/x-pie-executable" || mime == "application/x-shellscript" ) e = new KExecMimeType( &desktopFile ); else if ( !mime.isEmpty() ) e = new KMimeType( &desktopFile ); diff --git a/mimetypes/application/CMakeLists.txt b/mimetypes/application/CMakeLists.txt index 56547a4cf..76087ea82 100644 --- a/mimetypes/application/CMakeLists.txt +++ b/mimetypes/application/CMakeLists.txt @@ -22,7 +22,8 @@ tde_create_translated_desktop( x-jar.desktop x-arj.desktop x-tarz.desktop x-gzpostscript.desktop postscript.desktop octet-stream.desktop x-shellscript.desktop x-desktop.desktop - x-executable.desktop x-executable-script.desktop x-archive.desktop x-lha.desktop + x-executable.desktop x-pie-executable.desktop x-executable-script.desktop + x-archive.desktop x-lha.desktop x-tbz.desktop x-tgz.desktop x-awk.desktop x-perl.desktop x-perl-module.desktop x-compress.desktop x-cpio.desktop x-rpm.desktop msword.desktop x-sharedlib.desktop diff --git a/mimetypes/application/Makefile.am b/mimetypes/application/Makefile.am index 87b28b9ca..fe8ad398b 100644 --- a/mimetypes/application/Makefile.am +++ b/mimetypes/application/Makefile.am @@ -8,7 +8,8 @@ mimetypeapplicationdata_DATA = x-dvi.desktop x-gzdvi.desktop x-bz2dvi.desktop \ x-jar.desktop x-arj.desktop x-tarz.desktop \ x-gzpostscript.desktop postscript.desktop octet-stream.desktop \ x-shellscript.desktop x-desktop.desktop \ - x-executable.desktop x-executable-script.desktop x-archive.desktop x-lha.desktop \ + x-executable.desktop x-pie-executable.desktop x-executable-script.desktop \ + x-archive.desktop x-lha.desktop \ x-tbz.desktop x-tgz.desktop x-awk.desktop \ x-perl.desktop x-perl-module.desktop x-compress.desktop x-cpio.desktop \ x-rpm.desktop msword.desktop x-sharedlib.desktop \ diff --git a/mimetypes/application/x-pie-executable.desktop b/mimetypes/application/x-pie-executable.desktop new file mode 100644 index 000000000..edc09d7f0 --- /dev/null +++ b/mimetypes/application/x-pie-executable.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Comment=Executable File +Icon=application-x-executable +Type=MimeType +MimeType=application/x-pie-executable +X-TDE-IsAlso=application/x-executable 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); + } } diff --git a/tdeio/tdeio/krun.cpp b/tdeio/tdeio/krun.cpp index 329199da9..402b339b0 100644 --- a/tdeio/tdeio/krun.cpp +++ b/tdeio/tdeio/krun.cpp @@ -155,8 +155,10 @@ pid_t KRun::runURL( const KURL& u, const TQString& _mimetype, TQWidget* window, noAuth = true; } } - else if (_mimetype == "application/x-executable") + else if (_mimetype == "application/x-executable" || _mimetype == "application/x-pie-executable") + { noRun = true; + } } else if ( isExecutable(_mimetype) ) { @@ -1452,6 +1454,7 @@ bool KRun::isExecutable( const TQString& serviceType ) serviceType == "media/builtin-trash" || serviceType == "media/builtin-webbrowser" || serviceType == "application/x-executable" || + serviceType == "application/x-pie-executable" || serviceType == "application/x-msdos-program" || serviceType == "application/x-shellscript" ); } diff --git a/tdeio/tdeio/tdefileitem.cpp b/tdeio/tdeio/tdefileitem.cpp index 7af8aae39..577a8a0d7 100644 --- a/tdeio/tdeio/tdefileitem.cpp +++ b/tdeio/tdeio/tdefileitem.cpp @@ -700,7 +700,7 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const if (p.isNull()) kdWarning() << "Pixmap not found for mimetype " << m_pMimeType->name() << endl; - if ( mime->name() == "application/x-executable" ) { + if ( mime->name() == "application/x-executable" || mime->name() == "application/x-pie-executable" ) { // At first glance it might seem to be a good idea to // look for .desktop files for this executable before resorting to the embedded icon // in the same fashion as the minicli, but on close examination this is NOT A GOOD IDEA. |