2 import QtQuick.Controls 1.4
3 import QtQuick.Controls.Styles 1.4
4 import QtQuick.Layouts 1.2
11 property alias addressBar: urlBar
12 property Item webView: null
14 visible: opacity != 0.0
15 opacity: tabView.viewState == "page" ? 1.0 : 0.0
19 homeScreen.state = "disabled"
23 bookmarksButton.bookmarked = homeScreen.contains(urlBar.text) !== -1
29 background: Rectangle {
31 implicitHeight: toolBarSize
42 NumberAnimation { duration: animationDuration }
58 var diff = touchReference - touchY
60 if (velocityY > velocityThreshold) {
67 if (!touchGesture || diff == 0) {
68 if (y < -toolBarSize / 2)
74 if (diff > toolBarSize)
78 if (y == -toolBarSize)
89 if (diff >= toolBarSize)
92 return -toolBarSize + diff
106 height: toolBarSize - 2
116 source: "qrc:///back"
117 onClicked: webView.goBack()
118 enabled: webView && webView.canGoBack
124 bottom: parent.bottom
126 color: uiSeparatorColor
130 source: "qrc:///forward"
131 onClicked: webView.goForward()
132 enabled: webView && webView.canGoForward
138 bottom: parent.bottom
140 color: uiSeparatorColor
143 Layout.fillWidth: true
147 bottom: parent.bottom
153 Layout.fillWidth: true
154 text: webView ? webView.url : ""
155 activeFocusOnPress: true
156 placeholderText: qsTr("Search or type a URL")
159 onActiveFocusChanged: {
161 root.state = "enabled"
163 root.state = "tracking"
168 source: webView && webView.loading ? "qrc:///stop" : "qrc:///refresh"
172 highlightColor: "#eeeeee"
177 verticalCenter: addressBar.verticalCenter;
179 onClicked: { webView.loading ? webView.stop() : webView.reload() }
181 style: TextFieldStyle {
183 font.family: defaultFontFamily
185 selectionColor: uiHighlightColor
186 selectedTextColor: "black"
187 placeholderTextColor: placeholderColor
188 background: Rectangle {
191 border.color: textFieldStrokeColor
196 right: reloadButton.width
200 webView.url = engine.fromUserInput(text)
201 homeScreen.state = "disabled"
202 tabView.viewState = "page"
205 onTextChanged: refresh()
206 onEditingFinished: selectAll()
212 urlBar.cursorPosition = 0
218 Layout.fillWidth: true
222 bottom: parent.bottom
230 bottom: parent.bottom
232 color: uiSeparatorColor
236 source: "qrc:///home"
238 if (homeScreen.state == "disabled" || homeScreen.state == "edit") {
239 homeScreen.messageBox.state = "disabled"
240 homeScreen.state = "enabled"
241 } else if (homeScreen.state != "disabled")
242 homeScreen.state = "disabled"
249 bottom: parent.bottom
251 color: uiSeparatorColor
255 source: "qrc:///tabs"
257 if (tabView.viewState == "list") {
258 tabView.viewState = "page"
260 tabView.get(tabView.currentIndex).item.webView.takeSnapshot()
261 homeScreen.state = "disabled"
262 tabView.viewState = "list"
268 verticalCenterOffset: 4
272 font.family: defaultFontFamily
274 font.weight: Font.DemiBold
282 bottom: parent.bottom
284 color: uiSeparatorColor
288 property bool bookmarked: false
289 source: bookmarked ? "qrc:///star_checked" : "qrc:///star"
293 var icon = webView.loading ? "" : webView.icon
294 var idx = homeScreen.contains(webView.url.toString())
296 homeScreen.remove("", idx)
299 var count = homeScreen.count
300 homeScreen.add(webView.title, webView.url, icon, engine.fallbackColor())
301 if (count < homeScreen.count)
304 Component.onCompleted: refresh()
310 bottom: parent.bottom
312 color: uiSeparatorColor
316 source: "qrc:///settings"
319 onClicked: tabView.interactive = !checked
327 bottom: parent.bottom
332 style: ProgressBarStyle {
333 background: Rectangle {
335 color: uiSeparatorColor
337 progress: Rectangle {
338 color: uiHighlightColor
343 value: (webView && webView.loadProgress < 100) ? webView.loadProgress : 0