summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/package.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/package.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/package.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 5f0e5fa..0499e19 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -6,15 +6,15 @@
6#include <qtextstream.h> 6#include <qtextstream.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <unistd.h> 8#include <unistd.h>
9 9
10#include "debug.h" 10#include "debug.h"
11 11
12Package::~Package() 12//Package::~Package()
13{ 13//{
14} 14//}
15 15
16Package::Package( PackageManagerSettings *s ) 16Package::Package( PackageManagerSettings *s )
17{ 17{
18 init(s); 18 init(s);
19} 19}
20 20
@@ -58,46 +58,37 @@ Package::Package( Package *pi )
58 copyValues( pi ); 58 copyValues( pi );
59} 59}
60 60
61 61
62void Package::setValue( QString n, QString t ) 62void Package::setValue( QString n, QString t )
63{ 63{
64 if ( n == "Status" && installed() ) return;
65 if ( n == "Package" ) 64 if ( n == "Package" )
66 { 65 {
67 _name = QString( t ); 66 _name = QString( t );
68 } 67 }else if ( n == "Installed-Size" )
69 if ( n == "Installed-Size" )
70 { 68 {
71 _size = t; 69 _size = t;
72 } 70 }else if ( n == "Priority")
73 if ( n == "Priority")
74 { 71 {
75 72
76 } 73 }else if ( n == "Section")
77 if ( n == "Section")
78 { 74 {
79 setSection( t ); 75 setSection( t );
80 } 76 }else if ( n == "Maintainer")
81 if ( n == "Maintainer")
82 { 77 {
83 78
84 } 79 }else if ( n == "Architecture")
85 if ( n == "Architecture")
86 { 80 {
87 81
88 } 82 }else if ( n == "Version")
89 if ( n == "Version")
90 { 83 {
91 84
92 } 85 }else if ( n == "Pre-Depends")
93 if ( n == "Pre-Depends")
94 { 86 {
95 87
96 } 88 }else if ( n == "Depends")
97 if ( n == "Depends")
98 { 89 {
99 90
100 }else if ( n == "Filename") 91 }else if ( n == "Filename")
101 { 92 {
102 93
103 }else if ( n == "Size") 94 }else if ( n == "Size")
@@ -150,12 +141,28 @@ QString Package::shortDesc()
150 141
151QString Package::size() 142QString Package::size()
152{ 143{
153 return _size; 144 return _size;
154} 145}
155 146
147QString Package::sizeUnits()
148{
149 int i = _size.toInt();
150 int c = 0;
151 QString ret;
152 QStringList unit;
153 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
154 while (i > 1)
155 {
156 ret=QString::number(i)+" "+unit[c];
157 c++;
158 i /= 1024;
159 }
160 return ret;
161}
162
156bool Package::toProcess() 163bool Package::toProcess()
157{ 164{
158 return _toProcess; 165 return _toProcess;
159} 166}
160 167
161bool Package::toRemove() 168bool Package::toRemove()