Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/FullRepresentation.qml
Show All 12 Lines | |||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/> | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/> | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.8 | 21 | import QtQuick 2.10 | ||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | 23 | | |||
24 | import org.kde.plasma.plasmoid 2.0 | 24 | import org.kde.plasma.plasmoid 2.0 | ||
25 | import org.kde.plasma.core 2.0 as PlasmaCore | 25 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
26 | import org.kde.plasma.components 2.0 as PlasmaComponents | 26 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
27 | import org.kde.plasma.components 3.0 as PlasmaComponents3 | 27 | import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||
28 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 28 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
29 | import org.kde.kirigami 2.11 as Kirigami | ||||
29 | 30 | | |||
30 | import org.kde.kcoreaddons 1.0 as KCoreAddons | 31 | import org.kde.kcoreaddons 1.0 as KCoreAddons | ||
31 | 32 | | |||
32 | import org.kde.notificationmanager 1.0 as NotificationManager | 33 | import org.kde.notificationmanager 1.0 as NotificationManager | ||
33 | 34 | | |||
34 | import "global" | 35 | import "global" | ||
35 | 36 | | |||
36 | ColumnLayout{ | 37 | ColumnLayout{ | ||
Show All 24 Lines | 61 | if (plasmoid.expanded) { | |||
61 | list.positionViewAtBeginning(); | 62 | list.positionViewAtBeginning(); | ||
62 | list.currentIndex = -1; | 63 | list.currentIndex = -1; | ||
63 | } | 64 | } | ||
64 | } | 65 | } | ||
65 | } | 66 | } | ||
66 | 67 | | |||
67 | // header | 68 | // header | ||
68 | ColumnLayout { | 69 | ColumnLayout { | ||
70 | id: header | ||||
71 | visible: !Kirigami.Settings.isMobile | ||||
69 | Layout.fillWidth: true | 72 | Layout.fillWidth: true | ||
70 | spacing: 0 | 73 | spacing: 0 | ||
71 | 74 | | |||
72 | RowLayout { | 75 | RowLayout { | ||
73 | Layout.fillWidth: true | 76 | Layout.fillWidth: true | ||
74 | spacing: 0 | 77 | spacing: 0 | ||
75 | 78 | | |||
76 | RowLayout { | 79 | RowLayout { | ||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Line(s) | 223 | text: { | |||
257 | 260 | | |||
258 | return sections.join(" · "); | 261 | return sections.join(" · "); | ||
259 | } | 262 | } | ||
260 | visible: text !== "" | 263 | visible: text !== "" | ||
261 | } | 264 | } | ||
262 | } | 265 | } | ||
263 | 266 | | |||
264 | PlasmaCore.SvgItem { | 267 | PlasmaCore.SvgItem { | ||
268 | visible: header.visible | ||||
265 | elementId: "horizontal-line" | 269 | elementId: "horizontal-line" | ||
266 | Layout.fillWidth: true | 270 | Layout.fillWidth: true | ||
267 | // why is this needed here but not in the delegate? | 271 | // why is this needed here but not in the delegate? | ||
268 | Layout.preferredHeight: naturalSize.height | 272 | Layout.preferredHeight: naturalSize.height | ||
269 | svg: PlasmaCore.Svg { | 273 | svg: PlasmaCore.Svg { | ||
270 | id: lineSvg | 274 | id: lineSvg | ||
271 | imagePath: "widgets/line" | 275 | imagePath: "widgets/line" | ||
272 | } | 276 | } | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 364 | SequentialAnimation { | |||
366 | } | 370 | } | ||
367 | } | 371 | } | ||
368 | } | 372 | } | ||
369 | addDisplaced: Transition { | 373 | addDisplaced: Transition { | ||
370 | NumberAnimation { properties: "y"; duration: units.longDuration } | 374 | NumberAnimation { properties: "y"; duration: units.longDuration } | ||
371 | } | 375 | } | ||
372 | 376 | | |||
373 | remove: Transition { | 377 | remove: Transition { | ||
378 | id: removeTransition | ||||
374 | ParallelAnimation { | 379 | ParallelAnimation { | ||
375 | NumberAnimation { property: "opacity"; to: 0; duration: units.longDuration } | 380 | NumberAnimation { property: "opacity"; to: 0; duration: units.longDuration } | ||
376 | NumberAnimation { property: "x"; to: list.width; duration: units.longDuration } | 381 | NumberAnimation { | ||
382 | property: "x" | ||||
383 | to: removeTransition.ViewTransition.item.x >= 0 ? list.width : -list.width | ||||
384 | duration: units.longDuration | ||||
385 | } | ||||
377 | } | 386 | } | ||
378 | } | 387 | } | ||
379 | removeDisplaced: Transition { | 388 | removeDisplaced: Transition { | ||
380 | SequentialAnimation { | 389 | SequentialAnimation { | ||
381 | PauseAnimation { duration: units.longDuration } | 390 | PauseAnimation { duration: units.longDuration } | ||
382 | NumberAnimation { properties: "y"; duration: units.longDuration } | 391 | NumberAnimation { properties: "y"; duration: units.longDuration } | ||
383 | } | 392 | } | ||
384 | } | 393 | } | ||
385 | 394 | | |||
386 | // This is so the delegates can detect the change in "isInGroup" and show a separator | 395 | // This is so the delegates can detect the change in "isInGroup" and show a separator | ||
387 | section { | 396 | section { | ||
388 | property: "isInGroup" | 397 | property: "isInGroup" | ||
389 | criteria: ViewSection.FullString | 398 | criteria: ViewSection.FullString | ||
390 | } | 399 | } | ||
391 | 400 | | |||
392 | delegate: Loader { | 401 | delegate: DraggableDelegate { | ||
402 | width: list.width | ||||
403 | contentItem: delegateLoader | ||||
404 | | ||||
405 | draggable: !model.isGroup && model.type != NotificationManager.Notifications.JobType | ||||
406 | | ||||
407 | onDismissRequested: historyModel.close(historyModel.index(index, 0)); | ||||
408 | | ||||
409 | Loader { | ||||
393 | id: delegateLoader | 410 | id: delegateLoader | ||
394 | width: list.width | 411 | width: list.width | ||
395 | sourceComponent: model.isGroup ? groupDelegate : notificationDelegate | 412 | sourceComponent: model.isGroup ? groupDelegate : notificationDelegate | ||
396 | 413 | | |||
397 | Component { | 414 | Component { | ||
398 | id: groupDelegate | 415 | id: groupDelegate | ||
399 | NotificationHeader { | 416 | NotificationHeader { | ||
400 | applicationName: model.applicationName | 417 | applicationName: model.applicationName | ||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | 564 | PlasmaCore.SvgItem { | |||
552 | 569 | | |||
553 | // property is only atached to the delegate itself (the Loader in our case) | 570 | // property is only atached to the delegate itself (the Loader in our case) | ||
554 | visible: (!model.isInGroup || delegateLoader.ListView.nextSection !== delegateLoader.ListView.section) | 571 | visible: (!model.isInGroup || delegateLoader.ListView.nextSection !== delegateLoader.ListView.section) | ||
555 | && delegateLoader.ListView.nextSection !== "" // don't show after last item | 572 | && delegateLoader.ListView.nextSection !== "" // don't show after last item | ||
556 | } | 573 | } | ||
557 | } | 574 | } | ||
558 | } | 575 | } | ||
559 | } | 576 | } | ||
577 | } | ||||
560 | 578 | | |||
561 | PlasmaExtras.Heading { | 579 | PlasmaExtras.Heading { | ||
562 | width: list.width | 580 | width: list.width | ||
563 | level: 3 | 581 | level: 3 | ||
564 | opacity: 0.6 | 582 | opacity: 0.6 | ||
565 | text: i18n("No unread notifications.") | 583 | text: i18n("No unread notifications.") | ||
566 | visible: list.count === 0 | 584 | visible: list.count === 0 | ||
567 | } | 585 | } | ||
568 | } | 586 | } | ||
569 | } | 587 | } | ||
570 | } | 588 | } |