Hello, Will
Please, review patches. First is extract-utils, which allows string functions
from tooltipbuilder to use by others, second is connection-info, which makes
connection properties window.
--
Thanks,
Andrey
diff -r de0dc7204841 monolithic/CMakeLists.txt
--- a/monolithic/CMakeLists.txt Thu Nov 05 18:35:52 2009 +0200
+++ b/monolithic/CMakeLists.txt Sun Nov 08 03:45:35 2009 +0200
@@ -37,6 +37,9 @@
# helper class
tooltipbuilder.cpp
+ # helper functions
+ utils.cpp
+
# other networks dialog
otherwirelessnetworkdialog.cpp
)
diff -r de0dc7204841 monolithic/knetworkmanagertrayicon.cpp
--- a/monolithic/knetworkmanagertrayicon.cpp Thu Nov 05 18:35:52 2009 +0200
+++ b/monolithic/knetworkmanagertrayicon.cpp Sun Nov 08 03:45:35 2009 +0200
@@ -53,6 +53,7 @@
#include "wirelessinterfaceconnectionitem.h"
#include "unconfiguredinterfaceitem.h"
#include "wirelessnetworkitem.h"
+#include "utils.h"
Q_DECLARE_METATYPE(Knm::Activatable *)
@@ -509,38 +510,7 @@
Q_D(KNetworkManagerTrayIcon);
QString tip;
if (d->displayedNetworkInterface) {
- switch (d->displayedNetworkInterface->connectionState()) {
- case Solid::Control::NetworkInterface::UnknownState:
- tip = i18nc("@info:tooltip status string for network interface in unknown state state ", "Unknown");
- break;
- case Solid::Control::NetworkInterface::Unmanaged:
- tip = i18nc("@info:tooltip status string for network interface not managed by networking subsystem", "Not managed");
- break;
- case Solid::Control::NetworkInterface::Unavailable:
- tip = i18nc("@info:tooltip status string for network interface not available for use", "Unavailable");
- break;
- case Solid::Control::NetworkInterface::Disconnected:
- tip = i18nc("@info:tooltip status string for disconnected network interface", "Not connected");
- break;
- case Solid::Control::NetworkInterface::Preparing:
- tip = i18nc("@info:tooltip status string for network interface preparing to connect", "Preparing to connect");
- break;
- case Solid::Control::NetworkInterface::Configuring:
- tip = i18nc("@info:tooltip status string for network interface being configured prior to connection", "Configuring interface");
- break;
- case Solid::Control::NetworkInterface::NeedAuth:
- tip = i18nc("@info:tooltip status string for network interface awaiting authorizatoin", "Waiting for authorization");
- break;
- case Solid::Control::NetworkInterface::IPConfig:
- tip = i18nc("@info:tooltip status string for network interface getting IP address", "Obtaining network address");
- break;
- case Solid::Control::NetworkInterface::Activated:
- tip = i18nc("@info:tooltip status string for active network interface", "Active");
- break;
- case Solid::Control::NetworkInterface::Failed:
- tip = i18nc("@info:tooltip status string for network interface with failed connection", "Connection failed");
- break;
- }
+ tip = connectionStateToString(d->displayedNetworkInterface->connectionState());
} else {
tip = "<qt>Networking <b>information</b> not available</qt>";
}
diff -r de0dc7204841 monolithic/tooltipbuilder.cpp
--- a/monolithic/tooltipbuilder.cpp Thu Nov 05 18:35:52 2009 +0200
+++ b/monolithic/tooltipbuilder.cpp Sun Nov 08 03:45:35 2009 +0200
@@ -39,102 +39,7 @@
#include <knmserviceprefs.h>
#include <wirelesssecurityidentifier.h>
-// probably these functions should be in a separate file to be
-// easily included from different places.
-QString interfaceTypeToString(Solid::Control::NetworkInterface::Type type)
-{
- QString str;
- switch (type) {
- case Solid::Control::NetworkInterface::UnknownType:
- str = i18n("Unknown type");
- break;
- case Solid::Control::NetworkInterface::Ieee8023:
- str = i18nc("The network interface type","Ethernet");
- break;
- case Solid::Control::NetworkInterface::Ieee80211:
- str = i18nc("The network interface type","Wi-Fi");
- break;
- case Solid::Control::NetworkInterface::Serial:
- str = i18nc("The network interface type","Serial");
- break;
- case Solid::Control::NetworkInterface::Gsm:
- str = i18nc("The network interface type","GSM");
- break;
- case Solid::Control::NetworkInterface::Cdma:
- str = i18nc("The network interface type","CDMA");
- break;
- default:
- // oops, we need update this function, or something went wrong
- break;
- }
-
- return str;
-}
-
-QString connectionStateToString(Solid::Control::NetworkInterface::ConnectionState state)
-{
- QString stateString;
- switch (state) {
- case Solid::Control::NetworkInterface::UnknownState:
- stateString = i18nc("description of unknown network interface state", "Unknown");
- break;
- case Solid::Control::NetworkInterface::Unmanaged:
- stateString = i18nc("description of unmanaged network interface state", "Unmanaged");
- break;
- case Solid::Control::NetworkInterface::Unavailable:
- stateString = i18nc("description of unavailable network interface state", "Unavailable");
- break;
- case Solid::Control::NetworkInterface::Disconnected:
- stateString = i18nc("description of unconnected network interface state", "Not connected");
- break;
- case Solid::Control::NetworkInterface::Preparing:
- stateString = i18nc("description of preparing to connect network interface state", "Preparing to connect");
- break;
- case Solid::Control::NetworkInterface::Configuring:
- stateString = i18nc("description of configuring hardware network interface state", "Configuring interface");
- break;
- case Solid::Control::NetworkInterface::NeedAuth:
- stateString = i18nc("description of waiting for authentication network interface state", "Waiting for authorization");
- break;
- case Solid::Control::NetworkInterface::IPConfig:
- stateString = i18nc("network interface doing dhcp request in most cases", "Setting network address");
- break;
- case Solid::Control::NetworkInterface::Activated:
- stateString = i18nc("network interface connected state label", "Connected");
- break;
- case Solid::Control::NetworkInterface::Failed:
- stateString = i18nc("network interface connection failed state label", "Connection Failed");
- break;
- default:
- stateString = I18N_NOOP("UNKNOWN STATE FIX ME");
- }
- return stateString;
-}
-
-QString operationModeToString(Solid::Control::WirelessNetworkInterface::OperationMode mode)
-{
- QString modeString;
- switch (mode) {
- case Solid::Control::WirelessNetworkInterface::Unassociated:
- modeString = i18nc("wireless network operation mode", "Unassociated");
- break;
- case Solid::Control::WirelessNetworkInterface::Adhoc:
- modeString = i18nc("wireless network operation mode", "Adhoc");
- break;
- case Solid::Control::WirelessNetworkInterface::Managed:
- modeString = i18nc("wireless network operation mode", "Managed");
- break;
- case Solid::Control::WirelessNetworkInterface::Master:
- modeString = i18nc("wireless network operation mode", "Master");
- break;
- case Solid::Control::WirelessNetworkInterface::Repeater:
- modeString = i18nc("wireless network operation mode", "Repeater");
- break;
- default:
- modeString = I18N_NOOP("UNKNOWN MODE FIX ME");
- }
- return modeString;
-}
+#include "utils.h"
// private functions. Not included in the ToolTipBuilder class.
QString interfaceTooltipHtmlPart(Solid::Control::NetworkInterface *, const QString &);
@@ -479,42 +384,7 @@
{
QString table = QLatin1String("<table>");
- /* for testing purposes
- flags = Solid::Control::AccessPoint::PairWep40
- | Solid::Control::AccessPoint::PairWep104
- | Solid::Control::AccessPoint::PairTkip
- | Solid::Control::AccessPoint::PairCcmp
- | Solid::Control::AccessPoint::GroupWep40
- | Solid::Control::AccessPoint::GroupWep104
- | Solid::Control::AccessPoint::GroupTkip
- | Solid::Control::AccessPoint::GroupCcmp
- | Solid::Control::AccessPoint::KeyMgmtPsk
- | Solid::Control::AccessPoint::KeyMgmt8021x; */
-
- QStringList flagList;
-
- if (flags.testFlag(Solid::Control::AccessPoint::PairWep40))
- flagList.append(QLatin1String("Pairwise WEP40"));
- if (flags.testFlag(Solid::Control::AccessPoint::PairWep104))
- flagList.append(QLatin1String("Pairwise WEP104"));
- if (flags.testFlag(Solid::Control::AccessPoint::PairTkip))
- flagList.append(QLatin1String("Pairwise TKIP"));
- if (flags.testFlag(Solid::Control::AccessPoint::PairCcmp))
- flagList.append(QLatin1String("Pairwise CCMP"));
- if (flags.testFlag(Solid::Control::AccessPoint::GroupWep40))
- flagList.append(QLatin1String("Group WEP40"));
- if (flags.testFlag(Solid::Control::AccessPoint::GroupWep104))
- flagList.append(QLatin1String("Group WEP104"));
- if (flags.testFlag(Solid::Control::AccessPoint::GroupTkip))
- flagList.append(QLatin1String("Group TKIP"));
- if (flags.testFlag(Solid::Control::AccessPoint::GroupCcmp))
- flagList.append(QLatin1String("Group CCMP"));
- if (flags.testFlag(Solid::Control::AccessPoint::KeyMgmtPsk))
- flagList.append(QLatin1String("PSK"));
- if (flags.testFlag(Solid::Control::AccessPoint::KeyMgmt8021x))
- flagList.append(QLatin1String("802.1x"));
-
- table += buildHtmlTableHelper(flagList, 2);
+ table += buildHtmlTableHelper(wpaFlagsToStringList(flags), 2);
table += QLatin1String("</table>");
return table;
diff -r de0dc7204841 monolithic/utils.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/utils.cpp Sun Nov 08 03:45:35 2009 +0200
@@ -0,0 +1,156 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <KLocale>
+
+#include "utils.h"
+
+const QString interfaceTypeToString(Solid::Control::NetworkInterface::Type type)
+{
+ QString str;
+ switch (type) {
+ case Solid::Control::NetworkInterface::UnknownType:
+ str = i18n("Unknown type");
+ break;
+ case Solid::Control::NetworkInterface::Ieee8023:
+ str = i18nc("The network interface type","Ethernet");
+ break;
+ case Solid::Control::NetworkInterface::Ieee80211:
+ str = i18nc("The network interface type","Wi-Fi");
+ break;
+ case Solid::Control::NetworkInterface::Serial:
+ str = i18nc("The network interface type","Serial");
+ break;
+ case Solid::Control::NetworkInterface::Gsm:
+ str = i18nc("The network interface type","GSM");
+ break;
+ case Solid::Control::NetworkInterface::Cdma:
+ str = i18nc("The network interface type","CDMA");
+ break;
+ default:
+ str = I18N_NOOP("INCORRECT TYPE FIX ME");
+ }
+
+ return str;
+}
+
+const QString connectionStateToString(Solid::Control::NetworkInterface::ConnectionState state)
+{
+ QString stateString;
+ switch (state) {
+ case Solid::Control::NetworkInterface::UnknownState:
+ stateString = i18nc("description of unknown network interface state", "Unknown");
+ break;
+ case Solid::Control::NetworkInterface::Unmanaged:
+ stateString = i18nc("description of unmanaged network interface state", "Unmanaged");
+ break;
+ case Solid::Control::NetworkInterface::Unavailable:
+ stateString = i18nc("description of unavailable network interface state", "Unavailable");
+ break;
+ case Solid::Control::NetworkInterface::Disconnected:
+ stateString = i18nc("description of unconnected network interface state", "Not connected");
+ break;
+ case Solid::Control::NetworkInterface::Preparing:
+ stateString = i18nc("description of preparing to connect network interface state", "Preparing to connect");
+ break;
+ case Solid::Control::NetworkInterface::Configuring:
+ stateString = i18nc("description of configuring hardware network interface state", "Configuring interface");
+ break;
+ case Solid::Control::NetworkInterface::NeedAuth:
+ stateString = i18nc("description of waiting for authentication network interface state", "Waiting for authorization");
+ break;
+ case Solid::Control::NetworkInterface::IPConfig:
+ stateString = i18nc("network interface doing dhcp request in most cases", "Setting network address");
+ break;
+ case Solid::Control::NetworkInterface::Activated:
+ stateString = i18nc("network interface connected state label", "Connected");
+ break;
+ case Solid::Control::NetworkInterface::Failed:
+ stateString = i18nc("network interface connection failed state label", "Connection Failed");
+ break;
+ default:
+ stateString = I18N_NOOP("INCORRECT STATE FIX ME");
+ }
+ return stateString;
+}
+
+const QString operationModeToString(Solid::Control::WirelessNetworkInterface::OperationMode mode)
+{
+ QString modeString;
+ switch (mode) {
+ case Solid::Control::WirelessNetworkInterface::Unassociated:
+ modeString = i18nc("wireless network operation mode", "Unassociated");
+ break;
+ case Solid::Control::WirelessNetworkInterface::Adhoc:
+ modeString = i18nc("wireless network operation mode", "Adhoc");
+ break;
+ case Solid::Control::WirelessNetworkInterface::Managed:
+ modeString = i18nc("wireless network operation mode", "Managed");
+ break;
+ case Solid::Control::WirelessNetworkInterface::Master:
+ modeString = i18nc("wireless network operation mode", "Master");
+ break;
+ case Solid::Control::WirelessNetworkInterface::Repeater:
+ modeString = i18nc("wireless network operation mode", "Repeater");
+ break;
+ default:
+ modeString = I18N_NOOP("INCORRECT MODE FIX ME");
+ }
+ return modeString;
+}
+
+const QStringList wpaFlagsToStringList(Solid::Control::AccessPoint::WpaFlags flags)
+{
+ /* for testing purposes
+ flags = Solid::Control::AccessPoint::PairWep40
+ | Solid::Control::AccessPoint::PairWep104
+ | Solid::Control::AccessPoint::PairTkip
+ | Solid::Control::AccessPoint::PairCcmp
+ | Solid::Control::AccessPoint::GroupWep40
+ | Solid::Control::AccessPoint::GroupWep104
+ | Solid::Control::AccessPoint::GroupTkip
+ | Solid::Control::AccessPoint::GroupCcmp
+ | Solid::Control::AccessPoint::KeyMgmtPsk
+ | Solid::Control::AccessPoint::KeyMgmt8021x; */
+
+ QStringList flagList;
+
+ if (flags.testFlag(Solid::Control::AccessPoint::PairWep40))
+ flagList.append(i18nc("wireless network cipher", "Pairwise WEP40"));
+ if (flags.testFlag(Solid::Control::AccessPoint::PairWep104))
+ flagList.append(i18nc("wireless network cipher", "Pairwise WEP104"));
+ if (flags.testFlag(Solid::Control::AccessPoint::PairTkip))
+ flagList.append(i18nc("wireless network cipher", "Pairwise TKIP"));
+ if (flags.testFlag(Solid::Control::AccessPoint::PairCcmp))
+ flagList.append(i18nc("wireless network cipher", "Pairwise CCMP"));
+ if (flags.testFlag(Solid::Control::AccessPoint::GroupWep40))
+ flagList.append(i18nc("wireless network cipher", "Group WEP40"));
+ if (flags.testFlag(Solid::Control::AccessPoint::GroupWep104))
+ flagList.append(i18nc("wireless network cipher", "Group WEP104"));
+ if (flags.testFlag(Solid::Control::AccessPoint::GroupTkip))
+ flagList.append(i18nc("wireless network cipher", "Group TKIP"));
+ if (flags.testFlag(Solid::Control::AccessPoint::GroupCcmp))
+ flagList.append(i18nc("wireless network cipher", "Group CCMP"));
+ if (flags.testFlag(Solid::Control::AccessPoint::KeyMgmtPsk))
+ flagList.append(i18nc("wireless network cipher", "PSK"));
+ if (flags.testFlag(Solid::Control::AccessPoint::KeyMgmt8021x))
+ flagList.append(i18nc("wireless network cipher", "802.1x"));
+
+ return flagList;
+}
diff -r de0dc7204841 monolithic/utils.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/utils.h Sun Nov 08 03:45:35 2009 +0200
@@ -0,0 +1,37 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <solid/control/networkinterface.h>
+#include <solid/control/wirelessnetworkinterface.h>
+#include <solid/control/wirelessaccesspoint.h>
+
+/** Returns string representation of interface type. */
+const QString interfaceTypeToString(Solid::Control::NetworkInterface::Type type);
+/** Returns string representation of connection state. */
+const QString connectionStateToString(Solid::Control::NetworkInterface::ConnectionState state);
+/** Returns string representation of operation mode. */
+const QString operationModeToString(Solid::Control::WirelessNetworkInterface::OperationMode mode);
+/** Returns string list, representing wpa flags. */
+const QStringList wpaFlagsToStringList(Solid::Control::AccessPoint::WpaFlags flags);
+
+#endif // UTILS_H
diff -r 325b214839c9 monolithic/CMakeLists.txt
--- a/monolithic/CMakeLists.txt Sun Nov 08 14:13:30 2009 +0200
+++ b/monolithic/CMakeLists.txt Sun Nov 08 15:58:15 2009 +0200
@@ -42,9 +42,18 @@
# other networks dialog
otherwirelessnetworkdialog.cpp
+
+ # connection info
+ connectioninfodialog.cpp
+ connectioninfoipv4tab.cpp
+ connectioninfowiredtab.cpp
+ connectioninfowirelesstab.cpp
)
-kde4_add_ui_files(monolithic_SRCS otherwirelessnetworkwidget.ui)
+kde4_add_ui_files(monolithic_SRCS
+ otherwirelessnetworkwidget.ui
+ connectioninfowidget.ui
+ )
kde4_add_executable(knetworkmanager ${monolithic_SRCS})
diff -r 325b214839c9 monolithic/connectioninfodialog.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfodialog.cpp Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,120 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <KLocale>
+
+#include "connectioninfodialog.h"
+#include "connectioninfoipv4tab.h"
+#include "connectioninfowiredtab.h"
+#include "connectioninfowirelesstab.h"
+
+#include <solid/control/networkmanager.h>
+
+#include "utils.h"
+
+
+ConnectionInfoDialog::ConnectionInfoDialog(Knm::InterfaceConnection *ic, QWidget *parent)
+ : KDialog(parent), ic(ic), guiMade(false)
+{
+ QWidget *mainWidget = new QWidget(this);
+ ui.setupUi(mainWidget);
+ setMainWidget(mainWidget);
+
+ ui.connectionName->setText(ic->connectionName());
+
+ connect(ic, SIGNAL(activationStateChanged(Knm::InterfaceConnection::ActivationState)),
+ this, SLOT(interfaceConnectionStateChanged(Knm::InterfaceConnection::ActivationState)));
+
+ interfaceConnectionStateChanged(ic->activationState());
+
+ setAttribute(Qt::WA_DeleteOnClose);
+ setButtons(KDialog::Close);
+}
+
+ConnectionInfoDialog::~ConnectionInfoDialog()
+{
+}
+
+
+void ConnectionInfoDialog::interfaceConnectionStateChanged(Knm::InterfaceConnection::ActivationState state)
+{
+ if (state == Knm::InterfaceConnection::Unknown) {
+ if (guiMade)
+ clearGUI();
+ ui.connectionState->setText("");
+ } else {
+ if (!guiMade)
+ buildGUI();
+ }
+}
+
+void ConnectionInfoDialog::buildGUI()
+{
+ QString deviceUni = ic->deviceUni();
+ iface = Solid::Control::NetworkManager::findNetworkInterface(deviceUni);
+
+ ConnectionInfoIPv4Tab *ipTab = new ConnectionInfoIPv4Tab(iface, ui.infoTabWidget);
+ ui.infoTabWidget->addTab(ipTab, "IP");
+
+ QString tabName = interfaceTypeToString(iface->type());
+
+ switch (iface->type()) {
+ case Solid::Control::NetworkInterface::Ieee8023: {
+ ConnectionInfoWiredTab *wiredTab = new ConnectionInfoWiredTab(qobject_cast<Solid::Control::WiredNetworkInterface*>(iface), ui.infoTabWidget);
+
+ ui.infoTabWidget->addTab(wiredTab, tabName);
+ ui.connectionIcon->setPixmap(KIconLoader::global()->loadIcon("network-wired", KIconLoader::Panel));
+ break;
+ }
+ case Solid::Control::NetworkInterface::Ieee80211: {
+ ConnectionInfoWirelessTab *wirelessTab = new ConnectionInfoWirelessTab(qobject_cast<Solid::Control::WirelessNetworkInterface*>(iface), ui.infoTabWidget);
+
+ ui.infoTabWidget->addTab(wirelessTab, tabName);
+ ui.connectionIcon->setPixmap(KIconLoader::global()->loadIcon("network-wireless", KIconLoader::Panel));
+ break;
+ }
+ }
+
+ connect(iface, SIGNAL(connectionStateChanged(int,int,int)), this, SLOT(updateConnectionState(int,int,int)));
+
+ Solid::Control::NetworkInterface::ConnectionState state = iface->connectionState();
+ ui.connectionState->setText(connectionStateToString(state));
+ guiMade = true;
+}
+
+void ConnectionInfoDialog::clearGUI()
+{
+ disconnect(iface, SIGNAL(connectionStateChanged(int,int,int)), this, SLOT(updateConnectionState(int,int,int)));
+ int tabCount = ui.infoTabWidget->count();
+ while (tabCount--) {
+ QWidget *w = ui.infoTabWidget->widget(0);
+ ui.infoTabWidget->removeTab(0);
+ delete w;
+ }
+ ui.connectionState->setText("");
+ guiMade = false;
+}
+
+void ConnectionInfoDialog::updateConnectionState(int new_state, int old_state, int reason)
+{
+ ui.connectionState->setText(connectionStateToString((Solid::Control::NetworkInterface::ConnectionState) new_state));
+/* Solid::Control::NetworkInterface::ConnectionState state = iface->connectionState();
+ if (ic->activationState() != Knm::InterfaceConnection::Unknown)
+ ui.connectionState->setText(connectionStateToString(state));*/
+}
diff -r 325b214839c9 monolithic/connectioninfodialog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfodialog.h Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,53 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef CONNECTIONINFODIALOG_H
+#define CONNECTIONINFODIALOG_H
+
+#include <QtGui/QWidget>
+#include <KDialog>
+
+#include <interfaceconnection.h>
+
+#include <solid/control/networkinterface.h>
+#include <solid/control/networkipv4config.h>
+
+#include "ui_connectioninfowidget.h"
+
+class ConnectionInfoDialog : public KDialog {
+ Q_OBJECT
+
+public:
+ ConnectionInfoDialog(Knm::InterfaceConnection *ic, QWidget *parent = 0);
+ ~ConnectionInfoDialog();
+
+public slots:
+ void interfaceConnectionStateChanged(Knm::InterfaceConnection::ActivationState);
+ void updateConnectionState(int new_state, int old_state, int reason);
+
+private:
+ void buildGUI();
+ void clearGUI();
+ Ui_ConnectionInfoWidget ui;
+ Knm::InterfaceConnection *ic;
+ Solid::Control::NetworkInterface *iface;
+ bool guiMade;
+};
+
+#endif // CONNECTIONINFOWIDGET_H
diff -r 325b214839c9 monolithic/connectioninfoipv4tab.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfoipv4tab.cpp Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,87 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <kdeversion.h>
+
+#include "connectioninfoipv4tab.h"
+
+#include "utils.h"
+
+#if KDE_IS_VERSION(4, 3, 67)
+#else
+#include <arpa/inet.h>
+#endif
+
+ConnectionInfoIPv4Tab::ConnectionInfoIPv4Tab(Solid::Control::NetworkInterface *iface, QWidget *parent)
+ : QWidget(parent), iface(iface)
+{
+ QFormLayout *layout = new QFormLayout(this);
+ setLayout(layout);
+
+ ipAddressesLabel = new QLabel(this);
+ layout->addRow("IP Addresses: ", ipAddressesLabel);
+
+ netmasksLabel = new QLabel(this);
+ layout->addRow("Netmasks: ", netmasksLabel);
+
+ gatewaysLabel = new QLabel(this);
+ layout->addRow("Gateways: ", gatewaysLabel);
+
+ nameserversLabel = new QLabel(this);
+ layout->addRow("Nameservers: ", nameserversLabel);
+
+ domainsLabel = new QLabel(this);
+ layout->addRow("Search domains: ", domainsLabel);
+
+ connect(iface, SIGNAL(ipDetailsChanged()), this, SLOT(updateIpDetails()));
+ connect(iface, SIGNAL(connectionStateChanged(int,int,int)), this, SLOT(updateIpDetails()));
+ updateIpDetails();
+}
+
+void ConnectionInfoIPv4Tab::updateIpDetails()
+{
+ const Solid::Control::IPv4Config &config = iface->ipV4Config();
+
+ QStringList ipAddresses,
+ netmasks,
+ gateways;
+ foreach(Solid::Control::IPv4Address addr, config.addresses()) {
+ ipAddresses << QHostAddress(addr.address()).toString();
+#if 1//KDE_IS_VERSION(4, 3, 67)
+ netmasks << QHostAddress((0xffffffff) << (32 - addr.netMask())).toString();
+#else
+ netmasks << QHostAddress((0xffffffff) << (32 - ntohl(addr.netMask()))).toString();
+#endif
+ gateways << QHostAddress(addr.gateway()).toString();
+ }
+ ipAddressesLabel->setText(ipAddresses.join("\n"));
+ netmasksLabel->setText(netmasks.join("\n"));
+ gatewaysLabel->setText(gateways.join("\n"));
+
+ QStringList nameservers;
+ foreach(quint32 addr, config.nameservers())
+#if 1//KDE_IS_VERSION(4, 3, 67)
+ nameservers << QHostAddress(addr).toString();
+#else
+ nameservers << QHostAddress(htonl(addr)).toString();
+#endif
+ nameserversLabel->setText(nameservers.join("\n"));
+
+ domainsLabel->setText(config.domains().join("\n"));
+}
diff -r 325b214839c9 monolithic/connectioninfoipv4tab.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfoipv4tab.h Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,52 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef CONNECTIONINFOIPV4TAB_H
+#define CONNECTIONINFOIPV4TAB_H
+
+#include <QtGui>
+
+#include <solid/control/networkinterface.h>
+#include <solid/control/networkipv4config.h>
+
+class ConnectionInfoIPv4Tab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ ConnectionInfoIPv4Tab(Solid::Control::NetworkInterface *iface, QWidget *parent = 0);
+ ~ConnectionInfoIPv4Tab() { };
+
+public slots:
+ void updateIpDetails();
+
+private:
+ Solid::Control::NetworkInterface *iface;
+ QLabel *connectionStateLabel,
+ *ipAddressesLabel,
+ *netmasksLabel,
+ *gatewaysLabel,
+ *nameserversLabel,
+ *domainsLabel;
+};
+
+#endif // CONNECTIONINFOIPV4TAB_H
diff -r 325b214839c9 monolithic/connectioninfowidget.ui
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfowidget.ui Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConnectionInfoWidget</class>
+ <widget class="QWidget" name="ConnectionInfoWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>355</width>
+ <height>375</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="connectionIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="connectionName">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>connectionName</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="connectionState">
+ <property name="text">
+ <string>connectionState</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="KTabWidget" name="infoTabWidget"/>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KTabWidget</class>
+ <extends>QTabWidget</extends>
+ <header>ktabwidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff -r 325b214839c9 monolithic/connectioninfowiredtab.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfowiredtab.cpp Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,44 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "connectioninfowiredtab.h"
+
+ConnectionInfoWiredTab::ConnectionInfoWiredTab(Solid::Control::WiredNetworkInterface *iface, QWidget *parent)
+ : QWidget(parent), iface(iface)
+{
+ QFormLayout *layout = new QFormLayout(this);
+ setLayout(layout);
+
+ bitRateLabel = new QLabel(this);
+ layout->addRow("Bit rate: ", bitRateLabel);
+
+ hardwareAddressLabel = new QLabel(this);
+ layout->addRow("Hardware address: ", hardwareAddressLabel);
+
+ connect(iface, SIGNAL(bitRateChanged(int)), this, SLOT(updateBitRate(int)));
+
+ // populate initial values
+ updateBitRate(iface->bitRate());
+ hardwareAddressLabel->setText(iface->hardwareAddress());
+}
+
+void ConnectionInfoWiredTab::updateBitRate(int rate)
+{
+ bitRateLabel->setText(QString("%1 Mbit/s").arg(rate / 1000));
+}
diff -r 325b214839c9 monolithic/connectioninfowiredtab.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfowiredtab.h Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,45 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef CONNECTIONINFOWIREDTAB_H
+#define CONNECTIONINFOWIREDTAB_H
+
+#include <QtGui>
+
+#include <solid/control/networkinterface.h>
+#include <solid/control/wirednetworkinterface.h>
+
+class ConnectionInfoWiredTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ConnectionInfoWiredTab(Solid::Control::WiredNetworkInterface *iface, QWidget *parent = 0);
+ ~ConnectionInfoWiredTab() { };
+
+public slots:
+ void updateBitRate(int rate);
+
+private:
+ Solid::Control::WiredNetworkInterface *iface;
+ QLabel *bitRateLabel,
+ *hardwareAddressLabel;
+};
+
+#endif // CONNECTIONINFOWIREDTAB_H
diff -r 325b214839c9 monolithic/connectioninfowirelesstab.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfowirelesstab.cpp Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,149 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "connectioninfowirelesstab.h"
+
+#include "utils.h"
+
+
+ConnectionInfoWirelessTab::ConnectionInfoWirelessTab(Solid::Control::WirelessNetworkInterface *iface, QWidget *parent)
+ : QWidget(parent), iface(iface), maxBitRate(0)
+{
+ QFormLayout *layout = new QFormLayout(this);
+ setLayout(layout);
+
+ ssidLabel = new QLabel(this);
+ layout->addRow("SSID: ", ssidLabel);
+
+ signalStrengthLabel = new QLabel(this);
+ layout->addRow("Signal strength: ", signalStrengthLabel);
+
+ operationModeLabel = new QLabel(this);
+ layout->addRow("Operation mode: ", operationModeLabel);
+
+ bitRateLabel = new QLabel(this);
+ layout->addRow("Bit rate: ", bitRateLabel);
+
+ accessPointLabel = new QLabel(this);
+ layout->addRow("Access point: ", accessPointLabel);
+
+ securityWpaLabel = new QLabel(this);
+ layout->addRow("Security (WPA): ", securityWpaLabel);
+
+ securityRsnLabel = new QLabel(this);
+ layout->addRow("Security (RSN/WPA2): ", securityRsnLabel);
+
+ frequencyLabel = new QLabel(this);
+ layout->addRow("Frequency: ", frequencyLabel);
+
+ hardwareAddressLabel = new QLabel(this);
+ layout->addRow("Hardware address: ", hardwareAddressLabel);
+
+ connect(iface, SIGNAL(activeAccessPointChanged(const QString &)), this, SLOT(updateAccessPoint(const QString &)));
+
+ connect(iface, SIGNAL(bitRateChanged(int)), this, SLOT(updateBitRate(int)));
+
+ connect(iface, SIGNAL(modeChanged(Solid::Control::WirelessNetworkInterface::OperationMode)), this, SLOT(updateOperationMode(Solid::Control::WirelessNetworkInterface::OperationMode)));
+
+ // populate initial values
+ updateAccessPoint(iface->activeAccessPoint());
+ updateBitRate(iface->bitRate());
+ updateOperationMode(iface->mode());
+
+ hardwareAddressLabel->setText(iface->hardwareAddress());
+}
+
+void ConnectionInfoWirelessTab::updateAccessPoint(const QString &uni)
+{
+ Solid::Control::AccessPoint *ap = iface->findAccessPoint(uni);
+
+ // we are not connected
+ if (ap == 0) {
+ clearFields();
+ return;
+ }
+
+ // populate initial values
+ updateSsid(ap->ssid());
+ updateSignalStrength(ap->signalStrength());
+ accessPointLabel->setText(ap->hardwareAddress());
+ updateMaxBitRate(ap->maxBitRate());
+ updateFrequency(ap->frequency());
+ updateWpa(ap->wpaFlags());
+ updateRsn(ap->rsnFlags());
+
+ connect(ap, SIGNAL(ssidChanged(const QString &)), this, SLOT(updateSsid(const QString&)));
+ connect(ap, SIGNAL(signalStrengthChanged(int)), this, SLOT(updateSignalStrength(int)));
+ connect(ap, SIGNAL(bitRateChanged(int)), this, SLOT(updateMaxBitRate(int)));
+ connect(ap, SIGNAL(frequencyChanged(uint)), this, SLOT(updateFrequency(uint)));
+ connect(ap, SIGNAL(wpaFlagsChanged(Solid::Control::AccessPoint::WpaFlags)), this, SLOT(updateWpa(Solid::Control::AccessPoint::WpaFlags)));
+ connect(ap, SIGNAL(rsnFlagsChanged(Solid::Control::AccessPoint::WpaFlags)), this, SLOT(updateRsn(Solid::Control::AccessPoint::WpaFlags)));
+}
+
+void ConnectionInfoWirelessTab::updateBitRate(int rate)
+{
+ bitRateLabel->setText(QString("%1 / %2 Mbit/s").arg(rate / 1000).arg(maxBitRate / 1000));
+}
+
+void ConnectionInfoWirelessTab::updateOperationMode(Solid::Control::WirelessNetworkInterface::OperationMode mode)
+{
+ operationModeLabel->setText(operationModeToString(mode));
+}
+
+void ConnectionInfoWirelessTab::updateSsid(const QString& ssid)
+{
+ ssidLabel->setText(ssid);
+}
+
+void ConnectionInfoWirelessTab::updateSignalStrength(int signalStrength)
+{
+ signalStrengthLabel->setText(QString("%1%").arg(signalStrength));
+}
+
+void ConnectionInfoWirelessTab::updateMaxBitRate(int bitRate)
+{
+ maxBitRate = bitRate;
+ updateBitRate(iface->bitRate());
+}
+
+void ConnectionInfoWirelessTab::updateFrequency(uint frequency)
+{
+ frequencyLabel->setText(QString("%1 MHz").arg(frequency));
+}
+
+void ConnectionInfoWirelessTab::updateWpa(Solid::Control::AccessPoint::WpaFlags flags)
+{
+ securityWpaLabel->setText(wpaFlagsToStringList(flags).join("\n"));
+}
+
+void ConnectionInfoWirelessTab::updateRsn(Solid::Control::AccessPoint::WpaFlags flags)
+{
+ securityRsnLabel->setText(wpaFlagsToStringList(flags).join("\n"));
+}
+
+void ConnectionInfoWirelessTab::clearFields()
+{
+ ssidLabel->setText("");
+ signalStrengthLabel->setText("");
+ bitRateLabel->setText("");
+ accessPointLabel->setText("");
+ securityWpaLabel->setText("");
+ securityRsnLabel->setText("");
+ frequencyLabel->setText("");
+}
diff -r 325b214839c9 monolithic/connectioninfowirelesstab.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monolithic/connectioninfowirelesstab.h Sun Nov 08 15:58:15 2009 +0200
@@ -0,0 +1,64 @@
+/*
+Copyright 2009 Andrey Batyiev <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef CONNECTIONINFOWIRELESSTAB_H
+#define CONNECTIONINFOWIRELESSTAB_H
+
+#include <QtGui>
+
+#include <solid/control/networkinterface.h>
+#include <solid/control/wirelessnetworkinterface.h>
+#include <solid/control/wirelessaccesspoint.h>
+
+class ConnectionInfoWirelessTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ConnectionInfoWirelessTab(Solid::Control::WirelessNetworkInterface *iface, QWidget *parent = 0);
+ ~ConnectionInfoWirelessTab() { };
+
+public slots:
+ void updateAccessPoint(const QString &uni);
+ void updateBitRate(int rate);
+ void updateOperationMode(Solid::Control::WirelessNetworkInterface::OperationMode mode);
+ void updateSsid(const QString& ssid);
+ void updateSignalStrength(int signalStrength);
+ void updateMaxBitRate(int bitRate);
+ void updateFrequency(uint frequency);
+ void updateWpa(Solid::Control::AccessPoint::WpaFlags flags);
+ void updateRsn(Solid::Control::AccessPoint::WpaFlags flags);
+ void clearFields();
+
+private:
+ Solid::Control::WirelessNetworkInterface *iface;
+ QLabel *ssidLabel,
+ *signalStrengthLabel,
+ *operationModeLabel,
+ *bitRateLabel,
+ *accessPointLabel,
+ *securityWpaLabel,
+ *securityRsnLabel,
+ *frequencyLabel,
+ *hardwareAddressLabel;
+ int maxBitRate;
+ };
+
+#endif // CONNECTIONINFOWIRELESSTAB_H
+
diff -r 325b214839c9 monolithic/knetworkmanagertrayicon.cpp
--- a/monolithic/knetworkmanagertrayicon.cpp Sun Nov 08 14:13:30 2009 +0200
+++ b/monolithic/knetworkmanagertrayicon.cpp Sun Nov 08 15:58:15 2009 +0200
@@ -38,6 +38,8 @@
#include <solid/control/networkmanager.h>
+#include <connectioninfodialog.h>
+
#include <activatable.h>
#include <activatabledebug.h>
#include <sortedactivatablelist.h>
@@ -86,6 +88,8 @@
QPointer<Solid::Control::NetworkInterface> displayedNetworkInterface;
QPointer<Solid::Control::AccessPoint> activeAccessPoint;
QHostAddress hoveredActionIpAddress;
+ QHash<Knm::Activatable *, QPointer<ConnectionInfoDialog> > connectionPropertiesDialogs;
+ Knm::InterfaceConnection *hoveredActionInterfaceConnection;
};
/* for qSort()ing */
@@ -588,14 +592,12 @@
d->copyIpAddrAction = KStandardAction::copy(this, SLOT(copyIpAddress()), this);
d->copyIpAddrAction->setText(i18nc("@action:inmenu copy ip address to clipboard", "Copy IP Address"));
d->propertiesAction = new KAction(i18nc("@action:inmenu interface connection properties", "Properties"), this);
- connect(d->propertiesAction, SIGNAL(triggered(bool)), this, SLOT(showConnectionProperties(bool)));
- // TODO implement
- d->propertiesAction->setEnabled(false);
-
+ connect(d->propertiesAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(showConnectionProperties()));
}
+ d->hoveredActionInterfaceConnection = ic;
+ QString deviceUni = ic->deviceUni();
+ Solid::Control::NetworkInterface * iface = Solid::Control::NetworkManager::findNetworkInterface(deviceUni);
if (ic->activationState() == Knm::InterfaceConnection::Activated) {
- QString deviceUni = ic->deviceUni();
- Solid::Control::NetworkInterface * iface = Solid::Control::NetworkManager::findNetworkInterface(deviceUni);
QHostAddress addr;
if (iface) {
Solid::Control::IPv4Config cfg = iface->ipV4Config();
@@ -636,8 +638,18 @@
void KNetworkManagerTrayIcon::showConnectionProperties()
{
- // This is not yet implemented. When it is implemented, remove the setEnabled(false) call to
- // d->propertiesAction
+ Q_D(KNetworkManagerTrayIcon);
+ ConnectionInfoDialog *connectionInfoDialog;
+
+ connectionInfoDialog = d->connectionPropertiesDialogs[d->hoveredActionInterfaceConnection];
+ if (connectionInfoDialog == 0) {
+ connectionInfoDialog = new ConnectionInfoDialog(d->hoveredActionInterfaceConnection);
+ d->connectionPropertiesDialogs[d->hoveredActionInterfaceConnection] = connectionInfoDialog;
+ connectionInfoDialog->show();
+ } else {
+ connectionInfoDialog->show();
+ connectionInfoDialog->raise();
+ }
}
void KNetworkManagerTrayIcon::showOtherWirelessDialog()
_______________________________________________
kde-networkmanager mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-networkmanager