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>
This commit is contained in:
committed by
Björn Michaelsen
parent
0d0c51d155
commit
b6c6fc8ced
@@ -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 \
|
||||
|
26
offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl
Normal file
26
offapi/org/freedesktop/PackageKit/SyncDbusSessionHelper.idl
Normal file
@@ -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: */
|
@@ -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
|
||||
|
@@ -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* );
|
||||
|
||||
|
@@ -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 )
|
||||
|
@@ -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
|
||||
|
@@ -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";
|
||||
|
Reference in New Issue
Block a user