Module: Yast::BootloaderRoutinesPopupsInclude

Defined in:
src/include/bootloader/routines/popups.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) askLocationResetPopup(reason)

Ask for change of bootloader location because of device unavailability

Parameters:

  • reason (String)

    text stating why the location should be re-proposed

Returns:

  • (Boolean)

    yes if shall be reset



77
78
79
80
81
82
83
84
# File 'src/include/bootloader/routines/popups.rb', line 77

def askLocationResetPopup(reason)
  Popup.YesNo(
    # Confirmation box with yes-no popup. %1 is reason why we need to set
    # default location. It is translated on caller side and it is complete
    # sentence.
    Builtins.sformat(_("%1Set default boot loader location?\n"), reason)
  )
end

- (Boolean) confirmAbortPopup

Display question

Returns:

  • (Boolean)

    true if answered yes



45
46
47
48
49
50
51
52
# File 'src/include/bootloader/routines/popups.rb', line 45

def confirmAbortPopup
  # yes-no popup question
  Popup.YesNo(
    _(
      "Really leave the boot loader configuration without saving?\nAll changes will be lost.\n"
    )
  )
end

- (Object) emptyPasswdErrorPopup

Display error



55
56
57
58
59
60
# File 'src/include/bootloader/routines/popups.rb', line 55

def emptyPasswdErrorPopup
  # error popup
  Report.Error(_("The password must not be empty."))

  nil
end

- (Object) initialize_bootloader_routines_popups(include_target)



19
20
21
22
23
24
25
26
27
28
29
# File 'src/include/bootloader/routines/popups.rb', line 19

def initialize_bootloader_routines_popups(include_target)
  textdomain "bootloader"

  Yast.import "Encoding"
  Yast.import "Label"
  Yast.import "Misc"
  Yast.import "Mode"
  Yast.import "Popup"
  Yast.import "Report"
  Yast.import "String"
end

- (Object) NoLoaderAvailable

Inform about not available functionality when no loader selected



32
33
34
35
36
37
38
39
40
41
# File 'src/include/bootloader/routines/popups.rb', line 32

def NoLoaderAvailable
  # popup message
  Popup.Message(
    _(
      "This function is not available if the boot\nloader is not specified."
    )
  )

  nil
end

- (Object) passwdMissmatchPopup

Display error



63
64
65
66
67
68
69
70
71
72
# File 'src/include/bootloader/routines/popups.rb', line 63

def passwdMissmatchPopup
  # error popup
  Report.Error(
    _(
      "'Password' and 'Retype password'\ndo not match. Retype the password."
    )
  )

  nil
end

- (Boolean) restoreMBRPopup(device)

Display popup - confirmation befopre restoring MBR

Parameters:

  • device (String)

    string device to restore to

Returns:

  • (Boolean)

    true of MBR restore confirmed



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'src/include/bootloader/routines/popups.rb', line 110

def restoreMBRPopup(device)
  stat = Convert.to_map(SCR.Read(path(".target.stat"), "/boot/backup_mbr"))
  ctime = Ops.get_integer(stat, "ctime", 0)
  command = Builtins.sformat(
    "date --date='1970-01-01 00:00:00 %1 seconds'",
    ctime
  )
  out = Convert.to_map(SCR.Execute(path(".target.bash_output"), command))
  c_time = Ops.get_string(out, "stdout", "")
  c_time = String.FirstChunk(c_time, "\n")
  c_time = Convert.to_string(UI.Recode(Encoding.console, "UTF-8", c_time))

  # warning popup. %1 is device name, %2 is date/time in form of
  # 'date' command output
  msg = Builtins.sformat(
    _(
      "Warning!\n" +
        "\n" +
        "Current MBR of %1 will now be rewritten with MBR\n" +
        "saved at %2.\n" +
        "\n" +
        "Only the booting code in the MBR will be rewritten.\n" +
        "The partition table remains unchanged.\n" +
        "\n" +
        "Continue?\n"
    ),
    device,
    c_time
  )

  dialog = HBox(
    HSpacing(1),
    VBox(
      VSpacing(0.2),
      Label(msg),
      HBox(
        # PushButton
        PushButton(Id(:yes), _("&Yes, Rewrite")),
        HStretch(),
        PushButton(Id(:no), Opt(:default), Label.NoButton)
      ),
      VSpacing(0.2)
    ),
    HSpacing(1)
  )

  UI.OpenDialog(Opt(:decorated, :warncolor), dialog)

  button = nil
  begin
    button = Convert.to_symbol(UI.UserInput)
  end until button == :yes || button == :no

  UI.CloseDialog

  button == :yes
end

- (Object) usedNameErrorPopup

Display error



87
88
89
90
91
92
93
94
# File 'src/include/bootloader/routines/popups.rb', line 87

def usedNameErrorPopup
  # error popup
  Report.Error(
    _("The name selected is already used.\nUse a different one.\n")
  )

  nil
end

- (Object) writeErrorPopup

Display error

Returns:

  • true if shall retry



98
99
100
101
102
103
104
105
# File 'src/include/bootloader/routines/popups.rb', line 98

def writeErrorPopup
  # yes-no popup
  Popup.YesNo(
    _(
      "An error occurred during boot loader\ninstallation. Retry boot loader configuration?\n"
    )
  )
end