Kaydet (Commit) e1468a20 authored tarafından Oliver Bolte's avatar Oliver Bolte

INTEGRATION: CWS odfversion241_DEV300 (1.2.30.1.14); FILE MERGED

2008/05/21 07:40:38 pb 1.2.30.1.14.1: fix: #i89096# no online update check anymore; now open a website
üst db9169fd
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite * OpenOffice.org - a multi-platform office productivity suite
* *
* $RCSfile: newerverwarn.cxx,v $ * $RCSfile: newerverwarn.cxx,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* This file is part of OpenOffice.org. * This file is part of OpenOffice.org.
* *
...@@ -41,22 +41,29 @@ ...@@ -41,22 +41,29 @@
#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/configurationhelper.hxx> #include <comphelper/configurationhelper.hxx>
#include <rtl/bootstrap.hxx>
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <vos/process.hxx>
namespace beans = ::com::sun::star::beans; namespace beans = ::com::sun::star::beans;
namespace frame = ::com::sun::star::frame; namespace frame = ::com::sun::star::frame;
namespace lang = ::com::sun::star::lang; namespace lang = ::com::sun::star::lang;
namespace uno = ::com::sun::star::uno; namespace uno = ::com::sun::star::uno;
namespace util = ::com::sun::star::util; namespace util = ::com::sun::star::util;
using namespace com::sun::star::system;
namespace sfx2 namespace sfx2
{ {
NewerVersionWarningDialog::NewerVersionWarningDialog( Window* pParent ) : NewerVersionWarningDialog::NewerVersionWarningDialog(
Window* pParent, const ::rtl::OUString& rVersion ) :
SfxModalDialog( pParent, SfxResId( RID_DLG_NEWER_VERSION_WARNING ) ), SfxModalDialog( pParent, SfxResId( RID_DLG_NEWER_VERSION_WARNING ) ),
...@@ -64,7 +71,8 @@ NewerVersionWarningDialog::NewerVersionWarningDialog( Window* pParent ) : ...@@ -64,7 +71,8 @@ NewerVersionWarningDialog::NewerVersionWarningDialog( Window* pParent ) :
m_aInfoText ( this, SfxResId( FT_INFO ) ), m_aInfoText ( this, SfxResId( FT_INFO ) ),
m_aButtonLine ( this, SfxResId( FL_BUTTON ) ), m_aButtonLine ( this, SfxResId( FL_BUTTON ) ),
m_aUpdateBtn ( this, SfxResId( PB_UPDATE ) ), m_aUpdateBtn ( this, SfxResId( PB_UPDATE ) ),
m_aLaterBtn ( this, SfxResId( PB_LATER ) ) m_aLaterBtn ( this, SfxResId( PB_LATER ) ),
m_sVersion ( rVersion )
{ {
FreeResource(); FreeResource();
...@@ -81,40 +89,42 @@ NewerVersionWarningDialog::~NewerVersionWarningDialog() ...@@ -81,40 +89,42 @@ NewerVersionWarningDialog::~NewerVersionWarningDialog()
IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG ) IMPL_LINK( NewerVersionWarningDialog, UpdateHdl, PushButton*, EMPTYARG )
{ {
uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); // detect execute path
try ::rtl::OUString sProgramPath;
::vos::OStartupInfo().getExecutableFile( sProgramPath );
sal_uInt32 nLastIndex = sProgramPath.lastIndexOf( '/' );
if ( nLastIndex > 0 )
sProgramPath = sProgramPath.copy( 0, nLastIndex + 1 );
// read keys from soffice.ini (sofficerc)
::rtl::OUString sIniFileName = sProgramPath;
sIniFileName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_CONFIGFILE( "version" ) ) );
::rtl::Bootstrap aIniFile( sIniFileName );
::rtl::OUString sNotifyURL;
aIniFile.getFrom( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ODFNotifyURL" ) ), sNotifyURL );
if ( sNotifyURL.getLength() > 0 )
{ {
uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( try
xSMGR,
DEFINE_CONST_UNICODE("org.openoffice.Office.Addons/"),
DEFINE_CONST_UNICODE("AddonUI/OfficeHelp/UpdateCheckJob"),
DEFINE_CONST_UNICODE("URL"),
::comphelper::ConfigurationHelper::E_READONLY );
util::URL aURL;
if ( aVal >>= aURL.Complete )
{ {
uno::Reference< util::XURLTransformer > xTransformer( uno::Reference< lang::XMultiServiceFactory > xSMGR =
xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.util.URLTransformer") ), ::comphelper::getProcessServiceFactory();
uno::UNO_QUERY_THROW ); uno::Reference< XSystemShellExecute > xSystemShell(
xTransformer->parseStrict( aURL ); xSMGR->createInstance( ::rtl::OUString(
uno::Reference < frame::XDesktop > xDesktop( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
uno::Reference< frame::XDispatchProvider > xDispatchProvider( sNotifyURL += m_sVersion;
xDesktop->getCurrentFrame(), uno::UNO_QUERY ); if ( xSystemShell.is() && sNotifyURL.getLength() )
if ( !xDispatchProvider.is() ) {
xDispatchProvider = uno::Reference < frame::XDispatchProvider > ( xDesktop, uno::UNO_QUERY ); xSystemShell->execute(
sNotifyURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
uno::Reference< frame::XDispatch > xDispatch = }
xDispatchProvider->queryDispatch( aURL, rtl::OUString(), 0 ); }
if ( xDispatch.is() ) catch( const uno::Exception& e )
xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); {
OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
} }
}
catch( const uno::Exception& e )
{
OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
} }
EndDialog( RET_OK ); EndDialog( RET_OK );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment