parent
a9d25697dd
commit
99c7b33e1e
|
@ -73,6 +73,9 @@ QtObject {
|
|||
|
||||
property var savedAddressesModel: walletSectionSavedAddresses.model
|
||||
|
||||
readonly property bool showBrowserSelector: localAccountSensitiveSettings.showBrowserSelector
|
||||
readonly property bool openLinksInStatus: localAccountSensitiveSettings.openLinksInStatus
|
||||
|
||||
property var allNetworks: networksModule.all
|
||||
|
||||
function getEtherscanLink() {
|
||||
|
@ -98,6 +101,10 @@ QtObject {
|
|||
globalUtils.copyToClipboard(text)
|
||||
}
|
||||
|
||||
function plainText(text) {
|
||||
return globalUtils.plainText(text);
|
||||
}
|
||||
|
||||
function generateAlias(pk) {
|
||||
return globalUtils.generateAlias(pk);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,6 @@ Item {
|
|||
|
||||
onOpenActivityCenterPopupRequested: {
|
||||
Global.openPopup(activityCenterPopupComponent)
|
||||
Global.activityCenterPopupOpened = true
|
||||
}
|
||||
|
||||
onOpenChangeProfilePicPopup: {
|
||||
|
@ -154,6 +153,43 @@ Item {
|
|||
appMain.rootStore.mainModuleInst.displayEphemeralNotification(title, subTitle, icon, loading, ephNotifType, url);
|
||||
}
|
||||
onOpenEditDisplayNamePopup: Global.openPopup(displayNamePopupComponent)
|
||||
|
||||
onOpenPopupRequested: {
|
||||
const popup = popupComponent.createObject(appMain, params);
|
||||
popup.open();
|
||||
return popup;
|
||||
}
|
||||
|
||||
onOpenLink: {
|
||||
// Qt sometimes inserts random HTML tags; and this will break on invalid URL inside QDesktopServices::openUrl(link)
|
||||
link = appMain.rootStore.plainText(link);
|
||||
if (appMain.rootStore.showBrowserSelector) {
|
||||
Global.openChooseBrowserPopup(link);
|
||||
} else {
|
||||
if (appMain.rootStore.openLinksInStatus) {
|
||||
Global.changeAppSectionBySectionType(Constants.appSection.browser);
|
||||
Global.openLinkInBrowser(link);
|
||||
} else {
|
||||
Qt.openUrlExternally(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSetNthEnabledSectionActive: {
|
||||
if(!appMain.rootStore.mainModuleInst)
|
||||
return
|
||||
appMain.rootStore.mainModuleInst.setNthEnabledSectionActive(nthSection)
|
||||
}
|
||||
|
||||
onAppSectionBySectionTypeChanged: {
|
||||
if(!appMain.rootStore.mainModuleInst)
|
||||
return
|
||||
|
||||
appMain.rootStore.mainModuleInst.setActiveSectionBySectionType(sectionType)
|
||||
if (sectionType === Constants.appSection.profile) {
|
||||
Global.settingsSubsection = subsection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeAppSectionBySectionId(sectionId) {
|
||||
|
@ -1045,9 +1081,6 @@ Item {
|
|||
height: appView.height - _buttonSize * 2
|
||||
store: chatLayoutContainer.rootStore
|
||||
activityCenterStore: appMain.activityCenterStore
|
||||
onClosed: {
|
||||
Global.activityCenterPopupOpened = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1090,6 @@ Item {
|
|||
onEditDone: {
|
||||
if (nickname !== newNickname) {
|
||||
appMain.rootStore.contactStore.changeContactNickname(publicKey, newNickname)
|
||||
Global.nickNameChanged(publicKey, newNickname)
|
||||
}
|
||||
close()
|
||||
}
|
||||
|
@ -1070,7 +1102,6 @@ Item {
|
|||
UnblockContactConfirmationDialog {
|
||||
onUnblockButtonClicked: {
|
||||
appMain.rootStore.contactStore.unblockContact(contactAddress)
|
||||
Global.contactUnblocked(contactAddress)
|
||||
close()
|
||||
}
|
||||
onClosed: destroy()
|
||||
|
@ -1082,7 +1113,6 @@ Item {
|
|||
BlockContactConfirmationDialog {
|
||||
onBlockButtonClicked: {
|
||||
appMain.rootStore.contactStore.blockContact(contactAddress)
|
||||
Global.contactBlocked(contactAddress)
|
||||
close()
|
||||
}
|
||||
onClosed: destroy()
|
||||
|
@ -1325,7 +1355,6 @@ Item {
|
|||
} catch (e) {
|
||||
console.error('Could not parse the whitelist for sites', e)
|
||||
}
|
||||
Global.privacyModuleInst = appMain.rootStore.profileSectionStore.privacyStore.privacyModule
|
||||
Global.settingsLoaded()
|
||||
}
|
||||
|
||||
|
|
|
@ -5,121 +5,74 @@ import QtQml 2.14
|
|||
QtObject {
|
||||
id: root
|
||||
|
||||
property var applicationWindow
|
||||
property var appMain
|
||||
property var dragArea
|
||||
property var appMain
|
||||
property var applicationWindow
|
||||
property bool popupOpened: false
|
||||
property int settingsSubsection: Constants.settingsSubsection.profile
|
||||
|
||||
property var globalUtilsInst: typeof globalUtils !== "undefined" ? globalUtils : null
|
||||
property var userProfile
|
||||
property var mainModuleInst: typeof mainModule !== "undefined" ? mainModule : null
|
||||
property var privacyModuleInst
|
||||
property var toastMessage
|
||||
property var pinnedMessagesPopup
|
||||
property var communityProfilePopup
|
||||
property bool profilePopupOpened: false
|
||||
|
||||
property bool activityCenterPopupOpened: false
|
||||
|
||||
property var sendMessageSound
|
||||
property var notificationSound
|
||||
property var errorSound
|
||||
|
||||
signal openImagePopup(var image, var contextMenu)
|
||||
signal openLinkInBrowser(string link)
|
||||
signal openChooseBrowserPopup(string link)
|
||||
signal openDownloadModalRequested(bool available, string version, string url)
|
||||
signal settingsLoaded()
|
||||
signal openBackUpSeedPopup()
|
||||
signal openCreateChatView()
|
||||
signal closeCreateChatView()
|
||||
|
||||
signal openProfilePopupRequested(string publicKey, var parentPopup)
|
||||
|
||||
signal openNicknamePopupRequested(string publicKey, string nickname, string subtitle)
|
||||
signal nickNameChanged(string publicKey, string nickname)
|
||||
|
||||
signal blockContactRequested(string publicKey, string contactName)
|
||||
signal contactBlocked(string publicKey)
|
||||
signal unblockContactRequested(string publicKey, string contactName)
|
||||
signal contactUnblocked(string publicKey)
|
||||
|
||||
signal openChangeProfilePicPopup(var cb)
|
||||
signal displayToastMessage(string title, string subTitle, string icon, bool loading, int ephNotifType, string url)
|
||||
|
||||
signal openPopupRequested(var popupComponent, var params);
|
||||
signal openNicknamePopupRequested(string publicKey, string nickname, string subtitle)
|
||||
signal openDownloadModalRequested(bool available, string version, string url)
|
||||
signal openChangeProfilePicPopup(var cb)
|
||||
signal openBackUpSeedPopup()
|
||||
signal openImagePopup(var image, var contextMenu)
|
||||
signal openProfilePopupRequested(string publicKey, var parentPopup)
|
||||
signal openEditDisplayNamePopup()
|
||||
signal openActivityCenterPopupRequested
|
||||
|
||||
signal openContactRequestPopup(string publicKey, var cb)
|
||||
|
||||
signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb)
|
||||
|
||||
signal openActivityCenterPopupRequested()
|
||||
signal openSendIDRequestPopup(string publicKey, var cb)
|
||||
|
||||
signal openContactRequestPopup(string publicKey, var cb)
|
||||
signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb)
|
||||
signal openIncomingIDRequestPopup(string publicKey, var cb)
|
||||
|
||||
signal openOutgoingIDRequestPopup(string publicKey, var cb)
|
||||
|
||||
signal openLink(string link)
|
||||
|
||||
signal setNthEnabledSectionActive(int nthSection)
|
||||
signal appSectionBySectionTypeChanged(int sectionType, int subsection)
|
||||
|
||||
function openProfilePopup(publicKey, parentPopup) {
|
||||
openProfilePopupRequested(publicKey, parentPopup)
|
||||
root.openProfilePopupRequested(publicKey, parentPopup)
|
||||
}
|
||||
|
||||
function openActivityCenterPopup() {
|
||||
openActivityCenterPopupRequested()
|
||||
root.openActivityCenterPopupRequested();
|
||||
}
|
||||
|
||||
function openPopup(popupComponent, params = {}) {
|
||||
const popup = popupComponent.createObject(root.appMain, params)
|
||||
popup.open()
|
||||
return popup
|
||||
root.openPopupRequested(popupComponent, params);
|
||||
}
|
||||
|
||||
function openDownloadModal(available, version, url){
|
||||
openDownloadModalRequested(available, version, url);
|
||||
root.openDownloadModalRequested(available, version, url);
|
||||
}
|
||||
|
||||
function changeAppSectionBySectionType(sectionType, subsection = 0) {
|
||||
if(!root.mainModuleInst)
|
||||
return
|
||||
|
||||
mainModuleInst.setActiveSectionBySectionType(sectionType)
|
||||
if (sectionType === Constants.appSection.profile) {
|
||||
settingsSubsection = subsection;
|
||||
}
|
||||
}
|
||||
|
||||
function setNthEnabledSectionActive(nthSection) {
|
||||
if(!root.mainModuleInst)
|
||||
return
|
||||
mainModuleInst.setNthEnabledSectionActive(nthSection)
|
||||
}
|
||||
|
||||
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
|
||||
if (isCurrentUser || (isCurrentUser === undefined && pubkey === userProfile.pubKey)) {
|
||||
return userProfile.icon;
|
||||
}
|
||||
|
||||
let contactDetails = Utils.getContactDetailsAsJson(pubkey)
|
||||
return contactDetails.displayIcon
|
||||
}
|
||||
|
||||
function openLink(link) {
|
||||
// Qt sometimes inserts random HTML tags; and this will break on invalid URL inside QDesktopServices::openUrl(link)
|
||||
link = globalUtilsInst.plainText(link);
|
||||
if (localAccountSensitiveSettings.showBrowserSelector) {
|
||||
openChooseBrowserPopup(link);
|
||||
} else {
|
||||
if (localAccountSensitiveSettings.openLinksInStatus) {
|
||||
changeAppSectionBySectionType(Constants.appSection.browser);
|
||||
openLinkInBrowser(link);
|
||||
} else {
|
||||
Qt.openUrlExternally(link);
|
||||
}
|
||||
}
|
||||
root.appSectionBySectionTypeChanged(sectionType, subsection);
|
||||
}
|
||||
|
||||
function playErrorSound() {
|
||||
if(errorSound)
|
||||
errorSound.play();
|
||||
if (root.errorSound)
|
||||
root.errorSound.play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,15 +124,17 @@ StatusWindow {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO remove direct backend access
|
||||
Connections {
|
||||
id: windowsOsNotificationsConnection
|
||||
enabled: Qt.platform.os === Constants.windows
|
||||
target: Global.mainModuleInst
|
||||
target: typeof mainModule !== "undefined" ? mainModule : null
|
||||
function onDisplayWindowsOsNotification(title, message) {
|
||||
systemTray.showMessage(title, message)
|
||||
}
|
||||
}
|
||||
|
||||
//TODO remove direct backend access
|
||||
Connections {
|
||||
target: startupModule
|
||||
|
||||
|
@ -153,7 +155,6 @@ StatusWindow {
|
|||
}
|
||||
else if(state === Constants.appState.main) {
|
||||
// We set main module to the Global singleton once user is logged in and we move to the main app.
|
||||
Global.mainModuleInst = mainModule
|
||||
Global.userProfile = userProfile
|
||||
|
||||
loader.sourceComponent = app
|
||||
|
@ -202,6 +203,7 @@ StatusWindow {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO remove direct backend access
|
||||
Connections {
|
||||
target: singleInstance
|
||||
|
||||
|
|
Loading…
Reference in New Issue