Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/uui/source/logindlg.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
20
#pragma once
21
22
#include <vcl/weld/DialogController.hxx>
23
#include <vcl/weld/Entry.hxx>
24
#include <vcl/weld/weld.hxx>
25
#include <o3tl/typed_flags_set.hxx>
26
27
28
enum class LoginFlags {
29
    NONE                = 0x0000,
30
    NoSavePassword      = 0x0008,  // hide "save password"
31
    NoErrorText         = 0x0010,  // hide message
32
    UsernameReadonly    = 0x0040,  // "name" readonly
33
    NoAccount           = 0x0080,  // hide "account"
34
    NoUseSysCreds       = 0x0100,  // hide "use system credentials"
35
};
36
namespace o3tl {
37
    template<> struct typed_flags<LoginFlags> : is_typed_flags<LoginFlags, 0x01d8> {};
38
}
39
40
41
class LoginDialog : public weld::GenericDialogController
42
{
43
    std::unique_ptr<weld::Label> m_xErrorFT;
44
    std::unique_ptr<weld::Label> m_xErrorInfo;
45
    std::unique_ptr<weld::Label> m_xRequestInfo;
46
    std::unique_ptr<weld::Label> m_xNameFT;
47
    std::unique_ptr<weld::Entry> m_xNameED;
48
    std::unique_ptr<weld::Label> m_xPasswordFT;
49
    std::unique_ptr<weld::Entry> m_xPasswordED;
50
    std::unique_ptr<weld::Label> m_xAccountFT;
51
    std::unique_ptr<weld::Entry> m_xAccountED;
52
    std::unique_ptr<weld::CheckButton> m_xSavePasswdBtn;
53
    std::unique_ptr<weld::CheckButton> m_xUseSysCredsCB;
54
    std::unique_ptr<weld::Button> m_xOKBtn;
55
    OUString m_server;
56
    OUString m_realm;
57
58
    void            HideControls_Impl( LoginFlags nFlags );
59
    void            EnableUseSysCredsControls_Impl( bool bUseSysCredsEnabled );
60
    void            SetRequest();
61
62
    DECL_LINK(OKHdl_Impl, weld::Button&, void);
63
    DECL_LINK(UseSysCredsHdl_Impl, weld::Toggleable&, void);
64
65
public:
66
    LoginDialog(weld::Window* pParent, LoginFlags nFlags,
67
        OUString aServer, OUString aRealm);
68
    virtual ~LoginDialog() override;
69
70
0
    OUString        GetName() const                             { return m_xNameED->get_text(); }
71
0
    void            SetName( const OUString& rNewName )           { m_xNameED->set_text( rNewName ); }
72
0
    OUString        GetPassword() const                         { return m_xPasswordED->get_text(); }
73
    void            SetPassword( const OUString& rNew );
74
0
    OUString        GetAccount() const                          { return m_xAccountED->get_text(); }
75
0
    bool            IsSavePassword() const                      { return m_xSavePasswdBtn->get_active(); }
76
0
    void            SetSavePassword( bool bSave )               { m_xSavePasswdBtn->set_active( bSave ); }
77
0
    void            SetSavePasswordText( const OUString& rTxt )   { m_xSavePasswdBtn->set_label( rTxt ); }
78
0
    bool            IsUseSystemCredentials() const              { return m_xUseSysCredsCB->get_active(); }
79
    void            SetUseSystemCredentials( bool bUse );
80
0
    void            SetErrorText( const OUString& rTxt )          { m_xErrorInfo->set_label( rTxt ); }
81
    void            ClearPassword();
82
    void            ClearAccount();
83
};
84
85
86
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */