This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
ui/qml/panes/PeerSettingsPane.qml

121 lines
2.3 KiB
QML

import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import QtQuick.Controls 1.4
import "../widgets"
import "../styles"
ColumnLayout { // peerSettingsPane
id: root
anchors.fill: parent
property bool blocked
StackToolbar {
id: toolbar
aux.visible: false
back.onClicked: theStack.pane = theStack.messagePane
}
Flickable {
anchors.top: toolbar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
boundsBehavior: Flickable.StopAtBounds
clip:true
contentWidth: tehcol.width
contentHeight: tehcol.height
Column {
id: tehcol
width: root.width
leftPadding: 10
spacing: 5
ScalingLabel {
text: qsTr("address-label")
}
TextField {
id: txtOnion
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
readOnly: true
}
SimpleButton {
icon: "regular/clipboard"
text: qsTr("copy-btn")
onClicked: {
//: notification: copied to clipboard
gcd.popup(qsTr("copied-to-clipboard-notification"))
txtOnion.selectAll()
txtOnion.copy()
}
}
ScalingLabel{
text: qsTr("display-name-label")
}
TextField {
id: txtDisplayName
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
}
SimpleButton {
text: qsTr("save-btn")
onClicked: {
gcd.savePeerSettings(txtOnion.text, txtDisplayName.text)
theStack.title = txtDisplayName.text
theStack.pane = theStack.messagePane
}
}
SimpleButton {
icon: "solid/hand-paper"
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
onClicked: {
if (root.blocked) {
gcd.unblockPeer(txtOnion.text)
} else {
gcd.blockPeer(txtOnion.text)
}
root.blocked = !root.blocked
}
}
SimpleButton {
icon: "regular/trash-alt"
text: qsTr("delete-btn")
onClicked: {
gcd.deleteContact(txtOnion.text)
theStack.pane = theStack.emptyPane
}
}
}//end of column with padding
}//end of flickable
Connections {
target: gcd
onSupplyPeerSettings: function(onion, nick, blocked) {
toolbar.text = nick
txtOnion.text = onion
txtDisplayName.text = nick
root.blocked = blocked
}
}
}