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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/systemtray/ui
From:       Marco Martin <notmart () gmail ! com>
Date:       2009-05-11 21:06:08
Message-ID: 1242075968.497509.18609.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 966780 by mart:

use a button for more/less info
use the usual close button to clear the completed job list (with a space
between collapse and clear)


 M  +14 -5     applet.cpp  
 M  +9 -9      jobwidget.cpp  
 M  +4 -2      jobwidget.h  


--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/ui/applet.cpp \
#966779:966780 @@ -24,6 +24,7 @@
 
 #include <QtGui/QApplication>
 #include <QtGui/QGraphicsLayout>
+#include <QtGui/QGraphicsLinearLayout>
 #include <QtGui/QVBoxLayout>
 #include <QtGui/QIcon>
 #include <QtGui/QLabel>
@@ -111,6 +112,7 @@
     QDateTime lastActivity;
 
     Plasma::FrameSvg *background;
+    Plasma::Svg *icons;
     JobTotalsWidget *jobSummaryWidget;
     static SystemTray::Manager *s_manager;
     static int s_managerUsage;
@@ -135,6 +137,9 @@
     d->background->setCacheAllRenderedFrames(true);
     d->taskArea = new TaskArea(this);
 
+    d->icons = new Plasma::Svg(this);
+    d->icons->setImagePath("widgets/configuration-icons");
+
     setPopupIcon(QIcon());
     setPassivePopup(true);
     setAspectRatioMode(Plasma::IgnoreAspectRatio);
@@ -582,11 +587,15 @@
     }
 
     if (extenderItem->name() == "completedJobsGroup") {
-        Plasma::Label *label = new Plasma::Label(extenderItem);
-        label->setText(QString("<div align='right'><a \
                href='clear'>%1</a></div>").arg(i18n("clear all")));
-        label->setPreferredSize(label->minimumSize());
-        connect(label, SIGNAL(linkActivated(const QString &)), this, \
                SLOT(clearAllCompletedJobs()));
-        extenderItem->setWidget(label);
+        QGraphicsWidget *widget = new QGraphicsWidget(this);
+        widget->setMaximumHeight(0);
+        extenderItem->setWidget(widget);
+
+        QAction *clearAction = new QAction(this);
+        clearAction->setIcon(KIcon(d->icons->pixmap("close")));
+        extenderItem->addAction("space", new QAction(this));
+        extenderItem->addAction("clear", clearAction);
+        connect(clearAction, SIGNAL(triggered()), this, \
SLOT(clearAllCompletedJobs()));  return;
     }
 
--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/ui/jobwidget.cpp \
#966779:966780 @@ -34,6 +34,7 @@
 #include <Plasma/Theme>
 #include <Plasma/Label>
 #include <Plasma/Meter>
+#include <Plasma/PushButton>
 
 JobWidget::JobWidget(SystemTray::Job *job, Plasma::ExtenderItem *parent)
     : QGraphicsWidget(parent),
@@ -57,7 +58,7 @@
     m_dirCountLabel = new Plasma::Label(this);
     m_fileCountLabel = new Plasma::Label(this);
     m_eta = new Plasma::Label(this);
-    m_details = new Plasma::Label(this);
+    m_details = new Plasma::PushButton(this);
 
     m_totalBytesLabel->setVisible(false);
     m_dirCountLabel->setVisible(false);
@@ -71,7 +72,6 @@
     m_dirCountLabel->setAlignment(Qt::AlignRight);
     m_fileCountLabel->setAlignment(Qt::AlignRight);
     m_eta->setAlignment(Qt::AlignRight);
-    m_details->setAlignment(Qt::AlignLeft);
 
     m_fromLabel->nativeWidget()->setWordWrap(false);
     m_toLabel->nativeWidget()->setWordWrap(false);
@@ -92,12 +92,12 @@
     setMinimumWidth(350);
 
     if (m_job) {
-        m_details->setText("<a href=\"more\">" + i18n("More") + "</a>");
+        m_details->setText(i18n("More"));
 
         connect(m_job, SIGNAL(changed(SystemTray::Job*)), this, SLOT(updateJob()));
         connect(m_job, SIGNAL(destroyed(SystemTray::Job*)), m_extenderItem, \
                SLOT(destroy()));
-        connect(m_details, SIGNAL(linkActivated(const QString &)),
-                this, SLOT(detailsLinkClicked(const QString &)));
+        connect(m_details, SIGNAL(clicked()),
+                this, SLOT(detailsClicked()));
 
         //the suspend action
         QAction *suspendAction = new QAction(m_extenderItem);
@@ -258,10 +258,10 @@
     m_toLabel->setText(fm.elidedText(label1, Qt::ElideMiddle, \
m_toLabel->size().width()));  }
 
-void JobWidget::detailsLinkClicked(const QString &link)
+void JobWidget::detailsClicked()
 {
-    if (link == "more") {
-        m_details->setText("<a href=\"less\">" + i18n("less") + "</a>");
+    if (!m_totalBytesLabel->isVisible()) {
+        m_details->setText(i18n("less"));
         m_totalBytesLabel->setVisible(true);
         m_dirCountLabel->setVisible(true);
         m_fileCountLabel->setVisible(true);
@@ -270,7 +270,7 @@
         m_layout->addItem(m_dirCountLabel, 6, 1);
         m_extenderItem->setCollapsed(m_extenderItem->isCollapsed());
     } else {
-        m_details->setText("<a href=\"more\">" + i18n("more") + "</a>");
+        m_details->setText(i18n("more"));
         m_totalBytesLabel->setVisible(false);
         m_dirCountLabel->setVisible(false);
         m_fileCountLabel->setVisible(false);
--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/ui/jobwidget.h \
#966779:966780 @@ -30,10 +30,12 @@
 #include <Plasma/Service>
 #include <Plasma/ExtenderItem>
 #include <plasma/dataengine.h>
+#include <Plasma/PushButton>
 
 namespace Plasma
 {
     class ExtenderItem;
+    class PushButton;
     class Label;
     class Meter;
 } // namespace Plasma
@@ -58,7 +60,7 @@
         void resizeEvent(QGraphicsSceneResizeEvent *event);
 
     private Q_SLOTS:
-        void detailsLinkClicked(const QString &link);
+        void detailsClicked();
 
     private:
         void updateLabels();
@@ -75,7 +77,7 @@
         Plasma::Label *m_dirCountLabel;
         Plasma::Label *m_fileCountLabel;
         Plasma::Label *m_eta;
-        Plasma::Label *m_details;
+        Plasma::PushButton *m_details;
 
         QGraphicsGridLayout *m_layout;
 


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

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