Page MenuHomePhorge

SettingsPage.qml
No OneTemporary

SettingsPage.qml

import QtQuick 2.7
import QtQuick.Controls 2.0 as Controls
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.5 as Kirigami
import Qt.labs.settings 1.0
Kirigami.Page {
title: qsTr("Settings")
ColumnLayout {
anchors.fill: parent
Kirigami.Heading {
text: qsTr("Enter settings for your specific instance and credentials")
wrapMode: Text.WordWrap
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
}
Settings {
id: settings
property string phab_url: "https://phabricator.example.com"
property string api_token: "api-aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
ColumnLayout {
width: parent.width
Layout.fillWidth: true
// For desktop or tablet devices
Layout.alignment: Qt.AlignCenter
Layout.maximumWidth: Kirigami.Units.gridUnit * 25
// URL field
Controls.Label {
id: urlLabel
text: qsTr("Your instance URL:")
}
Controls.TextField {
id: urlField
text: settings.phab_url
placeholderText: qsTr("https://phabricator.example.com")
Layout.fillWidth: true
// selectByMouse: true
}
// API toekn field
Controls.Label {
text: qsTr("Your API token:")
}
Controls.TextField {
id: tokenField
text: settings.api_token
selectByMouse: true
Layout.fillWidth: true
}
// Save button
Controls.Button {
id: connectButton
Layout.fillWidth: true
Kirigami.Theme.backgroundColor: Material.accent
text: qsTr("Save")
onClicked: {
// connect to given account data
// kaidan.jid = jidField.text.toLowerCase()
// kaidan.password = passField.text
// kaidan.mainConnect()
settings.phab_url = urlField.text
settings.api_token = tokenField.text
}
}
// connect when return was pressed
Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
connectButton.clicked()
}
}
}
}
Component.onCompleted: {
console.log(Qt.application.name);
console.log("Phab url is " + settings.phab_url)
console.log("API token is " + settings.api_token)
// kaidan.connectionStateChanged.connect(handleConnectionState)
// kaidan.disconnReasonChanged.connect(handleConnectionError)
}
Component.onDestruction: {
console.log("Phab url is " + settings.phab_url)
console.log("API token is " + settings.api_token)
// kaidan.connectionStateChanged.disconnect(handleConnectionState)
// kaidan.disconnReasonChanged.disconnect(handleConnectionError)
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 28, 3:28 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
153999
Default Alt Text
SettingsPage.qml (2 KB)

Event Timeline