summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO3
-rw-r--r--noncore/unsupported/oipkg/main.cpp3
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp10
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h2
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp3
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp127
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h2
8 files changed, 74 insertions, 77 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index b1ae6e3..6de54ec 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -1,14 +1,15 @@
1* Settings Class 1* Settings Class
2* tr() ;) 2* tr() ;)
3* Dialog to display ipkg output live 3* Dialog to display ipkg output live
4* parse "to install" and "to remove" from status 4* parse "to install" and "to remove" from status
5* install local file dialog 5* install local file dialog
6* qcop 6* qcop
7* error handling 7* error handling
8* manage links 8* manage links
9* dependency checking 9* dependency checking
10* create dest if it does not exist 10* create dest if it does not exist
11* allow reinstalling 11* allow reinstalling
12* different types of filters and searches 12* different types of filters and searches
13 i.e. name, desc, files etc 13 i.e. name, desc, files etc
14* mark packages from doclnk and ipkgfind installed if installed \ No newline at end of file 14* mark packages from doclnk and ipkgfind installed if installed
15* show if different version is installed \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp
index bacc973..4af11df 100644
--- a/noncore/unsupported/oipkg/main.cpp
+++ b/noncore/unsupported/oipkg/main.cpp
@@ -1,23 +1,24 @@
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>
7int debugLevel; 7int debugLevel;
8 8
9int main( int argc, char ** argv ) 9int main( int argc, char ** argv )
10{ 10{
11 11
12 debugLevel = 2; 12 debugLevel = 2;
13 if (argc > 0) 13 if (argc > 0)
14 { 14 {
15 debugLevel = QString ( argv[1] ).toInt(); 15 debugLevel = QString ( argv[1] ).toInt();
16 qDebug("setting debug level to %i",debugLevel);
16 } 17 }
17 QPEApplication a( argc, argv ); 18 QPEApplication a( argc, argv );
18 MainWindow mw; 19 MainWindow mw;
19 if (debugLevel < 4) 20 if (argc > 2)
20 QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); 21 QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!");
21 a.showMainDocumentWidget( &mw ); 22 a.showMainDocumentWidget( &mw );
22 return a.exec(); 23 return a.exec();
23} 24}
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 259a789..4f6e4cc 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -229,51 +229,51 @@ void MainWindow::makeMenu()
229 cfg.setGroup( "gui" ); 229 cfg.setGroup( "gui" );
230 230
231 findShow( cfg.readBoolEntry( "findBar", true ) ); 231 findShow( cfg.readBoolEntry( "findBar", true ) );
232 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 232 searchShow( cfg.readBoolEntry( "searchBar", true ) );
233 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 233 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
234 destShow( cfg.readBoolEntry( "destBar", false ) ); 234 destShow( cfg.readBoolEntry( "destBar", false ) );
235} 235}
236 236
237MainWindow::~MainWindow() 237MainWindow::~MainWindow()
238{ 238{
239 pvDebug(7,"MainWindow::~MainWindow "); 239 pvDebug(7,"MainWindow::~MainWindow ");
240 Config cfg( "oipkg", Config::User ); 240 Config cfg( "oipkg", Config::User );
241 cfg.setGroup( "gui" ); 241 cfg.setGroup( "gui" );
242 cfg.writeEntry( "findBar", !findBar->isHidden() ); 242 cfg.writeEntry( "findBar", !findBar->isHidden() );
243 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 243 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
244 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 244 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
245 cfg.writeEntry( "destBar", !destBar->isHidden() ); 245 cfg.writeEntry( "destBar", !destBar->isHidden() );
246 pvDebug(7,"MainWindow::~MainWindow "); 246 pvDebug(7,"MainWindow::~MainWindow ");
247 247
248} 248}
249 249
250void MainWindow::runIpkg() 250void MainWindow::runIpkg()
251{ 251{
252 packageListServers.allPackages(); 252 packageListServers.allPackages();
253 ipkg->loadList( packageListSearch ); 253 ipkg->loadList( &packageListSearch );
254 ipkg->loadList( packageListDocLnk ); 254 ipkg->loadList( &packageListDocLnk );
255 ipkg->loadList( packageListServers ); 255 ipkg->loadList( &packageListServers );
256 ipkg->commit(); 256 ipkg->commit();
257 // ##### If we looked in the list of files, we could send out accurate 257 // ##### If we looked in the list of files, we could send out accurate
258 // ##### messages. But we don't bother yet, and just do an "all". 258 // ##### messages. But we don't bother yet, and just do an "all".
259 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 259 QCopEnvelope e("QPE/System", "linkChanged(QString)");
260 QString lf = QString::null; 260 QString lf = QString::null;
261 e << lf; 261 e << lf;
262 displayList(); 262 displayList();
263} 263}
264 264
265void MainWindow::updateList() 265void MainWindow::updateList()
266{ 266{
267 //wait->show(); 267 //wait->show();
268 QTimer *t = new QTimer( this ); 268 QTimer *t = new QTimer( this );
269 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 269 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
270 t->start( 0, false ); 270 t->start( 0, false );
271 packageListServers.clear(); 271 packageListServers.clear();
272 packageListSearch.clear(); 272 packageListSearch.clear();
273 packageListDocLnk.clear(); 273 packageListDocLnk.clear();
274 ipkg->update(); 274 ipkg->update();
275 packageListServers.update(); 275 packageListServers.update();
276 packageListSearch.update(); 276 packageListSearch.update();
277 packageListDocLnk.update(); 277 packageListDocLnk.update();
278 t->stop(); 278 t->stop();
279 // wait->hide(); 279 // wait->hide();
@@ -401,49 +401,50 @@ void MainWindow::destShow(bool b)
401void MainWindow::destClose() 401void MainWindow::destClose()
402{ 402{
403 destAction->setOn( false ); 403 destAction->setOn( false );
404} 404}
405 405
406void MainWindow::rotateUpdateIcon() 406void MainWindow::rotateUpdateIcon()
407{ 407{
408 pvDebug(2, "MainWindow::rotateUpdateIcon"); 408 pvDebug(2, "MainWindow::rotateUpdateIcon");
409 if ( updateIcon ) 409 if ( updateIcon )
410 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); 410 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
411 else 411 else
412 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); 412 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) );
413 updateIcon = !updateIcon; 413 updateIcon = !updateIcon;
414} 414}
415 415
416 416
417void MainWindow::setDocument(const QString &fileName) 417void MainWindow::setDocument(const QString &fileName)
418{ 418{
419 installFile(fileName); 419 installFile(fileName);
420 // ##### If we looked in the list of files, we could send out accurate 420 // ##### If we looked in the list of files, we could send out accurate
421 // ##### messages. But we don't bother yet, and just do an "all". 421 // ##### messages. But we don't bother yet, and just do an "all".
422 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 422 QCopEnvelope e("QPE/System", "linkChanged(QString)");
423 QString lf = QString::null; 423 QString lf = QString::null;
424 e << lf; 424 e << lf;
425 displayList(); 425 // displayList();
426 exit;
426} 427}
427 428
428void MainWindow::installFile(const QString &fileName) 429void MainWindow::installFile(const QString &fileName)
429{ 430{
430 pvDebug(3, "MainWindow::installFile "+fileName); 431 pvDebug(3, "MainWindow::installFile "+fileName);
431 if ( !QFile::exists( fileName ) ) return; 432 if ( !QFile::exists( fileName ) ) return;
432 ipkg->installFile( fileName ); 433 ipkg->installFile( fileName );
433 // ##### If we looked in the list of files, we could send out accurate 434 // ##### If we looked in the list of files, we could send out accurate
434 // ##### messages. But we don't bother yet, and just do an "all". 435 // ##### messages. But we don't bother yet, and just do an "all".
435 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 436 QCopEnvelope e("QPE/System", "linkChanged(QString)");
436 QString lf = QString::null; 437 QString lf = QString::null;
437 e << lf; 438 e << lf;
438 displayList(); 439 displayList();
439} 440}
440 441
441void MainWindow::makeChannel() 442void MainWindow::makeChannel()
442 { 443 {
443 channel = new QCopChannel( "QPE/Application/oipkg", this ); 444 channel = new QCopChannel( "QPE/Application/oipkg", this );
444 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 445 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
445 this, SLOT(receive(const QCString&, const QByteArray&)) ); 446 this, SLOT(receive(const QCString&, const QByteArray&)) );
446} 447}
447 448
448 449
449 450
@@ -462,26 +463,27 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg)
462 }else if( msg == "removeLinks(QString)" ) 463 }else if( msg == "removeLinks(QString)" )
463 { 464 {
464 ipkg->removeLinks( QString(arg) ); 465 ipkg->removeLinks( QString(arg) );
465 }else{ 466 }else{
466 pvDebug(2,"Huh what do ya want") 467 pvDebug(2,"Huh what do ya want")
467 } 468 }
468} 469}
469 470
470 471
471void MainWindow::createLinks() 472void MainWindow::createLinks()
472{ 473{
473 pvDebug(2,"creating links..."); 474 pvDebug(2,"creating links...");
474 ipkg->createLinks( settings->destinationurl->text() ); 475 ipkg->createLinks( settings->destinationurl->text() );
475} 476}
476 477
477void MainWindow::removeLinks() 478void MainWindow::removeLinks()
478{ 479{
479 pvDebug(2,"removing links..."); 480 pvDebug(2,"removing links...");
480 ipkg->removeLinks( settings->destinationurl->text() ); 481 ipkg->removeLinks( settings->destinationurl->text() );
481} 482}
482 483
483void MainWindow::remotePackageQuery() 484void MainWindow::remotePackageQuery()
484{ 485{
485 packageListSearch.query( searchEdit->text() ); 486 packageListSearch.query( searchEdit->text() );
487 packageListSearch.update();
486 displayList(); 488 displayList();
487} 489}
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index f6023b0..7c93dad 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -48,49 +48,49 @@ public slots:
48 void sectionClose(); 48 void sectionClose();
49 void sectionShow(bool); 49 void sectionShow(bool);
50 void findClose(); 50 void findClose();
51 void findShow(bool); 51 void findShow(bool);
52 void searchClose(); 52 void searchClose();
53 void searchShow(bool); 53 void searchShow(bool);
54 void destClose(); 54 void destClose();
55 void destShow(bool); 55 void destShow(bool);
56 void filterList(); 56 void filterList();
57 void createLinks(); 57 void createLinks();
58 void removeLinks(); 58 void removeLinks();
59 void receive (const QCString &, const QByteArray &); 59 void receive (const QCString &, const QByteArray &);
60 void setDocument (const QString &); 60 void setDocument (const QString &);
61 void remotePackageQuery(); 61 void remotePackageQuery();
62 62
63private: 63private:
64 void makeMenu(); 64 void makeMenu();
65 void setSections(); 65 void setSections();
66 void setSubSections(); 66 void setSubSections();
67 void installFile(const QString &); 67 void installFile(const QString &);
68 bool updateIcon; 68 bool updateIcon;
69 69
70 PmIpkg* ipkg; 70 PmIpkg* ipkg;
71 PackageManagerSettings *settings; 71 PackageManagerSettings *settings;
72 PackageListLocal packageListServers; 72 PackageListLocal packageListServers;
73 PackageListRemote packageListSearch; 73 PackageListRemote packageListSearch;
74 PackageListDocLnk packageListDocLnk; 74 PackageListDocLnk packageListDocLnk;
75 PackageListView *listViewPackages; 75 PackageListView *listViewPackages;
76 QAction *runAction; 76 QAction *runAction;
77 QAction *updateAction; 77 QAction *updateAction;
78 QAction *findAction; 78 QAction *findAction;
79 QPEToolBar *findBar; 79 QPEToolBar *findBar;
80 QLineEdit *findEdit; 80 QLineEdit *findEdit;
81 QAction *searchAction; 81 QAction *searchAction;
82 QAction *searchCommit; 82 QAction *searchCommit;
83 QPEToolBar *searchBar; 83 QPEToolBar *searchBar;
84 QLineEdit *searchEdit; 84 QLineEdit *searchEdit;
85 QAction *sectionAction; 85 QAction *sectionAction;
86 QPEToolBar *sectionBar; 86 QPEToolBar *sectionBar;
87 QComboBox *section; 87 QComboBox *section;
88 QComboBox *subsection; 88 QComboBox *subsection;
89 QAction *destAction; 89 QAction *destAction;
90 QPEToolBar *destBar; 90 QPEToolBar *destBar;
91 QComboBox *destination; 91 QComboBox *destination;
92 QCheckBox* CheckBoxLink; 92 QCheckBox* CheckBoxLink;
93// QMessageBox *wait; 93// QMessageBox *wait;
94private slots: 94private slots:
95 void rotateUpdateIcon(); 95 void rotateUpdateIcon();
96}; 96};
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
index 5787fdf..1d10adf 100644
--- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp
+++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
@@ -1,43 +1,44 @@
1 1
2#include "packagelistdoclnk.h" 2#include "packagelistdoclnk.h"
3 3
4#include <qpe/applnk.h> 4#include <qpe/applnk.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qlist.h> 6#include <qlist.h>
7 7
8#include "package.h" 8#include "package.h"
9#include "pksettings.h" 9#include "pksettings.h"
10 10
11PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s) 11PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s)
12 : PackageList(s) 12 : PackageList(s)
13{ 13{
14 PackageListDocLnk(); 14 PackageListDocLnk();
15} 15}
16 16
17PackageListDocLnk::PackageListDocLnk() 17PackageListDocLnk::PackageListDocLnk()
18 : PackageList() 18 : PackageList()
19{ 19{
20 Config cfg( "oipkg", Config::User ); 20 Config cfg( "oipkg", Config::User );
21 cfg.setGroup( "Common" ); 21 cfg.setGroup( "Common" );
22 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); 22 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" );
23 pvDebug(2,"opening DocLnkSet "+docLnkDir);
23 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); 24 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg");
24} 25}
25 26
26PackageListDocLnk::~PackageListDocLnk() 27PackageListDocLnk::~PackageListDocLnk()
27{ 28{
28 Config cfg( "oipkg", Config::User ); 29 Config cfg( "oipkg", Config::User );
29 cfg.setGroup( "Common" ); 30 cfg.setGroup( "Common" );
30 cfg.writeEntry( "docLnkDir", docLnkDir ); 31 cfg.writeEntry( "docLnkDir", docLnkDir );
31} 32}
32 33
33 34
34 35
35void PackageListDocLnk::update() 36void PackageListDocLnk::update()
36{ 37{
37 pvDebug(2,"PackageListDocLnk::update "); 38 pvDebug(2,"PackageListDocLnk::update ");
38 QList<DocLnk> packlist = doclnkset->children(); 39 QList<DocLnk> packlist = doclnkset->children();
39 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) 40 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
40 { 41 {
41 insertPackage( new Package(pack->file(), settings) ); 42 insertPackage( new Package(pack->file(), settings) );
42 } 43 }
43} 44}
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp
index 3c6ede7..ee54fca 100644
--- a/noncore/unsupported/oipkg/packagelistremote.cpp
+++ b/noncore/unsupported/oipkg/packagelistremote.cpp
@@ -1,47 +1,48 @@
1 1
2#include "packagelistremote.h" 2#include "packagelistremote.h"
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <stdlib.h> 5#include <stdlib.h>
6#include <unistd.h> 6#include <unistd.h>
7 7
8PackageListRemote::PackageListRemote(PackageManagerSettings* s) 8PackageListRemote::PackageListRemote(PackageManagerSettings* s)
9 : PackageList(s) 9 : PackageList(s)
10{ 10{
11 PackageListRemote(); 11 PackageListRemote();
12} 12}
13 13
14PackageListRemote::PackageListRemote() 14PackageListRemote::PackageListRemote()
15 : PackageList() 15 : PackageList()
16{ 16{
17} 17}
18 18
19PackageListRemote::~PackageListRemote() 19PackageListRemote::~PackageListRemote()
20{ 20{
21} 21}
22 22
23void PackageListRemote::query(QString s) 23void PackageListRemote::query(QString s)
24{ 24{
25 pvDebug(4,"set query "+s);
25 searchString = s; 26 searchString = s;
26} 27}
27 28
28void PackageListRemote::update() 29void PackageListRemote::update()
29{ 30{
30 pvDebug(2,"PackageListRemote::update"); 31 pvDebug(2,"PackageListRemote::update");
31 int r=0; 32 int r=0;
32 QString cmd = "wget"; 33 QString cmd = "wget";
33 QString redirect = "/tmp/oipkg.query"; 34 QString redirect = "/tmp/oipkg.query";
34 35
35 // use file for output 36 // use file for output
36 cmd += " --output-document="+redirect; 37 cmd += " --output-document="+redirect;
37//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section= 38//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section=
38 QString server="http://ipkgfind.handhelds.org/"; 39 QString server="http://ipkgfind.handhelds.org/";
39 cmd += " \""+server+"/packages.phtml"; 40 cmd += " \""+server+"/packages.phtml";
40 cmd += "?format=pda&searchtype=package&section="; 41 cmd += "?format=pda&searchtype=package&section=";
41 cmd += "&query="+searchString; 42 cmd += "&query="+searchString;
42 cmd += "\""; 43 cmd += "\"";
43 44
44 pvDebug(4,"search :"+cmd); 45 pvDebug(4,"search :"+cmd);
45 r = system(cmd.latin1()); 46 r = system(cmd.latin1());
46 readFileEntries( redirect ); 47 readFileEntries( redirect );
47} 48}
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index fd8279b..0ae74da 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -23,81 +23,81 @@
23#include <stdlib.h> 23#include <stdlib.h>
24#include <unistd.h> 24#include <unistd.h>
25 25
26#include "mainwindow.h" 26#include "mainwindow.h"
27 27
28 28
29PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 29PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
30 : QObject ( p ) 30 : QObject ( p )
31{ 31{
32 settings = s; 32 settings = s;
33 runwindow = new RunWindow( p, name, true, f ); 33 runwindow = new RunWindow( p, name, true, f );
34} 34}
35 35
36PmIpkg::~PmIpkg() 36PmIpkg::~PmIpkg()
37{ 37{
38} 38}
39 39
40//#define PROC 40//#define PROC
41#define SYSTEM 41#define SYSTEM
42int PmIpkg::runIpkg(const QString& args, const QString& dest ) 42int PmIpkg::runIpkg(const QString& args, const QString& dest )
43{ 43{
44 pvDebug(2,"PmIpkg::runIpkg "+args); 44 pvDebug(2,"PmIpkg::runIpkg "+args);
45 45
46#ifdef PROC 46#ifdef PROC
47 QStringList cmd = "/usr/bin/ipkg "; 47 QStringList cmd = "ipkg ";
48#endif 48#endif
49#ifdef SYSTEM 49#ifdef SYSTEM
50 QString cmd = "/usr/bin/ipkg "; 50 QString cmd = "/usr/bin/ipkg ";
51#endif 51#endif
52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
53 if ( dest == "" ) 53 if ( dest == "" )
54 cmd += " -dest "+settings->getDestinationName(); 54 cmd += " -dest "+settings->getDestinationName();
55 else 55 else
56 cmd += " -dest "+ dest; 56 cmd += " -dest "+ dest;
57 57
58 cmd += " -force-defaults "; 58 cmd += " -force-defaults ";
59 59
60 if (installDialog->_force_depends) 60 if (installDialog->_force_depends)
61 { 61 {
62 if (installDialog->_force_depends->isChecked()) 62 if (installDialog->_force_depends->isChecked())
63 cmd += " -force-depends "; 63 cmd += " -force-depends ";
64 if (installDialog->_force_reinstall->isChecked()) 64 if (installDialog->_force_reinstall->isChecked())
65 cmd += " -force-reinstall "; 65 cmd += " -force-reinstall ";
66 if (installDialog->_force_remove->isChecked()) 66 if (installDialog->_force_remove->isChecked())
67 cmd += " -force-removal-of-essential-packages "; 67 cmd += " -force-removal-of-essential-packages ";
68 } 68 }
69 69
70 out( "<hr><br>Starting to "+ args+"<br>\n"); 70 out( "<hr><br>Starting to "+ args+"<br>\n");
71 cmd += args; 71 cmd += args;
72 int r = 0; 72 int r = 0;
73#ifdef PROC 73#ifdef PROC
74 QString o = "start"; 74 QString o = "start";
75 Process *ipkg = new Process( cmd ); 75 Process *ipkg = new Process( cmd );
76 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); 76 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
77 QString description; 77 QString description;
78 ipkg->exec("",o); 78 r = ipkg->exec("",o);
79// out( o ); 79 out( o );
80#endif 80#endif
81#ifdef SYSTEM 81#ifdef SYSTEM
82 out( "running:<br>\n"+cmd+"<br>\n" ); 82 out( "running:<br>\n"+cmd+"<br>\n" );
83 QString redirect = "/tmp/oipkg.pipe"; 83 QString redirect = "/tmp/oipkg.pipe";
84 cmd += " 2>&1 | tee "+redirect+" 2>&1"; 84 cmd += " 2>&1 | tee "+redirect+" 2>&1";
85 pvDebug(2, "running >"+cmd+"<"); 85 pvDebug(2, "running >"+cmd+"<");
86 r = system(cmd.latin1()); 86 r = system(cmd.latin1());
87 QFile f( redirect ); 87 QFile f( redirect );
88 QString line; 88 QString line;
89 QString oldLine; 89 QString oldLine;
90 while ( ! f.open(IO_ReadOnly) ) {}; 90 while ( ! f.open(IO_ReadOnly) ) {};
91 QTextStream t( &f ); 91 QTextStream t( &f );
92 while ( !t.eof() ) 92 while ( !t.eof() )
93 { 93 {
94 line = t.readLine(); 94 line = t.readLine();
95 if ( line != oldLine ) 95 if ( line != oldLine )
96 { 96 {
97 out( line +"<br>" ); 97 out( line +"<br>" );
98 oldLine = line; 98 oldLine = line;
99 } 99 }
100 } 100 }
101 f.close(); 101 f.close();
102 out( "Finished!<br>"); 102 out( "Finished!<br>");
103#endif 103#endif
@@ -156,194 +156,185 @@ void PmIpkg::processFileList( QStringList *fileList, QString d )
156 } 156 }
157} 157}
158 158
159 159
160void PmIpkg::processLinkDir( QString file, QString dest ) 160void PmIpkg::processLinkDir( QString file, QString dest )
161{ 161{
162 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 162 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
163 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 163 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
164 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 164 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
165 if ( dest == "???" || dest == "" ) return; 165 if ( dest == "???" || dest == "" ) return;
166 QString destFile = file; 166 QString destFile = file;
167 file = dest+"/"+file; 167 file = dest+"/"+file;
168 if (file == dest) return; 168 if (file == dest) return;
169 QFileInfo fileInfo( file ); 169 QFileInfo fileInfo( file );
170 if ( fileInfo.isDir() ) 170 if ( fileInfo.isDir() )
171 { 171 {
172 pvDebug(4, "process dir "+file); 172 pvDebug(4, "process dir "+file);
173 QDir destDir( destFile ); 173 QDir destDir( destFile );
174 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 174 if (linkOpp==createLink) destDir.mkdir( destFile, true );
175 QDir d( file ); 175 QDir d( file );
176// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 176// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
177 const QFileInfoList *list = d.entryInfoList(); 177 const QFileInfoList *list = d.entryInfoList();
178 QFileInfoListIterator it( *list ); 178 QFileInfoListIterator it( *list );
179 QFileInfo *fi; 179 QFileInfo *fi;
180 qDebug( "while %i",list->count());
181 while ( (fi=it.current()) ) 180 while ( (fi=it.current()) )
182 { 181 {
183 pvDebug(4, "processLinkDir "+fi->absFilePath()); 182 pvDebug(4, "processLinkDir "+fi->absFilePath());
184 processLinkDir( fi->absFilePath(), dest ); 183 processLinkDir( fi->absFilePath(), dest );
185 ++it; 184 ++it;
186 } 185 }
187 } else 186 } else
188 if ( fileInfo.isFile() ) 187 if ( fileInfo.isFile() )
189 { 188 {
190 const char *instFile = strdup( (file).ascii() ); 189 const char *instFile = strdup( (file).ascii() );
191 const char *linkFile = strdup( (destFile).ascii()); 190 const char *linkFile = strdup( (destFile).ascii());
192 if( linkOpp==createLink ) 191 if( linkOpp==createLink )
193 { 192 {
194 pvDebug(4, "linking: "+file+" -> "+destFile ); 193 pvDebug(4, "linking: "+file+" -> "+destFile );
195 symlink( instFile, linkFile ); 194 symlink( instFile, linkFile );
196 } 195 }
197 } else { 196 } else {
198 const char *linkFile = strdup( (destFile).ascii()); 197 const char *linkFile = strdup( (destFile).ascii());
199 if( linkOpp==removeLink ) 198 if( linkOpp==removeLink )
200 { 199 {
201 QFileInfo toRemoveLink( destFile ); 200 QFileInfo toRemoveLink( destFile );
202 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 201 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
203 { 202 {
204 pvDebug(4,"removing "+destFile+" no "+file); 203 pvDebug(4,"removing "+destFile+" no "+file);
205 unlink( linkFile ); 204 unlink( linkFile );
206 } 205 }
207 } 206 }
208 } 207 }
209} 208}
210 209
211void PmIpkg::loadList( PackageList pl ) 210void PmIpkg::loadList( PackageList *pl )
212 { 211 {
213 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 212 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
214 { 213 {
215 if ( pack && (pack->name() != "") && pack) 214 if ( pack && (pack->name() != "") && pack)
216 { 215 {
217 if ( pack->toInstall() ) 216 if ( pack->toInstall() )
218 to_install.append( pack ); 217 to_install.append( pack );
219 if ( pack->toRemove() ) 218 if ( pack->toRemove() )
220 to_remove.append( pack ); 219 to_remove.append( pack );
221 } 220 }
222 } 221 }
223} 222}
224 223
225void PmIpkg::commit() 224void PmIpkg::commit()
226 { 225 {
227 int sizecount = 0; 226 int sizecount = 0;
228 for (uint i=0; i < to_remove.count(); i++)
229 sizecount += 1;
230 for (uint i=0; i < to_install.count(); i++)
231 sizecount += to_install.at(i)->size().toInt();
232 runwindow->progress->setTotalSteps(sizecount);
233 startDialog();
234}
235
236void PmIpkg::startDialog()
237{
238 installDialog = new InstallDialog(settings,0,0,true); 227 installDialog = new InstallDialog(settings,0,0,true);
239 QCheckListItem *toRemoveItem; 228 QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") );
240 toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); 229 QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
241 toRemoveItem->setOpen( true ); 230 toRemoveItem->setOpen( true );
242 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 231 toInstallItem->setOpen( true );
232 for (uint i=0; i < to_remove.count(); i++)
243 { 233 {
244 toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); 234 sizecount += 1;
235 toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
245 } 236 }
246 QCheckListItem *toInstallItem; 237 for (uint i=0; i < to_install.count(); i++)
247 toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
248 toInstallItem->setOpen( true );
249 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
250 { 238 {
251 toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); 239 sizecount += to_install.at(i)->size().toInt();
240 toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
252 } 241 }
242 runwindow->progress->setTotalSteps(sizecount);
243 qDebug("Install size %i",sizecount);
253 installDialog->showMaximized(); 244 installDialog->showMaximized();
254 if ( installDialog->exec() ) doIt(); 245 if ( installDialog->exec() ) doIt();
255 installDialog->close(); 246 installDialog->close();
247 runwindow->showMaximized();
256 out(tr("<b>All done.</b>")); 248 out(tr("<b>All done.</b>"));
257 to_install.clear();
258} 249}
259 250
260void PmIpkg::doIt() 251void PmIpkg::doIt()
261{ 252{
262 show( true ); 253 show( true );
263 remove(); 254 remove();
264 install(); 255 install();
265} 256}
266 257
267 258
268void PmIpkg::remove() 259void PmIpkg::remove()
269{ 260{
270 if ( to_remove.count() == 0 ) return; 261 if ( to_remove.count() == 0 ) return;
271 262
272 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); 263 out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>");
273 264
274 QStringList *fileList; 265 QStringList *fileList;
275 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 266 for (uint i=0; i < to_remove.count(); i++)
276 { 267 {
277 if ( it->link() )fileList = getList( it->name(), it->dest() ); 268 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
278 if ( runIpkg("remove " + it->name(), it->dest() ) == 0) 269 if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0)
279 { 270 {
280 runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); 271 runwindow->progress->setProgress( 1 );
281 linkOpp = removeLink; 272 linkOpp = removeLink;
282 if ( it->link() ) 273 if ( to_remove.at(i)->link() )
283 { 274 {
284 out( "<br>removing links<br>" ); 275 out( "<br>removing links<br>" );
285 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 276 out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" );
286 processFileList( fileList, it->dest() ); 277 processFileList( fileList, to_remove.at(i)->dest() );
287 }
288 it->processed();
289 // to_install.take( it );
290 out("<br><hr>");
291 }else{
292 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
293 } 278 }
294 if ( it->link() )delete fileList; 279 to_remove.at(i)->processed();
280 to_remove.take( i );
281 out("<br><hr>");
282 }else{
283 out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name());
295 } 284 }
296 out("<br>"); 285 if ( to_remove.at(i)->link() )delete fileList;
286 }
287 to_remove.clear();
288 out("<br>");
297} 289}
298 290
299 291
300void PmIpkg::install() 292void PmIpkg::install()
301{ 293{
302 if ( to_install.count() == 0 ) return; 294 if ( to_install.count() == 0 ) return;
303 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 295 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
304 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 296 for (uint i=0; i < to_install.count(); i++)
305 { 297 {
306 298 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 )
307 if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) 299 {
308 { 300 runwindow->progress->setProgress( to_install.at(i)->size().toInt() );
309 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 301 linkOpp = createLink;
310 linkOpp = createLink; 302 if ( to_install.at(i)->link() )
311 if ( it->link() ) 303 {
312 { 304 out( "<br>creating links<br>" );
313 out( "<br>creating links<br>" ); 305 out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" );
314 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 306 makeLinks( to_install.at(i) );
315 makeLinks( it ); 307 }
316 } 308 to_install.at(i)->processed();
317 it->processed(); 309 to_install.take( i );
318 // to_install.take( it->name() ); 310 out("<br><hr>");
319 out("<br><hr>"); 311 }else{
320 }else{ 312 out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name());
321 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name());
322 }
323 } 313 }
324 out("<br>"); 314 }
325 to_install.clear(); 315 out("<br>");
316 to_install.clear();
326} 317}
327 318
328void PmIpkg::createLinks( const QString &dest ) 319void PmIpkg::createLinks( const QString &dest )
329{ 320{
330 pvDebug(2,"PmIpkg::createLinks "+dest); 321 pvDebug(2,"PmIpkg::createLinks "+dest);
331 linkOpp=createLink; 322 linkOpp=createLink;
332 QString url = settings->getDestinationUrlByName( dest ); 323 QString url = settings->getDestinationUrlByName( dest );
333 url = url==""?dest:url; 324 url = url==""?dest:url;
334 processLinkDir( "/opt", url ); 325 processLinkDir( "/opt", url );
335 processLinkDir( "/usr", url ); 326 processLinkDir( "/usr", url );
336} 327}
337 328
338void PmIpkg::removeLinks( const QString &dest ) 329void PmIpkg::removeLinks( const QString &dest )
339{ 330{
340 pvDebug(2,"PmIpkg::removeLinks "+dest); 331 pvDebug(2,"PmIpkg::removeLinks "+dest);
341 linkOpp=removeLink; 332 linkOpp=removeLink;
342 QString url = settings->getDestinationUrlByName( dest ); 333 QString url = settings->getDestinationUrlByName( dest );
343 url = url==""?dest:url; 334 url = url==""?dest:url;
344 processLinkDir( "/opt", url ); 335 processLinkDir( "/opt", url );
345 processLinkDir( "/usr", url ); 336 processLinkDir( "/usr", url );
346} 337}
347 338
348void PmIpkg::update() 339void PmIpkg::update()
349{ 340{
@@ -377,41 +368,41 @@ void PmIpkg::showButtons(bool b)
377 368
378 } 369 }
379} 370}
380 371
381void PmIpkg::show(bool b) 372void PmIpkg::show(bool b)
382{ 373{
383 if (!runwindow->isVisible()) 374 if (!runwindow->isVisible())
384 runwindow->showMaximized(); 375 runwindow->showMaximized();
385 showButtons(b); 376 showButtons(b);
386 if ( !b ) 377 if ( !b )
387 runwindow->progress->hide(); 378 runwindow->progress->hide();
388 else 379 else
389 runwindow->progress->show(); 380 runwindow->progress->show();
390} 381}
391 382
392void PmIpkg::installFile(const QString &fileName, const QString &dest) 383void PmIpkg::installFile(const QString &fileName, const QString &dest)
393{ 384{
394 385
395 to_install.clear(); 386 to_install.clear();
396 to_remove.clear(); 387 to_remove.clear();
397 pvDebug( 2,"PmIpkg::installFile "+ fileName); 388 pvDebug( 2,"PmIpkg::installFile "+ fileName);
398 Package *p = new Package(fileName,settings); 389 Package *p = new Package(fileName,settings);
399 if ( dest!="") p->setDest( dest ); 390 if ( dest!="") p->setDest( dest );
400 to_install.append( p ); 391 to_install.append( p );
401 startDialog(); 392 commit();
402 delete p; 393 delete p;
403} 394}
404 395
405void PmIpkg::removeFile(const QString &fileName, const QString &dest) 396void PmIpkg::removeFile(const QString &fileName, const QString &dest)
406{ 397{
407 398
408 to_install.clear(); 399 to_install.clear();
409 to_remove.clear(); 400 to_remove.clear();
410 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 401 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
411 Package *p = new Package(fileName,settings); 402 Package *p = new Package(fileName,settings);
412 if ( dest!="") p->setDest( dest ); 403 if ( dest!="") p->setDest( dest );
413 to_remove.append( p ); 404 to_remove.append( p );
414 startDialog(); 405 commit();
415 delete p; 406 delete p;
416} 407}
417 408
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index d2490e8..7bc62f1 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -3,49 +3,49 @@
3 3
4 4
5#include <qobject.h> 5#include <qobject.h>
6#include <qlist.h> 6#include <qlist.h>
7#include <qstring.h> 7#include <qstring.h>
8#include <qwidget.h> 8#include <qwidget.h>
9#include "pksettings.h" 9#include "pksettings.h"
10#include "runwindow.h" 10#include "runwindow.h"
11#include "packagelist.h" 11#include "packagelist.h"
12#include "installdialog.h" 12#include "installdialog.h"
13#include "debug.h" 13#include "debug.h"
14 14
15#define createLink 0 15#define createLink 0
16#define removeLink 1 16#define removeLink 1
17 17
18class Package; 18class Package;
19class PmIpkg : public QObject 19class PmIpkg : public QObject
20{ 20{
21 Q_OBJECT 21 Q_OBJECT
22public: 22public:
23 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 );
24 ~PmIpkg(); 24 ~PmIpkg();
25 25
26 int linkOpp; 26 int linkOpp;
27 void loadList( PackageList ); 27 void loadList( PackageList* );
28 void commit(); 28 void commit();
29 void update(); 29 void update();
30 void showButtons(bool b=true); 30 void showButtons(bool b=true);
31 void show( bool buttons=true ); 31 void show( bool buttons=true );
32 32
33public slots: 33public slots:
34 void doIt(); 34 void doIt();
35 void install(); 35 void install();
36 void remove(); 36 void remove();
37 void installFile(const QString &fileName, const QString &dest=""); 37 void installFile(const QString &fileName, const QString &dest="");
38 void removeFile(const QString &fileName, const QString &dest=""); 38 void removeFile(const QString &fileName, const QString &dest="");
39 void createLinks( const QString &dest ); 39 void createLinks( const QString &dest );
40 void removeLinks( const QString &dest ); 40 void removeLinks( const QString &dest );
41 41
42private: 42private:
43 PackageManagerSettings* settings; 43 PackageManagerSettings* settings;
44 RunWindow *runwindow; 44 RunWindow *runwindow;
45 InstallDialog *installDialog; 45 InstallDialog *installDialog;
46 QList<Package> to_remove; 46 QList<Package> to_remove;
47 QList<Package> to_install; 47 QList<Package> to_install;
48 QString fileNameToInstall; 48 QString fileNameToInstall;
49 QCheckBox *_force_reinstall; 49 QCheckBox *_force_reinstall;
50 QCheckBox *_force_remove; 50 QCheckBox *_force_remove;
51 QCheckBox *_force_depends; 51 QCheckBox *_force_depends;