bugfixes and style
This commit is contained in:
parent
2e196c6f7a
commit
34f54ba015
10
api/api.go
10
api/api.go
|
@ -73,8 +73,14 @@ func (lapi *LockBoxAPI) decryptFile(inputFilename string, outputFilename string,
|
||||||
sort.Strings(schema)
|
sort.Strings(schema)
|
||||||
|
|
||||||
for _, k := range schema {
|
for _, k := range schema {
|
||||||
str := strings.SplitN(k, "_", 1)
|
parts := strings.SplitN(k, "_", 2)
|
||||||
outputLine += fmt.Sprintf(`"%v",`, strings.ReplaceAll(str[1], "\"", "\\\""))
|
var str string
|
||||||
|
if len(parts) > 1 {
|
||||||
|
str = parts[1]
|
||||||
|
} else {
|
||||||
|
str = k
|
||||||
|
}
|
||||||
|
outputLine += fmt.Sprintf(`"%v",`, strings.ReplaceAll(str, "\"", "\\\""))
|
||||||
}
|
}
|
||||||
|
|
||||||
outputfile = append(outputfile, outputLine)
|
outputfile = append(outputfile, outputLine)
|
||||||
|
|
|
@ -17,7 +17,7 @@ func main() {
|
||||||
|
|
||||||
app := widgets.NewQApplication(len(os.Args), os.Args)
|
app := widgets.NewQApplication(len(os.Args), os.Args)
|
||||||
app.SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
|
app.SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
|
||||||
quickcontrols2.QQuickStyle_SetStyle("Default")
|
quickcontrols2.QQuickStyle_SetStyle("Material")
|
||||||
engine := qml.NewQQmlApplicationEngine(nil)
|
engine := qml.NewQQmlApplicationEngine(nil)
|
||||||
|
|
||||||
lockapi := api.NewLockBoxAPI(nil)
|
lockapi := api.NewLockBoxAPI(nil)
|
||||||
|
|
53
qml/main.qml
53
qml/main.qml
|
@ -13,22 +13,11 @@ ApplicationWindow {
|
||||||
minimumWidth: 640
|
minimumWidth: 640
|
||||||
minimumHeight: 640
|
minimumHeight: 640
|
||||||
|
|
||||||
FileDialog {
|
property string keyfilegentxt
|
||||||
id: fileDialog
|
property string outfiletxt
|
||||||
title: "Please choose a file to decrypt"
|
property string keyfiletxt
|
||||||
nameFilters: [ "Dat File (*.dat)", "All files (*)" ]
|
property string inputfiletxt
|
||||||
folder: shortcuts.home
|
|
||||||
selectFolder: false
|
|
||||||
selectMultiple: false
|
|
||||||
onAccepted: {
|
|
||||||
console.log("You chose: " + fileDialog.fileUrls)
|
|
||||||
inputFileLabel.text = fileDialog.fileUrls[0]
|
|
||||||
}
|
|
||||||
onRejected: {
|
|
||||||
console.log("Canceled")
|
|
||||||
}
|
|
||||||
Component.onCompleted: visible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
TabView {
|
TabView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -71,6 +60,7 @@ ApplicationWindow {
|
||||||
width:parent.width * 0.50
|
width:parent.width * 0.50
|
||||||
id:keyFileGenLabel
|
id:keyFileGenLabel
|
||||||
placeholderText: "Folder to save keys into"
|
placeholderText: "Folder to save keys into"
|
||||||
|
text: root.keyfilegentxt
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
@ -87,7 +77,7 @@ ApplicationWindow {
|
||||||
Button {
|
Button {
|
||||||
text: "Generate!"
|
text: "Generate!"
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
lockbox.generateKey(keyFileCreateDialog.fileUrls[0])
|
lockbox.generateKey(root.keyfilegentxt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,6 +109,7 @@ ApplicationWindow {
|
||||||
width:parent.width * 0.75
|
width:parent.width * 0.75
|
||||||
id:inputFileLabel
|
id:inputFileLabel
|
||||||
placeholderText: "Encrypted submissions file (.dat)"
|
placeholderText: "Encrypted submissions file (.dat)"
|
||||||
|
text: root.inputfiletxt
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
@ -133,6 +124,7 @@ ApplicationWindow {
|
||||||
id:outputFileLabel
|
id:outputFileLabel
|
||||||
width:parent.width * 0.75
|
width:parent.width * 0.75
|
||||||
placeholderText: "Location for decrypted file (.csv)"
|
placeholderText: "Location for decrypted file (.csv)"
|
||||||
|
text: root.outfiletxt
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
@ -147,6 +139,7 @@ ApplicationWindow {
|
||||||
width:parent.width * 0.75
|
width:parent.width * 0.75
|
||||||
id:keyFileLabel
|
id:keyFileLabel
|
||||||
placeholderText: "Decryption key file (.private)"
|
placeholderText: "Decryption key file (.private)"
|
||||||
|
text: root.keyfiletxt
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
@ -160,7 +153,7 @@ ApplicationWindow {
|
||||||
Button {
|
Button {
|
||||||
text: "Decrypt!"
|
text: "Decrypt!"
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
lockbox.decryptFile(fileDialog.fileUrls[0],outputFileDialog.fileUrls[0],keyFileDialog.fileUrls[0])
|
lockbox.decryptFile(root.inputfiletxt,root.outfiletxt,root.keyfiletxt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +171,7 @@ ApplicationWindow {
|
||||||
selectExisting:false
|
selectExisting:false
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
console.log("You chose: " + outputFileDialog.fileUrls)
|
console.log("You chose: " + outputFileDialog.fileUrls)
|
||||||
outputFileLabel.text = outputFileDialog.fileUrls[0]
|
root.outfiletxt = outputFileDialog.fileUrls[0]
|
||||||
}
|
}
|
||||||
onRejected: {
|
onRejected: {
|
||||||
console.log("Canceled")
|
console.log("Canceled")
|
||||||
|
@ -198,7 +191,7 @@ ApplicationWindow {
|
||||||
selectMultiple: false
|
selectMultiple: false
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
console.log("You chose: " + keyFileDialog.fileUrls)
|
console.log("You chose: " + keyFileDialog.fileUrls)
|
||||||
keyFileLabel.text = keyFileDialog.fileUrls[0]
|
root.keyfiletxt = keyFileDialog.fileUrls[0]
|
||||||
}
|
}
|
||||||
onRejected: {
|
onRejected: {
|
||||||
console.log("Canceled")
|
console.log("Canceled")
|
||||||
|
@ -215,7 +208,7 @@ ApplicationWindow {
|
||||||
selectMultiple: false
|
selectMultiple: false
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
console.log("You chose: " + keyFileCreateDialog.fileUrls)
|
console.log("You chose: " + keyFileCreateDialog.fileUrls)
|
||||||
keyFileGenLabel.text = keyFileCreateDialog.fileUrls[0]
|
root.keyfilegentxt = keyFileCreateDialog.fileUrls[0]
|
||||||
}
|
}
|
||||||
onRejected: {
|
onRejected: {
|
||||||
console.log("Canceled")
|
console.log("Canceled")
|
||||||
|
@ -254,6 +247,24 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileDialog {
|
||||||
|
id: fileDialog
|
||||||
|
title: "Please choose a file to decrypt"
|
||||||
|
nameFilters: [ "Dat File (*.dat)", "All files (*)" ]
|
||||||
|
folder: shortcuts.home
|
||||||
|
selectFolder: false
|
||||||
|
selectMultiple: false
|
||||||
|
onAccepted: {
|
||||||
|
console.log("You chose: " + fileDialog.fileUrls)
|
||||||
|
root.inputfiletxt = fileDialog.fileUrls[0]
|
||||||
|
}
|
||||||
|
onRejected: {
|
||||||
|
console.log("Canceled")
|
||||||
|
}
|
||||||
|
Component.onCompleted: visible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: messageDialog
|
id: messageDialog
|
||||||
title: "May I have your attention please"
|
title: "May I have your attention please"
|
||||||
|
|
Loading…
Reference in New Issue