diff options
author | Noel Grandin <noel@peralex.com> | 2013-01-09 14:45:32 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-01-28 08:22:35 +0200 |
commit | 4b37df18a18b61521e5fcbf358c6bc85639abdfc (patch) | |
tree | 9b0ca1f6cd4db14d8b958028aed4d2257442ef25 | |
parent | 1a92a885d65860b4b09b426bb4b10f7a6a336571 (diff) |
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
-rw-r--r-- | cui/source/options/optupdt.cxx | 19 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/setup/UpdateCheckConfig.idl | 41 | ||||
-rw-r--r-- | uui/source/newerverwarn.cxx | 28 |
4 files changed, 60 insertions, 31 deletions
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 10db1d46f87a..9dc4b72177f4 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -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)) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 47bec3c6fe19..6be7bd8876ba 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -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 \ diff --git a/offapi/com/sun/star/setup/UpdateCheckConfig.idl b/offapi/com/sun/star/setup/UpdateCheckConfig.idl new file mode 100644 index 000000000000..d2354d820383 --- /dev/null +++ b/offapi/com/sun/star/setup/UpdateCheckConfig.idl @@ -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: */ diff --git a/uui/source/newerverwarn.cxx b/uui/source/newerverwarn.cxx index 4ddad6110fad..21f539357862 100644 --- a/uui/source/newerverwarn.cxx +++ b/uui/source/newerverwarn.cxx @@ -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 ); |