Class: Registration::UI::AddonEulaDialog

Inherits:
Object
  • Object
show all
Includes:
Yast, Yast::I18n, Yast::Logger, Yast::UIShortcuts
Defined in:
src/lib/registration/ui/addon_eula_dialog.rb

Overview

class for displaying and handling the add-on EULA dialog

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selected_addons) ⇒ AddonEulaDialog

constructor


33
34
35
36
# File 'src/lib/registration/ui/addon_eula_dialog.rb', line 33

def initialize(selected_addons)
  textdomain "registration"
  @addons = selected_addons
end

Instance Attribute Details

#addonsObject (readonly)

Returns the value of attribute addons


16
17
18
# File 'src/lib/registration/ui/addon_eula_dialog.rb', line 16

def addons
  @addons
end

Class Method Details

.run(selected_addons) ⇒ Object

display and run the dialog for accepting the extensions EULAs


26
27
28
29
# File 'src/lib/registration/ui/addon_eula_dialog.rb', line 26

def self.run(selected_addons)
  dialog = AddonEulaDialog.new(selected_addons)
  dialog.run
end

Instance Method Details

#runSymbol

display the EULA for each extension and wait for a button click


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'src/lib/registration/ui/addon_eula_dialog.rb', line 40

def run
  Yast::Wizard.SetContents(
    # dialog title
    _("License Agreement"),
    Label(_("Downloading Licenses...")),
    "",
    false,
    false
  )

  # Default: no EULA specified => accepted
  eula_ret = :accepted

  addons.each do |addon|
    next unless addon.eula_url && !addon.eula_url.empty?

    log.info "Addon '#{addon.name}' has an EULA at #{addon.eula_url}"
    eula_ret = accept_eula(addon)

    # any declined license needs to be handled separately
    break if eula_ret != :accepted
  end

  # go back or abort if any EULA has not been accepted, let the user
  # deselect the not accepted extension
  eula_ret == :accepted ? :next : eula_ret
end