summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interfaces/interface.cpp24
-rw-r--r--noncore/net/networksetup/interfaces/interface.h3
-rw-r--r--noncore/net/networksetup/interfaces/interfaceinformationimp.cpp13
-rw-r--r--noncore/net/networksetup/interfaces/interfaceinformationimp.h1
-rw-r--r--noncore/net/networksetup/interfaces/interfaces.pro2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp24
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h3
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp13
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.h1
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.pro2
10 files changed, 66 insertions, 20 deletions
diff --git a/noncore/net/networksetup/interfaces/interface.cpp b/noncore/net/networksetup/interfaces/interface.cpp
index 929b3a1..e4f405e 100644
--- a/noncore/net/networksetup/interfaces/interface.cpp
+++ b/noncore/net/networksetup/interfaces/interface.cpp
@@ -58,42 +58,52 @@ void Interface::setModuleOwner(Module *owner){
58}; 58};
59 59
60 60
61/** 61/**
62 * Try to start the interface. 62 * Try to start the interface.
63 */ 63 */
64void Interface::start(){ 64void Interface::start(){
65 // check to see if we are already running. 65 // check to see if we are already running.
66 if(true == status) 66 if(true == status){
67 emit (updateMessage("Unable to start interface,\n already started"));
67 return; 68 return;
68 69 }
70
69 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); 71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
70 // See if it was successfull... 72 // See if it was successfull...
71 if(ret != 0) 73 if(ret != 0){
74 emit (updateMessage("Starting interface failed."));
72 return; 75 return;
73 76 }
77
74 status = true; 78 status = true;
75 refresh(); 79 refresh();
80 emit (updateMessage("Start successfull"));
76} 81}
77 82
78/** 83/**
79 * Try to stop the interface. 84 * Try to stop the interface.
80 */ 85 */
81void Interface::stop(){ 86void Interface::stop(){
82 // check to see if we are already stopped. 87 // check to see if we are already stopped.
83 if(false == status) 88 if(false == status){
89 emit (updateMessage("Unable to stop interface,\n already stopped"));
84 return; 90 return;
91 }
85 92
86 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); 93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
87 if(ret != 0) 94 if(ret != 0){
95 emit (updateMessage("Stopping interface failed."));
88 return; 96 return;
97 }
89 98
90 status = true; 99 status = false;
91 refresh(); 100 refresh();
101 emit (updateMessage("Stop successfull"));
92} 102}
93 103
94/** 104/**
95 * Try to restart the interface. 105 * Try to restart the interface.
96 */ 106 */
97void Interface::restart(){ 107void Interface::restart(){
98 stop(); 108 stop();
99 start(); 109 start();
diff --git a/noncore/net/networksetup/interfaces/interface.h b/noncore/net/networksetup/interfaces/interface.h
index dc9c6d3..fc064fe 100644
--- a/noncore/net/networksetup/interfaces/interface.h
+++ b/noncore/net/networksetup/interfaces/interface.h
@@ -6,17 +6,18 @@
6 6
7class Module; 7class Module;
8 8
9class Interface : public QObject{ 9class Interface : public QObject{
10 Q_OBJECT 10 Q_OBJECT
11 11
12signals: 12signals:
13 void updateInterface(Interface *i); 13 void updateInterface(Interface *i);
14 14 void updateMessage(const QString &message);
15
15public: 16public:
16 Interface(QObject * parent=0, const char * name= "unknown", bool status = false); 17 Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
17 virtual ~Interface(){}; 18 virtual ~Interface(){};
18 19
19 virtual QString getInterfaceName(){ QString n(this->name()); return n; }; 20 virtual QString getInterfaceName(){ QString n(this->name()); return n; };
20 21
21 virtual bool getStatus(){ return status; }; 22 virtual bool getStatus(){ return status; };
22 virtual void setStatus(bool newStatus); 23 virtual void setStatus(bool newStatus);
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp
index 43483fb..39575c4 100644
--- a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp
+++ b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp
@@ -1,32 +1,34 @@
1#include "interfaceinformationimp.h" 1#include "interfaceinformationimp.h"
2#include "interfaceadvanced.h" 2#include "interfaceadvanced.h"
3 3
4#include <qpushbutton.h> 4#include <qpushbutton.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qmessagebox.h>
8
7#include <assert.h> 9#include <assert.h>
8 10
9/** 11/**
10 * Constructor for the InterfaceInformationImp class. This class pretty much 12 * Constructor for the InterfaceInformationImp class. This class pretty much
11 * just display's information about the interface that is passed to it. 13 * just display's information about the interface that is passed to it.
12 */ 14 */
13InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ 15InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){
14 assert(i); 16 assert(i);
15 17
16 interface = i; 18 interface = i;
17 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 19 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
20 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
18 updateInterface(interface); 21 updateInterface(interface);
19 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 22 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
20 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 23 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
21 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 24 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
22 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 25 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
23 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 26 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
24
25} 27}
26 28
27/** 29/**
28 * Update the interface information and buttons. 30 * Update the interface information and buttons.
29 * @param Intarface *i the interface to update (should be the one we already 31 * @param Intarface *i the interface to update (should be the one we already
30 * know about). 32 * know about).
31 */ 33 */
32void InterfaceInformationImp::updateInterface(Interface *i){ 34void InterfaceInformationImp::updateInterface(Interface *i){
@@ -61,10 +63,19 @@ void InterfaceInformationImp::advanced(){
61 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 63 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
62 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 64 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
63 a->dhcpInformation->setEnabled(interface->isDhcp()); 65 a->dhcpInformation->setEnabled(interface->isDhcp());
64 66
65 a->showMaximized(); 67 a->showMaximized();
66 a->show(); 68 a->show();
67} 69}
68 70
71/**
72 * Messages from the interface if start/stop went as planned.
73 * Purly for user feedback.
74 * @param message the message to display.
75 */
76void InterfaceInformationImp::showMessage(const QString &message){
77 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
78}
79
69// infoimp.cpp 80// infoimp.cpp
70 81
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.h b/noncore/net/networksetup/interfaces/interfaceinformationimp.h
index 42213cc..65cdfe0 100644
--- a/noncore/net/networksetup/interfaces/interfaceinformationimp.h
+++ b/noncore/net/networksetup/interfaces/interfaceinformationimp.h
@@ -10,16 +10,17 @@ Q_OBJECT
10 10
11public: 11public:
12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0); 12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
13 ~InterfaceInformationImp(){}; 13 ~InterfaceInformationImp(){};
14 14
15private slots: 15private slots:
16 void advanced(); 16 void advanced();
17 void updateInterface(Interface *i); 17 void updateInterface(Interface *i);
18 void showMessage(const QString &message);
18 19
19private: 20private:
20 Interface *interface; 21 Interface *interface;
21 22
22}; 23};
23 24
24#endif 25#endif
25 26
diff --git a/noncore/net/networksetup/interfaces/interfaces.pro b/noncore/net/networksetup/interfaces/interfaces.pro
index 9a024f6..d6b43fb 100644
--- a/noncore/net/networksetup/interfaces/interfaces.pro
+++ b/noncore/net/networksetup/interfaces/interfaces.pro
@@ -1,12 +1,12 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug 3 #CONFIG += qt warn_on debug
4 DESTDIR = $(QTDIR)/lib$(PROJMAK) 4 #DESTDIR = $(QTDIR)/lib$(PROJMAK)
5 HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h 5 HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h
6 SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp 6 SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ 7 INCLUDEPATH+= $(OPIEDIR)/include ../
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui 10 INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui
11 TARGET = interfaces 11 TARGET = interfaces
12 VERSION = 1.0.0 12 VERSION = 1.0.0
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index 929b3a1..e4f405e 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -58,42 +58,52 @@ void Interface::setModuleOwner(Module *owner){
58}; 58};
59 59
60 60
61/** 61/**
62 * Try to start the interface. 62 * Try to start the interface.
63 */ 63 */
64void Interface::start(){ 64void Interface::start(){
65 // check to see if we are already running. 65 // check to see if we are already running.
66 if(true == status) 66 if(true == status){
67 emit (updateMessage("Unable to start interface,\n already started"));
67 return; 68 return;
68 69 }
70
69 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); 71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
70 // See if it was successfull... 72 // See if it was successfull...
71 if(ret != 0) 73 if(ret != 0){
74 emit (updateMessage("Starting interface failed."));
72 return; 75 return;
73 76 }
77
74 status = true; 78 status = true;
75 refresh(); 79 refresh();
80 emit (updateMessage("Start successfull"));
76} 81}
77 82
78/** 83/**
79 * Try to stop the interface. 84 * Try to stop the interface.
80 */ 85 */
81void Interface::stop(){ 86void Interface::stop(){
82 // check to see if we are already stopped. 87 // check to see if we are already stopped.
83 if(false == status) 88 if(false == status){
89 emit (updateMessage("Unable to stop interface,\n already stopped"));
84 return; 90 return;
91 }
85 92
86 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); 93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
87 if(ret != 0) 94 if(ret != 0){
95 emit (updateMessage("Stopping interface failed."));
88 return; 96 return;
97 }
89 98
90 status = true; 99 status = false;
91 refresh(); 100 refresh();
101 emit (updateMessage("Stop successfull"));
92} 102}
93 103
94/** 104/**
95 * Try to restart the interface. 105 * Try to restart the interface.
96 */ 106 */
97void Interface::restart(){ 107void Interface::restart(){
98 stop(); 108 stop();
99 start(); 109 start();
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index dc9c6d3..fc064fe 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -6,17 +6,18 @@
6 6
7class Module; 7class Module;
8 8
9class Interface : public QObject{ 9class Interface : public QObject{
10 Q_OBJECT 10 Q_OBJECT
11 11
12signals: 12signals:
13 void updateInterface(Interface *i); 13 void updateInterface(Interface *i);
14 14 void updateMessage(const QString &message);
15
15public: 16public:
16 Interface(QObject * parent=0, const char * name= "unknown", bool status = false); 17 Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
17 virtual ~Interface(){}; 18 virtual ~Interface(){};
18 19
19 virtual QString getInterfaceName(){ QString n(this->name()); return n; }; 20 virtual QString getInterfaceName(){ QString n(this->name()); return n; };
20 21
21 virtual bool getStatus(){ return status; }; 22 virtual bool getStatus(){ return status; };
22 virtual void setStatus(bool newStatus); 23 virtual void setStatus(bool newStatus);
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index 43483fb..39575c4 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,32 +1,34 @@
1#include "interfaceinformationimp.h" 1#include "interfaceinformationimp.h"
2#include "interfaceadvanced.h" 2#include "interfaceadvanced.h"
3 3
4#include <qpushbutton.h> 4#include <qpushbutton.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qmessagebox.h>
8
7#include <assert.h> 9#include <assert.h>
8 10
9/** 11/**
10 * Constructor for the InterfaceInformationImp class. This class pretty much 12 * Constructor for the InterfaceInformationImp class. This class pretty much
11 * just display's information about the interface that is passed to it. 13 * just display's information about the interface that is passed to it.
12 */ 14 */
13InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ 15InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){
14 assert(i); 16 assert(i);
15 17
16 interface = i; 18 interface = i;
17 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 19 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
20 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
18 updateInterface(interface); 21 updateInterface(interface);
19 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 22 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
20 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 23 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
21 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 24 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
22 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 25 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
23 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 26 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
24
25} 27}
26 28
27/** 29/**
28 * Update the interface information and buttons. 30 * Update the interface information and buttons.
29 * @param Intarface *i the interface to update (should be the one we already 31 * @param Intarface *i the interface to update (should be the one we already
30 * know about). 32 * know about).
31 */ 33 */
32void InterfaceInformationImp::updateInterface(Interface *i){ 34void InterfaceInformationImp::updateInterface(Interface *i){
@@ -61,10 +63,19 @@ void InterfaceInformationImp::advanced(){
61 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 63 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
62 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 64 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
63 a->dhcpInformation->setEnabled(interface->isDhcp()); 65 a->dhcpInformation->setEnabled(interface->isDhcp());
64 66
65 a->showMaximized(); 67 a->showMaximized();
66 a->show(); 68 a->show();
67} 69}
68 70
71/**
72 * Messages from the interface if start/stop went as planned.
73 * Purly for user feedback.
74 * @param message the message to display.
75 */
76void InterfaceInformationImp::showMessage(const QString &message){
77 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
78}
79
69// infoimp.cpp 80// infoimp.cpp
70 81
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
index 42213cc..65cdfe0 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
@@ -10,16 +10,17 @@ Q_OBJECT
10 10
11public: 11public:
12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0); 12 InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
13 ~InterfaceInformationImp(){}; 13 ~InterfaceInformationImp(){};
14 14
15private slots: 15private slots:
16 void advanced(); 16 void advanced();
17 void updateInterface(Interface *i); 17 void updateInterface(Interface *i);
18 void showMessage(const QString &message);
18 19
19private: 20private:
20 Interface *interface; 21 Interface *interface;
21 22
22}; 23};
23 24
24#endif 25#endif
25 26
diff --git a/noncore/settings/networksettings/interfaces/interfaces.pro b/noncore/settings/networksettings/interfaces/interfaces.pro
index 9a024f6..d6b43fb 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.pro
+++ b/noncore/settings/networksettings/interfaces/interfaces.pro
@@ -1,12 +1,12 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3 #CONFIG += qt warn_on debug 3 #CONFIG += qt warn_on debug
4 DESTDIR = $(QTDIR)/lib$(PROJMAK) 4 #DESTDIR = $(QTDIR)/lib$(PROJMAK)
5 HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h 5 HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h
6 SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp 6 SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include ../ 7 INCLUDEPATH+= $(OPIEDIR)/include ../
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui 10 INTERFACES= interfaceadvanced.ui interfaceinformation.ui interfacesetup.ui
11 TARGET = interfaces 11 TARGET = interfaces
12 VERSION = 1.0.0 12 VERSION = 1.0.0