Skip to content

Instantly share code, notes, and snippets.

@anta40
Created January 17, 2013 17:56
Show Gist options
  • Save anta40/4558010 to your computer and use it in GitHub Desktop.
Save anta40/4558010 to your computer and use it in GitHub Desktop.
import bb.cascades 1.0
import bb.cascades.pickers 1.0
NavigationPane {
id: navigationPane
// The initial page
Page {
titleBar: TitleBar {
title: qsTr ("ExiView")
}
Container {
layout: DockLayout {}
// The background image
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
topPadding: 50
leftPadding: 30
rightPadding: 30
// The file picker mode selector
// The file picker view mode selector
DropDown {
id: pickerViewMode
horizontalAlignment: HorizontalAlignment.Center
title: qsTr ("View Mode")
Option {
text: qsTr ("Default")
value: FilePickerViewMode.Default
selected: true
}
Option {
text: qsTr ("List View")
value: FilePickerViewMode.ListView
}
Option {
text: qsTr ("Grid View")
value: FilePickerViewMode.GridView
}
}
// The file picker sort criterion selector
DropDown {
id: pickerSortBy
horizontalAlignment: HorizontalAlignment.Center
title: qsTr ("Sort by")
Option {
text: qsTr ("Default")
value: FilePickerSortFlag.Default
selected: true
}
Option {
text: qsTr ("Name")
value: FilePickerSortFlag.Name
}
Option {
text: qsTr ("Date")
value: FilePickerSortFlag.Date
}
Option {
text: qsTr ("Suffix")
value: FilePickerSortFlag.Suffix
}
Option {
text: qsTr ("Size")
value: FilePickerSortFlag.Size
}
}
// The file picker sort order selector
DropDown {
id: pickerSortOrder
horizontalAlignment: HorizontalAlignment.Center
title: qsTr ("Sort order")
Option {
text: qsTr ("Default")
value: FilePickerSortOrder.Default
selected: true
}
Option {
text: qsTr ("Ascending")
value: FilePickerSortOrder.Ascending
}
Option {
text: qsTr ("Descending")
value: FilePickerSortOrder.Descending
}
}
// The 'Show' button
Button {
horizontalAlignment: HorizontalAlignment.Center
topMargin: 100
text: qsTr ("Go")
onClicked: picker.open()
}
// The result label
Label {
id: resultLabel
horizontalAlignment: HorizontalAlignment.Center
topMargin: 30
text: qsTr ("Selected file: %1").arg(picker.selectedFile)
textStyle {
base: SystemDefaults.TextStyles.BodyText
color: Color.White
}
multiline: true
visible: (picker.selectedFile != "")
}
}
}
attachedObjects: [
FilePicker {
id: picker
property string selectedFile
property Page secondPage
title: qsTr ("Browse for file")
mode: FilePicker.Picker
type: FilePicker.Picture
viewMode: pickerViewMode.selectedValue
sortBy: pickerSortBy.selectedValue
sortOrder: pickerSortOrder.selectedValue
function getSecondPage() {
if (! secondPage) {
secondPage = secondPageDefinition.createObject();
}
return secondPage;
}
attachedObjects: [
ComponentDefinition {
id: secondPageDefinition
source: "DetailsPage.qml"
}
]
onFileSelected: {
selectedFile = selectedFiles[0]
secondPage.imagePath = selectedFile
navigaton.pushPage(secondPage)
}
}
]
}
} // end of NavigationPane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment