Class: Y2Packager::Dialogs::InstProductLicense

Inherits:
CWM::Dialog
  • Object
show all
Defined in:
src/lib/y2packager/dialogs/inst_product_license.rb,
src/lib/y2packager/dialogs/inst_product_license.rb

Overview

Dialog which shows the user a license and ask for confirmation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product, disable_buttons: []) ⇒ InstProductLicense

Constructor


30
31
32
33
34
35
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 30

def initialize(product)
  super()
  @product = product
  self.language = Yast::Language.language
  self.confirmed = product.license_confirmed?
end

Instance Attribute Details

#disable_buttonsArray<String> (readonly)


29
30
31
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 29

def disable_buttons
  @disable_buttons
end

#productY2Packager::Product (readonly)


25
26
27
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 25

def product
  @product
end

Instance Method Details

#back_handlerObject

Handler for the :back action

This action happens when the user clicks the 'Back' button


67
68
69
70
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 67

def back_handler
  update_product_confirmation
  finish_dialog(:back)
end

#contentsYast::Term

Dialog content


54
55
56
57
58
59
60
61
62
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 54

def contents
  VBox(
    Widgets::ProductLicenseTranslations.new(product, Yast::Language.language),
    HBox(
      confirmation_checkbox,
      HStretch()
    )
  )
end

#language_handlerObject

Handler for the :language action

This happens when the user changes the license language


40
41
42
43
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 40

def language_handler
  self.language = Yast::UI.QueryWidget(Id(:language), :Value)
  Yast::UI.ReplaceWidget(Id(:license_replace_point), license_content)
end

#license_confirmation_handlerObject

Handler for the :license_confirmation action

This action happens when the user clicks the confirmation checkbox.


48
49
50
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 48

def license_confirmation_handler
  @confirmed = Yast::UI.QueryWidget(Id(:license_confirmation), :Value)
end

#next_handlerObject

Handler for the :next action

This action happens when the user clicks the 'Next' button


55
56
57
58
59
60
61
62
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 55

def next_handler
  if confirmed
    update_product_confirmation
    finish_dialog(:next)
  else
    Yast::Report.Message(_("You must accept the license to install this product"))
  end
end

#titleString

Returns the dialog title


46
47
48
49
# File 'src/lib/y2packager/dialogs/inst_product_license.rb', line 46

def title
  # TRANSLATORS: %s is a product name
  format(_("%s License Agreement"), product.label)
end