-rw-r--r-- | noncore/unsupported/oipkg/TODO | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/debug.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 145 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 56 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 91 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.h | 53 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 134 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 32 |
12 files changed, 340 insertions, 209 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index b07542a..3fc84e5 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO @@ -7,4 +7,5 @@ * qcop * error handling * manage links -* dependency checking
\ No newline at end of file +* dependency checking +* ipkg options in runwindow
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index e73b9b2..973d96c 100644 --- a/noncore/unsupported/oipkg/debug.h +++ b/noncore/unsupported/oipkg/debug.h @@ -15,7 +15,7 @@ if ( debugLevel < 3 ) \ if ( I <= debugLevel ) qDebug(S);\ }else{\ if ( I <= debugLevel ) \ - printf("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\ + qDebug("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\ } #endif
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index e3abf36..6bf9a7a 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -14,6 +14,7 @@ #include <qtoolbutton.h> #include <qstring.h> #include <qlabel.h> +#include <qfile.h> #include <qlistview.h> #include <qtextview.h> #include <qlineedit.h> @@ -27,48 +28,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : QMainWindow( parent, name, f ) { - setCaption( tr("Package Manager") ); + settings = new PackageManagerSettings(this,0,TRUE); + listViewPackages = new PackageListView( this,"listViewPackages",settings ); + ipkg = new PmIpkg( settings, this ); - listViewPackages = new QListView( this,0,0 ); - listViewPackages->setSelectionMode(QListView::NoSelection); setCentralWidget( listViewPackages ); + setCaption( tr("Package Manager") ); channel = new QCopChannel( "QPE/Application/oipkg", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); makeMenu(); -#ifdef NEWLAYOUT - listViewPackages->addColumn( tr("Package") ); - listViewPackages->setRootIsDecorated( true ); -#endif -#ifndef NEWLAYOUT - QFontMetrics fm = fontMetrics(); - int wlw = width()*2; - int w0 = fm.width(tr("Package"))+30; - // int w0 = fm.width(tr("Package"))+30; - int w2 = fm.width("00000")+4; - int w1 = wlw-w2-w0-24; - listViewPackages->addColumn( tr("Package"), w0 ); - listViewPackages->addColumn( tr("Description"), w1 ); - listViewPackages->addColumn( tr("Size"), w2 ); - listViewPackages->setColumnWidthMode(0,QListView::Manual); - listViewPackages->setColumnWidthMode(1,QListView::Manual); - listViewPackages->setColumnWidthMode(2,QListView::Manual); - listViewPackages->setSelectionMode( QListView::Multi ); -#endif + connect( section, SIGNAL( activated(int) ), this, SLOT( sectionChanged() ) ); connect( subsection, SIGNAL(activated(int) ), this, SLOT( subSectionChanged() ) ); - connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), - this, SLOT( setCurrent( QListViewItem* ) ) ); - connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), - this, SLOT( stopTimer( QListViewItem* ) ) ); - - popupMenu = new QPopupMenu( this ); - - settings = new PackageManagerSettings(this,0,TRUE); ipkg = new PmIpkg( settings, this ); packageList.setSettings( settings ); @@ -88,11 +64,6 @@ void MainWindow::makeMenu() QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); - popupMenu = new QPopupMenu( this ); - destsMenu = new QPopupMenu( popupMenu ); - popupTimer = new QTimer( this ); - connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); - setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Package" ), srvMenu ); @@ -123,13 +94,14 @@ void MainWindow::makeMenu() 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 ); +// would we use for find +// 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; @@ -316,45 +288,6 @@ void MainWindow::showSettingsDst() updateList(); } - -void MainWindow::showDetails() -{ - 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); - } - 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(); -} - -void MainWindow::toggleActivePackage() -{ - activePackage->toggleProcess(); - if ( details ) details->close(); -} - -void MainWindow::setCurrent( QListViewItem* p ) -{ - if ( !p ) return; - activePackageListItem = (PackageListItem*)p; - activePackage = activePackageListItem->getPackage(); - pvDebug(5, "start timer"); - popupTimer->start( 750, true ); -} - void MainWindow::sectionShow(bool b) { if (b) sectionBar->show(); @@ -389,48 +322,36 @@ void MainWindow::rotateUpdateIcon() updateIcon = !updateIcon; } -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* ) +void MainWindow::setDocument(const QString &fileName) { - pvDebug( 5, "stop timer" ); - popupTimer->stop(); + installFile(fileName); + // ##### 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(); } -void MainWindow::setDocument(const QString &fileName) +void MainWindow::installFile(const QString &fileName) { + pvDebug(3, "MainWindow::installFile "+fileName); + if ( !QFile::exists( fileName ) ) return; ipkg->installFile( fileName ); + // ##### 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(); } void MainWindow::receive(const QCString &msg, const QByteArray &arg) { pvDebug(3, "QCop "+msg); - if ( msg == "setDocument(QString)" ) + if ( msg == "installFile(QString)" ) { - setDocument( QString(arg) ); + installFile( QString(arg) ); } }
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 34943f2..bcb0cc9 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h @@ -9,12 +9,11 @@ #include "packagelist.h" #include "pmipkg.h" #include "pksettings.h" -#include "pkdesc.h" +#include "packagelistview.h" class QComboBox; class QPEToolBar; class QLineEdit; -class QListView; class PackageListItem; class QCopChannel; @@ -39,48 +38,37 @@ protected slots: void showSettings(); void showSettingsSrv(); void showSettingsDst(); - void setDocument (const QString &); public slots: - void showDetails(); - void toggleActivePackage(); - void setCurrent( QListViewItem* ); void sectionClose(); void sectionShow(bool); void findClose(); void findShow(bool); void filterList(); - void showPopup(); - void changePackageDest( int ); - void stopTimer( QListViewItem* ); void receive (const QCString &, const QByteArray &); + void setDocument (const QString &); private: void makeMenu(); void setSections(); void setSubSections(); + void installFile(const QString &); + bool updateIcon; PmIpkg* ipkg; PackageManagerSettings *settings; - PackageDetails* details; PackageList packageList; - Package *activePackage; - PackageListItem *activePackageListItem; QAction *runAction; QAction *detailsAction; QAction *updateAction; QAction *findAction; QAction *sectionAction; - QListView *listViewPackages; + PackageListView *listViewPackages; QPEToolBar *findBar; QLineEdit *findEdit; QPEToolBar *sectionBar; QComboBox *section; QComboBox *subsection; - QTimer *popupTimer; - QPopupMenu *popupMenu; - QPopupMenu *destsMenu; - bool updateIcon; private slots: void rotateUpdateIcon(); }; diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 955c7f3..1f7a70d 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro @@ -7,9 +7,11 @@ HEADERS = mainwindow.h \ pmipkg.h \ packagelistitem.h \ packagelist.h \ + packagelistview.h \ package.h SOURCES = main.cpp \ mainwindow.cpp \ + packagelistview.cpp \ pksettings.cpp \ pmipkg.cpp \ packagelistitem.cpp \ @@ -18,8 +20,7 @@ SOURCES = main.cpp \ INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/ioclude LIBS += -lqpe -INTERFACES = pkdesc.ui \ - runwindow.ui \ +INTERFACES = runwindow.ui \ pksettingsbase.ui TARGET = oipkg diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 9f602b5..5f0e5fa 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -2,6 +2,10 @@ #include <qpe/process.h> #include <qpe/stringutil.h> +#include <qfile.h> +#include <qtextstream.h> +#include <stdlib.h> +#include <unistd.h> #include "debug.h" @@ -25,28 +29,33 @@ void Package::init( PackageManagerSettings *s ) _name = ""; _toProcess = false; _status = ""; - _dest = ""; + _dest = settings->getDestinationName(); + _link = settings->createLinks(); } Package::Package( QStringList pack, PackageManagerSettings *s ) { init(s); parsePackage( pack ); - _toProcess = false; } Package::Package( QString n, PackageManagerSettings *s ) { init(s); - _name = QString( n ); - _toProcess = false; + if ( !QFile::exists( n ) ) + { + _name = QString( n ); + }else{ + parseIpkgFile( n ); + _toProcess = true; + _packageName = QString( n ); + } } Package::Package( Package *pi ) { init(pi->settings); copyValues( pi ); - _toProcess = false; } @@ -211,12 +220,12 @@ void Package::parsePackage( QStringList pack ) QString line = pack[i]; int sep = line.find( QRegExp(":[\t ]+") ); if ( sep >= 0 ) - { - QString tag = line.left(sep); - QString value = line.mid(sep+2).simplifyWhiteSpace(); - setValue( tag, value ); - }else{ - } + { + QString tag = line.left(sep); + QString value = line.mid(sep+2).simplifyWhiteSpace(); + setValue( tag, value ); + }else{ + } } return; } @@ -295,3 +304,28 @@ void Package::setLink(bool b) { _link = b; } + +void Package::parseIpkgFile( QString file) +{ + system("tar xzf "+file+" -C /tmp"); + system("tar xzf /tmp/control.tar.gz -C /tmp"); + QFile f("/tmp/control"); + if ( f.open(IO_ReadOnly) ) + { + QTextStream t( &f ); + QStringList pack; + while ( !t.eof() ) + { + pack << t.readLine(); + } + f.close(); + parsePackage( pack ); + } + +} + +QString Package::getPackageName() +{ + if ( _packageName.isEmpty() ) return _name; + else return _packageName; +} diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 6c292ed..31b0010 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h @@ -43,11 +43,15 @@ class Package //: public QObject void setOn(); bool link(); void setLink(bool); + void parseIpkgFile( QString );; public slots: + /** No descriptions */ + QString getPackageName(); void toggleProcess(); private: PackageManagerSettings *settings; + QString _packageName; QString _name; bool _toProcess; bool _link; diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp new file mode 100644 index 0000000..693ea6a --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -0,0 +1,91 @@ +/*************************************************************************** + packagelistview.cpp - description + ------------------- + begin : Sat Apr 27 2002 + copyright : (C) 2002 by tille + email : tille@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "packagelistview.h" + +#include <qpopupmenu.h> +#include <qaction.h> + +#include "packagelistitem.h" +#include "pksettings.h" + +PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) + : QListView(p,n) +{ + settings = s; + popupMenu = new QPopupMenu( this ); + destsMenu = new QPopupMenu( popupMenu ); + popupTimer = new QTimer( this ); + setSelectionMode(QListView::NoSelection); + addColumn( tr("Package") ); + setRootIsDecorated( true ); + + connect( popupTimer, SIGNAL(timeout()), + this, SLOT(showPopup()) ); + connect( this, SIGNAL( pressed( QListViewItem* ) ), + this, SLOT( setCurrent( QListViewItem* ) ) ); + connect( this, SIGNAL( clicked( QListViewItem* ) ), + this, SLOT( stopTimer( QListViewItem* ) ) ); + +} + +//PackageListView::~PackageListView() +//{ +//} + +void PackageListView::setCurrent( QListViewItem* p ) +{ + if ( !p ) return; + activePackageListItem = (PackageListItem*)p; + activePackage = activePackageListItem->getPackage(); + pvDebug(5, "start timer"); + popupTimer->start( 750, true ); +} + + +void PackageListView::showPopup() +{ + popupMenu->clear(); + destsMenu->clear(); + + QAction *popupAction; + popupMenu->insertItem( QObject::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 PackageListView::stopTimer( QListViewItem* ) +{ + pvDebug( 5, "stop timer" ); + popupTimer->stop(); +} + + +void PackageListView::changePackageDest( int i ) +{ + activePackage->setDest( destsMenu->text(i) ); + activePackage->setOn(); + activePackage->setLink( settings->createLinks() ); + activePackageListItem->displayDetails(); +} diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h new file mode 100644 index 0000000..15e200b --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistview.h @@ -0,0 +1,53 @@ +/*************************************************************************** + packagelistview.h - description + ------------------- + begin : Sat Apr 27 2002 + copyright : (C) 2002 by tille + email : tille@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PACKAGELISTVIEW_H +#define PACKAGELISTVIEW_H + +#include <qlistview.h> +#include <qaction.h> +#include <qtimer.h> +#include <qwidget.h> +#include <qpopupmenu.h> +#include "debug.h" + +class PackageListItem; +class Package; +class PackageManagerSettings; + +class PackageListView : public QListView +{ + Q_OBJECT + +public: + PackageListView(QWidget*, const char*, PackageManagerSettings*); +// ~PackageListView(); + QTimer *popupTimer; +private: + PackageManagerSettings *settings; + Package *activePackage; + PackageListItem *activePackageListItem; + QPopupMenu *popupMenu; + QPopupMenu *destsMenu; +public slots: + void showPopup(); + void changePackageDest( int ); + void setCurrent( QListViewItem* ); + void stopTimer( QListViewItem* ); +}; + +#endif diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 45c89c5..f0992f5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -1,5 +1,4 @@ #include "pmipkg.h" -#include "pkdesc.h" #include "pksettings.h" #include "package.h" #include "packagelistitem.h" @@ -12,6 +11,7 @@ #include <qfile.h> #include <qmultilineedit.h> #include <qstring.h> +#include <qcheckbox.h> #include <qtextstream.h> #include <qtextview.h> @@ -57,6 +57,9 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) cmd += " -force-defaults "; +// if (runwindow->forcedepends->isChecked()) +// cmd += " -force-depends "; + out( "<hr><br>Starting to "+ args+"<br>\n"); cmd += args; int r = 0; @@ -71,7 +74,7 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) #ifdef SYSTEM out( "running:<br>\n"+cmd+"<br>\n" ); QString redirect = "/tmp/oipkg.pipe"; - cmd += " | tee "+redirect+" 2>&1"; + cmd += " 2>&1 | tee "+redirect+" 2>&1"; pvDebug(2, "running >"+cmd+"<"); r = system(cmd.latin1()); QFile f( redirect ); @@ -103,8 +106,6 @@ void PmIpkg::makeLinks(Package *pack) pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); QString dest = settings->getDestinationUrlByName( pack->dest() ); if (dest == "/" ) return; - out( "<br>creating links<br>" ); - out("for package "+pack->name()+" in "+dest+"<br>"); { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Common" ); @@ -122,6 +123,8 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) out( "<b>Panik!</b> Could not open:<br>"+packFileName ); return; }; + out( "<br>creating links<br>" ); + out("for package "+packFileName+" in "+dest+"<br>"); QTextStream t( &f ); QString fp; while ( !t.eof() ) @@ -134,6 +137,7 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) void PmIpkg::processLinkDir( QString file, QString dest ) { + pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); if ( dest == "???" ) return; QString destFile = file; file = dest+"/"+file; @@ -167,15 +171,11 @@ void PmIpkg::processLinkDir( QString file, QString dest ) void PmIpkg::commit( PackageList pl ) { - show( false ); - runwindow->outPut->setText(""); - out( "<h1>"+tr("Todo")+"</h1>\n"); - + int sizecount = 0; to_install.clear(); to_remove.clear(); - int sizecount = 0; - QString rem="<b>To remove:</b><br>\n"; - QString inst="<b>To install:</b><br>\n";; + QString rem="<b>"+tr("To remove:")+"</b><br>\n"; + QString inst="<b>"+tr("To install:")+"</b><br>\n"; pl.allPackages(); for( Package *pack = pl.first();pack ; (pack = pl.next()) ) { @@ -185,7 +185,7 @@ void PmIpkg::commit( PackageList pl ) { to_install.append( pack ); sizecount += pack->size().toInt(); - inst += pack->name()+"\t(on "+pack->dest()+")<br>"; + inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; } if ( pack->toRemove() ) { @@ -196,23 +196,77 @@ void PmIpkg::commit( PackageList pl ) } } - out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); - - qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); + startDialog(); - runwindow->progress->setTotalSteps( sizecount ); +} - connect( runwindow->doItButton, SIGNAL( clicked() ), - SLOT( doIt() ) ); - connect( runwindow->installButton, SIGNAL( clicked() ), +void PmIpkg::startDialog() +{ + QDialog *d = new QDialog(); + QGridLayout *RunWindowLayout = new QGridLayout( d ); + RunWindowLayout->setSpacing( 2 ); + RunWindowLayout->setMargin( 2 ); + + QHBoxLayout *buttons = new QHBoxLayout; + buttons->setSpacing( 6 ); + buttons->setMargin( 0 ); + + PackageListView *plv = new PackageListView(d, "install",settings); + RunWindowLayout->addWidget( plv, 1, 0 ); + for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) + { + plv->insertItem( new PackageListItem(plv, it,settings) ); + } + for (Package *it=to_install.first(); it != 0; it=to_install.next() ) + { + plv->insertItem( new PackageListItem(plv, it,settings) ); + } + QPushButton *doItButton = new QPushButton( d, "doItButton" ); + doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); + QFont doItButton_font( doItButton->font() ); + doItButton_font.setPointSize( 8 ); + doItButton->setFont( doItButton_font ); + doItButton->setText( tr( "Do all " ) ); + doItButton->setAutoResize( FALSE ); + buttons->addWidget( doItButton ); + + QPushButton *installButton = new QPushButton( d, "installButton" ); + QFont installButton_font( installButton->font() ); + installButton_font.setPointSize( 8 ); + installButton->setFont( installButton_font ); + installButton->setText( tr( "Install" ) ); + installButton->setAutoResize( TRUE ); + buttons->addWidget( installButton ); + + QPushButton *removeButton = new QPushButton( d, "removeButton" ); + QFont removeButton_font( removeButton->font() ); + removeButton_font.setPointSize( 7 ); + removeButton->setFont( removeButton_font ); + removeButton->setText( tr( "Remove" ) ); + removeButton->setAutoResize( TRUE ); + buttons->addWidget( removeButton ); + + QPushButton *cancelButton = new QPushButton( d, "cancelButton" ); + QFont cancelButton_font( cancelButton->font() ); + cancelButton_font.setPointSize( 8 ); + cancelButton->setFont( cancelButton_font ); + cancelButton->setText( tr( "Cancel" ) ); + cancelButton->setAutoResize( TRUE ); + buttons->addWidget( cancelButton ); + + RunWindowLayout->addLayout( buttons, 3, 0 ); + + connect( doItButton, SIGNAL( clicked() ), + this, SLOT( doIt() ) ); + connect( installButton, SIGNAL( clicked() ), this, SLOT( install() ) ); - connect( runwindow->removeButton, SIGNAL( clicked() ), + connect( removeButton, SIGNAL( clicked() ), this, SLOT( remove() ) ); - connect( runwindow->cancelButton, SIGNAL( clicked() ), - runwindow, SLOT( close() ) ); - - runwindow->exec(); - out("<h1>"+tr("Its now save to close this window")+"<h1>"); + connect( cancelButton, SIGNAL( clicked() ), + d, SLOT( close() ) ); + d->showMaximized(); + d->exec(); + // d->close(); } void PmIpkg::doIt() @@ -251,7 +305,7 @@ void PmIpkg::install() for (Package *it=to_install.first(); it != 0; it=to_install.next() ) { - if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) + if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) { runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); if ( it->link() ) @@ -314,7 +368,7 @@ void PmIpkg::show(bool b) if (!runwindow->isVisible()) runwindow->showMaximized(); showButtons(b); - if ( b ) + if ( !b ) runwindow->progress->hide(); else runwindow->progress->show(); @@ -322,27 +376,11 @@ void PmIpkg::show(bool b) void PmIpkg::installFile(const QString &fileName) { + + to_install.clear(); + to_remove.clear(); pvDebug( 2,"PmIpkg::installFile "+ fileName); - show( false ); - runwindow->outPut->setText(""); - fileNameToInstall = fileName; - runwindow->doItButton->hide(); - runwindow->removeButton->hide(); - out("<b>"+tr("Install: ")+fileName); - connect( runwindow->installButton, SIGNAL( clicked() ), - this, SLOT( installFileName() ) ); - connect( runwindow->cancelButton, SIGNAL( clicked() ), - runwindow, SLOT( close() ) ); - - runwindow->exec(); + to_install.append( new Package(fileName,settings) ); + startDialog(); } -void PmIpkg::installFileName() -{ - if ( !QFile::exists( fileNameToInstall ) ) return; - out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>"); - runIpkg("install " + fileNameToInstall ); - if ( settings->createLinks() ) - linkPackage( fileNameToInstall, settings->getDestinationUrl() ); - out("<h1>"+tr("Its now save to close this window")+"<h1>"); -}
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 8e06f4c..f70283e 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -33,6 +33,7 @@ private: bool runwindowopen; QString fileNameToInstall; + void startDialog(); void makeLinks(Package*); void linkPackage( QString, QString ); void processLinkDir( QString, QString ); @@ -42,7 +43,6 @@ private: public slots: void doIt(); void install(); - void installFileName(); void remove(); void installFile(const QString &fileName); void linkDestination( const QString, const QByteArray ); diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui index 52da408..8582ce8 100644 --- a/noncore/unsupported/oipkg/runwindow.ui +++ b/noncore/unsupported/oipkg/runwindow.ui @@ -12,7 +12,7 @@ <x>0</x> <y>0</y> <width>344</width> - <height>291</height> + <height>442</height> </rect> </property> <property stdset="1"> @@ -45,20 +45,7 @@ <number>0</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" > + <widget row="3" column="0" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> @@ -98,7 +85,7 @@ </property> <property stdset="1"> <name>autoResize</name> - <bool>true</bool> + <bool>false</bool> </property> </widget> <widget> @@ -166,6 +153,19 @@ </widget> </hbox> </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> </grid> </widget> </UI> |