author | zecke <zecke> | 2004-12-20 22:21:55 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-12-20 22:21:55 (UTC) |
commit | 2be4d5bf420dc4aff71cf78601c095a96ed88c47 (patch) (unidiff) | |
tree | f8d053d475501c2230a2c65acc1bed091d39faf9 /noncore/securityplugins/blueping | |
parent | b15930cd03acafd9770bca26f3388817f1a4dcbf (diff) | |
download | opie-2be4d5bf420dc4aff71cf78601c095a96ed88c47.zip opie-2be4d5bf420dc4aff71cf78601c095a96ed88c47.tar.gz opie-2be4d5bf420dc4aff71cf78601c095a96ed88c47.tar.bz2 |
Create the 'Config' instance on the Stack to avoid
that we revert changes done in between of our creation
and deletion
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 | |||
@@ -12,8 +12,8 @@ using Opie::Security::MultiauthConfigWidget; | |||
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); |
@@ -27,7 +27,7 @@ BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* name | |||
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 | ||
@@ -51,7 +51,9 @@ void BluepingConfigWidget::changeMAC() { | |||
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(); |
@@ -64,9 +66,7 @@ void BluepingConfigWidget::changeMAC() { | |||
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() |
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 | |||
@@ -50,7 +50,6 @@ public: | |||
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 | ||