2021-07-16 19:33:52 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2014-2015 by Eike Hein <hein@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 02110-1301 USA . *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
import org.kde.plasma.plasmoid 2.0
|
|
|
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
|
|
|
|
|
|
|
import org.kde.plasma.private.kicker 0.1 as Kicker
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: kicker
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
signal reset
|
|
|
|
|
|
|
|
property bool isDash: false
|
|
|
|
|
2022-09-01 20:51:23 +00:00
|
|
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
2021-07-16 19:33:52 +00:00
|
|
|
|
2022-09-01 20:51:23 +00:00
|
|
|
Plasmoid.compactRepresentation: null
|
|
|
|
Plasmoid.fullRepresentation: compactRepresentation
|
2021-07-16 19:33:52 +00:00
|
|
|
|
|
|
|
property Item dragSource: null
|
|
|
|
|
|
|
|
property QtObject globalFavorites: rootModel.favoritesModel
|
|
|
|
property QtObject systemFavorites: rootModel.systemFavoritesModel
|
2022-09-01 23:00:01 +00:00
|
|
|
PlasmaCore.DataSource {
|
|
|
|
id: menu_executable
|
|
|
|
engine: "executable"
|
|
|
|
connectedSources: []
|
|
|
|
onNewData: {
|
|
|
|
var exitCode = data["exit code"]
|
|
|
|
var exitStatus = data["exit status"]
|
|
|
|
var stdout = data["stdout"]
|
|
|
|
var stderr = data["stderr"]
|
|
|
|
exited(sourceName, exitCode, exitStatus, stdout, stderr)
|
|
|
|
disconnectSource(sourceName)
|
|
|
|
}
|
|
|
|
function exec(cmd) {
|
|
|
|
if (cmd) {
|
|
|
|
connectSource(cmd)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
signal exited(string cmd, int exitCode, int exitStatus, string stdout, string stderr)
|
|
|
|
}
|
2021-07-16 19:33:52 +00:00
|
|
|
|
|
|
|
function action_menuedit() {
|
|
|
|
processRunner.runMenuEditor();
|
|
|
|
}
|
2022-09-01 23:00:01 +00:00
|
|
|
function action_taskman() {
|
|
|
|
menu_executable.exec("ksysguard");
|
|
|
|
}
|
|
|
|
|
2021-07-16 19:33:52 +00:00
|
|
|
Component {
|
|
|
|
id: compactRepresentation
|
|
|
|
CompactRepresentation {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: menuRepresentation
|
2022-09-01 23:00:01 +00:00
|
|
|
MenuRepresentation {
|
|
|
|
|
|
|
|
}
|
2021-07-16 19:33:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Kicker.RootModel {
|
|
|
|
id: rootModel
|
|
|
|
|
|
|
|
autoPopulate: false
|
|
|
|
|
|
|
|
appNameFormat: plasmoid.configuration.appNameFormat
|
|
|
|
flat: true
|
|
|
|
sorted: true
|
2022-09-01 23:00:01 +00:00
|
|
|
showSeparators: true
|
2021-07-16 19:33:52 +00:00
|
|
|
appletInterface: plasmoid
|
|
|
|
|
2022-09-01 23:00:01 +00:00
|
|
|
paginate: false
|
2021-07-16 19:33:52 +00:00
|
|
|
pageSize: plasmoid.configuration.numberColumns * plasmoid.configuration.numberRows
|
|
|
|
|
2022-09-01 23:00:01 +00:00
|
|
|
showAllApps: false
|
|
|
|
showRecentApps: true
|
2021-07-16 19:33:52 +00:00
|
|
|
showRecentDocs: false
|
|
|
|
showRecentContacts: false
|
|
|
|
showPowerSession: false
|
|
|
|
|
|
|
|
onFavoritesModelChanged: {
|
|
|
|
if ("initForClient" in favoritesModel) {
|
|
|
|
favoritesModel.initForClient("org.kde.plasma.kicker.favorites.instance-" + plasmoid.id)
|
|
|
|
|
|
|
|
if (!plasmoid.configuration.favoritesPortedToKAstats) {
|
|
|
|
favoritesModel.portOldFavorites(plasmoid.configuration.favoriteApps);
|
|
|
|
plasmoid.configuration.favoritesPortedToKAstats = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
favoritesModel.favorites = plasmoid.configuration.favoriteApps;
|
|
|
|
}
|
|
|
|
|
|
|
|
favoritesModel.maxFavorites = pageSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
onSystemFavoritesModelChanged: {
|
|
|
|
systemFavoritesModel.enabled = false;
|
|
|
|
systemFavoritesModel.favorites = plasmoid.configuration.favoriteSystemActions;
|
|
|
|
systemFavoritesModel.maxFavorites = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
if ("initForClient" in favoritesModel) {
|
|
|
|
favoritesModel.initForClient("org.kde.plasma.kicker.favorites.instance-" + plasmoid.id)
|
|
|
|
|
|
|
|
if (!plasmoid.configuration.favoritesPortedToKAstats) {
|
|
|
|
favoritesModel.portOldFavorites(plasmoid.configuration.favoriteApps);
|
|
|
|
plasmoid.configuration.favoritesPortedToKAstats = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
favoritesModel.favorites = plasmoid.configuration.favoriteApps;
|
|
|
|
}
|
|
|
|
|
|
|
|
favoritesModel.maxFavorites = pageSize;
|
|
|
|
rootModel.refresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: globalFavorites
|
|
|
|
|
|
|
|
onFavoritesChanged: {
|
|
|
|
plasmoid.configuration.favoriteApps = target.favorites;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: systemFavorites
|
|
|
|
|
|
|
|
onFavoritesChanged: {
|
|
|
|
plasmoid.configuration.favoriteSystemActions = target.favorites;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: plasmoid.configuration
|
|
|
|
|
|
|
|
onFavoriteAppsChanged: {
|
|
|
|
globalFavorites.favorites = plasmoid.configuration.favoriteApps;
|
|
|
|
}
|
|
|
|
|
|
|
|
onFavoriteSystemActionsChanged: {
|
|
|
|
systemFavorites.favorites = plasmoid.configuration.favoriteSystemActions;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Kicker.RunnerModel {
|
|
|
|
id: runnerModel
|
|
|
|
|
|
|
|
favoritesModel: globalFavorites
|
|
|
|
runners: plasmoid.configuration.useExtraRunners ? new Array("services").concat(plasmoid.configuration.extraRunners) : "services"
|
|
|
|
appletInterface: plasmoid
|
|
|
|
|
|
|
|
deleteWhenEmpty: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Kicker.DragHelper {
|
|
|
|
id: dragHelper
|
|
|
|
}
|
|
|
|
|
|
|
|
Kicker.ProcessRunner {
|
|
|
|
id: processRunner;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaCore.FrameSvgItem {
|
|
|
|
id : highlightItemSvg
|
|
|
|
|
|
|
|
visible: false
|
|
|
|
|
2022-09-01 23:00:01 +00:00
|
|
|
imagePath: "widgets/menuitem"
|
2021-07-16 19:33:52 +00:00
|
|
|
prefix: "hover"
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaCore.FrameSvgItem {
|
|
|
|
id : panelSvg
|
|
|
|
|
|
|
|
visible: false
|
|
|
|
|
|
|
|
imagePath: "widgets/panel-background"
|
|
|
|
}
|
2022-09-01 23:00:01 +00:00
|
|
|
PlasmaCore.Svg {
|
|
|
|
id: arrowsSvg
|
2021-07-16 19:33:52 +00:00
|
|
|
|
2022-09-01 23:00:01 +00:00
|
|
|
imagePath: "widgets/arrows"
|
|
|
|
size: "16x16"
|
|
|
|
}
|
2021-07-16 19:33:52 +00:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
id: toolTipDelegate
|
|
|
|
|
|
|
|
width: contentWidth
|
|
|
|
height: contentHeight
|
|
|
|
|
|
|
|
property Item toolTip
|
|
|
|
|
|
|
|
text: (toolTip != null) ? toolTip.text : ""
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetDragSource() {
|
|
|
|
dragSource = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
plasmoid.setAction("menuedit", i18n("Edit Applications..."));
|
2022-09-01 23:00:01 +00:00
|
|
|
plasmoid.setAction("taskman", i18n("Task Manager"));
|
2021-07-16 19:33:52 +00:00
|
|
|
|
|
|
|
rootModel.refreshed.connect(reset);
|
|
|
|
|
|
|
|
dragHelper.dropped.connect(resetDragSource);
|
|
|
|
}
|
|
|
|
}
|