162dea6c351018bc3a284a2b143b2fd8b540988e
[qtrapids] / src / qml-client / qml / TorrentPickerPage.qml
1 import QtQuick 1.1
2 import Qt.labs.components 1.0
3 import com.nokia.meego 1.0
4 import com.meego 1.0
5 import com.nokia.extras 1.0
6
7 import QtMobility.gallery 1.1
8 import QtRapids 1.0
9
10 Page {
11     
12     id: torrentPickerPage
13     Component.onCompleted: console.log("TorrentPicker Running!")
14     DocumentGalleryModel {
15         id: torrentFileModel
16
17         rootType: DocumentGallery.File
18         properties: ["url"]
19         filter: GalleryWildcardFilter {
20             property: "fileName";
21             value: "*.torrent";
22         }
23
24         onProgressChanged: console.log("Width has changed to: ", progress)
25
26 //         onCountChanged: {
27 //             selection.clear()
28 //             for (var i = 0; i < count; i++)
29 //                 selection.append({"selected": false})
30 //         }
31     }
32     // TODO: Don't really need this, we can only select one file, I guess?
33 //     ListModel {
34 //         id: selection
35 //     }
36     ListView {
37         width: 200; height: 400
38         model: torrentFileModel
39         delegate: torrentFileDelegate
40     }
41     Component {
42         id: torrentFileDelegate
43
44         Item {
45             height: 60
46             width: parent.width
47             MouseArea {
48                 Text {
49                     height: parent.height
50                     width: parent.width
51                     text: url
52                 }
53                 anchors.fill: parent
54                 onClicked: { console.log("selected torrent: " + url); }
55             }
56         }
57     }
58 }