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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/applets/devicenotifier
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-03-09 2:37:40
Message-ID: 1268102260.475523.29455.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1100954 by aseigo:

more accurate text
BUG:230021


 M  +10 -5     notifierdialog.cpp  
 M  +3 -2      notifierdialog.h  


--- trunk/KDE/kdebase/workspace/plasma/generic/applets/devicenotifier/notifierdialog.cpp \
#1100953:1100954 @@ -56,6 +56,7 @@
     : QObject(parent),
       m_widget(0),
       m_notifier(notifier),
+      m_deviceCount(0),
       m_collapsing(false)
 {
     buildDialog();
@@ -127,6 +128,7 @@
         return;
     }
 
+    ++m_deviceCount;
     DeviceItem *devItem = new DeviceItem(udi);
     connect(devItem, SIGNAL(leftActionActivated(DeviceItem *)), this, \
                SLOT(leftActionActivated(DeviceItem *)));
     connect(devItem, SIGNAL(actionActivated(DeviceItem *, const QString &, const \
QString &)), @@ -416,6 +418,7 @@
     resetSelection();
     m_deviceLayout->removeItem(item);
     item->deleteLater();
+    --m_deviceCount;
 
     for (int i = 0; i < m_deviceLayout->count(); ++i) {
         Plasma::Separator *separator = dynamic_cast<Plasma::Separator \
*>(m_deviceLayout->itemAt(i)); @@ -424,9 +427,11 @@
             if (!nextItem) {
                 m_deviceLayout->removeAt(i);
                 QGraphicsLayoutItem *category = m_deviceLayout->itemAt(i);
-                m_deviceLayout->removeAt(i);
+                if (category) {
+                    m_deviceLayout->removeAt(i);
+                    delete category;
+                }
                 delete separator;
-                delete category;
                 --i;
             }
         }
@@ -816,10 +821,10 @@
 
 void NotifierDialog::updateMainLabelText()
 {
-    if (m_deviceLayout->count() == 0) {
-        m_mainLabel->setText(i18n("No devices plugged in."));
+    if (m_deviceCount > 0) {
+        m_mainLabel->setText(i18n("Available Devices"));
     } else {
-        m_mainLabel->setText(i18n("Devices recently plugged in:"));
+        m_mainLabel->setText(i18n("No Devices Available"));
     }
 }
 
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/devicenotifier/notifierdialog.h \
#1100953:1100954 @@ -331,6 +331,7 @@
           DeviceItem* hoveredItem();
           Plasma::IconWidget* hoveredAction();
 
+    private:
           /// The graphics widget which displays the panel
           QGraphicsWidget *m_widget;
 
@@ -361,9 +362,9 @@
 
           QTimer m_clearItemBackgroundTargetTimer;
 
+          Plasma::Label *m_mainLabel;
+          int m_deviceCount;
           bool m_collapsing;
-
-          Plasma::Label *m_mainLabel;
   };
 
 }


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

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