Kaydet (Commit) 5fc2910f authored tarafından Giuseppe Castagno's avatar Giuseppe Castagno Kaydeden (comit) jan iversen

tdf#96669: IsDocument should be true only if the document exists

Fixes a problem with Save to remote server dialog.

Change-Id: I4ef2dbf12bb786f5617cb57ff021012e4d884230
Reviewed-on: https://gerrit.libreoffice.org/21010Reviewed-by: 's avatarjan iversen <jani@documentfoundation.org>
Tested-by: 's avatarjan iversen <jani@documentfoundation.org>
üst faa767db
...@@ -865,6 +865,7 @@ void Content::addProperty( const ucb::PropertyCommandArgument& aCmdArg, ...@@ -865,6 +865,7 @@ void Content::addProperty( const ucb::PropertyCommandArgument& aCmdArg,
switch ( eType ) switch ( eType )
{ {
case UNKNOWN: case UNKNOWN:
case NOT_FOUND:
case DAV: case DAV:
throw lang::IllegalArgumentException(); throw lang::IllegalArgumentException();
...@@ -953,6 +954,7 @@ void Content::removeProperty( const OUString& Name, ...@@ -953,6 +954,7 @@ void Content::removeProperty( const OUString& Name,
switch ( eType ) switch ( eType )
{ {
case UNKNOWN: case UNKNOWN:
case NOT_FOUND:
case DAV: case DAV:
throw beans::UnknownPropertyException(); throw beans::UnknownPropertyException();
...@@ -1439,7 +1441,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( ...@@ -1439,7 +1441,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
NeonUri aUri( xResAccess->getURL() ); NeonUri aUri( xResAccess->getURL() );
aUnescapedTitle = aUri.GetPathBaseNameUnescaped(); aUnescapedTitle = aUri.GetPathBaseNameUnescaped();
if ( eType == UNKNOWN ) if ( eType == UNKNOWN || eType == NOT_FOUND )
{ {
xProps.reset( new ContentProperties( aUnescapedTitle ) ); xProps.reset( new ContentProperties( aUnescapedTitle ) );
} }
...@@ -1470,10 +1472,20 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( ...@@ -1470,10 +1472,20 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
"IsFolder", "IsFolder",
uno::makeAny( false ), uno::makeAny( false ),
true ); true );
xProps->addProperty( if ( eType == NOT_FOUND )
{
xProps->addProperty(
"IsDocument",
uno::makeAny( false ),
true );
}
else
{
xProps->addProperty(
"IsDocument", "IsDocument",
uno::makeAny( true ), uno::makeAny( true ),
true ); true );
}
} }
} }
else else
...@@ -2897,7 +2909,7 @@ Content::ResourceType Content::resourceTypeForLocks( ...@@ -2897,7 +2909,7 @@ Content::ResourceType Content::resourceTypeForLocks(
} }
} }
osl::MutexGuard g(m_aMutex); osl::MutexGuard g(m_aMutex);
if (m_eResourceTypeForLocks == UNKNOWN) if ( m_eResourceTypeForLocks == UNKNOWN || m_eResourceTypeForLocks == NOT_FOUND )
{ {
m_eResourceTypeForLocks = eResourceTypeForLocks; m_eResourceTypeForLocks = eResourceTypeForLocks;
} }
...@@ -3435,7 +3447,7 @@ Content::ResourceType Content::getResourceType( ...@@ -3435,7 +3447,7 @@ Content::ResourceType Content::getResourceType(
{ {
{ {
osl::MutexGuard g(m_aMutex); osl::MutexGuard g(m_aMutex);
if (m_eResourceType != UNKNOWN) { if ( m_eResourceType != UNKNOWN && m_eResourceType != NOT_FOUND ) {
return m_eResourceType; return m_eResourceType;
} }
} }
...@@ -3484,6 +3496,10 @@ Content::ResourceType Content::getResourceType( ...@@ -3484,6 +3496,10 @@ Content::ResourceType Content::getResourceType(
{ {
rResAccess->resetUri(); rResAccess->resetUri();
if ( e.getStatus() == SC_NOT_FOUND )
{
eResourceType = NOT_FOUND;
}
if ( e.getStatus() == SC_METHOD_NOT_ALLOWED ) if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
{ {
// Status SC_METHOD_NOT_ALLOWED is a safe indicator that the // Status SC_METHOD_NOT_ALLOWED is a safe indicator that the
...@@ -3507,7 +3523,7 @@ Content::ResourceType Content::getResourceType( ...@@ -3507,7 +3523,7 @@ Content::ResourceType Content::getResourceType(
} }
osl::MutexGuard g(m_aMutex); osl::MutexGuard g(m_aMutex);
if (m_eResourceType == UNKNOWN) { if ( m_eResourceType == UNKNOWN || m_eResourceType == NOT_FOUND ) {
m_eResourceType = eResourceType; m_eResourceType = eResourceType;
} else { } else {
SAL_WARN_IF( SAL_WARN_IF(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment