Dekko
SubjectField.qml
1 /* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
2 
3  This file is part of Dekko email client for Ubuntu devices
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License as
7  published by the Free Software Foundation; either version 2 of
8  the License or (at your option) version 3
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 import QtQuick 2.4
19 import Lomiri.Components 1.3
20 import Lomiri.Components.Themes.Ambiance 1.3
21 import Dekko.Components 1.0
22 import Dekko.Mail.Stores.Composer 1.0
23 import Dekko.Lomiri.Components 1.0
24 import Dekko.Lomiri.Constants 1.0
25 
26 FocusScope {
27 
28  readonly property int defaultHeight: units.gu(4)
29  readonly property alias text: input.text
30  property alias textDocument: input.textDocument
31 
32  anchors {
33  left: parent.left
34  right: parent.right
35  }
36 
37  clip: true
38  height: input.lineCount > 1 ? input.height + Style.smallSpacing : defaultHeight
39  implicitHeight: height
40  implicitWidth: width
41 
42  StretchRow {
43  anchors {
44  fill: parent
45  leftMargin: Style.defaultSpacing
46  rightMargin: Style.defaultSpacing
47  }
48  spacing: Style.smallSpacing
49 
50  Label {
51  anchors {
52  left: parent.left
53  top: parent.top
54  topMargin: Style.smallSpacing
55  }
56  text: qsTr("Subject:")
57  }
58 
59  Stretcher {
60  height: input.height
61  implicitHeight: height
62 
63  TextArea {
64  id: input
65  anchors {
66  left: parent.left
67  top: parent.top
68  right: parent.right
69  topMargin: Style.smallSpacing
70  }
71  maximumLineCount: 3
72  wrapMode: TextEdit.WrapAnywhere
73  autoSize: true
74  height: defaultHeight
75  style:TextAreaStyle {
76  overlaySpacing: 0
77  frameSpacing: 0
78  background: Item {}
79  }
80  }
81 
82  Binding {
83  target: ComposerStore
84  property: "subjectDocument"
85  value: input.textDocument
86  }
87  }
88  }
89 
90  Line {
91  anchors {
92  bottom: parent.bottom
93  right: parent.right
94  left: parent.left
95  }
96  }
97 }
98 
Dekko
Definition: Dekko.qml:30
Dekko::Lomiri::Components::Line
Definition: Line.qml:22
Dekko::Lomiri::Constants::Style::defaultSpacing
int defaultSpacing
Definition: Style.qml:27
Dekko::Lomiri::Constants::Style
Definition: Style.qml:23
Dekko::Lomiri::Constants::Style::smallSpacing
int smallSpacing
Definition: Style.qml:33