[Libreoffice-commits] .: offapi/org offapi/UnoApi_offapi.mk shell/source svtools/inc svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 16 03:38:43 PST 2012


 offapi/UnoApi_offapi.mk                                     |    1 
 offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl |   26 +++++++++
 shell/source/sessioninstall/SyncDbusSessionHelper.hxx       |    2 
 svtools/inc/svtools/templdlg.hxx                            |    2 
 svtools/source/contnr/templwin.cxx                          |   34 ++++++++++++
 svtools/source/contnr/templwin.hrc                          |    1 
 svtools/source/contnr/templwin.src                          |    7 ++
 7 files changed, 72 insertions(+), 1 deletion(-)

New commits:
commit b6c6fc8cedcc7ffc774b8e7373087c7b09479dff
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Thu Nov 15 00:54:30 2012 +0100

    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 at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3d81584..3620e07 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 0000000..72642aa
--- /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 6f86ecb..32c1ac1 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 ba195a5..ced95e2 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 c6df373..f0e41cc 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 d5d6e5a..d37e2bf 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 0b574c3..31b5470 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";


More information about the Libreoffice-commits mailing list