summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
authortille <tille>2002-05-03 19:08:09 (UTC)
committer tille <tille>2002-05-03 19:08:09 (UTC)
commit4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653 (patch) (unidiff)
tree66d77ffe196c448782ce0d04877641280e74890d /noncore/unsupported/oipkg/pmipkg.cpp
parent6bf450ac622d22ba7e9156e474a7abb714167eba (diff)
downloadopie-4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653.zip
opie-4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653.tar.gz
opie-4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653.tar.bz2
fixes
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp89
1 files changed, 40 insertions, 49 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index fd8279b..0ae74da 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -46,3 +46,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
46#ifdef PROC 46#ifdef PROC
47 QStringList cmd = "/usr/bin/ipkg "; 47 QStringList cmd = "ipkg ";
48#endif 48#endif
@@ -77,4 +77,4 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
77 QString description; 77 QString description;
78 ipkg->exec("",o); 78 r = ipkg->exec("",o);
79// out( o ); 79 out( o );
80#endif 80#endif
@@ -179,3 +179,2 @@ void PmIpkg::processLinkDir( QString file, QString dest )
179 QFileInfo *fi; 179 QFileInfo *fi;
180 qDebug( "while %i",list->count());
181 while ( (fi=it.current()) ) 180 while ( (fi=it.current()) )
@@ -210,5 +209,5 @@ void PmIpkg::processLinkDir( QString file, QString dest )
210 209
211void PmIpkg::loadList( PackageList pl ) 210void PmIpkg::loadList( PackageList *pl )
212 { 211 {
213 for( Package *pack = pl.first();pack ; (pack = pl.next()) ) 212 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
214 { 213 {
@@ -227,27 +226,19 @@ void PmIpkg::commit()
227 int sizecount = 0; 226 int sizecount = 0;
228 for (uint i=0; i < to_remove.count(); i++)
229 sizecount += 1;
230 for (uint i=0; i < to_install.count(); i++)
231 sizecount += to_install.at(i)->size().toInt();
232 runwindow->progress->setTotalSteps(sizecount);
233 startDialog();
234}
235
236void PmIpkg::startDialog()
237{
238 installDialog = new InstallDialog(settings,0,0,true); 227 installDialog = new InstallDialog(settings,0,0,true);
239 QCheckListItem *toRemoveItem; 228 QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") );
240 toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); 229 QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
241 toRemoveItem->setOpen( true ); 230 toRemoveItem->setOpen( true );
242 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 231 toInstallItem->setOpen( true );
232 for (uint i=0; i < to_remove.count(); i++)
243 { 233 {
244 toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); 234 sizecount += 1;
235 toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
245 } 236 }
246 QCheckListItem *toInstallItem; 237 for (uint i=0; i < to_install.count(); i++)
247 toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
248 toInstallItem->setOpen( true );
249 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
250 { 238 {
251 toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); 239 sizecount += to_install.at(i)->size().toInt();
240 toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
252 } 241 }
242 runwindow->progress->setTotalSteps(sizecount);
243 qDebug("Install size %i",sizecount);
253 installDialog->showMaximized(); 244 installDialog->showMaximized();
@@ -255,4 +246,4 @@ void PmIpkg::startDialog()
255 installDialog->close(); 246 installDialog->close();
247 runwindow->showMaximized();
256 out(tr("<b>All done.</b>")); 248 out(tr("<b>All done.</b>"));
257 to_install.clear();
258} 249}
@@ -274,23 +265,24 @@ void PmIpkg::remove()
274 QStringList *fileList; 265 QStringList *fileList;
275 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 266 for (uint i=0; i < to_remove.count(); i++)
276 { 267 {
277 if ( it->link() )fileList = getList( it->name(), it->dest() ); 268 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
278 if ( runIpkg("remove " + it->name(), it->dest() ) == 0) 269 if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0)
279 { 270 {
280 runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); 271 runwindow->progress->setProgress( 1 );
281 linkOpp = removeLink; 272 linkOpp = removeLink;
282 if ( it->link() ) 273 if ( to_remove.at(i)->link() )
283 { 274 {
284 out( "<br>removing links<br>" ); 275 out( "<br>removing links<br>" );
285 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 276 out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" );
286 processFileList( fileList, it->dest() ); 277 processFileList( fileList, to_remove.at(i)->dest() );
287 } 278 }
288 it->processed(); 279 to_remove.at(i)->processed();
289 // to_install.take( it ); 280 to_remove.take( i );
290 out("<br><hr>"); 281 out("<br><hr>");
291 }else{ 282 }else{
292 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); 283 out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name());
293 } 284 }
294 if ( it->link() )delete fileList; 285 if ( to_remove.at(i)->link() )delete fileList;
295 } 286 }
287 to_remove.clear();
296 out("<br>"); 288 out("<br>");
@@ -303,20 +295,19 @@ void PmIpkg::install()
303 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 295 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
304 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 296 for (uint i=0; i < to_install.count(); i++)
305 { 297 {
306 298 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 )
307 if ( runIpkg("install " + it->installName(), it->dest() ) == 0 )
308 { 299 {
309 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 300 runwindow->progress->setProgress( to_install.at(i)->size().toInt() );
310 linkOpp = createLink; 301 linkOpp = createLink;
311 if ( it->link() ) 302 if ( to_install.at(i)->link() )
312 { 303 {
313 out( "<br>creating links<br>" ); 304 out( "<br>creating links<br>" );
314 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 305 out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" );
315 makeLinks( it ); 306 makeLinks( to_install.at(i) );
316 } 307 }
317 it->processed(); 308 to_install.at(i)->processed();
318 // to_install.take( it->name() ); 309 to_install.take( i );
319 out("<br><hr>"); 310 out("<br><hr>");
320 }else{ 311 }else{
321 out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); 312 out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name());
322 } 313 }
@@ -400,3 +391,3 @@ void PmIpkg::installFile(const QString &fileName, const QString &dest)
400 to_install.append( p ); 391 to_install.append( p );
401 startDialog(); 392 commit();
402 delete p; 393 delete p;
@@ -413,3 +404,3 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest)
413 to_remove.append( p ); 404 to_remove.append( p );
414 startDialog(); 405 commit();
415 delete p; 406 delete p;