2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2020-06-23 18:51:10 +00:00
|
|
|
import QtQuick.Controls 2.13
|
2020-06-23 20:49:04 +00:00
|
|
|
import Qt.labs.settings 1.0
|
2020-05-19 19:44:45 +00:00
|
|
|
import "../../../imports"
|
2020-06-23 18:51:10 +00:00
|
|
|
import "../../../shared"
|
2021-03-08 19:24:39 +00:00
|
|
|
import "../../../shared/status"
|
2020-05-25 20:34:26 +00:00
|
|
|
import "."
|
2020-10-02 13:02:56 +00:00
|
|
|
import "components"
|
2020-05-13 17:27:06 +00:00
|
|
|
|
2021-06-11 13:23:41 +00:00
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
|
|
|
|
StatusAppTwoPanelLayout {
|
2020-06-23 20:49:04 +00:00
|
|
|
id: chatView
|
2020-05-27 17:10:50 +00:00
|
|
|
|
2020-11-19 18:30:09 +00:00
|
|
|
property alias chatColumn: chatColumn
|
2021-03-08 19:24:39 +00:00
|
|
|
property bool stickersLoaded: false
|
fix(Chat): disable HoverHandler when profile popup or context menu are open
Alright, this is an interesting one:
As described in #1829, when the profile popup is opened within the chat view,
users are still able to click *through* the popup on message, which then puts them in
an active state.
I've done a bunch of debugging as described [here](https://github.com/status-im/status-desktop/issues/1829#issuecomment-804748148) and after doing some
further debugging, I found out that `isMessageActive` isn't really the culprit here.
What causes this effect is the `HoverHandler` that's attached to the `CompactMessage` item.
`HoverHandler` is a standard QML type that emits `hoverChanged` signals so one can do things like
applying hover effects on elements, which is exactly what we do:
```
HoverHandler {
onHoverChanged: {
root.isHovered = hovered // `root` being the message item
}
}
```
I assume we went with this handler because putting a `MouseArea` in there instead, which fills
the entire message component pretty much eliminates all existing mouse handlers attached to
other child components, such as the profile image or the username of the message, which also
open a message context menu.
It turns out that, having a `HoverHandler` as described above, actually activates it when the
user clicks with the left mouse button as well (not just on hover). That's what causes the "click-through"
effect. This can be verified by setting `acceptedButtons` to `Qt.RightButton`, basically telling
the handler that only right clicks will activate it.
I then tried using `Qt.NoButtons` instead so that no button clicks and only hovers will activate
the handler, but that didn't seem to have any effect at all. It still defaults to `Qt.LeftButton`.
So the last resort was to disable the `HoverHandler` altogether, whenever either the profile popup,
or the message context menu (for emojis etc) is open.
Unfortunately, we don't have access to the profile popup in the compact message component, because it's
detached from the component tree. Therefore, I've introduced a new property `profilePopupOpened` on
the chat layout, which we can read from instead.
Fixes #1829
2021-03-23 09:44:56 +00:00
|
|
|
property bool profilePopupOpened: false
|
2021-03-08 19:24:39 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: chatsModel.stickers
|
|
|
|
onStickerPacksLoaded: {
|
|
|
|
stickersLoaded = true;
|
|
|
|
}
|
|
|
|
}
|
2020-11-19 18:30:09 +00:00
|
|
|
|
2020-09-23 07:28:20 +00:00
|
|
|
property var onActivated: function () {
|
2021-06-17 22:09:00 +00:00
|
|
|
chatsModel.channelView.restorePreviousActiveChannel()
|
2020-09-23 07:28:20 +00:00
|
|
|
chatColumn.onActivated()
|
|
|
|
}
|
|
|
|
|
2021-06-11 13:23:41 +00:00
|
|
|
leftPanel: Loader {
|
2020-12-11 20:29:46 +00:00
|
|
|
id: contactColumnLoader
|
2021-06-11 13:23:41 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-02-11 20:37:31 +00:00
|
|
|
sourceComponent: appSettings.communitiesEnabled && chatsModel.communities.activeCommunity.active ? communtiyColumnComponent : contactsColumnComponent
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
2021-06-11 13:23:41 +00:00
|
|
|
rightPanel: ChatColumn {
|
|
|
|
id: chatColumn
|
|
|
|
anchors.fill: parent
|
|
|
|
chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Component {
|
|
|
|
id: contactsColumnComponent
|
|
|
|
ContactsColumn {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communtiyColumnComponent
|
2021-06-02 19:43:33 +00:00
|
|
|
CommunityColumn {
|
|
|
|
pinnedMessagesPopupComponent: chatColumn.pinnedMessagesPopupComponent
|
|
|
|
}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
|
|
|
|
2021-02-17 20:36:10 +00:00
|
|
|
Component {
|
|
|
|
id: groupInfoPopupComponent
|
2021-05-25 19:38:18 +00:00
|
|
|
GroupInfoPopup {
|
|
|
|
pinnedMessagesPopupComponent: chatColumn.pinnedMessagesPopupComponent
|
|
|
|
}
|
2021-02-17 20:36:10 +00:00
|
|
|
}
|
|
|
|
|
2021-03-08 19:24:39 +00:00
|
|
|
Component {
|
|
|
|
id: statusStickerPackClickPopup
|
|
|
|
StatusStickerPackClickPopup{
|
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-02 13:02:56 +00:00
|
|
|
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
|
|
|
|
var popup = profilePopupComponent.createObject(chatView);
|
|
|
|
if(parentPopup){
|
|
|
|
popup.parentPopup = parentPopup;
|
|
|
|
}
|
|
|
|
popup.openPopup(profileModel.profile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
|
fix(Chat): disable HoverHandler when profile popup or context menu are open
Alright, this is an interesting one:
As described in #1829, when the profile popup is opened within the chat view,
users are still able to click *through* the popup on message, which then puts them in
an active state.
I've done a bunch of debugging as described [here](https://github.com/status-im/status-desktop/issues/1829#issuecomment-804748148) and after doing some
further debugging, I found out that `isMessageActive` isn't really the culprit here.
What causes this effect is the `HoverHandler` that's attached to the `CompactMessage` item.
`HoverHandler` is a standard QML type that emits `hoverChanged` signals so one can do things like
applying hover effects on elements, which is exactly what we do:
```
HoverHandler {
onHoverChanged: {
root.isHovered = hovered // `root` being the message item
}
}
```
I assume we went with this handler because putting a `MouseArea` in there instead, which fills
the entire message component pretty much eliminates all existing mouse handlers attached to
other child components, such as the profile image or the username of the message, which also
open a message context menu.
It turns out that, having a `HoverHandler` as described above, actually activates it when the
user clicks with the left mouse button as well (not just on hover). That's what causes the "click-through"
effect. This can be verified by setting `acceptedButtons` to `Qt.RightButton`, basically telling
the handler that only right clicks will activate it.
I then tried using `Qt.NoButtons` instead so that no button clicks and only hovers will activate
the handler, but that didn't seem to have any effect at all. It still defaults to `Qt.LeftButton`.
So the last resort was to disable the `HoverHandler` altogether, whenever either the profile popup,
or the message context menu (for emojis etc) is open.
Unfortunately, we don't have access to the profile popup in the compact message component, because it's
detached from the component tree. Therefore, I've introduced a new property `profilePopupOpened` on
the chat layout, which we can read from instead.
Fixes #1829
2021-03-23 09:44:56 +00:00
|
|
|
profilePopupOpened = true
|
2020-10-02 13:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
property Component profilePopupComponent: ProfilePopup {
|
|
|
|
id: profilePopup
|
2021-01-12 20:51:00 +00:00
|
|
|
height: 504
|
2020-10-02 13:02:56 +00:00
|
|
|
onClosed: {
|
|
|
|
if(profilePopup.parentPopup){
|
|
|
|
profilePopup.parentPopup.close();
|
|
|
|
}
|
fix(Chat): disable HoverHandler when profile popup or context menu are open
Alright, this is an interesting one:
As described in #1829, when the profile popup is opened within the chat view,
users are still able to click *through* the popup on message, which then puts them in
an active state.
I've done a bunch of debugging as described [here](https://github.com/status-im/status-desktop/issues/1829#issuecomment-804748148) and after doing some
further debugging, I found out that `isMessageActive` isn't really the culprit here.
What causes this effect is the `HoverHandler` that's attached to the `CompactMessage` item.
`HoverHandler` is a standard QML type that emits `hoverChanged` signals so one can do things like
applying hover effects on elements, which is exactly what we do:
```
HoverHandler {
onHoverChanged: {
root.isHovered = hovered // `root` being the message item
}
}
```
I assume we went with this handler because putting a `MouseArea` in there instead, which fills
the entire message component pretty much eliminates all existing mouse handlers attached to
other child components, such as the profile image or the username of the message, which also
open a message context menu.
It turns out that, having a `HoverHandler` as described above, actually activates it when the
user clicks with the left mouse button as well (not just on hover). That's what causes the "click-through"
effect. This can be verified by setting `acceptedButtons` to `Qt.RightButton`, basically telling
the handler that only right clicks will activate it.
I then tried using `Qt.NoButtons` instead so that no button clicks and only hovers will activate
the handler, but that didn't seem to have any effect at all. It still defaults to `Qt.LeftButton`.
So the last resort was to disable the `HoverHandler` altogether, whenever either the profile popup,
or the message context menu (for emojis etc) is open.
Unfortunately, we don't have access to the profile popup in the compact message component, because it's
detached from the component tree. Therefore, I've introduced a new property `profilePopupOpened` on
the chat layout, which we can read from instead.
Fixes #1829
2021-03-23 09:44:56 +00:00
|
|
|
profilePopupOpened = false
|
2020-10-02 13:02:56 +00:00
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: removeContactConfirmationDialog
|
|
|
|
// % "Remove contact"
|
|
|
|
title: qsTrId("remove-contact")
|
|
|
|
//% "Are you sure you want to remove this contact?"
|
|
|
|
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
|
|
|
|
onConfirmButtonClicked: {
|
2020-12-06 22:15:51 +00:00
|
|
|
if (profileModel.contacts.isAdded(chatColumn.contactToRemove)) {
|
|
|
|
profileModel.contacts.removeContact(chatColumn.contactToRemove)
|
2020-10-02 13:02:56 +00:00
|
|
|
}
|
|
|
|
removeContactConfirmationDialog.parentPopup.close();
|
|
|
|
removeContactConfirmationDialog.close();
|
|
|
|
}
|
|
|
|
}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2020-05-13 17:27:06 +00:00
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-06-23 18:51:10 +00:00
|
|
|
D{i:0;formeditorColor:"#ffffff";formeditorZoom:1.25;height:770;width:1152}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
|
|
|
##^##*/
|