Diffstat (limited to 'noncore/securityplugins/blueping') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/securityplugins/blueping/bluepingConfigWidget.cpp | 14 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingConfigWidget.h | 1 |
2 files changed, 7 insertions, 8 deletions
diff --git a/noncore/securityplugins/blueping/bluepingConfigWidget.cpp b/noncore/securityplugins/blueping/bluepingConfigWidget.cpp index 876ccda..17168f9 100644 --- a/noncore/securityplugins/blueping/bluepingConfigWidget.cpp +++ b/noncore/securityplugins/blueping/bluepingConfigWidget.cpp | |||
@@ -9,14 +9,14 @@ | |||
9 | 9 | ||
10 | using Opie::Security::MultiauthConfigWidget; | 10 | using Opie::Security::MultiauthConfigWidget; |
11 | 11 | ||
12 | BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* name = "Blueping configuration widget") | 12 | BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* name = "Blueping configuration widget") |
13 | : MultiauthConfigWidget(parent, name) | 13 | : MultiauthConfigWidget(parent, name) |
14 | { | 14 | { |
15 | m_config = new Config("Security"); | 15 | Config config("Security"); |
16 | m_config->setGroup("BluepingPlugin"); | 16 | config.setGroup("BluepingPlugin"); |
17 | QVBoxLayout * baseLayout = new QVBoxLayout( this); | 17 | QVBoxLayout * baseLayout = new QVBoxLayout( this); |
18 | baseLayout->setSpacing(11); | 18 | baseLayout->setSpacing(11); |
19 | baseLayout->setMargin(11); | 19 | baseLayout->setMargin(11); |
20 | baseLayout->setAlignment( Qt::AlignTop ); | 20 | baseLayout->setAlignment( Qt::AlignTop ); |
21 | 21 | ||
22 | QGroupBox * configBox = new QGroupBox(0, Qt::Vertical, tr("Set the MAC address to ping here"), this); | 22 | QGroupBox * configBox = new QGroupBox(0, Qt::Vertical, tr("Set the MAC address to ping here"), this); |
@@ -24,13 +24,13 @@ BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* name | |||
24 | QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); | 24 | QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); |
25 | 25 | ||
26 | QHBoxLayout * configLayout = new QHBoxLayout(); | 26 | QHBoxLayout * configLayout = new QHBoxLayout(); |
27 | configLayout->setSpacing(6); | 27 | configLayout->setSpacing(6); |
28 | boxLayout->addLayout(configLayout); | 28 | boxLayout->addLayout(configLayout); |
29 | 29 | ||
30 | QString mac = m_config->readEntry("mac"); | 30 | QString mac = config.readEntry("mac"); |
31 | if ( mac.isEmpty() ) | 31 | if ( mac.isEmpty() ) |
32 | mac = "00:00:00:00:00:00"; | 32 | mac = "00:00:00:00:00:00"; |
33 | 33 | ||
34 | editMAC = new QLineEdit( mac, configBox, "editMAC" ); | 34 | editMAC = new QLineEdit( mac, configBox, "editMAC" ); |
35 | setMAC = new QPushButton( tr("Set"), configBox, "setMAC" ); | 35 | setMAC = new QPushButton( tr("Set"), configBox, "setMAC" ); |
36 | configLayout->addWidget(editMAC); | 36 | configLayout->addWidget(editMAC); |
@@ -48,27 +48,27 @@ BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* name | |||
48 | /// checks and writes the MAC in the config file, if its format is OK | 48 | /// checks and writes the MAC in the config file, if its format is OK |
49 | void BluepingConfigWidget::changeMAC() { | 49 | void BluepingConfigWidget::changeMAC() { |
50 | QString mac = editMAC->text(); | 50 | QString mac = editMAC->text(); |
51 | QRegExp macPattern("[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]"); | 51 | QRegExp macPattern("[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]"); |
52 | if ( (mac.length() == 17) && (macPattern.match(mac) == 0) ) | 52 | if ( (mac.length() == 17) && (macPattern.match(mac) == 0) ) |
53 | { | 53 | { |
54 | m_config->writeEntry("mac", mac); | 54 | Config config("Security"); |
55 | config.setGroup("BluepingPlugin"); | ||
56 | config.writeEntry("mac", mac); | ||
55 | QMessageBox success( tr("MAC address saved!"), "<p>" + tr("Make sure that Bluetooth is turned on on the corresponding device when the Blueping plugin needs it.") + "</p>", | 57 | QMessageBox success( tr("MAC address saved!"), "<p>" + tr("Make sure that Bluetooth is turned on on the corresponding device when the Blueping plugin needs it.") + "</p>", |
56 | QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); | 58 | QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); |
57 | success.exec(); | 59 | success.exec(); |
58 | } else { | 60 | } else { |
59 | QMessageBox failure( tr("Please enter a valid MAC"), "<p>" + tr("Please separate the six pairs of digits of your MAC like this: 01:02:03:04:05:06") + tr("</p>"), | 61 | QMessageBox failure( tr("Please enter a valid MAC"), "<p>" + tr("Please separate the six pairs of digits of your MAC like this: 01:02:03:04:05:06") + tr("</p>"), |
60 | QMessageBox::Warning, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); | 62 | QMessageBox::Warning, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); |
61 | failure.exec(); | 63 | failure.exec(); |
62 | } | 64 | } |
63 | } | 65 | } |
64 | 66 | ||
65 | /// deletes the m_config pointer | 67 | /// deletes the m_config pointer |
66 | BluepingConfigWidget::~BluepingConfigWidget() | 68 | BluepingConfigWidget::~BluepingConfigWidget() |
67 | { | 69 | {} |
68 | delete m_config; | ||
69 | } | ||
70 | 70 | ||
71 | // does nothing (there's a button to save the config) | 71 | // does nothing (there's a button to save the config) |
72 | void BluepingConfigWidget::writeConfig() | 72 | void BluepingConfigWidget::writeConfig() |
73 | { | 73 | { |
74 | } | 74 | } |
diff --git a/noncore/securityplugins/blueping/bluepingConfigWidget.h b/noncore/securityplugins/blueping/bluepingConfigWidget.h index bd1bec9..643c97f 100644 --- a/noncore/securityplugins/blueping/bluepingConfigWidget.h +++ b/noncore/securityplugins/blueping/bluepingConfigWidget.h | |||
@@ -47,13 +47,12 @@ public: | |||
47 | BluepingConfigWidget(QWidget* parent, const char* name); | 47 | BluepingConfigWidget(QWidget* parent, const char* name); |
48 | virtual ~BluepingConfigWidget(); | 48 | virtual ~BluepingConfigWidget(); |
49 | virtual void writeConfig(); | 49 | virtual void writeConfig(); |
50 | private: | 50 | private: |
51 | QLineEdit *editMAC; | 51 | QLineEdit *editMAC; |
52 | QPushButton *setMAC; | 52 | QPushButton *setMAC; |
53 | Config *m_config; | ||
54 | private slots: | 53 | private slots: |
55 | void changeMAC(); | 54 | void changeMAC(); |
56 | 55 | ||
57 | }; | 56 | }; |
58 | 57 | ||
59 | #endif // BLUEPINGCONFIGWIDGET_H | 58 | #endif // BLUEPINGCONFIGWIDGET_H |