From 60355c949c4c8bf438465eaef0c0cc28a51fab53 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Fri, 20 Jun 2014 01:27:43 -0700 Subject: Optimize behavior for hiding the address bar. The address bar is only hidden, when the WebEngineView gains focus. It is hidden with a delay of 2 seconds. This usually gives the impression the address bar hides when the page loaded. Change-Id: I3d62406b3de7219d831d195fd961d71c3debb767 Reviewed-by: Andras Becsi --- basicsuite/webengine/main.qml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/basicsuite/webengine/main.qml b/basicsuite/webengine/main.qml index 30365ce..abcfe09 100644 --- a/basicsuite/webengine/main.qml +++ b/basicsuite/webengine/main.qml @@ -72,7 +72,6 @@ Rectangle { onLoadingChanged: { if (!loading) { addressBar.cursorPosition = 0 - toolBar.state = "address" } var loadError = loadRequest.errorDomain if (loadError == WebEngineView.NoErrorDomain) { @@ -91,6 +90,7 @@ Rectangle { else // HTTP and FTP errorPage.mainMessage = "Protocol error" } + onActiveFocusChanged: activeFocus ? hideTimer.running = true : toolBar.state = "address" } MultiPointTouchArea { @@ -134,13 +134,12 @@ Rectangle { Timer { id: hideTimer - interval: 3000 - running: (toolBar.state == "address" || toolBar.state == "") && !addressBar.activeFocus + interval: 2000 onTriggered: { - if (toolBar.state == "address") - toolBar.state = "hidden" - if (toolBar.state == "") - toolBar.state = "address" + if (addressBar.activeFocus) + return; + toolBar.state = "hidden" + running = false } } @@ -231,9 +230,11 @@ Rectangle { height: 25 iconSource: (toolBar.state == "hidden") ? "ui/icons/down.png" : "ui/icons/up.png" onClicked: { - if (toolBar.state == "hidden") + if (toolBar.state == "hidden") { toolBar.state = "address" - else + addressBar.forceActiveFocus() + addressBar.selectAll() + } else toolBar.state = "hidden" } anchors { -- cgit v1.2.3