author | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
commit | 9965bd5c49ff2f22d640d132ac343fdec97b3fb4 (patch) (unidiff) | |
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) (ignore 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 @@ | |||
1 | #include "interfaceinformationimp.h" | ||
2 | #include "interfaceadvanced.h" | ||
3 | |||
4 | #include <qpushbutton.h> | ||
5 | #include <qlabel.h> | ||
6 | #include <assert.h> | ||
7 | |||
8 | /** | ||
9 | * Constructor for the InterfaceInformationImp class. This class pretty much | ||
10 | * just display's information about the interface that is passed to it. | ||
11 | */ | ||
12 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ | ||
13 | assert(i); | ||
14 | |||
15 | interface = i; | ||
16 | updateInterface(); | ||
17 | connect(startButton, SIGNAL(clicked()), this, SLOT(start())); | ||
18 | connect(stopButton, SIGNAL(clicked()), this, SLOT(stop())); | ||
19 | connect(restartButton, SIGNAL(clicked()), this, SLOT(restart())); | ||
20 | connect(refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); | ||
21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | ||
22 | |||
23 | } | ||
24 | |||
25 | void InterfaceInformationImp::updateInterface(){ | ||
26 | if(interface->getStatus()){ | ||
27 | startButton->setEnabled(false); | ||
28 | stopButton->setEnabled(true); | ||
29 | restartButton->setEnabled(true); | ||
30 | } | ||
31 | else{ | ||
32 | startButton->setEnabled(true); | ||
33 | stopButton->setEnabled(false); | ||
34 | restartButton->setEnabled(false); | ||
35 | } | ||
36 | macAddressLabel->setText(interface->getMacAddress()); | ||
37 | ipAddressLabel->setText(interface->getIp()); | ||
38 | subnetMaskLabel->setText(interface->getSubnetMask()); | ||
39 | broadcastLabel->setText(interface->getBroadcast()); | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * Start the interface. Update the information if successfull | ||
44 | */ | ||
45 | void InterfaceInformationImp::start(){ | ||
46 | if(interface->start()){ | ||
47 | updateInterface(); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * Stop the interface. | ||
53 | */ | ||
54 | void InterfaceInformationImp::stop(){ | ||
55 | if(interface->stop()){ | ||
56 | updateInterface(); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | /*** | ||
61 | * Tell the interface to refresh its information. | ||
62 | **/ | ||
63 | void InterfaceInformationImp::refresh(){ | ||
64 | if(interface->refresh()) | ||
65 | updateInterface(); | ||
66 | } | ||
67 | |||
68 | void InterfaceInformationImp::restart(){ | ||
69 | if(interface->restart()){ | ||
70 | updateInterface(); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Create the advanced widget. Fill it with the current interface's information. | ||
77 | * Display it. | ||
78 | */ | ||
79 | void InterfaceInformationImp::advanced(){ | ||
80 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); | ||
81 | a->interfaceName->setText(interface->getInterfaceName()); | ||
82 | a->macAddressLabel->setText(interface->getMacAddress()); | ||
83 | a->ipAddressLabel->setText(interface->getIp()); | ||
84 | a->subnetMaskLabel->setText(interface->getSubnetMask()); | ||
85 | a->broadcastLabel->setText(interface->getBroadcast()); | ||
86 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); | ||
87 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); | ||
88 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); | ||
89 | a->showMaximized(); | ||
90 | a->show(); | ||
91 | } | ||
92 | |||
93 | // infoimp.cpp | ||
94 | |||