Prefer elficon metadata to (often incorrect) system string matching

pull/16/head
Timothy Pearson 13 years ago
parent b477a57673
commit 783973a7d6

@ -179,18 +179,35 @@ TQString KURIFilterData::iconName()
TQString exeName = m_pURI.url();
exeName = exeName.mid( exeName.findRev( '/' ) + 1 ); // strip path if given
KService::Ptr service = KService::serviceByDesktopName( exeName );
if (service && service->icon() != TQString::fromLatin1( "unknown" ))
#ifndef HAVE_ELFICON
// Try to find an icon with the same name as the binary (useful for non-tde apps)
// FIXME: We should only do this if the binary is in the system path somewhere,
// otherwise TDE could end up showing system icons for user binaries
if (service && service->icon() != TQString::fromLatin1( "unknown" )) {
m_strIconName = service->icon();
}
else if ( !KGlobal::iconLoader()->loadIcon( exeName, KIcon::NoGroup, 16, KIcon::DefaultState, 0, true ).isNull() ) {
m_strIconName = exeName;
}
else {
// use default
m_strIconName = TQString::fromLatin1("exec");
}
#else // HAVE_ELFICON
// Try to find an icon with the same name as the binary (useful for non-tde apps)
// FIXME: We should only do this if the binary is in the system path somewhere,
// otherwise TDE could end up showing system icons for user binaries
else if ( !KGlobal::iconLoader()->loadIcon( exeName, KIcon::NoGroup, 16, KIcon::DefaultState, 0, true ).isNull() )
if (service && service->icon() != TQString::fromLatin1( "unknown" )) {
m_strIconName = service->icon();
}
else if ( !KGlobal::iconLoader()->loadIcon( exeName, KIcon::NoGroup, 16, KIcon::DefaultState, 0, true ).isNull() ) {
m_strIconName = exeName;
}
else {
// not found, try to load from elf file (if supported)
// otherwise use default
// use default
m_strIconName = TQString::fromLatin1("exec");
#ifdef HAVE_ELFICON
}
// Try to load from elf file (if supported)
// Check for an embedded icon
unsigned int icon_size;
libr_icon *icon = NULL;
@ -266,7 +283,6 @@ TQString KURIFilterData::iconName()
}
}
#endif // HAVE_ELFICON
}
break;
}
case KURIFilterData::HELP:

Loading…
Cancel
Save