summaryrefslogtreecommitdiff
authortille <tille>2002-04-27 13:06:45 (UTC)
committer tille <tille>2002-04-27 13:06:45 (UTC)
commitdb90999f6298c1107888f062f2c25cb8817b528a (patch) (side-by-side diff)
tree020ebe65beb9286f3c63e4329fc3a0f298d34460
parente2f3288d468508f2cf7c0a327044963ca4b1b54a (diff)
downloadopie-db90999f6298c1107888f062f2c25cb8817b528a.zip
opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.gz
opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.bz2
added popup menu to choose inst dest (and more...)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO3
-rw-r--r--noncore/unsupported/oipkg/debug.h1
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp115
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h9
-rw-r--r--noncore/unsupported/oipkg/opie-oipkg.control2
-rw-r--r--noncore/unsupported/oipkg/package.cpp54
-rw-r--r--noncore/unsupported/oipkg/package.h22
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp46
-rw-r--r--noncore/unsupported/oipkg/packagelist.h8
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp44
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h8
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp24
-rw-r--r--noncore/unsupported/oipkg/pksettings.h3
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp112
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h12
-rw-r--r--noncore/unsupported/oipkg/runwindow.ui2
-rw-r--r--noncore/unsupported/oipkg/settings.h2
17 files changed, 312 insertions, 155 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index c53ca93..744cba4 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -1,4 +1,2 @@
-* search
* Settings Class
-* make oipkg determine dest of "to remove" apps
* tr() ;)
@@ -7,3 +5,2 @@
* install local file
-* install to dest with click on packet
* qcop
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h
index c53e36c..e73b9b2 100644
--- a/noncore/unsupported/oipkg/debug.h
+++ b/noncore/unsupported/oipkg/debug.h
@@ -9,2 +9,3 @@ extern int debugLevel;
+#define NEWLAYOUT
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index c803ca0..25ca889 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -9,2 +9,3 @@
#include <qpe/qpetoolbar.h>
+#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
@@ -31,2 +32,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
listViewPackages = new QListView( this,0,0 );
+ listViewPackages->setSelectionMode(QListView::NoSelection);
setCentralWidget( listViewPackages );
@@ -34,3 +36,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
makeMenu();
-
+#ifdef NEWLAYOUT
+ listViewPackages->addColumn( tr("Package") );
+ listViewPackages->setRootIsDecorated( true );
+#endif
+#ifndef NEWLAYOUT
QFontMetrics fm = fontMetrics();
@@ -40,3 +46,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
int w2 = fm.width("00000")+4;
- int w1 = wlw-w2-w0-20;
+ int w1 = wlw-w2-w0-24;
listViewPackages->addColumn( tr("Package"), w0 );
@@ -48,3 +54,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
listViewPackages->setSelectionMode( QListView::Multi );
-
+#endif
connect( section, SIGNAL( activated(int) ),
@@ -55,3 +61,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
this, SLOT( setCurrent( QListViewItem* ) ) );
-
+ connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ),
+ this, SLOT( stopTimer( QListViewItem* ) ) );
+
+ popupMenu = new QPopupMenu( this );
+
settings = new PackageManagerSettings(this,0,TRUE);
@@ -76,5 +86,6 @@ void MainWindow::makeMenu()
- popupMenu = new QPopupMenu( this );
-
- contextMenu = new QPopupMenu( this );
+ popupMenu = new QPopupMenu( this );
+ destsMenu = new QPopupMenu( popupMenu );
+ popupTimer = new QTimer( this );
+ connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) );
@@ -182,2 +193,10 @@ void MainWindow::makeMenu()
findAction->addTo( viewMenu );
+
+ #ifdef NEW
+ Config cfg( "oipkg", Config::User );
+ cfg.setGroup( "Setting_" + QString::number( setting ) );
+ CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) );
+ findShow(bool b)
+ sectionShow(bool b)
+ #endif
}
@@ -191,3 +210,8 @@ void MainWindow::runIpkg()
ipkg->commit( packageList );
-// updateList(); //to remove
+ // ##### If we looked in the list of files, we could send out accurate
+ // ##### messages. But we don't bother yet, and just do an "all".
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
+ displayList();
}
@@ -202,3 +226,3 @@ void MainWindow::updateList()
getList();
- t->stop();
+ t->stop();
}
@@ -226,3 +250,3 @@ void MainWindow::displayList()
if ( pack && (pack->name() != "") )
- listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) );
+ listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
pack = packageList.next();
@@ -293,16 +317,20 @@ void MainWindow::showDetails()
{
- if ( activePackage ) return;
if ( details )
- {
- details = new PackageDetails( this );
- connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) );
- connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) );
- connect( details->ignore, SIGNAL(clicked()), details, SLOT(close()));
- details->description->setTextFormat(RichText);
- }
-
- details->setCaption("Package: " + activePackage->name());
- details->description->setText(activePackage->details() );
- details->install->setEnabled(!activePackage->installed());
- details->remove->setEnabled(activePackage->installed());
+ {
+ details = new PackageDetails( this );
+ connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) );
+ connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) );
+ connect( details->ignore, SIGNAL(clicked()), details, SLOT(close()));
+ details->description->setTextFormat(RichText);
+ }
+ if ( !activePackage )
+ {
+ details->description->setText(tr("no package selected"));
+ details->description->setText(tr("errmm...<br>...not working?"));
+ }else{
+ details->setCaption("Package: " + activePackage->name());
+ details->description->setText(activePackage->details() );
+ details->install->setEnabled(!activePackage->installed());
+ details->remove->setEnabled(activePackage->installed());
+ }
details->showMaximized();
@@ -318,6 +346,7 @@ void MainWindow::setCurrent( QListViewItem* p )
{
- pvDebug(2, "MainWindow::setCurrent ");
- return;
- pvDebug(2, "name "+((Package*)p)->name());
- activePackage = (Package*)p;
+ if ( !p ) return;
+ activePackageListItem = (PackageListItem*)p;
+ activePackage = activePackageListItem->getPackage();
+ pvDebug(5, "start timer");
+ popupTimer->start( 750, true );
}
@@ -357 +386,33 @@ void MainWindow::rotateUpdateIcon()
}
+
+void MainWindow::showPopup()
+{
+ popupMenu->clear();
+ destsMenu->clear();
+
+ QAction *popupAction;
+ popupMenu->insertItem( tr("Install to"), destsMenu );
+ QStringList dests = settings->getDestinationNames();
+ for (uint i = 0; i < dests.count(); i++ )
+ {
+ popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
+ popupAction->addTo( destsMenu );
+ }
+ connect( destsMenu, SIGNAL( activated( int ) ),
+ this, SLOT( changePackageDest( int ) ) );
+ popupMenu->popup( QCursor::pos() );
+}
+
+void MainWindow::changePackageDest( int i )
+{
+ activePackage->setDest( destsMenu->text(i) );
+ activePackage->setOn();
+ activePackage->setLink( settings->createLinks() );
+ activePackageListItem->displayDetails();
+}
+
+void MainWindow::stopTimer( QListViewItem* )
+{
+ pvDebug( 5, "stop timer" );
+ popupTimer->stop();
+}
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 892d5e8..adc5e78 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -17,3 +17,3 @@ class QLineEdit;
class QListView;
-
+class PackageListItem;
@@ -48,2 +48,5 @@ public slots:
void filterList();
+ void showPopup();
+ void changePackageDest( int );
+ void stopTimer( QListViewItem* );
@@ -59,2 +62,3 @@ private:
Package *activePackage;
+ PackageListItem *activePackageListItem;
QAction *runAction;
@@ -65,3 +69,2 @@ private:
QListView *listViewPackages;
- QPopupMenu *contextMenu;
QPEToolBar *findBar;
@@ -71,3 +74,5 @@ private:
QComboBox *subsection;
+ QTimer *popupTimer;
QPopupMenu *popupMenu;
+ QPopupMenu *destsMenu;
bool updateIcon;
diff --git a/noncore/unsupported/oipkg/opie-oipkg.control b/noncore/unsupported/oipkg/opie-oipkg.control
index 89cc0b4..2ffec71 100644
--- a/noncore/unsupported/oipkg/opie-oipkg.control
+++ b/noncore/unsupported/oipkg/opie-oipkg.control
@@ -6,3 +6,3 @@ Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
-Depends: opie-base ($QPE_VERSION)
+Depends: opie-base ($QPE_VERSION), ipkg (>0.9)
Description: Package Manager
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 1705f78..9f602b5 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -11,4 +11,10 @@ Package::~Package()
-Package::Package()
+Package::Package( PackageManagerSettings *s )
{
+ init(s);
+}
+
+void Package::init( PackageManagerSettings *s )
+{
+ settings = s;
_size = "";
@@ -21,7 +27,8 @@ Package::Package()
_status = "";
+ _dest = "";
}
-Package::Package( QStringList pack )
+Package::Package( QStringList pack, PackageManagerSettings *s )
{
- Package();
+ init(s);
parsePackage( pack );
@@ -30,5 +37,5 @@ Package::Package( QStringList pack )
-Package::Package( QString n )
+Package::Package( QString n, PackageManagerSettings *s )
{
- Package();
+ init(s);
_name = QString( n );
@@ -39,3 +46,3 @@ Package::Package( Package *pi )
{
- Package();
+ init(pi->settings);
copyValues( pi );
@@ -174,3 +181,3 @@ void Package::copyValues( Package* pack )
-QString Package::getSection()
+QString Package::section()
{
@@ -192,3 +199,3 @@ void Package::setSection( QString s)
-QString Package::getSubSection()
+QString Package::subSection()
{
@@ -255,3 +262,2 @@ QString Package::details()
-/** No descriptions */
void Package::processed()
@@ -259,3 +265,3 @@ void Package::processed()
_toProcess = false;
- //hack, but we're mot writing status anyway...
+ //hack, but we're not writing status anyway...
if ( installed() ) _status = "install";
@@ -263 +269,29 @@ void Package::processed()
}
+
+QString Package::dest()
+{
+ if ( installed()||(!installed() && _toProcess) )
+ return _dest!=""?_dest:settings->getDestinationName();
+ else return "";
+}
+
+void Package::setDest( QString d )
+{
+ _dest = d;
+}
+
+void Package::setOn()
+{
+ _toProcess = true;
+}
+
+bool Package::link()
+{
+ if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
+ return _link;
+}
+
+void Package::setLink(bool b)
+{
+ _link = b;
+}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index cf2af75..6c292ed 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -10,2 +10,4 @@
+#include "pksettings.h"
+
class Package //: public QObject
@@ -14,6 +16,6 @@ class Package //: public QObject
public:
- Package();
+ Package(PackageManagerSettings *);
~Package();
- Package( QStringList );
- Package( QString );
+ Package( QStringList, PackageManagerSettings * );
+ Package( QString, PackageManagerSettings * );
Package( Package* );
@@ -31,4 +33,4 @@ class Package //: public QObject
void setSection( QString );
- QString getSection();
- QString getSubSection();
+ QString section();
+ QString subSection();
QString details();
@@ -37,4 +39,8 @@ class Package //: public QObject
bool toRemove();
- /** No descriptions */
void processed();
+ QString dest();
+ void setDest( QString d );
+ void setOn();
+ bool link();
+ void setLink(bool);
public slots:
@@ -43,4 +49,6 @@ public slots:
private:
+ PackageManagerSettings *settings;
QString _name;
bool _toProcess;
+ bool _link;
QString _status;
@@ -51,3 +59,5 @@ private:
QString _desc;
+ QString _dest;
void parsePackage( QStringList );
+ void init(PackageManagerSettings *);
};
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 944bb83..035ec81 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -72,4 +72,4 @@ void PackageList::filterPackages( QString f )
if (
- ((aktSection=="All")||(pack->getSection()==aktSection)) &&
- ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) &&
+ ((aktSection=="All")||(pack->section()==aktSection)) &&
+ ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
pack->name().contains( f )
@@ -128,3 +128,3 @@ void PackageList::updateSections( Package* pack )
{
- QString s = pack->getSection();
+ QString s = pack->section();
if ( s.isEmpty() || s == "") return;
@@ -132,3 +132,3 @@ void PackageList::updateSections( Package* pack )
sections += s;
- QString ss = pack->getSubSection();
+ QString ss = pack->subSection();
if ( ss.isEmpty() || ss == "" ) return;
@@ -152,6 +152,9 @@ void PackageList::parseStatus()
QStringList dests = settings->getDestinationUrls();
- for ( QStringList::Iterator it = dests.begin(); it != dests.end(); ++it )
+ QStringList destnames = settings->getDestinationNames();
+ QStringList::Iterator name = destnames.begin();
+ for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
{
- pvDebug( 2,"Status Dir: "+*it+statusDir+"/status");
- readFileEntries( *it+statusDir+"/status" );
+ pvDebug( 2,"Status: "+*dir+statusDir+"/status");
+ readFileEntries( *dir+statusDir+"/status", *name );
+ ++name;
};
@@ -165,4 +168,4 @@ void PackageList::parseList()
{
- pvDebug( 2, "List Dir: "+listsDir+"/"+*it);
- readFileEntries( listsDir+"/"+*it );
+ pvDebug( 2, "List: "+listsDir+"/"+*it);
+ readFileEntries( listsDir+"/"+*it, "" );
}
@@ -170,3 +173,3 @@ void PackageList::parseList()
-void PackageList::readFileEntries( QString filename )
+void PackageList::readFileEntries( QString filename, QString dest )
{
@@ -184,3 +187,4 @@ void PackageList::readFileEntries( QString filename )
{
- Package *p = new Package( packEntry );
+ Package *p = new Package( packEntry, settings );
+ p->setDest( dest );
if ( p )
@@ -201,7 +205,7 @@ void PackageList::update()
{
- pvDebug( 3, "parseStatus");
+ pvDebug( 2, "parseStatus");
parseStatus();
- pvDebug( 3, "parseList");
+ pvDebug( 2, "parseList");
parseList();
- pvDebug( 3, "finished parsing");
+ pvDebug( 2, "finished parsing");
}
@@ -223 +227,15 @@ void PackageList::clear()
}
+
+void PackageList::allPackages()
+{
+ packageList.clear();
+ QDictIterator<Package> filterIter( origPackageList );
+ filterIter.toFirst();
+ Package *pack= filterIter.current() ;
+ while ( pack )
+ {
+ packageList.insert( pack->name(), pack );
+ ++filterIter;
+ pack = filterIter.current();
+ }
+}
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index 4ce97af..7c326ca 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -14,3 +14,5 @@
-class PackageList {
+class PackageList //:QObject
+{
+// Q_OBJECT
public:
@@ -31,4 +33,4 @@ public:
Package* getByName( QString );
- /** No descriptions */
void clear();
+ void allPackages();
@@ -63,3 +65,3 @@ private:
void parseList();
- void readFileEntries( QString );
+ void readFileEntries( QString file, QString dest );
};
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 5d08bb1..149ba35 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -3,2 +3,5 @@
#include <qpe/resource.h>
+#include <qobject.h>
+
+#include "debug.h"
@@ -9,3 +12,3 @@ static QPixmap *pm_install=0;
-PackageListItem::PackageListItem(QListView* lv, Package *pi)
+PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lv,pi->name(),CheckBox)
@@ -13,2 +16,24 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi)
package = pi;
+ settings = s;
+ setExpandable( true );
+ QCheckListItem *item;
+#ifndef NEWLAYOUT
+ item = new QCheckListItem( this, QObject::tr("Name") );
+ item->setText(1,pi->name());
+ item = new QCheckListItem( this, QObject::tr("Description") );
+ item->setText(1,pi->desc()+"\ntest multi\nline");
+ item = new QCheckListItem( this, QObject::tr("Size") );
+ item->setText(1,pi->size());
+ item = new QCheckListItem( this, QObject::tr("Destination") );
+ item->setText(1,pi->getDest());
+#endif
+#ifdef NEWLAYOUT
+ item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() );
+ 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, "" );
+ displayDetails();
+#endif
+
if (!pm_uninstalled) {
@@ -19,4 +44,6 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi)
}
+#ifndef NEWLAYOUT
setText(1, package->shortDesc() );
setText(2, package->size() );
+#endif
}
@@ -95,2 +122,17 @@ void PackageListItem::setOn( bool b )
package->toggleProcess();
+// if ( b )
+// {
+// if ((package->dest()).isEmpty)
+// package->setDest( settings->getDestinationName() );
+// }else{
+// package->setDest( QObject::tr("not installed"));
+// }
+ package->setLink( settings->createLinks() );
+ displayDetails();
+}
+
+void PackageListItem::displayDetails()
+{
+ linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) );
+ destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
repaint();
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h
index 6983e58..f695432 100644
--- a/noncore/unsupported/oipkg/packagelistitem.h
+++ b/noncore/unsupported/oipkg/packagelistitem.h
@@ -11,2 +11,4 @@
+#include "pksettings.h"
+
class PackageListItem
@@ -15,3 +17,3 @@ class PackageListItem
public:
- PackageListItem(QListView*, Package* );
+ PackageListItem(QListView*, Package*, PackageManagerSettings*);
void paintCell( QPainter*, const QColorGroup&, int, int, int );
@@ -24,4 +26,8 @@ public:
virtual void setOn ( bool );
+ void displayDetails();
private:
+ QCheckListItem *destItem;
+ QCheckListItem *linkItem;
+ PackageManagerSettings *settings;
Package *package;
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp
index 32224b5..f84a9c4 100644
--- a/noncore/unsupported/oipkg/pksettings.cpp
+++ b/noncore/unsupported/oipkg/pksettings.cpp
@@ -471,2 +471,3 @@ QStringList PackageManagerSettings::getActiveServers()
}
+
/** returns the destination listed in ipkg.conf */
@@ -482,2 +483,25 @@ QStringList PackageManagerSettings::getDestinationUrls()
+/** returns the destination listed in ipkg.conf */
+QString PackageManagerSettings::getDestinationUrlByName(QString n)
+{
+ QStringList sl;
+ for (int i=0; i<(int)destinations->count(); i++)
+ {
+ if ( n == destinations->text(i)) return*destinationurlDic[i];
+ }
+ return "";
+}
+
+/** returns the destination listed in ipkg.conf */
+QStringList PackageManagerSettings::getDestinationNames()
+{
+ QStringList sl;
+ for (int i=0; i<(int)destinations->count(); i++)
+ {
+ sl += destinations->text(i);
+ }
+ return sl;
+}
+
+
void PackageManagerSettings::linkEnabled( bool b )
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h
index 2982f1c..11ba55c 100644
--- a/noncore/unsupported/oipkg/pksettings.h
+++ b/noncore/unsupported/oipkg/pksettings.h
@@ -21,2 +21,5 @@ public:
QStringList getDestinationUrls();
+ QStringList getDestinationNames();
+ QString getDestinationUrlByName(QString);
+
private:
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index eae73ad..3b31b4d 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -10,3 +10,2 @@
#include <qpe/stringutil.h>
-#include <qpe/qcopenvelope_qws.h>
#include <qdir.h>
@@ -42,3 +41,3 @@ PmIpkg::~PmIpkg()
#define SYSTEM
-int PmIpkg::runIpkg(const QString& args)
+int PmIpkg::runIpkg(const QString& args, const QString& dest )
{
@@ -46,9 +45,2 @@ int PmIpkg::runIpkg(const QString& args)
- //to make script ipkg happy
- pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg");
- if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg"))
- {
- QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg");
- instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg");
- }
#ifdef PROC
@@ -59,3 +51,8 @@ int PmIpkg::runIpkg(const QString& args)
#endif
- cmd += " -dest "+settings->getDestinationName();
+ pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
+ if ( dest == "" )
+ cmd += " -dest "+settings->getDestinationName();
+ else
+ cmd += " -dest "+ dest;
+
cmd += " -force-defaults ";
@@ -64,3 +61,2 @@ int PmIpkg::runIpkg(const QString& args)
cmd += args;
- out( "running:<br>\n"+cmd+"<br>\n" );
int r = 0;
@@ -68,8 +64,10 @@ int PmIpkg::runIpkg(const QString& args)
QString o = "start";
- Process ipkg( cmd );
+ Process *ipkg = new Process( "ls");//cmd );
+ out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
QString description;
- ipkg.exec("",o);
- out( o );
+ ipkg->exec("",o);
+// out( o );
#endif
#ifdef SYSTEM
+ out( "running:<br>\n"+cmd+"<br>\n" );
QString redirect = "/tmp/oipkg.pipe";
@@ -82,3 +80,3 @@ int PmIpkg::runIpkg(const QString& args)
while ( ! f.open(IO_ReadOnly) ) {};
- {
+ // {
QTextStream t( &f );
@@ -88,6 +86,9 @@ int PmIpkg::runIpkg(const QString& args)
line = t.readLine();
- if ( line != oldLine ) out( line +"<br>" );
- oldLine = line;
+ if ( line != oldLine )
+ {
+ out( line +"<br>" );
+ oldLine = line;
+ }
}
- }
+// }
f.close();
@@ -99,8 +100,9 @@ int PmIpkg::runIpkg(const QString& args)
-void PmIpkg::makeLinks(QString pack)
+void PmIpkg::makeLinks(Package *pack)
{
- pvDebug( 2, "PmIpkg::makeLinks "+ pack);
+ pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
+ QString dest = settings->getDestinationUrlByName( pack->dest() );
+ if (dest == "/" ) return;
out( "<br>creating links<br>" );
- QString dest = settings->getDestinationUrl();
- out("for package "+pack+" in "+dest+"<br>");
+ out("for package "+pack->name()+" in "+dest+"<br>");
{
@@ -110,3 +112,3 @@ void PmIpkg::makeLinks(QString pack)
}
- QString fn = dest+"/"+statusDir+"/info/"+pack+".list";
+ QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list";
QFile f( fn );
@@ -115,2 +117,3 @@ void PmIpkg::makeLinks(QString pack)
out( "<b>Panik!</b> Could not open:<br>"+fn );
+ return;
};
@@ -128,4 +131,6 @@ void PmIpkg::processLinkDir( QString file, QString dest )
{
+ if ( dest == "???" ) return;
QString destFile = file;
file = dest+"/"+file;
+ if (file == dest) return;
QFileInfo fileInfo( file );
@@ -168,2 +173,3 @@ void PmIpkg::commit( PackageList pl )
QString inst="<b>To install:</b><br>\n";;
+ pl.allPackages();
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
@@ -174,10 +180,5 @@ void PmIpkg::commit( PackageList pl )
{
- #ifndef NEWLIST
- to_install.append( pack->name() );
- #endif
- #ifdef NEWLIST
to_install.append( pack );
sizecount += pack->size().toInt();
- #endif
- inst += pack->name()+"<br>";
+ inst += pack->name()+"\t(on "+pack->dest()+")<br>";
}
@@ -185,9 +186,4 @@ void PmIpkg::commit( PackageList pl )
{
- #ifndef NEWLIST
- to_remove.append( pack->name() );
- #endif
- #ifdef NEWLIST
to_remove.append( pack );
sizecount += 1;
- #endif
rem += pack->name()+"<br>";
@@ -213,7 +209,2 @@ void PmIpkg::commit( PackageList pl )
runwindow->exec();
- // ##### If we looked in the list of files, we could send out accurate
- // ##### messages. But we don't bother yet, and just do an "all".
- QCopEnvelope e("QPE/System", "linkChanged(QString)");
- QString lf = QString::null;
- e << lf;
return;
@@ -235,14 +226,2 @@ void PmIpkg::remove()
- #ifndef NEWLIST
- for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it)
- {
- if ( runIpkg("remove " + *it) == 0)
- {
-
- }else{
- out("<b>"+tr("Error while removing")+"</b>"+*it);
- }
- }
-#endif
- #ifdef NEWLIST
for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
@@ -258,3 +237,2 @@ void PmIpkg::remove()
}
-#endif
}
@@ -267,22 +245,10 @@ void PmIpkg::install()
out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
- #ifndef NEWLIST
- for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it)
- {
- if ( runIpkg("install " + *it) == 0 )
- {
- if ( settings->createLinks() )
- makeLinks( *it );
- }else{
- out("<b>"+tr("Error while installing")+"</b>"+*it);
- }
- }
-#endif
- #ifdef NEWLIST
- for (Package *it=to_install.first(); it != 0; it=to_install.next() )
+ for (Package *it=to_install.first(); it != 0; it=to_install.next() )
{
- if ( runIpkg("install " + it->name()) == 0 )
+
+ if ( runIpkg("install " + it->name(), it->dest() ) == 0 )
{
runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
- if ( settings->createLinks() )
- makeLinks( it->name() );
+ if ( it->link() )
+ makeLinks( it );
it->processed();
@@ -292,3 +258,2 @@ void PmIpkg::install()
}
-#endif
}
@@ -296,3 +261,2 @@ void PmIpkg::install()
void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
-// add 3rd package parameter
{
@@ -347,6 +311,6 @@ void PmIpkg::show(bool b)
showButtons(b);
-// if ( b )
+ if ( b )
runwindow->progress->hide();
-// else
-// runwindow->progress->show();
+ else
+ runwindow->progress->show();
}
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 2692017..c57adb7 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -13,3 +13,2 @@
-//#define NEWLIST
class Package;
@@ -31,16 +30,9 @@ private:
RunWindow *runwindow;
-#ifndef NEWLIST
- QStringList to_remove;
- QStringList to_install;
-#endif
-#ifdef NEWLIST
QList<Package> to_remove;
QList<Package> to_install;
-#endif
bool runwindowopen;
- void makeLinks(QString);
+ void makeLinks(Package*);
void processLinkDir( QString, QString );
-
- int runIpkg(const QString& args);
+ int runIpkg(const QString& args, const QString& dest="" );
void out( QString );
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui
index 5359fe2..52da408 100644
--- a/noncore/unsupported/oipkg/runwindow.ui
+++ b/noncore/unsupported/oipkg/runwindow.ui
@@ -44,3 +44,3 @@
<name>progress</name>
- <number>42</number>
+ <number>0</number>
</property>
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h
index 5df522b..cf6e614 100644
--- a/noncore/unsupported/oipkg/settings.h
+++ b/noncore/unsupported/oipkg/settings.h
@@ -22,4 +22,2 @@ public:
QStringList getDestinationUrls();
- /** No descriptions */
- QComboBox getActiveDestinationCombo();