diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-07-20 16:01:09 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2015-07-24 12:28:52 +0200 |
commit | f369d4764b3575c01dc7245686e9493784473ada (patch) | |
tree | 8600e9958d4265b8374a7634c25b3c6d1c5c6350 /svtools | |
parent | ea956fa67ff42596cbe79a402dcb2c4c767e6946 (diff) |
default label for service
Change-Id: Iad4ad161765c943a035dcc15232c4dcbef1cc68c
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/dialogs/PlaceEditDialog.cxx | 37 | ||||
-rw-r--r-- | svtools/source/dialogs/filedlg2.src | 6 |
2 files changed, 42 insertions, 1 deletions
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index 15034dd03518..cb90be7412d3 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <officecfg/Office/Common.hxx> #include <svtools/svtresid.hxx> +#include <svtools/svtools.hrc> #include <vcl/msgbox.hxx> using namespace com::sun::star::uno; @@ -21,6 +22,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") , m_xCurrentDetails() , m_nCurrentType( 0 ) + , bLabelChanged( false ) { get( m_pEDServerName, "name" ); get( m_pLBServerType, "type" ); @@ -33,7 +35,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); m_pBTOk->Enable( false ); - m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) ); + m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, EditLabelHdl) ); // This constructor is called when user request a place creation, so // delete button is hidden. @@ -48,6 +50,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Place>& rPlace) : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") , m_xCurrentDetails( ) + , bLabelChanged( true ) { get( m_pEDServerName, "name" ); get( m_pLBServerType, "type" ); @@ -188,6 +191,26 @@ void PlaceEditDialog::InitDetails( ) SelectTypeHdl( m_pLBServerType ); } +void PlaceEditDialog::UpdateLabel( ) +{ + if( !bLabelChanged ) + { + if( !m_pEDUsername->GetText().isEmpty( ) ) + { + OUString sLabel = SvtResId( STR_SVT_DEFAULT_SERVICE_LABEL ); + sLabel = sLabel.replaceFirst( "$user$", m_pEDUsername->GetText() ); + sLabel = sLabel.replaceFirst( "$service$", m_pLBServerType->GetSelectEntry() ); + + m_pEDServerName->SetText( sLabel ); + bLabelChanged = false; + } + else + { + m_pEDServerName->SetText( m_pLBServerType->GetSelectEntry( ) ); + } + } +} + IMPL_LINK ( PlaceEditDialog, OKHdl, Button *, ) { if ( m_xCurrentDetails.get() ) @@ -234,12 +257,22 @@ IMPL_LINK ( PlaceEditDialog, DelHdl, Button *, ) IMPL_LINK_NOARG( PlaceEditDialog, EditHdl ) { + UpdateLabel( ); + OUString sUrl = GetServerUrl( ); OUString sName = OUString( m_pEDServerName->GetText() ).trim( ); m_pBTOk->Enable( !sName.isEmpty( ) && !sUrl.isEmpty( ) ); return 1; } +IMPL_LINK_NOARG( PlaceEditDialog, EditLabelHdl ) +{ + bLabelChanged = true; + EditHdl(NULL); + + return 1; +} + IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl ) { for ( std::vector< std::shared_ptr< DetailsContainer > >::iterator it = m_aDetailsContainers.begin( ); @@ -247,7 +280,9 @@ IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl ) { ( *it )->setUsername( OUString( m_pEDUsername->GetText() ) ); } + EditHdl(NULL); + return 1; } diff --git a/svtools/source/dialogs/filedlg2.src b/svtools/source/dialogs/filedlg2.src index 6e68db0ff4c1..795da0e54362 100644 --- a/svtools/source/dialogs/filedlg2.src +++ b/svtools/source/dialogs/filedlg2.src @@ -18,6 +18,7 @@ */ #include <svtools/filedlg2.hrc> +#include <svtools/svtools.hrc> String STR_FILEDLG_OPEN { @@ -32,4 +33,9 @@ String STR_FILEDLG_SAVE Text [ en-US ] = "Save" ; }; +String STR_SVT_DEFAULT_SERVICE_LABEL +{ + Text [ en-US ] = "$user$'s $service$" ; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |