/src/libreoffice/uui/source/loginerr.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 <rtl/ustring.hxx> |
23 | | #include <vcl/errinf.hxx> |
24 | | |
25 | 0 | #define LOGINERROR_FLAG_MODIFY_ACCOUNT 1 |
26 | 0 | #define LOGINERROR_FLAG_MODIFY_USER_NAME 2 |
27 | 0 | #define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4 |
28 | 0 | #define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8 |
29 | 0 | #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 |
30 | 0 | #define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 |
31 | 0 | #define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64 |
32 | | |
33 | | class LoginErrorInfo |
34 | | { |
35 | | private: |
36 | | OUString m_aServer; |
37 | | OUString m_aAccount; |
38 | | OUString m_aUserName; |
39 | | OUString m_aPassword; |
40 | | OUString m_aPasswordToModify; |
41 | | OUString m_aErrorText; |
42 | | sal_uInt8 m_nFlags; |
43 | | DialogMask m_nRet; |
44 | | bool m_bRecommendToOpenReadonly; |
45 | | |
46 | | public: |
47 | | LoginErrorInfo() |
48 | 0 | : m_nFlags(LOGINERROR_FLAG_MODIFY_USER_NAME) |
49 | 0 | , m_nRet(DialogMask::ButtonsCancel) |
50 | 0 | , m_bRecommendToOpenReadonly(false) |
51 | 0 | { |
52 | 0 | } |
53 | | |
54 | 0 | const OUString& GetServer() const { return m_aServer; } |
55 | 0 | const OUString& GetAccount() const { return m_aAccount; } |
56 | 0 | const OUString& GetUserName() const { return m_aUserName; } |
57 | 0 | const OUString& GetPassword() const { return m_aPassword; } |
58 | 0 | const OUString& GetPasswordToModify() const { return m_aPasswordToModify; } |
59 | 0 | bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; } |
60 | 0 | const OUString& GetErrorText() const { return m_aErrorText; } |
61 | 0 | bool GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); } |
62 | 0 | bool GetIsRememberPersistent() const { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); } |
63 | 0 | bool GetIsRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); } |
64 | | |
65 | | bool GetCanUseSystemCredentials() const |
66 | 0 | { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); } |
67 | | bool GetIsUseSystemCredentials() const |
68 | 0 | { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) == |
69 | 0 | LOGINERROR_FLAG_IS_USE_SYSCREDS; } |
70 | 0 | sal_uInt8 GetFlags() const { return m_nFlags; } |
71 | 0 | DialogMask GetResult() const { return m_nRet; } |
72 | | |
73 | | void SetServer( const OUString& aServer ) |
74 | 0 | { m_aServer = aServer; } |
75 | | void SetAccount( const OUString& aAccount ) |
76 | 0 | { m_aAccount = aAccount; } |
77 | | void SetUserName( const OUString& aUserName ) |
78 | 0 | { m_aUserName = aUserName; } |
79 | | void SetPassword( const OUString& aPassword ) |
80 | 0 | { m_aPassword = aPassword; } |
81 | | void SetPasswordToModify( const OUString& aPassword ) |
82 | 0 | { m_aPasswordToModify = aPassword; } |
83 | | void SetRecommendToOpenReadonly( bool bVal ) |
84 | 0 | { m_bRecommendToOpenReadonly = bVal; } |
85 | | void SetErrorText( const OUString& aErrorText ) |
86 | 0 | { m_aErrorText = aErrorText; } |
87 | | |
88 | | inline void SetCanRememberPassword( bool bSet ); |
89 | | inline void SetIsRememberPassword( bool bSet ); |
90 | | inline void SetIsRememberPersistent( bool bSet ); |
91 | | |
92 | | inline void SetCanUseSystemCredentials( bool bSet ); |
93 | | inline void SetIsUseSystemCredentials( bool bSet ); |
94 | | inline void SetModifyAccount( bool bSet ); |
95 | | inline void SetModifyUserName( bool bSet ); |
96 | | |
97 | | void SetResult( DialogMask nRet ) |
98 | 0 | { m_nRet = nRet; } |
99 | | }; |
100 | | |
101 | | inline void LoginErrorInfo::SetCanRememberPassword( bool bSet ) |
102 | 0 | { |
103 | 0 | if ( bSet ) |
104 | 0 | m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; |
105 | 0 | else |
106 | 0 | m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; |
107 | 0 | } |
108 | | |
109 | | inline void LoginErrorInfo::SetIsRememberPassword( bool bSet ) |
110 | 0 | { |
111 | 0 | if ( bSet ) |
112 | 0 | m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; |
113 | 0 | else |
114 | 0 | m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; |
115 | 0 | } |
116 | | |
117 | | inline void LoginErrorInfo::SetIsRememberPersistent( bool bSet ) |
118 | 0 | { |
119 | 0 | if ( bSet ) |
120 | 0 | m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT; |
121 | 0 | else |
122 | 0 | m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT; |
123 | 0 | } |
124 | | |
125 | | inline void LoginErrorInfo::SetCanUseSystemCredentials( bool bSet ) |
126 | 0 | { |
127 | 0 | if ( bSet ) |
128 | 0 | m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS; |
129 | 0 | else |
130 | 0 | m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS; |
131 | 0 | } |
132 | | |
133 | | inline void LoginErrorInfo::SetIsUseSystemCredentials( bool bSet ) |
134 | 0 | { |
135 | 0 | if ( bSet ) |
136 | 0 | m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS; |
137 | 0 | else |
138 | 0 | m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS; |
139 | 0 | } |
140 | | |
141 | | inline void LoginErrorInfo::SetModifyAccount( bool bSet ) |
142 | 0 | { |
143 | 0 | if ( bSet ) |
144 | 0 | m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; |
145 | 0 | else |
146 | 0 | m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; |
147 | 0 | } |
148 | | |
149 | | inline void LoginErrorInfo::SetModifyUserName( bool bSet ) |
150 | 0 | { |
151 | 0 | if ( bSet ) |
152 | 0 | m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; |
153 | 0 | else |
154 | 0 | m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; |
155 | 0 | } |
156 | | |
157 | | |
158 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |