Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 10, 2024
1 parent 1010a0f commit f7027ef
Showing 1 changed file with 51 additions and 37 deletions.
88 changes: 51 additions & 37 deletions src/lib/y2storage/dialogs/guided_setup/select_scheme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,46 +131,63 @@ def separate_vgs
)
end

def password_widget
Left(
HBox(
HSpacing(2),
Password(Id(:password), Opt(:hstretch), _("Password")),
Password(Id(:repeat_password), Opt(:hstretch), _("Verify Password"))
)
)
end

def encryption_method_widget
Left(
HBox(
HSpacing(2),
ComboBox(
Id(:encryption_method),
Opt(:notify, :hstretch),
_("Encryption method"),
Y2Storage::EncryptionMethod.available.reject(&:only_for_swap?).map do |m|
Item(Id(m.to_sym), m.to_human_string, false)
end
)
)
)
end

def encryption_pbkdf_widget
Left(
HBox(
HSpacing(2),
ComboBox(
Id(:encryption_pbkdf),
Opt(:hstretch),
_("Password-Based Key Derivation &Function (PBKDF)"),
Y2Storage::PbkdFunction.all.map do |m|
Item(Id(m.value), m.name, (m.value == "pbkdf2"))
end
)
)
)
end

def enable_disk_encryption
VBox(
Left(CheckBox(Id(:encryption), Opt(:notify), _(WIDGET_LABELS[:enable_disk_encryption]))),
VSpacing(0.2),
Left(
HBox(
HSpacing(2),
Password(Id(:password), Opt(:hstretch), _("Password")),
Password(Id(:repeat_password), Opt(:hstretch), _("Verify Password"))
)
),
Left(
HBox(
HSpacing(2),
ComboBox(
Id(:encryption_method),
Opt(:notify, :hstretch),
_("Encryption method"),
Y2Storage::EncryptionMethod.available.reject(&:only_for_swap?).map do |m|
Item(Id(m.to_sym), m.to_human_string, false)
end
)
)
),
Left(
HBox(
HSpacing(2),
ComboBox(
Id(:encryption_pbkdf),
Opt(:hstretch),
_("Password-Based Key Derivation &Function (PBKDF)"),
Y2Storage::PbkdFunction.all.map do |m|
Item(Id(m.value), m.name, (m.value == "pbkdf2"))
end
)
)
)
password_widget,
encryption_method_widget,
encryption_pbkdf_widget
)
end

def initialize_encryption_widgets
widget_update(:password, settings.encryption_password)
widget_update(:repeat_password, settings.encryption_password)
end

def initialize_widgets
widget_update(:lvm, settings.use_lvm)
widget_update(:separate_vgs, settings.separate_vgs) if settings.separate_vgs_relevant?
Expand All @@ -182,10 +199,7 @@ def initialize_widgets
Id(settings.encryption_pbkdf.value))
end
encryption_method_handler(focus: false)
return unless settings.use_encryption

widget_update(:password, settings.encryption_password)
widget_update(:repeat_password, settings.encryption_password)
initialize_encryption_widgets if settings.use_encryption
end

def update_settings!
Expand Down

0 comments on commit f7027ef

Please sign in to comment.