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

List:       kde-commits
Subject:    [plasma-mobile] applications/filebrowser/package/contents/ui: option to show files of current activi
From:       Marco Martin <notmart () gmail ! com>
Date:       2012-08-23 9:56:43
Message-ID: 20120823095643.F01F9A6042 () git ! kde ! org
[Download RAW message or body]

Git commit aeff4944b29bb237f20ade6e7de61789efcdee00 by Marco Martin.
Committed on 23/08/2012 at 11:55.
Pushed by mart into branch 'master'.

option to show files of current activity

M  +42   -17   applications/filebrowser/package/contents/ui/Intro.qml
M  +20   -0    applications/filebrowser/package/contents/ui/TypeFilter.qml
M  +6    -0    applications/filebrowser/package/contents/ui/main.qml

http://commits.kde.org/plasma-mobile/aeff4944b29bb237f20ade6e7de61789efcdee00

diff --git a/applications/filebrowser/package/contents/ui/Intro.qml \
b/applications/filebrowser/package/contents/ui/Intro.qml index d71f3be..d1fa686 \
                100644
--- a/applications/filebrowser/package/contents/ui/Intro.qml
+++ b/applications/filebrowser/package/contents/ui/Intro.qml
@@ -82,30 +82,55 @@ PlasmaComponents.Page {
         fillMode: Image.Tile
         anchors.fill: parent
 
-        MobileComponents.IconGrid {
-            id: introGrid
-            anchors.fill: parent
-
-            model: MetadataModels.MetadataCloudModel {
-                cloudCategory: "rdf:type"
-                resourceType: "nfo:FileDataObject"
-                minimumRating: metadataModel.minimumRating
-                allowedCategories: userTypes.userTypes.filter(function(val) {
-                    return val != "nfo:Application";
-                })
+        Flow {
+            id: introFlow
+            anchors.centerIn: parent
+            width: Math.min(parent.width, delegateWidth*children.length)
+
+            property int orientation: ListView.Horizontal
+            property int delegateWidth: theme.defaultFont.mSize.width * 15
+            property int delegateHeight: theme.defaultIconSize + \
theme.defaultFont.mSize.height + 8 +
+            Repeater {
+
+                model: MetadataModels.MetadataCloudModel {
+                    cloudCategory: "rdf:type"
+                    resourceType: "nfo:FileDataObject"
+                    minimumRating: metadataModel.minimumRating
+                    allowedCategories: userTypes.userTypes.filter(function(val) {
+                        return val != "nfo:Application";
+                    })
+                }
+
+                delegate: MobileComponents.ResourceDelegate {
+                    className: "FileDataObject"
+                    genericClassName: "FileDataObject"
+                    property string decoration: iconFor(model["label"])
+
+                    property string label: i18n("%1 (%2)", \
userTypes.typeNames[model["label"]], model["count"]) +
+                    width: introFlow.delegateWidth
+                    height: introFlow.delegateHeight
+
+                    onClicked: push(model["label"])
+                }
             }
 
-            delegate: MobileComponents.ResourceDelegate {
+            MobileComponents.ResourceDelegate {
                 className: "FileDataObject"
                 genericClassName: "FileDataObject"
-                property string decoration: iconFor(model["label"])
+                property string decoration: "preferences-activities"
 
-                property string label: i18n("%1 (%2)", \
userTypes.typeNames[model["label"]], model["count"]) +                property string \
label: i18n("Current activity")  
-                width: introGrid.delegateWidth
-                height: introGrid.delegateHeight
+                width: introFlow.delegateWidth
+                height: introFlow.delegateHeight
 
-                onClicked: push(model["label"])
+                onClicked: {
+                    var page = mainStack.push(Qt.createComponent("Browser.qml"))
+                    metadataModel.resourceType = "nfo:FileDataObject"
+                    metadataModel.activityId = activitySource.data.Status.Current
+                }
             }
         }
     }
diff --git a/applications/filebrowser/package/contents/ui/TypeFilter.qml \
b/applications/filebrowser/package/contents/ui/TypeFilter.qml index f8c2475..fcef930 \
                100644
--- a/applications/filebrowser/package/contents/ui/TypeFilter.qml
+++ b/applications/filebrowser/package/contents/ui/TypeFilter.qml
@@ -61,6 +61,7 @@ Column {
             buttonColumn.exclusive = true
         }
     }
+
     PlasmaComponents.ButtonColumn {
         id: buttonColumn
         spacing: 4
@@ -86,5 +87,24 @@ Column {
                 }
             }
         }
+        PlasmaExtraComponents.Heading {
+            text: i18n("Activity")
+            anchors {
+                right: parent.right
+                rightMargin: -(parent.parent.width - parent.width) + \
theme.defaultFont.mSize.width*2 +            }
+        }
+        PlasmaComponents.RadioButton {
+            text: i18n("Current activity")
+            checked: metadataModel.activityId == activitySource.data.Status.Current
+            onCheckedChanged: {
+                if (checked) {
+                    metadataModel.resourceType = "nfo:FileDataObject"
+                    metadataModel.activityId = activitySource.data.Status.Current
+                } else {
+                    metadataModel.activityId = ""
+                }
+            }
+        }
     }
 }
diff --git a/applications/filebrowser/package/contents/ui/main.qml \
b/applications/filebrowser/package/contents/ui/main.qml index e474ddd..61782af 100644
--- a/applications/filebrowser/package/contents/ui/main.qml
+++ b/applications/filebrowser/package/contents/ui/main.qml
@@ -20,6 +20,7 @@
 import QtQuick 1.1
 import org.kde.dirmodel 0.1
 import org.kde.metadatamodels 0.1 as MetadataModels
+import org.kde.plasma.core 0.1 as PlasmaCore
 import org.kde.plasma.components 0.1 as PlasmaComponents
 import org.kde.plasma.extras 0.1 as PlasmaExtras
 import org.kde.plasma.mobilecomponents 0.1 as MobileComponents
@@ -56,6 +57,11 @@ Image {
         resourceType: exclusiveResourceType
         mimeTypes: exclusiveMimeTypes
     }
+    PlasmaCore.DataSource {
+        id: activitySource
+        engine: "org.kde.activities"
+        connectedSources: ["Status"]
+    }
     DirModel {
         id: dirModel
     }


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

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