summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp24
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h3
-rw-r--r--noncore/unsupported/oipkg/package.cpp4
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp2
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp5
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp2
6 files changed, 8 insertions, 32 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 1c56aae..9c4c752 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,96 +1,92 @@
// adadpted form qpe/qipkg
#include "mainwindow.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qlistview.h>
#include <qtextview.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include "pksettingsbase.h"
#include "utils.h"
#include "packagelistitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QMainWindow( parent, name, f )
{
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 );
-// 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 );
packageListServers.setSettings( settings );
packageListSearch.setSettings( settings );
packageListDocLnk.setSettings( settings );
pvDebug(9,"packageListServers.update");
packageListServers.update();
pvDebug(9,"packageListDocLnk.update");
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()) );
connect( settings->removeLinksButton, SIGNAL( clicked()),
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
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 );
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;
// spacer = new QLabel( "", toolBar );
@@ -224,123 +220,114 @@ void MainWindow::makeMenu()
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 );
// 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()
{
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() );
}
void MainWindow::runIpkg()
{
packageListServers.allPackages();
ipkg->loadList( &packageListSearch );
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()
{
-// 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();
}
void MainWindow::filterList()
{
-// wait->show();
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageListServers.filterPackages( f );
-// wait->hide();
}
void MainWindow::displayList()
{
-// wait->hide();
filterList();
listViewPackages->display();
}
void MainWindow::sectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
subsection->clear();
packageListServers.setSection( section->currentText() );
setSubSections();
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::subSectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
packageListServers.setSubSection( subsection->currentText() );
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::setSections()
{
section->clear();
section->insertStringList( packageListServers.getSections() );
}
void MainWindow::setSubSections()
{
subsection->clear();
subsection->insertStringList( packageListServers.getSubSections() );
}
void MainWindow::showSettings()
@@ -363,107 +350,96 @@ void MainWindow::sectionShow(bool b)
{
if (b) sectionBar->show();
else sectionBar->hide();
sectionAction->setOn( b );
}
void MainWindow::sectionClose()
{
sectionAction->setOn( false );
}
void MainWindow::findShow(bool b)
{
if (b) findBar->show();
else findBar->hide();
findAction->setOn( b );
}
void MainWindow::findClose()
{
findAction->setOn( false );
}
void MainWindow::searchShow(bool b)
{
if (b) searchBar->show();
else searchBar->hide();
searchAction->setOn( b );
}
void MainWindow::searchClose()
{
searchAction->setOn( false );
}
void MainWindow::destShow(bool b)
{
if (b) destBar->show();
else destBar->hide();
destAction->setOn( 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)
{
if ( !QFile::exists( fileName ) ) return;
ipkg->installFile( fileName );
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
exit;
}
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&)) );
}
void MainWindow::receive(const QCString &msg, const QByteArray &arg)
{
pvDebug(3, "QCop "+msg+" "+QCString(arg));
if ( msg == "installFile(QString)" )
{
ipkg->installFile( QString(arg) );
}else if( msg == "removeFile(QString)" )
{
ipkg->removeFile( QString(arg) );
}else if( msg == "createLinks(QString)" )
{
ipkg->createLinks( QString(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()
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index ce3e761..4a5e8bf 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -44,54 +44,51 @@ protected slots:
void showSettingsSrv();
void showSettingsDst();
public slots:
void sectionClose();
void sectionShow(bool);
void findClose();
void findShow(bool);
void searchClose();
void searchShow(bool);
void destClose();
void destShow(bool);
void filterList();
void createLinks();
void removeLinks();
void receive (const QCString &, const QByteArray &);
void setDocument (const QString &);
void remotePackageQuery();
private:
void makeMenu();
void setSections();
void setSubSections();
bool updateIcon;
PmIpkg* ipkg;
PackageManagerSettings *settings;
PackageListLocal packageListServers;
PackageListRemote packageListSearch;
PackageListDocLnk packageListDocLnk;
PackageListView *listViewPackages;
QAction *runAction;
QAction *updateAction;
QAction *findAction;
QPEToolBar *findBar;
QLineEdit *findEdit;
QAction *searchAction;
QAction *searchCommit;
QPEToolBar *searchBar;
QLineEdit *searchEdit;
QAction *sectionAction;
QPEToolBar *sectionBar;
QComboBox *section;
QComboBox *subsection;
QAction *destAction;
QPEToolBar *destBar;
QComboBox *destination;
QCheckBox* CheckBoxLink;
-// QMessageBox *wait;
-private slots:
- void rotateUpdateIcon();
};
#endif
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 4542e42..8c5f0ea 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -5,96 +5,97 @@
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include <unistd.h>
#include "debug.h"
//Package::~Package()
//{
//}
Package::Package( PackageManagerSettings *s )
{
init(s);
}
void Package::init( PackageManagerSettings *s )
{
settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
_useFileName = false;
_old = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
_versions=0;
_version="";
}
Package::Package( QStringList pack, PackageManagerSettings *s )
{
init(s);
parsePackage( pack );
}
Package::Package( QString n, PackageManagerSettings *s )
{
init(s);
if ( !QFile::exists( n ) )
{
_name = QString( n );
}else{
+ pvDebug(2,"remote file: "+n);
parseIpkgFile( n );
_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 == "Section")
{
setSection( t );
// }else if ( n == "Maintainer")
// {
//
// }else if ( n == "Architecture")
// {
}else if ( n == "Version")
{
_version = t;
// }else if ( n == "Pre-Depends")
// {
//
// }else if ( n == "Depends")
// {
}else if ( n == "Filename")
{
_fileName = t;
// }else if ( n == "Size")
// {
//
@@ -297,97 +298,98 @@ QString Package::details()
for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
QString line = *it;
if ( line == " ." )
{
description.append("<p>");
} else
if ( line[0] == ' ' || line[0] == '\t' )
{
// continuation
description.append(" ");
description.append(Qtopia::escapeString(line));
} else {
int sep = line.find(QRegExp(":[\t ]+"));
if ( sep >= 0 )
{
QString tag = line.left(sep);
description.append("<br>");
description.append("<b>");
description.append(Qtopia::escapeString(tag));
description.append(":</b> ");
description.append(Qtopia::escapeString(line.mid(sep+2)));
} else {
description.append(" ");
description.append(Qtopia::escapeString(line));
}
}
}
}
return description;
}
void Package::processed()
{
_toProcess = false;
//hack, but we're not writing status anyway...
if ( installed() ) _status = "install";
else _status = "installed";
}
QString Package::dest()
{
if ( installed()||(!installed() && _toProcess) )
return _dest!=""?_dest:settings->getDestinationName();
else return "";
}
void Package::setDest( QString d )
{
- _dest = d;
+ if ( d == "remote") _useFileName = true;
+ else _dest = d;
}
void Package::setOn()
{
_toProcess = true;
}
bool Package::link()
{
if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
return _link;
}
void Package::setLink(bool b)
{
_link = b;
}
void Package::parseIpkgFile( QString file)
{
system("tar xzf "+file+" -C /tmp");
system("tar xzf /tmp/control.tar.gz -C /tmp");
QFile f("/tmp/control");
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;
}
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 8f835b7..1b572e0 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -130,92 +130,92 @@ QStringList PackageList::getSubSections()
void PackageList::setSection( QString sec )
{
aktSection = sec;
}
void PackageList::setSubSection( QString ssec )
{
aktSubSection = ssec;
}
void PackageList::updateSections( Package* pack )
{
QString s = pack->section();
if ( s.isEmpty() || s == "") return;
if ( sections.contains(s) ) return;
sections += s;
QString ss = pack->subSection();
if ( ss.isEmpty() || ss == "" ) return;
if ( !subSections[s] ) {
subSections.insert( s, new QStringList() );
QStringList *subsecs = subSections[s];
*subsecs += "All";
}
QStringList *subsecs = subSections[s];
*subsecs += ss;
if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
subsecs = subSections["All"];
*subsecs += ss;
}
void PackageList::readFileEntries( QString filename, QString dest )
{
pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
QStringList packEntry;
QFile f( filename );
if ( !f.open(IO_ReadOnly) ) return;
QTextStream *statusStream = new QTextStream( &f );
while ( !statusStream ->eof() )
{
QString line = statusStream->readLine();
if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
{
//end of package
if ( ! packEntry.isEmpty() )
{
Package *p = new Package( packEntry, settings );
- p->setDest( dest );
if ( p )
{
+ p->setDest( dest );
insertPackage( p );
packEntry.clear();
}
}
}else{
packEntry << line;
};
}
delete statusStream;
return;
}
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
Package* PackageList::getByName( QString n )
{
origPackageList[n];
}
void PackageList::clear()
{
origPackageList.clear();
packageList.clear();
}
void PackageList::allPackages()
{
packageList.clear();
QDictIterator<Package> filterIter( origPackageList );
filterIter.toFirst();
Package *pack= filterIter.current() ;
while ( pack )
{
packageList.insert( pack->name(), pack );
++filterIter;
pack = filterIter.current();
}
}
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index c743a49..55047d5 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -1,89 +1,90 @@
#include "packagelistitem.h"
#include <qpe/resource.h>
#include <qobject.h>
#include "debug.h"
static QPixmap *pm_uninstalled=0;
static QPixmap *pm_uninstalled_old=0;
static QPixmap *pm_installed=0;
static QPixmap *pm_installed_old=0;
static QPixmap *pm_uninstall=0;
static QPixmap *pm_install=0;
static QPixmap *pm_uninstalled_old_installed_new=0;
static QPixmap *pm_uninstalled_installed_old=0;
PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lv,pi->name(),CheckBox)
{
init(pi,s);
}
PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lvi,pi->name(),CheckBox)
{
init(pi,s);
}
void PackageListItem::init( Package *pi, PackageManagerSettings *s)
{
package = pi;
settings = s;
setExpandable( true );
QCheckListItem *item;
nameItem = new QCheckListItem( this, "" );
- item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() );
+ item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() );
+ item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() );
destItem = new QCheckListItem( this, "" );
linkItem = new QCheckListItem( this, "" );
statusItem = new QCheckListItem( this, "" );
QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") );
- item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() );
+ item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() );
QDict<QString> *fields = pi->getFields();
QDictIterator<QString> it( *fields );
while ( it.current() ) {
item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) );
++it;
}
displayDetails();
if (!pm_uninstalled)
{
pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld"));
pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew"));
pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld"));
pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld"));
pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
}
}
void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
int column, int width, int alignment )
{
if ( !p )
return;
p->fillRect( 0, 0, width, height(),
isSelected()? cg.highlight() : cg.base() );
if ( column != 0 ) {
// The rest is text
QListViewItem::paintCell( p, cg, column, width, alignment );
return;
}
QListView *lv = listView();
if ( !lv )
return;
int marg = lv->itemMargin();
int r = marg;
QPixmap pm = statePixmap();
p->drawPixmap(marg,(height()-pm.height())/2,pm);
r += pm.width()+1;
p->translate( r, 0 );
QListViewItem::paintCell( p, cg, column, width - r, alignment );
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp
index e37f256..bb29e80 100644
--- a/noncore/unsupported/oipkg/packagelistremote.cpp
+++ b/noncore/unsupported/oipkg/packagelistremote.cpp
@@ -1,49 +1,49 @@
#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");
if (searchString.isEmpty()) return;
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 );
+ readFileEntries( redirect, "remote" );
}