refactor: removed dynamic scoping from shared module

Properties and functions moved to Global:
- toastMessage
- openProfilePopup()
- getProfileImage()
- popupOpened

Closes #4248
This commit is contained in:
Alexandra Betouni 2021-12-08 23:20:43 +02:00 committed by Sale Djenic
parent 710236f51a
commit 0eb40287fa
82 changed files with 619 additions and 623 deletions

View File

@ -12,13 +12,13 @@ import shared.controls 1.0
import shared 1.0
import shared.status 1.0
import shared.popups 1.0
import "popups"
import "controls"
import "views"
import "panels"
import "stores"
import "../Chat/popups"
// Code based on https://code.qt.io/cgit/qt/qtwebengine.git/tree/examples/webengine/quicknanobrowser/BrowserWindow.qml?h=5.15
// Licensed under BSD
@ -470,10 +470,9 @@ Rectangle {
}
}
onLaunchBrowserSettings: {
Global.changeAppSectionBySectionType(Constants.appSection.profile)
// TODO: replace with shared store constant
// Profile/RootStore.browser_settings_id
profileLayoutContainer.changeProfileSection(10)
Global.changeAppSectionBySectionType(Constants.appSection.profile, 10);
}
}

View File

@ -78,8 +78,11 @@ StatusAppThreePanelLayout {
parentModule: chatCommunitySectionModule
rootStore: root.rootStore
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
stickersLoaded: root.stickersLoaded
//chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount
onOpenStickerPackPopup: {
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
}
onOpenAppSearch: {
root.openAppSearch()
}
@ -177,7 +180,7 @@ StatusAppThreePanelLayout {
id: quickActionMessageOptionsMenu
onOpenProfileClicked: {
openProfilePopup(displayName, publicKey, icon, "", displayName)
Global.openProfilePopup(displayName, publicKey, icon, "", displayName)
}
onCreateOneToOneChat: {
Global.changeAppSectionBySectionType(Constants.appSection.chat)

View File

@ -106,8 +106,7 @@ Item {
}
onClicked: {
if (mouse.button === Qt.LeftButton) {
//TODO remove dynamic scoping
openProfilePopup(wrapper.name, wrapper.publicKey, wrapper.icon, "", wrapper.name);
Global.openProfilePopup(wrapper.name, wrapper.publicKey, wrapper.identicon, "", wrapper.name);
}
else if (mouse.button === Qt.RightButton && !!messageContextMenu) {
// Set parent, X & Y positions for the messageContextMenu

View File

@ -27,7 +27,7 @@ ScrollView {
property bool isChecked: false
title: !model.name.endsWith(".eth") && !!model.localNickname ?
model.localNickname : Utils.removeStatusEns(model.name)
image.source: appMain.getProfileImage(model.pubKey) || model.identicon
image.source: Global.getProfileImage(model.pubKey) || model.identicon
image.isIdenticon: !!model.identicon
visible: {
if (selectMode) {

View File

@ -1,4 +1,5 @@
import QtQuick 2.13
import utils 1.0
Item {
id: component
@ -48,7 +49,7 @@ Item {
alias: sourceModel.rowData(i, "alias"),
userName: sourceModel.rowData(i, "userName"),
publicKey: publicKey,
identicon: getProfileImage(publicKey, false, false) || sourceModel.rowData(i, "identicon"),
identicon: Global.getProfileImage(publicKey, false, false) || sourceModel.rowData(i, "identicon"),
localName: sourceModel.rowData(i, "localName")
}
if (all || isAcceptedItem(filter, item)) {

View File

@ -127,7 +127,7 @@ Item {
id: memberItem
property string nickname: appMain.getUserNickname(model.pubKey)
property string profileImage: appMain.getProfileImage(model.pubKey) || ""
property string profileImage: Global.getProfileImage(model.pubKey) || ""
visible: !!!memberSearch.input.text ||
model.userName.toLowerCase().includes(memberSearch.input.text.toLowerCase()) ||

View File

@ -48,12 +48,12 @@ Popup {
color: Style.current.dropShadow
}
}
x: applicationWindow.width - activityCenter.width - Style.current.halfPadding
x: Global.applicationWindow.width - activityCenter.width - Style.current.halfPadding
onOpened: {
popupOpened = true
Global.popupOpened = true
}
onClosed: {
popupOpened = false
Global.popupOpened = false
}
padding: 0
@ -75,10 +75,9 @@ Popup {
}
onPreferencesClicked: {
activityCenter.close()
appMain.changeAppSection(Constants.profile)
// TODO: replace with shared store constant
// Profile/RootStore.notifications_id
profileLayoutContainer.changeProfileSection(7)
Global.changeAppSection(Constants.profile, 7);
}
onMarkAllReadClicked: {
errorText = activityCenter.store.activityCenterModuleInst.markAllActivityCenterNotificationsRead()

View File

@ -20,6 +20,7 @@ StatusModal {
property string finalButtonLabel: "Request address"
property var sendChatCommand: function () {}
property bool isRequested: false
property bool isContact: false
id: root
anchors.centerIn: parent
@ -100,6 +101,7 @@ StatusModal {
anchors.top: separator.bottom
anchors.topMargin: 10
width: stack.width
isContact: root.isContact
onSelectedRecipientChanged: {
addressRequiredValidator.address = root.isRequested ? selectFromAccount.selectedAccount.address : selectRecipient.selectedRecipient.address
}

View File

@ -225,7 +225,7 @@ StatusModal {
statusListItemTitle.font.pixelSize: 17
statusListItemTitleAside.font.pixelSize: 17
label: model.isAdmin ? qsTrId("group-chat-admin"): ""
image.source: appMain.getProfileImage(model.publicKey) || model.identicon
image.source: Global.getProfileImage(model.publicKey) || model.identicon
image.isIdenticon: model.identicon
components: [
StatusFlatRoundButton {
@ -263,8 +263,8 @@ StatusModal {
}
]
onTitleClicked: {
const userProfileImage = appMain.getProfileImage(model.publicKey)
openProfilePopup(model.userName, model.publicKey, userProfileImage || model.identicon, '', contactRow.nickname, popup)
const userProfileImage = Global.getProfileImage(model.publicKey)
Global.openProfilePopup(model.userName, model.publicKey, userProfileImage || model.identicon, '', contactRow.nickname, popup)
}
}
}

View File

@ -64,7 +64,7 @@ ModalPopup {
anchors.left: parent.left
anchors.leftMargin: 2
anchors.verticalCenter: parent.verticalCenter
source: appMain.getProfileImage(userProfile.pubKey)
source: Global.getProfileImage(userProfile.pubKey)
}
StyledText {

View File

@ -104,9 +104,9 @@ Item {
function openProfile() {
const pk = model.author
const userProfileImage = appMain.getProfileImage(pk)
const userProfileImage = Global.getProfileImage(pk)
// Not Refactored Yet
// openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
Global.openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
}
StyledTextEdit {

View File

@ -35,9 +35,9 @@ Item {
property int communityIndex: -1 //root.store.chatsModelInst.communities.joinedCommunities.getCommunityIndex(model.message.communityId)
function openProfile() {
const pk = model.author
const userProfileImage = appMain.getProfileImage(pk)
const userProfileImage = Global.getProfileImage(pk)
// Not Refactored Yet
// openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
Global.openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || utilsModel.generateIdenticon(pk))
}
Component {
@ -128,7 +128,6 @@ Item {
// contentType: model.message.contentType
// outgoingStatus: model.message.outgoingStatus
// responseTo: model.message.responseTo
// imageClick: imagePopup.openPopup.bind(imagePopup)
// messageId: model.message.messageId
// linkUrls: model.message.linkUrls
// communityId: model.message.communityId
@ -138,6 +137,7 @@ Item {
// pinnedMessage: model.message.isPinned
// activityCenterMessage: true
// read: model.read
// onImageClick: { Global.openImagePopup(image); }
// clickMessage: function (isProfileClick) {
// if (isProfileClick) {
// const pk = model.message.fromAuthor
@ -154,7 +154,6 @@ Item {
// root.store.chatsModelInst.channelView.setActiveChannel(model.message.chatId)
// positionAtMessage(model.message.messageId)
// }
// prevMessageIndex: previousNotificationIndex
// prevMsgTimestamp: previousNotificationTimestamp
// Component.onCompleted: {
@ -173,7 +172,6 @@ Item {
// messageStore.contentType = model.message.contentType;
// messageStore.outgoingStatus = model.message.outgoingStatus;
// messageStore.responseTo = model.message.responseTo;
// messageStore.imageClick = imagePopup.openPopup.bind(imagePopup);
// messageStore.messageId = model.message.messageId;
// messageStore.linkUrls = model.message.linkUrls;
// messageStore.communityId = model.message.communityId;
@ -190,7 +188,6 @@ Item {
// const userProfileImage = appMain.getProfileImage(pk)
// return openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || root.store.utilsModelInst.generateIdenticon(pk))
// }
// activityCenter.close()
// if (model.message.communityId) {
@ -253,7 +250,7 @@ Item {
// }
// return chatType
}
profileImage: realChatType === Constants.chatType.oneToOne ? appMain.getProfileImage(chatId) || "" : ""
profileImage: realChatType === Constants.chatType.oneToOne ? Global.getProfileImage(chatId) || "" : ""
// Not Refactored Yet
// channelName: root.store.chatsModelInst.getChannelNameById(badge.chatId)
// Not Refactored Yet
@ -278,7 +275,7 @@ Item {
target: root.store.allContacts
onContactChanged: {
if (pubkey === badge.chatId) {
badge.profileImage = appMain.getProfileImage(badge.chatId)
badge.profileImage = Global.getProfileImage(badge.chatId)
}
}
}

View File

@ -49,10 +49,12 @@ Item {
property string currentNotificationCommunityId
property var currentTime: 0
property var idMap: ({})
property bool stickersLoaded: false
property Timer timer: Timer { }
property var userList
signal openAppSearch()
signal openStickerPackPopup(string stickerPackId)
// Not Refactored Yet
// function hideChatInputExtendedArea () {
@ -103,9 +105,9 @@ Item {
// notificaiton bubble this part should be updated accordingly.
//
// I removed part of this function which caused app crash.
applicationWindow.show()
applicationWindow.raise()
applicationWindow.requestActivate()
Global.applicationWindow.show()
Global.applicationWindow.raise()
Global.applicationWindow.requestActivate()
}
function positionAtMessage(messageId, isSearch = false) {
@ -123,6 +125,31 @@ Item {
}
}
MessageContextMenuView {
id: contextmenu
reactionModel: root.rootStore.emojiReactionsModel
}
StatusImageModal {
id: imagePopup
onClicked: {
if (button === Qt.LeftButton) {
imagePopup.close()
} else if(button === Qt.RightButton) {
contextmenu.imageSource = imagePopup.imageSource
contextmenu.hideEmojiPicker = true
contextmenu.isRightClickOnImage = true;
contextmenu.show()
}
}
Connections {
target: Global
onOpenImagePopup: {
imagePopup.openPopup(image);
}
}
}
StackLayout {
anchors.fill: parent
currentIndex: {
@ -136,6 +163,7 @@ Item {
let myChatId = obj.chatContentModule.getMyChatId()
if(myChatId === root.activeChatId || myChatId === root.activeSubItemId)
return i
}
}
@ -148,7 +176,7 @@ Item {
}
EmptyChatPanel {
onShareChatKeyClicked: openProfilePopup(userProfile.name, userProfile.pubKey, userProfile.icon);
onShareChatKeyClicked: Global.openProfilePopup(userProfile.name, userProfile.pubKey, userProfile.icon);
}
// This is kind of a solution for applying backend refactored changes with the minimal qml changes.
@ -217,6 +245,7 @@ Item {
ChatCommandModal {
id: sendTransactionNoEns
store: root.rootStore
isContact: root.isContact
onClosed: {
txModalLoader.closed()
}
@ -247,6 +276,7 @@ Item {
ChatCommandModal {
id: receiveTransaction
store: root.rootStore
isContact: root.isContact
onClosed: {
txModalLoader.closed()
}
@ -283,6 +313,7 @@ Item {
onClosed: {
txModalLoader.closed()
}
isContact: root.isContact
selectRecipient.readOnly: true
selectRecipient.selectedRecipient: {
return {

View File

@ -268,21 +268,6 @@ ColumnLayout {
}
}
StatusImageModal {
id: imagePopup
onClicked: {
if (button === Qt.LeftButton) {
imagePopup.close()
}
else if(button === Qt.RightButton) {
contextmenu.imageSource = imagePopup.imageSource
contextmenu.hideEmojiPicker = true
contextmenu.isRightClickOnImage = true;
contextmenu.popup()
}
}
}
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true

View File

@ -56,7 +56,14 @@ StatusPopupMenu {
root.chatType === Constants.chatType.privateGroupChat
onTriggered: {
if (root.chatType === Constants.chatType.oneToOne) {
root.displayProfilePopup(root.chatId)
const userProfileImage = Global.getProfileImage(root.chatId)
return Global.openProfilePopup(
root.chatName,
root.chatId,
root.chatIcon,
"",
root.chatName
)
}
if (root.chatType === Constants.chatType.privateGroupChat) {
root.displayGroupInfoPopup(root.chatId)
@ -120,7 +127,7 @@ StatusPopupMenu {
icon.name: "edit"
enabled: root.isCommunityChat && root.isCommunityAdmin
onTriggered: {
let popup = Global.createPopup(editChannelPopup, {
let popup = Global.openPopup(editChannelPopup, {
isEdit: true,
channelName: root.chatName,
channelDescription: root.chatDescription

View File

@ -24,6 +24,7 @@ Item {
property var store
property var messageStore
property bool stickersLoaded: false
property alias chatLogView: chatLogView
property alias scrollToMessage: chatLogView.scrollToMessage
@ -32,6 +33,9 @@ Item {
property real scrollY: chatLogView.visibleArea.yPosition * chatLogView.contentHeight
property int newMessages: 0
property int countOnStartUp: 0
signal openStickerPackPopup(string stickerPackId)
ListView {
id: chatLogView
anchors.fill: parent
@ -320,6 +324,9 @@ Item {
prevMessageAsJsonObj: messageStore.getMessageByIndexAsJson(index - 1)
nextMessageIndex: index + 1
nextMessageAsJsonObj: messageStore.getMessageByIndexAsJson(index + 1)
onOpenStickerPackPopup: {
root.openStickerPackPopup(stickerPackId);
}
}
}

View File

@ -1,184 +0,0 @@
import QtQuick 2.13
import QtGraphicalEffects 1.0
import shared 1.0
import shared.panels 1.0
import shared.controls 1.0
import utils 1.0
Item {
id: root
property var store
property var messageStore
property bool longChatText: true
// Not Refactored Yet
property bool veryLongChatText: false // !!root.store ? root.store.chatsModelInst.plainText(message).length >
//Constants.limitLongChatTextCompactMode : false
property bool readMore: false
property alias textField: chatText
signal linkActivated(url link)
property alias hoveredLink: chatText.hoveredLink
property bool linkHovered: chatText.hoveredLink !== ""
z: 51
implicitHeight: visible ? (showMoreLoader.active ? childrenRect.height - 10 : chatText.height) : 0
// This function is to avoid the binding loop warning
function setWidths() {
if (longChatText) {
root.width = undefined
chatText.width = Qt.binding(function () {return root.width})
} else {
chatText.width = Qt.binding(function () {return chatText.implicitWidth})
root.width = Qt.binding(function () {return chatText.width})
}
}
Component.onCompleted: {
root.setWidths()
}
StyledTextEdit {
id: chatText
visible: !showMoreLoader.active || root.readMore
textFormat: Text.RichText
wrapMode: Text.Wrap
font.pixelSize: Style.current.primaryTextFontSize
readOnly: true
selectByMouse: true
color: Style.current.textColor
height: root.veryLongChatText && !root.readMore ? Math.min(implicitHeight, 200) : implicitHeight
clip: height < implicitHeight
onLinkActivated: {
// Not Refactored Yet
// root.linkActivated(link)
// if(link.startsWith("#")) {
// const channelName = link.substring(1);
// const foundChannelObj = root.store.chatsModelInst.getChannel(channelName);
// if (!foundChannelObj)
// {
// // Not Refactored Yet
//// root.store.chatsModelInst.channelView.joinPublicChat(channelName)
//// if(root.store.chatsModelInst.communities.activeCommunity.active)
//// {
//// root.store.chatsModelInst.channelView.joinPublicChat(channelName)
//// Global.changeAppSectionBySectionType(Constants.appSection.chat)
//// }
// return
// }
// let obj = JSON.parse(foundChannelObj)
// if(obj.chatType === -1 || obj.chatType === Constants.chatType.publicChat)
// {
// // Not Refactored Yet
//// if(root.store.chatsModelInst.communities.activeCommunity.active) {
//// root.store.chatsModelInst.channelView.joinPublicChat(channelName)
//// Global.changeAppSectionBySectionType(Constants.appSection.chat)
//// }
//// root.store.chatsModelInst.channelView.setActiveChannel(channelName);
// }
// else if(obj.communityId === root.store.chatsModelInst.communities.activeCommunity.id &&
// obj.chatType === Constants.chatType.communityChat &&
// root.store.chatsModelInst.channelView.activeChannel.id !== obj.id
// )
// {
// root.store.chatsModelInst.channelView.setActiveChannel(channelName);
// }
// return
// }
// if (link.startsWith('//')) {
// let pk = link.replace("//", "");
// const userProfileImage = appMain.getProfileImage(pk)
// openProfilePopup(root.store.userNameOrAlias(pk), pk, userProfileImage || root.store.generateIdenticon(pk))
// return;
// }
// const data = Utils.getLinkDataForStatusLinks(link)
// if (data && data.callback) {
// return data.callback()
// }
// Global.openLink(link)
}
onLinkHovered: {
cursorShape: Qt.PointingHandCursor
}
text: {
if(contentType === Constants.messageContentType.stickerType) return "";
let msg = Utils.linkifyAndXSS(message);
if(isEmoji) {
return Emoji.parse(msg, Emoji.size.middle);
} else {
if(isEdited){
let index = msg.endsWith("code>") ? msg.length : msg.length - 4
return Utils.getMessageWithStyle(Emoji.parse(msg.slice(0, index) + Constants.editLabel + msg.slice(index)), isCurrentUser, hoveredLink)
}
return Utils.getMessageWithStyle(Emoji.parse(msg), isCurrentUser, hoveredLink)
}
}
}
Loader {
id: mask
anchors.fill: chatText
active: showMoreLoader.active
visible: false
sourceComponent: LinearGradient {
start: Qt.point(0, 0)
end: Qt.point(0, chatText.height)
gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: 0.85; color: "white" }
GradientStop { position: 1; color: "transparent" }
}
}
}
Loader {
id: opMask
active: showMoreLoader.active && !root.readMore
anchors.fill: chatText
sourceComponent: OpacityMask {
source: chatText
maskSource: mask
}
}
Loader {
id: showMoreLoader
active: root.veryLongChatText
anchors.top: chatText.bottom
anchors.topMargin: - Style.current.padding
anchors.horizontalCenter: parent.horizontalCenter
sourceComponent: Component {
SVGImage {
id: emojiImage
width: 256
height: 44
fillMode: Image.PreserveAspectFit
source: Style.svg("read-more")
z: 100
rotation: root.readMore ? 180 : 0
MouseArea {
z: 101
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
root.readMore = !root.readMore
}
}
}
}
}
}

View File

@ -238,7 +238,7 @@ Item {
// let chatItem = !!channelList.statusChatListItems.model.items ?
// channelList.statusChatListItems.model.items.get(i) : null
// if (chatItem && chatItem.chatId === pubkey) {
// let profileImage = appMain.getProfileImage(pubkey)
// let profileImage = Global.getProfileImage(pubkey)
// if (!!profileImage) {
// chatItem.image.isIdenticon = false
// chatItem.image.source = profileImage
@ -455,39 +455,39 @@ Item {
// if (state === Constants.communityImported)
// {
// if (toastMessage.uuid !== communityImportingProcessId)
// if (Global.toastMessage.uuid !== communityImportingProcessId)
// return
// toastMessage.close()
// Global.toastMessage.close()
// //% "Community imported"
// toastMessage.title = qsTrId("community-imported")
// toastMessage.source = ""
// toastMessage.iconRotates = false
// toastMessage.dissapearInMs = 4000
// Global.toastMessage.title = qsTrId("community-imported")
// Global.toastMessage.source = ""
// Global.toastMessage.iconRotates = false
// Global.toastMessage.dissapearInMs = 4000
// }
// else if (state === Constants.communityImportingInProgress)
// {
// toastMessage.uuid = communityImportingProcessId
// Global.toastMessage.uuid = communityImportingProcessId
// //% "Importing community is in progress"
// toastMessage.title = qsTrId("importing-community-is-in-progress")
// toastMessage.source = Style.svg("loading")
// toastMessage.iconRotates = true
// toastMessage.dissapearInMs = -1
// Global.toastMessage.title = qsTrId("importing-community-is-in-progress")
// Global.toastMessage.source = Style.svg("loading")
// Global.toastMessage.iconRotates = true
// Global.toastMessage.dissapearInMs = -1
// }
// else if (state === Constants.communityImportingError)
// {
// if (toastMessage.uuid !== communityImportingProcessId)
// if (Global.toastMessage.uuid !== communityImportingProcessId)
// return
// toastMessage.close()
// Global.toastMessage.close()
// return
// }
// toastMessage.displayCloseButton = false
// toastMessage.displayLink = false
// toastMessage.iconColor = Style.current.primary
// toastMessage.open()
// Global.toastMessage.displayCloseButton = false
// Global.toastMessage.displayLink = false
// Global.toastMessage.iconColor = Style.current.primary
// Global.toastMessage.open()
// }
// }
}

View File

@ -159,14 +159,14 @@ ModalPopup {
onClicked: {
if (storingPasswordModal)
{
applicationWindow.prepareForStoring(repeatPasswordField.text, true)
Global.applicationWindow.prepareForStoring(repeatPasswordField.text, true)
popup.close()
}
else
{
loading = true
onboardingModule.storeSelectedAccountAndLogin(repeatPasswordField.text);
applicationWindow.prepareForStoring(repeatPasswordField.text, false)
Global.applicationWindow.prepareForStoring(repeatPasswordField.text, false)
}
}
}

View File

@ -31,7 +31,7 @@ Item {
loading = true
LoginStore.login(password)
applicationWindow.prepareForStoring(password, false)
Global.applicationWindow.prepareForStoring(password, false)
txtPassword.textField.clear()
}

View File

@ -14,12 +14,9 @@ import StatusQ.Layout 0.1
StatusAppTwoPanelLayout {
id: profileView
property alias changeProfileSection: leftTab.changeProfileSection
property RootStore store: RootStore { }
property var globalStore
property var systemPalette
property bool networkGuarded: false
QtObject {
id: _internal
@ -61,7 +58,6 @@ StatusAppTwoPanelLayout {
id: ensContainer
store: profileView.store
messageStore: profileView.globalStore.messageStore
networkGuarded: profileView.networkGuarded
profileContentWidth: _internal.profileContentWidth
}
@ -120,10 +116,3 @@ StatusAppTwoPanelLayout {
}
}
}

View File

@ -13,7 +13,6 @@ Item {
property var store
property var messageStore
property bool networkGuarded: false
property int profileContentWidth
property bool showSearchScreen: false
property string addedUsername: ""
@ -28,7 +27,7 @@ Item {
signal goToList();
function goToStart(){
if(ensView.store.ens.rowCount() > 0 && networkGuarded){
if(ensView.store.ens.rowCount() > 0 && Global.networkGuarded){
goToList();
} else {
goToWelcome();
@ -214,7 +213,6 @@ Item {
EnsWelcomeView {
username: ensView.store.username
onStartBtnClicked: next(null)
networkGuarded: ensView.networkGuarded
profileContentWidth: ensView.profileContentWidth
}
}
@ -319,17 +317,17 @@ Item {
target: ensView.store.ens
onTransactionWasSent: {
//% "Transaction pending..."
toastMessage.title = qsTrId("ens-transaction-pending")
toastMessage.source = Style.svg("loading")
toastMessage.iconColor = Style.current.primary
toastMessage.iconRotates = true
toastMessage.link = `${ensView.store.etherscanLink}/${txResult}`
toastMessage.open()
Global.toastMessage.title = qsTrId("ens-transaction-pending")
Global.toastMessage.source = Style.svg("loading")
Global.toastMessage.iconColor = Style.current.primary
Global.toastMessage.iconRotates = true
Global.toastMessage.link = `${root.store.etherscanLink}/${txResult}`
Global.toastMessage.open()
}
onTransactionCompleted: {
switch(trxType){
case "RegisterENS":
toastMessage.title = !success ?
Global.toastMessage.title = !success ?
//% "ENS Registration failed"
qsTrId("ens-registration-failed")
:
@ -337,7 +335,7 @@ Item {
qsTrId("ens-registration-completed");
break;
case "SetPubKey":
toastMessage.title = !success ?
Global.toastMessage.title = !success ?
//% "Updating ENS pubkey failed"
qsTrId("updating-ens-pubkey-failed")
:
@ -347,15 +345,14 @@ Item {
}
if (success) {
toastMessage.source = Style.svg("check-circle")
toastMessage.iconColor = Style.current.success
Global.toastMessage.source = Style.svg("check-circle")
Global.toastMessage.iconColor = Style.current.success
} else {
toastMessage.source = Style.svg("block-icon")
toastMessage.iconColor = Style.current.danger
Global.toastMessage.source = Style.svg("block-icon")
Global.toastMessage.iconColor = Style.current.danger
}
toastMessage.link = `${ensView.store.etherscanLink}/${txHash}`
toastMessage.open()
Global.toastMessage.link = `${root.store.etherscanLink}/${txHash}`
Global.toastMessage.open()
}
}
}

View File

@ -15,7 +15,6 @@ Item {
property string username: ""
property int profileContentWidth
property bool networkGuarded: false
ScrollView {
id: sview
@ -298,7 +297,7 @@ Item {
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding
anchors.horizontalCenter: parent.horizontalCenter
enabled: networkGuarded
enabled: Global.networkGuarded
//% "Start"
text: enabled ?
qsTrId("start") :

View File

@ -11,10 +11,6 @@ Item {
property var store
property var changeProfileSection: function (sectionId) {
Global.currentMenuTab = sectionId
}
StatusNavigationPanelHeadline {
id: title
text: qsTr("Settings")

View File

@ -29,6 +29,8 @@ QtObject {
property var contactsModuleInst: contactsModule
property var addedContacts: contactsModuleInst.model.addedContacts
property real volume: !!localAccountSensitiveSettings ? localAccountSensitiveSettings.volume : 0.0
property bool notificationSoundsEnabled: !!localAccountSensitiveSettings ? localAccountSensitiveSettings.notificationSoundsEnabled : false
function setCommunityMuted(communityId, checked) {
// Not Refactored Yet

View File

@ -43,9 +43,6 @@ Item {
return {}
}
}
property bool profilePopupOpened: false
// Not Refactored Yet
// property bool networkGuarded: profileModel.network.current === Constants.networkMainnet || (profileModel.network.current === Constants.networkRopsten && localAccountSensitiveSettings.stickersEnsRopsten)
signal openContactsPopup()
@ -67,32 +64,20 @@ Item {
popup.open()
return popup
}
onOpenProfilePopupRequested: {
var popup = profilePopupComponent.createObject(appMain);
if (parentPopup){
popup.parentPopup = parentPopup;
}
popup.openPopup(userProfile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
Global.profilePopupOpened = true;
}
}
function changeAppSectionBySectionId(sectionId) {
mainModule.setActiveSectionById(sectionId)
}
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
if (isCurrentUser || (isCurrentUser === undefined && pubkey === userProfile.pubKey)) {
return userProfile.icon
}
const index = appMain.rootStore.contactsModuleInst.model.list.getContactIndexByPubkey(pubkey)
if (index === -1) {
return
}
if (localAccountSensitiveSettings.onlyShowContactsProfilePics) {
const isContact = appMain.rootStore.contactsModuleInst.model.list.rowData(index, "isContact")
if (isContact === "false") {
return
}
}
return appMain.rootStore.contactsModuleInst.model.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
}
function getContactListObject(dataModel) {
const nbContacts = appMain.rootStore.contactsModuleInst.model.list.rowCount()
const contacts = []
@ -133,27 +118,6 @@ Item {
return ""
}
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
var popup = profilePopupComponent.createObject(appMain);
if(parentPopup){
popup.parentPopup = parentPopup;
}
popup.openPopup(userProfile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
profilePopupOpened = true
}
property Component profilePopupComponent: ProfilePopup {
id: profilePopup
store: rootStore
onClosed: {
if(profilePopup.parentPopup){
profilePopup.parentPopup.close();
}
profilePopupOpened = false
destroy()
}
}
Component {
id: downloadModalComponent
DownloadModal {
@ -163,13 +127,27 @@ Item {
}
}
property Component profilePopupComponent: ProfilePopup {
id: profilePopup
store: appMain.rootStore
onClosed: {
if (profilePopup.parentPopup) {
profilePopup.parentPopup.close();
}
Global.profilePopupOpened = false;
destroy();
}
}
Audio {
id: sendMessageSound
store: rootStore
track: "send_message.wav"
}
Audio {
id: notificationSound
store: rootStore
track: "notification.wav"
}
@ -472,11 +450,11 @@ Item {
// Loaders do not have access to the context, so props need to be set
// Adding a "_" to avoid a binding loop
// Not Refactored Yet
// property var _chatsModel: chatsModel.messageView
// property var _chatsModel: chatsModel.messageView
// Not Refactored Yet
// property var _walletModel: walletModel
// property var _walletModel: walletModel
// Not Refactored Yet
// property var _utilsModel: utilsModel
// property var _utilsModel: utilsModel
property var _web3Provider: web3Provider
}
@ -487,7 +465,6 @@ Item {
Layout.fillHeight: true
globalStore: appMain.rootStore
systemPalette: appMain.sysPalette
networkGuarded: appMain.networkGuarded
}
NodeLayout {
@ -504,7 +481,7 @@ Item {
Layout.fillHeight: true
}
Repeater{
Repeater {
model: mainModule.sectionsModel
delegate: DelegateChooser {
@ -544,7 +521,7 @@ Item {
// Connections {
// target: chatsModel
// onNotificationClicked: {
// applicationWindow.makeStatusAppActive()
// Global.applicationWindow.makeStatusAppActive()
// switch(notificationType){
// case Constants.osNotificationType.newContactRequest:
@ -575,6 +552,11 @@ Item {
// mnemonicModule.remove()
// }
// }
// Global.settingsLoaded()
// }
// }
Connections {
target: appMain.rootStore.contactsModuleInst.model
@ -686,6 +668,9 @@ Item {
ToastMessage {
id: toastMessage
Component.onCompleted: {
Global.toastMessage = this;
}
}
// Add SendModal here as it is used by the Wallet as well as the Browser
@ -845,7 +830,6 @@ Item {
// } catch (e) {
// console.error('Could not parse the whitelist for sites', e)
// }
Global.settingsHasLoaded()
Global.appRootComponent = appMain
Global.settingsHasLoaded();
}
}

View File

@ -124,8 +124,8 @@ Item {
onResultItemTitleClicked: {
// Not Refactored
//const pk = titleId
//const userProfileImage = appMain.getProfileImage(pk)
//return openProfilePopup(root.rootStore.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || root.rootStore.utilsModelInst.generateIdenticon(pk))
//const userProfileImage = Global.getProfileImage(pk)
//return Global.openProfilePopup(root.rootStore.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || root.rootStore.utilsModelInst.generateIdenticon(pk))
}
}
}

View File

@ -30,9 +30,9 @@ MouseArea {
radius: width / 2
antialiasing: true
color: closeSensor.pressed ? "#B24F47" : (applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#E9685C", 1.07)
color: closeSensor.pressed ? "#B24F47" : (Global.applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#E9685C", 1.07)
: inactive )
border.color:closeSensor.pressed ? "#943229" : (applicationWindow.active ? "#D14C40"
border.color:closeSensor.pressed ? "#943229" : (Global.applicationWindow.active ? "#D14C40"
: inactiveBorder)
border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0
@ -58,9 +58,9 @@ MouseArea {
radius: width / 2
antialiasing: true
color: miniSensor.pressed ? "#878E3B" : (applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#EDB84C", 1.07)
color: miniSensor.pressed ? "#878E3B" : (Global.applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#EDB84C", 1.07)
: inactive)
border.color:miniSensor.pressed ? "#986E29" : (applicationWindow.active ? "#D79F3D"
border.color:miniSensor.pressed ? "#986E29" : (Global.applicationWindow.active ? "#D79F3D"
: inactiveBorder)
border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0
@ -86,9 +86,9 @@ MouseArea {
radius: width / 2
antialiasing: true
color: maxiSensor.pressed ? "#48943f" : (applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#62C454", 1.06)
color: maxiSensor.pressed ? "#48943f" : (Global.applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#62C454", 1.06)
: inactive)
border.color: maxiSensor.pressed ? "#357225" : (applicationWindow.active ? "#53A73E"
border.color: maxiSensor.pressed ? "#357225" : (Global.applicationWindow.active ? "#53A73E"
: inactiveBorder)
border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import utils 1.0
import shared.stores 1.0
import StatusQ.Controls 0.1
@ -12,6 +13,7 @@ import "../panels"
import "."
Item {
id: root
//% "Insufficient balance"
property string balanceErrorMessage: qsTrId("insufficient-balance")
//% "Must be greater than or equal to 0"
@ -34,8 +36,6 @@ Item {
property string validationError
property var formattedInputValue
id: root
height: inputAmount.height + (inputAmount.validationError ? -16 - inputAmount.validationErrorTopMargin : 0) + txtFiatBalance.height + txtFiatBalance.anchors.topMargin
anchors.right: parent.right
anchors.left: parent.left
@ -74,12 +74,12 @@ Item {
}
onSelectedAccountChanged: {
selectAsset.assets = Qt.binding(function() {
selectAsset.assets = Qt.binding(function() {
if (selectedAccount) {
return selectedAccount.assets
}
})
txtBalance.text = Qt.binding(function() {
txtBalance.text = Qt.binding(function() {
return selectAsset.selectedAsset ? Utils.stripTrailingZeros(selectAsset.selectedAsset.value) : ""
})
}
@ -177,7 +177,7 @@ Item {
anchors.rightMargin: Style.current.smallPadding
defaultToken: Style.png("tokens/DEFAULT-TOKEN@3x")
getCurrencyBalanceString: function (currencyBalance) {
return Utils.toLocaleString(currencyBalance.toFixed(2), localAppSettings.locale, {"currency": true}) + " " + root.currentCurrency.toUpperCase()
return Utils.toLocaleString(currencyBalance.toFixed(2), RootStore.locale, {"currency": true}) + " " + root.currentCurrency.toUpperCase()
}
tokenAssetSourceFn: function (symbol) {
return symbol ? Style.png("tokens/" + symbol) : defaultToken

View File

@ -31,6 +31,7 @@ Item {
property string selectAContact: qsTrId("select-a-contact")
//% "Contact does not have an ENS address. Please send a transaction in chat."
property string noEnsAddressMessage: qsTrId("contact-does-not-have-an-ens-address--please-send-a-transaction-in-chat-")
property bool isContact: false
function resolveEns() {
if (selectedContact.ensVerified) {

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import shared.stores 1.0
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
@ -38,7 +39,7 @@ Item {
searchResults.loading = true
searchResults.showProfileNotFoundMessage = false
// Not Refactored Yet
// chatsModel.ensView.resolveENS(ensName)
//RootStore.chatsModelInst.ensView.resolveENS(ensName)
});
function validate() {
@ -46,7 +47,7 @@ Item {
root.validationError = qsTr("Enter a valid chat key or ENS username");
pubKey = ""
ensUsername = "";
} else if (userProfile.pubKey === chatKey.text) {
} else if (RootStore.userProfileInst.pubKey === chatKey.text) {
//% "Can't chat with yourself"
root.validationError = qsTrId("can-t-chat-with-yourself");
} else {
@ -74,7 +75,7 @@ Item {
if (Utils.isChatKey(chatKey.text)) {
pubKey = chatKey.text;
if (!contactsModule.model.isAdded(pubKey)) {
if (!RootStore.contactsModuleInst.model.isAdded(pubKey)) {
// Not Refactored Yet
// searchResults.username = utilsModel.generateAlias(pubKey);
searchResults.userAlias = Utils.compactAddress(pubKey, 4);
@ -93,7 +94,7 @@ Item {
// Not Refactored Yet
// Connections {
// target: chatsModel.ensView
// target: RootStore.chatsModelInst.ensView
// onEnsWasResolved: {
// if (chatKey.text == "") {
// ensUsername.text = "";
@ -187,7 +188,7 @@ Item {
}
root.pubKeys = pubKeysCopy
userClicked(true, contact.pubKey, contactsModule.model.addedContacts.userName(contact.pubKey, contact.name), contact.address)
userClicked(true, contact.pubKey, RootStore.contactsModuleInst.model.addedContacts.userName(contact.pubKey, contact.name), contact.address)
}
expanded: !searchResults.loading && pubKey === "" && !searchResults.showProfileNotFoundMessage
}
@ -207,7 +208,7 @@ Item {
}
userClicked(false, pubKey, chatKey.text, searchResults.address)
}
onAddToContactsButtonClicked: contactsModule.addContact(pubKey)
onAddToContactsButtonClicked: RootStore.contactsModuleInst.addContact(pubKey)
}
NoFriendsRectangle {

View File

@ -4,6 +4,7 @@ import QtGraphicalEffects 1.13
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0
import shared.stores 1.0
import "./"
import "../"
@ -58,7 +59,7 @@ Rectangle {
onClicked: {
if (textToCopy) {
// Not Refactored Yet
// chatsModel.copyToClipboard(textToCopy)
//RootStore.copyToClipboard(textToCopy)
}
onClick()
}

View File

@ -14,6 +14,7 @@ Item {
id: root
property var accounts
property var contacts
property int currentIndex
property int inputWidth: 272
property int sourceSelectWidth: 136
property alias label: txtLabel.text
@ -21,6 +22,7 @@ Item {
property alias additionalInfo: txtAddlInfo.text
property var selectedRecipient
property bool readOnly: false
property bool isContact: false
height: inpAddress.height + txtLabel.height
//% "Invalid ethereum address"
readonly property string addressValidationError: qsTrId("invalid-ethereum-address")
@ -171,6 +173,7 @@ Item {
width: root.inputWidth
dropdownWidth: parent.width
readOnly: root.readOnly
isContact: root.isContact
Layout.preferredWidth: selAddressSource.visible ? root.inputWidth : parent.width
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true

View File

@ -3,6 +3,7 @@ import QtQuick 2.13
import StatusQ.Components 0.1
import shared.panels 1.0
import shared.stores 1.0
import utils 1.0
Item {
@ -72,7 +73,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
color: Style.current.secondaryText
//% "before %1"
text: qsTrId("before--1").arg((nextMessageIndex > -1 ? new Date(nextMsgTimestamp * 1) : new Date()).toLocaleString(Qt.locale(localAppSettings.locale)))
text: qsTrId("before--1").arg((nextMessageIndex > -1 ? new Date(nextMsgTimestamp * 1) : new Date()).toLocaleString(Qt.locale(RootStore.locale)))
}
Separator {
anchors.top: fetchDate.bottom

View File

@ -37,7 +37,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
color: Style.current.secondaryText
text: qsTrId("between--1-and--2").arg(new Date(root.gapFrom * 1000)).arg(new Date(root.gapTo * 1000))
text: qsTrId("between--1-and--2").arg(new Date(gapFrom * 1000)).arg(new Date(gapTo * 1000))
}
Separator {
anchors.top: fetchDate.bottom

View File

@ -7,14 +7,16 @@ MouseArea {
id: mouseArea
z: 50
enabled: !placeholderMessage
//TODO remove dynamic scoping
// property bool isHovered: false
// property bool isSticker: false
// property bool placeholderMessage: false
// property var isMessageActive
property bool isHovered: false
property bool stickersLoaded: false
property bool isMessageActive
property bool isActivityCenterMessage: false
property var messageContextMenu
property var messageContextMenuParent
signal openStickerPackPopup()
signal setMessageActive(string messageId, bool active)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage)
@ -30,7 +32,7 @@ MouseArea {
if (mouse.button === Qt.RightButton) {
if (!!mouseArea.messageContextMenu) {
// Set parent, X & Y positions for the messageContextMenu
messageContextMenu.parent = root
messageContextMenu.parent = messageContextMenuParent;
messageContextMenu.setXPosition = function() { return (mouse.x)};
messageContextMenu.setYPosition = function() { return (mouse.y)};
}
@ -44,8 +46,7 @@ MouseArea {
if (isHovered) {
isHovered = false;
}
//TODO remove dynamic scoping
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
openStickerPackPopup();
return;
}
}

View File

@ -8,8 +8,10 @@ import StatusQ.Popups 0.1
import shared 1.0
import shared.controls 1.0
import shared.stores 1.0
import utils 1.0 as Imports
StatusModal {
property bool pinFieldValid: false
property bool submitted: false
@ -62,7 +64,7 @@ StatusModal {
onClicked: {
submitted = true
// Not Refactored Yet
// keycardModel.authenticate(pinField.text)
RootStore.keycardModelInst.authenticate(pinField.text)
popup.close()
}
}

View File

@ -6,6 +6,7 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import shared.controls 1.0
import shared.stores 1.0
StatusModal {
property bool pairingPasswordFieldValid: false
@ -59,7 +60,7 @@ StatusModal {
onClicked: {
submitted = true
// Not Refactored Yet
// keycardModel.pair(pairingPasswordField.text)
RootStore.keycardModelInst.pair(pairingPasswordField.text)
popup.close()
}
}

View File

@ -4,6 +4,7 @@ import QtGraphicalEffects 1.13
import StatusQ.Components 0.1
import utils 1.0
import shared.stores 1.0
import "./"
Rectangle {
@ -52,7 +53,7 @@ Rectangle {
]
// Connections {
// target: chatsModel
// target: RootStore.chatsModelInst
// onOnlineStatusChanged: {
// if (connected && root.state !== "ready" &&
// root.visible &&

View File

@ -83,7 +83,7 @@ Item {
onVisibleChanged: {
if (visible) {
timer.running = true
if (applicationWindow.active) {
if (Global.applicationWindow.active) {
this.flags |= Qt.Popup
} else {
this.flags = Qt.FramelessWindowHint | Qt.WA_ShowWithoutActivating

View File

@ -2,6 +2,7 @@ import QtQuick 2.3
import QtMultimedia 5.14
import shared 1.0
import shared.panels 1.0
import shared.stores 1.0
import utils 1.0
@ -14,6 +15,7 @@ Item {
Audio {
id: audioMessage
source: audioSource
store: RootStore
notifyInterval: 150
}

View File

@ -10,12 +10,15 @@ Rectangle {
property bool parentIsHovered: false
property int containerMargin: 2
property int contentType: 2
property bool isCurrentUser: false
property bool isMessageActive: false
property var messageContextMenu
property bool showMoreButton: true
property bool activityCenterMsg
property bool placeholderMsg
property string fromAuthor
property alias editBtnActive: editBtn.active
signal replyClicked()
signal hoverChanged(bool hovered)
signal setMessageActive(string messageId, bool active)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker)
@ -93,7 +96,7 @@ Rectangle {
tooltip.text: qsTrId("message-reply")
onClicked: {
SelectedMessage.set(messageId, fromAuthor);
showReplyArea()
buttonsContainer.replyClicked();
if (messageContextMenu.closeParentPopup) {
messageContextMenu.closeParentPopup()
}

View File

@ -11,7 +11,6 @@ import shared.controls.chat 1.0
Loader {
id: root
property bool amISenderOfTheRepliedMessage
property int repliedMessageContentType
property string repliedMessageSenderIcon
@ -20,7 +19,7 @@ Loader {
property string repliedMessageSender
property string repliedMessageContent
property string repliedMessageImage
property bool isCurrentUser: false
property int nameMargin: 6
property int textFieldWidth: item ? item.textField.width : 0
property int textFieldImplicitWidth: 0

View File

@ -1,6 +1,7 @@
import QtQuick 2.14
import shared 1.0
import shared.panels 1.0
import shared.stores 1.0
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0
@ -14,7 +15,7 @@ StyledText {
StatusQ.StatusToolTip {
visible: hhandler.hovered
text: new Date(parseInt(chatTime.timestamp, 10)).toLocaleString(Qt.locale(localAppSettings.locale))
text: new Date(parseInt(chatTime.timestamp, 10)).toLocaleString(Qt.locale(RootStore.locale))
maxWidth: 350
}

View File

@ -4,6 +4,7 @@ import QtGraphicalEffects 1.13
import utils 1.0
import shared.popups 1.0
import shared.stores 1.0
import StatusQ.Controls 0.1
@ -47,7 +48,7 @@ Popup {
text: qsTrId("send-transaction")
icon.color: Style.current.purple
icon.name: "send"
onClicked: localAccountSensitiveSettings.isWalletEnabled ? root.sendTransactionCommandButtonClicked() : sendConfirmationPopup.open()
onClicked: RootStore.isWalletEnabled ? root.sendTransactionCommandButtonClicked() : sendConfirmationPopup.open()
}
@ -57,7 +58,7 @@ Popup {
icon.color: Style.current.orange
icon.name: "send"
icon.rotation: 180
onClicked: localAccountSensitiveSettings.isWalletEnabled ? root.receiveTransactionCommandButtonClicked() : receiveConfirmationPopup.open()
onClicked: RootStore.isWalletEnabled ? root.receiveTransactionCommandButtonClicked() : receiveConfirmationPopup.open()
}
ConfirmationDialog {
@ -66,7 +67,7 @@ Popup {
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
confirmButtonLabel: qsTr("I understand")
onConfirmButtonClicked: {
localAccountSensitiveSettings.isWalletEnabled = true
RootStore.enableWallet();
close()
root.sendTransactionCommandButtonClicked()
}
@ -82,7 +83,7 @@ Popup {
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
confirmButtonLabel: qsTr("I understand")
onConfirmButtonClicked: {
localAccountSensitiveSettings.isWalletEnabled = true
RootStore.enableWallet();
close()
root.receiveTransactionCommandButtonClicked()
}

View File

@ -34,10 +34,10 @@ Popup {
radius: 8
}
onOpened: {
popupOpened = true
Global.popupOpened = true
}
onClosed: {
popupOpened = false
Global.popupOpened = false
}
padding: 0
contentItem: Item {

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3
import utils 1.0
import shared.stores 1.0
import StatusQ.Controls 0.1
@ -19,6 +20,7 @@ ModalPopup {
property alias selectRecipient: selectRecipient
property alias stack: stack
property var store
property bool isContact: false
//% "Send"
title: qsTrId("command-button-send")
@ -33,32 +35,32 @@ ModalPopup {
}
function sendTransaction() {
// Not Refactored Yet
// Not Refactored Yet
// stack.currentGroup.isPending = true
// let success = false
// if(txtAmount.selectedAsset.address === "" || txtAmount.selectedAsset.address === Constants.zeroAddress){
// success = walletModel.transactionsView.transferEth(
// selectFromAccount.selectedAccount.address,
// selectRecipient.selectedRecipient.address,
// txtAmount.selectedAmount,
// gasSelector.selectedGasLimit,
// gasSelector.eip1599Enabled ? "" : gasSelector.selectedGasPrice,
// gasSelector.selectedTipLimit,
// gasSelector.selectedOverallLimit,
// transactionSigner.enteredPassword,
// stack.uuid)
// success = RootStore.transferEth(
// selectFromAccount.selectedAccount.address,
// selectRecipient.selectedRecipient.address,
// txtAmount.selectedAmount,
// gasSelector.selectedGasLimit,
// gasSelector.eip1599Enabled ? "" : gasSelector.selectedGasPrice,
// gasSelector.selectedTipLimit,
// gasSelector.selectedOverallLimit,
// transactionSigner.enteredPassword,
// stack.uuid)
// } else {
// success = walletModel.transactionsView.transferTokens(
// selectFromAccount.selectedAccount.address,
// selectRecipient.selectedRecipient.address,
// txtAmount.selectedAsset.address,
// txtAmount.selectedAmount,
// gasSelector.selectedGasLimit,
// gasSelector.eip1599Enabled ? "" : gasSelector.selectedGasPrice,
// gasSelector.selectedTipLimit,
// gasSelector.selectedOverallLimit,
// transactionSigner.enteredPassword,
// stack.uuid)
// success = RootStore.transferTokens(
// selectFromAccount.selectedAccount.address,
// selectRecipient.selectedRecipient.address,
// txtAmount.selectedAsset.address,
// txtAmount.selectedAmount,
// gasSelector.selectedGasLimit,
// gasSelector.eip1599Enabled ? "" : gasSelector.selectedGasPrice,
// gasSelector.selectedTipLimit,
// gasSelector.selectedOverallLimit,
// transactionSigner.enteredPassword,
// stack.uuid)
// }
// if(!success){
@ -95,7 +97,7 @@ ModalPopup {
return null
}
// Not Refactored Yet
// currency: walletModel.balanceView.defaultCurrency
// currency: RootStore.defaultCurrency
width: stack.width
//% "From account"
label: qsTrId("from-account")
@ -110,11 +112,13 @@ ModalPopup {
id: selectRecipient
accounts: root.store.accounts
contacts: root.store.addedContacts
currentIndex: index
//% "Recipient"
label: qsTrId("recipient")
anchors.top: separator.bottom
anchors.topMargin: 10
width: stack.width
isContact: root.isContact
onSelectedRecipientChanged: if (isValid) { gasSelector.estimateGas() }
}
}
@ -129,11 +133,11 @@ ModalPopup {
id: txtAmount
selectedAccount: selectFromAccount.selectedAccount
// Not Refactored Yet
// defaultCurrency: walletModel.balanceView.defaultCurrency
currentCurrency: walletSection.currentCurrency
// defaultCurrency: RootStore.defaultCurrency
// Not Refactored Yet
// getFiatValue: walletModel.balanceView.getFiatValue
// getCryptoValue: walletModel.balanceView.getCryptoValue
currentCurrency: RootStore.currentCurrency
// getFiatValue: RootStore.fiatValue
// getCryptoValue: RootStore.cryptoValue
width: stack.width
onSelectedAssetChanged: if (isValid) { gasSelector.estimateGas() }
onSelectedAmountChanged: if (isValid) { gasSelector.estimateGas() }
@ -143,19 +147,19 @@ ModalPopup {
anchors.top: txtAmount.bottom
anchors.topMargin: Style.current.padding
// Not Refactored Yet
// gasPrice: parseFloat(walletModel.gasView.gasPrice)
// getGasEthValue: walletModel.gasView.getGasEthValue
// getFiatValue: walletModel.balanceView.getFiatValue
// defaultCurrency: walletModel.balanceView.defaultCurrency
// gasPrice: parseFloat(RootStore.gasPrice)
// getGasEthValue: RootStore.gasEthValue
// getFiatValue: RootStore.fiatValue
// defaultCurrency: RootStore.defaultCurrency
width: stack.width
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
// Not Refactored Yet
// Not Refactored Yet
// if (!(selectFromAccount.selectedAccount && selectFromAccount.selectedAccount.address &&
// selectRecipient.selectedRecipient && selectRecipient.selectedRecipient.address &&
// txtAmount.selectedAsset && txtAmount.selectedAsset.address &&
// txtAmount.selectedAmount)) return
// let gasEstimate = JSON.parse(walletModel.gasView.estimateGas(
// selectFromAccount.selectedAccount.address,
// selectRecipient.selectedRecipient.address,
@ -220,8 +224,8 @@ ModalPopup {
TransactionSigner {
id: transactionSigner
width: stack.width
// Not Refactored Yet
// signingPhrase: walletModel.utilsView.signingPhrase
// Not Refactored Yet
// signingPhrase: RootStore.signingPhrase
}
}
}
@ -246,7 +250,7 @@ ModalPopup {
Component {
id: transactionSettingsConfirmationPopupComponent
TransactionSettingsConfirmationPopup {
}
}
@ -291,13 +295,13 @@ ModalPopup {
// Not Refactored Yet
// Connections {
// target: walletModel.transactionsView
// target: RootStore.walletModelInst.transactionsView
// onTransactionWasSent: {
// try {
// let response = JSON.parse(txResult)
// if (response.uuid !== stack.uuid) return
// stack.currentGroup.isPending = false
// if (!response.success) {
@ -310,13 +314,14 @@ ModalPopup {
// return sendingError.open()
// }
// //% "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}/${response.result}`
// toastMessage.open()
//% "Transaction pending..."
// Global.toastMessage.title = qsTrId("ens-transaction-pending")
// Global.toastMessage.source = Style.svg("loading")
// Global.toastMessage.iconColor = Style.current.primary
// Global.toastMessage.iconRotates = true
// Global.toastMessage.link = `${walletModel.utilsView.etherscanLink}/${response.result}`
// Global.toastMessage.open()
// root.close()
// } catch (e) {
// console.error('Error parsing the response', e)
@ -325,17 +330,17 @@ ModalPopup {
// onTransactionCompleted: {
// if (success) {
// //% "Transaction completed"
// toastMessage.title = qsTrId("transaction-completed")
// toastMessage.source = Style.svg("check-circle")
// toastMessage.iconColor = Style.current.success
// Global.toastMessage.title = qsTrId("transaction-completed")
// Global.toastMessage.source = Style.svg("check-circle")
// Global.toastMessage.iconColor = Style.current.success
// } else {
// //% "Transaction failed"
// toastMessage.title = qsTrId("ens-registration-failed-title")
// toastMessage.source = Style.svg("block-icon")
// toastMessage.iconColor = Style.current.danger
// Global.toastMessage.title = qsTrId("ens-registration-failed-title")
// Global.toastMessage.source = Style.svg("block-icon")
// Global.toastMessage.iconColor = Style.current.danger
// }
// toastMessage.link = `${walletModel.utilsView.etherscanLink}/${txHash}`
// toastMessage.open()
// Global.toastMessage.link = `${walletModel.utilsView.etherscanLink}/${txHash}`
// Global.toastMessage.open()
// }
// }
}

View File

@ -14,7 +14,6 @@ import shared.panels 1.0
import shared.popups 1.0
import "../../../app/AppLayouts/Wallet"
//TODO remove dynamic scoping
StatusModal {
id: root
//% "Send"
@ -28,7 +27,7 @@ StatusModal {
property var selectedAmount
property var selectedFiatAmount
property bool outgoing: true
property string msgId: ""
property string trxData: ""
property alias transactionSigner: transactionSigner
@ -75,6 +74,7 @@ StatusModal {
icon: StandardIcon.Critical
standardButtons: StandardButton.Ok
}
signal openGasEstimateErrorPopup(string message)
onClosed: {
stack.pop(groupPreview, StackView.Immediate)
@ -134,6 +134,7 @@ StatusModal {
// Not Refactored Yet
// contacts: root.store.profileModelInst.contacts.addedContacts
selectedRecipient: root.selectedRecipient
currentIndex: index
readOnly: true
}
}
@ -175,13 +176,8 @@ StatusModal {
// trxData))
// if (!gasEstimate.success) {
// //% "Error estimating gas: %1"
// let message = qsTrId("error-estimating-gas---1").arg(gasEstimate.error.message)
// //% ". The transaction will probably fail."
// gasEstimateErrorPopup.confirmationText = message + qsTrId("--the-transaction-will-probably-fail-")
// gasEstimateErrorPopup.open()
// return
// root.openGasEstimateErrorPopup(message);
// }
// selectedGasLimit = gasEstimate.result
// defaultGasLimit = selectedGasLimit
@ -339,9 +335,7 @@ StatusModal {
Component {
id: transactionSettingsConfirmationPopupComponent
TransactionSettingsConfirmationPopup {
}
TransactionSettingsConfirmationPopup { }
}
// Not Refactored Yet
@ -366,17 +360,16 @@ StatusModal {
// }
// // Not Refactored Yet
//// chatsModel.transactions.acceptRequestTransaction(transactionId,
//// messageId,
//// root.store.profileModelInst.profile.pubKey + transactionId.substr(2))
// root.store.chatsModelInst.transactions.acceptRequestTransaction(transactionId, msgId,
// 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 = `${root.store.walletModelInst.utilsView.etherscanLink}/${transactionId}`
// toastMessage.open()
// Global.toastMessage.title = qsTrId("ens-transaction-pending")
// Global.toastMessage.source = Style.svg("loading")
// Global.toastMessage.iconColor = Style.current.primary
// Global.toastMessage.iconRotates = true
// Global.toastMessage.link = `${root.store.walletModelInst.utilsView.etherscanLink}/${transactionId}`
// Global.toastMessage.open()
// root.close()
// } catch (e) {

View File

@ -71,7 +71,7 @@ PopupMenu {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
openProfilePopup(root.store.userProfileInst.name, root.store.userProfileInst.pubKey, root.store.userProfileInst.icon)
Global.openProfilePopup(root.store.userProfileInst.name, root.store.userProfileInst.pubKey, root.store.userProfileInst.icon)
root.close()
}
}

View File

@ -10,7 +10,7 @@ Item {
property int imageWidth: 350
property bool isCurrentUser: false
property url source
property bool playing: applicationWindow.active
property bool playing: Global.applicationWindow.active
property bool isAnimated: !!source && source.toString().endsWith('.gif')
signal clicked(var image, var mouse)
property var container
@ -22,9 +22,9 @@ Item {
height: loadingImage.visible ? loadingImage.height : imageMessage.paintedHeight
Connections {
target: applicationWindow
target: Global.applicationWindow
onActiveChanged: {
if (applicationWindow.active === false) {
if (Global.applicationWindow.active === false) {
imageMessage.playing = false
} else {
imageMessage.playing = Qt.binding(function () {return imageContainer.playing})

View File

@ -11,6 +11,7 @@ import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
import shared.stores 1.0
//TODO remove this dependency
import "../../../app/AppLayouts/Chat/panels"
@ -144,7 +145,7 @@ Rectangle {
function checkTextInsert() {
if (emojiSuggestions.visible) {
emojiSuggestions.addEmoji();
replaceWithEmoji(extrapolateCursorPosition(), emojiSuggestions.shortname, emojiSuggestions.unicode);
return true
}
if (suggestionsBox.visible) {
@ -286,7 +287,7 @@ Rectangle {
// Not Refactored Yet
return ""
// return chatsModel.plainText(deparsedEmoji);
//return RootStore.chatsModelInst.plainText(deparsedEmoji);
}
function removeMentions(currentText) {
@ -561,7 +562,7 @@ Rectangle {
}
Connections {
target: applicationWindow.dragAndDrop
target: Global.applicationWindow.dragAndDrop
onDroppedOnValidScreen: (drop) => {
let validImages = validateImages(drop.urls)
if (validImages.length > 0) {
@ -608,17 +609,17 @@ Rectangle {
StatusEmojiSuggestionPopup {
id: emojiSuggestions
messageInput: messageInput
}
SuggestionBoxPanel {
id: suggestionsBox
// Not Refactored Yet
// Not Refactored Yet
// model: {
// if (chatsModel.communities.activeCommunity.active) {
// return chatsModel.communities.activeCommunity.members
// if (RootStore.chatsModelInst.communities.activeCommunity.active) {
// return RootStore.chatsModelInst.communities.activeCommunity.members
// }
// return chatsModel.messageView.messageList.userList
// return RootStore.chatsModelInst.messageView.messageList.userList
// }
x : messageInput.x
y: -height - Style.current.smallPadding
@ -933,63 +934,51 @@ Rectangle {
}
StatusTextFormatMenu {
readonly property var formationChars: (["*", "`", "~"])
property string selectedTextWithFormationChars: {
let i = 1
let text = ""
while(true) {
if (messageInputField.selectionStart - i < 0 && messageInputField.selectionEnd + i > messageInputField.length) {
break
}
text = messageInputField.getText(messageInputField.selectionStart - i, messageInputField.selectionEnd + i)
if (!formationChars.includes(text.charAt(0)) ||
!formationChars.includes(text.charAt(text.length - 1))) {
break
}
i++
}
return text
}
id: textFormatMenu
function surroundedBy(chars) {
if (selectedTextWithFormationChars === "") {
return false
}
const firstIndex = selectedTextWithFormationChars.indexOf(chars)
if (firstIndex === -1) {
return false
}
return selectedTextWithFormationChars.lastIndexOf(chars) > firstIndex
}
StatusChatInputTextFormationAction {
wrapper: "**"
icon.name: "bold"
//% "Bold"
text: qsTrId("bold")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars
onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper)
}
StatusChatInputTextFormationAction {
wrapper: "*"
icon.name: "italic"
//% "Italic"
text: qsTrId("italic")
checked: (textFormatMenu.surroundedBy("*") && !textFormatMenu.surroundedBy("**")) || textFormatMenu.surroundedBy("***")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars
checked: (surroundedBy("*") && !surroundedBy("**")) || surroundedBy("***")
onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper)
}
StatusChatInputTextFormationAction {
wrapper: "~~"
icon.name: "strikethrough"
//% "Strikethrough"
text: qsTrId("strikethrough")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars
onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper)
}
StatusChatInputTextFormationAction {
wrapper: "`"
icon.name: "code"
//% "Code"
text: qsTrId("code")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars
onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper)
}
onClosed: {
messageInputField.deselect();
}
}
}
@ -1092,8 +1081,8 @@ Rectangle {
anchors.rightMargin: Style.current.halfPadding
anchors.verticalCenter: parent.verticalCenter
visible: imageBtn2.visible
// Not Refactored Yet
// enabled: (chatsModel.plainText(Emoji.deparse(messageInputField.text)).length > 0 || isImage) && messageInputField.length < messageLimit
// Not Refactored Yet
// enabled: (RootStore.chatsModelInst.plainText(Emoji.deparse(messageInputField.text)).length > 0 || isImage) && messageInputField.length < messageLimit
onClicked: function (event) {
control.sendMessage(event)
control.hideExtendedArea();
@ -1120,7 +1109,7 @@ Rectangle {
anchors.right: emojiBtn.left
anchors.rightMargin: 2
anchors.bottom: parent.bottom
visible: !isEdit && localAccountSensitiveSettings.isGifWidgetEnabled
visible: !isEdit && RootStore.isGifWidgetEnabled
icon.name: "gif"
type: StatusQ.StatusFlatRoundButton.Type.Tertiary
color: "transparent"
@ -1137,7 +1126,7 @@ Rectangle {
anchors.bottom: parent.bottom
icon.name: "stickers"
type: StatusQ.StatusFlatRoundButton.Type.Tertiary
visible: !isEdit && networkGuarded && emojiBtn.visible
visible: !isEdit && Global.networkGuarded && emojiBtn.visible
color: "transparent"
onClicked: togglePopup(stickersPopup, stickersBtn)
}
@ -1155,8 +1144,8 @@ Rectangle {
text: qsTr("Unblock")
type: StatusQ.StatusBaseButton.Type.Danger
onClicked: function (event) {
// Not Refactored Yet
// contactsModule.unblockContact(chatsModel.channelView.activeChannel.id)
// Not Refactored Yet
// RootStore.contactsModuleInst.unblockContact(RootStore.chatsModelInst.channelView.activeChannel.id)
}
}
}

View File

@ -61,7 +61,7 @@ Row {
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: {
imagePopup.openPopup(chatImage)
Global.openImagePopup(chatImage);
}
}

View File

@ -3,12 +3,22 @@ import QtQuick.Controls 2.13
Action {
property string wrapper
property string selectedTextWithFormationChars: ""
function surroundedBy(chars) {
if (selectedTextWithFormationChars === "") {
return false;
}
const firstIndex = selectedTextWithFormationChars.indexOf(chars);
if (firstIndex === -1) {
return false;
}
return (selectedTextWithFormationChars.lastIndexOf(chars) > firstIndex);
}
// adding this signal due to a known limitation from Qt: Menu closes when Action is triggered
signal actionTriggered()
icon.width: 12
icon.height: 16
onActionTriggered: checked ?
unwrapSelection(wrapper, textFormatMenu.selectedTextWithFormationChars) :
wrapSelection(wrapper)
checked: textFormatMenu.surroundedBy(wrapper)
checked: surroundedBy(wrapper)
}

View File

@ -9,6 +9,7 @@ import StatusQ.Controls 0.1
import shared.views 1.0
import shared.popups 1.0
import shared.stores 1.0
import shared.controls 1.0
// TODO: replace with StatusModal
@ -24,7 +25,7 @@ ModalPopup {
Component.onCompleted: {
// Not Refactored Yet
// walletModel.gasView.getGasPricePredictions()
// RootStore.walletModelInst.gasView.getGasPricePredictions()
}
height: 540
@ -32,7 +33,7 @@ ModalPopup {
function sendTransaction() {
// Not Refactored Yet
// try {
// let responseStr = profileModel.ens.setPubKey(root.ensUsername,
// let responseStr = RootStore.profileModelInst.ens.setPubKey(root.ensUsername,
// selectFromAccount.selectedAccount.address,
// gasSelector.selectedGasLimit,
// gasSelector.eip1599Enabled ? "" : gasSelector.selectedGasPrice,
@ -95,7 +96,7 @@ ModalPopup {
return null
}
// Not Refactored Yet
// currency: walletModel.balanceView.defaultCurrency
// currency: RootStore.defaultCurrency
width: stack.width
//% "Choose account"
label: qsTrId("choose-account")
@ -107,11 +108,11 @@ ModalPopup {
id: selectRecipient
visible: false
// Not Refactored Yet
// accounts: walletModel.accountsView.accounts
contacts: contactsModule.model.addedContacts
// Not Refactored Yet
// selectedRecipient: { "address": utilsModel.ensRegisterAddress, "type": RecipientSelector.Type.Address }
// accounts: RootStore.walletModelInst.accountsView.accounts
contacts: RootStore.contactsModuleInst.model.addedContacts
selectedRecipient: { "address": RootStore.utilsModelInst.ensRegisterAddress, "type": RecipientSelector.Type.Address }
readOnly: true
currentIndex: index
onSelectedRecipientChanged: if (isValid) { gasSelector.estimateGas() }
}
GasSelector {
@ -120,10 +121,10 @@ ModalPopup {
anchors.top: selectFromAccount.bottom
anchors.topMargin: Style.current.padding
// Not Refactored Yet
// gasPrice: parseFloat(walletModel.gasView.gasPrice)
// getGasEthValue: walletModel.gasView.getGasEthValue
// getFiatValue: walletModel.balanceView.getFiatValue
// defaultCurrency: walletModel.balanceView.defaultCurrency
// gasPrice: parseFloat(RootStore.gasPrice)
// getGasEthValue: RootStore.gasEthValue
// getFiatValue: RootStore.fiatValue
// defaultCurrency: RootStore.defaultCurrency
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
let estimatedGas = root.estimateGasFunction(selectFromAccount.selectedAccount);
@ -158,9 +159,9 @@ ModalPopup {
toAccount: selectRecipient.selectedRecipient
asset: root.asset
// Not Refactored Yet
// currency: walletModel.balanceView.defaultCurrency
// currency: RootStore.defaultCurrency
// amount: {
// const fiatValue = walletModel.balanceView.getFiatValue(0, root.asset.symbol, currency)
// const fiatValue = RootStore.walletModelInst.balanceView.getFiatValue(0, root.asset.symbol, currency)
// return { "value": 0, "fiatValue": fiatValue }
// }
}
@ -175,7 +176,7 @@ ModalPopup {
id: transactionSigner
width: stack.width
// Not Refactored Yet
// signingPhrase: walletModel.utilsView.signingPhrase
// signingPhrase: RootStore.walletModelInst.utilsView.signingPhrase
}
}
}

View File

@ -7,9 +7,10 @@ import utils 1.0
import shared 1.0
StatusInputListPopup {
property string shortname
id: emojiSuggestions
property string shortname
property string unicode: emojiSuggestions.modelList[listView.currentIndex].unicode_alternates || emojiSuggestions.modelList[listView.currentIndex].unicode
getImageSource: function (modelData) {
return `../../assets/twemoji/72x72/${modelData.unicode}.png`
}
@ -25,14 +26,4 @@ StatusInputListPopup {
shortname = shortnameParam
emojiSuggestions.open()
}
function addEmoji(index) {
if (index === undefined) {
index = listView.currentIndex
}
const message = extrapolateCursorPosition();
const unicode = emojiSuggestions.modelList[index].unicode_alternates || emojiSuggestions.modelList[index].unicode
replaceWithEmoji(message, emojiSuggestions.shortname, unicode)
}
}

View File

@ -7,6 +7,7 @@ import StatusQ.Controls 0.1
import utils 1.0
import shared.stores 1.0
Column {
@ -110,7 +111,7 @@ Column {
onClicked: function (event) {
root.gifSelected(event, model.url)
// Not Refactored Yet
// chatsModel.gif.addToRecents(model.id)
// RootStore.chatsModelInst.gif.addToRecents(model.id)
}
}
}

View File

@ -8,6 +8,7 @@ import StatusQ.Controls 0.1
import utils 1.0
import shared.panels 1.0
import shared.stores 1.0
import shared.controls 1.0
Popup {
@ -22,7 +23,7 @@ Popup {
property var gifSelected: function () {}
property var searchGif: Backpressure.debounce(searchBox, 500, function (query) {
// Not Refactored Yet
// chatsModel.gif.search(query)
// RootStore.chatsModelInst.gif.search(query)
});
property var toggleCategory: function(newCategory) {
previousCategory = currentCategory
@ -30,16 +31,15 @@ Popup {
searchBox.text = ""
// Not Refactored Yet
// if (currentCategory === StatusGifPopup.Category.Trending) {
// chatsModel.gif.getTrendings()
// RootStore.chatsModelInst.gif.getTrendings()
// } else if(currentCategory === StatusGifPopup.Category.Favorite) {
// chatsModel.gif.getFavorites()
// RootStore.chatsModelInst.gif.getFavorites()
// } else if(currentCategory === StatusGifPopup.Category.Recent) {
// chatsModel.gif.getRecents()
// RootStore.chatsModelInst.gif.getRecents()
// }
}
property var toggleFavorite: function(item) {
// Not Refactored Yet
// chatsModel.gif.toggleFavorite(item.id, currentCategory === StatusGifPopup.Category.Favorite)
// RootStore.chatsModelInst.gif.toggleFavorite(item.id, currentCategory === StatusGifPopup.Category.Favorite)
}
property alias searchString: searchBox.text
property int currentCategory: StatusGifPopup.Category.Trending
@ -67,9 +67,8 @@ Popup {
onOpened: {
searchBox.text = ""
searchBox.forceActiveFocus(Qt.MouseFocusReason)
if (localAccountSensitiveSettings.isTenorWarningAccepted) {
// Not Refactored Yet
// chatsModel.gif.getTrendings()
if (RootStore.isTenorWarningAccepted) {
// RootStore.chatsModelInst.gif.getTrendings()
} else {
confirmationPopup.open()
}
@ -98,7 +97,7 @@ Popup {
SearchBox {
id: searchBox
placeholderText: qsTr("Search Tenor")
enabled: localAccountSensitiveSettings.isTenorWarningAccepted
enabled: RootStore.isTenorWarningAccepted
anchors.right: parent.right
anchors.rightMargin: gifHeader.headerMargin
anchors.top: parent.top
@ -165,7 +164,7 @@ Popup {
}
// Not Refactored Yet
sourceComponent: empty
// sourceComponent: chatsModel.gif.columnA.rowCount() == 0 ? empty : gifItems
// sourceComponent: RootStore.chatsModelInst.gif.columnA.rowCount() == 0 ? empty : gifItems
}
Row {
@ -182,7 +181,7 @@ Popup {
onClicked: {
toggleCategory(StatusGifPopup.Category.Trending)
}
enabled: localAccountSensitiveSettings.isTenorWarningAccepted
enabled: RootStore.isTenorWarningAccepted
}
StatusTabBarIconButton {
@ -191,7 +190,7 @@ Popup {
onClicked: {
toggleCategory(StatusGifPopup.Category.Recent)
}
enabled: localAccountSensitiveSettings.isTenorWarningAccepted
enabled: RootStore.isTenorWarningAccepted
}
StatusTabBarIconButton {
@ -200,7 +199,7 @@ Popup {
onClicked: {
toggleCategory(StatusGifPopup.Category.Favorite)
}
enabled: localAccountSensitiveSettings.isTenorWarningAccepted
enabled: RootStore.isTenorWarningAccepted
}
}
}
@ -262,9 +261,9 @@ Popup {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Enable")
onClicked: {
localAccountSensitiveSettings.isTenorWarningAccepted = true
RootStore.setIsTenorWarningAccepted(true);
// Not Refactored Yet
// chatsModel.gif.getTrendings()
// RootStore.chatsModelInst.gif.getTrendings()
confirmationPopup.close()
}
}
@ -305,7 +304,7 @@ Popup {
onClicked: {
if (searchBox.text === "") {
// Not Refactored Yet
// chatsModel.gif.getTrendings()
// RootStore.chatsModelInst.gif.getTrendings()
return
}
@ -337,7 +336,7 @@ Popup {
StatusGifColumn {
// Not Refactored Yet
// gifList.model: chatsModel.gif.columnA
// gifList.model: RootStore.chatsModelInst.gif.columnA
gifWidth: (popup.width / 3) - Style.current.padding
gifSelected: popup.gifSelected
toggleFavorite: popup.toggleFavorite
@ -349,7 +348,7 @@ Popup {
StatusGifColumn {
// Not Refactored Yet
// gifList.model: chatsModel.gif.columnB
// gifList.model: RootStore.chatsModelInst.gif.columnB
gifWidth: (popup.width / 3) - Style.current.padding
gifSelected: popup.gifSelected
toggleFavorite: popup.toggleFavorite
@ -361,7 +360,7 @@ Popup {
StatusGifColumn {
// Not Refactored Yet
// gifList.model: chatsModel.gif.columnC
// gifList.model: RootStore.chatsModelInst.gif.columnC
gifWidth: (popup.width / 3) - Style.current.padding
gifSelected: popup.gifSelected
toggleFavorite: popup.toggleFavorite
@ -371,7 +370,6 @@ Popup {
}
}
}
}
}
}

View File

@ -28,8 +28,8 @@ Popup {
function setPopupData(image) {
messageImage.source = image.source;
const maxHeight = applicationWindow.height - 80
const maxWidth = applicationWindow.width - 80
const maxHeight = Global.applicationWindow.height - 80
const maxWidth = Global.applicationWindow.width - 80
if (image.sourceSize.width >= maxWidth || image.sourceSize.height >= maxHeight) {

View File

@ -20,6 +20,7 @@ Popup {
property int imageHeight: 22
property string title
property bool showSearchBox: false
property var messageInput
function openPopup(listParam) {
modelList = listParam
@ -107,7 +108,7 @@ Popup {
} while (!listView.currentItem.visible)
}
Keys.onReleased: function onKeyPress(event) {
Keys.onReleased: {
if (event.key === Qt.Key_Down) {
searchBox.goToNextAvailableIndex(false)
}

View File

@ -22,7 +22,7 @@ Rectangle {
width: 366
height: 75
anchors.top: applicationWindow.top
anchors.top: Global.applicationWindow.top
radius: Style.current.radius
Loader {

View File

@ -8,13 +8,14 @@ import utils 1.0
import StatusQ.Controls 0.1
import shared.views 1.0
import shared.popups 1.0
import shared.stores 1.0
import shared.controls 1.0
// TODO: replace with StatusModal
ModalPopup {
id: root
// Not Refactored Yet
readonly property var asset: "" //JSON.parse(walletModel.tokensView.getStatusToken())
// readonly property var asset: "" //JSON.parse(RootStore.walletModelInst.tokensView.getStatusToken())
property string assetPrice
property string contractAddress
property var estimateGasFunction: (function(userAddress, uuid) { return 0; })
@ -23,7 +24,7 @@ ModalPopup {
Component.onCompleted: {
// Not Refactored Yet
// walletModel.gasView.getGasPrice()
// RootStore.walletModelInst.gasView.getGasPrice()
}
height: 540
@ -111,10 +112,11 @@ ModalPopup {
id: selectRecipient
visible: false
// Not Refactored Yet
// accounts: walletModel.accountsView.accounts
contacts: contactsModule.model.addedContacts
// accounts: RootStore.walletModelInst.accountsView.accounts
contacts: RootStore.contactsModuleInst.model.addedContacts
selectedRecipient: { "address": contractAddress, "type": RecipientSelector.Type.Address }
readOnly: true
currentIndex: index
onSelectedRecipientChanged: if (isValid) { gasSelector.estimateGas() }
}
GasSelector {
@ -122,10 +124,10 @@ ModalPopup {
anchors.top: selectFromAccount.bottom
anchors.topMargin: Style.current.padding
// Not Refactored Yet
// gasPrice: parseFloat(walletModel.gasView.gasPrice)
// getGasEthValue: walletModel.gasView.getGasEthValue
// getFiatValue: walletModel.balanceView.getFiatValue
defaultCurrency: walletSection.currentCurrency
// gasPrice: parseFloat(RootStore.gasPrice)
// getGasEthValue: RootStore.gasEthValue
// getFiatValue: RootStore.fiatValue
defaultCurrency: RootStore.currentCurrency
width: stack.width
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
@ -161,10 +163,9 @@ ModalPopup {
}
toAccount: selectRecipient.selectedRecipient
asset: root.asset
currency: walletSection.currentCurrency
// Not Refactored Yet
currency: RootStore.walletSectionInst.currentCurrency
// amount: {
// const fiatValue = walletModel.balanceView.getFiatValue(root.assetPrice || 0, root.asset.symbol, currency)
// const fiatValue = RootStore.walletModelInst.balanceView.getFiatValue(root.assetPrice || 0, root.asset.symbol, currency)
// return { "value": root.assetPrice, "fiatValue": fiatValue }
// }
}
@ -180,7 +181,7 @@ ModalPopup {
id: transactionSigner
width: stack.width
// Not Refactored Yet
// signingPhrase: walletModel.utilsView.signingPhrase
// signingPhrase: RootStore.walletModelInst.utilsView.signingPhrase
}
}
}

View File

@ -9,6 +9,8 @@ import shared.panels 1.0
GridView {
id: root
property int packId: -1
property var stickerGrid
visible: count > 0
anchors.fill: parent
cellWidth: 88
@ -18,8 +20,8 @@ GridView {
clip: true
signal stickerClicked(string hash, int packId)
delegate: Item {
width: stickerGrid.cellWidth
height: stickerGrid.cellHeight
width: root.cellWidth
height: root.cellHeight
Column {
anchors.fill: parent
anchors.topMargin: 4

View File

@ -15,6 +15,7 @@ Item {
id: root
property var stickerPacks: StickerPackData {}
property var stickerPurchasePopup
property int packId: -1
signal backClicked
signal uninstallClicked(int packId)
@ -49,7 +50,7 @@ Item {
height: 220
width: parent.width
radius: 12
source: "https://ipfs.infura.io/ipfs/" + preview
source: "https://ipfs.infura.io/ipfs/" + model.preview
onClicked: {
stickerPackDetailsPopup.open()
}
@ -74,6 +75,7 @@ Item {
anchors.fill: parent
anchors.topMargin: Style.current.padding
model: stickers
packId: root.packId
}
footer: StatusStickerButton {
@ -154,7 +156,7 @@ Item {
onCancelClicked: root.cancelClicked(packId)
onUpdateClicked: root.updateClicked(packId)
onBuyClicked: {
if (!localAccountSensitiveSettings.isWalletEnabled) {
if (!RootStore.isWalletEnabled) {
confirmationPopup.open()
return
}
@ -170,7 +172,7 @@ Item {
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
confirmButtonLabel: qsTr("I understand")
onConfirmButtonClicked: {
localAccountSensitiveSettings.isWalletEnabled = true
RootStore.enableWallet();
close()
root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId)

View File

@ -24,6 +24,7 @@ ModalPopup {
property bool bought: false;
property bool pending: false;
property var stickers;
signal buyClicked(int packId)
Component.onCompleted: {
const idx = stickersModule.stickerPacks.findIndexById(packId, false);
@ -55,6 +56,7 @@ ModalPopup {
model: stickers
anchors.fill: parent
anchors.topMargin: Style.current.padding
packId: stickerPackDetailsPopup.packId
Component {
id: stickerPackPurchaseModal
StatusSNTTransactionModal {
@ -103,8 +105,8 @@ ModalPopup {
onCancelClicked: function(){}
onUpdateClicked: function(){}
onBuyClicked: {
Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId)
Global.openPopup(stickerPackPurchaseModal);
stickerPackDetailsPopup.buyClicked(packId);
}
}
}

View File

@ -72,6 +72,7 @@ Popup {
Layout.fillWidth: true
Layout.fillHeight: true
stickerPacks: stickerPackList
packId: stickerPackListView.selectedPackId
onInstallClicked: {
stickersModule.install(packId)
stickerGrid.model = stickers
@ -169,6 +170,7 @@ Popup {
StatusStickerList {
id: stickerGrid
model: recentStickers
packId: stickerPackListView.selectedPackId
onStickerClicked: {
root.stickerSelected(hash, packId)
root.close()

View File

@ -12,10 +12,6 @@ Menu {
width: 132
height: 36
onClosed: {
messageInputField.deselect()
}
background: Item {
id: menuBackground
Rectangle {

View File

@ -0,0 +1,76 @@
pragma Singleton
import QtQuick 2.12
QtObject {
id: root
property var utilsModelInst: !!utilsModel ? utilsModel : null
property var chatsModelInst: !!chatsModel ?chatsModel : null
property var userProfileInst: !!userProfile ? userProfile : null
property var walletModelInst: !!walletModel ? walletModel : null
property var keycardModelInst: !!keycardModel ? keycardModel : null
property var profileModelInst: !!profileModel ? profileModel : null
property var walletSectionInst: !!walletSection ? walletSection : null
property var contactsModuleInst: !!contactsModule ? contactsModule : null
property var appSettings: !!localAppSettings ? localAppSettings : null
property var accountSensitiveSettings: !!localAccountSensitiveSettings ? localAccountSensitiveSettings : null
property real volume: !!accountSensitiveSettings ? accountSensitiveSettings.volume : 0.0
property bool isWalletEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.isWalletEnabled : false
property bool notificationSoundsEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.notificationSoundsEnabled : false
property bool neverAskAboutUnfurlingAgain: !!accountSensitiveSettings ? accountSensitiveSettings.neverAskAboutUnfurlingAgain : false
property bool isGifWidgetEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.isGifWidgetEnabled : false
property bool isTenorWarningAccepted: !!accountSensitiveSettings ? accountSensitiveSettings.isTenorWarningAccepted : false
property bool displayChatImages: !!accountSensitiveSettings ? accountSensitiveSettings.displayChatImages : false
property string locale: !!appSettings ? appSettings.locale : ""
property string signingPhrase: !!walletModelInst ? walletModelInst.utilsView.signingPhrase : ""
property string gasPrice: !!walletModelInst ? walletModelInst.gasView.gasPrice : "0"
property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0"
property string currentCurrency: !!walletSectionInst ? walletSectionInst.currentCurrency : ""
property string defaultCurrency: !!walletModelInst ? walletModelInst.balanceView.defaultCurrency : "0"
property string fiatValue: !!walletModelInst ? walletModelInst.balanceView.getFiatValue : "0"
property string cryptoValue: !!walletModelInst ? walletModelInst.balanceView.getCryptoValue : "0"
readonly property var formationChars: (["*", "`", "~"])
function getSelectedTextWithFormationChars(messageInputField) {
let i = 1
let text = ""
while (true) {
if (messageInputField.selectionStart - i < 0 && messageInputField.selectionEnd + i > messageInputField.length) {
break
}
text = messageInputField.getText(messageInputField.selectionStart - i, messageInputField.selectionEnd + i)
if (!formationChars.includes(text.charAt(0)) ||
!formationChars.includes(text.charAt(text.length - 1))) {
break
}
i++
}
return text
}
function setNeverAskAboutUnfurlingAgain(value) {
localAccountSensitiveSettings.neverAskAboutUnfurlingAgain = value;
}
function enableWallet() {
localAccountSensitiveSettings.isWalletEnabled = true;
}
function setIsTenorWarningAccepted(value) {
localAccountSensitiveSettings.isTenorWarningAccepted = value;
}
function transferEth(from, to, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid) {
return walletModelInst.transactionsView.transferEth(from, to, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid);
}
function transferTokens(from, to, address, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid) {
return walletModelInst.transactionsView.transferTokens(from, to, address, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid);
}
function copyToClipboard(textToCopy) {
chatsModelInst.copyToClipboard(textToCopy);
}
}

View File

@ -0,0 +1 @@
singleton RootStore 1.0 RootStore.qml

View File

@ -5,6 +5,7 @@ import QtGraphicalEffects 1.13
import StatusQ.Components 0.1
import utils 1.0
import shared.stores 1.0
Item {
id: root
@ -15,7 +16,7 @@ Item {
root.isPending = true
var name = inputValue.startsWith("@") ? inputValue.substring(1) : inputValue
// Not Refactored Yet
// chatsModel.ensView.resolveENSWithUUID(name, uuid)
// RootStore.chatsModelInst.ensView.resolveENSWithUUID(name, uuid)
});
signal resolved(string resolvedAddress)
@ -40,9 +41,8 @@ Item {
height: root.height
}
}
// Connections {
// target: chatsModel.ensView
// target: RootStore.chatsModelInst.ensView
// onEnsWasResolved: {
// if (uuid !== root.uuid) {
// return

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13
import utils 1.0
import shared.status 1.0
import shared.stores 1.0
// TODO move Contact into shared to get rid of that import
import "../../../app/AppLayouts/Chat/controls"
@ -51,7 +52,7 @@ Item {
// root.matchesAlias(model.name.toLowerCase(), root.filterText.toLowerCase()) ||
// model.name.toLowerCase().includes(root.filterText.toLowerCase()) ||
// model.address.toLowerCase().includes(root.filterText.toLowerCase())) &&
// (!root.hideCommunityMembers || !chatsModel.communities.activeCommunity.hasMember(model.pubKey))
// (!root.hideCommunityMembers || !RootStore.chatsModelInst.communities.activeCommunity.hasMember(model.pubKey))
onContactClicked: function () {
root.contactClicked(model)
}

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import shared.stores 1.0
import StatusQ.Controls 0.1
@ -44,7 +45,7 @@ Item {
function isContactAdded() {
// Not Refactored Yet
return false
// return pubKey != "" ? chatsModel.messageView.isAddedContact(pubKey) : false
// return pubKey != "" ? RootStore.chatsModelInst.messageView.isAddedContact(pubKey) : false
}
width: parent.width

View File

@ -14,6 +14,10 @@ Item {
height: childrenRect.height
property var store
property var commandParametersObject
property var token
property string tokenAmount
property string fiatValue
property int state: Constants.addressRequested
Separator {
@ -97,6 +101,7 @@ Item {
id: signTxComponent
SignTransactionModal {
store: root.store
msgId: messageId
onOpened: {
// Not Refactored Yet
// root.store.walletModelInst.gasView.getGasPrice()
@ -104,6 +109,12 @@ Item {
onClosed: {
destroy();
}
onOpenGasEstimateErrorPopup: {
gasEstimateErrorPopup.confirmationText = message + qsTrId("--the-transaction-will-probably-fail-");
gasEstimateErrorPopup.open();
return;
}
selectedAccount: {}
selectedRecipient: {
return {

View File

@ -11,8 +11,9 @@ Item {
property var store
property bool longChatText: true
property bool veryLongChatText: false
// property bool veryLongChatText: !!root.store ? root.store.chatsModelInst.plainText(message).length > Constants.limitLongChatTextCompactMode : false
// Not Refactored Yet
property bool veryLongChatText: false // !!root.store ? root.store.chatsModelInst.plainText(message).length >
//Constants.limitLongChatTextCompactMode : false
property bool readMore: false
property alias textField: chatText
@ -91,8 +92,8 @@ Item {
// if (link.startsWith('//')) {
// let pk = link.replace("//", "");
// const userProfileImage = appMain.getProfileImage(pk)
// openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || root.store.utilsModelInst.generateIdenticon(pk))
// const userProfileImage = Global.getProfileImage(pk)
// Global.openProfilePopup(root.store.chatsModelInst.userNameOrAlias(pk), pk, userProfileImage || root.store.utilsModelInst.generateIdenticon(pk))
// return;
// }

View File

@ -6,6 +6,7 @@ import shared.panels 1.0
import shared.status 1.0
import shared.controls 1.0
import shared.panels.chat 1.0
import shared.views.chat 1.0
import shared.controls.chat 1.0
import StatusQ.Controls 0.1 as StatusQControls
@ -19,9 +20,12 @@ Item {
property int chatHorizontalPadding: Style.current.halfPadding
property int chatVerticalPadding: 7
property bool headerRepeatCondition: (authorCurrentMsg !== authorPrevMsg ||
shouldRepeatHeader || dateGroupLbl.visible || chatReply.active)
property bool stickersLoaded: false
property bool isMessageActive: false
property bool isCurrentUser: false
property bool isHovered: false
property bool showMoreButton: {
let chatTypeThisMessageBelongsTo = messageStore.getChatType()
switch (chatTypeThisMessageBelongsTo) {
@ -43,7 +47,7 @@ Item {
return false
}
}
signal openStickerPackPopup(string stickerPackId)
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource)
@ -88,6 +92,9 @@ Item {
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, false, false, "");
}
onReplyClicked: {
showReplyArea();
}
}
Loader {
@ -242,7 +249,7 @@ Item {
anchors.left: chatImage.left
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
isCurrentUser: root.isCurrentUser
longReply: active && textFieldImplicitWidth > width
container: root.container
chatHorizontalPadding: chatHorizontalPadding
@ -269,6 +276,7 @@ Item {
// Not Refactored Yet
// messageStore.scrollToBottom(isit, root.container);
}
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, false, "")
}
@ -536,10 +544,18 @@ Item {
anchors.fill: stickerLoader.active ? stickerLoader : chatText
z: activityCenterMessage ? chatText.z + 1 : chatText.z -1
messageContextMenu: root.messageContextMenu
messageContextMenuParent: root
isHovered: root.isHovered
isMessageActive: root.isMessageActive
isActivityCenterMessage: activityCenterMessage
stickersLoaded: root.stickersLoaded
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, null, false, false, false, false, "");
}
onOpenStickerPackPopup: {
root.openStickerPackPopup();
}
onSetMessageActive: {
setMessageActive(messageId, active);
}
@ -639,8 +655,8 @@ Item {
HoverHandler {
enabled: !activityCenterMessage &&
(forceHoverHandler || (typeof root.messageContextMenu !== "undefined" && typeof profilePopupOpened !== "undefined" &&
!root.messageContextMenu.opened && !profilePopupOpened && !popupOpened))
(forceHoverHandler || (typeof root.messageContextMenu !== "undefined" && typeof Global.profilePopupOpened !== "undefined" &&
!root.messageContextMenu.opened && !Global.profilePopupOpened && !Global.popupOpened))
onHoveredChanged: {
setHovered(messageId, hovered);
}

View File

@ -9,6 +9,7 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import shared.status 1.0
import shared.stores 1.0
import shared.panels 1.0
import shared.panels.chat 1.0
import shared.controls.chat 1.0
@ -129,13 +130,13 @@ Column {
// for more information
this.height = undefined
if (Utils.hasImageExtension(link)) {
if (localAccountSensitiveSettings.displayChatImages) {
if (RootStore.displayChatImages) {
linkData = {
thumbnailUrl: link
}
return unfurledImageComponent
} else {
if (localAccountSensitiveSettings.neverAskAboutUnfurlingAgain || (isImageLink && index > 0)) {
if (RootStore.neverAskAboutUnfurlingAgain || (isImageLink && index > 0)) {
return
}
@ -156,7 +157,7 @@ Column {
}
return exists
})
if (!linkWhiteListed && linkExists && !localAccountSensitiveSettings.neverAskAboutUnfurlingAgain) {
if (!linkWhiteListed && linkExists && !RootStore.neverAskAboutUnfurlingAgain) {
return enableLinkComponent
}
if (linkWhiteListed) {
@ -189,7 +190,7 @@ Column {
// return root.store.chatsModelInst.getLinkPreviewData(link, linkMessageLoader.uuid)
}
// setting the height to 0 allows the "enable link" dialog to
// disappear correctly when localAccountSensitiveSettings.neverAskAboutUnfurlingAgain
// disappear correctly when RootStore.neverAskAboutUnfurlingAgain
// is true. The height is reset at the top of this method.
this.height = 0
return undefined
@ -366,10 +367,9 @@ Column {
//% "Enable in Settings"
text: qsTrId("enable-in-settings")
onClicked: {
Global.changeAppSectionBySectionType(Constants.appSection.profile)
// TODO: replace with shared store constant
// Profile/RootStore.privacy_and_security_id
profileLayoutContainer.changeProfileSection(3)
Global.changeAppSectionBySectionType(Constants.appSection.profile, 3);
}
width: parent.width
anchors.top: sep1.bottom
@ -385,7 +385,7 @@ Column {
//% "Don't ask me again"
text: qsTrId("dont-ask")
onClicked: {
localAccountSensitiveSettings.neverAskAboutUnfurlingAgain = true
RootStore.setNeverAskAboutUnfurlingAgain(true);
}
width: parent.width
anchors.top: sep2.bottom

View File

@ -67,6 +67,28 @@ StatusPopupMenu {
root.x = setXPosition()
}
function show(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, emojiReactionsModel) {
userName = userNameParam || ""
nickname = nicknameParam || ""
fromAuthor = fromAuthorParam || ""
identicon = identiconParam || ""
text = textParam || ""
let newEmojiReactions = []
if (!!emojiReactionsModel) {
emojiReactionsModel.forEach(function (emojiReaction) {
newEmojiReactions[emojiReaction.emojiId] = emojiReaction.currentUserReacted
})
}
emojiReactionsReactedByUser = newEmojiReactions;
/* // copy link feature not ready yet
const numLinkUrls = root.linkUrls.split(" ").length
copyLinkMenu.enabled = numLinkUrls > 1
copyLinkAction.enabled = !!root.linkUrls && numLinkUrls === 1 && !emojiOnly && !root.isProfile
*/
popup()
}
Item {
id: emojiContainer
width: emojiRow.width

View File

@ -113,7 +113,6 @@ Column {
//////////////////////////////////////
property bool isEmoji: contentType === Constants.messageContentType.emojiType
property bool isImage: contentType === Constants.messageContentType.imageType
property bool isAudio: contentType === Constants.messageContentType.audioType
@ -127,7 +126,7 @@ Column {
property bool isStatusUpdate: false
property int statusAgeEpoch: 0
property var imageClick: function () {}
signal imageClick(var image)
property var scrollToBottom: function () {}
property var clickMessage: function(isProfileClick,
@ -195,6 +194,8 @@ Column {
// }
/////////////////////////////////////////////
signal openStickerPackPopup(string stickerPackId)
// Not Refactored Yet
// Connections {
// enabled: (!placeholderMessage && !!root.rootStore)
@ -330,7 +331,7 @@ Column {
}
onChatImageClicked: {
// Not Refactored Yet - Should do it via messageStore
// messageStore.imageClick(image);
// root.imageClick(image);
}
onUserNameClicked: {
// Not Refactored Yet - Should do it via messageStore
@ -354,7 +355,6 @@ Column {
id: compactMessageComponent
CompactMessageView {
messageContextMenu: root.messageContextMenu
container: root
onAddEmoji: {
root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker)
}
@ -362,6 +362,9 @@ Column {
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, isRightClickOnImage, imageSource)
}
onOpenStickerPackPopup: {
root.openStickerPackPopup(stickerPackId);
}
}
}
}

View File

@ -6,6 +6,7 @@ import shared 1.0
import shared.panels 1.0
import shared.status 1.0
import shared.panels.chat 1.0
import shared.views.chat 1.0
import shared.controls.chat 1.0
import StatusQ.Controls 0.1

View File

@ -183,6 +183,10 @@ Item {
AcceptTransactionView {
state: root.state
store: root.store
token: root.token
fiatValue: root.fiatValue
tokenAmount: root.tokenAmount
commandParametersObject: root.commandParametersObject
}
}

View File

@ -4,10 +4,11 @@ import QtMultimedia 5.13
Audio {
id: audio
property var store
property string track: "error.mp3"
source: Qt.resolvedUrl("./../assets/audio" + track)
audioRole: Audio.NotificationRole
volume: localAccountSensitiveSettings.volume
muted: !localAccountSensitiveSettings.notificationSoundsEnabled
volume: store.volume
muted: !store.notificationSoundsEnabled
}

View File

@ -1,38 +1,71 @@
pragma Singleton
import QtQuick 2.13
import "../../app/AppLayouts/Chat/popups"
QtObject {
id: root
property var appRootComponent
property var applicationWindow
property bool popupOpened: false
property int currentMenuTab: 0
property var errorSound: Audio {
id: errorSound
track: Qt.resolvedUrl("../assets/audio/error.mp3")
}
property var mainModuleInst: mainModule
property var mainModuleInst: !!mainModule ? mainModule : null
property var toastMessage
property bool profilePopupOpened: false
//Not refactored yet
property bool networkGuarded: false //profileModel.network.current === Constants.networkMainnet || (profileModel.network.current === Constants.networkRopsten && localAccountSensitiveSettings.stickersEnsRopsten)
signal openImagePopup(var image)
signal openLinkInBrowser(string link)
signal openChooseBrowserPopup(string link)
signal openPopupRequested(var popupComponent, var params)
signal openDownloadModalRequested()
signal settingsLoaded()
function openDownloadModal(){
openDownloadModalRequested()
signal openProfilePopupRequested(string userNameParam, string fromAuthorParam, string identiconParam, string textParam, string nicknameParam, var parentPopup)
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
openProfilePopupRequested(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup);
}
function openPopup(popupComponent, params = {}) {
root.openPopupRequested(popupComponent, params);
}
function createPopup(popupComponent, params = {}) {
return popupComponent.createObject(root.appRootComponent, params);
function openDownloadModal(){
openDownloadModalRequested();
}
function changeAppSectionBySectionType(sectionType) {
function changeAppSectionBySectionType(sectionType, profileSectionId = -1) {
mainModuleInst.setActiveSectionBySectionType(sectionType)
if (profileSectionId > -1) {
currentMenuTab = profileSectionId;
}
}
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
if (isCurrentUser || (isCurrentUser === undefined && pubkey === userProfile.pubKey)) {
return userProfile.icon;
}
const index = contactsModule.model.list.getContactIndexByPubkey(pubkey);
if (index === -1) {
return;
}
if (localAccountSensitiveSettings.onlyShowContactsProfilePics) {
const isContact = contactsModule.model.list.rowData(index, "isContact");
if (isContact === "false") {
return;
}
}
return contactsModule.model.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage");
}
function openLink(link) {

View File

@ -23,7 +23,6 @@ StatusWindow {
property bool hasAccounts: startupModule.appState !== Constants.appState.onboarding
property bool removeMnemonicAfterLogin: false
property alias dragAndDrop: dragTarget
property bool popupOpened: false
property bool displayBeforeGetStartedModal: !hasAccounts
Universal.theme: Universal.System
@ -192,6 +191,7 @@ StatusWindow {
}
Component.onCompleted: {
Global.applicationWindow = this;
Style.changeTheme(localAppSettings.theme, systemPalette.isCurrentSystemThemeDark())
setX(Qt.application.screens[0].width / 2 - width / 2);
setY(Qt.application.screens[0].height / 2 - height / 2);