22 files changed, 192 insertions, 22 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp index bb50103..c676e84 100644 --- a/noncore/unsupported/oipkg/installdialog.cpp +++ b/noncore/unsupported/oipkg/installdialog.cpp @@ -1,107 +1,108 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'installdialog.ui' +/*************************************************************************** ** -** Created: Thu May 2 22:19:02 2002 -** by: The User Interface Compiler (uic) + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * ** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "installdialog.h" #include <qcheckbox.h> #include <qgroupbox.h> #include <qheader.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { settings = s; if ( !name ) setName( "InstallDialog" ); resize( 223, 269 ); setCaption( tr( "Install" ) ); InstallDialogLayout = new QGridLayout( this ); InstallDialogLayout->setSpacing( 2 ); InstallDialogLayout->setMargin( 2 ); ListViewPackages = new PackageListView( this,"listViewPackages",settings ); InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); GroupBoxOptions->layout()->setSpacing( 0 ); GroupBoxOptions->layout()->setMargin( 0 ); GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); GroupBoxOptionsLayout->setSpacing( 2 ); GroupBoxOptionsLayout->setMargin( 2 ); _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); QFont _force_depends_font( _force_depends->font() ); _force_depends_font.setPointSize( 8 ); _force_depends->setFont( _force_depends_font ); _force_depends->setText( tr( "-force-depends" ) ); //_force_depends->setChecked( true ); GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); QFont _force_reinstall_font( _force_reinstall->font() ); _force_reinstall_font.setPointSize( 8 ); _force_reinstall->setFont( _force_reinstall_font ); _force_reinstall->setText( tr( "-force-reinstall" ) ); GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); QFont _force_remove_font( _force_remove->font() ); _force_remove_font.setPointSize( 8 ); _force_remove->setFont( _force_remove_font ); _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); } /* * Destroys the object and frees any allocated resources */ InstallDialog::~InstallDialog() { // no need to delete child widgets, Qt does it all for us } /* * Main event handler. Reimplemented to handle application * font changes */ bool InstallDialog::event( QEvent* ev ) { bool ret = QDialog::event( ev ); if ( ev->type() == QEvent::ApplicationFontChange ) { QFont _force_depends_font( _force_depends->font() ); _force_depends_font.setPointSize( 8 ); _force_depends->setFont( _force_depends_font ); QFont _force_reinstall_font( _force_reinstall->font() ); _force_reinstall_font.setPointSize( 8 ); _force_reinstall->setFont( _force_reinstall_font ); QFont _force_remove_font( _force_remove->font() ); _force_remove_font.setPointSize( 8 ); _force_remove->setFont( _force_remove_font ); } return ret; } diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h index 5af2c35..828c8df 100644 --- a/noncore/unsupported/oipkg/installdialog.h +++ b/noncore/unsupported/oipkg/installdialog.h @@ -1,47 +1,50 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'installdialog.ui' +/*************************************************************************** ** -** Created: Thu May 2 22:19:01 2002 -** by: The User Interface Compiler (uic) + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * ** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> + + #ifndef INSTALLDIALOG_H #define INSTALLDIALOG_H #include "pksettings.h" #include "packagelistview.h" #include <qvariant.h> #include <qdialog.h> class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QCheckBox; class QGroupBox; class QListView; class QListViewItem; class InstallDialog : public QDialog { Q_OBJECT public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~InstallDialog(); PackageListView* ListViewPackages; QGroupBox* GroupBoxOptions; QCheckBox* _force_depends; QCheckBox* _force_reinstall; QCheckBox* _force_remove; QCheckListItem *toRemoveItem; QCheckListItem *toInstallItem; protected: QGridLayout* InstallDialogLayout; QGridLayout* GroupBoxOptionsLayout; bool event( QEvent* ); private: PackageManagerSettings* settings; }; #endif // INSTALLDIALOG_H diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 8778b85..084900d 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -1,129 +1,139 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// Copyright (C) 2000 Trolltech AS. // adadpted form qpe/qipkg +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #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 ) : 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 ); ipkg = new PmIpkg( settings, this ); packageListServers.setSettings( settings ); packageListSearch.setSettings( settings ); packageListDocLnk.setSettings( settings ); pvDebug(9,"packageListServers.update"); packageListServers.update(); pvDebug(9,"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()) ); 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 *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( "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(); 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" ), QString::null, 0, this, 0 ); connect( cfgact, SIGNAL( activated() ), SLOT( showSettings() ) ); cfgact->addTo( cfgMenu ); cfgact = new QAction( tr( "Servers" ), QString::null, 0, this, 0 ); connect( cfgact, SIGNAL( activated() ), diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 4a5e8bf..090ddd3 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h @@ -1,94 +1,106 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// Copyright (C) 2000 Trolltech AS. +// adadpted form qpe/qipkg +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> + #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <qmainwindow.h> #include <qaction.h> #include <qtimer.h> #include <qpopupmenu.h> #include "packagelist.h" #include "packagelistremote.h" #include "packagelistlocal.h" #include "packagelistdoclnk.h" #include "pmipkg.h" #include "pksettings.h" #include "packagelistview.h" class QComboBox; class QPEToolBar; class QLineEdit; class PackageListItem; class QCopChannel; class QMessageBox; class QCheckBox; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~MainWindow(); void makeChannel(); QCopChannel *channel; protected slots: void runIpkg(); void updateList(); void displayList(); void subSectionChanged(); void sectionChanged(); void showSettings(); 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; }; #endif diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 0cd93bf..7aaa240 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -1,128 +1,137 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "package.h" #include <qpe/process.h> #include <qpe/stringutil.h> #include <qfile.h> #include <qtextstream.h> #include <stdlib.h> #include <unistd.h> #include "debug.h" Package::Package( QObject *parent, const char *name ) : QObject(parent,name) { } Package::~Package() { } Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) : QObject(parent,name) { Package(parent,name); 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 , QObject *parent, const char *name ) : QObject(parent,name) { init(s); parsePackage( pack ); } Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) : QObject(parent,name) { init(s); if ( !QFile::exists( n ) ) { _name = QString( n ); }else{ pvDebug(4,"remote file: "+n); parseIpkgFile( n ); _useFileName = true; _fileName = QString( n ); } } Package::Package( Package *pi, QObject *parent, const char *name ) : QObject(parent,name) { 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") // { // // }else if ( n == "MD5Sum") // { }else if ( n == "Description") { setDesc( t ); }else if ( n == "Status") { if ( installed() ) return; _status = t; // }else if ( n == "Essential") // { }else{ _values.insert(n,new QString(t)); } diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 0f76ece..c147420 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h @@ -1,91 +1,100 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PK_ITEM_H #define PK_ITEM_H #include <qstring.h> #include <qlistview.h> #include <qpainter.h> #include <qpixmap.h> #include <qdict.h> #include <qobject.h> #include "pksettings.h" class Package : public QObject { Q_OBJECT public: Package(QObject *parent=0, const char *name=0); Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); ~Package(); Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); Package( Package*s, QObject *parent=0, const char *name=0 ); void setValue( QString, QString ); void copyValues( Package* ); QString name(); QString installName(); QString packageName(); bool installed(); bool otherInstalled(); 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); bool isOld(); bool hasVersions(); void parseIpkgFile( QString ); void instalFromFile(bool iff=true); void setName(QString); QDict<QString>* getFields(); QString status(); QDict<Package>* getOtherVersions(); void setOtherVersions(QDict<Package>*); public slots: void toggleProcess(); private: PackageManagerSettings *settings; QString _displayName; QString _name; QString _fileName; bool _old; bool _hasVersions; bool _toProcess; bool _link; QString _status; QString _size; QString _section; QString _subsection; QString _shortDesc; QString _desc; QString _version; QString _dest; QDict<QString> _values; QDict<Package> *_versions; bool _useFileName; void parsePackage( QStringList ); void init(PackageManagerSettings *); }; #endif diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index e445570..f6c4c37 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp @@ -1,128 +1,137 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "packagelist.h" #include <assert.h> #include <qfile.h> #include <qfileinfo.h> #include <qtextstream.h> #include "debug.h" static QDict<Package> *packageListAll; static int packageListAllRefCount = 0; PackageList::PackageList(QObject *parent, const char *name) : QObject(parent,name), packageIter( packageList ) { empty=true; if (!packageListAll) packageListAll = new QDict<Package>(); packageListAllRefCount++; sections << "All"; subSections.insert("All", new QStringList() ); QStringList *ss = subSections["All"]; *ss << "All"; aktSection = "All"; aktSubSection = "All"; } PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) : QObject(parent,name), packageIter( packageList ) { settings = s; PackageList(parent, name); } PackageList::~PackageList() { if (--packageListAllRefCount < 1 ) delete packageListAll; } /** Inserts a package into the list */ void PackageList::insertPackage( Package* pack ) { if (!pack) return; Package* p = packageListAll->find( pack->name() ); if ( p ) { if ( (p->version() == pack->version()) // && (p->dest() == pack->dest()) ) { p->copyValues( pack ); delete pack; pack = p; } else { QDict<Package> *packver = p->getOtherVersions(); // p->setName( pack->name()+"["+p->version()+"]" ); if (!packver) { packver = new QDict<Package>(); packver->insert( pack->name(), p ); p->setOtherVersions( packver ); } pack->setName( pack->name()+"["+pack->version()+"]" ); pack->setOtherVersions( packver ); packver->insert( pack->name(), pack ); packageListAll->insert( pack->name(), pack ); packageList.insert( pack->name(), pack ); origPackageList.insert( pack->name(), pack ); } }else{ packageListAll->insert( pack->name(), pack ); packageList.insert( pack->name(), pack ); origPackageList.insert( pack->name(), pack ); }; 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(); } } Package* PackageList::find( QString n ) { return packageList.find( n ); } Package* PackageList::first() { packageIter.toFirst(); return packageIter.current(); } Package* PackageList::next() { ++packageIter; return packageIter.current(); } QStringList PackageList::getSections() { sections.sort(); return sections; } QStringList PackageList::getSubSections() { QStringList ss; if ( !subSections[aktSection] ) return ss; ss = *subSections[aktSection]; ss.sort(); return ss; diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 46a00e9..0c13688 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h @@ -1,60 +1,69 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PACKAGELIST_H #define PACKAGELIST_H #include <qdict.h> #include "package.h" #include "pksettings.h" #include "debug.h" class PackageList : public QObject { Q_OBJECT public: // static QString all = QObject::tr("All"); PackageList (QObject *parent=0, const char *name=0); PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); virtual ~PackageList(); void insertPackage( Package* ); Package* find( QString ); Package* next(); Package* first(); QStringList getSections(); QStringList getSubSections(); void setSettings( PackageManagerSettings* ); void filterPackages( QString ); Package* getByName( QString ); void clear(); void allPackages(); QDict<Package> *versions; public slots: void setSection(QString); void setSubSection(QString); // virtual void update(); protected: int currentPackage; int packageCount; PackageManagerSettings *settings; QDict<Package> packageList; QDict<Package> origPackageList; QDictIterator<Package> packageIter; bool empty; QString aktSection; QString aktSubSection; QStringList sections; QDict<QStringList> subSections; QDict<bool> sectionsDict; void updateSections( Package* ); void readFileEntries( QString file, QString dest="" ); }; #endif diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index deb8a6d..76e91ff 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp @@ -1,45 +1,53 @@ - +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "packagelistdoclnk.h" #include <qpe/applnk.h> #include <qpe/config.h> #include <qlist.h> #include "package.h" #include "pksettings.h" PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name) : PackageList(s) { PackageListDocLnk(parent, name); } PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name) : PackageList(parent, name) { 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 ); delete doclnkset; } 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/packagelistdoclnk.h b/noncore/unsupported/oipkg/packagelistdoclnk.h index a63fb59..af06a45 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.h +++ b/noncore/unsupported/oipkg/packagelistdoclnk.h @@ -1,23 +1,32 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PACKAGELISTDOCLNK_H #define PACKAGELISTDOCLNK_H #include "packagelist.h" #include "debug.h" class DocLnkSet; class PackageListDocLnk : public PackageList { public: PackageListDocLnk(QObject *parent=0, const char *name=0); PackageListDocLnk( PackageManagerSettings *s, QObject *parent=0, const char *name=0); virtual ~PackageListDocLnk(); public slots: void update(); private: DocLnkSet *doclnkset; QString docLnkDir; }; #endif diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 7c54441..b5e86f5 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp @@ -1,128 +1,137 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #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("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("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 ); } void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, const QRect & r ) { // Skip QCheckListItem // (makes you wonder what we're getting from QCheckListItem) QListViewItem::paintFocus(p,cg,r); } QPixmap PackageListItem::statePixmap() const { bool installed = package->installed(); bool old = package->isOld(); bool versions = package->hasVersions(); bool verinstalled = package->otherInstalled(); if ( !package->toProcess() ) { if ( !installed ) if (old) { if (verinstalled) return *pm_uninstalled_old_installed_new; else return *pm_uninstalled_old; } else { if (verinstalled) return *pm_uninstalled_installed_old; else return *pm_uninstalled; } else if (old) return *pm_installed_old; else return *pm_installed; } else { //toProcess() == true if ( !installed ) return *pm_install; else return *pm_uninstall; } diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index 65e9711..dba44f7 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h @@ -1,41 +1,50 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PK_LISTITEM_H #define PK_LISTITEM_H #include "package.h" #include <qstring.h> #include <qlistview.h> #include <qpainter.h> #include <qpixmap.h> #include <qdict.h> #include "pksettings.h" class PackageListItem : public QCheckListItem { public: PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); PackageListItem(QListView*, Package*, PackageManagerSettings*); void paintCell( QPainter*, const QColorGroup&, int, int, int ); void paintFocus( QPainter*, const QColorGroup&, const QRect& ); QPixmap statePixmap() const; QString key( int, bool ) const; Package* getPackage() { return package; } ; QString getName() { return package->name(); } ; bool isInstalled(){ return package->installed(); }; virtual void setOn ( bool ); void displayDetails(); private: void init(Package*, PackageManagerSettings*); QCheckListItem *nameItem; QCheckListItem *destItem; QCheckListItem *linkItem; QCheckListItem *statusItem; PackageManagerSettings *settings; Package *package; }; #endif diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp index 6d931c8..b8a19253 100644 --- a/noncore/unsupported/oipkg/packagelistlocal.cpp +++ b/noncore/unsupported/oipkg/packagelistlocal.cpp @@ -1,66 +1,75 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include <qpe/config.h> #include <qfile.h> #include <qfileinfo.h> #include <qtextstream.h> #include <qstringlist.h> #include "packagelistlocal.h" PackageListLocal::PackageListLocal() : PackageList() { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Common" ); statusDir = cfg.readEntry( "statusDir", "" ); listsDir = cfg.readEntry( "listsDir", "" ); if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) { statusDir="/usr/lib/ipkg/"; listsDir="/usr/lib/ipkg/lists/"; cfg.writeEntry( "statusDir", statusDir ); cfg.writeEntry( "listsDir", listsDir ); } } PackageListLocal::PackageListLocal(PackageManagerSettings* s) : PackageList(s) { PackageListLocal(); } PackageListLocal::~PackageListLocal() { } void PackageListLocal::parseStatus() { QStringList dests = settings->getDestinationUrls(); QStringList destnames = settings->getDestinationNames(); QStringList::Iterator name = destnames.begin(); for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) { pvDebug( 2,"Status: "+*dir+statusDir+"/status"); readFileEntries( *dir+statusDir+"/status", *name ); ++name; }; } void PackageListLocal::parseList() { QStringList srvs = settings->getActiveServers(); for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) { pvDebug( 2, "List: "+listsDir+"/"+*it); readFileEntries( listsDir+"/"+*it ); } } void PackageListLocal::update() { pvDebug( 2, "parseStatus"); parseStatus(); pvDebug( 2, "parseList"); parseList(); pvDebug( 2, "finished parsing"); } diff --git a/noncore/unsupported/oipkg/packagelistlocal.h b/noncore/unsupported/oipkg/packagelistlocal.h index 887126b..69f871c 100644 --- a/noncore/unsupported/oipkg/packagelistlocal.h +++ b/noncore/unsupported/oipkg/packagelistlocal.h @@ -1,30 +1,39 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PACKAGELISTLOCAL_H #define PACKAGELISTLOCAL_H #include "packagelist.h" #define HACK #ifdef HACK static QString listsDir="/usr/lib/ipkg/"; static QString statusDir="/usr/lib/ipkg/"; #endif class PackageListLocal : public PackageList { public: PackageListLocal(); PackageListLocal( PackageManagerSettings* ); virtual ~PackageListLocal(); public slots: void update(); private: #ifndef HACK QString listsDir; QString statusDir; #endif void parseStatus(); void parseList(); }; #endif diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp index bb29e80..b4b6979 100644 --- a/noncore/unsupported/oipkg/packagelistremote.cpp +++ b/noncore/unsupported/oipkg/packagelistremote.cpp @@ -1,49 +1,58 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #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§ion= QString server="http://ipkgfind.handhelds.org/"; cmd += " \""+server+"/packages.phtml"; cmd += "?format=pda&searchtype=package§ion="; cmd += "&query="+searchString; cmd += "\""; pvDebug(4,"search :"+cmd); r = system(cmd.latin1()); readFileEntries( redirect, "remote" ); } diff --git a/noncore/unsupported/oipkg/packagelistremote.h b/noncore/unsupported/oipkg/packagelistremote.h index 87bf10d..98632ca 100644 --- a/noncore/unsupported/oipkg/packagelistremote.h +++ b/noncore/unsupported/oipkg/packagelistremote.h @@ -1,21 +1,30 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PACKAGELISTREMOTE_H #define PACKAGELISTREMOTE_H #include "packagelist.h" #include "package.h" #include "pksettings.h" #include "debug.h" class PackageListRemote : public PackageList { public: PackageListRemote(); PackageListRemote( PackageManagerSettings* s); virtual ~PackageListRemote(); void query(QString); public slots: void update(); private: QString searchString; }; #endif diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 2bb74e9..0d6fa80 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -1,128 +1,137 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "packagelistview.h" #include <qpopupmenu.h> #include <qaction.h> #include "packagelistitem.h" #include "pksettings.h" PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) : QListView(p,n) { settings = s; popupMenu = new QPopupMenu( this ); destsMenu = new QPopupMenu( popupMenu ); popupTimer = new QTimer( this ); setSelectionMode(QListView::NoSelection); addColumn( tr("Package") ); setRootIsDecorated( true ); connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); connect( this, SIGNAL( pressed( QListViewItem* ) ), this, SLOT( setCurrent( QListViewItem* ) ) ); connect( this, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( stopTimer( QListViewItem* ) ) ); } //PackageListView::~PackageListView() //{ //} void PackageListView::setCurrent( QListViewItem* p ) { if ( !p ) return; activePackageListItem = (PackageListItem*)p; activePackage = activePackageListItem->getPackage(); if (!activePackage) { // QDictIterator<QCheckListItem> it( rootItems ); // while ( it.current() ) // { // if ( it.current()==p ) // pvDebug(2,"current item"); // ++it; // } return; } popupTimer->start( 750, true ); } void PackageListView::showPopup() { popupMenu->clear(); destsMenu->clear(); QAction *popupAction; if ( !activePackage->installed() ) { popupMenu->insertItem( 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{ popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 ); popupAction->addTo( popupMenu ); connect( popupAction, SIGNAL( activated() ), this , SLOT( toggleProcess() ) ); popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 ); popupAction->addTo( popupMenu ); popupAction->setEnabled( false ); } 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(); } void PackageListView::display() { QDictIterator<PackageList> list( PackageLists ); PackageList *packlist; Package *pack; PackageListItem *item; QCheckListItem *rootItem; QListViewItem* it; QListViewItem* itdel; while ( list.current() ) { packlist = list.current(); rootItem = rootItems.find( list.currentKey() ); //rootItem->clear(); it=rootItem->firstChild(); while ( it ) { itdel = it; it = it->nextSibling(); delete itdel; } diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index 00c0320..3c09ba8 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h @@ -1,61 +1,54 @@ /*************************************************************************** - packagelistview.h - description - ------------------- - begin : Sat Apr 27 2002 - copyright : (C) 2002 by tille - email : tille@handhelds.org - ***************************************************************************/ - -/*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PACKAGELISTVIEW_H #define PACKAGELISTVIEW_H #include <qlistview.h> #include <qaction.h> #include <qdict.h> #include <qstring.h> #include <qtimer.h> #include <qwidget.h> #include <qpopupmenu.h> #include "packagelist.h" #include "debug.h" class PackageListItem; class Package; class PackageManagerSettings; class PackageListView : public QListView { Q_OBJECT public: PackageListView(QWidget*, const char*, PackageManagerSettings*); void addList( QString, PackageList* ); // ~PackageListView(); QTimer *popupTimer; private: QDict<PackageList> PackageLists; QDict<QCheckListItem> rootItems; PackageManagerSettings *settings; Package *activePackage; PackageListItem *activePackageListItem; QPopupMenu *popupMenu; QPopupMenu *destsMenu; public slots: void showPopup(); void changePackageDest( int ); void setCurrent( QListViewItem* ); void stopTimer( QListViewItem* ); void toggleProcess(); void display(); }; #endif diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 89309a2..de1f162 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -1,128 +1,137 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "pmipkg.h" #include "pksettings.h" #include "package.h" #include "packagelistitem.h" #include <opie/oprocess.h> #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))); installDialog = 0; #endif } PmIpkg::~PmIpkg() { #ifdef OPROCESS delete ipkgProcess; #endif } bool PmIpkg::runIpkg(const QString& args, const QString& dest ) { bool ret=false; QDir::setCurrent("/tmp"); QString cmd = "/usr/bin/ipkg "; #ifdef OPROCESS ipkgProcess->clearArguments(); *ipkgProcess << "/usr/bin/ipkg "; cmd = ""; #endif pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); if ( dest == "" ) cmd += " -dest "+settings->getDestinationName(); else cmd += " -dest "+ dest; cmd += " -force-defaults "; if (installDialog && 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( "Starting to "+ args+"\n"); cmd += args; out( "running:\n"+cmd+"\n" ); pvDebug(2,"running:"+cmd); #ifdef OPROCESS *ipkgProcess << args; out( "running:\n" + cmd); *ipkgProcess << cmd; //debug ipkgProcess->clearArguments(); *ipkgProcess << "/bin/ls "; //debug QValueList<QCString> a = ipkgProcess->args(); QValueList<QCString>::Iterator it; for( it = a.begin(); it != a.end(); ++it ) { out( *it ); cmd += *it; } pvDebug(2,"running:"+cmd); qApp->processEvents(); // sleep(1); ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); if ( !ret ) { pvDebug(2,"Could not execute '" + cmd); out("\nError while executing "+ cmd+"\n\n"); out("\nError while executing\n\n"); // return false; } while ( ipkgProcess->isRunning() ) { 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"); diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 2c92348..28bc5dd 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -1,65 +1,74 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PMIPKG_H #define PMIPKG_H #include <opie/oprocess.h> #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 commit(); void update(); void show(); /** No descriptions */ void clearLists(); 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 slots: void getIpkgOutput(OProcess *proc, char *buffer, int buflen); private: OProcess *ipkgProcess; PackageManagerSettings* settings; RunWindow *runwindow; InstallDialog *installDialog; QList<Package> to_remove; QList<Package> to_install; void makeLinks(Package*); void linkPackage( QString, QString ); void processLinkDir( QString , QString ); bool runIpkg(const QString& args, const QString& dest="" ); void out( QString ); QStringList* getList( QString, QString ); void processFileList( QStringList*, QString ); }; #endif diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp index 85daa98..4bd60c0 100644 --- a/noncore/unsupported/oipkg/settings.cpp +++ b/noncore/unsupported/oipkg/settings.cpp @@ -1,128 +1,137 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "pksettings.h" #include <qpe/config.h> #include <qcombobox.h> #include <qfile.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qlistbox.h> #include <qcheckbox.h> #include <qstring.h> #include <qobject.h> #include <qtextstream.h> #include <qtabwidget.h> PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) : PackageManagerSettingsBase( parent, name, fl ) { connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); // connect( CheckBoxLink, SIGNAL(toggled(bool)), // activeLinkDestination, SLOT(setEnabled(bool)) ); connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); servername->setEnabled(FALSE); serverurl->setEnabled(FALSE); serverurlDic.setAutoDelete(TRUE); destinationname->setEnabled(FALSE); destinationurl->setEnabled(FALSE); destinationurlDic.setAutoDelete(TRUE); readSettings(); } PackageManagerSettings::~PackageManagerSettings() { } void PackageManagerSettings::newServer() { int i = servers->count(); if ( servername->isEnabled() || serverurl->text().isEmpty() ) { serverurlDic.insert(i,new QString("http://")); servers->insertItem(tr("New")); activeServers->insertItem(tr("New")); } else { // allows one-level undo serverurlDic.insert(i,new QString(serverurl->text())); servers->insertItem(servername->text()); activeServers->insertItem(servername->text()); } servers->setSelected(i,TRUE); editServer(i); } void PackageManagerSettings::newDestination() { int i = destinations->count(); if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { destinationurlDic.insert(i,new QString("/")); destinations->insertItem(tr("New")); activeDestination->insertItem(tr("New")); activeLinkDestination->insertItem(tr("New")); } else { // allows one-level undo destinationurlDic.insert(i,new QString(destinationurl->text())); destinations->insertItem(destinationname->text()); activeDestination->insertItem(destinationname->text()); activeLinkDestination->insertItem(destinationname->text()); } destinations->setSelected(i,TRUE); editDestination(i); } void PackageManagerSettings::editServer(int i) { if ( servername->isEnabled() ) { disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); } else { servername->setEnabled(TRUE); serverurl->setEnabled(TRUE); } servername->setText( servers->text(i) ); serverurl->setText( *serverurlDic[i] ); editedserver = i; connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); } void PackageManagerSettings::editDestination(int i) { if ( destinationname->isEnabled() ) { disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); } else { destinationname->setEnabled(TRUE); destinationurl->setEnabled(TRUE); } destinationname->setText( destinations->text(i) ); destinationurl->setText( *destinationurlDic[i] ); editeddestination = i; connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); } void PackageManagerSettings::removeServer() { disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); servername->setText(servers->text(editedserver)); serverurl->setText(*serverurlDic[editedserver]); diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index 9cb7a9b..44459b2 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h @@ -1,67 +1,75 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PACKAGEMANAGERSETTINGS_H #define PACKAGEMANAGERSETTINGS_H #include "pksettingsbase.h" #include <qintdict.h> class PackageManagerSettings : public PackageManagerSettingsBase -//class PackageManagerSettings : private PackageManagerSettingsBase { Q_OBJECT public: PackageManagerSettings( QWidget* , const char* , WFlags ); ~PackageManagerSettings(); bool showDialog( int ) ; QString getDestinationUrl(); QString getDestinationName(); QString getLinkDestinationName(); bool createLinks(); QStringList getActiveServers(); QStringList getDestinationUrls(); public slots: /** No descriptions */ void createLinks(); void removeLinks(); void writeInstallationSettings(); void readInstallationSettings(); void writeCurrentInstallationSetting(); void readInstallationSetting(int); void installationSettingSetName(const QString &); void activeDestinationChange(int) void newServer(); void editServer(int); void removeDestination(); void newDestination(); void editDestination(int); void linkEnabled(bool); void removeServer(); void serverNameChanged(const QString&); void serverUrlChanged(const QString&); void destNameChanged(const QString&); void destUrlChanged(const QString&); void installationSettingChange(int); void newInstallationSetting(); void removeInstallationSetting(); void renameInstallationSetting(); private: QIntDict<QString> serverurlDic; QIntDict<QString> destinationurlDic; int ipkg_old; int editedserver; int editeddestination; int currentSetting; int installationSettingsCount; bool changed; bool serverChanged; bool readIpkgConfig(const QString&); void writeIpkgConfig(const QString&); void writeSettings(); void readSettings(); }; #endif |