Class: Installation::ProposalErrors

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n, Yast::Logger
Defined in:
src/lib/installation/proposal_errors.rb

Constant Summary collapse

ERROR_PROPOSAL_TIMEOUT =
60

Instance Method Summary collapse

Constructor Details

#initializeProposalErrors

Returns a new instance of ProposalErrors.



15
16
17
18
# File 'src/lib/installation/proposal_errors.rb', line 15

def initialize
  textdomain "installation"
  @errors = []
end

Instance Method Details

#append(message) ⇒ Object

appends new error with given message



26
27
28
# File 'src/lib/installation/proposal_errors.rb', line 26

def append(message)
  @errors << message
end

#approved?Boolean

returns true if there is no error or user approved stored errors

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'src/lib/installation/proposal_errors.rb', line 31

def approved?
  return true if @errors.empty?

  headline = _("Error Found in Installation Settings")
  text = _("The following errors were found in the configuration proposal.\n" \
           "If you continue with the installation it may not be successful.\n" \
           "Errors:\n")
  sep = Yast::UI.TextMode ? "-" : ""
  text += "#{sep} " + @errors.join("\n#{sep} ")

  if Yast::Mode.auto
    !Yast::Popup.TimedErrorAnyQuestion(headline, text,
      Yast::Label.BackButton, Yast::Label.ContinueButton, :focus_yes,
      ERROR_PROPOSAL_TIMEOUT)
  else
    !Yast::Popup.ErrorAnyQuestion(headline, text,
      Yast::Label.BackButton, Yast::Label.ContinueButton, :focus_yes)
  end
end

#clearObject

clears previously stored errros



21
22
23
# File 'src/lib/installation/proposal_errors.rb', line 21

def clear
  @errors = []
end