2023-02-07 14:21:32 +00:00
import QtQuick 2.15
2023-06-14 08:42:52 +00:00
import QtQuick . Layouts 1.15
import QtQuick . Dialogs 1.3
import QtQml . Models 2.15
import QtQml 2.15
import StatusQ . Core 0.1
import StatusQ . Controls 0.1
import StatusQ . Components 0.1
import StatusQ . Popups 0.1
2023-06-27 19:56:44 +00:00
import StatusQ . Core . Theme 0.1
2022-10-21 13:37:39 +00:00
import AppLayouts . Chat . popups 1.0
2023-02-07 14:21:32 +00:00
import AppLayouts . Profile . popups 1.0
2023-06-23 06:17:04 +00:00
import AppLayouts . Communities . popups 1.0
2023-02-07 14:21:32 +00:00
2023-08-02 17:39:42 +00:00
import AppLayouts . Wallet . stores 1.0 as WalletStore
import AppLayouts . Chat . stores 1.0 as ChatStore
2022-10-21 13:37:39 +00:00
import shared . popups 1.0
2023-02-07 14:21:32 +00:00
import shared . status 1.0
2022-10-21 13:37:39 +00:00
import utils 1.0
QtObject {
id: root
2023-02-07 14:21:32 +00:00
required property var popupParent
required property var rootStore
2023-04-28 10:35:18 +00:00
property var communitiesStore
2023-09-12 09:26:57 +00:00
property var devicesStore
2023-06-26 11:44:56 +00:00
property bool isDevBuild
2023-02-07 14:21:32 +00:00
2023-10-10 14:23:48 +00:00
signal openExternalLink ( string link )
signal saveDomainToUnfurledWhitelist ( string domain )
2023-02-07 14:21:32 +00:00
property var activePopupComponents: [ ]
Component.onCompleted: {
Global . openSendIDRequestPopup . connect ( openSendIDRequestPopup )
Global . openOutgoingIDRequestPopup . connect ( openOutgoingIDRequestPopup )
Global . openIncomingIDRequestPopup . connect ( openIncomingIDRequestPopup )
Global . openInviteFriendsToCommunityPopup . connect ( openInviteFriendsToCommunityPopup )
Global . openContactRequestPopup . connect ( openContactRequestPopup )
Global . openChooseBrowserPopup . connect ( openChooseBrowserPopup )
Global . openDownloadModalRequested . connect ( openDownloadModal )
Global . openImagePopup . connect ( openImagePopup )
Global . openProfilePopupRequested . connect ( openProfilePopup )
Global . openNicknamePopupRequested . connect ( openNicknamePopup )
Global . blockContactRequested . connect ( openBlockContactPopup )
Global . unblockContactRequested . connect ( openUnblockContactPopup )
Global . openChangeProfilePicPopup . connect ( openChangeProfilePicPopup )
Global . openBackUpSeedPopup . connect ( openBackUpSeedPopup )
Global . openEditDisplayNamePopup . connect ( openEditDisplayNamePopup )
Global . openPinnedMessagesPopupRequested . connect ( openPinnedMessagesPopup )
Global . openCommunityProfilePopupRequested . connect ( openCommunityProfilePopup )
2023-04-28 10:35:18 +00:00
Global . createCommunityPopupRequested . connect ( openCreateCommunityPopup )
Global . importCommunityPopupRequested . connect ( openImportCommunityPopup )
2023-07-21 17:21:11 +00:00
Global . communityIntroPopupRequested . connect ( openCommunityIntroPopup )
2023-05-10 12:22:26 +00:00
Global . removeContactRequested . connect ( openRemoveContactConfirmationPopup )
2023-02-07 14:21:32 +00:00
Global . openPopupRequested . connect ( openPopup )
2023-05-23 12:46:16 +00:00
Global . closePopupRequested . connect ( closePopup )
2023-05-19 16:07:50 +00:00
Global . openDeleteMessagePopup . connect ( openDeleteMessagePopup )
Global . openDownloadImageDialog . connect ( openDownloadImageDialog )
2023-06-14 08:42:52 +00:00
Global . leaveCommunityRequested . connect ( openLeaveCommunityPopup )
2023-06-27 19:56:44 +00:00
Global . openTestnetPopup . connect ( openTestnetPopup )
2023-07-19 05:58:21 +00:00
Global . openExportControlNodePopup . connect ( openExportControlNodePopup )
2023-07-21 08:44:10 +00:00
Global . openImportControlNodePopup . connect ( openImportControlNodePopup )
2023-08-02 17:39:42 +00:00
Global . openEditSharedAddressesFlow . connect ( openEditSharedAddressesPopup )
2023-09-14 10:02:51 +00:00
Global . openTransferOwnershipPopup . connect ( openTransferOwnershipPopup )
2023-02-07 14:21:32 +00:00
}
2023-05-23 12:46:16 +00:00
property var currentPopup
2023-02-07 14:21:32 +00:00
function openPopup ( popupComponent , params = { } , cb = null ) {
if ( activePopupComponents . includes ( popupComponent ) ) {
return
}
2023-05-23 12:46:16 +00:00
root . currentPopup = popupComponent . createObject ( popupParent , params )
root . currentPopup . open ( ) ;
2023-02-07 14:21:32 +00:00
if ( cb )
2023-05-23 12:46:16 +00:00
cb ( root . currentPopup )
2023-02-07 14:21:32 +00:00
activePopupComponents . push ( popupComponent )
2023-05-23 12:46:16 +00:00
root . currentPopup . closed . connect ( ( ) = > {
2023-02-07 14:21:32 +00:00
const removeIndex = activePopupComponents . indexOf ( popupComponent )
if ( removeIndex !== - 1 ) {
activePopupComponents . splice ( removeIndex , 1 )
}
} )
}
2023-05-23 12:46:16 +00:00
function closePopup ( ) {
if ( ! ! root . currentPopup )
root . currentPopup . close ( ) ;
}
2023-02-07 14:21:32 +00:00
function openChooseBrowserPopup ( link: string ) {
openPopup ( chooseBrowserPopupComponent , { link: link } )
}
function openDownloadModal ( available: bool , version: string , url: string ) {
const popupProperties = {
newVersionAvailable: available ,
downloadURL: url ,
currentVersion: rootStore . profileSectionStore . getCurrentVersion ( ) ,
newVersion: version
}
openPopup ( downloadPageComponent , popupProperties )
}
2023-09-05 16:04:58 +00:00
function openImagePopup ( image , url ) {
openPopup ( imagePopupComponent , { image: image , url: url } )
2023-02-07 14:21:32 +00:00
}
2023-05-30 19:01:55 +00:00
function openProfilePopup ( publicKey: string , parentPopup , cb ) {
openPopup ( profilePopupComponent , { publicKey: publicKey , parentPopup: parentPopup } , cb )
2023-02-07 14:21:32 +00:00
}
function openNicknamePopup ( publicKey: string , nickname: string , subtitle: string ) {
2023-05-23 12:46:16 +00:00
openPopup ( nicknamePopupComponent , { publicKey: publicKey , nickname: nickname , "headerSettings.subTitle" : subtitle } )
2023-02-07 14:21:32 +00:00
}
function openBlockContactPopup ( publicKey: string , contactName: string ) {
openPopup ( blockContactConfirmationComponent , { contactName: contactName , contactAddress: publicKey } )
}
function openUnblockContactPopup ( publicKey: string , contactName: string ) {
openPopup ( unblockContactConfirmationComponent , { contactName: contactName , contactAddress: publicKey } )
}
function openChangeProfilePicPopup ( cb ) {
var popup = changeProfilePicComponent . createObject ( popupParent , { callback: cb } ) ;
popup . chooseImageToCrop ( )
}
function openBackUpSeedPopup ( ) {
openPopup ( backupSeedModalComponent )
}
function openEditDisplayNamePopup ( ) {
openPopup ( displayNamePopupComponent )
}
function openCommunityProfilePopup ( store , community , communitySectionModule ) {
openPopup ( communityProfilePopup , { store: store , community: community , communitySectionModule: communitySectionModule } )
}
2022-10-21 13:37:39 +00:00
function openSendIDRequestPopup ( publicKey , cb ) {
2022-12-01 10:24:25 +00:00
const contactDetails = Utils . getContactDetailsAsJson ( publicKey , false )
2023-08-01 12:32:03 +00:00
const mainDisplayName = ProfileUtils . displayName ( contactDetails . localNickname , contactDetails . name , contactDetails . displayName , contactDetails . alias )
2023-02-07 14:21:32 +00:00
openPopup ( sendIDRequestPopupComponent , {
2022-10-21 13:37:39 +00:00
userPublicKey: publicKey ,
2023-08-01 12:32:03 +00:00
contactDetails: contactDetails ,
title: qsTr ( "Verify %1's Identity" ) . arg ( mainDisplayName ) ,
challengeText: qsTr ( "Ask a question that only the real %1 will be able to answer e.g. a question about a shared experience, or ask %1 to enter a code or phrase you have sent to them via a different communication channel (phone, post, etc...)." ) . arg ( mainDisplayName ) ,
2022-10-21 13:37:39 +00:00
buttonText: qsTr ( "Send verification request" )
2023-02-07 14:21:32 +00:00
} , cb )
2022-10-21 13:37:39 +00:00
}
function openOutgoingIDRequestPopup ( publicKey , cb ) {
try {
const verificationDetails = root . rootStore . profileSectionStore . contactsStore . getSentVerificationDetailsAsJson ( publicKey )
const popupProperties = {
userPublicKey: publicKey ,
verificationStatus: verificationDetails . requestStatus ,
verificationChallenge: verificationDetails . challenge ,
verificationResponse: verificationDetails . response ,
verificationResponseDisplayName: verificationDetails . displayName ,
verificationResponseIcon: verificationDetails . icon ,
verificationRequestedAt: verificationDetails . requestedAt ,
verificationRepliedAt: verificationDetails . repliedAt
}
2023-02-07 14:21:32 +00:00
openPopup ( contactOutgoingVerificationRequestPopupComponent , popupProperties , cb )
2022-10-21 13:37:39 +00:00
} catch ( e ) {
console . error ( "Error getting or parsing verification data" , e )
}
}
function openIncomingIDRequestPopup ( publicKey , cb ) {
2022-12-02 13:02:41 +00:00
const popupProperties = {
contactsStore: root . rootStore . profileSectionStore . contactsStore ,
publicKey: publicKey
}
2022-10-21 13:37:39 +00:00
2023-02-07 14:21:32 +00:00
openPopup ( contactVerificationRequestPopupComponent , popupProperties , cb )
2022-10-21 13:37:39 +00:00
}
function openInviteFriendsToCommunityPopup ( community , communitySectionModule , cb ) {
2023-02-07 14:21:32 +00:00
openPopup ( inviteFriendsToCommunityPopup , { community: community , communitySectionModule: communitySectionModule } , cb )
2022-10-21 13:37:39 +00:00
}
function openContactRequestPopup ( publicKey , cb ) {
2022-12-01 10:24:25 +00:00
const contactDetails = Utils . getContactDetailsAsJson ( publicKey , false )
2022-10-21 13:37:39 +00:00
const popupProperties = {
userPublicKey: publicKey ,
2023-08-01 12:32:03 +00:00
contactDetails: contactDetails
2022-10-21 13:37:39 +00:00
}
2023-02-07 14:21:32 +00:00
openPopup ( sendContactRequestPopupComponent , popupProperties , cb )
}
2023-03-24 09:48:05 +00:00
function openPinnedMessagesPopup ( store , messageStore , pinnedMessagesModel , messageToPin , chatId ) {
openPopup ( pinnedMessagesPopup , {
store: store ,
messageStore: messageStore ,
pinnedMessagesModel: pinnedMessagesModel ,
messageToPin: messageToPin ,
chatId: chatId
} )
2023-02-07 14:21:32 +00:00
}
function openCommunityPopup ( store , community , chatCommunitySectionModule ) {
openPopup ( communityProfilePopup , { store: store , community: community , chatCommunitySectionModule: chatCommunitySectionModule } )
2022-10-21 13:37:39 +00:00
}
2023-04-28 10:35:18 +00:00
function openCreateCommunityPopup ( isDiscordImport ) {
openPopup ( createCommunitiesPopupComponent , { isDiscordImport: isDiscordImport } )
}
function openImportCommunityPopup ( ) {
openPopup ( importCommunitiesPopupComponent )
}
2023-07-21 17:21:11 +00:00
function openCommunityIntroPopup ( communityId , name , introMessage ,
imageSrc , accessType , isInvitationPending ) {
openPopup ( communityIntroDialogPopup ,
{ communityId: communityId ,
name: name ,
introMessage: introMessage ,
imageSrc: imageSrc ,
accessType: accessType ,
isInvitationPending: isInvitationPending
2023-08-02 17:39:42 +00:00
} )
}
function openEditSharedAddressesPopup ( communityId ) {
openPopup ( editSharedAddressesPopupComponent , { communityId: communityId , isEditMode: true } )
2023-07-21 17:21:11 +00:00
}
2023-09-01 07:58:48 +00:00
function openDiscordImportProgressPopup ( importingSingleChannel ) {
openPopup ( discordImportProgressDialog , { importingSingleChannel: importingSingleChannel } )
2023-04-28 10:35:18 +00:00
}
2023-05-10 12:22:26 +00:00
function openRemoveContactConfirmationPopup ( displayName , publicKey ) {
openPopup ( removeContactConfirmationDialog , {
displayName: displayName ,
publicKey: publicKey
} )
}
2023-05-19 16:07:50 +00:00
function openDeleteMessagePopup ( messageId , messageStore ) {
openPopup ( deleteMessageConfirmationDialogComponent ,
{
messageId ,
messageStore
} )
}
function openDownloadImageDialog ( imageSource ) {
// We don't use `openPopup`, because there's no `FileDialog::closed` signal.
const popup = downloadImageDialogComponent . createObject ( popupParent , { imageSource } )
popup . open ( )
}
2023-06-14 08:42:52 +00:00
function openLeaveCommunityPopup ( community , communityId , outroMessage ) {
openPopup ( leaveCommunityPopupComponent , { community , communityId , outroMessage } )
}
2023-06-27 19:56:44 +00:00
function openTestnetPopup ( ) {
openPopup ( testnetModal )
}
2023-09-12 09:26:57 +00:00
function openExportControlNodePopup ( community ) {
openPopup ( exportControlNodePopup , { community } )
2023-07-19 05:58:21 +00:00
}
2023-09-12 09:26:57 +00:00
function openImportControlNodePopup ( community ) {
openPopup ( importControlNodePopup , { community } )
2023-07-21 08:44:10 +00:00
}
2023-09-14 10:02:51 +00:00
function openTransferOwnershipPopup ( communityName , communityLogo , token , accounts , sendModalPopup ) {
openPopup ( transferOwnershipPopup , { communityName , communityLogo , token , accounts , sendModalPopup } )
}
2023-10-10 14:23:48 +00:00
function openConfirmExternalLinkPopup ( link , domain ) {
openPopup ( confirmExternalLinkPopup , { link , domain } )
}
2023-02-07 14:21:32 +00:00
readonly property list < Component > _components : [
2023-05-10 12:22:26 +00:00
Component {
id: removeContactConfirmationDialog
ConfirmationDialog {
property string displayName
property string publicKey
2023-05-23 12:46:16 +00:00
headerSettings.title: qsTr ( "Remove '%1' as a contact" ) . arg ( displayName )
2023-05-10 12:22:26 +00:00
confirmationText: qsTr ( "This will mean that you and '%1' will no longer be able to send direct messages to each other. You will need to send them a new Contact Request in order to message again. All previous direct messages between you and '%1' will be retained in read-only mode." ) . arg ( displayName )
showCancelButton: true
cancelBtnType: ""
onConfirmButtonClicked: {
rootStore . contactStore . removeContact ( publicKey ) ;
close ( ) ;
}
onCancelButtonClicked: {
close ( ) ;
}
onClosed: { destroy ( ) ; }
}
} ,
2022-10-21 13:37:39 +00:00
Component {
id: contactVerificationRequestPopupComponent
ContactVerificationRequestPopup {
onResponseSent: {
root . rootStore . profileSectionStore . contactsStore . acceptVerificationRequest ( senderPublicKey , response )
}
onVerificationRefused: {
root . rootStore . profileSectionStore . contactsStore . declineVerificationRequest ( senderPublicKey )
}
onClosed: destroy ( )
}
} ,
Component {
id: contactOutgoingVerificationRequestPopupComponent
OutgoingContactVerificationRequestPopup {
onVerificationRequestCanceled: {
root . rootStore . profileSectionStore . contactsStore . cancelVerificationRequest ( userPublicKey )
}
onUntrustworthyVerified: {
root . rootStore . profileSectionStore . contactsStore . verifiedUntrustworthy ( userPublicKey )
}
onTrustedVerified: {
root . rootStore . profileSectionStore . contactsStore . verifiedTrusted ( userPublicKey )
}
onClosed: destroy ( )
}
} ,
Component {
id: sendIDRequestPopupComponent
SendContactRequestModal {
2023-04-06 07:56:50 +00:00
rootStore: root . rootStore
2022-10-21 13:37:39 +00:00
onAccepted: root . rootStore . profileSectionStore . contactsStore . sendVerificationRequest ( userPublicKey , message )
onClosed: destroy ( )
}
} ,
Component {
id: inviteFriendsToCommunityPopup
InviteFriendsToCommunityPopup {
rootStore: root . rootStore
contactsStore: root . rootStore . contactStore
onClosed: destroy ( )
}
} ,
Component {
id: sendContactRequestPopupComponent
SendContactRequestModal {
2023-04-06 07:56:50 +00:00
rootStore: root . rootStore
2022-10-21 13:37:39 +00:00
onAccepted: root . rootStore . profileSectionStore . contactsStore . sendContactRequest ( userPublicKey , message )
onClosed: destroy ( )
}
2023-02-07 14:21:32 +00:00
} ,
Component {
id: backupSeedModalComponent
BackupSeedModal {
privacyStore: rootStore . profileSectionStore . privacyStore
onClosed: destroy ( )
}
} ,
Component {
id: displayNamePopupComponent
DisplayNamePopup {
profileStore: rootStore . profileSectionStore . profileStore
onClosed: destroy ( )
}
} ,
Component {
id: downloadPageComponent
DownloadPage {
onClosed: destroy ( )
}
} ,
Component {
id: imagePopupComponent
StatusImageModal {
id: imagePopup
onClosed: destroy ( )
}
} ,
Component {
id: profilePopupComponent
ProfileDialog {
id: profilePopup
profileStore: rootStore . profileSectionStore . profileStore
contactsStore: rootStore . profileSectionStore . contactsStore
2023-02-28 15:00:10 +00:00
communitiesModel: rootStore . profileSectionStore . communitiesList
2023-02-07 14:21:32 +00:00
onClosed: {
if ( profilePopup . parentPopup ) {
profilePopup . parentPopup . close ( )
}
destroy ( )
}
}
} ,
Component {
id: changeProfilePicComponent
ImageCropWorkflow {
title: qsTr ( "Profile Picture" )
acceptButtonText: qsTr ( "Make this my Profile Pic" )
onImageCropped: {
if ( callback ) {
callback ( image ,
cropRect . x . toFixed ( ) ,
cropRect . y . toFixed ( ) ,
( cropRect . x + cropRect . width ) . toFixed ( ) ,
( cropRect . y + cropRect . height ) . toFixed ( ) )
return
}
rootStore . profileSectionStore . profileStore . uploadImage ( image ,
cropRect . x . toFixed ( ) ,
cropRect . y . toFixed ( ) ,
( cropRect . x + cropRect . width ) . toFixed ( ) ,
( cropRect . y + cropRect . height ) . toFixed ( ) ) ;
}
onDone: destroy ( )
}
} ,
Component {
id: chooseBrowserPopupComponent
ChooseBrowserPopup {
onClosed: destroy ( )
}
} ,
Component {
id: communityProfilePopup
CommunityProfilePopup {
contactsStore: rootStore . contactStore
hasAddedContacts: rootStore . hasAddedContacts
onClosed: destroy ( )
}
} ,
Component {
id: pinnedMessagesPopup
PinnedMessagesPopup {
onClosed: destroy ( )
}
} ,
Component {
id: nicknamePopupComponent
NicknamePopup {
onEditDone: {
if ( nickname !== newNickname ) {
rootStore . contactStore . changeContactNickname ( publicKey , newNickname )
2023-04-19 16:28:23 +00:00
Global . contactRenamed ( publicKey )
2023-02-07 14:21:32 +00:00
}
close ( )
}
onClosed: destroy ( )
}
} ,
Component {
id: unblockContactConfirmationComponent
UnblockContactConfirmationDialog {
onUnblockButtonClicked: {
rootStore . contactStore . unblockContact ( contactAddress )
close ( )
}
onClosed: destroy ( )
}
} ,
Component {
id: blockContactConfirmationComponent
BlockContactConfirmationDialog {
onBlockButtonClicked: {
rootStore . contactStore . blockContact ( contactAddress )
close ( )
}
onClosed: destroy ( )
}
2023-04-28 10:35:18 +00:00
} ,
Component {
id: importCommunitiesPopupComponent
ImportCommunityPopup {
store: root . communitiesStore
2023-07-21 17:21:11 +00:00
onJoinCommunity: {
2023-08-02 17:39:42 +00:00
close ( )
openCommunityIntroPopup ( communityId ,
communityDetails . name ,
communityDetails . introMessage ,
communityDetails . image ,
communityDetails . access ,
root . rootStore . isCommunityRequestPending ( communityId ) )
2023-07-21 17:21:11 +00:00
}
2023-08-02 17:39:42 +00:00
onClosed: destroy ( )
2023-07-21 17:21:11 +00:00
}
} ,
Component {
id: communityIntroDialogPopup
CommunityIntroDialog {
id: communityIntroDialog
property string communityId
loginType: root . rootStore . loginType
2023-08-22 18:04:58 +00:00
requirementsCheckPending: root . rootStore . requirementsCheckPending
2023-07-31 15:56:00 +00:00
walletAccountsModel: root . rootStore . walletAccountsModel
2023-08-21 18:54:57 +00:00
permissionsModel: {
root . rootStore . prepareTokenModelForCommunity ( communityIntroDialog . communityId )
return root . rootStore . permissionsModel
}
2023-07-21 17:21:11 +00:00
assetsModel: root . rootStore . assetsModel
collectiblesModel: root . rootStore . collectiblesModel
2023-08-21 20:03:08 +00:00
onJoined: root . rootStore . requestToJoinCommunityWithAuthentication ( communityIntroDialog . communityId , communityIntroDialog . name , sharedAddresses , airdropAddress )
2023-07-21 17:21:11 +00:00
onCancelMembershipRequest: root . rootStore . cancelPendingRequest ( communityIntroDialog . communityId )
Connections {
target: root . communitiesStore . communitiesModuleInst
function onCommunityAccessRequested ( communityId: string ) {
2023-08-02 17:39:42 +00:00
if ( communityId !== communityIntroDialog . communityId )
return
2023-07-21 17:21:11 +00:00
root . communitiesStore . spectateCommunity ( communityId ) ;
communityIntroDialog . close ( ) ;
}
function onCommunityAccessFailed ( communityId: string ) {
2023-08-02 17:39:42 +00:00
if ( communityId !== communityIntroDialog . communityId )
return
2023-07-21 17:21:11 +00:00
communityIntroDialog . close ( ) ;
}
function onUserAuthenticationCanceled ( ) {
communityIntroDialog . close ( ) ;
}
2023-04-28 10:35:18 +00:00
}
2023-08-21 18:54:57 +00:00
onSharedAddressesUpdated: {
root . rootStore . updatePermissionsModel ( communityIntroDialog . communityId , sharedAddresses )
}
2023-08-03 11:00:11 +00:00
onAboutToShow: { root . rootStore . communityKeyToImport = communityIntroDialog . communityId ; }
onClosed: { root . rootStore . communityKeyToImport = "" ; destroy ( ) ; }
2023-04-28 10:35:18 +00:00
}
} ,
Component {
id: createCommunitiesPopupComponent
CreateCommunityPopup {
store: root . communitiesStore
2023-06-26 11:44:56 +00:00
isDevBuild: root . isDevBuild
2023-04-28 10:35:18 +00:00
onClosed: {
destroy ( )
}
}
} ,
Component {
id: discordImportProgressDialog
DiscordImportProgressDialog {
store: root . communitiesStore
}
2023-05-19 16:07:50 +00:00
} ,
Component {
id: deleteMessageConfirmationDialogComponent
DeleteMessageConfirmationPopup {
onClosed: destroy ( )
}
} ,
Component {
id: downloadImageDialogComponent
FileDialog {
property string imageSource
title: qsTr ( "Please choose a directory" )
selectFolder: true
selectExisting: true
selectMultiple: false
modality: Qt . NonModal
onAccepted: {
Utils . downloadImageByUrl ( imageSource , fileUrl )
destroy ( )
}
onRejected: {
destroy ( )
}
}
2023-06-14 08:42:52 +00:00
} ,
Component {
id: leaveCommunityPopupComponent
StatusModal {
id: leavePopup
property string community
property string communityId
property string outroMessage
headerSettings.title: qsTr ( "Are you sure want to leave '%1'?" ) . arg ( community )
padding: 16
width: 640
contentItem: ColumnLayout {
spacing: 16
StatusBaseText {
id: outroMessage
Layout.fillWidth: true
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
text: leavePopup . outroMessage
visible: ! ! text
}
StatusMenuSeparator {
Layout.fillWidth: true
visible: outroMessage . visible
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
font.pixelSize: 13
text: qsTr ( "You will need to request to join if you want to become a member again in the future. If you joined the Community via public key ensure you have a copy of it before you go." )
}
}
rightButtons: [
StatusFlatButton {
text: qsTr ( "Cancel" )
onClicked: leavePopup . close ( )
} ,
StatusButton {
objectName: "CommunitiesListPanel_leaveCommunityButtonInPopup"
type: StatusBaseButton . Type . Danger
text: qsTr ( "Leave %1" ) . arg ( leavePopup . community )
onClicked: {
leavePopup . close ( )
2023-06-21 20:37:51 +00:00
root . rootStore . profileSectionStore . communitiesProfileModule . leaveCommunity ( leavePopup . communityId )
2023-06-14 08:42:52 +00:00
}
}
]
onClosed: destroy ( )
}
2023-06-27 19:56:44 +00:00
} ,
Component {
id: testnetModal
AlertPopup {
width: 521
readonly property string mainTitle: root . rootStore . profileSectionStore . walletStore . areTestNetworksEnabled ? qsTr ( "Turn off testnet mode" ) : qsTr ( "Turn on testnet mode" )
title: mainTitle
alertLabel.textFormat: Text . RichText
alertText: root . rootStore . profileSectionStore . walletStore . areTestNetworksEnabled ?
qsTr ( "Are you sure you want to turn off %1? All future transactions will be performed on live networks with real funds" ) . arg ( "<html><span style='font-weight: 500;'>testnet mode</span></html>" ) :
qsTr ( "Are you sure you want to turn on %1? In this mode, all blockchain data displayed will come from testnets and all blockchain interactions will be with testnets. Testnet mode switches the entire app to using testnets only. Please switch this mode on only if you know exactly why you need to use it." ) . arg ( "<html><span style='font-weight: 500;'>testnet mode</span></html>" )
acceptBtnText: mainTitle
acceptBtnType: root . rootStore . profileSectionStore . walletStore . areTestNetworksEnabled ? StatusBaseButton.Type.Normal : StatusBaseButton . Type . Warning
asset.name: "settings"
asset.color: Theme . palette . warningColor1
asset.bgColor: Theme . palette . warningColor3
onAcceptClicked: {
root . rootStore . profileSectionStore . walletStore . toggleTestNetworksEnabled ( )
Global . displayToastMessage ( root . rootStore . profileSectionStore . walletStore . areTestNetworksEnabled ? qsTr ( "Testnet mode turned on" ) : qsTr ( "Testnet mode turned off" ) , "" , "checkmark-circle" , false , Constants . ephemeralNotificationType . success , "" )
}
onCancelClicked: close ( )
}
2023-07-19 05:58:21 +00:00
} ,
Component {
id: exportControlNodePopup
ExportControlNodePopup {
2023-09-12 09:26:57 +00:00
devicesStore: root . devicesStore
2023-07-19 05:58:21 +00:00
onClosed: destroy ( )
}
2023-07-21 08:44:10 +00:00
} ,
Component {
id: importControlNodePopup
ImportControlNodePopup {
onClosed: destroy ( )
2023-09-12 09:26:57 +00:00
onImportControlNode: console . warn ( "!!! TODO importControlNode for community:" , community . name ) // FIXME implement moving (importing) the control node
2023-07-21 08:44:10 +00:00
}
2023-08-02 17:39:42 +00:00
} ,
Component {
id: editSharedAddressesPopupComponent
SharedAddressesPopup {
id: editSharedAddressesPopup
2023-07-21 08:44:10 +00:00
2023-08-24 20:36:38 +00:00
readonly property var oldSharedAddresses: root . rootStore . myRevealedAddressesForCurrentCommunity
readonly property string oldAirdropAddress: root . rootStore . myRevealedAirdropAddressForCurrentCommunity
onOldSharedAddressesChanged: {
editSharedAddressesPopup . setOldSharedAddresses (
editSharedAddressesPopup . oldSharedAddresses
)
}
onOldAirdropAddressChanged: {
editSharedAddressesPopup . setOldAirdropAddress (
editSharedAddressesPopup . oldAirdropAddress
)
}
2023-08-02 17:39:42 +00:00
property string communityId
readonly property var chatStore: ChatStore . RootStore {
contactsStore: root . rootStore . contactStore
chatCommunitySectionModule: {
root . rootStore . mainModuleInst . prepareCommunitySectionModuleForCommunityId ( editSharedAddressesPopup . communityId )
return root . rootStore . mainModuleInst . getCommunitySectionModule ( )
}
}
communityName: chatStore . sectionDetails . name
communityIcon: chatStore . sectionDetails . image
2023-08-22 18:04:58 +00:00
requirementsCheckPending: root . rootStore . requirementsCheckPending
2023-08-02 17:39:42 +00:00
loginType: chatStore . loginType
2023-08-29 15:28:41 +00:00
walletAccountsModel: root . rootStore . walletAccountsModel
2023-08-21 18:54:57 +00:00
permissionsModel: {
root . rootStore . prepareTokenModelForCommunity ( editSharedAddressesPopup . communityId )
return root . rootStore . permissionsModel
}
2023-08-02 17:39:42 +00:00
assetsModel: chatStore . assetsModel
collectiblesModel: chatStore . collectiblesModel
2023-08-21 20:03:08 +00:00
onSharedAddressesChanged: root . rootStore . updatePermissionsModel (
editSharedAddressesPopup . communityId , sharedAddresses )
onSaveSelectedAddressesClicked: root . rootStore . editSharedAddressesWithAuthentication (
editSharedAddressesPopup . communityId , sharedAddresses , airdropAddress )
2023-08-02 17:39:42 +00:00
onClosed: destroy ( )
}
2023-09-14 10:02:51 +00:00
} ,
Component {
id: transferOwnershipPopup
TransferOwnershipPopup {
onClosed: destroy ( )
}
2023-10-10 14:23:48 +00:00
} ,
Component {
id: confirmExternalLinkPopup
ConfirmExternalLinkPopup {
destroyOnClose: true
onOpenExternalLink: root . openExternalLink ( link )
onSaveDomainToUnfurledWhitelist: root . saveDomainToUnfurledWhitelist ( domain )
}
2023-08-02 17:39:42 +00:00
}
2022-10-21 13:37:39 +00:00
]
}