Kaydet (Commit) 0ab1f6a0 authored tarafından Szymon Kłos's avatar Szymon Kłos

added change password entry in the split button menu

Change-Id: I68e76e346ec6d704c27fe6f4031453dd44dbc983
üst 2b0e0ffc
......@@ -738,6 +738,58 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
}
}
}
else if( sIdent == "change_password" )
{
try
{
Reference< XPasswordContainer2 > xMasterPasswd(
PasswordContainer::create( comphelper::getProcessComponentContext() ) );
if( xMasterPasswd->isPersistentStoringAllowed() )
{
int nPos = GetSelectedServicePos();
if( nPos >= 0 )
{
OUString sUrl( m_aServices[nPos]->GetUrl() );
Reference< XInteractionHandler > xInteractionHandler(
InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), 0 ),
UNO_QUERY );
UrlRecord aURLEntries = xMasterPasswd->find( sUrl, xInteractionHandler );
if( aURLEntries.Url == sUrl )
{
if( aURLEntries.UserList.getLength() )
{
OUString sUserName = aURLEntries.UserList[0].UserName;
::comphelper::SimplePasswordRequest* pPasswordRequest
= new ::comphelper::SimplePasswordRequest( PasswordRequestMode_PASSWORD_CREATE );
Reference< XInteractionRequest > rRequest( pPasswordRequest );
xInteractionHandler->handle( rRequest );
if ( pPasswordRequest->isPassword() )
{
OUString aNewPass = pPasswordRequest->getPassword();
Sequence< OUString > aPasswd( 1 );
aPasswd[0] = aNewPass;
Reference< XPasswordContainer2 > xPasswdContainer(
PasswordContainer::create(comphelper::getProcessComponentContext()));
xPasswdContainer->addPersistent(
sUrl, sUserName, aPasswd, xInteractionHandler );
}
}
}
}
}
}
catch( const Exception& )
{}
}
EnableControls();
}
......
......@@ -10,6 +10,8 @@
#ifndef INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
#define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
#include <comphelper/docpasswordrequest.hxx>
#include <svtools/foldertree.hxx>
#include <svtools/place.hxx>
#include <svtools/PlaceEditDialog.hxx>
......@@ -32,6 +34,8 @@
#include <officecfg/Office/Common.hxx>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/task/PasswordContainer.hpp>
#include <com/sun/star/task/XPasswordContainer2.hpp>
#include <vector>
......@@ -42,6 +46,7 @@
#include "iodlg.hrc"
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ui::dialogs;
......
......@@ -285,5 +285,13 @@
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="change_password">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Change password</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment