Method: Yast::PackageClass#PackageDialog

Defined in:
library/packages/src/modules/Package.rb

#PackageDialog(packages, install, message) ⇒ Object

Main package installatio|removal dialog



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'library/packages/src/modules/Package.rb', line 315

def PackageDialog(packages, install, message)
  log.info "Asking for packages: #{packages}"
  packs = Builtins.filter(packages) do |package|
    install ? !Installed(package) : Installed(package)
  end
  log.info "Remaining packages: #{packs}"

  return true if packs.empty?

  check_transactional_system!(packs, install ? :install : :remove)

  # Popup Text
  text = _("These packages need to be installed:") + "<p>"
  # Popup Text
  text = _("These packages need to be removed:") + "<p>" if install == false

  Builtins.foreach(packs) do |p|
    text = Ops.add(text, Builtins.sformat("%1<br>", p))
  end

  text = Builtins.sformat(message, Builtins.mergestring(packs, ", ")) if !message.nil?

  doit = if Mode.commandline
    CommandLine.Interactive ? AskPackages(packs, install) : true
  else
    Popup.AnyQuestionRichText(
      "",
      text,
      40,
      10,
      # labels changed for bug #215195
      #  Label::ContinueButton (), Label::CancelButton (),
      # push button label
      install ? Label.InstallButton : _("&Uninstall"),
      Label.CancelButton,
      :focus_yes
    )
  end

  if doit
    @last_op_canceled = false
    return DoRemove(packs) if install == false

    return DoInstall(packs)
  end

  @last_op_canceled = true
  false
end