diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-12 16:49:43 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-12 16:49:43 -0500 |
commit | 18098b4c7042e7ce2f965964bb8977b4f17b9842 (patch) | |
tree | 5208af2813df58ff9ef7d5c878a516bd54c368d9 /kicker/taskbar/taskbar.cpp | |
parent | b28da13a4da674958eea60d6be6594766e42c757 (diff) | |
download | tdebase-18098b4c7042e7ce2f965964bb8977b4f17b9842.tar.gz tdebase-18098b4c7042e7ce2f965964bb8977b4f17b9842.zip |
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
Diffstat (limited to 'kicker/taskbar/taskbar.cpp')
-rw-r--r-- | kicker/taskbar/taskbar.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
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 |