diff options
Diffstat (limited to 'components/package/contents/ui/Outbox.qml')
-rw-r--r-- | components/package/contents/ui/Outbox.qml | 129 |
1 files changed, 58 insertions, 71 deletions
diff --git a/components/package/contents/ui/Outbox.qml b/components/package/contents/ui/Outbox.qml index 3a51e51a..74e4212e 100644 --- a/components/package/contents/ui/Outbox.qml +++ b/components/package/contents/ui/Outbox.qml | |||
@@ -17,9 +17,8 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | import QtQuick 2.4 | 19 | import QtQuick 2.4 |
20 | import QtQuick.Controls 1.3 | ||
21 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
22 | import QtQuick.Controls 2.0 as Controls2 | 21 | import QtQuick.Controls 2.0 |
23 | 22 | ||
24 | import org.kde.kirigami 1.0 as Kirigami | 23 | import org.kde.kirigami 1.0 as Kirigami |
25 | 24 | ||
@@ -27,11 +26,10 @@ import org.kube.framework.actions 1.0 as KubeAction | |||
27 | import org.kube.framework.domain 1.0 as KubeFramework | 26 | import org.kube.framework.domain 1.0 as KubeFramework |
28 | import org.kube.components 1.0 as KubeComponents | 27 | import org.kube.components 1.0 as KubeComponents |
29 | 28 | ||
30 | ToolButton { | 29 | Button { |
31 | id: root | 30 | id: root |
32 | 31 | ||
33 | iconName: "mail-folder-outbox" | 32 | text: "outbox" |
34 | tooltip: "outbox" | ||
35 | 33 | ||
36 | onClicked: { | 34 | onClicked: { |
37 | dialog.visible = dialog.visible ? false : true | 35 | dialog.visible = dialog.visible ? false : true |
@@ -41,90 +39,79 @@ ToolButton { | |||
41 | id: outboxController | 39 | id: outboxController |
42 | } | 40 | } |
43 | 41 | ||
44 | //BEGIN Dialog | 42 | Popup { |
45 | Rectangle { | ||
46 | id: dialog | 43 | id: dialog |
47 | 44 | ||
48 | property int modelCount: listView.count | 45 | height: content.height + Kirigami.Units.smallSpacing * 2 |
46 | width: content.width + Kirigami.Units.smallSpacing * 2 | ||
49 | 47 | ||
50 | anchors { | 48 | y: - dialog.height + root.height |
51 | top: parent.bottom | 49 | x: root.width |
52 | horizontalCenter: parent.horizontalCenter | ||
53 | } | ||
54 | 50 | ||
55 | function calculateHeight() { | 51 | modal: true |
56 | if (modelCount == 0) { | ||
57 | return Kirigami.Units.gridUnit * 3 + 10 | ||
58 | } else { | ||
59 | return modelCount * Kirigami.Units.gridUnit * 3 + 10 + sendNowButton.height | ||
60 | } | ||
61 | } | ||
62 | 52 | ||
63 | height: calculateHeight() | 53 | Item { |
64 | width: Kirigami.Units.gridUnit * 20 | 54 | id: content |
65 | |||
66 | color: Kirigami.Theme.backgroundColor | ||
67 | border.width: 1 | ||
68 | border.color: Kirigami.Theme.highlightColor //TODO change to Kirigami inactive text color once it is available | ||
69 | radius: 3 | ||
70 | clip: true | ||
71 | visible: false | ||
72 | |||
73 | //BEGIN Dialog Content | ||
74 | Column { | ||
75 | anchors { | ||
76 | fill: parent | ||
77 | margins: 5 | ||
78 | } | ||
79 | 55 | ||
80 | visible: dialog.modelCount != 0 | 56 | anchors.centerIn: parent |
81 | 57 | ||
82 | Controls2.Button { | 58 | width: Kirigami.Units.gridUnit * 17 |
83 | id: sendNowButton | 59 | height: listView.count * Kirigami.Units.gridUnit * 3 + sendNowButton.height + Kirigami.Units.smallSpacing |
84 | anchors.horizontalCenter: parent.horizontalCenter | ||
85 | height: Kirigami.Units.gridUnit * 2 | ||
86 | text: qsTr("Send now.") | ||
87 | onClicked: { | ||
88 | outboxController.sendOutboxAction.execute() | ||
89 | } | ||
90 | } | ||
91 | 60 | ||
92 | ScrollView { | 61 | ListView { |
93 | id: scrollView | 62 | id: listView |
94 | 63 | ||
95 | anchors { | 64 | width: parent.width |
96 | left: parent.left | 65 | height: count * Kirigami.Units.gridUnit * 3 |
97 | right: parent.right | ||
98 | margins: 5 | ||
99 | } | ||
100 | 66 | ||
101 | ListView { | 67 | model: KubeFramework.OutboxModel {} |
102 | id: listView | ||
103 | 68 | ||
104 | model: KubeFramework.OutboxModel { | 69 | delegate: Rectangle { |
105 | } | ||
106 | 70 | ||
107 | delegate: Kirigami.AbstractListItem { | 71 | height: Kirigami.Units.gridUnit * 3 |
108 | height: Kirigami.Units.gridUnit * 3 | 72 | width: listView.width |
109 | 73 | ||
110 | Kirigami.Label { | 74 | color: Kirigami.Theme.viewBackgroundColor |
111 | anchors.verticalCenter: parent.verticalCenter | 75 | border.color: Kirigami.Theme.backgroundColor |
112 | text: model.subject | 76 | border.width: 1 |
77 | |||
78 | Label { | ||
79 | anchors { | ||
80 | verticalCenter: parent.verticalCenter | ||
81 | left: parent.left | ||
82 | leftMargin: Kirigami.Units.largeSpacing | ||
113 | } | 83 | } |
84 | text: model.subject | ||
114 | } | 85 | } |
115 | } | 86 | } |
87 | |||
88 | clip: true | ||
116 | } | 89 | } |
117 | } | 90 | |
118 | Kirigami.Label { | 91 | Button { |
119 | anchors { | 92 | id: sendNowButton |
120 | fill: parent | 93 | |
121 | margins: 5 | 94 | anchors { |
122 | verticalCenter: parent.verticalCenter | 95 | top: listView.bottom |
96 | topMargin: Kirigami.Units.smallSpacing | ||
97 | horizontalCenter: parent.horizontalCenter | ||
98 | } | ||
99 | |||
100 | visible: listView.count != 0 | ||
101 | |||
102 | text: qsTr("Send now") | ||
103 | onClicked: { | ||
104 | outboxController.sendOutboxAction.execute() | ||
105 | } | ||
106 | } | ||
107 | |||
108 | Label { | ||
109 | anchors.centerIn: parent | ||
110 | |||
111 | visible: listView.count == 0 | ||
112 | |||
113 | text: qsTr("No pending messages") | ||
123 | } | 114 | } |
124 | visible: dialog.modelCount == 0 | ||
125 | text: qsTr("No pending messages.") | ||
126 | } | 115 | } |
127 | //END Dialog Content | ||
128 | } | 116 | } |
129 | //END Dialog | ||
130 | } | 117 | } |