-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index fdd1163..8f835b7 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,95 +1,96 @@ | |||
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 | ||
10 | static QDict<Package> *packageListAll; | 10 | static QDict<Package> *packageListAll; |
11 | static int packageListAllRefCount = 0; | 11 | static int packageListAllRefCount = 0; |
12 | 12 | ||
13 | PackageList::PackageList() | 13 | PackageList::PackageList() |
14 | : packageIter( packageList ) | 14 | : packageIter( packageList ) |
15 | { | 15 | { |
16 | empty=true; | 16 | empty=true; |
17 | if (!packageListAll) packageListAll = new QDict<Package>(); | 17 | if (!packageListAll) packageListAll = new QDict<Package>(); |
18 | packageListAllRefCount++; | 18 | packageListAllRefCount++; |
19 | sections << "All"; | 19 | sections << "All"; |
20 | subSections.insert("All", new QStringList() ); | 20 | subSections.insert("All", new QStringList() ); |
21 | QStringList *ss = subSections["All"]; | 21 | QStringList *ss = subSections["All"]; |
22 | *ss << "All"; | 22 | *ss << "All"; |
23 | aktSection = "All"; | 23 | aktSection = "All"; |
24 | aktSubSection = "All"; | 24 | aktSubSection = "All"; |
25 | } | 25 | } |
26 | 26 | ||
27 | PackageList::PackageList( PackageManagerSettings* s) | 27 | PackageList::PackageList( PackageManagerSettings* s) |
28 | : packageIter( packageList ) | 28 | : packageIter( packageList ) |
29 | { | 29 | { |
30 | settings = s; | 30 | settings = s; |
31 | PackageList(); | 31 | PackageList(); |
32 | } | 32 | } |
33 | 33 | ||
34 | PackageList::~PackageList() | 34 | PackageList::~PackageList() |
35 | { | 35 | { |
36 | if (--packageListAllRefCount < 1 ) delete packageListAll; | 36 | if (--packageListAllRefCount < 1 ) delete packageListAll; |
37 | } | 37 | } |
38 | 38 | ||
39 | /** Inserts a package into the list */ | 39 | /** Inserts a package into the list */ |
40 | void PackageList::insertPackage( Package* pack ) | 40 | void PackageList::insertPackage( Package* pack ) |
41 | { | 41 | { |
42 | if (!pack) return; | 42 | if (!pack) return; |
43 | Package* p = packageListAll->find( pack->name() ); | 43 | Package* p = packageListAll->find( pack->name() ); |
44 | if ( p ) | 44 | if ( p ) |
45 | { | 45 | { |
46 | if ( (p->version() == pack->version()) | 46 | if ( (p->version() == pack->version()) |
47 | && (p->dest() == pack->dest()) ) | 47 | // && (p->dest() == pack->dest()) |
48 | ) | ||
48 | { | 49 | { |
49 | p->copyValues( pack ); | 50 | p->copyValues( pack ); |
50 | delete pack; | 51 | delete pack; |
51 | pack = p; | 52 | pack = p; |
52 | } else { | 53 | } else { |
53 | QDict<Package> *packver = p->getOtherVersions(); | 54 | QDict<Package> *packver = p->getOtherVersions(); |
54 | // p->setName( pack->name()+"["+p->version()+"]" ); | 55 | // p->setName( pack->name()+"["+p->version()+"]" ); |
55 | if (!packver) | 56 | if (!packver) |
56 | { | 57 | { |
57 | packver = new QDict<Package>(); | 58 | packver = new QDict<Package>(); |
58 | packver->insert( pack->name(), p ); | 59 | packver->insert( pack->name(), p ); |
59 | p->setOtherVersions( packver ); | 60 | p->setOtherVersions( packver ); |
60 | } | 61 | } |
61 | pack->setName( pack->name()+"["+pack->version()+"]" ); | 62 | pack->setName( pack->name()+"["+pack->version()+"]" ); |
62 | pack->setOtherVersions( packver ); | 63 | pack->setOtherVersions( packver ); |
63 | packver->insert( pack->name(), pack ); | 64 | packver->insert( pack->name(), pack ); |
64 | packageListAll->insert( pack->name(), pack ); | 65 | packageListAll->insert( pack->name(), pack ); |
65 | packageList.insert( pack->name(), pack ); | 66 | packageList.insert( pack->name(), pack ); |
66 | origPackageList.insert( pack->name(), pack ); | 67 | origPackageList.insert( pack->name(), pack ); |
67 | } | 68 | } |
68 | }else{ | 69 | }else{ |
69 | packageListAll->insert( pack->name(), pack ); | 70 | packageListAll->insert( pack->name(), pack ); |
70 | packageList.insert( pack->name(), pack ); | 71 | packageList.insert( pack->name(), pack ); |
71 | origPackageList.insert( pack->name(), pack ); | 72 | origPackageList.insert( pack->name(), pack ); |
72 | }; | 73 | }; |
73 | empty=false; | 74 | empty=false; |
74 | updateSections( pack ); | 75 | updateSections( pack ); |
75 | } | 76 | } |
76 | 77 | ||
77 | void PackageList::filterPackages( QString f ) | 78 | void PackageList::filterPackages( QString f ) |
78 | { | 79 | { |
79 | packageList.clear(); | 80 | packageList.clear(); |
80 | QDictIterator<Package> filterIter( origPackageList ); | 81 | QDictIterator<Package> filterIter( origPackageList ); |
81 | filterIter.toFirst(); | 82 | filterIter.toFirst(); |
82 | Package *pack= filterIter.current() ; | 83 | Package *pack= filterIter.current() ; |
83 | while ( pack ) | 84 | while ( pack ) |
84 | { | 85 | { |
85 | if ( | 86 | if ( |
86 | ((aktSection=="All")||(pack->section()==aktSection)) && | 87 | ((aktSection=="All")||(pack->section()==aktSection)) && |
87 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && | 88 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && |
88 | pack->name().contains( f ) | 89 | pack->name().contains( f ) |
89 | ) | 90 | ) |
90 | { | 91 | { |
91 | packageList.insert( pack->name(), pack ); | 92 | packageList.insert( pack->name(), pack ); |
92 | } | 93 | } |
93 | ++filterIter; | 94 | ++filterIter; |
94 | pack = filterIter.current(); | 95 | pack = filterIter.current(); |
95 | } | 96 | } |