summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp55
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp37
2 files changed, 72 insertions, 20 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 233eae6..7df1d6b 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -34,33 +34,34 @@
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QMainWindow( parent, name, f )
// packageListServers( QObject(parent), name ),
// packageListSearch( parent, name ),
// packageListDocLnk( parent, name )
{
setCaption( tr("Package Manager") );
settings = new PackageManagerSettings(this,0,TRUE);
listViewPackages = new PackageListView( this,"listViewPackages",settings );
setCentralWidget( listViewPackages );
listViewPackages->addList( tr("feeds"), &packageListServers );
listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
- listViewPackages->addList( tr("documents"), &packageListDocLnk );
+//listViewPackages->addList( tr("documents"), &packageListDocLnk );
ipkg = new PmIpkg( settings, this );
packageListServers.setSettings( settings );
packageListSearch.setSettings( settings );
packageListDocLnk.setSettings( settings );
pvDebug(9,"packageListServers.update");
packageListServers.update();
pvDebug(9,"packageListDocLnk.update");
- packageListDocLnk.update();
+ pvDebug(0,"no UPDATE of DocLnk");
+// packageListDocLnk.update();
pvDebug(9,"makeMenu");
makeMenu();
makeChannel();
//opie is hardcoded default ;)
// pvDebug(9,"section->setCurrentItem");
// for (int i=0;i<section->count();i++)
// if (section->text(i)=="opie")
// section->setCurrentItem(i);
// sectionChanged();
connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
@@ -73,48 +74,48 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
pvDebug(9,"displayList");
displayList();
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
QPopupMenu *srvMenu = new QPopupMenu( menuBar );
QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
- // QPopupMenu *sectMenu = new QPopupMenu( menuBar );
+ QPopupMenu *helpMenu = new QPopupMenu( menuBar );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Package" ), srvMenu );
menuBar->insertItem( tr( "View" ), viewMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
- // menuBar->insertItem( tr( "Sections" ), sectMenu );
+ menuBar->insertItem( tr( "Help" ), helpMenu );
QLabel *spacer;
// spacer = new QLabel( "", toolBar );
// spacer->setBackgroundColor( toolBar->backgroundColor() );
// toolBar->setStretchableWidget( spacer );
runAction = new QAction( tr( "Apply" ),
Resource::loadPixmap( "oipkg/install" ),
QString::null, 0, this, 0 );
connect( runAction, SIGNAL( activated() ),
this, SLOT( runIpkg() ) );
runAction->addTo( toolBar );
runAction->addTo( srvMenu );
- srvMenu->insertSeparator ();
+ srvMenu->insertSeparator();
updateAction = new QAction( tr( "Update" ),
Resource::loadIconSet( "oipkg/update" ),
QString::null, 0, this, 0 );
connect( updateAction, SIGNAL( activated() ),
this , SLOT( updateList() ) );
updateAction->addTo( toolBar );
updateAction->addTo( srvMenu );
QAction *cfgact;
cfgact = new QAction( tr( "Setups" ),
@@ -220,24 +221,61 @@ void MainWindow::makeMenu()
CheckBoxLink->setChecked( settings->createLinks() );
connect( CheckBoxLink, SIGNAL(toggled(bool)),
settings, SLOT(linkEnabled(bool)) );
destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
a->addTo( destBar );
destBar->setStretchableWidget( CheckBoxLink );
destAction->setToggleAction( true );
// destAction->addTo( viewMenu );
+// helpMenu
+ helpMenu->insertSeparator();
+ a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ helpMenu->insertSeparator();
+ a = new QAction( tr( "Install" ),
+ Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ a = new QAction( tr( "Remove" ),
+ Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ helpMenu->insertSeparator();
+ a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ helpMenu->insertSeparator();
+ a = new QAction( tr( "New version, installed" ),
+ Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ a = new QAction( tr( "New version, not installed" ),
+ Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ a = new QAction( tr( "Old version, installed" ),
+ Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ a = new QAction( tr( "Old version, not installed" ),
+ Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ a = new QAction( tr( "Old version, new version installed" ),
+ Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+ a = new QAction( tr( "New version, old version installed" ),
+ Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 );
+ a->addTo( helpMenu );
+// a = new QAction( tr( "" ),
+// Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 );
+// a->addTo( helpMenu );
+
// configure the menus
Config cfg( "oipkg", Config::User );
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()
{
@@ -245,45 +283,46 @@ MainWindow::~MainWindow()
cfg.setGroup( "gui" );
cfg.writeEntry( "findBar", !findBar->isHidden() );
cfg.writeEntry( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
cfg.writeEntry( "destBar", !destBar->isHidden() );
}
void MainWindow::runIpkg()
{
packageListServers.allPackages();
ipkg->loadList( &packageListSearch );
- ipkg->loadList( &packageListDocLnk );
+//ipkg->loadList( &packageListDocLnk );
ipkg->loadList( &packageListServers );
ipkg->commit();
ipkg->clearLists();
// ##### 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()
{
packageListServers.clear();
packageListSearch.clear();
- packageListDocLnk.clear();
+
+// packageListDocLnk.clear();
ipkg->update();
packageListServers.update();
packageListSearch.update();
- packageListDocLnk.update();
+// packageListDocLnk.update();
}
void MainWindow::filterList()
{
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageListServers.filterPackages( f );
}
void MainWindow::displayList()
{
filterList();
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 0817247..7d0e246 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,43 +1,43 @@
#include "pmipkg.h"
#include "pksettings.h"
#include "package.h"
#include "packagelistitem.h"
-//#infdef OPROCESS
#include <opie/oprocess.h>
-//#endif
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/stringutil.h>
#include <qpe/qpeapplication.h>
#include <qdir.h>
#include <qfile.h>
#include <qgroupbox.h>
#include <qmultilineedit.h>
#include <qstring.h>
#include <qcheckbox.h>
#include <qtextstream.h>
#include <qtextview.h>
#include <qprogressbar.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <stdlib.h>
#include <unistd.h>
#include "mainwindow.h"
+//#define OPROCESS
+
PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
: QObject ( p )
{
settings = s;
runwindow = new RunWindow( p, name, true, f );
#ifdef OPROCESS
ipkgProcess = new OProcess();
connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
this, SLOT(getIpkgOutput(OProcess*,char*,int)));
connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)),
this, SLOT(getIpkgOutput(OProcess*,char*,int)));
@@ -117,43 +117,42 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
out(".");
pvDebug(7,"wait for oprocess to terminate");
qApp->processEvents();
};
#else
qApp->processEvents();
FILE *fp;
char line[130];
QString lineStr, lineStrOld;
sleep(1);
cmd +=" 2>&1";
fp = popen( (const char *) cmd, "r");
- if ( !fp ) {
+ if ( fp == NULL ) {
qDebug("Could not execute '" + cmd + "'! err=%d", fp);
- pclose(fp);
out("\nError while executing "+ cmd+"\n\n");
- return false;
+ ret = false;
} else {
- while ( fgets( line, sizeof line, fp)) {
+ while ( fgets( line, sizeof line, fp) != NULL)
+ {
lineStr = line;
lineStr=lineStr.left(lineStr.length()-1);
//Configuring opie-oipkg...Done
- if (lineStr.contains("Done"))
- ret = true;
+ if (lineStr.contains("Done")) ret = true;
if (lineStr!=lineStrOld)
out(lineStr);
lineStrOld = lineStr;
qApp->processEvents();
}
- pclose(fp);
}
+ pclose(fp);
#endif
//out( "Finished!");
pvDebug(2,QString(ret?"success\n":"failure\n"));
return ret;
}
void PmIpkg::makeLinks(Package *pack)
{
pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
linkPackage( pack->name(), pack->dest() );
}
@@ -225,33 +224,33 @@ void PmIpkg::processLinkDir( QString file, QString dest )
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
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());
+ const char *instFile = strdup( (file).latin1() );
+ const char *linkFile = strdup( (destFile).latin1());
if( linkOpp==createLink )
{
pvDebug(4, "linking: "+file+" -> "+destFile );
symlink( instFile, linkFile );
}
} else {
- const char *linkFile = strdup( (destFile).ascii());
+ const char *linkFile = strdup( (destFile).latin1());
if( linkOpp==removeLink )
{
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
{
pvDebug(4,"removing "+destFile+" no "+file);
unlink( linkFile );
}
}
}
}
@@ -344,24 +343,38 @@ void PmIpkg::remove()
to_remove.clear();
out("\n");
}
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
out(tr("Installing")+"\n"+tr("please wait")+"\n");
for (uint i=0; i < to_install.count(); i++)
{
qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
+ if (to_install.at(i)->link())
+ {
+ // hack to have package.list
+ // in "dest"/usr/lib/ipkg/info/
+ QString rds = settings->getDestinationUrlByName("root");
+ QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest());
+ QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list";
+ rds += listFile;
+ lds += listFile;
+ const char *rd = rds.latin1();
+ const char *ld = lds.latin1();
+ pvDebug(4, "linking: "+rds+" -> "+lds );
+ symlink( rd, ld );
+ }
if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
{
runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
to_install.at(i)->processed();
linkOpp = createLink;
if ( to_install.at(i)->link() )
makeLinks( to_install.at(i) );
// to_install.take( i );
out("\n");
}else{
out(tr("Error while installing")+to_install.at(i)->name()+"\n");
linkOpp = createLink;