summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO1
-rw-r--r--noncore/unsupported/oipkg/main.cpp3
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp10
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h0
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp1
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp89
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h2
8 files changed, 52 insertions, 55 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 @@
* Settings Class
* tr() ;)
* Dialog to display ipkg output live
* parse "to install" and "to remove" from status
* install local file dialog
* qcop
* error handling
* manage links
* dependency checking
* create dest if it does not exist
* allow reinstalling
* different types of filters and searches
i.e. name, desc, files etc
* mark packages from doclnk and ipkgfind installed if installed \ No newline at end of file
+* 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 @@
#include "mainwindow.h"
#include <qpe/qpeapplication.h>
#include <qstring.h>
#include <qmessagebox.h>
int debugLevel;
int main( int argc, char ** argv )
{
debugLevel = 2;
if (argc > 0)
{
debugLevel = QString ( argv[1] ).toInt();
+ qDebug("setting debug level to %i",debugLevel);
}
QPEApplication a( argc, argv );
MainWindow mw;
- if (debugLevel < 4)
+ if (argc > 2)
QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!");
a.showMainDocumentWidget( &mw );
return a.exec();
}
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()
cfg.setGroup( "gui" );
findShow( cfg.readBoolEntry( "findBar", true ) );
searchShow( cfg.readBoolEntry( "searchBar", true ) );
sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
destShow( cfg.readBoolEntry( "destBar", false ) );
}
MainWindow::~MainWindow()
{
pvDebug(7,"MainWindow::~MainWindow ");
Config cfg( "oipkg", Config::User );
cfg.setGroup( "gui" );
cfg.writeEntry( "findBar", !findBar->isHidden() );
cfg.writeEntry( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
cfg.writeEntry( "destBar", !destBar->isHidden() );
pvDebug(7,"MainWindow::~MainWindow ");
}
void MainWindow::runIpkg()
{
packageListServers.allPackages();
- ipkg->loadList( packageListSearch );
- ipkg->loadList( packageListDocLnk );
- ipkg->loadList( packageListServers );
+ ipkg->loadList( &packageListSearch );
+ ipkg->loadList( &packageListDocLnk );
+ ipkg->loadList( &packageListServers );
ipkg->commit();
// ##### If we looked in the list of files, we could send out accurate
// ##### messages. But we don't bother yet, and just do an "all".
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
displayList();
}
void MainWindow::updateList()
{
// wait->show();
QTimer *t = new QTimer( this );
connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
t->start( 0, false );
packageListServers.clear();
packageListSearch.clear();
packageListDocLnk.clear();
ipkg->update();
packageListServers.update();
packageListSearch.update();
packageListDocLnk.update();
t->stop();
// wait->hide();
@@ -401,49 +401,50 @@ void MainWindow::destShow(bool b)
void MainWindow::destClose()
{
destAction->setOn( false );
}
void MainWindow::rotateUpdateIcon()
{
pvDebug(2, "MainWindow::rotateUpdateIcon");
if ( updateIcon )
updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
else
updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) );
updateIcon = !updateIcon;
}
void MainWindow::setDocument(const QString &fileName)
{
installFile(fileName);
// ##### If we looked in the list of files, we could send out accurate
// ##### messages. But we don't bother yet, and just do an "all".
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
- displayList();
+ // displayList();
+ exit;
}
void MainWindow::installFile(const QString &fileName)
{
pvDebug(3, "MainWindow::installFile "+fileName);
if ( !QFile::exists( fileName ) ) return;
ipkg->installFile( fileName );
// ##### If we looked in the list of files, we could send out accurate
// ##### messages. But we don't bother yet, and just do an "all".
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
displayList();
}
void MainWindow::makeChannel()
{
channel = new QCopChannel( "QPE/Application/oipkg", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(receive(const QCString&, const QByteArray&)) );
}
@@ -462,26 +463,27 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg)
}else if( msg == "removeLinks(QString)" )
{
ipkg->removeLinks( QString(arg) );
}else{
pvDebug(2,"Huh what do ya want")
}
}
void MainWindow::createLinks()
{
pvDebug(2,"creating links...");
ipkg->createLinks( settings->destinationurl->text() );
}
void MainWindow::removeLinks()
{
pvDebug(2,"removing links...");
ipkg->removeLinks( settings->destinationurl->text() );
}
void MainWindow::remotePackageQuery()
{
packageListSearch.query( searchEdit->text() );
+ packageListSearch.update();
displayList();
}
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
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 @@
#include "packagelistdoclnk.h"
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qlist.h>
#include "package.h"
#include "pksettings.h"
PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s)
: PackageList(s)
{
PackageListDocLnk();
}
PackageListDocLnk::PackageListDocLnk()
: PackageList()
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
docLnkDir = cfg.readEntry( "docLnkDir", "/root/" );
+ pvDebug(2,"opening DocLnkSet "+docLnkDir);
doclnkset = new DocLnkSet(docLnkDir,"application/ipkg");
}
PackageListDocLnk::~PackageListDocLnk()
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
cfg.writeEntry( "docLnkDir", docLnkDir );
}
void PackageListDocLnk::update()
{
pvDebug(2,"PackageListDocLnk::update ");
QList<DocLnk> packlist = doclnkset->children();
for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
{
insertPackage( new Package(pack->file(), settings) );
}
}
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 @@
#include "packagelistremote.h"
#include <qstring.h>
#include <stdlib.h>
#include <unistd.h>
PackageListRemote::PackageListRemote(PackageManagerSettings* s)
: PackageList(s)
{
PackageListRemote();
}
PackageListRemote::PackageListRemote()
: PackageList()
{
}
PackageListRemote::~PackageListRemote()
{
}
void PackageListRemote::query(QString s)
{
+ pvDebug(4,"set query "+s);
searchString = s;
}
void PackageListRemote::update()
{
pvDebug(2,"PackageListRemote::update");
int r=0;
QString cmd = "wget";
QString redirect = "/tmp/oipkg.query";
// use file for output
cmd += " --output-document="+redirect;
//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section=
QString server="http://ipkgfind.handhelds.org/";
cmd += " \""+server+"/packages.phtml";
cmd += "?format=pda&searchtype=package&section=";
cmd += "&query="+searchString;
cmd += "\"";
pvDebug(4,"search :"+cmd);
r = system(cmd.latin1());
readFileEntries( redirect );
}
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 @@
#include <stdlib.h>
#include <unistd.h>
#include "mainwindow.h"
PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
: QObject ( p )
{
settings = s;
runwindow = new RunWindow( p, name, true, f );
}
PmIpkg::~PmIpkg()
{
}
//#define PROC
#define SYSTEM
int PmIpkg::runIpkg(const QString& args, const QString& dest )
{
pvDebug(2,"PmIpkg::runIpkg "+args);
#ifdef PROC
- QStringList cmd = "/usr/bin/ipkg ";
+ QStringList cmd = "ipkg ";
#endif
#ifdef SYSTEM
QString cmd = "/usr/bin/ipkg ";
#endif
pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
if ( dest == "" )
cmd += " -dest "+settings->getDestinationName();
else
cmd += " -dest "+ dest;
cmd += " -force-defaults ";
if (installDialog->_force_depends)
{
if (installDialog->_force_depends->isChecked())
cmd += " -force-depends ";
if (installDialog->_force_reinstall->isChecked())
cmd += " -force-reinstall ";
if (installDialog->_force_remove->isChecked())
cmd += " -force-removal-of-essential-packages ";
}
out( "<hr><br>Starting to "+ args+"<br>\n");
cmd += args;
int r = 0;
#ifdef PROC
QString o = "start";
Process *ipkg = new Process( cmd );
out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
QString description;
- ipkg->exec("",o);
-// out( o );
+ r = ipkg->exec("",o);
+ out( o );
#endif
#ifdef SYSTEM
out( "running:<br>\n"+cmd+"<br>\n" );
QString redirect = "/tmp/oipkg.pipe";
cmd += " 2>&1 | tee "+redirect+" 2>&1";
pvDebug(2, "running >"+cmd+"<");
r = system(cmd.latin1());
QFile f( redirect );
QString line;
QString oldLine;
while ( ! f.open(IO_ReadOnly) ) {};
QTextStream t( &f );
while ( !t.eof() )
{
line = t.readLine();
if ( line != oldLine )
{
out( line +"<br>" );
oldLine = line;
}
}
f.close();
out( "Finished!<br>");
#endif
@@ -156,190 +156,181 @@ void PmIpkg::processFileList( QStringList *fileList, QString d )
}
}
void PmIpkg::processLinkDir( QString file, QString dest )
{
pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
if ( dest == "???" || dest == "" ) return;
QString destFile = file;
file = dest+"/"+file;
if (file == dest) return;
QFileInfo fileInfo( file );
if ( fileInfo.isDir() )
{
pvDebug(4, "process dir "+file);
QDir destDir( destFile );
if (linkOpp==createLink) destDir.mkdir( destFile, true );
QDir d( file );
// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
- qDebug( "while %i",list->count());
while ( (fi=it.current()) )
{
pvDebug(4, "processLinkDir "+fi->absFilePath());
processLinkDir( fi->absFilePath(), dest );
++it;
}
} else
if ( fileInfo.isFile() )
{
const char *instFile = strdup( (file).ascii() );
const char *linkFile = strdup( (destFile).ascii());
if( linkOpp==createLink )
{
pvDebug(4, "linking: "+file+" -> "+destFile );
symlink( instFile, linkFile );
}
} else {
const char *linkFile = strdup( (destFile).ascii());
if( linkOpp==removeLink )
{
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
{
pvDebug(4,"removing "+destFile+" no "+file);
unlink( linkFile );
}
}
}
}
-void PmIpkg::loadList( PackageList pl )
+void PmIpkg::loadList( PackageList *pl )
{
- for( Package *pack = pl.first();pack ; (pack = pl.next()) )
+ for( Package *pack = pl->first();pack ; (pack = pl->next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
to_install.append( pack );
if ( pack->toRemove() )
to_remove.append( pack );
}
}
}
void PmIpkg::commit()
{
int sizecount = 0;
- for (uint i=0; i < to_remove.count(); i++)
- sizecount += 1;
- for (uint i=0; i < to_install.count(); i++)
- sizecount += to_install.at(i)->size().toInt();
- runwindow->progress->setTotalSteps(sizecount);
- startDialog();
-}
-
-void PmIpkg::startDialog()
-{
installDialog = new InstallDialog(settings,0,0,true);
- QCheckListItem *toRemoveItem;
- toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") );
+ QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") );
+ QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
toRemoveItem->setOpen( true );
- for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
+ toInstallItem->setOpen( true );
+ for (uint i=0; i < to_remove.count(); i++)
{
- toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) );
+ sizecount += 1;
+ toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
}
- QCheckListItem *toInstallItem;
- toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
- toInstallItem->setOpen( true );
- for (Package *it=to_install.first(); it != 0; it=to_install.next() )
+ for (uint i=0; i < to_install.count(); i++)
{
- toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) );
+ sizecount += to_install.at(i)->size().toInt();
+ toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
}
+ runwindow->progress->setTotalSteps(sizecount);
+ qDebug("Install size %i",sizecount);
installDialog->showMaximized();
if ( installDialog->exec() ) doIt();
installDialog->close();
+ runwindow->showMaximized();
out(tr("<b>All done.</b>"));
- to_install.clear();
}
void PmIpkg::doIt()
{
show( true );
remove();
install();
}
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>");
QStringList *fileList;
- for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
+ for (uint i=0; i < to_remove.count(); i++)
{
- if ( it->link() )fileList = getList( it->name(), it->dest() );
- if ( runIpkg("remove " + it->name(), it->dest() ) == 0)
+ if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
+ if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0)
{
- runwindow->progress->setProgress( 1 + runwindow->progress->progress() );
+ runwindow->progress->setProgress( 1 );
linkOpp = removeLink;
- if ( it->link() )
+ if ( to_remove.at(i)->link() )
{
out( "<br>removing links<br>" );
- out( "for package "+it->name()+" in "+it->dest()+"<br>" );
- processFileList( fileList, it->dest() );
+ out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" );
+ processFileList( fileList, to_remove.at(i)->dest() );
}
- it->processed();
-// to_install.take( it );
+ to_remove.at(i)->processed();
+ to_remove.take( i );
out("<br><hr>");
}else{
- out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
+ out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name());
}
- if ( it->link() )delete fileList;
+ if ( to_remove.at(i)->link() )delete fileList;
}
+ to_remove.clear();
out("<br>");
}
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
- for (Package *it=to_install.first(); it != 0; it=to_install.next() )
+ for (uint i=0; i < to_install.count(); i++)
{
-
- if ( runIpkg("install " + it->installName(), it->dest() ) == 0 )
+ if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 )
{
- runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
+ runwindow->progress->setProgress( to_install.at(i)->size().toInt() );
linkOpp = createLink;
- if ( it->link() )
+ if ( to_install.at(i)->link() )
{
out( "<br>creating links<br>" );
- out( "for package "+it->name()+" in "+it->dest()+"<br>" );
- makeLinks( it );
+ out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" );
+ makeLinks( to_install.at(i) );
}
- it->processed();
-// to_install.take( it->name() );
+ to_install.at(i)->processed();
+ to_install.take( i );
out("<br><hr>");
}else{
- out("<b>"+tr("Error while installing")+"</b><hr>"+it->name());
+ out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name());
}
}
out("<br>");
to_install.clear();
}
void PmIpkg::createLinks( const QString &dest )
{
pvDebug(2,"PmIpkg::createLinks "+dest);
linkOpp=createLink;
QString url = settings->getDestinationUrlByName( dest );
url = url==""?dest:url;
processLinkDir( "/opt", url );
processLinkDir( "/usr", url );
}
void PmIpkg::removeLinks( const QString &dest )
{
pvDebug(2,"PmIpkg::removeLinks "+dest);
linkOpp=removeLink;
QString url = settings->getDestinationUrlByName( dest );
url = url==""?dest:url;
processLinkDir( "/opt", url );
processLinkDir( "/usr", url );
@@ -377,41 +368,41 @@ void PmIpkg::showButtons(bool b)
}
}
void PmIpkg::show(bool b)
{
if (!runwindow->isVisible())
runwindow->showMaximized();
showButtons(b);
if ( !b )
runwindow->progress->hide();
else
runwindow->progress->show();
}
void PmIpkg::installFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
pvDebug( 2,"PmIpkg::installFile "+ fileName);
Package *p = new Package(fileName,settings);
if ( dest!="") p->setDest( dest );
to_install.append( p );
- startDialog();
+ commit();
delete p;
}
void PmIpkg::removeFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
pvDebug( 2,"PmIpkg::removeFile "+ fileName);
Package *p = new Package(fileName,settings);
if ( dest!="") p->setDest( dest );
to_remove.append( p );
- startDialog();
+ commit();
delete p;
}
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 @@
#include <qobject.h>
#include <qlist.h>
#include <qstring.h>
#include <qwidget.h>
#include "pksettings.h"
#include "runwindow.h"
#include "packagelist.h"
#include "installdialog.h"
#include "debug.h"
#define createLink 0
#define removeLink 1
class Package;
class PmIpkg : public QObject
{
Q_OBJECT
public:
PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
~PmIpkg();
int linkOpp;
- void loadList( PackageList );
+ void loadList( PackageList* );
void commit();
void update();
void showButtons(bool b=true);
void show( bool buttons=true );
public slots:
void doIt();
void install();
void remove();
void installFile(const QString &fileName, const QString &dest="");
void removeFile(const QString &fileName, const QString &dest="");
void createLinks( const QString &dest );
void removeLinks( const QString &dest );
private:
PackageManagerSettings* settings;
RunWindow *runwindow;
InstallDialog *installDialog;
QList<Package> to_remove;
QList<Package> to_install;
QString fileNameToInstall;
QCheckBox *_force_reinstall;
QCheckBox *_force_remove;
QCheckBox *_force_depends;