~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-1993

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Settings/Menus/SnapDecisionMenu.qml

  • Committer: Bileto Bot
  • Date: 2016-10-19 13:22:23 UTC
  • mfrom: (146.3.110 slots-layout)
  • Revision ID: ci-train-bot@canonical.com-20161019132223-8xigje52fn3laoaq
* Menus: rewrite components using ListItemLayout's and SlotsLayout's
* Bump revision to 0.10, as per Components removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 2013 Canonical Ltd.
 
2
 * Copyright 2013-2016 Canonical Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU Lesser General Public License as published by
16
16
 * Authors:
17
17
 *      Renato Araujo Oliveira Filho <renato@canonical.com>
18
18
 *      Olivier Tilloy <olivier.tilloy@canonical.com>
 
19
 *      Marco Trevisan <marco.trevisan@canonical.com>
19
20
 */
20
21
 
21
22
import QtQuick 2.4
22
23
import Ubuntu.Components 1.3
23
24
import Ubuntu.Settings.Components 0.1 as USC
24
 
import QtQuick.Layouts 1.1
25
25
 
26
26
SimpleMessageMenu {
27
27
    id: menu
28
28
 
29
 
    property bool actionEnabled: true
30
 
    property string actionButtonText: i18n.dtr("ubuntu-settings-components", "Call back")
 
29
    property alias actionEnabled: actionButton.enabled
 
30
    property alias actionButtonText: actionButton.text
31
31
 
32
 
    property bool replyEnabled: true
33
 
    property string replyButtonText: i18n.dtr("ubuntu-settings-components", "Send")
34
 
    property string replyHintText
35
 
    property bool replyExpanded: false
 
32
    property alias replyEnabled: reply.activateEnabled
 
33
    property alias replyButtonText: reply.buttonText
 
34
    property alias replyHintText: reply.textHint
 
35
    property alias replyExpanded: reply.visible
36
36
 
37
37
    signal actionActivated
38
38
    signal replied(string value)
40
40
    footer: Item {
41
41
        id: buttons
42
42
 
43
 
        implicitHeight: layout.implicitHeight
 
43
        implicitHeight: layout.height
 
44
        anchors { right: parent.right; left: parent.left }
44
45
 
45
 
        ColumnLayout {
 
46
        Column {
46
47
            id: layout
47
48
            anchors {
48
49
                left: parent.left
49
50
                right: parent.right
50
51
            }
51
 
            spacing: units.gu(1)
52
 
 
53
 
            RowLayout {
54
 
                spacing: units.gu(2)
55
 
 
56
 
                Button {
57
 
                    objectName: "messageButton"
58
 
                    text: i18n.dtr("ubuntu-settings-components", "Message")
59
 
                    Layout.fillWidth: true
60
 
 
61
 
                    onClicked: {
62
 
                        menu.replyExpanded = !menu.replyExpanded;
 
52
 
 
53
            SlotsLayout {
 
54
                id: slotsLayout
 
55
                padding.top: 0
 
56
 
 
57
                mainSlot: Row {
 
58
                    id: row
 
59
                    spacing: units.gu(2)
 
60
 
 
61
                    Button { id:foobutt
 
62
                        objectName: "messageButton"
 
63
                        text: i18n.dtr("ubuntu-settings-components", "Message")
 
64
 
 
65
                        onClicked: {
 
66
                            menu.replyExpanded = !menu.replyExpanded;
 
67
                        }
 
68
 
 
69
                        width: actionButton.width
63
70
                    }
64
 
                }
65
 
 
66
 
                Button {
67
 
                    id: actionButton
68
 
                    objectName: "actionButton"
69
 
                    enabled: menu.actionEnabled
70
 
                    text: actionButtonText
71
 
                    color: enabled ? theme.palette.normal.positive : theme.palette.disabled.positive
72
 
                    Layout.fillWidth: true
73
 
 
74
 
                    onClicked: {
75
 
                        menu.actionActivated();
 
71
 
 
72
                    Button {
 
73
                        id: actionButton
 
74
                        objectName: "actionButton"
 
75
                        text: i18n.dtr("ubuntu-settings-components", "Call back")
 
76
                        color: enabled ? theme.palette.normal.positive : theme.palette.disabled.positive
 
77
 
 
78
                        onClicked: {
 
79
                            menu.actionActivated();
 
80
                        }
 
81
 
 
82
                        width: (parent.width - row.spacing) / 2
76
83
                    }
77
84
                }
78
85
            }
80
87
            USC.ActionTextField {
81
88
                id: reply
82
89
 
83
 
                Layout.fillWidth: true
84
 
                Layout.fillHeight: true
85
 
                visible: menu.replyExpanded
86
 
 
87
 
                activateEnabled: menu.replyEnabled
88
 
                buttonText: menu.replyButtonText
89
 
                textHint: menu.replyHintText
 
90
                visible: false
 
91
                activateEnabled: true
 
92
                buttonText: i18n.dtr("ubuntu-settings-components", "Send")
90
93
 
91
94
                onActivated: {
92
95
                    menu.replied(value);