mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
rewrite mainwindow to use helper
This commit is contained in:
parent
23f4a7f141
commit
e64e8810f8
@ -35,10 +35,11 @@ ErrorWindow::~ErrorWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList ErrorWindow::getMessage(const int mess)
|
QStringList ErrorWindow::getMessage(const int mess, const QString custom)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]";
|
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]";
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]" << ":" << "Message" << mess;
|
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]" << ":" << "Message" << mess;
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]" << ":" << "Custom message" << custom;
|
||||||
|
|
||||||
QString message, title;
|
QString message, title;
|
||||||
switch(mess) {
|
switch(mess) {
|
||||||
@ -123,6 +124,8 @@ QStringList ErrorWindow::getMessage(const int mess)
|
|||||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!custom.isEmpty())
|
||||||
|
message = custom;
|
||||||
|
|
||||||
QStringList fullMessage;
|
QStringList fullMessage;
|
||||||
fullMessage.append(title);
|
fullMessage.append(title);
|
||||||
@ -168,13 +171,14 @@ QMessageBox::Icon ErrorWindow::getIcon(const int mess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ErrorWindow::showWindow(const int mess, const QString sender)
|
void ErrorWindow::showWindow(const int mess, const QString sender, const QString custom)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]";
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]";
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Message" << mess;
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Message" << mess;
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Sender" << sender;
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Sender" << sender;
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Custom message" << custom;
|
||||||
|
|
||||||
QStringList message = getMessage(mess);
|
QStringList message = getMessage(mess, custom);
|
||||||
QMessageBox messageBox;
|
QMessageBox messageBox;
|
||||||
messageBox.setText(message[0]);
|
messageBox.setText(message[0]);
|
||||||
messageBox.setInformativeText(message[1]);
|
messageBox.setInformativeText(message[1]);
|
||||||
|
@ -33,11 +33,12 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showWindow(const int mess = 0,
|
void showWindow(const int mess = 0,
|
||||||
const QString sender = QString());
|
const QString sender = QString(),
|
||||||
|
const QString custom = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool debug;
|
bool debug;
|
||||||
QStringList getMessage(const int mess);
|
QStringList getMessage(const int mess, const QString custom = QString());
|
||||||
QMessageBox::Icon getIcon(const int mess);
|
QMessageBox::Icon getIcon(const int mess);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ bool restoreExistSession()
|
|||||||
QString("Restore"));
|
QString("Restore"));
|
||||||
QDBusMessage response = bus.call(request);
|
QDBusMessage response = bus.call(request);
|
||||||
QList<QVariant> arguments = response.arguments();
|
QList<QVariant> arguments = response.arguments();
|
||||||
return ((arguments.size() == 1) && arguments[0].toBool());
|
return !arguments.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +129,10 @@ bool MainWindow::forceStartHelper()
|
|||||||
TaskResult process = runTask(cmd, false);
|
TaskResult process = runTask(cmd, false);
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[checkExternalApps]" << ":" << "Cmd returns" << process.exitCode;
|
if (debug) qDebug() << "[MainWindow]" << "[checkExternalApps]" << ":" << "Cmd returns" << process.exitCode;
|
||||||
|
|
||||||
return isHelperActive();
|
if (process.exitCode == 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,12 +141,10 @@ bool MainWindow::forceStopHelper()
|
|||||||
if (debug) qDebug() << "[MainWindow]" << "[forceStartHelper]";
|
if (debug) qDebug() << "[MainWindow]" << "[forceStartHelper]";
|
||||||
|
|
||||||
QList<QVariant> responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
QList<QVariant> responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
DBUS_HELPER_INTERFACE, QString("Close"));
|
DBUS_HELPER_INTERFACE, QString("Close"),
|
||||||
|
QList<QVariant>(), true);
|
||||||
|
|
||||||
if (responce.size() == 1)
|
return !responce.isEmpty();
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -184,12 +185,19 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
|
|||||||
|
|
||||||
if (passwdWid != 0)
|
if (passwdWid != 0)
|
||||||
delete passwdWid;
|
delete passwdWid;
|
||||||
if (netctlCommand->getWirelessInterfaceList().isEmpty())
|
QStringList interfaces;
|
||||||
|
if (useHelper)
|
||||||
|
interfaces = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("WirelessInterfaces"),
|
||||||
|
QList<QVariant>(), true)[0].toStringList();
|
||||||
|
else
|
||||||
|
interfaces = netctlCommand->getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> settings;
|
||||||
settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'");
|
settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'");
|
||||||
settings[QString("Interface")] = netctlCommand->getWirelessInterfaceList()[0];
|
settings[QString("Interface")] = interfaces[0];
|
||||||
settings[QString("Connection")] = QString("wireless");
|
settings[QString("Connection")] = QString("wireless");
|
||||||
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 2)->text();
|
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 2)->text();
|
||||||
if (security.contains(QString("WPA")))
|
if (security.contains(QString("WPA")))
|
||||||
@ -209,10 +217,33 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
|
|||||||
|
|
||||||
QString profile = QString("netctl-gui-") + settings[QString("ESSID")];
|
QString profile = QString("netctl-gui-") + settings[QString("ESSID")];
|
||||||
profile.remove(QChar('"')).remove(QChar('\''));
|
profile.remove(QChar('"')).remove(QChar('\''));
|
||||||
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
bool status = false;
|
||||||
if (netctlProfile->copyProfile(profileTempName))
|
if (useHelper) {
|
||||||
|
QStringList settingsList;
|
||||||
|
for (int i=0; i<settings.keys().count(); i++)
|
||||||
|
settingsList.append(settings.keys()[i] + QString("==") + settings[settings.keys()[i]]);
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
args.append(settingsList);
|
||||||
|
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Create"),
|
||||||
|
args, true);
|
||||||
|
args.clear();
|
||||||
|
args.append(profile);
|
||||||
|
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Start"),
|
||||||
|
args, true);
|
||||||
|
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||||
|
args, true)[0].toBool();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||||
|
netctlProfile->copyProfile(profileTempName);
|
||||||
netctlCommand->startProfile(profile);
|
netctlCommand->startProfile(profile);
|
||||||
if (netctlCommand->isProfileActive(profile))
|
status = netctlCommand->isProfileActive(profile);
|
||||||
|
}
|
||||||
|
if (status)
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
else
|
else
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
@ -335,20 +366,27 @@ void MainWindow::mainTabEnableProfile()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
|
bool previous = !ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty();
|
||||||
|
bool current;
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||||
netctlCommand->enableProfile(profile);
|
if (useHelper) {
|
||||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
QList<QVariant> args;
|
||||||
if (netctlCommand->isProfileEnabled(profile))
|
args.append(profile);
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
else
|
DBUS_HELPER_INTERFACE, QString("Enable"),
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
args, true);
|
||||||
|
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("isProfileEnabled"),
|
||||||
|
args, true)[0].toBool();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (netctlCommand->isProfileEnabled(profile))
|
netctlCommand->enableProfile(profile);
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
current = netctlCommand->isProfileEnabled(profile);
|
||||||
else
|
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
|
||||||
}
|
}
|
||||||
|
if (current != previous)
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
|
else
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
|
|
||||||
updateMainTab();
|
updateMainTab();
|
||||||
}
|
}
|
||||||
@ -361,7 +399,17 @@ void MainWindow::mainTabRemoveProfile()
|
|||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
// call netctlprofile
|
// call netctlprofile
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||||
if (netctlProfile->removeProfile(profile))
|
bool status;
|
||||||
|
if (useHelper) {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Remove"),
|
||||||
|
args, true)[0].toBool();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
status = netctlProfile->removeProfile(profile);
|
||||||
|
if (status)
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
else
|
else
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
@ -380,8 +428,22 @@ void MainWindow::mainTabRestartProfile()
|
|||||||
|
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||||
netctlCommand->restartProfile(profile);
|
bool status = false;
|
||||||
if (netctlCommand->isProfileActive(profile))
|
if (useHelper) {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Restart"),
|
||||||
|
args, true)[0].toBool();
|
||||||
|
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||||
|
args, true)[0].toBool();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
netctlCommand->restartProfile(profile);
|
||||||
|
status = netctlCommand->isProfileActive(profile);
|
||||||
|
}
|
||||||
|
if (status)
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
else
|
else
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
@ -399,24 +461,27 @@ void MainWindow::mainTabStartProfile()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
|
bool previous = !ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty();
|
||||||
|
bool current;
|
||||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty()) {
|
if (useHelper) {
|
||||||
netctlCommand->startProfile(profile);
|
QList<QVariant> args;
|
||||||
if (netctlCommand->isProfileActive(profile))
|
args.append(profile);
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
else
|
DBUS_HELPER_INTERFACE, QString("Start"),
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
args, true);
|
||||||
|
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||||
|
args, true)[0].toBool();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (netctlCommand->getActiveProfile().isEmpty())
|
netctlCommand->startProfile(profile);
|
||||||
netctlCommand->startProfile(profile);
|
current = netctlCommand->isProfileActive(profile);
|
||||||
else
|
|
||||||
netctlCommand->switchToProfile(profile);
|
|
||||||
if (netctlCommand->isProfileActive(profile))
|
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
|
||||||
else
|
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
|
||||||
}
|
}
|
||||||
|
if (current != previous)
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
|
else
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
|
|
||||||
updateMainTab();
|
updateMainTab();
|
||||||
}
|
}
|
||||||
@ -594,7 +659,13 @@ void MainWindow::profileTabClear()
|
|||||||
if (debug) qDebug() << "[MainWindow]" << "[profileTabClear]";
|
if (debug) qDebug() << "[MainWindow]" << "[profileTabClear]";
|
||||||
|
|
||||||
ui->comboBox_profile->clear();
|
ui->comboBox_profile->clear();
|
||||||
QList<netctlProfileInfo> profiles = netctlCommand->getProfileList();
|
QList<netctlProfileInfo> profiles;
|
||||||
|
if (useHelper)
|
||||||
|
profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("ProfileList"),
|
||||||
|
QList<QVariant>(), true));
|
||||||
|
else
|
||||||
|
profiles = netctlCommand->getProfileList();
|
||||||
for (int i=0; i<profiles.count(); i++)
|
for (int i=0; i<profiles.count(); i++)
|
||||||
ui->comboBox_profile->addItem(profiles[i].name);
|
ui->comboBox_profile->addItem(profiles[i].name);
|
||||||
ui->comboBox_profile->setCurrentIndex(-1);
|
ui->comboBox_profile->setCurrentIndex(-1);
|
||||||
@ -776,8 +847,23 @@ void MainWindow::profileTabCreateProfile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call netctlprofile
|
// call netctlprofile
|
||||||
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
bool status = false;
|
||||||
if (netctlProfile->copyProfile(profileTempName))
|
if (useHelper) {
|
||||||
|
QStringList settingsList;
|
||||||
|
for (int i=0; i<settings.keys().count(); i++)
|
||||||
|
settingsList.append(settings.keys()[i] + QString("==") + settings[settings.keys()[i]]);
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
args.append(settingsList);
|
||||||
|
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Create"),
|
||||||
|
args, true)[0].toBool();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||||
|
status = netctlProfile->copyProfile(profileTempName);
|
||||||
|
}
|
||||||
|
if (status)
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
else
|
else
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
@ -793,7 +879,24 @@ void MainWindow::profileTabLoadProfile()
|
|||||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
||||||
if (profile.isEmpty())
|
if (profile.isEmpty())
|
||||||
return;
|
return;
|
||||||
QMap<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
QMap<QString, QString> settings;
|
||||||
|
if (useHelper) {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
QStringList settingsList = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Profile"),
|
||||||
|
args, true)[0].toStringList();
|
||||||
|
for (int i=0; i<settingsList.count(); i++) {
|
||||||
|
QString key = settingsList[i].split(QString("=="))[0];
|
||||||
|
QString value = settingsList[i].split(QString("=="))[1];
|
||||||
|
settings[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
settings = netctlProfile->getSettingsFromProfile(profile);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (settings.isEmpty())
|
if (settings.isEmpty())
|
||||||
return errorWin->showWindow(17, QString("[MainWindow] : [profileTabLoadProfile]"));
|
return errorWin->showWindow(17, QString("[MainWindow] : [profileTabLoadProfile]"));
|
||||||
|
|
||||||
@ -848,7 +951,17 @@ void MainWindow::profileTabRemoveProfile()
|
|||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
// call netctlprofile
|
// call netctlprofile
|
||||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
||||||
if (netctlProfile->removeProfile(profile))
|
bool status = false;
|
||||||
|
if (useHelper) {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Remove"),
|
||||||
|
args, true)[0].toBool();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
status = netctlProfile->removeProfile(profile);
|
||||||
|
if (status)
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
else
|
else
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
@ -947,20 +1060,32 @@ void MainWindow::wifiTabStart()
|
|||||||
hiddenNetwork = false;
|
hiddenNetwork = false;
|
||||||
QString profile = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text();
|
QString profile = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text();
|
||||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 4)->text().isEmpty()) {
|
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 4)->text().isEmpty()) {
|
||||||
QString profileName = wpaCommand->existentProfile(profile);
|
bool previous = !ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text().isEmpty();
|
||||||
netctlCommand->startProfile(profileName);
|
bool current;
|
||||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text().isEmpty()) {
|
if (useHelper) {
|
||||||
if (netctlCommand->isProfileActive(profileName))
|
QList<QVariant> args;
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
args.append(profile);
|
||||||
else
|
QString profileName = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
DBUS_HELPER_INTERFACE, QString("ProfileByEssid"),
|
||||||
|
args, true)[0].toString();
|
||||||
|
args.clear();
|
||||||
|
args.append(profileName);
|
||||||
|
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("Start"),
|
||||||
|
args, true);
|
||||||
|
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||||
|
args, true)[0].toBool();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (netctlCommand->isProfileActive(profileName))
|
QString profileName = wpaCommand->existentProfile(profile);
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
netctlCommand->startProfile(profileName);
|
||||||
else
|
current = netctlCommand->isProfileActive(profileName);
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
|
||||||
}
|
}
|
||||||
|
if (current != previous)
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||||
|
else
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 1)->text();
|
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 1)->text();
|
||||||
|
@ -123,7 +123,8 @@ QString MainWindow::getInformation()
|
|||||||
QString status;
|
QString status;
|
||||||
if (useHelper) {
|
if (useHelper) {
|
||||||
QStringList request = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
QStringList request = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
DBUS_HELPER_INTERFACE, QString("Information"))[0].toStringList();
|
DBUS_HELPER_INTERFACE, QString("Information"),
|
||||||
|
QList<QVariant>(), true)[0].toStringList();
|
||||||
profile = request[0];
|
profile = request[0];
|
||||||
status = request[1];
|
status = request[1];
|
||||||
}
|
}
|
||||||
@ -162,12 +163,10 @@ bool MainWindow::isHelperActive()
|
|||||||
if (debug) qDebug() << "[MainWindow]" << "[isHelperActive]";
|
if (debug) qDebug() << "[MainWindow]" << "[isHelperActive]";
|
||||||
|
|
||||||
QList<QVariant> responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
QList<QVariant> responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
DBUS_HELPER_INTERFACE, QString("Active"));
|
DBUS_HELPER_INTERFACE, QString("Active"),
|
||||||
|
QList<QVariant>(), true);
|
||||||
|
|
||||||
if (responce.size() == 1)
|
return (!responce.isEmpty());
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -376,27 +375,40 @@ void MainWindow::deleteObjects()
|
|||||||
|
|
||||||
QList<QVariant> MainWindow::sendDBusRequest(const QString service, const QString path,
|
QList<QVariant> MainWindow::sendDBusRequest(const QString service, const QString path,
|
||||||
const QString interface, const QString cmd,
|
const QString interface, const QString cmd,
|
||||||
bool system)
|
const QList<QVariant> args, bool system)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]";
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]";
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Service" << service;
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Service" << service;
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Path" << path;
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Path" << path;
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Interface" << interface;
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Interface" << interface;
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "cmd" << cmd;
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "cmd" << cmd;
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "args" << args;
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "is system bus" << system;
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "is system bus" << system;
|
||||||
|
|
||||||
QList<QVariant> arguments;
|
QList<QVariant> arguments;
|
||||||
|
QDBusMessage response;
|
||||||
if (system) {
|
if (system) {
|
||||||
QDBusConnection bus = QDBusConnection::systemBus();
|
QDBusConnection bus = QDBusConnection::systemBus();
|
||||||
QDBusMessage request = QDBusMessage::createMethodCall(service, path, interface, cmd);
|
QDBusMessage request = QDBusMessage::createMethodCall(service, path, interface, cmd);
|
||||||
QDBusMessage response = bus.call(request);
|
if (!args.isEmpty())
|
||||||
arguments = response.arguments();
|
request.setArguments(args);
|
||||||
|
response = bus.call(request);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||||
QDBusMessage request = QDBusMessage::createMethodCall(service, path, interface, cmd);
|
QDBusMessage request = QDBusMessage::createMethodCall(service, path, interface, cmd);
|
||||||
QDBusMessage response = bus.call(request);
|
if (!args.isEmpty())
|
||||||
arguments = response.arguments();
|
request.setArguments(args);
|
||||||
|
response = bus.call(request);
|
||||||
|
}
|
||||||
|
arguments = response.arguments();
|
||||||
|
if ((arguments.size() == 0) &&
|
||||||
|
(service != DBUS_HELPER_SERVICE) &&
|
||||||
|
(path != DBUS_CONTROL_PATH) &&
|
||||||
|
(interface != DBUS_HELPER_INTERFACE) &&
|
||||||
|
(cmd != QString("Active"))) {
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[sendDBusRequest]" << ":" << "Error message" << response.errorMessage();
|
||||||
|
errorWin->showWindow(0, QString("[MainWindow] : [sendDBusRequest]"), response.errorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return arguments;
|
return arguments;
|
||||||
@ -506,6 +518,7 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
|
|||||||
delete settingsWin;
|
delete settingsWin;
|
||||||
|
|
||||||
createObjects();
|
createObjects();
|
||||||
|
if (useHelper) useHelper = isHelperActive();
|
||||||
setTab(args[QString("tab")].toInt() - 1);
|
setTab(args[QString("tab")].toInt() - 1);
|
||||||
createActions();
|
createActions();
|
||||||
setIconsToTabs();
|
setIconsToTabs();
|
||||||
@ -669,13 +682,21 @@ void MainWindow::updateMainTab()
|
|||||||
return errorWin->showWindow(1, QString("[MainWindow] : [updateMainTab]"));
|
return errorWin->showWindow(1, QString("[MainWindow] : [updateMainTab]"));
|
||||||
|
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
ui->widget_netctlAuto->setHidden(!netctlCommand->isNetctlAutoRunning());
|
|
||||||
QList<netctlProfileInfo> profiles;
|
QList<netctlProfileInfo> profiles;
|
||||||
if (useHelper)
|
bool netctlAutoStatus = false;
|
||||||
|
if (useHelper) {
|
||||||
|
netctlAutoStatus = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
|
DBUS_HELPER_INTERFACE, QString("isNetctlAutoActive"),
|
||||||
|
QList<QVariant>(), true)[0].toBool();
|
||||||
profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||||
DBUS_HELPER_INTERFACE, QString("ProfileList")));
|
DBUS_HELPER_INTERFACE, QString("ProfileList"),
|
||||||
else
|
QList<QVariant>(), true));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
netctlAutoStatus = netctlCommand->isNetctlAutoRunning();
|
||||||
profiles = netctlCommand->getProfileList();
|
profiles = netctlCommand->getProfileList();
|
||||||
|
}
|
||||||
|
ui->widget_netctlAuto->setHidden(!netctlAutoStatus);
|
||||||
|
|
||||||
ui->tableWidget_main->setSortingEnabled(false);
|
ui->tableWidget_main->setSortingEnabled(false);
|
||||||
ui->tableWidget_main->selectRow(-1);
|
ui->tableWidget_main->selectRow(-1);
|
||||||
@ -759,8 +780,9 @@ void MainWindow::updateWifiTab()
|
|||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
QList<netctlWifiInfo> scanResults;
|
QList<netctlWifiInfo> scanResults;
|
||||||
if (useHelper)
|
if (useHelper)
|
||||||
scanResults = parseOutputWifi(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
scanResults = parseOutputWifi(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH,
|
||||||
DBUS_HELPER_INTERFACE, QString("WiFi")));
|
DBUS_HELPER_INTERFACE, QString("WiFi"),
|
||||||
|
QList<QVariant>(), true));
|
||||||
else
|
else
|
||||||
scanResults = wpaCommand->scanWifi();
|
scanResults = wpaCommand->scanWifi();
|
||||||
|
|
||||||
|
@ -147,6 +147,7 @@ private:
|
|||||||
void keyPressEvent(QKeyEvent *pressedKey);
|
void keyPressEvent(QKeyEvent *pressedKey);
|
||||||
QList<QVariant> sendDBusRequest(const QString service, const QString path,
|
QList<QVariant> sendDBusRequest(const QString service, const QString path,
|
||||||
const QString interface, const QString cmd,
|
const QString interface, const QString cmd,
|
||||||
|
const QList<QVariant> args = QList<QVariant>(),
|
||||||
const bool system = true);
|
const bool system = true);
|
||||||
void setIconsToTabs();
|
void setIconsToTabs();
|
||||||
QString configPath;
|
QString configPath;
|
||||||
|
@ -27,6 +27,7 @@ ControlAdaptor::ControlAdaptor(NetctlHelper *parent, const QMap<QString, QString
|
|||||||
{
|
{
|
||||||
netctlCommand = new Netctl(false, configuration);
|
netctlCommand = new Netctl(false, configuration);
|
||||||
netctlProfile = new NetctlProfile(false, configuration);
|
netctlProfile = new NetctlProfile(false, configuration);
|
||||||
|
wpaCommand = new WpaSup(false, configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ ControlAdaptor::~ControlAdaptor()
|
|||||||
{
|
{
|
||||||
delete netctlCommand;
|
delete netctlCommand;
|
||||||
delete netctlProfile;
|
delete netctlProfile;
|
||||||
|
delete wpaCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +121,40 @@ bool ControlAdaptor::SwitchTo(const QString profile)
|
|||||||
|
|
||||||
|
|
||||||
// netctlProfile
|
// netctlProfile
|
||||||
|
bool ControlAdaptor::Create(const QString profile, const QStringList settingsList)
|
||||||
|
{
|
||||||
|
QMap<QString, QString> settings;
|
||||||
|
for (int i=0; i<settingsList.count(); i++) {
|
||||||
|
QString key = settingsList[i].split(QString("=="))[0];
|
||||||
|
QString value = settingsList[i].split(QString("=="))[1];
|
||||||
|
settings[key] = value;
|
||||||
|
}
|
||||||
|
QString temporaryProfile = netctlProfile->createProfile(profile, settings);
|
||||||
|
|
||||||
|
return netctlProfile->copyProfile(temporaryProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ControlAdaptor::Remove(const QString profile)
|
bool ControlAdaptor::Remove(const QString profile)
|
||||||
{
|
{
|
||||||
return netctlProfile->removeProfile(profile);
|
return netctlProfile->removeProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// wpaCommand
|
||||||
|
QStringList ControlAdaptor::WiFi()
|
||||||
|
{
|
||||||
|
QList<netctlWifiInfo> wifiPoints = wpaCommand->scanWifi();
|
||||||
|
QStringList info;
|
||||||
|
for (int i=0; i<wifiPoints.count(); i++) {
|
||||||
|
QStringList point;
|
||||||
|
point.append(wifiPoints[i].name);
|
||||||
|
point.append(wifiPoints[i].security);
|
||||||
|
point.append(wifiPoints[i].signal);
|
||||||
|
point.append(QString::number(wifiPoints[i].active));
|
||||||
|
point.append(QString::number(wifiPoints[i].exists));
|
||||||
|
info.append(point.join(QChar('|')));
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
@ -52,12 +52,16 @@ public slots:
|
|||||||
bool Start(const QString profile);
|
bool Start(const QString profile);
|
||||||
bool SwitchTo(const QString profile);
|
bool SwitchTo(const QString profile);
|
||||||
// netctlProfile
|
// netctlProfile
|
||||||
|
bool Create(const QString profile, const QStringList settingsList);
|
||||||
bool Remove(const QString profile);
|
bool Remove(const QString profile);
|
||||||
|
// wpaCommand
|
||||||
|
QStringList WiFi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NetctlHelper *helper;
|
NetctlHelper *helper;
|
||||||
Netctl *netctlCommand;
|
Netctl *netctlCommand;
|
||||||
NetctlProfile *netctlProfile;
|
NetctlProfile *netctlProfile;
|
||||||
|
WpaSup *wpaCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,15 +41,12 @@ bool checkExistSession()
|
|||||||
QString("Active"));
|
QString("Active"));
|
||||||
QDBusMessage response = bus.call(request);
|
QDBusMessage response = bus.call(request);
|
||||||
QList<QVariant> arguments = response.arguments();
|
QList<QVariant> arguments = response.arguments();
|
||||||
return ((arguments.size() == 1) && arguments[0].toBool());
|
return !arguments.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// setuid(getuid());
|
|
||||||
// qDebug() << getuid();
|
|
||||||
// qDebug() << geteuid();
|
|
||||||
// detach from console
|
// detach from console
|
||||||
bool isDaemon = true;
|
bool isDaemon = true;
|
||||||
for (int i=0; i<argc; i++)
|
for (int i=0; i<argc; i++)
|
||||||
|
@ -122,7 +122,7 @@ QStringList NetctlAdaptor::Profile(const QString profile)
|
|||||||
QMap<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
QMap<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
||||||
QStringList settingsList;
|
QStringList settingsList;
|
||||||
for (int i=0; i<settings.keys().count(); i++)
|
for (int i=0; i<settings.keys().count(); i++)
|
||||||
settingsList.append(settings.keys()[i] + QString("=") +
|
settingsList.append(settings.keys()[i] + QString("==") +
|
||||||
settings[settings.keys()[i]]);
|
settings[settings.keys()[i]]);
|
||||||
|
|
||||||
return settingsList;
|
return settingsList;
|
||||||
@ -142,19 +142,7 @@ QString NetctlAdaptor::ProfileByEssid(const QString essid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList NetctlAdaptor::WiFi()
|
QStringList NetctlAdaptor::WirelessInterfaces()
|
||||||
{
|
{
|
||||||
QList<netctlWifiInfo> wifiPoints = wpaCommand->scanWifi();
|
return netctlCommand->getWirelessInterfaceList();
|
||||||
QStringList info;
|
|
||||||
for (int i=0; i<wifiPoints.count(); i++) {
|
|
||||||
QStringList point;
|
|
||||||
point.append(wifiPoints[i].name);
|
|
||||||
point.append(wifiPoints[i].security);
|
|
||||||
point.append(wifiPoints[i].signal);
|
|
||||||
point.append(QString::number(wifiPoints[i].active));
|
|
||||||
point.append(QString::number(wifiPoints[i].exists));
|
|
||||||
info.append(point.join(QChar('|')));
|
|
||||||
}
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public slots:
|
|||||||
QString ProfileValue(const QString profile, const QString key);
|
QString ProfileValue(const QString profile, const QString key);
|
||||||
// wpaCommand
|
// wpaCommand
|
||||||
QString ProfileByEssid(const QString essid);
|
QString ProfileByEssid(const QString essid);
|
||||||
QStringList WiFi();
|
QStringList WirelessInterfaces();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Netctl *netctlCommand;
|
Netctl *netctlCommand;
|
||||||
|
@ -114,7 +114,7 @@ void NetctlHelper::quitHelper()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlHelper]" << "[quitHelper]";
|
if (debug) qDebug() << "[NetctlHelper]" << "[quitHelper]";
|
||||||
|
|
||||||
QCoreApplication::quit();
|
QCoreApplication::instance()->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,12 +364,13 @@ bool Netctl::isNetctlAutoRunning()
|
|||||||
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not find service";
|
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not find service";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not interface";
|
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not interface";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString interface = getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
||||||
|
|
||||||
return cmdCall(false, systemctlCommand, QString("is-active"), argument);
|
return cmdCall(false, systemctlCommand, QString("is-active"), argument);
|
||||||
@ -523,12 +524,13 @@ bool Netctl::autoEnableService()
|
|||||||
if (debug) qDebug() << "[Netctl]" << "[autoEnableService]" << ":" << "Could not find service";
|
if (debug) qDebug() << "[Netctl]" << "[autoEnableService]" << ":" << "Could not find service";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoEnableService]" << ":" << "Could not interface";
|
if (debug) qDebug() << "[Netctl]" << "[autoEnableService]" << ":" << "Could not interface";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString interface = getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
||||||
|
|
||||||
if (isNetctlAutoEnabled())
|
if (isNetctlAutoEnabled())
|
||||||
@ -548,12 +550,13 @@ bool Netctl::autoRestartService()
|
|||||||
if (debug) qDebug() << "[Netctl]" << "[autoRestartService]" << ":" << "Could not find service";
|
if (debug) qDebug() << "[Netctl]" << "[autoRestartService]" << ":" << "Could not find service";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoRestartService]" << ":" << "Could not interface";
|
if (debug) qDebug() << "[Netctl]" << "[autoRestartService]" << ":" << "Could not interface";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString interface = getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
||||||
|
|
||||||
if (isNetctlAutoRunning())
|
if (isNetctlAutoRunning())
|
||||||
@ -573,12 +576,13 @@ bool Netctl::autoStartService()
|
|||||||
if (debug) qDebug() << "[Netctl]" << "[autoStartService]" << ":" << "Could not find service";
|
if (debug) qDebug() << "[Netctl]" << "[autoStartService]" << ":" << "Could not find service";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[Netctl]" << "[autoStartService]" << ":" << "Could not interface";
|
if (debug) qDebug() << "[Netctl]" << "[autoStartService]" << ":" << "Could not interface";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString interface = getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
QString argument = netctlAutoService + QString("@") + interface + QString(".service");
|
||||||
|
|
||||||
if (isNetctlAutoRunning())
|
if (isNetctlAutoRunning())
|
||||||
|
@ -253,14 +253,15 @@ bool WpaSup::startWpaSupplicant()
|
|||||||
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find library";
|
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find library";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (netctlCommand->getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = netctlCommand->getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find interfaces";
|
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find interfaces";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QFile(pidFile).exists())
|
if (QFile(pidFile).exists())
|
||||||
return true;
|
return true;
|
||||||
QString interface = netctlCommand->getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString cmd = sudoCommand + QString(" ") + wpaSupPath + QString(" -B -P ") + pidFile +
|
QString cmd = sudoCommand + QString(" ") + wpaSupPath + QString(" -B -P ") + pidFile +
|
||||||
QString(" -i ") + interface + QString(" -D ") + wpaDrivers +
|
QString(" -i ") + interface + QString(" -D ") + wpaDrivers +
|
||||||
QString(" -C \"DIR=") + ctrlDir + QString(" GROUP=") + ctrlGroup + QString("\"");
|
QString(" -C \"DIR=") + ctrlDir + QString(" GROUP=") + ctrlGroup + QString("\"");
|
||||||
@ -311,12 +312,13 @@ QString WpaSup::getWpaCliOutput(const QString commandLine)
|
|||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find library";
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find library";
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
if (netctlCommand->getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = netctlCommand->getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find interfaces";
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find interfaces";
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString interface = netctlCommand->getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString cmd = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
QString cmd = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
||||||
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << cmd;
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << cmd;
|
||||||
@ -365,12 +367,13 @@ bool WpaSup::wpaCliCall(const QString commandLine)
|
|||||||
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find library";
|
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find library";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (netctlCommand->getWirelessInterfaceList().isEmpty()) {
|
QStringList interfaces = netctlCommand->getWirelessInterfaceList();
|
||||||
|
if (interfaces.isEmpty()) {
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find interfaces";
|
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find interfaces";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString interface = netctlCommand->getWirelessInterfaceList()[0];
|
QString interface = interfaces[0];
|
||||||
QString cmd = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
QString cmd = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
||||||
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << cmd;
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << cmd;
|
||||||
|
Loading…
Reference in New Issue
Block a user