Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp | 97 |
1 files changed, 54 insertions, 43 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp index 37c3a91..698dfd3 100644 --- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp @@ -1 +1,2 @@ + #include "interfaceinformationimp.h" @@ -3,2 +4,7 @@ +/* OPIE */ +#include <qpe/config.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qcheckbox.h> @@ -9,3 +15,2 @@ -#include <qpe/config.h> @@ -20,14 +25,15 @@ */ -InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ - connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); - connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); - 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())); - Config cfg("networksettings", Config::User); - cfg.setGroup("interface"); - CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) ); +InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i) +{ + connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); + connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); + 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())); + Config cfg("networksettings", Config::User); + cfg.setGroup("interface"); + CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) ); } @@ -46,17 +52,20 @@ InterfaceInformationImp::~InterfaceInformationImp() */ -void InterfaceInformationImp::updateInterface(Interface *){ - 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()); +void InterfaceInformationImp::updateInterface(Interface *) +{ + 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()); } @@ -67,14 +76,15 @@ void InterfaceInformationImp::updateInterface(Interface *){ */ -void InterfaceInformationImp::advanced(){ - InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); - 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->dhcpInformation->setEnabled(interface->isDhcp()); - a->showMaximized(); +void InterfaceInformationImp::advanced() +{ + InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); + 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->dhcpInformation->setEnabled(interface->isDhcp()); + QPEApplication::showWidget( a ); } @@ -86,5 +96,6 @@ void InterfaceInformationImp::advanced(){ */ -void InterfaceInformationImp::showMessage(const QString &message){ - if (CheckBoxSilent->isChecked()) return; - QMessageBox::information(this, "Message", message, QMessageBox::Ok); +void InterfaceInformationImp::showMessage(const QString &message) +{ + if (CheckBoxSilent->isChecked()) return; + QMessageBox::information(this, "Message", message, QMessageBox::Ok); } |