summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-07 19:01:59 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-08-08 10:25:53 -0430
commitfb5a7e213571caafb83fdec9d5cdfb6f5ad7c4f7 (patch)
tree278efa9a70f9b7c72299c59222fc5e9785933448
parent7ec0e8838a25adf0f228e94d75c635905989c872 (diff)
Update remote repository name.
- Check that theres no name clash with other repositories. Change-Id: I66de40d17bc2d593e1ea4697320a7abe0a397718
-rw-r--r--sfx2/inc/sfx2/templateonlineview.hxx4
-rw-r--r--sfx2/source/control/templateonlineview.cxx20
2 files changed, 24 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx
index abb28194f364..36d9f1b38cea 100644
--- a/sfx2/inc/sfx2/templateonlineview.hxx
+++ b/sfx2/inc/sfx2/templateonlineview.hxx
@@ -46,6 +46,10 @@ public:
private:
+ DECL_LINK(ChangeNameHdl, TemplateView*);
+
+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 36865eb5d218..1c64d26cba45 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -56,6 +56,7 @@ TemplateOnlineView::TemplateOnlineView (Window *pParent, WinBits nWinStyle, bool
, mbIsSynced(true)
{
mpItemView->SetColor(Color(COL_WHITE));
+ mpItemView->setChangeNameHdl(LINK(this,TemplateOnlineView,ChangeNameHdl));
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >(
@@ -292,4 +293,23 @@ void TemplateOnlineView::setItemDimensions(long ItemWidth, long ThumbnailHeight,
mpItemView->setItemDimensions(ItemWidth,ThumbnailHeight,DisplayHeight,itemPadding);
}
+IMPL_LINK (TemplateOnlineView, ChangeNameHdl, TemplateView*, pView)
+{
+ bool bRet = true;
+ mbIsSynced = false;
+
+ // check if there isnt another repository with the same name.
+ for (size_t i = 0, n = maRepositories.size(); i < n; ++i)
+ {
+ if (maRepositories[i]->maTitle == pView->getName())
+ {
+ bRet = false;
+ mbIsSynced = true;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */