fix(@desktop/chat): open 121 chat by pasting chat key of existing mutual contact
This commit is contained in:
parent
c801c869e6
commit
d60a4b0c97
|
@ -96,6 +96,7 @@ Item {
|
|||
|
||||
TextInput {
|
||||
id: edit
|
||||
property bool pasteOperation: false
|
||||
Layout.minimumWidth: 4
|
||||
Layout.fillHeight: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
@ -119,17 +120,13 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
onTextEdited: if (suggestionsDialog.forceHide) suggestionsDialog.forceHide = false;
|
||||
onTextEdited: if (suggestionsDialog.forceHide && !pasteOperation)
|
||||
suggestionsDialog.forceHide = false
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.matches(StandardKey.Paste)) {
|
||||
event.accepted = true
|
||||
const previousText = text;
|
||||
const previousSelectedText = selectedText;
|
||||
paste()
|
||||
if (previousText === "" || previousSelectedText.length === previousText.length)
|
||||
root.textPasted(text)
|
||||
return;
|
||||
pasteOperation = true
|
||||
root.suggestionsDialog.forceHide = true
|
||||
}
|
||||
|
||||
if (suggestionsDialog.visible) {
|
||||
|
@ -154,6 +151,17 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onReleased: {
|
||||
if (event.matches(StandardKey.Paste)) {
|
||||
event.accepted = true
|
||||
pasteOperation = false
|
||||
if (text) {
|
||||
root.textPasted(text)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ensure edit cursor is visible
|
||||
|
|
|
@ -89,30 +89,31 @@ MembersSelectorBase {
|
|||
enabled: root.visible
|
||||
target: root.rootStore.contactsStore.mainModuleInst
|
||||
onResolvedENS: {
|
||||
|
||||
if (resolvedPubKey === "")
|
||||
if (resolvedPubKey === "") {
|
||||
root.suggestionsDialog.forceHide = false
|
||||
return
|
||||
}
|
||||
|
||||
const contactDetails = Utils.getContactDetailsAsJson(resolvedPubKey, false)
|
||||
|
||||
if (contactDetails.publicKey === root.rootStore.contactsStore.myPublicKey)
|
||||
return;
|
||||
|
||||
if (contactDetails.isBlocked)
|
||||
return;
|
||||
if (contactDetails.publicKey === root.rootStore.contactsStore.myPublicKey ||
|
||||
contactDetails.isBlocked) {
|
||||
root.suggestionsDialog.forceHide = false
|
||||
return
|
||||
};
|
||||
|
||||
if (contactDetails.isContact) {
|
||||
if (d.addMember(contactDetails.publicKey, contactDetails.displayName))
|
||||
root.cleanup()
|
||||
root.rootStore.mainModuleInst.switchTo(root.rootStore.getMySectionId(), contactDetails.publicKey)
|
||||
return
|
||||
}
|
||||
|
||||
if (root.model.count === 0) {
|
||||
root.suggestionsDialog.forceHide = true
|
||||
Global.openContactRequestPopup(contactDetails.publicKey,
|
||||
popup => popup.closed.connect(root.rejected))
|
||||
return
|
||||
}
|
||||
|
||||
root.suggestionsDialog.forceHide = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue