summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/package.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/package.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/package.cpp58
1 files changed, 57 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 9280d89..c947c64 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -26,15 +26,17 @@ void Package::init( PackageManagerSettings *s )
26 _subsection = ""; 26 _subsection = "";
27 _shortDesc = ""; 27 _shortDesc = "";
28 _desc = ""; 28 _desc = "";
29 _name = ""; 29 _name = "";
30 _toProcess = false; 30 _toProcess = false;
31 _useFileName = false; 31 _useFileName = false;
32 _old = false;
32 _status = ""; 33 _status = "";
33 _dest = settings->getDestinationName(); 34 _dest = settings->getDestinationName();
34 _link = settings->createLinks(); 35 _link = settings->createLinks();
36 _versions=0;
35} 37}
36 38
37Package::Package( QStringList pack, PackageManagerSettings *s ) 39Package::Package( QStringList pack, PackageManagerSettings *s )
38 { 40 {
39 init(s); 41 init(s);
40 parsePackage( pack ); 42 parsePackage( pack );
@@ -125,13 +127,40 @@ QString Package::installName()
125 if (_useFileName) return _fileName; 127 if (_useFileName) return _fileName;
126 else return _name; 128 else return _name;
127} 129}
128 130
129bool Package::installed() 131bool Package::installed()
130{ 132{
131 return _status.contains("installed"); 133 if (_status.contains("installed")) return true;
134 else
135 if (_versions)
136 {
137 QDictIterator<Package> other( *_versions );
138 while ( other.current() )
139 {
140 if (other.current()->status().contains("installed")
141 && other.current()->version() == version())
142 return true;
143 ++other;
144 }
145 }
146 return false;
147}
148
149bool Package::otherInstalled()
150{
151 if (_versions)
152 {
153 QDictIterator<Package> other( *_versions );
154 while ( other.current() )
155 {
156 if (other.current()->installed()) return true;
157 ++other;
158 }
159 }
160 return false;
132} 161}
133 162
134void Package::setDesc( QString s ) 163void Package::setDesc( QString s )
135{ 164{
136 _desc = s; 165 _desc = s;
137 _shortDesc = s.left( s.find("\n") ); 166 _shortDesc = s.left( s.find("\n") );
@@ -367,6 +396,33 @@ QDict<QString>* Package::getFields()
367} 396}
368 397
369QString Package::status() 398QString Package::status()
370{ 399{
371 return _status; 400 return _status;
372} 401}
402
403bool Package::isOld()
404{
405 if (!_versions) return false;
406 QDictIterator<Package> other( *_versions );
407 while ( other.current() ) {
408 if (other.current()->version() > version() ) return true;
409 ++other;
410 }
411 return false;
412}
413
414bool Package::hasVersions()
415{
416 if (!_versions) return false;
417 else return true;
418}
419
420QDict<Package>* Package::getOtherVersions()
421{
422 return _versions;
423}
424
425void Package::setOtherVersions(QDict<Package> *v)
426{
427 _versions=v;
428}