~ubuntu-branches/ubuntu/raring/plasma-mobile/raring-proposed

« back to all changes in this revision

Viewing changes to applications/filebrowser/package/contents/ui/Intro.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-07-17 12:04:43 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120717120443-q3ig9u2fnltx67yg
Tags: 2.0+git2012071701-0ubuntu1
* New upstream snapshot
* Remove build-dep on kde-runtime-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2011 Marco Martin <mart@kde.org>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU Library General Public License as
 
6
 *   published by the Free Software Foundation; either version 2, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program is distributed in the hope that it will be useful,
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *   GNU Library General Public License for more details
 
13
 *
 
14
 *   You should have received a copy of the GNU Library General Public
 
15
 *   License along with this program; if not, write to the
 
16
 *   Free Software Foundation, Inc.,
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
import QtQuick 1.1
 
21
import org.kde.metadatamodels 0.1 as MetadataModels
 
22
import org.kde.plasma.components 0.1 as PlasmaComponents
 
23
import org.kde.plasma.mobilecomponents 0.1 as MobileComponents
 
24
 
 
25
 
 
26
PlasmaComponents.Page {
 
27
    id: introPage
 
28
    objectName: "introPage"
 
29
 
 
30
    tools: Item {
 
31
        width: parent.width
 
32
        height: childrenRect.height
 
33
 
 
34
        MobileComponents.ViewSearch {
 
35
            id: searchBox
 
36
            anchors.centerIn: parent
 
37
 
 
38
            onSearchQueryChanged: {
 
39
                metadataModel.extraParameters["nfo:fileName"] = searchBox.searchQuery
 
40
                busy = (searchBox.searchQuery.length > 0)
 
41
                push("")
 
42
            }
 
43
        }
 
44
    }
 
45
 
 
46
    anchors {
 
47
        fill: parent
 
48
        topMargin: toolBar.height
 
49
    }
 
50
 
 
51
    function push(category)
 
52
    {
 
53
        var page = mainStack.push(Qt.createComponent("Browser.qml"))
 
54
        metadataModel.resourceType = category
 
55
    }
 
56
 
 
57
    function iconFor(category)
 
58
    {
 
59
        switch (category) {
 
60
        case "nfo:Bookmark":
 
61
            return "folder-bookmark"
 
62
        case "nfo:Audio":
 
63
            return "folder-sound"
 
64
        case "nfo:Archive":
 
65
            return "folder-tar"
 
66
        case "nco:Contact":
 
67
            return "folder-image-people"
 
68
        case "nfo:Document":
 
69
            return "folder-documents"
 
70
        case "nfo:Image":
 
71
            return "folder-image"
 
72
        case "nfo:Video":
 
73
            return "folder-video"
 
74
            break;
 
75
        }
 
76
    }
 
77
 
 
78
    Image {
 
79
        id: browserFrame
 
80
        z: 100
 
81
        source: "image://appbackgrounds/standard"
 
82
        fillMode: Image.Tile
 
83
        anchors.fill: parent
 
84
 
 
85
        MobileComponents.IconGrid {
 
86
            id: introGrid
 
87
            anchors.fill: parent
 
88
 
 
89
            model: MetadataModels.MetadataCloudModel {
 
90
                cloudCategory: "rdf:type"
 
91
                resourceType: "nfo:FileDataObject"
 
92
                minimumRating: metadataModel.minimumRating
 
93
                allowedCategories: userTypes.userTypes.filter(function(val) {
 
94
                    return val != "nfo:Application";
 
95
                })
 
96
            }
 
97
 
 
98
            delegate: MobileComponents.ResourceDelegate {
 
99
                className: "FileDataObject"
 
100
                genericClassName: "FileDataObject"
 
101
                property string decoration: iconFor(model["label"])
 
102
 
 
103
                property string label: i18n("%1 (%2)", userTypes.typeNames[model["label"]], model["count"])
 
104
 
 
105
                width: introGrid.delegateWidth
 
106
                height: introGrid.delegateHeight
 
107
 
 
108
                onClicked: push(model["label"])
 
109
            }
 
110
        }
 
111
    }
 
112
}
 
113