diff --git a/applet/activatablelistwidget.cpp b/applet/activatablelistwidget.cpp index c2a458b..885e86a 100644 --- a/applet/activatablelistwidget.cpp +++ b/applet/activatablelistwidget.cpp @@ -137,12 +137,12 @@ void ActivatableListWidget::listAppeared() } } -void ActivatableListWidget::deactivateConnection() +void ActivatableListWidget::deactivateConnection(const QString& deviceUni) { foreach (ActivatableItem* item, m_itemIndex) { RemoteInterfaceConnection *conn = item->interfaceConnection(); - if (conn) { - kDebug() << "deactivating ..."; + if (conn && conn->deviceUni() == deviceUni) { + kDebug() << "deactivating" << conn->connectionName(); conn->deactivate(); } } diff --git a/applet/activatablelistwidget.h b/applet/activatablelistwidget.h index 602d5d3..992141b 100644 --- a/applet/activatablelistwidget.h +++ b/applet/activatablelistwidget.h @@ -47,7 +47,7 @@ public Q_SLOTS: void activatableRemoved(RemoteActivatable*); void listDisappeared(); void listAppeared(); - void deactivateConnection(); + void deactivateConnection(const QString& deviceUni); Q_SIGNALS: void connectionListUpdated(); diff --git a/applet/interfaceitem.cpp b/applet/interfaceitem.cpp index 2df1de4..d04aed0 100644 --- a/applet/interfaceitem.cpp +++ b/applet/interfaceitem.cpp @@ -95,7 +95,7 @@ InterfaceItem::InterfaceItem(Solid::Control::NetworkInterface * iface, NameDispl m_disconnectButton->setToolTip(i18n("Disconnect")); m_disconnectButton->hide(); // forward disconnect signal - connect(m_disconnectButton, SIGNAL(clicked()), this, SIGNAL(disconnectInterface())); + connect(m_disconnectButton, SIGNAL(clicked()), this, SLOT(emitDisconnectInterfaceRequest())); m_layout->addItem(m_disconnectButton, 0, 2, 1, 1, Qt::AlignRight); @@ -307,4 +307,10 @@ QPixmap InterfaceItem::statePixmap(const QString &icon) { return KIcon(icon).pixmap(QSize(KIconLoader::SizeMedium, KIconLoader::SizeMedium)); } +void InterfaceItem::emitDisconnectInterfaceRequest() +{ + kDebug() << m_iface->uni(); + emit disconnectInterfaceRequested(m_iface->uni()); +} + // vim: sw=4 sts=4 et tw=100 diff --git a/applet/interfaceitem.h b/applet/interfaceitem.h index e0802a3..0a47579 100644 --- a/applet/interfaceitem.h +++ b/applet/interfaceitem.h @@ -84,7 +84,7 @@ protected Q_SLOTS: Q_SIGNALS: void stateChanged(); - void disconnectInterface(); + void disconnectInterfaceRequested(const QString& deviceUni); protected: /** @@ -118,5 +118,8 @@ protected: QString m_interfaceName; bool m_disconnect; + +private Q_SLOTS: + void emitDisconnectInterfaceRequest(); }; #endif // APPLET_INTERFACEWIDGET_H diff --git a/applet/nmpopup.cpp b/applet/nmpopup.cpp index 200c425..885b152 100644 --- a/applet/nmpopup.cpp +++ b/applet/nmpopup.cpp @@ -227,11 +227,11 @@ void NMPopup::addInterfaceInternal(Solid::Control::NetworkInterface* iface) wifiItem->setEnabled(Solid::Control::NetworkManager::isWirelessEnabled()); //createTab(ifaceItem, iface, i18nc("title of the wireless tab", "Wireless"), "network-wireless"); kDebug() << "WiFi added"; - connect(wifiItem, SIGNAL(disconnectInterface()), m_wirelessList, SLOT(deactivateConnection())); + connect(wifiItem, SIGNAL(disconnectInterfaceRequested(const QString&)), m_wirelessList, SLOT(deactivateConnection(const QString&))); } else { // Create the interfaceitem ifaceItem = new InterfaceItem(static_cast(iface), InterfaceItem::InterfaceName, this); - connect(ifaceItem, SIGNAL(disconnectInterface()), m_connectionList, SLOT(deactivateConnection())); + connect(ifaceItem, SIGNAL(disconnectInterfaceRequested(const QString&)), m_connectionList, SLOT(deactivateConnection(const QString&))); } // Catch connection changes connect(iface, SIGNAL(connectionStateChanged(int,int,int)), this, SLOT(handleConnectionStateChange(int,int,int)));