Blame SOURCES/kde-workspace-taskmanager-grouping.patch

5397b8
diff --git a/plasma/desktop/applets/tasks/CMakeLists.txt b/plasma/desktop/applets/tasks/CMakeLists.txt
5397b8
index 29bb5ad..aee560d 100644
5397b8
--- a/plasma/desktop/applets/tasks/CMakeLists.txt
5397b8
+++ b/plasma/desktop/applets/tasks/CMakeLists.txt
5397b8
@@ -11,7 +11,7 @@ kde4_add_ui_files(tasks_SRCS tasksConfig.ui)
5397b8

5397b8
 kde4_add_plugin(plasma_applet_tasks ${tasks_SRCS})
5397b8

5397b8
-target_link_libraries(plasma_applet_tasks ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} taskmanager)
5397b8
+target_link_libraries(plasma_applet_tasks ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} taskmanager kephal)
5397b8

5397b8
 install(TARGETS plasma_applet_tasks DESTINATION ${PLUGIN_INSTALL_DIR})
5397b8
 install(FILES plasma-tasks-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
5397b8
diff --git a/plasma/desktop/applets/tasks/package/contents/ui/GroupDialog.qml b/plasma/desktop/applets/tasks/package/contents/ui/GroupDialog.qml
5397b8
index 4bba608..fe3c2b7 100644
5397b8
--- a/plasma/desktop/applets/tasks/package/contents/ui/GroupDialog.qml
5397b8
+++ b/plasma/desktop/applets/tasks/package/contents/ui/GroupDialog.qml
5397b8
@@ -20,6 +20,7 @@
5397b8
 import QtQuick 1.1
5397b8

5397b8
 import org.kde.plasma.core 0.1 as PlasmaCore
5397b8
+import org.kde.plasma.extras 0.1 as PlasmaExtras
5397b8
 import org.kde.draganddrop 1.0
5397b8

5397b8
 import "../code/layout.js" as Layout
5397b8
@@ -45,10 +46,15 @@ PlasmaCore.Dialog {
5397b8

5397b8
             anchors.fill: parent
5397b8

5397b8
-            Repeater {
5397b8
-                id: groupRepeater
5397b8
+            PlasmaExtras.ScrollArea {
5397b8
+                id: scrollArea
5397b8
+                anchors.fill: parent
5397b8

5397b8
-                onCountChanged: updateSize()
5397b8
+                ListView {
5397b8
+                    id: groupRepeater
5397b8
+                    anchors.fill: parent
5397b8
+                    onCountChanged: updateSize()
5397b8
+                }
5397b8
             }
5397b8
         }
5397b8
     }
5397b8
@@ -87,8 +93,12 @@ PlasmaCore.Dialog {
5397b8
             var task;
5397b8
             var maxWidth = 0;
5397b8

5397b8
-            for (var i = 0; i < taskList.children.length - 1; ++i) {
5397b8
-                task = taskList.children[i];
5397b8
+            for (var i = 0; i < groupRepeater.count - 1; ++i) {
5397b8
+                task = groupRepeater.contentItem.children[i];
5397b8
+
5397b8
+                if (!task || typeof task.textWidth == 'undefined') {
5397b8
+                    continue
5397b8
+                }
5397b8

5397b8
                 if (task.textWidth > maxWidth) {
5397b8
                     maxWidth = task.textWidth;
5397b8
@@ -100,8 +110,13 @@ PlasmaCore.Dialog {
5397b8
             maxWidth += Layout.horizontalMargins() + theme.smallIconSize + 6;
5397b8

5397b8
             // TODO: Properly derive limits from work area size (screen size sans struts).
5397b8
+            mainItem.height = Math.min(screenHeight / 2, groupRepeater.count * (Layout.verticalMargins() + theme.smallIconSize));
5397b8
             mainItem.width = Math.min(maxWidth, (tasks.vertical ? 640 - tasks.width : Math.max(tasks.width, 640)) - 20);
5397b8
-            mainItem.height = groupRepeater.count * (Layout.verticalMargins() + theme.smallIconSize);
5397b8
+
5397b8
+            // Scrollbar is used so adjust width
5397b8
+            if (mainItem.height >= screenHeight / 2) {
5397b8
+                mainItem.width += 5
5397b8
+            }
5397b8
         }
5397b8
     }
5397b8

5397b8
diff --git a/plasma/desktop/applets/tasks/tasks.cpp b/plasma/desktop/applets/tasks/tasks.cpp
5397b8
index 4ebb87d..a919948 100644
5397b8
--- a/plasma/desktop/applets/tasks/tasks.cpp
5397b8
+++ b/plasma/desktop/applets/tasks/tasks.cpp
5397b8
@@ -41,6 +41,9 @@
5397b8
 #include <taskmanager/taskitem.h>
5397b8
 #include <taskmanager/tasksmodel.h>
5397b8

5397b8
+#include "kephal/kephal/desktopwidgetscreens.h"
5397b8
+#include "kephal/kephal/screens.h"
5397b8
+
5397b8
 #include <QtDeclarative>
5397b8

5397b8
 class GroupManager : public TaskManager::GroupManager
5397b8
@@ -97,6 +100,7 @@ void Tasks::init()
5397b8
     qmlRegisterType<ToolTipProxy>( "Tasks", 0, 1, "ToolTip" );
5397b8
     rootContext->setContextProperty("tasksModel", QVariant::fromValue(static_cast<QObject *>(m_tasksModel)));
5397b8
     rootContext->setContextProperty("dragHelper", QVariant::fromValue(static_cast<QObject *>(new DragHelper(this))));
5397b8
+    rootContext->setContextProperty("screenHeight", Kephal::Screens::self()->screen(c->screen())->size().height());
5397b8

5397b8
     // NOTE: This can go away once Plasma::Location becomes available (i.e. once this is
5397b8
     // a pure-QML applet.)