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