Skip to content

Commit

Permalink
Merge branch '386-fix-desktop-error-dialog' into 'development'
Browse files Browse the repository at this point in the history
Resolve "Fix desktop error dialog"

Closes #386

See merge request qt-team/graft-mobile-client!369
  • Loading branch information
vitalius-parubochyi-vakoms committed Aug 17, 2018
2 parents b21f552 + 1a82ac0 commit 4564c4f
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 50 deletions.
22 changes: 9 additions & 13 deletions GraftMobileClient/resources/BaseSettingsScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,18 @@ BaseScreen {
title: qsTr("Enter password:")
topMargin: (parent.height - passwordDialog.height) / 2
leftMargin: (parent.width - passwordDialog.width) / 2
denyButton {
text: qsTr("Close")
onClicked: {
passwordTextField.clear()
passwordDialog.close()
}
confirmButtonText: qsTr("OK")
denyButtonText: qsTr("Close")
onConfirmed: {
confirmButtonEnabled = false
passwordDialog.accept()
}
confirmButton {
text: qsTr("Ok")
onClicked: {
passwordDialog.confirmButton.enabled = false
passwordDialog.accept()
}
onDenied: {
passwordTextField.clear()
passwordDialog.close()
}
onAccepted: checkingPassword(passwordTextField.text)
onVisibleChanged: confirmButton.enabled = true
onVisibleChanged: confirmButtonEnabled = true
}

MessageDialog {
Expand Down
10 changes: 8 additions & 2 deletions GraftMobileClient/resources/ChooserDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import QtQuick.Controls 2.2
Dialog {
property alias passwordTextField: textField
property alias dialogMessage: message.text
property alias denyButton: leftButton
property alias confirmButton: rightButton
property alias confirmButtonText: leftButton.text
property alias confirmButtonEnabled: leftButton.enabled
property alias denyButtonText: rightButton.text
property bool dialogMode: false

signal confirmed()
signal denied()

visible: false
modal: true
padding: 5
Expand Down Expand Up @@ -47,11 +51,13 @@ Dialog {
Button {
id: leftButton
flat: true
onClicked: confirmed()
}

Button {
id: rightButton
flat: true
onClicked: denied()
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions GraftMobileClient/resources/CreateWalletScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ BaseScreen {
ValidPasswordMessageDialog {
id: dialogs
mobileMessageDialog.onYes: createAccount()
desktopConfirmButton.onClicked: createAccount()
onDesktopDialogApproved: createAccount()
}

function createAccount() {
desktopMessageDialog.confirmButton.enabled = false
dialogs.desktopMessageDialog.confirmButtonEnabled = false
disableScreen()
busyIndicator.running = true
GraftClient.createAccount(passwordTextField.passwordText)
dialogs.desktopMessageDialog.confirmButtonEnabled = true
}

function pushSettingsScreen() {
Expand Down
5 changes: 3 additions & 2 deletions GraftMobileClient/resources/DesktopDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import QtQuick.Layouts 1.3

Dialog {
property alias text: message.text
property alias confirmButton: okButton

signal confirmed()

visible: false
modal: true
Expand All @@ -24,11 +25,11 @@ Dialog {
}

Button {
id: okButton
flat: true
text: qsTr("Ok")
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
onClicked: confirmed()
}
}
}
2 changes: 1 addition & 1 deletion GraftMobileClient/resources/RestoreScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ BaseScreen {
ValidPasswordMessageDialog {
id: dialogs
mobileMessageDialog.onYes: restoreWallet()
desktopConfirmButton.onClicked: restoreWallet()
onDesktopDialogApproved: restoreWallet()
}

function restoreWallet() {
Expand Down
16 changes: 6 additions & 10 deletions GraftMobileClient/resources/SendConfirmationScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,12 @@ BaseScreen {
title: qsTr("Enter password:")
topMargin: (parent.height - passwordDialog.height) / 2
leftMargin: (parent.width - passwordDialog.width) / 2
denyButton {
text: qsTr("Close")
onClicked: {
passwordTextField.clear()
passwordDialog.close()
}
}
confirmButton {
text: qsTr("Ok")
onClicked: passwordDialog.accept()
confirmButtonText: qsTr("OK")
denyButtonText: qsTr("Close")
onConfirmed: passwordDialog.accept()
onDenied: {
passwordTextField.clear()
passwordDialog.close()
}
onAccepted: checkingPassword(passwordTextField.text)
}
Expand Down
18 changes: 11 additions & 7 deletions GraftMobileClient/resources/ValidPasswordMessageDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import QtQuick.Dialogs 1.2
Item {
property alias mobileMessageDialog: mobileMessageDialog
property alias desktopMessageDialog: desktopMessageDialog
property alias desktopConfirmButton: desktopMessageDialog.confirmButton
property string messageText: qsTr("Are you sure you don't want to create a password for your " +
"wallet? You will not be able to create a password later!")

signal desktopDialogApproved()
signal desktopDialogRefused()

anchors.fill: parent

MessageDialog {
Expand All @@ -25,13 +27,15 @@ Item {
dialogMode: true
title: qsTr("Attention")
dialogMessage: messageText
denyButton {
text: qsTr("No")
onClicked: desktopMessageDialog.close()
confirmButtonText: qsTr("Yes")
denyButtonText: qsTr("No")
onConfirmed: {
desktopDialogApproved()
desktopMessageDialog.close()
}
confirmButton {
text: qsTr("Yes")
onClicked: desktopMessageDialog.close()
onDenied: {
desktopDialogRefused()
desktopMessageDialog.close()
}
}
}
2 changes: 1 addition & 1 deletion GraftMobileClient/resources/ios/BaseScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Page {
topMargin: (parent.height - desktopDialog.height) / 2
leftMargin: (parent.width - desktopDialog.width) / 2
title: qsTr("Attention")
confirmButton.onClicked: desktopDialog.close()
onConfirmed: desktopDialog.close()
}

MessageDialog {
Expand Down
16 changes: 6 additions & 10 deletions GraftMobileClient/resources/ios/pos/ProductScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,13 @@ BaseScreen {
dialogMode: true
title: qsTr("Delete item")
dialogMessage: qsTr("Are you sure that you want to remove this item?")
denyButton {
text: qsTr("No")
onClicked: desktopMessageDialog.close()
}
confirmButton {
text: qsTr("Yes")
onClicked: {
ProductModel.removeProduct(index)
GraftClient.saveProducts()
}
confirmButtonText: qsTr("Yes")
denyButtonText: qsTr("No")
onConfirmed: {
ProductModel.removeProduct(index)
GraftClient.saveProducts()
}
onDenied: desktopMessageDialog.close()
}

onRemoveItemClicked: Detector.isDesktop() ? desktopMessageDialog.open() : mobileMessageDialog.open()
Expand Down
2 changes: 1 addition & 1 deletion GraftMobileClient/resources/pos/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GraftApplicationWindow {
leftMargin: (parent.width - desktopMessageDialog.width) / 2
title: qsTr("Sale failed!")
text: qsTr("Sale request failed.\nPlease try again.")
confirmButton.onClicked: {
onConfirmed: {
mainLayout.enableScreen()
checkAccountExists()
desktopMessageDialog.close()
Expand Down
2 changes: 1 addition & 1 deletion GraftMobileClient/resources/wallet/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ GraftApplicationWindow {
leftMargin: (parent.width - desktopMessageDialog.width) / 2
title: qsTr("Pay failed!")
text: qsTr("Pay request failed.\nPlease try again.")
confirmButton.onClicked: {
onConfirmed: {
mainLayout.enableScreen()
checkAccountExists()
desktopMessageDialog.close()
Expand Down

0 comments on commit 4564c4f

Please sign in to comment.