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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/shells/desktop
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2009-08-25 13:48:36
Message-ID: 1251208116.329342.795.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1015420 by aseigo:

add a close button to the label at the top; hopefully this pleases everyone.
BUG:200745


 M  +14 -13    dashboardview.cpp  
 M  +2 -0      dashboardview.h  


--- trunk/KDE/kdebase/workspace/plasma/shells/desktop/dashboardview.cpp \
#1015419:1015420 @@ -24,6 +24,7 @@
 #include <QAction>
 #include <QKeyEvent>
 #include <QTimer>
+#include <QToolButton>
 
 #include <KWindowSystem>
 
@@ -44,6 +45,7 @@
     : Plasma::View(containment, 0),
       m_view(view),
       m_appletBrowser(0),
+      m_closeButton(new QToolButton(this)),
       m_suppressShow(false),
       m_zoomIn(false),
       m_zoomOut(false),
@@ -67,6 +69,13 @@
 
     installEventFilter(this);
 
+    QFont f = font();
+    f.bold();
+    const QFontMetrics fm(f);
+    m_closeButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
+    m_closeButton->resize(fm.height(), fm.height());
+    m_closeButton->setIcon(KIcon("window-close"));
+    connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hideView()));
     connect(scene(), SIGNAL(releaseVisualFocus()), SLOT(hideView()));
 }
 
@@ -99,13 +108,15 @@
     const QFontMetrics fm(f);
     const int margin = 6;
     const int textWidth = fm.width(text);
-    const QPoint centered(r.width() / 2 - textWidth / 2 - margin, r.y());
-    const QRect boundingBox(centered, QSize(margin * 2 + textWidth, fm.height() + \
margin * 2)); +    const QPoint centered(r.width() / 2 - textWidth / 2 - margin - \
margin / 2 - m_closeButton->width() / 2, r.y()); +    const QRect \
boundingBox(centered, QSize(margin * 3 + textWidth + m_closeButton->width(), \
fm.height() + margin * 2));  
     if (!viewport() || !event->rect().intersects(boundingBox)) {
         return;
     }
 
+    m_closeButton->move(boundingBox.right() - 6 - m_closeButton->width(), \
boundingBox.top() + margin); +
     QPainterPath box;
     box.moveTo(boundingBox.topLeft());
     box.lineTo(boundingBox.bottomLeft() + QPoint(0, -margin * 2));
@@ -125,7 +136,7 @@
     painter.setBrush(highlight);
     painter.drawPath(box);
     painter.setPen(palette().highlightedText().color());
-    painter.drawText(boundingBox, Qt::AlignCenter | Qt::AlignVCenter, text);
+    painter.drawText(boundingBox.adjusted(margin, 0, 0, 0), Qt::AlignLeft | \
Qt::AlignVCenter, text);  }
 
 void DashboardView::showAppletBrowser()
@@ -321,16 +332,6 @@
 {
     //kDebug() << "DashboardView::suppressShowTimeout";
     m_suppressShow = false;
-
-    KConfigGroup cg(KGlobal::config(), "Dashboard");
-    if (!cg.readEntry("DashboardShown", false)) {
-        // the first time we show the user the dashboard, expand
-        // the toolbox; some people don't know how to get out of it at first
-        // so we do this as a hint for them
-        containment()->openToolBox();
-        cg.writeEntry("DashboardShown", true);
-        configNeedsSaving();
-    }
 }
 
 void DashboardView::keyPressEvent(QKeyEvent *event)
--- trunk/KDE/kdebase/workspace/plasma/shells/desktop/dashboardview.h \
#1015419:1015420 @@ -25,6 +25,7 @@
 #include <Plasma/View>
 
 class QAction;
+class QToolButton;
 
 namespace Plasma
 {
@@ -70,6 +71,7 @@
 private:
     Plasma::View *m_view;
     Plasma::AppletBrowser *m_appletBrowser;
+    QToolButton *m_closeButton;
     QPoint m_appletBrowserDragStart;
     QAction *m_hideAction;
     bool m_suppressShow : 1;


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

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