From 8ca6f2fa61953b67517fd698ba34ca77b6a1ccef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 12 Aug 2015 22:23:07 +0200 Subject: [PATCH] added a finish dialog --- src/lib/migration/finish_dialog.rb | 98 ++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/lib/migration/finish_dialog.rb diff --git a/src/lib/migration/finish_dialog.rb b/src/lib/migration/finish_dialog.rb new file mode 100644 index 0000000..1cf4fa6 --- /dev/null +++ b/src/lib/migration/finish_dialog.rb @@ -0,0 +1,98 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2015 SUSE LLC, All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact SUSE LLC. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require "yast" + +module Migration + # Check for possible repository issues in the libzypp products + class FinishDialog + include Yast::Logger + include Yast::I18n + include Yast::UIShortcuts + + Yast.import "UI" + Yast.import "Wizard" + + attr_accessor :reboot + + # run the dialog + def self.run + dialog = FinishDialog.new + dialog.run + end + + # constructor + def initialize + textdomain "migration" + + @reboot = false + end + + # display and run the dialog + # @return [Symbol] user input + def run + Yast::Wizard.SetContents( + # TRANSLATORS: dialog title + _("Migration Finished"), + dialog_content, + # TRANSLATORS: a short help text (the details are directly in the dialog) + _("

The migration has finished.

"), + # going back is not possible + false, + true + ) + + update_details + + loop do + ret = Yast::UI.UserInput + store_values if ret == :next + + return ret if [:next, :back, :cancel, :abort].include?(ret) + end + end + + private + + # the main dialog content + # @return [Yast::Term] UI term + def dialog_content + VBox( + VSpacing(1), + + MinHeight(8, + VWeight(25, + RichText(Id(:details), Opt(:vstretch), "") + )), + + VSpacing(1), + # TRANSLATORS: check button label + CheckBox(Id(:reboot), _("Manually Select Migration Repositories"), reboot), + VSpacing(1) + ) + end + + # store the current UI values + def store_values + self.reboot = Yast::UI.QueryWidget(:reboot, :Value) + log.info "Reboot flag: #{reboot}" + end + end +end