summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-15 00:54:30 +0100
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2012-11-16 11:38:19 +0000
commitb6c6fc8cedcc7ffc774b8e7373087c7b09479dff (patch)
tree0c9fdc4e8f937e4b03c8816ba4a5bb10e0805a39
parent0d0c51d155dfc6a51a5da3c4d61ab6f40c5e0e5f (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>
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl26
-rw-r--r--shell/source/sessioninstall/SyncDbusSessionHelper.hxx2
-rw-r--r--svtools/inc/svtools/templdlg.hxx2
-rw-r--r--svtools/source/contnr/templwin.cxx34
-rw-r--r--svtools/source/contnr/templwin.hrc1
-rw-r--r--svtools/source/contnr/templwin.src7
7 files changed, 72 insertions, 1 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3d815842333e..3620e070c00c 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -4293,6 +4293,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xsd,\
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/org/freedesktop/PackageKit,\
+ SyncDbusSessionHelper \
XSyncDbusSessionHelper \
XModify \
XQuery \
diff --git a/offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl b/offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl
new file mode 100644
index 000000000000..72642aa23af0
--- /dev/null
+++ b/offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef org_freedesktop_PackageKit_SyncDbusSessionHelper_idl
+#define org_freedesktop_PackageKit_SyncDbusSessionHelper_idl
+
+#include <org/freedesktop/PackageKit/XSyncDbusSessionHelper.idl>
+
+module org {
+module freedesktop {
+module PackageKit {
+
+service SyncDbusSessionHelper : XSyncDbusSessionHelper;
+
+} ; // PackageKit
+} ; // freedesktop
+} ; // org
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
index 6f86ecb395c7..32c1ac1ff3ee 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
@@ -12,7 +12,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <org/freedesktop/PackageKit/XSyncDbusSessionHelper.hpp>
+#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
#include <cppuhelper/implbase1.hxx>
namespace shell { namespace sessioninstall
diff --git a/svtools/inc/svtools/templdlg.hxx b/svtools/inc/svtools/templdlg.hxx
index ba195a579b8d..ced95e2afafe 100644
--- a/svtools/inc/svtools/templdlg.hxx
+++ b/svtools/inc/svtools/templdlg.hxx
@@ -47,6 +47,7 @@ private:
FixedHyperlink aMoreTemplatesLink;
FixedLine aLine;
PushButton aManageBtn;
+ PushButton aPackageBtn;
PushButton aEditBtn;
OKButton aOKBtn;
CancelButton aCancelBtn;
@@ -60,6 +61,7 @@ private:
DECL_DLLPRIVATE_LINK( SendFocusHdl_Impl, void* );
DECL_DLLPRIVATE_LINK( OKHdl_Impl, PushButton* );
DECL_DLLPRIVATE_LINK( OrganizerHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( PackageHdl_Impl, void* );
DECL_DLLPRIVATE_LINK( UpdateHdl_Impl, Timer* );
DECL_DLLPRIVATE_LINK( OpenLinkHdl_Impl, void* );
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";