import QtQuick 2.0 import Sailfish.Silica 1.0 Page { id: page Column { anchors.fill: parent spacing: Theme.paddingMedium PageHeader { title: qsTr("Impostazioni") } TextField { id: urlField anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: Theme.paddingLarge anchors.rightMargin: Theme.paddingLarge label: qsTr("Indirizzo del server") placeholderText: "http://192.168.3.21:8792" text: appSettings.baseUrl inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoPredictiveText } TextField { id: tokenField anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: Theme.paddingLarge anchors.rightMargin: Theme.paddingLarge label: qsTr("Token") placeholderText: qsTr("incolla il token del server") text: appSettings.token echoMode: TextInput.Password inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase } Label { x: Theme.paddingLarge width: parent.width - 2 * Theme.paddingLarge font.pixelSize: Theme.fontSizeExtraSmall color: Theme.secondaryColor wrapMode: Text.WordWrap text: qsTr("Il token è il contenuto di ~/.config/statusd/token sul server. " + "Fuori casa serve la VPN attiva: la porta 8792 è chiusa su Internet.") } Button { anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Salva e verifica") onClicked: { appSettings.save(urlField.text, tokenField.text) statusClient.refresh() } } Label { x: Theme.paddingLarge width: parent.width - 2 * Theme.paddingLarge visible: statusClient.error !== "" text: statusClient.error font.pixelSize: Theme.fontSizeSmall color: "#e53935" wrapMode: Text.WordWrap } Label { x: Theme.paddingLarge width: parent.width - 2 * Theme.paddingLarge visible: statusClient.error === "" && statusClient.fetchedAt !== "" text: qsTr("Risposta ricevuta alle ") + statusClient.fetchedAt font.pixelSize: Theme.fontSizeSmall color: "#43a047" wrapMode: Text.WordWrap } } }