Diffstat (limited to 'noncore/net/networksetup/interfaces/interfaceinformationimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/networksetup/interfaces/interfaceinformationimp.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp index 43483fb..39575c4 100644 --- a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp +++ b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp | |||
@@ -1,36 +1,38 @@ | |||
1 | #include "interfaceinformationimp.h" | 1 | #include "interfaceinformationimp.h" |
2 | #include "interfaceadvanced.h" | 2 | #include "interfaceadvanced.h" |
3 | 3 | ||
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qmessagebox.h> | ||
8 | |||
7 | #include <assert.h> | 9 | #include <assert.h> |
8 | 10 | ||
9 | /** | 11 | /** |
10 | * Constructor for the InterfaceInformationImp class. This class pretty much | 12 | * Constructor for the InterfaceInformationImp class. This class pretty much |
11 | * just display's information about the interface that is passed to it. | 13 | * just display's information about the interface that is passed to it. |
12 | */ | 14 | */ |
13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ | 15 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ |
14 | assert(i); | 16 | assert(i); |
15 | 17 | ||
16 | interface = i; | 18 | interface = i; |
17 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 19 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
20 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); | ||
18 | updateInterface(interface); | 21 | updateInterface(interface); |
19 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); | 22 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); |
20 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); | 23 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); |
21 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); | 24 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); |
22 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); | 25 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); |
23 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | 26 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); |
24 | |||
25 | } | 27 | } |
26 | 28 | ||
27 | /** | 29 | /** |
28 | * Update the interface information and buttons. | 30 | * Update the interface information and buttons. |
29 | * @param Intarface *i the interface to update (should be the one we already | 31 | * @param Intarface *i the interface to update (should be the one we already |
30 | * know about). | 32 | * know about). |
31 | */ | 33 | */ |
32 | void InterfaceInformationImp::updateInterface(Interface *i){ | 34 | void InterfaceInformationImp::updateInterface(Interface *i){ |
33 | if(interface->getStatus()){ | 35 | if(interface->getStatus()){ |
34 | startButton->setEnabled(false); | 36 | startButton->setEnabled(false); |
35 | stopButton->setEnabled(true); | 37 | stopButton->setEnabled(true); |
36 | restartButton->setEnabled(true); | 38 | restartButton->setEnabled(true); |
@@ -57,14 +59,23 @@ void InterfaceInformationImp::advanced(){ | |||
57 | a->ipAddressLabel->setText(interface->getIp()); | 59 | a->ipAddressLabel->setText(interface->getIp()); |
58 | a->subnetMaskLabel->setText(interface->getSubnetMask()); | 60 | a->subnetMaskLabel->setText(interface->getSubnetMask()); |
59 | a->broadcastLabel->setText(interface->getBroadcast()); | 61 | a->broadcastLabel->setText(interface->getBroadcast()); |
60 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); | 62 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); |
61 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); | 63 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); |
62 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); | 64 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); |
63 | a->dhcpInformation->setEnabled(interface->isDhcp()); | 65 | a->dhcpInformation->setEnabled(interface->isDhcp()); |
64 | 66 | ||
65 | a->showMaximized(); | 67 | a->showMaximized(); |
66 | a->show(); | 68 | a->show(); |
67 | } | 69 | } |
68 | 70 | ||
71 | /** | ||
72 | * Messages from the interface if start/stop went as planned. | ||
73 | * Purly for user feedback. | ||
74 | * @param message the message to display. | ||
75 | */ | ||
76 | void InterfaceInformationImp::showMessage(const QString &message){ | ||
77 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); | ||
78 | } | ||
79 | |||
69 | // infoimp.cpp | 80 | // infoimp.cpp |
70 | 81 | ||