mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 06:33:09 +00:00
different container for notifiactions
with different visibility rules
This commit is contained in:
parent
03f57b0345
commit
e14c8aeba3
3 changed files with 111 additions and 37 deletions
60
containments/panel/package/contents/ui/FullContainer.qml
Normal file
60
containments/panel/package/contents/ui/FullContainer.qml
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 Marco Martin <mart@kde.org>
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 Marco Martin <mart@kde.org>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
* 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 QtQuick.Layouts 1.3
|
||||||
import QtQml.Models 2.12
|
import QtQml.Models 2.12
|
||||||
|
|
||||||
|
|
@ -60,14 +60,18 @@ PlasmaCore.ColorScope {
|
||||||
compactContainer.applet = applet;
|
compactContainer.applet = applet;
|
||||||
applet.anchors.fill = compactContainer;
|
applet.anchors.fill = compactContainer;
|
||||||
applet.visible = true;
|
applet.visible = true;
|
||||||
if (applet.pluginName == "org.kde.phone.notifications") {
|
|
||||||
|
|
||||||
}
|
|
||||||
//FIXME: make a way to instantiate fullRepresentationItem without the open/close dance
|
//FIXME: make a way to instantiate fullRepresentationItem without the open/close dance
|
||||||
applet.expanded = true
|
applet.expanded = true
|
||||||
applet.expanded = false
|
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;
|
applet.fullRepresentationItem.parent = fullContainer;
|
||||||
fullContainer.applet = applet;
|
fullContainer.applet = applet;
|
||||||
fullContainer.contentItem = applet.fullRepresentationItem;
|
fullContainer.contentItem = applet.fullRepresentationItem;
|
||||||
|
|
@ -122,39 +126,13 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: fullContainerComponent
|
id: fullContainerComponent
|
||||||
DrawerBackground {
|
FullContainer {
|
||||||
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();
|
|
||||||
|
|
||||||
fullRepresentationView.currentIndex = ObjectModel.index;
|
Component {
|
||||||
fullRepresentationView.positionViewAtIndex(ObjectModel.index, ListView.SnapPosition)
|
id: fullNotificationsContainerComponent
|
||||||
} else if (ObjectModel.index >= 0) {
|
FullNotificationsContainer {
|
||||||
fullRepresentationModel.remove(ObjectModel.index);
|
|
||||||
fullRepresentationView.forceLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Connections {
|
|
||||||
target: fullContainer.applet
|
|
||||||
onActivated: {
|
|
||||||
if (!visible) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fullRepresentationView.currentIndex = ObjectModel.index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,6 +264,7 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: fullRepresentationView
|
id: fullRepresentationView
|
||||||
|
z: 4
|
||||||
parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents
|
parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue