Back to Home

ESO Lua File v100034

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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
    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
    local emailText = ZO_OptionsPanel_GetAccountEmail()
    if emailText == "" then
        emailText = GetString(SI_INTERFACE_OPTIONS_ACCOUNT_NO_EMAIL_TEXT)
    end
    control:SetText(emailText)
end
    local emailText = ZO_OptionsPanel_GetAccountEmail()
    if emailText ~= "" then
        InitializeTooltip(InformationTooltip, control, BOTTOMLEFT, 0, -2, TOPLEFT)
        SetTooltipText(InformationTooltip, emailText)
    end
end
    ClearTooltip(InformationTooltip)
end
local panelBuilder = ZO_KeyboardOptionsPanelBuilder:New(SETTING_PANEL_ACCOUNT)
------------------------------
-- Account -> Email Address --
------------------------------
panelBuilder:AddSetting({
    controlName = "Options_Account_ChangeEmail",
    template = "ZO_Options_Account_InvokeCallback_WithEmail",
    settingType = SETTING_TYPE_ACCOUNT,
    settingId = ACCOUNT_SETTING_ACCOUNT_EMAIL,
    header = SI_INTERFACE_OPTIONS_ACCOUNT_EMAIL_HEADER,
})
panelBuilder:AddSetting({
    controlName = "Options_Account_ResendActivation",
    template = "ZO_Options_InvokeCallback_Wide",
    settingType = SETTING_TYPE_CUSTOM,
    settingId = OPTIONS_CUSTOM_SETTING_RESEND_EMAIL_ACTIVATION,
    header = SI_INTERFACE_OPTIONS_ACCOUNT_EMAIL_HEADER,
})
--------------------------------------
-- Account -> Marketing Preferences --
--------------------------------------
panelBuilder:AddSetting({
    controlName = "Options_Account_GetUpdates",
    settingType = SETTING_TYPE_ACCOUNT,
    settingId = ACCOUNT_SETTING_GET_UPDATES,
    header = SI_INTERFACE_OPTIONS_ACCOUNT_MARKETING_HEADER,
})