@@ -12,6 +12,9 @@ FocusScope {
1212
1313 signal applicationSelected(string appId)
1414
15+ property bool draggingHorizontally: false
16+ property int dragDistance: 0
17+
1518 Rectangle {
1619 anchors.fill: parent
1720 color: "#BF000000"
@@ -50,10 +53,10 @@ FocusScope {
5053 width: parent.width
5154 actions: [
5255 Action {
53− text: i18n.tr("A-Z")
56+ text: i18n.ctr("Apps sorted alphabetically", "A-Z")
5457 },
5558 Action {
56− text: i18n.tr("Most used")
59+ text: i18n.ctr("Most used apps", "Most used")
5760 }
5861 ]
5962
@@ -72,6 +75,39 @@ FocusScope {
7275 sourceComponent: sections.selectedIndex == 0 ? aToZComponent : mostUsedComponent
7376 }
7477
78+ MouseArea {
79+ parent: listLoader.item ? listLoader.item : null
80+ anchors.fill: parent
81+ propagateComposedEvents: true
82+ property int oldX: 0
83+ onPressed: {
84+ oldX = mouseX;
85+ }
86+ onMouseXChanged: {
87+ var diff = oldX - mouseX;
88+ root.draggingHorizontally |= diff > units.gu(2);
89+ if (!root.draggingHorizontally) {
90+ return;
91+ }
92+ propagateComposedEvents = false;
93+ parent.interactive = false;
94+ root.dragDistance += diff;
95+ oldX = mouseX
96+ }
97+ onReleased: {
98+ if (root.draggingHorizontally) {
99+ root.draggingHorizontally = false;
100+ parent.interactive = true;
101+ }
102+ reactivateTimer.start();
103+ }
104+ Timer {
105+ id: reactivateTimer
106+ interval: 0
107+ onTriggered: parent.propagateComposedEvents = true;
108+ }
109+ }
110+
75111 Component {
76112 id: mostUsedComponent
77113 ListView {
@@ -89,6 +125,7 @@ FocusScope {
89125 model: AppDrawerProxyModel {
90126 source: sortProxyModel
91127 group: AppDrawerProxyModel.GroupByAll
128+ sortBy: AppDrawerProxyModel.SortByUsage
92129 }
93130
94131 delegate: UbuntuShape {
@@ -98,6 +135,7 @@ FocusScope {
98135 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
99136 // which messes up the ListView.
100137 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
138+ enabled: parent.interactive
101139
102140 DrawerGridView {
103141 id: mostUsedGridView
@@ -108,7 +146,6 @@ FocusScope {
108146
109147 model: sortProxyModel
110148
111−
112149 delegateWidth: units.gu(8)
113150 delegateHeight: units.gu(10)
114151 delegate: drawerDelegateComponent
@@ -140,6 +177,7 @@ FocusScope {
140177 width: parent.width
141178 color: "#20ffffff"
142179 aspect: UbuntuShape.Flat
180+ enabled: parent.interactive
143181
144182 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
145183 // which messes up the ListView.