Skip to content

Commit ce66bf8

Browse files
committed
fixed ipv6 validator
1 parent 96d2933 commit ce66bf8

File tree

4 files changed

+34
-21
lines changed

4 files changed

+34
-21
lines changed

code/peditor/peditor.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,24 @@ PropertiesEditor::PropertiesEditor(QWidget* parent, const arrayElement& ae, bool
4646
// Setup the address validator and apply it to any ui QLineEdit.
4747
// The lev validator will validate an IP address or up to one white space character (to allow
4848
// editing of the line edit).
49-
QString octet = "(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])";
49+
QString s_ip4 = "(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])";
50+
QString s_ip6 = "(?:[0-9a-fA-F]{1,4})";
5051

5152
// QLineEdits that allow single address
52-
QRegularExpression rx("\\s?|^" + octet + "\\." + octet + "\\." + octet + "\\." + octet + "$");
53-
QRegularExpressionValidator* lev_s = new QRegularExpressionValidator(rx, this);
54-
ui.lineEdit_ipv4address->setValidator(lev_s);
55-
ui.lineEdit_ipv4netmask->setValidator(lev_s);
56-
ui.lineEdit_ipv4gateway->setValidator(lev_s);
57-
ui.lineEdit_ipv6address->setValidator(lev_s);
58-
ui.lineEdit_ipv6gateway->setValidator(lev_s);
53+
QRegularExpression rx4("\\s?|^" + s_ip4 + "\\." + s_ip4 + "\\." + s_ip4 + "\\." + s_ip4 + "$");
54+
QRegularExpression rx6("\\s?|^" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + "$");
55+
QRegularExpressionValidator* lev_4 = new QRegularExpressionValidator(rx4, this);
56+
QRegularExpressionValidator* lev_6 = new QRegularExpressionValidator(rx6, this);
57+
ui.lineEdit_ipv4address->setValidator(lev_4);
58+
ui.lineEdit_ipv4netmask->setValidator(lev_4);
59+
ui.lineEdit_ipv4gateway->setValidator(lev_4);
60+
ui.lineEdit_ipv6address->setValidator(lev_6);
61+
ui.lineEdit_ipv6gateway->setValidator(lev_6);
5962

6063
// now QLineEdits that allow multiple addresses
61-
rx.setPattern("\\s*|(" + octet + "\\." + octet + "\\." + octet + "\\." + octet + "(\\s*[,|;]?\\s*))+");
62-
QRegularExpressionValidator* lev_m = new QRegularExpressionValidator(rx, this);
64+
//rx4.setPattern("\\s*|(" + s_ip4 + "\\." + s_ip4 + "\\." + s_ip4 + "\\." + s_ip4 + "(\\s*[,|;]?\\s*))+");
65+
QRegularExpression rx46("\\s?|((" + s_ip4 + "\\." + s_ip4 + "\\." + s_ip4 + "\\." + s_ip4 + "|" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ":" + s_ip6 + ")" + "(\\s*[,|;|\\s]+\\s*))+");
66+
QRegularExpressionValidator* lev_m = new QRegularExpressionValidator(rx46, this);
6367
ui.lineEdit_nameservers->setValidator(lev_m);
6468
ui.lineEdit_timeservers->setValidator(lev_m);
6569
ui.lineEdit_domains->setValidator(lev_m);

code/peditor/ui/peditor.ui

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
<number>0</number>
2727
</property>
2828
<widget class="QWidget" name="general">
29+
<property name="geometry">
30+
<rect>
31+
<x>0</x>
32+
<y>0</y>
33+
<width>279</width>
34+
<height>166</height>
35+
</rect>
36+
</property>
2937
<attribute name="label">
3038
<string>&amp;General</string>
3139
</attribute>
@@ -162,8 +170,8 @@
162170
<rect>
163171
<x>0</x>
164172
<y>0</y>
165-
<width>279</width>
166-
<height>166</height>
173+
<width>154</width>
174+
<height>132</height>
167175
</rect>
168176
</property>
169177
<property name="whatsThis">
@@ -253,8 +261,8 @@
253261
<rect>
254262
<x>0</x>
255263
<y>0</y>
256-
<width>279</width>
257-
<height>166</height>
264+
<width>194</width>
265+
<height>161</height>
258266
</rect>
259267
</property>
260268
<property name="whatsThis">
@@ -335,7 +343,7 @@
335343
</item>
336344
<item>
337345
<property name="text">
338-
<string>Prefered</string>
346+
<string>Preferred</string>
339347
</property>
340348
</item>
341349
<item>
@@ -374,7 +382,7 @@
374382
<rect>
375383
<x>0</x>
376384
<y>0</y>
377-
<width>265</width>
385+
<width>146</width>
378386
<height>168</height>
379387
</rect>
380388
</property>
@@ -416,7 +424,7 @@
416424
<item row="1" column="0" colspan="2">
417425
<widget class="QStackedWidget" name="stackedWidget_proxy01">
418426
<property name="currentIndex">
419-
<number>0</number>
427+
<number>2</number>
420428
</property>
421429
<widget class="QWidget" name="page_0"/>
422430
<widget class="QWidget" name="page_1">

code/resource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ DEALINGS IN THE SOFTWARE.
3434

3535
///////////////////////////////// Program Values ///////////////////////
3636
// Program Info
37-
#define VERSION "14.10.12-1"
38-
#define RELEASE_DATE "23 August 2014"
37+
#define VERSION "14.10.14-1"
38+
#define RELEASE_DATE "15 October 2014"
3939
#define COPYRIGHT_DATE "2013-2014"
4040

4141
// Program Values

text/changelog.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<b><center>Connman System Tray (CMST)</center></b>
1+
q<b><center>Connman System Tray (CMST)</center></b>
22
<b><center>Change Log</center></b>
33
<br>
4-
<br><b>In Progress</b>
4+
<br><b>2014.10.15</b>
55
<ul>
66
<li>Connect, Disconnect, and Remove buttons in the Wifi tab are disabled if no Wifi services are available.<li>
77
<li>If only one WiFi service exists it is no longer necessary to select it first before pressing the Connect button.</li>
@@ -10,6 +10,7 @@
1010
<li>If an instance of CMST is started while one is running the running copy will be raised, and a message about a second instance trying to start will be printed to stderr.</li>
1111
<li>Wifi signal strength bar and techonlogy buttons now have frames around them so that they do not fill an entire table cell</li>
1212
<li>Autoconnect property can be set or unset from the property editor.</li>
13+
<li>Fixed IPv6 validator in the properties editor.</li>
1314
</ul>
1415
<br>
1516
<br><b>2014.08.23</b>

0 commit comments

Comments
 (0)