author | tille <tille> | 2002-04-25 21:06:23 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-25 21:06:23 (UTC) |
commit | 054b0f3268189d6f8f06135960042a7f51117223 (patch) (side-by-side diff) | |
tree | 2ab5eef44d4e6604d6c0a45e51608390c8b3a521 /noncore/unsupported | |
parent | c06667cd62b945a05edce621aab34358ee0e964f (diff) | |
download | opie-054b0f3268189d6f8f06135960042a7f51117223.zip opie-054b0f3268189d6f8f06135960042a7f51117223.tar.gz opie-054b0f3268189d6f8f06135960042a7f51117223.tar.bz2 |
installation messages working
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettingsbase.ui | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 142 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 14 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 112 |
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 @@ -103,3 +103,3 @@ void MainWindow::makeMenu() updateAction = new QAction( tr( "Update" ), - Resource::loadIconSet( "oipkg/repeat" ), + Resource::loadIconSet( "oipkg/update" ), QString::null, 0, this, 0 ); @@ -147,2 +147,3 @@ void MainWindow::makeMenu() label->setBackgroundColor( sectionBar->backgroundColor() ); + sectionBar->setStretchableWidget( label ); section = new QComboBox( false, sectionBar ); @@ -152,3 +153,2 @@ void MainWindow::makeMenu() subsection = new QComboBox( false, sectionBar ); - sectionBar->setStretchableWidget( label ); @@ -277,3 +277,3 @@ void MainWindow::showSettings() if ( settings->showDialog( 0 ) ) - getList(); + updateList(); } @@ -282,3 +282,3 @@ void MainWindow::showSettingsSrv() if ( settings->showDialog( 1 ) ) - getList(); + updateList(); } @@ -287,3 +287,3 @@ 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 @@ -18,6 +18,5 @@ SOURCES = main.cpp \ INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/ioclude LIBS += -lqpe INTERFACES = pkdesc.ui \ - pkfind.ui \ runwindow.ui \ 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 @@ -19,3 +19,3 @@ Package::Package() _name = ""; - _toProcess = true; + _toProcess = false; _status = ""; @@ -255 +255,9 @@ QString Package::details() +/** 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 @@ -37,2 +37,4 @@ class Package //: public QObject bool toRemove(); + /** No descriptions */ + void processed(); public slots: 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 @@ -13,3 +13,3 @@ <y>0</y> - <width>353</width> + <width>349</width> <height>454</height> @@ -178,3 +178,3 @@ <name>text</name> - <string>Link Destination:</string> + <string>Link Destination: root</string> </property> @@ -720,8 +720,2 @@ <connections> - <connection> - <sender>CheckBoxLink</sender> - <signal>toggled(bool)</signal> - <receiver>Form4</receiver> - <slot>linkEnabled(bool)</slot> - </connection> <slot access="public">destNameChanged(const QString&)</slot> 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 @@ -2,3 +2,2 @@ #include "pkdesc.h" -#include "pkfind.h" #include "pksettings.h" @@ -19,2 +18,6 @@ +#include <qprogressbar.h> +#include <qpushbutton.h> +#include <qlayout.h> + #include <stdlib.h> @@ -23,10 +26,5 @@ #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 ) @@ -34,6 +32,4 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag 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 ); } @@ -75,10 +71,13 @@ int PmIpkg::runIpkg(const QString& args) 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; } @@ -98,8 +97,2 @@ void PmIpkg::makeLinks(QString pack) 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 { @@ -115,3 +108,2 @@ void PmIpkg::makeLinks(QString pack) }; -#endif QTextStream t( &f ); @@ -128,10 +120,4 @@ 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 ); @@ -148,3 +134,3 @@ void PmIpkg::processLinkDir( QString file, QString dest ) { - out( "<b>"+fi->absFilePath()+"</b>" ); + // out( "<b>"+fi->absFilePath()+"</b>" ); processLinkDir( fi->absFilePath(), dest ); @@ -157,3 +143,3 @@ void PmIpkg::processLinkDir( QString file, QString dest ) const char *linkFile = strdup( (destFile).ascii()); - out( "linking: "+file+" -> "+destFile ); +// out( "linking: "+file+" -> "+destFile ); qDebug( "linking: %s -> %s", instFile, linkFile ); @@ -165,7 +151,5 @@ 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"); @@ -190,4 +174,3 @@ void PmIpkg::commit( PackageList pl ) - out("<p>"+inst+"</p>"+"<p>"+rem+"</p>"); - bool ok=TRUE; + out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); @@ -195,8 +178,50 @@ void PmIpkg::commit( PackageList pl ) - 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() ) @@ -209,3 +234,3 @@ void PmIpkg::commit( PackageList pl ) }else{ - ok = false; + out("<b>"+tr("Error while installing")+"</b>"+*it); } @@ -213,7 +238,2 @@ void PmIpkg::commit( PackageList pl ) - // ##### 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; } @@ -238,4 +258,5 @@ void PmIpkg::update() { - runwindow->showMaximized(); + show( false ); runIpkg( "update" ); + runwindow->close(); } @@ -245,3 +266,32 @@ 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 @@ -12,8 +12,4 @@ -//#define DIA -#include <qpe/qcopenvelope_qws.h> - -//class PmIpkg : public RunWindow class PmIpkg : public QObject @@ -23,3 +19,2 @@ public: PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); - // PmIpkg( QObject*, PackageManagerSettings* ); ~PmIpkg(); @@ -29,2 +24,4 @@ public: PackageList* getPackageList(); + void showButtons(bool b=true); + void show( bool buttons=true ); @@ -33,3 +30,5 @@ private: RunWindow *runwindow; - QCopChannel *linkDest; + QStringList to_remove; + QStringList to_install; + bool runwindowopen; @@ -42,2 +41,5 @@ private: 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 @@ -13,3 +13,3 @@ <y>0</y> - <width>197</width> + <width>344</width> <height>291</height> @@ -30,3 +30,3 @@ <name>margin</name> - <number>5</number> + <number>2</number> </property> @@ -60,2 +60,110 @@ </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> |