tdf#108518 partial revert tdf#64222 sw: better DOCX im/export
[LibreOffice.git] / uui / source / logindlg.hxx
blobff799f4501ff65e159ad6f915daeee328201421f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UUI_SOURCE_LOGINDLG_HXX
21 #define INCLUDED_UUI_SOURCE_LOGINDLG_HXX
23 #include <vcl/weld.hxx>
24 #include <o3tl/typed_flags_set.hxx>
27 enum class LoginFlags {
28 NONE = 0x0000,
29 NoSavePassword = 0x0008, // hide "save password"
30 NoErrorText = 0x0010, // hide message
31 UsernameReadonly = 0x0040, // "name" readonly
32 NoAccount = 0x0080, // hide "account"
33 NoUseSysCreds = 0x0100, // hide "use system credentials"
35 namespace o3tl {
36 template<> struct typed_flags<LoginFlags> : is_typed_flags<LoginFlags, 0x01d8> {};
40 class LoginDialog : public weld::GenericDialogController
42 std::unique_ptr<weld::Label> m_xErrorFT;
43 std::unique_ptr<weld::Label> m_xErrorInfo;
44 std::unique_ptr<weld::Label> m_xRequestInfo;
45 std::unique_ptr<weld::Label> m_xNameFT;
46 std::unique_ptr<weld::Entry> m_xNameED;
47 std::unique_ptr<weld::Label> m_xPasswordFT;
48 std::unique_ptr<weld::Entry> m_xPasswordED;
49 std::unique_ptr<weld::Label> m_xAccountFT;
50 std::unique_ptr<weld::Entry> m_xAccountED;
51 std::unique_ptr<weld::CheckButton> m_xSavePasswdBtn;
52 std::unique_ptr<weld::CheckButton> m_xUseSysCredsCB;
53 std::unique_ptr<weld::Button> m_xOKBtn;
54 OUString m_server;
55 OUString m_realm;
57 void HideControls_Impl( LoginFlags nFlags );
58 void EnableUseSysCredsControls_Impl( bool bUseSysCredsEnabled );
59 void SetRequest();
61 DECL_LINK(OKHdl_Impl, weld::Button&, void);
62 DECL_LINK(UseSysCredsHdl_Impl, weld::Button&, void);
64 public:
65 LoginDialog(weld::Window* pParent, LoginFlags nFlags,
66 const OUString& rServer, const OUString &rRealm);
67 virtual ~LoginDialog() override;
69 OUString GetName() const { return m_xNameED->get_text(); }
70 void SetName( const OUString& rNewName ) { m_xNameED->set_text( rNewName ); }
71 OUString GetPassword() const { return m_xPasswordED->get_text(); }
72 void SetPassword( const OUString& rNew );
73 OUString GetAccount() const { return m_xAccountED->get_text(); }
74 bool IsSavePassword() const { return m_xSavePasswdBtn->get_active(); }
75 void SetSavePassword( bool bSave ) { m_xSavePasswdBtn->set_active( bSave ); }
76 void SetSavePasswordText( const OUString& rTxt ) { m_xSavePasswdBtn->set_label( rTxt ); }
77 bool IsUseSystemCredentials() const { return m_xUseSysCredsCB->get_active(); }
78 void SetUseSystemCredentials( bool bUse );
79 void SetErrorText( const OUString& rTxt ) { m_xErrorInfo->set_label( rTxt ); }
80 void ClearPassword();
81 void ClearAccount();
85 #endif // INCLUDED_UUI_SOURCE_LOGINDLG_HXX
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */