on xenial help sign in
merge expose-renderer-hints
commit4da7de709c94f296b3a1c8a6cb50302560ad82a4 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 3 Oct 2013, 20:22 (13 years ago) parentfe67fc32d839af
2 files changed+7−5
plugins/Unity/categoryresults.cpp+6−4 plugins/Unity/categoryresults.h+1−1
plugins/Unity/categoryresults.cpp+6−4
@@ -46,7 +46,7 @@ CategoryResults::CategoryResults(QObject* parent)
4646 m_roles[CategoryResults::RoleComment] = "comment";
4747 m_roles[CategoryResults::RoleDndUri] = "dndUri";
4848 m_roles[CategoryResults::RoleMetadata] = "metadata";
49− m_roles[CategoryResults::RoleMetadataScopeDisabled] = "scopeDisabled";
49+ m_roles[CategoryResults::RoleRendererHints] = "rendererHints";
5050}
5151
5252int CategoryResults::categoryIndex() const
@@ -94,14 +94,16 @@ CategoryResults::data(const QModelIndex& index, int role) const
9494 return DeeListModel::data(index, ResultsColumn::DND_URI);
9595 case RoleMetadata:
9696 return DeeListModel::data(index, ResultsColumn::METADATA);
97− // FIXME nasty hack while we don't support annotated icons
98− case RoleMetadataScopeDisabled: {
97+ case RoleRendererHints:
98+ {
9999 QVariantHash hash(DeeListModel::data(index, ResultsColumn::METADATA).toHash());
100100 if (hash.contains("content")) {
101+ QVariantMap hints;
101102 QVariantHash innerHash(hash["content"].toHash());
102103 if (innerHash.contains("scope_disabled")) {
103− return innerHash["scope_disabled"];
104+ hints["scope_disabled"] = innerHash["scope_disabled"];
104105 }
106+ return hints.empty() ? QVariant() : QVariant::fromValue(hints);
105107 }
106108 return QVariant();
107109 }
plugins/Unity/categoryresults.h+1−1
@@ -44,7 +44,7 @@ public:
4444 RoleComment,
4545 RoleDndUri,
4646 RoleMetadata,
47− RoleMetadataScopeDisabled
47+ RoleRendererHints
4848 };
4949
5050 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;