Use HInterfaceBox for ImportExportKeys
This commit is contained in:
parent
ce3404a516
commit
7c3ed5ca14
|
@ -3,7 +3,9 @@ import Qt.labs.platform 1.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: opener
|
id: opener
|
||||||
anchors.fill: parent
|
anchors.fill: fill ? parent : undefined
|
||||||
|
|
||||||
|
property bool fill: true
|
||||||
|
|
||||||
property alias dialog: fileDialog
|
property alias dialog: fileDialog
|
||||||
property string selectedFile: ""
|
property string selectedFile: ""
|
||||||
|
@ -12,7 +14,7 @@ Item {
|
||||||
enum FileType { All, Images }
|
enum FileType { All, Images }
|
||||||
property int fileType: HFileDialogOpener.FileType.All
|
property int fileType: HFileDialogOpener.FileType.All
|
||||||
|
|
||||||
TapHandler { onTapped: fileDialog.open() }
|
TapHandler { enabled: fill; onTapped: fileDialog.open() }
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
|
|
@ -24,7 +24,7 @@ Rectangle {
|
||||||
property var buttonCallbacks: []
|
property var buttonCallbacks: []
|
||||||
property string enterButtonTarget: ""
|
property string enterButtonTarget: ""
|
||||||
|
|
||||||
default property alias body: interfaceBody.children
|
default property alias body: interfaceBody.data
|
||||||
|
|
||||||
function clickEnterButtonTarget() {
|
function clickEnterButtonTarget() {
|
||||||
for (let i = 0; i < buttonModel.length; i++) {
|
for (let i = 0; i < buttonModel.length; i++) {
|
||||||
|
|
|
@ -5,6 +5,9 @@ import "../../Base"
|
||||||
import "../../utils.js" as Utils
|
import "../../utils.js" as Utils
|
||||||
|
|
||||||
HInterfaceBox {
|
HInterfaceBox {
|
||||||
|
horizontalSpacing: currentSpacing
|
||||||
|
verticalSpacing: currentSpacing
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
{ name: "retry", text: qsTr("Retry"), iconName: "retry" },
|
{ name: "retry", text: qsTr("Retry"), iconName: "retry" },
|
||||||
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
||||||
|
|
|
@ -4,7 +4,22 @@ import QtQuick.Layouts 1.12
|
||||||
import "../../Base"
|
import "../../Base"
|
||||||
import "../../utils.js" as Utils
|
import "../../utils.js" as Utils
|
||||||
|
|
||||||
HColumnLayout {
|
HInterfaceBox {
|
||||||
|
horizontalSpacing: currentSpacing
|
||||||
|
verticalSpacing: currentSpacing
|
||||||
|
|
||||||
|
buttonModel: [
|
||||||
|
{ name: "export", text: qsTr("Export"), iconName: "export-keys",
|
||||||
|
enabled: false },
|
||||||
|
{ name: "import", text: qsTr("Import"), iconName: "import-keys"},
|
||||||
|
]
|
||||||
|
|
||||||
|
buttonCallbacks: ({
|
||||||
|
export: button => {},
|
||||||
|
import: button => { fileDialog.open() },
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
HLabel {
|
HLabel {
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
text: qsTr(
|
text: qsTr(
|
||||||
|
@ -15,38 +30,17 @@ HColumnLayout {
|
||||||
).arg(pageLoader.isWide ? "\n" :"\n\n")
|
).arg(pageLoader.isWide ? "\n" :"\n\n")
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.margins: currentSpacing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRowLayout {
|
|
||||||
HButton {
|
|
||||||
id: exportButton
|
|
||||||
icon.name: "export-keys"
|
|
||||||
text: qsTr("Export")
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignBottom
|
|
||||||
}
|
|
||||||
|
|
||||||
HButton {
|
|
||||||
id: importButton
|
|
||||||
icon.name: "import-keys"
|
|
||||||
text: qsTr("Import")
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignBottom
|
|
||||||
|
|
||||||
HFileDialogOpener {
|
HFileDialogOpener {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
fill: false
|
||||||
dialog.title: qsTr("Select a decryption key file to import")
|
dialog.title: qsTr("Select a decryption key file to import")
|
||||||
onFileChanged: {
|
onFileChanged: {
|
||||||
importPasswordPopup.file = file
|
importPasswordPopup.file = file
|
||||||
importPasswordPopup.open()
|
importPasswordPopup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HPasswordPopup {
|
HPasswordPopup {
|
||||||
property url file: ""
|
property url file: ""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user