From 054b0f3268189d6f8f06135960042a7f51117223 Mon Sep 17 00:00:00 2001 From: tille Date: Thu, 25 Apr 2002 21:06:23 +0000 Subject: installation messages working --- 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 @@ -101,7 +101,7 @@ void MainWindow::makeMenu() 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() ) ); @@ -145,12 +145,12 @@ void MainWindow::makeMenu() 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() ) ); @@ -275,17 +275,17 @@ void MainWindow::setSubSections() 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(); } 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 @@ -16,10 +16,9 @@ SOURCES = main.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 @@ -17,7 +17,7 @@ Package::Package() _shortDesc = ""; _desc = ""; _name = ""; - _toProcess = true; + _toProcess = false; _status = ""; } @@ -253,3 +253,11 @@ QString Package::details() 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 @@ -35,6 +35,8 @@ class Package //: public QObject bool toProcess(); bool toInstall(); bool toRemove(); + /** No descriptions */ + void processed(); public slots: void toggleProcess(); 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 @@ -11,7 +11,7 @@ 0 0 - 353 + 349 454 @@ -176,7 +176,7 @@ text - Link Destination: + Link Destination: root @@ -718,12 +718,6 @@ - - CheckBoxLink - toggled(bool) - Form4 - linkEnabled(bool) - destNameChanged(const QString&) destUrlChanged(const QString&) editDestination(int) 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,6 +1,5 @@ #include "pmipkg.h" #include "pkdesc.h" -#include "pkfind.h" #include "pksettings.h" #include "package.h" #include "packagelistitem.h" @@ -17,25 +16,22 @@ #include #include +#include +#include +#include + #include #include #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() @@ -73,14 +69,17 @@ int PmIpkg::runIpkg(const QString& args) 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() +"
" ); + line = t.readLine(); + if ( line != oldLine ) out( line +"
" ); + oldLine = line; } } f.close(); @@ -96,12 +95,6 @@ void PmIpkg::makeLinks(QString pack) out( "
creating links
" ); QString dest = settings->getDestinationUrl(); out("for package "+pack+" in "+dest+"
"); -#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" ); @@ -113,7 +106,6 @@ void PmIpkg::makeLinks(QString pack) { out( "Panik! Could not open:
"+fn ); }; -#endif QTextStream t( &f ); QString fp; while ( !t.eof() ) @@ -126,14 +118,8 @@ void PmIpkg::makeLinks(QString pack) 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() ) { @@ -146,7 +132,7 @@ void PmIpkg::processLinkDir( QString file, QString dest ) QFileInfo *fi; while ( (fi=it.current()) ) { - out( ""+fi->absFilePath()+"" ); + // out( ""+fi->absFilePath()+"" ); processLinkDir( fi->absFilePath(), dest ); ++it; } @@ -155,7 +141,7 @@ void PmIpkg::processLinkDir( QString file, QString dest ) { 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 ); } @@ -163,11 +149,9 @@ void PmIpkg::processLinkDir( QString file, QString dest ) void PmIpkg::commit( PackageList pl ) { - runwindow->showMaximized(); -// exec(); + show( false ); runwindow->outPut->setText(""); - out( "

Starting...


\n"); - QStringList to_remove, to_install; + out( "

"+tr("Todo")+"

\n"); QString rem="To remove:
\n"; QString inst="To install:
\n";; @@ -188,17 +172,58 @@ void PmIpkg::commit( PackageList pl ) } } - out("

"+inst+"

"+"

"+rem+"

"); - bool ok=TRUE; + out("

"+inst+"

"+"

"+rem+"

"); 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("

"+tr("Removing")+"
"+tr("please wait")+"

"); 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(""+tr("Error while removing")+""+*it); + } + } +} + + +void PmIpkg::install() +{ + if ( to_install.count() == 0 ) return; + show( true ); + out("

"+tr("Installing")+"
"+tr("please wait")+"
"); if ( to_install.count() ) for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) { @@ -207,15 +232,10 @@ void PmIpkg::commit( PackageList pl ) if ( settings->createLinks() ) makeLinks( *it ); }else{ - ok = false; + out(""+tr("Error while installing")+""+*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 ) @@ -236,12 +256,42 @@ void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) 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 @@ -10,28 +10,27 @@ #include "packagelist.h" #include "debug.h" -//#define DIA -#include - -//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 ); @@ -40,6 +39,9 @@ private: void out( QString ); public slots: + void doIt(); + void install(); + void remove(); void linkDestination( const QString, const QByteArray ); }; 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 @@ -11,7 +11,7 @@ 0 0 - 197 + 344 291 @@ -28,7 +28,7 @@ margin - 5 + 2 spacing @@ -58,6 +58,114 @@ + + QLayoutWidget + + name + buttons + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + doItButton + + + sizePolicy + + 0 + 0 + + + + font + + 8 + + + + text + Do all + + + autoResize + true + + + + QPushButton + + name + installButton + + + font + + 8 + + + + text + Install + + + autoResize + true + + + + QPushButton + + name + removeButton + + + font + + 7 + + + + text + Remove + + + autoResize + true + + + + QPushButton + + name + cancelButton + + + font + + 8 + + + + text + Cancel + + + autoResize + true + + + + -- cgit v0.9.0.2