@@ -18,35 +18,11 @@ import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import "../Components"
2020import "../Components/ListItems" as ListItems
21+import "../Components/IconUtil.js" as IconUtil
2122
2223LensView {
2324 id: lensView
2425
25− //FIXME: a quick hack to get icons out of gicons and fallback to
26− //base icon for annotated icons. Doesn't correctly handle all icons.
27− //Proper global solution needed.
28− function from_gicon(name) {
29− var icon_name = name;
30− var annotated_re = /^. UnityProtocolAnnotatedIcon/;
31− if (annotated_re.test(name)) {
32− var base_icon_re = /'base-icon':.+?'(.+?)'/;
33− var base_icon = name.toString().match(base_icon_re);
34− icon_name = base_icon[1];
35− }
36− else {
37− var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
38− var themed = name.match(themed_re);
39− if (themed) {
40− return "image://gicon/" + themed[1];
41− }
42− }
43− var remote_re = /^http/;
44− if (remote_re.test(icon_name)) {
45− return icon_name;
46− }
47− return "image://gicon/" + icon_name;
48− }
49−
5026 onIsCurrentChanged: {
5127 pageHeader.resetSearch();
5228 }
@@ -99,7 +75,7 @@ LensView {
9975 text: column_5 ? column_5 : "" // FIXME: this shouldn't be necessary
10076 imageWidth: units.gu(11)
10177 imageHeight: units.gu(16)
102− source: column_1 ? from_gicon(column_1) : "" // FIXME: ditto
78+ source: column_1 ? IconUtil.from_gicon(column_1) : "" // FIXME: ditto
10379 }
10480 }
10581 }