summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-01-04 23:09:18 +0100
committerPetr Mladek <pmladek@suse.cz>2013-01-08 16:12:47 +0100
commit28f96fc78df11cd6e5028b65e60f144121afa4d4 (patch)
treea8fb7896b2901d899f1b2d523c3194152f1c68b7 /cui
parentf3478203c1dd360c1eae7b733a262923985c3b96 (diff)
Personas: More robust Persona URL handling.
Change-Id: I55fa2570decd52e978747e589887f2fe972812c8 Signed-off-by: Cor Nouws <oolst@nouenoff.nl> Signed-off-by: Olivier Hallot <olivier.hallot@documentfoundation.org> Signed-off-by: Adolfo Jayme Barrientos <fitoschido@ubuntu.com> Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/options/personalization.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 7d31b0fa4cc0..ae8f60572f3d 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -71,7 +71,14 @@ OUString SelectPersonaDialog::GetPersonaURL() const
return OUString();
}
- return aText;
+ // canonicalize the URL
+ OUString aPersona( "persona/" );
+ sal_Int32 nPersona = aText.lastIndexOf( aPersona );
+
+ if ( nPersona < 0 )
+ return OUString();
+
+ return "http://www.getpersonas.com/persona/" + aText.copy( nPersona + aPersona.getLength() );
}
IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ )
@@ -236,7 +243,7 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ )
while ( aDialog.Execute() == RET_OK )
{
OUString aURL( aDialog.GetPersonaURL() );
- if ( aURL != "" )
+ if ( !aURL.isEmpty() )
{
if ( CopyPersonaToGallery( aURL ) )
m_pOwnPersona->Check();
@@ -312,7 +319,14 @@ bool SvxPersonalizationTabPage::CopyPersonaToGallery( const OUString &rURL )
if ( !xFileAccess.is() )
return false;
- uno::Reference< io::XInputStream > xStream( xFileAccess->openFileRead( rURL ), uno::UNO_QUERY );
+ uno::Reference< io::XInputStream > xStream;
+ try {
+ xStream = xFileAccess->openFileRead( rURL );
+ }
+ catch (...)
+ {
+ return false;
+ }
if ( !xStream.is() )
return false;