Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationItem.qml
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | 30 | Item { | |||
---|---|---|---|---|---|
145 | 145 | | |||
146 | ColumnLayout { | 146 | ColumnLayout { | ||
147 | id: mainLayout | 147 | id: mainLayout | ||
148 | 148 | | |||
149 | anchors { | 149 | anchors { | ||
150 | top: parent.top | 150 | top: parent.top | ||
151 | left: appIconItem.visible || imageItem.visible ? appIconItem.right : parent.left | 151 | left: appIconItem.visible || imageItem.visible ? appIconItem.right : parent.left | ||
152 | right: parent.right | 152 | right: parent.right | ||
153 | leftMargin: units.smallSpacing * 2 | 153 | leftMargin: units.smallSpacing | ||
154 | } | 154 | } | ||
155 | 155 | | |||
156 | spacing: units.smallSpacing | 156 | spacing: Math.round(units.smallSpacing / 2) | ||
mart: you should still make sure it's an integer number | |||||
157 | 157 | | |||
158 | RowLayout { | 158 | RowLayout { | ||
159 | id: titleBar | 159 | id: titleBar | ||
160 | spacing: units.smallSpacing | 160 | spacing: units.smallSpacing | ||
161 | height: units.iconSizes.smallMedium | | |||
162 | 161 | | |||
163 | PlasmaExtras.Heading { | 162 | PlasmaExtras.Heading { | ||
164 | id: summaryLabel | 163 | id: summaryLabel | ||
165 | Layout.fillWidth: true | 164 | Layout.fillWidth: true | ||
166 | Layout.fillHeight: true | 165 | Layout.fillHeight: true | ||
167 | verticalAlignment: Text.AlignVCenter | 166 | verticalAlignment: Text.AlignVCenter | ||
168 | level: 4 | 167 | level: 4 | ||
169 | elide: Text.ElideRight | 168 | elide: Text.ElideRight | ||
Show All 36 Lines | 196 | PlasmaComponents.ToolButton { | |||
206 | onClicked: close() | 205 | onClicked: close() | ||
207 | } | 206 | } | ||
208 | 207 | | |||
209 | } | 208 | } | ||
210 | 209 | | |||
211 | RowLayout { | 210 | RowLayout { | ||
212 | id: bottomPart | 211 | id: bottomPart | ||
213 | Layout.alignment: Qt.AlignTop | 212 | Layout.alignment: Qt.AlignTop | ||
213 | spacing: units.smallSpacing | ||||
214 | 214 | | |||
215 | // Force the whole thing to collapse if the children are invisible | 215 | // Force the whole thing to collapse if the children are invisible | ||
216 | // If there is a big notification followed by a small one, the height | 216 | // If there is a big notification followed by a small one, the height | ||
217 | // of the popup does not always shrink back, so this forces it to | 217 | // of the popup does not always shrink back, so this forces it to | ||
218 | // height=0 when those are invisible. -1 means "default to implicitHeight" | 218 | // height=0 when those are invisible. -1 means "default to implicitHeight" | ||
219 | Layout.maximumHeight: bodyText.visible || actionsColumn.visible ? -1 : 0 | 219 | Layout.maximumHeight: bodyText.visible || actionsColumn.visible ? -1 : 0 | ||
220 | 220 | | |||
221 | MouseArea { | 221 | MouseArea { | ||
222 | id: contextMouseArea | 222 | id: contextMouseArea | ||
223 | 223 | | |||
224 | Layout.alignment: Qt.AlignTop | 224 | Layout.alignment: Qt.AlignTop | ||
225 | Layout.fillWidth: true | 225 | Layout.fillWidth: true | ||
226 | 226 | | |||
227 | anchors { | | |||
228 | leftMargin: units.smallSpacing * 2 | | |||
229 | rightMargin: units.smallSpacing * 2 | | |||
230 | } | | |||
231 | | ||||
232 | implicitHeight: maximumTextHeight > 0 ? Math.min(maximumTextHeight, bodyText.paintedHeight) : bodyText.paintedHeight | 227 | implicitHeight: maximumTextHeight > 0 ? Math.min(maximumTextHeight, bodyText.paintedHeight) : bodyText.paintedHeight | ||
233 | 228 | | |||
234 | acceptedButtons: Qt.RightButton | 229 | acceptedButtons: Qt.RightButton | ||
235 | preventStealing: true | 230 | preventStealing: true | ||
236 | 231 | | |||
237 | onPressed: contextMenu.open(mouse.x, mouse.y) | 232 | onPressed: contextMenu.open(mouse.x, mouse.y) | ||
238 | 233 | | |||
239 | PlasmaComponents.ContextMenu { | 234 | PlasmaComponents.ContextMenu { | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 258 | TextEdit { | |||
296 | } | 291 | } | ||
297 | } | 292 | } | ||
298 | } | 293 | } | ||
299 | } | 294 | } | ||
300 | 295 | | |||
301 | ColumnLayout { | 296 | ColumnLayout { | ||
302 | id: actionsColumn | 297 | id: actionsColumn | ||
303 | Layout.alignment: Qt.AlignTop | 298 | Layout.alignment: Qt.AlignTop | ||
304 | Layout.maximumWidth: theme.mSize(theme.defaultFont).width * (compact ? 8 : 12) | 299 | Layout.maximumWidth: theme.mSize(theme.defaultFont).width * (compact ? 10 : 16) | ||
300 | // this is so it never collapses but always follows what the Buttons below want | ||||
301 | // but also don't let the buttons get too narrow (e.g. "View" or "Open" button) | ||||
302 | Layout.minimumWidth: Math.max(units.gridUnit * 4, implicitWidth) | ||||
305 | 303 | | |||
306 | spacing: units.smallSpacing | 304 | spacing: units.smallSpacing | ||
307 | visible: notificationItem.actions && notificationItem.actions.count > 0 | 305 | visible: notificationItem.actions && notificationItem.actions.count > 0 | ||
308 | 306 | | |||
309 | Repeater { | 307 | Repeater { | ||
310 | id: actionRepeater | 308 | id: actionRepeater | ||
311 | model: notificationItem.actions | 309 | model: notificationItem.actions | ||
312 | 310 | | |||
313 | PlasmaComponents.Button { | 311 | PlasmaComponents.Button { | ||
312 | Layout.fillWidth: true | ||||
313 | Layout.preferredWidth: minimumWidth | ||||
314 | Layout.maximumWidth: actionsColumn.Layout.maximumWidth | 314 | Layout.maximumWidth: actionsColumn.Layout.maximumWidth | ||
315 | text: model.text | 315 | text: model.text | ||
316 | onClicked: notificationItem.action(model.id) | 316 | onClicked: notificationItem.action(model.id) | ||
317 | } | 317 | } | ||
318 | } | 318 | } | ||
319 | } | 319 | } | ||
320 | } | 320 | } | ||
321 | 321 | | |||
Show All 9 Lines |
you should still make sure it's an integer number