on xenial help sign in
Support annotated icons in ApplicationsFilterGrid.qml.

Approved by PS Jenkins bot, Pawel Stolowski.

commitaf5d2441b008f0431bf9af316aa4daf1146bfb32 authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 24 Jun 2013, 17:16 (13 years ago) parent41efc9ca1af2b9
2 files changed+7−6
Components/IconUtil.js+5−5 Dash/Apps/ApplicationsFilterGrid.qml+2−1
Components/IconUtil.js+5−5
@@ -26,17 +26,17 @@ function from_gicon(name) {
2626 var base_icon_re = /'base-icon':.+?'(.+?)'/;
2727 var base_icon = name.toString().match(base_icon_re);
2828 icon_name = base_icon[1];
29− }
30− else {
29+ } else {
3130 var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
3231 var themed = name.match(themed_re);
3332 if (themed) {
3433 return "image://gicon/" + themed[1];
3534 }
3635 }
37− var remote_re = /^http/;
38− if (remote_re.test(icon_name)) {
36+ var name_re = /^[a-z0-9\._-]+$/;
37+ if (name_re.test(icon_name)) {
38+ return "image://gicon/" + icon_name;
39+ } else {
3940 return icon_name;
4041 }
41− return "image://gicon/" + icon_name;
4242}
Dash/Apps/ApplicationsFilterGrid.qml+2−1
@@ -17,6 +17,7 @@
1717import QtQuick 2.0
1818import "../../Components"
1919import "../../Applications"
20+import "../../Components/IconUtil.js" as IconUtil
2021
2122FilterGrid {
2223 id: filterGrid
@@ -50,7 +51,7 @@ FilterGrid {
5051 text: model.column_5 ? model.column_5 : application.name // FIXME: this is temporary
5152 imageWidth: units.gu(8)
5253 imageHeight: units.gu(7.5)
53− source: icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon
54+ source: IconUtil.from_gicon(icon)
5455 onClicked: filterGrid.clicked(index, application.desktopFile);
5556 }
5657}