diff --git a/kfile-plugins/elf/kfile_elf.cpp b/kfile-plugins/elf/kfile_elf.cpp index c657d245b..a26a6804b 100644 --- a/kfile-plugins/elf/kfile_elf.cpp +++ b/kfile-plugins/elf/kfile_elf.cpp @@ -97,6 +97,7 @@ KElfPlugin::KElfPlugin(TQObject *parent, const char *name, item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); item = addItemInfo(group, "DateTime", i18n("Creation Date/Time"), TQVariant::String); + item = addItemInfo(group, "SystemIcon", i18n("Requested Icon"), TQVariant::String); item = addItemInfo(group, "Notes", i18n("Comments"), TQVariant::String); item = addItemInfo(group2, "EmbeddedIcon", i18n("Icon Name(s)"), TQVariant::String); @@ -126,6 +127,7 @@ bool KElfPlugin::readInfo( KFileMetaInfo& info, uint what) appendItem(group, "Organization", elf_get_resource(handle, ".metadata_organization")); 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, "Notes", elf_get_resource(handle, ".metadata_notes")); TQString iconListing; @@ -143,7 +145,7 @@ bool KElfPlugin::readInfo( KFileMetaInfo& info, uint what) iconListing = entry->name; } else { - iconListing = iconListing.append("
").append(entry->name);
+ iconListing = iconListing.append("\n").append(entry->name);
}
break;
}
diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp
index 40927f0cf..efb59043b 100644
--- a/kio/kio/kfileitem.cpp
+++ b/kio/kio/kfileitem.cpp
@@ -668,6 +668,13 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const
{
// Failed to obtain a list of ELF icons
kdWarning() << "failed to obtain ELF icon: " << libr_errmsg() << endl;
+
+ // See if there is a system icon we can use
+ TQString sysIconName = elf_get_resource(handle, ".metadata_sysicon");
+ if (KGlobal::iconLoader()->iconPath(sysIconName.ascii(), 0, true) != "") {
+ p = DesktopIcon( sysIconName.ascii(), _size, _state );
+ }
+
libr_close(handle);
return p;
}
diff --git a/kio/kio/kurifilter.cpp b/kio/kio/kurifilter.cpp
index 102d83166..24ed48328 100644
--- a/kio/kio/kurifilter.cpp
+++ b/kio/kio/kurifilter.cpp
@@ -216,6 +216,13 @@ TQString KURIFilterData::iconName()
{
// Failed to obtain a list of ELF icons
kdWarning() << "failed to obtain ELF icon: " << libr_errmsg() << endl;
+
+ // See if there is a system icon we can use
+ TQString sysIconName = elf_get_resource(handle, ".metadata_sysicon");
+ if (KGlobal::iconLoader()->iconPath(sysIconName.ascii(), 0, true) != "") {
+ m_customIconPixmap = DesktopIcon( sysIconName.ascii(), _size, _state );
+ }
+
libr_close(handle);
libr_can_continue = 0;
}
diff --git a/kio/kio/tdelficon.cpp b/kio/kio/tdelficon.cpp
index 8c5a0d9de..6e1e68169 100644
--- a/kio/kio/tdelficon.cpp
+++ b/kio/kio/tdelficon.cpp
@@ -58,4 +58,32 @@ iconentry *get_nexticon(iconlist *icons, iconentry *last_entry)
return NULL;
}
return &(icons->entry);
+}
+
+TQString elf_get_resource(libr_file *handle, char *section_name)
+{
+ size_t buffer_size = 0;
+ char *buffer = NULL;
+ TQString result;
+
+ /* Get the resource from the ELF binary */
+ if(!libr_size(handle, section_name, &buffer_size))
+ {
+ kdWarning() << "failed to obtain ELF resource size: " << libr_errmsg() << endl;
+ return result;
+ }
+ /* Get the resource from the ELF file */
+ buffer = (char *) malloc(buffer_size+1);
+ buffer[buffer_size] = 0;
+ if(!libr_read(handle, section_name, buffer))
+ {
+ kdWarning() << "failed to obtain ELF resource: " << libr_errmsg() << endl;
+ goto fail;
+ }
+ result = buffer;
+
+fail:
+ free(buffer);
+
+ return result;
}
\ No newline at end of file
diff --git a/kio/kio/tdelficon.h b/kio/kio/tdelficon.h
index 7b17df818..7a962bdaa 100644
--- a/kio/kio/tdelficon.h
+++ b/kio/kio/tdelficon.h
@@ -1,8 +1,13 @@
-
#include