summaryrefslogtreecommitdiffstats
path: root/knode/kngroupbrowser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'knode/kngroupbrowser.cpp')
-rw-r--r--knode/kngroupbrowser.cpp70
1 files changed, 43 insertions, 27 deletions
diff --git a/knode/kngroupbrowser.cpp b/knode/kngroupbrowser.cpp
index f2379f51..865dbd20 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 TQSortedList<KNGroupInfo>;
- allList->setAutoDelete(true);
- matchList=new TQSortedList<KNGroupInfo>;
- matchList->setAutoDelete(false);
+ allList = new std::list<KNGroupInfo*>();
+ matchList = new std::list<KNGroupInfo*>();
//create Widgets
page=new TQWidget(this);
@@ -89,8 +87,8 @@ KNGroupBrowser::KNGroupBrowser(TQWidget *parent, const TQString &caption, KNNntp
groupView->addColumn(i18n("Description"));
groupView->setTreeStepSize(15);
- connect(groupView, TQT_SIGNAL(doubleClicked(TQListViewItem*)),
- this, TQT_SLOT(slotItemDoubleClicked(TQListViewItem*)));
+ connect(groupView, TQ_SIGNAL(doubleClicked(TQListViewItem*)),
+ this, TQ_SLOT(slotItemDoubleClicked(TQListViewItem*)));
//layout
TQGridLayout *topL=new TQGridLayout(page,3,1,0,5);
@@ -121,22 +119,22 @@ KNGroupBrowser::KNGroupBrowser(TQWidget *parent, const TQString &caption, KNNntp
arrL->addWidget(arrowBtn2, AlignCenter);
//connect
- connect(filterEdit, TQT_SIGNAL(textChanged(const TQString&)),
- TQT_SLOT(slotFilterTextChanged(const TQString&)));
- connect(groupView, TQT_SIGNAL(expanded(TQListViewItem*)),
- TQT_SLOT(slotItemExpand(TQListViewItem*)));
+ connect(filterEdit, TQ_SIGNAL(textChanged(const TQString&)),
+ TQ_SLOT(slotFilterTextChanged(const TQString&)));
+ connect(groupView, TQ_SIGNAL(expanded(TQListViewItem*)),
+ TQ_SLOT(slotItemExpand(TQListViewItem*)));
- connect(refilterTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotRefilter()));
- connect(noTreeCB, TQT_SIGNAL(clicked()), TQT_SLOT(slotTreeCBToggled()));
- connect(subCB, TQT_SIGNAL(clicked()), TQT_SLOT(slotSubCBToggled()));
- connect(newCB, TQT_SIGNAL(clicked()), TQT_SLOT(slotNewCBToggled()));
+ connect(refilterTimer, TQ_SIGNAL(timeout()), TQ_SLOT(slotRefilter()));
+ connect(noTreeCB, TQ_SIGNAL(clicked()), TQ_SLOT(slotTreeCBToggled()));
+ connect(subCB, TQ_SIGNAL(clicked()), TQ_SLOT(slotSubCBToggled()));
+ connect(newCB, TQ_SIGNAL(clicked()), TQ_SLOT(slotNewCBToggled()));
enableButton(User1,false);
enableButton(User2,false);
filterEdit->setFocus();
- TQTimer::singleShot(2, this, TQT_SLOT(slotLoadList()));
+ TQTimer::singleShot(2, this, TQ_SLOT(slotLoadList()));
}
@@ -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;
@@ -287,7 +301,7 @@ void KNGroupBrowser::slotItemExpand(TQListViewItem *it)
{
groupView->ensureVisible(groupView->contentsX(), y+h/2, 0, h/2);
delayedCenter = y+h/2;
- TQTimer::singleShot(300, this, TQT_SLOT(slotCenterDelayed()));
+ TQTimer::singleShot(300, this, TQ_SLOT(slotCenterDelayed()));
}
}
@@ -321,14 +335,14 @@ void KNGroupBrowser::slotFilter(const TQString &txt)
bool doIncrementalUpdate = (!isRegexp && incrementalFilter && (filtertxt.left(lastFilter.length())==lastFilter));
if (doIncrementalUpdate) {
- TQSortedList<KNGroupInfo> *tempList = new TQSortedList<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);