Diffstat (limited to 'noncore/securityplugins/notice/noticeConfigWidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/securityplugins/notice/noticeConfigWidget.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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 | |||
@@ -65,19 +65,17 @@ void NoticeConfigWidget::resetNotice() | |||
65 | * if no text has been defined yet returns defaultNoticeText | 65 | * if no text has been defined yet returns defaultNoticeText |
66 | */ | 66 | */ |
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; |
74 | } | 73 | } |
75 | 74 | ||
76 | /// set the notice text in our m_config config file (escaping new lines) | 75 | /// set the notice text in our m_config config file (escaping new lines) |
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 | } |