mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
looks working...
This commit is contained in:
parent
76877f737e
commit
946b470d11
@ -56,7 +56,6 @@ QHash<QString, QString> BridgeWidget::getSettings()
|
|||||||
if (isOk() == 0) {
|
if (isOk() == 0) {
|
||||||
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
||||||
bridgeSettings[QString("SkipForwardingDelay")] = QString("yes");
|
bridgeSettings[QString("SkipForwardingDelay")] = QString("yes");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bridgeSettings;
|
return bridgeSettings;
|
||||||
|
@ -121,7 +121,6 @@ QHash<QString, QString> EthernetWidget::getSettings()
|
|||||||
ethernetSettings[QString("TimeoutCarrier")] = QString(ui->spinBox_timeoutCarrier->value());
|
ethernetSettings[QString("TimeoutCarrier")] = QString(ui->spinBox_timeoutCarrier->value());
|
||||||
if (ui->spinBox_timeoutWpa->value() != 15)
|
if (ui->spinBox_timeoutWpa->value() != 15)
|
||||||
ethernetSettings[QString("TimeoutWPA")] = QString(ui->spinBox_timeoutWpa->value());
|
ethernetSettings[QString("TimeoutWPA")] = QString(ui->spinBox_timeoutWpa->value());
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ethernetSettings;
|
return ethernetSettings;
|
||||||
|
@ -147,7 +147,6 @@ QHash<QString, QString> GeneralWidget::getSettings()
|
|||||||
generalSettings[QString("ExecDownPre")] = QString("'") + ui->lineEdit_execDownPre->text() + QString("'");
|
generalSettings[QString("ExecDownPre")] = QString("'") + ui->lineEdit_execDownPre->text() + QString("'");
|
||||||
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
||||||
generalSettings[QString("ForceConnect")] = QString("yes");
|
generalSettings[QString("ForceConnect")] = QString("yes");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return generalSettings;
|
return generalSettings;
|
||||||
|
@ -471,7 +471,6 @@ QHash<QString, QString> IpWidget::getSettings()
|
|||||||
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
|
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
|
||||||
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
|
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
|
||||||
}
|
}
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ipSettings;
|
return ipSettings;
|
||||||
|
@ -168,6 +168,7 @@ void MainWindow::createActions()
|
|||||||
connect(ui->lineEdit_profile, SIGNAL(returnPressed()), this, SLOT(profileTabLoadProfile()));
|
connect(ui->lineEdit_profile, SIGNAL(returnPressed()), this, SLOT(profileTabLoadProfile()));
|
||||||
connect(ui->pushButton_profile, SIGNAL(clicked(bool)), this, SLOT(profileTabBrowseProfile()));
|
connect(ui->pushButton_profile, SIGNAL(clicked(bool)), this, SLOT(profileTabBrowseProfile()));
|
||||||
connect(ui->pushButton_profileClear, SIGNAL(clicked(bool)), this, SLOT(profileTabClear()));
|
connect(ui->pushButton_profileClear, SIGNAL(clicked(bool)), this, SLOT(profileTabClear()));
|
||||||
|
connect(ui->pushButton_profileSave, SIGNAL(clicked(bool)), this, SLOT(profileTabCreateProfile()));
|
||||||
connect(ui->pushButton_profileLoad, SIGNAL(clicked(bool)), this, SLOT(profileTabLoadProfile()));
|
connect(ui->pushButton_profileLoad, SIGNAL(clicked(bool)), this, SLOT(profileTabLoadProfile()));
|
||||||
connect(generalWid->connectionType, SIGNAL(currentIndexChanged(QString)), this, SLOT(profileTabChangeState(QString)));
|
connect(generalWid->connectionType, SIGNAL(currentIndexChanged(QString)), this, SLOT(profileTabChangeState(QString)));
|
||||||
|
|
||||||
@ -235,7 +236,9 @@ void MainWindow::updateMainTab()
|
|||||||
|
|
||||||
void MainWindow::updateProfileTab()
|
void MainWindow::updateProfileTab()
|
||||||
{
|
{
|
||||||
|
ui->tabWidget->setDisabled(true);
|
||||||
profileTabClear();
|
profileTabClear();
|
||||||
|
ui->tabWidget->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -412,25 +415,6 @@ void MainWindow::profileTabBrowseProfile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::profileTabClear()
|
|
||||||
{
|
|
||||||
ui->lineEdit_profile->clear();
|
|
||||||
|
|
||||||
generalWid->clear();
|
|
||||||
ipWid->clear();
|
|
||||||
bridgeWid->clear();
|
|
||||||
ethernetWid->clear();
|
|
||||||
mobileWid->clear();
|
|
||||||
pppoeWid->clear();
|
|
||||||
tunnelWid->clear();
|
|
||||||
tuntapWid->clear();
|
|
||||||
vlanWid->clear();
|
|
||||||
wirelessWid->clear();
|
|
||||||
|
|
||||||
profileTabChangeState(generalWid->connectionType->currentText());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::profileTabChangeState(QString current)
|
void MainWindow::profileTabChangeState(QString current)
|
||||||
{
|
{
|
||||||
if (current == QString("ethernet")) {
|
if (current == QString("ethernet")) {
|
||||||
@ -545,11 +529,202 @@ void MainWindow::profileTabChangeState(QString current)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::profileTabClear()
|
||||||
|
{
|
||||||
|
ui->lineEdit_profile->clear();
|
||||||
|
|
||||||
|
generalWid->clear();
|
||||||
|
ipWid->clear();
|
||||||
|
bridgeWid->clear();
|
||||||
|
ethernetWid->clear();
|
||||||
|
mobileWid->clear();
|
||||||
|
pppoeWid->clear();
|
||||||
|
tunnelWid->clear();
|
||||||
|
tuntapWid->clear();
|
||||||
|
vlanWid->clear();
|
||||||
|
wirelessWid->clear();
|
||||||
|
|
||||||
|
profileTabChangeState(generalWid->connectionType->currentText());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::profileTabCreateProfile()
|
||||||
|
{
|
||||||
|
// error checking
|
||||||
|
if (ui->lineEdit_profile->text().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (generalWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (generalWid->isOk() == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((generalWid->connectionType->currentText() == QString("ethernet")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("wireless")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("bond")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("dummy")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("bridge")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("tunnel")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("tuntap")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("vlan"))) {
|
||||||
|
if (ipWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (ipWid->isOk() == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||||
|
if (ethernetWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||||
|
if (wirelessWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (wirelessWid->isOk() == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (wirelessWid->isOk() == 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (wirelessWid->isOk() == 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (wirelessWid->isOk() == 5) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||||
|
if (pppoeWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (pppoeWid->isOk() == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (pppoeWid->isOk() == 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (pppoeWid->isOk() == 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||||
|
if (mobileWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mobileWid->isOk() == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||||
|
if (tuntapWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tuntapWid->isOk() == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||||
|
if (ethernetWid->isOk() == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->tabWidget->setDisabled(true);
|
||||||
|
// read settings
|
||||||
|
QString profile = ui->lineEdit_profile->text();
|
||||||
|
QHash<QString, QString> settings;
|
||||||
|
settings = generalWid->getSettings();
|
||||||
|
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = ethernetWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = wirelessWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if ((generalWid->connectionType->currentText() == QString("bond")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("dummy"))) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = bridgeWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||||
|
QHash<QString, QString> addSettings = pppoeWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||||
|
QHash<QString, QString> addSettings = mobileWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = tunnelWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = tuntapWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||||
|
QHash<QString, QString> addSettings = ipWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = ethernetWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
addSettings = vlanWid->getSettings();
|
||||||
|
for (int i=0; i<addSettings.keys().count(); i++)
|
||||||
|
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// call netctlprofile
|
||||||
|
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||||
|
if (netctlProfile->copyProfile(profileTempName))
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
|
else
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
|
|
||||||
|
updateProfileTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::profileTabLoadProfile()
|
void MainWindow::profileTabLoadProfile()
|
||||||
{
|
{
|
||||||
QString profile = ui->lineEdit_profile->text();
|
QString profile = ui->lineEdit_profile->text();
|
||||||
QHash<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
QHash<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
||||||
printf("%i\n", settings.count());
|
|
||||||
|
|
||||||
generalWid->setSettings(settings);
|
generalWid->setSettings(settings);
|
||||||
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||||
|
@ -82,6 +82,7 @@ private slots:
|
|||||||
void profileTabBrowseProfile();
|
void profileTabBrowseProfile();
|
||||||
void profileTabChangeState(QString current);
|
void profileTabChangeState(QString current);
|
||||||
void profileTabClear();
|
void profileTabClear();
|
||||||
|
void profileTabCreateProfile();
|
||||||
void profileTabLoadProfile();
|
void profileTabLoadProfile();
|
||||||
// wifi tab slots
|
// wifi tab slots
|
||||||
void wifiTabSetEnabled(bool state);
|
void wifiTabSetEnabled(bool state);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_main">
|
<widget class="QWidget" name="tab_main">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -190,8 +190,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>439</width>
|
<width>429</width>
|
||||||
<height>357</height>
|
<height>348</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -356,7 +356,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>471</width>
|
<width>471</width>
|
||||||
<height>23</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuMenu">
|
<widget class="QMenu" name="menuMenu">
|
||||||
|
@ -120,7 +120,6 @@ QHash<QString, QString> MobileWidget::getSettings()
|
|||||||
mobileSettings[QString("UsePeerDNS")] = QString("false");
|
mobileSettings[QString("UsePeerDNS")] = QString("false");
|
||||||
if (!ui->lineEdit_options->text().isEmpty())
|
if (!ui->lineEdit_options->text().isEmpty())
|
||||||
mobileSettings[QString("OptionsFile")] = QString("'") + ui->lineEdit_options->text() + QString("'");
|
mobileSettings[QString("OptionsFile")] = QString("'") + ui->lineEdit_options->text() + QString("'");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mobileSettings;
|
return mobileSettings;
|
||||||
|
@ -74,7 +74,7 @@ QStringList Netctl::getProfileDescriptions(QStringList profileList)
|
|||||||
else if (fileStr[0] != '#')
|
else if (fileStr[0] != '#')
|
||||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("Description"))
|
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("Description"))
|
||||||
descriptions.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]);
|
descriptions.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].remove(QString("\n")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
descriptions.append(QString("<unknown>"));
|
descriptions.append(QString("<unknown>"));
|
||||||
@ -125,7 +125,7 @@ QString Netctl::getSsidFromProfile(QString profile)
|
|||||||
else if (fileStr[0] != '#') {
|
else if (fileStr[0] != '#') {
|
||||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("ESSID"))
|
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("ESSID"))
|
||||||
ssidName = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
ssidName = fileStr.split(QString("="), QString::SkipEmptyParts)[1].remove(QString("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
#include "netctlprofile.h"
|
#include "netctlprofile.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
@ -37,6 +40,38 @@ NetctlProfile::~NetctlProfile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NetctlProfile::copyProfile(QString oldPath)
|
||||||
|
{
|
||||||
|
QString newPath = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(oldPath).fileName();
|
||||||
|
QProcess command;
|
||||||
|
command.start(sudoCommand + QString(" /usr/bin/cp ") + oldPath + QString(" ") + newPath);
|
||||||
|
command.waitForFinished(-1);
|
||||||
|
if (command.exitCode() == 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString NetctlProfile::createProfile(QString profile, QHash<QString, QString> settings)
|
||||||
|
{
|
||||||
|
|
||||||
|
QString profileTempName = QDir::homePath() + QDir::separator() +
|
||||||
|
QString(".cache") + QDir::separator() + QFileInfo(profile).fileName();
|
||||||
|
QFile profileFile(profileTempName);
|
||||||
|
|
||||||
|
if (!profileFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
|
return profileTempName;
|
||||||
|
|
||||||
|
QTextStream out(&profileFile);
|
||||||
|
for (int i=0; i<settings.keys().count(); i++)
|
||||||
|
out << settings.keys()[i] << QString("=") << settings[settings.keys()[i]] << QString("\n");
|
||||||
|
profileFile.close();
|
||||||
|
|
||||||
|
return profileTempName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, QString> NetctlProfile::getSettingsFromProfile(QString profile)
|
QHash<QString, QString> NetctlProfile::getSettingsFromProfile(QString profile)
|
||||||
{
|
{
|
||||||
QHash<QString, QString> settings;
|
QHash<QString, QString> settings;
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
QString profileDir = QString(""),
|
QString profileDir = QString(""),
|
||||||
QString sudoPath = QString(""));
|
QString sudoPath = QString(""));
|
||||||
~NetctlProfile();
|
~NetctlProfile();
|
||||||
|
bool copyProfile(QString oldPath);
|
||||||
|
QString createProfile(QString profile, QHash<QString, QString> settings);
|
||||||
QHash<QString, QString> getSettingsFromProfile(QString profile);
|
QHash<QString, QString> getSettingsFromProfile(QString profile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -161,7 +161,6 @@ QHash<QString, QString> PppoeWidget::getSettings()
|
|||||||
pppoeSettings[QString("PPPoEMAC")] = QString("'") + ui->lineEdit_mac->text() + QString("'");
|
pppoeSettings[QString("PPPoEMAC")] = QString("'") + ui->lineEdit_mac->text() + QString("'");
|
||||||
if (ui->checkBox_ipv6->checkState() == Qt::Checked)
|
if (ui->checkBox_ipv6->checkState() == Qt::Checked)
|
||||||
pppoeSettings[QString("PPPoEIP6")] = QString("yes");
|
pppoeSettings[QString("PPPoEIP6")] = QString("yes");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pppoeSettings;
|
return pppoeSettings;
|
||||||
|
@ -93,7 +93,6 @@ QHash<QString, QString> TunnelWidget::getSettings()
|
|||||||
tunnelSettings[QString("Local")] = QString("'") + getIp(ui->lineEdit_local->text().remove(QString(" "))) + QString("'");
|
tunnelSettings[QString("Local")] = QString("'") + getIp(ui->lineEdit_local->text().remove(QString(" "))) + QString("'");
|
||||||
if (!ui->lineEdit_remote->text().split(QString(".")).join(QString("")).remove(QString(" ")).isEmpty())
|
if (!ui->lineEdit_remote->text().split(QString(".")).join(QString("")).remove(QString(" ")).isEmpty())
|
||||||
tunnelSettings[QString("Remote")] = QString("'") + getIp(ui->lineEdit_remote->text().remove(QString(" "))) + QString("'");
|
tunnelSettings[QString("Remote")] = QString("'") + getIp(ui->lineEdit_remote->text().remove(QString(" "))) + QString("'");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tunnelSettings;
|
return tunnelSettings;
|
||||||
|
@ -59,7 +59,6 @@ QHash<QString, QString> TuntapWidget::getSettings()
|
|||||||
tuntapSettings[QString("Mode")] = QString("'") + ui->comboBox_mode->currentText() + QString("'");
|
tuntapSettings[QString("Mode")] = QString("'") + ui->comboBox_mode->currentText() + QString("'");
|
||||||
tuntapSettings[QString("User")] = QString("'") + ui->lineEdit_user->text() + QString("'");
|
tuntapSettings[QString("User")] = QString("'") + ui->lineEdit_user->text() + QString("'");
|
||||||
tuntapSettings[QString("Group")] = QString("'") + ui->lineEdit_group->text() + QString("'");
|
tuntapSettings[QString("Group")] = QString("'") + ui->lineEdit_group->text() + QString("'");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tuntapSettings;
|
return tuntapSettings;
|
||||||
|
@ -55,7 +55,6 @@ QHash<QString, QString> VlanWidget::getSettings()
|
|||||||
|
|
||||||
if (isOk() == 0) {
|
if (isOk() == 0) {
|
||||||
vlanSettings[QString("VLANID")] = QString(ui->spinBox_vlan->value());
|
vlanSettings[QString("VLANID")] = QString(ui->spinBox_vlan->value());
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return vlanSettings;
|
return vlanSettings;
|
||||||
|
@ -232,7 +232,7 @@ QHash<QString, QString> WirelessWidget::getSettings()
|
|||||||
wirelessSettings[QString("Priority")] = QString(ui->spinBox_priority->value());
|
wirelessSettings[QString("Priority")] = QString(ui->spinBox_priority->value());
|
||||||
if (!ui->lineEdit_country->text().isEmpty())
|
if (!ui->lineEdit_country->text().isEmpty())
|
||||||
wirelessSettings[QString("Country")] = QString("'") + ui->lineEdit_country->text() + QString("'");
|
wirelessSettings[QString("Country")] = QString("'") + ui->lineEdit_country->text() + QString("'");
|
||||||
if (!ui->lineEdit_wpaGroup->text().isEmpty())
|
if (ui->lineEdit_wpaGroup->text() != QString("wheel"))
|
||||||
wirelessSettings[QString("WPAGroup")] = QString("'") + ui->lineEdit_wpaGroup->text() + QString("'");
|
wirelessSettings[QString("WPAGroup")] = QString("'") + ui->lineEdit_wpaGroup->text() + QString("'");
|
||||||
if (ui->listWidget_drivers->count() != 0) {
|
if (ui->listWidget_drivers->count() != 0) {
|
||||||
QStringList drivers;
|
QStringList drivers;
|
||||||
@ -246,7 +246,6 @@ QHash<QString, QString> WirelessWidget::getSettings()
|
|||||||
wirelessSettings[QString("TimeoutWPA")] = QString(ui->spinBox_timeoutWpa->value());
|
wirelessSettings[QString("TimeoutWPA")] = QString(ui->spinBox_timeoutWpa->value());
|
||||||
if (ui->checkBox_exclude->checkState() == Qt::Checked)
|
if (ui->checkBox_exclude->checkState() == Qt::Checked)
|
||||||
wirelessSettings[QString("ExcludeAuto")] = QString("yes");
|
wirelessSettings[QString("ExcludeAuto")] = QString("yes");
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return wirelessSettings;
|
return wirelessSettings;
|
||||||
|
Loading…
Reference in New Issue
Block a user