~cos64/trolly/trunk

« back to all changes in this revision

Viewing changes to components/HistoryPage.qml

  • Committer: Cos64
  • Date: 2015-12-30 08:10:02 UTC
  • Revision ID: cos64@staticdot.com-20151230081002-yc3vzwpubm15yhsw
Bug 1495134: Remove redundant history list model.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
            text: i18n.tr("Delete all")
18
18
            iconName: "edit-delete"
19
19
            onTriggered: askToDeleteAllItems()
20
 
            enabled: items.length > 0
 
20
            enabled: historyListModel.count > 0
21
21
        }
22
22
    ]
23
23
 
24
 
    property var items: null;
25
 
 
26
24
    ListModel {
27
25
        id: historyListModel
28
26
    }
33
31
        layouts: [
34
32
            ConditionalLayout {
35
33
                name: "placeholder"
36
 
                when: items.length === 0
 
34
                when: historyListModel.count === 0
37
35
 
38
36
                Label {
39
37
                    anchors {
47
45
            },
48
46
            ConditionalLayout {
49
47
                name: "content"
50
 
                when: items.length > 0
 
48
                when: historyListModel.count > 0
51
49
 
52
50
                ColumnLayout {
53
51
                    spacing: units.gu(1)
130
128
    }
131
129
 
132
130
    function loadHistory() {
133
 
        items = listService.do_load_history();
 
131
        var items = listService.do_load_history();
134
132
 
135
133
        historyListModel.clear();
136
134
        for(var i = 0; i < items.length; i++) {
147
145
    function deleteAllItems() {
148
146
        listService.do_delete_list(namesOfAllItemsInTheList());
149
147
        historyListModel.clear();
150
 
        items = [];
151
148
    }
152
149
 
153
150
    function moveItemToShoppingList(index) {