Skip to content

Commit

Permalink
Merge pull request #16 from yast/ui_fixes
Browse files Browse the repository at this point in the history
UI fixes
  • Loading branch information
lslezak committed Feb 25, 2014
2 parents 285dbf6 + 38a78f1 commit f2263e9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
8 changes: 8 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 25 09:14:24 UTC 2014 - lslezak@suse.cz

- make the credentials input fields wider (bnc#864882)
- ask user to confirm skipping the registration
- use the current language in "Accept-Language" HTTP header
- 3.1.9

-------------------------------------------------------------------
Fri Feb 21 08:02:38 UTC 2014 - vmoravec@suse.com

Expand Down
6 changes: 4 additions & 2 deletions package/yast2-registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 3.1.8
Version: 3.1.9
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand All @@ -31,8 +31,10 @@ Requires: yast2-pkg-bindings >= 2.17.20
# Y2Logger
Requires: yast2-ruby-bindings >= 3.1.7
# SCC API library
Requires: rubygem-scc_api
Requires: rubygem-scc_api >= 0.2.3
Requires: yast2-slp >= 3.1.2
# Language module
Requires: yast2-country

BuildRequires: yast2 >= 2.23.13
BuildRequires: update-desktop-files
Expand Down
2 changes: 2 additions & 0 deletions src/clients/discover_registration_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def initialize
end

def main
textdomain "registration"

busy_box do
log.info(
"Searching for SLP registration services of type #{SUPPORTED_SERVICES.join(', ')}"
Expand Down
49 changes: 40 additions & 9 deletions src/clients/inst_scc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main
Yast.import "Mode"
Yast.import "Progress"
Yast.import "PackageCallbacks"
Yast.import "Language"

# redirect the scc_api log to y2log
SccApi::GlobalLogger.instance.log = Y2Logger.instance
Expand All @@ -73,8 +74,7 @@ def main
end
end

# skip the registration
return :next if ret == :skip
return :next if ret == :skip && confirm_skipping
end

return ret
Expand All @@ -86,6 +86,9 @@ def main
def register(email, reg_code)
scc = SccApi::Connection.new(email, reg_code)

# set the current language to receive translated error messages
scc.language = language

# announce (register the system) first
credentials = run_with_feedback(_("Registering the System..."), _("Contacting the SUSE Customer Center server")) do
scc.announce
Expand Down Expand Up @@ -157,14 +160,18 @@ def add_services(product_services, credentials)

def scc_credentials_dialog
VBox(
Frame(_("SUSE Customer Center Credentials"),
MarginBox(1, 0.5,
VBox(
InputField(Id(:email), _("&Email")),
VSpacing(0.5),
InputField(Id(:reg_code), _("Registration &Code"))
HBox(
HSpacing(Opt(:hstretch), 3),
Frame(_("SUSE Customer Center Credentials"),
MarginBox(1, 0.5,
VBox(
MinWidth(32, InputField(Id(:email), _("&Email"))),
VSpacing(0.5),
MinWidth(32, InputField(Id(:reg_code), _("Registration &Code")))
)
)
)
),
HSpacing(Opt(:hstretch), 3),
),
VSpacing(3),
PushButton(Id(:skip), _("&Skip Registration"))
Expand Down Expand Up @@ -230,6 +237,30 @@ def ensure_zypp_config_writable
end
end

def confirm_skipping
# Popup question: confirm skipping the registration
confirmation = _("If you do not register your system we will not be able\n" +
"to grant you access to the update repositories.\n\n" +
"You can register after the installation or visit our\n" +
"Customer Center for online registration.\n\n" +
"Really skip the registration now?")

Popup.YesNo(confirmation)
end

def language
lang = Language.language
log.info "Current language: #{lang}"

# remove the encoding (e.g. ".UTF-8")
lang.sub!(/\..*$/, "")
# replace lang/country separator "_" -> "-"
# see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
lang.tr!("_", "-")

log.info "Language for HTTP requests set to #{lang.inspect}"
lang
end
end
end

Expand Down

0 comments on commit f2263e9

Please sign in to comment.