on xenial help sign in
Small fixlets

* Don't account for hidden others in edit mode * Allow to drag only from the handle since otherwise if you have too many items you can't scroll the list

commit2abfc99a752eb44101fd226a3aebcb7d941cfa1a authorAlbert Astals <albert.astals@canonical.com> dateThu 23 Oct 2014, 08:49 (12 years ago) parent85b65c4
3 files changed+23−17
qml/Dash/ScopesList.qml+1 qml/Dash/ScopesListCategory.qml+14−14 qml/Dash/ScopesListCategoryItem.qml+8−3
qml/Dash/ScopesList.qml+1
@@ -87,6 +87,7 @@ Item {
8787 clip: true
8888 contentWidth: root.width
8989 contentHeight: column.height
90+ onContentHeightChanged: returnToBounds();
9091 Column {
9192 id: column
9293 Repeater {
qml/Dash/ScopesListCategory.qml+14−14
@@ -35,7 +35,7 @@ Item {
3535 signal requestScopeMoveTo(string scopeId, int index)
3636 signal requestActivate(var result)
3737
38− implicitHeight: childrenRect.height
38+ implicitHeight: visible ? childrenRect.height : 0
3939
4040 ListItems.Header {
4141 id: header
@@ -88,14 +88,19 @@ Item {
8888 root.requestActivate(result);
8989 }
9090 }
91+ onPressAndHold: {
92+ if (!editMode) {
93+ root.requestEditMode();
94+ }
95+ }
9196 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);
92− onPressed: {
97+ onHandlePressed: {
9398 if (editMode) {
94− drag.target = dragItem;
95− drag.maximumX = units.gu(1);
96− drag.minimumX = units.gu(1);
97− drag.minimumY = list.y - dragItem.height / 2;
98− drag.maximumY = list.y + list.height - dragItem.height / 2
99+ handle.drag.target = dragItem;
100+ handle.drag.maximumX = units.gu(1);
101+ handle.drag.minimumX = units.gu(1);
102+ handle.drag.minimumY = list.y - dragItem.height / 2;
103+ handle.drag.maximumY = list.y + list.height - dragItem.height / 2
99104 dragItem.icon = icon;
100105 dragItem.text = text;
101106 dragItem.subtext = subtext;
@@ -106,14 +111,9 @@ Item {
106111 dragItem.loaderToShrink = loader;
107112 }
108113 }
109− onPressAndHold: {
110− if (!editMode) {
111− root.requestEditMode();
112− }
113− }
114− onReleased: {
114+ onHandleReleased: {
115115 if (dragItem.visible) {
116− drag.target = undefined;
116+ handle.drag.target = undefined;
117117 dragItem.visible = false;
118118 if (dragMarker.visible && dragMarker.index != index) {
119119 root.requestScopeMoveTo(model.scopeId, dragMarker.index);
qml/Dash/ScopesListCategoryItem.qml+8−3
@@ -19,7 +19,11 @@ import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.1
2020
2121MouseArea {
22+ id: root
23+
2224 signal requestFavorite(string scopeId, bool favorite)
25+ signal handlePressed(var handle)
26+ signal handleReleased(var handle)
2327
2428 property alias icon: shapeImage.source
2529 property alias text: titleLabel.text
@@ -77,14 +81,15 @@ MouseArea {
7781 height: parent.height
7882 width: height
7983 anchors.right: parent.right
80− enabled: !editMode
81− visible: !hideChildren
82− onClicked: root.requestFavorite(model.scopeId, !isFavorite);
84+ onClicked: if (!editMode) root.requestFavorite(model.scopeId, !isFavorite);
85+ onPressed: if (editMode) root.handlePressed(starArea);
86+ onReleased: if (editMode) root.handleReleased(starArea);
8387 Icon {
8488 id: star
8589 anchors.centerIn: parent
8690 height: units.gu(2)
8791 width: units.gu(2)
92+ visible: !hideChildren
8893 // TODO is view-grid-symbolic what we really want here? Looks good but seems semantically wrong
8994 source: editMode ? "image://theme/view-grid-symbolic" : isFavorite ? "image://theme/starred" : "image://theme/non-starred"
9095 }