ImageSelectionBlock.qml Example File
socialinvocation/assets/ImageSelectionBlock.qml
import bb.cascades 1.0
import bb.cascades.pickers 1.0
Container {
topPadding: 40.0
property string invokeTarget
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Container {
rightPadding: 20.0
Button {
horizontalAlignment: HorizontalAlignment.Center
text: qsTr("Select Image")
onClicked: {
picker.open()
}
}
Button {
id: btnPostText
text: qsTr("Post")
visible: (picker.selectedFile != "")
onClicked: {
_socialInvocation.invoke(invokeTarget, "bb.action.SHARE",
"image/jpeg",
"file://" + picker.selectedFile)
}
}
}
ImageView {
imageSource: "file://" + picker.selectedFile
maxHeight: 475
maxWidth: 325
scalingMethod: ScalingMethod.AspectFit
verticalAlignment: VerticalAlignment.Top
}
attachedObjects: [
FilePicker {
id: picker
property string selectedFile
title: qsTr("File Picker")
mode: FilePickerMode.Picker
type: FileType.Picture
viewMode: FilePickerViewMode.GridView
onFileSelected: {
selectedFile = selectedFiles[0]
}
}
]
}