summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index e00dcce..37c3a91 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,79 +1,93 @@
1#include "interfaceinformationimp.h" 1#include "interfaceinformationimp.h"
2#include "interfaceadvanced.h" 2#include "interfaceadvanced.h"
3 3
4#include <qcheckbox.h>
4#include <qpushbutton.h> 5#include <qpushbutton.h>
5#include <qlabel.h> 6#include <qlabel.h>
6#include <qgroupbox.h> 7#include <qgroupbox.h>
7#include <qmessagebox.h> 8#include <qmessagebox.h>
8 9
9#ifdef QWS 10#include <qpe/config.h>
11
12#ifdef QWS
10#else 13#else
11 #define showMaximized show 14 #define showMaximized show
12#endif 15#endif
13 16
14/** 17/**
15 * Constructor for the InterfaceInformationImp class. This class pretty much 18 * Constructor for the InterfaceInformationImp class. This class pretty much
16 * just display's information about the interface that is passed to it. 19 * just display's information about the interface that is passed to it.
17 */ 20 */
18InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ 21InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){
19 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 22 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
20 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); 23 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
21 updateInterface(interface); 24 updateInterface(interface);
22 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 25 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
23 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 26 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
24 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 27 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
25 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 28 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
26 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 29 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
30 Config cfg("networksettings", Config::User);
31 cfg.setGroup("interface");
32 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
33}
34
35InterfaceInformationImp::~InterfaceInformationImp()
36{
37 Config cfg("networksettings", Config::User);
38 cfg.setGroup("interface");
39 cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
27} 40}
28 41
29/** 42/**
30 * Update the interface information and buttons. 43 * Update the interface information and buttons.
31 * @param Intarface *i the interface to update (should be the one we already 44 * @param Intarface *i the interface to update (should be the one we already
32 * know about). 45 * know about).
33 */ 46 */
34void InterfaceInformationImp::updateInterface(Interface *){ 47void InterfaceInformationImp::updateInterface(Interface *){
35 if(interface->getStatus()){ 48 if(interface->getStatus()){
36 startButton->setEnabled(false); 49 startButton->setEnabled(false);
37 stopButton->setEnabled(true); 50 stopButton->setEnabled(true);
38 restartButton->setEnabled(true); 51 restartButton->setEnabled(true);
39 } 52 }
40 else{ 53 else{
41 startButton->setEnabled(true); 54 startButton->setEnabled(true);
42 stopButton->setEnabled(false); 55 stopButton->setEnabled(false);
43 restartButton->setEnabled(false); 56 restartButton->setEnabled(false);
44 } 57 }
45 macAddressLabel->setText(interface->getMacAddress()); 58 macAddressLabel->setText(interface->getMacAddress());
46 ipAddressLabel->setText(interface->getIp()); 59 ipAddressLabel->setText(interface->getIp());
47 subnetMaskLabel->setText(interface->getSubnetMask()); 60 subnetMaskLabel->setText(interface->getSubnetMask());
48 broadcastLabel->setText(interface->getBroadcast()); 61 broadcastLabel->setText(interface->getBroadcast());
49} 62}
50 63
51/** 64/**
52 * Create the advanced widget. Fill it with the current interface's information. 65 * Create the advanced widget. Fill it with the current interface's information.
53 * Display it. 66 * Display it.
54 */ 67 */
55void InterfaceInformationImp::advanced(){ 68void InterfaceInformationImp::advanced(){
56 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 69 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
57 a->interfaceName->setText(interface->getInterfaceName()); 70 a->interfaceName->setText(interface->getInterfaceName());
58 a->macAddressLabel->setText(interface->getMacAddress()); 71 a->macAddressLabel->setText(interface->getMacAddress());
59 a->ipAddressLabel->setText(interface->getIp()); 72 a->ipAddressLabel->setText(interface->getIp());
60 a->subnetMaskLabel->setText(interface->getSubnetMask()); 73 a->subnetMaskLabel->setText(interface->getSubnetMask());
61 a->broadcastLabel->setText(interface->getBroadcast()); 74 a->broadcastLabel->setText(interface->getBroadcast());
62 a->dhcpServerLabel->setText(interface->getDhcpServerIp()); 75 a->dhcpServerLabel->setText(interface->getDhcpServerIp());
63 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 76 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
64 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 77 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
65 a->dhcpInformation->setEnabled(interface->isDhcp()); 78 a->dhcpInformation->setEnabled(interface->isDhcp());
66 a->showMaximized(); 79 a->showMaximized();
67} 80}
68 81
69/** 82/**
70 * Messages from the interface if start/stop went as planned. 83 * Messages from the interface if start/stop went as planned.
71 * Purly for user feedback. 84 * Purly for user feedback.
72 * @param message the message to display. 85 * @param message the message to display.
73 */ 86 */
74void InterfaceInformationImp::showMessage(const QString &message){ 87void InterfaceInformationImp::showMessage(const QString &message){
88 if (CheckBoxSilent->isChecked()) return;
75 QMessageBox::information(this, "Message", message, QMessageBox::Ok); 89 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
76} 90}
77 91
78// infoimp.cpp 92// infoimp.cpp
79 93