Kaydet (Commit) b9426828 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in desktop

Change-Id: Iff29d7d5962b441678c91bcd0319ac07c6488b34
Reviewed-on: https://gerrit.libreoffice.org/56327
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst f287292d
......@@ -224,8 +224,8 @@ void ExtensionBox_Impl::Init()
m_xRemoveListener = new ExtensionRemovedListener( this );
m_pLocale = new lang::Locale( Application::GetSettings().GetLanguageTag().getLocale() );
m_pCollator = new CollatorWrapper( ::comphelper::getProcessComponentContext() );
m_pLocale.reset( new lang::Locale( Application::GetSettings().GetLanguageTag().getLocale() ) );
m_pCollator.reset( new CollatorWrapper( ::comphelper::getProcessComponentContext() ) );
m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
Show();
......@@ -256,8 +256,8 @@ void ExtensionBox_Impl::dispose()
m_xRemoveListener.clear();
delete m_pLocale;
delete m_pCollator;
m_pLocale.reset();
m_pCollator.reset();
::svt::IExtensionListBox::dispose();
}
......@@ -841,7 +841,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const long nSta
if ( nStart == nEnd )
{
eCompare = rEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nStart ] );
if ( eCompare < 0 )
return false;
else if ( eCompare == 0 )
......@@ -862,7 +862,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const long nSta
}
const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
eCompare = rEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nMid ] );
if ( eCompare < 0 )
return FindEntryPos( rEntry, nStart, nMid-1, nPos );
......
......@@ -140,8 +140,8 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
std::vector< TEntry_Impl > m_vEntries;
std::vector< TEntry_Impl > m_vRemovedEntries;
css::lang::Locale *m_pLocale;
CollatorWrapper *m_pCollator;
std::unique_ptr<css::lang::Locale> m_pLocale;
std::unique_ptr<CollatorWrapper> m_pCollator;
//Holds weak references to extensions to which is we have added an XEventListener
std::vector< css::uno::WeakReference<
......
......@@ -548,14 +548,8 @@ void UpdateDialog::dispose()
{
storeIgnoredUpdates();
for (auto const& listboxEntry : m_ListboxEntries)
{
delete listboxEntry;
}
for (auto const& ignoredUpdate : m_ignoredUpdates)
{
delete ignoredUpdate;
}
m_ListboxEntries.clear();
m_ignoredUpdates.clear();
m_pUpdates.disposeAndClear();
m_pchecking.clear();
m_pthrobber.clear();
......@@ -719,7 +713,7 @@ void UpdateDialog::addEnabledUpdate( OUString const & name,
UpdateDialog::Index *pEntry = new UpdateDialog::Index( ENABLED_UPDATE, nIndex, name );
m_enabledUpdates.push_back( data );
m_ListboxEntries.push_back( pEntry );
m_ListboxEntries.emplace_back( pEntry );
if ( ! isIgnoredUpdate( pEntry ) )
{
......@@ -742,7 +736,7 @@ void UpdateDialog::addDisabledUpdate( UpdateDialog::DisabledUpdate const & data
UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, nIndex, data.name );
m_disabledUpdates.push_back( data );
m_ListboxEntries.push_back( pEntry );
m_ListboxEntries.emplace_back( pEntry );
isIgnoredUpdate( pEntry );
addAdditional( pEntry, SvLBoxButtonKind::DisabledCheckbox );
......@@ -755,7 +749,7 @@ void UpdateDialog::addSpecificError( UpdateDialog::SpecificError const & data )
UpdateDialog::Index *pEntry = new UpdateDialog::Index( SPECIFIC_ERROR, nIndex, data.name );
m_specificErrors.push_back( data );
m_ListboxEntries.push_back( pEntry );
m_ListboxEntries.emplace_back( pEntry );
addAdditional( pEntry, SvLBoxButtonKind::StaticImage);
}
......@@ -976,7 +970,7 @@ void UpdateDialog::getIgnoredUpdates()
uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) );
aPropValue >>= aVersion;
IgnoredUpdate *pData = new IgnoredUpdate( aIdentifier, aVersion );
m_ignoredUpdates.push_back( pData );
m_ignoredUpdates.emplace_back( pData );
}
}
......@@ -1106,7 +1100,7 @@ void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index const *pIndex, bool bIg
if ( bIgnore && !bFound )
{
IgnoredUpdate *pData = new IgnoredUpdate( aExtensionID, aVersion );
m_ignoredUpdates.push_back( pData );
m_ignoredUpdates.emplace_back( pData );
}
}
}
......@@ -1222,7 +1216,7 @@ IMPL_LINK_NOARG(UpdateDialog, allHandler, CheckBox&, void)
for (auto const& listboxEntry : m_ListboxEntries)
{
if ( listboxEntry->m_bIgnored || ( listboxEntry->m_eKind != ENABLED_UPDATE ) )
insertItem( listboxEntry, SvLBoxButtonKind::DisabledCheckbox );
insertItem( listboxEntry.get(), SvLBoxButtonKind::DisabledCheckbox );
}
}
else
......
......@@ -194,8 +194,8 @@ private:
std::vector< dp_gui::UpdateData > m_enabledUpdates;
std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
std::vector< UpdateDialog::SpecificError > m_specificErrors;
std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
std::vector< Index* > m_ListboxEntries;
std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > m_ignoredUpdates;
std::vector< std::unique_ptr<Index> > m_ListboxEntries;
std::vector< dp_gui::UpdateData > & m_updateData;
rtl::Reference< UpdateDialog::Thread > m_thread;
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment