|
|
|
@ -29,22 +29,18 @@ DesktopIconProvider::DesktopIconProvider()
|
|
|
|
QPixmap DesktopIconProvider::requestPixmap(const QString &id, QSize *realSize,
|
|
|
|
QPixmap DesktopIconProvider::requestPixmap(const QString &id, QSize *realSize,
|
|
|
|
const QSize &requestedSize)
|
|
|
|
const QSize &requestedSize)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Sanitize requested size
|
|
|
|
|
|
|
|
QSize size(requestedSize);
|
|
|
|
QSize size(requestedSize);
|
|
|
|
if (size.width() < 1)
|
|
|
|
if (size.width() < 1)
|
|
|
|
size.setWidth(1);
|
|
|
|
size.setWidth(1);
|
|
|
|
if (size.height() < 1)
|
|
|
|
if (size.height() < 1)
|
|
|
|
size.setHeight(1);
|
|
|
|
size.setHeight(1);
|
|
|
|
|
|
|
|
|
|
|
|
// Return real size
|
|
|
|
|
|
|
|
if (realSize)
|
|
|
|
if (realSize)
|
|
|
|
*realSize = size;
|
|
|
|
*realSize = size;
|
|
|
|
|
|
|
|
|
|
|
|
// Is it a path?
|
|
|
|
|
|
|
|
if (id.startsWith(QLatin1Char('/')))
|
|
|
|
if (id.startsWith(QLatin1Char('/')))
|
|
|
|
return QPixmap(id).scaled(size);
|
|
|
|
return QPixmap(id).scaled(size);
|
|
|
|
|
|
|
|
|
|
|
|
// Return icon from theme or fallback to a generic icon
|
|
|
|
|
|
|
|
QIcon icon = QIcon::fromTheme(id);
|
|
|
|
QIcon icon = QIcon::fromTheme(id);
|
|
|
|
if (icon.isNull())
|
|
|
|
if (icon.isNull())
|
|
|
|
icon = QIcon::fromTheme(QLatin1String("application-x-desktop"));
|
|
|
|
icon = QIcon::fromTheme(QLatin1String("application-x-desktop"));
|
|
|
|
|