/** Copyright 2013 Heena Mahour <heena393@gmail.com>** 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, see <http: //www.gnu.org/licenses/>.*/import QtQuick 2.0import org.kde.plasma.core 2.0 as PlasmaCoreimport org.kde.plasma.components 2.0 as PlasmaComponentsimport org.kde.plasma.extras 2.0 as PlasmaExtrasPlasmaExtras.ScrollArea {id: menuproperty alias model: menuListView.modelproperty alias section: menuListView.sectionproperty int iconSize: units.iconSizes.smallproperty bool showDesktop: truesignal itemSelected(int id)signal executeJob(string jobName, int id)signal setOnDesktop(int id, int desktop)ListView {id: menuListViewanchors.top: menu.topanchors.left: menu.leftanchors.bottom: menu.bottomfocus: truesection.property: desktopsection.criteria: ViewSection.FullStringspacing:0section.delegate: PlasmaComponents.Highlight {hover: menu.focuswidth: menu.widthheight: sectionDelegateLabel.height + marginHints.top + marginHints.bottomPlasmaComponents.Label {id: sectionDelegateLabeltext: section > 0 ? i18n("Desktop") + section : i18n("On all desktops")anchors.centerIn: parent}}highlight: PlasmaComponents.Highlight {hover: falsewidth: menuListView.width}delegate: TaskDelegate {id: menuItemDelegatewidth: menuListView.widthnameLabel: DisplayRoledesktop: Desktopicon: DecorationRoleactive: ActiveiconSize: menu.iconSizeshowDesktop: menu.showDesktoponClicked: menu.itemSelected(Id);onExecuteJob: menu.executeJob(jobName, Id);onSetOnDesktop: menu.setOnDesktop(Id, desktop);onActiveChanged: {if (active) {menuListView.currentIndex = index}}}}}