WIP
This commit is contained in:
parent
b8a31e994f
commit
6a1c8ecf62
@ -318,41 +318,55 @@ do_open2(Selected, State = #s{wallets = Wallets}) ->
|
||||
|
||||
do_open3(Path, State = #s{frame = Frame, j = J}) ->
|
||||
Label = J("Password"),
|
||||
Dialog = wxDialog:new(Frame, ?wxID_ANY, Label),
|
||||
Sizer = wxBoxSizer:new(?wxVERTICAL),
|
||||
PassSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, Label}]),
|
||||
PassTx = wxTextCtrl:new(Dialog, ?wxID_ANY, [{style, ?wxTE_PASSWORD}]),
|
||||
_ = wxStaticBoxSizer:add(PassSz, PassTx, zxw:flags(wide)),
|
||||
ButtSz = wxBoxSizer:new(?wxHORIZONTAL),
|
||||
Affirm = wxButton:new(Dialog, ?wxID_OK),
|
||||
_ = wxBoxSizer:add(ButtSz, Affirm, zxw:flags(wide)),
|
||||
_ = wxBoxSizer:add(Sizer, PassSz, zxw:flags(base)),
|
||||
_ = wxBoxSizer:add(Sizer, ButtSz, zxw:flags(wide)),
|
||||
ok = wxDialog:setSizer(Dialog, Sizer),
|
||||
ok = wxBoxSizer:layout(Sizer),
|
||||
ok = wxDialog:setSize(Dialog, {500, 130}),
|
||||
ok = wxDialog:center(Dialog),
|
||||
ok = wxStyledTextCtrl:setFocus(PassTx),
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK ->
|
||||
case wxTextCtrl:getValue(PassTx) of
|
||||
"" ->
|
||||
ok = wxDialog:destroy(Dialog),
|
||||
ensure_shown(Frame);
|
||||
Phrase ->
|
||||
ok = wxDialog:destroy(Dialog),
|
||||
case gd_con:open_wallet(Path, Phrase) of
|
||||
ok ->
|
||||
do_close(State);
|
||||
Error ->
|
||||
ok = ensure_shown(Frame),
|
||||
trouble(Error)
|
||||
end
|
||||
case zxw_text_modal:show(Frame, Label, [{password, true}]) of
|
||||
{ok, ""} ->
|
||||
ensure_shown(Frame);
|
||||
{ok, Phrase} ->
|
||||
case gd_con:open_wallet(Path, Phrase) of
|
||||
ok ->
|
||||
do_close(State);
|
||||
Error ->
|
||||
ok = ensure_shown(Frame),
|
||||
trouble(Error)
|
||||
end;
|
||||
?wxID_CANCEL ->
|
||||
ok = wxDialog:destroy(Dialog),
|
||||
cancel ->
|
||||
ensure_shown(Frame)
|
||||
end.
|
||||
% Dialog = wxDialog:new(Frame, ?wxID_ANY, Label),
|
||||
% Sizer = wxBoxSizer:new(?wxVERTICAL),
|
||||
% PassSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, Label}]),
|
||||
% PassTx = wxTextCtrl:new(Dialog, ?wxID_ANY, [{style, ?wxTE_PASSWORD}]),
|
||||
% _ = wxStaticBoxSizer:add(PassSz, PassTx, zxw:flags(wide)),
|
||||
% ButtSz = wxBoxSizer:new(?wxHORIZONTAL),
|
||||
% Affirm = wxButton:new(Dialog, ?wxID_OK),
|
||||
% _ = wxBoxSizer:add(ButtSz, Affirm, zxw:flags(wide)),
|
||||
% _ = wxBoxSizer:add(Sizer, PassSz, zxw:flags(base)),
|
||||
% _ = wxBoxSizer:add(Sizer, ButtSz, zxw:flags(wide)),
|
||||
% ok = wxDialog:setSizer(Dialog, Sizer),
|
||||
% ok = wxBoxSizer:layout(Sizer),
|
||||
% ok = wxDialog:setSize(Dialog, {500, 130}),
|
||||
% ok = wxDialog:center(Dialog),
|
||||
% ok = wxStyledTextCtrl:setFocus(PassTx),
|
||||
% case wxDialog:showModal(Dialog) of
|
||||
% ?wxID_OK ->
|
||||
% case wxTextCtrl:getValue(PassTx) of
|
||||
% "" ->
|
||||
% ok = wxDialog:destroy(Dialog),
|
||||
% ensure_shown(Frame);
|
||||
% Phrase ->
|
||||
% ok = wxDialog:destroy(Dialog),
|
||||
% case gd_con:open_wallet(Path, Phrase) of
|
||||
% ok ->
|
||||
% do_close(State);
|
||||
% Error ->
|
||||
% ok = ensure_shown(Frame),
|
||||
% trouble(Error)
|
||||
% end
|
||||
% end;
|
||||
% ?wxID_CANCEL ->
|
||||
% ok = wxDialog:destroy(Dialog),
|
||||
% ensure_shown(Frame)
|
||||
% end.
|
||||
|
||||
|
||||
do_wiz(State = #s{wx = WX, lang = Lang, wiz = none}) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user