summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp41
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp36
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h7
3 files changed, 64 insertions, 20 deletions
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
@@ -25,33 +25,34 @@
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include "pksettingsbase.h"
#include "utils.h"
#include "packagelistitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QMainWindow( parent, name, f )
{
setCaption( tr("Package Manager") );
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"));
ipkg = new PmIpkg( settings, this );
// settings->setIpkg( ipkg );
packageList.setSettings( settings );
packageListSearch.setSettings( settings );
packageList.update();
makeMenu();
makeChannel();
//opie is hardcoded default ;)
for (int i=0;i<section->count();i++)
if (section->text(i)=="opie")
section->setCurrentItem(i);
sectionChanged();
@@ -267,52 +268,52 @@ void MainWindow::updateList()
// wait->hide();
}
void MainWindow::filterList()
{
// wait->show();
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageList.filterPackages( f );
// wait->hide();
}
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()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
subsection->clear();
packageList.setSection( section->currentText() );
setSubSections();
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
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
@@ -81,16 +81,52 @@ void PackageListView::stopTimer( QListViewItem* )
}
void PackageListView::changePackageDest( int i )
{
activePackage->setDest( destsMenu->text(i) );
activePackage->setOn();
activePackage->setLink( settings->createLinks() );
activePackageListItem->displayDetails();
}
void PackageListView::toggleProcess()
{
activePackage->toggleProcess() ;
activePackageListItem->displayDetails();
}
+
+void PackageListView::display()
+{
+ QDictIterator<PackageList> 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
@@ -7,48 +7,55 @@
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PACKAGELISTVIEW_H
#define PACKAGELISTVIEW_H
#include <qlistview.h>
#include <qaction.h>
+#include <qdict.h>
+#include <qstring.h>
#include <qtimer.h>
#include <qwidget.h>
#include <qpopupmenu.h>
+#include "packagelist.h"
#include "debug.h"
class PackageListItem;
class Package;
class PackageManagerSettings;
class PackageListView : public QListView
{
Q_OBJECT
public:
PackageListView(QWidget*, const char*, PackageManagerSettings*);
+ void addList( QString, PackageList* );
// ~PackageListView();
QTimer *popupTimer;
private:
+ QDict<PackageList> PackageLists;
+ QDict<QCheckListItem> rootItems;
PackageManagerSettings *settings;
Package *activePackage;
PackageListItem *activePackageListItem;
QPopupMenu *popupMenu;
QPopupMenu *destsMenu;
public slots:
void showPopup();
void changePackageDest( int );
void setCurrent( QListViewItem* );
void stopTimer( QListViewItem* );
void toggleProcess();
+ void display();
};
#endif