fdo#46808, Adapt setup::UpdateCheckConfig UNO services to new style

The services already existed, it just did not have an IDL file.

Change-Id: Iae319545e5bf2384ede0992715a4879554605a22
This commit is contained in:
Noel Grandin
2013-01-09 14:45:32 +02:00
parent 1a92a885d6
commit 4b37df18a1
4 changed files with 60 additions and 31 deletions

View File

@@ -35,16 +35,11 @@
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/setup/UpdateCheckConfig.hpp>
#include <osl/file.hxx>
#include <osl/security.hxx>
namespace beans = ::com::sun::star::beans;
namespace container = ::com::sun::star::container;
namespace dialogs = ::com::sun::star::ui::dialogs;
namespace frame = ::com::sun::star::frame;
namespace lang = ::com::sun::star::lang;
namespace uno = ::com::sun::star::uno;
namespace util = ::com::sun::star::util;
using namespace ::com::sun::star;
// class SvxOnlineUpdateTabPage --------------------------------------------------
@@ -70,11 +65,9 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSe
m_aCheckNowButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
m_aChangePathButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
m_xUpdateAccess = uno::Reference < container::XNameReplace >(
xFactory->createInstance( "com.sun.star.setup.UpdateCheckConfig" ),
uno::UNO_QUERY_THROW );
m_xUpdateAccess = setup::UpdateCheckConfig::create( xContext );
sal_Bool bDownloadSupported = sal_False;
m_xUpdateAccess->getByName( "DownloadSupported" ) >>= bDownloadSupported;
@@ -301,7 +294,7 @@ IMPL_LINK( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, CheckBox *, pBox )
IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl)
{
uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
uno::Reference < dialogs::XFolderPicker2 > xFolderPicker = dialogs::FolderPicker::create(xContext);
uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext);
rtl::OUString aURL;
if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) )
@@ -310,7 +303,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl)
xFolderPicker->setDisplayDirectory( aURL );
sal_Int16 nRet = xFolderPicker->execute();
if ( dialogs::ExecutableDialogResults::OK == nRet )
if ( ui::dialogs::ExecutableDialogResults::OK == nRet )
{
rtl::OUString aFolder;
if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(xFolderPicker->getDirectory(), aFolder))

View File

@@ -275,6 +275,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/security,\
DocumentDigitalSignatures \
SerialNumberAdapter \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/setup,\
UpdateCheckConfig \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sheet,\
ExternalDocLink \
ExternalDocLinks \

View File

@@ -0,0 +1,41 @@
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_setup_UpdateCheckConfig_idl__
#define __com_sun_star_setup_UpdateCheckConfig_idl__
#include <com/sun/star/container/XNameReplace.idl>
module com { module sun { module star { module setup {
/**
This was created from it's places of use, so it may be incomplete.
@since LibreOffice 4.1
*/
service UpdateCheckConfig : com::sun::star::container::XNameReplace;
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -25,6 +25,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/setup/UpdateCheckConfig.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
@@ -37,14 +38,7 @@
#include <vcl/msgbox.hxx>
#include <osl/process.h>
namespace beans = ::com::sun::star::beans;
namespace frame = ::com::sun::star::frame;
namespace lang = ::com::sun::star::lang;
namespace uno = ::com::sun::star::uno;
namespace util = ::com::sun::star::util;
namespace container = ::com::sun::star::container;
using namespace com::sun::star::system;
using namespace com::sun::star;
namespace uui
{
@@ -91,23 +85,21 @@ IMPL_LINK_NOARG(NewerVersionWarningDialog, UpdateHdl)
try
{
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
if ( !sNotifyURL.isEmpty() && !m_sVersion.isEmpty() )
{
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
uno::Reference< XSystemShellExecute > xSystemShell( SystemShellExecute::create(xContext) );
uno::Reference< system::XSystemShellExecute > xSystemShell( system::SystemShellExecute::create(xContext) );
sNotifyURL += m_sVersion;
if ( !sNotifyURL.isEmpty() )
{
xSystemShell->execute(
sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::URIS_ONLY );
sNotifyURL, ::rtl::OUString(), system::SystemShellExecuteFlags::URIS_ONLY );
}
}
else
{
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
uno::Reference < container::XNameReplace > xUpdateConfig(
aContext.createComponent( "com.sun.star.setup.UpdateCheckConfig" ), uno::UNO_QUERY_THROW );
uno::Reference < container::XNameReplace > xUpdateConfig =
setup::UpdateCheckConfig::create(xContext);
sal_Bool bUpdateCheckEnabled = sal_False;
OSL_VERIFY( xUpdateConfig->getByName( OUString( "AutoCheckEnabled" ) ) >>= bUpdateCheckEnabled );
@@ -116,7 +108,7 @@ IMPL_LINK_NOARG(NewerVersionWarningDialog, UpdateHdl)
// updates enabled", but this here is not an automatic update, but one triggered explicitly by the user.
uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
aContext.getUNOContext(),
xContext,
"org.openoffice.Office.Addons/",
"AddonUI/OfficeHelp/UpdateCheckJob",
"URL",
@@ -124,10 +116,10 @@ IMPL_LINK_NOARG(NewerVersionWarningDialog, UpdateHdl)
util::URL aURL;
if ( aVal >>= aURL.Complete )
{
uno::Reference< util::XURLTransformer > xTransformer( util::URLTransformer::create(aContext.getUNOContext()) );
uno::Reference< util::XURLTransformer > xTransformer( util::URLTransformer::create(xContext) );
xTransformer->parseStrict( aURL );
uno::Reference < frame::XDesktop2 > xDesktop = frame::Desktop::create(aContext.getUNOContext());
uno::Reference < frame::XDesktop2 > xDesktop = frame::Desktop::create(xContext);
uno::Reference< frame::XDispatchProvider > xDispatchProvider(
xDesktop->getCurrentFrame(), uno::UNO_QUERY );