summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <[email protected]>2017-11-16 18:28:36 -0500
committerAllen Winter <[email protected]>2017-11-16 18:28:36 -0500
commitf64b13e05d86dee8a1325af096cbf64b2cf3779a (patch)
tree7c2aa2b70999c15457437fe6cbcb154b980cb349
parentf9221a07f0bef50897462148ba3d7c04a9583999 (diff)
src/prefs/koprefsdialog - plug 2 memory leaks
-rw-r--r--src/prefs/koprefsdialog.cpp23
-rw-r--r--src/prefs/koprefsdialog.h3
2 files changed, 16 insertions, 10 deletions
diff --git a/src/prefs/koprefsdialog.cpp b/src/prefs/koprefsdialog.cpp
index 3623d31..7a6f882 100644
--- a/src/prefs/koprefsdialog.cpp
+++ b/src/prefs/koprefsdialog.cpp
@@ -1219,6 +1219,12 @@ KOPrefsDialogPlugins::KOPrefsDialogPlugins(QWidget *parent)
selectionChanged();
}
+KOPrefsDialogPlugins::~KOPrefsDialogPlugins()
+{
+ delete mDecorations;
+ delete mOthers;
+}
+
void KOPrefsDialogPlugins::usrReadConfig()
{
mTreeWidget->clear();
@@ -1229,12 +1235,10 @@ void KOPrefsDialogPlugins::usrReadConfig()
QStringList selectedPlugins = viewPrefs->selectedPlugins();
- QTreeWidgetItem *decorations =
- new QTreeWidgetItem(mTreeWidget, QStringList(
- i18nc("@title:group", "Calendar Decorations")));
- QTreeWidgetItem *others =
- new QTreeWidgetItem(mTreeWidget, QStringList(
- i18nc("@title:group", "Other Plugins")));
+ mDecorations = new QTreeWidgetItem(mTreeWidget,
+ QStringList(i18nc("@title:group", "Calendar Decorations")));
+ mOthers = new QTreeWidgetItem(mTreeWidget,
+ QStringList(i18nc("@title:group", "Other Plugins")));
KService::List::ConstIterator it;
KService::List::ConstIterator end(plugins.constEnd());
@@ -1242,7 +1246,7 @@ void KOPrefsDialogPlugins::usrReadConfig()
for (it = plugins.constBegin(); it != end; ++it) {
QTreeWidgetItem *item = nullptr;
if ((*it)->hasServiceType(EventViews::CalendarDecoration::Decoration::serviceType())) {
- item = new PluginItem(decorations, *it);
+ item = new PluginItem(mDecorations, *it);
} else {
continue;
}
@@ -1253,8 +1257,8 @@ void KOPrefsDialogPlugins::usrReadConfig()
}
}
- decorations->setExpanded(true);
- others->setExpanded(true);
+ mDecorations->setExpanded(true);
+ mOthers->setExpanded(true);
mDecorationsAtMonthViewTop = KOPrefs::instance()->decorationsAtMonthViewTop().toSet();
mDecorationsAtAgendaViewTop = viewPrefs->decorationsAtAgendaViewTop().toSet();
@@ -1463,4 +1467,3 @@ QString KOPrefsDesignerFields::applicationName()
{
return QStringLiteral("KORGANIZER");
}
-
diff --git a/src/prefs/koprefsdialog.h b/src/prefs/koprefsdialog.h
index 7d926fc..aa597e6 100644
--- a/src/prefs/koprefsdialog.h
+++ b/src/prefs/koprefsdialog.h
@@ -122,6 +122,7 @@ class KCM_KORGANIZER_EXPORT KOPrefsDialogPlugins : public KPIM::KPrefsModule
Q_OBJECT
public:
KOPrefsDialogPlugins(QWidget *parent);
+ ~KOPrefsDialogPlugins();
protected Q_SLOTS:
void usrWriteConfig() override;
@@ -140,6 +141,8 @@ private:
QRadioButton *mPositionAgendaTop = nullptr;
QRadioButton *mPositionAgendaBottom = nullptr;
+ QTreeWidgetItem *mDecorations = nullptr;
+ QTreeWidgetItem *mOthers = nullptr;
QSet<QString> mDecorationsAtMonthViewTop;
QSet<QString> mDecorationsAtAgendaViewTop;
QSet<QString> mDecorationsAtAgendaViewBottom;