Diffstat (limited to 'noncore/settings/aqpkg/package.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index 4c27c65..adda832 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -1,15 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
@@ -21,82 +21,87 @@ | |||
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "package.h" | 30 | #include "package.h" |
31 | #include "global.h" | 31 | #include "global.h" |
32 | 32 | ||
33 | #include <qobject.h> | ||
34 | |||
33 | Package::Package( QString &name ) | 35 | Package::Package( QString &name ) |
34 | { | 36 | { |
35 | packageName = name; | 37 | packageName = name; |
36 | 38 | ||
37 | version = "N/A"; | 39 | QString tempstr = QObject::tr( "N/A" ); |
38 | description = "N/A"; | 40 | version = tempstr; |
39 | packageSize = "N/A"; | 41 | description = tempstr; |
40 | section = "N/A"; | 42 | packageSize = tempstr; |
41 | 43 | section = tempstr; | |
44 | |||
42 | localPackage = 0; | 45 | localPackage = 0; |
43 | installed = false; | 46 | installed = false; |
44 | packageStoredLocally = false; | 47 | packageStoredLocally = false; |
45 | installedToRoot = false; | 48 | installedToRoot = false; |
46 | installed = false; | 49 | installed = false; |
47 | installedTo = 0; | 50 | installedTo = 0; |
48 | } | 51 | } |
49 | 52 | ||
50 | Package::Package( char *name ) | 53 | Package::Package( char *name ) |
51 | { | 54 | { |
52 | packageName = name; | 55 | packageName = name; |
53 | 56 | ||
54 | version = "N/A"; | 57 | QString tempstr = QObject::tr( "N/A" ); |
55 | description = "N/A"; | 58 | version = tempstr; |
56 | packageSize = "N/A"; | 59 | description = tempstr; |
57 | section = "N/A"; | 60 | packageSize = tempstr; |
58 | 61 | section = tempstr; | |
62 | |||
59 | localPackage = 0; | 63 | localPackage = 0; |
60 | installed = false; | 64 | installed = false; |
61 | packageStoredLocally = false; | 65 | packageStoredLocally = false; |
62 | installedToRoot = false; | 66 | installedToRoot = false; |
63 | installed = false; | 67 | installed = false; |
64 | installedTo = 0; | 68 | installedTo = 0; |
65 | differentVersionAvailable = false; | 69 | differentVersionAvailable = false; |
66 | } | 70 | } |
67 | 71 | ||
68 | Package::~Package() | 72 | Package::~Package() |
69 | { | 73 | { |
70 | } | 74 | } |
71 | 75 | ||
72 | QString Package :: toString() | 76 | QString Package :: toString() |
73 | { | 77 | { |
74 | QString ret = "Package - " + getPackageName() + | 78 | QString ret = QObject::tr( "Package - %1\n version - %2" ). |
75 | "\n version - " + getVersion(); | 79 | arg( getPackageName() ). |
80 | arg( getVersion() ); | ||
76 | 81 | ||
77 | if ( localPackage ) | 82 | if ( localPackage ) |
78 | ret += "\n inst version - " + localPackage->getVersion(); | 83 | ret.append( QObject::tr( "\n inst version - %1" ).arg( localPackage->getVersion() ) ); |
79 | 84 | ||
80 | 85 | ||
81 | return ret; | 86 | return ret; |
82 | } | 87 | } |
83 | 88 | ||
84 | void Package :: setStatus( const QString &s ) | 89 | void Package :: setStatus( const QString &s ) |
85 | { | 90 | { |
86 | QString state_status; | 91 | QString state_status; |
87 | int two, three; | 92 | int two, three; |
88 | 93 | ||
89 | status = s.simplifyWhiteSpace( ); | 94 | status = s.simplifyWhiteSpace( ); |
90 | 95 | ||
91 | two = status.find( " " ); // find second column | 96 | two = status.find( " " ); // find second column |
92 | three = status.find( " ", two + 1 ); // find third column | 97 | three = status.find( " ", two + 1 ); // find third column |
93 | 98 | ||
94 | state_status = status.mid( three ).stripWhiteSpace( ); | 99 | state_status = status.mid( three ).stripWhiteSpace( ); |
95 | 100 | ||
96 | if ( state_status == "installed" ) | 101 | if ( state_status == "installed" ) |
97 | installed = true; | 102 | installed = true; |
98 | } | 103 | } |
99 | 104 | ||
100 | void Package :: setLocalPackage( Package *p ) | 105 | void Package :: setLocalPackage( Package *p ) |
101 | { | 106 | { |
102 | localPackage = p; | 107 | localPackage = p; |