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