[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/tasks
From:       Marco Martin <notmart () gmail ! com>
Date:       2008-01-26 10:39:36
Message-ID: 1201343976.999867.23171.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 766578 by mart:

taskbar working better in vertical panels

 M  +16 -7     taskgroupitem.cpp  
 M  +15 -0     taskgroupitem.h  
 M  +6 -0      tasks.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/taskgroupitem.cpp #766577:766578
@@ -31,9 +31,6 @@
 #include <KGlobalSettings>
 #include <QStyleOptionGraphicsItem>
 
-// Plasma
-#include <plasma/layouts/boxlayout.h>
-
 TaskGroupItem::TaskGroupItem(QGraphicsItem *parent, QObject *parentObject)
     : AbstractTaskItem(parent, parentObject),
       _activeTask(-1),
@@ -45,10 +42,10 @@
 {
    //setAcceptDrops(true);
 
-   Plasma::BoxLayout *layout = new Plasma::BoxLayout(Plasma::BoxLayout::LeftToRight, this);
-   layout->setMargin(0);
-   layout->setSpacing(5);
-   layout->setMultiRow(true);
+   m_layout = new Plasma::BoxLayout(Plasma::BoxLayout::LeftToRight, this);
+   m_layout->setMargin(0);
+   m_layout->setSpacing(5);
+   m_layout->setMultiRow(true);
 }
 
 QSizeF TaskGroupItem::maximumSize() const
@@ -210,6 +207,18 @@
     return _borderStyle;
 }
 
+void TaskGroupItem::setDirection(Plasma::BoxLayout::Direction dir)
+{
+    m_layout->setDirection(dir);
+
+    m_layout->setMultiRow(dir != Plasma::BoxLayout::TopToBottom);
+}
+
+Plasma::BoxLayout::Direction TaskGroupItem::direction()
+{
+    m_layout->direction();
+}
+
 void TaskGroupItem::paint(QPainter *painter,
                           const QStyleOptionGraphicsItem *option,
                           QWidget *)
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/taskgroupitem.h #766577:766578
@@ -23,6 +23,9 @@
 // Own
 #include "abstracttaskitem.h"
 
+// Plasma
+#include <plasma/layouts/boxlayout.h>
+
 /**
  * A graphics item which holds a group of tasks.
  * To add a task to a group, set the AbstractTaskItem's parent
@@ -99,6 +102,17 @@
     QColor color() const;
 
     /**
+    * Sets the direction in which tasks are laid out.
+    * @param dir direction
+    */
+    void setDirection(Plasma::BoxLayout::Direction dir);
+
+   /**
+    * @returns direction in which tasks are laid out, default RightToLeft
+    */
+    Plasma::BoxLayout::Direction direction();
+
+    /**
      * Sets whether the task group is collapsed.
      * TODO: Document me
      */
@@ -173,6 +187,7 @@
     int _caretIndex;
     bool _allowSubGroups;
     int m_geometryUpdateTimerId;
+    Plasma::BoxLayout *m_layout;
 
     static const int CaretWidth = 5;
     static const int GroupBorderWidth = 16;
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/tasks.cpp #766577:766578
@@ -205,6 +205,12 @@
 void Tasks::constraintsUpdated(Plasma::Constraints constraints)
 {
     if (constraints & Plasma::LocationConstraint) {
+        if (formFactor() == Plasma::Vertical) {
+            m_rootTaskGroup->setDirection(Plasma::BoxLayout::TopToBottom);
+        } else {
+            m_rootTaskGroup->setDirection(Plasma::BoxLayout::LeftToRight);
+        }
+
         foreach (AbstractTaskItem *taskItem, m_windowTaskItems) {
             WindowTaskItem *windowTaskItem = dynamic_cast<WindowTaskItem *>(taskItem);
             if (windowTaskItem) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic