/*SPDX-FileCopyrightText: 2014-2015 Eike Hein <hein@kde.org>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Layoutsimport org.kde.kirigami as Kirigamiimport org.kde.ksvg as KSvgimport org.kde.plasma.components as PlasmaComponents3import org.kde.plasma.core as PlasmaCoreimport org.kde.plasma.plasmoidimport org.kde.plasma.private.kicker as KickerPlasmoidItem {id: kickeranchors.fill: parentsignal resetsignal modelRefreshedproperty bool isDash: Plasmoid.pluginName === "org.kde.plasma.kickerdash"switchWidth: isDash || !fullRepresentationItem ? 0 : fullRepresentationItem.Layout.minimumWidthswitchHeight: isDash || !fullRepresentationItem ? 0 : fullRepresentationItem.Layout.minimumHeight// this is a bit of a hack to prevent Plasma from spawning a dialog on its own when we're DashpreferredRepresentation: isDash ? fullRepresentation : nullcompactRepresentation: isDash ? null : compactRepresentationComponentfullRepresentation: isDash ? compactRepresentationComponent : menuRepresentationComponentreadonly property Component itemListDialogComponent: Component {ItemListDialog {}}property Item dragSource: nullproperty QtObject globalFavorites: rootModel.favoritesModelproperty QtObject systemFavorites: rootModel.systemFavoritesModelPlasmoid.icon: Plasmoid.configuration.useCustomButtonImage ? Plasmoid.configuration.customButtonImage : Plasmoid.configuration.icononSystemFavoritesChanged: {if (systemFavorites) {systemFavorites.favorites = Plasmoid.configuration.favoriteSystemActions;}}function action_menuedit() {processRunner.runMenuEditor();}Component {id: compactRepresentationComponentCompactRepresentation {}}Component {id: menuRepresentationComponentMenuRepresentation {}}Kicker.RootModel {id: rootModelautoPopulate: falseappNameFormat: Plasmoid.configuration.appNameFormatflat: kicker.isDash || Plasmoid.configuration.limitDepthsorted: Plasmoid.configuration.alphaSortshowSeparators: !kicker.isDash// TODO: appletInterface property now can be ported to "applet" and have the real Applet* assigned directlyappletInterface: kickershowAllApps: kicker.isDashshowAllAppsCategorized: trueshowTopLevelItems: !kicker.isDashshowRecentApps: Plasmoid.configuration.showRecentAppsshowRecentDocs: Plasmoid.configuration.showRecentDocsrecentOrdering: Plasmoid.configuration.recentOrderingonShowRecentAppsChanged: {Plasmoid.configuration.showRecentApps = showRecentApps;}onShowRecentDocsChanged: {Plasmoid.configuration.showRecentDocs = showRecentDocs;}onRecentOrderingChanged: {Plasmoid.configuration.recentOrdering = recentOrdering;}Component.onCompleted: {favoritesModel.initForClient("org.kde.plasma.kicker.favorites.instance-" + Plasmoid.id)if (!Plasmoid.configuration.favoritesPortedToKAstats) {if (favoritesModel.count < 1) {favoritesModel.portOldFavorites(Plasmoid.configuration.favoriteApps);}Plasmoid.configuration.favoritesPortedToKAstats = true;}}}Connections {target: globalFavoritesfunction onFavoritesChanged() {Plasmoid.configuration.favoriteApps = target.favorites;}}Connections {target: systemFavoritesfunction onFavoritesChanged() {Plasmoid.configuration.favoriteSystemActions = target.favorites;}}Connections {target: Plasmoid.configurationfunction onFavoriteAppsChanged() {globalFavorites.favorites = Plasmoid.configuration.favoriteApps;}function onFavoriteSystemActionsChanged() {systemFavorites.favorites = Plasmoid.configuration.favoriteSystemActions;}}Kicker.RunnerModel {id: runnerModelappletInterface: kickerfavoritesModel: globalFavoritesrunners: {const results = ["krunner_services","krunner_systemsettings","krunner_sessions","krunner_powerdevil","calculator","unitconverter"];if (Plasmoid.configuration.useExtraRunners) {results.push(...Plasmoid.configuration.extraRunners);}return results;}}Kicker.DragHelper {id: dragHelperdragIconSize: Kirigami.Units.iconSizes.medium}Kicker.ProcessRunner {id: processRunner}Kicker.WindowSystem {id: windowSystem}KSvg.FrameSvgItem {id: highlightItemSvgvisible: falseimagePath: "widgets/viewitem"prefix: "hover"}KSvg.FrameSvgItem {id: listItemSvgvisible: falseimagePath: "widgets/listitem"prefix: "normal"}PlasmaComponents3.Label {id: toolTipDelegatewidth: contentWidthheight: undefinedproperty Item toolTiptext: toolTip ? toolTip.mainText : ""textFormat: Text.PlainText}Timer {id: justOpenedTimerrepeat: falseinterval: 600}Connections {target: kickerfunction onExpandedChanged(expanded) {if (expanded) {windowSystem.monitorWindowVisibility(Plasmoid.fullRepresentationItem);justOpenedTimer.start();} else {kicker.reset();}}}function resetDragSource() {dragSource = null;}function enableHideOnWindowDeactivate() {kicker.hideOnWindowDeactivate = true;}Plasmoid.contextualActions: [PlasmaCore.Action {text: i18n("Edit Applicationsβ¦")icon.name: "kmenuedit"visible: Plasmoid.immutability !== PlasmaCore.Types.SystemImmutableonTriggered: processRunner.runMenuEditor()}]Component.onCompleted: {if (Plasmoid.hasOwnProperty("activationTogglesExpanded")) {Plasmoid.activationTogglesExpanded = !kicker.isDash}windowSystem.focusIn.connect(enableHideOnWindowDeactivate);kicker.hideOnWindowDeactivate = true;rootModel.refreshed.connect(modelRefreshed);dragHelper.dropped.connect(resetDragSource);}}