2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-02-18 19:14:31 +00:00
|
|
|
import QtMultimedia 5.13
|
2021-11-01 20:10:50 +00:00
|
|
|
import Qt.labs.qmlmodels 1.0
|
2022-03-03 22:50:53 +00:00
|
|
|
import Qt.labs.platform 1.1
|
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
|
2022-03-08 18:49:33 +00:00
|
|
|
import AppLayouts.Wallet 1.0
|
|
|
|
import AppLayouts.Node 1.0
|
|
|
|
import AppLayouts.Browser 1.0
|
|
|
|
import AppLayouts.Chat 1.0
|
|
|
|
import AppLayouts.Chat.popups 1.0
|
2022-05-13 15:27:26 +00:00
|
|
|
import AppLayouts.Chat.views 1.0
|
2022-03-08 18:49:33 +00:00
|
|
|
import AppLayouts.Profile 1.0
|
|
|
|
import AppLayouts.Profile.popups 1.0
|
2022-05-23 13:11:30 +00:00
|
|
|
import AppLayouts.CommunitiesPortal 1.0
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2022-03-17 16:15:38 +00:00
|
|
|
import shared.controls 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
2020-05-11 21:24:08 +00:00
|
|
|
|
2021-06-11 12:17:23 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-21 23:34:35 +00:00
|
|
|
import StatusQ.Components 0.1
|
2021-06-11 12:17:23 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2021-10-21 23:34:35 +00:00
|
|
|
import StatusQ.Core 0.1
|
2021-06-11 12:17:23 +00:00
|
|
|
|
2022-05-16 15:02:03 +00:00
|
|
|
import AppLayouts.Browser.stores 1.0 as BrowserStores
|
|
|
|
|
2022-03-08 18:49:33 +00:00
|
|
|
import AppLayouts.stores 1.0
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Item {
|
2020-09-15 19:47:13 +00:00
|
|
|
id: appMain
|
2021-06-11 12:17:23 +00:00
|
|
|
anchors.fill: parent
|
2020-05-11 21:24:08 +00:00
|
|
|
|
2021-09-15 11:40:07 +00:00
|
|
|
property alias appLayout: appLayout
|
2022-02-28 20:14:04 +00:00
|
|
|
property alias dragAndDrop: dragTarget
|
2021-12-20 18:21:21 +00:00
|
|
|
property RootStore rootStore: RootStore { }
|
2021-12-09 13:28:02 +00:00
|
|
|
// set from main.qml
|
|
|
|
property var sysPalette
|
2021-10-20 09:50:50 +00:00
|
|
|
|
2021-12-23 13:45:52 +00:00
|
|
|
Connections {
|
|
|
|
target: rootStore.aboutModuleInst
|
|
|
|
onAppVersionFetched: {
|
2022-03-03 21:00:52 +00:00
|
|
|
rootStore.setLatestVersionInfo(available, version, url);
|
|
|
|
if (!available) {
|
2022-03-17 16:15:38 +00:00
|
|
|
versionUpToDate.show()
|
|
|
|
} else {
|
|
|
|
versionWarning.show()
|
|
|
|
}
|
2021-12-23 13:45:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-17 16:24:50 +00:00
|
|
|
Connections {
|
|
|
|
target: rootStore.mainModuleInst
|
|
|
|
onDisplayUserProfile: Global.openProfilePopup(publicKey)
|
|
|
|
}
|
|
|
|
|
2021-12-06 21:10:54 +00:00
|
|
|
Connections {
|
|
|
|
target: Global
|
|
|
|
onOpenLinkInBrowser: {
|
|
|
|
browserLayoutContainer.item.openUrlInNewTab(link);
|
|
|
|
}
|
|
|
|
onOpenChooseBrowserPopup: {
|
2021-12-07 20:33:12 +00:00
|
|
|
Global.openPopup(chooseBrowserPopupComponent, {link: link});
|
|
|
|
}
|
2021-12-09 13:28:02 +00:00
|
|
|
onOpenDownloadModalRequested: {
|
2022-03-17 16:15:38 +00:00
|
|
|
const downloadPage = downloadPageComponent.createObject(appMain,
|
|
|
|
{
|
2022-03-03 21:00:52 +00:00
|
|
|
newVersionAvailable: available,
|
|
|
|
downloadURL: url,
|
2022-03-17 16:15:38 +00:00
|
|
|
currentVersion: rootStore.profileSectionStore.getCurrentVersion(),
|
2022-03-03 21:00:52 +00:00
|
|
|
newVersion: version
|
2022-03-17 16:15:38 +00:00
|
|
|
})
|
|
|
|
return downloadPage
|
2021-12-09 13:28:02 +00:00
|
|
|
}
|
2021-12-08 21:20:43 +00:00
|
|
|
onOpenProfilePopupRequested: {
|
|
|
|
var popup = profilePopupComponent.createObject(appMain);
|
2022-06-20 14:48:38 +00:00
|
|
|
if (parentPopup) {
|
2021-12-08 21:20:43 +00:00
|
|
|
popup.parentPopup = parentPopup;
|
|
|
|
}
|
2022-06-20 14:48:38 +00:00
|
|
|
popup.openPopup(publicKey, state);
|
2021-12-08 21:20:43 +00:00
|
|
|
Global.profilePopupOpened = true;
|
|
|
|
}
|
2022-02-04 08:43:55 +00:00
|
|
|
onOpenChangeProfilePicPopup: {
|
|
|
|
var popup = changeProfilePicComponent.createObject(appMain);
|
2022-06-22 12:16:21 +00:00
|
|
|
popup.chooseImageToCrop();
|
2022-02-04 08:43:55 +00:00
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
onOpenBackUpSeedPopup: Global.openPopup(backupSeedModalComponent)
|
2022-05-05 10:28:54 +00:00
|
|
|
onDisplayToastMessage: {
|
|
|
|
appMain.rootStore.mainModuleInst.displayEphemeralNotification(title, subTitle, icon, loading, ephNotifType, url);
|
|
|
|
}
|
2022-06-28 18:11:18 +00:00
|
|
|
onOpenEditDisplayNamePopup: {
|
|
|
|
var popup = displayNamePopupComponent.createObject(appMain)
|
|
|
|
popup.open()
|
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function changeAppSectionBySectionId(sectionId) {
|
|
|
|
mainModule.setActiveSectionById(sectionId)
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2021-12-30 12:39:47 +00:00
|
|
|
property Component backupSeedModalComponent: BackupSeedModal {
|
|
|
|
id: backupSeedModal
|
2022-05-26 13:40:41 +00:00
|
|
|
anchors.centerIn: parent
|
2021-12-30 12:39:47 +00:00
|
|
|
privacyStore: appMain.rootStore.profileSectionStore.privacyStore
|
2022-06-28 10:55:33 +00:00
|
|
|
onClosed: destroy()
|
2021-12-30 12:39:47 +00:00
|
|
|
}
|
|
|
|
|
2022-06-28 18:11:18 +00:00
|
|
|
property Component displayNamePopupComponent: DisplayNamePopup {
|
2022-07-11 09:35:38 +00:00
|
|
|
anchors.centerIn: parent
|
2022-06-28 18:11:18 +00:00
|
|
|
profileStore: appMain.rootStore.profileSectionStore.profileStore
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
Component {
|
2022-03-17 16:15:38 +00:00
|
|
|
id: downloadPageComponent
|
|
|
|
DownloadPage {
|
2021-12-08 21:20:43 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
2021-08-05 18:06:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 20:36:11 +00:00
|
|
|
StatusImageModal {
|
|
|
|
id: imagePopup
|
|
|
|
onClicked: {
|
|
|
|
if (button === Qt.LeftButton) {
|
|
|
|
imagePopup.close()
|
|
|
|
} else if(button === Qt.RightButton) {
|
2022-02-01 13:10:24 +00:00
|
|
|
contextMenu.imageSource = imagePopup.imageSource
|
|
|
|
contextMenu.hideEmojiPicker = true
|
|
|
|
contextMenu.isRightClickOnImage = true;
|
|
|
|
contextMenu.show()
|
2022-01-26 20:36:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Connections {
|
|
|
|
target: Global
|
|
|
|
onOpenImagePopup: {
|
2022-02-01 13:10:24 +00:00
|
|
|
imagePopup.contextMenu = contextMenu
|
|
|
|
imagePopup.openPopup(image)
|
2022-01-26 20:36:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-05 18:06:19 +00:00
|
|
|
property Component profilePopupComponent: ProfilePopup {
|
|
|
|
id: profilePopup
|
2022-06-20 11:54:17 +00:00
|
|
|
anchors.centerIn: parent
|
2022-01-17 14:56:19 +00:00
|
|
|
profileStore: appMain.rootStore.profileSectionStore.profileStore
|
2021-12-31 12:29:51 +00:00
|
|
|
contactsStore: appMain.rootStore.profileSectionStore.contactsStore
|
2021-08-05 18:06:19 +00:00
|
|
|
onClosed: {
|
2021-12-08 21:20:43 +00:00
|
|
|
if (profilePopup.parentPopup) {
|
2021-08-05 18:06:19 +00:00
|
|
|
profilePopup.parentPopup.close();
|
|
|
|
}
|
2021-12-08 21:20:43 +00:00
|
|
|
Global.profilePopupOpened = false;
|
|
|
|
destroy();
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2022-02-04 08:43:55 +00:00
|
|
|
property Component changeProfilePicComponent: Component {
|
2022-06-22 12:16:21 +00:00
|
|
|
ImageCropWorkflow {
|
|
|
|
title: qsTr("Profile Picture")
|
|
|
|
acceptButtonText: qsTr("Make this my Profile Pic")
|
|
|
|
onImageCropped: {
|
|
|
|
appMain.rootStore.profileSectionStore.profileStore.uploadImage(image,
|
|
|
|
cropRect.x.toFixed(),
|
|
|
|
cropRect.y.toFixed(),
|
|
|
|
(cropRect.x + cropRect.width).toFixed(),
|
|
|
|
(cropRect.y + cropRect.height).toFixed());
|
|
|
|
}
|
2022-02-04 08:43:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
Audio {
|
|
|
|
id: sendMessageSound
|
2021-12-08 21:20:43 +00:00
|
|
|
store: rootStore
|
2022-01-11 23:16:17 +00:00
|
|
|
track: Qt.resolvedUrl("../imports/assets/audio/send_message.wav")
|
2021-02-18 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Audio {
|
|
|
|
id: notificationSound
|
2021-12-08 21:20:43 +00:00
|
|
|
store: rootStore
|
2022-01-11 23:16:17 +00:00
|
|
|
track: Qt.resolvedUrl("../imports/assets/audio/notification.wav")
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio {
|
|
|
|
id: errorSound
|
|
|
|
track: Qt.resolvedUrl("../imports/assets/audio/error.mp3")
|
|
|
|
store: rootStore
|
2021-02-18 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
2022-02-16 16:13:45 +00:00
|
|
|
AppSearch {
|
2021-11-10 08:09:31 +00:00
|
|
|
id: appSearch
|
2022-01-27 11:28:27 +00:00
|
|
|
store: appMain.rootStore.appSearchStore
|
2021-11-10 08:09:31 +00:00
|
|
|
}
|
|
|
|
|
2022-03-07 14:56:05 +00:00
|
|
|
StatusEmojiPopup {
|
|
|
|
id: statusEmojiPopup
|
|
|
|
width: 360
|
|
|
|
height: 440
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
StatusAppLayout {
|
2021-09-15 11:40:07 +00:00
|
|
|
id: appLayout
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
width: parent.width
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
|
|
|
appNavBar: StatusAppNavBar {
|
|
|
|
height: appMain.height
|
2021-10-19 10:27:41 +00:00
|
|
|
communityTypeRole: "sectionType"
|
|
|
|
communityTypeValue: Constants.appSection.community
|
|
|
|
sectionModel: mainModule.sectionsModel
|
|
|
|
|
2021-12-24 08:24:26 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
mainModule.sectionsModel.sectionVisibilityUpdated.connect(function(){
|
|
|
|
triggerUpdate()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
property bool communityAdded: false
|
|
|
|
|
|
|
|
onAboutToUpdateFilteredRegularModel: {
|
|
|
|
communityAdded = false
|
|
|
|
}
|
|
|
|
|
|
|
|
filterRegularItem: function(item) {
|
|
|
|
if(!item.enabled)
|
|
|
|
return false
|
|
|
|
|
|
|
|
if(item.sectionType === Constants.appSection.community)
|
|
|
|
if(communityAdded)
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
communityAdded = true
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
filterCommunityItem: function(item) {
|
|
|
|
return item.sectionType === Constants.appSection.community
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
regularNavBarButton: StatusNavBarTabButton {
|
2022-07-15 00:24:46 +00:00
|
|
|
id: navbar
|
|
|
|
objectName: model.name + "-navbar"
|
2021-10-19 10:27:41 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
name: model.icon.length > 0? "" : model.name
|
|
|
|
icon.name: model.icon
|
|
|
|
icon.source: model.image
|
|
|
|
tooltip.text: model.name
|
|
|
|
checked: model.active
|
|
|
|
badge.value: model.notificationsCount
|
|
|
|
badge.visible: model.hasNotification
|
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
|
|
|
|
badge.border.width: 2
|
2021-06-17 18:41:11 +00:00
|
|
|
onClicked: {
|
2021-10-19 10:27:41 +00:00
|
|
|
changeAppSectionBySectionId(model.id)
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
communityNavBarButton: StatusNavBarTabButton {
|
2021-06-17 18:41:11 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-10-19 10:27:41 +00:00
|
|
|
name: model.icon.length > 0? "" : model.name
|
|
|
|
icon.name: model.icon
|
|
|
|
icon.source: model.image
|
2021-06-17 18:41:11 +00:00
|
|
|
tooltip.text: model.name
|
2021-10-19 10:27:41 +00:00
|
|
|
checked: model.active
|
|
|
|
badge.value: model.notificationsCount
|
|
|
|
badge.visible: model.hasNotification
|
2021-06-17 18:41:11 +00:00
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
|
|
|
|
badge.border.width: 2
|
2021-10-19 10:27:41 +00:00
|
|
|
onClicked: {
|
|
|
|
changeAppSectionBySectionId(model.id)
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
id: communityContextMenu
|
|
|
|
|
2022-01-18 20:54:14 +00:00
|
|
|
property var chatCommunitySectionModule
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
openHandler: function () {
|
2022-01-18 20:54:14 +00:00
|
|
|
// // we cannot return QVariant if we pass another parameter in a function call
|
|
|
|
// // that's why we're using it this way
|
|
|
|
mainModule.prepareCommunitySectionModuleForCommunityId(model.id)
|
|
|
|
communityContextMenu.chatCommunitySectionModule = mainModule.getCommunitySectionModule()
|
2022-02-04 13:07:48 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Invite People")
|
2021-06-17 18:41:11 +00:00
|
|
|
icon.name: "share-ios"
|
2022-01-18 20:54:14 +00:00
|
|
|
enabled: model.canManageUsers
|
2022-01-10 16:44:54 +00:00
|
|
|
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
2022-01-18 20:54:14 +00:00
|
|
|
community: model,
|
2022-01-19 20:07:02 +00:00
|
|
|
hasAddedContacts: appMain.rootStore.hasAddedContacts,
|
|
|
|
communitySectionModule: communityContextMenu.chatCommunitySectionModule
|
2022-01-10 16:44:54 +00:00
|
|
|
})
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("View Community")
|
2021-06-17 18:41:11 +00:00
|
|
|
icon.name: "group-chat"
|
2022-01-10 16:44:54 +00:00
|
|
|
onTriggered: Global.openPopup(communityProfilePopup, {
|
|
|
|
store: appMain.rootStore,
|
2022-01-18 20:54:14 +00:00
|
|
|
community: model,
|
|
|
|
communitySectionModule: communityContextMenu.chatCommunitySectionModule
|
2022-01-10 16:44:54 +00:00
|
|
|
})
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Leave Community")
|
2021-06-17 18:41:11 +00:00
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 14
|
|
|
|
iconRotation: 180
|
|
|
|
type: StatusMenuItem.Type.Danger
|
2022-01-18 20:54:14 +00:00
|
|
|
onTriggered: communityContextMenu.chatCommunitySectionModule.leaveCommunity()
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
navBarProfileButton: StatusNavBarTabButton {
|
|
|
|
id: profileButton
|
2021-09-27 10:31:17 +00:00
|
|
|
property bool opened: false
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2022-03-30 15:30:28 +00:00
|
|
|
name: appMain.rootStore.userProfileInst.name
|
2021-12-01 12:46:21 +00:00
|
|
|
icon.source: appMain.rootStore.userProfileInst.icon
|
2022-04-01 11:46:32 +00:00
|
|
|
identicon.icon.charactersLen: 2
|
2022-04-07 19:05:33 +00:00
|
|
|
identicon.icon.color: Utils.colorForPubkey(appMain.rootStore.userProfileInst.pubKey)
|
2022-04-01 11:46:32 +00:00
|
|
|
identicon.ringSettings.ringSpecModel: Utils.getColorHashAsJson(appMain.rootStore.userProfileInst.pubKey)
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
badge.visible: true
|
|
|
|
badge.anchors.rightMargin: 4
|
|
|
|
badge.anchors.topMargin: 25
|
|
|
|
badge.implicitHeight: 15
|
|
|
|
badge.implicitWidth: 15
|
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
|
2022-06-10 09:01:31 +00:00
|
|
|
badge.color: {
|
|
|
|
switch(appMain.rootStore.userProfileInst.currentUserStatus){
|
|
|
|
case Constants.currentUserStatus.automatic:
|
|
|
|
case Constants.currentUserStatus.alwaysOnline:
|
|
|
|
return Style.current.green;
|
|
|
|
default:
|
|
|
|
return Style.current.midGrey;
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
badge.border.width: 3
|
2021-09-27 10:31:17 +00:00
|
|
|
onClicked: {
|
|
|
|
userStatusContextMenu.opened ?
|
|
|
|
userStatusContextMenu.close() :
|
|
|
|
userStatusContextMenu.open()
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
|
|
|
UserStatusContextMenu {
|
|
|
|
id: userStatusContextMenu
|
2022-07-04 10:47:29 +00:00
|
|
|
y: profileButton.y - userStatusContextMenu.height + profileButton.height
|
|
|
|
x: profileButton.x + profileButton.width + 5
|
2021-11-04 23:38:57 +00:00
|
|
|
store: appMain.rootStore
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-28 12:50:48 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2021-12-17 17:42:12 +00:00
|
|
|
appView: ColumnLayout {
|
2021-06-17 18:41:11 +00:00
|
|
|
anchors.fill: parent
|
2021-12-17 17:42:12 +00:00
|
|
|
|
|
|
|
ModuleWarning {
|
|
|
|
id: versionWarning
|
|
|
|
width: parent.width
|
2022-03-17 16:15:38 +00:00
|
|
|
height: 32
|
2022-03-03 21:00:52 +00:00
|
|
|
visible: appMain.rootStore.newVersionAvailable
|
2021-12-17 17:42:12 +00:00
|
|
|
color: Style.current.green
|
|
|
|
btnWidth: 100
|
2022-03-03 21:00:52 +00:00
|
|
|
text: qsTr("A new version of Status (%1) is available").arg(appMain.rootStore.latestVersion)
|
2021-12-17 17:42:12 +00:00
|
|
|
btnText: qsTr("Download")
|
|
|
|
onClick: function(){
|
2022-03-03 21:00:52 +00:00
|
|
|
Global.openDownloadModal(appMain.rootStore.newVersionAvailable, appMain.rootStore.latestVersion, appMain.rootStore.downloadURL)
|
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
appMain.rootStore.resetLastVersion();
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
2022-03-17 16:15:38 +00:00
|
|
|
|
|
|
|
function show() {
|
|
|
|
versionWarning.visible = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ModuleWarning {
|
|
|
|
id: versionUpToDate
|
|
|
|
width: parent.width
|
|
|
|
height: 32
|
|
|
|
visible: false
|
|
|
|
color: Style.current.green
|
|
|
|
btnWidth: 100
|
|
|
|
text: qsTr("Your version is up to date")
|
|
|
|
btnText: qsTr("Close")
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
}
|
|
|
|
function show() {
|
|
|
|
versionUpToDate.visible = true
|
|
|
|
timer.setTimeout(function() {
|
|
|
|
versionUpToDate.close()
|
|
|
|
}, 4000);
|
|
|
|
}
|
|
|
|
|
|
|
|
onClick: function(){
|
|
|
|
versionUpToDate.close()
|
|
|
|
}
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
|
|
|
|
Item {
|
2022-06-23 15:28:30 +00:00
|
|
|
Layout.fillWidth: true
|
2021-12-17 17:42:12 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
StackLayout {
|
|
|
|
id: appView
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
currentIndex: {
|
|
|
|
if(mainModule.activeSection.sectionType === Constants.appSection.chat) {
|
|
|
|
return Constants.appViewStackIndex.chat
|
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.community) {
|
2021-12-17 17:42:12 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
for(let i = this.children.length - 1; i >=0; i--)
|
2021-12-17 17:42:12 +00:00
|
|
|
{
|
2022-05-13 15:27:26 +00:00
|
|
|
var obj = this.children[i];
|
|
|
|
if(obj && obj.sectionId && obj.sectionId == mainModule.activeSection.id)
|
|
|
|
{
|
|
|
|
return i
|
|
|
|
}
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2022-05-13 15:27:26 +00:00
|
|
|
|
|
|
|
// Should never be here, correct index must be returned from the for loop above
|
|
|
|
console.error("Wrong section type: ", mainModule.activeSection.sectionType,
|
|
|
|
" or section id: ", mainModule.activeSection.id)
|
|
|
|
return Constants.appViewStackIndex.community
|
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.communitiesPortal) {
|
|
|
|
return Constants.appViewStackIndex.communitiesPortal
|
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.wallet) {
|
|
|
|
return Constants.appViewStackIndex.wallet
|
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.browser) {
|
|
|
|
return Constants.appViewStackIndex.browser
|
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.profile) {
|
|
|
|
return Constants.appViewStackIndex.profile
|
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.node) {
|
|
|
|
return Constants.appViewStackIndex.node
|
2021-11-01 20:10:50 +00:00
|
|
|
}
|
2021-12-17 17:42:12 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
// We should never end up here
|
|
|
|
console.error("Unknown section type")
|
2021-11-01 20:10:50 +00:00
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
var obj = this.children[currentIndex];
|
|
|
|
if(!obj)
|
|
|
|
return
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
if (obj.onActivated && typeof obj.onActivated === "function") {
|
|
|
|
this.children[currentIndex].onActivated()
|
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
if(obj === browserLayoutContainer && browserLayoutContainer.active == false){
|
|
|
|
browserLayoutContainer.active = true;
|
|
|
|
}
|
2021-08-18 14:43:59 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
if(obj === walletLayoutContainer){
|
|
|
|
walletLayoutContainer.showSigningPhrasePopup();
|
|
|
|
}
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2021-03-05 18:45:39 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
// NOTE:
|
|
|
|
// If we ever change stack layout component order we need to updade
|
|
|
|
// Constants.appViewStackIndex accordingly
|
|
|
|
|
|
|
|
ChatLayout {
|
|
|
|
id: chatLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
chatView.pinnedMessagesListPopupComponent: pinnedMessagesPopupComponent
|
|
|
|
chatView.emojiPopup: statusEmojiPopup
|
2021-12-17 17:42:12 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
contactsStore: appMain.rootStore.contactStore
|
|
|
|
rootStore.emojiReactionsModel: appMain.rootStore.emojiReactionsModel
|
2021-12-21 09:26:13 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
chatView.onProfileButtonClicked: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
|
|
|
}
|
2021-12-21 09:26:13 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
chatView.onOpenAppSearch: {
|
|
|
|
appSearch.openSearchPopup()
|
|
|
|
}
|
2022-01-04 12:06:05 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
rootStore.chatCommunitySectionModule = mainModule.getChatSectionModule()
|
|
|
|
}
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
CommunitiesPortalLayout {
|
|
|
|
id: communitiesPortalLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2021-11-10 12:48:22 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
WalletLayout {
|
|
|
|
id: walletLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
store: appMain.rootStore
|
|
|
|
contactsStore: appMain.rootStore.profileSectionStore.contactsStore
|
|
|
|
emojiPopup: statusEmojiPopup
|
|
|
|
sendModal: sendModal
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2021-11-01 20:10:50 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
Component {
|
|
|
|
id: browserLayoutComponent
|
|
|
|
BrowserLayout {
|
|
|
|
globalStore: appMain.rootStore
|
|
|
|
sendTransactionModal: sendModal
|
|
|
|
}
|
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
Loader {
|
|
|
|
id: browserLayoutContainer
|
|
|
|
sourceComponent: browserLayoutComponent
|
|
|
|
active: false
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
// 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
|
|
|
|
// Not Refactored Yet
|
|
|
|
// property var _walletModel: walletModel
|
|
|
|
// Not Refactored Yet
|
|
|
|
// property var _utilsModel: utilsModel
|
|
|
|
property var _web3Provider: BrowserStores.Web3ProviderStore.web3ProviderInst
|
|
|
|
}
|
2021-11-10 08:09:31 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
ProfileLayout {
|
|
|
|
id: profileLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
store: appMain.rootStore.profileSectionStore
|
2021-12-17 17:42:12 +00:00
|
|
|
globalStore: appMain.rootStore
|
2022-05-13 15:27:26 +00:00
|
|
|
systemPalette: appMain.sysPalette
|
|
|
|
emojiPopup: statusEmojiPopup
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2022-01-31 13:29:27 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
NodeLayout {
|
|
|
|
id: nodeLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
Repeater {
|
|
|
|
model: mainModule.sectionsModel
|
|
|
|
|
|
|
|
delegate: DelegateChooser {
|
|
|
|
id: delegateChooser
|
|
|
|
role: "sectionType"
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: Constants.appSection.community
|
|
|
|
delegate: ChatLayout {
|
|
|
|
property string sectionId: model.id
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
chatView.pinnedMessagesListPopupComponent: pinnedMessagesPopupComponent
|
|
|
|
chatView.emojiPopup: statusEmojiPopup
|
|
|
|
|
|
|
|
contactsStore: appMain.rootStore.contactStore
|
|
|
|
rootStore.emojiReactionsModel: appMain.rootStore.emojiReactionsModel
|
|
|
|
|
|
|
|
chatView.onProfileButtonClicked: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
|
|
|
}
|
|
|
|
|
|
|
|
chatView.onOpenAppSearch: {
|
|
|
|
appSearch.openSearchPopup()
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
// we cannot return QVariant if we pass another parameter in a function call
|
|
|
|
// that's why we're using it this way
|
|
|
|
mainModule.prepareCommunitySectionModuleForCommunityId(model.id)
|
|
|
|
rootStore.chatCommunitySectionModule = mainModule.getCommunitySectionModule()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 17:42:12 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
CreateChatView {
|
|
|
|
property bool opened: false
|
2021-12-30 12:39:47 +00:00
|
|
|
|
2022-05-13 15:27:26 +00:00
|
|
|
id: createChatView
|
|
|
|
rootStore: chatLayoutContainer.rootStore
|
2022-03-10 17:01:17 +00:00
|
|
|
emojiPopup: statusEmojiPopup
|
2022-05-13 15:27:26 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 8
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.right: parent.right
|
|
|
|
width: chatLayoutContainer.chatView.width - chatLayoutContainer.chatView.leftPanel.width - anchors.rightMargin - anchors.leftMargin
|
|
|
|
visible: createChatView.opened
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: Global
|
|
|
|
onOpenCreateChatView: {
|
|
|
|
createChatView.opened = true
|
|
|
|
}
|
|
|
|
onCloseCreateChatView: {
|
|
|
|
createChatView.opened = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Connections {
|
|
|
|
target: mainModule
|
|
|
|
onActiveSectionChanged: {
|
|
|
|
Global.closeCreateChatView()
|
2021-11-01 20:10:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-05-17 14:09:22 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: rootStore.mainModuleInst
|
|
|
|
onMailserverNotWorking: {
|
2022-06-01 14:49:57 +00:00
|
|
|
if (!appLayout.mailserverNotWorkingPopup) {
|
|
|
|
appLayout.mailserverNotWorkingPopup = Global.openPopup(mailserverNotWorkingPopupComponent);
|
|
|
|
}
|
2022-05-17 14:09:22 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-01 14:49:57 +00:00
|
|
|
} // ColumnLayout
|
|
|
|
property var mailserverNotWorkingPopup: null
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2022-05-17 14:09:22 +00:00
|
|
|
Component {
|
|
|
|
id: mailserverNotWorkingPopupComponent
|
|
|
|
StatusModal {
|
|
|
|
id: msNotWorkingPopup
|
|
|
|
anchors.centerIn: parent
|
|
|
|
header.title: qsTr("Can not connect to mailserver")
|
|
|
|
onClosed: {
|
2022-06-01 14:49:57 +00:00
|
|
|
appLayout.mailserverNotWorkingPopup = null
|
2022-05-17 14:09:22 +00:00
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
width: msNotWorkingPopup.width
|
|
|
|
implicitHeight: 100
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("The mailserver you're connecting to is unavailable.")
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rightButtons: [
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Pick another")
|
|
|
|
onClicked: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.messaging)
|
|
|
|
msNotWorkingPopup.close()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Retry")
|
|
|
|
onClicked: {
|
|
|
|
// Retrying already happens automatically, so doing nothing
|
|
|
|
// here is the same as retrying...
|
|
|
|
msNotWorkingPopup.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: chooseBrowserPopupComponent
|
|
|
|
ChooseBrowserPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2020-12-29 20:33:54 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-21 12:08:44 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: inviteFriendsToCommunityPopup
|
|
|
|
InviteFriendsToCommunityPopup {
|
|
|
|
anchors.centerIn: parent
|
2022-01-10 16:44:54 +00:00
|
|
|
rootStore: appMain.rootStore
|
|
|
|
contactsStore: appMain.rootStore.contactStore
|
2021-06-17 18:41:11 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2022-03-23 10:56:25 +00:00
|
|
|
|
|
|
|
onSendInvites: {
|
|
|
|
const error = communitySectionModule.inviteUsersToCommunity(JSON.stringify(pubKeys))
|
|
|
|
processInviteResult(error)
|
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-16 12:36:27 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
2021-07-16 12:36:27 +00:00
|
|
|
id: communityProfilePopup
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
CommunityProfilePopup {
|
|
|
|
anchors.centerIn: parent
|
2022-01-19 20:07:02 +00:00
|
|
|
contactsStore: appMain.rootStore.contactStore
|
|
|
|
hasAddedContacts: appMain.rootStore.hasAddedContacts
|
2021-06-17 18:41:11 +00:00
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 09:26:13 +00:00
|
|
|
Component {
|
|
|
|
id: pinnedMessagesPopupComponent
|
|
|
|
PinnedMessagesPopup {
|
|
|
|
id: pinnedMessagesPopup
|
2022-01-05 15:50:03 +00:00
|
|
|
emojiReactionsModel: appMain.rootStore.emojiReactionsModel
|
2021-12-21 09:26:13 +00:00
|
|
|
onClosed: destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: genericConfirmationDialog
|
|
|
|
ConfirmationDialog {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-07-26 18:44:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-28 20:14:04 +00:00
|
|
|
DropArea {
|
|
|
|
id: dragTarget
|
|
|
|
|
|
|
|
signal droppedOnValidScreen(var drop)
|
|
|
|
property alias droppedUrls: rptDraggedPreviews.model
|
|
|
|
property var chatCommunitySectionModule: chatLayoutContainer.rootStore.chatCommunitySectionModule
|
|
|
|
property int activeChatType: chatCommunitySectionModule && chatCommunitySectionModule.activeItem.type
|
|
|
|
property bool enabled: !drag.source && !!loader.item && !!loader.item.appLayout
|
|
|
|
&& (
|
|
|
|
// in chat view
|
|
|
|
(mainModule.activeSection.sectionType === Constants.appSection.chat &&
|
|
|
|
(
|
|
|
|
// in a one-to-one chat
|
|
|
|
activeChatType === Constants.chatType.oneToOne ||
|
|
|
|
// in a private group chat
|
|
|
|
activeChatType === Constants.chatType.privateGroupChat
|
|
|
|
)
|
|
|
|
) ||
|
|
|
|
// In community section
|
|
|
|
mainModule.activeSection.sectionType === Constants.appSection.community
|
|
|
|
)
|
|
|
|
|
|
|
|
width: appMain.width
|
|
|
|
height: appMain.height
|
|
|
|
|
|
|
|
function cleanup() {
|
|
|
|
rptDraggedPreviews.model = []
|
|
|
|
}
|
|
|
|
|
|
|
|
onDropped: (drop) => {
|
|
|
|
if (enabled) {
|
|
|
|
droppedOnValidScreen(drop)
|
|
|
|
} else {
|
|
|
|
drop.accepted = false
|
|
|
|
}
|
|
|
|
cleanup()
|
|
|
|
}
|
|
|
|
onEntered: {
|
|
|
|
if (!enabled || !!drag.source) {
|
|
|
|
drag.accepted = false
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// needed because drag.urls is not a normal js array
|
|
|
|
rptDraggedPreviews.model = drag.urls.filter(img => Utils.hasDragNDropImageExtension(img))
|
|
|
|
}
|
|
|
|
onPositionChanged: {
|
|
|
|
rptDraggedPreviews.x = drag.x
|
|
|
|
rptDraggedPreviews.y = drag.y
|
|
|
|
}
|
|
|
|
onExited: cleanup()
|
2022-07-13 14:28:54 +00:00
|
|
|
Loader {
|
|
|
|
active: dragTarget.enabled && dragTarget.containsDrag
|
|
|
|
width: active ? parent.width : 0
|
|
|
|
height: active ? parent.height : 0
|
|
|
|
sourceComponent: Rectangle {
|
|
|
|
id: dropRectangle
|
|
|
|
color: Style.current.background
|
|
|
|
opacity: 0.8
|
|
|
|
}
|
2022-02-28 20:14:04 +00:00
|
|
|
}
|
2022-07-13 14:28:54 +00:00
|
|
|
|
2022-02-28 20:14:04 +00:00
|
|
|
Repeater {
|
|
|
|
id: rptDraggedPreviews
|
|
|
|
|
|
|
|
Image {
|
|
|
|
source: modelData
|
|
|
|
width: 80
|
|
|
|
height: 80
|
|
|
|
sourceSize.width: 160
|
|
|
|
sourceSize.height: 160
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
x: index * 10 + rptDraggedPreviews.x
|
|
|
|
y: index * 10 + rptDraggedPreviews.y
|
|
|
|
z: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
// Add SendModal here as it is used by the Wallet as well as the Browser
|
2021-06-17 18:41:11 +00:00
|
|
|
Loader {
|
|
|
|
id: sendModal
|
|
|
|
active: false
|
2022-02-04 13:07:48 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
function open() {
|
|
|
|
this.active = true
|
|
|
|
this.item.open()
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
function closed() {
|
|
|
|
// this.sourceComponent = undefined // kill an opened instance
|
|
|
|
this.active = false
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
2021-12-07 23:15:17 +00:00
|
|
|
property var selectedAccount
|
2021-06-17 18:41:11 +00:00
|
|
|
sourceComponent: SendModal {
|
2022-03-18 14:47:51 +00:00
|
|
|
anchors.centerIn: parent
|
2021-11-04 18:55:21 +00:00
|
|
|
store: appMain.rootStore
|
2022-01-04 12:06:05 +00:00
|
|
|
contactsStore: appMain.rootStore.profileSectionStore.contactsStore
|
2021-06-17 18:41:11 +00:00
|
|
|
onClosed: {
|
|
|
|
sendModal.closed()
|
|
|
|
}
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
2021-12-07 23:15:17 +00:00
|
|
|
onLoaded: {
|
2022-04-12 09:10:55 +00:00
|
|
|
if (!!sendModal.selectedAccount) {
|
2022-06-27 13:41:47 +00:00
|
|
|
item.selectedAccount = sendModal.selectedAccount
|
2021-12-07 23:15:17 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+1"
|
2021-12-06 21:10:54 +00:00
|
|
|
onTriggered: Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+2"
|
2021-12-06 21:10:54 +00:00
|
|
|
onTriggered: Global.changeAppSectionBySectionType(Constants.appSection.browser)
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+3"
|
2021-12-06 21:10:54 +00:00
|
|
|
onTriggered: Global.changeAppSectionBySectionType(Constants.appSection.wallet)
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+4, Ctrl+,"
|
2021-12-06 21:10:54 +00:00
|
|
|
onTriggered: Global.changeAppSectionBySectionType(Constants.appSection.profile)
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+K"
|
|
|
|
onTriggered: {
|
2022-02-16 16:13:45 +00:00
|
|
|
// FIXME the focus is no longer on the AppMain when the popup is opened, so this does not work to close
|
2021-06-17 18:41:11 +00:00
|
|
|
if (channelPicker.opened) {
|
|
|
|
channelPicker.close()
|
|
|
|
} else {
|
|
|
|
channelPicker.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-02-16 16:13:45 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+F"
|
|
|
|
onTriggered: {
|
|
|
|
// FIXME the focus is no longer on the AppMain when the popup is opened, so this does not work to close
|
|
|
|
if (appSearch.opened) {
|
|
|
|
appSearch.closeSearchPopup()
|
|
|
|
} else {
|
|
|
|
appSearch.openSearchPopup()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2022-02-04 13:07:48 +00:00
|
|
|
StatusSearchListPopup {
|
2021-06-17 18:41:11 +00:00
|
|
|
id: channelPicker
|
2022-02-04 13:07:48 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
x: parent.width / 2 - width / 2
|
|
|
|
y: parent.height / 2 - height / 2
|
2022-02-04 13:07:48 +00:00
|
|
|
|
|
|
|
searchBoxPlaceholder: qsTr("Where do you want to go?")
|
|
|
|
model: rootStore.chatSearchModel
|
|
|
|
delegate: StatusListItem {
|
|
|
|
property var modelData
|
|
|
|
property bool isCurrentItem: true
|
|
|
|
function filterAccepts(searchText) {
|
|
|
|
return title.includes(searchText)
|
|
|
|
}
|
|
|
|
|
|
|
|
title: modelData ? modelData.name : ""
|
|
|
|
label: modelData? modelData.sectionName : ""
|
|
|
|
highlighted: isCurrentItem
|
|
|
|
sensor.hoverEnabled: false
|
|
|
|
statusListItemIcon {
|
|
|
|
name: modelData ? modelData.name : ""
|
|
|
|
active: true
|
|
|
|
}
|
|
|
|
icon {
|
|
|
|
width: image.width
|
|
|
|
height: image.height
|
|
|
|
color: modelData ? modelData.color : ""
|
|
|
|
}
|
|
|
|
image {
|
|
|
|
source: modelData ? modelData.icon : ""
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
2021-12-13 14:24:21 +00:00
|
|
|
|
2022-02-04 13:07:48 +00:00
|
|
|
onAboutToShow: rootStore.rebuildChatSearchModel()
|
|
|
|
onSelected: {
|
|
|
|
rootStore.setActiveSectionChat(modelData.sectionId, modelData.chatId)
|
|
|
|
close()
|
2022-01-24 17:59:59 +00:00
|
|
|
}
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-23 11:59:29 +00:00
|
|
|
|
2022-05-05 10:28:54 +00:00
|
|
|
ListView {
|
|
|
|
id: toastArea
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 60
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 60
|
|
|
|
spacing: 8
|
|
|
|
verticalLayoutDirection: ListView.BottomToTop
|
|
|
|
model: appMain.rootStore.mainModuleInst.ephemeralNotificationModel
|
|
|
|
delegate: StatusToastMessage {
|
|
|
|
primaryText: model.title
|
|
|
|
secondaryText: model.subTitle
|
|
|
|
icon.name: model.icon
|
|
|
|
loading: model.loading
|
|
|
|
type: model.ephNotifType
|
|
|
|
linkUrl: model.url
|
|
|
|
duration: model.durationInMs
|
|
|
|
onLinkActivated: {
|
|
|
|
Qt.openUrlExternally(link);
|
|
|
|
}
|
|
|
|
onClose: {
|
|
|
|
appMain.rootStore.mainModuleInst.removeEphemeralNotification(model.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-23 11:59:29 +00:00
|
|
|
Component.onCompleted: {
|
2022-02-28 20:14:04 +00:00
|
|
|
Global.appMain = this;
|
2022-03-07 20:34:59 +00:00
|
|
|
const whitelist = appMain.rootStore.messagingStore.getLinkPreviewWhitelist()
|
2022-02-10 20:02:02 +00:00
|
|
|
try {
|
|
|
|
const whiteListedSites = JSON.parse(whitelist)
|
|
|
|
let settingsUpdated = false
|
2021-11-18 19:34:03 +00:00
|
|
|
|
2022-02-10 20:02:02 +00:00
|
|
|
// Add Status links to whitelist
|
|
|
|
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
|
|
|
whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false})
|
|
|
|
let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
2021-12-13 14:24:21 +00:00
|
|
|
|
2022-02-10 20:02:02 +00:00
|
|
|
if (!settings) {
|
|
|
|
settings = {}
|
|
|
|
}
|
2021-12-13 14:24:21 +00:00
|
|
|
|
2022-02-10 20:02:02 +00:00
|
|
|
// Set Status links as true. We intercept thoseURLs so it is privacy-safe
|
|
|
|
if (!settings[Constants.deepLinkPrefix] || !settings[Constants.joinStatusLink]) {
|
|
|
|
settings[Constants.deepLinkPrefix] = true
|
|
|
|
settings[Constants.joinStatusLink] = true
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
|
|
|
|
const whitelistedHostnames = []
|
|
|
|
|
|
|
|
// Add whitelisted sites in to app settings that are not already there
|
|
|
|
whiteListedSites.forEach(site => {
|
|
|
|
if (!settings.hasOwnProperty(site.address)) {
|
|
|
|
settings[site.address] = false
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
whitelistedHostnames.push(site.address)
|
|
|
|
})
|
|
|
|
// Remove any whitelisted sites from app settings that don't exist in the
|
|
|
|
// whitelist from status-go
|
|
|
|
Object.keys(settings).forEach(settingsHostname => {
|
|
|
|
if (!whitelistedHostnames.includes(settingsHostname)) {
|
|
|
|
delete settings[settingsHostname]
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (settingsUpdated) {
|
|
|
|
localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.error('Could not parse the whitelist for sites', e)
|
|
|
|
}
|
2021-12-08 21:20:43 +00:00
|
|
|
Global.settingsHasLoaded();
|
2022-01-11 23:16:17 +00:00
|
|
|
Global.errorSound = errorSound;
|
2021-09-23 11:59:29 +00:00
|
|
|
}
|
2020-05-11 21:24:08 +00:00
|
|
|
}
|