2019-07-21 13:34:42 +03:00
|
|
|
import QtQuick 2.0
|
2019-07-26 15:28:17 +03:00
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "modules/"
|
2019-07-21 13:34:42 +03:00
|
|
|
|
|
|
|
Item {
|
2019-07-26 15:28:17 +03:00
|
|
|
id: parentItem
|
|
|
|
|
2019-07-30 21:55:17 +03:00
|
|
|
Connections {
|
|
|
|
target: appCore
|
2020-06-18 01:12:13 +03:00
|
|
|
function onQmlShowEncDecResult(message) {
|
|
|
|
outputText.setText(message)
|
|
|
|
}
|
2019-07-30 21:55:17 +03:00
|
|
|
}
|
|
|
|
|
2019-07-26 15:28:17 +03:00
|
|
|
ColumnLayout {
|
|
|
|
|
|
|
|
id: column
|
2019-07-29 19:36:37 +03:00
|
|
|
spacing: 20
|
2019-07-26 15:28:17 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: 20
|
|
|
|
anchors.rightMargin: 20
|
|
|
|
|
2019-07-30 21:55:17 +03:00
|
|
|
function changeState() {
|
2019-08-07 19:53:43 +03:00
|
|
|
keyLabledText.labelText = (encryptDecryptMenu.state ? qsTr("Public key:") : qsTr("Private key:"))
|
|
|
|
inputText.labelText = (encryptDecryptMenu.state ? qsTr("Text to encrypt:") : qsTr("Text to decrypt:"))
|
|
|
|
outputText.labelText = (encryptDecryptMenu.state ? qsTr("Encrypted text:") : qsTr("Decrypted text:"))
|
2019-07-29 19:36:37 +03:00
|
|
|
}
|
|
|
|
|
2019-08-14 23:27:25 +03:00
|
|
|
DoubleStateMenu {
|
|
|
|
|
2019-07-29 19:36:37 +03:00
|
|
|
id: encryptDecryptMenu
|
2019-07-30 21:55:17 +03:00
|
|
|
verticalSize: 0.1
|
2019-08-07 19:53:43 +03:00
|
|
|
firstStateName: qsTr("Encrypt")
|
|
|
|
secondStateName: qsTr("Decrypt")
|
2019-07-30 21:55:17 +03:00
|
|
|
onChangeState: column.changeState()
|
2019-08-14 23:27:25 +03:00
|
|
|
onGetAction: appCore.getEncryptDecrypt(encryptDecryptMenu.state,
|
2020-06-18 01:12:13 +03:00
|
|
|
keyLabledText.textAreaText,
|
|
|
|
inputText.textAreaText)
|
2019-07-29 19:36:37 +03:00
|
|
|
}
|
|
|
|
|
2019-08-07 19:53:43 +03:00
|
|
|
RowElement {
|
2019-07-29 19:36:37 +03:00
|
|
|
id: keyLabledText
|
2019-08-14 23:27:25 +03:00
|
|
|
verticalSize: 0.3
|
2019-07-30 21:55:17 +03:00
|
|
|
labelText: qsTr("Public key:")
|
2019-08-07 19:53:43 +03:00
|
|
|
buttonImageSource: "../images/clear.png"
|
|
|
|
onButtonClicked: keyLabledText.setText("")
|
2019-07-29 19:36:37 +03:00
|
|
|
}
|
|
|
|
|
2019-08-07 19:53:43 +03:00
|
|
|
RowElement {
|
2019-07-30 21:55:17 +03:00
|
|
|
id: inputText
|
2019-08-14 23:27:25 +03:00
|
|
|
verticalSize: 0.3
|
2019-07-30 21:55:17 +03:00
|
|
|
labelText: qsTr("Text to encrypt:")
|
2019-08-07 19:53:43 +03:00
|
|
|
buttonImageSource: "../images/clear.png"
|
|
|
|
onButtonClicked: inputText.setText("")
|
2019-07-30 21:55:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
RowElement {
|
|
|
|
id: outputText
|
2019-08-14 23:27:25 +03:00
|
|
|
verticalSize: 0.3
|
2019-07-30 21:55:17 +03:00
|
|
|
labelText: qsTr("Encrypted text:")
|
2019-08-07 19:53:43 +03:00
|
|
|
buttonImageSource: "../images/cpy.png"
|
2019-07-30 21:55:17 +03:00
|
|
|
onButtonClicked: appCore.copyToClipboard(outputText.textAreaText)
|
2019-07-29 19:36:37 +03:00
|
|
|
}
|
2019-08-23 12:07:31 +03:00
|
|
|
|
2019-07-26 15:28:17 +03:00
|
|
|
}
|
2019-07-21 13:34:42 +03:00
|
|
|
}
|