/usr/share/plasma/shells/org.kde.plasma.mediacenter/contents/explorer/WidgetExplorer.qml is in plasma-mediacenter 5.7.3-1.
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 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /*
* Copyright 2011 Marco Martin <mart@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 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.components 2.0 as PlasmaComponents
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import org.kde.plasma.private.shell 2.0
Item {
id: main
width: minimumWidth
height: 800//Screen.height
// The +4 is for the gap and cross button
property int minimumWidth: theme.mSize(heading.font).width * (heading.text.length + 6)
property int minimumHeight: 800//width will be set by the dialog anyway
property alias containment: widgetExplorer.containment
//external drop events can cause a raise event causing us to lose focus and
//therefore get deleted whilst we are still in a drag exec()
//this is a clue to the owning dialog that hideOnWindowDeactivate should be deleted
//See https://bugs.kde.org/show_bug.cgi?id=332733
property bool preventWindowHide: false
property Item getWidgetsButton
property Item categoryButton
signal closed()
WidgetExplorer {
id: widgetExplorer
//view: desktop
onShouldClose: main.closed();
}
PlasmaComponents.ModelContextMenu {
id: categoriesDialog
visualParent: main.categoryButton
model: widgetExplorer.filterModel
onClicked: {
list.contentX = 0
list.contentY = 0
main.categoryButton.text = model.display
widgetExplorer.widgetsModel.filterQuery = model.filterData
widgetExplorer.widgetsModel.filterType = model.filterType
}
onStatusChanged: {
if (status == PlasmaComponents.DialogStatus.Opening) {
main.preventWindowHide = true;
} else if (status == PlasmaComponents.DialogStatus.Closed) {
main.preventWindowHide = false;
}
}
}
PlasmaComponents.ModelContextMenu {
id: getWidgetsDialog
visualParent: main.getWidgetsButton
model: widgetExplorer.widgetsMenuActions
onClicked: model.trigger()
onStatusChanged: {
if (status == PlasmaComponents.DialogStatus.Opening) {
main.preventWindowHide = true;
} else if (status == PlasmaComponents.DialogStatus.Closed) {
main.preventWindowHide = false;
}
}
}
/*
PlasmaCore.Dialog {
id: tooltipDialog
property Item appletDelegate
location: PlasmaCore.Types.RightEdge //actually we want this to be the opposite location of the explorer itself
type: PlasmaCore.Dialog.Tooltip
flags:Qt.Window|Qt.WindowStaysOnTopHint|Qt.X11BypassWindowManagerHint
onAppletDelegateChanged: {
if (!appletDelegate) {
toolTipHideTimer.restart()
toolTipShowTimer.running = false
} else if (tooltipDialog.visible) {
tooltipDialog.visualParent = appletDelegate
} else {
tooltipDialog.visualParent = appletDelegate
toolTipShowTimer.restart()
toolTipHideTimer.running = false
}
}
mainItem: Tooltip { id: tooltipWidget }
Behavior on y {
NumberAnimation { duration: units.longDuration }
}
}
Timer {
id: toolTipShowTimer
interval: 500
repeat: false
onTriggered: {
tooltipDialog.visible = true
}
}
Timer {
id: toolTipHideTimer
interval: 1000
repeat: false
onTriggered: tooltipDialog.visible = false
}
*/
GridLayout {
id: topBar
anchors {
top: parent.top
left: parent.left
right: parent.right
topMargin: 0
leftMargin: units.smallSpacing
rightMargin: units.smallSpacing
}
columns: 2
PlasmaExtras.Title {
id: heading
text: i18nd("plasma_shell_org.kde.plasma.mediacenter", "Widgets")
elide: Text.ElideRight
Layout.fillWidth: true
}
PlasmaComponents.ToolButton {
id: closeButton
anchors {
right: parent.right
verticalCenter: heading.verticalCenter
}
iconSource: "window-close"
onClicked: main.closed()
}
PlasmaComponents.TextField {
clearButtonShown: true
placeholderText: i18nd("plasma_shell_org.kde.plasma.mediacenter", "Search...")
onTextChanged: {
list.contentX = 0
list.contentY = 0
widgetExplorer.widgetsModel.searchTerm = text
}
Component.onCompleted: forceActiveFocus()
Layout.columnSpan: 2
Layout.fillWidth: true
}
PlasmaComponents.Button {
id: categoryButton
text: i18nd("plasma_shell_org.kde.plasma.mediacenter", "Categories")
onClicked: {
main.preventWindowHide = true;
categoriesDialog.open(0, categoryButton.height)
}
Layout.columnSpan: 2
Layout.fillWidth: true
}
}
PlasmaCore.FrameSvgItem {
id: backgroundHint
imagePath: "widgets/viewitem"
prefix: "normal"
visible: false
}
PlasmaExtras.ScrollArea {
anchors {
top: topBar.bottom
left: parent.left
right: parent.right
bottom: bottomBar.top
topMargin: units.smallSpacing
leftMargin: units.smallSpacing
bottomMargin: units.smallSpacing
}
ListView {
id: list
property int delegateWidth: list.width
property int delegateHeight: units.iconSizes.huge + backgroundHint.margins.top + backgroundHint.margins.bottom
snapMode: ListView.SnapToItem
model: widgetExplorer.widgetsModel
clip: true //TODO work out why this is this needed
cacheBuffer: delegateHeight * 5 // keep 5 delegates either side
delegate: AppletDelegate {}
//slide in to view from the left
add: Transition {
NumberAnimation {
properties: "x"
from: -list.width
to: 0
duration: units.shortDuration * 3
}
}
//slide out of view to the right
remove: Transition {
NumberAnimation {
properties: "x"
to: list.width
duration: units.shortDuration * 3
}
}
//if we are adding other items into the view use the same animation as normal adding
//this makes everything slide in together
//if we make it move everything ends up weird
addDisplaced: list.add
//moved due to filtering
displaced: Transition {
NumberAnimation {
properties: "y"
duration: units.shortDuration * 3
}
}
}
}
Column {
id: bottomBar
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
leftMargin: units.smallSpacing
rightMargin: units.smallSpacing
bottomMargin: units.smallSpacing
}
spacing: units.smallSpacing
PlasmaComponents.Button {
anchors {
left: parent.left
right: parent.right
}
id: getWidgetsButton
iconSource: "get-hot-new-stuff"
text: i18nd("plasma_shell_org.kde.plasma.mediacenter", "Get new widgets")
onClicked: {
main.preventWindowHide = true;
getWidgetsDialog.open()
}
}
Repeater {
model: widgetExplorer.extraActions.length
PlasmaComponents.Button {
anchors {
left: parent.left
right: parent.right
}
iconSource: widgetExplorer.extraActions[modelData].icon
text: widgetExplorer.extraActions[modelData].text
onClicked: {
widgetExplorer.extraActions[modelData].trigger()
}
}
}
}
Component.onCompleted: {
main.getWidgetsButton = getWidgetsButton
main.categoryButton = categoryButton
}
}
|