diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-07-09 17:01:11 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2015-07-16 09:53:40 +0200 |
commit | 16ba8ede0af90516c9293b76f2f3a534e944b832 (patch) | |
tree | b699b1e6ea6065a63ff9ef368dba20df41e89328 /svtools | |
parent | 2a6cec2caae7a04f9dc16d05aa2402536678c4c1 (diff) |
RemoteFilesDialog: fixes needed for saving documents
Change-Id: I3134f82d81ed2c2de7d6197fbec5610b53814e1e
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/dialogs/RemoteFilesDialog.cxx | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 05f1ac9c1fd2..03fa023d8063 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -494,7 +494,12 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL ) if( m_pFileView ) { - OUString sFilter = GetCurFilter(); + OUString sFilter = FILEDIALOG_FILTER_ALL; + + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + sFilter = m_aFilters[m_nCurrentFilter].second; + } m_pFileView->EndInplaceEditing( false ); eResult = m_pFileView->Initialize( sURL, sFilter, NULL, GetBlackList() ); @@ -791,9 +796,12 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) bool bFileDlg = ( m_eType == REMOTEDLG_TYPE_FILEDLG ); bool bSelected = ( m_pFileView->GetSelectionCount() > 0 ); + if( !sCurrentPath.endsWith( OUString( "/" ) ) ) + sCurrentPath += OUString( "/" ); + if( !bSelected ) { - m_sPath = sCurrentPath + "/" + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); + m_sPath = sCurrentPath + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); } else { @@ -826,14 +834,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) if ( !bExists ) { - // TODO - - return 0; + if( m_eMode == REMOTEDLG_MODE_OPEN ) + return 0; } - if( bExists ) - EndDialog( RET_OK ); - + EndDialog( RET_OK ); return 1; } @@ -899,11 +904,7 @@ OUString RemoteFilesDialog::GetCurFilter() const if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) { - sFilter = m_aFilters[m_nCurrentFilter].second; - } - else - { - sFilter = FILEDIALOG_FILTER_ALL; + sFilter = m_aFilters[m_nCurrentFilter].first; } return sFilter; @@ -967,12 +968,22 @@ std::vector<OUString> RemoteFilesDialog::GetPathList() const bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL ) { - 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.isFolder(); + 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.isFolder(); + } + catch( const Exception& ) + { + // a content doesn't exist + } + + return false; } sal_Int32 RemoteFilesDialog::getTargetColorDepth() |