[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/declarative-applets/replacements/news/package
From:       Marco Martin <notmart () gmail ! com>
Date:       2011-03-27 13:43:25
Message-ID: 20110327134325.61A3AAC8CA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1226177 by mart:

don't use a tabbar in tablet mode


 M  +1 -1      contents/ui/BasicComponents/ListItem.qml  
 M  +2 -1      contents/ui/ComplexComponents/ItemsList.qml  
 M  +5 -1      contents/ui/ComplexComponents/Toolbar.qml  
 M  +18 -4     contents/ui/main.qml  
 M  +33 -18    platformcontents/application/tablet/ui/main.qml  


--- trunk/playground/base/plasma/declarative-applets/replacements/news/package/contents/ui/BasicComponents/ListItem.qml \
#1226176:1226177 @@ -40,7 +40,7 @@
 
         MouseArea {
             id: itemMouse
-            anchors.fill: listItem
+            anchors.fill: background
             onClicked: listItem.clicked()
         }
     }
--- trunk/playground/base/plasma/declarative-applets/replacements/news/package/contents/ui/ComplexComponents/ItemsList.qml \
#1226176:1226177 @@ -28,6 +28,7 @@
     id: list
 
     property string feedCategory
+    signal itemClicked
 
     snapMode: ListView.SnapToItem
 
@@ -93,7 +94,7 @@
 
             list.currentIndex = index
             bodyView.html = "<body \
                style=\"background:#fff;\">"+description+"</body>"
-            mainView.currentIndex = 1
+            list.itemClicked()
         }
     }
 }
--- trunk/playground/base/plasma/declarative-applets/replacements/news/package/contents/ui/ComplexComponents/Toolbar.qml \
#1226176:1226177 @@ -58,7 +58,11 @@
 
         onClicked: {
             if (!bodyView.customUrl) {
-                mainView.currentIndex = mainView.currentIndex -1
+                if (mainWindow.state == "item") {
+                    mainWindow.state = "items"
+                } else if (mainWindow.state == "items") {
+                    mainWindow.state = "feeds"
+                }
             } else {
                 bodyView.html = "<body \
style=\"background:#fff;\">"+feedSource.data['items'][list.currentIndex].description+"</body>";
  }
--- trunk/playground/base/plasma/declarative-applets/replacements/news/package/contents/ui/main.qml \
#1226176:1226177 @@ -31,10 +31,26 @@
     id: mainWindow;
     width: 250
     height: 400
+    state: "items"
 
     property string source
     signal unreadCountChanged();
 
+    states: [
+         State {
+             name: "feeds"
+             PropertyChanges { target: mainView; currentIndex: 0 }
+         },
+         State {
+             name: "items"
+             PropertyChanges { target: mainView; currentIndex: 1 }
+         },
+         State {
+             name: "item"
+             PropertyChanges { target: mainView; currentIndex: 2 }
+         }
+     ]
+
     Component.onCompleted: {
         BookKeeping.mainWindow = mainWindow
         BookKeeping.loadReadArticles();
@@ -86,19 +102,17 @@
                 FeedList {
                     id: feedList
                     anchors.fill: feedListContainer
-                    onItemClicked: mainView.currentIndex = 1
+                    onItemClicked: mainWindow.state = "items"
                 }
             }
             QGraphicsWidget {
                 id: listContainer
-                Component.onCompleted: {
-                    mainView.currentIndex = 1
-                }
 
                 ItemsList {
                     id: itemsList
                     anchors.fill: listContainer
                     feedCategory: feedList.feedCategory
+                    onItemClicked: mainWindow.state = "item"
                 }
             }
 
--- trunk/playground/base/plasma/declarative-applets/replacements/news/package/platformcontents/application/tablet/ui/main.qml \
#1226176:1226177 @@ -31,10 +31,32 @@
     id: mainWindow
     width: 250
     height: 400
+    state: "items"
 
     property string source
     signal unreadCountChanged();
 
+    states: [
+         State {
+             name: "feeds"
+             PropertyChanges { target: mainView; x: 0 }
+             PropertyChanges { target: itemsList; width: mainWindow.width/4*3}
+             PropertyChanges { target: toolbarFrame; backEnabled: false }
+         },
+         State {
+             name: "items"
+             PropertyChanges { target: mainView; x: 0 }
+             PropertyChanges { target: itemsList; width: mainWindow.width/4*3}
+             PropertyChanges { target: toolbarFrame; backEnabled: false }
+         },
+         State {
+             name: "item"
+             PropertyChanges { target: mainView; x: -mainWindow.width/4}
+             PropertyChanges { target: itemsList; width: mainWindow.width/4}
+             PropertyChanges { target: toolbarFrame; backEnabled: true }
+         }
+     ]
+
     Component.onCompleted: {
         BookKeeping.mainWindow = mainWindow
         BookKeeping.loadReadArticles();
@@ -77,40 +99,33 @@
         }
 
 
-        PlasmaWidgets.TabBar {
+        Row {
             id : mainView
             width: mainWindow.width
             height: mainWindow.height - toolbarFrame.height +9
-            tabBarShown: false
 
-            onCurrentChanged: {
-                toolbarFrame.backEnabled = currentIndex > 0
-                toolbarFrame.searchEnabled = currentIndex < 1
-            }
 
-            QGraphicsWidget {
-                id: listContainer
-                Component.onCompleted: {
-                    mainView.currentIndex = 0
-                }
-
                 FeedList {
                     id: feedList
-                    anchors.fill: listContainer
-                    anchors.rightMargin: listContainer.width/4*3
+                anchors.top: mainView.top
+                anchors.bottom: mainView.bottom
+                width: mainWindow.width/4
                 }
 
                 ItemsList {
                     id: itemsList
-                    anchors.fill: listContainer
-                    anchors.leftMargin: listContainer.width/4
+                anchors.top: mainView.top
+                anchors.bottom: mainView.bottom
+                width: mainWindow.width/4*3
+
                     feedCategory: feedList.feedCategory
+                onItemClicked: mainWindow.state = "item"
                 }
 
-            }
-
             PlasmaWidgets.WebView {
                 id : bodyView
+                width: mainWindow.width/4*3
+                height: parent.height
                 dragToScroll : true
                 property bool customUrl: false
                 onUrlChanged: {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic