Kaydet (Commit) 5667079a authored tarafından Szymon Kłos's avatar Szymon Kłos

save mode improvements

Change-Id: I14953eafb3fbd840df5f9c890b55855e14a1fd9a
üst 2635c0ac
...@@ -757,8 +757,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl ) ...@@ -757,8 +757,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
} }
else else
{ {
m_sPath.clear(); if( m_eMode == REMOTEDLG_MODE_OPEN )
m_pName_ed->SetText( "" ); {
m_sPath.clear();
m_pName_ed->SetText( "" );
}
} }
EnableControls(); EnableControls();
...@@ -883,24 +886,10 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) ...@@ -883,24 +886,10 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
bool bExists = false; bool bExists = false;
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); if( bFileDlg )
Reference< XInteractionHandler > xInteractionHandler( bExists = ContentIsDocument(m_sPath);
InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW ); else
Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( bExists = ContentIsFolder(m_sPath);
xInteractionHandler, Reference< XProgressHandler >() );
::ucbhelper::Content m_aContent( m_sPath, xEnv, xContext );
try
{
if( bFileDlg )
bExists = m_aContent.isDocument();
else
bExists = m_aContent.isFolder();
}
catch( const Exception& )
{
bExists = false;
}
if ( bExists ) if ( bExists )
{ {
...@@ -917,6 +906,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) ...@@ -917,6 +906,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
{ {
if( m_eMode == REMOTEDLG_MODE_OPEN ) if( m_eMode == REMOTEDLG_MODE_OPEN )
return 0; return 0;
if( m_eMode == REMOTEDLG_MODE_SAVE && ContentIsFolder(m_sPath) )
return 0;
} }
EndDialog( RET_OK ); EndDialog( RET_OK );
...@@ -1157,7 +1148,25 @@ bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL ) ...@@ -1157,7 +1148,25 @@ bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL )
return false; return false;
} }
bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL )
{
try
{
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xInteractionHandler(
InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW );
Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
::ucbhelper::Content aContent( rURL, xEnv, xContext );
return aContent.isDocument();
}
catch( const Exception& )
{
// a content doesn't exist
}
return false;
}
sal_Int32 RemoteFilesDialog::getTargetColorDepth() sal_Int32 RemoteFilesDialog::getTargetColorDepth()
{ {
......
...@@ -80,6 +80,7 @@ public: ...@@ -80,6 +80,7 @@ public:
virtual const OUString& GetPath() SAL_OVERRIDE; virtual const OUString& GetPath() SAL_OVERRIDE;
virtual std::vector<OUString> GetPathList() const SAL_OVERRIDE; virtual std::vector<OUString> GetPathList() const SAL_OVERRIDE;
virtual bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE; virtual bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE;
virtual bool ContentIsDocument( const OUString& rURL );
virtual OUString getCurrentFileText() const SAL_OVERRIDE; virtual OUString getCurrentFileText() const SAL_OVERRIDE;
virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) SAL_OVERRIDE; virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) SAL_OVERRIDE;
......
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