removal of notifications

This commit is contained in:
Aaron Seigo 2014-09-29 19:15:21 +02:00
parent e84aaa3e00
commit 60825add90
2 changed files with 52 additions and 8 deletions

View file

@ -1,3 +1,22 @@
/*
* 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.0
import org.kde.plasma.core 2.0 as PlasmaCore
@ -15,13 +34,32 @@ Rectangle {
}
property color textGradientOverlay: "#9900000C"
Behavior on x {
SpringAnimation { spring: 2; damping: 0.2 }
}
MouseArea {
anchors.fill: root
drag.axis: Drag.XAxis
drag.target: root
onReleased: {
if (drag.active) {
if (parent.x > width / 4 || parent.x < width / -4) {
notificationsModel.remove(index);
} else {
parent.x = 0;
}
}
}
}
PlasmaCore.IconItem {
id: icon
width: units.iconSizes.medium
height: width
x: units.largeSpacing
y: 0
source: "im-user"
source: appIcon && appIcon.length > 0 ? appIcon : "im-user"
}
Item {
@ -57,7 +95,6 @@ Rectangle {
id: summaryArea
width: parent.width - icon.width - rounded.width - (units.largeSpacing * 2)
height: parent.height
anchors {
left: rounded.right
top: parent.top
@ -76,11 +113,5 @@ Rectangle {
color: "white"
text: summary
}
/*
MouseArea {
anchors.fill: parent
drag.axis: Drag.YAxis
drag.target: parent
}*/
}
}

View file

@ -138,6 +138,19 @@ Item {
ListModel {
id: notificationsModel
ListElement {
appIcon: "call-start"
summary: "Missed call from Joe"
}
ListElement {
appIcon: "im-google"
summary: "July: Hey! Are you around?"
}
ListElement {
appIcon: "im-google"
summary: "July: Hello?"
}
}
ListView {