fdo#52000 take website url from configuration

instead of taking it from a localized resource. This way
we have more control over localizations, no need to ping
each l10n team.

Change-Id: I4f8904b4601cd623399146ce060b9697d7b52671
This commit is contained in:
Andras Timar
2012-07-12 15:03:51 +02:00
parent 7444b258df
commit 291f3fe9d0

View File

@@ -38,6 +38,7 @@
#include <com/sun/star/uno/Any.h>
#include <vcl/graph.hxx>
#include <svtools/filter.hxx>
#include <svtools/langhelp.hxx>
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include "com/sun/star/system/XSystemShellExecute.hpp"
@@ -56,6 +57,8 @@
#include <vcl/bitmap.hxx>
#include <vcl/rendergraphicrasterizer.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star;
enum AboutDialogButton
@@ -121,22 +124,48 @@ IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton )
if ( pDialogButton == (AboutDialogButton*)CREDITS_BUTTON )
sURL = m_aCreditsLinkStr;
else if ( pDialogButton == (AboutDialogButton*)WEBSITE_BUTTON )
sURL = m_aWebsiteLinkStr;
{
try
{
Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(rtl::OUString( "com.sun.star.configuration.ConfigurationProvider" )),UNO_QUERY);
if( xConfig.is() )
{
Sequence<Any> args(1);
PropertyValue val(
rtl::OUString( "nodepath" ),
0,
Any(rtl::OUString( "/org.openoffice.Office.Common/Help/StartCenter" )),
PropertyState_DIRECT_VALUE);
args.getArray()[0] <<= val;
Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(rtl::OUString( "com.sun.star.configuration.ConfigurationAccess" ),args), UNO_QUERY);
if( xNameAccess.is() )
{
//throws css::container::NoSuchElementException, css::lang::WrappedTargetException
Any value( xNameAccess->getByName(rtl::OUString( "InfoURL" )) );
sURL = value.get<rtl::OUString> ();
localizeWebserviceURI(sURL);
}
}
}
catch (const Exception&)
{
}
}
// If the URL is empty, don't do anything
if ( sURL.isEmpty() )
return 1;
try
{
uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
::comphelper::getProcessServiceFactory()->createInstance(
DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW );
DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), UNO_QUERY_THROW );
xSystemShellExecute->execute( sURL, rtl::OUString(),
com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
}
catch (const uno::Exception&)
catch (const Exception&)
{
uno::Any exc( ::cppu::getCaughtException() );
Any exc( ::cppu::getCaughtException() );
rtl::OUString msg( ::comphelper::anyToString( exc ) );
const SolarMutexGuard guard;
ErrorBox aErrorBox( NULL, WB_OK, msg );