Class: Watobo::Gui::PasswordPolicyDialog

Inherits:
FXDialogBox
  • Object
show all
Includes:
Responder
Defined in:
lib/watobo/gui/password_policy_dialog.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner, password_policy = {}) ⇒ PasswordPolicyDialog

Returns a new instance of PasswordPolicyDialog.


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/watobo/gui/password_policy_dialog.rb', line 35

def initialize(owner, password_policy = {} )
  super(owner, "Password Policy", :opts => DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE, :width => 200, :height => 150)

  @password_policy = {
    :save_passwords => false,
    :save_without_master => false
  }
  @password_policy.update password_policy if password_policy.is_a? Hash

  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)

  frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @save_pws_cbt = FXCheckButton.new(frame, "save passwords")
  @save_pws_cbt.checkState = false
  @save_pws_cbt.checkState = true if @password_policy[:save_passwords] == true

  @save_pws_cbt.connect(SEL_COMMAND) {
    @save_without_cbt.enabled = @save_pws_cbt.checked?
  }

  @save_without_cbt = FXCheckButton.new(frame, "save without masterpassword")

  @save_without_cbt.enabled = @save_pws_cbt.checked?

  @save_without_cbt.checkState = false
  @save_without_cbt.checkState = true if @password_policy[:save_without_master] == true

  buttons = FXHorizontalFrame.new(frame, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
  :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)

  # Accept
  @acceptBtn = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
  FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
  @acceptBtn.enable

  FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
  FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
  #  @hostname.handle(self, FXSEL(SEL_UPDATE, 0), nil)
  #  @domain.handle(self, FXSEL(SEL_UPDATE, 0), nil)
  #  @user.handle(self, FXSEL(SEL_UPDATE, 0), nil)
  #  @email.handle(self, FXSEL(SEL_UPDATE, 0), nil)

end

Instance Method Details

#passwordPolicyObject


28
29
30
31
32
33
# File 'lib/watobo/gui/password_policy_dialog.rb', line 28

def passwordPolicy
  pp = {
    :save_passwords => @save_pws_cbt.checked?,
    :save_without_master => @save_without_cbt.checked?
  }
end