Networksettings API API Documentation

interfaceinformationimp.cpp

00001 #include "interfaceinformationimp.h"
00002 #include "interfaceadvanced.h"
00003 
00004 #include <qcheckbox.h>
00005 #include <qpushbutton.h>
00006 #include <qlabel.h>
00007 #include <qgroupbox.h>
00008 #include <qmessagebox.h>
00009 
00010 #include <qpe/config.h>
00011 
00012 #ifdef QWS
00013 #else
00014  #define showMaximized show
00015 #endif
00016 
00021 InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){
00022   connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
00023   connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
00024   updateInterface(interface);
00025   connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
00026   connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
00027   connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
00028   connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
00029   connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
00030   Config cfg("networksettings", Config::User);
00031   cfg.setGroup("interface");
00032   CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
00033 }
00034 
00035 InterfaceInformationImp::~InterfaceInformationImp()
00036 {
00037     Config cfg("networksettings", Config::User);
00038     cfg.setGroup("interface");
00039     cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
00040 }
00041 
00047 void InterfaceInformationImp::updateInterface(Interface *){
00048   if(interface->getStatus()){
00049     startButton->setEnabled(false);
00050     stopButton->setEnabled(true);
00051     restartButton->setEnabled(true);
00052   }
00053   else{
00054     startButton->setEnabled(true);
00055     stopButton->setEnabled(false);
00056     restartButton->setEnabled(false);
00057   }
00058   macAddressLabel->setText(interface->getMacAddress());
00059   ipAddressLabel->setText(interface->getIp());
00060   subnetMaskLabel->setText(interface->getSubnetMask());
00061   broadcastLabel->setText(interface->getBroadcast());
00062 }
00063 
00068 void InterfaceInformationImp::advanced(){
00069   InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
00070   a->interfaceName->setText(interface->getInterfaceName());
00071   a->macAddressLabel->setText(interface->getMacAddress());
00072   a->ipAddressLabel->setText(interface->getIp());
00073   a->subnetMaskLabel->setText(interface->getSubnetMask());
00074   a->broadcastLabel->setText(interface->getBroadcast());
00075   a->dhcpServerLabel->setText(interface->getDhcpServerIp());
00076   a->leaseObtainedLabel->setText(interface->getLeaseObtained());
00077   a->leaseExpiresLabel->setText(interface->getLeaseExpires());
00078   a->dhcpInformation->setEnabled(interface->isDhcp());
00079   a->showMaximized();
00080 }
00081 
00087 void InterfaceInformationImp::showMessage(const QString &message){
00088   if (CheckBoxSilent->isChecked()) return;
00089   QMessageBox::information(this, "Message", message, QMessageBox::Ok);
00090 }
00091 
00092 // infoimp.cpp
00093 
KDE Logo
This file is part of the documentation for OPIE Version 1.0.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:26:44 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001