-rw-r--r-- | noncore/unsupported/oipkg/TODO | 6 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 26 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettingsbase.ui | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 178 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 18 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 4 |
12 files changed, 157 insertions, 104 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 714baa4..d81e873 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,8 +1,10 @@ | |||
1 | * search | 1 | * search |
2 | * parse "to install" and "to remove" from status | ||
3 | * Settings Class | 2 | * Settings Class |
3 | * make oipkg determine dest of "to remove" apps | ||
4 | * tr() ;) | ||
4 | * Dialog to display ipkg output live | 5 | * Dialog to display ipkg output live |
6 | * parse "to install" and "to remove" from status | ||
5 | * install local file | 7 | * install local file |
6 | * make oipkg determine dest of to remove apps | 8 | * install to dest with click on packet |
7 | * error handling | 9 | * error handling |
8 | * manage links | 10 | * manage links |
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp index 264fd55..4af59b0 100644 --- a/noncore/unsupported/oipkg/main.cpp +++ b/noncore/unsupported/oipkg/main.cpp | |||
@@ -4,14 +4,14 @@ | |||
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | int debugLevel; | 6 | int debugLevel; |
7 | 7 | ||
8 | int main( int argc, char ** argv ) | 8 | int main( int argc, char ** argv ) |
9 | { | 9 | { |
10 | debugLevel = 1; | 10 | debugLevel = 2; |
11 | if (argc > 2) | 11 | if (argc > 0) |
12 | { | 12 | { |
13 | debugLevel = QString ( argv[1] ).toInt(); | 13 | debugLevel = QString ( argv[1] ).toInt(); |
14 | } | 14 | } |
15 | QPEApplication a( argc, argv ); | 15 | QPEApplication a( argc, argv ); |
16 | MainWindow mw; | 16 | MainWindow mw; |
17 | a.showMainDocumentWidget( &mw ); | 17 | a.showMainDocumentWidget( &mw ); |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index b485a03..cb2b4cd 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -48,13 +48,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
48 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 48 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
49 | 49 | ||
50 | settings = new PackageManagerSettings(this,0,TRUE); | 50 | settings = new PackageManagerSettings(this,0,TRUE); |
51 | 51 | ||
52 | ipkg = new PmIpkg( settings, this ); | 52 | ipkg = new PmIpkg( settings, this ); |
53 | packageList.setSettings( settings ); | 53 | packageList.setSettings( settings ); |
54 | newList(); | 54 | getList(); |
55 | setSections(); | 55 | setSections(); |
56 | setSubSections(); | 56 | setSubSections(); |
57 | displayList(); | 57 | displayList(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void MainWindow::makeMenu() | 60 | void MainWindow::makeMenu() |
@@ -63,12 +63,19 @@ void MainWindow::makeMenu() | |||
63 | QPEToolBar *toolBar = new QPEToolBar( this ); | 63 | QPEToolBar *toolBar = new QPEToolBar( this ); |
64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
66 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 66 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
67 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 67 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
68 | 68 | ||
69 | //#define TOOLBAR | ||
70 | #ifdef TOOLBAR | ||
71 | QPEToolBar *secBar = new QPEToolBar( this ); | ||
72 | QComboBox *sections = new QComboBox( false, this ); | ||
73 | secBar->addTo( sections ); | ||
74 | #endif | ||
75 | |||
69 | contextMenu = new QPopupMenu( this ); | 76 | contextMenu = new QPopupMenu( this ); |
70 | 77 | ||
71 | setToolBarsMovable( false ); | 78 | setToolBarsMovable( false ); |
72 | toolBar->setHorizontalStretchable( true ); | 79 | toolBar->setHorizontalStretchable( true ); |
73 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 80 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
74 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 81 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
@@ -131,25 +138,26 @@ MainWindow::~MainWindow() | |||
131 | { | 138 | { |
132 | } | 139 | } |
133 | 140 | ||
134 | void MainWindow::runIpkg() | 141 | void MainWindow::runIpkg() |
135 | { | 142 | { |
136 | ipkg->commit( packageList ); | 143 | ipkg->commit( packageList ); |
137 | ipkg->runIpkg("update"); | 144 | updateList(); |
138 | packageList.update(); | ||
139 | } | 145 | } |
140 | 146 | ||
141 | void MainWindow::updateList() | 147 | void MainWindow::updateList() |
142 | { | 148 | { |
143 | ipkg->runIpkg("update"); | 149 | // todo: packageList.clear(); |
144 | packageList.update(); | 150 | ipkg->update(); |
151 | getList(); | ||
145 | } | 152 | } |
146 | 153 | ||
147 | void MainWindow::newList() | 154 | void MainWindow::getList() |
148 | { | 155 | { |
149 | packageList.update(); | 156 | packageList.update(); |
157 | displayList(); | ||
150 | } | 158 | } |
151 | 159 | ||
152 | void MainWindow::filterList() | 160 | void MainWindow::filterList() |
153 | { | 161 | { |
154 | packageList.filterPackages(); | 162 | packageList.filterPackages(); |
155 | } | 163 | } |
@@ -214,23 +222,23 @@ void MainWindow::setSubSections() | |||
214 | } | 222 | } |
215 | 223 | ||
216 | 224 | ||
217 | void MainWindow::showSettings() | 225 | void MainWindow::showSettings() |
218 | { | 226 | { |
219 | if ( settings->showDialog( 0 ) ) | 227 | if ( settings->showDialog( 0 ) ) |
220 | newList(); | 228 | getList(); |
221 | } | 229 | } |
222 | void MainWindow::showSettingsSrv() | 230 | void MainWindow::showSettingsSrv() |
223 | { | 231 | { |
224 | if ( settings->showDialog( 1 ) ) | 232 | if ( settings->showDialog( 1 ) ) |
225 | newList(); | 233 | getList(); |
226 | } | 234 | } |
227 | void MainWindow::showSettingsDst() | 235 | void MainWindow::showSettingsDst() |
228 | { | 236 | { |
229 | if ( settings->showDialog( 2 ) ) | 237 | if ( settings->showDialog( 2 ) ) |
230 | newList(); | 238 | getList(); |
231 | } | 239 | } |
232 | 240 | ||
233 | 241 | ||
234 | void MainWindow::showDetails() | 242 | void MainWindow::showDetails() |
235 | { | 243 | { |
236 | if ( activePackage ) return; | 244 | if ( activePackage ) return; |
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 77604fd..95dcc90 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -25,13 +25,13 @@ public: | |||
25 | protected: | 25 | protected: |
26 | PackageWindow *table; | 26 | PackageWindow *table; |
27 | 27 | ||
28 | 28 | ||
29 | protected slots: | 29 | protected slots: |
30 | void runIpkg(); | 30 | void runIpkg(); |
31 | void newList(); | 31 | void getList(); |
32 | void updateList(); | 32 | void updateList(); |
33 | void filterList(); | 33 | void filterList(); |
34 | void displayList(); | 34 | void displayList(); |
35 | void subSectionChanged(); | 35 | void subSectionChanged(); |
36 | void sectionChanged(); | 36 | void sectionChanged(); |
37 | void showSettings(); | 37 | void showSettings(); |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 04230f5..c61af0f 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | #CONFIG = qt warn_on debug | 4 | CONFIG = qt warn_on debug |
5 | HEADERS = mainwindow.h \ | 5 | HEADERS = mainwindow.h \ |
6 | pksettings.h \ | 6 | pksettings.h \ |
7 | pmipkg.h \ | 7 | pmipkg.h \ |
8 | packagelistitem.h \ | 8 | packagelistitem.h \ |
9 | packagelist.h \ | 9 | packagelist.h \ |
10 | package.h | 10 | package.h |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 82ea1c8..e317308 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -153,13 +153,13 @@ bool Package::toInstall() | |||
153 | if ( _toProcess && !installed() ) return true; | 153 | if ( _toProcess && !installed() ) return true; |
154 | else return false; | 154 | else return false; |
155 | } | 155 | } |
156 | 156 | ||
157 | void Package::toggleProcess() | 157 | void Package::toggleProcess() |
158 | { | 158 | { |
159 | _toProcess = !(_toProcess); | 159 | _toProcess = ! _toProcess; |
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | 163 | ||
164 | void Package::copyValues( Package* pack ) | 164 | void Package::copyValues( Package* pack ) |
165 | { | 165 | { |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index d72ef75..5f6934d 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -202,14 +202,15 @@ void PackageList::update() | |||
202 | parseStatus(); | 202 | parseStatus(); |
203 | pvDebug( 3, "parseList"); | 203 | pvDebug( 3, "parseList"); |
204 | parseList(); | 204 | parseList(); |
205 | pvDebug( 3, "finished parsing"); | 205 | pvDebug( 3, "finished parsing"); |
206 | } | 206 | } |
207 | 207 | ||
208 | |||
209 | |||
210 | /** No descriptions */ | ||
211 | void PackageList::setSettings( PackageManagerSettings *s ) | 208 | void PackageList::setSettings( PackageManagerSettings *s ) |
212 | { | 209 | { |
213 | settings = s; | 210 | settings = s; |
214 | } | 211 | } |
215 | 212 | ||
213 | Package* PackageList::getByName( QString n ) | ||
214 | { | ||
215 | origPackageList[n]; | ||
216 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index eda8d22..68b89f0 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -23,12 +23,14 @@ public: | |||
23 | Package* first(); | 23 | Package* first(); |
24 | 24 | ||
25 | QStringList getSections(); | 25 | QStringList getSections(); |
26 | QStringList getSubSections(); | 26 | QStringList getSubSections(); |
27 | void setSettings( PackageManagerSettings* ); | 27 | void setSettings( PackageManagerSettings* ); |
28 | void filterPackages(); | 28 | void filterPackages(); |
29 | /** No descriptions */ | ||
30 | Package* getByName( QString ); | ||
29 | 31 | ||
30 | public slots: | 32 | public slots: |
31 | void setSection(QString); | 33 | void setSection(QString); |
32 | void setSubSection(QString); | 34 | void setSubSection(QString); |
33 | void update(); | 35 | void update(); |
34 | 36 | ||
diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui index 2efd2f3..ea507a8 100644 --- a/noncore/unsupported/oipkg/pksettingsbase.ui +++ b/noncore/unsupported/oipkg/pksettingsbase.ui | |||
@@ -8,13 +8,13 @@ | |||
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>357</width> | 14 | <width>353</width> |
15 | <height>454</height> | 15 | <height>454</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Package Servers</string> | 20 | <string>Package Servers</string> |
@@ -295,13 +295,13 @@ | |||
295 | <property stdset="1"> | 295 | <property stdset="1"> |
296 | <name>name</name> | 296 | <name>name</name> |
297 | <cstring>newsetting</cstring> | 297 | <cstring>newsetting</cstring> |
298 | </property> | 298 | </property> |
299 | <property stdset="1"> | 299 | <property stdset="1"> |
300 | <name>enabled</name> | 300 | <name>enabled</name> |
301 | <bool>true</bool> | 301 | <bool>false</bool> |
302 | </property> | 302 | </property> |
303 | <property stdset="1"> | 303 | <property stdset="1"> |
304 | <name>text</name> | 304 | <name>text</name> |
305 | <string>New</string> | 305 | <string>New</string> |
306 | </property> | 306 | </property> |
307 | <property stdset="1"> | 307 | <property stdset="1"> |
@@ -314,13 +314,13 @@ | |||
314 | <property stdset="1"> | 314 | <property stdset="1"> |
315 | <name>name</name> | 315 | <name>name</name> |
316 | <cstring>renamesetting</cstring> | 316 | <cstring>renamesetting</cstring> |
317 | </property> | 317 | </property> |
318 | <property stdset="1"> | 318 | <property stdset="1"> |
319 | <name>enabled</name> | 319 | <name>enabled</name> |
320 | <bool>true</bool> | 320 | <bool>false</bool> |
321 | </property> | 321 | </property> |
322 | <property stdset="1"> | 322 | <property stdset="1"> |
323 | <name>text</name> | 323 | <name>text</name> |
324 | <string>Rename</string> | 324 | <string>Rename</string> |
325 | </property> | 325 | </property> |
326 | </widget> | 326 | </widget> |
@@ -329,13 +329,13 @@ | |||
329 | <property stdset="1"> | 329 | <property stdset="1"> |
330 | <name>name</name> | 330 | <name>name</name> |
331 | <cstring>removesetting</cstring> | 331 | <cstring>removesetting</cstring> |
332 | </property> | 332 | </property> |
333 | <property stdset="1"> | 333 | <property stdset="1"> |
334 | <name>enabled</name> | 334 | <name>enabled</name> |
335 | <bool>true</bool> | 335 | <bool>false</bool> |
336 | </property> | 336 | </property> |
337 | <property stdset="1"> | 337 | <property stdset="1"> |
338 | <name>text</name> | 338 | <name>text</name> |
339 | <string>Remove</string> | 339 | <string>Remove</string> |
340 | </property> | 340 | </property> |
341 | <property stdset="1"> | 341 | <property stdset="1"> |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 528365e..681f2d4 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -21,163 +21,199 @@ | |||
21 | 21 | ||
22 | #include "mainwindow.h" | 22 | #include "mainwindow.h" |
23 | #include "runwindow.h" | 23 | #include "runwindow.h" |
24 | 24 | ||
25 | 25 | ||
26 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 26 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
27 | : RunWindow ( p, name, f ) | 27 | // : RunWindow ( p, name, f ) |
28 | //: QObject ( p ) | 28 | : QObject ( p ) |
29 | { | 29 | { |
30 | settings = s; | 30 | settings = s; |
31 | 31 | runwindow = new RunWindow ( p, name, f ); | |
32 | linkDest = new QCopChannel( "QPE/MakeLinks", this ); | 32 | linkDest = new QCopChannel( "QPE/MakeLinks", this ); |
33 | connect( linkDest, SIGNAL(received(const QCString &, const QByteArray &)), | 33 | connect( linkDest, SIGNAL(received(const QCString &, const QByteArray &)), |
34 | this, SLOT(linkDestination( const QString &, const QString&)) ); | 34 | this, SLOT(linkDestination( const QString &, const QByteArray&)) ); |
35 | } | 35 | } |
36 | 36 | ||
37 | PmIpkg::~PmIpkg() | 37 | PmIpkg::~PmIpkg() |
38 | { | 38 | { |
39 | } | 39 | } |
40 | 40 | ||
41 | //#define PROC | ||
42 | #define SYSTEM | ||
41 | int PmIpkg::runIpkg(const QString& args) | 43 | int PmIpkg::runIpkg(const QString& args) |
42 | { | 44 | { |
43 | pvDebug(4,"PmIpkg::runIpkg"); | 45 | pvDebug(2,"PmIpkg::runIpkg "+args); |
46 | #ifdef PROC | ||
47 | QStringList cmd = "/usr/bin/ipkg "; | ||
48 | #endif | ||
49 | #ifdef SYSTEM | ||
44 | QString cmd = "/usr/bin/ipkg "; | 50 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | ||
45 | cmd += " -dest "+settings->getDestinationName(); | 52 | cmd += " -dest "+settings->getDestinationName(); |
46 | cmd += " -force-defaults "; | 53 | cmd += " -force-defaults "; |
47 | 54 | ||
48 | outPut->setText( outPut->text()+"<br><br>Starting to "+ args+"<br>\n"); | 55 | out( "Starting to "+ args+"<br>\n"); |
49 | QString redirect = "/tmp/ipkg.pipe"; | 56 | cmd += args; |
50 | cmd += args+" | tee "+redirect+" 2>&1&"; | 57 | out( "running:<br>\n"+cmd+"<br>\n" ); |
51 | 58 | int r = 0; | |
52 | outPut->setText( outPut->text() + "running:<br>\n"+cmd+"<br>\n" ); | 59 | #ifdef PROC |
53 | pvDebug( 0, "Execute >"+cmd+"<" ); | 60 | QString o = "start"; |
54 | int r = system(cmd.latin1()); | 61 | Process ipkg( cmd ); |
62 | QString description; | ||
63 | ipkg.exec("",o); | ||
64 | out( o ); | ||
65 | #endif | ||
66 | #ifdef SYSTEM | ||
67 | QString redirect = "/tmp/oipkg.pipe"; | ||
68 | cmd += " | tee "+redirect+" 2>&1"; | ||
69 | r = system(cmd.latin1()); | ||
55 | QFile f( redirect ); | 70 | QFile f( redirect ); |
56 | if ( f.open(IO_ReadOnly) ) { | 71 | while ( ! f.open(IO_ReadOnly) ) {}; |
72 | // if ( f.open(IO_ReadOnly) ) {}; | ||
73 | { | ||
57 | QTextStream t( &f ); | 74 | QTextStream t( &f ); |
58 | QString fp; | 75 | QString fp; |
59 | while ( !t.eof() ) | 76 | while ( !t.eof() ) |
60 | { | ||
61 | outPut->setText( outPut->text() + t.readLine() +"\n<br>" ); | ||
62 | } | ||
63 | } | ||
64 | f.close(); | ||
65 | outPut->setText( outPut->text() + "\n<br><br>Finished!"); | ||
66 | outPut->setContentsPos(0,outPut->contentsHeight()); | ||
67 | |||
68 | if ( r == 0 ) | ||
69 | { | 77 | { |
70 | QString param = args.left( args.find(" ") ); | 78 | out( t.readLine() +"<br>" ); |
71 | QString file = args.right( args.length() - args.find(" ") ); | ||
72 | if ( param == "install" && settings->createLinks() ) | ||
73 | makeLinks( file); | ||
74 | } | 79 | } |
80 | } | ||
81 | f.close(); | ||
82 | out( "Finished!<br>"); | ||
83 | #endif | ||
75 | 84 | ||
76 | return r; | 85 | return r; |
77 | } | 86 | } |
78 | 87 | ||
79 | void PmIpkg::makeLinks(QString file) | 88 | void PmIpkg::makeLinks(QString file) |
80 | { | 89 | { |
81 | outPut->setText( outPut->text() + "<br>creating links<br>" ); | 90 | out( "<br>creating links<br>" ); |
82 | QString dest = settings->getDestinationUrl(); | 91 | QString dest = settings->getDestinationUrl(); |
83 | system(("ipkg -d "+dest+" files "+file+"> /tmp/oipkg.pipe").latin1()); | 92 | out("for package "+file+" in "+dest+"<br>"); |
93 | system(("ipkg -d "+dest+" files "+file+"> /tmp/oipkg.pipe 2>&1").latin1()); | ||
84 | QFile f( "/tmp/oipkg.pipe" ); | 94 | QFile f( "/tmp/oipkg.pipe" ); |
85 | if ( ! f.open(IO_ReadOnly) )return; | 95 | while ( ! f.open(IO_ReadOnly) ) {}; |
86 | QTextStream t( &f ); | 96 | QTextStream t( &f ); |
87 | QString fp; | 97 | QString fp; |
88 | while ( !t.eof() ) | 98 | while ( !t.eof() ) |
89 | { | 99 | { |
90 | processLinkDir( t.readLine(), dest ); | 100 | fp = t.readLine(); |
101 | processLinkDir( fp, dest ); | ||
91 | } | 102 | } |
92 | f.close(); | 103 | f.close(); |
93 | } | 104 | } |
94 | 105 | ||
95 | void PmIpkg::processLinkDir( QString file, QString dest ) | 106 | void PmIpkg::processLinkDir( QString file, QString dest ) |
96 | { | 107 | { |
97 | QString destFile = file.right( file.length() - dest.length() ); | 108 | QString destFile = file.right( file.length() - dest.length() ); |
98 | QFileInfo fileInfo( file ); | 109 | QFileInfo fileInfo( file ); |
99 | if ( fileInfo.isFile() ) | ||
100 | { | ||
101 | const char *instFile = strdup( (file).ascii() ); | ||
102 | const char *linkFile = strdup( (destFile).ascii()); | ||
103 | outPut->setText( outPut->text() + "linking: "+file+" -> "+destFile ); | ||
104 | symlink( instFile, linkFile ); | ||
105 | } | ||
106 | if ( fileInfo.isDir() ) | 110 | if ( fileInfo.isDir() ) |
111 | { | ||
112 | QDir destDir( destFile ); | ||
113 | destDir.mkdir( destFile, true ); | ||
114 | QDir d( file ); | ||
115 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | ||
116 | const QFileInfoList *list = d.entryInfoList(); | ||
117 | QFileInfoListIterator it( *list ); | ||
118 | QFileInfo *fi; | ||
119 | while ( (fi=it.current()) ) | ||
107 | { | 120 | { |
108 | QDir destDir( destFile ); | 121 | out( "<b>"+fi->absFilePath()+"</b>" ); |
109 | destDir.mkdir( destFile, true ); | 122 | processLinkDir( fi->absFilePath(), dest ); |
110 | QDir d( file ); | 123 | ++it; |
111 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | ||
112 | |||
113 | const QFileInfoList *list = d.entryInfoList(); | ||
114 | QFileInfoListIterator it( *list ); | ||
115 | QFileInfo *fi; | ||
116 | while ( (fi=it.current()) ) { | ||
117 | processLinkDir( fi->absFilePath(), dest ); | ||
118 | ++it; | ||
119 | } | ||
120 | } | 124 | } |
125 | } else | ||
126 | if ( fileInfo.isFile() ) | ||
127 | { | ||
128 | const char *instFile = strdup( (file).ascii() ); | ||
129 | const char *linkFile = strdup( (destFile).ascii()); | ||
130 | out( "linking: "+file+" -> "+destFile ); | ||
131 | qDebug( "linking: %s -> %s", instFile, linkFile ); | ||
132 | symlink( instFile, linkFile ); | ||
133 | } | ||
121 | } | 134 | } |
122 | 135 | ||
123 | void PmIpkg::commit( PackageList pl ) | 136 | void PmIpkg::commit( PackageList pl ) |
124 | { | 137 | { |
125 | showMaximized(); | 138 | runwindow->showMaximized(); |
126 | exec(); | 139 | // exec(); |
127 | outPut->setText( "<b>Starting...</b><br>\n"); | 140 | runwindow->outPut->setText(""); |
141 | out( "<h1>Starting...</h1><br>\n"); | ||
128 | QStringList to_remove, to_install; | 142 | QStringList to_remove, to_install; |
129 | 143 | ||
130 | QString rem="To remove:<br>\n"; | 144 | QString rem="<b>To remove:</b><br>\n"; |
131 | QString inst="To install:<br>\n";; | 145 | QString inst="<b>To install:</b><br>\n";; |
132 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 146 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
133 | { | 147 | { |
134 | if ( pack && (pack->name() != "") && pack) | 148 | if ( pack && (pack->name() != "") && pack) |
135 | { | 149 | { |
136 | if ( pack->toInstall() ) | 150 | if ( pack->toInstall() ) |
137 | { | 151 | { |
138 | to_install.append( pack->name() ); | 152 | to_install.append( pack->name() ); |
139 | inst += pack->name()+"\n"; | 153 | inst += pack->name()+"<br>"; |
140 | } | 154 | } |
141 | if ( pack->toRemove() ) | 155 | if ( pack->toRemove() ) |
142 | { | 156 | { |
143 | to_remove.append( pack->name() ); | 157 | to_remove.append( pack->name() ); |
144 | rem += pack->name()+"\n"; | 158 | rem += pack->name()+"<br>"; |
145 | } | 159 | } |
146 | } | 160 | } |
147 | } | 161 | } |
148 | 162 | ||
149 | outPut->setText( outPut->text()+inst+rem); | 163 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p>"); |
150 | bool ok=TRUE; | 164 | bool ok=TRUE; |
151 | 165 | ||
152 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); | 166 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); |
153 | 167 | ||
154 | int jobs = to_remove.count()+to_install.count(); | 168 | int jobs = to_remove.count()+to_install.count(); |
155 | if ( jobs < 1 ) return; | 169 | if ( jobs < 1 ) return; |
156 | 170 | ||
157 | if ( to_remove.count() ) | 171 | if ( to_remove.count() ) |
158 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) | 172 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) |
159 | if ( runIpkg("remove " + *it) != 0 ) ok = false; | 173 | if ( runIpkg("remove " + *it) != 0 ) ok = false; |
160 | if ( to_install.count() ) | 174 | if ( to_install.count() ) |
161 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) | 175 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) |
162 | if ( runIpkg("install " + *it) != 0 ) ok = false; | 176 | { |
177 | if ( runIpkg("install " + *it) == 0 ) | ||
178 | { | ||
179 | if ( settings->createLinks() ) | ||
180 | makeLinks( *it ); | ||
181 | }else{ | ||
182 | ok = false; | ||
183 | } | ||
184 | } | ||
163 | 185 | ||
164 | // ##### If we looked in the list of files, we could send out accurate | 186 | // ##### If we looked in the list of files, we could send out accurate |
165 | // ##### messages. But we don't bother yet, and just do an "all". | 187 | // ##### messages. But we don't bother yet, and just do an "all". |
166 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 188 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
167 | QString lf = QString::null; | 189 | QString lf = QString::null; |
168 | e << lf; | 190 | e << lf; |
169 | } | 191 | } |
170 | 192 | ||
171 | void PmIpkg::linkDestination( QString src, QString dest ) | 193 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
194 | // add 3rd package parameter | ||
172 | { | 195 | { |
173 | QDir d( src ); | 196 | qDebug("msg="+msg+" -- "+QString(dest) ); |
174 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 197 | // QDir d( src ); |
175 | if (! d.exists() ) return; | 198 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
176 | const QFileInfoList *list = d.entryInfoList(); | 199 | //// if (! d.exists() ) return; |
177 | QFileInfoListIterator it( *list ); | 200 | // const QFileInfoList *list = d.entryInfoList(); |
178 | QFileInfo *fi; | 201 | // QFileInfoListIterator it( *list ); |
179 | while ( (fi=it.current()) ) { | 202 | // QFileInfo *fi; |
180 | processLinkDir( fi->absFilePath(), dest ); | 203 | // while ( (fi=it.current()) ) { |
181 | ++it; | 204 | // processLinkDir( fi->absFilePath(), dest ); |
182 | } | 205 | // ++it; |
206 | // } | ||
207 | } | ||
208 | |||
209 | void PmIpkg::update() | ||
210 | { | ||
211 | runwindow->showMaximized(); | ||
212 | runIpkg( "update" ); | ||
213 | } | ||
214 | |||
215 | void PmIpkg::out( QString o ) | ||
216 | { | ||
217 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | ||
218 | runwindow->outPut->setContentsPos(0,runwindow->outPut->contentsHeight()); | ||
183 | } | 219 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 98efaa6..e6486ff 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -7,36 +7,40 @@ | |||
7 | #include <qwidget.h> | 7 | #include <qwidget.h> |
8 | #include "pksettings.h" | 8 | #include "pksettings.h" |
9 | #include "runwindow.h" | 9 | #include "runwindow.h" |
10 | #include "packagelist.h" | 10 | #include "packagelist.h" |
11 | #include "debug.h" | 11 | #include "debug.h" |
12 | 12 | ||
13 | //#define DIA | ||
13 | 14 | ||
14 | #include <qpe/qcopenvelope_qws.h> | 15 | #include <qpe/qcopenvelope_qws.h> |
15 | 16 | ||
16 | class PmIpkg : public RunWindow | 17 | |
17 | //class PmIpkg : public QObject | 18 | //class PmIpkg : public RunWindow |
19 | class PmIpkg : public QObject | ||
18 | { | 20 | { |
19 | Q_OBJECT | 21 | Q_OBJECT |
20 | public: | 22 | public: |
21 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
22 | //PmIpkg( QObject*, PackageManagerSettings* ); | 24 | //PmIpkg( QObject*, PackageManagerSettings* ); |
23 | ~PmIpkg(); | 25 | ~PmIpkg(); |
24 | 26 | ||
27 | void commit( PackageList ); | ||
28 | void update(); | ||
25 | PackageList* getPackageList(); | 29 | PackageList* getPackageList(); |
26 | 30 | ||
27 | private: | 31 | private: |
28 | PackageManagerSettings* settings; | 32 | PackageManagerSettings* settings; |
33 | RunWindow *runwindow; | ||
29 | QCopChannel *linkDest; | 34 | QCopChannel *linkDest; |
30 | void processLinkDir( QString, QString ); | ||
31 | |||
32 | 35 | ||
33 | public: | ||
34 | void makeLinks(QString); | 36 | void makeLinks(QString); |
37 | void processLinkDir( QString, QString ); | ||
38 | |||
35 | int runIpkg(const QString& args); | 39 | int runIpkg(const QString& args); |
36 | void commit( PackageList ); | 40 | void out( QString ); |
37 | 41 | ||
38 | public slots: | 42 | public slots: |
39 | void linkDestination( QString, QString ); | 43 | void linkDestination( const QString, const QByteArray ); |
40 | }; | 44 | }; |
41 | 45 | ||
42 | #endif | 46 | #endif |
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui index 23f58cf..9113f2d 100644 --- a/noncore/unsupported/oipkg/runwindow.ui +++ b/noncore/unsupported/oipkg/runwindow.ui | |||
@@ -8,13 +8,13 @@ | |||
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>201</width> | 14 | <width>197</width> |
15 | <height>291</height> | 15 | <height>291</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>running...</string> | 20 | <string>running...</string> |
@@ -39,13 +39,13 @@ | |||
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>progress</cstring> | 41 | <cstring>progress</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>progress</name> | 44 | <name>progress</name> |
45 | <number>0</number> | 45 | <number>42</number> |
46 | </property> | 46 | </property> |
47 | </widget> | 47 | </widget> |
48 | <widget row="1" column="0" > | 48 | <widget row="1" column="0" > |
49 | <class>QTextView</class> | 49 | <class>QTextView</class> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>name</name> | 51 | <name>name</name> |