summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-03 14:10:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-07 08:31:52 +0200
commit619027af4480e71198ab7c642f9b56c618c1fba3 (patch)
treeb4a2f80ff36fed5028c38b30b036cad133cceb2d
parent063ac5c39a8ba324ca14384065df1118e44fabd5 (diff)
loplugin:useuniqueptr in SfxCmisVersionsDialog
Change-Id: Ib2ad8550fa452478066039d79a75f75cb5605460 Reviewed-on: https://gerrit.libreoffice.org/53870 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sfx2/source/dialog/versdlg.cxx25
-rw-r--r--sfx2/source/inc/versdlg.hxx2
2 files changed, 12 insertions, 15 deletions
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index f268bfeef031..1624304bd20b 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -544,7 +544,7 @@ SfxCmisVersionsDialog::~SfxCmisVersionsDialog()
void SfxCmisVersionsDialog::dispose()
{
- delete m_pTable;
+ m_pTable.reset();
m_pVersionBox.disposeAndClear();
m_pOpenButton.clear();
m_pViewButton.clear();
@@ -557,20 +557,17 @@ void SfxCmisVersionsDialog::LoadVersions()
{
SfxObjectShell *pObjShell = pViewFrame->GetObjectShell();
uno::Sequence < document::CmisVersion > aVersions = pObjShell->GetCmisVersions( );
- delete m_pTable;
- m_pTable = new SfxVersionTableDtor( aVersions );
+ m_pTable.reset(new SfxVersionTableDtor( aVersions ));
+ for ( size_t n = 0; n < m_pTable->size(); ++n )
{
- for ( size_t n = 0; n < m_pTable->size(); ++n )
- {
- SfxVersionInfo *pInfo = m_pTable->at( n );
- OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper());
- aEntry += "\t";
- aEntry += pInfo->aAuthor;
- aEntry += "\t";
- aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment );
- SvTreeListEntry *pEntry = m_pVersionBox->InsertEntry( aEntry );
- pEntry->SetUserData( pInfo );
- }
+ SfxVersionInfo *pInfo = m_pTable->at( n );
+ OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper());
+ aEntry += "\t";
+ aEntry += pInfo->aAuthor;
+ aEntry += "\t";
+ aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment );
+ SvTreeListEntry *pEntry = m_pVersionBox->InsertEntry( aEntry );
+ pEntry->SetUserData( pInfo );
}
}
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index b35d3fa36b9d..fa687f3c81f1 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -97,7 +97,7 @@ class SfxCmisVersionsDialog : public SfxModalDialog
VclPtr<PushButton> m_pDeleteButton;
VclPtr<PushButton> m_pCompareButton;
SfxViewFrame* pViewFrame;
- SfxVersionTableDtor* m_pTable;
+ std::unique_ptr<SfxVersionTableDtor> m_pTable;
void LoadVersions();