on xenial help sign in
some fixes, tests
d2db6b0Michael Zanetti
plugins/Utils/appdrawerproxymodel.cpp−3
@@ -172,12 +172,10 @@ bool AppDrawerProxyModel::filterAcceptsRow(int source_row, const QModelIndex &so
172
172
173QString AppDrawerProxyModel::appId(int index) const
173QString AppDrawerProxyModel::appId(int index) const
174{
174{
175− qDebug() << "get called:" << index << this << m_source->staticMetaObject.className() << m_source;
176 if (index >= 0 && index < rowCount()) {
175 if (index >= 0 && index < rowCount()) {
177 QModelIndex sourceIndex = mapToSource(this->index(index, 0));
176 QModelIndex sourceIndex = mapToSource(this->index(index, 0));
178
177
179 AppDrawerModelInterface* adm = dynamic_cast<AppDrawerModelInterface*>(m_source);
178 AppDrawerModelInterface* adm = dynamic_cast<AppDrawerModelInterface*>(m_source);
180− qDebug() << "tried casting to ADMI:" << adm;
181 if (adm) {
179 if (adm) {
182 return adm->data(sourceIndex, AppDrawerModelInterface::RoleAppId).toString();
180 return adm->data(sourceIndex, AppDrawerModelInterface::RoleAppId).toString();
183 }
181 }
@@ -187,6 +185,5 @@ QString AppDrawerProxyModel::appId(int index) const
187 return adpm->appId(sourceIndex.row());
185 return adpm->appId(sourceIndex.row());
188 }
186 }
189 }
187 }
190− qDebug() << "could nto cast source model";
191 return nullptr;
188 return nullptr;
192}
189}
qml/Launcher/Launcher.qml+14−18
@@ -347,12 +347,20 @@ FocusScope {
347 top: parent.top
347 top: parent.top
348 topMargin: root.inverted ? root.topPanelHeight : 0
348 topMargin: root.inverted ? root.topPanelHeight : 0
349 bottom: parent.bottom
349 bottom: parent.bottom
350+ right: parent.left
350 }
351 }
351 width: Math.min(root.width, units.gu(90)) * .9
352 width: Math.min(root.width, units.gu(90)) * .9
352− x: -width
353 panelWidth: panel.width
353 panelWidth: panel.width
354 visible: x > -width
354 visible: x > -width
355
355
356+ Behavior on anchors.rightMargin {
357+ enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate && !drawer.draggingHorizontally
358+ NumberAnimation {
359+ duration: 300
360+ easing.type: Easing.OutCubic
361+ }
362+ }
363+
356 onApplicationSelected: {
364 onApplicationSelected: {
357 root.hide();
365 root.hide();
358 root.launcherApplicationSelected(appId)
366 root.launcherApplicationSelected(appId)
@@ -365,7 +373,7 @@ FocusScope {
365 }
373 }
366
374
367 onDragDistanceChanged: {
375 onDragDistanceChanged: {
368− x = Math.min(0, x-dragDistance);
376+ anchors.rightMargin = Math.max(-drawer.width, anchors.rightMargin + dragDistance);
369 }
377 }
370 onDraggingHorizontallyChanged: {
378 onDraggingHorizontallyChanged: {
371 if (!draggingHorizontally) {
379 if (!draggingHorizontally) {
@@ -496,12 +504,12 @@ FocusScope {
496 if (root.drawerEnabled && dragging && launcher.state != "drawer") {
504 if (root.drawerEnabled && dragging && launcher.state != "drawer") {
497 var drawerHintDistance = panel.width + units.gu(1)
505 var drawerHintDistance = panel.width + units.gu(1)
498 if (distance < drawerHintDistance) {
506 if (distance < drawerHintDistance) {
499− drawer.x = -drawer.width + Math.min(Math.max(0, distance), drawer.width);
507+ drawer.anchors.rightMargin = -Math.min(Math.max(0, distance), drawer.width);
500 } else {
508 } else {
501 var linearDrawerX = Math.min(Math.max(0, distance - drawerHintDistance), drawer.width);
509 var linearDrawerX = Math.min(Math.max(0, distance - drawerHintDistance), drawer.width);
502 var linearDrawerProgress = linearDrawerX / (drawer.width)
510 var linearDrawerProgress = linearDrawerX / (drawer.width)
503 var easedDrawerProgress = easeInOutCubic(linearDrawerProgress);
511 var easedDrawerProgress = easeInOutCubic(linearDrawerProgress);
504− drawer.x = (-drawer.width + drawerHintDistance) + easedDrawerProgress * (drawer.width - drawerHintDistance);
512+ drawer.anchors.rightMargin = -(drawerHintDistance + easedDrawerProgress * (drawer.width - drawerHintDistance));
505 }
513 }
506 }
514 }
507 }
515 }
@@ -532,7 +540,7 @@ FocusScope {
532 }
540 }
533 PropertyChanges {
541 PropertyChanges {
534 target: drawer
542 target: drawer
535− x: -drawer.width
543+ anchors.rightMargin: 0
536 }
544 }
537 },
545 },
538 State {
546 State {
@@ -541,17 +549,13 @@ FocusScope {
541 target: panel
549 target: panel
542 x: -root.x // so we never go past panelWidth, even when teased by tutorial
550 x: -root.x // so we never go past panelWidth, even when teased by tutorial
543 }
551 }
544− PropertyChanges {
545− target: drawer
546− x: -drawer.width
547− }
548 },
552 },
549 State {
553 State {
550 name: "drawer"
554 name: "drawer"
551 extend: "visible"
555 extend: "visible"
552 PropertyChanges {
556 PropertyChanges {
553 target: drawer
557 target: drawer
554− x: -root.x // so we never go past panelWidth, even when teased by tutorial
558+ anchors.rightMargin: -drawer.width + root.x // so we never go past panelWidth, even when teased by tutorial
555 }
559 }
556 },
560 },
557 State {
561 State {
@@ -579,12 +583,4 @@ FocusScope {
579 }
583 }
580 }
584 }
581 ]
585 ]
582− transitions: [
583− Transition {
584− from: "*"
585− to: "*"
586− UbuntuNumberAnimation { target: panel; property: "x"; easing: Easing.OutQuad; duration: UbuntuAnimation.SnapDuration }
587− UbuntuNumberAnimation { target: drawer; property: "x"; easing: Easing.OutQuad; duration: UbuntuAnimation.SnapDuration }
588− }
589− ]
590}
586}
tests/qmltests/Launcher/tst_Drawer.qml+13−1
@@ -89,6 +89,7 @@ StyledItem {
89 UnityTestCase {
89 UnityTestCase {
90 id: testCase
90 id: testCase
91 when: windowShown
91 when: windowShown
92+ name: "Drawer"
92
93
93 function dragDrawerIntoView() {
94 function dragDrawerIntoView() {
94 var startX = launcher.dragAreaWidth/2;
95 var startX = launcher.dragAreaWidth/2;
@@ -159,10 +160,11 @@ StyledItem {
159
160
160 function test_hideByDraggingDrawer() {
161 function test_hideByDraggingDrawer() {
161 dragDrawerIntoView();
162 dragDrawerIntoView();
163+ waitForRendering(launcher);
162
164
163 var drawer = findChild(launcher, "drawer");
165 var drawer = findChild(launcher, "drawer");
164
166
165− mouseFlick(drawer, drawer.width - units.gu(1), drawer.height / 2, drawer.width - units.gu(12), drawer.height / 2);
167+ mouseFlick(root, drawer.width - units.gu(1), drawer.height / 2, 0, drawer.height / 2, true, true);
166
168
167 tryCompare(launcher, "state", "");
169 tryCompare(launcher, "state", "");
168 }
170 }
@@ -218,5 +220,15 @@ StyledItem {
218
220
219 launcher.drawerEnabled = true;
221 launcher.drawerEnabled = true;
220 }
222 }
223+
224+ function test_search() {
225+ compare(launcher.lastSelectedApplication, "");
226+
227+ launcher.openDrawer(true)
228+ typeString("cam");
229+ keyClick(Qt.Key_Enter);
230+
231+ compare(launcher.lastSelectedApplication, "camera-app");
232+ }
221 }
233 }
222}
234}