Add metadata to shared libraries

Update metadata information
pull/16/head
Timothy Pearson 11 years ago
parent ef338f1187
commit 747375435b

@ -50,6 +50,7 @@ KElfPlugin::KElfPlugin(TQObject *parent, const char *name,
: KFilePlugin(parent, name, args)
{
// Executables
KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-executable" );
KFileMimeTypeInfo::GroupInfo* group = 0L;
@ -70,6 +71,30 @@ KElfPlugin::KElfPlugin(TQObject *parent, const char *name,
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);
@ -100,6 +125,8 @@ bool KElfPlugin::readInfo( KFileMetaInfo& info, uint what)
appendItem(group, "Version", elf_get_resource(handle, ".metadata_version"));
appendItem(group, "DateTime", elf_get_resource(handle, ".metadata_datetime"));
appendItem(group, "SystemIcon", elf_get_resource(handle, ".metadata_sysicon"));
appendItem(group, "SCMModule", elf_get_resource(handle, ".metadata_scmmodule"));
appendItem(group, "SCMRevision", elf_get_resource(handle, ".metadata_scmrevision"));
appendItem(group, "Notes", elf_get_resource(handle, ".metadata_notes"));
TQString iconListing;

@ -61,6 +61,6 @@ Name[zh_TW]=ELF 資訊
Name[zu]=Ulwazi lwe-ELF
ServiceTypes=KFilePlugin
X-TDE-Library=tdefile_elf
MimeType=application/x-executable
MimeType=application/x-executable;application/x-sharedlib
PreferredItems=Name,Description,License,Copyright,Authors,Product,Organization,Version,DateTime,Notes"
SupportsThumbnail=false

@ -75,7 +75,9 @@ typedef enum {
PARAM_VERSION = 10,
PARAM_DATETIME = 11,
PARAM_SYSICON = 12,
PARAM_NOTES = 13,
PARAM_SCMMODULE = 13,
PARAM_SCMREVISION = 14,
PARAM_NOTES = 15,
} eParams;
typedef struct {
@ -211,7 +213,7 @@ int handle_arguments(int argc, char **argv, eMode *mode)
break;
case 'm':
*mode = MODE_SET_METADATA;
required_params = 14;
required_params = 16;
break;
case 'r':
*mode = MODE_RETRIEVE_ICON;
@ -242,7 +244,7 @@ print_icon_usage:
fprintf(stderr, _("usage: %s [-c|-e|-g] elf-file-name\n"), argv[PARAM_PROGNAME]);
fprintf(stderr, _("usage: %s [-s] elf-file-name uuid\n"), argv[PARAM_PROGNAME]);
fprintf(stderr, _("usage: %s [-s] elf-file-name uuid\n"), argv[PARAM_PROGNAME]);
fprintf(stderr, _("usage: %s [-m] elf-file-name \"executable name\" \"description\" \"license\" \"copyright\" \"authors\" \"product\" \"organization\" \"version\" \"datetime\" \"sysicon\" \"notes\"\n"), argv[PARAM_PROGNAME]);
fprintf(stderr, _("usage: %s [-m] elf-file-name \"executable name\" \"description\" \"license\" \"copyright\" \"authors\" \"product\" \"organization\" \"version\" \"datetime\" \"sysicon\" \"scmmodule\" \"scmrevision\" \"notes\"\n"), argv[PARAM_PROGNAME]);
fprintf(stderr, _("If -t is set the TDEDIRS environment variable must include your TDE installation prefix\n"));
fprintf(stderr, _("for example: TDEDIRS=/opt/trinity ./tdelfeditor -t ./konqueror konqueror\n"));
for(i=0;i<ELFICON_OPTIONS;i++)
@ -480,9 +482,9 @@ int main_console(int argc, char **argv)
break;
case MODE_SET_METADATA:
{
// There are 10 of these
// There are 13 of these
// The metadata sequence is:
// "executable name" "description" "license" "copyright" "authors" "product" "organization" "version" "datetime" "notes"
// "executable name" "description" "license" "copyright" "authors" "product" "organization" "version" "datetime" "sysicon" "scmmodule" "scmrevision" "notes"
if (strlen(argv[PARAM_EXECUTABLE_NAME]) > 0) add_resource_string(handle, ".metadata_name", argv[PARAM_EXECUTABLE_NAME]);
if (strlen(argv[PARAM_DESCRIPTION]) > 0) add_resource_string(handle, ".metadata_description", argv[PARAM_DESCRIPTION]);
if (strlen(argv[PARAM_LICENSE]) > 0) add_resource_string(handle, ".metadata_license", argv[PARAM_LICENSE]);
@ -493,6 +495,8 @@ int main_console(int argc, char **argv)
if (strlen(argv[PARAM_VERSION]) > 0) add_resource_string(handle, ".metadata_version", argv[PARAM_VERSION]);
if (strlen(argv[PARAM_DATETIME]) > 0) add_resource_string(handle, ".metadata_datetime", argv[PARAM_DATETIME]);
if (strlen(argv[PARAM_SYSICON]) > 0) add_resource_string(handle, ".metadata_sysicon", argv[PARAM_SYSICON]);
if (strlen(argv[PARAM_SCMMODULE]) > 0) add_resource_string(handle, ".metadata_scmmodule", argv[PARAM_SCMMODULE]);
if (strlen(argv[PARAM_SCMREVISION]) > 0) add_resource_string(handle, ".metadata_scmrevision", argv[PARAM_SCMREVISION]);
if (strlen(argv[PARAM_NOTES]) > 0) add_resource_string(handle, ".metadata_notes", argv[PARAM_NOTES]);
} break;
case MODE_SET_EMPTY_UUID:

Loading…
Cancel
Save