~verzegnassi-stefano/edit/brand-name-not-translatable

« back to all changes in this revision

Viewing changes to app/ui/LocalFilePicker.qml

  • Committer: pawstr
  • Date: 2015-01-23 19:41:38 UTC
  • Revision ID: pawstr@gmail.com-20150123194138-bd8zysyrzcqa0uq6
All files added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import Ubuntu.Components 1.1
 
3
import Ubuntu.Components.ListItems 1.0 as ListItem
 
4
 
 
5
Page {
 
6
    title: i18n.tr("Local files")
 
7
 
 
8
    tools: ToolbarItems {
 
9
        back: root.pageStack.pop()
 
10
    }
 
11
    visible: false
 
12
 
 
13
    onActiveChanged: {
 
14
        if(active) {
 
15
            root.fileList = fileIO.getLocalFileList("/home/phablet/.local/share/com.ubuntu.developer.pawstr.edit/")
 
16
            listModel.clear();
 
17
            for(var i=0; i<root.fileList.length; i++) {
 
18
//                print(root.fileList[i]);
 
19
                listModel.append({"text": root.fileList[i]});
 
20
            }
 
21
        }
 
22
    }
 
23
    ListModel {id: listModel}
 
24
 
 
25
    UbuntuListView {
 
26
        id: ubuntuListView
 
27
        anchors.fill: parent
 
28
        model: listModel
 
29
        delegate: ListItem.Standard {
 
30
            id: standardItem
 
31
            text: modelData
 
32
            onClicked: {
 
33
                root.pageStack.pop();
 
34
                root.importItems[0].url = "file:///home/phablet/.local/share/com.ubuntu.developer.pawstr.edit/" + text;
 
35
                textArea.text = fileIO.read(root.importItems[0].url);
 
36
                root.title = fileIO.getFullName(root.importItems[0].url);
 
37
            }
 
38
        }
 
39
    }
 
40
}