summaryrefslogtreecommitdiff
authortille <tille>2002-04-25 21:06:23 (UTC)
committer tille <tille>2002-04-25 21:06:23 (UTC)
commit054b0f3268189d6f8f06135960042a7f51117223 (patch) (side-by-side diff)
tree2ab5eef44d4e6604d6c0a45e51608390c8b3a521
parentc06667cd62b945a05edce621aab34358ee0e964f (diff)
downloadopie-054b0f3268189d6f8f06135960042a7f51117223.zip
opie-054b0f3268189d6f8f06135960042a7f51117223.tar.gz
opie-054b0f3268189d6f8f06135960042a7f51117223.tar.bz2
installation messages working
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp10
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro3
-rw-r--r--noncore/unsupported/oipkg/package.cpp10
-rw-r--r--noncore/unsupported/oipkg/package.h2
-rw-r--r--noncore/unsupported/oipkg/pksettingsbase.ui10
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp142
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h14
-rw-r--r--noncore/unsupported/oipkg/runwindow.ui112
8 files changed, 233 insertions, 70 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 997f449..54ee115 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -56,146 +56,146 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
settings = new PackageManagerSettings(this,0,TRUE);
ipkg = new PmIpkg( settings, this );
packageList.setSettings( settings );
getList();
setSections();
setSubSections();
displayList();
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
QPopupMenu *srvMenu = new QPopupMenu( menuBar );
QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
// QPopupMenu *sectMenu = new QPopupMenu( menuBar );
popupMenu = new QPopupMenu( this );
contextMenu = new QPopupMenu( this );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Package" ), srvMenu );
menuBar->insertItem( tr( "View" ), viewMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
// menuBar->insertItem( tr( "Sections" ), sectMenu );
QLabel *spacer = new QLabel( "", toolBar );
spacer->setBackgroundColor( toolBar->backgroundColor() );
toolBar->setStretchableWidget( spacer );
runAction = new QAction( tr( "Commit" ),
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/repeat" ),
+ Resource::loadIconSet( "oipkg/update" ),
QString::null, 0, this, 0 );
connect( updateAction, SIGNAL( activated() ),
this , SLOT( updateList() ) );
updateAction->addTo( toolBar );
updateAction->addTo( srvMenu );
detailsAction = new QAction( tr( "Details" ),
Resource::loadIconSet( "find" ),
QString::null, 0, this, 0 );
connect( detailsAction, SIGNAL( activated() ),
this , SLOT( showDetails() ) );
detailsAction->addTo( toolBar );
detailsAction->addTo( srvMenu );
QAction *cfgact;
cfgact = new QAction( tr( "Setups" ),
// Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettings() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Servers" ),
// Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsSrv() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Destinations" ),
// Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsDst() ) );
cfgact->addTo( cfgMenu );
QAction *a;
sectionBar = new QPEToolBar( this );
addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
sectionBar->setHorizontalStretchable( true );
QLabel *label = new QLabel( tr("Section: "), sectionBar );
label->setBackgroundColor( sectionBar->backgroundColor() );
+ sectionBar->setStretchableWidget( label );
section = new QComboBox( false, sectionBar );
// section->setBackgroundMode( PaletteBackground );
label = new QLabel( " / ", sectionBar );
label->setBackgroundColor( sectionBar->backgroundColor() );
subsection = new QComboBox( false, sectionBar );
- sectionBar->setStretchableWidget( label );
a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
a->addTo( sectionBar );
sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
sectionAction->setToggleAction( true );
sectionAction->setOn( true );
sectionAction->addTo( viewMenu );
findBar = new QPEToolBar(this);
addToolBar( findBar, "Search", QMainWindow::Top, TRUE );
label = new QLabel( tr("Filter: "), findBar );
label->setBackgroundColor( findBar->backgroundColor() );
findBar->setHorizontalStretchable( TRUE );
findEdit = new QLineEdit( findBar, "findEdit" );
findBar->setStretchableWidget( findEdit );
connect( findEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( displayList() ) );
// a = new QAction( tr( "Filter" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
// connect( a, SIGNAL( activated() ), this, SLOT( filterList() ) );
// a->addTo( findBar );
// a->addTo( edit );
a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
a->addTo( findBar );
findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
findAction->setToggleAction( true );
findAction->setOn( true );
findAction->addTo( viewMenu );
}
MainWindow::~MainWindow()
{
}
void MainWindow::runIpkg()
{
ipkg->commit( packageList );
updateList(); //to remove
}
void MainWindow::updateList()
{
packageList.clear();
@@ -230,107 +230,107 @@ void MainWindow::displayList()
}
void MainWindow::sectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
subsection->clear();
packageList.setSection( section->currentText() );
setSubSections();
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::subSectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
packageList.setSubSection( subsection->currentText() );
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::setSections()
{
section->clear();
section->insertStringList( packageList.getSections() );
}
void MainWindow::setSubSections()
{
subsection->clear();
subsection->insertStringList( packageList.getSubSections() );
}
void MainWindow::showSettings()
{
if ( settings->showDialog( 0 ) )
- getList();
+ updateList();
}
void MainWindow::showSettingsSrv()
{
if ( settings->showDialog( 1 ) )
- getList();
+ updateList();
}
void MainWindow::showSettingsDst()
{
if ( settings->showDialog( 2 ) )
- getList();
+ updateList();
}
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->showMaximized();
}
void MainWindow::toggleActivePackage()
{
activePackage->toggleProcess();
if ( details ) details->close();
}
void MainWindow::setCurrent( QListViewItem* p )
{
pvDebug(2, "MainWindow::setCurrent ");
return;
pvDebug(2, "name "+((Package*)p)->name());
activePackage = (Package*)p;
}
void MainWindow::sectionShow(bool b)
{
if (b) sectionBar->show();
else sectionBar->hide();
sectionAction->setOn( b );
}
void MainWindow::sectionClose()
{
sectionAction->setOn( false );
}
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index c16cc73..955c7f3 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -1,26 +1,25 @@
DESTDIR = $(OPIEDIR)/bin
TEMPLATE = app
#CONFIG = qt warn_on release
CONFIG = qt warn_on debug
HEADERS = mainwindow.h \
pksettings.h \
pmipkg.h \
packagelistitem.h \
packagelist.h \
package.h
SOURCES = main.cpp \
mainwindow.cpp \
pksettings.cpp \
pmipkg.cpp \
packagelistitem.cpp \
packagelist.cpp \
package.cpp
INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/ioclude
LIBS += -lqpe
INTERFACES = pkdesc.ui \
- pkfind.ui \
runwindow.ui \
pksettingsbase.ui
TARGET = oipkg
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index e317308..1705f78 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,68 +1,68 @@
#include "package.h"
#include <qpe/process.h>
#include <qpe/stringutil.h>
#include "debug.h"
Package::~Package()
{
}
Package::Package()
{
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
- _toProcess = true;
+ _toProcess = false;
_status = "";
}
Package::Package( QStringList pack )
{
Package();
parsePackage( pack );
_toProcess = false;
}
Package::Package( QString n )
{
Package();
_name = QString( n );
_toProcess = false;
}
Package::Package( Package *pi )
{
Package();
copyValues( pi );
_toProcess = false;
}
void Package::setValue( QString n, QString t )
{
if ( n == "Status" && installed() ) return;
if ( n == "Package" )
{
_name = QString( t );
}
if ( n == "Installed-Size" )
{
_size = t;
}
if ( n == "Priority")
{
}
if ( n == "Section")
{
setSection( t );
}
if ( n == "Maintainer")
{
}
@@ -208,48 +208,56 @@ void Package::parsePackage( QStringList pack )
QString tag = line.left(sep);
QString value = line.mid(sep+2).simplifyWhiteSpace();
setValue( tag, value );
}else{
}
}
return;
}
QString Package::details()
{
QString status;
Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
QString description;
if ( ipkg_status.exec("",status) )
{
QStringList lines = QStringList::split('\n',status,TRUE);
for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
QString line = *it;
if ( line == " ." )
{
description.append("<p>");
} else
if ( line[0] == ' ' || line[0] == '\t' )
{
// continuation
description.append(" ");
description.append(Qtopia::escapeString(line));
} else {
int sep = line.find(QRegExp(":[\t ]+"));
if ( sep >= 0 )
{
QString tag = line.left(sep);
description.append("<br>");
description.append("<b>");
description.append(Qtopia::escapeString(tag));
description.append(":</b> ");
description.append(Qtopia::escapeString(line.mid(sep+2)));
} else {
description.append(" ");
description.append(Qtopia::escapeString(line));
}
}
}
}
return description;
}
+/** No descriptions */
+void Package::processed()
+{
+ _toProcess = false;
+ //hack, but we're mot writing status anyway...
+ if ( installed() ) _status = "install";
+ else _status = "installed";
+}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 08d0c57..cf2af75 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -1,54 +1,56 @@
#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>
class Package //: public QObject
{
// Q_OBJECT
public:
Package();
~Package();
Package( QStringList );
Package( QString );
Package( Package* );
void setValue( QString, QString );
void copyValues( Package* );
QString name() ;
bool installed();
void setDesc( QString );
QString shortDesc();
QString desc();
QString size();
void setSection( QString );
QString getSection();
QString getSubSection();
QString details();
bool toProcess();
bool toInstall();
bool toRemove();
+ /** No descriptions */
+ void processed();
public slots:
void toggleProcess();
private:
QString _name;
bool _toProcess;
QString _status;
QString _size;
QString _section;
QString _subsection;
QString _shortDesc;
QString _desc;
void parsePackage( QStringList );
};
#endif
diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui
index ea507a8..196a89f 100644
--- a/noncore/unsupported/oipkg/pksettingsbase.ui
+++ b/noncore/unsupported/oipkg/pksettingsbase.ui
@@ -1,62 +1,62 @@
<!DOCTYPE UI><UI>
<class>PackageManagerSettingsBase</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>Form4</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>353</width>
+ <width>349</width>
<height>454</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Package Servers</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget row="0" column="0" >
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
<cstring>TabWidget</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Settings</string>
</attribute>
@@ -131,97 +131,97 @@
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Install destination:</string>
</property>
</widget>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>activeDestination</cstring>
</property>
</widget>
</hbox>
</widget>
<widget row="6" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxLink</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Link Destination:</string>
+ <string>Link Destination: root</string>
</property>
</widget>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>activeLinkDestination</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
</widget>
</hbox>
</widget>
<widget row="3" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout13</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Used servers:</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer4</cstring>
</property>
<property stdset="1">
<name>orientation</name>
@@ -673,72 +673,66 @@
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>URL:</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>destinationname</cstring>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>destinationurl</cstring>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Name:</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<connections>
- <connection>
- <sender>CheckBoxLink</sender>
- <signal>toggled(bool)</signal>
- <receiver>Form4</receiver>
- <slot>linkEnabled(bool)</slot>
- </connection>
<slot access="public">destNameChanged(const QString&amp;)</slot>
<slot access="public">destUrlChanged(const QString&amp;)</slot>
<slot access="public">editDestination(int)</slot>
<slot access="public">editServer(int)</slot>
<slot access="public">installationSettingChange(int)</slot>
<slot access="public">installationSettingSetName(const QString &amp;)</slot>
<slot access="public">linkEnabled(bool)</slot>
<slot access="public">newDestination()</slot>
<slot access="public">newInstallationSetting()</slot>
<slot access="public">newServer()</slot>
<slot access="public">removeDestination()</slot>
<slot access="public">removeInstallationSetting()</slot>
<slot access="public">removeServer()</slot>
<slot access="public">renameInstallationSetting()</slot>
<slot access="public">serverNameChanged(const QString&amp;)</slot>
<slot access="public">serverUrlChanged(const QString&amp;)</slot>
</connections>
</UI>
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index b2ddf95..b23b9ea 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,247 +1,297 @@
#include "pmipkg.h"
#include "pkdesc.h"
-#include "pkfind.h"
#include "pksettings.h"
#include "package.h"
#include "packagelistitem.h"
#include <qpe/process.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/stringutil.h>
#include <qpe/qcopenvelope_qws.h>
#include <qdir.h>
#include <qfile.h>
#include <qmultilineedit.h>
#include <qstring.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"
-#include "runwindow.h"
-
-#define PARSE_FILELIST
-// #define IPKG_FILELIST
PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
-// : RunWindow ( p, name, f )
: QObject ( p )
{
settings = s;
- runwindow = new RunWindow ( p, name, f );
- linkDest = new QCopChannel( "QPE/oipkg", this );
- connect( linkDest, SIGNAL(received(const QCString &, const QByteArray &)),
- this, SLOT(linkDestination( const QString &, const QByteArray&)) );
+ runwindowopen = false;
+ runwindow = new RunWindow( p, name, true, f );
}
PmIpkg::~PmIpkg()
{
}
//#define PROC
#define SYSTEM
int PmIpkg::runIpkg(const QString& args)
{
pvDebug(2,"PmIpkg::runIpkg "+args);
#ifdef PROC
QStringList cmd = "/usr/bin/ipkg ";
#endif
#ifdef SYSTEM
QString cmd = "/usr/bin/ipkg ";
#endif
cmd += " -dest "+settings->getDestinationName();
cmd += " -force-defaults ";
out( "<hr><br>Starting to "+ args+"<br>\n");
cmd += args;
out( "running:<br>\n"+cmd+"<br>\n" );
int r = 0;
#ifdef PROC
QString o = "start";
Process ipkg( cmd );
QString description;
ipkg.exec("",o);
out( o );
#endif
#ifdef SYSTEM
QString redirect = "/tmp/oipkg.pipe";
cmd += " | tee "+redirect+" 2>&1";
pvDebug(2, "running >"+cmd+"<");
r = system(cmd.latin1());
QFile f( redirect );
+ QString line;
+ QString oldLine;
while ( ! f.open(IO_ReadOnly) ) {};
- // if ( f.open(IO_ReadOnly) ) {};
{
QTextStream t( &f );
- QString fp;
+ // QString fp;
while ( !t.eof() )
{
- out( t.readLine() +"<br>" );
+ line = t.readLine();
+ if ( line != oldLine ) out( line +"<br>" );
+ oldLine = line;
}
}
f.close();
out( "Finished!<br>");
#endif
return r;
}
void PmIpkg::makeLinks(QString pack)
{
pvDebug( 2, "PmIpkg::makeLinks "+ pack);
out( "<br>creating links<br>" );
QString dest = settings->getDestinationUrl();
out("for package "+pack+" in "+dest+"<br>");
-#ifdef IPKG_FILELIST
- system(("ipkg -d "+dest+" files "+pack+"> /tmp/oipkg.pipe 2>&1").latin1());
- QFile f( "/tmp/oipkg.pipe" );
- while ( ! f.open(IO_ReadOnly) ) {};
-#endif
-#ifdef PARSE_FILELIST
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
QString statusDir = cfg.readEntry( "statusDir", "" );
}
QString fn = dest+"/"+statusDir+"/info/"+pack+".list";
QFile f( fn );
if ( ! f.open(IO_ReadOnly) )
{
out( "<b>Panik!</b> Could not open:<br>"+fn );
};
-#endif
QTextStream t( &f );
QString fp;
while ( !t.eof() )
{
fp = t.readLine();
processLinkDir( fp, dest );
}
f.close();
}
void PmIpkg::processLinkDir( QString file, QString dest )
{
-
-#ifdef PARSE_FILELIST
QString destFile = file;
file = dest+"/"+file;
-#endif
-#ifdef IPKG_FILELIST
- QString destFile = file.right( file.length() - dest.length() );
-#endif
QFileInfo fileInfo( file );
if ( fileInfo.isDir() )
{
QDir destDir( destFile );
destDir.mkdir( destFile, true );
QDir d( file );
d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
- out( "<b>"+fi->absFilePath()+"</b>" );
+ // out( "<b>"+fi->absFilePath()+"</b>" );
processLinkDir( fi->absFilePath(), dest );
++it;
}
} else
if ( fileInfo.isFile() )
{
const char *instFile = strdup( (file).ascii() );
const char *linkFile = strdup( (destFile).ascii());
- out( "linking: "+file+" -> "+destFile );
+// out( "linking: "+file+" -> "+destFile );
qDebug( "linking: %s -> %s", instFile, linkFile );
symlink( instFile, linkFile );
}
}
void PmIpkg::commit( PackageList pl )
{
- runwindow->showMaximized();
-// exec();
+ show( false );
runwindow->outPut->setText("");
- out( "<h1>Starting...</h1><br>\n");
- QStringList to_remove, to_install;
+ out( "<h1>"+tr("Todo")+"</h1>\n");
QString rem="<b>To remove:</b><br>\n";
QString inst="<b>To install:</b><br>\n";;
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
{
to_install.append( pack->name() );
inst += pack->name()+"<br>";
}
if ( pack->toRemove() )
{
to_remove.append( pack->name() );
rem += pack->name()+"<br>";
}
}
}
- out("<p>"+inst+"</p>"+"<p>"+rem+"</p>");
- bool ok=TRUE;
+ out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>");
qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count());
- int jobs = to_remove.count()+to_install.count();
- if ( jobs < 1 ) return;
+ connect( runwindow->doItButton, SIGNAL( clicked() ),
+ SLOT( doIt() ) );
+ connect( runwindow->installButton, SIGNAL( clicked() ),
+ this, SLOT( install() ) );
+ connect( runwindow->removeButton, SIGNAL( clicked() ),
+ this, SLOT( remove() ) );
+ connect( runwindow->cancelButton, SIGNAL( clicked() ),
+ runwindow, SLOT( close() ) );
+
+ 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;
+}
+
+void PmIpkg::doIt()
+{
+ remove();
+ install();
+}
+
- if ( to_remove.count() )
+void PmIpkg::remove()
+{
+ if ( to_remove.count() == 0 ) return;
+ show( true );
+
+ out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>");
for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it)
- if ( runIpkg("remove " + *it) != 0 ) ok = false;
+ {
+ if ( runIpkg("remove " + *it) == 0)
+ {
+
+ }else{
+ out("<b>"+tr("Error while removing")+"</b>"+*it);
+ }
+ }
+}
+
+
+void PmIpkg::install()
+{
+ if ( to_install.count() == 0 ) return;
+ show( true );
+ out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"<b><br>");
if ( to_install.count() )
for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it)
{
if ( runIpkg("install " + *it) == 0 )
{
if ( settings->createLinks() )
makeLinks( *it );
}else{
- ok = false;
+ out("<b>"+tr("Error while installing")+"</b>"+*it);
}
}
- // ##### 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;
}
void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
// add 3rd package parameter
{
qDebug("msg="+msg+" -- "+QString(dest) );
// QDir d( src );
// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
//// if (! d.exists() ) return;
// const QFileInfoList *list = d.entryInfoList();
// QFileInfoListIterator it( *list );
// QFileInfo *fi;
// while ( (fi=it.current()) ) {
// processLinkDir( fi->absFilePath(), dest );
// ++it;
// }
}
void PmIpkg::update()
{
- runwindow->showMaximized();
+ show( false );
runIpkg( "update" );
+ runwindow->close();
}
void PmIpkg::out( QString o )
{
runwindow->outPut->setText( runwindow->outPut->text()+o );
- runwindow->outPut->setContentsPos(0,runwindow->outPut->contentsHeight());
+ runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight());
+}
+
+
+void PmIpkg::showButtons(bool b)
+{
+ if ( b )
+ {
+ runwindow->cancelButton->hide();
+ runwindow->doItButton->hide();
+ runwindow->removeButton->hide();
+ runwindow->installButton->hide();
+ }else{
+ runwindow->cancelButton->show();
+ runwindow->doItButton->show();
+ runwindow->removeButton->show();
+ runwindow->installButton->show();
+
+ }
+}
+
+void PmIpkg::show(bool b)
+{
+ if (!runwindow->isVisible())
+ runwindow->showMaximized();
+ showButtons(b);
+ if ( b )
+ runwindow->progress->show();
+ else
+ runwindow->progress->show();
}
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index e6486ff..8718f49 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -1,46 +1,48 @@
#ifndef PMIPKG_H
#define PMIPKG_H
#include <qobject.h>
#include <qstring.h>
#include <qwidget.h>
#include "pksettings.h"
#include "runwindow.h"
#include "packagelist.h"
#include "debug.h"
-//#define DIA
-#include <qpe/qcopenvelope_qws.h>
-
-//class PmIpkg : public RunWindow
class PmIpkg : public QObject
{
Q_OBJECT
public:
PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
- // PmIpkg( QObject*, PackageManagerSettings* );
~PmIpkg();
void commit( PackageList );
void update();
PackageList* getPackageList();
+ void showButtons(bool b=true);
+ void show( bool buttons=true );
private:
PackageManagerSettings* settings;
RunWindow *runwindow;
- QCopChannel *linkDest;
+ QStringList to_remove;
+ QStringList to_install;
+ bool runwindowopen;
void makeLinks(QString);
void processLinkDir( QString, QString );
int runIpkg(const QString& args);
void out( QString );
public slots:
+ void doIt();
+ void install();
+ void remove();
void linkDestination( const QString, const QByteArray );
};
#endif
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui
index 9113f2d..5359fe2 100644
--- a/noncore/unsupported/oipkg/runwindow.ui
+++ b/noncore/unsupported/oipkg/runwindow.ui
@@ -1,63 +1,171 @@
<!DOCTYPE UI><UI>
<class>RunWindow</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>RunWindow</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>197</width>
+ <width>344</width>
<height>291</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>running...</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
- <number>5</number>
+ <number>2</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget row="0" column="0" >
<class>QProgressBar</class>
<property stdset="1">
<name>name</name>
<cstring>progress</cstring>
</property>
<property stdset="1">
<name>progress</name>
<number>42</number>
</property>
</widget>
<widget row="1" column="0" >
<class>QTextView</class>
<property stdset="1">
<name>name</name>
<cstring>outPut</cstring>
</property>
<property stdset="1">
<name>font</name>
<font>
<pointsize>6</pointsize>
</font>
</property>
</widget>
+ <widget row="2" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>buttons</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>doItButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Do all </string>
+ </property>
+ <property stdset="1">
+ <name>autoResize</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>installButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Install</string>
+ </property>
+ <property stdset="1">
+ <name>autoResize</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removeButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remove</string>
+ </property>
+ <property stdset="1">
+ <name>autoResize</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cancelButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Cancel</string>
+ </property>
+ <property stdset="1">
+ <name>autoResize</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
</grid>
</widget>
</UI>