diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-15 00:54:30 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-16 11:38:19 +0000 |
commit | b6c6fc8cedcc7ffc774b8e7373087c7b09479dff (patch) | |
tree | 0c9fdc4e8f937e4b03c8816ba4a5bb10e0805a39 /svtools/source/contnr | |
parent | 0d0c51d155dfc6a51a5da3c4d61ab6f40c5e0e5f (diff) |
template pack installer
- so this adds a button to the templates dialog to install
https://launchpad.net/ubuntu/+source/libreoffice-templates/0.1.20120814-0ubuntu2
which is packed from
http://cgit.freedesktop.org/libreoffice/templates
- could be packed and used like that on other distros
- disabled when service is not available
Change-Id: I55d5bada25693070aae5e5f9e0e77bf8aa52e982
Reviewed-on: https://gerrit.libreoffice.org/1071
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'svtools/source/contnr')
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 34 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.hrc | 1 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.src | 7 |
3 files changed, 42 insertions, 0 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index c6df3734e502..f0e41cc26d7e 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -72,6 +72,7 @@ #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/task/InteractionHandler.hpp> +#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp> #include <unotools/localedatawrapper.hxx> #include <com/sun/star/container/XNameContainer.hpp> #include <vcl/waitobj.hxx> @@ -1425,6 +1426,7 @@ SvtDocumentTemplateDialog::SvtDocumentTemplateDialog( Window* pParent ) : aMoreTemplatesLink ( this, SvtResId( FT_DOCTEMPLATE_LINK ) ), aLine ( this, SvtResId( FL_DOCTEMPLATE ) ), aManageBtn ( this, SvtResId( BTN_DOCTEMPLATE_MANAGE ) ), + aPackageBtn ( this, SvtResId( BTN_DOCTEMPLATE_PACKAGE ) ), aEditBtn ( this, SvtResId( BTN_DOCTEMPLATE_EDIT ) ), aOKBtn ( this, SvtResId( BTN_DOCTEMPLATE_OPEN ) ), aCancelBtn ( this, SvtResId( BTN_DOCTEMPLATE_CANCEL ) ), @@ -1454,6 +1456,18 @@ void SvtDocumentTemplateDialog::InitImpl( ) aMoreTemplatesLink.Hide(); aManageBtn.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, OrganizerHdl_Impl ) ); + // Only enable the Package Button, if the service is available + try + { + using namespace org::freedesktop::PackageKit; + Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()), UNO_QUERY); + aPackageBtn.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, PackageHdl_Impl ) ); + aPackageBtn.Enable(xSyncDbusSessionHelper.is()); + } + catch(...) + { + aPackageBtn.Enable(false); + } Link aLink = LINK( this, SvtDocumentTemplateDialog, OKHdl_Impl ); aEditBtn.SetClickHdl( aLink ); aOKBtn.SetClickHdl( aLink ); @@ -1502,6 +1516,9 @@ void SvtDocumentTemplateDialog::InitImpl( ) aPos = aHelpBtn.GetPosPixel(); aPos.Y() -= nDelta; aHelpBtn.SetPosPixel( aPos ); + aPos = aPackageBtn.GetPosPixel(); + aPos.Y() -= nDelta; + aPackageBtn.SetPosPixel( aPos ); pImpl->pWin->Show(); @@ -1636,6 +1653,23 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl) return 0; } + +IMPL_LINK_NOARG(SvtDocumentTemplateDialog, PackageHdl_Impl) +{ + try + { + using namespace org::freedesktop::PackageKit; + Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()), UNO_QUERY); + Sequence< ::rtl::OUString > vPackages(1); + vPackages[0] = "libreoffice-templates"; + ::rtl::OUString sInteraction(""); + xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, sInteraction); + } + catch(...) + { } + return 0; +} + // ------------------------------------------------------------------------ IMPL_LINK ( SvtDocumentTemplateDialog, UpdateHdl_Impl, Timer*, _pEventSource ) diff --git a/svtools/source/contnr/templwin.hrc b/svtools/source/contnr/templwin.hrc index d5d6e5ab3f6b..d37e2bf5a235 100644 --- a/svtools/source/contnr/templwin.hrc +++ b/svtools/source/contnr/templwin.hrc @@ -25,6 +25,7 @@ #define BTN_DOCTEMPLATE_CANCEL 14 #define BTN_DOCTEMPLATE_HELP 15 #define FT_DOCTEMPLATE_LINK 16 +#define BTN_DOCTEMPLATE_PACKAGE 17 #define TI_DOCTEMPLATE_BACK 1 #define TI_DOCTEMPLATE_PREV 2 diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index 0b574c345cec..31b547041206 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -210,6 +210,13 @@ ModalDialog DLG_DOCTEMPLATE Pos = MAP_APPFONT( 0, 219 ); Size = MAP_APPFONT( 320, 8 ); }; + PushButton BTN_DOCTEMPLATE_PACKAGE + { + HelpID = "svtools:PushButton:DLG_DOCTEMPLATE:BTN_DOCTEMPLATE_PACKAGE"; + Pos = MAP_APPFONT( 208, 206 ); + Size = MAP_APPFONT( 106, 14 ); + Text [ en-US ] = "Install Template Pack"; + }; PushButton BTN_DOCTEMPLATE_MANAGE { HelpID = "svtools:PushButton:DLG_DOCTEMPLATE:BTN_DOCTEMPLATE_MANAGE"; |