From: Yves Marcoz Date: Tue, 1 Nov 2011 04:29:49 +0000 (-0700) Subject: qml - Improving menu layout X-Git-Url: http://vcs.maemo.org/git/?p=feedingit;a=commitdiff_plain;h=67e057e8ff211b20833bcd2952a11396c79e03dc qml - Improving menu layout --- diff --git a/psa_harmattan/feedingit/pysrc/feedingit.py b/psa_harmattan/feedingit/pysrc/feedingit.py index 546d043..867a60c 100644 --- a/psa_harmattan/feedingit/pysrc/feedingit.py +++ b/psa_harmattan/feedingit/pysrc/feedingit.py @@ -44,7 +44,6 @@ class Controller(QtCore.QObject): @QtCore.Slot(str, result=str) def getFeedsXml(self, catid): - print self._handler.generateFeedsXml(catid) return self._handler.generateFeedsXml(catid) @QtCore.Slot(str,result=str) diff --git a/psa_harmattan/feedingit/qml/Feeds.qml b/psa_harmattan/feedingit/qml/Feeds.qml index 2f39cbd..12d1c89 100644 --- a/psa_harmattan/feedingit/qml/Feeds.qml +++ b/psa_harmattan/feedingit/qml/Feeds.qml @@ -10,10 +10,12 @@ Item { function reload() { feeds.xml = catid == "" ? "" : controller.getFeedsXml(catid); //feeds.reload() - console.log(feeds.xml) + //console.log(feeds.xml) } - Component.onCompleted: { console.log(catid + "/" + parent.catid) } + //Component.onCompleted: { console.log(catid + "/" + parent.catid); console.log(feeds.xml) } + + //onCatidChanged: console.log("catid changed: "+catid) ListView { id: feedList; model: feeds; delegate: feedDelegate; z: 6 @@ -44,10 +46,13 @@ Item { Item { - Component.onCompleted: console.log("item:"+feedid) - id: wrapper; width: wrapper.ListView.view.width; + //Component.onCompleted: console.log("item:"+feedid + " "+ visible + " "+ height + " " + width) + id: wrapper; + //width: wrapper.ListView.view.width; visible: (unread == "0" && feedsItem.hideReadFeeds=="True") ? false : true + //visible: true height: (visible) ? 86 : 0 + width: parent.width Item { id: moveMe @@ -68,26 +73,26 @@ Item { Text { text: updatedDate + " / " + qsTr("%1 unread items").arg(unread); color: (unread=="0") ? "white" : "#7b97fd"; width: parent.width; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } } +//// Item { +//// x: wrapper.ListView.view.width - 128; y: 12 +//// height: 58; width: 58; +//// //anchors.horizontalCenter: parent.horizontalCenter; +//// Image { source: "common/images/wmEditIcon.png" } +//// MouseArea { +//// anchors.fill: parent; onClicked: { container.feedEdit(feedname, feedid, url); } +//// } +//// visible: inEditMode +//// } // Item { -// x: wrapper.ListView.view.width - 128; y: 12 +// x: wrapper.ListView.view.width - 64; y: 12 // height: 58; width: 58; // //anchors.horizontalCenter: parent.horizontalCenter; -// Image { source: "common/images/wmEditIcon.png" } +// Image { source: "common/images/delete.png" } // MouseArea { -// anchors.fill: parent; onClicked: { container.feedEdit(feedname, feedid, url); } +// anchors.fill: parent; onClicked: { container.feedDeleted(feedid); } // } // visible: inEditMode // } - Item { - x: wrapper.ListView.view.width - 64; y: 12 - height: 58; width: 58; - //anchors.horizontalCenter: parent.horizontalCenter; - Image { source: "common/images/delete.png" } - MouseArea { - anchors.fill: parent; onClicked: { container.feedDeleted(feedid); } - } - visible: inEditMode - } } MouseArea { anchors.fill: wrapper; diff --git a/psa_harmattan/feedingit/qml/main.qml b/psa_harmattan/feedingit/qml/main.qml index c0dd409..731dda0 100644 --- a/psa_harmattan/feedingit/qml/main.qml +++ b/psa_harmattan/feedingit/qml/main.qml @@ -3,8 +3,13 @@ import com.nokia.meego 1.0 PageStackWindow { + id: window initialPage: categoryPage + signal articleClosed() + property string feedid + property string catid + ToolBarLayout { id: commonTools visible: false @@ -21,6 +26,27 @@ PageStackWindow { id: myMenu visualParent: pageStack MenuLayout { + MenuItem { text: qsTr("Settings"); onClicked: {} } + MenuItem { text: qsTr("Update All Categories"); visible: pageStack.depth==3; onClicked: controller.updateAll(); } + MenuItem { text: qsTr("About FeedingIt"); onClicked: query.open(); } + } + } + + Menu { + id: myFeedsMenu + visualParent: pageStack + MenuLayout { + MenuItem { text: qsTr("Update All Feeds"); onClicked: controller.updateAll(); } + MenuItem { text: qsTr("About FeedingIt"); onClicked: query.open(); } + } + } + + Menu { + id: myArticlesMenu + visualParent: pageStack + MenuLayout { + MenuItem { text: qsTr("Mark All As Read"); onClicked: controller.markAllAsRead(feedid); } + MenuItem { text: qsTr("Update Feed"); onClicked: controller.updateFeed(feedid); } MenuItem { text: qsTr("About FeedingIt"); onClicked: query.open(); } } } @@ -49,20 +75,47 @@ PageStackWindow { Page { tools: commonTools Categories { - onCategoryClicked: pageStack.push(feedsPage, {catid: cat}) + onCategoryClicked: { + window.catid = cat + pageStack.push(feedsPage) + } } } } Component { id: feedsPage + Page { - tools: commonTools - property string catid + tools: feedsTools + anchors.fill: parent + property string catid: window.catid Feeds { id: feedsItem - onFeedClicked: pageStack.push(articlesPage, {feedid: feedid}) + onFeedClicked: { + window.feedid = feedid + pageStack.push(articlesPage) + } + } + ToolBarLayout { + id: feedsTools + visible: false + ToolIcon { iconId: "toolbar-back"; + onClicked: { + myArticlesMenu.close(); + pageStack.pop(); + } + } + ToolIcon { + platformIconId: "toolbar-view-menu" + anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: (myFeedsMenu.status == DialogStatus.Closed) ? myFeedsMenu.open() : myFeedsMenu.close() + } } + Connections { + target: window + onArticleClosed: feedsItem.reload() + } } } @@ -70,30 +123,44 @@ PageStackWindow { id: articlesPage Page { tools: articleTools - property string feedid + property string feedid: window.feedid ArticleViewer { id: flipper } - } - ToolBarLayout { - id: articleTools - visible: false - ToolIcon { iconId: "toolbar-back"; onClicked: { - myMenu.close(); - if (flipper.articleShown) { - flipper.articleShown = false; - flipper.reload() - } else { - pageStack.pop(); + ToolBarLayout { + id: articleTools + visible: false + ToolIcon { iconId: "toolbar-back"; + onClicked: { + myArticlesMenu.close(); + if (flipper.articleShown) { + flipper.articleShown = false; + flipper.reload() + } else { + window.articleClosed(); + pageStack.pop(); + } } } - visible: pageStack.depth>1 - } - ToolIcon { - platformIconId: "toolbar-view-menu" - anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close() + + ToolIcon { + platformIconId: "toolbar-prev" + //anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: flipper.prev(); + } + + ToolIcon { + platformIconId: "toolbar-next" + //anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: flipper.next() + } + + ToolIcon { + platformIconId: "toolbar-view-menu" + anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: (myArticlesMenu.status == DialogStatus.Closed) ? myArticlesMenu.open() : myArticlesMenu.close() + } } } }