author | tille <tille> | 2002-04-27 21:02:53 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 21:02:53 (UTC) |
commit | 69e271e44d23befc74a96a98708ddb6ec754a4b6 (patch) (side-by-side diff) | |
tree | 6f8300d8858d2c7659eb90066b58b302a2863e43 | |
parent | acdc33336307e48ac7089b146006fe7b36e321a5 (diff) | |
download | opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.zip opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.gz opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.bz2 |
setDocument working and some changes in install gui
-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 @@ -9,2 +9,3 @@ * 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 @@ -17,3 +17,3 @@ if ( debugLevel < 3 ) \ 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);\ } 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 @@ -16,2 +16,3 @@ #include <qlabel.h> +#include <qfile.h> #include <qlistview.h> @@ -29,7 +30,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : { - 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") ); @@ -40,21 +42,3 @@ 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(); - 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) ), @@ -63,10 +47,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 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); @@ -90,7 +66,2 @@ void MainWindow::makeMenu() - popupMenu = new QPopupMenu( this ); - destsMenu = new QPopupMenu( popupMenu ); - popupTimer = new QTimer( this ); - connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); - setToolBarsMovable( false ); @@ -125,9 +96,10 @@ void MainWindow::makeMenu() - 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 ); @@ -318,41 +290,2 @@ void MainWindow::showSettingsDst() - -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) @@ -391,37 +324,25 @@ 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* ) +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(); } @@ -431,5 +352,5 @@ 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) ); } 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 @@ -11,3 +11,3 @@ #include "pksettings.h" -#include "pkdesc.h" +#include "packagelistview.h" @@ -16,3 +16,2 @@ class QPEToolBar; class QLineEdit; -class QListView; class PackageListItem; @@ -41,8 +40,4 @@ protected slots: void showSettingsDst(); - void setDocument (const QString &); public slots: - void showDetails(); - void toggleActivePackage(); - void setCurrent( QListViewItem* ); void sectionClose(); @@ -52,6 +47,4 @@ public slots: void filterList(); - void showPopup(); - void changePackageDest( int ); - void stopTimer( QListViewItem* ); void receive (const QCString &, const QByteArray &); + void setDocument (const QString &); @@ -61,2 +54,4 @@ private: void setSubSections(); + void installFile(const QString &); + bool updateIcon; @@ -64,6 +59,3 @@ private: PackageManagerSettings *settings; - PackageDetails* details; PackageList packageList; - Package *activePackage; - PackageListItem *activePackageListItem; QAction *runAction; @@ -73,3 +65,3 @@ private: QAction *sectionAction; - QListView *listViewPackages; + PackageListView *listViewPackages; QPEToolBar *findBar; @@ -79,6 +71,2 @@ private: QComboBox *subsection; - QTimer *popupTimer; - QPopupMenu *popupMenu; - QPopupMenu *destsMenu; - bool updateIcon; private slots: 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 @@ -9,2 +9,3 @@ HEADERS = mainwindow.h \ packagelist.h \ + packagelistview.h \ package.h @@ -12,2 +13,3 @@ SOURCES = main.cpp \ mainwindow.cpp \ + packagelistview.cpp \ pksettings.cpp \ @@ -20,4 +22,3 @@ DEPENDPATH += $(OPIEDIR)/ioclude LIBS += -lqpe -INTERFACES = pkdesc.ui \ - runwindow.ui \ +INTERFACES = runwindow.ui \ pksettingsbase.ui 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 @@ -4,2 +4,6 @@ #include <qpe/stringutil.h> +#include <qfile.h> +#include <qtextstream.h> +#include <stdlib.h> +#include <unistd.h> @@ -27,3 +31,4 @@ void Package::init( PackageManagerSettings *s ) _status = ""; - _dest = ""; + _dest = settings->getDestinationName(); + _link = settings->createLinks(); } @@ -34,3 +39,2 @@ Package::Package( QStringList pack, PackageManagerSettings *s ) parsePackage( pack ); - _toProcess = false; } @@ -40,4 +44,10 @@ 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 ); + } } @@ -48,3 +58,2 @@ Package::Package( Package *pi ) copyValues( pi ); - _toProcess = false; } @@ -213,8 +222,8 @@ void Package::parsePackage( QStringList pack ) 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{ + } } @@ -297 +306,26 @@ void Package::setLink(bool 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 @@ -45,3 +45,6 @@ class Package //: public QObject void setLink(bool); + void parseIpkgFile( QString );; public slots: + /** No descriptions */ + QString getPackageName(); void toggleProcess(); @@ -50,2 +53,3 @@ private: PackageManagerSettings *settings; + QString _packageName; QString _name; 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,3 +1,2 @@ #include "pmipkg.h" -#include "pkdesc.h" #include "pksettings.h" @@ -14,2 +13,3 @@ #include <qstring.h> +#include <qcheckbox.h> #include <qtextstream.h> @@ -59,2 +59,5 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) +// if (runwindow->forcedepends->isChecked()) +// cmd += " -force-depends "; + out( "<hr><br>Starting to "+ args+"<br>\n"); @@ -73,3 +76,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) QString redirect = "/tmp/oipkg.pipe"; - cmd += " | tee "+redirect+" 2>&1"; + cmd += " 2>&1 | tee "+redirect+" 2>&1"; pvDebug(2, "running >"+cmd+"<"); @@ -105,4 +108,2 @@ void PmIpkg::makeLinks(Package *pack) if (dest == "/" ) return; - out( "<br>creating links<br>" ); - out("for package "+pack->name()+" in "+dest+"<br>"); { @@ -124,2 +125,4 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) }; + out( "<br>creating links<br>" ); + out("for package "+packFileName+" in "+dest+"<br>"); QTextStream t( &f ); @@ -136,2 +139,3 @@ void PmIpkg::processLinkDir( QString file, QString dest ) { + pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); if ( dest == "???" ) return; @@ -169,11 +173,7 @@ 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(); @@ -187,3 +187,3 @@ void PmIpkg::commit( PackageList pl ) sizecount += pack->size().toInt(); - inst += pack->name()+"\t(on "+pack->dest()+")<br>"; + inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; } @@ -198,19 +198,73 @@ 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(); } @@ -253,3 +307,3 @@ void PmIpkg::install() - if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) + if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) { @@ -316,3 +370,3 @@ void PmIpkg::show(bool b) showButtons(b); - if ( b ) + if ( !b ) runwindow->progress->hide(); @@ -324,25 +378,9 @@ 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 @@ -35,2 +35,3 @@ private: + void startDialog(); void makeLinks(Package*); @@ -44,3 +45,2 @@ public slots: void install(); - void installFileName(); void remove(); 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 @@ -14,3 +14,3 @@ <width>344</width> - <height>291</height> + <height>442</height> </rect> @@ -47,16 +47,3 @@ </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> @@ -100,3 +87,3 @@ <name>autoResize</name> - <bool>true</bool> + <bool>false</bool> </property> @@ -168,2 +155,15 @@ </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> |