@@ -12,6 +12,9 @@ FocusScope {
13 signal applicationSelected(string appId)
13 signal applicationSelected(string appId)
15+ property bool draggingHorizontally: false
16+ property int dragDistance: 0
15 Rectangle {
18 Rectangle {
16 anchors.fill: parent
19 anchors.fill: parent
17 color: "#BF000000"
20 color: "#BF000000"
@@ -50,10 +53,10 @@ FocusScope {
50 width: parent.width
53 width: parent.width
51 actions: [
54 actions: [
53− text: i18n.tr("A-Z")
56+ text: i18n.ctr("Apps sorted alphabetically", "A-Z")
56− text: i18n.tr("Most used")
59+ text: i18n.ctr("Most used apps", "Most used")
@@ -72,6 +75,39 @@ FocusScope {
72 sourceComponent: sections.selectedIndex == 0 ? aToZComponent : mostUsedComponent
75 sourceComponent: sections.selectedIndex == 0 ? aToZComponent : mostUsedComponent
79+ parent: listLoader.item ? listLoader.item : null
81+ propagateComposedEvents: true
87+ var diff = oldX - mouseX;
88+ root.draggingHorizontally |= diff > units.gu(2);
89+ if (!root.draggingHorizontally) {
92+ propagateComposedEvents = false;
93+ parent.interactive = false;
94+ root.dragDistance += diff;
98+ if (root.draggingHorizontally) {
99+ root.draggingHorizontally = false;
100+ parent.interactive = true;
102+ reactivateTimer.start();
107+ onTriggered: parent.propagateComposedEvents = true;
75 Component {
111 Component {
76 id: mostUsedComponent
112 id: mostUsedComponent
77 ListView {
113 ListView {
@@ -89,6 +125,7 @@ FocusScope {
89 model: AppDrawerProxyModel {
125 model: AppDrawerProxyModel {
90 source: sortProxyModel
126 source: sortProxyModel
91 group: AppDrawerProxyModel.GroupByAll
127 group: AppDrawerProxyModel.GroupByAll
128+ sortBy: AppDrawerProxyModel.SortByUsage
94 delegate: UbuntuShape {
131 delegate: UbuntuShape {
@@ -98,6 +135,7 @@ FocusScope {
98 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
135 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
99 // which messes up the ListView.
136 // which messes up the ListView.
100 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
137 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
138+ enabled: parent.interactive
102 DrawerGridView {
140 DrawerGridView {
103 id: mostUsedGridView
141 id: mostUsedGridView
@@ -108,7 +146,6 @@ FocusScope {
109 model: sortProxyModel
147 model: sortProxyModel
112 delegateWidth: units.gu(8)
149 delegateWidth: units.gu(8)
113 delegateHeight: units.gu(10)
150 delegateHeight: units.gu(10)
114 delegate: drawerDelegateComponent
151 delegate: drawerDelegateComponent
@@ -140,6 +177,7 @@ FocusScope {
140 width: parent.width
177 width: parent.width
141 color: "#20ffffff"
178 color: "#20ffffff"
142 aspect: UbuntuShape.Flat
179 aspect: UbuntuShape.Flat
180+ enabled: parent.interactive
144 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
182 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
145 // which messes up the ListView.
183 // which messes up the ListView.