fix to prevent multiple launch appcontrol.
[apps/osp/Account.git] / inc / AccAccountPresentationModel.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                AccAccountPresentationModel.h
19  * @brief               This is the header file for AccountPresentationModel class.
20  */
21
22 #ifndef _ACC_ACCOUNT_PRESENTATION_MODEL_H_
23 #define _ACC_ACCOUNT_PRESENTATION_MODEL_H_
24
25 #include <FApp.h>
26 #include <FBase.h>
27 #include <FGraphics.h>
28 #include <FSocial.h>
29 #include "AccTypes.h"
30 #include "AccIAccountPresentationModelListener.h"
31
32 class AccountPresentationModel
33         : Tizen::Social::IAccountEventListener
34 {
35 public:
36         AccountPresentationModel();
37         virtual ~AccountPresentationModel();
38         result AddAccountChangedEventListener(IAccountPresentationModelListener& listener);
39         result RemoveAccountChangedEventListener(IAccountPresentationModelListener& listener);
40         int GetAccountCount(void) const;
41         int GetAccountProviderCount(void) const;
42         Tizen::Base::String GetAccountInfo(AccountInfoType type, int index) const;
43         Tizen::Base::String GetAccountProviderName(int index) const;
44         Tizen::Graphics::Bitmap* GetAccountIconN(int index) const;
45         Tizen::Graphics::Bitmap* GetAccountProviderIconN(int index) const;
46         Tizen::App::AppId GetAccountAppId(int index) const;
47         Tizen::App::AppId GetAccountProviderAppId(int index) const;
48         Tizen::Social::AccountId GetAccountId(int index) const;
49
50         // Todo: TBD
51         void SetRunningAccountProviderAppId(const Tizen::App::AppId& appId);
52         Tizen::App::AppId GetRunningAccountProviderAppId(void) const;
53
54         virtual void OnAccountAdded(Tizen::Social::AccountId accountId);
55         virtual void OnAccountRemoved(Tizen::Social::AccountId accountId);
56         virtual void OnAccountUpdated(Tizen::Social::AccountId accountId);
57
58         static AccountPresentationModel* GetInstance(void);
59 private:
60         result Construct(void);
61         void FireAccountChangedEvent(void);
62         Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& path) const;
63 //      Tizen::Base::String ParseCapability(const Tizen::Base::Collection::IList& capabilityList);
64
65         static void CreateInstance(void);
66         static void DestroyInstance(void);
67 private:
68         static AccountPresentationModel* __pInstance;
69         Tizen::Base::Collection::ArrayList* __pAccountList;
70         Tizen::Base::Collection::ArrayList* __pAccountProviderList;
71         Tizen::Base::Collection::LinkedList __accountListeners;
72         Tizen::App::AppId __runningAccountProviderAppId;
73 };
74
75 #endif /* _ACC_ACCOUNT_PRESENTATION_MODEL_H_ */