summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelist.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index be20c71..2fc4c41 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,63 +1,78 @@
1#include "packagelist.h" 1#include "packagelist.h"
2 2
3#include <assert.h> 3#include <assert.h>
4#include <qfile.h> 4#include <qfile.h>
5#include <qfileinfo.h> 5#include <qfileinfo.h>
6#include <qtextstream.h> 6#include <qtextstream.h>
7 7
8#include "debug.h" 8#include "debug.h"
9 9
10static QDict<Package> *packageListAll;
11
10PackageList::PackageList() 12PackageList::PackageList()
11 : packageIter( packageList ) 13 : packageIter( packageList )
12{ 14{
13 empty=true; 15 empty=true;
16 if (!packageListAll) packageListAll = new QDict<Package>();
14 sections << "All"; 17 sections << "All";
15 subSections.insert("All", new QStringList() ); 18 subSections.insert("All", new QStringList() );
16 QStringList *ss = subSections["All"]; 19 QStringList *ss = subSections["All"];
17 *ss << "All"; 20 *ss << "All";
18 aktSection = "All"; 21 aktSection = "All";
19 aktSubSection = "All"; 22 aktSubSection = "All";
20} 23}
21 24
22PackageList::PackageList( PackageManagerSettings* s) 25PackageList::PackageList( PackageManagerSettings* s)
23 : packageIter( packageList ) 26 : packageIter( packageList )
24{ 27{
25 settings = s; 28 settings = s;
26 PackageList(); 29 PackageList();
27} 30}
28 31
29PackageList::~PackageList() 32PackageList::~PackageList()
30{ 33{
31} 34}
32 35
33/** Inserts a package into the list */ 36/** Inserts a package into the list */
34void PackageList::insertPackage( Package* pack ) 37void PackageList::insertPackage( Package* pack )
35{ 38{
36 if (!pack) return; 39 if (!pack) return;
37 Package* p = packageList.find( pack->name() ); 40 Package* p = packageListAll->find( pack->name() );
38 if ( p ) 41 if ( p )
39 { 42 {
40 if ( p->version() == pack->version() ) 43 if ( (p->version() == pack->version())
44 && (p->dest() == pack->dest()) )
41 { 45 {
42 p->copyValues( pack ); 46 p->copyValues( pack );
43 delete pack; 47 delete pack;
44 pack = p; 48 pack = p;
45 } else { 49 } else {
46 p->setName( pack->name()+"["+p->version()+"]" ); 50 QDict<Package> *packver = p->getOtherVersions();
51 // p->setName( pack->name()+"["+p->version()+"]" );
52 if (!packver)
53 {
54 packver = new QDict<Package>;
55 packver->insert( pack->name(), p );
56 p->setOtherVersions( packver );
57 }
47 pack->setName( pack->name()+"["+pack->version()+"]" ); 58 pack->setName( pack->name()+"["+pack->version()+"]" );
59 pack->setOtherVersions( packver );
60 packver->insert( pack->name(), pack );
61 packageListAll->insert( pack->name(), pack );
48 packageList.insert( pack->name(), pack ); 62 packageList.insert( pack->name(), pack );
49 origPackageList.insert( pack->name(), pack ); 63 origPackageList.insert( pack->name(), pack );
50 } 64 }
51 }else{ 65 }else{
66 packageListAll->insert( pack->name(), pack );
52 packageList.insert( pack->name(), pack ); 67 packageList.insert( pack->name(), pack );
53 origPackageList.insert( pack->name(), pack ); 68 origPackageList.insert( pack->name(), pack );
54 }; 69 };
55 empty=false; 70 empty=false;
56 updateSections( pack ); 71 updateSections( pack );
57} 72}
58 73
59void PackageList::filterPackages( QString f ) 74void PackageList::filterPackages( QString f )
60 { 75 {
61 packageList.clear(); 76 packageList.clear();
62 QDictIterator<Package> filterIter( origPackageList ); 77 QDictIterator<Package> filterIter( origPackageList );
63 filterIter.toFirst(); 78 filterIter.toFirst();