/**************************************************************************** Copyright (C) 2012-2013 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.0import org.kde.draganddrop 2.0import "../code/layout.js" as LayoutManagerimport "../code/tools.js" as TaskToolsItem {signal urlDropped(url url)property Item targetDropArea {id: dropHandleranchors.fill: parentpreventStealing: true;property Item hoveredItemonDragMove: {if (target.animating) {return;}var above = target.childAt(event.x, event.y);// HACK: plasmoid.configuration.sortingStrategy is an integer representation// of the TaskManager::GroupManager::TaskSortingStrategy enum.if (tasks.dragSource && backend.sortingStrategy == 1) {if (tasks.dragSource != above) {if (iconsOnly || !tasks.dragSource.isLauncher && !(above && "isLauncher" in above && above.isLauncher)) {itemMove(tasks.dragSource.itemId,TaskTools.insertionIndexAt(tasks.dragSource.itemIndex,event.x, event.y));}}} else if (!tasks.dragSource && above && hoveredItem != above) {hoveredItem = above;activationTimer.restart();} else if (!above) {hoveredItem = null;activationTimer.stop();}}onDragLeave: {hoveredItem = null;activationTimer.stop();}onDrop: {// Reject internal drops.if (event.mimeData.formats.indexOf("application/x-orgkdeplasmataskmanager_taskbuttonitem") >= 0) {return;}if (event.mimeData.hasUrls) {parent.urlDropped(event.mimeData.url);}}Timer {id: activationTimerinterval: 250repeat: falseonTriggered: {if (parent.hoveredItem.isGroupParent) {groupDialog.visualParent = parent.hoveredItem;groupDialog.visible = true;} else if (!parent.hoveredItem.isLauncher) {tasks.activateItem(parent.hoveredItem.itemId, false);}}}}MouseArea {id: wheelHandleranchors.fill: parentproperty int wheelDelta: 0;enabled: plasmoid.configuration.wheelEnabledonWheel: wheelDelta = TaskTools.wheelActivateNextPrevTask(false, wheelDelta, wheel.angleDelta.y);}}