~nick-dedekind/unity8/indicators.hint-interval

« back to all changes in this revision

Viewing changes to qml/Dash/Previews/PreviewActionCombo.qml

  • Committer: Nick Dedekind
  • Date: 2014-03-07 15:54:57 UTC
  • mfrom: (638.1.118 unity8)
  • Revision ID: nicholas.dedekind@gmail.com-20140307155457-f0s1zu5ll2czt3rq
merged with trunk

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 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 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
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
 
 
20
Item {
 
21
    id: root
 
22
 
 
23
    implicitHeight: childrenRect.height
 
24
 
 
25
    signal triggeredAction(var actionData)
 
26
 
 
27
    property alias model: actionRepeater.model
 
28
 
 
29
    Button {
 
30
        id: moreButton
 
31
        property bool expanded: false
 
32
 
 
33
        objectName: "moreLessButton"
 
34
        text: !expanded ? i18n.tr("More...") : i18n.tr("Less...")
 
35
        color: Theme.palette.selected.foreground
 
36
        onClicked: expanded = !expanded
 
37
        width: parent.width
 
38
    }
 
39
 
 
40
    Column {
 
41
        anchors {
 
42
            top: moreButton.bottom
 
43
            topMargin: height > 0 ? spacing : 0
 
44
        }
 
45
        objectName: "buttonColumn"
 
46
        spacing: units.gu(1)
 
47
        width: parent.width
 
48
        height: moreButton.expanded ? implicitHeight : 0
 
49
        clip: true
 
50
        Behavior on height {
 
51
            UbuntuNumberAnimation {
 
52
                duration: UbuntuAnimation.SnapDuration
 
53
            }
 
54
        }
 
55
 
 
56
        Repeater {
 
57
            id: actionRepeater
 
58
 
 
59
            delegate: PreviewActionButton {
 
60
                data: modelData
 
61
                width: implicitWidth < parent.width ? parent.width : implicitWidth
 
62
                onClicked: root.triggeredAction(modelData)
 
63
            }
 
64
        }
 
65
    }
 
66
}