diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-14 12:05:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-14 14:25:24 +0200 |
commit | 89b2fd604420d53b6d6ccc6e7656c3bcf282703d (patch) | |
tree | cc77ba205c87a5914a31bef61bc9da6f1f8027da /fpicker/source/office/RemoteFilesDialog.cxx | |
parent | 5431e8e25c6668480ebac11248f2aecbc0bda431 (diff) |
loplugin:flatten in fpicker
Change-Id: Icfad1871686c894379b0e703194307a5bd72b2f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92160
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker/source/office/RemoteFilesDialog.cxx')
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index f8791df0b27c..fcbd203b536b 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -233,22 +233,22 @@ void RemoteFilesDialog::InitSize() // initialize from config SvtViewOptions aDlgOpt( EViewType::Dialog, m_sIniKey ); - if( aDlgOpt.Exists() ) - { - m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + if( !aDlgOpt.Exists() ) + return; - Any aUserData = aDlgOpt.GetUserItem( "UserData" ); - OUString sCfgStr; - if( aUserData >>= sCfgStr ) - { - sal_Int32 nPos1{ sCfgStr.indexOf('|') }; - if (nPos1<0) - return; - sal_Int32 nPos2{ sCfgStr.indexOf('|', nPos1+1 ) }; - if (nPos2<0) - return; - m_xFileView->SetConfigString( sCfgStr.copy(nPos2+1) ); - } + m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + + Any aUserData = aDlgOpt.GetUserItem( "UserData" ); + OUString sCfgStr; + if( aUserData >>= sCfgStr ) + { + sal_Int32 nPos1{ sCfgStr.indexOf('|') }; + if (nPos1<0) + return; + sal_Int32 nPos2{ sCfgStr.indexOf('|', nPos1+1 ) }; + if (nPos2<0) + return; + m_xFileView->SetConfigString( sCfgStr.copy(nPos2+1) ); } } @@ -339,61 +339,61 @@ void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rTyp void RemoteFilesDialog::OpenURL( OUString const & sURL ) { - if( m_xFileView ) - { - DisableControls(); + if( !m_xFileView ) + return; - auto xWait = std::make_unique<weld::WaitObject>(m_xDialog.get()); + DisableControls(); - if( !sURL.isEmpty() ) - { - OUString sFilter = FILEDIALOG_FILTER_ALL; + auto xWait = std::make_unique<weld::WaitObject>(m_xDialog.get()); - if( m_nCurrentFilter != -1) - { - sFilter = m_aFilters[m_nCurrentFilter].second; - } + if( !sURL.isEmpty() ) + { + OUString sFilter = FILEDIALOG_FILTER_ALL; - m_xFileView->EndInplaceEditing(); + if( m_nCurrentFilter != -1) + { + sFilter = m_aFilters[m_nCurrentFilter].second; + } - DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" ); + m_xFileView->EndInplaceEditing(); - m_pCurrentAsyncAction = new AsyncPickerAction( this, m_xFileView.get(), AsyncPickerAction::Action::eOpenURL ); + DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" ); - // -1 timeout - sync - m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetBlackList() ); + m_pCurrentAsyncAction = new AsyncPickerAction( this, m_xFileView.get(), AsyncPickerAction::Action::eOpenURL ); - if( m_eMode != REMOTEDLG_MODE_SAVE ) - m_xName_ed->set_text( "" ); + // -1 timeout - sync + m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetBlackList() ); - m_xFileView->grab_focus(); - } - else - { - xWait.reset(); + if( m_eMode != REMOTEDLG_MODE_SAVE ) + m_xName_ed->set_text( "" ); - // content doesn't exist - ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS ); + m_xFileView->grab_focus(); + } + else + { + xWait.reset(); - EnableControls(); - } + // content doesn't exist + ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS ); + + EnableControls(); } } void RemoteFilesDialog::AddFileExtension() { - if (m_nCurrentFilter != -1) - { - OUString sExt = m_aFilters[m_nCurrentFilter].second; - OUString sFileName = m_xName_ed->get_text(); + if (m_nCurrentFilter == -1) + return; - sal_Int32 nDotPos = sFileName.lastIndexOf( '.' ); + OUString sExt = m_aFilters[m_nCurrentFilter].second; + OUString sFileName = m_xName_ed->get_text(); - if ( nDotPos == -1 ) - { - sFileName += sExt.copy( 1 ); // without '*' - m_xName_ed->set_text( sFileName ); - } + sal_Int32 nDotPos = sFileName.lastIndexOf( '.' ); + + if ( nDotPos == -1 ) + { + sFileName += sExt.copy( 1 ); // without '*' + m_xName_ed->set_text( sFileName ); } } @@ -725,32 +725,32 @@ IMPL_LINK_NOARG( RemoteFilesDialog, DoubleClickHdl, SvtFileView*, bool ) IMPL_LINK_NOARG( RemoteFilesDialog, SelectHdl, SvtFileView*, void ) { SvtContentEntry* pData = m_xFileView->FirstSelected(); - if (pData) + if (!pData) + return; + + if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) ) + || ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) ) { - if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) ) - || ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) ) - { - // url must contain user info, because we need this info in recent files entry - // (to fill user field in login box by default) - INetURLObject aURL( pData->maURL ); - INetURLObject aCurrentURL( m_sLastServiceUrl ); - aURL.SetUser( aCurrentURL.GetUser() ); + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( pData->maURL ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); - m_sPath = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ); + m_sPath = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - m_xName_ed->set_text( aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset) ); - } - else + m_xName_ed->set_text( aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset) ); + } + else + { + if( m_eMode == REMOTEDLG_MODE_OPEN ) { - if( m_eMode == REMOTEDLG_MODE_OPEN ) - { - m_sPath.clear(); - m_xName_ed->set_text( "" ); - } + m_sPath.clear(); + m_xName_ed->set_text( "" ); } - - EnableControls(); } + + EnableControls(); } IMPL_LINK_NOARG(RemoteFilesDialog, FileNameGetFocusHdl, weld::Widget&, void) |