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

List:       kde-commits
Subject:    [plasma-nm] editor: add Infiniband config
From:       Lukáš Tinkl <lukas () kde ! org>
Date:       2013-04-27 22:26:27
Message-ID: 20130427222627.82686A603F () git ! kde ! org
[Download RAW message or body]

Git commit 4f97fa033fef36bba080444d6259c618aa7f8d45 by Lukáš Tinkl.
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->bdaddr->hwAddress()));
                
     btSetting.setProfileType(static_cast<NetworkManager::Settings::BluetoothSetting::ProfileType>(m_ui->type->itemData(m_ui->type->currentIndex()).toInt()));
  
     return btSetting.toMap();
diff --git a/editor/connectiondetaileditor.cpp b/editor/connectiondetaileditor.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 <QDebug>
@@ -239,6 +240,9 @@ void ConnectionDetailEditor::initTabs()
             m_detailEditor->tabWidget->addTab(pppWidget, i18n("PPP"));
 
         }
+    } else if (type == NetworkManager::Settings::ConnectionSettings::Infiniband) { \
// Infiniband +        InfinibandWidget * infinibandWidget = new \
InfinibandWidget(m_connection->setting(NetworkManager::Settings::Setting::Infiniband), \
this); +        m_detailEditor->tabWidget->addTab(infinibandWidget, \
                i18n("Infiniband"));
     } else if (type == NetworkManager::Settings::ConnectionSettings::Vpn) { // VPN
         QString error;
         VpnUiPlugin * vpnPlugin = 0;
@@ -277,7 +281,7 @@ void ConnectionDetailEditor::initTabs()
     IPv4Widget * ipv4Widget = new \
IPv4Widget(m_connection->setting(NetworkManager::Settings::Setting::Ipv4), this);  \
m_detailEditor->tabWidget->addTab(ipv4Widget, i18n("IPv4"));  
-    if (type == Settings::ConnectionSettings::Wired || type == \
Settings::ConnectionSettings::Wireless) { +    if (type == \
Settings::ConnectionSettings::Wired || type == Settings::ConnectionSettings::Wireless \
                || type == Settings::ConnectionSettings::Infiniband) {
         IPv6Widget * ipv6Widget = new \
IPv6Widget(m_connection->setting(NetworkManager::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::WindowFlags \
flags):  m_menu->addAction(action);
     action = new QAction(i18n("InfiniBand"), this);
     action->setData(NetworkManager::Settings::ConnectionSettings::Infiniband);
-    // TODO: disabled for now
-    action->setDisabled(true);
     m_menu->addAction(action);
     action = 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 * parent, const \
QString &type  text = i18n("Mobile broadband");
         setIcon(0, KIcon("phone"));
     } else if (type == QLatin1String("infiniband")) {
-        text = i18n("InfiniBand");
+        text = i18n("Infiniband");
     } else if (type == QLatin1String("802-11-olpc-mesh")) {
         text = i18n("Olpc mesh");
     } else if (type == 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 <ltinkl@redhat.com>
+
+    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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "uiutils.h"
+
+#include "infinibandwidget.h"
+#include "ui_infiniband.h"
+
+#include <KLocalizedString>
+
+#include <NetworkManagerQt/settings/infiniband.h>
+
+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 = \
setting.staticCast<NetworkManager::Settings::InfinibandSetting>(); +
+    if (infinibandSetting->transportMode() != \
NetworkManager::Settings::InfinibandSetting::Unknown) +        \
m_ui->transport->setCurrentIndex(m_ui->transport->findData(infinibandSetting->transportMode()));
 +    m_ui->macAddress->init(NetworkManager::Device::InfiniBand, \
UiUtils::macAddressAsString(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<NetworkManager::Settings::InfinibandSetting::TransportMode>(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 <ltinkl@redhat.com>
+
+    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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PLASMA_NM_INFI_WIDGET_H
+#define PLASMA_NM_INFI_WIDGET_H
+
+#include <QtGui/QWidget>
+
+#include <NetworkManagerQt/settings/setting.h>
+
+#include "settingwidget.h"
+
+namespace Ui
+{
+class InfinibandWidget;
+}
+
+class InfinibandWidget : public SettingWidget
+{
+    Q_OBJECT
+public:
+    InfinibandWidget(const NetworkManager::Settings::Setting::Ptr &setting = \
NetworkManager::Settings::Setting::Ptr(), QWidget* parent = 0, Qt::WindowFlags f = \
0); +    virtual ~InfinibandWidget();
+
+    void loadConfig(const NetworkManager::Settings::Setting::Ptr &setting);
+
+    QVariantMap setting(bool agentOwned = 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <author>Lukáš Tinkl &lt;ltinkl@redhat.com&gt;</author>
+ <class>InfinibandWidget</class>
+ <widget class="QWidget" name="InfinibandWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>414</width>
+    <height>362</height>
+   </rect>
+  </property>
+  <layout class="QFormLayout" name="formLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>&amp;Transport mode:</string>
+     </property>
+     <property name="buddy">
+      <cstring>transport</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QComboBox" name="transport">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>&amp;Device MAC address:</string>
+     </property>
+     <property name="buddy">
+      <cstring>macAddress</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="HwAddrComboBox" name="macAddress">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="text">
+      <string>&amp;MTU:</string>
+     </property>
+     <property name="buddy">
+      <cstring>mtu</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="KIntSpinBox" name="mtu">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="specialValueText">
+      <string>Automatic</string>
+     </property>
+     <property name="suffix">
+      <string> bytes</string>
+     </property>
+     <property name="maximum">
+      <number>9999</number>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
+  <customwidget>
+   <class>HwAddrComboBox</class>
+   <extends>QComboBox</extends>
+   <header>hwaddrcombobox.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>transport</tabstop>
+  <tabstop>macAddress</tabstop>
+  <tabstop>mtu</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
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->BSSIDLineEdit->text()));
  }
 
-    if (!m_ui->macAddress->currentText().isEmpty()) {
-        wifiSetting.setMacAddress(UiUtils::macAddressFromString(m_ui->macAddress->hwAddress()));
                
-    }
+    wifiSetting.setMacAddress(UiUtils::macAddressFromString(m_ui->macAddress->hwAddress()));
  
     if (!m_ui->clonedMacAddress->text().isEmpty() && m_ui->clonedMacAddress->text() \
                != ":::::") {
         wifiSetting.setClonedMacAddress(UiUtils::macAddressFromString(m_ui->clonedMacAddress->text()));
                
diff --git a/editor/wiredconnectionwidget.cpp b/editor/wiredconnectionwidget.cpp
index b34086a..ae0b119 100644
--- a/editor/wiredconnectionwidget.cpp
+++ b/editor/wiredconnectionwidget.cpp
@@ -77,9 +77,7 @@ QVariantMap WiredConnectionWidget::setting(bool agentOwned) 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->macAddress->hwAddress()));
  
     if (!m_widget->clonedMacAddress->text().isEmpty() && \
                m_widget->clonedMacAddress->text() != ":::::") {
         wiredSetting.setClonedMacAddress(UiUtils::macAddressFromString(m_widget->clonedMacAddress->text()));



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

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