summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-07-29 14:13:58 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-08-14 08:45:19 +0200
commit5667079ae0ae31d5a529d5da6ba6cb826e099c99 (patch)
treed63bedace191b0e1ccde46f8428d75e3c3a8c095 /fpicker
parent2635c0ac94c0cfe76c18efe403782ba7790fdb8c (diff)
save mode improvements
Change-Id: I14953eafb3fbd840df5f9c890b55855e14a1fd9a
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx49
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx1
2 files changed, 30 insertions, 20 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 5a32d7624b32..cdb38ec996e2 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -757,8 +757,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
}
else
{
- m_sPath.clear();
- m_pName_ed->SetText( "" );
+ if( m_eMode == REMOTEDLG_MODE_OPEN )
+ {
+ m_sPath.clear();
+ m_pName_ed->SetText( "" );
+ }
}
EnableControls();
@@ -883,24 +886,10 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
bool bExists = false;
- 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 m_aContent( m_sPath, xEnv, xContext );
-
- try
- {
- if( bFileDlg )
- bExists = m_aContent.isDocument();
- else
- bExists = m_aContent.isFolder();
- }
- catch( const Exception& )
- {
- bExists = false;
- }
+ if( bFileDlg )
+ bExists = ContentIsDocument(m_sPath);
+ else
+ bExists = ContentIsFolder(m_sPath);
if ( bExists )
{
@@ -917,6 +906,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
{
if( m_eMode == REMOTEDLG_MODE_OPEN )
return 0;
+ if( m_eMode == REMOTEDLG_MODE_SAVE && ContentIsFolder(m_sPath) )
+ return 0;
}
EndDialog( RET_OK );
@@ -1157,7 +1148,25 @@ bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL )
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()
{
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 5e458738c2b9..2bb7c353c1bd 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -80,6 +80,7 @@ public:
virtual const OUString& GetPath() SAL_OVERRIDE;
virtual std::vector<OUString> GetPathList() const SAL_OVERRIDE;
virtual bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE;
+ virtual bool ContentIsDocument( const OUString& rURL );
virtual OUString getCurrentFileText() const SAL_OVERRIDE;
virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) SAL_OVERRIDE;