From 7434e4213b5771cf4d3c805b1ddc44716f087a83 Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <dirk@hohndel.org>
Date: Sat, 26 Mar 2016 21:27:48 -0700
Subject: [PATCH] QML UI: show keyboard when entering credential screen

If the user goes to the credentials screen, they likely want to edit
something.  So put the focus on the first entry field and show the
keyboard.

We also need to hide the keyboard when the credential screen becomes
invisble so that the keyboard doesn't stay around when the dive list
is shown.

Suggested-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
---
 qt-mobile/qml/CloudCredentials.qml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/qt-mobile/qml/CloudCredentials.qml b/qt-mobile/qml/CloudCredentials.qml
index b31e59c03..6da8b0bab 100644
--- a/qt-mobile/qml/CloudCredentials.qml
+++ b/qt-mobile/qml/CloudCredentials.qml
@@ -23,6 +23,16 @@ Item {
 	ColumnLayout {
 		id: outerLayout
 		width: subsurfaceTheme.columnWidth - 2 * MobileComponents.Units.gridUnit
+
+		onVisibleChanged: {
+			if (visible) {
+				Qt.inputMethod.show()
+				login.forceActiveFocus()
+			} else {
+				Qt.inputMethod.hide()
+			}
+		}
+
 		MobileComponents.Heading {
 			text: "Cloud credentials"
 			level: headingLevel