diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cjs_app.cpp | 10 | ||||
-rw-r--r-- | fxjs/cjs_publicmethods.cpp | 3 | ||||
-rw-r--r-- | fxjs/xfa/cjx_hostpseudomodel.cpp | 12 |
3 files changed, 15 insertions, 10 deletions
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp index 36a1212715..f52d7e9230 100644 --- a/fxjs/cjs_app.cpp +++ b/fxjs/cjs_app.cpp @@ -254,11 +254,11 @@ CJS_Return CJS_App::alert(CJS_Runtime* pRuntime, swMsg = pRuntime->ToWideString(newParams[0]); } - int iIcon = 0; + int iIcon = JSPLATFORM_ALERT_ICON_DEFAULT; if (IsTypeKnown(newParams[1])) iIcon = pRuntime->ToInt32(newParams[1]); - int iType = 0; + int iType = JSPLATFORM_ALERT_BUTTON_DEFAULT; if (IsTypeKnown(newParams[2])) iType = pRuntime->ToInt32(newParams[2]); @@ -282,7 +282,11 @@ CJS_Return CJS_App::beep(CJS_Runtime* pRuntime, if (params.size() != 1) return CJS_Return(JSMessage::kParamError); - pRuntime->GetFormFillEnv()->JS_appBeep(pRuntime->ToInt32(params[0])); + int type = JSPLATFORM_BEEP_DEFAULT; + if (IsTypeKnown(params[0])) + type = pRuntime->ToInt32(params[0]); + + pRuntime->GetFormFillEnv()->JS_appBeep(type); return CJS_Return(); } diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp index 58a54e5212..a86ece3461 100644 --- a/fxjs/cjs_publicmethods.cpp +++ b/fxjs/cjs_publicmethods.cpp @@ -82,7 +82,8 @@ T StrTrim(const T& str) { void AlertIfPossible(CJS_EventContext* pContext, const WideString& swMsg) { CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv(); if (pFormFillEnv) - pFormFillEnv->JS_appAlert(swMsg, WideString(), 0, 3); + pFormFillEnv->JS_appAlert(swMsg, WideString(), JSPLATFORM_ALERT_BUTTON_OK, + JSPLATFORM_ALERT_ICON_STATUS); } #if _FX_OS_ != _FX_OS_ANDROID_ diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp index 6dd160639a..37bc99ad47 100644 --- a/fxjs/xfa/cjx_hostpseudomodel.cpp +++ b/fxjs/xfa/cjx_hostpseudomodel.cpp @@ -502,18 +502,18 @@ CJS_Return CJX_HostPseudoModel::messageBox( if (params.size() >= 2) title = runtime->ToWideString(params[1]); - uint32_t messageType = XFA_MBICON_Error; + uint32_t messageType = static_cast<uint32_t>(AlertIcon::kDefault); if (params.size() >= 3) { messageType = runtime->ToInt32(params[2]); - if (messageType > XFA_MBICON_Status) - messageType = XFA_MBICON_Error; + if (messageType > static_cast<uint32_t>(AlertIcon::kStatus)) + messageType = static_cast<uint32_t>(AlertIcon::kDefault); } - uint32_t buttonType = XFA_MB_OK; + uint32_t buttonType = static_cast<uint32_t>(AlertButton::kDefault); if (params.size() >= 4) { buttonType = runtime->ToInt32(params[3]); - if (buttonType > XFA_MB_YesNoCancel) - buttonType = XFA_MB_OK; + if (buttonType > static_cast<uint32_t>(AlertButton::kYesNoCancel)) + buttonType = static_cast<uint32_t>(AlertButton::kDefault); } int32_t iValue = pNotify->GetAppProvider()->MsgBox(message, title, |