2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2021-05-26 17:36:24 +00:00
|
|
|
import Qt.labs.platform 1.1
|
2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-06-24 03:23:49 +00:00
|
|
|
|
2020-05-25 20:34:26 +00:00
|
|
|
import "../../../imports"
|
2020-05-27 21:09:12 +00:00
|
|
|
import "../../../shared"
|
2021-05-26 17:36:24 +00:00
|
|
|
import "../../../shared/status"
|
2020-05-26 18:16:07 +00:00
|
|
|
import "./components"
|
2020-05-28 00:21:02 +00:00
|
|
|
import "./ContactsColumn"
|
2020-12-11 20:38:10 +00:00
|
|
|
import "./CommunityComponents"
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2021-03-26 17:57:30 +00:00
|
|
|
Rectangle {
|
2020-05-28 11:06:17 +00:00
|
|
|
property alias chatGroupsListViewCount: channelList.channelListCount
|
2020-06-15 16:24:21 +00:00
|
|
|
property alias searchStr: searchBox.text
|
2020-05-25 20:34:26 +00:00
|
|
|
|
|
|
|
id: contactsColumn
|
2020-05-27 18:40:58 +00:00
|
|
|
Layout.fillHeight: true
|
2021-03-26 17:57:30 +00:00
|
|
|
color: Style.current.secondaryMenuBackground
|
2020-05-27 18:40:58 +00:00
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 18:40:58 +00:00
|
|
|
id: title
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Chat"
|
|
|
|
text: qsTrId("chat")
|
2020-05-27 18:40:58 +00:00
|
|
|
anchors.top: parent.top
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
2020-05-27 18:40:58 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-07-15 19:38:03 +00:00
|
|
|
font.weight: Font.Bold
|
2020-05-27 18:40:58 +00:00
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Component {
|
|
|
|
id: publicChatPopupComponent
|
|
|
|
PublicChatPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
2020-05-27 20:11:56 +00:00
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Component {
|
|
|
|
id: groupChatPopupComponent
|
|
|
|
GroupChatPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
2020-06-17 15:56:48 +00:00
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Component {
|
|
|
|
id: privateChatPopupComponent
|
|
|
|
PrivateChatPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communitiesPopupComponent
|
|
|
|
CommunitiesPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: createCommunitiesPopupComponent
|
|
|
|
CreateCommunityPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-18 20:55:33 +00:00
|
|
|
Component {
|
|
|
|
id: importCommunitiesPopupComponent
|
2021-02-12 18:19:31 +00:00
|
|
|
AccessExistingCommunityPopup {
|
2020-12-18 20:55:33 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Component {
|
|
|
|
id: communityDetailPopup
|
|
|
|
CommunityDetailPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
2020-05-28 12:56:43 +00:00
|
|
|
}
|
|
|
|
|
2021-05-26 17:36:24 +00:00
|
|
|
Component {
|
|
|
|
id: contactRequestsPopup
|
|
|
|
ContactRequestsPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-28 11:19:18 +00:00
|
|
|
SearchBox {
|
2020-05-27 18:40:58 +00:00
|
|
|
id: searchBox
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
2020-06-15 16:24:21 +00:00
|
|
|
anchors.right: addChat.left
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-15 16:24:21 +00:00
|
|
|
anchors.left: parent.left
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-05-27 18:40:58 +00:00
|
|
|
}
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2020-05-28 11:32:05 +00:00
|
|
|
AddChat {
|
2020-06-17 19:18:31 +00:00
|
|
|
id: addChat
|
2020-06-24 03:23:49 +00:00
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
2020-05-27 16:24:24 +00:00
|
|
|
}
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2021-05-26 17:36:24 +00:00
|
|
|
Connections {
|
|
|
|
target: profileModel.contacts
|
|
|
|
onContactRequestAdded: {
|
2021-05-17 20:15:34 +00:00
|
|
|
if (!appSettings.notifyOnNewRequests) {
|
|
|
|
return
|
|
|
|
}
|
2021-05-26 18:56:04 +00:00
|
|
|
const isContact = profileModel.contacts.isAdded(address)
|
|
|
|
systemTray.showMessage(isContact ? qsTr("Contact request accepted") :
|
|
|
|
qsTr("New contact request"),
|
|
|
|
isContact ? qsTr("You can now chat with %1").arg(Utils.removeStatusEns(name)) :
|
|
|
|
qsTr("%1 requests to become contacts").arg(Utils.removeStatusEns(name)),
|
2021-05-26 17:36:24 +00:00
|
|
|
SystemTrayIcon.NoIcon,
|
|
|
|
Constants.notificationPopupTTL)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusSettingsLineButton {
|
|
|
|
property int nbRequests: profileModel.contacts.contactRequests.count
|
|
|
|
|
|
|
|
id: contactRequest
|
|
|
|
anchors.top: searchBox.bottom
|
|
|
|
anchors.topMargin: visible ? Style.current.padding : 0
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
visible: nbRequests > 0
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
text: qsTr("Contact requests")
|
|
|
|
isBadge: true
|
|
|
|
badgeText: nbRequests.toString()
|
|
|
|
onClicked: openPopup(contactRequestsPopup)
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
ScrollView {
|
|
|
|
id: chatGroupsContainer
|
2021-05-26 17:36:24 +00:00
|
|
|
anchors.top: contactRequest.bottom
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
2020-05-27 18:40:58 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-12-11 20:29:46 +00:00
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
rightPadding: Style.current.halfPadding
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
2021-06-11 12:17:23 +00:00
|
|
|
contentHeight: channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height
|
2020-12-11 20:29:46 +00:00
|
|
|
clip: true
|
|
|
|
|
|
|
|
ChannelList {
|
|
|
|
id: channelList
|
2020-12-11 20:38:10 +00:00
|
|
|
searchStr: contactsColumn.searchStr.toLowerCase()
|
2021-06-17 22:09:00 +00:00
|
|
|
channelModel: chatsModel.channelView.chats
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EmptyView {
|
|
|
|
id: emptyViewAndSuggestions
|
|
|
|
width: parent.width
|
|
|
|
anchors.top: channelList.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
}
|
2020-05-27 16:24:24 +00:00
|
|
|
}
|
2020-05-25 20:34:26 +00:00
|
|
|
}
|
2020-07-08 19:19:34 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|