From a3397118d3c384655bedb40210db96ca34adc0c9 Mon Sep 17 00:00:00 2001 From: tille Date: Wed, 01 May 2002 22:56:23 +0000 Subject: fixed close of local & ipkgfind --- (limited to 'noncore') diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 4865c39..0422d65 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -38,7 +38,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : settings = new PackageManagerSettings(this,0,TRUE); listViewPackages = new PackageListView( this,"listViewPackages",settings ); setCentralWidget( listViewPackages ); - + listViewPackages->addList( tr("local"), &packageList ); + listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); // wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); // wait = new QMessageBox(this); // wait->setText(tr("Please wait")); @@ -280,26 +281,26 @@ void MainWindow::displayList() { // wait->hide(); filterList(); - listViewPackages->clear(); - Package *pack = packageList.first(); - PackageListItem *item; - -// if (!rootLocal) + listViewPackages->display(); +//// if (!rootLocal) +//// { +// QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); +// QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); +//// } +// listViewPackages->clear(); +// Package *pack = packageList.first(); +// PackageListItem *item; +// while( pack ) +// { +// item = new PackageListItem( rootLocal, pack, settings ); +// pack = packageList.next(); +// } +// pack = packageListSearch.first(); +// while( pack ) // { - QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); - QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); -// } - while( pack ) - { - item = new PackageListItem( rootLocal, pack, settings ); - pack = packageList.next(); - } - pack = packageListSearch.first(); - while( pack ) - { - item = new PackageListItem( rootSearch, pack, settings ); - pack = packageListSearch.next(); - } +// item = new PackageListItem( rootSearch, pack, settings ); +// pack = packageListSearch.next(); +// } } void MainWindow::sectionChanged() diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 26b1ce7..5137c64 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -94,3 +94,39 @@ void PackageListView::toggleProcess() activePackage->toggleProcess() ; activePackageListItem->displayDetails(); } + +void PackageListView::display() +{ + QDictIterator list( PackageLists ); + PackageList *packlist; + Package *pack; + PackageListItem *item; + QCheckListItem *rootItem; + QListViewItem* it; + QListViewItem* itdel; + while ( list.current() ) { + packlist = list.current(); + rootItem = rootItems.find( list.currentKey() ); + //rootItem->clear(); + it=rootItem->firstChild(); + while ( it ) + { + itdel = it; + it = it->nextSibling(); + delete itdel; + } + pack = packlist->first(); + while( pack ) + { + item = new PackageListItem( rootItem, pack, settings ); + pack = packlist->next(); + } + ++list; + } +} + +void PackageListView::addList( QString n, PackageList* pl) +{ + PackageLists.insert(n, pl); + rootItems.insert(n, new QCheckListItem(this,n)); +} diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index d371a34..00c0320 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h @@ -20,9 +20,12 @@ #include #include +#include +#include #include #include #include +#include "packagelist.h" #include "debug.h" class PackageListItem; @@ -35,9 +38,12 @@ class PackageListView : public QListView public: PackageListView(QWidget*, const char*, PackageManagerSettings*); + void addList( QString, PackageList* ); // ~PackageListView(); QTimer *popupTimer; private: + QDict PackageLists; + QDict rootItems; PackageManagerSettings *settings; Package *activePackage; PackageListItem *activePackageListItem; @@ -49,6 +55,7 @@ public slots: void setCurrent( QListViewItem* ); void stopTimer( QListViewItem* ); void toggleProcess(); + void display(); }; #endif -- cgit v0.9.0.2