on xenial help sign in
fix isFavorites and categoryId issues with last commit
commit0828225b6b95ae2a69cb5cc40de2129621ddd81f authorAlbert Astals <albert.astals@canonical.com> dateFri 26 Sep 2014, 16:06 (12 years ago) parent82b74fc
3 files changed+12−6
qml/Dash/ScopesListCategory.qml+7−3 qml/Dash/ScopesListCategoryItem.qml+4−2 tests/mocks/Unity/fake_scopesoverview.cpp+1−1
qml/Dash/ScopesListCategory.qml+7−3
@@ -26,6 +26,9 @@ Item {
2626 property var scopeStyle
2727 property bool editMode: false
2828
29+ readonly property bool isFavoritesFeed: root.model.categoryId == "favorites"
30+ readonly property bool isOtherFeed: root.model.categoryId == "other"
31+
2932 visible: !editMode || categoryId == "favorites"
3033
3134 signal requestFavorite(string scopeId, bool favorite)
@@ -40,8 +43,8 @@ Item {
4043 width: root.width
4144 height: units.gu(5)
4245 text: {
43− if (categoryId == "favorites") return i18n.tr("Favourite Feeds");
44− else if (categoryId == "other") return i18n.tr("Other Subscribed Feeds");
46+ if (isFavoritesFeed) return i18n.tr("Favourite Feeds");
47+ else if (isOtherFeed) return i18n.tr("Other Subscribed Feeds");
4548 else return name;
4649 }
4750 color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
@@ -76,7 +79,8 @@ Item {
7679
7780 icon: model.art || ""
7881 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
8084
8185 onClicked: root.requestActivate(result);
8286 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);
qml/Dash/ScopesListCategoryItem.qml+4−2
@@ -24,6 +24,8 @@ MouseArea {
2424 property alias text: titleLabel.text
2525 property alias showStar: star.visible
2626
27+ property bool isFavorite: false
28+
2729 UbuntuShape {
2830 id: shape
2931 anchors {
@@ -63,10 +65,10 @@ MouseArea {
6365 height: units.gu(2)
6466 width: units.gu(2)
6567 // 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"
6769 MouseArea {
6870 anchors.fill: parent
69− onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
71+ onClicked: root.requestFavorite(model.scopeId, !isFavorite);
7072 }
7173 }
7274}
tests/mocks/Unity/fake_scopesoverview.cpp+1−1
@@ -108,7 +108,7 @@ QVariant ScopesOverviewCategories::data(const QModelIndex& index, int role) cons
108108 return QVariant();
109109 }
110110
111− const QString categoryId = index.row() == 0 ? "favorites" : "nonfavorites";
111+ const QString categoryId = index.row() == 0 ? "favorites" : "other";
112112
113113 ScopesOverviewResultsModel *resultsModel = m_resultsModels[index.row()];
114114 if (!resultsModel) {