31e97bd0c9704cb53537973ab271298d1d7d5730
[feedingit] / psa_harmattan / feedingit / qml / AddFeed.qml
1 import QtQuick 1.0
2 import com.nokia.meego 1.0
3 import "feedSearch.js" as FeedJS
4
5 Page {
6     id: addFeedPage
7     tools: tabTools
8     anchors.margins: UiConstants.DefaultMargin
9     anchors.fill: parent
10
11     TabGroup {
12         id: tabGroup
13         anchors.fill: parent
14         currentTab: searchTab
15
16         Item {
17             id: searchTab
18             anchors.fill: parent
19
20             Column {
21                 spacing: 10
22
23                 Text {
24                     id: searchText
25                     font.pixelSize: 22
26                     color: "white"
27                     text: "Search for feeds"
28                 }
29
30                 TextInputClear {
31                     id: searchInput
32                     placeHolder: "Enter a search term"
33                 }
34
35                 Button {
36                     id: searchButton
37                     text: "Search"
38                     onClicked: FeedJS.keywordSearch(searchInput.text)
39                 }
40             }
41
42             SelectionDialog {
43                      id: searchDialog
44                      titleText: "Select feed:"
45                      //model: []
46                      onSelectedIndexChanged: {
47                          if (selectedIndex>=0) {
48                              var feedTitle = searchDialog.model.get(searchDialog.selectedIndex).name;
49                              var feedUrl = searchDialog.model.get(searchDialog.selectedIndex).url;
50                              container.addFeed(feedTitle,feedUrl,1);
51                              console.log("Adding feed "+feedTitle+" at " +feedUrl);
52                          }
53                      }
54             }
55
56         } //searchTab
57
58         Item {
59             id: urlTab
60
61             Column {
62                 Text {
63                     id: urlText
64                     font.pixelSize: 22
65                     color: "white"
66                     text: "Enter the feed URL"
67                 }
68
69                 TextInputClear {
70                     id: urlInput
71                     placeHolder: "Feed URL"
72
73                 }
74
75                 Button {
76                     id: urlButton
77                     text: "Add"
78                     checkable: true
79                     onClicked: {
80                         console.log("Adding "+urlInput.text)
81                         container.addFeed("",urlInput.text,1);
82                     }
83                 }
84             }
85
86         } //searchTab
87
88         ToolBarLayout {
89             id: tabTools
90             ToolIcon {
91                 iconId: "toolbar-back"
92                 onClicked: tabGroup.currentTab.depth > 1 ? tabGroup.currentTab.pop() : pageStack.pop()
93             }
94             ButtonRow {
95                 TabButton {
96                     text: "Search"
97                     tab: searchTab
98                 }
99                 TabButton {
100                     text: "URL"
101                     tab: urlTab
102                 }
103             }
104         }
105     }
106 }
107
108
109 //Dialog {
110 //    id: myDialog
111
112 //    title: Item {
113 //        height: myDialog.platformStyle.titleBarHeight
114 //        width: parent.width
115 //        Label {
116 //            id: titleLabel
117 //            anchors.left: supplement.right
118 //            anchors.verticalCenter: titleField.verticalCenter
119 //            font.capitalization: Font.MixedCase
120 //            color: "white"
121 //            text: "Add A Feed"
122 //        }
123
124 //    }
125
126 //    content:Item {
127 //        id: name
128 //        //height: childrenRect.height
129
130
131
132 //        TextInputClear {
133 //            id: urlInput
134 //            placeHolder: "Enter a feed URL"
135 //        }
136
137 //    }
138
139 //    buttons: ButtonRow {
140 //                    platformStyle: ButtonStyle { }
141 //                    anchors.horizontalCenter: parent.horizontalCenter
142 //                    Button {id: b1; text: "OK"; onClicked: myDialog.accept()}
143 //                    Button {id: b2; text: "Cancel"; onClicked: myDialog.reject()}
144 //                }
145 //}