[PATCH] Mobile components: use back button to close global and context drawers
Dirk Hohndel
dirk at hohndel.org
Thu Jan 7 07:17:18 UTC 2016
This is a possible patch for the first issue I just reported :-)
/D
On Wed, Jan 06, 2016 at 11:46:06PM +1100, Rick Walsh wrote:
> ApplicationWindow catches Qt.Key_Back. By using it to close the global and
> context drawers ahead of stackView.pop(), we get expected behaviour in
> Subsurface-mobile, similar to other apps.
>
> Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
> ---
>
> Sebastian,
> You said you'd rather any changes to qt-mobile/qml/mobilecomponents/* are made upstream, so I'm sending this patch to you as well as the Subsurface list. I couldn't find a tidy way to make the drawers close with the back button without touching qt-mobile/qml/mobilecomponents/. Of course, you are much more familiar with the code than I am, and may know a better way to achieve the same goal.
>
> Rick
>
> qt-mobile/qml/mobilecomponents/ApplicationWindow.qml | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/qt-mobile/qml/mobilecomponents/ApplicationWindow.qml b/qt-mobile/qml/mobilecomponents/ApplicationWindow.qml
> index 0eaa81e..911f885 100644
> --- a/qt-mobile/qml/mobilecomponents/ApplicationWindow.qml
> +++ b/qt-mobile/qml/mobilecomponents/ApplicationWindow.qml
> @@ -65,9 +65,17 @@ inputMethod.keyboardRectangle.y) : 0
> }
> focus: true
> Keys.onReleased: {
> - if (event.key == Qt.Key_Back && stackView.depth > 1) {
> - stackView.pop();
> - event.accepted = true;
> + if (event.key == Qt.Key_Back) {
> + if (root.contextDrawer && root.contextDrawer.opened) {
> + root.contextDrawer.close();
> + event.accepted = true;
> + } else if (root.globalDrawer && root.globalDrawer.opened) {
> + root.globalDrawer.close();
> + event.accepted = true;
> + } else if (stackView.depth > 1) {
> + stackView.pop();
> + event.accepted = true;
> + }
> }
> }
> }
> --
> 2.5.0
>
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
More information about the Plasma-devel
mailing list