Skip to content

Commit

Permalink
fixed #151
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bibb committed Sep 18, 2016
1 parent 75a3f0b commit df0a949
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 18 deletions.
23 changes: 18 additions & 5 deletions apps/cmstapp/code/control_box/controlbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ void ControlBox::dbsServicesChanged(QList<QVariant> vlist, QList<QDBusObjectPath
if (services_list.count() > 0) {
if (services_list.at(0).objmap.value("Type") == "vpn") managerRescan(CMST::Manager_Services);
}

updateDisplayWidgets();

return;
Expand Down Expand Up @@ -1164,8 +1165,9 @@ void ControlBox::dbsTechnologyPropertyChanged(QString name, QDBusVariant dbvalue
return;
}

// Slot to rescan all WiFi technologies. Called from the
// ui.pushButton_rescan control.
// Slot to rescan all WiFi technologies. Called when ui.actionRescan
// is triggered. Action is called from rescanwifi buttons and from
// the context menu.
// Results signaled by manager.ServicesChanged(), except for peer
// services which will be signaled by manager.PeersChanged()
void ControlBox::scanWiFi()
Expand All @@ -1177,13 +1179,12 @@ void ControlBox::scanWiFi()
for (int row = 0; row < technologies_list.size(); ++row) {
if (technologies_list.at(row).objmap.value("Type").toString() == "wifi") {
if (technologies_list.at(row).objmap.value("Powered").toBool() ) {
ui.pushButton_rescan->setDisabled(true);
setStateRescan(false);
ui.tableWidget_services->setCurrentIndex(QModelIndex()); // first cell becomes selected once pushbutton is disabled
qApp->processEvents(); // needed to promply disable the button
QDBusInterface* iface_tech = new QDBusInterface(DBUS_CON_SERVICE, technologies_list.at(row).objpath.path(), "net.connman.Technology", QDBusConnection::systemBus(), this);
iface_tech->setTimeout( 8 * 1000); // full 25 second timeout is a bit much when there is a problem
QDBusMessage reply = iface_tech->call(QDBus::AutoDetect, "Scan");
if (shared::processReply(reply) != QDBusMessage::InvalidMessage) ui.pushButton_rescan->setEnabled(true);
iface_tech->deleteLater();
} // if the wifi was powered
} // if the list item is wifi
Expand Down Expand Up @@ -1699,7 +1700,7 @@ void ControlBox::assembleTabStatus()
ui.tableWidget_technologies->showColumn(5);
ui.pushButton_IDPass->setHidden(false);
}

for (int row = 0; row < technologies_list.size(); ++row) {
QTableWidgetItem* qtwi00 = new QTableWidgetItem();
st = technologies_list.at(row).objmap.value("Name").toString();
Expand Down Expand Up @@ -1959,6 +1960,7 @@ void ControlBox::assembleTabWireless()
ui.pushButton_connect->setEnabled(b_enable);
ui.pushButton_disconnect->setEnabled(b_enable);
ui.pushButton_remove->setEnabled(b_enable);
setStateRescan(b_enable);

return;
}
Expand Down Expand Up @@ -3013,3 +3015,14 @@ void ControlBox::iconColorChanged(const QString& col)
return;
}

//
// Slot to set the enabled/disabled state of the rescan wifi controls
void ControlBox::setStateRescan(bool state)
{
ui.pushButton_rescanwifi01->setEnabled(state);
ui.pushButton_rescanwifi02->setEnabled(state);
ui.actionRescan->setEnabled(state);

return;
}

1 change: 1 addition & 0 deletions apps/cmstapp/code/control_box/controlbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class ControlBox : public QDialog
void cleanUp();
void callColorDialog();
void iconColorChanged(const QString&);
void setStateRescan(bool);
};

#endif
Expand Down
50 changes: 38 additions & 12 deletions apps/cmstapp/code/control_box/ui/controlbox.ui
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pushButton_rescan">
<widget class="QPushButton" name="pushButton_rescanwifi01">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force a rescan of all WiFi technologies. This is similar to issuing the command &lt;span style=&quot; font-weight:600;&quot;&gt;connmanctl scan wifi&lt;/span&gt; from the command line.&lt;/p&gt;&lt;p&gt;The button will become inactive while the scan is occuring.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
Expand Down Expand Up @@ -523,8 +523,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>60</height>
<width>647</width>
<height>353</height>
</rect>
</property>
<layout class="QVBoxLayout" name="_2">
Expand Down Expand Up @@ -720,6 +720,16 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_rescanwifi02">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force a rescan of all WiFi technologies. This is similar to issuing the command &lt;span style=&quot; font-weight:600;&quot;&gt;connmanctl scan wifi&lt;/span&gt; from the command line.&lt;/p&gt;&lt;p&gt;The button will become inactive while the scan is occuring.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Resc&amp;an</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_wifi_state">
<property name="sizePolicy">
Expand Down Expand Up @@ -895,8 +905,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>112</width>
<height>286</height>
<width>647</width>
<height>431</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7">
Expand Down Expand Up @@ -935,8 +945,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>46</height>
<width>603</width>
<height>141</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
Expand Down Expand Up @@ -991,8 +1001,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>46</height>
<width>603</width>
<height>140</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
Expand Down Expand Up @@ -1747,8 +1757,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>412</height>
<width>537</width>
<height>431</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
Expand Down Expand Up @@ -1961,7 +1971,7 @@
</hints>
</connection>
<connection>
<sender>pushButton_rescan</sender>
<sender>pushButton_rescanwifi01</sender>
<signal>clicked()</signal>
<receiver>actionRescan</receiver>
<slot>trigger()</slot>
Expand Down Expand Up @@ -2120,5 +2130,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_rescanwifi02</sender>
<signal>clicked()</signal>
<receiver>actionRescan</receiver>
<slot>trigger()</slot>
<hints>
<hint type="sourcelabel">
<x>329</x>
<y>83</y>
</hint>
<hint type="destinationlabel">
<x>-1</x>
<y>-1</y>
</hint>
</hints>
</connection>
</connections>
</ui>
2 changes: 1 addition & 1 deletion apps/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DEALINGS IN THE SOFTWARE.
///////////////////////////////// Program Values ///////////////////////
//
// Program Info (may be visible, but don't mark for tranalation)
#define VERSION "2016.08.11-1"
#define VERSION "2016.09.18-1"

#define RELEASE_DATE "3 April 2016"
#define COPYRIGHT_DATE "2013-2016"
Expand Down
2 changes: 2 additions & 0 deletions text/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<li>New commandline option to disable VPN support (issue #144).</li>
<li>Fixed showing error dialog when connect is selected from the tray icon (issue #143).</li>
<li>Provisioning editor and properties editor nameserver and timeserver fields will now accept domain names in addition to IPv4 and IPv6 addresses (issue #146).</li>
<li>Added wifi rescan button to Wifi tab (issue #151).</li>
<li>Wifi rescan controls disabled during scans and if there is no powered Wifi technology found.</li>
</ul>
<b>2016.04.03</b>
<ul>
Expand Down

0 comments on commit df0a949

Please sign in to comment.