/usr/share/plasma/shells/org.kde.plasma.plasmoidviewershell/contents/configuration/AppletConfiguration.qml is in plasma-sdk 5.8.6-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 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | /*
* Copyright 2013 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.0
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.configuration 2.0
import org.kde.kquickcontrolsaddons 2.0
//TODO: all of this will be done with desktop components
Rectangle {
id: root
Layout.minimumWidth: units.gridUnit * 30
Layout.minimumHeight: units.gridUnit * 20
//BEGIN properties
color: syspal.window
width: units.gridUnit * 40
height: units.gridUnit * 30
property bool isContainment: false
//END properties
//BEGIN model
property ConfigModel globalConfigModel: globalAppletConfigModel
ConfigModel {
id: globalAppletConfigModel
ConfigCategory {
name: i18nd("plasma_shell_org.kde.plasma.desktop", "Keyboard shortcuts")
icon: "preferences-desktop-keyboard"
source: "ConfigurationShortcuts.qml"
}
}
PlasmaCore.SortFilterModel {
id: configDialogFilterModel
sourceModel: configDialog.configModel
filterRole: "visible"
filterCallback: function(source_row, value) { return value; }
}
//END model
//BEGIN functions
function saveConfig() {
if (main.currentItem.saveConfig) {
main.currentItem.saveConfig()
}
for (var key in plasmoid.configuration) {
if (main.currentItem["cfg_"+key] !== undefined) {
plasmoid.configuration[key] = main.currentItem["cfg_"+key]
}
}
}
function restoreConfig() {
for (var key in plasmoid.configuration) {
if (main.currentItem["cfg_"+key] !== undefined) {
main.currentItem["cfg_"+key] = plasmoid.configuration[key]
}
}
}
function settingValueChanged() {
applyButton.enabled = true;
}
//END functions
//BEGIN connections
Component.onCompleted: {
if (!isContainment && configDialog.configModel && configDialog.configModel.count > 0) {
if (configDialog.configModel.get(0).source) {
main.sourceFile = configDialog.configModel.get(0).source
} else if (configDialog.configModel.get(0).kcm) {
main.sourceFile = Qt.resolvedUrl("ConfigurationKcmPage.qml");
main.currentItem.kcm = configDialog.configModel.get(0).kcm;
} else {
main.sourceFile = "";
}
main.title = configDialog.configModel.get(0).name
} else {
main.sourceFile = globalConfigModel.get(0).source
main.title = globalConfigModel.get(0).name
}
// root.width = mainColumn.implicitWidth
// root.height = mainColumn.implicitHeight
}
//END connections
//BEGIN UI components
SystemPalette {id: syspal}
MouseEventListener {
anchors.fill: parent
property int oldX
property int oldY
onPressed: {
oldX = mouse.screenX
oldY = mouse.screenY
}
onPositionChanged: {
configDialog.y += mouse.screenY - oldY
configDialog.x += mouse.screenX - oldX
oldX = mouse.screenX
oldY = mouse.screenY
}
}
MessageDialog {
id: messageDialog
icon: StandardIcon.Warning
property Item delegate
title: i18nd("plasma_shell_org.kde.plasma.desktop", "Apply Settings")
text: i18nd("plasma_shell_org.kde.plasma.desktop", "The settings of the current module have changed. Do you want to apply the changes or discard them?")
standardButtons: StandardButton.Apply | StandardButton.Discard | StandardButton.Cancel
onApply: {
applyAction.trigger()
delegate.openCategory()
}
onDiscard: {
delegate.openCategory()
}
}
ColumnLayout {
id: mainColumn
anchors {
fill: parent
margins: mainColumn.spacing //margins are hardcoded in QStyle we should match that here
}
property int implicitWidth: Math.max(contentRow.implicitWidth, buttonsRow.implicitWidth) + 8
property int implicitHeight: contentRow.implicitHeight + buttonsRow.implicitHeight + 8
RowLayout {
id: contentRow
anchors {
left: parent.left
right: parent.right
}
spacing: units.largeSpacing
Layout.fillHeight: true
Layout.preferredHeight: parent.height - buttonsRow.height
QtControls.ScrollView {
id: categoriesScroll
frameVisible: true
Layout.fillHeight: true
visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1
Layout.preferredWidth: units.gridUnit * 7
flickableItem.interactive: false
Rectangle {
width: categoriesScroll.viewport.width
height: Math.max(categoriesScroll.viewport.height, categories.height)
color: syspal.base
Column {
id: categories
width: parent.width
height: childrenRect.height
property Item currentItem: children[1]
Repeater {
model: root.isContainment ? globalConfigModel : undefined
delegate: ConfigCategoryDelegate {}
}
Repeater {
model: configDialogFilterModel
delegate: ConfigCategoryDelegate {}
}
Repeater {
model: !root.isContainment ? globalConfigModel : undefined
delegate: ConfigCategoryDelegate {}
}
}
}
}
QtControls.ScrollView {
id: scroll
Layout.fillHeight: true
Layout.fillWidth: true
Column {
spacing: units.largeSpacing / 2
QtControls.Label {
id: pageTitle
width: scroll.viewport.width
font.pointSize: theme.defaultFont.pointSize*2
font.weight: Font.Light
text: main.title
}
QtControls.StackView {
id: main
property string title: ""
property bool invertAnimations: false
height: Math.max((scroll.viewport.height - pageTitle.height - parent.spacing), (main.currentItem ? (main.currentItem.implicitHeight ? main.currentItem.implicitHeight : main.currentItem.childrenRect.height) : 0))
width: scroll.viewport.width
property string sourceFile
onSourceFileChanged: {
if (!sourceFile) {
return;
}
// print("Source file changed in flickable" + sourceFile);
replace(Qt.resolvedUrl(sourceFile));
root.restoreConfig()
for (var prop in currentItem) {
if (prop.indexOf("cfg_") === 0 && prop.indexOf("Changed") > 0 ) {
currentItem[prop].connect(root.settingValueChanged)
}
}
if (currentItem["configurationChanged"]) {
currentItem["configurationChanged"].connect(root.settingValueChanged)
}
applyButton.enabled = false;
scroll.flickableItem.contentY = 0
/*
* This is not needed on a desktop shell that has ok/apply/cancel buttons, i'll leave it here only for future reference until we have a prototype for the active shell.
* root.pageChanged will start a timer, that in turn will call saveConfig() when triggered
for (var prop in currentItem) {
if (prop.indexOf("cfg_") === 0) {
currentItem[prop+"Changed"].connect(root.pageChanged)
}
}*/
}
delegate: QtControls.StackViewDelegate {
function transitionFinished(properties)
{
properties.exitItem.opacity = 1
}
pushTransition: QtControls.StackViewTransition {
PropertyAnimation {
target: enterItem
property: "opacity"
from: 0
to: 1
duration: units.longDuration
easing.type: Easing.InOutQuad
}
PropertyAnimation {
target: enterItem
property: "x"
from: main.invertAnimations ? -target.width/3: target.width/3
to: 0
duration: units.longDuration
easing.type: Easing.InOutQuad
}
PropertyAnimation {
target: exitItem
property: "opacity"
from: 1
to: 0
duration: units.longDuration
easing.type: Easing.InOutQuad
}
PropertyAnimation {
target: exitItem
property: "x"
from: 0
to: main.invertAnimations ? target.width/3 : -target.width/3
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
}
}
}
}
}
QtControls.Action {
id: acceptAction
onTriggered: {
applyAction.trigger();
configDialog.close();
}
shortcut: "Return"
}
QtControls.Action {
id: applyAction
onTriggered: {
if (main.currentItem.saveConfig !== undefined) {
main.currentItem.saveConfig();
}
root.saveConfig();
applyButton.enabled = false;
}
}
QtControls.Action {
id: cancelAction
onTriggered: configDialog.close();
shortcut: "Escape"
}
RowLayout {
id: buttonsRow
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
QtControls.Button {
iconName: "dialog-ok"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "OK")
onClicked: acceptAction.trigger()
}
QtControls.Button {
id: applyButton
enabled: false
iconName: "dialog-ok-apply"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Apply")
onClicked: applyAction.trigger()
}
QtControls.Button {
iconName: "dialog-cancel"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Cancel")
onClicked: cancelAction.trigger()
}
}
}
//END UI components
}
|