summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx32
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx2
-rw-r--r--include/svtools/PlaceEditDialog.hxx1
3 files changed, 32 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 );
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
index cfcfe67c4dc4..79ec3487a28e 100644
--- a/include/svtools/PlaceEditDialog.hxx
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -70,6 +70,7 @@ public :
OUString GetServerName() { return m_pEDServerName->GetText(); }
OUString GetServerUrl();
OUString GetPassword() { return m_pEDPassword->GetText(); };
+ OUString GetUser() { return m_pEDUsername->GetText(); };
void ShowPasswordControl( bool bShow = true ) { m_pEDPassword->Show( bShow ); m_pFTPasswordLabel->Show( bShow ); }