on xenial help sign in
fix isFavorites and categoryId issues with last commit
0828225Albert Astals
qml/Dash/ScopesListCategory.qml+7−3
@@ -26,6 +26,9 @@ Item {
26 property var scopeStyle
26 property var scopeStyle
27 property bool editMode: false
27 property bool editMode: false
28
28
29+ readonly property bool isFavoritesFeed: root.model.categoryId == "favorites"
30+ readonly property bool isOtherFeed: root.model.categoryId == "other"
31+
29 visible: !editMode || categoryId == "favorites"
32 visible: !editMode || categoryId == "favorites"
30
33
31 signal requestFavorite(string scopeId, bool favorite)
34 signal requestFavorite(string scopeId, bool favorite)
@@ -40,8 +43,8 @@ Item {
40 width: root.width
43 width: root.width
41 height: units.gu(5)
44 height: units.gu(5)
42 text: {
45 text: {
43− if (categoryId == "favorites") return i18n.tr("Favourite Feeds");
46+ if (isFavoritesFeed) return i18n.tr("Favourite Feeds");
44− else if (categoryId == "other") return i18n.tr("Other Subscribed Feeds");
47+ else if (isOtherFeed) return i18n.tr("Other Subscribed Feeds");
45 else return name;
48 else return name;
46 }
49 }
47 color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
50 color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
@@ -76,7 +79,8 @@ Item {
76
79
77 icon: model.art || ""
80 icon: model.art || ""
78 text: model.title || ""
81 text: model.title || ""
79− showStar: model.scopeId != "clickscope" && (categoryId == "favorites" || categoryId == "other")
82+ showStar: model.scopeId != "clickscope" && (root.isFavoritesFeed || root.isOtherFeed)
83+ isFavorite: root.isFavoritesFeed
80
84
81 onClicked: root.requestActivate(result);
85 onClicked: root.requestActivate(result);
82 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);
86 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);
qml/Dash/ScopesListCategoryItem.qml+4−2
@@ -24,6 +24,8 @@ MouseArea {
24 property alias text: titleLabel.text
24 property alias text: titleLabel.text
25 property alias showStar: star.visible
25 property alias showStar: star.visible
26
26
27+ property bool isFavorite: false
28+
27 UbuntuShape {
29 UbuntuShape {
28 id: shape
30 id: shape
29 anchors {
31 anchors {
@@ -63,10 +65,10 @@ MouseArea {
63 height: units.gu(2)
65 height: units.gu(2)
64 width: units.gu(2)
66 width: units.gu(2)
65 // TODO is view-grid-symbolic what we really want here? Looks good but seems semantically wrong
67 // TODO is view-grid-symbolic what we really want here? Looks good but seems semantically wrong
66− source: editMode ? "image://theme/view-grid-symbolic" : isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
68+ source: editMode ? "image://theme/view-grid-symbolic" : isFavorite ? "image://theme/starred" : "image://theme/non-starred"
67 MouseArea {
69 MouseArea {
68 anchors.fill: parent
70 anchors.fill: parent
69− onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
71+ onClicked: root.requestFavorite(model.scopeId, !isFavorite);
70 }
72 }
71 }
73 }
72}
74}
tests/mocks/Unity/fake_scopesoverview.cpp+1−1
@@ -108,7 +108,7 @@ QVariant ScopesOverviewCategories::data(const QModelIndex& index, int role) cons
108 return QVariant();
108 return QVariant();
109 }
109 }
110
110
111− const QString categoryId = index.row() == 0 ? "favorites" : "nonfavorites";
111+ const QString categoryId = index.row() == 0 ? "favorites" : "other";
112
112
113 ScopesOverviewResultsModel *resultsModel = m_resultsModels[index.row()];
113 ScopesOverviewResultsModel *resultsModel = m_resultsModels[index.row()];
114 if (!resultsModel) {
114 if (!resultsModel) {