summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp38
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)
102{ 102{
103 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 103 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
104 QString dest = settings->getDestinationUrlByName( pack->dest() ); 104 QString dest = settings->getDestinationUrlByName( pack->dest() );
105 if (dest == "/" ) return; 105 if (dest == "/" ) return;
106 out( "<br>creating links<br>" ); 106 out( "<br>creating links<br>" );
107 out("for package "+pack->name()+" in "+dest+"<br>"); 107 out("for package "+pack->name()+" in "+dest+"<br>");
108 { 108 {
109 Config cfg( "oipkg", Config::User ); 109 Config cfg( "oipkg", Config::User );
110 cfg.setGroup( "Common" ); 110 cfg.setGroup( "Common" );
111 QString statusDir = cfg.readEntry( "statusDir", "" ); 111 QString statusDir = cfg.readEntry( "statusDir", "" );
112 } 112 }
113 QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; 113 QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list";
114 QFile f( fn ); 114 linkPackage( fn, dest );
115}
116
117void PmIpkg::linkPackage( QString packFileName, QString dest )
118{
119 QFile f( packFileName );
115 if ( ! f.open(IO_ReadOnly) ) 120 if ( ! f.open(IO_ReadOnly) )
116 { 121 {
117 out( "<b>Panik!</b> Could not open:<br>"+fn ); 122 out( "<b>Panik!</b> Could not open:<br>"+packFileName );
118 return; 123 return;
119 }; 124 };
120 QTextStream t( &f ); 125 QTextStream t( &f );
121 QString fp; 126 QString fp;
122 while ( !t.eof() ) 127 while ( !t.eof() )
123 { 128 {
124 fp = t.readLine(); 129 fp = t.readLine();
125 processLinkDir( fp, dest ); 130 processLinkDir( fp, dest );
126 } 131 }
127 f.close(); 132 f.close();
128} 133}
129 134
@@ -198,25 +203,25 @@ void PmIpkg::commit( PackageList pl )
198 runwindow->progress->setTotalSteps( sizecount ); 203 runwindow->progress->setTotalSteps( sizecount );
199 204
200 connect( runwindow->doItButton, SIGNAL( clicked() ), 205 connect( runwindow->doItButton, SIGNAL( clicked() ),
201 SLOT( doIt() ) ); 206 SLOT( doIt() ) );
202 connect( runwindow->installButton, SIGNAL( clicked() ), 207 connect( runwindow->installButton, SIGNAL( clicked() ),
203 this, SLOT( install() ) ); 208 this, SLOT( install() ) );
204 connect( runwindow->removeButton, SIGNAL( clicked() ), 209 connect( runwindow->removeButton, SIGNAL( clicked() ),
205 this, SLOT( remove() ) ); 210 this, SLOT( remove() ) );
206 connect( runwindow->cancelButton, SIGNAL( clicked() ), 211 connect( runwindow->cancelButton, SIGNAL( clicked() ),
207 runwindow, SLOT( close() ) ); 212 runwindow, SLOT( close() ) );
208 213
209 runwindow->exec(); 214 runwindow->exec();
210 return; 215 out("<h1>"+tr("Its now save to close this window")+"<h1>");
211} 216}
212 217
213void PmIpkg::doIt() 218void PmIpkg::doIt()
214{ 219{
215 remove(); 220 remove();
216 install(); 221 install();
217} 222}
218 223
219 224
220void PmIpkg::remove() 225void PmIpkg::remove()
221{ 226{
222 if ( to_remove.count() == 0 ) return; 227 if ( to_remove.count() == 0 ) return;
@@ -305,12 +310,39 @@ void PmIpkg::showButtons(bool b)
305} 310}
306 311
307void PmIpkg::show(bool b) 312void PmIpkg::show(bool b)
308{ 313{
309 if (!runwindow->isVisible()) 314 if (!runwindow->isVisible())
310 runwindow->showMaximized(); 315 runwindow->showMaximized();
311 showButtons(b); 316 showButtons(b);
312 if ( b ) 317 if ( b )
313 runwindow->progress->hide(); 318 runwindow->progress->hide();
314 else 319 else
315 runwindow->progress->show(); 320 runwindow->progress->show();
316} 321}
322
323void PmIpkg::installFile(const QString &fileName)
324{
325 pvDebug( 2,"PmIpkg::installFile "+ fileName);
326 show( false );
327 runwindow->outPut->setText("");
328 fileNameToInstall = fileName;
329 runwindow->doItButton->hide();
330 runwindow->removeButton->hide();
331 out("<b>"+tr("Install: ")+fileName);
332 connect( runwindow->installButton, SIGNAL( clicked() ),
333 this, SLOT( installFileName() ) );
334 connect( runwindow->cancelButton, SIGNAL( clicked() ),
335 runwindow, SLOT( close() ) );
336
337 runwindow->exec();
338}
339
340void PmIpkg::installFileName()
341{
342 if ( !QFile::exists( fileNameToInstall ) ) return;
343 out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>");
344 runIpkg("install " + fileNameToInstall );
345 if ( settings->createLinks() )
346 linkPackage( fileNameToInstall, settings->getDestinationUrl() );
347 out("<h1>"+tr("Its now save to close this window")+"<h1>");
348} \ No newline at end of file