/usr/lib/kde4/imports/org/kde/akonadi/CollectionDelegate.qml is in kdepim-runtime 4:4.14.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
This library 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 of the License, or (at your
option) any later version.
This library 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 library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
import org.kde 4.5
import org.kde.akonadi 4.5
Item {
id: wrapper
clip: true
property bool fullClickArea : false
property bool showChildIndicator : false
property bool selectedDelegate : false
property bool topItem : false
property bool showUnread : false
property bool showCheckbox : false
property bool checkable : false
property bool uncheckable : false
property bool alternatingRowColors : false
property int indentation : 0
property real dragCheckThreshold : 0.5
property alias dragParent : dragTarget.parent
property variant checkModel
signal indexSelected(int row)
x : indentation
width : ListView.view.width - indentation
Rectangle {
// This is the same as anchors.fill : parent, but ParentAnimation only works
// if positional layouting is used instead of anchor layouting.
x : 0
y : 0
width : wrapper.width
height : wrapper.height
id : nestedItem
color : ( alternatingRowColors && model.index % 2 == 0 ) ? "#33ffffff" : "#00000000"
Behavior on x {
id : dragFinishedBehavior
SequentialAnimation {
NumberAnimation {
easing.type: "OutQuad"
easing.amplitude: 100
duration: 800
}
ScriptAction {
script : {
nestedItem.parent = wrapper
nestedItem.y = 0
dragFinishedBehavior.enabled = false
nestedItem.x = 0
dragFinishedBehavior.enabled = true
}
}
}
}
MouseArea {
anchors.fill: parent
onClicked: {
if ( fullClickArea )
{
if (topItem)
{
indexSelected(model.index);
return;
}
if (showChildIndicator)
{
nestedItem.state = "before_select_child";
} else if (!selectedDelegate)
nestedItem.state = "before_select_breadcrumb";
indexSelected(model.index);
}
}
drag.target : (checkable || uncheckable) ? nestedItem : undefined
drag.axis : Drag.XAxis
drag.minimumX : uncheckable ? -nestedItem.width : wrapper.indentation
drag.maximumX : checkable ? nestedItem.width : wrapper.indentation
drag.onActiveChanged : {
if (!drag.active) {
if ((checkable && nestedItem.x > nestedItem.width * dragCheckThreshold)
|| (uncheckable && nestedItem.x < nestedItem.width * dragCheckThreshold))
{
// 8 is QItemSelectionModel::Toggle
checkModel.select(model.index, 8);
}
nestedItem.x = wrapper.indentation
} else {
var point = mapToItem(dragParent, nestedItem.x, nestedItem.y)
nestedItem.y = point.y
dragFinishedBehavior.enabled = false;
nestedItem.x = point.x + wrapper.indentation
dragFinishedBehavior.enabled = true;
nestedItem.parent = dragParent
// Using the state directly does not seem to work.
// nestedItem.state = "dragging"
}
}
}
Row {
id: topLayout
x: 10; y: 10;
height: 48
width: parent.width
spacing: 10
Image {
id : checkbox
y : -10
source : "check.png"
visible : wrapper.showCheckbox && model.checkOn;
}
//Image {
// id: collectionIcon
// http://lists.trolltech.com/pipermail/qt-qml/2010-July/000668.html
// pixmap: KDE.iconToPixmap( model.decoration, height );
// width: 48; height: 48
// }
Column {
height : parent.height
Text {
width: wrapper.width - 48 - 50
text : model.display
color: (model.foreground != undefined ? model.foreground : "black")
//### requires a newer QML version
//wrapMode: "WrapAnywhere" // Needs the anchors.fill to work properly
}
Text {
text : wrapper.showUnread && model.unreadCount > 0 ? KDE.i18n( "Unread: %1", model.unreadCount ) : ""
color: "#0C55BB"
font.pixelSize: 16
}
Rectangle {
id: progressBar
color: "black"
width: parent.width
height: 7
visible: (model.collectionSyncProgress != undefined && model.collectionSyncProgress != 0 && model.collectionSyncProgress != 100)
Rectangle {
color: "lightsteelblue"
x: 1
y: 1
height: 5
width: ((parent.width * (model.collectionSyncProgress == 100 ? 0 : model.collectionSyncProgress)) / 100)
}
}
}
}
Image {
width : height
anchors.right : nestedItem.right
anchors.rightMargin : 5
anchors.verticalCenter : nestedItem.verticalCenter
opacity : ( showChildIndicator && breadcrumbComponentFactory.childCollectionHasChildren( model.index ) ) ? 1 : 0
source: "transparentplus.png"
}
states : [
State {
name : "dragging"
ParentChange { id : dragTarget; target : nestedItem }
},
State {
name : "before_select_child"
ParentChange { target : nestedItem; parent : selectedItemPlaceHolder; }
PropertyChanges { target : nestedItem; x : indentation; y : 0 }
},
State {
name : "before_select_breadcrumb"
ParentChange { target : nestedItem; parent : selectedItemPlaceHolder; }
PropertyChanges { target : nestedItem; x : indentation; y : 0 }
}
]
transitions : [
Transition {
ParentAnimation {
target : nestedItem
NumberAnimation {
properties: "x,y";
duration : 500
easing.type: Easing.OutQuad;
}
}
}
]
}
}
|