diff --git a/sources/gui/src/mainactions.cpp b/sources/gui/src/mainactions.cpp index ee55050..ed0858d 100644 --- a/sources/gui/src/mainactions.cpp +++ b/sources/gui/src/mainactions.cpp @@ -143,7 +143,7 @@ bool MainWindow::forceStopHelper() QList responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Close"), - QList(), true); + QList(), true, debug); return !responce.isEmpty(); } @@ -190,7 +190,7 @@ void MainWindow::connectToUnknownEssid(const QString passwd) if (useHelper) interfaces = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("WirelessInterfaces"), - QList(), true)[0].toStringList(); + QList(), true, debug)[0].toStringList(); else interfaces = netctlCommand->getWirelessInterfaceList(); if (interfaces.isEmpty()) @@ -228,15 +228,15 @@ void MainWindow::connectToUnknownEssid(const QString passwd) args.append(settingsList); sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Create"), - args, true); + args, true, debug); args.clear(); args.append(profile); sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Start"), - args, true); + args, true, debug); status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("isProfileActive"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); } else { QString profileTempName = netctlProfile->createProfile(profile, settings); @@ -375,10 +375,10 @@ void MainWindow::mainTabEnableProfile() args.append(profile); sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Enable"), - args, true); + args, true, debug); current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("isProfileEnabled"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); } else { netctlCommand->enableProfile(profile); @@ -406,7 +406,7 @@ void MainWindow::mainTabRemoveProfile() args.append(profile); status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Remove"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); } else status = netctlProfile->removeProfile(profile); @@ -435,10 +435,10 @@ void MainWindow::mainTabRestartProfile() args.append(profile); sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Restart"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("isProfileActive"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); } else { netctlCommand->restartProfile(profile); @@ -470,10 +470,10 @@ void MainWindow::mainTabStartProfile() args.append(profile); sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Start"), - args, true); + args, true, debug); current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("isProfileActive"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); } else { netctlCommand->startProfile(profile); @@ -664,7 +664,7 @@ void MainWindow::profileTabClear() if (useHelper) profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("ProfileList"), - QList(), true)); + QList(), true, debug), debug); else profiles = netctlCommand->getProfileList(); for (int i=0; icreateProfile(profile, settings); @@ -886,7 +886,7 @@ void MainWindow::profileTabLoadProfile() args.append(profile); QStringList settingsList = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("Profile"), - args, true)[0].toStringList(); + args, true, debug)[0].toStringList(); for (int i=0; iremoveProfile(profile); @@ -1068,15 +1068,15 @@ void MainWindow::wifiTabStart() args.append(profile); QString profileName = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("ProfileByEssid"), - args, true)[0].toString(); + args, true, debug)[0].toString(); args.clear(); args.append(profileName); sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Start"), - args, true); + args, true, debug); current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("isProfileActive"), - args, true)[0].toBool(); + args, true, debug)[0].toBool(); } else { QString profileName = wpaCommand->existentProfile(profile); diff --git a/sources/gui/src/mainwindow.cpp b/sources/gui/src/mainwindow.cpp index 8965257..96a04cd 100644 --- a/sources/gui/src/mainwindow.cpp +++ b/sources/gui/src/mainwindow.cpp @@ -125,7 +125,7 @@ QString MainWindow::getInformation() if (useHelper) { QStringList request = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("Information"), - QList(), true)[0].toStringList(); + QList(), true, debug)[0].toStringList(); profile = request[0]; status = request[1]; } @@ -165,7 +165,7 @@ bool MainWindow::isHelperActive() QList responce = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("Active"), - QList(), true); + QList(), true, debug); return (!responce.isEmpty()); } @@ -605,10 +605,10 @@ void MainWindow::updateMainTab() if (useHelper) { netctlAutoStatus = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("isNetctlAutoActive"), - QList(), true)[0].toBool(); + QList(), true, debug)[0].toBool(); profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, DBUS_HELPER_INTERFACE, QString("ProfileList"), - QList(), true)); + QList(), true, debug), debug); } else { netctlAutoStatus = netctlCommand->isNetctlAutoRunning(); @@ -700,7 +700,7 @@ void MainWindow::updateWifiTab() if (useHelper) scanResults = parseOutputWifi(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, DBUS_HELPER_INTERFACE, QString("WiFi"), - QList(), true)); + QList(), true, debug), debug); else scanResults = wpaCommand->scanWifi(); diff --git a/sources/gui/src/netctlautowindow.cpp b/sources/gui/src/netctlautowindow.cpp index fa207d9..06a9339 100644 --- a/sources/gui/src/netctlautowindow.cpp +++ b/sources/gui/src/netctlautowindow.cpp @@ -169,12 +169,26 @@ void NetctlAutoWindow::netctlAutoUpdateTable() ui->tableWidget->setDisabled(true); // actions - if (netctlCommand->isNetctlAutoEnabled()) + bool enabled = false; + bool running = false; + if (useHelper) { + enabled = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, + DBUS_HELPER_INTERFACE, QString("isNetctlAutoEnabled"), + QList(), true, debug)[0].toBool(); + running = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, + DBUS_HELPER_INTERFACE, QString("isNetctlAutoRunning"), + QList(), true, debug)[0].toBool(); + } + else { + enabled = netctlCommand->isNetctlAutoEnabled(); + running = netctlCommand->isNetctlAutoRunning(); + } + if (enabled) ui->actionEnableService->setText(QApplication::translate("NetctlAutoWindow", "Disable service")); else ui->actionEnableService->setText(QApplication::translate("NetctlAutoWindow", "Enable service")); ui->actionEnableService->setVisible(true); - if (netctlCommand->isNetctlAutoRunning()) { + if (running) { ui->label_info->setText(QApplication::translate("NetctlAutoWindow", "netctl-auto is running")); ui->actionStartService->setText(QApplication::translate("NetctlAutoWindow", "Stop service")); ui->actionDisableAll->setVisible(true); @@ -190,7 +204,13 @@ void NetctlAutoWindow::netctlAutoUpdateTable() netctlAutoRefreshButtons(0, 0); return; } - QList profiles = netctlCommand->getProfileListFromNetctlAuto(); + QList profiles; + if (useHelper) + profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, + DBUS_HELPER_INTERFACE, QString("ProfileList"), + QList(), true, debug), debug); + else + profiles = netctlCommand->getProfileListFromNetctlAuto(); ui->tableWidget->setSortingEnabled(false); ui->tableWidget->selectRow(-1); @@ -257,7 +277,14 @@ void NetctlAutoWindow::netctlAutoDisableAllProfiles() if (debug) qDebug() << "[NetctlAutoWindow]" << "[netctlAutoDisableAllProfiles]"; ui->tableWidget->setDisabled(true); - if (netctlCommand->autoDisableAllProfiles()) + bool status = false; + if (useHelper) + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoDisableAll"), + QList(), true, debug)[0].toBool(); + else + status = netctlCommand->autoDisableAllProfiles(); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error")); @@ -274,7 +301,17 @@ void NetctlAutoWindow::netctlAutoEnableProfile() return; ui->tableWidget->setDisabled(true); QString profile = ui->tableWidget->item(ui->tableWidget->currentItem()->row(), 0)->text(); - if (netctlCommand->autoEnableProfile(profile)) + bool status = false; + if (useHelper) { + QList args; + args.append(profile); + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoEnable"), + args, true, debug)[0].toBool(); + } + else + status = netctlCommand->autoEnableProfile(profile); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error")); @@ -288,7 +325,14 @@ void NetctlAutoWindow::netctlAutoEnableAllProfiles() if (debug) qDebug() << "[NetctlAutoWindow]" << "[netctlAutoEnableAllProfiles]"; ui->tableWidget->setDisabled(true); - if (netctlCommand->autoEnableAllProfiles()) + bool status = false; + if (useHelper) + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoEnableAll"), + QList(), true, debug)[0].toBool(); + else + status = netctlCommand->autoEnableAllProfiles(); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error")); @@ -305,7 +349,17 @@ void NetctlAutoWindow::netctlAutoStartProfile() return; ui->tableWidget->setDisabled(true); QString profile = ui->tableWidget->item(ui->tableWidget->currentItem()->row(), 0)->text(); - if (netctlCommand->autoStartProfile(profile)) + bool status = false; + if (useHelper) { + QList args; + args.append(profile); + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoStart"), + args, true, debug)[0].toBool(); + } + else + status = netctlCommand->autoStartProfile(profile); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error")); @@ -318,7 +372,14 @@ void NetctlAutoWindow::netctlAutoEnableService() { if (debug) qDebug() << "[NetctlAutoWindow]" << "[netctlAutoEnableService]"; - if (netctlCommand->autoEnableService()) + bool status = false; + if (useHelper) + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoServiceEnable"), + QList(), true, debug)[0].toBool(); + else + status = netctlCommand->autoEnableService(); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error")); @@ -331,7 +392,14 @@ void NetctlAutoWindow::netctlAutoRestartService() { if (debug) qDebug() << "[NetctlAutoWindow]" << "[netctlAutoRestartService]"; - if (netctlCommand->autoRestartService()) + bool status = false; + if (useHelper) + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoServiceRestart"), + QList(), true, debug)[0].toBool(); + else + status = netctlCommand->autoRestartService(); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error")); @@ -344,7 +412,14 @@ void NetctlAutoWindow::netctlAutoStartService() { if (debug) qDebug() << "[NetctlAutoWindow]" << "[netctlAutoStartService]"; - if (netctlCommand->autoStartService()) + bool status = false; + if (useHelper) + status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CONTROL_PATH, + DBUS_HELPER_INTERFACE, QString("autoServiceStart"), + QList(), true, debug)[0].toBool(); + else + status = netctlCommand->autoStartService(); + if (status) ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Done")); else ui->statusBar->showMessage(QApplication::translate("NetctlAutoWindow", "Error"));