import QtQuick 1.0 import com.nokia.meego 1.0 import "feedSearch.js" as FeedJS Page { id: addFeedPage tools: tabTools anchors.margins: UiConstants.DefaultMargin anchors.fill: parent TabGroup { id: tabGroup anchors.fill: parent currentTab: searchTab Item { id: searchTab anchors.fill: parent Column { spacing: 10 Text { id: searchText font.pixelSize: 22 color: "white" text: "Search for feeds" } TextInputClear { id: searchInput placeHolder: "Enter a search term" } Button { id: searchButton text: "Search" onClicked: FeedJS.keywordSearch(searchInput.text) } } SelectionDialog { id: searchDialog titleText: "Select feed:" //model: [] onSelectedIndexChanged: { if (selectedIndex>=0) { var feedTitle = searchDialog.model.get(searchDialog.selectedIndex).name; var feedUrl = searchDialog.model.get(searchDialog.selectedIndex).url; //controller.addFeed(feedTitle,feedUrl,1); categoryDialog.confirmCategory(feedTitle, feedUrl); console.log("Adding feed "+feedTitle+" at " +feedUrl); } } } } //searchTab Item { id: urlTab Column { Text { id: urlText font.pixelSize: 22 color: "white" text: "Enter the feed URL" } TextInputClear { id: urlInput placeHolder: "Feed URL" width: parent.width } Button { id: urlButton text: "Add" onClicked: { console.log("Adding "+urlInput.text) //controller.addFeed("",urlInput.text,1); categoryDialog.confirmCategory("", urlInput.text); } width: 150 } } } //urlTab Item { id: opmlTab Column { Text { id: opmlText font.pixelSize: 22 color: "white" text: "Enter the OPML filename in MyDocs folder" } TextInputClear { id: opmlInput placeHolder: "OPML filename" width: parent.width } Button { id: opmlButton text: "Import" onClicked: { console.log("Importing "+opmlInput.text) //controller.addFeed("",urlInput.text,1); var num = controller.importOpml(opmlInput.text) banner.text=qsTr("Successfully imported "+num+" feeds.") banner.open() } width: 150 } } } //opmlTab Item { id: categoryTab Column { Text { id: categoryText font.pixelSize: 22 color: "white" text: "Enter the category name" } TextInputClear { id: categoryInput placeHolder: "name" width: parent.width } Button { id: categoryButton text: "Add" onClicked: { if (categoryInput.text != "") { controller.addCategory(categoryInput.text) categoryDialog.reload() window.categoryReloadRequest() } } width: 150 } } } //categoryTab ToolBarLayout { id: tabTools ToolIcon { iconId: "toolbar-back" onClicked: { if (tabGroup.currentTab.depth > 1) { tabGroup.currentTab.pop() } else { pageStack.pop() } window.feedReloadRequest() window.categoryReloadRequest() } } ButtonRow { TabButton { text: "Search" tab: searchTab } TabButton { text: "URL" tab: urlTab } TabButton { text: "Import" tab: opmlTab } TabButton { text: "Categories" tab: categoryTab } } } } SelectionDialog { id: categoryDialog titleText: "Select category:" property string feedTitle property string feedUrl //property variant listModel: ListModel {} function createListModel() { var listModel = Qt.createQmlObject('import QtQuick 1.0; ListModel {}', categoryDialog); for (var i=0;i=0) { controller.addFeed(feedTitle,feedUrl,categoryDialog.model.get(categoryDialog.selectedIndex).catid); console.log("Adding feed "+feedTitle+" at " +feedUrl + " in " + categoryDialog.model.get(categoryDialog.selectedIndex).catid); } categoryDialog.selectedIndex = -1; } } }