mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-06 10:35:46 +00:00
end work on interfaces
This commit is contained in:
@ -243,7 +243,7 @@ small {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList netctlVerboseProfileList()</td>
|
||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED</code> from netctl even if netctl-auto is running</td>
|
||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED|NETCTL-AUTO</code> from netctl even if netctl-auto is running</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -253,7 +253,7 @@ small {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList VerboseProfileList()</td>
|
||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED</code></td>
|
||||
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED|NETCTL-AUTO</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -393,11 +393,6 @@ small {
|
||||
<td>returns the application process UIDs <code>[UID, EUID]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QStringList VerboseInformation()</td>
|
||||
<td>returns information in format <code>[isNetctlAutoActive, ProfileList, ActiveProfile, isProfileEnabled/autoIsProfileEnabled]</code></td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a href="#links" class="anchor" id="links"></a>External links</h2>
|
||||
|
@ -1,6 +1,7 @@
|
||||
# set files
|
||||
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp)
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
||||
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
||||
|
@ -19,11 +19,32 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <listmap/listmap.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "dbusoperation.h"
|
||||
|
||||
|
||||
InterfaceAnswer createProfileSlot(const QString profile, QMap<QString,QString> settings,
|
||||
NetctlInterface* interface, const bool useHelper, const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
if (!useHelper) return interface->createProfile(profile, settings);
|
||||
try {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
args.append(mapToList(settings));
|
||||
int responce = sendRequestToInterfaceWithArgs(QString("Create"), args, debug)[0].toInt();
|
||||
return static_cast<InterfaceAnswer>(responce);
|
||||
} catch (...) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||
return InterfaceAnswer::Error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug)
|
||||
{
|
||||
@ -43,6 +64,25 @@ InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interf
|
||||
}
|
||||
|
||||
|
||||
InterfaceAnswer removeProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
if (!useHelper) return interface->removeProfile(profile);
|
||||
try {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
int responce = sendRequestToInterfaceWithArgs(QString("Remove"), args, debug)[0].toInt();
|
||||
return static_cast<InterfaceAnswer>(responce);
|
||||
} catch (...) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||
return InterfaceAnswer::Error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InterfaceAnswer restartProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug)
|
||||
{
|
||||
@ -114,3 +154,92 @@ InterfaceAnswer switchToProfileSlot(const QString profile, NetctlInterface *inte
|
||||
return InterfaceAnswer::Error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InterfaceAnswer connectToEssid(const QString essid, QMap<QString,QString> settings,
|
||||
NetctlInterface* interface, const bool useHelper, const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "ESSID" << essid;
|
||||
|
||||
|
||||
if (!useHelper) return interface->connectToEssid(essid, settings);
|
||||
try {
|
||||
QList<QVariant> args;
|
||||
args.append(essid);
|
||||
args.append(mapToList(settings));
|
||||
int responce = sendRequestToInterfaceWithArgs(QString("Essid"), args, debug)[0].toInt();
|
||||
return static_cast<InterfaceAnswer>(responce);
|
||||
} catch (...) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||
return InterfaceAnswer::Error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
netctlInformation generalInformation(NetctlInterface* interface, const bool useHelper,
|
||||
const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (!useHelper) return interface->information();
|
||||
try {
|
||||
QList<QVariant> responce = sendRequestToInterface(QString("Information"), debug);
|
||||
// main
|
||||
netctlInformation info;
|
||||
info.netctlAuto = responce[0].toStringList().takeFirst().toInt();
|
||||
QList<netctlProfileInfo> profiles = parseOutputNetctl(responce);
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
if (profiles[i].netctlAuto)
|
||||
info.netctlAutoProfiles.append(profiles[i]);
|
||||
else
|
||||
info.netctlProfiles.append(profiles[i]);
|
||||
}
|
||||
return info;
|
||||
} catch (...) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||
return netctlInformation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> profileInformation(const QString profile, NetctlInterface* interface,
|
||||
const bool useHelper, const bool debug)
|
||||
{
|
||||
if (!useHelper) return interface->profileSettings(profile);
|
||||
try {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
QStringList responce = sendRequestToInterfaceWithArgs(QString("Profile"), args, debug)[0].toStringList();
|
||||
return listToMap(responce);
|
||||
} catch (...) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||
return QMap<QString, QString>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
netctlCurrent trayInformation(NetctlInterface *interface, const bool useHelper,
|
||||
const bool debug)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (!useHelper) return interface->status();
|
||||
try {
|
||||
QStringList responce = sendRequestToInterface(QString("Status"), debug)[0].toStringList();
|
||||
netctlCurrent status;
|
||||
status.netctlAuto = responce[0].toInt();
|
||||
status.profiles = responce[1].split(QChar('|'));
|
||||
status.current = responce[2].split(QChar('|'));
|
||||
QStringList enables = responce[3].split(QChar('|'));
|
||||
for (int i=0; i<enables.count(); i++)
|
||||
status.enables.append(enables[i].toInt());
|
||||
return status;
|
||||
} catch (...) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||
return netctlCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -18,22 +18,38 @@
|
||||
#ifndef CALLS_H
|
||||
#define CALLS_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
|
||||
// control
|
||||
InterfaceAnswer createProfileSlot(const QString profile, const QMap<QString,QString> settings,
|
||||
NetctlInterface *interface, const bool useHelper,
|
||||
const bool debug = false);
|
||||
InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug = false);
|
||||
InterfaceAnswer removeProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug = false);
|
||||
InterfaceAnswer restartProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug = false);
|
||||
InterfaceAnswer startProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug = false);
|
||||
InterfaceAnswer stopAllProfilesSlot(NetctlInterface *interface, const bool useHelper,
|
||||
const bool debug);
|
||||
const bool debug = false);
|
||||
InterfaceAnswer switchToProfileSlot(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug);
|
||||
const bool useHelper, const bool debug = false);
|
||||
// wireless connection
|
||||
InterfaceAnswer connectToEssid(const QString essid, QMap<QString,QString> settings,
|
||||
NetctlInterface *interface, const bool useHelper,
|
||||
const bool debug = false);
|
||||
// information
|
||||
netctlInformation generalInformation(NetctlInterface *interface, const bool useHelper,
|
||||
const bool debug = false);
|
||||
QMap<QString, QString> profileInformation(const QString profile, NetctlInterface *interface,
|
||||
const bool useHelper, const bool debug = false);
|
||||
netctlCurrent trayInformation(NetctlInterface *interface, const bool useHelper,
|
||||
const bool debug = false);
|
||||
|
||||
|
||||
#endif /* CALLS_H */
|
||||
|
@ -33,7 +33,7 @@ QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw)
|
||||
QStringList list = raw[0].toStringList();
|
||||
for (int i=0; i<list.count(); i++) {
|
||||
QStringList info = list[i].split(QChar('|'));
|
||||
if (info.count() != 7) continue;
|
||||
if (info.count() != 8) continue;
|
||||
netctlProfileInfo profile;
|
||||
profile.name = info[0];
|
||||
profile.description = info[1];
|
||||
@ -42,6 +42,7 @@ QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw)
|
||||
profile.essid = info[4];
|
||||
profile.active = info[5].toInt();
|
||||
profile.enabled = info[6].toInt();
|
||||
profile.netctlAuto = info[7].toInt();
|
||||
profileInfo.append(profile);
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "calls.h"
|
||||
#include "commonfunctions.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include "netctlautowindow.h"
|
||||
|
||||
|
||||
MainWidget::MainWidget(QWidget *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
||||
@ -140,28 +140,15 @@ void MainWidget::updateMainTab()
|
||||
}
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QList<netctlProfileInfo> profiles;
|
||||
bool netctlAutoStatus = false;
|
||||
if (useHelper) {
|
||||
QList<QVariant> responce = sendRequestToLib(QString("isNetctlAutoActive"), debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return updateMainTab();
|
||||
}
|
||||
netctlAutoStatus = responce[0].toBool();
|
||||
profiles = parseOutputNetctl(sendRequestToLib(QString("netctlVerboseProfileList"), debug));
|
||||
} else {
|
||||
netctlAutoStatus = mainWindow->netctlCommand->isNetctlAutoRunning();
|
||||
profiles = mainWindow->netctlCommand->getProfileList();
|
||||
}
|
||||
ui->label_netctlAuto->setHidden(!netctlAutoStatus);
|
||||
netctlInformation info = generalInformation(mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
ui->label_netctlAuto->setHidden(!info.netctlAuto);
|
||||
|
||||
ui->tableWidget_main->setSortingEnabled(false);
|
||||
ui->tableWidget_main->selectRow(-1);
|
||||
ui->tableWidget_main->sortByColumn(0, Qt::AscendingOrder);
|
||||
ui->tableWidget_main->clear();
|
||||
ui->tableWidget_main->setRowCount(profiles.count());
|
||||
ui->tableWidget_main->setRowCount(info.netctlProfiles.count());
|
||||
|
||||
// create header
|
||||
QStringList headerList;
|
||||
@ -171,35 +158,36 @@ void MainWidget::updateMainTab()
|
||||
headerList.append(QApplication::translate("MainWidget", "Enabled"));
|
||||
ui->tableWidget_main->setHorizontalHeaderLabels(headerList);
|
||||
// create items
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
for (int i=0; i<info.netctlProfiles.count(); i++) {
|
||||
// font
|
||||
QFont font;
|
||||
font.setBold(profiles[i].active);
|
||||
font.setItalic(profiles[i].enabled);
|
||||
font.setBold(info.netctlProfiles[i].active);
|
||||
font.setItalic(info.netctlProfiles[i].enabled);
|
||||
// tooltip
|
||||
QString toolTip = QString("");
|
||||
toolTip += QString("%1: %2@%3\n").arg(QApplication::translate("MainWidget", "Type"))
|
||||
.arg(profiles[i].type).arg(profiles[i].interface);
|
||||
.arg(info.netctlProfiles[i].type)
|
||||
.arg(info.netctlProfiles[i].interface);
|
||||
toolTip += QString("%1: %2\n").arg(QApplication::translate("MainWidget", "Active"))
|
||||
.arg(checkStatus(profiles[i].active));
|
||||
.arg(checkStatus(info.netctlProfiles[i].active));
|
||||
toolTip += QString("%1: %2\n").arg(QApplication::translate("MainWidget", "Enabled"))
|
||||
.arg(checkStatus(profiles[i].enabled));
|
||||
.arg(checkStatus(info.netctlProfiles[i].enabled));
|
||||
toolTip += QString("%1: %2").arg(QApplication::translate("MainWidget", "Is wireless"))
|
||||
.arg(checkStatus(!profiles[i].essid.isEmpty()));
|
||||
.arg(checkStatus(!info.netctlProfiles[i].essid.isEmpty()));
|
||||
// name
|
||||
ui->tableWidget_main->setItem(i, 0, new QTableWidgetItem(profiles[i].name));
|
||||
ui->tableWidget_main->setItem(i, 0, new QTableWidgetItem(info.netctlProfiles[i].name));
|
||||
ui->tableWidget_main->item(i, 0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
ui->tableWidget_main->item(i, 0)->setToolTip(toolTip);
|
||||
ui->tableWidget_main->item(i, 0)->setFont(font);
|
||||
// description
|
||||
ui->tableWidget_main->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
||||
ui->tableWidget_main->setItem(i, 1, new QTableWidgetItem(info.netctlProfiles[i].description));
|
||||
ui->tableWidget_main->item(i, 1)->setTextAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
||||
ui->tableWidget_main->item(i, 1)->setToolTip(toolTip);
|
||||
// active
|
||||
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(checkStatus(profiles[i].active, true)));
|
||||
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(checkStatus(info.netctlProfiles[i].active, true)));
|
||||
ui->tableWidget_main->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
// enabled
|
||||
ui->tableWidget_main->setItem(i, 3, new QTableWidgetItem(checkStatus(profiles[i].enabled, true)));
|
||||
ui->tableWidget_main->setItem(i, 3, new QTableWidgetItem(checkStatus(info.netctlProfiles[i].enabled, true)));
|
||||
ui->tableWidget_main->item(i, 3)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
@ -305,7 +293,10 @@ void MainWidget::mainTabEnableProfile()
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
mainWindow->showMessage(mainWindow->enableProfileSlot(profile));
|
||||
InterfaceAnswer answer = enableProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
// TODO check if status has been changed?
|
||||
mainWindow->showMessage(answer != InterfaceAnswer::Error);
|
||||
|
||||
updateMainTab();
|
||||
}
|
||||
@ -318,20 +309,9 @@ void MainWidget::mainTabRemoveProfile()
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
QList<QVariant> responce = sendRequestToCtrlWithArgs(QString("Remove"), args, debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return mainTabRemoveProfile();
|
||||
}
|
||||
status = responce[0].toBool();
|
||||
} else
|
||||
status = mainWindow->netctlProfile->removeProfile(profile);
|
||||
mainWindow->showMessage(status);
|
||||
InterfaceAnswer answer = removeProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateMainTab();
|
||||
}
|
||||
@ -349,7 +329,9 @@ void MainWidget::mainTabRestartProfile()
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
mainWindow->showMessage(mainWindow->restartProfileSlot(profile));
|
||||
InterfaceAnswer answer = restartProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateMainTab();
|
||||
}
|
||||
@ -367,7 +349,9 @@ void MainWidget::mainTabStartProfile()
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
mainWindow->showMessage(mainWindow->startProfileSlot(profile));
|
||||
InterfaceAnswer answer = startProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateMainTab();
|
||||
}
|
||||
@ -383,18 +367,9 @@ void MainWidget::mainTabStopAllProfiles()
|
||||
}
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QList<QVariant> responce = sendRequestToCtrl(QString("StolAll"), debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return mainTabStopAllProfiles();
|
||||
}
|
||||
status = responce[0].toBool();
|
||||
} else
|
||||
status = mainWindow->netctlCommand->stopAllProfiles();
|
||||
mainWindow->showMessage(status);
|
||||
InterfaceAnswer answer = stopAllProfilesSlot(mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateMainTab();
|
||||
}
|
||||
@ -412,7 +387,9 @@ void MainWidget::mainTabSwitchToProfile()
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
mainWindow->showMessage(mainWindow->switchToProfileSlot(profile));
|
||||
InterfaceAnswer answer = switchToProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateMainTab();
|
||||
}
|
||||
@ -449,7 +426,6 @@ void MainWidget::createObjects()
|
||||
ui->tableWidget_main->setColumnHidden(2, true);
|
||||
ui->tableWidget_main->setColumnHidden(3, true);
|
||||
updateToolBarState(static_cast<Qt::ToolBarArea>(configuration[QString("NETCTL_TOOLBAR")].toInt()));
|
||||
netctlAutoWin = new NetctlAutoWindow(mainWindow, debug, configuration);
|
||||
|
||||
// append toolbar
|
||||
QMenu *actionMenu = new QMenu(this);
|
||||
@ -464,6 +440,5 @@ void MainWidget::deleteObjects()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (netctlAutoWin != nullptr) delete netctlAutoWin;
|
||||
if (ui != nullptr) delete ui;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
|
||||
class MainWindow;
|
||||
class NetctlAutoWindow;
|
||||
|
||||
namespace Ui {
|
||||
class MainWidget;
|
||||
@ -40,7 +39,6 @@ public:
|
||||
const QMap<QString,QString> settings = QMap<QString,QString>(),
|
||||
const bool debugCmd = false);
|
||||
~MainWidget();
|
||||
NetctlAutoWindow *netctlAutoWin = nullptr;
|
||||
Qt::ToolBarArea getToolBarArea();
|
||||
|
||||
public slots:
|
||||
|
@ -31,10 +31,12 @@
|
||||
#include <QUrl>
|
||||
|
||||
#include <language/language.h>
|
||||
#include <listmap/listmap.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
#include "aboutwindow.h"
|
||||
#include "calls.h"
|
||||
#include "commonfunctions.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
@ -124,29 +126,21 @@ QStringList MainWindow::printInformation()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList output;
|
||||
output.append(QString("none"));
|
||||
output.append(QString("(none)"));
|
||||
if (useHelper) {
|
||||
QList<QVariant> responce = sendRequestToLib(QString("Information"), debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return printInformation();
|
||||
}
|
||||
if (responce[0].toStringList().count() != 2) return output;
|
||||
output = responce[0].toStringList();
|
||||
} else {
|
||||
if (netctlCommand->isNetctlAutoRunning()) {
|
||||
output[0] = netctlCommand->autoGetActiveProfile();
|
||||
output[1] = QString("netctl-auto");
|
||||
} else {
|
||||
QStringList currentProfiles = netctlCommand->getActiveProfile();
|
||||
output[0] = currentProfiles.join(QChar('|'));
|
||||
QStringList statusList;
|
||||
for (int i=0; i<currentProfiles.count(); i++)
|
||||
statusList.append(netctlCommand->getProfileStatus(currentProfiles[i]));
|
||||
output[1] = statusList.join(QChar('|'));
|
||||
}
|
||||
output.append(QApplication::translate("MainWindow", "none"));
|
||||
output.append(QApplication::translate("MainWindow", "(none)"));
|
||||
netctlCurrent current = printTrayInformation();
|
||||
if (current.current.isEmpty()) return output;
|
||||
|
||||
QStringList profiles;
|
||||
for (int i=0; i<current.current.count(); i++) {
|
||||
QString status;
|
||||
if (current.netctlAuto)
|
||||
status = QApplication::translate("MainWindow", "(netctl-auto)");
|
||||
else if (current.enables[i])
|
||||
status = QApplication::translate("MainWindow", "(enabled)");
|
||||
else
|
||||
status = QApplication::translate("MainWindow", "(static)");
|
||||
profiles.append(QString("%1 %2").arg(current.current[i]).arg(status));
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -157,81 +151,15 @@ QStringList MainWindow::printSettings()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList settingsList;
|
||||
for (int i=0; i<configuration.keys().count(); i++)
|
||||
settingsList.append(QString("%1==%2").arg(configuration.keys()[i]).arg(configuration[configuration.keys()[i]]));
|
||||
|
||||
return settingsList;
|
||||
return mapToList(configuration);
|
||||
}
|
||||
|
||||
|
||||
QStringList MainWindow::printTrayInformation()
|
||||
netctlCurrent MainWindow::printTrayInformation()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList information;
|
||||
QString current;
|
||||
QString enabled;
|
||||
bool netctlAutoStatus = false;
|
||||
QList<netctlProfileInfo> profiles;
|
||||
if (useHelper) {
|
||||
QList<QVariant> responce = sendRequestToLib(QString("ActiveProfile"), debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return printTrayInformation();
|
||||
}
|
||||
current = responce[0].toString();
|
||||
responce = sendRequestToLib(QString("isNetctlAutoActive"), debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return printTrayInformation();
|
||||
}
|
||||
netctlAutoStatus = responce[0].toBool();
|
||||
profiles = parseOutputNetctl(sendRequestToLib(QString("VerboseProfileList"), debug));
|
||||
if (netctlAutoStatus) {
|
||||
QList<QVariant> args;
|
||||
args.append(current);
|
||||
responce = sendRequestToLibWithArgs(QString("autoIsProfileEnabled"), args, debug);
|
||||
enabled = QString::number(!responce.isEmpty() && responce[0].toBool());
|
||||
} else {
|
||||
QStringList currentProfiles = current.split(QChar('|'));
|
||||
QStringList enabledList;
|
||||
for (int i=0; i<currentProfiles.count(); i++) {
|
||||
QList<QVariant> args;
|
||||
args.append(currentProfiles[i]);
|
||||
responce = sendRequestToLibWithArgs(QString("isProfileEnabled"), args, debug);
|
||||
enabledList.append(QString::number(!responce.isEmpty() && responce[0].toBool()));
|
||||
enabled = enabledList.join(QChar('|'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
netctlAutoStatus = netctlCommand->isNetctlAutoRunning();
|
||||
if (netctlAutoStatus) {
|
||||
current = netctlCommand->autoGetActiveProfile();
|
||||
enabled = QString::number(netctlCommand->autoIsProfileEnabled(current));
|
||||
profiles = netctlCommand->getProfileListFromNetctlAuto();
|
||||
} else {
|
||||
QStringList currentProfiles = netctlCommand->getActiveProfile();
|
||||
current = currentProfiles.join(QChar('|'));
|
||||
QStringList enabledList;
|
||||
for (int i=0; i<currentProfiles.count(); i++)
|
||||
enabledList.append(QString::number(netctlCommand->isProfileEnabled(currentProfiles[i])));
|
||||
enabled = enabledList.join(QChar('|'));
|
||||
profiles = netctlCommand->getProfileList();
|
||||
}
|
||||
}
|
||||
|
||||
information.append(QString::number(netctlAutoStatus));
|
||||
QStringList profileList;
|
||||
for (int i=0; i<profiles.count(); i++)
|
||||
profileList.append(profiles[i].name);
|
||||
information.append(profileList.join(QChar('|')));
|
||||
information.append(current);
|
||||
information.append(enabled);
|
||||
|
||||
return information;
|
||||
return trayInformation(netctlInterface, useHelper, debug);
|
||||
}
|
||||
|
||||
|
||||
@ -241,7 +169,7 @@ bool MainWindow::isHelperActive()
|
||||
|
||||
QList<QVariant> responce = sendRequestToCtrl(QString("Active"), debug);
|
||||
|
||||
return (!responce.isEmpty() && responce[0].toBool());
|
||||
return (!responce.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@ -380,7 +308,7 @@ bool MainWindow::forceStopHelper()
|
||||
|
||||
QList<QVariant> responce = sendRequestToCtrl(QString("Close"), debug);
|
||||
|
||||
return !responce.isEmpty();
|
||||
return (!responce.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@ -528,8 +456,6 @@ void MainWindow::updateToolBarState(const Qt::ToolBarArea area)
|
||||
addToolBar(area, ui->toolBar);
|
||||
ui->toolBar->show();
|
||||
}
|
||||
|
||||
qDebug() << findChildren<QToolBar *>().count();
|
||||
}
|
||||
|
||||
|
||||
@ -636,14 +562,15 @@ void MainWindow::createObjects()
|
||||
checkHelperStatus();
|
||||
|
||||
netctlCommand = new Netctl(debug, configuration);
|
||||
netctlInterface = new NetctlInterface(debug, configuration);
|
||||
netctlProfile = new NetctlProfile(debug, configuration);
|
||||
wpaCommand = new WpaSup(debug, configuration);
|
||||
// frontend
|
||||
mainWidget = new MainWidget(this, configuration, debug);
|
||||
netctlAutoWin = mainWidget->netctlAutoWin;
|
||||
netctlAutoWin = new NetctlAutoWindow(this, configuration, debug);
|
||||
newProfileWidget = new NewProfileWidget(this, configuration, debug);
|
||||
wifiMenuWidget = new WiFiMenuWidget(this, configuration, debug);
|
||||
trayIcon = new TrayIcon(this, debug);
|
||||
trayIcon = new TrayIcon(this, configuration, debug);
|
||||
// windows
|
||||
ui->retranslateUi(this);
|
||||
ui->layout_main->addWidget(mainWidget);
|
||||
@ -662,6 +589,7 @@ void MainWindow::deleteObjects()
|
||||
QDBusConnection::sessionBus().unregisterObject(DBUS_OBJECT_PATH);
|
||||
QDBusConnection::sessionBus().unregisterService(DBUS_SERVICE);
|
||||
if (netctlCommand != nullptr) delete netctlCommand;
|
||||
if (netctlInterface != nullptr) delete netctlInterface;
|
||||
if (netctlProfile != nullptr) delete netctlProfile;
|
||||
if (wpaCommand != nullptr) delete wpaCommand;
|
||||
|
||||
@ -669,6 +597,7 @@ void MainWindow::deleteObjects()
|
||||
if (settingsWin != nullptr) delete settingsWin;
|
||||
if (trayIcon != nullptr) delete trayIcon;
|
||||
if (mainWidget != nullptr) delete mainWidget;
|
||||
if (netctlAutoWin != nullptr) delete netctlAutoWin;
|
||||
if (newProfileWidget != nullptr) delete newProfileWidget;
|
||||
if (wifiMenuWidget != nullptr) delete wifiMenuWidget;
|
||||
}
|
||||
|
@ -50,11 +50,12 @@ public:
|
||||
Qt::ToolBarArea getToolBarArea();
|
||||
QStringList printInformation();
|
||||
QStringList printSettings();
|
||||
QStringList printTrayInformation();
|
||||
netctlCurrent printTrayInformation();
|
||||
bool isHelperActive();
|
||||
bool isHelperServiceActive();
|
||||
// library interfaces
|
||||
Netctl *netctlCommand = nullptr;
|
||||
NetctlInterface *netctlInterface = nullptr;
|
||||
NetctlProfile *netctlProfile = nullptr;
|
||||
WpaSup *wpaCommand = nullptr;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
NetctlAutoWindow::NetctlAutoWindow(QWidget *parent, const bool debugCmd, const QMap<QString, QString> settings)
|
||||
NetctlAutoWindow::NetctlAutoWindow(QWidget *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::NetctlAutoWindow),
|
||||
debug(debugCmd)
|
||||
|
@ -34,8 +34,8 @@ class NetctlAutoWindow : public QMainWindow
|
||||
|
||||
public:
|
||||
explicit NetctlAutoWindow(QWidget *parent = 0,
|
||||
const bool debugCmd = false,
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>(),
|
||||
const bool debugCmd = false);
|
||||
~NetctlAutoWindow();
|
||||
Qt::ToolBarArea getToolBarArea();
|
||||
|
||||
|
@ -133,9 +133,3 @@ QStringList NetctlGuiAdaptor::UIDs()
|
||||
|
||||
return uids;
|
||||
}
|
||||
|
||||
|
||||
QStringList NetctlGuiAdaptor::VerboseInformation()
|
||||
{
|
||||
return mainWindow->printTrayInformation();
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ public slots:
|
||||
bool ShowNetctlAuto();
|
||||
bool ShowSettings();
|
||||
QStringList UIDs();
|
||||
QStringList VerboseInformation();
|
||||
|
||||
private:
|
||||
MainWindow *mainWindow;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "calls.h"
|
||||
#include "bridgewidget.h"
|
||||
#include "commonfunctions.h"
|
||||
#include "dbusoperation.h"
|
||||
@ -149,11 +150,8 @@ void NewProfileWidget::profileTabClear()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->comboBox_profile->clear();
|
||||
QList<netctlProfileInfo> profiles;
|
||||
if (useHelper)
|
||||
profiles = parseOutputNetctl(sendRequestToLib(QString("netctlVerboseProfileList"), debug));
|
||||
else
|
||||
profiles = mainWindow->netctlCommand->getProfileList();
|
||||
QList<netctlProfileInfo> profiles = generalInformation(mainWindow->netctlInterface,
|
||||
useHelper, debug).netctlProfiles;
|
||||
for (int i=0; i<profiles.count(); i++)
|
||||
ui->comboBox_profile->addItem(profiles[i].name);
|
||||
ui->comboBox_profile->setCurrentIndex(-1);
|
||||
@ -326,27 +324,9 @@ void NewProfileWidget::profileTabCreateProfile()
|
||||
}
|
||||
|
||||
// call netctlprofile
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QStringList settingsList;
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
settingsList.append(QString("%1==%2").arg(settings.keys()[i]).arg(settings[settings.keys()[i]]));
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
args.append(settingsList);
|
||||
QList<QVariant> responce = sendRequestToCtrlWithArgs(QString("Create"), args, debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return profileTabCreateProfile();
|
||||
}
|
||||
status = responce[0].toBool();
|
||||
|
||||
} else {
|
||||
QString profileTempName = mainWindow->netctlProfile->createProfile(profile, settings);
|
||||
status = mainWindow->netctlProfile->copyProfile(profileTempName);
|
||||
}
|
||||
mainWindow->showMessage(status);
|
||||
InterfaceAnswer answer = createProfileSlot(profile, settings, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateProfileTab();
|
||||
}
|
||||
@ -358,25 +338,8 @@ void NewProfileWidget::profileTabLoadProfile()
|
||||
|
||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
||||
if (profile.isEmpty()) return;
|
||||
QMap<QString, QString> settings;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
QList<QVariant> responce = sendRequestToLibWithArgs(QString("Profile"), args, debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return profileTabLoadProfile();
|
||||
}
|
||||
QStringList settingsList = responce[0].toStringList();
|
||||
for (int i=0; i<settingsList.count(); i++) {
|
||||
if (!settingsList[i].contains(QString("=="))) continue;
|
||||
QString key = settingsList[i].split(QString("=="))[0];
|
||||
QString value = settingsList[i].split(QString("=="))[1];
|
||||
settings[key] = value;
|
||||
}
|
||||
} else
|
||||
settings = mainWindow->netctlProfile->getSettingsFromProfile(profile);
|
||||
QMap<QString, QString> settings = profileInformation(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
|
||||
if (settings.isEmpty()) return ErrorWindow::showWindow(17, QString(PDEBUG), debug);
|
||||
|
||||
@ -422,21 +385,9 @@ void NewProfileWidget::profileTabRemoveProfile()
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
||||
if (profile.isEmpty()) return ErrorWindow::showWindow(17, QString(PDEBUG), debug);
|
||||
bool status = false;
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
QList<QVariant> responce = sendRequestToCtrlWithArgs(QString("Remove"), args, debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return profileTabLoadProfile();
|
||||
}
|
||||
status = responce[0].toBool();
|
||||
} else
|
||||
status = mainWindow->netctlProfile->removeProfile(profile);
|
||||
mainWindow->showMessage(status);
|
||||
InterfaceAnswer answer = removeProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
|
||||
updateProfileTab();
|
||||
}
|
||||
|
@ -19,18 +19,19 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "calls.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
TrayIcon::TrayIcon(QObject *parent, const bool debugCmd)
|
||||
TrayIcon::TrayIcon(QObject *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
||||
: QSystemTrayIcon(parent),
|
||||
debug(debugCmd)
|
||||
{
|
||||
mainWindow = dynamic_cast<MainWindow *>(parent);
|
||||
useHelper = (settings[QString("USE_HELPER")] == QString("true"));
|
||||
|
||||
init();
|
||||
}
|
||||
@ -44,41 +45,7 @@ TrayIcon::~TrayIcon()
|
||||
startProfileMenu->clear();
|
||||
switchToProfileMenu->clear();
|
||||
menuActions->clear();
|
||||
delete startProfileMenu;
|
||||
delete switchToProfileMenu;
|
||||
delete menuActions;
|
||||
for (int i=0; i<contextMenu.keys().count(); i++)
|
||||
delete contextMenu[contextMenu.keys()[i]];
|
||||
}
|
||||
|
||||
|
||||
int TrayIcon::showInformation()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (supportsMessages()) {
|
||||
QString title = QApplication::translate("TrayIcon", "netctl status");
|
||||
QStringList info = mainWindow->printInformation();
|
||||
QString message = QString("%1: %2\n").arg(QApplication::translate("TrayIcon", "Profile")).arg(info[0]);
|
||||
message += QString("%1: %2").arg(QApplication::translate("TrayIcon", "Status")).arg(info[1]);
|
||||
showMessage(title, message, QSystemTrayIcon::Information);
|
||||
}
|
||||
else
|
||||
return showInformationInWindow();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int TrayIcon::showInformationInWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString title = QApplication::translate("TrayIcon", "netctl status");
|
||||
QStringList info = mainWindow->printInformation();
|
||||
QString message = QString("%1: %2\n").arg(QApplication::translate("TrayIcon", "Profile")).arg(info[0]);
|
||||
message += QString("%1: %2").arg(QApplication::translate("TrayIcon", "Status")).arg(info[1]);
|
||||
|
||||
return QMessageBox::information(0, title, message);
|
||||
}
|
||||
|
||||
|
||||
@ -86,79 +53,52 @@ void TrayIcon::updateMenu()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList info = mainWindow->printTrayInformation();
|
||||
bool netctlAutoStatus = info[0].toInt();
|
||||
QStringList profiles = info[1].split(QChar('|'));
|
||||
QString current = info[2];
|
||||
QString enabled = info[3];
|
||||
netctlCurrent info = mainWindow->printTrayInformation();
|
||||
|
||||
if (current.isEmpty()) {
|
||||
if (info.current.isEmpty()) {
|
||||
contextMenu[QString("title")]->setIcon(QIcon(QString(":network-offline-64x64")));
|
||||
contextMenu[QString("title")]->setText(QApplication::translate("TrayIcon", "(inactive)"));
|
||||
} else {
|
||||
contextMenu[QString("title")]->setIcon(QIcon(QString(":network-idle-64x64")));
|
||||
QStringList currentProfiles, status;
|
||||
if (netctlAutoStatus) {
|
||||
currentProfiles.append(current);
|
||||
status.append(QApplication::translate("TrayIcon", "(netctl-auto)"));
|
||||
} else {
|
||||
for (int i=0; i<enabled.split(QChar('|')).count(); i++) {
|
||||
currentProfiles.append(current.split(QChar('|'))[i]);
|
||||
if (enabled.split(QChar('|'))[i] == QString("0"))
|
||||
status.append(QApplication::translate("TrayIcon", "static"));
|
||||
else
|
||||
status.append(QApplication::translate("TrayIcon", "enabled"));
|
||||
}
|
||||
}
|
||||
QStringList profiles;
|
||||
for (int i=0; i<currentProfiles.count(); i++)
|
||||
profiles.append(QString("%1 %2").arg(currentProfiles[i]).arg(status[i]));
|
||||
if (info.netctlAuto)
|
||||
profiles.append(QString("%1 (%2)").arg(info.current[0])
|
||||
.arg(QApplication::translate("TrayIcon", "netctl-auto")));
|
||||
else
|
||||
for (int i=0; i<info.current.count(); i++) {
|
||||
QString status;
|
||||
if (info.enables[i])
|
||||
status = QApplication::translate("TrayIcon", "enabled");
|
||||
else
|
||||
status = QApplication::translate("TrayIcon", "static");
|
||||
profiles.append(QString("%1 (%2)").arg(info.current[i]).arg(status));
|
||||
}
|
||||
contextMenu[QString("title")]->setText(profiles.join(QString(" | ")));
|
||||
}
|
||||
|
||||
if (netctlAutoStatus) {
|
||||
contextMenu[QString("start")]->setVisible(false);
|
||||
contextMenu[QString("stop")]->setVisible(false);
|
||||
contextMenu[QString("stopall")]->setVisible(false);
|
||||
contextMenu[QString("switch")]->setVisible(true);
|
||||
contextMenu[QString("restart")]->setVisible(false);
|
||||
contextMenu[QString("enable")]->setVisible(false);
|
||||
startProfileMenu->setVisible(!info.netctlAuto);
|
||||
contextMenu[QString("stop")]->setVisible(!info.netctlAuto && (info.current.count() == 1));
|
||||
contextMenu[QString("stopall")]->setVisible(!info.netctlAuto && (info.current.count() > 1));
|
||||
switchToProfileMenu->setVisible(info.netctlAuto);
|
||||
contextMenu[QString("restart")]->setVisible(!info.netctlAuto && (info.current.count() == 1));
|
||||
contextMenu[QString("enable")]->setVisible(!info.netctlAuto && (info.current.count() == 1));
|
||||
|
||||
if (info.netctlAuto) {
|
||||
switchToProfileMenu->clear();
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
QAction *profile = new QAction(profiles[i], this);
|
||||
switchToProfileMenu->addAction(profile);
|
||||
}
|
||||
for (int i=0; i<info.current.count(); i++)
|
||||
switchToProfileMenu->addAction(info.current[i]);
|
||||
} else {
|
||||
if (current.contains(QChar('|'))) {
|
||||
contextMenu[QString("start")]->setVisible(true);
|
||||
contextMenu[QString("stop")]->setVisible(false);
|
||||
contextMenu[QString("stopall")]->setVisible(true);
|
||||
contextMenu[QString("switch")]->setVisible(false);
|
||||
contextMenu[QString("restart")]->setVisible(false);
|
||||
contextMenu[QString("enable")]->setVisible(false);
|
||||
} else {
|
||||
contextMenu[QString("start")]->setVisible(true);
|
||||
contextMenu[QString("stop")]->setVisible(!current.isEmpty());
|
||||
contextMenu[QString("switch")]->setVisible(false);
|
||||
contextMenu[QString("stopall")]->setVisible(false);
|
||||
contextMenu[QString("restart")]->setVisible(!current.isEmpty());
|
||||
contextMenu[QString("enable")]->setVisible(!current.isEmpty());
|
||||
}
|
||||
if (!current.isEmpty()) {
|
||||
contextMenu[QString("start")]->setText(QApplication::translate("TrayIcon", "Start another profile"));
|
||||
contextMenu[QString("stop")]->setText(QApplication::translate("TrayIcon", "Stop %1").arg(current));
|
||||
contextMenu[QString("restart")]->setText(QApplication::translate("TrayIcon", "Restart %1").arg(current));
|
||||
if (enabled.split(QChar('|'))[0].toInt())
|
||||
contextMenu[QString("enable")]->setText(QApplication::translate("TrayIcon", "Disable %1").arg(current));
|
||||
if (info.current.count() == 1) {
|
||||
contextMenu[QString("stop")]->setText(QApplication::translate("TrayIcon", "Stop %1").arg(info.current[0]));
|
||||
contextMenu[QString("restart")]->setText(QApplication::translate("TrayIcon", "Restart %1").arg(info.current[0]));
|
||||
if (info.enables[0])
|
||||
contextMenu[QString("enable")]->setText(QApplication::translate("TrayIcon", "Disable %1").arg(info.current[0]));
|
||||
else
|
||||
contextMenu[QString("enable")]->setText(QApplication::translate("TrayIcon", "Enable %1").arg(current));
|
||||
} else
|
||||
contextMenu[QString("start")]->setText(QApplication::translate("TrayIcon", "Start profile"));
|
||||
startProfileMenu->clear();
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
QAction *profile = new QAction(profiles[i], this);
|
||||
startProfileMenu->addAction(profile);
|
||||
contextMenu[QString("enable")]->setText(QApplication::translate("TrayIcon", "Enable %1").arg(info.current[0]));
|
||||
}
|
||||
startProfileMenu->clear();
|
||||
for (int i=0; i<info.current.count(); i++)
|
||||
startProfileMenu->addAction(info.current[i]);
|
||||
}
|
||||
|
||||
if (mainWindow->isHidden())
|
||||
@ -176,55 +116,43 @@ void TrayIcon::createActions()
|
||||
|
||||
menuActions = new QMenu();
|
||||
|
||||
contextMenu[QString("title")] = new QAction(QIcon(":icon"), QApplication::translate("TrayIcon", "Status"), this);
|
||||
menuActions->addAction(contextMenu[QString("title")]);
|
||||
connect(contextMenu[QString("title")], SIGNAL(triggered(bool)), this, SLOT(showInformationInWindow()));
|
||||
|
||||
contextMenu[QString("title")] = menuActions->addAction(QIcon(":icon"),
|
||||
QApplication::translate("TrayIcon", "Status"),
|
||||
mainWindow,
|
||||
SLOT(showMainWindow()));
|
||||
menuActions->addSeparator();
|
||||
|
||||
contextMenu[QString("start")] = new QAction(QIcon::fromTheme("system-run"), QApplication::translate("TrayIcon", "Start profile"), this);
|
||||
startProfileMenu = new QMenu();
|
||||
contextMenu[QString("start")]->setMenu(startProfileMenu);
|
||||
connect(startProfileMenu, SIGNAL(triggered(QAction *)), this, SLOT(startProfileSlot(QAction *)));
|
||||
menuActions->addAction(contextMenu[QString("start")]);
|
||||
startProfileMenu = menuActions->addMenu(QIcon::fromTheme("system-run"),
|
||||
QApplication::translate("TrayIcon", "Start profile"));
|
||||
connect(startProfileMenu, SIGNAL(triggered(QAction *)), this, SLOT(startProfileTraySlot(QAction *)));
|
||||
|
||||
contextMenu[QString("stop")] = new QAction(QIcon::fromTheme("process-stop"), QApplication::translate("TrayIcon", "Stop profile"), this);
|
||||
connect(contextMenu[QString("stop")], SIGNAL(triggered(bool)), this, SLOT(stopProfileSlot()));
|
||||
menuActions->addAction(contextMenu[QString("stop")]);
|
||||
contextMenu[QString("stop")] = menuActions->addAction(QIcon::fromTheme("process-stop"),
|
||||
QApplication::translate("TrayIcon", "Stop profile"),
|
||||
this,
|
||||
SLOT(startProfileTraySlot()));
|
||||
contextMenu[QString("stopall")] = menuActions->addAction(QIcon::fromTheme("process-stop"),
|
||||
QApplication::translate("TrayIcon", "Stop all profiles"),
|
||||
this,
|
||||
SLOT(stopAllProfilesTraySlot()));
|
||||
|
||||
contextMenu[QString("stopall")] = new QAction(QIcon::fromTheme("process-stop"), QApplication::translate("TrayIcon", "Stop all profiles"), this);
|
||||
connect(contextMenu[QString("stopall")], SIGNAL(triggered(bool)), this, SLOT(stopAllProfilesSlot()));
|
||||
menuActions->addAction(contextMenu[QString("stopall")]);
|
||||
|
||||
contextMenu[QString("switch")] = new QAction(QIcon::fromTheme("system-run"), QApplication::translate("TrayIcon", "Switch to profile"), this);
|
||||
switchToProfileMenu = new QMenu();
|
||||
contextMenu[QString("switch")]->setMenu(switchToProfileMenu);
|
||||
connect(switchToProfileMenu, SIGNAL(triggered(QAction *)), this, SLOT(switchToProfileSlot(QAction *)));
|
||||
menuActions->addAction(contextMenu[QString("switch")]);
|
||||
|
||||
contextMenu[QString("restart")] = new QAction(QIcon::fromTheme("view-refresh"), QApplication::translate("TrayIcon", "Restart profile"), this);
|
||||
connect(contextMenu[QString("restart")], SIGNAL(triggered(bool)), this, SLOT(restartProfileSlot()));
|
||||
menuActions->addAction(contextMenu[QString("restart")]);
|
||||
|
||||
contextMenu[QString("enable")] = new QAction(QApplication::translate("TrayIcon", "Enable profile"), this);
|
||||
connect(contextMenu[QString("enable")], SIGNAL(triggered(bool)), this, SLOT(enableProfileSlot()));
|
||||
menuActions->addAction(contextMenu[QString("enable")]);
|
||||
switchToProfileMenu = menuActions->addMenu(QIcon::fromTheme("system-run"),
|
||||
QApplication::translate("TrayIcon", "Switch to profile"));
|
||||
connect(switchToProfileMenu, SIGNAL(triggered(QAction *)), this, SLOT(switchToProfileTraySlot(QAction *)));
|
||||
|
||||
contextMenu[QString("restart")] = menuActions->addAction(QIcon::fromTheme("view-refresh"),
|
||||
QApplication::translate("TrayIcon", "Restart profile"),
|
||||
this,
|
||||
SLOT(restartProfileTraySlot()));
|
||||
contextMenu[QString("enable")] = menuActions->addAction(QIcon::fromTheme("list-add"),
|
||||
QApplication::translate("TrayIcon", "Enable profile"),
|
||||
this,
|
||||
SLOT(enableProfileTraySlot()));
|
||||
menuActions->addSeparator();
|
||||
|
||||
contextMenu[QString("gui")] = new QAction(QApplication::translate("TrayIcon", "Show"), this);
|
||||
connect(contextMenu[QString("gui")], SIGNAL(triggered(bool)), mainWindow, SLOT(showMainWindow()));
|
||||
menuActions->addAction(contextMenu[QString("gui")]);
|
||||
|
||||
contextMenu[QString("auto")] = new QAction(QApplication::translate("TrayIcon", "Show netctl-auto"), this);
|
||||
connect(contextMenu[QString("auto")], SIGNAL(triggered(bool)), mainWindow, SLOT(showNetctlAutoWindow()));
|
||||
menuActions->addAction(contextMenu[QString("auto")]);
|
||||
|
||||
menuActions->addSeparator();
|
||||
|
||||
contextMenu[QString("quit")] = new QAction(QApplication::translate("TrayIcon", "Quit"), this);
|
||||
connect(contextMenu[QString("quit")], SIGNAL(triggered(bool)), mainWindow, SLOT(closeMainWindow()));
|
||||
menuActions->addAction(contextMenu[QString("quit")]);
|
||||
contextMenu[QString("quit")] = menuActions->addAction(QIcon::fromTheme("application-exit"),
|
||||
QApplication::translate("TrayIcon", "Quit"),
|
||||
mainWindow,
|
||||
SLOT(closeMainWindow()));
|
||||
}
|
||||
|
||||
|
||||
@ -249,9 +177,6 @@ void TrayIcon::itemActivated(const QSystemTrayIcon::ActivationReason reason)
|
||||
|
||||
switch (reason) {
|
||||
case QSystemTrayIcon::Trigger:
|
||||
showInformation();
|
||||
break;
|
||||
case QSystemTrayIcon::DoubleClick:
|
||||
mainWindow->showMainWindow();
|
||||
break;
|
||||
case QSystemTrayIcon::Context:
|
||||
@ -265,59 +190,49 @@ void TrayIcon::itemActivated(const QSystemTrayIcon::ActivationReason reason)
|
||||
}
|
||||
|
||||
|
||||
bool TrayIcon::enableProfileSlot()
|
||||
void TrayIcon::enableProfileTraySlot()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString profile = mainWindow->printInformation()[0];
|
||||
|
||||
return mainWindow->enableProfileSlot(profile);
|
||||
enableProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
|
||||
}
|
||||
|
||||
|
||||
bool TrayIcon::restartProfileSlot()
|
||||
void TrayIcon::restartProfileTraySlot()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString profile = mainWindow->printInformation()[0];
|
||||
|
||||
return mainWindow->restartProfileSlot(profile);
|
||||
restartProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
|
||||
}
|
||||
|
||||
|
||||
bool TrayIcon::startProfileSlot(QAction *action)
|
||||
void TrayIcon::startProfileTraySlot(QAction *action)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString profile = action->text().remove(QChar('&'));
|
||||
|
||||
return mainWindow->switchToProfileSlot(profile);
|
||||
startProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
|
||||
}
|
||||
|
||||
|
||||
bool TrayIcon::stopProfileSlot()
|
||||
void TrayIcon::stopAllProfilesTraySlot()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString profile = mainWindow->printInformation()[0];
|
||||
|
||||
return mainWindow->startProfileSlot(profile);
|
||||
stopAllProfilesSlot(mainWindow->netctlInterface, useHelper, debug);
|
||||
}
|
||||
|
||||
|
||||
bool TrayIcon::stopAllProfilesSlot()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return mainWindow->stopAllProfilesSlot();
|
||||
}
|
||||
|
||||
|
||||
bool TrayIcon::switchToProfileSlot(QAction *action)
|
||||
void TrayIcon::switchToProfileTraySlot(QAction *action)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString profile = action->text().remove(QChar('&'));
|
||||
|
||||
return mainWindow->switchToProfileSlot(profile);
|
||||
switchToProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
|
||||
}
|
||||
|
@ -31,25 +31,24 @@ class TrayIcon : public QSystemTrayIcon
|
||||
|
||||
public:
|
||||
explicit TrayIcon(QObject *parent = 0,
|
||||
const QMap<QString,QString> settings = QMap<QString,QString>(),
|
||||
const bool debugCmd = false);
|
||||
~TrayIcon();
|
||||
|
||||
public slots:
|
||||
int showInformation();
|
||||
int showInformationInWindow();
|
||||
void updateMenu();
|
||||
|
||||
private slots:
|
||||
void itemActivated(const QSystemTrayIcon::ActivationReason reason);
|
||||
bool enableProfileSlot();
|
||||
bool restartProfileSlot();
|
||||
bool startProfileSlot(QAction *action);
|
||||
bool stopProfileSlot();
|
||||
bool stopAllProfilesSlot();
|
||||
bool switchToProfileSlot(QAction *action);
|
||||
void enableProfileTraySlot();
|
||||
void restartProfileTraySlot();
|
||||
void startProfileTraySlot(QAction *action);
|
||||
void stopAllProfilesTraySlot();
|
||||
void switchToProfileTraySlot(QAction *action);
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
bool useHelper = true;
|
||||
MainWindow *mainWindow;
|
||||
// contextual actions
|
||||
QMenu *menuActions;
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "calls.h"
|
||||
#include "commonfunctions.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
@ -97,23 +98,10 @@ bool WiFiMenuWidget::wifiTabSelectEssidSlot(const QString essid)
|
||||
void WiFiMenuWidget::connectToUnknownEssid(const QString passwd)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (ui->tableWidget_wifi->currentItem() == nullptr) return;
|
||||
if (passwdWid != nullptr) delete passwdWid;
|
||||
QStringList interfaces;
|
||||
if (useHelper) {
|
||||
QList<QVariant> responce = sendRequestToLib(QString("WirelessInterfaces"), debug);
|
||||
if (responce.isEmpty())
|
||||
interfaces = mainWindow->netctlCommand->getWirelessInterfaceList();
|
||||
else
|
||||
interfaces = responce[0].toStringList();
|
||||
} else
|
||||
interfaces = mainWindow->netctlCommand->getWirelessInterfaceList();
|
||||
if (interfaces.isEmpty()) return;
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'");
|
||||
settings[QString("Interface")] = interfaces[0];
|
||||
settings[QString("Connection")] = QString("wireless");
|
||||
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 2)->text();
|
||||
if (security.contains(QString("WPA")))
|
||||
settings[QString("Security")] = QString("wpa");
|
||||
@ -121,50 +109,35 @@ void WiFiMenuWidget::connectToUnknownEssid(const QString passwd)
|
||||
settings[QString("Security")] = QString("wep");
|
||||
else
|
||||
settings[QString("Security")] = QString("none");
|
||||
settings[QString("ESSID")] = QString("'%1'").arg(ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text());
|
||||
if (!passwd.isEmpty())
|
||||
settings[QString("Key")] = QString("'%1'").arg(passwd);
|
||||
settings[QString("IP")] = QString("dhcp");
|
||||
if (hiddenNetwork)
|
||||
settings[QString("Hidden")] = QString("yes");
|
||||
QString essid = QString("'%1'").arg(ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text());
|
||||
InterfaceAnswer answer = connectToEssid(essid, settings, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
|
||||
QString profile = QString("netctl-gui-%1").arg(settings[QString("ESSID")]);
|
||||
QString profile = QString("netctl-gui-%1").arg(essid);
|
||||
profile.remove(QChar('"')).remove(QChar('\''));
|
||||
if (useHelper) {
|
||||
QStringList settingsList;
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
settingsList.append(QString("%1==%2").arg(settings.keys()[i]).arg(settings[settings.keys()[i]]));
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
args.append(settingsList);
|
||||
sendRequestToCtrlWithArgs(QString("Create"), args, debug);
|
||||
} else {
|
||||
QString profileTempName = mainWindow->netctlProfile->createProfile(profile, settings);
|
||||
mainWindow->netctlProfile->copyProfile(profileTempName);
|
||||
}
|
||||
QString message;
|
||||
if (mainWindow->startProfileSlot(profile)) {
|
||||
message = QApplication::translate("MainWindow", "Connection is successfully.");
|
||||
if (answer == InterfaceAnswer::True) {
|
||||
message = QApplication::translate("MainWindow", "Connection is successfully");
|
||||
mainWindow->showMessage(true);
|
||||
} else {
|
||||
message = QApplication::translate("MainWindow", "Connection failed.");
|
||||
message = QApplication::translate("MainWindow", "Connection failed");
|
||||
mainWindow->showMessage(false);
|
||||
}
|
||||
message += QString("\n");
|
||||
message += QApplication::translate("MainWindow", "Do you want to save profile %1?").arg(profile);
|
||||
int select = QMessageBox::question(this, QApplication::translate("MainWindow", "WiFi menu"),
|
||||
message, QMessageBox::Save | QMessageBox::Discard, QMessageBox::Save);
|
||||
|
||||
switch (select) {
|
||||
case QMessageBox::Save:
|
||||
break;
|
||||
case QMessageBox::Discard:
|
||||
default:
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
sendRequestToCtrlWithArgs(QString("Remove"), args, debug);
|
||||
} else
|
||||
mainWindow->netctlProfile->removeProfile(profile);
|
||||
removeProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -199,10 +172,10 @@ void WiFiMenuWidget::updateMenuWifi()
|
||||
}
|
||||
|
||||
|
||||
void WiFiMenuWidget::updateText()
|
||||
void WiFiMenuWidget::updateText(const netctlWifiInfo current)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
wifiTabSetEnabled(checkExternalApps(QString("wpasup-only"), configuration, debug));
|
||||
if (wifiTabSetEnabled(checkExternalApps(QString("wpasup-only"), configuration, debug))) return;
|
||||
if (!checkExternalApps(QString("wpasup"), configuration, debug)) {
|
||||
ErrorWindow::showWindow(1, QString(PDEBUG), debug);
|
||||
emit(mainWindow->needToBeConfigured());
|
||||
@ -210,13 +183,6 @@ void WiFiMenuWidget::updateText()
|
||||
}
|
||||
ui->label_wifi->setText(QApplication::translate("WiFiMenuWidget", "Processing..."));
|
||||
|
||||
netctlWifiInfo current;
|
||||
if (useHelper)
|
||||
current = parseOutputWifi(sendRequestToCtrl(QString("CurrentWiFi"), debug))[0];
|
||||
else
|
||||
current = mainWindow->wpaCommand->scanWifi()[0];
|
||||
if (current.name.isEmpty()) return;
|
||||
|
||||
QString text = QString("");
|
||||
text += QString("%1 - %2 - %3 ").arg(current.name).arg(current.security).arg(current.macs[0]);
|
||||
text += QString("(%1 %2)").arg(current.frequencies[0]).arg(QApplication::translate("WiFiMenuWidget", "MHz"));
|
||||
@ -228,7 +194,7 @@ void WiFiMenuWidget::updateText()
|
||||
void WiFiMenuWidget::updateWifiTab()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
wifiTabSetEnabled(checkExternalApps(QString("wpasup-only"), configuration, debug));
|
||||
if (wifiTabSetEnabled(checkExternalApps(QString("wpasup-only"), configuration, debug))) return;
|
||||
if (!checkExternalApps(QString("wpasup"), configuration, debug)) {
|
||||
ErrorWindow::showWindow(1, QString(PDEBUG), debug);
|
||||
emit(mainWindow->needToBeConfigured());
|
||||
@ -259,6 +225,7 @@ void WiFiMenuWidget::updateWifiTab()
|
||||
headerList.append(QApplication::translate("WiFiMenuWidget", "Exists"));
|
||||
ui->tableWidget_wifi->setHorizontalHeaderLabels(headerList);
|
||||
// create items
|
||||
netctlWifiInfo current = scanResults.isEmpty() ? netctlWifiInfo() : scanResults.takeFirst();
|
||||
for (int i=0; i<scanResults.count(); i++) {
|
||||
// font
|
||||
QFont font;
|
||||
@ -335,7 +302,7 @@ void WiFiMenuWidget::updateWifiTab()
|
||||
ui->tableWidget_wifi->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
updateText();
|
||||
updateText(current);
|
||||
mainWindow->setDisabled(false);
|
||||
mainWindow->showMessage(true);
|
||||
}
|
||||
@ -375,13 +342,15 @@ void WiFiMenuWidget::wifiTabContextualMenu(const QPoint &pos)
|
||||
}
|
||||
|
||||
|
||||
void WiFiMenuWidget::wifiTabSetEnabled(const bool state)
|
||||
bool WiFiMenuWidget::wifiTabSetEnabled(const bool state)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||
|
||||
ui->tableWidget_wifi->setHidden(!state);
|
||||
if (!state) ui->label_wifi->setText(QApplication::translate("WiFiMenuWidget", "Please install 'wpa_supplicant' before using it"));
|
||||
ui->tableWidget_wifi->setEnabled(state);
|
||||
if (!state) ui->label_wifi->setText(QApplication::translate("WiFiMenuWidget", "Please install 'wpa_supplicant' before use it"));
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@ -396,6 +365,7 @@ void WiFiMenuWidget::wifiTabStart()
|
||||
if (ui->tableWidget_wifi->currentItem() == nullptr) return;
|
||||
|
||||
mainWindow->setDisabled(true);
|
||||
|
||||
// name is hidden
|
||||
if (ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text() == QString("<hidden>")) {
|
||||
hiddenNetwork = true;
|
||||
@ -414,21 +384,10 @@ void WiFiMenuWidget::wifiTabStart()
|
||||
// name isn't hidden
|
||||
hiddenNetwork = false;
|
||||
QString profile = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text();
|
||||
QString profileName = QString("");
|
||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 6)->text().isEmpty()) {
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
QList<QVariant> responce = sendRequestToLibWithArgs(QString("ProfileByEssid"), args, debug);
|
||||
if (responce.isEmpty()) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Could not interact with helper, disable it";
|
||||
useHelper = false;
|
||||
return wifiTabStart();
|
||||
}
|
||||
profileName = responce[0].toString();
|
||||
} else
|
||||
profileName = mainWindow->wpaCommand->existentProfile(profile);
|
||||
mainWindow->showMessage(mainWindow->startProfileSlot(profileName));
|
||||
InterfaceAnswer answer = startProfileSlot(profile, mainWindow->netctlInterface,
|
||||
useHelper, debug);
|
||||
mainWindow->showMessage(answer == InterfaceAnswer::True);
|
||||
} else {
|
||||
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 1)->text();
|
||||
if (security == QString("none")) return connectToUnknownEssid(QString(""));
|
||||
|
@ -53,11 +53,11 @@ public slots:
|
||||
private slots:
|
||||
// update slots
|
||||
void updateMenuWifi();
|
||||
void updateText();
|
||||
void updateText(const netctlWifiInfo current);
|
||||
void updateWifiTab();
|
||||
// wifi tab slots
|
||||
void wifiTabContextualMenu(const QPoint &pos);
|
||||
void wifiTabSetEnabled(const bool state);
|
||||
bool wifiTabSetEnabled(const bool state);
|
||||
void wifiTabStart();
|
||||
|
||||
private:
|
||||
@ -70,7 +70,7 @@ private:
|
||||
void createObjects();
|
||||
void deleteObjects();
|
||||
bool debug = false;
|
||||
bool hiddenNetwork;
|
||||
bool hiddenNetwork = false;
|
||||
bool useHelper = true;
|
||||
// configuration
|
||||
QMap<QString, QString> configuration;
|
||||
|
Reference in New Issue
Block a user