mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-25 14:00:00 +00:00
refactor: Introduce more generic confirmation dialog for simpel cases
This commit is contained in:
parent
6d0d0fb2aa
commit
4f7486afbe
@ -18,6 +18,8 @@ StackLayout {
|
|||||||
|
|
||||||
property var appSettings
|
property var appSettings
|
||||||
property bool isConnected: false
|
property bool isConnected: false
|
||||||
|
property string contactToRemove: ""
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumWidth: 300
|
Layout.minimumWidth: 300
|
||||||
@ -118,16 +120,15 @@ StackLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ProfilePopup {
|
ProfilePopup {
|
||||||
id: profilePopup
|
id: profilePopup
|
||||||
onBlockButtonClicked: {
|
onBlockButtonClicked: {
|
||||||
blockContactConfirmationDialog.contactName = name
|
blockContactConfirmationDialog.contactName = name
|
||||||
blockContactConfirmationDialog.contactAddress = address
|
chatColumnLayout.contact = address
|
||||||
blockContactConfirmationDialog.open()
|
blockContactConfirmationDialog.open()
|
||||||
}
|
}
|
||||||
onRemoveButtonClicked: {
|
onRemoveButtonClicked: {
|
||||||
removeContactConfirmationDialog.contactAddress = address
|
chatColumnLayout.contactToRemove = address
|
||||||
removeContactConfirmationDialog.open()
|
removeContactConfirmationDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,11 +142,14 @@ StackLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveContactConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
onRemoveButtonClicked: {
|
// % "Remove contact"
|
||||||
if (profileModel.isAdded(removeContactConfirmationDialog.contactAddress)) {
|
title: qsTrId("remove-contact")
|
||||||
profileModel.removeContact(removeContactConfirmationDialog.contactAddress)
|
confirmationText: qsTr("Are you sure you want to remove this contact?")
|
||||||
|
onConfirmButtonClicked: {
|
||||||
|
if (profileModel.isAdded(chatColumnLayout.contactToRemove)) {
|
||||||
|
profileModel.removeContact(chatColumnLayout.contactToRemove)
|
||||||
}
|
}
|
||||||
removeContactConfirmationDialog.close()
|
removeContactConfirmationDialog.close()
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,14 @@ Rectangle {
|
|||||||
icon.color: Style.current.red
|
icon.color: Style.current.red
|
||||||
//% "Delete Chat"
|
//% "Delete Chat"
|
||||||
text: qsTrId("delete-chat")
|
text: qsTrId("delete-chat")
|
||||||
onTriggered: chatsModel.leaveActiveChat()
|
onTriggered: {
|
||||||
|
//% "Delete Chat"
|
||||||
|
deleteChatConfirmationDialog.title = qsTrId("delete-chat")
|
||||||
|
//% "Delete Chat"
|
||||||
|
deleteChatConfirmationDialog.confirmButtonLabel = qsTrId("delete-chat")
|
||||||
|
deleteChatConfirmationDialog.confirmationText = qsTr("Are you sure you want to delete this chat?")
|
||||||
|
deleteChatConfirmationDialog.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +186,14 @@ Rectangle {
|
|||||||
icon.height: chatTopBarContent.iconSize
|
icon.height: chatTopBarContent.iconSize
|
||||||
//% "Leave Group"
|
//% "Leave Group"
|
||||||
text: qsTrId("leave-group")
|
text: qsTrId("leave-group")
|
||||||
onTriggered: chatsModel.leaveActiveChat()
|
onTriggered: {
|
||||||
|
//% "Leave group"
|
||||||
|
deleteChatConfirmationDialog.title = qsTrId("leave-group")
|
||||||
|
//% "Leave group"
|
||||||
|
deleteChatConfirmationDialog.confirmButtonLabel = qsTrId("leave-group")
|
||||||
|
deleteChatConfirmationDialog.confirmationText = qsTr("Are you sure you want to leave this chat?")
|
||||||
|
deleteChatConfirmationDialog.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,4 +217,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfirmationDialog {
|
||||||
|
id: deleteChatConfirmationDialog
|
||||||
|
onConfirmButtonClicked: {
|
||||||
|
chatsModel.leaveActiveChat()
|
||||||
|
deleteChatConfirmationDialog.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ ListView {
|
|||||||
property alias selectedContact: contactGroup.checkedButton
|
property alias selectedContact: contactGroup.checkedButton
|
||||||
property string searchString: ""
|
property string searchString: ""
|
||||||
property string lowerCaseSearchString: searchString.toLowerCase()
|
property string lowerCaseSearchString: searchString.toLowerCase()
|
||||||
|
property string contactToRemove: ""
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ ListView {
|
|||||||
blockContactConfirmationDialog.open()
|
blockContactConfirmationDialog.open()
|
||||||
}
|
}
|
||||||
onRemoveContactActionTriggered: {
|
onRemoveContactActionTriggered: {
|
||||||
removeContactConfirmationDialog.contactAddress = address
|
contactList.contactToRemove = address
|
||||||
removeContactConfirmationDialog.open()
|
removeContactConfirmationDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +50,7 @@ ListView {
|
|||||||
blockContactConfirmationDialog.open()
|
blockContactConfirmationDialog.open()
|
||||||
}
|
}
|
||||||
onRemoveButtonClicked: {
|
onRemoveButtonClicked: {
|
||||||
removeContactConfirmationDialog.contactAddress = address
|
contactList.contactToRemove = address
|
||||||
removeContactConfirmationDialog.open()
|
removeContactConfirmationDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,11 +67,13 @@ ListView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveContactConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
onRemoveButtonClicked: {
|
title: qsTrId("remove-contact")
|
||||||
if (profileModel.isAdded(removeContactConfirmationDialog.contactAddress)) {
|
confirmationText: qsTr("Are you sure you want to remove this contact?")
|
||||||
profileModel.removeContact(removeContactConfirmationDialog.contactAddress)
|
onConfirmButtonClicked: {
|
||||||
|
if (profileModel.isAdded(contactList.contactToRemove)) {
|
||||||
|
profileModel.removeContact(contactList.contactToRemove)
|
||||||
}
|
}
|
||||||
removeContactConfirmationDialog.close()
|
removeContactConfirmationDialog.close()
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,23 @@ import "../imports"
|
|||||||
import "./"
|
import "./"
|
||||||
|
|
||||||
ModalPopup {
|
ModalPopup {
|
||||||
id: removeContactConfirmationDialog
|
id: confirmationDialog
|
||||||
height: 186
|
height: 186
|
||||||
width: 400
|
width: 400
|
||||||
property string contactAddress: ""
|
title: qsTr("Confirm your action")
|
||||||
signal removeButtonClicked()
|
|
||||||
title: qsTrId("remove-contact")
|
property string confirmButtonLabel: qsTr("Confirm")
|
||||||
|
property string confirmationText: qsTr("Are you sure you want to this?")
|
||||||
|
signal confirmButtonClicked()
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Are you sure you want to remove this contact?")
|
text: confirmationDialog.confirmationText
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
footer: Item {
|
footer: Item {
|
||||||
id: footerContainer
|
id: footerContainer
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -33,12 +34,12 @@ ModalPopup {
|
|||||||
btnBorderWidth: 1
|
btnBorderWidth: 1
|
||||||
btnBorderColor: Style.current.grey
|
btnBorderColor: Style.current.grey
|
||||||
textColor: Style.current.red
|
textColor: Style.current.red
|
||||||
//% "Block User"
|
label: confirmationDialog.confirmButtonLabel
|
||||||
label: qsTrId("remove-contact")
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
onClicked: removeContactConfirmationDialog.removeButtonClicked()
|
onClicked: confirmationDialog.confirmButtonClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,4 +18,4 @@ SplitViewHandle 1.0 SplitViewHandle.qml
|
|||||||
CopyToClipBoardButton 1.0 CopyToClipBoardButton.qml
|
CopyToClipBoardButton 1.0 CopyToClipBoardButton.qml
|
||||||
NotificationWindow 1.0 NotificationWindow.qml
|
NotificationWindow 1.0 NotificationWindow.qml
|
||||||
BlockContactConfirmationDialog 1.0 BlockContactConfirmationDialog.qml
|
BlockContactConfirmationDialog 1.0 BlockContactConfirmationDialog.qml
|
||||||
RemoveContactConfirmationDialog 1.0 RemoveContactConfirmationDialog.qml
|
ConfirmationDialog 1.0 ConfirmationDialog.qml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user