diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 15:22:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 17:14:14 +0100 |
commit | 489bce598626390d9c0aa5e5b8514e26070add61 (patch) | |
tree | 170ec95dcb393dbe4f7178bc08e6d96b6b76954b /fpicker | |
parent | f19599c929ac6ae2708b19b9eff62ff70b44ee75 (diff) |
loplugin:flatten in filter..framework
Change-Id: I15a577b3c6da03001bbbf2c2b43b29b41c4007c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127234
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/PlacesListBox.cxx | 35 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 68 |
2 files changed, 51 insertions, 52 deletions
diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index a7a90281bb11..050cee39c113 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -112,27 +112,26 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool ) { sal_uInt16 nSelected = mxImpl->get_cursor_index(); PlacePtr pPlace = maPlaces[nSelected]; - if ( pPlace->IsEditable() && !pPlace->IsLocal( ) ) + if ( !pPlace->IsEditable() || pPlace->IsLocal( ) ) + return true; + PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace); + short aRetCode = aDlg.run(); + switch (aRetCode) { - PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace); - short aRetCode = aDlg.run(); - switch (aRetCode) + case RET_OK : + { + pPlace->SetName ( aDlg.GetServerName() ); + pPlace->SetUrl( aDlg.GetServerUrl() ); + mbUpdated = true; + break; + } + case RET_NO : { - case RET_OK : - { - pPlace->SetName ( aDlg.GetServerName() ); - pPlace->SetUrl( aDlg.GetServerUrl() ); - mbUpdated = true; - break; - } - case RET_NO : - { - RemovePlace(nSelected); - break; - } - default: - break; + RemovePlace(nSelected); + break; } + default: + break; } return true; } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 9f6a11da9ab1..33f42647e308 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1831,51 +1831,51 @@ bool SvtFileDialog::IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilt rFilter.clear(); - if ( nWildCardPos != -1 ) - { - sal_Int32 nPathTokenPos = aReversePath.indexOf( '/' ); + if ( nWildCardPos == -1 ) + return true; - if ( nPathTokenPos == -1 ) - { - OUString aDelim( + sal_Int32 nPathTokenPos = aReversePath.indexOf( '/' ); + + if ( nPathTokenPos == -1 ) + { + OUString aDelim( #if defined(_WIN32) - '\\' + '\\' #else - '/' + '/' #endif - ); + ); - nPathTokenPos = aReversePath.indexOf( aDelim ); + nPathTokenPos = aReversePath.indexOf( aDelim ); #if !defined( UNX ) - if ( nPathTokenPos == -1 ) - { - nPathTokenPos = aReversePath.indexOf( ':' ); - } -#endif + if ( nPathTokenPos == -1 ) + { + nPathTokenPos = aReversePath.indexOf( ':' ); } +#endif + } - // check syntax - if ( nPathTokenPos != -1 ) + // check syntax + if ( nPathTokenPos != -1 ) + { + if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) ) { - if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) ) - { - ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX ); - return false; - } + ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX ); + return false; + } - // cut off filter - rFilter = aReversePath.copy( 0, nPathTokenPos ); - rFilter = comphelper::string::reverseString(rFilter); + // cut off filter + rFilter = aReversePath.copy( 0, nPathTokenPos ); + rFilter = comphelper::string::reverseString(rFilter); - // determine folder - rPath = aReversePath.copy( nPathTokenPos ); - rPath = comphelper::string::reverseString(rPath); - } - else - { - rFilter = rPath; - rPath.clear(); - } + // determine folder + rPath = aReversePath.copy( nPathTokenPos ); + rPath = comphelper::string::reverseString(rPath); + } + else + { + rFilter = rPath; + rPath.clear(); } return true; |