~chris.gagnon/ubuntu-ui-toolkit/fix-bug-1388896

« back to all changes in this revision

Viewing changes to tests/resources/header/select.qml

  • Committer: CI bot
  • Author(s): Zsombor Egri, Michael Sheldon, Zoltán Balogh, Christian Dywan, Tim Peeters
  • Date: 2014-10-07 12:09:27 UTC
  • mfrom: (1000.249.11 landing-0711)
  • Revision ID: ps-jenkins@lists.canonical.com-20141007120927-ucysonqxn60vu8gz
  [ Michael Sheldon ]
  * Removes the keyboard anchor animation as this is now implemented
    in the keyboard.

  [ Tim Peeters ]
  * PageStack push returns the pushed page. Fixes LP: #1361919
  * Add selection mode as a preset to the header configuration.
    Fixes LP: #1370146.

  [ Zsombor Egri ]
  * Fix Dialog foreground sizing. Fixes LP: #1337555, LP: #1337556.
  * Workaround for StateSaver to fall back to use qgetenv() when
    QStandardPaths fails to return XDG_RUNTIME_DIR path.
    Fixes LP: #1363112.

  [ Christian Dywan ]
  * Add unit tests for MathUtils API.
    Fixes LP: #1244685.
  * Text field hint should use the same font as the editor.
    Fixes LP: #1237400.
  * Read-only text fields mustn't have a clear button.
    Fixes LP: #1337257.
  * autopilot package should source-depend on QML plugin.
    Fixes LP: #1236085.
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
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 Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.2
 
18
import Ubuntu.Components 1.1
 
19
 
 
20
// FIXME: This example can be much simplified using PageHeadState
 
21
//  when bug #1345775 has been fixed.
 
22
 
 
23
MainView {
 
24
    id: mainView
 
25
    width: units.gu(40)
 
26
    height: units.gu(50)
 
27
    useDeprecatedToolbar: false
 
28
 
 
29
    Page {
 
30
        id: page
 
31
        title: "Demo"
 
32
 
 
33
        state: "default"
 
34
        states: [
 
35
            PageHeadState {
 
36
                name: "default"
 
37
                head: page.head
 
38
                actions: [
 
39
                    Action {
 
40
                        iconName: "contact"
 
41
                        text: "Contact"
 
42
                    }
 
43
                ]
 
44
            },
 
45
            State {
 
46
                id: selectState
 
47
                name: "select"
 
48
 
 
49
                property Action leaveSelect: Action {
 
50
                    iconName: "back"
 
51
                    text: "Back"
 
52
                    onTriggered: page.state = "default"
 
53
                }
 
54
                property list<Action> actions: [
 
55
                    Action {
 
56
                        iconName: "select"
 
57
                        text: "Select All"
 
58
                    },
 
59
                    Action {
 
60
                        iconName: "delete"
 
61
                        text: "Delete"
 
62
                    }
 
63
                ]
 
64
                PropertyChanges {
 
65
                    target: page.head
 
66
                    backAction: selectState.leaveSelect
 
67
                    actions: selectState.actions
 
68
                    preset: "select"
 
69
                }
 
70
            }
 
71
        ]
 
72
 
 
73
        Label {
 
74
            anchors.centerIn: parent
 
75
            text: "Use back button to leave selection mode."
 
76
            visible: page.state == "select"
 
77
        }
 
78
 
 
79
        Button {
 
80
            anchors.centerIn: parent
 
81
            onClicked: page.state = "select"
 
82
            visible: page.state != "select"
 
83
            text: "selection mode"
 
84
        }
 
85
    }
 
86
}