diff options
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 32 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.hxx | 2 |
2 files changed, 31 insertions, 3 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 6cf999492ca8..98ef36f43cac 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -650,6 +650,27 @@ void RemoteFilesDialog::DisableControls() m_pCancel_btn->Enable( true ); } +void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUser, const OUString& rPassword ) +{ + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() && m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) ) + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + Sequence< OUString > aPasswd( 1 ); + aPasswd[0] = rPassword; + + m_xMasterPasswd->addPersistent( + rURL, rUser, aPasswd, xInteractionHandler ); + } + } + catch( const Exception& ) + {} +} + IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) { ScopedVclPtrInstance< PlaceEditDialog > aDlg( this ); @@ -663,6 +684,13 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) ServicePtr newService = aDlg->GetPlace(); m_aServices.push_back( newService ); + OUString sPassword = aDlg->GetPassword(); + OUString sUser = aDlg->GetUser(); + if( !sUser.isEmpty() && !sPassword.isEmpty() ) + { + SavePassword( newService->GetUrl(), sUser, sPassword ); + } + OUString sPrefix = lcl_GetServiceType( newService ); if(!sPrefix.isEmpty()) @@ -803,9 +831,7 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, Sequence< OUString > aPasswd( 1 ); aPasswd[0] = aNewPass; - Reference< XPasswordContainer2 > xPasswdContainer( - PasswordContainer::create( m_xContext ) ); - xPasswdContainer->addPersistent( + m_xMasterPasswd->addPersistent( sUrl, sUserName, aPasswd, xInteractionHandler ); } } diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index f35d64c96ddd..4fe118868ea6 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -178,6 +178,8 @@ private: void EnableControls(); void DisableControls(); + void SavePassword( const OUString& rURL, const OUString& rUser, const OUString& rPassword ); + DECL_LINK ( AddServiceHdl, void * ); DECL_LINK ( SelectServiceHdl, void * ); DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void ); |