diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-25 09:59:16 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-12 22:06:19 -0400 |
commit | c5cdfe39d3afca716e7b11f8f8e169ce378861ea (patch) | |
tree | 5b804fa2e78405afe16db734f88f24a7b9714209 /cui | |
parent | 0c4c31576fe03b3b59217bf9990b75f32d193d0d (diff) |
update loplugin stylepolice to check local pointers vars
are actually pointer vars.
Also convert from regex to normal code, so we can enable this
plugin all the time.
Reviewed-on: https://gerrit.libreoffice.org/24391
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
(cherry picked from commit e8fd5a07eca70912ddee45aaa34d434809b59fb7)
Change-Id: Ie36a25ecba61c18f99c77c77646d6459a443cbd1
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/personalization.cxx | 60 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 37 |
2 files changed, 28 insertions, 69 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index eb44d5fa4c6c..f146a38973d7 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -29,6 +29,7 @@ #include <dialmgr.hxx> #include "cuires.hrc" +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/xml/sax/Parser.hpp> @@ -85,10 +86,10 @@ SelectPersonaDialog::SelectPersonaDialog( vcl::Window *pParent ) get( m_vResultList[7], "result8" ); get( m_vResultList[8], "result9" ); - for (sal_Int32 nIndex = 0; nIndex < 9; ++nIndex) + for (VclPtr<PushButton> & nIndex : m_vResultList) { - m_vResultList[nIndex]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - m_vResultList[nIndex]->Disable(); + nIndex->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); + nIndex->Disable(); } } @@ -102,9 +103,9 @@ void SelectPersonaDialog::dispose() m_pEdit.clear(); m_pSearchButton.clear(); m_pProgressLabel.clear(); - for (VclPtr<PushButton> vp : m_vResultList) + for (VclPtr<PushButton>& vp : m_vResultList) vp.clear(); - for (VclPtr<PushButton> vp : m_vSearchSuggestions) + for (VclPtr<PushButton>& vp : m_vSearchSuggestions) vp.clear(); m_pOkButton.clear(); m_pCancelButton.clear(); @@ -129,11 +130,11 @@ IMPL_LINK_TYPED( SelectPersonaDialog, SearchPersonas, Button*, pButton, void ) searchTerm = m_pEdit->GetText(); else { - for( sal_Int32 nIndex = 0; nIndex < 5; nIndex++ ) + for(VclPtr<PushButton> & i : m_vSearchSuggestions) { - if( pButton == m_vSearchSuggestions[nIndex] ) + if( pButton == i ) { - searchTerm = m_vSearchSuggestions[nIndex]->GetDisplayText(); + searchTerm = i->GetDisplayText(); break; } } @@ -142,38 +143,7 @@ IMPL_LINK_TYPED( SelectPersonaDialog, SearchPersonas, Button*, pButton, void ) if( searchTerm.isEmpty( ) ) return; - // TODO FIXME! - // Before the release, the allizom.org url should be changed to: - // OUString rSearchURL = "https://services.addons.mozilla.org/en-US/firefox/api/1.5/search/" + searchTerm + "/9/9"; - // The problem why it cannot be done just now is that the SSL negotiation - // with services.addons.mozilla.org fails very early - during an early - // propfind, SSL returns X509_V_ERR_CERT_UNTRUSTED to neon, causing the - // NE_SSL_UNTRUSTED being set in verify_callback in neon/src/ne_openssl.c - // - // This is not cleared anywhere during the init, and so later, even though - // we have found the certificate, this triggers - // NeonSession_CertificationNotify callback, that - // causes that NE_SSL_UNTRUSTED is ignored in cases when the condition - // if ( pSession->isDomainMatch( - // GetHostnamePart( xEECert.get()->getSubjectName() ) ) ) - // is true; but that is only when getSubjectName() actually returns a - // wildcard, or the exact name. - // - // In the case of services.addons.mozilla.com, the certificate is for - // versioncheck.addons.mozilla.com, but it also has - // X509v3 Subject Alternative Name: - // DNS:services.addons.mozilla.org, DNS:versioncheck-bg.addons.mozilla.org, DNS:pyrepo.addons.mozilla.org, DNS:versioncheck.addons.mozilla.org - // So it is all valid; but the early X509_V_ERR_CERT_UNTRUSTED failure - // described above just makes this being ignored. - // - // My suspicion is that this never actually worked, and the - // if ( pSession->isDomainMatch( - // GetHostnamePart( xEECert.get()->getSubjectName() ) ) ) - // works around the root cause that is there for years, and which makes it - // work in most cases. I guess that we initialize something wrongly or - // too late; but I have already spent few hours debugging, and - // give up for the moment - need to return to this at some stage. - OUString rSearchURL = "https://addons.allizom.org/en-US/firefox/api/1.5/search/" + searchTerm + "/9/9"; + OUString rSearchURL = "https://services.addons.mozilla.org/en-US/firefox/api/1.5/search/" + searchTerm + "/9/9"; m_rSearchThread = new SearchAndParseThread( this, rSearchURL ); m_rSearchThread->launch(); } @@ -266,10 +236,10 @@ void SelectPersonaDialog::ClearSearchResults() { m_vPersonaSettings.clear(); m_aSelectedPersona.clear(); - for( sal_Int32 nIndex = 0; nIndex < 9; nIndex++ ) + for(VclPtr<PushButton> & nIndex : m_vResultList) { - m_vResultList[nIndex]->Disable(); - m_vResultList[nIndex]->SetModeImage(Image()); + nIndex->Disable(); + nIndex->SetModeImage(Image()); } } @@ -317,8 +287,8 @@ void SvxPersonalizationTabPage::dispose() m_pDefaultPersona.clear(); m_pOwnPersona.clear(); m_pSelectPersona.clear(); - for (int i=0; i<3; ++i) - m_vDefaultPersonaImages[i].clear(); + for (VclPtr<PushButton> & i : m_vDefaultPersonaImages) + i.clear(); m_pExtensionPersonaPreview.clear(); m_pPersonaList.clear(); m_pExtensionLabel.clear(); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index a5a064dcbc6d..5a8923ea928e 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1768,7 +1768,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nPageId = (sal_uInt16)rInetArray.GetValue(i); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; -#if defined WNT +#if defined(_WIN32) // Disable E-mail tab-page on Windows if ( nPageId == RID_SVXPAGE_INET_MAIL ) continue; @@ -1801,8 +1801,8 @@ bool isNodeActive( OptionsNode* pNode, Module* pModule ) // search node in active module if ( pModule->m_bActive ) { - for ( size_t j = 0; j < pModule->m_aNodeList.size(); ++j ) - if ( pModule->m_aNodeList[j]->m_sId == pNode->m_sId ) + for (OrderedEntry* j : pModule->m_aNodeList) + if ( j->m_sId == pNode->m_sId ) return true; } } @@ -1995,22 +1995,18 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes( bool bAlreadyOpened = false; if ( pNode->m_aGroupedLeaves.size() > 0 ) { - for ( size_t k = 0; - k < pNode->m_aGroupedLeaves.size(); ++k ) + for (std::vector<OptionsLeaf*> & rGroup : pNode->m_aGroupedLeaves) { - if ( pNode->m_aGroupedLeaves[k].size() > 0 && - pNode->m_aGroupedLeaves[k][0]->m_sGroupId - == sLeafGrpId ) + if ( rGroup.size() > 0 && + rGroup[0]->m_sGroupId == sLeafGrpId ) { sal_uInt32 l = 0; - for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l ) + for ( ; l < rGroup.size(); ++l ) { - if ( pNode->m_aGroupedLeaves[k][l]-> - m_nGroupIndex >= nLeafGrpIdx ) + if ( rGroup[l]->m_nGroupIndex >= nLeafGrpIdx ) break; } - pNode->m_aGroupedLeaves[k].insert( - pNode->m_aGroupedLeaves[k].begin() + l, pLeaf ); + rGroup.insert( rGroup.begin() + l, pLeaf ); bAlreadyOpened = true; break; } @@ -2066,7 +2062,6 @@ VectorOfNodes OfaTreeOptionsDialog::LoadNodes( static sal_uInt16 lcl_getGroupId( const OUString& rGroupName, const SvTreeListBox& rTreeLB ) { - OUString sGroupName( rGroupName ); sal_uInt16 nRet = 0; SvTreeListEntry* pEntry = rTreeLB.First(); while( pEntry ) @@ -2074,7 +2069,7 @@ static sal_uInt16 lcl_getGroupId( const OUString& rGroupName, const SvTreeListBo if ( !rTreeLB.GetParent( pEntry ) ) { OUString sTemp( rTreeLB.GetEntryText( pEntry ) ); - if ( sTemp == sGroupName ) + if ( sTemp == rGroupName ) return nRet; nRet++; } @@ -2111,10 +2106,8 @@ static void lcl_insertLeaf( void OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList ) { - for ( size_t i = 0; i < rNodeList.size(); ++i ) + for (OptionsNode* pNode : rNodeList) { - OptionsNode* pNode = rNodeList[i]; - if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 ) { sal_uInt32 j = 0; @@ -2202,7 +2195,6 @@ void ExtensionsTabPage::dispose() } - void ExtensionsTabPage::CreateDialogWithHandler() { try @@ -2246,7 +2238,6 @@ void ExtensionsTabPage::CreateDialogWithHandler() } - bool ExtensionsTabPage::DispatchAction( const OUString& rAction ) { bool bRet = false; @@ -2285,7 +2276,7 @@ void ExtensionsTabPage::ActivatePage() if ( m_xPage.is() ) { - m_xPage->setVisible( sal_True ); + m_xPage->setVisible( true ); m_bIsWindowHidden = false; } } @@ -2295,11 +2286,10 @@ void ExtensionsTabPage::DeactivatePage() TabPage::DeactivatePage(); if ( m_xPage.is() ) - m_xPage->setVisible( sal_False ); + m_xPage->setVisible( false ); } - void ExtensionsTabPage::ResetPage() { DispatchAction( "back" ); @@ -2307,7 +2297,6 @@ void ExtensionsTabPage::ResetPage() } - void ExtensionsTabPage::SavePage() { DispatchAction( "ok" ); |