svtools/source/dialogs/RemoteFilesDialog.cxx | 49 ++++++++++++++++----------- 1 file changed, 30 insertions(+), 19 deletions(-)
New commits: commit 85eee1b128bef28bf5d280b4708a05172ff44df8 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 17:01:11 2015 +0200 RemoteFilesDialog: fixes needed for saving documents Change-Id: I3134f82d81ed2c2de7d6197fbec5610b53814e1e diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 05f1ac9..03fa023 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()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits