1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_cui.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir #include <dialmgr.hxx> 33*cdf0e10cSrcweir #include <cuires.hrc> 34*cdf0e10cSrcweir #include <com/sun/star/task/UrlRecord.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/task/XPasswordContainer.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/task/XMasterPasswordHandling.hpp> 37*cdf0e10cSrcweir #include "com/sun/star/task/XUrlContainer.hpp" 38*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 39*cdf0e10cSrcweir #include <comphelper/docpasswordrequest.hxx> 40*cdf0e10cSrcweir #include "webconninfo.hxx" 41*cdf0e10cSrcweir #include "webconninfo.hrc" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir using namespace ::com::sun::star; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //........................................................................ 46*cdf0e10cSrcweir namespace svx 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir //........................................................................ 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir // class PasswordTable --------------------------------------------------- 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir PasswordTable::PasswordTable( Window* pParent, const ResId& rResId ) : 53*cdf0e10cSrcweir SvxSimpleTable( pParent, rResId ) 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir SetStyle( GetStyle() | WB_NOINITIALSELECTION ); 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir void PasswordTable::InsertHeaderItem( sal_uInt16 nColumn, const String& rText, HeaderBarItemBits nBits ) 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir GetTheHeaderBar()->InsertItem( nColumn, rText, 0, nBits ); 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir void PasswordTable::ResetTabs() 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir SetTabs(); 66*cdf0e10cSrcweir } 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir void PasswordTable::Resort( bool bForced ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir sal_uInt16 nColumn = GetSelectedCol(); 71*cdf0e10cSrcweir if ( 0 == nColumn || bForced ) // only the first column is sorted 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir HeaderBarItemBits nBits = GetTheHeaderBar()->GetItemBits(1); 74*cdf0e10cSrcweir sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW ); 75*cdf0e10cSrcweir SvSortMode eMode = SortAscending; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir if ( bUp ) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir nBits &= ~HIB_UPARROW; 80*cdf0e10cSrcweir nBits |= HIB_DOWNARROW; 81*cdf0e10cSrcweir eMode = SortDescending; 82*cdf0e10cSrcweir } 83*cdf0e10cSrcweir else 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir nBits &= ~HIB_DOWNARROW; 86*cdf0e10cSrcweir nBits |= HIB_UPARROW; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir GetTheHeaderBar()->SetItemBits( 1, nBits ); 89*cdf0e10cSrcweir SvTreeList* pListModel = GetModel(); 90*cdf0e10cSrcweir pListModel->SetSortMode( eMode ); 91*cdf0e10cSrcweir pListModel->Resort(); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir // class WebConnectionInfoDialog ----------------------------------------- 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // ----------------------------------------------------------------------- 98*cdf0e10cSrcweir WebConnectionInfoDialog::WebConnectionInfoDialog( Window* pParent ) : 99*cdf0e10cSrcweir ModalDialog( pParent, CUI_RES( RID_SVXDLG_WEBCONNECTION_INFO ) ) 100*cdf0e10cSrcweir ,m_aNeverShownFI ( this, CUI_RES( FI_NEVERSHOWN ) ) 101*cdf0e10cSrcweir ,m_aPasswordsLB ( this, CUI_RES( LB_PASSWORDS ) ) 102*cdf0e10cSrcweir ,m_aRemoveBtn ( this, CUI_RES( PB_REMOVE ) ) 103*cdf0e10cSrcweir ,m_aRemoveAllBtn ( this, CUI_RES( PB_REMOVEALL ) ) 104*cdf0e10cSrcweir ,m_aChangeBtn ( this, CUI_RES( PB_CHANGE ) ) 105*cdf0e10cSrcweir ,m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) ) 106*cdf0e10cSrcweir ,m_aCloseBtn ( this, CUI_RES( PB_CLOSE ) ) 107*cdf0e10cSrcweir ,m_aHelpBtn ( this, CUI_RES( PB_HELP ) ) 108*cdf0e10cSrcweir ,m_nPos ( -1 ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir static long aStaticTabs[]= { 3, 0, 150, 250 }; 111*cdf0e10cSrcweir m_aPasswordsLB.SetTabs( aStaticTabs ); 112*cdf0e10cSrcweir m_aPasswordsLB.InsertHeaderItem( 1, CUI_RESSTR( STR_WEBSITE ), 113*cdf0e10cSrcweir HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS | HIB_CLICKABLE | HIB_UPARROW ); 114*cdf0e10cSrcweir m_aPasswordsLB.InsertHeaderItem( 2, CUI_RESSTR( STR_USERNAME ), 115*cdf0e10cSrcweir HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS ); 116*cdf0e10cSrcweir m_aPasswordsLB.ResetTabs(); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir FreeResource(); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir m_aPasswordsLB.SetHeaderBarClickHdl( LINK( this, WebConnectionInfoDialog, HeaderBarClickedHdl ) ); 121*cdf0e10cSrcweir m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) ); 122*cdf0e10cSrcweir m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) ); 123*cdf0e10cSrcweir m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir // one button too small for its text? 126*cdf0e10cSrcweir sal_Int32 i = 0; 127*cdf0e10cSrcweir long nBtnTextWidth = 0; 128*cdf0e10cSrcweir Window* pButtons[] = { &m_aRemoveBtn, &m_aRemoveAllBtn, &m_aChangeBtn }; 129*cdf0e10cSrcweir Window** pButton = pButtons; 130*cdf0e10cSrcweir const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] ); 131*cdf0e10cSrcweir for ( ; i < nBCount; ++i, ++pButton ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() ); 134*cdf0e10cSrcweir if ( nTemp > nBtnTextWidth ) 135*cdf0e10cSrcweir nBtnTextWidth = nTemp; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset 138*cdf0e10cSrcweir long nButtonWidth = m_aRemoveBtn.GetSizePixel().Width(); 139*cdf0e10cSrcweir if ( nBtnTextWidth > nButtonWidth ) 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir // so make the buttons broader and its control in front of it smaller 142*cdf0e10cSrcweir long nDelta = nBtnTextWidth - nButtonWidth; 143*cdf0e10cSrcweir pButton = pButtons; 144*cdf0e10cSrcweir for ( i = 0; i < nBCount; ++i, ++pButton ) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir Point aNewPos = (*pButton)->GetPosPixel(); 147*cdf0e10cSrcweir if ( &m_aRemoveAllBtn == (*pButton) ) 148*cdf0e10cSrcweir aNewPos.X() += nDelta; 149*cdf0e10cSrcweir else if ( &m_aChangeBtn == (*pButton) ) 150*cdf0e10cSrcweir aNewPos.X() -= nDelta; 151*cdf0e10cSrcweir Size aNewSize = (*pButton)->GetSizePixel(); 152*cdf0e10cSrcweir aNewSize.Width() += nDelta; 153*cdf0e10cSrcweir (*pButton)->SetPosSizePixel( aNewPos, aNewSize ); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir FillPasswordList(); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) ); 160*cdf0e10cSrcweir m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) ); 161*cdf0e10cSrcweir m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) ); 162*cdf0e10cSrcweir m_aPasswordsLB.SetSelectHdl( LINK( this, WebConnectionInfoDialog, EntrySelectedHdl ) ); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir m_aRemoveBtn.Enable( sal_False ); 165*cdf0e10cSrcweir m_aChangeBtn.Enable( sal_False ); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir HeaderBarClickedHdl( NULL ); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir // ----------------------------------------------------------------------- 171*cdf0e10cSrcweir WebConnectionInfoDialog::~WebConnectionInfoDialog() 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // ----------------------------------------------------------------------- 176*cdf0e10cSrcweir IMPL_LINK( WebConnectionInfoDialog, HeaderBarClickedHdl, SvxSimpleTable*, pTable ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir m_aPasswordsLB.Resort( NULL == pTable ); 179*cdf0e10cSrcweir return 0; 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // ----------------------------------------------------------------------- 183*cdf0e10cSrcweir void WebConnectionInfoDialog::FillPasswordList() 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir try 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir uno::Reference< task::XMasterPasswordHandling > xMasterPasswd( 188*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstance( 189*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), 190*cdf0e10cSrcweir uno::UNO_QUERY ); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir uno::Reference< task::XPasswordContainer > xPasswdContainer( xMasterPasswd, uno::UNO_QUERY_THROW ); 195*cdf0e10cSrcweir uno::Reference< task::XInteractionHandler > xInteractionHandler( 196*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstance( 197*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), 198*cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler ); 201*cdf0e10cSrcweir sal_Int32 nCount = 0; 202*cdf0e10cSrcweir for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ ) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir for ( sal_Int32 nUserInd = 0; nUserInd < aURLEntries[nURLInd].UserList.getLength(); nUserInd++ ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir ::rtl::OUString aUIEntry( aURLEntries[nURLInd].Url ); 207*cdf0e10cSrcweir aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' ); 208*cdf0e10cSrcweir aUIEntry += aURLEntries[nURLInd].UserList[nUserInd].UserName; 209*cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry ); 210*cdf0e10cSrcweir pEntry->SetUserData( (void*)(nCount++) ); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir // remember pos of first url container entry. 215*cdf0e10cSrcweir m_nPos = nCount; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir uno::Reference< task::XUrlContainer > xUrlContainer( 218*cdf0e10cSrcweir xPasswdContainer, uno::UNO_QUERY_THROW ); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir uno::Sequence< rtl::OUString > aUrls 221*cdf0e10cSrcweir = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir ::rtl::OUString aUIEntry( aUrls[ nURLIdx ] ); 226*cdf0e10cSrcweir aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' ); 227*cdf0e10cSrcweir aUIEntry += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*" ) ); 228*cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry ); 229*cdf0e10cSrcweir pEntry->SetUserData( (void*)(nCount++) ); 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir catch( uno::Exception& ) 234*cdf0e10cSrcweir {} 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir // ----------------------------------------------------------------------- 238*cdf0e10cSrcweir IMPL_LINK( WebConnectionInfoDialog, RemovePasswordHdl, PushButton*, EMPTYARG ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir try 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); 243*cdf0e10cSrcweir if ( pEntry ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); 246*cdf0e10cSrcweir ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir uno::Reference< task::XPasswordContainer > xPasswdContainer( 249*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstance( 250*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 251*cdf0e10cSrcweir "com.sun.star.task.PasswordContainer" ) ) ), 252*cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); 255*cdf0e10cSrcweir if ( nPos < m_nPos ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir xPasswdContainer->removePersistent( aURL, aUserName ); 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir else 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir uno::Reference< task::XUrlContainer > xUrlContainer( 262*cdf0e10cSrcweir xPasswdContainer, uno::UNO_QUERY_THROW ); 263*cdf0e10cSrcweir xUrlContainer->removeUrl( aURL ); 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir m_aPasswordsLB.RemoveEntry( pEntry ); 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir catch( uno::Exception& ) 269*cdf0e10cSrcweir {} 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir return 0; 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir // ----------------------------------------------------------------------- 275*cdf0e10cSrcweir IMPL_LINK( WebConnectionInfoDialog, RemoveAllPasswordsHdl, PushButton*, EMPTYARG ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir try 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir uno::Reference< task::XPasswordContainer > xPasswdContainer( 280*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstance( 281*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 282*cdf0e10cSrcweir "com.sun.star.task.PasswordContainer" ) ) ), 283*cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir // should the master password be requested before? 286*cdf0e10cSrcweir xPasswdContainer->removeAllPersistent(); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir uno::Reference< task::XUrlContainer > xUrlContainer( 289*cdf0e10cSrcweir xPasswdContainer, uno::UNO_QUERY_THROW ); 290*cdf0e10cSrcweir uno::Sequence< rtl::OUString > aUrls 291*cdf0e10cSrcweir = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); 292*cdf0e10cSrcweir for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) 293*cdf0e10cSrcweir xUrlContainer->removeUrl( aUrls[ nURLIdx ] ); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir m_aPasswordsLB.Clear(); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir catch( uno::Exception& ) 298*cdf0e10cSrcweir {} 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir return 0; 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir // ----------------------------------------------------------------------- 304*cdf0e10cSrcweir IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG ) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir try 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); 309*cdf0e10cSrcweir if ( pEntry ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); 312*cdf0e10cSrcweir ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir ::comphelper::SimplePasswordRequest* pPasswordRequest 315*cdf0e10cSrcweir = new ::comphelper::SimplePasswordRequest( task::PasswordRequestMode_PASSWORD_CREATE ); 316*cdf0e10cSrcweir uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir uno::Reference< task::XInteractionHandler > xInteractionHandler( 319*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstance( 320*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 321*cdf0e10cSrcweir "com.sun.star.task.InteractionHandler" ) ) ), 322*cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 323*cdf0e10cSrcweir xInteractionHandler->handle( rRequest ); 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir if ( pPasswordRequest->isPassword() ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir String aNewPass = pPasswordRequest->getPassword(); 328*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aPasswd( 1 ); 329*cdf0e10cSrcweir aPasswd[0] = aNewPass; 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir uno::Reference< task::XPasswordContainer > xPasswdContainer( 332*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstance( 333*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 334*cdf0e10cSrcweir "com.sun.star.task.PasswordContainer" ) ) ), 335*cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 336*cdf0e10cSrcweir xPasswdContainer->addPersistent( 337*cdf0e10cSrcweir aURL, aUserName, aPasswd, xInteractionHandler ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir catch( uno::Exception& ) 342*cdf0e10cSrcweir {} 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir return 0; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir // ----------------------------------------------------------------------- 348*cdf0e10cSrcweir IMPL_LINK( WebConnectionInfoDialog, EntrySelectedHdl, void*, EMPTYARG ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); 351*cdf0e10cSrcweir if ( !pEntry ) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir m_aRemoveBtn.Enable( sal_False ); 354*cdf0e10cSrcweir m_aChangeBtn.Enable( sal_False ); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir else 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir m_aRemoveBtn.Enable( sal_True ); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir // url container entries (-> use system credentials) have 361*cdf0e10cSrcweir // no password 362*cdf0e10cSrcweir sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); 363*cdf0e10cSrcweir m_aChangeBtn.Enable( nPos < m_nPos ); 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir return 0; 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir //........................................................................ 370*cdf0e10cSrcweir } // namespace svx 371*cdf0e10cSrcweir //........................................................................ 372*cdf0e10cSrcweir 373