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