~dbusmenu-team/libdbusmenu-qt/trunk

« back to all changes in this revision

Viewing changes to src/dbusmenuexporter.cpp

  • Committer: Charles Kerr
  • Author(s): Albert Astals Cid (aacid)
  • Date: 2012-10-24 14:43:10 UTC
  • mfrom: (236.1.1 libdbusmenu-qt)
  • Revision ID: charles.kerr@canonical.com-20121024144310-w4ihv1fbzij09xm6
give the serialized icon data even if the icon name is available

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
 
234
234
void DBusMenuExporterPrivate::insertIconProperty(QVariantMap *map, QAction *action) const
235
235
{
236
 
    QString iconName = q->iconNameForAction(action);
 
236
    // provide the icon name for per-theme lookups
 
237
    const QString iconName = q->iconNameForAction(action);
237
238
    if (!iconName.isEmpty()) {
238
239
        map->insert("icon-name", iconName);
239
 
        return;
240
 
    }
241
 
    QIcon icon = action->icon();
242
 
    if (icon.isNull()) {
243
 
        return;
244
240
    }
245
241
 
246
 
    QBuffer buffer;
247
 
    icon.pixmap(16).save(&buffer, "PNG");
248
 
    map->insert("icon-data", buffer.data());
 
242
    // provide the serialized icon data in case the icon
 
243
    // is unnamed or the name isn't supported by the theme
 
244
    const QIcon icon = action->icon();
 
245
    if (!icon.isNull()) {
 
246
        QBuffer buffer;
 
247
        icon.pixmap(16).save(&buffer, "PNG");
 
248
        map->insert("icon-data", buffer.data());
 
249
    }
249
250
}
250
251
 
251
252
static void collapseSeparator(QAction* action)