summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/main.cpp3
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp5
-rw-r--r--noncore/unsupported/oipkg/package.cpp65
-rw-r--r--noncore/unsupported/oipkg/package.h7
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp17
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp10
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h1
8 files changed, 62 insertions, 47 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp
index 4af59b0..5cef2dc 100644
--- a/noncore/unsupported/oipkg/main.cpp
+++ b/noncore/unsupported/oipkg/main.cpp
@@ -1,19 +1,22 @@
#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();
}
QPEApplication a( argc, argv );
MainWindow mw;
+ 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 06828e0..4865c39 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -42,50 +42,48 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
// wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
// wait = new QMessageBox(this);
// wait->setText(tr("Please wait"));
ipkg = new PmIpkg( settings, this );
// settings->setIpkg( ipkg );
packageList.setSettings( settings );
packageListSearch.setSettings( settings );
packageList.update();
makeMenu();
makeChannel();
//opie is hardcoded default ;)
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()) );
connect( settings->removeLinksButton, SIGNAL( clicked()),
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
-// rootLocal = new QCheckListItem(listViewPackages,tr("local"));
-// rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
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 );
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 );
QLabel *spacer = new QLabel( "", toolBar );
spacer->setBackgroundColor( toolBar->backgroundColor() );
toolBar->setStretchableWidget( spacer );
@@ -265,50 +263,53 @@ void MainWindow::updateList()
packageList.clear();
ipkg->update();
packageList.update();
t->stop();
// wait->hide();
}
void MainWindow::filterList()
{
// wait->show();
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageList.filterPackages( f );
// wait->hide();
}
void MainWindow::displayList()
{
// wait->hide();
filterList();
listViewPackages->clear();
Package *pack = packageList.first();
PackageListItem *item;
+// if (!rootLocal)
+// {
QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
+// }
while( pack )
{
item = new PackageListItem( rootLocal, pack, settings );
pack = packageList.next();
}
pack = packageListSearch.first();
while( pack )
{
item = new PackageListItem( rootSearch, pack, settings );
pack = packageListSearch.next();
}
}
void MainWindow::sectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
subsection->clear();
packageList.setSection( section->currentText() );
setSubSections();
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 6bb53a9..0787ece 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -48,132 +48,138 @@ Package::Package( QString n, PackageManagerSettings *s )
_name = QString( n );
}else{
parseIpkgFile( n );
_toProcess = true;
_useFileName = true;
_fileName = QString( n );
}
}
Package::Package( Package *pi )
{
init(pi->settings);
copyValues( pi );
}
void Package::setValue( QString n, QString t )
{
if ( n == "Package" )
{
_name = QString( t );
}else if ( n == "Installed-Size" )
{
_size = t;
- }else if ( n == "Priority")
- {
+// }else if ( n == "Priority")
+// {
}else if ( n == "Section")
{
setSection( t );
- }else if ( n == "Maintainer")
- {
-
- }else if ( n == "Architecture")
- {
+// }else if ( n == "Maintainer")
+// {
+//
+// }else if ( n == "Architecture")
+// {
}else if ( n == "Version")
{
-
- }else if ( n == "Pre-Depends")
- {
-
- }else if ( n == "Depends")
- {
+ _version = t;
+// }else if ( n == "Pre-Depends")
+// {
+//
+// }else if ( n == "Depends")
+// {
}else if ( n == "Filename")
{
_fileName = t;
- }else if ( n == "Size")
- {
-
- }else if ( n == "MD5Sum")
- {
+// }else if ( n == "Size")
+// {
+//
+// }else if ( n == "MD5Sum")
+// {
- }
- if ( n == "Description")
+ }else if ( n == "Description")
{
setDesc( t );
- }
- if ( n == "Status")
+ }else if ( n == "Status")
{
if ( installed() ) return;
_status = t;
- }
- if ( t == "Essential")
- {
+// }else if ( n == "Essential")
+// {
+ }else{
+ _values.insert(n,new QString(t));
}
-};
+}
QString Package::name()
{
- return _name;
+ if (_displayName.isEmpty() ) return _name;
+ else return _displayName;
}
QString Package::installName()
{
if (_useFileName) return _fileName;
else return _name;
}
bool Package::installed()
{
return _status.contains("installed");
}
void Package::setDesc( QString s )
{
_desc = s;
_shortDesc = s.left( s.find("\n") );
}
QString Package::desc()
{
return _desc;
}
QString Package::shortDesc()
{
return _shortDesc;
}
QString Package::size()
{
return _size;
}
+
+QString Package::version()
+{
+ return _version;
+}
+
QString Package::sizeUnits()
{
int i = _size.toInt();
int c = 0;
QString ret;
QStringList unit;
unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
while (i > 1)
{
ret=QString::number(i)+" "+unit[c];
c++;
i /= 1024;
}
return ret;
}
bool Package::toProcess()
{
return _toProcess;
}
bool Package::toRemove()
{
if ( _toProcess && installed() ) return true;
@@ -329,24 +335,29 @@ void Package::parseIpkgFile( QString file)
if ( f.open(IO_ReadOnly) )
{
QTextStream t( &f );
QStringList pack;
while ( !t.eof() )
{
pack << t.readLine();
}
f.close();
parsePackage( pack );
}
}
//QString Package::getPackageName()
//{
// if ( _packageName.isEmpty() ) return _name;
// else return _packageName;
//}
void Package::instalFromFile(bool iff)
{
_useFileName = iff;
}
+
+void Package::setName(QString n)
+{
+ _displayName = n;
+}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 4618c3a..2ca966d 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -11,64 +11,67 @@
#include "pksettings.h"
class Package //: public QObject
{
// Q_OBJECT
public:
Package(PackageManagerSettings *);
// ~Package();
Package( QStringList, PackageManagerSettings * );
Package( QString, PackageManagerSettings * );
Package( Package* );
void setValue( QString, QString );
void copyValues( Package* );
QString name() ;
QString installName() ;
bool installed();
void setDesc( QString );
QString shortDesc();
QString desc();
QString size();
QString sizeUnits();
+ QString version();
void setSection( QString );
QString section();
QString subSection();
QString details();
bool toProcess();
bool toInstall();
bool toRemove();
void processed();
QString dest();
void setDest( QString d );
void setOn();
bool link();
void setLink(bool);
void parseIpkgFile( QString );
void instalFromFile(bool iff=true);
+ void setName(QString);
public slots:
-// QString getPackageName();
void toggleProcess();
private:
PackageManagerSettings *settings;
-// QString _packageName;
+ QString _displayName;
QString _name;
QString _fileName;
bool _toProcess;
bool _link;
QString _status;
QString _size;
QString _section;
QString _subsection;
QString _shortDesc;
QString _desc;
+ QString _version;
QString _dest;
+ QDict<QString> _values;
bool _useFileName;
void parsePackage( QStringList );
void init(PackageManagerSettings *);
};
#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index b892b30..be20c71 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -12,59 +12,68 @@ PackageList::PackageList()
{
empty=true;
sections << "All";
subSections.insert("All", new QStringList() );
QStringList *ss = subSections["All"];
*ss << "All";
aktSection = "All";
aktSubSection = "All";
}
PackageList::PackageList( PackageManagerSettings* s)
: packageIter( packageList )
{
settings = s;
PackageList();
}
PackageList::~PackageList()
{
}
/** Inserts a package into the list */
void PackageList::insertPackage( Package* pack )
{
+ if (!pack) return;
Package* p = packageList.find( pack->name() );
if ( p )
{
- p->copyValues( pack );
- delete pack;
- pack = p;
+ if ( p->version() == pack->version() )
+ {
+ p->copyValues( pack );
+ delete pack;
+ pack = p;
+ } else {
+ p->setName( pack->name()+"["+p->version()+"]" );
+ pack->setName( pack->name()+"["+pack->version()+"]" );
+ packageList.insert( pack->name(), pack );
+ origPackageList.insert( pack->name(), pack );
+ }
}else{
packageList.insert( pack->name(), pack );
origPackageList.insert( pack->name(), pack );
- empty=false;
};
+ empty=false;
updateSections( pack );
}
void PackageList::filterPackages( QString f )
{
packageList.clear();
QDictIterator<Package> filterIter( origPackageList );
filterIter.toFirst();
Package *pack= filterIter.current() ;
while ( pack )
{
if (
((aktSection=="All")||(pack->section()==aktSection)) &&
((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
pack->name().contains( f )
)
{
packageList.insert( pack->name(), pack );
}
++filterIter;
pack = filterIter.current();
}
}
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 610a0e1..36d081b 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -43,48 +43,47 @@ void PackageListView::setCurrent( QListViewItem* p )
void PackageListView::showPopup()
{
popupMenu->clear();
destsMenu->clear();
QAction *popupAction;
if ( !activePackage->installed() )
{
popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
QStringList dests = settings->getDestinationNames();
QString ad = settings->getDestinationName();
for (uint i = 0; i < dests.count(); i++ )
{
popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
popupAction->addTo( destsMenu );
if ( dests[i] == ad && activePackage->toInstall() )
{
popupAction->setToggleAction( true );
popupAction->setOn(true);
};
}
connect( destsMenu, SIGNAL( activated( int ) ),
this, SLOT( changePackageDest( int ) ) );
}else{
-// popupActcat setOn( activePackage->toProcess() );
}
popupMenu->popup( QCursor::pos() );
}
void PackageListView::stopTimer( QListViewItem* )
{
popupTimer->stop();
}
void PackageListView::changePackageDest( int i )
{
activePackage->setDest( destsMenu->text(i) );
activePackage->setOn();
activePackage->setLink( settings->createLinks() );
activePackageListItem->displayDetails();
}
void PackageListView::toggleProcess()
{
activePackage->toggleProcess() ;
activePackageListItem->displayDetails();
}
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index fe200f5..1798c80 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -265,98 +265,88 @@ void PmIpkg::startDialog()
QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
GroupBox1->setTitle( tr( "Ipkg options" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 0 );
GroupBox1->layout()->setMargin( 0 );
QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
GroupBox1Layout->setSpacing( 3 );
GroupBox1Layout->setMargin( 3 );
_force_depends = new QCheckBox( GroupBox1, "_force_depends" );
_force_depends->setText( tr( "-force-depends" ) );
_force_depends->setAutoResize( TRUE );
_force_depends->setChecked(true);
GroupBox1Layout->addWidget( _force_depends, 0, 0 );
_force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
_force_reinstall->setText( tr( "-force-reinstall" ) );
_force_reinstall->setAutoResize( TRUE );
GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
_force_remove = new QCheckBox( GroupBox1, "_force_remove" );
_force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
_force_remove->setAutoResize( TRUE );
GroupBox1Layout->addWidget( _force_remove, 1, 0 );
RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
-
-// connect( doItButton, SIGNAL( clicked() ),
-// this, SLOT( doIt() ) );
-// connect( installButton, SIGNAL( clicked() ),
-// this, SLOT( install() ) );
-// connect( removeButton, SIGNAL( clicked() ),
-// this, SLOT( remove() ) );
-// connect( cancelButton, SIGNAL( clicked() ),
-// installDialog, SLOT( close() ) );
installDialog->showMaximized();
if ( installDialog->exec() ) doIt();
installDialog->close();
out(tr("<b>All done.</b>"));
}
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() )
{
if ( it->link() )fileList = getList( it->name(), it->dest() );
if ( runIpkg("remove " + it->name()) == 0)
{
runwindow->progress->setProgress( 1 + runwindow->progress->progress() );
linkOpp = removeLink;
if ( it->link() )
{
out( "<br>removing links<br>" );
out( "for package "+it->name()+" in "+it->dest()+"<br>" );
processFileList( fileList, it->dest() );
}
it->processed();
out("<br><hr>");
}else{
out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
}
- pvDebug(2,"delete File List");
if ( it->link() )delete fileList;
}
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() )
{
if ( runIpkg("install " + it->installName(), it->dest() ) == 0 )
{
runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
linkOpp = createLink;
if ( it->link() )
{
out( "<br>creating links<br>" );
out( "for package "+it->name()+" in "+it->dest()+"<br>" );
makeLinks( it );
}
it->processed();
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 2b89023..fa00048 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -5,49 +5,48 @@
#include <qobject.h>
#include <qlist.h>
#include <qstring.h>
#include <qwidget.h>
#include "pksettings.h"
#include "runwindow.h"
#include "packagelist.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 commit( PackageList );
void update();
- // PackageList* getPackageList();
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:
int sizecount;
PackageManagerSettings* settings;
RunWindow *runwindow;
QDialog *installDialog;
QList<Package> to_remove;
QList<Package> to_install;
bool runwindowopen;
QString fileNameToInstall;
QCheckBox *_force_reinstall;
QCheckBox *_force_remove;
QCheckBox *_force_depends;