Add window.makePopup(), utils.makePopup() wrapper
This commit is contained in:
parent
c813e92ac7
commit
a389238024
@ -14,10 +14,10 @@ HMenuItem {
|
|||||||
|
|
||||||
utils.makePopup(
|
utils.makePopup(
|
||||||
popup,
|
popup,
|
||||||
|
null,
|
||||||
utils.objectUpdate(
|
utils.objectUpdate(
|
||||||
{ focusOnClosed: menu.previouslyFocused }, properties,
|
{ focusOnClosed: menu.previouslyFocused }, properties,
|
||||||
),
|
),
|
||||||
null,
|
|
||||||
autoDestruct,
|
autoDestruct,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ HTile {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
actionMenu.focusOnClosed = null
|
actionMenu.focusOnClosed = null
|
||||||
|
|
||||||
utils.makePopup(
|
window.makePopup(
|
||||||
"Popups/KeyVerificationPopup.qml",
|
"Popups/KeyVerificationPopup.qml",
|
||||||
{
|
{
|
||||||
focusOnClosed: nameField,
|
focusOnClosed: nameField,
|
||||||
|
@ -49,7 +49,7 @@ HColumnPage {
|
|||||||
|
|
||||||
function deleteDevices(...indice) {
|
function deleteDevices(...indice) {
|
||||||
if (indice.length === 1 && indice[0] === 0) {
|
if (indice.length === 1 && indice[0] === 0) {
|
||||||
utils.makePopup("Popups/SignOutPopup.qml", { userId: page.userId })
|
window.makePopup("Popups/SignOutPopup.qml", {userId: page.userId})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,14 +62,14 @@ HColumnPage {
|
|||||||
deviceIds.push(deviceList.model.get(i).id)
|
deviceIds.push(deviceList.model.get(i).id)
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.makePopup(
|
window.makePopup(
|
||||||
"Popups/DeleteDevicesPopup.qml",
|
"Popups/DeleteDevicesPopup.qml",
|
||||||
{
|
{
|
||||||
userId: page.userId,
|
userId: page.userId,
|
||||||
deviceIds,
|
deviceIds,
|
||||||
deletedCallback: () => {
|
deletedCallback: () => {
|
||||||
deleteOwnDevice ?
|
deleteOwnDevice ?
|
||||||
utils.makePopup(
|
window.makePopup(
|
||||||
"Popups/SignOutPopup.qml", { userId: page.userId },
|
"Popups/SignOutPopup.qml", { userId: page.userId },
|
||||||
) :
|
) :
|
||||||
page.loadDevices()
|
page.loadDevices()
|
||||||
|
@ -23,7 +23,7 @@ Banner {
|
|||||||
|
|
||||||
buttonCallbacks: ({
|
buttonCallbacks: ({
|
||||||
forget: button => {
|
forget: button => {
|
||||||
utils.makePopup(
|
window.makePopup(
|
||||||
"Popups/ForgetRoomPopup.qml",
|
"Popups/ForgetRoomPopup.qml",
|
||||||
{
|
{
|
||||||
userId: chat.userId,
|
userId: chat.userId,
|
||||||
@ -31,7 +31,7 @@ Banner {
|
|||||||
roomName: chat.roomInfo.display_name,
|
roomName: chat.roomInfo.display_name,
|
||||||
},
|
},
|
||||||
obj => {
|
obj => {
|
||||||
obj.onOk.connect(() => { button.loading = true })
|
obj.onOk.connect(() => { button.loading = true }) // FIXME
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
@ -35,7 +35,7 @@ Item {
|
|||||||
HShortcut {
|
HShortcut {
|
||||||
sequences: window.settings.keys.leaveRoom
|
sequences: window.settings.keys.leaveRoom
|
||||||
active: userInfo && userInfo.presence !== "offline"
|
active: userInfo && userInfo.presence !== "offline"
|
||||||
onActivated: utils.makePopup(
|
onActivated: window.makePopup(
|
||||||
"Popups/LeaveRoomPopup.qml",
|
"Popups/LeaveRoomPopup.qml",
|
||||||
{userId, roomId, roomName: roomInfo.display_name},
|
{userId, roomId, roomName: roomInfo.display_name},
|
||||||
)
|
)
|
||||||
@ -44,7 +44,7 @@ Item {
|
|||||||
HShortcut {
|
HShortcut {
|
||||||
sequences: window.settings.keys.forgetRoom
|
sequences: window.settings.keys.forgetRoom
|
||||||
active: userInfo && userInfo.presence !== "offline"
|
active: userInfo && userInfo.presence !== "offline"
|
||||||
onActivated: utils.makePopup(
|
onActivated: window.makePopup(
|
||||||
"Popups/ForgetRoomPopup.qml",
|
"Popups/ForgetRoomPopup.qml",
|
||||||
{userId, roomId, roomName: roomInfo.display_name},
|
{userId, roomId, roomName: roomInfo.display_name},
|
||||||
)
|
)
|
||||||
|
@ -165,7 +165,7 @@ HTextArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCustomImagePaste: utils.makePopup(
|
onCustomImagePaste: window.makePopup(
|
||||||
"Popups/ConfirmClipboardUploadPopup.qml",
|
"Popups/ConfirmClipboardUploadPopup.qml",
|
||||||
{
|
{
|
||||||
userId: chat.userId,
|
userId: chat.userId,
|
||||||
|
@ -21,7 +21,7 @@ HButton {
|
|||||||
|
|
||||||
HShortcut {
|
HShortcut {
|
||||||
sequences: window.settings.keys.sendFileFromPathInClipboard
|
sequences: window.settings.keys.sendFileFromPathInClipboard
|
||||||
onActivated: utils.makePopup(
|
onActivated: window.makePopup(
|
||||||
"Popups/ConfirmUploadPopup.qml",
|
"Popups/ConfirmUploadPopup.qml",
|
||||||
{
|
{
|
||||||
userId: chat.userId,
|
userId: chat.userId,
|
||||||
|
@ -134,7 +134,7 @@ HColumnLayout {
|
|||||||
qsTr("Invite members to this room") :
|
qsTr("Invite members to this room") :
|
||||||
qsTr("No permission to invite members to this room")
|
qsTr("No permission to invite members to this room")
|
||||||
|
|
||||||
onClicked: utils.makePopup(
|
onClicked: window.makePopup(
|
||||||
"Popups/InviteToRoomPopup.qml",
|
"Popups/InviteToRoomPopup.qml",
|
||||||
{
|
{
|
||||||
userId: chat.userId,
|
userId: chat.userId,
|
||||||
|
@ -74,7 +74,7 @@ Rectangle {
|
|||||||
|
|
||||||
enabled: (events && events.length > 0) || events === null
|
enabled: (events && events.length > 0) || events === null
|
||||||
sequences: window.settings.keys.removeFocusedOrSelectedMessages
|
sequences: window.settings.keys.removeFocusedOrSelectedMessages
|
||||||
onActivated: utils.makePopup(
|
onActivated: window.makePopup(
|
||||||
"Popups/RedactPopup.qml",
|
"Popups/RedactPopup.qml",
|
||||||
{
|
{
|
||||||
preferUserId: chat.userId,
|
preferUserId: chat.userId,
|
||||||
@ -200,7 +200,7 @@ Rectangle {
|
|||||||
|
|
||||||
HShortcut {
|
HShortcut {
|
||||||
sequences: window.settings.keys.clearRoomMessages
|
sequences: window.settings.keys.clearRoomMessages
|
||||||
onActivated: utils.makePopup(
|
onActivated: window.makePopup(
|
||||||
"Popups/ClearMessagesPopup.qml",
|
"Popups/ClearMessagesPopup.qml",
|
||||||
{
|
{
|
||||||
userId: window.uiState.pageProperties.userId,
|
userId: window.uiState.pageProperties.userId,
|
||||||
@ -413,7 +413,7 @@ Rectangle {
|
|||||||
const fullMxc =
|
const fullMxc =
|
||||||
forLink || (isAnimated(event) ? "" : event.media_url)
|
forLink || (isAnimated(event) ? "" : event.media_url)
|
||||||
|
|
||||||
utils.makePopup(
|
window.makePopup(
|
||||||
"Popups/ImageViewerPopup/ImageViewerPopup.qml",
|
"Popups/ImageViewerPopup/ImageViewerPopup.qml",
|
||||||
{
|
{
|
||||||
thumbnailTitle: getThumbnailTitle(event),
|
thumbnailTitle: getThumbnailTitle(event),
|
||||||
|
@ -80,7 +80,7 @@ Python {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.makePopup(
|
window.makePopup(
|
||||||
"Popups/UnexpectedErrorPopup.qml",
|
"Popups/UnexpectedErrorPopup.qml",
|
||||||
{ errorType: type, message, traceback },
|
{ errorType: type, message, traceback },
|
||||||
)
|
)
|
||||||
|
@ -65,8 +65,8 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function makePopup(urlComponent, properties={}, callback=null,
|
function makePopup(urlComponent, parent, properties={}, callback=null,
|
||||||
autoDestruct=true, parent=window) {
|
autoDestruct=true) {
|
||||||
makeObject(urlComponent, parent, properties, (popup) => {
|
makeObject(urlComponent, parent, properties, (popup) => {
|
||||||
popup.open()
|
popup.open()
|
||||||
if (autoDestruct) popup.closed.connect(() => { popup.destroy() })
|
if (autoDestruct) popup.closed.connect(() => { popup.destroy() })
|
||||||
|
@ -57,6 +57,15 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makePopup(
|
||||||
|
urlComponent, properties={}, callback=null, autoDestruct=true,
|
||||||
|
) {
|
||||||
|
utils.makePopup(
|
||||||
|
urlComponent, window, properties, callback, autoDestruct,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
flags: Qt.WA_TranslucentBackground
|
flags: Qt.WA_TranslucentBackground
|
||||||
minimumWidth: theme ? theme.minimumSupportedWidth : 240
|
minimumWidth: theme ? theme.minimumSupportedWidth : 240
|
||||||
|
Loading…
x
Reference in New Issue
Block a user