Reorder QML files to follow coding conventions

https://doc.qt.io/qt-5/qml-codingconventions.html#qml-object-declarations
This commit is contained in:
miruka
2020-07-12 00:25:57 -04:00
parent 229fbee298
commit 3c7b78d4ca
131 changed files with 1022 additions and 1122 deletions

View File

@@ -5,24 +5,13 @@ import Qt.labs.platform 1.1
import "../Popups"
HFileDialogOpener {
fill: false
dialog.title: qsTr("Save decryption keys file as...")
dialog.fileMode: FileDialog.SaveFile
onFilePicked: {
exportPasswordPopup.file = file
exportPasswordPopup.open()
}
// This is used for the SignOutPopup to know when the export is done
// so it can close
signal done()
property string userId: ""
property bool exporting: false
function exportKeys(file, passphrase) {
exporting = true
@@ -35,14 +24,23 @@ HFileDialogOpener {
}
fill: false
dialog.title: qsTr("Save decryption keys file as...")
dialog.fileMode: FileDialog.SaveFile
onFilePicked: {
exportPasswordPopup.file = file
exportPasswordPopup.open()
}
PasswordPopup {
id: exportPasswordPopup
property url file: ""
summary.text: qsTr("Passphrase to protect this file:")
validateButton.text: qsTr("Export")
validateButton.icon.name: "export-keys"
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
property url file: ""
}
}

View File

@@ -5,13 +5,8 @@ import Qt.labs.platform 1.1
Item {
id: opener
anchors.fill: fill ? parent : undefined
signal filePicked(string file)
signal filesPicked(var files)
signal cancelled()
enum FileType { All, Images }
property bool fill: true
@@ -24,9 +19,14 @@ Item {
property string selectSubject:
dialog.fileMode === FileDialog.SaveFile ? qsTr("file") : qsTr("open")
enum FileType { All, Images }
property int fileType: HFileDialogOpener.FileType.All
signal filePicked(string file)
signal filesPicked(var files)
signal cancelled()
anchors.fill: fill ? parent : undefined
TapHandler { enabled: opener.enabled && fill; onTapped: fileDialog.open() }

View File

@@ -7,6 +7,10 @@ import "../Popups"
import "../PythonBridge"
HFileDialogOpener {
property string userId: ""
property Future importFuture: null
fill: false
dialog.title: qsTr("Select a decryption keys file to import")
onFilePicked: {
@@ -14,26 +18,11 @@ HFileDialogOpener {
importPasswordPopup.open()
}
property string userId: ""
property Future importFuture: null
PasswordPopup {
id: importPasswordPopup
summary.text:
importFuture ?
qsTr("This might take a while...") :
qsTr("Passphrase used to protect this file:")
validateButton.text: qsTr("Import")
validateButton.icon.name: "import-keys"
onClosed: if (importFuture) importFuture.cancel()
property url file: ""
function verifyPassword(pass, callback) {
const call = py.callClientCoro
const path = file.toString().replace(/^file:\/\//, "")
@@ -72,6 +61,14 @@ HFileDialogOpener {
})
}
summary.text:
importFuture ?
qsTr("This might take a while...") :
qsTr("Passphrase used to protect this file:")
validateButton.text: qsTr("Import")
validateButton.icon.name: "import-keys"
onClosed: if (importFuture) importFuture.cancel()
Binding on closePolicy {
value: Popup.CloseOnEscape

View File

@@ -4,6 +4,11 @@ import QtQuick 2.12
import Qt.labs.platform 1.1
HFileDialogOpener {
property string userId
property string roomId
property bool destroyWhenDone: false
fill: false
dialog.title: qsTr("Select a file to send")
dialog.fileMode: FileDialog.OpenFiles
@@ -23,9 +28,4 @@ HFileDialogOpener {
}
onCancelled: if (destroyWhenDone) destroy()
property string userId
property string roomId
property bool destroyWhenDone: false
}