Skip to content

Commit

Permalink
Showing warning / question to users if they change the update method
Browse files Browse the repository at this point in the history
- Only if changing from "patterns" to "update only installed rpms"
- BNC#873122
  • Loading branch information
kobliha committed Apr 15, 2014
1 parent 95aed00 commit 103c234
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/clients/inst_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,29 @@ def main
end

if (@ret == :next || @ret == :ok) && Pkg.RestoreState(true)
@something_changed = false

if UI.QueryWidget(Id(:notupgrade), :Value) !=
Update.onlyUpdateInstalled
@something_changed = true
end

if @something_changed && Packages.base_selection_modified
# yes/no question
if !Popup.YesNo(
_("Do you really want\nto reset your detailed selection?")
new_onlyUpdateInstalled = UI.QueryWidget(Id(:notupgrade), :Value)
# Selection has changed
if Update.onlyUpdateInstalled != new_onlyUpdateInstalled
# BNC#873122
# The default is 'do not onlyUpdateInstalled'
# New status is 'do onlyUpdateInstalled'
if !Update.default_onlyUpdateInstalled && new_onlyUpdateInstalled
next unless Popup::AnyQuestion(
Label.WarningMsg,
# warning / question
_(
"Changing the update method to 'Update packages only' might\n" +
"lead into non-bootable or non-working system if you do not\n" +
"adjust the list of packages yourself.\n\n" +
"Really continue?"
),
Label.YesButton,
Label.NoButton,
:focus_no
)
next
elsif Packages.base_selection_modified
# yes/no question
next unless Popup.YesNo(_("Do you really want\nto reset your detailed selection?"))
end
end
end
Expand All @@ -242,10 +252,7 @@ def main
Update.did_init1 = false

@b1 = Update.onlyUpdateInstalled
Update.onlyUpdateInstalled = Convert.to_boolean(
UI.QueryWidget(Id(:notupgrade), :Value)
)
# Update::deleteOldPackages = (boolean) UI::QueryWidget (`id(`delete), `Value);
Update.onlyUpdateInstalled = UI.QueryWidget(Id(:notupgrade), :Value)

if @b1 != Update.onlyUpdateInstalled || @details_pressed
Update.manual_interaction = true
Expand Down
3 changes: 3 additions & 0 deletions src/modules/Update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def main

# Only an update, NOT an upgrade
@onlyUpdateInstalled = nil
@defaultonlyUpdateInstalled = nil

@selected_selection = ""

Expand Down Expand Up @@ -420,6 +421,7 @@ def Reset
# y2milestone ("deleteOldPackages %1", deleteOldPackages);

@onlyUpdateInstalled = OnlyUpdateInstalled()
@default_onlyUpdateInstalled = deep_copy(@onlyUpdateInstalled)
Builtins.y2milestone("onlyUpdateInstalled %1", @onlyUpdateInstalled)

@disallow_upgrade = false
Expand Down Expand Up @@ -857,6 +859,7 @@ def installed_product
publish :variable => :did_init2, :type => "boolean"
publish :variable => :last_runlevel, :type => "integer"
publish :variable => :onlyUpdateInstalled, :type => "boolean"
publish :variable => :default_onlyUpdateInstalled, :type => "boolean"
publish :variable => :selected_selection, :type => "string"
publish :variable => :products_incompatible, :type => "boolean"
publish :variable => :updateBasePackages, :type => "boolean"
Expand Down

0 comments on commit 103c234

Please sign in to comment.