Back to Home

ESO Lua File v100029

pregame/optionspanels/keyboard/optionspanel_account_keyboard.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
    ZO_Dialogs_RegisterCustomDialog("ZO_OPTIONS_KEYBOARD_EDIT_EMAIL_DIALOG",
    {
        title =
        {
            text = SI_INTERFACE_OPTIONS_ACCOUNT_EMAIL_DIALOG_TITLE,
        },
        mainText =
        {
            text = SI_INTERFACE_OPTIONS_ACCOUNT_EMAIL_DIALOG_ENTRY_TITLE,
        },
        canQueue = true,
        customControl = control,
        setup = function(dialog)
            local newEmailEdit = dialog:GetNamedChild("NewEmailEntryEdit")
            local confirmNewEmailEdit = dialog:GetNamedChild("ConfirmNewEmailEntryEdit")
            newEmailEdit:SetText("")
            confirmNewEmailEdit:SetText("")
        end,
        buttons =
        {
            -- Confirm Button
            {
                control = control:GetNamedChild("Confirm"),
                keybind = "DIALOG_PRIMARY",
                text = SI_DIALOG_CONFIRM,
                enabled = function(dialog)
                    local newEmailEdit = dialog:GetNamedChild("NewEmailEntryEdit")
                    local confirmNewEmailEdit = dialog:GetNamedChild("ConfirmNewEmailEntryEdit")
                    return newEmailEdit:GetText() == confirmNewEmailEdit:GetText()
                end,
                callback = function(dialog)
                    local newEmailEdit = dialog:GetNamedChild("NewEmailEntryEdit")
                    SetSecureSetting(SETTING_TYPE_ACCOUNT, ACCOUNT_SETTING_ACCOUNT_EMAIL, newEmailEdit:GetText())
                end,
            },
            -- Cancel Button
            {
                control = control:GetNamedChild("Cancel"),
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
            },
        },
        finishedCallback = function()
            KEYBOARD_OPTIONS:UpdatePanelVisibilityIfShowing(SETTING_PANEL_ACCOUNT)
        end,
    })
    -- Edit Email Addresses
    local emailEditBox = control:GetNamedChild("NewEmailEntryEdit")
    ZO_PreHookHandler(emailEditBox, "OnTextChanged", function(editControl)
        ZO_EditDefaultText_OnTextChanged(editControl)
    end)
    local confirmEmailEditBox = control:GetNamedChild("ConfirmNewEmailEntryEdit")
    ZO_PreHookHandler(confirmEmailEditBox, "OnTextChanged", function(editControl)
        ZO_EditDefaultText_OnTextChanged(editControl)
    end)
    ZO_PreHookHandler(emailEditBox, "OnEnter", function(editControl)
        confirmEmailEditBox:TakeFocus()
    end)
    ZO_PreHookHandler(emailEditBox, "OnTab", function(editControl)
        confirmEmailEditBox:TakeFocus()
    end)
    ZO_PreHookHandler(confirmEmailEditBox, "OnEnter", function(editControl)
        if emailEditBox:GetText() == confirmEmailEditBox:GetText() then
            SetSecureSetting(SETTING_TYPE_ACCOUNT, ACCOUNT_SETTING_ACCOUNT_EMAIL, emailEditBox:GetText())
            ZO_Dialogs_ReleaseDialog("ZO_OPTIONS_KEYBOARD_EDIT_EMAIL_DIALOG")
        end
    end)
    ZO_PreHookHandler(confirmEmailEditBox, "OnTab", function(editControl)
        emailEditBox:TakeFocus()
    end)
end
end
    local labelControl = Options_Account_DisplayEmailAddress:GetNamedChild("Content")
    local emailText = ZO_OptionsPanel_GetAccountEmail()
    if emailText == "" then
        emailText = GetString(SI_INTERFACE_OPTIONS_ACCOUNT_NO_EMAIL_TEXT)
    end
    labelControl:SetText(emailText)
end
function ZO_OptionsPanel_Account_InitializeSetting_Keyboard(control, settingType, settingId)
    if ZO_SharedOptions_SettingsData[SETTING_PANEL_ACCOUNT] ~= nil then
        control.data = KEYBOARD_OPTIONS:GetSettingsData(SETTING_PANEL_ACCOUNT, settingType, settingId)
    else
        control:SetHidden(true)
    end
end