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: - Image viewer:
- fix gifs - fix gifs
- double click on EventImage to open fullscreen
- open externally in context menu in timeline thumbnail - open externally in context menu in timeline thumbnail
- hflickable support kinetic scrolling disabler and speed/decel settings - hflickable support kinetic scrolling disabler and speed/decel settings
- buttons - buttons

View File

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

View File

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