mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-17 17:19:02 +00:00
UserStatusContextMenu refactored to be not dependent on stores
This commit is contained in:
parent
affaf6099f
commit
3bf415add0
@ -272,8 +272,6 @@ SettingsContentBase {
|
|||||||
Layout.leftMargin: Style.current.padding
|
Layout.leftMargin: Style.current.padding
|
||||||
Layout.rightMargin: Style.current.padding
|
Layout.rightMargin: Style.current.padding
|
||||||
|
|
||||||
store: root.profileStore
|
|
||||||
|
|
||||||
displayName: profileStore.name
|
displayName: profileStore.name
|
||||||
pubkey: profileStore.pubkey
|
pubkey: profileStore.pubkey
|
||||||
icon: profileStore.profileLargeImage
|
icon: profileStore.profileLargeImage
|
||||||
|
@ -863,9 +863,20 @@ Item {
|
|||||||
|
|
||||||
UserStatusContextMenu {
|
UserStatusContextMenu {
|
||||||
id: userStatusContextMenu
|
id: userStatusContextMenu
|
||||||
|
|
||||||
y: profileButton.y - userStatusContextMenu.height + profileButton.height
|
y: profileButton.y - userStatusContextMenu.height + profileButton.height
|
||||||
x: profileButton.x + profileButton.width + 5
|
x: profileButton.x + profileButton.width + 5
|
||||||
store: appMain.rootStore
|
|
||||||
|
pubKey: appMain.rootStore.userProfileInst.pubKey
|
||||||
|
name: appMain.rootStore.userProfileInst.name
|
||||||
|
icon: appMain.rootStore.userProfileInst.icon
|
||||||
|
isEnsVerified: !!appMain.rootStore.userProfileInst.preferredName
|
||||||
|
|
||||||
|
currentUserStatus: appMain.rootStore.userProfileInst.currentUserStatus
|
||||||
|
|
||||||
|
onViewProfileRequested: Global.openProfilePopup(pubKey)
|
||||||
|
onCopyLinkRequested: ClipboardUtils.setText(appMain.rootStore.contactStore.getLinkToProfile(pubKey))
|
||||||
|
onSetCurrentUserStatusRequested: appMain.rootStore.setCurrentUserStatus(status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ import StatusQ.Components 0.1
|
|||||||
import StatusQ.Popups 0.1
|
import StatusQ.Popups 0.1
|
||||||
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
||||||
|
|
||||||
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
@ -22,7 +20,6 @@ Item {
|
|||||||
Big
|
Big
|
||||||
}
|
}
|
||||||
|
|
||||||
property ProfileStores.ProfileStore store
|
|
||||||
property string displayName
|
property string displayName
|
||||||
property string pubkey
|
property string pubkey
|
||||||
property string icon
|
property string icon
|
||||||
@ -145,7 +142,7 @@ Item {
|
|||||||
icon.height: d.getSize(8, 12, 24)
|
icon.height: d.getSize(8, 12, 24)
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!!root.store.profileLargeImage)
|
if (!!root.icon)
|
||||||
Global.openMenu(editImageMenuComponent, this)
|
Global.openMenu(editImageMenuComponent, this)
|
||||||
else
|
else
|
||||||
Global.openChangeProfilePicPopup(tempIcon);
|
Global.openChangeProfilePicPopup(tempIcon);
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
import QtQuick 2.12
|
|
||||||
import QtQuick.Controls 2.14
|
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
import QtQml.Models 2.3
|
|
||||||
|
|
||||||
import utils 1.0
|
|
||||||
import shared.controls.chat 1.0
|
|
||||||
import shared.panels 1.0
|
|
||||||
import shared.controls.chat.menuItems 1.0
|
|
||||||
|
|
||||||
import StatusQ 0.1
|
|
||||||
import StatusQ.Components 0.1
|
|
||||||
import StatusQ.Popups 0.1
|
import StatusQ.Popups 0.1
|
||||||
|
|
||||||
import AppLayouts.stores 1.0
|
import shared.controls.chat 1.0
|
||||||
|
import shared.controls.chat.menuItems 1.0
|
||||||
|
import shared.panels 1.0
|
||||||
|
import utils 1.0
|
||||||
|
|
||||||
StatusMenu {
|
StatusMenu {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property RootStore store
|
property string pubKey
|
||||||
|
property alias name: header.displayName
|
||||||
|
property alias icon: header.icon
|
||||||
|
|
||||||
|
property alias isEnsVerified: header.userIsEnsVerified
|
||||||
|
|
||||||
|
// Constants.currentUserStatus
|
||||||
|
property int currentUserStatus
|
||||||
|
|
||||||
|
signal viewProfileRequested
|
||||||
|
signal copyLinkRequested
|
||||||
|
signal setCurrentUserStatusRequested(int status)
|
||||||
|
|
||||||
ProfileHeader {
|
ProfileHeader {
|
||||||
width: parent.width
|
id: header
|
||||||
|
|
||||||
displayName: root.store.userProfileInst.name
|
|
||||||
pubkey: root.store.userProfileInst.pubKey
|
|
||||||
icon: root.store.userProfileInst.icon
|
|
||||||
userIsEnsVerified: !!root.store.userProfileInst.preferredName
|
|
||||||
objectName: 'onlineIdentifierProfileHeader'
|
objectName: 'onlineIdentifierProfileHeader'
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
pubkey: root.pubKey
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuSeparator {
|
StatusMenuSeparator {}
|
||||||
}
|
|
||||||
|
|
||||||
ViewProfileMenuItem {
|
ViewProfileMenuItem {
|
||||||
objectName: "userStatusViewMyProfileAction"
|
objectName: "userStatusViewMyProfileAction"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Global.openProfilePopup(root.store.userProfileInst.pubKey)
|
root.viewProfileRequested()
|
||||||
root.close()
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,54 +45,50 @@ StatusMenu {
|
|||||||
text: qsTr("Copy link to profile")
|
text: qsTr("Copy link to profile")
|
||||||
icon.name: "copy"
|
icon.name: "copy"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
ClipboardUtils.setText(root.store.contactStore.getLinkToProfile(root.store.userProfileInst.pubKey))
|
root.copyLinkRequested()
|
||||||
root.close()
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuSeparator {
|
StatusMenuSeparator {}
|
||||||
}
|
|
||||||
|
|
||||||
StatusAction {
|
StatusAction {
|
||||||
id: alwaysOnlineAction
|
|
||||||
objectName: "userStatusMenuAlwaysOnlineAction"
|
objectName: "userStatusMenuAlwaysOnlineAction"
|
||||||
text: qsTr("Always online")
|
text: qsTr("Always online")
|
||||||
assetSettings.name: "statuses/online"
|
assetSettings.name: "statuses/online"
|
||||||
assetSettings.width: 12
|
assetSettings.width: 12
|
||||||
assetSettings.height: 12
|
assetSettings.height: 12
|
||||||
assetSettings.color: "transparent"
|
assetSettings.color: "transparent"
|
||||||
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.alwaysOnline
|
fontSettings.bold: root.currentUserStatus === Constants.currentUserStatus.alwaysOnline
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
store.setCurrentUserStatus(Constants.currentUserStatus.alwaysOnline)
|
root.setCurrentUserStatusRequested(Constants.currentUserStatus.alwaysOnline)
|
||||||
root.close();
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusAction {
|
StatusAction {
|
||||||
id: inactiveAction
|
|
||||||
objectName: "userStatusMenuInactiveAction"
|
objectName: "userStatusMenuInactiveAction"
|
||||||
text: qsTr("Inactive")
|
text: qsTr("Inactive")
|
||||||
assetSettings.name: "statuses/inactive"
|
assetSettings.name: "statuses/inactive"
|
||||||
assetSettings.width: 12
|
assetSettings.width: 12
|
||||||
assetSettings.height: 12
|
assetSettings.height: 12
|
||||||
assetSettings.color: "transparent"
|
assetSettings.color: "transparent"
|
||||||
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.inactive
|
fontSettings.bold: root.currentUserStatus === Constants.currentUserStatus.inactive
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
store.setCurrentUserStatus(Constants.currentUserStatus.inactive)
|
root.setCurrentUserStatusRequested(Constants.currentUserStatus.inactive)
|
||||||
root.close();
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusAction {
|
StatusAction {
|
||||||
id: automaticAction
|
|
||||||
objectName: "userStatusMenuAutomaticAction"
|
objectName: "userStatusMenuAutomaticAction"
|
||||||
text: qsTr("Set status automatically")
|
text: qsTr("Set status automatically")
|
||||||
assetSettings.name: "statuses/automatic"
|
assetSettings.name: "statuses/automatic"
|
||||||
assetSettings.color: "transparent"
|
assetSettings.color: "transparent"
|
||||||
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.automatic
|
fontSettings.bold: root.currentUserStatus === Constants.currentUserStatus.automatic
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
store.setCurrentUserStatus(Constants.currentUserStatus.automatic)
|
root.setCurrentUserStatusRequested(Constants.currentUserStatus.automatic)
|
||||||
root.close();
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user