diff --git a/sources/3rdparty/pdebug b/sources/3rdparty/pdebug
index 9c63e10..294a590 160000
--- a/sources/3rdparty/pdebug
+++ b/sources/3rdparty/pdebug
@@ -1 +1 @@
-Subproject commit 9c63e102b05e11ead690489ca470c8482b6335b1
+Subproject commit 294a590bb966fd79eb2e93a7b02377ca57731cd5
diff --git a/sources/gui/docs/netctl-gui-dbus-api.html b/sources/gui/docs/netctl-gui-dbus-api.html
index 814f2f5..09de81a 100644
--- a/sources/gui/docs/netctl-gui-dbus-api.html
+++ b/sources/gui/docs/netctl-gui-dbus-api.html
@@ -35,6 +35,7 @@ small {
DBus API
Helper API
Helper ctrl API
+ Helper interface API
Helper netctl API
GUI API
GUI netctlgui API
@@ -74,7 +75,7 @@ small {
QStringList FindSettings() |
- scans system and suggests the recommended configuration which will be used by the library |
+ scans system and suggests the recommended configuration which may be used by the library |
no |
@@ -211,6 +212,78 @@ small {
returns available WiFi points in format NAME|SECURITY|SIGNAL|ACTIVE|EXISTS |
yes |
+
+
+ /interface path |
+
+
+
+ int Enable(QString profile) |
+ enables or disables the profile. Returns is the profile enabled or 2 if there was an another error |
+ yes |
+
+
+ int Restart(QString profile) |
+ restarts the profile. Returns is the profile active or 2 if there was an error |
+ yes |
+
+
+ int Start(QString profile) |
+ starts or stops the profile. Returns is the profile active or 2 if there was an error |
+ yes |
+
+
+ bool StopAll() |
+ synonym of /ctlr/StopAll() |
+ yes |
+
+
+ bool SwitchTo(QString profile) |
+ switchs to the profile (works with netctl and netctl-auto). Returns is the profile active or 2 if there was an error |
+ yes |
+
+
+ int Create(QString profile, QStringList settingsList) |
+ >creates the profile with specified settings. Settings should be given in the format KEY==VALUE . Returns 1 if action has been performed successfully, 0 if there was an error in the profile copying and 2 if there was an another error |
+ yes |
+
+
+ QStringList Profile(QString profile) |
+ synonym of /netctl/Profile() |
+ no |
+
+
+ int Remove(QString profile) |
+ synonym of /ctrl/Remove() |
+ yes |
+
+
+
+ QStringList Information() |
+ returns general information in format [IsNetctlAutoActive, NetctlProfiles, NetctlAutoProfiles] |
+ no |
+
+
+ QStringList Status() |
+ returns actual information in format [IsNetctlAutoActive, ProfilesNames, ActiveProfile, ActiveProfileEnables] |
+ no |
+
+
+
+ int Essid(QString essid, QStringList settingsList) |
+ connects to WiFi point with the given ESSID, calls KnownEssid or UnknownESSID depending on whether there is a profile. Settings may be empty. To get return codes refer to KnownEssid() and UnknownEssid() |
+ yes |
+
+
+ int KnownEssid(QString essid) |
+ connects to WiFi point with the given ESSID with existent profile. Returns Start() if ok, in other cases returns 2 |
+ yes |
+
+
+ int UnknownEssid(QString essid, QStringList settingsList) |
+ creates a profile and connects to WiFi point with the given ESSID. Returns Start() if ok, in other cases returns 2 |
+ yes |
+
/netctl path |
@@ -318,7 +391,6 @@ small {
org.netctlgui.netctlgui service (session bus) |
-
/netctlgui path |
@@ -338,11 +410,6 @@ small {
true and closes the application |
no |
-
- QString Information() |
- returns general information in format [ActiveProfile, ActiveProfileStatus] |
- no |
-
void LibraryDocs() |
opens the library documentation |
diff --git a/sources/gui/src/mainwidget.ui b/sources/gui/src/mainwidget.ui
index 51447f8..db77bf8 100644
--- a/sources/gui/src/mainwidget.ui
+++ b/sources/gui/src/mainwidget.ui
@@ -26,6 +26,9 @@
netctl-auto is running
+
+ Qt::AlignCenter
+
-
diff --git a/sources/gui/src/mainwindow.cpp b/sources/gui/src/mainwindow.cpp
index 149634d..686fa98 100644
--- a/sources/gui/src/mainwindow.cpp
+++ b/sources/gui/src/mainwindow.cpp
@@ -121,32 +121,6 @@ Qt::ToolBarArea MainWindow::getToolBarArea()
}
-QStringList MainWindow::printInformation()
-{
- if (debug) qDebug() << PDEBUG;
-
- QStringList output;
- 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; istackedWidget->currentIndex());
+ setTab(ui->stackedWidget->currentIndex());
show();
} else
hide();
@@ -336,12 +310,24 @@ void MainWindow::setTab(int tab)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Set tab" << tab;
+ if (ui->stackedWidget->currentWidget() == nullptr) return;
if ((tab > 2) || (tab < 0)) tab = 0;
- if (tab == ui->stackedWidget->currentIndex())
- updateTabs(tab);
- else
- ui->stackedWidget->setCurrentIndex(tab);
+ if (tab != ui->stackedWidget->currentIndex())
+ return ui->stackedWidget->setCurrentIndex(tab);
+
+ switch (tab) {
+ case 1:
+ newProfileWidget->update();
+ break;
+ case 2:
+ wifiMenuWidget->update();
+ break;
+ case 0:
+ default:
+ mainWidget->update();
+ break;
+ }
}
@@ -426,26 +412,6 @@ void MainWindow::updateConfiguration(const QMap args)
}
-void MainWindow::updateTabs(const int tab)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Update tab" << tab;
-
- switch (tab) {
- case 1:
- newProfileWidget->update();
- break;
- case 2:
- wifiMenuWidget->update();
- break;
- case 0:
- default:
- mainWidget->update();
- break;
- }
-}
-
-
void MainWindow::updateToolBarState(const Qt::ToolBarArea area)
{
if (debug) qDebug() << PDEBUG;
@@ -460,27 +426,17 @@ void MainWindow::updateToolBarState(const Qt::ToolBarArea area)
// private slots
-void MainWindow::setMainTab()
+void MainWindow::setTabByAction(QAction *action)
{
if (debug) qDebug() << PDEBUG;
+ if (action == nullptr) return;
- return setTab(0);
-}
-
-
-void MainWindow::setProfileTab()
-{
- if (debug) qDebug() << PDEBUG;
-
- return setTab(1);
-}
-
-
-void MainWindow::setWifiTab()
-{
- if (debug) qDebug() << PDEBUG;
-
- return setTab(2);
+ if (action == ui->actionNetctl)
+ setTab(0);
+ else if (action == ui->actionProfiles)
+ setTab(1);
+ else if (action == ui->actionWiFi_menu)
+ setTab(2);
}
@@ -513,10 +469,8 @@ void MainWindow::createActions()
{
if (debug) qDebug() << PDEBUG;
+ connect(ui->toolBar, SIGNAL(actionTriggered(QAction *)), this, SLOT(setTabByAction(QAction *)));
connect(ui->actionNetctl_auto, SIGNAL(triggered()), this, SLOT(showNetctlAutoWindow()));
- connect(ui->actionNetctl, SIGNAL(triggered()), this, SLOT(setMainTab()));
- connect(ui->actionProfiles, SIGNAL(triggered()), this, SLOT(setProfileTab()));
- connect(ui->actionWiFi_menu, SIGNAL(triggered()), this, SLOT(setWifiTab()));
connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(setTab(int)));
connect(this, SIGNAL(needToBeConfigured()), this, SLOT(showSettingsWindow()));
@@ -572,9 +526,9 @@ void MainWindow::createObjects()
trayIcon = new TrayIcon(this, configuration, debug);
// windows
ui->retranslateUi(this);
- ui->layout_main->addWidget(mainWidget);
- ui->layout_new->addWidget(newProfileWidget);
- ui->layout_wifi->addWidget(wifiMenuWidget);
+ ui->stackedWidget->addWidget(mainWidget);
+ ui->stackedWidget->addWidget(newProfileWidget);
+ ui->stackedWidget->addWidget(wifiMenuWidget);
updateToolBarState(static_cast(configuration[QString("MAIN_TOOLBAR")].toInt()));
aboutWin = new AboutWindow(this, debug);
settingsWin = new SettingsWindow(this, debug, configPath);
@@ -585,6 +539,9 @@ void MainWindow::deleteObjects()
{
if (debug) qDebug() << PDEBUG;
+ // workaround to avoid crash on window closing
+ disconnect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(setTab(int)));
+
QDBusConnection::sessionBus().unregisterObject(DBUS_OBJECT_PATH);
QDBusConnection::sessionBus().unregisterService(DBUS_SERVICE);
if (netctlCommand != nullptr) delete netctlCommand;
diff --git a/sources/gui/src/mainwindow.h b/sources/gui/src/mainwindow.h
index 61fa9af..02629c5 100644
--- a/sources/gui/src/mainwindow.h
+++ b/sources/gui/src/mainwindow.h
@@ -48,7 +48,6 @@ public:
QTranslator *appTranslator = 0);
~MainWindow();
Qt::ToolBarArea getToolBarArea();
- QStringList printInformation();
QStringList printSettings();
netctlCurrent printTrayInformation();
bool isHelperActive();
@@ -83,16 +82,16 @@ public slots:
void showMessage(const bool status);
void storeToolBars();
void updateConfiguration(const QMap args = QMap());
- void updateTabs(const int tab);
void updateToolBarState(const Qt::ToolBarArea area = Qt::TopToolBarArea);
signals:
void needToBeConfigured();
+ void needShowAboutWindow();
+ void needShowNetctlAutoWindow();
+ void needShowSettingsWindow();
private slots:
- void setMainTab();
- void setProfileTab();
- void setWifiTab();
+ void setTabByAction(QAction *action);
void reportABug();
private:
diff --git a/sources/gui/src/mainwindow.ui b/sources/gui/src/mainwindow.ui
index 9594544..5be2ef9 100644
--- a/sources/gui/src/mainwindow.ui
+++ b/sources/gui/src/mainwindow.ui
@@ -23,27 +23,6 @@
0
-
-
-
- 0
-
-
-
-
-
-
- 0
-
-
-
-
-
-
- 0
-
-
-
diff --git a/sources/gui/src/netctlguiadaptor.cpp b/sources/gui/src/netctlguiadaptor.cpp
index 1797086..a95e6a4 100644
--- a/sources/gui/src/netctlguiadaptor.cpp
+++ b/sources/gui/src/netctlguiadaptor.cpp
@@ -54,12 +54,6 @@ bool NetctlGuiAdaptor::Close()
}
-QStringList NetctlGuiAdaptor::Information()
-{
- return mainWindow->printInformation();
-}
-
-
void NetctlGuiAdaptor::LibraryDocs()
{
return mainWindow->showLibrary();
diff --git a/sources/gui/src/netctlguiadaptor.h b/sources/gui/src/netctlguiadaptor.h
index 668523e..b6ae6c0 100644
--- a/sources/gui/src/netctlguiadaptor.h
+++ b/sources/gui/src/netctlguiadaptor.h
@@ -37,7 +37,6 @@ public slots:
bool Active();
void ApiDocs();
bool Close();
- QStringList Information();
void LibraryDocs();
QString Pony();
bool Restore();
diff --git a/sources/gui/src/trayicon.cpp b/sources/gui/src/trayicon.cpp
index 9dd03ff..7c5701f 100644
--- a/sources/gui/src/trayicon.cpp
+++ b/sources/gui/src/trayicon.cpp
@@ -188,9 +188,10 @@ void TrayIcon::enableProfileTraySlot()
{
if (debug) qDebug() << PDEBUG;
- QString profile = mainWindow->printInformation()[0];
+ QStringList profiles = mainWindow->printTrayInformation().current;
+ if (profiles.isEmpty()) return;
- enableProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
+ enableProfileSlot(profiles[0], mainWindow->netctlInterface, useHelper, debug);
}
@@ -198,9 +199,10 @@ void TrayIcon::restartProfileTraySlot()
{
if (debug) qDebug() << PDEBUG;
- QString profile = mainWindow->printInformation()[0];
+ QStringList profiles = mainWindow->printTrayInformation().current;
+ if (profiles.isEmpty()) return;
- restartProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
+ restartProfileSlot(profiles[0], mainWindow->netctlInterface, useHelper, debug);
}
@@ -208,7 +210,13 @@ void TrayIcon::startProfileTraySlot(QAction *action)
{
if (debug) qDebug() << PDEBUG;
- QString profile = action == nullptr ? mainWindow->printInformation()[0] : action->text().remove(QChar('&'));
+ QString profile;
+ if (action == nullptr) {
+ QStringList profiles = mainWindow->printTrayInformation().current;
+ if (profiles.isEmpty()) return;
+ profile = profiles[0];
+ } else
+ profile = action->text().remove(QChar('&'));
startProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
}
@@ -227,7 +235,8 @@ void TrayIcon::switchToProfileTraySlot(QAction *action)
if (debug) qDebug() << PDEBUG;
if (action == nullptr) return;
- QString profile = action->text().remove(QChar('&'));
+ QStringList profiles = mainWindow->printTrayInformation().current;
+ if (profiles.isEmpty()) return;
- switchToProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
+ switchToProfileSlot(profiles[0], mainWindow->netctlInterface, useHelper, debug);
}
diff --git a/sources/helper/src/controladaptor.cpp b/sources/helper/src/controladaptor.cpp
index 64818cb..9c73e46 100644
--- a/sources/helper/src/controladaptor.cpp
+++ b/sources/helper/src/controladaptor.cpp
@@ -110,6 +110,12 @@ QString ControlAdaptor::SecurityDocs()
}
+bool ControlAdaptor::SelfDestruct()
+{
+ return SelfDestruct();
+}
+
+
QStringList ControlAdaptor::Settings()
{
return helper->printSettings();
diff --git a/sources/helper/src/controladaptor.h b/sources/helper/src/controladaptor.h
index fabde9a..72320ac 100644
--- a/sources/helper/src/controladaptor.h
+++ b/sources/helper/src/controladaptor.h
@@ -45,6 +45,7 @@ public slots:
QString LibraryDocs();
QString Pony();
QString SecurityDocs();
+ bool SelfDestruct();
QStringList Settings();
QStringList UIDs();
bool Update();
diff --git a/sources/netctlgui/include/netctlgui/netctlinteract.h b/sources/netctlgui/include/netctlgui/netctlinteract.h
index dddb2fe..f7d9c10 100644
--- a/sources/netctlgui/include/netctlgui/netctlinteract.h
+++ b/sources/netctlgui/include/netctlgui/netctlinteract.h
@@ -119,7 +119,7 @@ public:
* @param profile profile name
* @return profile description or ""
*/
- QString getProfileDescription(const QString profile);
+ Q_DECL_DEPRECATED QString getProfileDescription(const QString profile);
/**
* @brief method which gets profile status
* @param profile profile name
diff --git a/sources/netctlgui/src/netctlinteract.cpp b/sources/netctlgui/src/netctlinteract.cpp
index 7776360..61b5583 100644
--- a/sources/netctlgui/src/netctlinteract.cpp
+++ b/sources/netctlgui/src/netctlinteract.cpp
@@ -321,11 +321,11 @@ bool Netctl::autoIsProfileActive(const QString profile)
bool status = false;
QList profiles = getProfileListFromNetctlAuto();
- for (int i=0; i profiles = getProfileListFromNetctlAuto();
- for (int i=0; iremoveProfile(profile))
- return InterfaceAnswer::True;
- else
- return InterfaceAnswer::Error;
+ return static_cast(netctlProfile->removeProfile(profile));
}
@@ -238,10 +235,7 @@ InterfaceAnswer NetctlInterface::stopAllProfiles()
return InterfaceAnswer::Error;
}
- if (netctlCommand->stopAllProfiles())
- return InterfaceAnswer::True;
- else
- return InterfaceAnswer::Error;
+ return static_cast(netctlCommand->stopAllProfiles());
}
diff --git a/sources/netctlgui/src/netctlprofile.cpp b/sources/netctlgui/src/netctlprofile.cpp
index 484463c..0fd1093 100644
--- a/sources/netctlgui/src/netctlprofile.cpp
+++ b/sources/netctlgui/src/netctlprofile.cpp
@@ -111,16 +111,16 @@ QString NetctlProfile::createProfile(const QString profile, const QMap NetctlProfile::getSettingsFromProfile(const QString profi
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
output = QString(process.output).trimmed().split(QChar('\n'));
- // gettings variables
+ // read variables
QStringList keys;
for (int i=0; igetProfileDescription(QString("netctlgui-test-dummy"));
- QString dbus;
- if (helper) {
- QList args;
- args.append(QString("netctlgui-test-dummy"));
- args.append(QString("Description"));
- dbus = sendDBusRequest(QString("/netctl"), QString("ProfileValue"), args)
- [0].toString();
- }
- delete netctl;
-
- QCOMPARE(result, original);
- if (helper) QCOMPARE(dbus, result);
-}
-
-
void TestNetctl::test_getProfileStatus()
{
Netctl *netctl = createNetctlObj();
diff --git a/sources/test/testnetctl.h b/sources/test/testnetctl.h
index ad0c55e..c846d1e 100644
--- a/sources/test/testnetctl.h
+++ b/sources/test/testnetctl.h
@@ -36,7 +36,6 @@ private slots:
// netctl
void test_getRecommendedConfiguration();
void test_getActiveProfile();
- void test_getProfileDescription();
void test_getProfileStatus();
void test_isProfileActive();
void test_isProfileEnabled();