2
* Copyright (C) 2014-2015 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
import Ubuntu.Components 1.1
19
import Ubuntu.Components.Popups 1.0
21
// TODO: Use page breaks detection, when LibreOfficeKit will support it.
25
objectName: "LOViewGotoDialog"
27
title: i18n.tr("Go to position")
28
text: i18n.tr("Choose a position between 1% and 100%")
32
objectName:"goToPageTextField"
37
inputMethodHints: Qt.ImhFormattedNumbersOnly
38
validator: IntValidator{ bottom: 1; top: 100 }
40
Keys.onReturnPressed: goToPage()
41
Component.onCompleted: forceActiveFocus()
47
color: UbuntuColors.green
49
enabled: goToPageTextField.acceptableInput
54
text: i18n.tr("Cancel")
55
onClicked: PopupUtils.close(goToPageDialog)
59
var pos = loView.contentHeight * parseInt(goToPageTextField.text) / 100
61
loView.contentY = Math.min(pos, (loView.contentHeight - loView.height))
62
PopupUtils.close(goToPageDialog)