Fix for fdo43460 Part XLIII getLength() to isEmpty()

Part XLIII
Modules
uui
This commit is contained in:
Olivier Hallot
2012-01-19 22:05:49 -02:00
parent 5738e07a78
commit c571e8777d
10 changed files with 37 additions and 47 deletions

View File

@@ -335,7 +335,7 @@ handleAuthenticationRequest_(
if (aInfo.GetIsRememberPassword()) if (aInfo.GetIsRememberPassword())
{ {
if (!aPwContainerHelper.addRecord( if (!aPwContainerHelper.addRecord(
rURL.getLength() ? rURL : rRequest.ServerName, !rURL.isEmpty() ? rURL : rRequest.ServerName,
rtl::OUString(), // empty u/p -> sys creds rtl::OUString(), // empty u/p -> sys creds
uno::Sequence< rtl::OUString >(), uno::Sequence< rtl::OUString >(),
xIH, xIH,
@@ -350,7 +350,7 @@ handleAuthenticationRequest_(
== ucb::RememberAuthentication_SESSION) == ucb::RememberAuthentication_SESSION)
{ {
if (!aPwContainerHelper.addRecord( if (!aPwContainerHelper.addRecord(
rURL.getLength() ? rURL : rRequest.ServerName, !rURL.isEmpty() ? rURL : rRequest.ServerName,
rtl::OUString(), // empty u/p -> sys creds rtl::OUString(), // empty u/p -> sys creds
uno::Sequence< rtl::OUString >(), uno::Sequence< rtl::OUString >(),
xIH, xIH,
@@ -373,7 +373,7 @@ handleAuthenticationRequest_(
if (aInfo.GetIsRememberPassword()) if (aInfo.GetIsRememberPassword())
{ {
if (!aPwContainerHelper.addRecord( if (!aPwContainerHelper.addRecord(
rURL.getLength() ? rURL : rRequest.ServerName, !rURL.isEmpty() ? rURL : rRequest.ServerName,
aInfo.GetUserName(), aInfo.GetUserName(),
aPassList, aPassList,
xIH, xIH,
@@ -388,7 +388,7 @@ handleAuthenticationRequest_(
== ucb::RememberAuthentication_SESSION) == ucb::RememberAuthentication_SESSION)
{ {
if (!aPwContainerHelper.addRecord( if (!aPwContainerHelper.addRecord(
rURL.getLength() ? rURL : rRequest.ServerName, !rURL.isEmpty() ? rURL : rRequest.ServerName,
aInfo.GetUserName(), aInfo.GetUserName(),
aPassList, aPassList,
xIH, xIH,

View File

@@ -61,7 +61,7 @@ executeErrorDialog(
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
rtl::OUStringBuffer aText(rContext); rtl::OUStringBuffer aText(rContext);
if (rContext.getLength() != 0 && rMessage.getLength() != 0) if (!rContext.isEmpty() && !rMessage.isEmpty())
aText.appendAscii(RTL_CONSTASCII_STRINGPARAM(":\n")); aText.appendAscii(RTL_CONSTASCII_STRINGPARAM(":\n"));
//TODO! must be internationalized //TODO! must be internationalized
aText.append(rMessage); aText.append(rMessage);
@@ -265,7 +265,7 @@ UUIInteractionHelper::handleErrorHandlerRequest(
//TODO! remove this backwards compatibility? //TODO! remove this backwards compatibility?
rtl::OUString aContext(getContextProperty()); rtl::OUString aContext(getContextProperty());
if (aContext.getLength() == 0 && nErrorCode != 0) if (aContext.isEmpty() && nErrorCode != 0)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
ErrorContext * pContext = ErrorContext::GetContext(); ErrorContext * pContext = ErrorContext::GetContext();

View File

@@ -193,7 +193,7 @@ handleNoSuchFilterRequest_(
// If he doesn't select anyone // If he doesn't select anyone
// -> abort operation // -> abort operation
if (sSelectedFilter.getLength()<1) if (sSelectedFilter.isEmpty())
{ {
xAbort->select(); xAbort->select();
return; return;
@@ -298,7 +298,7 @@ handleAmbigousFilterRequest_(
lNames, lNames,
sFilter ); sFilter );
if( sFilter.getLength() > 0 ) if( !sFilter.isEmpty() )
{ {
xFilterTransport->setFilter( sFilter ); xFilterTransport->setFilter( sFilter );
xFilterTransport->select(); xFilterTransport->select();
@@ -362,7 +362,7 @@ handleFilterOptionsRequest_(
{ {
::rtl::OUString aServiceName; ::rtl::OUString aServiceName;
aProps[nProperty].Value >>= aServiceName; aProps[nProperty].Value >>= aServiceName;
if( aServiceName.getLength() ) if( !aServiceName.isEmpty() )
{ {
uno::Reference< uno::Reference<
ui::dialogs::XExecutableDialog > xFilterDialog( ui::dialogs::XExecutableDialog > xFilterDialog(

View File

@@ -96,7 +96,7 @@ handleLockedDocumentRequest_(
sal_Int32 nResult = RET_CANCEL; sal_Int32 nResult = RET_CANCEL;
if ( nMode == UUI_DOC_LOAD_LOCK ) if ( nMode == UUI_DOC_LOAD_LOCK )
{ {
aArguments.push_back( aInfo.getLength() aArguments.push_back( !aInfo.isEmpty()
? aInfo ? aInfo
: ::rtl::OUString( String( : ::rtl::OUString( String(
ResId( STR_UNKNOWNUSER, ResId( STR_UNKNOWNUSER,
@@ -111,7 +111,7 @@ handleLockedDocumentRequest_(
} }
else if ( nMode == UUI_DOC_SAVE_LOCK ) else if ( nMode == UUI_DOC_SAVE_LOCK )
{ {
aArguments.push_back( aInfo.getLength() aArguments.push_back( !aInfo.isEmpty()
? aInfo ? aInfo
: ::rtl::OUString( String( : ::rtl::OUString( String(
ResId( STR_UNKNOWNUSER, ResId( STR_UNKNOWNUSER,

View File

@@ -92,7 +92,7 @@ isDomainMatch(
for ( int i = 0; i < certHostNames.getLength(); i++){ for ( int i = 0; i < certHostNames.getLength(); i++){
::rtl::OUString element = certHostNames[i]; ::rtl::OUString element = certHostNames[i];
if (element.getLength() == 0) if (element.isEmpty())
continue; continue;
if (hostName.equalsIgnoreAsciiCase( element )) if (hostName.equalsIgnoreAsciiCase( element ))

View File

@@ -499,7 +499,7 @@ UUIInteractionHelper::handleRequest_impl(
ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS; ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS;
std::vector< rtl::OUString > aArguments; std::vector< rtl::OUString > aArguments;
if( aNCException.Name.getLength() ) if( !aNCException.Name.isEmpty() )
{ {
nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS; nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS;
aArguments.push_back( aNCException.Name ); aArguments.push_back( aNCException.Name );
@@ -648,33 +648,25 @@ UUIInteractionHelper::handleRequest_impl(
{ {
ErrCode nErrorCode; ErrCode nErrorCode;
std::vector< rtl::OUString > aArguments; std::vector< rtl::OUString > aArguments;
if (aWrongJavaVersionException.DetectedVersion.getLength() == 0) if (aWrongJavaVersionException.DetectedVersion.isEmpty())
if (aWrongJavaVersionException.LowestSupportedVersion. if (aWrongJavaVersionException.LowestSupportedVersion.isEmpty())
getLength()
== 0)
nErrorCode = ERRCODE_UUI_WRONGJAVA; nErrorCode = ERRCODE_UUI_WRONGJAVA;
else else
{ {
nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN; nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN;
aArguments.push_back(aWrongJavaVersionException. aArguments.push_back(aWrongJavaVersionException.LowestSupportedVersion);
LowestSupportedVersion);
} }
else if (aWrongJavaVersionException.LowestSupportedVersion. else if (aWrongJavaVersionException.LowestSupportedVersion.isEmpty())
getLength()
== 0)
{ {
nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION; nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION;
aArguments.push_back(aWrongJavaVersionException. aArguments.push_back(aWrongJavaVersionException.DetectedVersion);
DetectedVersion);
} }
else else
{ {
nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN; nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN;
aArguments.reserve(2); aArguments.reserve(2);
aArguments.push_back(aWrongJavaVersionException. aArguments.push_back(aWrongJavaVersionException.DetectedVersion);
DetectedVersion); aArguments.push_back(aWrongJavaVersionException.LowestSupportedVersion);
aArguments.push_back(aWrongJavaVersionException.
LowestSupportedVersion);
} }
handleErrorHandlerRequest(task::InteractionClassification_ERROR, handleErrorHandlerRequest(task::InteractionClassification_ERROR,
nErrorCode, nErrorCode,
@@ -736,7 +728,7 @@ UUIInteractionHelper::handleRequest_impl(
const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING; const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING;
rtl::OUString aStratum = aStratumCreationException.StratumData; rtl::OUString aStratum = aStratumCreationException.StratumData;
if (aStratum.getLength() == 0) if (aStratum.isEmpty())
aStratum = aStratumCreationException.StratumService; aStratum = aStratumCreationException.StratumService;
std::vector< rtl::OUString > aArguments; std::vector< rtl::OUString > aArguments;
@@ -827,7 +819,7 @@ UUIInteractionHelper::handleRequest_impl(
{ {
std::vector< rtl::OUString > aArguments; std::vector< rtl::OUString > aArguments;
if( aBrokenPackageRequest.aName.getLength() ) if( !aBrokenPackageRequest.aName.isEmpty() )
aArguments.push_back( aBrokenPackageRequest.aName ); aArguments.push_back( aBrokenPackageRequest.aName );
handleBrokenPackageRequest( aArguments, handleBrokenPackageRequest( aArguments,
@@ -930,7 +922,7 @@ UUIInteractionHelper::handleRequest_impl(
handleMacroConfirmRequest( handleMacroConfirmRequest(
aMacroConfirmRequest.DocumentURL, aMacroConfirmRequest.DocumentURL,
aMacroConfirmRequest.DocumentStorage, aMacroConfirmRequest.DocumentStorage,
aMacroConfirmRequest.DocumentVersion.getLength() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT, !aMacroConfirmRequest.DocumentVersion.isEmpty() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT,
aMacroConfirmRequest.DocumentSignatureInformation, aMacroConfirmRequest.DocumentSignatureInformation,
rRequest->getContinuations()); rRequest->getContinuations());
return true; return true;
@@ -1233,12 +1225,10 @@ UUIInteractionHelper::handleNameClashResolveRequest(
task::XInteractionContinuation > > const & rContinuations) task::XInteractionContinuation > > const & rContinuations)
SAL_THROW((uno::RuntimeException)) SAL_THROW((uno::RuntimeException))
{ {
OSL_ENSURE( OSL_ENSURE(!rRequest.TargetFolderURL.isEmpty(),
rRequest.TargetFolderURL.getLength() > 0,
"NameClashResolveRequest must not contain empty TargetFolderURL" ); "NameClashResolveRequest must not contain empty TargetFolderURL" );
OSL_ENSURE( OSL_ENSURE(!rRequest.ClashingName.isEmpty(),
rRequest.ClashingName.getLength() > 0,
"NameClashResolveRequest must not contain empty ClashingName" ); "NameClashResolveRequest must not contain empty ClashingName" );
uno::Reference< task::XInteractionAbort > xAbort; uno::Reference< task::XInteractionAbort > xAbort;
@@ -1332,7 +1322,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
: STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE, : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
*xManager.get() ) ); *xManager.get() ) );
if ( aTitle.getLength() && aErrTitle.getLength() ) if ( !aTitle.isEmpty() && !aErrTitle.isEmpty() )
aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) ); aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
aTitle += aErrTitle; aTitle += aErrTitle;

View File

@@ -42,7 +42,7 @@ IMPL_LINK( NameClashDialog, ButtonHdl_Impl, PushButton *, pBtn )
{ {
nRet = (long) RENAME; nRet = (long) RENAME;
rtl::OUString aNewName = maEDNewName.GetText(); rtl::OUString aNewName = maEDNewName.GetText();
if ( ( aNewName == maNewName ) || !aNewName.getLength() ) if ( ( aNewName == maNewName ) || aNewName.isEmpty() )
{ {
ErrorBox aError( NULL, WB_OK, maSameName ); ErrorBox aError( NULL, WB_OK, maSameName );
aError.Execute(); aError.Execute();
@@ -100,7 +100,7 @@ NameClashDialog::NameClashDialog( Window* pParent, ResMgr* pResMgr,
aInfo.SearchAndReplaceAscii( "%NAME", rClashingName ); aInfo.SearchAndReplaceAscii( "%NAME", rClashingName );
aInfo.SearchAndReplaceAscii( "%FOLDER", aPath ); aInfo.SearchAndReplaceAscii( "%FOLDER", aPath );
maFTMessage.SetText( aInfo ); maFTMessage.SetText( aInfo );
if ( rProposedNewName.getLength() ) if ( !rProposedNewName.isEmpty() )
maEDNewName.SetText( rProposedNewName ); maEDNewName.SetText( rProposedNewName );
else else
maEDNewName.SetText( rClashingName ); maEDNewName.SetText( rClashingName );

View File

@@ -101,7 +101,7 @@ IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG )
try try
{ {
if ( ( sNotifyURL.getLength() > 0 ) && ( m_sVersion.getLength() > 0 ) ) if ( !sNotifyURL.isEmpty() && !m_sVersion.isEmpty() )
{ {
uno::Reference< lang::XMultiServiceFactory > xSMGR = uno::Reference< lang::XMultiServiceFactory > xSMGR =
::comphelper::getProcessServiceFactory(); ::comphelper::getProcessServiceFactory();
@@ -110,7 +110,7 @@ IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG )
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
sNotifyURL += m_sVersion; sNotifyURL += m_sVersion;
if ( xSystemShell.is() && sNotifyURL.getLength() ) if ( xSystemShell.is() && !sNotifyURL.isEmpty() )
{ {
xSystemShell->execute( xSystemShell->execute(
sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );

View File

@@ -178,8 +178,8 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
// Runtime / Persistent info avail for current auth request? // Runtime / Persistent info avail for current auth request?
rtl::OUString aResult = xUrlContainer->findUrl( rtl::OUString aResult = xUrlContainer->findUrl(
rURL.getLength() ? rURL : rRequest.ServerName ); rURL.isEmpty() ? rRequest.ServerName : rURL );
if ( aResult.getLength() > 0 ) if ( !aResult.isEmpty() )
{ {
if ( fillContinuation( true, if ( fillContinuation( true,
rRequest, rRequest,
@@ -199,10 +199,10 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
{ {
try try
{ {
if (rRequest.UserName.getLength() == 0) if (rRequest.UserName.isEmpty())
{ {
task::UrlRecord aRec; task::UrlRecord aRec;
if ( rURL.getLength() ) if ( !rURL.isEmpty() )
aRec = xContainer->find(rURL, xIH); aRec = xContainer->find(rURL, xIH);
if ( aRec.UserList.getLength() == 0 ) if ( aRec.UserList.getLength() == 0 )
@@ -225,7 +225,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
else else
{ {
task::UrlRecord aRec; task::UrlRecord aRec;
if ( rURL.getLength() ) if ( !rURL.isEmpty() )
aRec = xContainer->findForName( aRec = xContainer->findForName(
rURL, rRequest.UserName, xIH); rURL, rRequest.UserName, xIH);
@@ -265,7 +265,7 @@ bool PasswordContainerHelper::addRecord(
{ {
try try
{ {
if ( rUsername.getLength() ) if ( !rUsername.isEmpty() )
{ {
OSL_ENSURE( m_xPasswordContainer.is(), OSL_ENSURE( m_xPasswordContainer.is(),
"Got no XPasswordContainer!" ); "Got no XPasswordContainer!" );

View File

@@ -120,7 +120,7 @@ PasswordDialog::PasswordDialog(
aFTPassword.SetText( aFTPassword.GetText() + aDocURL ); aFTPassword.SetText( aFTPassword.GetText() + aDocURL );
if (bIsSimplePasswordRequest) if (bIsSimplePasswordRequest)
{ {
DBG_ASSERT( aDocURL.getLength() == 0, "A simple password request should not have a document URL! Use document password request instead." ); DBG_ASSERT( aDocURL.isEmpty(), "A simple password request should not have a document URL! Use document password request instead." );
aFTPassword.SetText( String( ResId( STR_ENTER_SIMPLE_PASSWORD, *pResourceMgr ) ) ); aFTPassword.SetText( String( ResId( STR_ENTER_SIMPLE_PASSWORD, *pResourceMgr ) ) );
} }