diff options
author | Jan Holesovsky <kendy@suse.cz> | 2012-12-04 08:49:50 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-12-04 16:23:14 +0100 |
commit | ad0e96c2ec27ed6266715c724464809e6d86979f (patch) | |
tree | a31f4d84b23f1e12856b30cdf0f08bbbdfceb448 /cui | |
parent | 23c3f4a72cfbcc59d39be7b9832ef6439f440d29 (diff) |
Personas: Allow to paste Persona to the selection dialog.
Change-Id: Ife095eb27fac135c0c2285259dd1008e9b7cefc5
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/personalization.cxx | 32 |
1 files changed, 29 insertions, 3 deletions
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 <comphelper/processfactory.hxx> #include <officecfg/Office/Common.hxx> +#include <vcl/edit.hxx> #include <vcl/msgbox.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -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; |