summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-08-11 11:26:24 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-08-14 08:45:49 +0200
commita38e2ff72079a392a0f1c419ee9cfce472dca6e1 (patch)
tree5be336384d98470330d079c96efd57df258e1485 /fpicker
parentb5be942585db167aae58a4b820e9786f80a84096 (diff)
store password for service if filled
Change-Id: I99ce30516a3d8859c060c8e85f8f8ea5e5217d61
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx32
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx2
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 );