qml - Improving menu layout
[feedingit] / psa_harmattan / feedingit / qml / main.qml
index c0dd409..731dda0 100644 (file)
@@ -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()
+                }
             }
         }
     }