[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bnetworkmanagement=5D_libs/service=3A_Prevents_crash?=
From: "Lamarque V.Souza" <lamarque () gmail ! com>
Date: 2011-03-01 3:19:56
Message-ID: 20110301031956.8B5F6A60CB () git ! kde ! org
[Download RAW message or body]
Git commit ea121ad1b5ff84a41369c9755cc746a078674db5 by Lamarque V. Souza.
Committed on 01/03/2011 at 04:18.
Pushed by lvsouza into branch 'master'.
Prevents crash when notifying one interface has been removed.
M +10 -3 libs/service/notificationmanager.cpp
M +2 -0 libs/service/notificationmanager.h
http://commits.kde.org/networkmanagement/ea121ad1b5ff84a41369c9755cc746a078674db5
diff --git a/libs/service/notificationmanager.cpp \
b/libs/service/notificationmanager.cpp index a1f6c85..4084b48 100644
--- a/libs/service/notificationmanager.cpp
+++ b/libs/service/notificationmanager.cpp
@@ -41,7 +41,7 @@ License along with this library. If not, see \
<http://www.gnu.org/licenses/>. #include "events.h"
#include "../internals/connection.h"
-static int iconSize = 48;
+static const int iconSize = 48;
Knm::Connection::Type solidToKnmType(const Solid::Control::NetworkInterface::Type \
sType);
K_GLOBAL_STATIC_WITH_ARGS(KComponentData, s_networkManagementComponentData, \
("networkmanagement", "networkmanagement", \
KComponentData::SkipMainComponentRegistration)) @@ -50,6 +50,9 @@ \
InterfaceNotificationHost::InterfaceNotificationHost(Solid::Control::NetworkInte {
// Keep a record for when it is removed
m_interfaceNameLabel = UiUtils::interfaceNameLabel(interface->uni());
+
+ // For the notification icon
+ m_type = interface->type();
QObject::connect(interface, SIGNAL(connectionStateChanged(int,int,int)),
this, SLOT(interfaceConnectionStateChanged(int,int,int)));
@@ -79,6 +82,11 @@ QString InterfaceNotificationHost::label() const
return m_interfaceNameLabel;
}
+Solid::Control::NetworkInterface::Type InterfaceNotificationHost::type() const
+{
+ return m_type;
+}
+
void InterfaceNotificationHost::removeInterfaceConnection(Knm::InterfaceConnection * \
ic) {
if (ic) {
@@ -494,8 +502,7 @@ void NotificationManager::networkInterfaceRemoved(const QString \
&uni)
notificationText = i18nc("@info:status Notification for hardware removed \
used if we don't have its user-visible name", "Network interface removed"); }
- Solid::Control::NetworkInterface * iface = \
Solid::Control::NetworkManager::findNetworkInterface(uni);
- KNotification::event(Event::HwRemoved, notificationText, \
KIcon(Knm::Connection::iconName(solidToKnmType(iface->type()))).pixmap(QSize(iconSize,iconSize)), \
0, KNotification::CloseOnTimeout, componentData()); + \
KNotification::event(Event::HwRemoved, notificationText, \
KIcon(Knm::Connection::iconName(solidToKnmType(host->type()))).pixmap(QSize(iconSize,iconSize)), \
0, KNotification::CloseOnTimeout, componentData()); }
}
diff --git a/libs/service/notificationmanager.h b/libs/service/notificationmanager.h
index 9b43902..41e52d7 100644
--- a/libs/service/notificationmanager.h
+++ b/libs/service/notificationmanager.h
@@ -85,6 +85,7 @@ public:
void removeInterfaceConnection(Knm::InterfaceConnection* removed);
QString label() const;
+ Solid::Control::NetworkInterface::Type type() const;
public Q_SLOTS:
/*
* Update notification with with state changes for iface's active connections
@@ -103,6 +104,7 @@ private:
Solid::Control::NetworkInterface * m_interface;
// used to refer to the interface if it is removed
QString m_interfaceNameLabel;
+ Solid::Control::NetworkInterface::Type m_type;
QPointer<KNotification> m_notification;
QSet<Knm::InterfaceConnection*> m_activating;
QSet<Knm::InterfaceConnection*> m_interfaceConnections;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic