Diffstat (limited to 'noncore/settings/networksettings/interfaceinformationimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaceinformationimp.cpp | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/noncore/settings/networksettings/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaceinformationimp.cpp index e37e0f8..59a6400 100644 --- a/noncore/settings/networksettings/interfaceinformationimp.cpp +++ b/noncore/settings/networksettings/interfaceinformationimp.cpp @@ -10,22 +10,28 @@ * just display's information about the interface that is passed to it. */ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ assert(i); interface = i; - updateInterface(); - connect(startButton, SIGNAL(clicked()), this, SLOT(start())); - connect(stopButton, SIGNAL(clicked()), this, SLOT(stop())); - connect(restartButton, SIGNAL(clicked()), this, SLOT(restart())); - connect(refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); + connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); + updateInterface(interface); + connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); + connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); + connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); + connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); } -void InterfaceInformationImp::updateInterface(){ +/** + * Update the interface information and buttons. + * @param Intarface *i the interface to update (should be the one we already + * know about). + */ +void InterfaceInformationImp::updateInterface(Interface *i){ if(interface->getStatus()){ startButton->setEnabled(false); stopButton->setEnabled(true); restartButton->setEnabled(true); } else{ @@ -37,45 +43,12 @@ void InterfaceInformationImp::updateInterface(){ ipAddressLabel->setText(interface->getIp()); subnetMaskLabel->setText(interface->getSubnetMask()); broadcastLabel->setText(interface->getBroadcast()); } /** - * Start the interface. Update the information if successfull - */ -void InterfaceInformationImp::start(){ - if(interface->start()){ - updateInterface(); - } -} - -/** - * Stop the interface. - */ -void InterfaceInformationImp::stop(){ - if(interface->stop()){ - updateInterface(); - } -} - -/*** - * Tell the interface to refresh its information. - **/ -void InterfaceInformationImp::refresh(){ - if(interface->refresh()) - updateInterface(); -} - -void InterfaceInformationImp::restart(){ - if(interface->restart()){ - updateInterface(); - } -} - - -/** * Create the advanced widget. Fill it with the current interface's information. * Display it. */ void InterfaceInformationImp::advanced(){ InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); a->interfaceName->setText(interface->getInterfaceName()); |