diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-09-17 14:41:33 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-09-17 14:41:33 +0000 |
commit | 49c5701fbbc6a93ca0410719564ee22b5166ee48 (patch) | |
tree | 6dcd8396502f89c91b7ac29c20f1e9c23eaa9520 /uui | |
parent | c932a23fb013889e14ce5096966221c22ed8f96a (diff) |
CWS-TOOLING: integrate CWS kso32fixes2
2009-09-14 kso #i104767# - 64 bit build breaker
2009-09-14 kso #i14767# - compiler warning
2009-09-08 kso i104767# - Removed obsolete header.
2009-09-08 kso i104767# - Removed obsolete header include.
2009-09-08 kso #i104767# - Fixed build breaker.
2009-09-07 kso #i104767# - merged in dev300 m57.
2009-09-07 kso #i104767# - support for system credentials usage
2009-09-07 kso #i104767# - support for system credentials usage
2009-09-07 kso #i104767# - support for system credentials usage
2009-09-07 kso #i104767# - support for system credentials usage
2009-09-07 kso #i104767# - support for system credentials usage
2009-09-07 Kai Sommerfeld #i104767# - support for system credentials usage
2009-09-07 Kai Sommerfeld #i104767# - support for system credentials usage
2009-09-07 ks93798 #i104767# - adaptions for NTLM SSO
Diffstat (limited to 'uui')
-rw-r--r-- | uui/source/iahndl.cxx | 354 | ||||
-rw-r--r-- | uui/source/iahndl.hxx | 9 | ||||
-rw-r--r-- | uui/source/logindlg.cxx | 70 | ||||
-rw-r--r-- | uui/source/logindlg.hrc | 1 | ||||
-rw-r--r-- | uui/source/logindlg.hxx | 7 | ||||
-rw-r--r-- | uui/source/logindlg.src | 8 |
6 files changed, 346 insertions, 103 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index ff7022fd241e..8ea299289986 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -77,8 +77,10 @@ #include "com/sun/star/task/XInteractionRequest.hpp" #include "com/sun/star/task/XInteractionRetry.hpp" #include "com/sun/star/task/XPasswordContainer.hpp" +#include "com/sun/star/task/XUrlContainer.hpp" #include "com/sun/star/task/XInteractionAskLater.hpp" #include "com/sun/star/ucb/AuthenticationRequest.hpp" +#include "com/sun/star/ucb/URLAuthenticationRequest.hpp" #include "com/sun/star/ucb/CertificateValidationRequest.hpp" #include "com/sun/star/ucb/HandleCookiesRequest.hpp" #include "com/sun/star/ucb/InteractiveAppException.hpp" @@ -99,6 +101,7 @@ #include "com/sun/star/ucb/XInteractionCookieHandling.hpp" #include "com/sun/star/ucb/XInteractionReplaceExistingData.hpp" #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" +#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp" #include "com/sun/star/ucb/XInteractionSupplyName.hpp" #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include "com/sun/star/uno/RuntimeException.hpp" @@ -110,7 +113,6 @@ #include "tools/rcid.h" #include "vcl/svapp.hxx" #include "svtools/svtools.hrc" -#include "svtools/loginerr.hxx" #include "svtools/httpcook.hxx" #include "svtools/sfxecode.hxx" #include "toolkit/helper/vclunohelper.hxx" @@ -134,6 +136,8 @@ #include "filechanged.hxx" #include "trylater.hxx" #include "lockfailed.hxx" +#include "loginerr.hxx" + #include <comphelper/processfactory.hxx> #include <svtools/zforlist.hxx> using namespace com::sun; @@ -201,6 +205,8 @@ getContinuations( star::uno::Reference< star::task::XInteractionAbort > * pAbort, star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > * pSupplyAuthentication, + star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > * + pSupplyAuthentication2, star::uno::Reference< star::task::XInteractionPassword > * pPassword, star::uno::Reference< star::ucb::XInteractionSupplyName > * pSupplyName, @@ -247,7 +253,16 @@ getContinuations( star::ucb::XInteractionSupplyAuthentication >( rContinuations[i], star::uno::UNO_QUERY); if (pSupplyAuthentication->is()) + { + // is it even a supplyauthentication2, which is derived from + // supplyauthentication? + if (pSupplyAuthentication2 && !pSupplyAuthentication2->is()) + *pSupplyAuthentication2 + = star::uno::Reference< + star::ucb::XInteractionSupplyAuthentication2 >( + rContinuations[i], star::uno::UNO_QUERY); continue; + } } if (pPassword && !pPassword->is()) { @@ -610,7 +625,7 @@ bool UUIInteractionHelper::handleMessageboxRequests( star::task::XInteractionDisapprove > xDisapprove; getContinuations( rRequest->getContinuations(), - &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0); + &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0, 0); if( xApprove.is() && xDisapprove.is() ) { @@ -1097,11 +1112,21 @@ bool UUIInteractionHelper::handleDialogRequests( { star::uno::Any aAnyRequest(rRequest->getRequest()); + star::ucb::URLAuthenticationRequest aURLAuthenticationRequest; + if (aAnyRequest >>= aURLAuthenticationRequest) + { + handleAuthenticationRequest(aURLAuthenticationRequest, + rRequest->getContinuations(), + aURLAuthenticationRequest.URL); + return true; + } + star::ucb::AuthenticationRequest aAuthenticationRequest; if (aAnyRequest >>= aAuthenticationRequest) { handleAuthenticationRequest(aAuthenticationRequest, - rRequest->getContinuations()); + rRequest->getContinuations(), + rtl::OUString()); return true; } @@ -1345,10 +1370,12 @@ UUIInteractionHelper::handle_impl( Reference< uno::XInterface > xIfc = m_xServiceFactory->createInstance(aIt->ServiceName); - Reference< com::sun::star::task::XInteractionHandler2 > xInteractionHandler = - Reference< com::sun::star::task::XInteractionHandler2 >( xIfc, UNO_QUERY ); + Reference< task::XInteractionHandler2 > + xInteractionHandler( xIfc, UNO_QUERY ); - OSL_ENSURE( xInteractionHandler.is(), "Custom Interactionhandler does not implement mandatory interface XInteractionHandler2!" ); + OSL_ENSURE( xInteractionHandler.is(), + "Custom Interactionhandler does not implement " + "mandatory interface XInteractionHandler2!" ); if (xInteractionHandler.is()) if (xInteractionHandler->handleInteractionRequest(rRequest)) return true; @@ -1512,7 +1539,8 @@ rtl::OUString UUIInteractionHelper::getContextProperty() SAL_THROW(()) bool UUIInteractionHelper::initPasswordContainer( - star::uno::Reference< star::task::XPasswordContainer > * pContainer) + star::uno::Reference< star::task::XPasswordContainer > * pContainer, + star::uno::Reference< star::task::XUrlContainer > * pUrlContainer) const SAL_THROW(()) { OSL_ENSURE(pContainer, "specification violation"); @@ -1527,11 +1555,17 @@ UUIInteractionHelper::initPasswordContainer( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.PasswordContainer"))), star::uno::UNO_QUERY); + + if ( pContainer->is() ) + { + *pUrlContainer = star::uno::Reference< star::task::XUrlContainer >( *pContainer, UNO_QUERY ); + OSL_ENSURE( pUrlContainer->is(), "Got no XUrlContainer!" ); + } } catch (star::uno::Exception const &) {} OSL_ENSURE(pContainer->is(), "unexpected situation"); - return pContainer->is(); + return pContainer->is() && pUrlContainer->is(); } @@ -1710,6 +1744,7 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, != 0; bool bSavePassword = rInfo.GetIsPersistentPassword() || rInfo.GetIsSavePassword(); + bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials(); sal_uInt16 nFlags = 0; if (rInfo.GetPath().Len() == 0) @@ -1724,6 +1759,9 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, if (!bSavePassword) nFlags |= LF_NO_SAVEPASSWORD; + if (!bCanUseSysCreds) + nFlags |= LF_NO_USESYSCREDS; + std::auto_ptr< ResMgr > xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); UniString aRealm(rRealm); // Forte compiler needs it spelled out... @@ -1752,12 +1790,18 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, xDialog->SetSavePassword(rInfo.GetIsSavePassword()); } + if ( bCanUseSysCreds ) + xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() ); + rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); rInfo.SetUserName(xDialog->GetName()); rInfo.SetPassword(xDialog->GetPassword()); rInfo.SetAccount(xDialog->GetAccount()); rInfo.SetSavePassword(xDialog->IsSavePassword()); + + if ( bCanUseSysCreds ) + rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() ); } catch (std::bad_alloc const &) { @@ -2119,12 +2163,87 @@ UUIInteractionHelper::getInteractionHandler() const return xIH; } +namespace +{ +bool fillContinuation( + bool bUseSystemCredentials, + const star::ucb::AuthenticationRequest & rRequest, + const star::task::UrlRecord & aRec, + const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > & + xSupplyAuthentication, + const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > & + xSupplyAuthentication2, + bool bCanUseSystemCredentials, + bool bCheckForEqualPasswords ) +{ + if ( bUseSystemCredentials ) + { + // "use system creds" record found. + // Wants client that we use it? + if ( xSupplyAuthentication2.is() && + bCanUseSystemCredentials ) + { + xSupplyAuthentication2->setUseSystemCredentials( sal_True ); + return true; + } + return false; + } + else if (aRec.UserList.getLength() != 0) + { + if (aRec.UserList[0].Passwords.getLength() == 0) + { + // Password sequence can be empty, for instance if master + // password was not given (e.g. master pw dialog canceled) + // pw container does not throw NoMasterException in this case. + // bug??? + return false; + } + + // "user/pass" record found. + if (!bCheckForEqualPasswords || !rRequest.HasPassword + || rRequest.Password != aRec.UserList[0].Passwords[0]) // failed login attempt? + { + if (xSupplyAuthentication->canSetUserName()) + xSupplyAuthentication-> + setUserName(aRec.UserList[0].UserName.getStr()); + + if (xSupplyAuthentication->canSetPassword()) + xSupplyAuthentication-> + setPassword(aRec.UserList[0].Passwords[0].getStr()); + if (aRec.UserList[0].Passwords.getLength() > 1) + { + if (rRequest.HasRealm) + { + if (xSupplyAuthentication->canSetRealm()) + xSupplyAuthentication-> + setRealm(aRec.UserList[0].Passwords[1]. + getStr()); + } + else if (xSupplyAuthentication->canSetAccount()) + xSupplyAuthentication-> + setAccount(aRec.UserList[0].Passwords[1]. + getStr()); + } + + if ( xSupplyAuthentication2.is() && + bCanUseSystemCredentials ) + xSupplyAuthentication2->setUseSystemCredentials( sal_False ); + + return true; + } + } + return false; +} + +} + void UUIInteractionHelper::handleAuthenticationRequest( star::ucb::AuthenticationRequest const & rRequest, star::uno::Sequence< star::uno::Reference< star::task::XInteractionContinuation > > const & - rContinuations) + rContinuations, + const rtl::OUString & rURL) SAL_THROW((star::uno::RuntimeException)) { star::uno::Reference< star::task::XInteractionHandler > xIH; @@ -2133,9 +2252,12 @@ UUIInteractionHelper::handleAuthenticationRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > xSupplyAuthentication; + star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > + xSupplyAuthentication2; getContinuations( rContinuations, - 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0 ); + 0, 0, &xRetry, &xAbort, + &xSupplyAuthentication, &xSupplyAuthentication2, 0, 0, 0 ); bool bRemember; bool bRememberPersistent; if (xSupplyAuthentication.is()) @@ -2158,90 +2280,103 @@ UUIInteractionHelper::handleAuthenticationRequest( bRememberPersistent = false; } + sal_Bool bCanUseSystemCredentials; + sal_Bool bDefaultUseSystemCredentials; + if (xSupplyAuthentication2.is()) + { + bCanUseSystemCredentials + = xSupplyAuthentication2->canUseSystemCredentials( + bDefaultUseSystemCredentials ); + } + else + { + bCanUseSystemCredentials = sal_False; + bDefaultUseSystemCredentials = sal_False; + } + com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer > xContainer; + com::sun::star::uno::Reference< com::sun::star::task::XUrlContainer > + xUrlContainer; + + if ( bCanUseSystemCredentials && initPasswordContainer( &xContainer, &xUrlContainer ) ) + { + // Runtime / Persistent info avail for current auth request? + + rtl::OUString aResult = xUrlContainer->findUrl( + rURL.getLength() ? rURL : rRequest.ServerName ); + if ( aResult.getLength() > 0 ) + { + if ( fillContinuation( true, + rRequest, + star::task::UrlRecord(), + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + false ) ) + { + xSupplyAuthentication->select(); + return; + } + } + } // xContainer works with userName passwdSequences pairs: if (rRequest.HasUserName && rRequest.HasPassword - && initPasswordContainer(&xContainer)) + && initPasswordContainer(&xContainer, &xUrlContainer)) { xIH = getInteractionHandler(); try { if (rRequest.UserName.getLength() == 0) { - star::task::UrlRecord - aRec(xContainer->find(rRequest.ServerName, xIH)); - if (aRec.UserList.getLength() != 0) + star::task::UrlRecord aRec; + if ( rURL.getLength() ) + aRec = xContainer->find(rURL, xIH); + + if ( aRec.UserList.getLength() == 0 ) + { + // compat: try server name. + aRec = xContainer->find(rRequest.ServerName, xIH); + } + + if ( fillContinuation( false, + rRequest, + aRec, + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + false ) ) { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName(aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - xSupplyAuthentication-> - setPassword( - aRec.UserList[0].Passwords[0].getStr()); - } - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } xSupplyAuthentication->select(); return; } } else { - star::task::UrlRecord - aRec(xContainer->findForName(rRequest.ServerName, - rRequest.UserName, - xIH)); - if (aRec.UserList.getLength() != 0) + star::task::UrlRecord aRec; + if ( rURL.getLength() ) + aRec = xContainer->findForName( + rURL, rRequest.UserName, xIH); + + if ( aRec.UserList.getLength() == 0 ) { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - if (!rRequest.HasPassword - || rRequest.Password != aRec.UserList[0].Passwords[0]) - { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName( - aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - xSupplyAuthentication-> - setPassword(aRec.UserList[0].Passwords[0]. - getStr()); - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } - xSupplyAuthentication->select(); - return; - } + // compat: try server name. + aRec = xContainer->findForName( + rRequest.ServerName, rRequest.UserName, xIH); + } + + if ( fillContinuation( false, + rRequest, + aRec, + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + true ) ) + { + xSupplyAuthentication->select(); + return; } } } @@ -2261,6 +2396,8 @@ UUIInteractionHelper::handleAuthenticationRequest( aInfo.SetErrorText(rRequest.Diagnostic); aInfo.SetPersistentPassword(bRememberPersistent); aInfo.SetSavePassword(bRemember); + aInfo.SetCanUseSystemCredentials( bCanUseSystemCredentials ); + aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials ); aInfo.SetModifyAccount(rRequest.HasAccount && xSupplyAuthentication.is() && xSupplyAuthentication->canSetAccount()); @@ -2293,34 +2430,51 @@ UUIInteractionHelper::handleAuthenticationRequest( else if (xSupplyAuthentication->canSetAccount()) xSupplyAuthentication->setAccount(aInfo.GetAccount()); + if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials ) + xSupplyAuthentication2->setUseSystemCredentials( + aInfo.GetIsUseSystemCredentials() ); + xSupplyAuthentication->select(); } - // Empty user name can not be valid: - if (aInfo.GetUserName().Len() != 0 - && initPasswordContainer(&xContainer)) + + if ( aInfo.GetIsUseSystemCredentials() ) + { + if (aInfo.GetIsSavePassword()) + { + if ( initPasswordContainer(&xContainer, &xUrlContainer) ) + xUrlContainer->addUrl( + rURL.getLength() ? rURL : rRequest.ServerName, + bRememberPersistent ); + } + } + else if (aInfo.GetUserName().Len() != 0 // Empty user name can not be valid: + && initPasswordContainer(&xContainer, &xUrlContainer)) { - star::uno::Sequence< rtl::OUString > - aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2); - aPassList[0] = aInfo.GetPassword(); - if (aInfo.GetAccount().Len() != 0) - aPassList[1] = aInfo.GetAccount(); try { if (aInfo.GetIsSavePassword()) { + star::uno::Sequence< rtl::OUString > + aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2); + aPassList[0] = aInfo.GetPassword(); + if (aInfo.GetAccount().Len() != 0) + aPassList[1] = aInfo.GetAccount(); + if (!xIH.is()) xIH = getInteractionHandler(); if (bRememberPersistent) - xContainer->addPersistent(rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH); + xContainer->addPersistent( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH); else - xContainer->add(rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH); + xContainer->add( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH); } } catch (star::task::NoMasterException const &) @@ -2375,7 +2529,7 @@ UUIInteractionHelper::handleCertificateValidationRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); sal_Int32 failures = rRequest.CertificateValidity; @@ -2502,7 +2656,7 @@ UUIInteractionHelper::handleNameClashResolveRequest( xReplaceExistingData; getContinuations( rContinuations, - 0, 0, 0, &xAbort, 0, 0, &xSupplyName, &xReplaceExistingData); + 0, 0, 0, &xAbort, 0, 0, 0, &xSupplyName, &xReplaceExistingData); OSL_ENSURE( xAbort.is(), "NameClashResolveRequest must contain Abort continuation" ); @@ -2563,7 +2717,7 @@ UUIInteractionHelper::handleMasterPasswordRequest( xSupplyAuthentication; getContinuations( rContinuations, - 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0); + 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0, 0); LoginErrorInfo aInfo; // in case of master password a hash code is returned @@ -2606,7 +2760,7 @@ UUIInteractionHelper::handlePasswordRequest( star::uno::Reference< star::task::XInteractionPassword > xPassword; getContinuations( - rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0); LoginErrorInfo aInfo; executePasswordDialog(aInfo, nMode, aDocumentName); @@ -2647,7 +2801,7 @@ UUIInteractionHelper::handleMSPasswordRequest( star::uno::Reference< star::task::XInteractionPassword > xPassword; getContinuations( - rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0); LoginErrorInfo aInfo; executeMSPasswordDialog(aInfo, nMode, aDocumentName); @@ -3408,7 +3562,7 @@ UUIInteractionHelper::handleErrorRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( rContinuations, - &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0); + &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0, 0); // The following mapping uses the bit mask // Approve = 8, @@ -3526,7 +3680,7 @@ UUIInteractionHelper::handleBrokenPackageRequest( star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0); ErrCode nErrorCode; if( xApprove.is() && xDisapprove.is() ) @@ -3631,7 +3785,7 @@ UUIInteractionHelper::handleLockedDocumentRequest( star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() ) return; @@ -3709,7 +3863,7 @@ UUIInteractionHelper::handleChangedByOthersRequest( star::uno::Reference< star::task::XInteractionApprove > xApprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xAbort.is() ) return; @@ -3749,7 +3903,7 @@ UUIInteractionHelper::handleLockFileIgnoreRequest( star::uno::Reference< star::task::XInteractionApprove > xApprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xAbort.is() ) return; diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index f390e70674ea..dadac27b63a4 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -100,6 +100,7 @@ namespace com { namespace sun { namespace star { class XInteractionHandler; class XInteractionRequest; class XPasswordContainer; + class XUrlContainer; } namespace ucb { class AuthenticationRequest; @@ -181,7 +182,10 @@ private: bool initPasswordContainer(com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer > * - pContainer) + pContainer, + com::sun::star::uno::Reference< + com::sun::star::task::XUrlContainer > * + pUrlContainer) const SAL_THROW(()); com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > @@ -248,7 +252,8 @@ private: com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > const & - rContinuations) + rContinuations, + rtl::OUString const & rURL) SAL_THROW((com::sun::star::uno::RuntimeException)); void diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx index 4d58e07e37da..195dcaaf2648 100644 --- a/uui/source/logindlg.cxx +++ b/uui/source/logindlg.cxx @@ -55,6 +55,7 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) FASTBOOL bPathHide = FALSE; FASTBOOL bErrorHide = FALSE; FASTBOOL bAccountHide = FALSE; + FASTBOOL bUseSysCredsHide = FALSE; if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH ) { @@ -104,6 +105,12 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) bAccountHide = TRUE; } + if ( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) + { + aUseSysCredsCB.Hide(); + bUseSysCredsHide = TRUE; + } + if ( bErrorHide ) { long nOffset = aLoginGB.GetPosPixel().Y() - @@ -147,6 +154,9 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) aNewPnt = aSavePasswdBtn.GetPosPixel(); aNewPnt.Y() -= nOffset; aSavePasswdBtn.SetPosPixel( aNewPnt ); + aNewPnt = aUseSysCredsCB.GetPosPixel(); + aNewPnt.Y() -= nOffset; + aUseSysCredsCB.SetPosPixel( aNewPnt ); aNewPnt = aLoginGB.GetPosPixel(); aNewPnt.Y() -= nOffset; aLoginGB.SetPosPixel( aNewPnt ); @@ -174,6 +184,9 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) aTmpPnt1 = aSavePasswdBtn.GetPosPixel(); aTmpPnt1.Y() -= nOffset; aSavePasswdBtn.SetPosPixel( aTmpPnt1 ); + aTmpPnt1 = aUseSysCredsCB.GetPosPixel(); + aTmpPnt1.Y() -= nOffset; + aUseSysCredsCB.SetPosPixel( aTmpPnt1 ); Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; SetSizePixel( aNewSz ); @@ -186,6 +199,19 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) Point aTmpPnt = aSavePasswdBtn.GetPosPixel(); aTmpPnt.Y() -= nOffset; aSavePasswdBtn.SetPosPixel( aTmpPnt ); + aTmpPnt = aUseSysCredsCB.GetPosPixel(); + aTmpPnt.Y() -= nOffset; + aUseSysCredsCB.SetPosPixel( aTmpPnt ); + Size aNewSz = GetSizePixel(); + aNewSz.Height() -= nOffset; + SetSizePixel( aNewSz ); + } + + if ( bUseSysCredsHide ) + { + long nOffset = aUseSysCredsCB.GetPosPixel().Y() - + aSavePasswdBtn.GetPosPixel().Y(); + Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; SetSizePixel( aNewSz ); @@ -193,6 +219,25 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) }; // ----------------------------------------------------------------------- +void LoginDialog::EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled ) +{ + aErrorInfo.Enable( !bUseSysCredsEnabled ); + aErrorGB.Enable( !bUseSysCredsEnabled ); + aRequestInfo.Enable( !bUseSysCredsEnabled ); + aPathFT.Enable( !bUseSysCredsEnabled ); + aPathED.Enable( !bUseSysCredsEnabled ); + aPathInfo.Enable( !bUseSysCredsEnabled ); + aPathBtn.Enable( !bUseSysCredsEnabled ); + aNameFT.Enable( !bUseSysCredsEnabled ); + aNameED.Enable( !bUseSysCredsEnabled ); + aNameInfo.Enable( !bUseSysCredsEnabled ); + aPasswordFT.Enable( !bUseSysCredsEnabled ); + aPasswordED.Enable( !bUseSysCredsEnabled ); + aAccountFT.Enable( !bUseSysCredsEnabled ); + aAccountED.Enable( !bUseSysCredsEnabled ); +} + +// ----------------------------------------------------------------------- IMPL_LINK( LoginDialog, OKHdl_Impl, OKButton *, EMPTYARG ) { @@ -221,6 +266,14 @@ IMPL_LINK( LoginDialog, PathHdl_Impl, PushButton *, EMPTYARG ) // ----------------------------------------------------------------------- +IMPL_LINK( LoginDialog, UseSysCredsHdl_Impl, CheckBox *, EMPTYARG ) +{ + EnableUseSysCredsControls_Impl( aUseSysCredsCB.IsChecked() ); + return 1; +} + +// ----------------------------------------------------------------------- + LoginDialog::LoginDialog ( Window* pParent, @@ -247,6 +300,7 @@ LoginDialog::LoginDialog aAccountFT ( this, ResId( FT_LOGIN_ACCOUNT, *pResMgr ) ), aAccountED ( this, ResId( ED_LOGIN_ACCOUNT, *pResMgr ) ), aSavePasswdBtn ( this, ResId( CB_LOGIN_SAVEPASSWORD, *pResMgr ) ), + aUseSysCredsCB ( this, ResId( CB_LOGIN_USESYSCREDS, *pResMgr ) ), aLoginGB ( this, ResId( GB_LOGIN_LOGIN, *pResMgr ) ), aOKBtn ( this, ResId( BTN_LOGIN_OK, *pResMgr ) ), aCancelBtn ( this, ResId( BTN_LOGIN_CANCEL, *pResMgr ) ), @@ -261,6 +315,10 @@ LoginDialog::LoginDialog } else aRequest = aRequestInfo.GetText(); + + if ( !( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) ) + EnableUseSysCredsControls_Impl( aUseSysCredsCB.IsChecked() ); + aRequest.SearchAndReplaceAscii("%1", rServer); aRequestInfo.SetText(aRequest); @@ -271,6 +329,7 @@ LoginDialog::LoginDialog aOKBtn.SetClickHdl( LINK( this, LoginDialog, OKHdl_Impl ) ); aPathBtn.SetClickHdl( LINK( this, LoginDialog, PathHdl_Impl ) ); + aUseSysCredsCB.SetClickHdl( LINK( this, LoginDialog, UseSysCredsHdl_Impl ) ); HideControls_Impl( nFlags ); }; @@ -285,6 +344,17 @@ void LoginDialog::SetName( const String& rNewName ) // ----------------------------------------------------------------------- +void LoginDialog::SetUseSystemCredentials( BOOL bUse ) +{ + if ( aUseSysCredsCB.IsVisible() ) + { + aUseSysCredsCB.Check( bUse ); + EnableUseSysCredsControls_Impl( bUse ); + } +} + +// ----------------------------------------------------------------------- + void LoginDialog::ClearPassword() { aPasswordED.SetText( String() ); diff --git a/uui/source/logindlg.hrc b/uui/source/logindlg.hrc index 20b5a5c86d46..a9c1ff853d85 100644 --- a/uui/source/logindlg.hrc +++ b/uui/source/logindlg.hrc @@ -50,6 +50,7 @@ #define ED_LOGIN_ACCOUNT 31 #define CB_LOGIN_SAVEPASSWORD 32 #define GB_LOGIN_LOGIN 33 +#define CB_LOGIN_USESYSCREDS 34 #define BTN_LOGIN_OK 50 #define BTN_LOGIN_CANCEL 51 diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx index a6e92797d26f..c88bc7a93aad 100644 --- a/uui/source/logindlg.hxx +++ b/uui/source/logindlg.hxx @@ -48,6 +48,7 @@ #define LF_PATH_READONLY 0x0020 // "path" readonly #define LF_USERNAME_READONLY 0x0040 // "name" readonly #define LF_NO_ACCOUNT 0x0080 // hide "account" +#define LF_NO_USESYSCREDS 0x0100 // hide "use system cedentials" //............................................................................ //............................................................................ @@ -70,15 +71,18 @@ class LoginDialog : public ModalDialog FixedText aAccountFT; Edit aAccountED; CheckBox aSavePasswdBtn; + CheckBox aUseSysCredsCB; FixedLine aLoginGB; OKButton aOKBtn; CancelButton aCancelBtn; HelpButton aHelpBtn; void HideControls_Impl( USHORT nFlags ); + void EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled ); DECL_LINK( OKHdl_Impl, OKButton * ); DECL_LINK( PathHdl_Impl, PushButton * ); + DECL_LINK( UseSysCredsHdl_Impl, CheckBox * ); public: LoginDialog( Window* pParent, USHORT nFlags, @@ -103,6 +107,9 @@ public: { aSavePasswdBtn.Check( bSave ); } void SetSavePasswordText( const String& rTxt ) { aSavePasswdBtn.SetText( rTxt ); } + BOOL IsUseSystemCredentials() const + { return aUseSysCredsCB.IsChecked(); } + void SetUseSystemCredentials( BOOL bUse ); void SetErrorText( const String& rTxt ) { aErrorInfo.SetText( rTxt ); } void SetLoginRequestText( const String& rTxt ) diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src index 39b98ffea1a4..7450a389e7e5 100644 --- a/uui/source/logindlg.src +++ b/uui/source/logindlg.src @@ -45,7 +45,7 @@ ModalDialog DLG_UUI_LOGIN Moveable = TRUE ; OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 265 , 158 ) ; + Size = MAP_APPFONT ( 265 , 170 ) ; FixedText INFO_LOGIN_ERROR { Pos = MAP_APPFONT ( 12 , 14 ) ; @@ -139,6 +139,12 @@ ModalDialog DLG_UUI_LOGIN Size = MAP_APPFONT ( 185 , 10 ) ; Text [ en-US ] = "~Save password" ; }; + CheckBox CB_LOGIN_USESYSCREDS + { + Pos = MAP_APPFONT ( 12 , 148 ) ; + Size = MAP_APPFONT ( 185 , 10 ) ; + Text [ en-US ] = "~Use System Credentials" ; + }; FixedLine GB_LOGIN_LOGIN { Pos = MAP_APPFONT ( 7 , 44 ) ; |