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 | |
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
5 files changed, 16 insertions, 22 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 | |||
@@ -14,4 +14,4 @@ BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* 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); |
@@ -29,3 +29,3 @@ BluepingConfigWidget::BluepingConfigWidget(QWidget* parent = 0, const char* name | |||
29 | 29 | ||
30 | QString mac = m_config->readEntry("mac"); | 30 | QString mac = config.readEntry("mac"); |
31 | if ( mac.isEmpty() ) | 31 | if ( mac.isEmpty() ) |
@@ -53,3 +53,5 @@ void BluepingConfigWidget::changeMAC() { | |||
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>", |
@@ -66,5 +68,3 @@ void BluepingConfigWidget::changeMAC() { | |||
66 | BluepingConfigWidget::~BluepingConfigWidget() | 68 | BluepingConfigWidget::~BluepingConfigWidget() |
67 | { | 69 | {} |
68 | delete m_config; | ||
69 | } | ||
70 | 70 | ||
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 | |||
@@ -52,3 +52,2 @@ private: | |||
52 | QPushButton *setMAC; | 52 | QPushButton *setMAC; |
53 | Config *m_config; | ||
54 | private slots: | 53 | private slots: |
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.cpp b/noncore/securityplugins/notice/noticeConfigWidget.cpp index e0468a7..02084f8 100644 --- a/noncore/securityplugins/notice/noticeConfigWidget.cpp +++ b/noncore/securityplugins/notice/noticeConfigWidget.cpp | |||
@@ -67,7 +67,6 @@ void NoticeConfigWidget::resetNotice() | |||
67 | QString NoticeConfigWidget::getNoticeText() { | 67 | QString NoticeConfigWidget::getNoticeText() { |
68 | m_config = new Config("Security"); | 68 | Config config("Security"); |
69 | m_config->setGroup("NoticePlugin"); | 69 | config.setGroup("NoticePlugin"); |
70 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp | 70 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp |
71 | QString noticeText = m_config->readEntry("noticeText", QObject::tr(defaultNoticeText) ).replace( QRegExp("\\\\n"), "\n" ); | 71 | QString noticeText = config.readEntry("noticeText", QObject::tr(defaultNoticeText) ).replace( QRegExp("\\\\n"), "\n" ); |
72 | delete m_config; | ||
73 | return noticeText; | 72 | return noticeText; |
@@ -77,7 +76,6 @@ QString NoticeConfigWidget::getNoticeText() { | |||
77 | void NoticeConfigWidget::setNoticeText(QString noticeText) { | 76 | void NoticeConfigWidget::setNoticeText(QString noticeText) { |
78 | m_config = new Config("Security"); | 77 | Config config("Security"); |
79 | m_config->setGroup("NoticePlugin"); | 78 | config.setGroup("NoticePlugin"); |
80 | // since Config files do not allow true newlines, we replace them with litteral "\n" | 79 | // since Config files do not allow true newlines, we replace them with litteral "\n" |
81 | m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); | 80 | config.writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); |
82 | delete m_config; | ||
83 | } | 81 | } |
diff --git a/noncore/securityplugins/notice/noticeplugin.cpp b/noncore/securityplugins/notice/noticeplugin.cpp index 5617855..d3dc7a4 100644 --- a/noncore/securityplugins/notice/noticeplugin.cpp +++ b/noncore/securityplugins/notice/noticeplugin.cpp | |||
@@ -12,4 +12,2 @@ using Opie::Security::MultiauthConfigWidget; | |||
12 | NoticePlugin::NoticePlugin() : MultiauthPluginObject(), m_noticeW(0) { | 12 | NoticePlugin::NoticePlugin() : MultiauthPluginObject(), m_noticeW(0) { |
13 | m_config = new Config("Security"); | ||
14 | m_config->setGroup("NoticePlugin"); | ||
15 | } | 13 | } |
@@ -18,4 +16,2 @@ NoticePlugin::NoticePlugin() : MultiauthPluginObject(), m_noticeW(0) { | |||
18 | NoticePlugin::~NoticePlugin() { | 16 | NoticePlugin::~NoticePlugin() { |
19 | delete m_config; | ||
20 | if (m_noticeW != 0) | ||
21 | delete m_noticeW; | 17 | delete m_noticeW; |
@@ -83,3 +79,5 @@ QString NoticePlugin::getNoticeText() { | |||
83 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp | 79 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp |
84 | return m_config->readEntry("noticeText", QObject::tr(defaultNoticeText)).replace( QRegExp("\\\\n"), "\n" ); | 80 | Config config("Security"); |
81 | config.setGroup("NoticePlugin"); | ||
82 | return config.readEntry("noticeText", QObject::tr(defaultNoticeText)).replace( QRegExp("\\\\n"), "\n" ); | ||
85 | } | 83 | } |
diff --git a/noncore/securityplugins/notice/noticeplugin.h b/noncore/securityplugins/notice/noticeplugin.h index 2828f58..22b2322 100644 --- a/noncore/securityplugins/notice/noticeplugin.h +++ b/noncore/securityplugins/notice/noticeplugin.h | |||
@@ -59,3 +59,2 @@ private: | |||
59 | NoticeConfigWidget * m_noticeW; | 59 | NoticeConfigWidget * m_noticeW; |
60 | Config * m_config; | ||
61 | QString getNoticeText(); | 60 | QString getNoticeText(); |