Skip to content

Commit

Permalink
change default action, added combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Nov 20, 2013
1 parent e4a7eb5 commit ecde210
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
4 changes: 2 additions & 2 deletions library/general/src/fillup/sysconfig.yast2
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ STORE_CONFIG_IN_SUBVERSION="no"
SUBVERSION_ADD_DIRS_RECURSIVE="no"

## Type: list(close,restart,summary)
## Default: "close"
## Default: "summary"
# Set the default behavior of the package manager when package installation has finished.
# Possible actions are:
# close - just finish the package manager
# restart - go back to the package manager, install/remove more packages
# summary - display an installation summary dialog, there user can decide whether to finish or restart
# The summary dialog is always displayed when an installation error has occured.
PKGMGR_ACTION_AT_EXIT="close"
PKGMGR_ACTION_AT_EXIT="summary"

## Type: list(yes,no)
## Default: "yes"
Expand Down
43 changes: 37 additions & 6 deletions library/packages/src/modules/PackagesUI.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ def FormatPackageList(pkgs, link)
end

def InstallationSummary(summary)
summary = deep_copy(summary)
ret = ""

if Builtins.haskey(summary, "success")
Expand Down Expand Up @@ -637,14 +636,15 @@ def ShowDetailsList(heading, pkgs)


def ShowInstallationSummaryMap(summary)
summary = deep_copy(summary)
summary_str = InstallationSummary(summary)

if summary_str == nil || summary_str == ""
if summary["installed"] == 0 && summary["updated"] == 0 && summary["removed"] == 0 && summary["remaining"] == []
Builtins.y2warning("No summary, skipping summary dialog")
return :next
end

Builtins.y2milestone("Displaying installation report: #{summary.inspect}")

wizard_opened = false

# open a new wizard dialog if needed
Expand All @@ -653,16 +653,28 @@ def ShowInstallationSummaryMap(summary)
wizard_opened = true
end

dialog = RichText(Id(:rtext), summary_str)
current_action = SCR.Read(path(".sysconfig.yast2.PKGMGR_ACTION_AT_EXIT"))

dialog = VBox(
RichText(Id(:rtext), summary_str),
Left(
ComboBox(Id(:action), _("After Installing Packages"), [
Item(Id("summary"), _("Show This Report"), current_action == "summary"),
Item(Id("close"), _("Finish"), current_action == "close"),
Item(Id("restart"), _("Continue in the Software Manager"), current_action == "restart")
])
)
)

help_text = _(
"<P><BIG><B>Installation Summary</B></BIG><BR>Here is a summary of installed packages.</P>"
"<P><BIG><B>Installation Report</B></BIG><BR>Here is a summary of installed or removed packages.</P>"
)

Wizard.SetNextButton(:next, Label.FinishButton)
Wizard.SetBackButton(:back, Label.ContinueButton)

Wizard.SetContents(
_("Installation Summary"), #has_next
_("Installation Report"),
dialog,
help_text,
true,
Expand Down Expand Up @@ -714,7 +726,26 @@ def ShowInstallationSummaryMap(summary)

Builtins.y2milestone("Installation Summary result: %1", result)

new_action = UI.QueryWidget(Id(:action), :Value)

# the combobox value has been changed, save the new value
if result == :next && current_action != new_action
if new_action != "summary"
# disabling installation report dialog, inform the user how to enable it back
Popup.Message(_("If you want to show this report dialog again edit\n\n"+
"System > Yast2 > GUI > PKGMGR_ACTION_AT_EXIT\n\n" +
"value in the YaST sysconfig editor."))
end

Builtins.y2milestone("Changing PKGMGR_ACTION_AT_EXIT from #{current_action.inspect} to #{new_action.inspect}")

SCR.Write(path(".sysconfig.yast2.PKGMGR_ACTION_AT_EXIT"), new_action)
# flush
SCR.Write(path(".sysconfig.yast2"), nil)
end

Wizard.RestoreNextButton
Wizard.RestoreBackButton

if wizard_opened
# close the opened window
Expand Down

0 comments on commit ecde210

Please sign in to comment.