mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Remove old notification applet
This commit is contained in:
parent
d206d498c0
commit
9d14c6da15
5 changed files with 0 additions and 475 deletions
|
|
@ -1,3 +1,2 @@
|
|||
plasma_install_package(activities org.kde.phone.activities)
|
||||
plasma_install_package(clock org.kde.phone.clock)
|
||||
plasma_install_package(notifications org.kde.phone.notifications)
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
#! /usr/bin/env bash
|
||||
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
|
||||
$XGETTEXT `find . -name \*.qml` -L Java -o $podir/plasma_applet_org.kde.phone.notifications.pot
|
||||
$XGETTEXT rc.cpp -jo $podir/plasma_applet_org.kde.phone.notifications.pot
|
||||
rm -f rc.cpp
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
MouseArea {
|
||||
id: notificationItem
|
||||
|
||||
|
||||
//actionsLayout.height*2 because the text is centered
|
||||
//TODO: center the whole block not only the text
|
||||
height: Math.max(units.gridUnit * 3, Math.max(messageLayout.height, icon.height)) + (expanded ? actionsLayout.height*2 : 0)
|
||||
width: parent.width
|
||||
anchors.bottomMargin: 10
|
||||
drag.axis: Drag.XAxis
|
||||
drag.target: notificationItem
|
||||
|
||||
property bool expanded: false
|
||||
property string source: model.source
|
||||
property var actions: model.actions
|
||||
|
||||
opacity: 1 - Math.abs(x) / (width/2)
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: units.longDuration
|
||||
}
|
||||
}
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: units.longDuration
|
||||
}
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
if (drag.active) {
|
||||
if (x > width / 4 || x < width / -4) {
|
||||
//if there is an action, execute the first when swiping left
|
||||
if (x < 0 && actions) {
|
||||
var action = actions.get(0);
|
||||
if (action) {
|
||||
root.executeAction(source, action.id)
|
||||
}
|
||||
}
|
||||
notificationsModel.remove(index);
|
||||
} else {
|
||||
x = 0;
|
||||
}
|
||||
} else if (body || actions) {
|
||||
expanded = !expanded;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, notificationItem.pressed ? 0.5 : 0.2)
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: closeButton
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
rightMargin: units.gridUnit
|
||||
}
|
||||
iconSource: "window-close"
|
||||
flat: false
|
||||
onClicked: {
|
||||
notificationsModel.remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: messageLayout
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: icon.right
|
||||
right: notificationItem.expanded ? actionsLayout.left : closeButton.left
|
||||
leftMargin: units.gridUnit
|
||||
rightMargin: units.gridUnit
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: summaryLabel
|
||||
Layout.fillWidth: true
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
text: model.appName + " " + summary
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: bodyLabel
|
||||
Layout.fillWidth: true
|
||||
visible: text.length > 0
|
||||
opacity: 0.8
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
text: body
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
x: units.gridUnit
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
source: appIcon && appIcon.length > 0 ? appIcon : "preferences-desktop-notification"
|
||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||
}
|
||||
|
||||
Column {
|
||||
id: actionsLayout
|
||||
anchors {
|
||||
right: closeButton.left
|
||||
rightMargin: units.gridUnit
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
opacity: notificationItem.expanded && notificationItem.actions && notificationItem.actions.count > 0 ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: units.shortDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
model: notificationItem.actions
|
||||
delegate: PlasmaComponents.Button {
|
||||
text: model.text
|
||||
onClicked: {
|
||||
root.executeAction(notificationItem.source, model.id)
|
||||
notificationsModel.remove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property int notificationId: 0
|
||||
|
||||
Layout.maximumHeight: notificationView.contentHeight + units.gridUnit
|
||||
//todo: size of first item
|
||||
Layout.minimumHeight: units.gridUnit * 4
|
||||
property var pendingRemovals: [];
|
||||
|
||||
Plasmoid.switchWidth: 500
|
||||
Plasmoid.switchHeight: 500
|
||||
Plasmoid.status: notificationsModel.count > 0
|
||||
? PlasmaCore.Types.ActiveStatus
|
||||
: PlasmaCore.Types.PassiveStatus
|
||||
|
||||
function addNotification(source, data, actions) {
|
||||
// Do not show duplicated notifications
|
||||
// Remove notifications that are sent again (odd, but true)
|
||||
for (var i = 0; i < notificationsModel.count; ++i) {
|
||||
var tmp = notificationsModel.get(i);
|
||||
var matches = (tmp.appName == data.appName &&
|
||||
tmp.summary == data.summary &&
|
||||
tmp.body == data.body);
|
||||
var sameSource = tmp.source == source;
|
||||
|
||||
if (sameSource && matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sameSource || matches) {
|
||||
notificationsModel.remove(i)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data["id"] = ++notificationId;
|
||||
data["source"] = source;
|
||||
if (data["summary"].length < 1) {
|
||||
data["summary"] = data["body"];
|
||||
data["body"] = '';
|
||||
}
|
||||
data["actions"] = actions;
|
||||
|
||||
notificationsModel.insert(0, data);
|
||||
if (!data["isPersistent"]) {
|
||||
pendingRemovals.push(notificationId);
|
||||
pendingTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
function executeAction(source, id) {
|
||||
//try to use the service
|
||||
if (source.indexOf("notification") !== -1) {
|
||||
var service = notificationsSource.serviceForSource(source)
|
||||
var op = service.operationDescription("invokeAction")
|
||||
op["actionId"] = id
|
||||
|
||||
service.startOperationCall(op)
|
||||
//try to open the id as url
|
||||
} else if (source.indexOf("Job") !== -1) {
|
||||
Qt.openUrlExternally(id)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: notificationsSource
|
||||
|
||||
engine: "notifications"
|
||||
interval: 0
|
||||
|
||||
onSourceAdded: {
|
||||
connectSource(source);
|
||||
}
|
||||
|
||||
onSourceRemoved: {
|
||||
for (var i = 0; i < notificationsModel.count; ++i) {
|
||||
if (notificationsModel.get(i) == source) {
|
||||
notificationsModel.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onNewData: {
|
||||
var actions = new Array()
|
||||
if (data["actions"] && data["actions"].length % 2 == 0) {
|
||||
for (var i = 0; i < data["actions"].length; i += 2) {
|
||||
var action = new Object();
|
||||
action["id"] = data["actions"][i];
|
||||
action["text"] = data["actions"][i+1];
|
||||
actions.push(action);
|
||||
}
|
||||
}
|
||||
|
||||
root.addNotification(
|
||||
sourceName,
|
||||
data,
|
||||
actions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
anchors.centerIn: parent
|
||||
opacity: 0.4
|
||||
visible: notificationsModel.count == 0
|
||||
text: i18n("No recent notifications")
|
||||
}
|
||||
|
||||
Plasmoid.compactRepresentation: PlasmaCore.SvgItem {
|
||||
id: notificationSvgItem
|
||||
anchors.centerIn: parent
|
||||
width: units.roundToIconSize(Math.min(parent.width, parent.height))
|
||||
height: width
|
||||
|
||||
svg: PlasmaCore.Svg {
|
||||
imagePath: "icons/notification"
|
||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||
}
|
||||
|
||||
elementId: {
|
||||
if (notificationsModel.count > 0) {
|
||||
return "notification-empty"
|
||||
}
|
||||
return "notification-disabled"
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
visible: notificationsModel.count > 0
|
||||
text: notificationsModel.count
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: notificationsModel
|
||||
/* ListElement {
|
||||
source: "call1Source"
|
||||
appIcon: "call-start"
|
||||
summary: "Missed call from Joe"
|
||||
appName: "Phone"
|
||||
body: "Called at 8:42 from +41 56 373 37 31"
|
||||
actions: []
|
||||
}
|
||||
ListElement {
|
||||
source: "im1Source"
|
||||
appIcon: "im-google"
|
||||
appName: "Message"
|
||||
summary: "July: Hey! Are you around?"
|
||||
actions: []
|
||||
}
|
||||
ListElement {
|
||||
source: "im2Source"
|
||||
appIcon: "im-google"
|
||||
appName: "Message"
|
||||
summary: "July: Hello?"
|
||||
actions: []
|
||||
}*/
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: notificationView
|
||||
spacing: units.largeSpacing
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: units.largeSpacing
|
||||
rightMargin: units.largeSpacing
|
||||
}
|
||||
interactive: false
|
||||
cacheBuffer: 200000
|
||||
|
||||
z: 1
|
||||
//verticalLayoutDirection: ListView.BottomToTop
|
||||
model: notificationsModel
|
||||
|
||||
add: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
from: notificationView.width
|
||||
duration: units.shortDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
to: notificationView.width
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
NumberAnimation {
|
||||
properties: "opacity"
|
||||
to: 0
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
removeDisplaced: Transition {
|
||||
SequentialAnimation {
|
||||
PauseAnimation {
|
||||
duration: units.longDuration
|
||||
}
|
||||
NumberAnimation {
|
||||
properties: "x,y"
|
||||
duration: units.shortDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate: NotificationStripe {}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Notifications
|
||||
Name[ca]=Notificacions
|
||||
Name[ca@valencia]=Notificacions
|
||||
Name[cs]=Oznamování
|
||||
Name[de]=Benachrichtigungen
|
||||
Name[en_GB]=Notifications
|
||||
Name[es]=Notificaciones
|
||||
Name[fi]=Ilmoitukset
|
||||
Name[fr]=Notifications
|
||||
Name[gl]=Notificacións
|
||||
Name[it]=Notifiche
|
||||
Name[ko]=알림
|
||||
Name[nl]=Meldingen
|
||||
Name[nn]=Varslingar
|
||||
Name[pl]=Powiadomienia
|
||||
Name[pt]=Notificações
|
||||
Name[sv]=Underrättelser
|
||||
Name[tr]=Bildirimler
|
||||
Name[uk]=Сповіщення
|
||||
Name[x-test]=xxNotificationsxx
|
||||
Name[zh_CN]=通知
|
||||
Name[zh_TW]=通知
|
||||
Comment=Display notifications and jobs
|
||||
Comment[ca]=Mostra les notificacions i els treballs
|
||||
Comment[ca@valencia]=Mostra les notificacions i els treballs
|
||||
Comment[cs]=Oznámení a úlohy
|
||||
Comment[de]=Benachrichtigungen und Aktionen anzeigen
|
||||
Comment[en_GB]=Display notifications and jobs
|
||||
Comment[es]=Mostrar notificaciones y tareas
|
||||
Comment[fi]=Näytä ilmoitukset ja työt
|
||||
Comment[fr]=Affiche les notifications et les tâches
|
||||
Comment[gl]=Mostra notificacións e tarefas
|
||||
Comment[it]=Visualizza le notifiche ed i lavori
|
||||
Comment[ko]=알림과 작업 표시
|
||||
Comment[nl]=Meldingen en taken tonen
|
||||
Comment[nn]=Vis varslingar og jobbar
|
||||
Comment[pl]=Wyświetla powiadomienia i zadania
|
||||
Comment[pt]=Mostrar as notificações e tarefas
|
||||
Comment[sv]=Visa underrättelser och jobb
|
||||
Comment[tr]=Bildirimleri ve işleri görüntüle
|
||||
Comment[uk]=Показ сповіщень і завдань
|
||||
Comment[x-test]=xxDisplay notifications and jobsxx
|
||||
Comment[zh_CN]=显示通知和任务
|
||||
Comment[zh_TW]=顯示通知與工作
|
||||
|
||||
Type=Service
|
||||
Icon=preferences-desktop-notification
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Marco Martin
|
||||
X-KDE-PluginInfo-Category=Tasks
|
||||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-Name=org.kde.phone.notifications
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-Provides=org.kde.plasma.notifications
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-NotificationArea=true
|
||||
Loading…
Reference in a new issue