Skip to content

Commit

Permalink
Some changes based on CR.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 9, 2017
1 parent a0d52c7 commit 70aa5dd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
7 changes: 4 additions & 3 deletions src/lib/installation/clients/inst_install_inf.rb
Expand Up @@ -42,9 +42,10 @@ def fix_regurl!(regurl)
while regurl && !valid_url?(regurl)
new_url = ::Installation::RegistrationURLDialog.new(regurl).run
case new_url
when :abort
if Popup.YesNo(_("If you decide to abort, the custom URL\n" \
"will be completely removed.\n\n Really abort?\n"))
when :cancel
if Popup.YesNo(_("If you decide to cancel, the custom URL\n" \
"will be completelly ignored.\n\n" \
"Really cancel URL modification?"))
regurl = nil
end
when "",
Expand Down
1 change: 1 addition & 0 deletions src/lib/installation/dialogs/registration_url_dialog.rb
Expand Up @@ -25,6 +25,7 @@
module Installation
class RegistrationURLDialog < ::Installation::URLDialog
def help_text
# TRANSLATORS: Help text alerting the user about a invalid url
_("<p>\n" \
"The registration url provided in the command line is not valid.\n" \
"Check that you entered it correctly and try again.\n" \
Expand Down
53 changes: 30 additions & 23 deletions src/lib/installation/dialogs/url_dialog.rb
Expand Up @@ -40,45 +40,52 @@ def initialize(url)
# @param [String] original Original value
# @return [String] new value
def dialog_content
HBox(
HWeight(30, RichText(help_text)),
HStretch(),
HSpacing(1),
HWeight(
70,
VBox(
Heading(dialog_title),
VSpacing(1),
VStretch(),
MinWidth(60,
Left(TextEntry(Id(:uri), entry_label, @url))),
VSpacing(1),
VStretch(),
HBox(
PushButton(Id(:retry), Opt(:default), Yast::Label.RetryButton),
PushButton(Id(:abort), Yast::Label.AbortButton)
)
)
VBox(
Heading(dialog_title),
show_help? ? RichText(help_text) : Empty(),
VSpacing(1),
VStretch(),
MinWidth(60,
Left(TextEntry(Id(:uri), entry_label, @url))),
VSpacing(1),
VStretch(),
HBox(
PushButton(Id(:ok), Opt(:default), ok_label),
PushButton(Id(:cancel), cancel_label)
)
)
end

def retry_handler
def ok_handler
@url = Yast::UI.QueryWidget(Id(:uri), :Value)
finish_dialog(@url)
end

def abort_handler
finish_dialog(:abort)
def cancel_handler
finish_dialog(:cancel)
end

# Help text that will be displayed at the left of the dialog
def ok_label
Yast::Label.OKButton
end

def cancel_label
Yast::Label.CancelButton
end

# Help text that will be displayed above the url entry
#
# @return [String]
def help_text
""
end

def show_help?
return true if help_text && help_text != ""

false
end

# Heading title for the dialog
#
# @return [String]
Expand Down

0 comments on commit 70aa5dd

Please sign in to comment.