| [844] | 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtDeclarative module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | import QtQuick 1.0
|
|---|
| 43 |
|
|---|
| 44 | Image {
|
|---|
| 45 | id: header
|
|---|
| 46 |
|
|---|
| 47 | property alias editUrl: urlInput.url
|
|---|
| 48 | property bool urlChanged: false
|
|---|
| 49 |
|
|---|
| 50 | source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally
|
|---|
| 51 |
|
|---|
| 52 | x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width
|
|---|
| 53 | ? -webView.contentX+webView.contentWidth-webView.width : 0
|
|---|
| 54 | y: {
|
|---|
| 55 | if (webView.progress < 1.0)
|
|---|
| 56 | return 0;
|
|---|
| 57 | else {
|
|---|
| 58 | webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 | Column {
|
|---|
| 62 | width: parent.width
|
|---|
| 63 |
|
|---|
| 64 | Item {
|
|---|
| 65 | width: parent.width; height: 20
|
|---|
| 66 | Text {
|
|---|
| 67 | anchors.centerIn: parent
|
|---|
| 68 | text: webView.title; font.pixelSize: 14; font.bold: true
|
|---|
| 69 | color: "white"; styleColor: "black"; style: Text.Sunken
|
|---|
| 70 | }
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | Item {
|
|---|
| 74 | width: parent.width; height: 40
|
|---|
| 75 |
|
|---|
| 76 | Button {
|
|---|
| 77 | id: backButton
|
|---|
| 78 | action: webView.back; image: "pics/go-previous-view.png"
|
|---|
| 79 | anchors { left: parent.left; bottom: parent.bottom }
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | Button {
|
|---|
| 83 | id: nextButton
|
|---|
| 84 | anchors.left: backButton.right
|
|---|
| 85 | action: webView.forward; image: "pics/go-next-view.png"
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | UrlInput {
|
|---|
| 89 | id: urlInput
|
|---|
| 90 | anchors { left: nextButton.right; right: reloadButton.left }
|
|---|
| 91 | image: "pics/display.png"
|
|---|
| 92 | onUrlEntered: {
|
|---|
| 93 | webBrowser.urlString = url
|
|---|
| 94 | webBrowser.focus = true
|
|---|
| 95 | header.urlChanged = false
|
|---|
| 96 | }
|
|---|
| 97 | onUrlChanged: header.urlChanged = true
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | Button {
|
|---|
| 101 | id: reloadButton
|
|---|
| 102 | anchors { right: quitButton.left; rightMargin: 10 }
|
|---|
| 103 | action: webView.reload; image: "pics/view-refresh.png"
|
|---|
| 104 | visible: webView.progress == 1.0 && !header.urlChanged
|
|---|
| 105 | }
|
|---|
| 106 | Text {
|
|---|
| 107 | id: quitButton
|
|---|
| 108 | color: "white"
|
|---|
| 109 | style: Text.Sunken
|
|---|
| 110 | anchors.right: parent.right
|
|---|
| 111 | anchors.top: parent.top
|
|---|
| 112 | anchors.bottom: parent.bottom
|
|---|
| 113 | verticalAlignment: Text.AlignVCenter
|
|---|
| 114 | horizontalAlignment: Text.AlignHCenter
|
|---|
| 115 | font.pixelSize: 18
|
|---|
| 116 | width: 60
|
|---|
| 117 | text: "Quit"
|
|---|
| 118 | MouseArea {
|
|---|
| 119 | anchors.fill: parent
|
|---|
| 120 | onClicked: Qt.quit()
|
|---|
| 121 | }
|
|---|
| 122 | Rectangle {
|
|---|
| 123 | width: 1
|
|---|
| 124 | y: 5
|
|---|
| 125 | height: parent.height-10
|
|---|
| 126 | anchors.right: parent.left
|
|---|
| 127 | color: "darkgray"
|
|---|
| 128 | }
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | Button {
|
|---|
| 132 | id: stopButton
|
|---|
| 133 | anchors { right: quitButton.left; rightMargin: 10 }
|
|---|
| 134 | action: webView.stop; image: "pics/edit-delete.png"
|
|---|
| 135 | visible: webView.progress < 1.0 && !header.urlChanged
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | Button {
|
|---|
| 139 | id: goButton
|
|---|
| 140 | anchors { right: parent.right; rightMargin: 4 }
|
|---|
| 141 | onClicked: {
|
|---|
| 142 | webBrowser.urlString = urlInput.url
|
|---|
| 143 | webBrowser.focus = true
|
|---|
| 144 | header.urlChanged = false
|
|---|
| 145 | }
|
|---|
| 146 | image: "pics/go-jump-locationbar.png"; visible: header.urlChanged
|
|---|
| 147 | }
|
|---|
| 148 | }
|
|---|
| 149 | }
|
|---|
| 150 | }
|
|---|