Branch: master

74737543 2014-03-27 02:38:49 Timothy Pearson
Add metadata to shared libraries
Update metadata information
M tdefile-plugins/elf/tdefile_elf.cpp
M tdefile-plugins/elf/tdefile_elf.desktop
M tdelfeditor/tdelfeditor.cpp
diff --git a/tdefile-plugins/elf/tdefile_elf.cpp b/tdefile-plugins/elf/tdefile_elf.cpp
index 7308a40..f87b536 100644
--- a/tdefile-plugins/elf/tdefile_elf.cpp
+++ b/tdefile-plugins/elf/tdefile_elf.cpp
@@ -50,6 +50,7 @@
 
     : KFilePlugin(parent, name, args)
 {
+    // Executables
     KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-executable" );
 
     KFileMimeTypeInfo::GroupInfo* group = 0L;
@@ -70,6 +71,30 @@
     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 @@
 	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;
diff --git a/tdefile-plugins/elf/tdefile_elf.desktop b/tdefile-plugins/elf/tdefile_elf.desktop
index ab8efe3..715ee92 100644
--- a/tdefile-plugins/elf/tdefile_elf.desktop
+++ b/tdefile-plugins/elf/tdefile_elf.desktop
@@ -61,6 +61,6 @@
 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
diff --git a/tdelfeditor/tdelfeditor.cpp b/tdelfeditor/tdelfeditor.cpp
index 23c95a0..fc17f03 100644
--- a/tdelfeditor/tdelfeditor.cpp
+++ b/tdelfeditor/tdelfeditor.cpp
@@ -75,7 +75,9 @@
 	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 @@
 				break;
 			case 'm':
 				*mode = MODE_SET_METADATA;
-				required_params = 14;
+				required_params = 16;
 				break;
 			case 'r':
 				*mode = MODE_RETRIEVE_ICON;
@@ -242,7 +244,7 @@
 	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 @@
 			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 @@
 			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: