- import bb.cascades 1.0
- import bb.data 1.0
- import bb.system 1.0
- TabbedPane {
- showTabsOnActionBar: true
- property variant menu;
- Menu.definition: menu
- property int size;
- property int rand;
- property string des;
- property string dat;
- property string cat;
- //*************************************************************************
- Tab{
- imageSource: "asset:///images/ic_overflow_tab.png"
- NavigationPane {
- id: nav
- Page {
- id: recipeListPage
- Container {
- id:cont
- layout: StackLayout {
- }
- /*
- ImageView {
- imageSource: "asset:///images/Book_background.amd"
- verticalAlignment: VerticalAlignment.Fill
- horizontalAlignment: HorizontalAlignment.Fill
- }*/
- Container {
- topPadding: 15
- bottomPadding: topPadding
- Container{
- layout: StackLayout{orientation:LayoutOrientation.LeftToRight}
- /*Container {
- layout: StackLayout{orientation:LayoutOrientation.LeftToRight}
- TextField {
- id: bsc
- hintText: qsTr("Busque su receta ")
- horizontalAlignment: HorizontalAlignment.Left
- input.submitKey: SubmitKey.Search*/
- /*horizontalAlignment: HorizontalAlignment.Center
- verticalAlignment: VerticalAlignment.Center
- preferredWidth: 530
- preferredHeight: 65
- hintText: ""
- input {
- submitKey: SubmitKey.Search
- onSubmitted: root.startSearch()
- }*/
- // }
- /*Button {
- text:qsTr("Buscar")
- onClicked: {
- listview.enabled=false
- listview.visible=false
- contBus.visible=true
- contBus.enabled=true
- volver.enabled=true
- contBus.text=bsc.text*/
- /*if(bsc.length==0){
- contBus.text="Debe Colocar algo en la barra de busqueda porfavor"
- }else{
- contBus.text=bsc.text
- }*/
- /*}
- }*/
- Container {
- layout:DockLayout{}
- /*ImageView {
- horizontalAlignment: HorizontalAlignment.Center
- verticalAlignment: VerticalAlignment.Center
- imageSource: "asset:///images/searcharea.png"
- }//Imagen de fondo del input text
- */
- TextField {
- id: zipCodeField
- horizontalAlignment: HorizontalAlignment.Center
- verticalAlignment: VerticalAlignment.Center
- preferredWidth: 530
- preferredHeight: 65
- hintText: qsTr("Busque su Receta")
- input {
- submitKey: SubmitKey.Search
- onSubmitted: root.startSearch()
- }
- }//Input text
- ImageButton {
- horizontalAlignment: HorizontalAlignment.Right
- verticalAlignment: VerticalAlignment.Center
- translationX: -20
- defaultImageSource: "asset:///images/find_button.png"
- pressedImageSource: "asset:///images/find_button.png"
- //onClicked: root.startSearch()
- onClicked: {
- listview.enabled=false
- listview.visible=false
- contBus.visible=true
- contBus.enabled=true
- volver.enabled=true
- //contBus.text=zipCodeField.text
- var selectedData = listview.dataModel.data([ zipCodeField.text ])
- if(selectedData){
- contBus.text=zipCodeField.text
- }
- }
- }//Boton busca
- }//Container
- Button {
- id:volver
- text:qsTr("Volver")
- /*defaultImageSource: "asset:///images/ic_previous.png"
- pressedImageSource: "asset:///images/ic_previous.png"*/
- enabled:false
- onClicked: {
- listview.enabled=true
- listview.visible=true
- contBus.visible=false
- contBus.enabled=false
- botV.visible=false
- botV.enabled=false
- enabled=false
- }
- }//Boton Volver
- Button{
- text:qsTr("Azar")
- /*defaultImageSource: "asset:///images/ic_view_grid.png"
- pressedImageSource: "asset:///images/ic_view_grid.png"*/
- onClicked: {
- listview.enabled=false
- listview.visible=false
- contBus.visible=true
- contBus.enabled=true
- botV.visible=true
- botV.enabled=true
- volver.enabled=true
- var randomnews = Math.floor((Math.random() * groupDataModel.size()) + 1)
- var selectedData = listview.dataModel.data([ randomnews ])
- contBus.text = selectedData.title
- des=selectedData.description
- dat=selectedData.pubDate
- cat=selectedData.category
- //------------------------------------------
- /*var pagina = pagina2.createObject();
- pagina.nombreIngresado = selectedData.title
- pagina.desIngresado = des
- pagina.dateIngresado = dat
- pagina.catIngresado = cat
- nav.push(pagina)*/
- //--------------------------------------------
- }
- }//Boton Random
- }//Container
- }//Container
- /*ListView {
- id: contBus
- visible: false
- enabled: false
- listItemComponents: [
- ListItemComponent {
- type: "item"
- Container {
- Label {
- id:contBus2
- }
- Divider {
- }
- }//Container
- }]
- onTriggered: {
- //cont.background = Color.Cyan
- var pagina = pagina2.createObject();
- var chosenItem = dataModel.data(indexPath)
- pagina.nombreIngresado = chosenItem.title
- pagina.desIngresado = chosenItem.description
- pagina.dateIngresado = chosenItem.pubDate
- //pagina.imgIngresado = chosenItem.image
- nav.push(pagina)
- }
- }//Label de busqueda
- */
- Label {
- id:contBus
- }
- Button {
- id:botV
- text:qsTr("Ir")
- enabled: false
- visible: false
- onClicked: {
- var pagina = pagina2.createObject();
- //var chosenItem = dataModel.data(indexPath)
- pagina.nombreIngresado = contBus.text
- pagina.desIngresado = des
- pagina.dateIngresado = dat
- pagina.catIngresado = cat
- //pagina.desIngresado = chosenItem.description
- //pagina.dateIngresado = chosenItem.pubDate
- //pagina.imgIngresado = chosenItem.image
- nav.push(pagina)
- }
- }
- ListView {
- id: listview
- dataModel: groupDataModel
- listItemComponents: [
- ListItemComponent {
- type: "item"
- /* Container {
- layout:DockLayout{}
- ImageView {
- imageSource: "asset:///images/a.jpg"
- }
- Label {
- text: qsTr(ListItemData.title)
- }
- Divider {
- }
- }//Container
- */
- StandardListItem {
- imageSource: "asset:///images/a.jpg"
- title: qsTr(ListItemData.title)
- description:qsTr("Categoria: "+ListItemData.category)
- }
- }]
- onTriggered: {
- //cont.background = Color.Cyan
- var pagina = pagina2.createObject();
- var chosenItem = dataModel.data(indexPath)
- pagina.nombreIngresado = chosenItem.title
- pagina.desIngresado = chosenItem.description
- pagina.dateIngresado = chosenItem.pubDate
- pagina.catIngresado = chosenItem.category
- //pagina.imgIngresado = chosenItem.image
- nav.push(pagina)
- }
- } // ListView
- }// Container
- } // Page
- attachedObjects: [
- GroupDataModel {
- id: groupDataModel
- grouping: ItemGrouping.None
- sortingKeys: [ "pubDate" ]
- sortedAscending: false
- },
- DataSource {
- id: dataSourceYahoo
- source: "http://www.universoderecetas.com.ar/feed/"
- //source: "http://www.mundosabores.com/feed/"
- //source: "http://recetasdeargentina.com.ar/feed/"
- //source:"http://www.recetascocina.com.ar/recetas-comidas/feed/"
- query: "rss/channel/item"
- onDataLoaded: {
- groupDataModel.insertList(data)
- }
- },
- ComponentDefinition {
- id: pagina2
- source: "pagina2.qml"
- },
- ComponentDefinition {
- id: cookbookMenu
- source: "CookbookMenu.qml"
- }
- ]
- onCreationCompleted: {
- dataSourceYahoo.load()
- // We want to only display in portrait-mode in this view.
- OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.DisplayPortrait;
- // Create the app menu for the cookbook.
- menu = cookbookMenu.createObject();
- }
- }//NavigationPane
- //*************************************************************************
- }//Tab
- //*************************************************************************
- Tab {
- title: "Home"
- imageSource: "asset:///images/ic_select_more.png"
- Page {
- id: page2
- /*actions: [
- ActionItem {
- title: "New"
- },
- ActionItem {
- title: "Delete"
- }
- ]*/
- }//Page