summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-07 10:27:44 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-08-08 10:25:52 -0430
commitef71e97d8cae548a46a0040de68df35e5a300905 (patch)
treebba3cb161810034cf4b948bc7636c58846d5434d /sfx2/source
parent0817e7c0943e9f89db1cf58f50fcc81c6a302682 (diff)
Reload view templates when click refresh button.
- Force remote repository to fetch new template list and update cache. Change-Id: I9d7d67d367023323ca43731d78a275d389a9cf15
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/control/templatelocalview.cxx24
-rw-r--r--sfx2/source/control/templateonlineview.cxx5
-rw-r--r--sfx2/source/doc/templatedlg.cxx4
-rw-r--r--sfx2/source/doc/templatedlg.hrc3
-rw-r--r--sfx2/source/doc/templatedlg.src13
5 files changed, 49 insertions, 0 deletions
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 9fff6d2b9c56..a1dd938ac84d 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -174,6 +174,30 @@ void TemplateLocalView::Populate ()
Invalidate();
}
+void TemplateLocalView::reload ()
+{
+ mpDocTemplates->Update();
+
+ Clear();
+
+ Populate();
+
+ if (mpItemView->IsVisible())
+ {
+ sal_uInt16 nItemId = mpItemView->getId() + 1;
+
+ for (size_t i = 0; i < mItemList.size(); ++i)
+ {
+ if (mItemList[i]->mnId == nItemId)
+ {
+ mpItemView->Clear();
+ mpItemView->InsertItems(static_cast<TemplateLocalViewItem*>(mItemList[i])->maTemplates);
+ break;
+ }
+ }
+ }
+}
+
std::vector<rtl::OUString> TemplateLocalView::getFolderNames()
{
size_t n = mItemList.size();
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index 6a9b04062885..36865eb5d218 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -93,6 +93,11 @@ void TemplateOnlineView::Populate()
}
}
+void TemplateOnlineView::reload ()
+{
+ loadRepository(mpItemView->getId(),true);
+}
+
void TemplateOnlineView::filterTemplatesByApp(const FILTER_APPLICATION &eApp)
{
if (mpItemView->IsVisible())
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 5c1b6665c760..007d43fffb04 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -111,6 +111,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
// Create popup menus
mpActionMenu = new PopupMenu;
mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT));
+ mpActionMenu->InsertItem(MNI_ACTION_REFRESH,SfxResId(STR_ACTION_REFRESH).toString(),SfxResId(IMG_ACTION_REFRESH));
mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl));
mpRepositoryMenu = new PopupMenu;
@@ -514,6 +515,9 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu)
else
maView->sortItems(SortView_Name());
break;
+ case MNI_ACTION_REFRESH:
+ mpCurView->reload();
+ break;
default:
break;
}
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index 810d03d0dcbe..e7e29d7ee572 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -28,6 +28,7 @@
#define TBI_TEMPLATE_MOVE 17
#define TBI_TEMPLATE_DELETE 18
+#define MNI_ACTION_REFRESH 22
#define MNI_ACTION_SORT_NAME 23
#define BTN_TEMPLATE_CLOSE 24
@@ -35,6 +36,7 @@
#define TBI_TEMPLATE_FOLDER_DEL 25
#define TBI_TEMPLATE_REPOSITORY 26
+#define STR_ACTION_REFRESH 263
#define STR_ACTION_SORT_NAME 264
#define MNI_MOVE_NEW 265
@@ -56,3 +58,4 @@
#define IMG_CREATE_PRESENT 302
#define IMG_CREATE_DRAW 303
#define IMG_ACTION_SORT 304
+#define IMG_ACTION_REFRESH 305
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index d973e46adb1b..98c17ac5d13b 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -15,6 +15,11 @@ String STR_ACTION_SORT_NAME
Text [ en-US ] = "Sort by name";
};
+String STR_ACTION_REFRESH
+{
+ Text [ en-US ] = "Refresh";
+};
+
String STR_MOVE_NEW
{
Text [ en-US ] = "New folder";
@@ -123,6 +128,14 @@ ModelessDialog DLG_TEMPLATE_MANAGER
};
};
+ Image IMG_ACTION_REFRESH
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "reload.png";
+ };
+ };
+
ToolBox TBX_ACTION_VIEW
{