openImageViewer(): take an optional callback

This commit is contained in:
miruka 2020-07-19 20:33:40 -04:00
parent 066102e64d
commit 2001fcf70a
3 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,6 @@
- Image viewer:
- fix gifs
- double click on EventImage to open fullscreen
- open externally in context menu in timeline thumbnail
- hflickable support kinetic scrolling disabler and speed/decel settings
- buttons

View File

@ -66,11 +66,11 @@ HMxcImage {
acceptedButtons: Qt.LeftButton
acceptedModifiers: Qt.NoModifier
gesturePolicy: TapHandler.ReleaseWithinBounds
onTapped:
eventList.selectedCount ?
eventDelegate.toggleChecked() :
eventList.openImageViewer(singleMediaInfo)
}
TapHandler {

View File

@ -355,7 +355,7 @@ Rectangle {
) || utils.urlFileName(event.media_url)
}
function openImageViewer(event, forLink="") {
function openImageViewer(event, forLink="", callback=null) {
// if forLink is empty, this must be a media event
const title =
@ -390,11 +390,13 @@ Rectangle {
)
},
obj => {
obj.openExternallyRequested.connect(() =>
obj.openExternallyRequested.connect(() => {
forLink ?
Qt.openUrlExternally(forLink) :
eventList.openMediaExternally(event)
)
})
if (callback) callback(obj)
},
)
}