1 | /* |
---|
2 | * AbstractAccount.h |
---|
3 | * |
---|
4 | * Created on: Jul 9, 2009 |
---|
5 | * Author: saemy |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef ABSTRACTLOGINACCOUNT_H_ |
---|
9 | #define ABSTRACTLOGINACCOUNT_H_ |
---|
10 | |
---|
11 | #include "abstractaccount.h" |
---|
12 | |
---|
13 | #include "abstractlogingateway.h" |
---|
14 | |
---|
15 | #include "eventmappers/sloginaccounteventmapper.h" |
---|
16 | |
---|
17 | namespace LoginAccount { |
---|
18 | class Status: public Account::Status { |
---|
19 | public: |
---|
20 | static const QString Login; |
---|
21 | static const QString Logout; |
---|
22 | }; |
---|
23 | } |
---|
24 | |
---|
25 | class AbstractLoginAccount: public AbstractAccount { |
---|
26 | Q_OBJECT |
---|
27 | |
---|
28 | public: |
---|
29 | AbstractLoginAccount(IStorageOfficer* storageOfficer, IValidator* validator); |
---|
30 | |
---|
31 | virtual AbstractLoginGateway* gateway() const =0; |
---|
32 | |
---|
33 | QString username() const; |
---|
34 | void setUsername(const QString& username); |
---|
35 | |
---|
36 | QString password() const; |
---|
37 | void setPassword(const QString& password); |
---|
38 | |
---|
39 | bool isLoggedIn(); |
---|
40 | void login(); |
---|
41 | void logout(bool FORCE = false); |
---|
42 | |
---|
43 | virtual SLoginAccountEventMapper* eventMapper() const; |
---|
44 | |
---|
45 | protected: |
---|
46 | virtual void setLoggedIn(bool newLoggedIn); |
---|
47 | |
---|
48 | virtual void doLogin() =0; |
---|
49 | virtual void doLogout() =0; |
---|
50 | virtual bool stillLoggedIn() =0; |
---|
51 | |
---|
52 | virtual ILoginAccountEvents* accountEvents() const; |
---|
53 | |
---|
54 | private: |
---|
55 | SLoginAccountEventMapper* eventMapper_; |
---|
56 | |
---|
57 | QString username_; |
---|
58 | QString password_; |
---|
59 | |
---|
60 | bool loggedIn_; |
---|
61 | }; |
---|
62 | |
---|
63 | #endif /* ABSTRACTLOGINACCOUNT_H_ */ |
---|