From 18098b4c7042e7ce2f965964bb8977b4f17b9842 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 12 Apr 2013 16:49:43 -0500 Subject: Add initial taskbar drag and drop support This partially resolves Bug 1103 Save horizontal space around TDE Menu button when text is in use and Kicker is greater than one line in height --- kicker/taskbar/taskbar.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'kicker/taskbar/taskbar.cpp') diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp index 1e27050f3..40cc04fe1 100644 --- a/kicker/taskbar/taskbar.cpp +++ b/kicker/taskbar/taskbar.cpp @@ -1295,3 +1295,72 @@ void TaskBar::sortContainersByDesktop(TaskContainer::List& list) } } +int TaskBar::taskMoveHandler(const TQPoint &pos, Task::List taskList) { + TaskContainer* movingContainer = NULL; + TaskContainer* destContainer = NULL; + bool movingRight = true; + + TaskContainer::Iterator it = containers.begin(); + for (; it != containers.end(); ++it) + { + TaskContainer* c = *it; + if (c->taskList() == taskList) { + movingContainer = c; + break; + } + } + + if (movingContainer) { + // Find the best place for the container to go... + it = containers.begin(); + for (; it != containers.end(); ++it) + { + TaskContainer* c = *it; + TQPoint containerPos = c->pos(); + TQSize containerSize = c->size(); + TQRect containerRect(containerPos.x(), containerPos.y(), containerSize.width(), containerSize.height()); + if (containerRect.contains(pos)) { + destContainer = c; + // Figure out if the mobile container is moving towards the end of the container list (i.e. right or down) + for (; it != containers.end(); ++it) + { + if (movingContainer == (*it)) { + movingRight = false; + } + } + break; + } + } + + if (destContainer == movingContainer) { + return false; + } + + removeChild(movingContainer); + containers.remove(movingContainer); + + if (destContainer) { + it = containers.find(destContainer); + if ((it != containers.end()) && (movingRight)) { + it++; + } + if (it != containers.end()) { + containers.insert(it, movingContainer); + } + else { + containers.append(movingContainer); + } + } + else { + containers.append(movingContainer); + } + + addChild(movingContainer); + reLayoutEventually(); + emit containerCountChanged(); + + return true; + } + + return false; +} \ No newline at end of file -- cgit v1.2.1