on xenial help sign in
Foundations for the edit mode
commitcf3695c76f795808201f96fd81808bca66a61144 authorAlbert Astals <albert.astals@canonical.com> dateMon 22 Sep 2014, 17:46 (12 years ago) parentd319b6f
3 files changed+23−6
qml/Dash/PageHeader.qml+2−1 qml/Dash/ScopesList.qml+14−3 qml/Dash/ScopesListCategory.qml+7−2
qml/Dash/PageHeader.qml+2−1
@@ -28,6 +28,7 @@ Item {
2828 implicitHeight: headerContainer.height + bottomContainer.height + (showSignatureLine ? units.gu(2) : 0)
2929
3030 property bool showBackButton: false
31+ property bool backIsClose: false
3132 property string title
3233
3334 property bool storeEntryEnabled: false
@@ -249,7 +250,7 @@ Item {
249250 property var config: PageHeadConfiguration {
250251 foregroundColor: root.scopeStyle ? root.scopeStyle.headerForeground : Theme.palette.normal.baseText
251252 backAction: Action {
252− iconName: "back"
253+ iconName: backIsClose ? "close" : "back"
253254 visible: root.showBackButton
254255 onTriggered: root.backClicked()
255256 }
qml/Dash/ScopesList.qml+14−3
@@ -31,6 +31,8 @@ Item {
3131 signal storeClicked()
3232 signal requestFavorite(string scopeId, bool favorite)
3333
34+ state: "browse"
35+
3436 ScopeStyle {
3537 id: scopeStyle
3638 style: { "foreground-color" : "gray",
@@ -62,9 +64,16 @@ Item {
6264 title: i18n.tr("My Feeds")
6365 width: parent.width
6466 showBackButton: true
65− storeEntryEnabled: true
66− searchEntryEnabled: true
67− onBackClicked: root.backClicked()
67+ backIsClose: root.state == "edit"
68+ storeEntryEnabled: root.state == "browse"
69+ searchEntryEnabled: root.state == "browse"
70+ onBackClicked: {
71+ if (backIsClose) {
72+ root.state = "browse"
73+ } else {
74+ root.backClicked()
75+ }
76+ }
6877 onStoreClicked: root.storeClicked();
6978 }
7079
@@ -91,10 +100,12 @@ Item {
91100 item.isFavoriteFeeds = index == 0;
92101 item.scopeStyle = scopeStyle;
93102 item.model = Qt.binding(function() { return results });
103+ item.editMode = Qt.binding(function() { return root.state == "edit" });
94104 }
95105 Connections {
96106 target: item
97107 onRequestFavorite: root.requestFavorite(scopeId, favorite)
108+ onRequestEditMode: root.state = "edit";
98109 }
99110 }
100111 }
qml/Dash/ScopesListCategory.qml+7−2
@@ -25,8 +25,10 @@ Item {
2525 property alias model: list.model
2626 property var scopeStyle
2727 property bool isFavoriteFeeds: false
28+ property bool editMode: false
2829
2930 signal requestFavorite(string scopeId, bool favorite)
31+ signal requestEditMode()
3032
3133 implicitHeight: childrenRect.height
3234
@@ -58,7 +60,7 @@ Item {
5860 asynchronous: true
5961 width: root.width
6062 height: units.gu(6)
61− sourceComponent: Item {
63+ sourceComponent: MouseArea {
6264 width: root.width
6365 UbuntuShape {
6466 id: shape
@@ -100,12 +102,15 @@ Item {
100102 height: units.gu(2)
101103 width: units.gu(2)
102104 visible: model.scopeId != "clickscope"
103− source: isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
105+ // TODO is view-grid-symbolic what we really want here? Looks good but seems semantically wrong
106+ source: editMode ? "image://theme/view-grid-symbolic" : isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
104107 MouseArea {
105108 anchors.fill: parent
106109 onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
107110 }
108111 }
112+
113+ onPressAndHold: root.requestEditMode();
109114 }
110115 }
111116 }