summaryrefslogtreecommitdiffstats
path: root/kio
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-02 10:13:06 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-02 10:13:06 -0600
commit6d74bae8a11865d0d3d373781de6cc95682f5cc4 (patch)
treec25cebab1bcd8c11d9ebe1ad402681385469da97 /kio
parentc5bca102dd4e45626e1e76b0684ef065935918ed (diff)
downloadtdelibs-6d74bae8a11865d0d3d373781de6cc95682f5cc4.tar.gz
tdelibs-6d74bae8a11865d0d3d373781de6cc95682f5cc4.zip
Add icon request ability
Diffstat (limited to 'kio')
-rw-r--r--kio/kio/kfileitem.cpp8
-rw-r--r--kio/kio/kurifilter.cpp14
-rw-r--r--kio/kio/tdelficon.cpp6
3 files changed, 16 insertions, 12 deletions
diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp
index efb59043b..cf903f712 100644
--- a/kio/kio/kfileitem.cpp
+++ b/kio/kio/kfileitem.cpp
@@ -671,8 +671,10 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const
// 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 );
+ if (!sysIconName.isEmpty()) {
+ if (KGlobal::iconLoader()->iconPath(sysIconName.ascii(), 0, true) != "") {
+ p = DesktopIcon( sysIconName.ascii(), _size, _state );
+ }
}
libr_close(handle);
@@ -694,7 +696,7 @@ TQPixmap KFileItem::pixmap( int _size, int _state ) const
}
}
- if (iconresnamefound == 0) {
+ if ((iconresnamefound == 0) && (icon)) {
// Extract the embedded icon
size_t icon_data_length;
char* icondata = libr_icon_malloc(icon, &icon_data_length);
diff --git a/kio/kio/kurifilter.cpp b/kio/kio/kurifilter.cpp
index 24ed48328..42840a588 100644
--- a/kio/kio/kurifilter.cpp
+++ b/kio/kio/kurifilter.cpp
@@ -195,7 +195,7 @@ TQString KURIFilterData::iconName()
libr_file *handle = NULL;
libr_access_t access = LIBR_READ;
char libr_can_continue = 1;
-
+
if((handle = libr_open(const_cast<char*>(m_pURI.path().ascii()), access)) == NULL)
{
kdWarning() << "failed to open file" << m_pURI.path() << endl;
@@ -219,8 +219,10 @@ TQString KURIFilterData::iconName()
// 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 );
+ if (!sysIconName.isEmpty()) {
+ if (KGlobal::iconLoader()->iconPath(sysIconName.ascii(), 0, true) != "") {
+ m_strIconName = sysIconName;
+ }
}
libr_close(handle);
@@ -241,8 +243,8 @@ TQString KURIFilterData::iconName()
}
}
}
-
- if (iconresnamefound == 0) {
+
+ if ((iconresnamefound == 0) && (icon)) {
// Extract the embedded icon
size_t icon_data_length;
char* icondata = libr_icon_malloc(icon, &icon_data_length);
@@ -255,7 +257,7 @@ TQString KURIFilterData::iconName()
free(icondata);
libr_icon_close(icon);
}
-
+
libr_close(handle);
}
}
diff --git a/kio/kio/tdelficon.cpp b/kio/kio/tdelficon.cpp
index 6e1e68169..49ceffd24 100644
--- a/kio/kio/tdelficon.cpp
+++ b/kio/kio/tdelficon.cpp
@@ -69,7 +69,7 @@ TQString elf_get_resource(libr_file *handle, char *section_name)
/* 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;
+// kdWarning() << "failed to obtain ELF resource size: " << libr_errmsg() << endl;
return result;
}
/* Get the resource from the ELF file */
@@ -77,7 +77,7 @@ TQString elf_get_resource(libr_file *handle, char *section_name)
buffer[buffer_size] = 0;
if(!libr_read(handle, section_name, buffer))
{
- kdWarning() << "failed to obtain ELF resource: " << libr_errmsg() << endl;
+// kdWarning() << "failed to obtain ELF resource: " << libr_errmsg() << endl;
goto fail;
}
result = buffer;
@@ -86,4 +86,4 @@ fail:
free(buffer);
return result;
-} \ No newline at end of file
+}