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

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Settings/Components/ActionTextField.qml

  • Committer: Bileto Bot
  • Date: 2016-10-24 11:32:00 UTC
  • mfrom: (146.3.110 slots-layout)
  • Revision ID: ci-train-bot@canonical.com-20161024113200-85dvkl9m1o0msi5i
* 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
 
import QtQuick.Layouts 1.1
24
24
 
25
25
Item {
26
26
    id: textField
31
31
 
32
32
    signal activated(var value)
33
33
 
34
 
    implicitHeight: layout.implicitHeight
 
34
    height: layout.height
 
35
    anchors { right: parent.right; left: parent.left }
35
36
 
36
 
    Row {
 
37
    SlotsLayout {
37
38
        id: layout
38
 
        anchors {
39
 
            left: parent.left
40
 
            right: parent.right
41
 
        }
42
 
        spacing: units.gu(1)
 
39
        padding.top: 0
43
40
 
44
 
        TextArea {
 
41
        mainSlot: TextArea {
45
42
            id: replyField
46
43
            objectName: "replyText"
47
44
            autoSize: true
48
 
            width: parent.width - layout.spacing - sendButton.width
49
45
 
50
46
            onEnabledChanged: {
51
47
                //Make sure that the component lost focus when enabled = false,
59
55
        Button {
60
56
            id: sendButton
61
57
            objectName: "sendButton"
62
 
            Layout.preferredWidth: units.gu(9)
63
 
            enabled: (replyField.text !== "" || replyField.inputMethodComposing) && textField.activateEnabled
 
58
            enabled: (replyField.text.length > 0 || replyField.inputMethodComposing) && textField.activateEnabled
64
59
            color: enabled ? theme.palette.normal.positive : theme.palette.disabled.positive
65
60
 
66
61
            onClicked: {
67
62
                Qt.inputMethod.commit();
68
63
                textField.activated(replyField.text);
69
64
            }
 
65
 
 
66
            SlotsLayout.position: SlotsLayout.Trailing
70
67
        }
71
68
    }
72
69
}