author | andyq <andyq> | 2002-09-28 23:22:41 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-09-28 23:22:41 (UTC) |
commit | 8ebc71609e5263d096f7331a5e0fa95b41eb1d77 (patch) (unidiff) | |
tree | b51cc78a419a8735d4bc447229b4561b5c6edbe5 /noncore/settings/aqpkg/package.cpp | |
parent | e78460a23cb8bea25f45cdd01f74e8c1d07da1a8 (diff) | |
download | opie-8ebc71609e5263d096f7331a5e0fa95b41eb1d77.zip opie-8ebc71609e5263d096f7331a5e0fa95b41eb1d77.tar.gz opie-8ebc71609e5263d096f7331a5e0fa95b41eb1d77.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'noncore/settings/aqpkg/package.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp new file mode 100644 index 0000000..48b6934 --- a/dev/null +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -0,0 +1,109 @@ | |||
1 | /*************************************************************************** | ||
2 | package.cpp - description | ||
3 | ------------------- | ||
4 | begin : Mon Aug 26 2002 | ||
5 | copyright : (C) 2002 by Andy Qua | ||
6 | email : andy.qua@blueyonder.co.uk | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #include "package.h" | ||
19 | #include "global.h" | ||
20 | |||
21 | Package::Package( QString &name ) | ||
22 | { | ||
23 | packageName = name; | ||
24 | localPackage = 0; | ||
25 | installed = false; | ||
26 | packageStoredLocally = false; | ||
27 | installedToRoot = false; | ||
28 | } | ||
29 | |||
30 | Package::Package( char *name ) | ||
31 | { | ||
32 | packageName = name; | ||
33 | localPackage = 0; | ||
34 | } | ||
35 | |||
36 | Package::~Package() | ||
37 | { | ||
38 | } | ||
39 | |||
40 | QString Package :: toString() | ||
41 | { | ||
42 | QString ret = "Package - " + getPackageName() + | ||
43 | "\n version - " + getVersion(); | ||
44 | |||
45 | if ( localPackage ) | ||
46 | ret += "\n inst version - " + localPackage->getVersion(); | ||
47 | |||
48 | |||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | void Package :: setStatus( QString &s ) | ||
53 | { | ||
54 | status = s; | ||
55 | |||
56 | if ( status.find( "installed" ) != -1 ) | ||
57 | installed = true; | ||
58 | } | ||
59 | |||
60 | void Package :: setLocalPackage( Package *p ) | ||
61 | { | ||
62 | localPackage = p; | ||
63 | |||
64 | if ( localPackage ) | ||
65 | if ( localPackage->getVersion() != getVersion() ) | ||
66 | differentVersionAvailable = true; | ||
67 | else | ||
68 | differentVersionAvailable = false; | ||
69 | } | ||
70 | |||
71 | void Package :: setVersion( QString &v ) | ||
72 | { | ||
73 | version = v; | ||
74 | |||
75 | if ( localPackage ) | ||
76 | if ( localPackage->getVersion() != getVersion() ) | ||
77 | differentVersionAvailable = true; | ||
78 | else | ||
79 | differentVersionAvailable = false; | ||
80 | } | ||
81 | |||
82 | void Package :: setPackageName( QString &name ) | ||
83 | { | ||
84 | packageName = name; | ||
85 | } | ||
86 | |||
87 | void Package :: setDescription( QString &d ) | ||
88 | { | ||
89 | description = d; | ||
90 | } | ||
91 | |||
92 | void Package :: setFilename( QString &f ) | ||
93 | { | ||
94 | filename = f; | ||
95 | } | ||
96 | |||
97 | |||
98 | QString Package :: getInstalledVersion() | ||
99 | { | ||
100 | if ( localPackage ) | ||
101 | return localPackage->getVersion(); | ||
102 | else | ||
103 | return getVersion(); | ||
104 | } | ||
105 | |||
106 | bool Package :: isInstalled() | ||
107 | { | ||
108 | return installed || ( localPackage && localPackage->isInstalled() ); | ||
109 | } | ||