Diffstat (limited to 'noncore/settings/networksettings/interfaces/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/interface.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
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 | |||
@@ -54,50 +54,60 @@ void Interface::setHardwareName(QString name){ | |||
54 | */ | 54 | */ |
55 | void Interface::setModuleOwner(Module *owner){ | 55 | void Interface::setModuleOwner(Module *owner){ |
56 | moduleOwner = owner; | 56 | moduleOwner = owner; |
57 | emit(updateInterface(this)); | 57 | emit(updateInterface(this)); |
58 | }; | 58 | }; |
59 | 59 | ||
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Try to start the interface. | 62 | * Try to start the interface. |
63 | */ | 63 | */ |
64 | void Interface::start(){ | 64 | void 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 | */ |
81 | void Interface::stop(){ | 86 | void 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 | */ |
97 | void Interface::restart(){ | 107 | void Interface::restart(){ |
98 | stop(); | 108 | stop(); |
99 | start(); | 109 | start(); |
100 | } | 110 | } |
101 | 111 | ||
102 | /** | 112 | /** |
103 | * Try to refresh the information about the interface. | 113 | * Try to refresh the information about the interface. |