Hi panel devs,

I have written a patch against 4.2 that does exactly this. I'm using it since 
a month now. I wrote it because STasks and FancyTasks where either too buggy 
or have other things I don't like.

So here it is... If you think this is useful I could port it to trunk and 
commit it. You decide.

Cheers,
Michael

On Monday 13 April 2009 02:53:54 Mario Palomo wrote:
> Hi,
>
> I use a narrow vertical Panel and the text of the items in the Task
> Manager are not very useful to me (only 2 or 3 characters), but I see
> a *small* icon and the 2 or 3 characters I don't need. I think is
> better to see only a *big* icon for every task, so I have touch a
> little the file 'abstracttaskitem.cpp', and if I've configured the
> Grouping Strategy to ManualGrouping, I don't show the text: only a big
> icon (I've used the option to Grouping Strategy because I use this
> option too, and the other KDE4 user in the system don't have this
> option and have a horizontal Panel). I am happy with the result.
>
> I think that the developers of the Tasks applet could include a "Show
> only icons" option for me and others (some users of the Panel in
> horizontal position may want this option too: I've discover in
> screenshots that Windows 7 show the tasks only with icons). If you
> want to see the modifications made to the code by a non-KDE4 developer
> that see the code for the first time, here is :-)
>
> Index: abstracttaskitem.cpp
> ===================================================================
> --- abstracttaskitem.cpp        (revision 951443)
> +++ abstracttaskitem.cpp        (working copy)
> @@ -493,6 +493,8 @@
>          painter->drawPixmap(iconRect(bounds).topLeft(), result);
>      }
>
> +if (   m_applet->groupManager().groupingStrategy()
> +    != TaskManager::GroupManager::ManualGrouping) { //By Mario
>      painter->setPen(QPen(textColor(), 1.0));
>
>      QRect rect = textRect(bounds).toRect();
> @@ -527,6 +529,7 @@
>              painter->drawText(rect, Qt::AlignCenter,
> QString::number(groupItem->memberList().count()));
>          }
>      }
> +}//By Mario
>  }
>
>  QTextOption AbstractTaskItem::textOption() const
> @@ -766,7 +769,10 @@
>      QRectF bounds(b);
>      const int right = bounds.right();
>      //leave enough space for the text. useful in vertical panel
> +if (   m_applet->groupManager().groupingStrategy()
> +    != TaskManager::GroupManager::ManualGrouping) { //By Mario
>      bounds.setWidth(qMax(bounds.width() / 3,
> qMin(minimumSize().height(), bounds.width())));
> +}//By Mario
>
>      //restore right position if the layout is RTL
>      if (QApplication::layoutDirection() == Qt::RightToLeft) {
>
>
> I hope you have in mind my suggestion. Greetings,
>
> Mario
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel

Index: kwin/clients/ozone/CMakeLists.txt
===================================================================
--- kwin/clients/ozone/CMakeLists.txt	(revision 938695)
+++ kwin/clients/ozone/CMakeLists.txt	(working copy)
@@ -3,7 +3,7 @@
 ########### next target ###############
 
 set(kwin_ozone_SRCS
-     lib/helper.cpp
+#     lib/helper.cpp
      oxygenclient.cpp
      oxygenbutton.cpp
      oxygen.cpp
Index: kwin/clients/oxygen/CMakeLists.txt
===================================================================
--- kwin/clients/oxygen/CMakeLists.txt	(revision 938695)
+++ kwin/clients/oxygen/CMakeLists.txt	(working copy)
@@ -3,7 +3,7 @@
 ########### next target ###############
 
 set(kwin_oxygen_SRCS
-     lib/helper.cpp
+#     lib/helper.cpp
      oxygenclient.cpp
      oxygenbutton.cpp
      oxygen.cpp
Index: plasma/applets/tasks/taskgroupitem.cpp
===================================================================
--- plasma/applets/tasks/taskgroupitem.cpp	(revision 938695)
+++ plasma/applets/tasks/taskgroupitem.cpp	(working copy)
@@ -55,8 +55,8 @@
 #include "tasks.h"
 #include "layoutwidget.h"
 
-TaskGroupItem::TaskGroupItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip)
-    : AbstractTaskItem(parent, applet, showTooltip),
+TaskGroupItem::TaskGroupItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip, const bool showOnlyIcon)
+    : AbstractTaskItem(parent, applet, showTooltip, showOnlyIcon),
       m_group(0),
       m_expandedLayout(0),
       m_popupMenuTimer(0),
@@ -146,7 +146,7 @@
 
     if (!m_childSplitGroup) {
         //kDebug() << "Normal scene " << scene();
-        m_childSplitGroup = new  TaskGroupItem(this, m_applet, true);
+        m_childSplitGroup = new  TaskGroupItem(this, m_applet, true, false);
         m_childSplitGroup->setSplitGroup(m_group);
     }
 
@@ -362,11 +362,11 @@
     }
 
     if (groupableItem->isGroupItem()) {
-        TaskGroupItem *groupItem = new TaskGroupItem(this, m_applet, m_applet->showTooltip());
+        TaskGroupItem *groupItem = new TaskGroupItem(this, m_applet, m_applet->showTooltip(), m_applet->showOnlyIcons());
         groupItem->setGroup(static_cast<TaskManager::TaskGroup*>(groupableItem));
         item = groupItem;
     } else { //it's a window task
-        WindowTaskItem *windowItem = new WindowTaskItem(this, m_applet, m_applet->showTooltip());
+        WindowTaskItem *windowItem = new WindowTaskItem(this, m_applet, m_applet->showTooltip(), m_applet->showOnlyIcons());
         windowItem->setTask(static_cast<TaskManager::TaskItem*>(groupableItem));
         item = windowItem;
     }
Index: plasma/applets/tasks/taskgroupitem.h
===================================================================
--- plasma/applets/tasks/taskgroupitem.h	(revision 938695)
+++ plasma/applets/tasks/taskgroupitem.h	(working copy)
@@ -50,7 +50,7 @@
 
 public:
     /** Constructs a new representation for a taskgroup. */
-    TaskGroupItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip);
+    TaskGroupItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip, const bool showOnlyIcon);
 
     /** Sets the group represented by this task. */
     void setGroup(TaskManager::GroupPtr);
Index: plasma/applets/tasks/abstracttaskitem.cpp
===================================================================
--- plasma/applets/tasks/abstracttaskitem.cpp	(revision 938695)
+++ plasma/applets/tasks/abstracttaskitem.cpp	(working copy)
@@ -54,7 +54,7 @@
 #include "taskgroupitem.h"
 #include "layoutwidget.h"
 
-AbstractTaskItem::AbstractTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip)
+AbstractTaskItem::AbstractTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip, const bool showOnlyIcon)
     : QGraphicsWidget(parent),
       m_abstractItem(0),
       m_applet(applet),
@@ -68,6 +68,7 @@
       m_attentionTicks(0),
       m_fadeIn(true),
       m_showTooltip(showTooltip),
+      m_showOnlyIcon(showOnlyIcon),
       m_showingTooltip(false)
 {
     setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
@@ -98,8 +99,15 @@
         topMargin = qMax(1, topMargin/2); 
         bottomMargin = qMax(1, bottomMargin/2); 
     }
-    return QSize(mSize.width()*12 + m_applet->itemLeftMargin() + m_applet->itemRightMargin() + KIconLoader::SizeSmall,
+
+    if (m_showOnlyIcon) {
+
+      return QSize(qMin(m_applet->size().height(), m_applet->size().width()), 
+			    qMin(m_applet->size().height(), m_applet->size().width()));
+    } else {
+      return QSize(mSize.width()*12 + m_applet->itemLeftMargin() + m_applet->itemRightMargin() + KIconLoader::SizeSmall,
                            qMax(mSize.height(), iconsize) + topMargin + bottomMargin);
+    }
 }
 
 AbstractTaskItem::~AbstractTaskItem()
@@ -120,6 +128,8 @@
     } else if (m_showTooltip != m_applet->showTooltip()) {
         m_showTooltip = !m_showTooltip;
     }
+
+    m_showOnlyIcon = m_applet->showOnlyIcons();
 }
 
 void AbstractTaskItem::setShowTooltip(const bool showit)
@@ -452,40 +462,61 @@
         painter->drawPixmap(iconRect(bounds).topLeft(), result);
     }
 
-    painter->setPen(QPen(textColor(), 1.0));
+    if (!m_showOnlyIcon) {
+      painter->setPen(QPen(textColor(), 1.0));
 
-    QRect rect = textRect(bounds).toRect();
-    if (rect.height() > 20) {
-        rect.adjust(2, 2, -2, -2); // Create a text margin
-    }
-    QTextLayout layout;
-    layout.setFont(KGlobalSettings::taskbarFont());
-    layout.setTextOption(textOption());
+      QRect rect = textRect(bounds).toRect();
+      if (rect.height() > 20) {
+	  rect.adjust(2, 2, -2, -2); // Create a text margin
+      }
+      QTextLayout layout;
+      layout.setFont(KGlobalSettings::taskbarFont());
+      layout.setTextOption(textOption());
 
-    layoutText(layout, m_text, rect.size());
-    drawTextLayout(painter, layout, rect);
+      layoutText(layout, m_text, rect.size());
+      drawTextLayout(painter, layout, rect);
 
+    }
     TaskGroupItem *groupItem = qobject_cast<TaskGroupItem *>(this);
     if (groupItem) {
-        QFont font(KGlobalSettings::smallestReadableFont());
-        QFontMetrics fm(font);
-        QRectF rect(expanderRect(bounds));
+	QFont font;
+	if (m_showOnlyIcon) {
+	  font = (KGlobalSettings::taskbarFont());
+	} else {
+	  font = (KGlobalSettings::smallestReadableFont());
+	}
+	QFontMetrics fm(font);
+	QRectF rect(expanderRect(bounds));
 
-        Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
+	Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
 
-        if (itemBackground && itemBackground->hasElement(expanderElement())) {
-            QSizeF arrowSize(itemBackground->elementSize(expanderElement()));
-            QRectF arrowRect(rect.center()-QPointF(arrowSize.width()/2, arrowSize.height()+fm.xHeight()/2), arrowSize);
-            itemBackground->paint(painter, arrowRect, expanderElement());
+	if (itemBackground && itemBackground->hasElement(expanderElement())) {
+	    QSizeF arrowSize(itemBackground->elementSize(expanderElement()));
+	    QRectF arrowRect(rect.center()-QPointF(arrowSize.width()/2, arrowSize.height()+fm.xHeight()/2), arrowSize);
+	    itemBackground->paint(painter, arrowRect, expanderElement());
 
-            painter->setFont(font);
-            rect.setTop(arrowRect.bottom());
-            painter->drawText(rect, Qt::AlignHCenter|Qt::AlignTop, QString::number(groupItem->memberList().count()));
-        } else {
-            painter->setFont(font);
-            painter->drawText(rect, Qt::AlignCenter, QString::number(groupItem->memberList().count()));
-        }
-    }
+ 	    QColor shadowColor;
+ 	    if (textColor().value() < 128) {
+ 		shadowColor = Qt::white;
+ 	    } else {
+ 		shadowColor = Qt::black;
+ 	    }
+ 	    painter->setPen(QPen(shadowColor, 1.0));
+// 	    font.setPixelSize(font.pixelSize()+2);
+// 	    painter->setFont(font);
+ 	    rect.setTop(arrowRect.bottom() + 1);
+ 	    painter->drawText(rect, Qt::AlignHCenter|Qt::AlignTop, QString::number(groupItem->memberList().count()));
+
+ 	    painter->setPen(QPen(textColor(), 1.0));
+// 	    font.setPixelSize(font.pixelSize()-2);
+//	    painter->setFont(font);
+	    rect.setTop(arrowRect.bottom());
+	    painter->drawText(rect, Qt::AlignHCenter|Qt::AlignTop, QString::number(groupItem->memberList().count()));
+	} else {
+	    painter->setFont(font);
+	    painter->drawText(rect, Qt::AlignCenter, QString::number(groupItem->memberList().count()));
+	}
+   }
 }
 
 QTextOption AbstractTaskItem::textOption() const
@@ -503,6 +534,9 @@
 QSize AbstractTaskItem::layoutText(QTextLayout &layout, const QString &text,
                                    const QSize &constraints) const
 {
+    if (m_showOnlyIcon) {
+      return QSize(0, 0);
+    }
     QFontMetrics metrics(layout.font());
     int leading     = metrics.leading();
     int height      = 0;
@@ -719,18 +753,26 @@
 {
     QRectF bounds(b);
     const int right = bounds.right();
-    //leave enough space for the text. useful in vertical panel
-    bounds.setWidth(qMax(bounds.width() / 3, qMin(minimumSize().height(), bounds.width())));
 
-    //restore right position if the layout is RTL
-    if (QApplication::layoutDirection() == Qt::RightToLeft) {
-        bounds.moveRight(right);
+    if(!m_showOnlyIcon){
+      //leave enough space for the text. useful in vertical panel
+      bounds.setWidth(qMax(bounds.width() / 3, qMin(minimumSize().height(), bounds.width())));
+      //restore right position if the layout is RTL
+      if (QApplication::layoutDirection() == Qt::RightToLeft) {
+	  bounds.moveRight(right);
+      }
     }
 
+
     QSize iconSize = m_icon.actualSize(bounds.size().toSize());
 
-    return QStyle::alignedRect(QApplication::layoutDirection(), Qt::AlignLeft | Qt::AlignVCenter,
+    if(!m_showOnlyIcon){
+      return QStyle::alignedRect(QApplication::layoutDirection(), Qt::AlignLeft | Qt::AlignVCenter,
                                iconSize, bounds.toRect());
+    } else {
+      return QStyle::alignedRect(QApplication::layoutDirection(), Qt::AlignCenter | Qt::AlignVCenter,
+                               iconSize, bounds.toRect());
+    }
 }
 
 QRectF AbstractTaskItem::expanderRect(const QRectF &bounds) const
@@ -740,15 +782,25 @@
         return QRectF();
     }
 
-    QFontMetrics fm(KGlobalSettings::smallestReadableFont());
-    Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
+    if(m_showOnlyIcon){
+      QFontMetrics fm = KGlobalSettings::taskbarFont();
+      Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
+      QSize expanderSize(qMax(fm.width(QString::number(groupItem->memberList().count())),
+			itemBackground ?  m_applet->itemBackground()->elementSize(expanderElement()).width() : 0),
+			size().height());
+      return QStyle::alignedRect(QApplication::layoutDirection(), Qt::AlignCenter | Qt::AlignVCenter,
+                               expanderSize, bounds.toRect());
+    } else {
+      QFontMetrics fm = KGlobalSettings::smallestReadableFont();
+      Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
 
-    QSize expanderSize(qMax(fm.width(QString::number(groupItem->memberList().count())),
+      QSize expanderSize(qMax(fm.width(QString::number(groupItem->memberList().count())),
                        itemBackground ?  m_applet->itemBackground()->elementSize(expanderElement()).width() : 0),
                        size().height());
 
-    return QStyle::alignedRect(QApplication::layoutDirection(), Qt::AlignRight | Qt::AlignVCenter,
+      return QStyle::alignedRect(QApplication::layoutDirection(), Qt::AlignRight | Qt::AlignVCenter,
                                expanderSize, bounds.toRect());
+    }
 }
 
 QRectF AbstractTaskItem::textRect(const QRectF &bounds) const
Index: plasma/applets/tasks/tasksConfig.ui
===================================================================
--- plasma/applets/tasks/tasksConfig.ui	(revision 938695)
+++ plasma/applets/tasks/tasksConfig.ui	(working copy)
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>tasksConfig</class>
- <widget class="QWidget" name="tasksConfig" >
-  <property name="geometry" >
+ <widget class="QWidget" name="tasksConfig">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
@@ -9,60 +10,60 @@
     <height>391</height>
    </rect>
   </property>
-  <layout class="QGridLayout" name="gridLayout" >
-   <item row="0" column="0" colspan="2" >
-    <widget class="QLabel" name="label_5" >
-     <property name="font" >
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="2">
+    <widget class="QLabel" name="label_5">
+     <property name="font">
       <font>
        <weight>75</weight>
        <bold>true</bold>
       </font>
      </property>
-     <property name="text" >
+     <property name="text">
       <string>Appearance</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <widget class="QLabel" name="label_7" >
-     <property name="text" >
+   <item row="1" column="1">
+    <widget class="QLabel" name="label_7">
+     <property name="text">
       <string>Show tooltips:</string>
      </property>
-     <property name="alignment" >
+     <property name="alignment">
       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
      </property>
     </widget>
    </item>
-   <item row="1" column="2" >
-    <widget class="QCheckBox" name="showTooltip" >
-     <property name="text" >
+   <item row="1" column="3">
+    <widget class="QCheckBox" name="showTooltip">
+     <property name="text">
       <string/>
      </property>
     </widget>
    </item>
-   <item row="2" column="1" >
-    <widget class="QLabel" name="label_8" >
-     <property name="text" >
+   <item row="2" column="1">
+    <widget class="QLabel" name="label_8">
+     <property name="text">
       <string>Force row settings:</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="2" >
-    <widget class="QCheckBox" name="fillRows" >
-     <property name="text" >
+   <item row="2" column="3">
+    <widget class="QCheckBox" name="fillRows">
+     <property name="text">
       <string/>
      </property>
     </widget>
    </item>
-   <item row="3" column="1" >
-    <spacer name="verticalSpacer_6" >
-     <property name="orientation" >
+   <item row="4" column="1">
+    <spacer name="verticalSpacer_6">
+     <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeType" >
+     <property name="sizeType">
       <enum>QSizePolicy::Fixed</enum>
      </property>
-     <property name="sizeHint" stdset="0" >
+     <property name="sizeHint" stdset="0">
       <size>
        <width>64</width>
        <height>5</height>
@@ -70,34 +71,34 @@
      </property>
     </spacer>
    </item>
-   <item row="4" column="1" >
-    <widget class="QLabel" name="label_3" >
-     <property name="text" >
+   <item row="5" column="1">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
       <string>Maximum rows:</string>
      </property>
-     <property name="alignment" >
+     <property name="alignment">
       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
      </property>
     </widget>
    </item>
-   <item row="4" column="2" >
-    <layout class="QHBoxLayout" name="horizontalLayout" >
+   <item row="5" column="3">
+    <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <widget class="QSpinBox" name="maxRows" >
-       <property name="minimum" >
+      <widget class="QSpinBox" name="maxRows">
+       <property name="minimum">
         <number>1</number>
        </property>
-       <property name="value" >
+       <property name="value">
         <number>2</number>
        </property>
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_2" >
-       <property name="orientation" >
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeHint" stdset="0" >
+       <property name="sizeHint" stdset="0">
         <size>
          <width>47</width>
          <height>23</height>
@@ -107,15 +108,15 @@
      </item>
     </layout>
    </item>
-   <item row="5" column="1" >
-    <spacer name="verticalSpacer_2" >
-     <property name="orientation" >
+   <item row="6" column="1">
+    <spacer name="verticalSpacer_2">
+     <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeType" >
+     <property name="sizeType">
       <enum>QSizePolicy::Fixed</enum>
      </property>
-     <property name="sizeHint" stdset="0" >
+     <property name="sizeHint" stdset="0">
       <size>
        <width>64</width>
        <height>10</height>
@@ -123,34 +124,34 @@
      </property>
     </spacer>
    </item>
-   <item row="6" column="0" colspan="3" >
-    <widget class="QLabel" name="label_6" >
-     <property name="font" >
+   <item row="7" column="0" colspan="4">
+    <widget class="QLabel" name="label_6">
+     <property name="font">
       <font>
        <weight>75</weight>
        <bold>true</bold>
       </font>
      </property>
-     <property name="text" >
+     <property name="text">
       <string>Grouping &amp; Sorting</string>
      </property>
     </widget>
    </item>
-   <item row="7" column="1" >
-    <widget class="QLabel" name="label" >
-     <property name="text" >
+   <item row="8" column="1">
+    <widget class="QLabel" name="label">
+     <property name="text">
       <string>Grouping:</string>
      </property>
-     <property name="alignment" >
+     <property name="alignment">
       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
      </property>
     </widget>
    </item>
-   <item row="7" column="2" >
-    <layout class="QHBoxLayout" name="horizontalLayout_2" >
+   <item row="8" column="3">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
-      <widget class="QComboBox" name="groupingStrategy" >
-       <property name="minimumSize" >
+      <widget class="QComboBox" name="groupingStrategy">
+       <property name="minimumSize">
         <size>
          <width>200</width>
          <height>0</height>
@@ -159,11 +160,11 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_3" >
-       <property name="orientation" >
+      <spacer name="horizontalSpacer_3">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeHint" stdset="0" >
+       <property name="sizeHint" stdset="0">
         <size>
          <width>40</width>
          <height>20</height>
@@ -173,17 +174,17 @@
      </item>
     </layout>
    </item>
-   <item row="8" column="2" >
-    <layout class="QHBoxLayout" name="horizontalLayout_4" >
+   <item row="9" column="3">
+    <layout class="QHBoxLayout" name="horizontalLayout_4">
      <item>
-      <spacer name="horizontalSpacer" >
-       <property name="orientation" >
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeType" >
+       <property name="sizeType">
         <enum>QSizePolicy::Fixed</enum>
        </property>
-       <property name="sizeHint" stdset="0" >
+       <property name="sizeHint" stdset="0">
         <size>
          <width>13</width>
          <height>20</height>
@@ -192,35 +193,35 @@
       </spacer>
      </item>
      <item>
-      <widget class="QCheckBox" name="groupWhenFull" >
-       <property name="enabled" >
+      <widget class="QCheckBox" name="groupWhenFull">
+       <property name="enabled">
         <bool>false</bool>
        </property>
-       <property name="text" >
+       <property name="text">
         <string>Only when the taskbar is full</string>
        </property>
-       <property name="checked" >
+       <property name="checked">
         <bool>true</bool>
        </property>
       </widget>
      </item>
     </layout>
    </item>
-   <item row="9" column="1" >
-    <widget class="QLabel" name="label_2" >
-     <property name="text" >
+   <item row="10" column="1">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
       <string>Sorting:</string>
      </property>
-     <property name="alignment" >
+     <property name="alignment">
       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
      </property>
     </widget>
    </item>
-   <item row="9" column="2" >
-    <layout class="QHBoxLayout" name="horizontalLayout_3" >
+   <item row="10" column="3">
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
      <item>
-      <widget class="QComboBox" name="sortingStrategy" >
-       <property name="minimumSize" >
+      <widget class="QComboBox" name="sortingStrategy">
+       <property name="minimumSize">
         <size>
          <width>200</width>
          <height>0</height>
@@ -229,11 +230,11 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer_4" >
-       <property name="orientation" >
+      <spacer name="horizontalSpacer_4">
+       <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeHint" stdset="0" >
+       <property name="sizeHint" stdset="0">
         <size>
          <width>40</width>
          <height>20</height>
@@ -243,28 +244,28 @@
      </item>
     </layout>
    </item>
-   <item row="10" column="0" >
-    <widget class="QLabel" name="label_4" >
-     <property name="font" >
+   <item row="11" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="font">
       <font>
        <weight>75</weight>
        <bold>true</bold>
       </font>
      </property>
-     <property name="text" >
+     <property name="text">
       <string>Filters</string>
      </property>
     </widget>
    </item>
-   <item row="10" column="1" >
-    <spacer name="verticalSpacer_4" >
-     <property name="orientation" >
+   <item row="11" column="1">
+    <spacer name="verticalSpacer_4">
+     <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeType" >
+     <property name="sizeType">
       <enum>QSizePolicy::Fixed</enum>
      </property>
-     <property name="sizeHint" stdset="0" >
+     <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
        <height>10</height>
@@ -272,33 +273,33 @@
      </property>
     </spacer>
    </item>
-   <item row="11" column="1" colspan="2" >
-    <widget class="QCheckBox" name="showOnlyCurrentDesktop" >
-     <property name="text" >
+   <item row="12" column="1" colspan="3">
+    <widget class="QCheckBox" name="showOnlyCurrentDesktop">
+     <property name="text">
       <string>Only show tasks from the current desktop</string>
      </property>
     </widget>
    </item>
-   <item row="12" column="1" colspan="2" >
-    <widget class="QCheckBox" name="showOnlyCurrentScreen" >
-     <property name="text" >
+   <item row="13" column="1" colspan="3">
+    <widget class="QCheckBox" name="showOnlyCurrentScreen">
+     <property name="text">
       <string>Only show tasks from the current screen</string>
      </property>
     </widget>
    </item>
-   <item row="13" column="1" colspan="2" >
-    <widget class="QCheckBox" name="showOnlyMinimized" >
-     <property name="text" >
+   <item row="14" column="1" colspan="3">
+    <widget class="QCheckBox" name="showOnlyMinimized">
+     <property name="text">
       <string>Only show tasks that are minimized</string>
      </property>
     </widget>
    </item>
-   <item row="14" column="1" >
-    <spacer name="verticalSpacer" >
-     <property name="orientation" >
+   <item row="15" column="1">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeHint" stdset="0" >
+     <property name="sizeHint" stdset="0">
       <size>
        <width>0</width>
        <height>5</height>
@@ -306,6 +307,23 @@
      </property>
     </spacer>
    </item>
+   <item row="3" column="1">
+    <widget class="QLabel" name="label_9">
+     <property name="text">
+      <string>Show only icons:</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="3">
+    <widget class="QCheckBox" name="showOnlyIcons">
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>
Index: plasma/applets/tasks/windowtaskitem.cpp
===================================================================
--- plasma/applets/tasks/windowtaskitem.cpp	(revision 938695)
+++ plasma/applets/tasks/windowtaskitem.cpp	(working copy)
@@ -50,8 +50,8 @@
 
 #include "tasks.h"
 
-WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip)
-    : AbstractTaskItem(parent, applet, showTooltip),
+WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip, const bool showOnlyIcon)
+    : AbstractTaskItem(parent, applet, showTooltip, showOnlyIcon),
       m_task(0)
 {
 }
Index: plasma/applets/tasks/abstracttaskitem.h
===================================================================
--- plasma/applets/tasks/abstracttaskitem.h	(revision 938695)
+++ plasma/applets/tasks/abstracttaskitem.h	(working copy)
@@ -54,7 +54,7 @@
 
 public:
     /** Constructs a new representation for an abstract task. */
-    AbstractTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip);
+    AbstractTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip, const bool showOnlyIcon);
 
      /** Destruct the representation for an abstract task. */
     ~AbstractTaskItem();
@@ -228,6 +228,7 @@
 
     bool m_fadeIn : 1;
     bool m_showTooltip : 1;
+    bool m_showOnlyIcon : 1;
     bool m_showingTooltip : 1;
     // distance (in pixels) between a task's icon and its text
     static const int IconTextSpacing = 4;
Index: plasma/applets/tasks/windowtaskitem.h
===================================================================
--- plasma/applets/tasks/windowtaskitem.h	(revision 938695)
+++ plasma/applets/tasks/windowtaskitem.h	(working copy)
@@ -36,7 +36,7 @@
 
 public:
     /** Constructs a new representation for a window task. */
-    WindowTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip);
+    WindowTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip, const bool showOnlyIcon);
 
     /** Sets the window/startup represented by this task. */
     void setTask(TaskManager::TaskItem* taskItem);
Index: plasma/applets/tasks/tasks.cpp
===================================================================
--- plasma/applets/tasks/tasks.cpp	(revision 938695)
+++ plasma/applets/tasks/tasks.cpp	(working copy)
@@ -88,7 +88,7 @@
    // connect(m_groupManager, SIGNAL(reload()), this, SLOT(reload()));
     connect(this, SIGNAL(settingsChanged()), m_groupManager, SLOT(reconnect()));
 
-    m_rootGroupItem = new TaskGroupItem(this, this, false);
+    m_rootGroupItem = new TaskGroupItem(this, this, false, false);
     m_rootGroupItem->expand();
     m_rootGroupItem->setGroup(m_groupManager->rootGroup());
 
@@ -123,6 +123,7 @@
     m_groupManager->setShowOnlyMinimized(cg.readEntry("showOnlyMinimized", false));
     m_groupManager->setOnlyGroupWhenFull(cg.readEntry("groupWhenFull", true));
     m_showTooltip = cg.readEntry("showTooltip", true);
+    m_showOnlyIcons = cg.readEntry("showOnlyIcons", true);
 
     m_groupManager->setGroupingStrategy( static_cast<TaskManager::GroupManager::TaskGroupingStrategy>(cg.readEntry("groupingStrategy", static_cast<int>(TaskManager::GroupManager::ProgramGrouping))));
 
@@ -253,6 +254,7 @@
      parent->addPage(widget, i18n("General"), icon());
 
     m_ui.showTooltip->setChecked(m_showTooltip);
+    m_ui.showOnlyIcons->setChecked(m_showOnlyIcons);
     m_ui.showOnlyCurrentDesktop->setChecked(m_groupManager->showOnlyCurrentDesktop());
     m_ui.showOnlyCurrentScreen->setChecked(m_groupManager->showOnlyCurrentScreen());
     m_ui.showOnlyMinimized->setChecked(m_groupManager->showOnlyMinimized());
@@ -380,6 +382,13 @@
         changed = true;
     }
 
+    if (m_showOnlyIcons != (m_ui.showOnlyIcons->checkState() == Qt::Checked)) {
+        m_showOnlyIcons = !m_showOnlyIcons;
+        KConfigGroup cg = config();
+        cg.writeEntry("showOnlyIcons", m_showOnlyIcons);
+        changed = true;
+    }
+
     if (changed) {
         emit settingsChanged();
         emit configNeedsSaving();
@@ -392,8 +401,11 @@
     return m_showTooltip;
 }
 
+bool Tasks::showOnlyIcons() const
+{
+    return m_showOnlyIcons;
+}
 
-
 void Tasks::themeRefresh()
 {
     delete m_taskItemBackground;
Index: plasma/applets/tasks/tasks.h
===================================================================
--- plasma/applets/tasks/tasks.h	(revision 938695)
+++ plasma/applets/tasks/tasks.h	(working copy)
@@ -101,6 +101,7 @@
         Qt::KeyboardModifiers groupModifierKey() const;
 
         bool showTooltip() const;
+        bool showOnlyIcons() const;
 
 
 signals:
@@ -132,6 +133,7 @@
 
 private:
         bool m_showTooltip;
+        bool m_showOnlyIcons;
         Plasma::LayoutAnimator *m_animator;
         QGraphicsLinearLayout *layout;
 
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to