diff --git a/apps/cmstapp/code/control_box/controlbox.cpp b/apps/cmstapp/code/control_box/controlbox.cpp index 2908a9b1..15c689d0 100755 --- a/apps/cmstapp/code/control_box/controlbox.cpp +++ b/apps/cmstapp/code/control_box/controlbox.cpp @@ -456,6 +456,7 @@ ControlBox::ControlBox(const QCommandLineParser& parser, QWidget *parent) connect(ui.pushButton_disconnect, SIGNAL(clicked()), this, SLOT(disconnectPressed())); connect(ui.pushButton_vpn_disconnect, SIGNAL(clicked()), this, SLOT(disconnectPressed())); connect(ui.pushButton_remove, SIGNAL(clicked()), this, SLOT(removePressed())); + connect(ui.pushButton_edit, SIGNAL(clicked()), this, SLOT(editPressed())); connect(ui.pushButton_aboutCMST, SIGNAL(clicked()), this, SLOT(aboutCMST())); connect(ui.pushButton_aboutIconSet, SIGNAL(clicked()), this, SLOT(aboutIconSet())); connect(ui.pushButton_aboutOtherArt, SIGNAL(clicked()), this, SLOT(aboutOtherArt())); @@ -826,7 +827,7 @@ void ControlBox::connectPressed() // Slot to actually request a connection via DBUS. Called from the connectPressed() slot void ControlBox::requestConnection() { - // only way here is when a finished() signal fires, delete the object that did it + // if we got here because a finished() signal fireed delete the object that did it if (proc) delete proc; if (gened) delete gened; @@ -918,7 +919,13 @@ void ControlBox::disconnectPressed() // Called when ui.pushButton_remove is pressed void ControlBox::removePressed() { - // if no row selected return + // If there is only one row select it + if (ui.tableWidget_wifi->rowCount() == 1 ) { + QTableWidgetSelectionRange qtwsr = QTableWidgetSelectionRange(0, 0, 0, ui.tableWidget_wifi->columnCount() - 1); + ui.tableWidget_wifi->setRangeSelected(qtwsr, true); + } + + // If no row is selected then return QList list; list.clear(); list = ui.tableWidget_wifi->selectedItems(); @@ -928,6 +935,10 @@ void ControlBox::removePressed() return; } + // calling Remove() on hidden or provisioned services will cause an error, so simply return now without executing the method. + QMap map = wifi_list.at(list.at(0)->row()).objmap; + if(map.value("Name").toString().isEmpty() || map.value("Immutable").toBool() ) return; + // send the Remove message to the service QDBusInterface* iface_serv = new QDBusInterface(DBUS_CON_SERVICE, wifi_list.at(list.at(0)->row()).objpath.path(), "net.connman.Service", QDBusConnection::systemBus(), this); QDBusMessage reply = iface_serv->call(QDBus::AutoDetect, "Remove"); @@ -937,7 +948,38 @@ void ControlBox::removePressed() return; } -// dbs slots are slots to receive DBus Signals +// +// Slot to edit a Wifi service. Note that Connman does not provide a way to retrieve or edit a passphrase. Adding something like this is insecure as we don't know +// anything about the permissions the CMST user has. The best we can do issue a remove call then a connect call. +void ControlBox::editPressed() +{ + // If there is only one row select it + if (ui.tableWidget_wifi->rowCount() == 1 ) { + QTableWidgetSelectionRange qtwsr = QTableWidgetSelectionRange(0, 0, 0, ui.tableWidget_wifi->columnCount() - 1); + ui.tableWidget_wifi->setRangeSelected(qtwsr, true); + } + + // if no row selected return + QList list; + list.clear(); + list = ui.tableWidget_wifi->selectedItems(); + if (list.isEmpty() ) { + QMessageBox::information(this, tr("No Services Selected"), + tr("You need to select a Wifi service before pressing the edit button.") ); + return; + } + + // remove the connection + this->removePressed(); + + // connect the connection which will ask for user information if needed + pendingobjectpath = wifi_list.at(list.at(0)->row()).objpath.path(); + this->requestConnection(); + + return; +} + +// dbs slots: these slots are to receive DBus Signals // // Slot called whenever DBUS issues a PropertyChanged signal void ControlBox::dbsPropertyChanged(QString prop, QDBusVariant dbvalue) diff --git a/apps/cmstapp/code/control_box/controlbox.h b/apps/cmstapp/code/control_box/controlbox.h index f90e7e32..742ed219 100755 --- a/apps/cmstapp/code/control_box/controlbox.h +++ b/apps/cmstapp/code/control_box/controlbox.h @@ -185,6 +185,7 @@ class ControlBox : public QDialog void requestConnection(); void disconnectPressed(); void removePressed(); + void editPressed(); void dbsPropertyChanged(QString,QDBusVariant); void dbsServicesChanged(QList, QList, QDBusMessage); void dbsPeersChanged(QList, QList, QDBusMessage); diff --git a/apps/cmstapp/code/control_box/ui/controlbox.ui b/apps/cmstapp/code/control_box/ui/controlbox.ui index ed56eea2..37485c0d 100644 --- a/apps/cmstapp/code/control_box/ui/controlbox.ui +++ b/apps/cmstapp/code/control_box/ui/controlbox.ui @@ -580,74 +580,6 @@ &Wireless - - - - <html><head/><body><p>This page shows the known WiFi services. </p><p><span style=" font-weight:600;">Name:</span> The SSID of the network.</p><p><span style=" font-weight:600;">Favorite:</span> A heart symbol in this column indicates that this computer has previously made a connection to the network using this service.</p><p><span style=" font-weight:600;">Connected:</span> Shows the connection state of this service. Hover the mouse over the icon to popup a text description. Online signals that an Internet connectionis available and has been verified. Ready signals a successfully connected device. </p><p><span style=" font-weight:600;">Security: </span>Describes the type of security used for this service. Possible values are &quot;none&quot;, &quot;wep&quot;, &quot;psk&quot;, &quot;ieee8021x&quot;, and &quot;wps&quot;.</p><p><span style=" font-weight:600;">Signal Strength:</span> The strength of the WiFi signal, normalized to a scale of 0 to 100.</p><p><br/></p></body></html> - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - false - - - 5 - - - 80 - - - true - - - false - - - false - - - - Name - - - - - Favorite - - - - - Connected - - - - - Security - - - - - Signal Strength - - - - @@ -684,6 +616,16 @@ + + + + <html><head/><body><p>Select a wifi service in the table below and press this button to edit the service. </p><p>The service must have previously been successfully connected (Favorite is true) for this button to work. Pressing <span style=" font-weight:600;">Edit</span> will remove the service and then request credentials to establish the connection. If the service is currently connected it will be disconnected first. If the service required a passphrase then the old passphrase it will be cleared and forgotten.</p><p>Connman does not provide any methods to retrieve credentials (passphrases, etc.) as that is insecure. CMST will not work around this protection. All this button really does is automate pressing the <span style=" font-weight:600;">Remove</span> and <span style=" font-weight:600;">Connect</span> buttons above. Make sure you know all of the credentials to reconnect as the existing credentials will be cleared when this button is pressed.</p></body></html> + + + Edit + + + @@ -726,6 +668,74 @@ + + + + <html><head/><body><p>This page shows the known WiFi services. </p><p><span style=" font-weight:600;">Name:</span> The SSID of the network.</p><p><span style=" font-weight:600;">Favorite:</span> A heart symbol in this column indicates that this computer has previously made a connection to the network using this service.</p><p><span style=" font-weight:600;">Connected:</span> Shows the connection state of this service. Hover the mouse over the icon to popup a text description. Online signals that an Internet connectionis available and has been verified. Ready signals a successfully connected device. </p><p><span style=" font-weight:600;">Security: </span>Describes the type of security used for this service. Possible values are &quot;none&quot;, &quot;wep&quot;, &quot;psk&quot;, &quot;ieee8021x&quot;, and &quot;wps&quot;.</p><p><span style=" font-weight:600;">Signal Strength:</span> The strength of the WiFi signal, normalized to a scale of 0 to 100.</p><p><br/></p></body></html> + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + false + + + 5 + + + 80 + + + true + + + false + + + false + + + + Name + + + + + Favorite + + + + + Connected + + + + + Security + + + + + Signal Strength + + + + @@ -1047,7 +1057,7 @@ 0 - -22 + 0 621 663 diff --git a/apps/resource.h b/apps/resource.h index 306b88b2..2765e6fc 100755 --- a/apps/resource.h +++ b/apps/resource.h @@ -43,7 +43,7 @@ DEALINGS IN THE SOFTWARE. ///////////////////////////////// Program Values /////////////////////// // // Program Info (may be visible, but don't mark for tranalation) -#define VERSION "2022.01.09-2" +#define VERSION "2022.01.09-3" #define RELEASE_DATE "05 January 2022" #define COPYRIGHT_DATE "2013-2022" diff --git a/text/changelog.txt b/text/changelog.txt index a3885eeb..c8fda43d 100644 --- a/text/changelog.txt +++ b/text/changelog.txt @@ -2,6 +2,7 @@
Change Log
In Progress
    +
  • Added Edit button to Wifi Services (issue #202)
  • Removed obsolete managerRescan() function, moved code to where needed.
  • Fix VPN parsing not being done in various display elements (issue #192)