Preliminary WiFi connection editing support (incomplete)

main
Aaron Rainbolt 1 year ago
parent 807b01d5d2
commit b9139483e1

@ -55,6 +55,8 @@ set(PROJECT_SOURCES
ipv6settingstab.h
ipv6settingstab.cpp
ipv6settingstab.ui
wifisettings.h
wifisettings.cpp
${TS_FILES}
)

@ -272,11 +272,10 @@ void NetworkSelector::modifyConnection(QModelIndex index)
switch(connType) {
case NetworkManager::ConnectionSettings::Wired:
dialogWindow = new EthernetSettings(index.data(Qt::UserRole+1).toString());
dialogWindow->exec();
delete dialogWindow;
regenConnTree();
break;
case NetworkManager::ConnectionSettings::Wireless:
dialogWindow = new WifiSettings(index.data(Qt::UserRole+1).toString());
break;
case NetworkManager::ConnectionSettings::Adsl:
case NetworkManager::ConnectionSettings::Pppoe:
case NetworkManager::ConnectionSettings::Bluetooth:
@ -297,6 +296,9 @@ void NetworkSelector::modifyConnection(QModelIndex index)
case NetworkManager::ConnectionSettings::Unknown:
;
}
dialogWindow->exec();
delete dialogWindow;
regenConnTree();
}
}
}

@ -2,6 +2,7 @@
#define NETWORKSELECTOR_H
#include "ethernetsettings.h"
#include "wifisettings.h"
#include "networkcreator.h"
#include "networkdeleter.h"

@ -0,0 +1,47 @@
#include "wifisettings.h"
#include "ui_genericsettings.h"
WifiSettings::WifiSettings(QString connUuidStr, QWidget *parent) :
QDialog(parent),
ui(new Ui::GenericSettings)
{
targetConnUuidStr = connUuidStr;
ui->setupUi(this);
QVariantMap connSettings = ConnectionSettingsEngine::readConnectionSettings(connUuidStr);
this->setWindowTitle(connSettings["connName"].toString());
ui->connectionNameLineEdit->setText(connSettings["connName"].toString());
generalSettingsTab = new GeneralSettingsTab();
ipv4SettingsTab = new Ipv4SettingsTab();
ipv6SettingsTab = new Ipv6SettingsTab();
ui->tabWidget->addTab(generalSettingsTab, tr("General"));
ui->tabWidget->addTab(ipv4SettingsTab, tr("IPv4"));
ui->tabWidget->addTab(ipv6SettingsTab, tr("IPv6"));
generalSettingsTab->loadSettings(connSettings);
ipv4SettingsTab->loadSettings(connSettings);
ipv6SettingsTab->loadSettings(connSettings);
connect(ui->cancelButton, &QPushButton::clicked, this, &WifiSettings::onCancelButtonClicked);
connect(ui->saveButton, &QPushButton::clicked, this, &WifiSettings::onSaveButtonClicked);
}
WifiSettings::~WifiSettings()
{
delete ui;
delete generalSettingsTab;
delete ipv4SettingsTab;
delete ipv6SettingsTab;
}
void WifiSettings::onCancelButtonClicked()
{
this->done(0);
}
void WifiSettings::onSaveButtonClicked()
{
QVariantMap settings = generalSettingsTab->readSettings();
settings.insert(ipv4SettingsTab->readSettings());
settings.insert(ipv6SettingsTab->readSettings());
settings.insert("connName", ui->connectionNameLineEdit->text());
ConnectionSettingsEngine::modifyConnectionSettings(targetConnUuidStr, settings);
this->done(0);
}

@ -0,0 +1,37 @@
#ifndef WIFISETTINGS_H
#define WIFISETTINGS_H
#include "connectionsettingsengine.h"
#include "generalsettingstab.h"
#include "security802_1xtab.h"
#include "ipv4settingstab.h"
#include "ipv6settingstab.h"
#include <QDialog>
namespace Ui {
class GenericSettings;
}
class WifiSettings : public QDialog
{
Q_OBJECT
public:
explicit WifiSettings(QString connUuidStr, QWidget *parent = nullptr);
~WifiSettings();
private slots:
void onCancelButtonClicked();
void onSaveButtonClicked();
private:
Ui::GenericSettings *ui;
QString targetConnUuidStr;
GeneralSettingsTab *generalSettingsTab;
Ipv4SettingsTab *ipv4SettingsTab;
Ipv6SettingsTab *ipv6SettingsTab;
};
#endif // WIFISETTINGS_H
Loading…
Cancel
Save