diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-01 07:13:38 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-02 22:24:31 -0430 |
commit | 3fa5a70375083e5f201d6b62f418e9778446e2f5 (patch) | |
tree | 3ef288d1658b13b9c1b8bc1797aee6ca415e7068 /sfx2/source | |
parent | f36adaa38ca7a04144c18902343ab52784f4fbae (diff) |
Cache results for remote repositories.
- Only fetch template list when its the first time or when specified.
Change-Id: I922e97dfcbf67cebdd66a85bd7ff204896757e52
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/control/templateonlineview.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx index 7087b35ff5d8..b8b978fad849 100644 --- a/sfx2/source/control/templateonlineview.cxx +++ b/sfx2/source/control/templateonlineview.cxx @@ -113,7 +113,7 @@ void TemplateOnlineView::showOverlay (bool bVisible) } } -bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId) +bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bRefresh) { TemplateOnlineViewItem *pItem = NULL; @@ -129,6 +129,9 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId) if (!pItem) return false; + if (!pItem->getTemplates().empty() && !bRefresh) + return true; + rtl::OUString aURL = static_cast<TemplateOnlineViewItem*>(pItem)->getURL(); try @@ -158,6 +161,7 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId) if ( xResultSet.is() ) { + pItem->clearTemplates(); mpItemView->Clear(); uno::Reference< XRow > xRow( xResultSet, UNO_QUERY ); @@ -217,6 +221,7 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId) aTemplateItem.aType = SvFileInformationManager::GetFileDescription(INetURLObject(sRealURL)); + pItem->insertTemplate(aTemplateItem); aItems.push_back(aTemplateItem); ++nIdx; } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 765f66436d62..d3eff745ded9 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -590,7 +590,7 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu) { sal_uInt16 nRepoId = nMenuId - MNI_REPOSITORY_BASE; - if (mpOnlineView->loadRepository(nRepoId)) + if (mpOnlineView->loadRepository(nRepoId,false)) { switchMainView(false); mpOnlineView->showOverlay(true); |