author | benmeyer <benmeyer> | 2002-11-04 15:17:58 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-11-04 15:17:58 (UTC) |
commit | 17a29825dcf56cb0e224848e71e24ee6a884890b (patch) (side-by-side diff) | |
tree | 91a7f024de51081800a13312dd1b16822d86c188 | |
parent | a5f1f8a58a5a654503d72042b12f36ab30216a16 (diff) | |
download | opie-17a29825dcf56cb0e224848e71e24ee6a884890b.zip opie-17a29825dcf56cb0e224848e71e24ee6a884890b.tar.gz opie-17a29825dcf56cb0e224848e71e24ee6a884890b.tar.bz2 |
Fix bug and gives more user feedback now
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 @@ -65,12 +65,17 @@ void Interface::start(){ // check to see if we are already running. - if(true == status) + if(true == status){ + emit (updateMessage("Unable to start interface,\n already started")); return; - + } + int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); // See if it was successfull... - if(ret != 0) + if(ret != 0){ + emit (updateMessage("Starting interface failed.")); return; - + } + status = true; refresh(); + emit (updateMessage("Start successfull")); } @@ -82,11 +87,16 @@ void Interface::stop(){ // check to see if we are already stopped. - if(false == status) + if(false == status){ + emit (updateMessage("Unable to stop interface,\n already stopped")); return; + } int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); - if(ret != 0) + if(ret != 0){ + emit (updateMessage("Stopping interface failed.")); return; + } - status = true; + status = false; refresh(); + emit (updateMessage("Stop successfull")); } 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 @@ -13,3 +13,4 @@ signals: void updateInterface(Interface *i); - + void updateMessage(const QString &message); + public: 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 @@ -6,2 +6,4 @@ #include <qgroupbox.h> +#include <qmessagebox.h> + #include <assert.h> @@ -17,2 +19,3 @@ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *na connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); + connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); updateInterface(interface); @@ -23,3 +26,2 @@ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *na connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); - } @@ -68,2 +70,11 @@ void InterfaceInformationImp::advanced(){ +/** + * Messages from the interface if start/stop went as planned. + * Purly for user feedback. + * @param message the message to display. + */ +void InterfaceInformationImp::showMessage(const QString &message){ + QMessageBox::information(this, "Message", message, QMessageBox::Ok); +} + // infoimp.cpp 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 @@ -17,2 +17,3 @@ private slots: void updateInterface(Interface *i); + void showMessage(const QString &message); 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 @@ -3,3 +3,3 @@ CONFIG += qt warn_on release #CONFIG += qt warn_on debug -DESTDIR = $(QTDIR)/lib$(PROJMAK) +#DESTDIR = $(QTDIR)/lib$(PROJMAK) HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h 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 @@ -65,12 +65,17 @@ void Interface::start(){ // check to see if we are already running. - if(true == status) + if(true == status){ + emit (updateMessage("Unable to start interface,\n already started")); return; - + } + int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); // See if it was successfull... - if(ret != 0) + if(ret != 0){ + emit (updateMessage("Starting interface failed.")); return; - + } + status = true; refresh(); + emit (updateMessage("Start successfull")); } @@ -82,11 +87,16 @@ void Interface::stop(){ // check to see if we are already stopped. - if(false == status) + if(false == status){ + emit (updateMessage("Unable to stop interface,\n already stopped")); return; + } int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); - if(ret != 0) + if(ret != 0){ + emit (updateMessage("Stopping interface failed.")); return; + } - status = true; + status = false; refresh(); + emit (updateMessage("Stop successfull")); } 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 @@ -13,3 +13,4 @@ signals: void updateInterface(Interface *i); - + void updateMessage(const QString &message); + public: 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 @@ -6,2 +6,4 @@ #include <qgroupbox.h> +#include <qmessagebox.h> + #include <assert.h> @@ -17,2 +19,3 @@ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *na connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); + connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); updateInterface(interface); @@ -23,3 +26,2 @@ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *na connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); - } @@ -68,2 +70,11 @@ void InterfaceInformationImp::advanced(){ +/** + * Messages from the interface if start/stop went as planned. + * Purly for user feedback. + * @param message the message to display. + */ +void InterfaceInformationImp::showMessage(const QString &message){ + QMessageBox::information(this, "Message", message, QMessageBox::Ok); +} + // infoimp.cpp 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 @@ -17,2 +17,3 @@ private slots: void updateInterface(Interface *i); + void showMessage(const QString &message); 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 @@ -3,3 +3,3 @@ CONFIG += qt warn_on release #CONFIG += qt warn_on debug -DESTDIR = $(QTDIR)/lib$(PROJMAK) +#DESTDIR = $(QTDIR)/lib$(PROJMAK) HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h |