33d8bf3cf9d6c28306f6a9a3427b7086094619ac
[framework/web/wrt-plugins-common.git] / src / modules / tizen / Messaging / MailNotifier.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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  * @file   MailNotifier.h
18  * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
19  */
20
21 #ifndef SRC_MODULES_TIZEN_MESSAGING_MAILNOTIFIER_H_
22 #define SRC_MODULES_TIZEN_MESSAGING_MAILNOTIFIER_H_
23
24 #include <dpl/thread.h>
25 #include <dpl/generic_event.h>
26 #include <dpl/event/event_support.h>
27 #include <dpl/event/event_listener.h>
28 #include <API/Messaging/IMessage.h>
29 #include <DBus/Connection.h>
30 #include <DBus/Message.h>
31 #include <DBus/MessageEvent.h>
32
33 namespace WrtDeviceApis {
34 namespace Messaging {
35
36 DECLARE_GENERIC_EVENT_1(EmailReceivedEvent, int);
37
38 class MailNotifier : public DPL::Event::EventSupport<EmailReceivedEvent>,
39                      private DPL::Event::EventListener<DBus::MessageEvent>
40 {
41 public:
42     MailNotifier();
43     virtual ~MailNotifier();
44
45     void setWorkerThread(DPL::Thread* thread);
46
47 protected:
48     virtual void OnEventReceived(const DBus::MessageEvent& event);
49
50     virtual void onStorageChange(const DBus::MessagePtr& message);
51
52 private:
53     DBus::ConnectionPtr m_connection;
54     std::vector<int> m_incomming;
55 };
56
57 }
58 }
59
60 #endif