display list of contacts in the open chat modal

This commit is contained in:
Iuri Matias 2020-06-16 14:04:56 -04:00
parent 1c2154f11e
commit fe82f762bb
4 changed files with 44 additions and 2 deletions

View File

@ -3,13 +3,19 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import "../../../../imports"
import "../../../../shared"
import "../../Profile/Sections/Contacts/"
import "./"
ModalPopup {
function doJoin(){
if(chatKey.text === "") return;
chatsModel.joinChat(chatKey.text, Constants.chatTypeOneToOne);
if (chatKey.text !== "") {
chatsModel.joinChat(chatKey.text, Constants.chatTypeOneToOne);
} else if (contactListView.selectedContact.checked) {
chatsModel.joinChat(contactListView.selectedContact.parent.address, Constants.chatTypeOneToOne);
} else {
return;
}
popup.close();
}
@ -19,6 +25,7 @@ ModalPopup {
onOpened: {
chatKey.text = "";
chatKey.forceActiveFocus(Qt.MouseFocusReason)
contactListView.selectedContact.checked = false
}
Input {
@ -28,6 +35,12 @@ ModalPopup {
Keys.onReturnPressed: doJoin()
}
ContactList {
id: contactListView
contacts: profileModel.contactList
selectable: true
}
footer: Button {
width: 44
height: 44
@ -47,3 +60,9 @@ ModalPopup {
}
}
}
/*##^##
Designer {
D{i:0;height:300;width:300}
}
##^##*/

View File

@ -9,6 +9,7 @@ Rectangle {
property string name: "Jotaro Kujo"
property string address: "0x04d8c07dd137bd1b73a6f51df148b4f77ddaa11209d36e43d8344c0a7d6db1cad6085f27cfb75dd3ae21d86ceffebe4cf8a35b9ce8d26baa19dc264efe6d8f221b"
property string identicon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
property bool selectable: false
height: 64
anchors.right: parent.right
@ -46,4 +47,11 @@ Rectangle {
font.pixelSize: 15
color: Theme.darkGrey
}
RadioButton {
visible: selectable
anchors.top: parent.top
anchors.topMargin: Theme.smallPadding
anchors.right: parent.right
ButtonGroup.group: contactGroup
}
}

View File

@ -7,7 +7,10 @@ import "../../../../../imports"
import "../../../../../shared"
ListView {
id: contactList
property var contacts: ContactsData {}
property var selectable: true
property alias selectedContact: contactGroup.checkedButton
anchors.topMargin: 48
anchors.top: element2.bottom
@ -18,6 +21,11 @@ ListView {
name: model.name
address: model.address
identicon: model.identicon
selectable: contactList.selectable
}
ButtonGroup {
id: contactGroup
}
}
/*##^##

View File

@ -25,5 +25,12 @@ Item {
ContactList {
id: contactListView
contacts: profileModel.contactList
selectable: false
}
}
/*##^##
Designer {
D{i:0;width:600}
}
##^##*/