Commit f64b13e0 authored by Allen Winter's avatar Allen Winter

src/prefs/koprefsdialog - plug 2 memory leaks

parent f9221a07
......@@ -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");
}
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment