Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 9f6429a..fe200f5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -201,52 +201,49 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
201 | } else { | 201 | } else { |
202 | const char *linkFile = strdup( (destFile).ascii()); | 202 | const char *linkFile = strdup( (destFile).ascii()); |
203 | if( linkOpp==removeLink ) | 203 | if( linkOpp==removeLink ) |
204 | { | 204 | { |
205 | pvDebug(4,"removing "+destFile+" no "+file); | 205 | pvDebug(4,"removing "+destFile+" no "+file); |
206 | QFileInfo toRemoveLink( destFile ); | 206 | QFileInfo toRemoveLink( destFile ); |
207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
208 | unlink( linkFile ); | 208 | unlink( linkFile ); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | void PmIpkg::commit( PackageList pl ) | 213 | void PmIpkg::loadList( PackageList pl ) |
214 | { | 214 | { |
215 | int sizecount = 0; | ||
216 | to_install.clear(); | ||
217 | to_remove.clear(); | ||
218 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | ||
219 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | ||
220 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 215 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
221 | { | 216 | { |
222 | if ( pack && (pack->name() != "") && pack) | 217 | if ( pack && (pack->name() != "") && pack) |
223 | { | 218 | { |
224 | if ( pack->toInstall() ) | 219 | if ( pack->toInstall() ) |
225 | { | ||
226 | to_install.append( pack ); | 220 | to_install.append( pack ); |
227 | sizecount += pack->size().toInt(); | 221 | if ( pack->toRemove() ) |
228 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; | ||
229 | } | ||
230 | if ( pack->toRemove() ) | ||
231 | { | ||
232 | to_remove.append( pack ); | 222 | to_remove.append( pack ); |
233 | sizecount += 1; | 223 | } |
234 | rem += pack->name()+"<br>"; | 224 | } |
235 | } | 225 | } |
236 | } | ||
237 | } | ||
238 | 226 | ||
227 | void PmIpkg::commit( PackageList pl ) | ||
228 | { | ||
229 | sizecount = 0; | ||
230 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | ||
231 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | ||
232 | loadList(pl); | ||
233 | for (uint i=0; i < to_remove.count(); i++) | ||
234 | sizecount += 1; | ||
235 | for (uint i=0; i < to_install.count(); i++) | ||
236 | sizecount += to_install.at(i)->size().toInt(); | ||
239 | startDialog(); | 237 | startDialog(); |
240 | |||
241 | } | 238 | } |
242 | 239 | ||
243 | void PmIpkg::startDialog() | 240 | void PmIpkg::startDialog() |
244 | { | 241 | { |
245 | installDialog = new QDialog(0,0,true); | 242 | installDialog = new QDialog(0,0,true); |
246 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 243 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
247 | RunWindowLayout->setSpacing( 2 ); | 244 | RunWindowLayout->setSpacing( 2 ); |
248 | RunWindowLayout->setMargin( 2 ); | 245 | RunWindowLayout->setMargin( 2 ); |
249 | 246 | ||
250 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 247 | PackageListView *plv = new PackageListView(installDialog, "install",settings); |
251 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | 248 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); |
252 | RunWindowLayout->addWidget( plv, 1, 0 ); | 249 | RunWindowLayout->addWidget( plv, 1, 0 ); |
@@ -257,37 +254,37 @@ void PmIpkg::startDialog() | |||
257 | { | 254 | { |
258 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); | 255 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); |
259 | } | 256 | } |
260 | QCheckListItem *toInstallItem; | 257 | QCheckListItem *toInstallItem; |
261 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | 258 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); |
262 | toInstallItem->setOpen( true ); | 259 | toInstallItem->setOpen( true ); |
263 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 260 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
264 | { | 261 | { |
265 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); | 262 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); |
266 | } | 263 | } |
267 | 264 | ||
268 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); | 265 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); |
269 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) ); | 266 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); |
270 | GroupBox1->setTitle( tr( "Ipkg options" ) ); | 267 | GroupBox1->setTitle( tr( "Ipkg options" ) ); |
271 | GroupBox1->setColumnLayout(0, Qt::Vertical ); | 268 | GroupBox1->setColumnLayout(0, Qt::Vertical ); |
272 | GroupBox1->layout()->setSpacing( 0 ); | 269 | GroupBox1->layout()->setSpacing( 0 ); |
273 | GroupBox1->layout()->setMargin( 0 ); | 270 | GroupBox1->layout()->setMargin( 0 ); |
274 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); | 271 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); |
275 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | 272 | GroupBox1Layout->setAlignment( Qt::AlignTop ); |
276 | GroupBox1Layout->setSpacing( 3 ); | 273 | GroupBox1Layout->setSpacing( 3 ); |
277 | GroupBox1Layout->setMargin( 3 ); | 274 | GroupBox1Layout->setMargin( 3 ); |
278 | |||
279 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); | 275 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); |
280 | _force_depends->setText( tr( "-force-depends" ) ); | 276 | _force_depends->setText( tr( "-force-depends" ) ); |
281 | _force_depends->setAutoResize( TRUE ); | 277 | _force_depends->setAutoResize( TRUE ); |
278 | _force_depends->setChecked(true); | ||
282 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); | 279 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); |
283 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | 280 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); |
284 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 281 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
285 | _force_reinstall->setAutoResize( TRUE ); | 282 | _force_reinstall->setAutoResize( TRUE ); |
286 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); | 283 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); |
287 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); | 284 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); |
288 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 285 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
289 | _force_remove->setAutoResize( TRUE ); | 286 | _force_remove->setAutoResize( TRUE ); |
290 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); | 287 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); |
291 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | 288 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); |
292 | 289 | ||
293 | // connect( doItButton, SIGNAL( clicked() ), | 290 | // connect( doItButton, SIGNAL( clicked() ), |
@@ -310,57 +307,58 @@ void PmIpkg::doIt() | |||
310 | remove(); | 307 | remove(); |
311 | install(); | 308 | install(); |
312 | } | 309 | } |
313 | 310 | ||
314 | 311 | ||
315 | void PmIpkg::remove() | 312 | void PmIpkg::remove() |
316 | { | 313 | { |
317 | if ( to_remove.count() == 0 ) return; | 314 | if ( to_remove.count() == 0 ) return; |
318 | 315 | ||
319 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); | 316 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
320 | 317 | ||
321 | QStringList *fileList; | 318 | QStringList *fileList; |
322 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 319 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
323 | { | 320 | { |
324 | if ( it->link() )fileList = getList( it->name(), it->dest() ); | 321 | if ( it->link() )fileList = getList( it->name(), it->dest() ); |
325 | if ( runIpkg("remove " + it->name()) == 0) | 322 | if ( runIpkg("remove " + it->name()) == 0) |
326 | { | 323 | { |
327 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); | 324 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); |
328 | linkOpp = removeLink; | 325 | linkOpp = removeLink; |
329 | if ( it->link() ) | 326 | if ( it->link() ) |
330 | { | 327 | { |
331 | out( "<br>removing links<br>" ); | 328 | out( "<br>removing links<br>" ); |
332 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 329 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
333 | processFileList( fileList, it->dest() ); | 330 | processFileList( fileList, it->dest() ); |
334 | } | 331 | } |
335 | it->processed(); | 332 | it->processed(); |
333 | |||
336 | out("<br><hr>"); | 334 | out("<br><hr>"); |
337 | }else{ | 335 | }else{ |
338 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); | 336 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); |
339 | } | 337 | } |
340 | pvDebug(2,"delete File List"); | 338 | pvDebug(2,"delete File List"); |
341 | if ( it->link() )delete fileList; | 339 | if ( it->link() )delete fileList; |
342 | } | 340 | } |
343 | out("<br>"); | 341 | out("<br>"); |
344 | } | 342 | } |
345 | 343 | ||
346 | 344 | ||
347 | void PmIpkg::install() | 345 | void PmIpkg::install() |
348 | { | 346 | { |
349 | if ( to_install.count() == 0 ) return; | 347 | if ( to_install.count() == 0 ) return; |
350 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 348 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
351 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 349 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
352 | { | 350 | { |
353 | 351 | ||
354 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) | 352 | if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) |
355 | { | 353 | { |
356 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 354 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
357 | linkOpp = createLink; | 355 | linkOpp = createLink; |
358 | if ( it->link() ) | 356 | if ( it->link() ) |
359 | { | 357 | { |
360 | out( "<br>creating links<br>" ); | 358 | out( "<br>creating links<br>" ); |
361 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 359 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
362 | makeLinks( it ); | 360 | makeLinks( it ); |
363 | } | 361 | } |
364 | it->processed(); | 362 | it->processed(); |
365 | out("<br><hr>"); | 363 | out("<br><hr>"); |
366 | }else{ | 364 | }else{ |