diff options
author | Andras Timar <atimar@suse.com> | 2012-07-12 15:03:51 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-07-12 15:05:41 +0200 |
commit | 291f3fe9d05eccfd125cdaafcdf01328e754122c (patch) | |
tree | 779c83fd904de1f66c3967c51e091fb3cad4bfbd /cui | |
parent | 7444b258df32638876257bab588f8d3513602781 (diff) |
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
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/about.cxx | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index daa662836ef9..8ba491c73eb8 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -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 ); |