diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-08 11:12:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-09 05:47:36 +0000 |
commit | bcad173faaffd3a3c1e6737d94d2108cf590338d (patch) | |
tree | 8370b2186548de7302eb9109ce6ac520ecf17c3b /uui | |
parent | afc755fa61cfd9645c4ed2507bdc3a06b721ed5c (diff) |
Reapply "create ErrorHandlerFlags scoped enum for error handling flags""
This effectively reverts commit 32cae6a2eaa41568888df9c8fc5605debd8d704a.
Change-Id: I15bb0a5c4acaeee6d47dd93a71601d9687d701bc
Reviewed-on: https://gerrit.libreoffice.org/34028
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'uui')
-rw-r--r-- | uui/source/iahndl-authentication.cxx | 26 | ||||
-rw-r--r-- | uui/source/iahndl-errorhandler.cxx | 32 | ||||
-rw-r--r-- | uui/source/iahndl.cxx | 26 | ||||
-rw-r--r-- | uui/source/loginerr.hxx | 10 |
4 files changed, 51 insertions, 43 deletions
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 9e07550ee5db..3701f73886c7 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -113,8 +113,8 @@ executeLoginDialog( if ( bCanUseSysCreds ) xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() ); - rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : - ERRCODE_BUTTON_CANCEL); + rInfo.SetResult(xDialog->Execute() == RET_OK ? ErrorHandlerFlags::ButtonsOk : + ErrorHandlerFlags::ButtonsCancel); rInfo.SetUserName(xDialog->GetName()); rInfo.SetPassword(xDialog->GetPassword()); rInfo.SetAccount(xDialog->GetAccount()); @@ -276,7 +276,7 @@ handleAuthenticationRequest_( rRequest.HasRealm ? rRequest.Realm : OUString()); switch (aInfo.GetResult()) { - case ERRCODE_BUTTON_OK: + case ErrorHandlerFlags::ButtonsOk: if (xSupplyAuthentication.is()) { if (xSupplyAuthentication->canSetUserName()) @@ -390,7 +390,7 @@ handleAuthenticationRequest_( } break; - case ERRCODE_BUTTON_RETRY: + case ErrorHandlerFlags::ButtonsRetry: if (xRetry.is()) xRetry->select(); break; @@ -419,7 +419,7 @@ executeMasterPasswordDialog( ScopedVclPtrInstance< MasterPasswordCreateDialog > xDialog( pParent, xManager.get()); rInfo.SetResult(xDialog->Execute() - == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); + == RET_OK ? ErrorHandlerFlags::ButtonsOk : ErrorHandlerFlags::ButtonsCancel); aMaster = OUStringToOString( xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8); } @@ -428,7 +428,7 @@ executeMasterPasswordDialog( ScopedVclPtrInstance< MasterPasswordDialog > xDialog( pParent, nMode, xManager.get()); rInfo.SetResult(xDialog->Execute() - == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); + == RET_OK ? ErrorHandlerFlags::ButtonsOk : ErrorHandlerFlags::ButtonsCancel); aMaster = OUStringToOString( xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8); } @@ -476,7 +476,7 @@ handleMasterPasswordRequest_( switch (aInfo.GetResult()) { - case ERRCODE_BUTTON_OK: + case ErrorHandlerFlags::ButtonsOk: if (xSupplyAuthentication.is()) { if (xSupplyAuthentication->canSetPassword()) @@ -485,7 +485,7 @@ handleMasterPasswordRequest_( } break; - case ERRCODE_BUTTON_RETRY: + case ErrorHandlerFlags::ButtonsRetry: if (xRetry.is()) xRetry->select(); break; @@ -520,7 +520,7 @@ executePasswordDialog( bIsPasswordToModify, bIsSimplePasswordRequest); xDialog->SetMinLen(0); - rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); + rInfo.SetResult(xDialog->Execute() == RET_OK ? ErrorHandlerFlags::ButtonsOk : ErrorHandlerFlags::ButtonsCancel); rInfo.SetPassword(xDialog->GetPassword()); } else @@ -531,7 +531,7 @@ executePasswordDialog( ScopedVclPtr<AbstractPasswordToOpenModifyDialog> const pDialog( pFact->CreatePasswordToOpenModifyDialog(pParent, nMaxPasswdLen, bIsPasswordToModify)); - rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL ); + rInfo.SetResult( pDialog->Execute() == RET_OK ? ErrorHandlerFlags::ButtonsOk : ErrorHandlerFlags::ButtonsCancel ); rInfo.SetPassword( pDialog->GetPasswordToOpen() ); rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() ); rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() ); @@ -543,7 +543,7 @@ executePasswordDialog( bIsPasswordToModify, bIsSimplePasswordRequest); xDialog->SetMinLen(0); - rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); + rInfo.SetResult(xDialog->Execute() == RET_OK ? ErrorHandlerFlags::ButtonsOk : ErrorHandlerFlags::ButtonsCancel); rInfo.SetPassword(bIsPasswordToModify ? OUString() : xDialog->GetPassword()); rInfo.SetPasswordToModify(bIsPasswordToModify ? xDialog->GetPassword() : OUString()); } @@ -582,7 +582,7 @@ handlePasswordRequest_( switch (aInfo.GetResult()) { - case ERRCODE_BUTTON_OK: + case ErrorHandlerFlags::ButtonsOk: OSL_ENSURE( !bIsPasswordToModify || xPassword2.is(), "PasswordToModify is requested, but there is no Interaction!" ); if (xPassword.is()) { @@ -597,7 +597,7 @@ handlePasswordRequest_( } break; - case ERRCODE_BUTTON_RETRY: + case ErrorHandlerFlags::ButtonsRetry: if (xRetry.is()) xRetry->select(); break; diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx index 786ba755a298..a549cc2a4e7b 100644 --- a/uui/source/iahndl-errorhandler.cxx +++ b/uui/source/iahndl-errorhandler.cxx @@ -40,7 +40,7 @@ using namespace com::sun::star; namespace { -sal_uInt16 +ErrorHandlerFlags executeErrorDialog( vcl::Window * pParent, task::InteractionClassification eClassification, @@ -101,27 +101,29 @@ executeErrorDialog( throw uno::RuntimeException("out of memory"); } - sal_uInt16 aResult = xBox->Execute(); + sal_uInt16 aMessResult = xBox->Execute(); xBox.disposeAndClear(); - switch( aResult ) + ErrorHandlerFlags aResult = ErrorHandlerFlags::NONE; + switch( aMessResult ) { case RET_OK: - aResult = ERRCODE_BUTTON_OK; + aResult = ErrorHandlerFlags::ButtonsOk; break; case RET_CANCEL: - aResult = ERRCODE_BUTTON_CANCEL; + aResult = ErrorHandlerFlags::ButtonsCancel; break; case RET_YES: - aResult = ERRCODE_BUTTON_YES; + aResult = ErrorHandlerFlags::ButtonsYes; break; case RET_NO: - aResult = ERRCODE_BUTTON_NO; + aResult = ErrorHandlerFlags::ButtonsNo; break; case RET_RETRY: - aResult = ERRCODE_BUTTON_RETRY; + aResult = ErrorHandlerFlags::ButtonsRetry; break; + default: assert(false); } return aResult; @@ -257,12 +259,12 @@ UUIInteractionHelper::handleErrorHandlerRequest( } } - sal_uInt16 nResult = executeErrorDialog( + ErrorHandlerFlags nResult = executeErrorDialog( getParentProperty(), eClassification, aContext, aMessage, nButtonMask ); switch (nResult) { - case ERRCODE_BUTTON_OK: + case ErrorHandlerFlags::ButtonsOk: OSL_ENSURE(xApprove.is() || xAbort.is(), "unexpected situation"); if (xApprove.is()) xApprove->select(); @@ -270,29 +272,31 @@ UUIInteractionHelper::handleErrorHandlerRequest( xAbort->select(); break; - case ERRCODE_BUTTON_CANCEL: + case ErrorHandlerFlags::ButtonsCancel: OSL_ENSURE(xAbort.is(), "unexpected situation"); if (xAbort.is()) xAbort->select(); break; - case ERRCODE_BUTTON_RETRY: + case ErrorHandlerFlags::ButtonsRetry: OSL_ENSURE(xRetry.is(), "unexpected situation"); if (xRetry.is()) xRetry->select(); break; - case ERRCODE_BUTTON_NO: + case ErrorHandlerFlags::ButtonsNo: OSL_ENSURE(xDisapprove.is(), "unexpected situation"); if (xDisapprove.is()) xDisapprove->select(); break; - case ERRCODE_BUTTON_YES: + case ErrorHandlerFlags::ButtonsYes: OSL_ENSURE(xApprove.is(), "unexpected situation"); if (xApprove.is()) xApprove->select(); break; + + default: break; } } diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 46d325f95b55..fe4aebb6379c 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -987,7 +987,7 @@ UUIInteractionHelper::getInteractionHandler() namespace { -sal_uInt16 +ErrorHandlerFlags executeMessageBox( vcl::Window * pParent, OUString const & rTitle, @@ -998,24 +998,26 @@ executeMessageBox( ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, rTitle, rMessage); - sal_uInt16 aResult = xBox->Execute(); - switch( aResult ) + sal_uInt16 aMessResult = xBox->Execute(); + ErrorHandlerFlags aResult = ErrorHandlerFlags::NONE; + switch( aMessResult ) { case RET_OK: - aResult = ERRCODE_BUTTON_OK; + aResult = ErrorHandlerFlags::ButtonsOk; break; case RET_CANCEL: - aResult = ERRCODE_BUTTON_CANCEL; + aResult = ErrorHandlerFlags::ButtonsCancel; break; case RET_YES: - aResult = ERRCODE_BUTTON_YES; + aResult = ErrorHandlerFlags::ButtonsYes; break; case RET_NO: - aResult = ERRCODE_BUTTON_NO; + aResult = ErrorHandlerFlags::ButtonsNo; break; case RET_RETRY: - aResult = ERRCODE_BUTTON_RETRY; + aResult = ErrorHandlerFlags::ButtonsRetry; break; + default: assert(false); } return aResult; @@ -1270,23 +1272,25 @@ UUIInteractionHelper::handleBrokenPackageRequest( switch ( executeMessageBox( getParentProperty(), title, aMessage, nButtonMask ) ) { - case ERRCODE_BUTTON_OK: + case ErrorHandlerFlags::ButtonsOk: OSL_ENSURE( xAbort.is(), "unexpected situation" ); if (xAbort.is()) xAbort->select(); break; - case ERRCODE_BUTTON_NO: + case ErrorHandlerFlags::ButtonsNo: OSL_ENSURE(xDisapprove.is(), "unexpected situation"); if (xDisapprove.is()) xDisapprove->select(); break; - case ERRCODE_BUTTON_YES: + case ErrorHandlerFlags::ButtonsYes: OSL_ENSURE(xApprove.is(), "unexpected situation"); if (xApprove.is()) xApprove->select(); break; + + default: break; } } diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx index db4ce88d5178..ae0775a3f154 100644 --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -43,13 +43,13 @@ private: OUString m_aPath; OUString m_aErrorText; sal_uInt8 m_nFlags; - sal_uInt16 m_nRet; + ErrorHandlerFlags m_nRet; bool m_bRecommendToOpenReadonly; public: LoginErrorInfo() : m_nFlags(LOGINERROR_FLAG_MODIFY_USER_NAME) - , m_nRet(ERRCODE_BUTTON_CANCEL) + , m_nRet(ErrorHandlerFlags::ButtonsCancel) , m_bRecommendToOpenReadonly(false) { } @@ -71,8 +71,8 @@ public: bool GetIsUseSystemCredentials() const { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) == LOGINERROR_FLAG_IS_USE_SYSCREDS; } - sal_uInt8 GetFlags() const { return m_nFlags; } - sal_uInt16 GetResult() const { return m_nRet; } + sal_uInt8 GetFlags() const { return m_nFlags; } + ErrorHandlerFlags GetResult() const { return m_nRet; } void SetTitle( const OUString& aTitle ) { m_aTitle = aTitle; } @@ -100,7 +100,7 @@ public: inline void SetModifyAccount( bool bSet ); inline void SetModifyUserName( bool bSet ); - void SetResult( sal_uInt16 nRet ) + void SetResult( ErrorHandlerFlags nRet ) { m_nRet = nRet; } }; |