From kde-commits Sat Apr 27 22:26:27 2013 From: =?utf-8?b?THVrw6HFoSBUaW5rbA==?= Date: Sat, 27 Apr 2013 22:26:27 +0000 To: kde-commits Subject: [plasma-nm] editor: add Infiniband config Message-Id: <20130427222627.82686A603F () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=136710159906137 Git commit 4f97fa033fef36bba080444d6259c618aa7f8d45 by Luk=C3=A1=C5=A1 Tink= l. Committed on 28/04/2013 at 00:26. Pushed by lukas into branch 'master'. add Infiniband config M +2 -0 editor/CMakeLists.txt M +1 -2 editor/btwidget.cpp M +5 -1 editor/connectiondetaileditor.cpp M +0 -2 editor/connectioneditor.cpp M +1 -1 editor/connectiontypeitem.cpp A +72 -0 editor/infinibandwidget.cpp [License: LGPL] A +50 -0 editor/infinibandwidget.h [License: LGPL] A +108 -0 editor/ui/infiniband.ui M +1 -3 editor/wificonnectionwidget.cpp M +1 -3 editor/wiredconnectionwidget.cpp http://commits.kde.org/plasma-nm/4f97fa033fef36bba080444d6259c618aa7f8d45 diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index f886281..c27e204 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -25,6 +25,7 @@ set(connectioneditor_SRCS gsmwidget.cpp cdmawidget.cpp btwidget.cpp + infinibandwidget.cpp ) = kde4_add_ui_files(connectioneditor_SRCS @@ -45,6 +46,7 @@ kde4_add_ui_files(connectioneditor_SRCS ui/gsm.ui ui/cdma.ui ui/bt.ui + ui/infiniband.ui ) = kde4_add_executable(kde-nm-connection-editor ${connectioneditor_SRCS}) diff --git a/editor/btwidget.cpp b/editor/btwidget.cpp index 1c9fe4a..5e37fd2 100644 --- a/editor/btwidget.cpp +++ b/editor/btwidget.cpp @@ -58,8 +58,7 @@ QVariantMap BtWidget::setting(bool agentOwned) const = NetworkManager::Settings::BluetoothSetting btSetting; = - if (!m_ui->bdaddr->currentText().isEmpty()) - btSetting.setBluetoothAddress(UiUtils::macAddressFromString(m_ui->= bdaddr->hwAddress())); + btSetting.setBluetoothAddress(UiUtils::macAddressFromString(m_ui->bdad= dr->hwAddress())); btSetting.setProfileType(static_cast(m_ui->type->itemData(m_ui->type->currentIndex()).to= Int())); = return btSetting.toMap(); diff --git a/editor/connectiondetaileditor.cpp b/editor/connectiondetailedi= tor.cpp index 40f764c..b1b2faa 100644 --- a/editor/connectiondetaileditor.cpp +++ b/editor/connectiondetaileditor.cpp @@ -32,6 +32,7 @@ #include "gsmwidget.h" #include "cdmawidget.h" #include "btwidget.h" +#include "infinibandwidget.h" #include "vpnuiplugin.h" = #include @@ -239,6 +240,9 @@ void ConnectionDetailEditor::initTabs() m_detailEditor->tabWidget->addTab(pppWidget, i18n("PPP")); = } + } else if (type =3D=3D NetworkManager::Settings::ConnectionSettings::I= nfiniband) { // Infiniband + InfinibandWidget * infinibandWidget =3D new InfinibandWidget(m_con= nection->setting(NetworkManager::Settings::Setting::Infiniband), this); + m_detailEditor->tabWidget->addTab(infinibandWidget, i18n("Infiniba= nd")); } else if (type =3D=3D NetworkManager::Settings::ConnectionSettings::V= pn) { // VPN QString error; VpnUiPlugin * vpnPlugin =3D 0; @@ -277,7 +281,7 @@ void ConnectionDetailEditor::initTabs() IPv4Widget * ipv4Widget =3D new IPv4Widget(m_connection->setting(Netwo= rkManager::Settings::Setting::Ipv4), this); m_detailEditor->tabWidget->addTab(ipv4Widget, i18n("IPv4")); = - if (type =3D=3D Settings::ConnectionSettings::Wired || type =3D=3D Set= tings::ConnectionSettings::Wireless) { + if (type =3D=3D Settings::ConnectionSettings::Wired || type =3D=3D Set= tings::ConnectionSettings::Wireless || type =3D=3D Settings::ConnectionSett= ings::Infiniband) { IPv6Widget * ipv6Widget =3D new IPv6Widget(m_connection->setting(N= etworkManager::Settings::Setting::Ipv6), this); m_detailEditor->tabWidget->addTab(ipv6Widget, i18n("IPv6")); } diff --git a/editor/connectioneditor.cpp b/editor/connectioneditor.cpp index 2b34d29..7138ca8 100644 --- a/editor/connectioneditor.cpp +++ b/editor/connectioneditor.cpp @@ -67,8 +67,6 @@ ConnectionEditor::ConnectionEditor(QWidget* parent, Qt::W= indowFlags flags): m_menu->addAction(action); action =3D new QAction(i18n("InfiniBand"), this); action->setData(NetworkManager::Settings::ConnectionSettings::Infiniba= nd); - // TODO: disabled for now - action->setDisabled(true); m_menu->addAction(action); action =3D new QAction(i18n("Mobile Broadband..."), this); action->setData(NetworkManager::Settings::ConnectionSettings::Gsm); diff --git a/editor/connectiontypeitem.cpp b/editor/connectiontypeitem.cpp index 6a86b49..24b87ad 100644 --- a/editor/connectiontypeitem.cpp +++ b/editor/connectiontypeitem.cpp @@ -47,7 +47,7 @@ ConnectionTypeItem::ConnectionTypeItem(QTreeWidget * pare= nt, const QString &type text =3D i18n("Mobile broadband"); setIcon(0, KIcon("phone")); } else if (type =3D=3D QLatin1String("infiniband")) { - text =3D i18n("InfiniBand"); + text =3D i18n("Infiniband"); } else if (type =3D=3D QLatin1String("802-11-olpc-mesh")) { text =3D i18n("Olpc mesh"); } else if (type =3D=3D QLatin1String("vlan")) { diff --git a/editor/infinibandwidget.cpp b/editor/infinibandwidget.cpp new file mode 100644 index 0000000..b3e6d9e --- /dev/null +++ b/editor/infinibandwidget.cpp @@ -0,0 +1,72 @@ +/* + Copyright 2013 Lukas Tinkl + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 6 of version 3 of the license. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#include "uiutils.h" + +#include "infinibandwidget.h" +#include "ui_infiniband.h" + +#include + +#include + +InfinibandWidget::InfinibandWidget(const NetworkManager::Settings::Setting= ::Ptr &setting, QWidget* parent, Qt::WindowFlags f): + SettingWidget(setting, parent, f), + m_ui(new Ui::InfinibandWidget) +{ + m_ui->setupUi(this); + + m_ui->transport->addItem(i18nc("infiniband transport mode", "Datagram"= ), NetworkManager::Settings::InfinibandSetting::Datagram); + m_ui->transport->addItem(i18nc("infiniband transport mode", "Connected= "), NetworkManager::Settings::InfinibandSetting::Connected); + m_ui->transport->setCurrentIndex(0); + + if (setting) + loadConfig(setting); +} + +InfinibandWidget::~InfinibandWidget() +{ +} + +void InfinibandWidget::loadConfig(const NetworkManager::Settings::Setting:= :Ptr &setting) +{ + NetworkManager::Settings::InfinibandSetting::Ptr infinibandSetting =3D= setting.staticCast(); + + if (infinibandSetting->transportMode() !=3D NetworkManager::Settings::= InfinibandSetting::Unknown) + m_ui->transport->setCurrentIndex(m_ui->transport->findData(infinib= andSetting->transportMode())); + m_ui->macAddress->init(NetworkManager::Device::InfiniBand, UiUtils::ma= cAddressAsString(infinibandSetting->macAddress())); + if (infinibandSetting->mtu()) { + m_ui->mtu->setValue(infinibandSetting->mtu()); + } +} + +QVariantMap InfinibandWidget::setting(bool agentOwned) const +{ + Q_UNUSED(agentOwned) + + NetworkManager::Settings::InfinibandSetting setting; + setting.setTransportMode(static_cast(m_ui->transport->currentIndex())); + setting.setMacAddress(UiUtils::macAddressFromString(m_ui->macAddress->= hwAddress())); + if (m_ui->mtu->value()) { + setting.setMtu(m_ui->mtu->value()); + } + + return setting.toMap(); +} diff --git a/editor/infinibandwidget.h b/editor/infinibandwidget.h new file mode 100644 index 0000000..0b325c9 --- /dev/null +++ b/editor/infinibandwidget.h @@ -0,0 +1,50 @@ +/* + Copyright 2013 Lukas Tinkl + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 6 of version 3 of the license. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef PLASMA_NM_INFI_WIDGET_H +#define PLASMA_NM_INFI_WIDGET_H + +#include + +#include + +#include "settingwidget.h" + +namespace Ui +{ +class InfinibandWidget; +} + +class InfinibandWidget : public SettingWidget +{ + Q_OBJECT +public: + InfinibandWidget(const NetworkManager::Settings::Setting::Ptr &setting= =3D NetworkManager::Settings::Setting::Ptr(), QWidget* parent =3D 0, Qt::W= indowFlags f =3D 0); + virtual ~InfinibandWidget(); + + void loadConfig(const NetworkManager::Settings::Setting::Ptr &setting); + + QVariantMap setting(bool agentOwned =3D false) const; + +private: + Ui::InfinibandWidget * m_ui; +}; + +#endif // PLASMA_NM_INFI_WIDGET_H diff --git a/editor/ui/infiniband.ui b/editor/ui/infiniband.ui new file mode 100644 index 0000000..ba44503 --- /dev/null +++ b/editor/ui/infiniband.ui @@ -0,0 +1,108 @@ + + + Luk=C3=A1=C5=A1 Tinkl <ltinkl@redhat.com> + InfinibandWidget + + + + 0 + 0 + 414 + 362 + + + + + + + &Transport mode: + + + transport + + + + + + + + 0 + 0 + + + + + + + + &Device MAC address: + + + macAddress + + + + + + + + 0 + 0 + + + + + + + + &MTU: + + + mtu + + + + + + + + 0 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Automatic + + + bytes + + + 9999 + + + + + + + + KIntSpinBox + QSpinBox +
knuminput.h
+
+ + HwAddrComboBox + QComboBox +
hwaddrcombobox.h
+
+
+ + transport + macAddress + mtu + + + +
diff --git a/editor/wificonnectionwidget.cpp b/editor/wificonnectionwidget.= cpp index 055bde9..00c66ad 100644 --- a/editor/wificonnectionwidget.cpp +++ b/editor/wificonnectionwidget.cpp @@ -90,9 +90,7 @@ QVariantMap WifiConnectionWidget::setting(bool agentOwned= ) const wifiSetting.setBssid(UiUtils::macAddressFromString(m_ui->BSSIDLine= Edit->text())); } = - if (!m_ui->macAddress->currentText().isEmpty()) { - wifiSetting.setMacAddress(UiUtils::macAddressFromString(m_ui->macA= ddress->hwAddress())); - } + wifiSetting.setMacAddress(UiUtils::macAddressFromString(m_ui->macAddre= ss->hwAddress())); = if (!m_ui->clonedMacAddress->text().isEmpty() && m_ui->clonedMacAddres= s->text() !=3D ":::::") { wifiSetting.setClonedMacAddress(UiUtils::macAddressFromString(m_ui= ->clonedMacAddress->text())); diff --git a/editor/wiredconnectionwidget.cpp b/editor/wiredconnectionwidge= t.cpp index b34086a..ae0b119 100644 --- a/editor/wiredconnectionwidget.cpp +++ b/editor/wiredconnectionwidget.cpp @@ -77,9 +77,7 @@ QVariantMap WiredConnectionWidget::setting(bool agentOwne= d) const = NetworkManager::Settings::WiredSetting wiredSetting; = - if (!m_widget->macAddress->currentText().isEmpty()) { - wiredSetting.setMacAddress(UiUtils::macAddressFromString(m_widget-= >macAddress->hwAddress())); - } + wiredSetting.setMacAddress(UiUtils::macAddressFromString(m_widget->mac= Address->hwAddress())); = if (!m_widget->clonedMacAddress->text().isEmpty() && m_widget->clonedM= acAddress->text() !=3D ":::::") { wiredSetting.setClonedMacAddress(UiUtils::macAddressFromString(m_w= idget->clonedMacAddress->text()));