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 /noncore/unsupported/oipkg/pmipkg.cpp | |
parent | acdc33336307e48ac7089b146006fe7b36e321a5 (diff) | |
download | opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.zip opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.gz opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.bz2 |
setDocument working and some changes in install gui
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 132 |
1 files changed, 85 insertions, 47 deletions
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>"); + startDialog(); - qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); +} + +void PmIpkg::startDialog() +{ + QDialog *d = new QDialog(); + QGridLayout *RunWindowLayout = new QGridLayout( d ); + RunWindowLayout->setSpacing( 2 ); + RunWindowLayout->setMargin( 2 ); - runwindow->progress->setTotalSteps( sizecount ); + QHBoxLayout *buttons = new QHBoxLayout; + buttons->setSpacing( 6 ); + buttons->setMargin( 0 ); - connect( runwindow->doItButton, SIGNAL( clicked() ), - SLOT( doIt() ) ); - connect( runwindow->installButton, SIGNAL( clicked() ), + 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) { - 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.clear(); + to_remove.clear(); + pvDebug( 2,"PmIpkg::installFile "+ fileName); + 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 |