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.cpp89
1 files changed, 48 insertions, 41 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
@@ -10,7 +10,7 @@
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 )
@@ -62,63 +62,54 @@ Package::Package( Package *pi )
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" ) 68 {
70 {
71 _size = t; 69 _size = t;
72 } 70 }else if ( n == "Priority")
73 if ( n == "Priority") 71 {
74 {
75 72
76 } 73 }else if ( n == "Section")
77 if ( n == "Section") 74 {
78 {
79 setSection( t ); 75 setSection( t );
80 } 76 }else if ( n == "Maintainer")
81 if ( n == "Maintainer") 77 {
82 {
83 78
84 } 79 }else if ( n == "Architecture")
85 if ( n == "Architecture") 80 {
86 {
87 81
88 } 82 }else if ( n == "Version")
89 if ( n == "Version") 83 {
90 {
91 84
92 } 85 }else if ( n == "Pre-Depends")
93 if ( n == "Pre-Depends") 86 {
94 {
95 87
96 } 88 }else if ( n == "Depends")
97 if ( n == "Depends") 89 {
98 {
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")
104 { 95 {
105 96
106 }else if ( n == "MD5Sum") 97 }else if ( n == "MD5Sum")
107 { 98 {
108 99
109 } 100 }
110 if ( n == "Description") 101 if ( n == "Description")
111 { 102 {
112 setDesc( t ); 103 setDesc( t );
113 } 104 }
114 if ( n == "Status") 105 if ( n == "Status")
115 { 106 {
116 if ( installed() ) return; 107 if ( installed() ) return;
117 _status = t; 108 _status = t;
118 } 109 }
119 if ( t == "Essential") 110 if ( t == "Essential")
120 { 111 {
121 112
122 } 113 }
123}; 114};
124 115
@@ -154,4 +145,20 @@ QString Package::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{