Dekko
Loading...
Searching...
No Matches
SettingsPopup.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*/
18import QtQuick 2.4
19import QtQuick.Controls.Suru 2.2
20import Lomiri.Components 1.3
21import Lomiri.Components.Popups 1.3
22import Dekko.Components 1.0
23import Dekko.Lomiri.Constants 1.0
24import Dekko.Lomiri.Components 1.0
26PopupBase {
27 id: base
28
29 property alias title: header.title
30 default property alias settingsContent: mainContent.data
31 readonly property int maxHeight: units.gu(70)
32 readonly property int maxWidth: units.gu(100)
33
34 Rectangle {
35 anchors.fill: parent
36 color: Suru.secondaryForegroundColor
37 opacity: 0.6
38 }
39
40 LomiriShape {
41 readonly property bool shouldCenter: height === base.maxHeight
42 readonly property bool addTopMargin: height > units.gu(40)
43 aspect: LomiriShape.DropShadow
44 width: Math.min((parent.width / 3)*2, base.maxWidth)
45 height: Math.min((parent.height / 5)*4, base.maxHeight)
46 anchors {
47 horizontalCenter: parent.horizontalCenter
48 top: shouldCenter ? undefined : parent.top
49 topMargin: shouldCenter ? undefined : (addTopMargin ? units.gu(6) : Style.defaultSpacing)
50 verticalCenter: shouldCenter ? parent.verticalCenter : undefined
51 }
52 color: Suru.backgroundColor
53 clip: true
54
55 StretchColumn {
56 anchors.fill: parent
57
58 DekkoHeader {
59 id: header
60 implicitHeight: height
61 backgroundVisible: false
62 backAction: Action {
63 iconName: "close"
64 onTriggered: PopupUtils.close(base)
65 }
66 }
67
68 Stretcher {
69 id: mainContent
70 }
71 }
72 InverseMouseArea {
73 anchors.fill: parent
74 acceptedButtons: Qt.LeftButton
75 onPressed: PopupUtils.close(base)
76 }
77 }
78
79}