diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-03-27 17:33:53 +0530 |
---|---|---|
committer | Olivier Hallot <ohallot@collabora.co.uk> | 2016-03-28 10:17:56 +0000 |
commit | 529848375abbe5b11e06e7ce37fca1feb20630a8 (patch) | |
tree | f00c4ba785eb22b8e09d1d5c86ad6f891ace46eb /sfx2 | |
parent | 08df97bbe68efbe31d40cb3fd40fe24103a078f5 (diff) |
tdf#59698 Template Manager: 'OK' and 'Help' buttons added
Change-Id: I0ec224eb5c6b11a8d589def477f3cf8429195f2c
Reviewed-on: https://gerrit.libreoffice.org/23552
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Olivier Hallot <ohallot@collabora.co.uk>
Tested-by: Olivier Hallot <ohallot@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 36 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/templatedlg.ui | 47 |
2 files changed, 76 insertions, 7 deletions
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 5e05de675f6f..e008e95f7ab4 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -191,6 +191,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) get(mpLocalView, "template_view"); get(mpSearchView, "search_view"); get(mpRemoteView, "remote_view"); + get(mpOKButton, "ok"); TabPage *pTabPage = mpTabControl->GetTabPage(mpTabControl->GetPageId("filter_docs")); pTabPage->Show(); @@ -271,6 +272,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) mpTabControl->SetActivatePageHdl(LINK(this, SfxTemplateManagerDlg, ActivatePageHdl)); + mpOKButton->SetClickHdl(LINK(this, SfxTemplateManagerDlg, OkClickHdl)); + SvtMiscOptions aMiscOptions; if ( !aMiscOptions.IsExperimentalMode() ) { @@ -281,6 +284,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) mpViewBar->Show(); mpActionBar->Show(); + switchMainView(true); loadRepositories(); @@ -288,11 +292,19 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) createRepositoryMenu(); createDefaultTemplateMenu(); + //setSaveMode(); //Uncomment this line to put template manager into Save As mode + mpLocalView->Populate(); mpCurView->filterItems(ViewFilter_Application(FILTER_APPLICATION::WRITER)); readSettings(); + if(!mbIsSaveMode) + mpOKButton->Disable(); + + if(mbIsSaveMode) + mpOKButton->SetText( SfxResId(STR_SAVEDOC).toString() ); + mpLocalView->Show(); } @@ -663,6 +675,17 @@ IMPL_LINK_TYPED(SfxTemplateManagerDlg, DefaultTemplateMenuSelectHdl, Menu*, pMen return false; } +IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, OkClickHdl, Button*, void) +{ + if(!mbIsSaveMode) + { + OnTemplateOpen(); + EndDialog(RET_OK); + } + else + OnTemplateSaveAs(); +} + IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, OpenRegionHdl, void*, void) { maSelFolders.clear(); @@ -671,7 +694,10 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, OpenRegionHdl, void*, void) mpViewBar->ShowItem(VIEWBAR_NEW_FOLDER, mpCurView->isNestedRegionAllowed()); if (!mbIsSaveMode) + { mpViewBar->ShowItem(VIEWBAR_IMPORT, mpCurView->isImportAllowed()); + mpOKButton->Disable(); + } mpTemplateBar->Hide(); mpViewBar->Show(); @@ -766,6 +792,8 @@ void SfxTemplateManagerDlg::OnRegionState (const ThumbnailViewItem *pItem) } maSelFolders.insert(pItem); + if(mbIsSaveMode) + mpOKButton->Enable(); } else { @@ -777,6 +805,8 @@ void SfxTemplateManagerDlg::OnRegionState (const ThumbnailViewItem *pItem) mpViewBar->HideItem(VIEWBAR_DELETE); mpViewBar->ShowItem(VIEWBAR_NEW_FOLDER); } + if(!mbIsSaveMode) + mpOKButton->Disable(); } } @@ -790,6 +820,7 @@ void SfxTemplateManagerDlg::OnTemplateState (const ThumbnailViewItem *pItem) { mpViewBar->Show(false); mpTemplateBar->Show(); + mpOKButton->Enable(); } else if (maSelTemplates.size() != 1 || !bInSelection) { @@ -806,6 +837,8 @@ void SfxTemplateManagerDlg::OnTemplateState (const ThumbnailViewItem *pItem) mpTemplateBar->HideItem(TEMPLATEBAR_PROPERTIES); mpTemplateBar->HideItem(TEMPLATEBAR_DEFAULT); } + if( !mbIsSaveMode ) + mpOKButton->Disable(); } if (!bInSelection) @@ -821,6 +854,8 @@ void SfxTemplateManagerDlg::OnTemplateState (const ThumbnailViewItem *pItem) { mpTemplateBar->Show(false); mpViewBar->Show(); + if(!mbIsSaveMode) + mpOKButton->Disable(); } else if (maSelTemplates.size() == 1) { @@ -837,6 +872,7 @@ void SfxTemplateManagerDlg::OnTemplateState (const ThumbnailViewItem *pItem) mpTemplateBar->ShowItem(TEMPLATEBAR_PROPERTIES); mpTemplateBar->ShowItem(TEMPLATEBAR_DEFAULT); } + mpOKButton->Enable(); } } } diff --git a/sfx2/uiconfig/ui/templatedlg.ui b/sfx2/uiconfig/ui/templatedlg.ui index 836c88408d69..29b5a9e7f143 100644 --- a/sfx2/uiconfig/ui/templatedlg.ui +++ b/sfx2/uiconfig/ui/templatedlg.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.19.0 --> +<!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.6"/> <requires lib="LibreOffice" version="1.0"/> @@ -21,25 +21,53 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="button1"> - <property name="label">gtk-close</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">0</property> + <property name="secondary">True</property> + </packing> + </child> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -454,5 +482,10 @@ </child> </object> </child> + <action-widgets> + <action-widget response="0">help</action-widget> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + </action-widgets> </object> </interface> |