status-desktop/ui/app/AppLayouts/Chat/popups/community/InviteFriendsToCommunityPop...

83 lines
2.3 KiB
QML
Raw Normal View History

2020-12-11 20:38:10 +00:00
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQml.Models 2.3
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import utils 1.0
import "../../views"
import "../../panels/communities"
2020-12-11 20:38:10 +00:00
StatusModal {
2020-12-11 20:38:10 +00:00
id: popup
property var rootStore
property var contactsStore
property var community
property var communitySectionModule
property bool hasAddedContacts
2020-12-11 20:38:10 +00:00
signal sendInvites(var pubKeys)
2020-12-11 20:38:10 +00:00
onOpened: {
contentItem.community = community;
contentItem.contactListSearch.chatKey.text = "";
contentItem.contactListSearch.pubKey = "";
contentItem.contactListSearch.pubKeys = [];
contentItem.contactListSearch.ensUsername = "";
contentItem.contactListSearch.chatKey.forceActiveFocus(Qt.MouseFocusReason);
contentItem.contactListSearch.existingContacts.visible = hasAddedContacts;
contentItem.contactListSearch.noContactsRect.visible = !contentItem.contactListSearch.existingContacts.visible;
2020-12-11 20:38:10 +00:00
}
2021-02-18 16:36:05 +00:00
//% "Invite friends"
header.title: qsTrId("invite-friends")
function proccesInviteResult(error) {
if (error) {
console.error('Error inviting', error)
contactFieldAndList.validationError = error
return
}
//% "Invite successfully sent"
popup.contentItem.contactListSearch.successMessage = qsTrId("invite-successfully-sent")
}
contentItem: CommunityProfilePopupInviteFriendsPanel {
id: contactFieldAndList
rootStore: popup.rootStore
communitySectionModule: popup.communitySectionModule
contactsStore: popup.contactsStore
community: popup.community
2020-12-11 20:38:10 +00:00
}
leftButtons: [
2020-12-11 20:38:10 +00:00
StatusRoundButton {
icon.name: "arrow-right"
icon.height: 16
icon.width: 20
2020-12-11 20:38:10 +00:00
rotation: 180
onClicked: {
popup.close()
2020-12-11 20:38:10 +00:00
}
}
]
2020-12-11 20:38:10 +00:00
rightButtons: [
2020-12-11 20:38:10 +00:00
StatusButton {
enabled: popup.contentItem.contactListSearch.pubKeys.length > 0
2021-02-18 16:36:05 +00:00
//% "Invite"
text: qsTrId("invite-button")
2020-12-11 20:38:10 +00:00
onClicked : {
popup.sendInvites(popup.contentItem.contactListSearch.pubKeys)
2020-12-11 20:38:10 +00:00
}
}
]
2020-12-11 20:38:10 +00:00
}