diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-04 15:12:53 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-06 07:38:35 -0430 |
commit | 77cb1de56a48fcc03fe8ae10964ae0cba9b5b7eb (patch) | |
tree | 67b840582f0e7bfb3dc810ecf07f003ea8f87530 /sfx2 | |
parent | 69a748f1f085963f21c178769c97fba8bfed4db9 (diff) |
Sync template repository list with user-stored settings.
Change-Id: Ia9927e637fd99a9ae97c45c930b7c5b23409ad41
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/templateonlineview.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/control/templateonlineview.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 2 |
3 files changed, 31 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx index 91453dee48e0..a37d762ddd07 100644 --- a/sfx2/inc/sfx2/templateonlineview.hxx +++ b/sfx2/inc/sfx2/templateonlineview.hxx @@ -38,10 +38,13 @@ public: void insertRepository (const OUString &rName, const OUString &rURL); + void syncRepositories () const; + void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding); private: + bool mbIsSynced; std::vector<TemplateOnlineViewItem*> maRepositories; com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; }; diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx index 07e79b7e96d1..bb085c6492a0 100644 --- a/sfx2/source/control/templateonlineview.cxx +++ b/sfx2/source/control/templateonlineview.cxx @@ -53,6 +53,7 @@ enum TemplateOnlineView::TemplateOnlineView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren) : TemplateAbstractView(pParent,nWinStyle,bDisableTransientChildren) + , mbIsSynced(true) { mpItemView->SetColor(Color(COL_WHITE)); @@ -251,6 +252,31 @@ void TemplateOnlineView::insertRepository(const OUString &rName, const OUString pItem->setURL(rURL); maRepositories.push_back(pItem); + + mbIsSynced = false; +} + +void TemplateOnlineView::syncRepositories() const +{ + if (!mbIsSynced) + { + uno::Reference < uno::XComponentContext > pContext(comphelper::getProcessComponentContext()); + boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(pContext)); + + size_t nSize = maRepositories.size(); + uno::Sequence<OUString> aUrls(nSize); + uno::Sequence<OUString> aNames(nSize); + + for(size_t i = 0; i < nSize; ++i) + { + aUrls[i] = maRepositories[i]->getURL(); + aNames[i] = maRepositories[i]->maTitle; + } + + officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(aUrls, batch, pContext); + officecfg::Office::Common::Misc::FilePickerPlacesNames::set(aNames, batch, pContext); + batch->commit(); + } } void TemplateOnlineView::setItemDimensions(long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding) diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index b28d5a150282..0b851a23c712 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -259,6 +259,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) SfxTemplateManagerDlg::~SfxTemplateManagerDlg () { + mpOnlineView->syncRepositories(); + delete mpSearchEdit; delete mpViewBar; delete mpActionBar; |