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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -120,7 +120,7 @@ PasswordDialog::PasswordDialog(
aFTPassword.SetText( aFTPassword.GetText() + aDocURL );
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 ) ) );
}