WIP
This commit is contained in:
+4
-21
@@ -298,7 +298,7 @@ handle_event(#wx{event = #wxCommand{type = command_button_clicked},
|
||||
#w{name = mnemonic} -> show_mnemonic(State);
|
||||
#w{name = rename} -> rename_key(State);
|
||||
#w{name = drop_key} -> drop_key(State);
|
||||
#w{name = copy} -> copy(State);
|
||||
#w{name = copy} -> copy_pk(State);
|
||||
#w{name = www} -> www(State);
|
||||
#w{name = send} -> spend(State);
|
||||
#w{name = grids} -> grids_dialogue(State);
|
||||
@@ -588,7 +588,7 @@ show_mnemonic(Selected, State = #s{frame = Frame, j = J, accounts = Accounts}) -
|
||||
ok =
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_CANCEL -> ok;
|
||||
?wxID_OK -> copy_to_clipboard(Mnemonic)
|
||||
?wxID_OK -> gd_lib:copy_to_clipboard(Mnemonic)
|
||||
end,
|
||||
ok = wxDialog:destroy(Dialog),
|
||||
State.
|
||||
@@ -656,28 +656,11 @@ drop_key(Selected, State = #s{frame = Frame, j = J, accounts = Accounts, prefs =
|
||||
State#s{prefs = NewPrefs}.
|
||||
|
||||
|
||||
copy(State = #s{id = {_, #w{wx = ID_T}}}) ->
|
||||
copy_pk(State = #s{id = {_, #w{wx = ID_T}}}) ->
|
||||
String = wxStaticText:getLabel(ID_T),
|
||||
ok = copy_to_clipboard(String),
|
||||
ok = gd_lib:copy_to_clipboard(String),
|
||||
State.
|
||||
|
||||
copy_to_clipboard(String) ->
|
||||
CB = wxClipboard:get(),
|
||||
case wxClipboard:open(CB) of
|
||||
true ->
|
||||
Text = wxTextDataObject:new([{text, String}]),
|
||||
case wxClipboard:setData(CB, Text) of
|
||||
true ->
|
||||
R = wxClipboard:flush(CB),
|
||||
log(info, "String copied to system clipboard. Flushed: ~p", [R]);
|
||||
false ->
|
||||
log(info, "Failed to copy to clipboard")
|
||||
end,
|
||||
ok = wxClipboard:close(CB);
|
||||
false ->
|
||||
log(info, "Failed to acquire the clipboard.")
|
||||
end.
|
||||
|
||||
|
||||
www(State = #s{id = {_, #w{wx = ID_T}}, j = J}) ->
|
||||
case wxStaticText:getLabel(ID_T) of
|
||||
|
||||
Reference in New Issue
Block a user