~fginther/ubuntu-filemanager-app/copy-Xauthority

« back to all changes in this revision

Viewing changes to PlacesSidebar.qml

  • Committer: Michel Spencer
  • Date: 2013-08-02 04:05:20 UTC
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: spencers1993@gmail.com-20130802040520-zbq6pe1rmei23qm0
Added initial places sidebar in desktop/wide mode

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Michael Spencer <spencers1993@gmail.com>
 
17
 */
 
18
import QtQuick 2.0
 
19
import Ubuntu.Components 0.1
 
20
import Ubuntu.Components.ListItems 0.1
 
21
import Ubuntu.Components.Popups 0.1
 
22
 
 
23
Sidebar {
 
24
    id: root
 
25
 
 
26
    width: units.gu(25)
 
27
 
 
28
    ListModel {
 
29
        id: places
 
30
 
 
31
        ListElement {
 
32
            path: "~"
 
33
        }
 
34
 
 
35
        ListElement {
 
36
            path: "~/Documents"
 
37
        }
 
38
 
 
39
        ListElement {
 
40
            path: "~/Downloads"
 
41
        }
 
42
 
 
43
        ListElement {
 
44
            path: "~/Music"
 
45
        }
 
46
 
 
47
        ListElement {
 
48
            path: "~/Pictures"
 
49
        }
 
50
 
 
51
        ListElement {
 
52
            path: "~/Videos"
 
53
        }
 
54
 
 
55
        ListElement {
 
56
            path: "/"
 
57
        }
 
58
    }
 
59
 
 
60
    Column {
 
61
        anchors {
 
62
            left: parent.left
 
63
            right: parent.right
 
64
            top: parent.top
 
65
        }
 
66
 
 
67
        Header {
 
68
            text: i18n.tr("Places")
 
69
        }
 
70
 
 
71
//        Empty {
 
72
 
 
73
//            TextField {
 
74
//                id: locationField
 
75
//                anchors {
 
76
//                    verticalCenter: parent.verticalCenter
 
77
//                    left: parent.left
 
78
//                    right: parent.right
 
79
//                    margins: units.gu(1)
 
80
//                }
 
81
 
 
82
//                inputMethodHints: Qt.ImhNoAutoUppercase
 
83
 
 
84
//                property bool valid: pathExists(text)
 
85
 
 
86
//                text: fileView.path
 
87
 
 
88
//                placeholderText: i18n.tr("Location...")
 
89
 
 
90
//                onAccepted: {
 
91
//                    goTo(text)
 
92
//                }
 
93
//            }
 
94
 
 
95
//            onClicked: {
 
96
//                goTo(locationField.text)
 
97
//            }
 
98
//        }
 
99
 
 
100
        Repeater {
 
101
            id: placesList
 
102
            objectName: "placesList"
 
103
 
 
104
            model: places
 
105
 
 
106
            delegate: Standard {
 
107
                text: folderName(path)
 
108
                icon: model.icon || fileIcon(model.path, true)
 
109
 
 
110
                onClicked: {
 
111
                    goTo(model.path)
 
112
                }
 
113
 
 
114
                height: units.gu(5)
 
115
 
 
116
                selected: folder === path
 
117
            }
 
118
        }
 
119
    }
 
120
}