-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp index f72540c..c579df8 100644 --- a/noncore/unsupported/oipkg/main.cpp +++ b/noncore/unsupported/oipkg/main.cpp | |||
@@ -1,25 +1,26 @@ | |||
1 | 1 | ||
2 | #include "mainwindow.h" | 2 | #include "mainwindow.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | //#include <qmessagebox.h> | 6 | //#include <qmessagebox.h> |
7 | int debugLevel; | 7 | int debugLevel; |
8 | 8 | ||
9 | int main( int argc, char ** argv ) | 9 | int main( int argc, char ** argv ) |
10 | { | 10 | { |
11 | setpgid(0,0); | ||
11 | printf("This is oipkg\n"); | 12 | printf("This is oipkg\n"); |
12 | printf("$Id$\n"); | 13 | printf("$Id$\n"); |
13 | debugLevel = 2; | 14 | debugLevel = 2; |
14 | if (argc > 1) | 15 | if (argc > 1) |
15 | { | 16 | { |
16 | debugLevel = QString ( argv[1] ).toInt(); | 17 | debugLevel = QString ( argv[1] ).toInt(); |
17 | qDebug("setting debug level to %i",debugLevel); | 18 | qDebug("setting debug level to %i",debugLevel); |
18 | } | 19 | } |
19 | QPEApplication a( argc, argv ); | 20 | QPEApplication a( argc, argv ); |
20 | MainWindow mw; | 21 | MainWindow mw; |
21 | // if (argc > 2) | 22 | // if (argc > 2) |
22 | // QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); | 23 | // QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); |
23 | a.showMainDocumentWidget( &mw ); | 24 | a.showMainDocumentWidget( &mw ); |
24 | return a.exec(); | 25 | return a.exec(); |
25 | } | 26 | } |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 8bbdd77..0cd93bf 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,165 +1,167 @@ | |||
1 | #include "package.h" | 1 | #include "package.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 4 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
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 | ||
12 | Package::Package( QObject *parent, const char *name ) | 12 | Package::Package( QObject *parent, const char *name ) |
13 | : QObject(parent,name) | 13 | : QObject(parent,name) |
14 | { | 14 | { |
15 | 15 | ||
16 | } | 16 | } |
17 | 17 | ||
18 | Package::~Package() | 18 | Package::~Package() |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) | 22 | Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) |
23 | : QObject(parent,name) | 23 | : QObject(parent,name) |
24 | { | 24 | { |
25 | Package(parent,name); | 25 | Package(parent,name); |
26 | init(s); | 26 | init(s); |
27 | } | 27 | } |
28 | 28 | ||
29 | void Package::init( PackageManagerSettings *s ) | 29 | void Package::init( PackageManagerSettings *s ) |
30 | { | 30 | { |
31 | settings = s; | 31 | settings = s; |
32 | _size = ""; | 32 | _size = ""; |
33 | _section = ""; | 33 | _section = ""; |
34 | _subsection = ""; | 34 | _subsection = ""; |
35 | _shortDesc = ""; | 35 | _shortDesc = ""; |
36 | _desc = ""; | 36 | _desc = ""; |
37 | _name = ""; | 37 | _name = ""; |
38 | _toProcess = false; | 38 | _toProcess = false; |
39 | _useFileName = false; | 39 | _useFileName = false; |
40 | _old = false; | 40 | _old = false; |
41 | _status = ""; | 41 | _status = ""; |
42 | _dest = settings->getDestinationName(); | 42 | _dest = settings->getDestinationName(); |
43 | _link = settings->createLinks(); | 43 | _link = settings->createLinks(); |
44 | _versions=0; | 44 | _versions=0; |
45 | _version=""; | 45 | _version=""; |
46 | } | 46 | } |
47 | 47 | ||
48 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) | 48 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) |
49 | : QObject(parent,name) | 49 | : QObject(parent,name) |
50 | { | 50 | { |
51 | init(s); | 51 | init(s); |
52 | parsePackage( pack ); | 52 | parsePackage( pack ); |
53 | } | 53 | } |
54 | 54 | ||
55 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) | 55 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) |
56 | : QObject(parent,name) | ||
56 | { | 57 | { |
57 | init(s); | 58 | init(s); |
58 | if ( !QFile::exists( n ) ) | 59 | if ( !QFile::exists( n ) ) |
59 | { | 60 | { |
60 | _name = QString( n ); | 61 | _name = QString( n ); |
61 | }else{ | 62 | }else{ |
62 | pvDebug(4,"remote file: "+n); | 63 | pvDebug(4,"remote file: "+n); |
63 | parseIpkgFile( n ); | 64 | parseIpkgFile( n ); |
64 | _useFileName = true; | 65 | _useFileName = true; |
65 | _fileName = QString( n ); | 66 | _fileName = QString( n ); |
66 | } | 67 | } |
67 | } | 68 | } |
68 | 69 | ||
69 | Package::Package( Package *pi, QObject *parent, const char *name ) | 70 | Package::Package( Package *pi, QObject *parent, const char *name ) |
71 | : QObject(parent,name) | ||
70 | { | 72 | { |
71 | init(pi->settings); | 73 | init(pi->settings); |
72 | copyValues( pi ); | 74 | copyValues( pi ); |
73 | } | 75 | } |
74 | 76 | ||
75 | 77 | ||
76 | void Package::setValue( QString n, QString t ) | 78 | void Package::setValue( QString n, QString t ) |
77 | { | 79 | { |
78 | if ( n == "Package" ) | 80 | if ( n == "Package" ) |
79 | { | 81 | { |
80 | _name = QString( t ); | 82 | _name = QString( t ); |
81 | }else if ( n == "Installed-Size" ) | 83 | }else if ( n == "Installed-Size" ) |
82 | { | 84 | { |
83 | _size = t; | 85 | _size = t; |
84 | // }else if ( n == "Priority") | 86 | // }else if ( n == "Priority") |
85 | // { | 87 | // { |
86 | 88 | ||
87 | }else if ( n == "Section") | 89 | }else if ( n == "Section") |
88 | { | 90 | { |
89 | setSection( t ); | 91 | setSection( t ); |
90 | // }else if ( n == "Maintainer") | 92 | // }else if ( n == "Maintainer") |
91 | // { | 93 | // { |
92 | // | 94 | // |
93 | // }else if ( n == "Architecture") | 95 | // }else if ( n == "Architecture") |
94 | // { | 96 | // { |
95 | 97 | ||
96 | }else if ( n == "Version") | 98 | }else if ( n == "Version") |
97 | { | 99 | { |
98 | _version = t; | 100 | _version = t; |
99 | // }else if ( n == "Pre-Depends") | 101 | // }else if ( n == "Pre-Depends") |
100 | // { | 102 | // { |
101 | // | 103 | // |
102 | // }else if ( n == "Depends") | 104 | // }else if ( n == "Depends") |
103 | // { | 105 | // { |
104 | 106 | ||
105 | }else if ( n == "Filename") | 107 | }else if ( n == "Filename") |
106 | { | 108 | { |
107 | _fileName = t; | 109 | _fileName = t; |
108 | // }else if ( n == "Size") | 110 | // }else if ( n == "Size") |
109 | // { | 111 | // { |
110 | // | 112 | // |
111 | //}else if ( n == "MD5Sum") | 113 | //}else if ( n == "MD5Sum") |
112 | //{ | 114 | //{ |
113 | 115 | ||
114 | }else if ( n == "Description") | 116 | }else if ( n == "Description") |
115 | { | 117 | { |
116 | setDesc( t ); | 118 | setDesc( t ); |
117 | }else if ( n == "Status") | 119 | }else if ( n == "Status") |
118 | { | 120 | { |
119 | if ( installed() ) return; | 121 | if ( installed() ) return; |
120 | _status = t; | 122 | _status = t; |
121 | // }else if ( n == "Essential") | 123 | // }else if ( n == "Essential") |
122 | // { | 124 | // { |
123 | 125 | ||
124 | }else{ | 126 | }else{ |
125 | _values.insert(n,new QString(t)); | 127 | _values.insert(n,new QString(t)); |
126 | } | 128 | } |
127 | } | 129 | } |
128 | 130 | ||
129 | QString Package::name() | 131 | QString Package::name() |
130 | { | 132 | { |
131 | if (_displayName.isEmpty() ) return _name; | 133 | if (_displayName.isEmpty() ) return _name; |
132 | else return _displayName; | 134 | else return _displayName; |
133 | } | 135 | } |
134 | 136 | ||
135 | 137 | ||
136 | QString Package::installName() | 138 | QString Package::installName() |
137 | { | 139 | { |
138 | if (_useFileName) return _fileName; | 140 | if (_useFileName) return _fileName; |
139 | else return _name; | 141 | else return _name; |
140 | } | 142 | } |
141 | 143 | ||
142 | QString Package::packageName() | 144 | QString Package::packageName() |
143 | { | 145 | { |
144 | QString pn = installName(); | 146 | QString pn = installName(); |
145 | pn = pn.right(pn.length()-pn.findRev("/")); | 147 | pn = pn.right(pn.length()-pn.findRev("/")); |
146 | pn = pn.left(pn.find("_")); | 148 | pn = pn.left(pn.find("_")); |
147 | return pn; | 149 | return pn; |
148 | } | 150 | } |
149 | 151 | ||
150 | bool Package::installed() | 152 | bool Package::installed() |
151 | { | 153 | { |
152 | if (_status.contains("installed")) | 154 | if (_status.contains("installed")) |
153 | { | 155 | { |
154 | if (_status.contains("not-installed")) | 156 | if (_status.contains("not-installed")) |
155 | { | 157 | { |
156 | _toProcess = true; | 158 | _toProcess = true; |
157 | return false; | 159 | return false; |
158 | } | 160 | } |
159 | else return true; | 161 | else return true; |
160 | } | 162 | } |
161 | else | 163 | else |
162 | if (_versions) | 164 | if (_versions) |
163 | { | 165 | { |
164 | QDictIterator<Package> other( *_versions ); | 166 | QDictIterator<Package> other( *_versions ); |
165 | while ( other.current() ) | 167 | while ( other.current() ) |