-rw-r--r-- | noncore/unsupported/oipkg/listviewitemoipkg.cpp | 38 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/listviewitemoipkg.h | 33 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 100 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 34 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 20 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistdoclnk.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 159 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.h | 32 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistlocal.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 141 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.h | 17 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 8 |
16 files changed, 370 insertions, 253 deletions
diff --git a/noncore/unsupported/oipkg/listviewitemoipkg.cpp b/noncore/unsupported/oipkg/listviewitemoipkg.cpp new file mode 100644 index 0000000..30b5a5e --- a/dev/null +++ b/noncore/unsupported/oipkg/listviewitemoipkg.cpp @@ -0,0 +1,38 @@ +#include "listviewitemoipkg.h" +#include "packagelistview.h" + +#include <qlistview.h> + +ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type) + : QCheckListItem(parent,name,qct) +{ + _type = type; +} +ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, Type type) + : QCheckListItem(parent,name,CheckBox) +{ + _type = type; +} + +ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type) + : QCheckListItem(parent,name,CheckBox) +{ + _type = type; +} + +ListViewItemOipkg::ListViewItemOipkg(PackageListView *parent, QString name, Type type) + : QCheckListItem(parent,name,Controller) +{ + _type = type; +} + +ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name) + : QCheckListItem(parent,name,Controller) +{ + _type = type; +} + +ListViewItemOipkg::~ListViewItemOipkg() +{ +// delete _popupMenu; +} diff --git a/noncore/unsupported/oipkg/listviewitemoipkg.h b/noncore/unsupported/oipkg/listviewitemoipkg.h new file mode 100644 index 0000000..4f7d2d7 --- a/dev/null +++ b/noncore/unsupported/oipkg/listviewitemoipkg.h @@ -0,0 +1,33 @@ +#ifndef LISTVIEWITEMOIPKG_H +#define LISTVIEWITEMOIPKG_H + +#include <qpopupmenu.h> +#include <qstring.h> +#include <qlistview.h> +#include <qcheckbox.h> + +class PackageListItem; +class PackageListView; + +class ListViewItemOipkg : public QObject, public QCheckListItem +{ +Q_OBJECT +public: + enum Type {Package, Feed, Attribute}; + + ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type); ListViewItemOipkg(QListView *parent, QString name, Type type); + ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type); + ListViewItemOipkg(PackageListView *parent, QString name, Type type); + ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name); + ~ListViewItemOipkg(); + + int getType() {return _type;}; + virtual QPopupMenu* getPopupMenu() {return 0;}; +protected slots: + virtual void menuAction(int ) {}; +protected: + int _type; + static QPopupMenu* _popupMenu; +}; + +#endif diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 354c585..f32352b 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h @@ -20,2 +20,3 @@ +#include "package.h" #include "packagelist.h" diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 986cbcd..230df2c 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro @@ -10,2 +10,3 @@ HEADERS = mainwindow.h \ utils.h \ + listviewitemoipkg.h \ packagelistitem.h \ @@ -22,2 +23,3 @@ SOURCES = main.cpp \ installdialog.cpp \ + listviewitemoipkg.cpp \ packagelistremote.cpp \ @@ -34,3 +36,3 @@ LIBS += -lopie INTERFACES = runwindow.ui \ - pksettingsbase.ui + pksettingsbase.ui TARGET = oipkg diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 3effb73..e020601 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -20,3 +20,3 @@ -Package::Package( QObject *parent, const char *name ) +OipkgPackage::OipkgPackage( QObject *parent, const char *name ) : QObject(parent,name) @@ -26,3 +26,3 @@ Package::Package( QObject *parent, const char *name ) -Package::~Package() +OipkgPackage::~OipkgPackage() { @@ -30,6 +30,5 @@ Package::~Package() -Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) +OipkgPackage::OipkgPackage( PackageManagerSettings *s, QObject *parent, const char *name ) : QObject(parent,name) -{ - Package(parent,name); +{ init(s); @@ -37,3 +36,3 @@ Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) -void Package::init( PackageManagerSettings *s ) +void OipkgPackage::init( PackageManagerSettings *s ) { @@ -56,3 +55,3 @@ void Package::init( PackageManagerSettings *s ) -Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) +OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) : QObject(parent,name) @@ -63,3 +62,3 @@ Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, -Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) +OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) : QObject(parent,name) @@ -78,3 +77,3 @@ Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const c -Package::Package( Package *pi, QObject *parent, const char *name ) +OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name ) : QObject(parent,name) @@ -86,3 +85,3 @@ Package::Package( Package *pi, QObject *parent, const char *name ) -void Package::setValue( QString n, QString t ) +void OipkgPackage::setValue( QString n, QString t ) { @@ -139,3 +138,3 @@ void Package::setValue( QString n, QString t ) -QString Package::name() +QString OipkgPackage::name() { @@ -146,3 +145,3 @@ QString Package::name() -QString Package::installName() +QString OipkgPackage::installName() { @@ -152,3 +151,3 @@ QString Package::installName() -QString Package::packageName() +QString OipkgPackage::packageName() { @@ -160,3 +159,3 @@ QString Package::packageName() -bool Package::installed() +bool OipkgPackage::installed() { @@ -174,3 +173,3 @@ bool Package::installed() { - QDictIterator<Package> other( *_versions ); + QDictIterator<OipkgPackage> other( *_versions ); while ( other.current() ) @@ -186,3 +185,3 @@ bool Package::installed() -bool Package::otherInstalled() +bool OipkgPackage::otherInstalled() { @@ -190,3 +189,3 @@ bool Package::otherInstalled() { - QDictIterator<Package> other( *_versions ); + QDictIterator<OipkgPackage> other( *_versions ); while ( other.current() ) @@ -200,3 +199,3 @@ bool Package::otherInstalled() -void Package::setDesc( QString s ) +void OipkgPackage::setDesc( QString s ) { @@ -206,3 +205,3 @@ void Package::setDesc( QString s ) -QString Package::desc() +QString OipkgPackage::desc() { @@ -211,3 +210,3 @@ QString Package::desc() -QString Package::shortDesc() +QString OipkgPackage::shortDesc() { @@ -216,3 +215,3 @@ QString Package::shortDesc() -QString Package::size() +QString OipkgPackage::size() { @@ -222,3 +221,3 @@ QString Package::size() -QString Package::version() +QString OipkgPackage::version() { @@ -227,3 +226,3 @@ QString Package::version() -QString Package::sizeUnits() +QString OipkgPackage::sizeUnits() { @@ -243,3 +242,3 @@ QString Package::sizeUnits() -bool Package::toProcess() +bool OipkgPackage::toProcess() { @@ -248,3 +247,3 @@ bool Package::toProcess() -bool Package::toRemove() +bool OipkgPackage::toRemove() { @@ -254,3 +253,3 @@ bool Package::toRemove() -bool Package::toInstall() +bool OipkgPackage::toInstall() { @@ -260,3 +259,3 @@ bool Package::toInstall() -void Package::toggleProcess() +void OipkgPackage::toggleProcess() { @@ -266,4 +265,3 @@ void Package::toggleProcess() - -void Package::copyValues( Package* pack ) +void OipkgPackage::copyValues( OipkgPackage* pack ) { @@ -283,3 +281,3 @@ void Package::copyValues( Package* pack ) -QString Package::section() +QString OipkgPackage::section() { @@ -288,3 +286,3 @@ QString Package::section() -void Package::setSection( QString s) +void OipkgPackage::setSection( QString s) { @@ -301,3 +299,3 @@ void Package::setSection( QString s) -QString Package::subSection() +QString OipkgPackage::subSection() { @@ -306,3 +304,3 @@ QString Package::subSection() -void Package::parsePackage( QStringList pack ) +void OipkgPackage::parsePackage( QStringList pack ) { @@ -325,3 +323,3 @@ void Package::parsePackage( QStringList pack ) -QString Package::details() +QString OipkgPackage::details() { @@ -364,3 +362,3 @@ QString Package::details() -void Package::processed() +void OipkgPackage::processed() { @@ -372,3 +370,3 @@ void Package::processed() -QString Package::dest() +QString OipkgPackage::dest() { @@ -379,3 +377,3 @@ QString Package::dest() -void Package::setDest( QString d ) +void OipkgPackage::setDest( QString d ) { @@ -385,3 +383,3 @@ void Package::setDest( QString d ) -void Package::setOn() +void OipkgPackage::setOn() { @@ -390,3 +388,3 @@ void Package::setOn() -bool Package::link() +bool OipkgPackage::link() { @@ -396,3 +394,3 @@ bool Package::link() -void Package::setLink(bool b) +void OipkgPackage::setLink(bool b) { @@ -401,3 +399,3 @@ void Package::setLink(bool b) -void Package::parseIpkgFile( QString file) +void OipkgPackage::parseIpkgFile( QString file) { @@ -427,3 +425,3 @@ void Package::parseIpkgFile( QString file) -//QString Package::getPackageName() +//QString OipkgPackage::getPackageName() //{ @@ -433,3 +431,3 @@ void Package::parseIpkgFile( QString file) -void Package::instalFromFile(bool iff) +void OipkgPackage::instalFromFile(bool iff) { @@ -438,3 +436,3 @@ void Package::instalFromFile(bool iff) -void Package::setName(QString n) +void OipkgPackage::setName(QString n) { @@ -443,3 +441,3 @@ void Package::setName(QString n) -QDict<QString>* Package::getFields() +QDict<QString>* OipkgPackage::getFields() { @@ -448,3 +446,3 @@ QDict<QString>* Package::getFields() -QString Package::status() +QString OipkgPackage::status() { @@ -453,6 +451,6 @@ QString Package::status() -bool Package::isOld() +bool OipkgPackage::isOld() { if (!_versions) return false; - QDictIterator<Package> other( *_versions ); + QDictIterator<OipkgPackage> other( *_versions ); while ( other.current() ) { @@ -464,3 +462,3 @@ bool Package::isOld() -bool Package::hasVersions() +bool OipkgPackage::hasVersions() { @@ -470,3 +468,3 @@ bool Package::hasVersions() -QDict<Package>* Package::getOtherVersions() +QDict<OipkgPackage>* OipkgPackage::getOtherVersions() { @@ -475,3 +473,3 @@ QDict<Package>* Package::getOtherVersions() -void Package::setOtherVersions(QDict<Package> *v) +void OipkgPackage::setOtherVersions(QDict<OipkgPackage> *v) { diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index c147420..2334c31 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h @@ -21,3 +21,3 @@ -class Package : public QObject +class OipkgPackage : public QObject { @@ -25,11 +25,11 @@ class Package : public QObject 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 ); + OipkgPackage(QObject *parent=0, const char *name=0); + OipkgPackage(PackageManagerSettings *s, QObject *parent=0, const char *name=0); + ~OipkgPackage(); + OipkgPackage( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); + OipkgPackage( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); + OipkgPackage( OipkgPackage*s, QObject *parent=0, const char *name=0 ); void setValue( QString, QString ); - void copyValues( Package* ); + void copyValues( OipkgPackage* ); @@ -68,4 +68,4 @@ class Package : public QObject - QDict<Package>* getOtherVersions(); - void setOtherVersions(QDict<Package>*); + QDict<OipkgPackage>* getOtherVersions(); + void setOtherVersions(QDict<OipkgPackage>*); @@ -92,3 +92,3 @@ private: QDict<QString> _values; - QDict<Package> *_versions; + QDict<OipkgPackage> *_versions; bool _useFileName; diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index edb9cc5..5f79ec1 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp @@ -18,3 +18,3 @@ -static QDict<Package> *packageListAll; +static QDict<OipkgPackage> *packageListAll; static int packageListAllRefCount = 0; @@ -25,3 +25,3 @@ PackageList::PackageList(QObject *parent, const char *name) empty=true; - if (!packageListAll) packageListAll = new QDict<Package>(); + if (!packageListAll) packageListAll = new QDict<OipkgPackage>(); packageListAllRefCount++; @@ -48,6 +48,6 @@ PackageList::~PackageList() /** Inserts a package into the list */ -void PackageList::insertPackage( Package* pack ) +void PackageList::insertPackage( OipkgPackage* pack ) { if (!pack) return; - Package* p = packageListAll->find( pack->name() ); + OipkgPackage* p = packageListAll->find( pack->name() ); if ( p ) @@ -62,3 +62,3 @@ void PackageList::insertPackage( Package* pack ) } else { - QDict<Package> *packver = p->getOtherVersions(); + QDict<OipkgPackage> *packver = p->getOtherVersions(); // p->setName( pack->name()+"["+p->version()+"]" ); @@ -66,3 +66,3 @@ void PackageList::insertPackage( Package* pack ) { - packver = new QDict<Package>(); + packver = new QDict<OipkgPackage>(); packver->insert( pack->name(), p ); @@ -89,5 +89,5 @@ void PackageList::filterPackages( QString f ) packageList.clear(); - QDictIterator<Package> filterIter( origPackageList ); + QDictIterator<OipkgPackage> filterIter( origPackageList ); filterIter.toFirst(); - Package *pack= filterIter.current() ; + OipkgPackage *pack= filterIter.current() ; while ( pack ) @@ -107,3 +107,3 @@ void PackageList::filterPackages( QString f ) -Package* PackageList::find( QString n ) +OipkgPackage* PackageList::find( QString n ) { @@ -112,3 +112,3 @@ Package* PackageList::find( QString n ) -Package* PackageList::first() +OipkgPackage* PackageList::first() { @@ -118,3 +118,3 @@ Package* PackageList::first() -Package* PackageList::next() +OipkgPackage* PackageList::next() { @@ -149,3 +149,3 @@ void PackageList::setSubSection( QString ssec ) -void PackageList::updateSections( Package* pack ) +void PackageList::updateSections( OipkgPackage* pack ) { @@ -184,3 +184,3 @@ void PackageList::readFileEntries( QString filename, QString dest ) { - Package *p = new Package( packEntry, settings ); + OipkgPackage *p = new OipkgPackage( packEntry, settings ); if ( p ) @@ -199,3 +199,3 @@ void PackageList::readFileEntries( QString filename, QString dest ) { - Package *p = new Package( packEntry, settings ); + OipkgPackage *p = new OipkgPackage( packEntry, settings ); if ( p ) @@ -216,3 +216,3 @@ void PackageList::setSettings( PackageManagerSettings *s ) -Package* PackageList::getByName( QString n ) +OipkgPackage* PackageList::getByName( QString n ) { @@ -230,5 +230,5 @@ void PackageList::allPackages() packageList.clear(); - QDictIterator<Package> filterIter( origPackageList ); + QDictIterator<OipkgPackage> filterIter( origPackageList ); filterIter.toFirst(); - Package *pack= filterIter.current() ; + OipkgPackage *pack= filterIter.current() ; while ( pack ) diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 0c13688..88a8793 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h @@ -26,6 +26,6 @@ public: virtual ~PackageList(); - void insertPackage( Package* ); - Package* find( QString ); - Package* next(); - Package* first(); + void insertPackage( OipkgPackage* ); + OipkgPackage* find( QString ); + OipkgPackage* next(); + OipkgPackage* first(); @@ -35,3 +35,3 @@ public: void filterPackages( QString ); - Package* getByName( QString ); + OipkgPackage* getByName( QString ); void clear(); @@ -39,3 +39,3 @@ public: - QDict<Package> *versions; + QDict<OipkgPackage> *versions; @@ -51,5 +51,5 @@ protected: PackageManagerSettings *settings; - QDict<Package> packageList; - QDict<Package> origPackageList; - QDictIterator<Package> packageIter; + QDict<OipkgPackage> packageList; + QDict<OipkgPackage> origPackageList; + QDictIterator<OipkgPackage> packageIter; @@ -63,3 +63,3 @@ protected: - void updateSections( Package* ); + void updateSections( OipkgPackage* ); void readFileEntries( QString file, QString dest="" ); diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index 76e91ff..a7a6f70 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp @@ -50,3 +50,3 @@ void PackageListDocLnk::update() { - insertPackage( new Package(pack->file(), settings ) ); + insertPackage( new OipkgPackage(pack->file(), settings ) ); } diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 03bf477..4380393 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp @@ -13,2 +13,4 @@ #include <qobject.h> +#include <qpopupmenu.h> +#include <qaction.h> @@ -25,16 +27,29 @@ static QPixmap *pm_uninstalled_installed_old=0; -PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) - : QCheckListItem(lv,pi->name(),CheckBox) +PackageListItem::PackageListItem(ListViewItemOipkg *parent, QString name, Type ittype) + : ListViewItemOipkg(parent,name,ittype) { - init(pi,s); + } -PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) - : QCheckListItem(lvi,pi->name(),CheckBox) +PackageListItem::PackageListItem(QListView* lv, OipkgPackage *pi, PackageManagerSettings *s) + : ListViewItemOipkg(lv,pi->name(),ListViewItemOipkg::Package) { - init(pi,s); + init(pi,s); } -void PackageListItem::init( Package *pi, PackageManagerSettings *s) +PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s) + : ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package) +{ + init(pi,s); +} +PackageListItem::~PackageListItem() { + delete popupMenu; + delete destsMenu; +} + +void PackageListItem::init( OipkgPackage *pi, PackageManagerSettings *s) +{ + popupMenu = new QPopupMenu( 0 ); + destsMenu = new QPopupMenu( 0 ); package = pi; @@ -42,17 +57,17 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *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() ); + ListViewItemOipkg *item; + nameItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute,"name" ); + item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Description: ")+pi->desc() ); + item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Size: ")+pi->size() ); + destItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "dest" ); + linkItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "link" ); + statusItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "status" ); + ListViewItemOipkg *otherItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("other") ); + item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, 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; - } + while ( it.current() ) { + item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QString(it.currentKey()+": "+*it.current()) ); + ++it; + } displayDetails(); @@ -60,12 +75,12 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *s) 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")); - } + { + 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")); + } } @@ -117,15 +132,15 @@ QPixmap PackageListItem::statePixmap() const if ( !installed ) - if (old) + 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; - } + 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; + if (old) return *pm_installed_old; + else return *pm_installed; } else { //toProcess() == true @@ -162,10 +177,10 @@ void PackageListItem::displayDetails() { - QString sod; - sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); - //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); - sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); + QString sod; + sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); + //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); + sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); setText(0, package->name()+sod ); - nameItem->setText( 0, QObject::tr("Name: ")+package->name()); - linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); + nameItem->setText( 0, QObject::tr("Name: ")+package->name()); + linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); @@ -174 +189,51 @@ void PackageListItem::displayDetails() } + +QPopupMenu* PackageListItem::getPopupMenu() +{ + popupMenu->clear(); + destsMenu->clear(); + + QAction *popupAction; + qDebug("PackageListItem::showPopup "); + + if (!package->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, popupMenu, 0 ); + popupAction->addTo( destsMenu ); + if ( dests[i] == ad && getPackage()->toInstall() ) + { + popupAction->setToggleAction( true ); + popupAction->setOn(true); + } + } + connect( destsMenu, SIGNAL( activated( int ) ), + this, SLOT( menuAction( int ) ) ); + popupMenu->popup( QCursor::pos() ); + }else{ + popupMenu->insertItem( QObject::tr("Remove")); + connect( popupMenu, SIGNAL( activated( int ) ), + this, SLOT( menuAction( int ) ) ); + popupMenu->popup( QCursor::pos() ); + } + return popupMenu; +} + +void PackageListItem::menuAction( int i ) +{ + if (package->installed()){ + package->setDest( destsMenu->text(i) ); + package->setLink( settings->createLinks() ); + } + package->setOn(); + displayDetails(); +} + +//void PackageListItem::toggleProcess() +//{ +// package->toggleProcess() ; +// displayDetails(); +//}
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index dba44f7..ca0cf17 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h @@ -12,6 +12,5 @@ -#include "package.h" #include <qstring.h> -#include <qlistview.h> +//#include <qlistview.h> #include <qpainter.h> @@ -20,10 +19,18 @@ +#include "listviewitemoipkg.h" +#include "package.h" #include "pksettings.h" -class PackageListItem -: public QCheckListItem +class QPopupMenu; + +class PackageListItem : public ListViewItemOipkg { public: - PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); - PackageListItem(QListView*, Package*, PackageManagerSettings*); + PackageListItem(ListViewItemOipkg *parent, QString name, Type ittype); + PackageListItem( + ListViewItemOipkg *parent, + OipkgPackage *pack, + PackageManagerSettings *s); + PackageListItem(QListView*, OipkgPackage*, PackageManagerSettings*); + ~PackageListItem(); void paintCell( QPainter*, const QColorGroup&, int, int, int ); @@ -32,3 +39,3 @@ public: QString key( int, bool ) const; - Package* getPackage() { return package; } ; + OipkgPackage* getPackage() { return package; } ; QString getName() { return package->name(); } ; @@ -39,3 +46,7 @@ public: private: - void init(Package*, PackageManagerSettings*); + QPopupMenu *popupMenu; + QPopupMenu *destsMenu; + void init(OipkgPackage*, PackageManagerSettings*); + virtual QPopupMenu* getPopupMenu(); + static QPopupMenu *_destsMenu; QCheckListItem *nameItem; @@ -45,3 +56,6 @@ private: PackageManagerSettings *settings; - Package *package; + OipkgPackage *package; +protected slots: + // void toggleProcess(); + virtual void menuAction( int ); }; diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp index b8a19253..2fe75bc 100644 --- a/noncore/unsupported/oipkg/packagelistlocal.cpp +++ b/noncore/unsupported/oipkg/packagelistlocal.cpp @@ -71,3 +71,3 @@ void PackageListLocal::update() parseStatus(); - pvDebug( 2, "parseList"); + pvDebug( 2, "parseList "+listsDir); parseList(); diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 0d6fa80..3c7435d 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -14,2 +14,3 @@ +#include "listviewitemoipkg.h" #include "packagelistitem.h" @@ -18,17 +19,15 @@ PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) - : QListView(p,n) + : QListView(p,n) { - settings = s; - popupMenu = new QPopupMenu( this ); - destsMenu = new QPopupMenu( popupMenu ); + settings = s; popupTimer = new QTimer( this ); setSelectionMode(QListView::NoSelection); - addColumn( tr("Package") ); - setRootIsDecorated( true ); + addColumn( tr("Package") ); + setRootIsDecorated( true ); connect( popupTimer, SIGNAL(timeout()), - this, SLOT(showPopup()) ); + this, SLOT(showPopup()) ); connect( this, SIGNAL( pressed( QListViewItem* ) ), - this, SLOT( setCurrent( QListViewItem* ) ) ); - connect( this, SIGNAL( clicked( QListViewItem* ) ), + this, SLOT( setCurrent( QListViewItem* ) ) ); + connect( this, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( stopTimer( QListViewItem* ) ) ); @@ -43,18 +42,24 @@ void PackageListView::setCurrent( QListViewItem* p ) { - if ( !p ) return; - activePackageListItem = (PackageListItem*)p; - activePackage = activePackageListItem->getPackage(); - if (!activePackage) - { -// QDictIterator<QCheckListItem> it( rootItems ); -// while ( it.current() ) + qDebug("PackageListView::setCurrent "); + activeItem = (ListViewItemOipkg*)p; + + if ( activeItem != 0 ) popupTimer->start( 750, true ); + +// if ( activeItem->getType() != ListViewItemOipkg::Package ){ +// qDebug("PackageListView::setCurrent !p "); +// activePackage = 0; +// activePackageListItem = 0; +// qDebug("PackageListView::setCurrent returning "); +// return; +// }; +// activePackageListItem = (PackageListItem*)p; +// activePackage = activePackageListItem->getPackage(); +// if (activePackage == 0 ) // { -// if ( it.current()==p ) -// pvDebug(2,"current item"); -// ++it; -// } +// qDebug("PackageListView::setCurrent if (!activePackage)"); +// return; +// } + - return; - } - popupTimer->start( 750, true ); + qDebug("PackageListView::setCurrent popupTimer->start"); } @@ -64,33 +69,7 @@ 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() ); + qDebug("PackageListView::showPopup"); + QPopupMenu *popup = activeItem->getPopupMenu(); + if (popup == 0) return; + popup->popup( QCursor::pos() ); + qDebug("PackageListView::showPopup"); } @@ -99,3 +78,3 @@ void PackageListView::stopTimer( QListViewItem* ) { - popupTimer->stop(); + popupTimer->stop(); } @@ -103,27 +82,13 @@ void PackageListView::stopTimer( QListViewItem* ) -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; + QDictIterator<PackageList> list( PackageLists ); + PackageList *packlist; + OipkgPackage *pack; PackageListItem *item; - QCheckListItem *rootItem; + ListViewItemOipkg *rootItem; QListViewItem* it; QListViewItem* itdel; - while ( list.current() ) { - packlist = list.current(); + while ( list.current() ) { + packlist = list.current(); rootItem = rootItems.find( list.currentKey() ); @@ -132,14 +97,14 @@ void PackageListView::display() while ( it ) - { - itdel = it; - it = it->nextSibling(); - delete itdel; - } + { + itdel = it; + it = it->nextSibling(); + delete itdel; + } pack = packlist->first(); - while( pack ) - { - item = new PackageListItem( rootItem, pack, settings ); + while( pack ) + { + item = new PackageListItem( rootItem, pack, settings ); pack = packlist->next(); - } - ++list; + } + ++list; } @@ -149,5 +114,5 @@ void PackageListView::addList( QString n, PackageList* pl) { - PackageLists.insert(n, pl); - QCheckListItem *item = new QCheckListItem(this,n); - rootItems.insert(n, item); + PackageLists.insert(n, pl); + ListViewItemOipkg *item = new ListViewItemOipkg(this,n,ListViewItemOipkg::Feed); + rootItems.insert(n, item); } diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index 3c09ba8..17dcb95 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h @@ -20,2 +20,3 @@ #include <qpopupmenu.h> +#include "listviewitemoipkg.h" #include "packagelist.h" @@ -24,4 +25,5 @@ class PackageListItem; -class Package; +class OipkgPackage; class PackageManagerSettings; +//class ListViewItemOipkg; @@ -37,7 +39,8 @@ public: private: - QDict<PackageList> PackageLists; - QDict<QCheckListItem> rootItems; - PackageManagerSettings *settings; - Package *activePackage; - PackageListItem *activePackageListItem; + QDict<PackageList> PackageLists; + QDict<ListViewItemOipkg> rootItems; + PackageManagerSettings *settings; +// OipkgPackage *activePackage; +// PackageListItem *activePackageListItem; + ListViewItemOipkg *activeItem; QPopupMenu *popupMenu; @@ -46,6 +49,4 @@ public slots: void showPopup(); - void changePackageDest( int ); void setCurrent( QListViewItem* ); void stopTimer( QListViewItem* ); - void toggleProcess(); void display(); diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 2ed313c..cfaadbf 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -116,3 +116,3 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) -void PmIpkg::makeLinks(Package *pack) +void PmIpkg::makeLinks(OipkgPackage *pack) { @@ -234,3 +234,3 @@ void PmIpkg::loadList( PackageList *pl ) { - for( Package *pack = pl->first();pack ; (pack = pl->next()) ) + for( OipkgPackage *pack = pl->first();pack ; (pack = pl->next()) ) { @@ -293,3 +293,3 @@ void PmIpkg::remove() - QStringList *fileList; + QStringList *fileList = new QStringList; for (uint i=0; i < to_remove.count(); i++) @@ -416,3 +416,3 @@ void PmIpkg::installFile(const QString &fileName, const QString &dest) pvDebug( 2,"PmIpkg::installFile "+ fileName); - Package *p = new Package(fileName,settings); + OipkgPackage *p = new OipkgPackage(fileName,settings); if ( dest!="") p->setDest( dest ); @@ -429,3 +429,3 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest) pvDebug( 2,"PmIpkg::removeFile "+ fileName); - Package *p = new Package(fileName,settings); + OipkgPackage *p = new OipkgPackage(fileName,settings); if ( dest!="") p->setDest( dest ); diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 2f4d6ae..cb0759a 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -25,3 +25,3 @@ -class Package; +class OipkgPackage; class PmIpkg : public QObject @@ -55,5 +55,5 @@ private: InstallDialog *installDialog; - QList<Package> to_remove; - QList<Package> to_install; - void makeLinks(Package*); + QList<OipkgPackage> to_remove; + QList<OipkgPackage> to_install; + void makeLinks(OipkgPackage*); void linkPackage( QString, QString ); |