diff --git a/containments/panel/package/contents/ui/FullContainer.qml b/containments/panel/package/contents/ui/FullContainer.qml new file mode 100644 index 00000000..d2bf418d --- /dev/null +++ b/containments/panel/package/contents/ui/FullContainer.qml @@ -0,0 +1,60 @@ +/* + * Copyright 2019 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +import QtQuick 2.12 +import QtQuick.Layouts 1.3 +import QtQml.Models 2.12 + +import org.kde.plasma.core 2.0 as PlasmaCore + +DrawerBackground { + id: fullContainer + property Item applet + property ObjectModel fullRepresentationModel + property ListView fullRepresentationView + visible: applet && (applet.status != PlasmaCore.Types.HiddenStatus && applet.status != PlasmaCore.Types.PassiveStatus) + height: parent.height + width: visible ? quickSettingsParent.width : 0 + Layout.minimumHeight: applet && applet.switchHeight + onVisibleChanged: {print("OOOOOOO"+fullRepresentationModel+fullRepresentationView) + if (visible) { + for (var i = 0; i < fullRepresentationModel.count; ++i) { + if (fullRepresentationModel.get(i) === this) { + return; + } + } + fullRepresentationModel.append(this); + fullRepresentationView.forceLayout(); + + fullRepresentationView.currentIndex = ObjectModel.index; + fullRepresentationView.positionViewAtIndex(ObjectModel.index, ListView.SnapPosition) + } else if (ObjectModel.index >= 0) { + fullRepresentationModel.remove(ObjectModel.index); + fullRepresentationView.forceLayout(); + } + } + Connections { + target: fullContainer.applet + onActivated: { + if (!visible) { + return; + } + fullRepresentationView.currentIndex = ObjectModel.index; + } + } +} diff --git a/containments/panel/package/contents/ui/FullNotificationsContainer.qml b/containments/panel/package/contents/ui/FullNotificationsContainer.qml new file mode 100644 index 00000000..314e1c53 --- /dev/null +++ b/containments/panel/package/contents/ui/FullNotificationsContainer.qml @@ -0,0 +1,35 @@ +/* + * Copyright 2019 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +import QtQuick 2.12 +import QtQuick.Layouts 1.3 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.notificationmanager 1.0 as NotificationManager + +FullContainer { + id: fullContainer + + visible: applet && historyModel.count > 0 + + NotificationManager.Notifications { + id: historyModel + showExpired: true + showDismissed: true + } +} diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index 8d3b0fb2..377e6306 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ -import QtQuick 2.1 +import QtQuick 2.12 import QtQuick.Layouts 1.3 import QtQml.Models 2.12 @@ -60,14 +60,18 @@ PlasmaCore.ColorScope { compactContainer.applet = applet; applet.anchors.fill = compactContainer; applet.visible = true; - if (applet.pluginName == "org.kde.phone.notifications") { - - } + //FIXME: make a way to instantiate fullRepresentationItem without the open/close dance applet.expanded = true applet.expanded = false - var fullContainer = fullContainerComponent.createObject(fullRepresentationView.contentItem); + var fullContainer = null; + if (applet.pluginName == "org.kde.plasma.notifications") { + fullContainer = fullNotificationsContainerComponent.createObject(fullRepresentationView.contentItem, {"fullRepresentationModel": fullRepresentationModel, "fullRepresentationView": fullRepresentationView}); + } else { + fullContainer = fullContainerComponent.createObject(fullRepresentationView.contentItem, {"fullRepresentationModel": fullRepresentationModel, "fullRepresentationView": fullRepresentationView}); + } +print("SDSDSDS"+fullContainer); applet.fullRepresentationItem.parent = fullContainer; fullContainer.applet = applet; fullContainer.contentItem = applet.fullRepresentationItem; @@ -122,39 +126,13 @@ PlasmaCore.ColorScope { Component { id: fullContainerComponent - DrawerBackground { - id: fullContainer - property Item applet - visible: applet && (applet.status != PlasmaCore.Types.HiddenStatus && applet.status != PlasmaCore.Types.PassiveStatus) - height: parent.height - width: visible ? quickSettingsParent.width : 0 - Layout.minimumHeight: applet && applet.switchHeight - onVisibleChanged: { - if (visible) { - for (var i = 0; i < fullRepresentationModel.count; ++i) { - if (fullRepresentationModel.get(i) === this) { - return; - } - } - fullRepresentationModel.append(this); - fullRepresentationView.forceLayout(); + FullContainer { + } + } - fullRepresentationView.currentIndex = ObjectModel.index; - fullRepresentationView.positionViewAtIndex(ObjectModel.index, ListView.SnapPosition) - } else if (ObjectModel.index >= 0) { - fullRepresentationModel.remove(ObjectModel.index); - fullRepresentationView.forceLayout(); - } - } - Connections { - target: fullContainer.applet - onActivated: { - if (!visible) { - return; - } - fullRepresentationView.currentIndex = ObjectModel.index; - } - } + Component { + id: fullNotificationsContainerComponent + FullNotificationsContainer { } } @@ -286,6 +264,7 @@ PlasmaCore.ColorScope { ListView { id: fullRepresentationView + z: 4 parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents anchors { left: parent.left