summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-07-22 17:20:26 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-07-24 12:29:05 +0200
commit8f7978245471763e5a2394cc8e67fed33483fe68 (patch)
treed5e025194a2d3ad0d31567dddae34f1c11b59449 /fpicker
parent638e527bfaae76fc4b32fa17c0bd576378a8a479 (diff)
show error when directory doesn't exist
Change-Id: I1c8ca1a509c9187687079d86f0e637b26490a7a3
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx31
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx2
2 files changed, 29 insertions, 4 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index bd35802ec34d..4e69c9d0df59 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -462,7 +462,7 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL )
if( m_pFileView )
{
- if( ContentIsFolder( sURL ) )
+ if( !sURL.isEmpty() && ContentIsFolder( sURL ) )
{
OUString sFilter = FILEDIALOG_FILTER_ALL;
@@ -496,6 +496,9 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL )
else
{
// content doesn't exist
+ m_pTreeView->EndSelection();
+ ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS );
+ return eFailure;
}
}
@@ -689,13 +692,13 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
{
OUString sURL = m_pFileView->GetCurrentURL();
- if( ContentIsFolder( sURL ) )
+ if( ContentIsDocument( sURL ) )
{
- OpenURL( sURL );
+ EndDialog( RET_OK );
}
else
{
- EndDialog( RET_OK );
+ OpenURL( sURL );
}
}
@@ -1043,6 +1046,26 @@ 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()
{
// This dialog doesn't contain preview
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index ede30c7a4711..b0f151e2b71e 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -16,6 +16,7 @@
#include <svtools/breadcrumb.hxx>
#include <svtools/fileview.hxx>
+#include <tools/errinf.hxx>
#include <tools/resid.hxx>
#include <vcl/button.hxx>
@@ -81,6 +82,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 void AddFilter( const OUString& rFilter, const OUString& rType ) SAL_OVERRIDE;
virtual void AddFilterGroup( const OUString& _rFilter,