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