author | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
commit | 9965bd5c49ff2f22d640d132ac343fdec97b3fb4 (patch) (side-by-side diff) | |
tree | 45e8f1d1bf414530b637692ba43b730110611856 /noncore/net/networksetup/interfaceinformationimp.cpp | |
parent | 5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (diff) | |
download | opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.zip opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.tar.gz opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.tar.bz2 |
Initial commit
Diffstat (limited to 'noncore/net/networksetup/interfaceinformationimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/networksetup/interfaceinformationimp.cpp | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/noncore/net/networksetup/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaceinformationimp.cpp new file mode 100644 index 0000000..e37e0f8 --- a/dev/null +++ b/noncore/net/networksetup/interfaceinformationimp.cpp @@ -0,0 +1,94 @@ +#include "interfaceinformationimp.h" +#include "interfaceadvanced.h" + +#include <qpushbutton.h> +#include <qlabel.h> +#include <assert.h> + +/** + * Constructor for the InterfaceInformationImp class. This class pretty much + * 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(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); + +} + +void InterfaceInformationImp::updateInterface(){ + if(interface->getStatus()){ + startButton->setEnabled(false); + stopButton->setEnabled(true); + restartButton->setEnabled(true); + } + else{ + startButton->setEnabled(true); + stopButton->setEnabled(false); + restartButton->setEnabled(false); + } + macAddressLabel->setText(interface->getMacAddress()); + 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()); + a->macAddressLabel->setText(interface->getMacAddress()); + a->ipAddressLabel->setText(interface->getIp()); + a->subnetMaskLabel->setText(interface->getSubnetMask()); + a->broadcastLabel->setText(interface->getBroadcast()); + a->dhcpServerLabel->setText(interface->getDhcpServerIp()); + a->leaseObtainedLabel->setText(interface->getLeaseObtained()); + a->leaseExpiresLabel->setText(interface->getLeaseExpires()); + a->showMaximized(); + a->show(); +} + +// infoimp.cpp + |