convert LF constants to o3tl::typed_flags
Change-Id: I4fa3a62e53eb02fe60c9ca0675709b76e56a7912
This commit is contained in:
@@ -72,21 +72,21 @@ executeLoginDialog(
|
||||
bool bSavePassword = rInfo.GetCanRememberPassword();
|
||||
bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
|
||||
|
||||
sal_uInt16 nFlags = 0;
|
||||
LoginFlags nFlags = LoginFlags::NONE;
|
||||
if (rInfo.GetPath().isEmpty())
|
||||
nFlags |= LF_NO_PATH;
|
||||
nFlags |= LoginFlags::NoPath;
|
||||
if (rInfo.GetErrorText().isEmpty())
|
||||
nFlags |= LF_NO_ERRORTEXT;
|
||||
nFlags |= LoginFlags::NoErrorText;
|
||||
if (!bAccount)
|
||||
nFlags |= LF_NO_ACCOUNT;
|
||||
nFlags |= LoginFlags::NoAccount;
|
||||
if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
|
||||
nFlags |= LF_USERNAME_READONLY;
|
||||
nFlags |= LoginFlags::UsernameReadonly;
|
||||
|
||||
if (!bSavePassword)
|
||||
nFlags |= LF_NO_SAVEPASSWORD;
|
||||
nFlags |= LoginFlags::NoSavePassword;
|
||||
|
||||
if (!bCanUseSysCreds)
|
||||
nFlags |= LF_NO_USESYSCREDS;
|
||||
nFlags |= LoginFlags::NoUseSysCreds;
|
||||
|
||||
ScopedVclPtrInstance< LoginDialog > xDialog(pParent, nFlags, rInfo.GetServer(), rRealm);
|
||||
if (!rInfo.GetErrorText().isEmpty())
|
||||
|
@@ -67,52 +67,52 @@ void LoginDialog::SetPassword( const OUString& rNew )
|
||||
SetRequest();
|
||||
}
|
||||
|
||||
void LoginDialog::HideControls_Impl( sal_uInt16 nFlags )
|
||||
void LoginDialog::HideControls_Impl( LoginFlags nFlags )
|
||||
{
|
||||
if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH )
|
||||
if ( nFlags & LoginFlags::NoPath )
|
||||
{
|
||||
m_pPathFT->Hide();
|
||||
m_pPathED->Hide();
|
||||
m_pPathBtn->Hide();
|
||||
}
|
||||
else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY )
|
||||
else if ( nFlags & LoginFlags::PathReadonly )
|
||||
{
|
||||
m_pPathED->Enable( false );
|
||||
m_pPathBtn->Enable( false );
|
||||
}
|
||||
|
||||
if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME )
|
||||
if ( nFlags & LoginFlags::NoUsername )
|
||||
{
|
||||
m_pNameFT->Hide();
|
||||
m_pNameED->Hide();
|
||||
}
|
||||
else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY )
|
||||
else if ( nFlags & LoginFlags::UsernameReadonly )
|
||||
{
|
||||
m_pNameED->Enable( false );
|
||||
}
|
||||
|
||||
if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD )
|
||||
if ( nFlags & LoginFlags::NoPassword )
|
||||
{
|
||||
m_pPasswordFT->Hide();
|
||||
m_pPasswordED->Hide();
|
||||
}
|
||||
|
||||
if ( ( nFlags & LF_NO_SAVEPASSWORD ) == LF_NO_SAVEPASSWORD )
|
||||
if ( nFlags & LoginFlags::NoSavePassword )
|
||||
m_pSavePasswdBtn->Hide();
|
||||
|
||||
if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT )
|
||||
if ( nFlags & LoginFlags::NoErrorText )
|
||||
{
|
||||
m_pErrorInfo->Hide();
|
||||
m_pErrorFT->Hide();
|
||||
}
|
||||
|
||||
if ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT )
|
||||
if ( nFlags & LoginFlags::NoAccount )
|
||||
{
|
||||
m_pAccountFT->Hide();
|
||||
m_pAccountED->Hide();
|
||||
}
|
||||
|
||||
if ( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS )
|
||||
if ( nFlags & LoginFlags::NoUseSysCreds )
|
||||
{
|
||||
m_pUseSysCredsCB->Hide();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ IMPL_LINK_NOARG(LoginDialog, UseSysCredsHdl_Impl, Button*, void)
|
||||
EnableUseSysCredsControls_Impl( m_pUseSysCredsCB->IsChecked() );
|
||||
}
|
||||
|
||||
LoginDialog::LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags,
|
||||
LoginDialog::LoginDialog(vcl::Window* pParent, LoginFlags nFlags,
|
||||
const OUString& rServer, const OUString& rRealm)
|
||||
: ModalDialog(pParent, "LoginDialog", "uui/ui/logindialog.ui"),
|
||||
m_server(rServer), m_realm(rRealm)
|
||||
@@ -207,7 +207,7 @@ LoginDialog::LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags,
|
||||
get(m_pUseSysCredsCB, "syscreds");
|
||||
get(m_pOKBtn, "ok");
|
||||
|
||||
if ( !( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) )
|
||||
if ( !( nFlags & LoginFlags::NoUseSysCreds ) )
|
||||
EnableUseSysCredsControls_Impl( m_pUseSysCredsCB->IsChecked() );
|
||||
|
||||
SetRequest();
|
||||
|
@@ -24,17 +24,24 @@
|
||||
#include <vcl/dialog.hxx>
|
||||
#include <vcl/edit.hxx>
|
||||
#include <vcl/fixed.hxx>
|
||||
#include <o3tl/typed_flags_set.hxx>
|
||||
|
||||
|
||||
#define LF_NO_PATH 0x0001 // hide "path"
|
||||
#define LF_NO_USERNAME 0x0002 // hide "name"
|
||||
#define LF_NO_PASSWORD 0x0004 // hide "password"
|
||||
#define LF_NO_SAVEPASSWORD 0x0008 // hide "save password"
|
||||
#define LF_NO_ERRORTEXT 0x0010 // hide message
|
||||
#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 credentials"
|
||||
enum class LoginFlags {
|
||||
NONE = 0x0000,
|
||||
NoPath = 0x0001, // hide "path"
|
||||
NoUsername = 0x0002, // hide "name"
|
||||
NoPassword = 0x0004, // hide "password"
|
||||
NoSavePassword = 0x0008, // hide "save password"
|
||||
NoErrorText = 0x0010, // hide message
|
||||
PathReadonly = 0x0020, // "path" readonly
|
||||
UsernameReadonly = 0x0040, // "name" readonly
|
||||
NoAccount = 0x0080, // hide "account"
|
||||
NoUseSysCreds = 0x0100, // hide "use system credentials"
|
||||
};
|
||||
namespace o3tl {
|
||||
template<> struct typed_flags<LoginFlags> : is_typed_flags<LoginFlags, 0x01ff> {};
|
||||
}
|
||||
|
||||
|
||||
class LoginDialog : public ModalDialog
|
||||
@@ -57,7 +64,7 @@ class LoginDialog : public ModalDialog
|
||||
OUString m_server;
|
||||
OUString m_realm;
|
||||
|
||||
void HideControls_Impl( sal_uInt16 nFlags );
|
||||
void HideControls_Impl( LoginFlags nFlags );
|
||||
void EnableUseSysCredsControls_Impl( bool bUseSysCredsEnabled );
|
||||
void SetRequest();
|
||||
|
||||
@@ -66,7 +73,7 @@ class LoginDialog : public ModalDialog
|
||||
DECL_LINK(UseSysCredsHdl_Impl, Button*, void);
|
||||
|
||||
public:
|
||||
LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags,
|
||||
LoginDialog(vcl::Window* pParent, LoginFlags nFlags,
|
||||
const OUString& rServer, const OUString &rRealm);
|
||||
virtual ~LoginDialog() override;
|
||||
virtual void dispose() override;
|
||||
|
Reference in New Issue
Block a user