Skip to content

Commit

Permalink
fix full media product selection (bsc#1179094, bsc#1176424)
Browse files Browse the repository at this point in the history
  • Loading branch information
wfeldt committed Nov 24, 2020
1 parent 8d4b4c2 commit e6eb7a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions src/lib/installation/clients/inst_complex_welcome.rb
Expand Up @@ -158,7 +158,7 @@ def setup_final_choice
# list because the dialog will not show the license (we do not know which product we are
# upgrading yet) nor the product selector (as you cannot change the product during upgrade).
#
# @return [Array<Y2Packager::Product>,Array<Y2Packager::ProductControlProduct] List of
# @return [Array<Y2Packager::Product>, Array<Y2Packager::ProductControlProduct, Array<Y2Packager::ProductLocation>] List of
# available base products; if any, a list containing only the forced base product;
# empty list in update mode.
def products
Expand All @@ -171,7 +171,8 @@ def products

# Returns all available base products
#
# @return [Array<Y2Packager::Product>, Array<Y2Packager::ProductControlProduct>] List of available base products
# @return [Array<Y2Packager::Product>, Array<Y2Packager::ProductControlProduct>, Array<Y2Packager::ProductLocation>] List of
# available base products
def available_base_products
return @available_base_products if @available_base_products

Expand Down Expand Up @@ -224,13 +225,24 @@ def disable_buttons
end
end

# Show product selection screen even when only a single product is available.
#
# This serves mainly to delay the license confirmation to a later point
# (when the license has been read).
#
# @return [Boolean] true if product selection is preferred over license
# confirmation
def allow_single_product_selection?
products.size == 1 && !products.first.respond_to?(:license)
end

# Determine whether selected product license should be confirmed
#
# If more than 1 product exists, it is supposed to be accepted later.
#
# @return [Boolean] true if it should be accepted; false otherwise.
def license_confirmation_required?
return false if products.size > 1
return false if products.size > 1 || allow_single_product_selection?
selected_product.license_confirmation_required?
end

Expand All @@ -241,7 +253,7 @@ def license_confirmation_required?
# agreement confirmed when required; false otherwise
def product_selection_finished?
if selected_product.nil?
return true if products.size <= 1
return true if products.size <= 1 && !allow_single_product_selection?
Yast::Popup.Error(_("Please select a product to install."))
return false
elsif license_confirmation_required? && !selected_product.license_confirmed?
Expand Down
4 changes: 2 additions & 2 deletions src/lib/installation/dialogs/complex_welcome.rb
Expand Up @@ -133,11 +133,11 @@ def product_license

# Determine whether the license must be shown
#
# The license will be shown when only one product is available.
# The license will be shown when only one product with license information is available.
#
# @return [Boolean] true if the license must be shown; false otherwise
def show_license?
products.size == 1
products.size == 1 && products.first.respond_to?(:license)
end

# Determine whether some product is available or not
Expand Down

0 comments on commit e6eb7a4

Please sign in to comment.