Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 3b31b4d..45c89c5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -102,28 +102,33 @@ 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" ); QString statusDir = cfg.readEntry( "statusDir", "" ); } QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; - QFile f( fn ); + linkPackage( fn, dest ); +} + +void PmIpkg::linkPackage( QString packFileName, QString dest ) +{ + QFile f( packFileName ); if ( ! f.open(IO_ReadOnly) ) { - out( "<b>Panik!</b> Could not open:<br>"+fn ); + out( "<b>Panik!</b> Could not open:<br>"+packFileName ); return; }; QTextStream t( &f ); QString fp; while ( !t.eof() ) { fp = t.readLine(); processLinkDir( fp, dest ); } f.close(); } @@ -198,25 +203,25 @@ void PmIpkg::commit( PackageList pl ) runwindow->progress->setTotalSteps( sizecount ); 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(); - return; + out("<h1>"+tr("Its now save to close this window")+"<h1>"); } void PmIpkg::doIt() { remove(); install(); } void PmIpkg::remove() { if ( to_remove.count() == 0 ) return; @@ -305,12 +310,39 @@ void PmIpkg::showButtons(bool b) } void PmIpkg::show(bool b) { if (!runwindow->isVisible()) runwindow->showMaximized(); showButtons(b); if ( b ) runwindow->progress->hide(); else runwindow->progress->show(); } + +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(); +} + +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 |