summaryrefslogtreecommitdiff
path: root/examples/networksettings/exampleiface.cpp
Unidiff
Diffstat (limited to 'examples/networksettings/exampleiface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/networksettings/exampleiface.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/networksettings/exampleiface.cpp b/examples/networksettings/exampleiface.cpp
new file mode 100644
index 0000000..5267a9c
--- a/dev/null
+++ b/examples/networksettings/exampleiface.cpp
@@ -0,0 +1,43 @@
1#include "exampleiface.h"
2
3VirtualInterface::VirtualInterface( QObject* parent,
4 const char* name,
5 bool status )
6 : Interface(parent, name, status )
7{
8}
9
10VirtualInterface::~VirtualInterface() {
11}
12
13bool VirtualInterface::refresh() {
14/* we do VPN over ppp
15 * so replace the interfaceName with
16 * something actual existing
17 * I take wlan0 in my case
18 */
19 QString old = getInterfaceName();
20 qWarning("Interface name was " + old );
21 setInterfaceName( "wlan0" );
22
23 bool b =Interface::refresh();
24 setInterfaceName( old );
25
26/* new and old interface name */
27 emit updateInterface(this);
28 return b;
29}
30
31
32void VirtualInterface::start() {
33// call pptp
34 setStatus(true);
35 refresh();
36 emit updateMessage("VPN started");
37}
38
39void VirtualInterface::stop() {
40 setStatus(false );
41 refresh();
42 emit updateMessage("VPN halted");
43}