refactor(desktop/chat) Cleaning up popups

This commit is contained in:
Alexandra Betouni 2021-10-22 23:49:47 +03:00 committed by Iuri Matias
parent 23811dc7e4
commit 056f84c301
32 changed files with 374 additions and 275 deletions

View File

@ -26,6 +26,7 @@ import "../Chat/popups"
Rectangle {
id: browserWindow
property var globalStore
property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null
property Component browserDialogComponent: BrowserDialog {
@ -43,7 +44,9 @@ Rectangle {
}
// TODO we'll need a new dialog at one point because this one is not using the same call, but it's good for now
property Component sendTransactionModalComponent: SignTransactionModal {}
property Component sendTransactionModalComponent: SignTransactionModal {
store: browserWindow.globalStore
}
property Component signMessageModalComponent: SignMessageModal {}

View File

@ -218,6 +218,7 @@ StatusAppThreePanelLayout {
Component {
id: groupInfoPopupComponent
GroupInfoPopup {
store: root.rootStore
pinnedMessagesPopupComponent: chatColumn.pinnedMessagesPopupComponent
}
}

View File

@ -3,7 +3,6 @@ import QtQuick 2.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/panels"
import "../popups"
Item {
id: root
@ -17,8 +16,7 @@ Item {
property string selectedAmount
property string selectedFiatAmount
signal signModalOpened()
signal sendTransaction(string address)
signal sendTransaction()
Separator {
id: separator
@ -42,30 +40,7 @@ Item {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
root.clicked(root.fromAddress);
//TODO remove dynamic scoping
openPopup(signTxComponent, {selectedAccount: {
name: root.acc.name,
address: root.fromAddress,
iconColor: root.acc.iconColor,
assets: root.acc.assets
}})
}
}
}
Component {
id: signTxComponent
SignTransactionModal {
selectedAsset: root.selectedAsset
selectedAmount: root.selectedAmount
selectedRecipient: root.selectedRecipient
selectedFiatAmount: root.selectedFiatAmount
onOpened: {
root.signModalOpened();
}
onClosed: {
destroy();
root.sendTransaction();
}
}
}

View File

@ -81,7 +81,7 @@ Popup {
profileLayoutContainer.changeProfileSection(7)
}
onMarkAllReadClicked: {
errorText = chatsModel.activityNotificationList.markAllActivityCenterNotificationsRead()
errorText = activityCenter.store.chatsModelInst.activityNotificationList.markAllActivityCenterNotificationsRead()
}
}
@ -109,7 +109,7 @@ Popup {
// TODO remove this once it is handled by the activity center
// Repeater {
// id: contactList
// model: profileModel.contacts.contactRequests
// model: activityCenter.store.profileModelInst.contacts.contactRequests
// delegate: ContactRequest {
// visible: !hideReadNotifications &&
@ -144,7 +144,7 @@ Popup {
function(left, right) { return left.timestamp > right.timestamp }
]
model: chatsModel.activityNotificationList
model: activityCenter.store.chatsModelInst.activityNotificationList
delegate: Item {
id: notificationDelegate
@ -221,7 +221,7 @@ Popup {
}
Item {
visible: chatsModel.activityNotificationList.hasMoreToShow
visible: activityCenter.store.chatsModelInst.activityNotificationList.hasMoreToShow
width: parent.width
height: visible ? showMoreBtn.height + showMoreBtn.anchors.topMargin : 0
StatusButton {
@ -231,7 +231,7 @@ Popup {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
onClicked: chatsModel.activityNotificationList.loadMoreNotifications()
onClicked: activityCenter.store.chatsModelInst.activityNotificationList.loadMoreNotifications()
}
}
}

View File

@ -15,6 +15,7 @@ import "../../../../shared/controls"
import "../../../../shared/views"
StatusModal {
property var store
property string commandTitle: "Send"
property string finalButtonLabel: "Request address"
property var sendChatCommand: function () {}
@ -49,15 +50,15 @@ StatusModal {
StatusQControls.StatusAccountSelector {
id: selectFromAccount
accounts: walletModel.accountsView.accounts
accounts: root.store.walletModelInst.accountsView.accounts
selectedAccount: {
const currAcc = walletModel.accountsView.currentAccount
const currAcc = root.store.walletModelInst.accountsView.currentAccount
if (currAcc.walletType !== Constants.watchWalletType) {
return currAcc
}
return null
}
currency: walletModel.balanceView.defaultCurrency
currency: root.store.walletModelInst.balanceView.defaultCurrency
width: stack.width
label: {
return root.isRequested ?
@ -87,8 +88,8 @@ StatusModal {
RecipientSelector {
id: selectRecipient
accounts: walletModel.accountsView.accounts
contacts: profileModel.contacts.addedContacts
accounts: root.store.walletModelInst.accountsView.accounts
contacts: root.store.profileModelInst.contacts.addedContacts
label: root.isRequested ?
//% "From"
qsTrId("from") :
@ -111,9 +112,9 @@ StatusModal {
AssetAndAmountInput {
id: txtAmount
selectedAccount: selectFromAccount.selectedAccount
defaultCurrency: walletModel.balanceView.defaultCurrency
getFiatValue: walletModel.balanceView.getFiatValue
getCryptoValue: walletModel.balanceView.getCryptoValue
defaultCurrency: root.store.walletModelInst.balanceView.defaultCurrency
getFiatValue: root.store.walletModelInst.balanceView.getFiatValue
getCryptoValue: root.store.walletModelInst.balanceView.getCryptoValue
validateBalance: !root.isRequested
width: stack.width
}

View File

@ -16,7 +16,7 @@ import "../panels"
ModalPopup {
id: popup
property var store
//% "Contact requests"
title: qsTrId("contact-requests")
@ -32,7 +32,7 @@ ModalPopup {
anchors.leftMargin: -Style.current.halfPadding
anchors.rightMargin: -Style.current.halfPadding
model: profileModel.contacts.contactRequests
model: popup.store.profileModelInst.contacts.contactRequests
clip: true
delegate: ContactRequestPanel {
@ -50,11 +50,11 @@ ModalPopup {
blockContactConfirmationDialog.open()
}
onAcceptClicked: {
chatsModel.channelView.joinPrivateChat(model.address, "")
profileModel.contacts.addContact(model.address)
popup.store.chatsModelInst.channelView.joinPrivateChat(model.address, "")
popup.store.profileModelInst.contacts.addContact(model.address)
}
onDeclineClicked: {
profileModel.contacts.rejectContactRequest(model.address)
popup.store.profileModelInst.contacts.rejectContactRequest(model.address)
}
}
}
@ -66,7 +66,7 @@ ModalPopup {
BlockContactConfirmationDialog {
id: blockContactConfirmationDialog
onBlockButtonClicked: {
profileModel.contacts.blockContact(blockContactConfirmationDialog.contactAddress)
popup.store.profileModelInst.contacts.blockContact(blockContactConfirmationDialog.contactAddress)
blockContactConfirmationDialog.close()
}
}
@ -78,12 +78,12 @@ ModalPopup {
//% "Are you sure you want to decline all these contact requests"
confirmationText: qsTrId("are-you-sure-you-want-to-decline-all-these-contact-requests")
onConfirmButtonClicked: {
const requests = profileModel.contacts.contactRequests
const requests = popup.store.profileModelInst.contacts.contactRequests
const pubkeys = []
for (let i = 0; i < requests.count; i++) {
pubkeys.push(requests.rowData(i, "address"))
}
profileModel.contacts.rejectContactRequests(JSON.stringify(pubkeys))
popup.store.profileModelInst.contacts.rejectContactRequests(JSON.stringify(pubkeys))
declineAllDialog.close()
}
}
@ -95,12 +95,12 @@ ModalPopup {
//% "Are you sure you want to accept all these contact requests"
confirmationText: qsTrId("are-you-sure-you-want-to-accept-all-these-contact-requests")
onConfirmButtonClicked: {
const requests = profileModel.contacts.contactRequests
const requests = popup.store.profileModelInst.contacts.contactRequests
const pubkeys = []
for (let i = 0; i < requests.count; i++) {
pubkeys.push(requests.rowData(i, "address"))
}
profileModel.contacts.acceptContactRequests(JSON.stringify(pubkeys))
popup.store.profileModelInst.contacts.acceptContactRequests(JSON.stringify(pubkeys))
acceptAllDialog.close()
}
}

View File

@ -18,6 +18,7 @@ import "../controls"
ModalPopup {
id: popup
property var store
property var pubKeys: []
property bool selectChatMembers: true
property int memberCount: 1
@ -37,14 +38,14 @@ ModalPopup {
contactList.membersData.append({
//% "(You)"
name: profileModel.profile.username + " " + qsTrId("(you)"),
pubKey: profileModel.profile.pubKey,
name: popup.store.profileModelInst.profile.username + " " + qsTrId("(you)"),
pubKey: popup.store.profileModelInst.profile.pubKey,
address: "",
identicon: profileModel.profile.identicon,
thumbnailImage: profileModel.profile.thumbnailImage,
identicon: popup.store.profileModelInst.profile.identicon,
thumbnailImage: popup.store.profileModelInst.profile.thumbnailImage,
isUser: true
});
noContactsRect.visible = !profileModel.contacts.list.hasAddedContacts();
noContactsRect.visible = !popup.store.profileModelInst.contacts.list.hasAddedContacts();
contactList.visible = !noContactsRect.visible;
if (!contactList.visible) {
memberCount = 0;
@ -72,7 +73,7 @@ ModalPopup {
if (pubKeys.length === 0) {
return;
}
chatsModel.groups.create(Utils.filterXSS(groupName.text), JSON.stringify(pubKeys));
popup.store.chatsModelInst.groups.create(Utils.filterXSS(groupName.text), JSON.stringify(pubKeys));
popup.close();
}

View File

@ -22,6 +22,7 @@ ModalPopup {
ActiveChannel,
ContextChannel
}
property var store
property bool addMembers: false
property int currMemberCount: 1
property int memberCount: 1
@ -55,7 +56,7 @@ ModalPopup {
onOpened: {
addMembers = false;
popup.isAdmin = popup.channel.isAdmin(profileModel.profile.pubKey)
popup.isAdmin = popup.channel.isAdmin(popup.store.profileModelInst.profile.pubKey)
btnSelectMembers.enabled = false;
resetSelectedMembers();
}
@ -152,6 +153,11 @@ ModalPopup {
RenameGroupPopup {
id: renameGroupPopup
activeChannelName: popup.store.chatsModelInst.channelView.activeChannel.name
onDoRename: {
popup.store.chatsModelInst.groups.rename(groupName);
close();
}
}
}
@ -225,7 +231,7 @@ ModalPopup {
}
StatusSettingsLineButton {
property int pinnedCount: chatsModel.messageView.pinnedMessagesList.count
property int pinnedCount: popup.store.chatsModelInst.messageView.pinnedMessagesList.count
id: pinnedMessagesBtn
visible: pinnedCount > 0
@ -253,16 +259,16 @@ ModalPopup {
}
Connections {
target: chatsModel.channelView
target: popup.store.chatsModelInst.channelView
onActiveChannelChanged: {
if (popup.channelType === GroupInfoPopup.ChannelType.ActiveChannel) {
popup.channel = chatsModel.channelView.activeChannel
popup.channel = popup.store.chatsModelInst.channelView.activeChannel
resetSelectedMembers()
}
}
onContextChannelChanged: {
if (popup.channelType === GroupInfoPopup.ChannelType.ContextChannel) {
popup.channel = chatsModel.channelView.contextChannel
popup.channel = popup.store.chatsModelInst.channelView.contextChannel
resetSelectedMembers()
}
}
@ -359,7 +365,7 @@ ModalPopup {
icon.height: 16
//% "Make Admin"
text: qsTrId("make-admin")
onTriggered: chatsModel.groups.makeAdmin(popup.channel.id, model.publicKey)
onTriggered: popup.store.chatsModelInst.groups.makeAdmin(popup.channel.id, model.publicKey)
}
Action {
icon.source: Style.svg("remove-from-group")
@ -368,7 +374,7 @@ ModalPopup {
icon.color: Style.current.red
//% "Remove From Group"
text: qsTrId("remove-from-group")
onTriggered: chatsModel.groups.kickMember(popup.channel.id, model.publicKey)
onTriggered: popup.store.chatsModelInst.groups.kickMember(popup.channel.id, model.publicKey)
}
}
}

View File

@ -13,25 +13,24 @@ import StatusQ.Popups 0.1
import "../../../../shared/controls"
StatusModal {
property int nicknameLength: nicknameInput.textField.text.length
readonly property int maxNicknameLength: 32
property bool nicknameTooLong: nicknameLength > maxNicknameLength
property var changeUsername: function () {}
property var changeNickname: function () {}
anchors.centerIn: parent
id: popup
width: 400
height: 390
onOpened: {
nicknameInput.forceActiveFocus(Qt.MouseFocusReason)
}
header.title: qsTr("Nickname")
header.subTitle: isEnsVerified ? alias : fromAuthor
header.subTitleElide: !isEnsVerified ? Text.ElideMiddle : Text.ElideNone
property int nicknameLength: nicknameInput.textField.text.length
readonly property int maxNicknameLength: 32
property bool nicknameTooLong: nicknameLength > maxNicknameLength
signal doneClicked(string newUsername, string newNickname)
onOpened: {
nicknameInput.forceActiveFocus(Qt.MouseFocusReason);
}
contentItem: Item {
width: popup.width
height: childrenRect.height
@ -86,21 +85,8 @@ StatusModal {
text: qsTrId("done")
enabled: !popup.nicknameTooLong
onClicked: {
if (!isEnsVerified) {
// Change username title only if it was not an ENS name
if (nicknameInput.textField.text === "") {
// If we removed the nickname, go back to showing the alias
popup.changeUsername(alias)
} else {
popup.changeUsername(nicknameInput.textField.text)
}
}
popup.changeNickname(nicknameInput.textField.text)
profileModel.contacts.changeContactNickname(fromAuthor, nicknameInput.textField.text)
popup.close()
if (!!chatsModel.communities.activeCommunity) {
chatsModel.communities.activeCommunity.triggerMembersUpdate()
}
// If we removed the nickname, go back to showing the alias
doneClicked(nicknameInput.textField.text === "" ? alias : nicknameInput.textField.text, nicknameInput.textField.text);
}
}
]

View File

@ -18,12 +18,12 @@ ModalPopup {
property var rootStore
property var messageStore
property bool userCanPin: {
switch (chatsModel.channelView.activeChannel.chatType) {
switch (popup.rootStore.chatsModelInst.channelView.activeChannel.chatType) {
case Constants.chatTypePublic: return false
case Constants.chatTypeStatusUpdate: return false
case Constants.chatTypeOneToOne: return true
case Constants.chatTypePrivateGroupChat: return chatsModel.channelView.activeChannel.isAdmin(profileModel.profile.pubKey)
case Constants.chatTypeCommunity: return chatsModel.communities.activeCommunity.admin
case Constants.chatTypePrivateGroupChat: return popup.rootStore.chatsModelInst.channelView.activeChannel.isAdmin(profileModel.profile.pubKey)
case Constants.chatTypeCommunity: return popup.rootStore.chatsModelInst.communities.activeCommunity.admin
default: return false
}
}
@ -97,7 +97,7 @@ ModalPopup {
ListView {
id: pinnedMessageListView
model: chatsModel.messageView.pinnedMessagesList
model: popup.rootStore.chatsModelInst.messageView.pinnedMessagesList
height: parent.height
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
@ -235,9 +235,9 @@ ModalPopup {
type: StatusQControls.StatusBaseButton.Type.Danger
anchors.right: parent.right
onClicked: {
const chatId = chatsModel.channelView.activeChannel.id
chatsModel.messageView.unPinMessage(messageToUnpin, chatId)
chatsModel.messageView.pinMessage(messageToPin, chatId)
const chatId = popup.rootStore.chatsModelInst.channelView.activeChannel.id
popup.rootStore.chatsModelInst.messageView.unPinMessage(messageToUnpin, chatId)
popup.rootStore.chatsModelInst.messageView.pinMessage(messageToPin, chatId)
messageToUnpin = messageToPin = ""
popup.close()
}

View File

@ -15,10 +15,11 @@ ModalPopup {
id: popup
//% "New chat"
title: qsTrId("new-chat")
property var store
signal profileClicked()
function doJoin(pk, ensName) {
chatsModel.channelView.joinPrivateChat(pk, Utils.isChatKey(pk) ? "" : ensName);
popup.store.chatsModelInst.channelView.joinPrivateChat(pk, Utils.isChatKey(pk) ? "" : ensName);
popup.close();
}
@ -27,7 +28,7 @@ ModalPopup {
contactFieldAndList.pubKey = ""
contactFieldAndList.ensUsername = ""
contactFieldAndList.chatKey.forceActiveFocus(Qt.MouseFocusReason)
contactFieldAndList.existingContacts.visible = profileModel.contacts.list.hasAddedContacts()
contactFieldAndList.existingContacts.visible = popup.store.profileModelInst.contacts.list.hasAddedContacts()
contactFieldAndList.noContactsRect.visible = !contactFieldAndList.existingContacts.visible
}
@ -38,7 +39,7 @@ ModalPopup {
width: parent.width
addContactEnabled: false
onUserClicked: function (isContact, pubKey, ensName) {
chatsModel.channelView.joinPrivateChat(pubKey, Utils.isChatKey(pubKey) ? "" : ensName);
popup.store.chatsModelInst.channelView.joinPrivateChat(pubKey, Utils.isChatKey(pubKey) ? "" : ensName);
popup.close();
}
}
@ -63,7 +64,7 @@ ModalPopup {
anchors.left: parent.left
anchors.leftMargin: 2
anchors.verticalCenter: parent.verticalCenter
source: appMain.getProfileImage(profileModel.profile.pubKey)
source: appMain.getProfileImage(popup.store.profileModelInst.profile.pubKey)
}
StyledText {

View File

@ -19,6 +19,11 @@ StatusModal {
property Popup parentPopup
//ProfilePopup is either instantiated in some files
//and called to open via the openProfilePopup in others
//TODO ---------------------------------------
//use one PofilePopup instance and pass the store there
property var store
property var identicon: ""
property var userName: ""
property string nickname: ""
@ -236,11 +241,17 @@ StatusModal {
NicknamePopup {
id: nicknamePopup
changeUsername: function (newUsername) {
popup.userName = newUsername
}
changeNickname: function (newNickname) {
popup.nickname = newNickname
onDoneClicked: {
// Change username title only if it was not an ENS name
if (isEnsVerified) {
popup.userName = newUsername;
}
popup.nickname = newNickname;
profileModel.contacts.changeContactNickname(fromAuthor, newNickname);
popup.close()
if (!!chatsModel.communities.activeCommunity) {
chatsModel.communities.activeCommunity.triggerMembersUpdate();
}
}
}
}

View File

@ -15,7 +15,8 @@ import "../panels"
// TODO: replace with StatusModal
ModalPopup {
property string channelNameValidationError: ""
signal joinPublicChat(string name)
signal suggestedMessageClicked(string channel)
function validate() {
if (channelName.text === "") {
//% "You need to enter a channel name"
@ -34,7 +35,7 @@ ModalPopup {
if (!validate()) {
return
}
chatsModel.channelView.joinPublicChat(channelName.text);
popup.joinPublicChat(channelName.text);
popup.close();
}
@ -101,7 +102,7 @@ ModalPopup {
id: sectionRepeater
width: parent.width
onSuggestedMessageClicked: {
chatsModel.channelView.joinPublicChat(channel);
popup.suggestedMessageClicked(channel);
}
}
}

View File

@ -10,10 +10,6 @@ import StatusQ.Popups 0.1
import "../../../../shared/controls"
StatusModal {
function doRename(){
chatsModel.groups.rename(groupName.text)
popup.close();
}
id: popup
height: 210
@ -22,9 +18,12 @@ StatusModal {
//% "Group name"
header.title: qsTrId("group-name")
property string activeChannelName
signal doRename(string groupName)
onOpened: {
groupName.forceActiveFocus(Qt.MouseFocusReason)
groupName.text = chatsModel.channelView.activeChannel.name
groupName.text = popup.activeChannelName;
}
contentItem: Item {
@ -50,7 +49,7 @@ StatusModal {
id: saveBtn
//% "Save"
text: qsTrId("save")
onClicked : doRename()
onClicked : { doRename(groupName.text); }
}
]
}

View File

@ -15,6 +15,9 @@ StatusModal {
//% "Select account"
header.title: qsTrId("select-account")
height: 284
property var accounts
property string currency
property alias accountSelector: selectFromAccount
signal selectAndShareAddressButtonClicked()
@ -28,8 +31,8 @@ StatusModal {
anchors.rightMargin: Style.current.padding
StatusAccountSelector {
id: selectFromAccount
accounts: walletModel.accountsView.accounts
currency: walletModel.balanceView.defaultCurrency
accounts: root.accounts
currency: root.currency
width: parent.width
//% "Choose account"
//% "Select account to share and receive assets"

View File

@ -14,7 +14,14 @@ import "../../../../shared/views"
import "../../../../shared/popups"
import "../../Wallet/"
//TODO remove dynamic scoping
StatusModal {
id: root
//% "Send"
header.title: qsTrId("command-button-send")
height: 540
property var store
property var selectedAccount
property var selectedRecipient
property var selectedAsset
@ -29,7 +36,7 @@ StatusModal {
property var sendTransaction: function(selectedGasLimit, selectedGasPrice, selectedTipLimit, selectedOveralLimit, enteredPassword) {
let success = false
if(root.selectedAsset.address == Constants.zeroAddress){
success = walletModel.transactionsView.transferEth(
success = root.store.walletModelInst.transactionsView.transferEth(
selectFromAccount.selectedAccount.address,
selectRecipient.selectedRecipient.address,
root.selectedAmount,
@ -40,7 +47,7 @@ StatusModal {
enteredPassword,
stack.uuid)
} else {
success = walletModel.transactionsView.transferTokens(
success = root.store.walletModelInst.transactionsView.transferTokens(
selectFromAccount.selectedAccount.address,
selectRecipient.selectedRecipient.address,
root.selectedAsset.address,
@ -60,12 +67,6 @@ StatusModal {
}
}
id: root
//% "Send"
header.title: qsTrId("command-button-send")
height: 540
property MessageDialog sendingError: MessageDialog {
id: sendingError
//% "Error sending the transaction"
@ -95,7 +96,7 @@ StatusModal {
id: groupSelectAcct
headerText: {
if(trxData.startsWith("0x095ea7b3")){
const approveData = JSON.parse(walletModel.tokensView.decodeTokenApproval(selectedRecipient.address, trxData))
const approveData = JSON.parse(root.store.walletModelInst.tokensView.decodeTokenApproval(selectedRecipient.address, trxData))
if(approveData.symbol)
//% "Authorize %1 %2"
return qsTrId("authorize--1--2").arg(approveData.amount).arg(approveData.symbol)
@ -112,8 +113,8 @@ StatusModal {
}
StatusAccountSelector {
id: selectFromAccount
accounts: walletModel.accountsView.accounts
currency: walletModel.balanceView.defaultCurrency
accounts: root.store.walletModelInst.accountsView.accounts
currency: root.store.walletModelInst.balanceView.defaultCurrency
width: stack.width
selectedAccount: root.selectedAccount
//% "Choose account"
@ -125,8 +126,8 @@ StatusModal {
RecipientSelector {
id: selectRecipient
visible: false
accounts: walletModel.accountsView.accounts
contacts: profileModel.contacts.addedContacts
accounts: root.store.walletModelInst.accountsView.accounts
contacts: root.store.profileModelInst.contacts.addedContacts
selectedRecipient: root.selectedRecipient
readOnly: true
}
@ -143,10 +144,10 @@ StatusModal {
GasSelector {
id: gasSelector
anchors.topMargin: Style.current.padding
gasPrice: parseFloat(walletModel.gasView.gasPrice)
getGasEthValue: walletModel.gasView.getGasEthValue
getFiatValue: walletModel.balanceView.getFiatValue
defaultCurrency: walletModel.balanceView.defaultCurrency
gasPrice: parseFloat(root.store.walletModelInst.gasView.gasPrice)
getGasEthValue: root.store.walletModelInst.gasView.getGasEthValue
getFiatValue: root.store.walletModelInst.balanceView.getFiatValue
defaultCurrency: root.store.walletModelInst.balanceView.defaultCurrency
width: stack.width
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
@ -159,7 +160,7 @@ StatusModal {
return
}
let gasEstimate = JSON.parse(walletModel.gasView.estimateGas(
let gasEstimate = JSON.parse(root.store.walletModelInst.gasView.estimateGas(
selectFromAccount.selectedAccount.address,
selectRecipient.selectedRecipient.address,
root.selectedAsset.address,
@ -213,7 +214,7 @@ StatusModal {
toAccount: selectRecipient.selectedRecipient
asset: root.selectedAsset
amount: { "value": root.selectedAmount, "fiatValue": root.selectedFiatAmount }
currency: walletModel.balanceView.defaultCurrency
currency: root.store.walletModelInst.balanceView.defaultCurrency
isFromEditable: false
trxData: root.trxData
isGasEditable: true
@ -254,7 +255,7 @@ StatusModal {
TransactionSigner {
id: transactionSigner
width: stack.width
signingPhrase: walletModel.utilsView.signingPhrase
signingPhrase: root.store.walletModelInst.utilsView.signingPhrase
}
}
}
@ -335,7 +336,7 @@ StatusModal {
}
Connections {
target: walletModel.transactionsView
target: root.store.walletModelInst.transactionsView
onTransactionWasSent: {
try {
let response = JSON.parse(txResult)
@ -356,14 +357,14 @@ StatusModal {
chatsModel.transactions.acceptRequestTransaction(transactionId,
messageId,
profileModel.profile.pubKey + transactionId.substr(2))
root.store.profileModelInst.profile.pubKey + transactionId.substr(2))
//% "Transaction pending..."
toastMessage.title = qsTrId("ens-transaction-pending")
toastMessage.source = Style.svg("loading")
toastMessage.iconColor = Style.current.primary
toastMessage.iconRotates = true
toastMessage.link = `${walletModel.utilsView.etherscanLink}/${transactionId}`
toastMessage.link = `${root.store.walletModelInst.utilsView.etherscanLink}/${transactionId}`
toastMessage.open()
root.close()

View File

@ -13,33 +13,33 @@ import StatusQ.Controls 0.1 as StatusQControls
import "../../../../../shared/controls"
StatusModal {
id: popup
id: root
width: 400
height: 400
anchors.centerIn: parent
property string error: ""
property string keyValidationError: ""
function validate() {
keyValidationError = ""
keyValidationError = "";
if (keyInput.text.trim() === "") {
//% "You need to enter a key"
keyValidationError = qsTrId("you-need-to-enter-a-key")
keyValidationError = qsTrId("you-need-to-enter-a-key");
}
return !keyValidationError
return !keyValidationError;
}
//% "Access existing community"
header.title: qsTrId("access-existing-community")
onClosed: {
popup.destroy();
root.destroy();
}
contentItem: Item {
width: popup.width - 32
width: root.width - 32
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
@ -73,22 +73,20 @@ StatusModal {
text: qsTrId("import")
onClicked: {
if (!validate()) {
return
return;
}
let communityKey = keyInput.text.trim()
let communityKey = keyInput.text.trim();
if (!communityKey.startsWith("0x")) {
communityKey = "0x" + communityKey
communityKey = "0x" + communityKey;
}
const error = chatsModel.communities.importCommunity(communityKey, Utils.uuid())
if (error) {
creatingError.text = error
return creatingError.open()
if (!!root.error) {
creatingError.text = error;
return creatingError.open();
}
popup.close()
root.close();
}
MessageDialog {

View File

@ -15,6 +15,10 @@ import "../../../../../shared"
StatusModal {
id: popup
property var communitiesList
signal setActiveCommunity(string id)
signal setObservedCommunity(string id)
onOpened: {
contentItem.searchBox.input.text = "";
contentItem.searchBox.input.forceActiveFocus(Qt.MouseFocusReason)
@ -102,7 +106,7 @@ StatusModal {
}
]
model: chatsModel.communities.list
model: popup.communitiesList
delegate: StatusListItem {
visible: {
if (!searchBox.input.text) {
@ -125,9 +129,9 @@ StatusModal {
sensor.onClicked: {
if (joined && isMember) {
chatsModel.communities.setActiveCommunity(id)
popup.setActiveCommunity(id);
} else {
chatsModel.communities.setObservedCommunity(id)
popup.setObservedCommunity(id);
openPopup(communityDetailPopup)
}
popup.close()

View File

@ -12,7 +12,10 @@ import StatusQ.Popups 0.1
import utils 1.0
StatusModal {
property QtObject community: chatsModel.communities.observedCommunity
id: root
property var store
property QtObject community: root.store.chatsModelInst.communities.observedCommunity
property string communityId: community.id
property string name: community.name
property string description: community.description
@ -25,8 +28,6 @@ StatusModal {
property bool isMember: community.isMember
property string communityColor: community.communityColor || Style.current.blue
id: popup
header.title: name
header.subTitle: {
let subTitle = ""
@ -55,7 +56,7 @@ StatusModal {
}
contentItem: Column {
width: popup.width
width: root.width
Item {
height: childrenRect.height + 8
@ -66,7 +67,7 @@ StatusModal {
id: description
anchors.top: parent.top
anchors.topMargin: 16
text: popup.description
text: root.description
font.pixelSize: 15
color: Theme.palette.directColor1
wrapMode: Text.WordWrap
@ -115,7 +116,7 @@ StatusModal {
}
ScrollView {
width: popup.width
width: root.width
height: 300
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
clip: true
@ -130,7 +131,7 @@ StatusModal {
title: "#" + model.name
subTitle: model.description
icon.isLetterIdenticon: true
icon.background.color: popup.communityColor
icon.background.color: root.communityColor
}
}
}
@ -145,8 +146,8 @@ StatusModal {
icon.width: 20
rotation: 180
onClicked: {
openPopup(communitiesPopupComponent)
popup.close()
openroot(communitiesrootComponent)
root.close()
}
}
]
@ -157,37 +158,37 @@ StatusModal {
if (access !== Constants.communityChatOnRequestAccess) {
return false
}
return chatsModel.communities.isCommunityRequestPending(popup.communityId)
return root.store.chatsModelInst.communities.isCommunityRequestPending(root.communityId)
}
text: {
if (popup.ensOnly && !profileModel.profile.ensVerified) {
if (root.ensOnly && !root.store.profileModelInst.profile.ensVerified) {
//% "Membership requires an ENS username"
return qsTrId("membership-requires-an-ens-username")
}
if (popup.canJoin) {
if (root.canJoin) {
//% "Join %1"
return qsTrId("join---1-").arg(popup.name);
return qsTrId("join---1-").arg(root.name);
}
if (isPendingRequest) {
//% "Pending"
return qsTrId("invite-chat-pending")
}
switch(popup.access) {
switch(root.access) {
//% "Join %1"
case Constants.communityChatPublicAccess: return qsTrId("join---1-").arg(popup.name);
case Constants.communityChatPublicAccess: return qsTrId("join---1-").arg(root.name);
//% "You need to be invited"
case Constants.communityChatInvitationOnlyAccess: return qsTrId("you-need-to-be-invited");
//% "Request to join %1"
case Constants.communityChatOnRequestAccess: return qsTrId("request-to-join---1-").arg(popup.name);
case Constants.communityChatOnRequestAccess: return qsTrId("request-to-join---1-").arg(root.name);
//% "Unknown community"
default: return qsTrId("unknown-community");
}
}
enabled: {
if (popup.ensOnly && !profileModel.profile.ensVerified) {
if (root.ensOnly && !root.store.profileModelInst.profile.ensVerified) {
return false
}
if (popup.access === Constants.communityChatInvitationOnlyAccess || isPendingRequest) {
if (root.access === Constants.communityChatInvitationOnlyAccess || isPendingRequest) {
return false
}
if (canJoin) {
@ -197,16 +198,16 @@ StatusModal {
}
onClicked: {
let error
if (access === Constants.communityChatOnRequestAccess && !popup.isMember) {
error = chatsModel.communities.requestToJoinCommunity(popup.communityId,
profileModel.profile.ensVerified ? profileModel.profile.username : "")
if (access === Constants.communityChatOnRequestAccess && !root.isMember) {
error = root.store.chatsModelInst.communities.requestToJoinCommunity(root.communityId,
root.store.profileModelInst.profile.ensVerified ? root.store.profileModelInst.profile.username : "")
if (!error) {
enabled = false
//% "Pending"
text = qsTrId("invite-chat-pending")
}
} else {
error = chatsModel.communities.joinCommunity(popup.communityId, true)
error = root.store.chatsModelInst.communities.joinCommunity(root.communityId, true)
}
if (error) {
@ -214,7 +215,7 @@ StatusModal {
return joiningError.open()
}
popup.close()
root.close()
}
}
]

View File

@ -10,11 +10,11 @@ import utils 1.0
import "../../panels/communities"
StatusModal {
id: root
property var store
property var community
id: popup
onClosed: {
while (contentItem.depth > 1) {
contentItem.pop()
@ -24,13 +24,13 @@ StatusModal {
header.title: contentItem.currentItem.headerTitle
header.subTitle: contentItem.currentItem.headerSubtitle || ""
header.image.source: contentItem.currentItem.headerImageSource || ""
header.icon.isLetterIdenticon: contentItem.currentItem.headerTitle == popup.community.name && !contentItem.currentItem.headerImageSource
header.icon.background.color: popup.community.communityColor
header.icon.isLetterIdenticon: contentItem.currentItem.headerTitle == root.community.name && !contentItem.currentItem.headerImageSource
header.icon.background.color: root.community.communityColor
contentItem: StackView {
id: stack
initialItem: profileOverview
width: popup.width
width: root.width
implicitHeight: currentItem.implicitHeight || currentItem.height
pushEnter: Transition { enabled: false }
@ -43,9 +43,9 @@ StatusModal {
CommunityProfilePopupOverviewPanel {
width: stack.width
headerTitle: popup.community.name
headerTitle: root.community.name
headerSubtitle: {
switch(popup.community.access) {
switch(root.community.access) {
//% "Public community"
case Constants.communityChatPublicAccess: return qsTrId("public-community");
//% "Invitation only community"
@ -56,31 +56,29 @@ StatusModal {
default: return qsTrId("unknown-community");
}
}
headerImageSource: popup.community.thumbnailImage
community: popup.community
headerImageSource: root.community.thumbnailImage
community: root.community
onMembersListButtonClicked: popup.contentItem.push(membersList)
onMembersListButtonClicked: root.contentItem.push(membersList)
onNotificationsButtonClicked: {
chatsModel.communities.setCommunityMuted(popup.community.id, checked)
root.store.setCommunityMuted(root.community.id, checked);
}
onEditButtonClicked: openPopup(editCommunityPopup, {
community: popup.community
onEditButtonClicked: openroot(editCommunityroot, {
community: root.community
})
onTransferOwnershipButtonClicked: openPopup(transferOwnershipPopup, {privateKey: chatsModel.communities.exportCommunity()})
onTransferOwnershipButtonClicked: openroot(transferOwnershiproot, {privateKey: root.store.exportCommunity()})
onLeaveButtonClicked: {
chatsModel.communities.leaveCommunity(popup.community.id)
popup.close()
root.store.leaveCommunity(root.community.id);
root.close();
}
onCopyToClipboard: {
//TODO
//root.store.copyToClipboard(link);
chatsModel.copyToClipboard(link);
root.store.copyToClipboard(link);
}
}
}
Component {
id: transferOwnershipPopup
id: transferOwnershiproot
TransferOwnershipPopup {
anchors.centerIn: parent
onClosed: {
@ -95,9 +93,9 @@ StatusModal {
width: stack.width
//% "Members"
headerTitle: qsTrId("members-label")
headerSubtitle: popup.community.nbMembers.toString()
community: popup.community
onInviteButtonClicked: popup.contentItem.push(inviteFriendsView)
headerSubtitle: root.community.nbMembers.toString()
community: root.community
onInviteButtonClicked: root.contentItem.push(inviteFriendsView)
}
}
@ -107,13 +105,13 @@ StatusModal {
width: stack.width
//% "Invite friends"
headerTitle: qsTrId("invite-friends")
community: popup.community
community: root.community
contactListSearch.chatKey.text: ""
contactListSearch.pubKey: ""
contactListSearch.pubKeys: []
contactListSearch.ensUsername: ""
contactListSearch.existingContacts.visible: profileModel.contacts.list.hasAddedContacts()
contactListSearch.existingContacts.visible: root.store.profileModelInst.contacts.list.hasAddedContacts()
contactListSearch.noContactsRect.visible: !contactListSearch.existingContacts.visible
}
}
@ -138,12 +136,12 @@ StatusModal {
StatusButton {
//% "Invite"
text: qsTrId("community-invite-title")
visible: popup.contentItem.depth > 2
visible: root.contentItem.depth > 2
height: !visible ? 0 : implicitHeight
enabled: popup.contentItem.currentItem.contactListSearch !== undefined && popup.contentItem.currentItem.contactListSearch.pubKeys.length > 0
enabled: root.contentItem.currentItem.contactListSearch !== undefined && root.contentItem.currentItem.contactListSearch.pubKeys.length > 0
onClicked: {
popup.contentItem.currentItem.sendInvites(popup.contentItem.currentItem.contactListSearch.pubKeys)
popup.contentItem.pop()
root.contentItem.currentItem.sendInvites(root.contentItem.currentItem.contactListSearch.pubKeys)
root.contentItem.pop()
}
}
]

View File

@ -13,6 +13,9 @@ import utils 1.0
import "../../../../../shared/popups"
StatusModal {
id: root
property var store
property string communityId
property string categoryId
property string categoryName: ""
@ -24,14 +27,12 @@ StatusModal {
readonly property var categoryNameValidator: Utils.Validate.NoEmpty
| Utils.Validate.TextLength
id: popup
onOpened: {
if(isEdit){
popup.contentItem.categoryName.input.text = categoryName
channels = JSON.parse(chatsModel.communities.activeCommunity.getChatIdsByCategory(categoryId))
root.contentItem.categoryName.input.text = categoryName
channels = JSON.parse(root.store.chatsModelInst.communities.activeCommunity.getChatIdsByCategory(categoryId))
}
popup.contentItem.categoryName.input.forceActiveFocus(Qt.MouseFocusReason)
root.contentItem.categoryName.input.forceActiveFocus(Qt.MouseFocusReason)
}
onClosed: destroy()
@ -47,7 +48,7 @@ StatusModal {
contentItem: Column {
width: popup.width
width: root.width
property alias categoryName: nameInput
StatusInput {
@ -68,7 +69,7 @@ StatusModal {
ScrollView {
id: scrollView
width: popup.width
width: root.width
height: Math.min(content.height, 300)
anchors.horizontalCenter: parent.horizontalCenter
@ -108,14 +109,14 @@ StatusModal {
anchors.top: channelsLabel.bottom
height: childrenRect.height
width: parent.width
model: chatsModel.communities.activeCommunity.chats
model: root.store.activeCommunityChatsModel
interactive: false
clip: true
delegate: StatusListItem {
anchors.horizontalCenter: parent.horizontalCenter
visible: popup.isEdit ?
model.categoryId === popup.categoryId || model.categoryId === "" :
visible: root.isEdit ?
model.categoryId === root.categoryId || model.categoryId === "" :
model.categoryId === ""
height: visible ? implicitHeight : 0
title: "#" + model.name
@ -126,16 +127,16 @@ StatusModal {
components: [
StatusCheckBox {
id: channelItemCheckbox
checked: popup.isEdit ? popup.channels.indexOf(model.id) > - 1 : false
checked: root.isEdit ? root.channels.indexOf(model.id) > - 1 : false
onCheckedChanged: {
var idx = popup.channels.indexOf(model.id)
var idx = root.channels.indexOf(model.id)
if(checked){
if(idx === -1){
popup.channels.push(model.id)
root.channels.push(model.id)
}
} else {
if(idx > -1){
popup.channels.splice(idx, 1);
root.channels.splice(idx, 1);
}
}
}
@ -162,11 +163,11 @@ StatusModal {
icon.name: "delete"
type: StatusListItem.Type.Danger
sensor.onClicked: {
openPopup(deleteCategoryConfirmationDialogComponent, {
openroot(deleteCategoryConfirmationDialogComponent, {
//% "Delete %1 category"
title: qsTrId("delete--1-category").arg(popup.contentItem.categoryName.input.text),
title: qsTrId("delete--1-category").arg(root.contentItem.categoryName.input.text),
//% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted."
confirmationText: qsTrId("are-you-sure-you-want-to-delete--1-category--channels-inside-the-category-won-t-be-deleted-").arg(popup.contentItem.categoryName.input.text)
confirmationText: qsTrId("are-you-sure-you-want-to-delete--1-category--channels-inside-the-category-won-t-be-deleted-").arg(root.contentItem.categoryName.input.text)
})
}
@ -189,13 +190,13 @@ StatusModal {
close();
}
onConfirmButtonClicked: function(){
const error = chatsModel.communities.deleteCommunityCategory(chatsModel.communities.activeCommunity.id, popup.categoryId)
const error = root.store.deleteCommunityCategory(root.categoryId);
if (error) {
creatingError.text = error
return creatingError.open()
}
close();
popup.close()
root.close()
}
}
}
@ -218,9 +219,9 @@ StatusModal {
let error = ""
if (isEdit) {
error = chatsModel.communities.editCommunityCategory(communityId, categoryId, Utils.filterXSS(popup.contentItem.categoryName.input.text), JSON.stringify(channels))
error = root.store.editCommunityCategory(communityId, categoryId, Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
} else {
error = chatsModel.communities.createCommunityCategory(communityId, Utils.filterXSS(popup.contentItem.categoryName.input.text), JSON.stringify(channels))
error = root.store.createCommunityCategory(communityId, Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
}
if (error) {
@ -228,7 +229,7 @@ StatusModal {
return categoryError.open()
}
popup.close()
root.close()
}
}
]

View File

@ -12,6 +12,7 @@ import StatusQ.Popups 0.1
StatusModal {
id: popup
property var store
property string communityId
property QtObject channel
property bool isEdit: false
@ -170,7 +171,7 @@ StatusModal {
//% "Pinned messages"
title: qsTrId("pinned-messages")
icon.name: "pin"
label: chatsModel.messageView.pinnedMessagesList.count
label: popup.store.chatsModelInst.messageView.pinnedMessagesList.count
components: [
StatusIcon {
icon: "chevron-down"
@ -204,15 +205,12 @@ StatusModal {
}
let error = "";
if (!isEdit) {
error = chatsModel.createCommunityChannel(communityId,
error = popup.store.createCommunityChannel(communityId,
Utils.filterXSS(popup.contentItem.channelName.input.text),
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
categoryId)
// TODO: pass the private value when private channels
// are implemented
//privateSwitch.checked)
} else {
error = chatsModel.editCommunityChannel(communityId,
error = popup.store.editCommunityChannel(communityId,
popup.contentItem.channelId,
Utils.filterXSS(popup.contentItem.channelName.input.text),
Utils.filterXSS(popup.contentItem.channelDescription.input.text),

View File

@ -14,19 +14,18 @@ import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1
import StatusQ.Popups 0.1
StatusModal {
property QtObject community: chatsModel.communities.activeCommunity
StatusModal {
id: popup
height: 509
property var store
property bool isEdit: false
property QtObject community: popup.store.chatsModelInst.communities.activeCommunity
readonly property int maxCommunityNameLength: 30
readonly property int maxCommunityDescLength: 140
readonly property var communityColorValidator: Utils.Validate.NoEmpty
| Utils.Validate.TextHexColor
id: popup
height: 509
onOpened: {
if (isEdit) {
contentItem.communityName.input.text = community.name;
@ -405,7 +404,7 @@ StatusModal {
let error = false;
if(isEdit) {
error = chatsModel.communities.editCommunity(
error = popup.store.editCommunity(
community.id,
Utils.filterXSS(popup.contentItem.communityName.input.text),
Utils.filterXSS(popup.contentItem.communityDescription.input.text),
@ -421,7 +420,7 @@ StatusModal {
popup.contentItem.imageCropperModal.bY
)
} else {
error = chatsModel.communities.createCommunity(
error = popup.store.createCommunity(
Utils.filterXSS(popup.contentItem.communityName.input.text),
Utils.filterXSS(popup.contentItem.communityDescription.input.text),
membershipRequirementSettingPopup.checkedMembership,

View File

@ -16,17 +16,18 @@ StatusModal {
id: popup
property var community
property bool hasAddedContacts
onOpened: {
contentItem.community = community
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 = profileModel.contacts.list.hasAddedContacts()
contentItem.contactListSearch.noContactsRect.visible = !contentItem.contactListSearch.existingContacts.visible
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;
}
//% "Invite friends"

View File

@ -13,7 +13,7 @@ import "../../../../../shared"
StatusModal {
id: popup
property var store
onOpened: {
contentItem.errorText.text = ""
}
@ -53,15 +53,15 @@ StatusModal {
ListView {
id: membershipRequestList
anchors.fill: parent
model: chatsModel.communities.activeCommunity.communityMembershipRequests
model: popup.store.chatsModelInst.communities.activeCommunity.communityMembershipRequests
clip: true
delegate: StatusListItem {
anchors.horizontalCenter: parent.horizontalCenter
property int contactIndex: profileModel.contacts.list.getContactIndexByPubkey(model.publicKey)
property int contactIndex: popup.store.profileModelInst.contacts.list.getContactIndexByPubkey(model.publicKey)
property string nickname: appMain.getUserNickname(model.publicKey)
property string profileImage: contactIndex === -1 ? "" : profileModel.contacts.list.rowData(contactIndex, 'thumbnailImage')
property string profileImage: contactIndex === -1 ? "" : popup.store.profileModelInst.contacts.list.rowData(contactIndex, 'thumbnailImage')
property string displayName: Utils.getDisplayName(publicKey, contactIndex)
image.isIdenticon: !profileImage && model.identicon
@ -83,7 +83,7 @@ StatusModal {
cursorShape: Qt.PointingHandCursor
onClicked: {
errorText.text = ""
const error = chatsModel.communities.acceptRequestToJoinCommunity(id)
const error = popup.store.acceptRequestToJoinCommunity(id);
if (error) {
errorText.text = error
}
@ -103,7 +103,7 @@ StatusModal {
cursorShape: Qt.PointingHandCursor
onClicked: {
errorText.text = ""
const error = chatsModel.communities.declineRequestToJoinCommunity(id)
const error = popup.store.declineRequestToJoinCommunity(id);
if (error) {
errorText.text = error
}

View File

@ -81,4 +81,60 @@ QtObject {
return null;
}
property var activeCommunityChatsModel: chatsModelInst.communities.activeCommunity.chats
function createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY) {
chatsModelInst.communities.createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY);
}
function editCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY) {
chatsModelInst.communities.editCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY);
}
function createCommunityCategory(communityId, categoryName, channels) {
chatsModelInst.communities.createCommunityCategory(communityId, categoryName, channels);
}
function editCommunityCategory(communityId, categoryId, categoryName, channels) {
chatsModelInst.communities.editCommunityCategory(communityId, categoryId, categoryName, channels);
}
function deleteCommunityCategory(categoryId) {
chatsModelInst.communities.deleteCommunityCategory(chatsModelInst.communities.activeCommunity.id, categoryId);
}
function leaveCommunity(communityId) {
chatsModelInst.communities.leaveCommunity(communityId);
}
function setCommunityMuted(communityId, checked) {
chatsModelInst.communities.setCommunityMuted(communityId, checked);
}
function exportCommunity() {
chatsModelInst.communities.exportCommunity();
}
function createCommunityChannel(communityId, channelName, channelDescription, categoryId) {
// TODO: pass the private value when private channels
// are implemented
//privateSwitch.checked)
chatsModelInst.createCommunityChannel(communityId, channelName, channelDescription, categoryId);
}
function editCommunityChannel(communityId, channelId, channelName, channelDescription, channelCategoryId, popupPosition) {
// TODO: pass the private value when private channels
// are implemented
//privateSwitch.checked)
chatsModelInst.editCommunityChannel(communityId, channelId, channelName, channelDescription, channelCategoryId, popupPosition);
}
function acceptRequestToJoinCommunity(id) {
chatsModelInst.communities.acceptRequestToJoinCommunity(id);
}
function declineRequestToJoinCommunity(id) {
chatsModelInst.communities.declineRequestToJoinCommunity(id);
}
}

View File

@ -8,12 +8,14 @@ import "../popups"
import utils 1.0
//TODO remove dynamic scoping
Item {
property int state: Constants.addressRequested
id: root
width: parent.width
height: childrenRect.height
property var store
property int state: Constants.addressRequested
Separator {
id: separator1
@ -74,9 +76,9 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: {
if (root.state === Constants.addressRequested) {
chatsModel.transactions.declineAddressRequest(messageId)
root.store.chatsModelInst.transactions.declineAddressRequest(messageId)
} else if (root.state === Constants.transactionRequested) {
chatsModel.transactions.declineRequest(messageId)
root.store.chatsModelInst.transactions.declineRequest(messageId)
}
}
@ -94,8 +96,9 @@ Item {
Component {
id: signTxComponent
SignTransactionModal {
store: root.store
onOpened: {
walletModel.gasView.getGasPrice()
root.store.walletModelInst.gasView.getGasPrice()
}
onClosed: {
destroy();
@ -104,8 +107,8 @@ Item {
selectedRecipient: {
return {
address: commandParametersObject.address,
identicon: chatsModel.channelView.activeChannel.identicon,
name: chatsModel.channelView.activeChannel.name,
identicon: root.store.chatsModelInst.channelView.activeChannel.identicon,
name: root.store.chatsModelInst.channelView.activeChannel.name,
type: RecipientSelector.Type.Contact
}
}
@ -117,8 +120,10 @@ Item {
SelectAccountModal {
id: selectAccountModal
accounts: root.store.walletModelInst.accountsView.accounts
currency: root.store.walletModelInst.balanceView.defaultCurrency
onSelectAndShareAddressButtonClicked: {
chatsModel.transactions.acceptAddressRequest(messageId, accountSelector.selectedAccount.address)
root.store.chatsModelInst.transactions.acceptAddressRequest(messageId, accountSelector.selectedAccount.address)
selectAccountModal.close()
}
}

View File

@ -449,6 +449,7 @@ Item {
id: cmpSendTransactionNoEns
ChatCommandModal {
id: sendTransactionNoEns
store: root.rootStore
onClosed: {
txModalLoader.closed()
}
@ -477,6 +478,7 @@ Item {
id: cmpReceiveTransaction
ChatCommandModal {
id: receiveTransaction
store: root.rootStore
onClosed: {
txModalLoader.closed()
}

View File

@ -281,6 +281,7 @@ Item {
id: createChannelPopup
CreateChannelPopup {
anchors.centerIn: parent
store: root.store
pinnedMessagesPopupComponent: root.pinnedMessagesPopupComponent
onClosed: {
destroy()
@ -292,6 +293,7 @@ Item {
id: createCategoryPopup
CreateCategoryPopup {
anchors.centerIn: parent
store: root.store
onClosed: {
destroy()
}
@ -333,6 +335,7 @@ Item {
id: membershipRequestPopup
MembershipRequestsPopup {
anchors.centerIn: parent
store: root.store
onClosed: {
destroy()
}

View File

@ -279,6 +279,13 @@ Item {
Component {
id: publicChatPopupComponent
PublicChatPopup {
onJoinPublicChat: {
root.store.chatsModelInst.channelView.joinPublicChat(name);
}
onSuggestedMessageClicked: {
root.store.chatsModelInst.channelView.joinPublicChat(channel);
}
onClosed: {
destroy()
}
@ -297,6 +304,7 @@ Item {
Component {
id: privateChatPopupComponent
PrivateChatPopup {
store: root.store
onClosed: {
destroy()
}
@ -310,6 +318,13 @@ Item {
id: communitiesPopupComponent
CommunitiesPopup {
anchors.centerIn: parent
communitiesList: root.store.chatsModelInst.communities.list
onSetActiveCommunity: {
root.store.chatsModelInst.communities.setActiveCommunity(id)
}
onSetObservedCommunity: {
root.store.chatsModelInst.communities.setObservedCommunity(id)
}
onClosed: {
destroy()
}
@ -320,6 +335,7 @@ Item {
id: createCommunitiesPopupComponent
CreateCommunityPopup {
anchors.centerIn: parent
store: root.store
onClosed: {
destroy()
}
@ -329,6 +345,8 @@ Item {
Component {
id: importCommunitiesPopupComponent
AccessExistingCommunityPopup {
anchors.centerIn: parent
error: root.store.chatsModelInst.communities.importCommunity(communityKey, Utils.uuid())
onClosed: {
destroy()
}
@ -339,6 +357,7 @@ Item {
id: communityDetailPopup
CommunityDetailPopup {
anchors.centerIn: parent
store: root.store
onClosed: {
destroy()
}
@ -348,6 +367,7 @@ Item {
Component {
id: contactRequestsPopup
ContactRequestsPopup {
store: root.store
onClosed: {
destroy()
}

View File

@ -3,9 +3,9 @@ import utils 1.0
import "../../../../shared"
import "../../../../shared/panels"
import "../controls"
//TODO remove or make view
import "../views"
import "../popups"
import "../controls"
Item {
id: root
@ -203,11 +203,32 @@ Item {
type: RecipientSelector.Type.Contact
}
}
onSignModalOpened: {
root.store.walletModelInst.gasView.getGasPrice();
}
onSendTransaction: {
root.store.walletModelInst.accountsView.setFocusedAccountByAddress(fromAddress);
//TODO remove dynamic scoping
openPopup(signTxComponent, {selectedAccount: {
name: acc.name,
address: fromAddress,
iconColor: acc.iconColor,
assets: acc.assets
}})
}
}
}
Component {
id: signTxComponent
SignTransactionModal {
store: root.store
selectedAsset: root.selectedAsset
selectedAmount: root.selectedAmount
selectedRecipient: root.selectedRecipient
selectedFiatAmount: root.selectedFiatAmount
onOpened: {
root.store.walletModelInst.gasView.getGasPrice();
}
onClosed: {
destroy();
}
}
}

View File

@ -436,7 +436,9 @@ Item {
Component {
id: browserLayoutComponent
BrowserLayout { }
BrowserLayout {
globalStore: appMain.rootStore
}
}
Loader {
@ -633,6 +635,7 @@ Item {
id: inviteFriendsToCommunityPopup
InviteFriendsToCommunityPopup {
anchors.centerIn: parent
hasAddedContacts: appMain.rootStore.profileModelInst.contacts.list.hasAddedContacts()
onClosed: {
destroy()
}