Skip to content
Snippets Groups Projects
Unverified Commit 4449aabf authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conversationsmartlist: add confirm dialog for blocking and removing

Change-Id: I98f9d19176a0401d5498a74e9bcc318868388854
parent c99b409d
Branches
Tags
No related merge requests found
......@@ -15,6 +15,7 @@
<file>src/app/commoncomponents/PhotoboothView.qml</file>
<file>src/app/commoncomponents/JamiListView.qml</file>
<file>src/app/commoncomponents/DeleteAccountDialog.qml</file>
<file>src/app/commoncomponents/ConfirmDialog.qml</file>
<file>src/app/commoncomponents/CustomBorder.qml</file>
<file>src/app/commoncomponents/PushButton.qml</file>
<file>src/app/commoncomponents/JamiFileDialog.qml</file>
......
/*
* Copyright (C) 2022 Savoir-faire Linux Inc.
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
BaseModalDialog {
id: root
signal accepted
width: JamiTheme.preferredDialogWidth
height: JamiTheme.preferredDialogHeight
property var confirmLabel: ""
property var textLabel: ""
popupContent: ColumnLayout {
id: column
Label {
id: labelAction
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: column.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor
text: root.textLabel
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}
RowLayout {
spacing: 16
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
MaterialButton {
id: primaryBtn
Layout.alignment: Qt.AlignHCenter
text: root.confirmLabel
preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
preferredHeight: JamiTheme.preferredFieldHeight
color: JamiTheme.buttonTintedRed
hoveredColor: JamiTheme.buttonTintedRedHovered
pressedColor: JamiTheme.buttonTintedRedPressed
outlined: true
onClicked: {
close()
accepted()
}
}
MaterialButton {
id: btnCancel
Layout.alignment: Qt.AlignHCenter
preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
preferredHeight: JamiTheme.preferredFieldHeight
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
text: JamiStrings.optionCancel
onClicked: close()
}
}
}
}
......@@ -247,7 +247,10 @@ Item {
property string startVideoCall: qsTr("Start video call")
property string startAudioCall: qsTr("Start audio call")
property string clearConversation: qsTr("Clear conversation")
property string confirmAction: qsTr("Confirm action")
property string removeConversation: qsTr("Remove conversation")
property string confirmRmConversation: qsTr("Do you really want to remove this conversation")
property string confirmBlockConversation: qsTr("Do you really want to block this conversation")
property string removeContact: qsTr("Remove contact")
property string blockContact: qsTr("Block contact")
property string blockSwarm: qsTr("Block swarm")
......@@ -582,6 +585,7 @@ Item {
property string optionUpgrade: qsTr("Upgrade")
property string optionLater: qsTr("Later")
property string optionDelete: qsTr("Delete")
property string optionBlock: qsTr("Block")
// Conference moderation
property string setModerator: qsTr("Set moderator")
......
......@@ -28,6 +28,29 @@ import "../../commoncomponents/contextmenu"
ContextMenuAutoLoader {
id: root
ConfirmDialog {
id: rmDialog
title: JamiStrings.confirmAction
textLabel: JamiStrings.confirmRmConversation
confirmLabel: JamiStrings.optionDelete
onAccepted: {
if (isSwarm)
MessagesAdapter.removeConversation(responsibleConvUid)
else
MessagesAdapter.removeContact(responsibleConvUid)
}
}
ConfirmDialog {
id: blockDialog
title: JamiStrings.confirmAction
textLabel: JamiStrings.confirmBlockConversation
confirmLabel: JamiStrings.optionBlock
onAccepted: MessagesAdapter.blockConversation(responsibleConvUid)
}
property string responsibleAccountId: ""
property string responsibleConvUid: ""
property bool isBanned: false
......@@ -89,12 +112,7 @@ ContextMenuAutoLoader {
return JamiStrings.removeContact
}
iconSource: JamiResources.ic_hangup_participant_24dp_svg
onClicked: {
if (isSwarm)
MessagesAdapter.removeConversation(responsibleConvUid)
else
MessagesAdapter.removeContact(responsibleConvUid)
}
onClicked: rmDialog.open()
},
GeneralMenuItem {
id: hangup
......@@ -131,7 +149,7 @@ ContextMenuAutoLoader {
itemName: !(mode && mode !== Conversation.Mode.ONE_TO_ONE && mode !== Conversation.Mode.NON_SWARM) ? JamiStrings.blockContact : JamiStrings.blockSwarm
iconSource: JamiResources.block_black_24dp_svg
addMenuSeparatorAfter: contactType !== Profile.Type.SIP
onClicked: MessagesAdapter.blockConversation(responsibleConvUid)
onClicked: blockDialog.open()
},
GeneralMenuItem {
id: unblockContact
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment