diff --git a/sources/gui/src/netctlinteract.cpp b/sources/gui/src/netctlinteract.cpp index 3438a72..77d0904 100644 --- a/sources/gui/src/netctlinteract.cpp +++ b/sources/gui/src/netctlinteract.cpp @@ -21,7 +21,6 @@ #include #include "mainwindow.h" -#include "cstdio" Netctl::Netctl(MainWindow *wid, QString netctlPath, QString profileDir, QString sudoPath) diff --git a/sources/gui/src/netctlprofile.cpp b/sources/gui/src/netctlprofile.cpp index e4a80bc..41ea101 100644 --- a/sources/gui/src/netctlprofile.cpp +++ b/sources/gui/src/netctlprofile.cpp @@ -23,6 +23,7 @@ #include #include "mainwindow.h" +#include NetctlProfile::NetctlProfile(MainWindow *wid, QString profileDir, QString sudoPath) @@ -104,11 +105,45 @@ QHash NetctlProfile::getSettingsFromProfile(QString profile) if (profileFile.atEnd()) break; else if (fileStr[0] != '#') { - if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) - settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1] - .remove(QString("(")) - .remove(QString(")")) - .trimmed(); + if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) { + if ((fileStr.split(QString("="))[1][0] == QChar('(')) && + (fileStr.split(QString("="))[1][fileStr.split(QString("="))[1].size()-2] == QChar(')'))) + settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1] + .remove(QString("(")) + .remove(QString(")")) + .trimmed(); + else if (fileStr.split(QString("="))[1][0] == QChar('(')) { + QString parameterName = fileStr.split(QString("="))[0]; + QStringList parameter; + if (!fileStr.split(QString("="))[1] + .remove(QString("(")) + .remove(QString(")")) + .trimmed() + .isEmpty()) + parameter.append(fileStr.split(QString("="))[1] + .remove(QString("(")) + .remove(QString(")")) + .trimmed()); + while(true) { + fileStr = QString(profileFile.readLine()); + if ((profileFile.atEnd()) || + (fileStr[fileStr.size()-2] == QChar(')'))) + break; + if (!fileStr.remove(QString("(")) + .remove(QString(")")) + .trimmed() + .isEmpty()) + parameter.append(fileStr.remove(QString("(")) + .remove(QString(")")) + .trimmed()); + } + settings[parameterName] = parameter.join(QString("\n")); + } + else + settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1] + .trimmed(); + } + } } diff --git a/sources/gui/src/wpasupinteract.cpp b/sources/gui/src/wpasupinteract.cpp index 89c7bc9..7be512c 100644 --- a/sources/gui/src/wpasupinteract.cpp +++ b/sources/gui/src/wpasupinteract.cpp @@ -22,7 +22,6 @@ #include "mainwindow.h" #include "netctlinteract.h" #include "sleepthread.h" -#include WpaSup::WpaSup(MainWindow *wid, QStringList wpaConfig, QString sudoPath, QString ifaceDir, QString preferedInterface)