Diffstat (limited to 'noncore/securityplugins/notice/noticeConfigWidget.cpp') (more/less context) (ignore 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 @@ -62,22 +62,20 @@ void NoticeConfigWidget::resetNotice() /// get the notice text from the config file (with true new lines) /** * if no text has been defined yet returns defaultNoticeText */ QString NoticeConfigWidget::getNoticeText() { - m_config = new Config("Security"); - m_config->setGroup("NoticePlugin"); + Config config("Security"); + config.setGroup("NoticePlugin"); // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp - QString noticeText = m_config->readEntry("noticeText", QObject::tr(defaultNoticeText) ).replace( QRegExp("\\\\n"), "\n" ); - delete m_config; + QString noticeText = config.readEntry("noticeText", QObject::tr(defaultNoticeText) ).replace( QRegExp("\\\\n"), "\n" ); return noticeText; } /// set the notice text in our m_config config file (escaping new lines) void NoticeConfigWidget::setNoticeText(QString noticeText) { - m_config = new Config("Security"); - m_config->setGroup("NoticePlugin"); + Config config("Security"); + config.setGroup("NoticePlugin"); // since Config files do not allow true newlines, we replace them with litteral "\n" - m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); - delete m_config; + config.writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); } |