Commit 5fa6da95 authored by Andrea Scarpino's avatar Andrea Scarpino

IPv6 support

parent 38011671
......@@ -42,16 +42,16 @@ Page {
switch (exitCode) {
case 0:
errorMsg.color = "green";
errorMsg.text = "The host is UP!";
errorMsg.text = qsTr("The host is UP!");
break;
case 2:
errorMsg.color = "yellow";
errorMsg.text = "The host is UNKNOWN";
errorMsg.text = qsTr("The host is UNKNOWN");
break;
case 1:
default:
errorMsg.color = "red";
errorMsg.text = "The host is DOWN!";
errorMsg.text = qsTr("The host is DOWN!");
}
}
}
......@@ -71,7 +71,20 @@ Page {
width: column.width
focus: true
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
placeholderText: "Write an IP address or an host name"
placeholderText: "An IP address or hostname"
onTextChanged: {
if (host.text.match('([a-zA-Z1-9]{1,4}:){5}[a-zA-Z1-9]{1,4}')) {
ipv6.checked = true;
} else if (host.text.match('([1-9]{1,3}.){3}[1-9]{1,3}')) {
ipv6.checked = false;
}
}
}
TextSwitch {
id: ipv6
text: qsTr("IPv6")
}
Label {
......@@ -81,10 +94,10 @@ Page {
Button {
id: button
text: "Ping it"
text: qsTr("Ping it")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
pingAction.ping(host.text);
pingAction.ping(host.text, ipv6.checked);
button.enabled = false;
}
}
......
* Tue Sep 19 2014 Andrea Scarpino <me@andreascarpino> 0.2-1
- IPv6 support
* Tue Sep 09 2014 Andrea Scarpino <me@andreascarpino> 0.1-1
- First release!
......@@ -13,7 +13,7 @@ Name: harbour-hostisdown
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Check if the desired host is up or not
Version: 0.1
Version: 0.2
Release: 1
Group: Qt/Qt
License: MIT
......
Name: harbour-hostisdown
Summary: Check if the desired host is up or not
Version: 0.1
Version: 0.2
Release: 1
# The contents of the Group field should be one of the groups listed here:
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
......
......@@ -46,8 +46,13 @@ PingAction::~PingAction()
delete m_process;
}
void PingAction::ping(const QString &host)
void PingAction::ping(const QString &host, const bool ipv6)
{
qDebug() << "Pinging" << host;
m_process->start("/bin/ping -c 1 " + host);
if (ipv6) {
m_process->start("/bin/ping6 -c 1 " + host);
} else {
m_process->start("/bin/ping -c 1 " + host);
}
}
......@@ -40,7 +40,7 @@ class PingAction : public QObject
public:
explicit PingAction(QObject *parent = 0);
virtual ~PingAction();
Q_INVOKABLE void ping(const QString &host);
Q_INVOKABLE void ping(const QString &host, const bool ipv6);
Q_SIGNALS:
void result(int exitCode);
......
......@@ -5,7 +5,7 @@
<name>CoverPage</name>
<message>
<location filename="../qml/cover/CoverPage.qml" line="37"/>
<source>Esegui il Ping</source>
<source>Esegui il ping</source>
<translation type="unfinished"></translation>
</message>
</context>
......@@ -13,7 +13,12 @@
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="66"/>
<source>Pinga un host!</source>
<source>Ping any host!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="87"/>
<source>IPv6</source>
<translation type="unfinished"></translation>
</message>
</context>
......
......@@ -5,7 +5,7 @@
<name>CoverPage</name>
<message>
<location filename="../qml/cover/CoverPage.qml" line="37"/>
<source>Ping It</source>
<source>Ping It!</source>
<translation type="unfinished"></translation>
</message>
</context>
......@@ -16,5 +16,10 @@
<source>Ping any host!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="87"/>
<source>IPv6</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment