diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-06-28 14:56:12 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-06-29 23:45:49 +0900 |
commit | 0e1649599e9aea4fccb8435fbf74796e0756d282 (patch) | |
tree | 5c62a6ea7aa518a1caa641adbd1b7f6b3182c3df /knode/kngroupbrowser.cpp | |
parent | fd0046c40716f19ab1bd3bff77b123e373b73771 (diff) | |
download | tdepim-0e1649599e9aea4fccb8435fbf74796e0756d282.tar.gz tdepim-0e1649599e9aea4fccb8435fbf74796e0756d282.zip |
Fix functionality broken by commit fd0046c4
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'knode/kngroupbrowser.cpp')
-rw-r--r-- | knode/kngroupbrowser.cpp | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/knode/kngroupbrowser.cpp b/knode/kngroupbrowser.cpp index e77f7687b..bafa065c9 100644 --- a/knode/kngroupbrowser.cpp +++ b/knode/kngroupbrowser.cpp @@ -41,10 +41,8 @@ KNGroupBrowser::KNGroupBrowser(TQWidget *parent, const TQString &caption, KNNntp { refilterTimer = new TQTimer(); - allList=new TQPtrList<KNGroupInfo>; - allList->setAutoDelete(true); - matchList=new TQPtrList<KNGroupInfo>; - matchList->setAutoDelete(false); + allList = new std::list<KNGroupInfo*>(); + matchList = new std::list<KNGroupInfo*>(); //create Widgets page=new TQWidget(this); @@ -148,7 +146,16 @@ KNGroupBrowser::~KNGroupBrowser() knGlobals.netAccess()->stopJobsNntp(KNJobData::JTCheckNewGroups); delete matchList; + + for (KNGroupInfo *g : *allList) + { + if (g) + { + delete g; + } + } delete allList; + delete refilterTimer; } @@ -159,6 +166,13 @@ void KNGroupBrowser::slotReceiveList(KNGroupListData* d) enableButton(User2,true); if (d) { // d==0 if something has gone wrong... + for (KNGroupInfo *g : *allList) + { + if (g) + { + delete g; + } + } delete allList; allList = d->extractList(); incrementalFilter=false; @@ -206,8 +220,8 @@ void KNGroupBrowser::createListItems(TQListViewItem *parent) } } - for(KNGroupInfo *gn=matchList->first(); gn; gn=matchList->next()) { - + for (KNGroupInfo *gn : *matchList) + { if(!prefix.isEmpty() && !gn->name.startsWith(prefix)) if(!compare.isNull()) break; @@ -321,14 +335,14 @@ void KNGroupBrowser::slotFilter(const TQString &txt) bool doIncrementalUpdate = (!isRegexp && incrementalFilter && (filtertxt.left(lastFilter.length())==lastFilter)); if (doIncrementalUpdate) { - TQPtrList<KNGroupInfo> *tempList = new TQPtrList<KNGroupInfo>(); - tempList->setAutoDelete(false); + std::list<KNGroupInfo*> *tempList = new std::list<KNGroupInfo*>(); - for(KNGroupInfo *g=matchList->first(); g; g=matchList->next()) { + for (KNGroupInfo *g : *matchList) + { if ((notCheckSub||g->subscribed)&& (notCheckNew||g->newGroup)&& (notCheckStr||(g->name.find(filtertxt)!=-1))) - tempList->append(g); + tempList->push_back(g); } delete matchList; @@ -336,18 +350,20 @@ void KNGroupBrowser::slotFilter(const TQString &txt) } else { matchList->clear(); - for(KNGroupInfo *g=allList->first(); g; g=allList->next()) { + for (KNGroupInfo *g : *allList) + { if ((notCheckSub||g->subscribed)&& (notCheckNew||g->newGroup)&& (notCheckStr||(isRegexp? (reg.search(g->name,0) != -1):(g->name.find(filtertxt)!=-1)))) - matchList->append(g); + matchList->push_back(g); } } groupView->clear(); - if((matchList->count() < MIN_FOR_TREE) || noTreeCB->isChecked()) { - for(KNGroupInfo *g=matchList->first(); g; g=matchList->next()) { + if((matchList->size() < MIN_FOR_TREE) || noTreeCB->isChecked()) { + for (KNGroupInfo *g : *matchList) + { cit=new CheckItem(groupView, *g, this); updateItemState(cit); } @@ -358,7 +374,7 @@ void KNGroupBrowser::slotFilter(const TQString &txt) lastFilter = filtertxt; incrementalFilter = !isRegexp; - leftLabel->setText(i18n("Groups on %1: (%2 displayed)").arg(a_ccount->name()).arg(matchList->count())); + leftLabel->setText(i18n("Groups on %1: (%2 displayed)").arg(a_ccount->name()).arg(matchList->size())); arrowBtn1->setEnabled(false); arrowBtn2->setEnabled(false); |