From ad0e96c2ec27ed6266715c724464809e6d86979f Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 4 Dec 2012 08:49:50 +0100 Subject: Personas: Allow to paste Persona to the selection dialog. Change-Id: Ife095eb27fac135c0c2285259dd1008e9b7cefc5 --- cui/source/options/personalization.cxx | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'cui') diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 3f0330a3e82c..4fe2b1bc5afa 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -31,9 +32,15 @@ http://www.getpersona.com ... */ class SelectPersonaDialog : public ModalDialog { +private: + Edit *m_pEdit; ///< The input line for the Persona URL + public: SelectPersonaDialog( Window *pParent ); + /// Get the URL from the Edit field. + OUString GetPersonaURL() const; + private: /// Handle the [Visit Firefox Personas] button DECL_LINK( VisitPersonas, PushButton* ); @@ -45,6 +52,19 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) PushButton *pButton; get( pButton, "visit_personas" ); pButton->SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) ); + + get( m_pEdit, "persona_url" ); + m_pEdit->SetPlaceholderText( "http://www.getpersonas.com/persona/" ); +} + +OUString SelectPersonaDialog::GetPersonaURL() const +{ + OUString aText( m_pEdit->GetText() ); + + if ( !aText.startsWith( "http://www.getpersonas.com/" ) ) + return OUString(); + + return aText; } IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ ) @@ -198,10 +218,16 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ ) { SelectPersonaDialog aDialog( NULL ); - if ( aDialog.Execute() == RET_OK ) + while ( aDialog.Execute() == RET_OK ) { - m_pOwnPersona->Check(); - // TODO parse the results + OUString aURL( aDialog.GetPersonaURL() ); + if ( aURL != "" ) + { + // TODO parse the results + m_pOwnPersona->Check(); + break; + } + // else TODO msgbox that the URL did not match } return 0; -- cgit v1.2.3