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