summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-08-10 13:49:18 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-08-14 08:45:42 +0200
commit0ab1f6a024651d09b619c2864cee1ecc0c7968db (patch)
tree877ac68007309acf941ada40959985b048cdc18a /fpicker
parent2b0e0ffc1562e3f939833b9dfc3c52eea847bd4d (diff)
added change password entry in the split button menu
Change-Id: I68e76e346ec6d704c27fe6f4031453dd44dbc983
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx52
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx5
-rw-r--r--fpicker/uiconfig/ui/remotefilesdialog.ui8
3 files changed, 65 insertions, 0 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index a85c40dc82d5..c90175d10855 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -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();
}
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index a63bef3e8eaa..740262a6529a 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -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;
diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui
index 7c0c92359034..e0699a5b96a8 100644
--- a/fpicker/uiconfig/ui/remotefilesdialog.ui
+++ b/fpicker/uiconfig/ui/remotefilesdialog.ui
@@ -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>