summaryrefslogtreecommitdiff
path: root/mobile_src/Messaging/MailRemover.h
diff options
context:
space:
mode:
Diffstat (limited to 'mobile_src/Messaging/MailRemover.h')
-rwxr-xr-xmobile_src/Messaging/MailRemover.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/mobile_src/Messaging/MailRemover.h b/mobile_src/Messaging/MailRemover.h
new file mode 100755
index 0000000..359420f
--- /dev/null
+++ b/mobile_src/Messaging/MailRemover.h
@@ -0,0 +1,73 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef MAILREMOVE_H_
+#define MAILREMOVE_H_
+
+#include <map>
+#include <dpl/event/event_listener.h>
+#include <dpl/thread.h>
+#include <dpl/scoped_ptr.h>
+#include "DBus/Connection.h"
+#include "DBus/MessageEvent.h"
+#include "IEmail.h"
+
+namespace DeviceAPI {
+namespace Messaging {
+
+// TODO Not thread-safe, make it.
+class MailRemover : private DPL::Event::EventListener<DBus::MessageEvent>
+{
+ public:
+ static MailRemover& getInstance();
+
+ public:
+ int removeCheck(const int accountId, const IEmailPtr& mail);
+
+ protected:
+ void OnEventReceived(const DBus::MessageEvent& event);
+
+ private:
+
+ struct RemoveRequestData
+ {
+ int accountId;
+ IEmailPtr mail;
+
+ explicit RemoveRequestData(const int accountId, const IEmailPtr& mail) :
+ accountId(accountId),
+ mail(mail)
+ {
+ }
+ };
+
+ typedef std::map<int, RemoveRequestData> RemoveRequests;
+ typedef RemoveRequests::iterator RemoveRequestsIterator;
+
+
+ private:
+ MailRemover();
+ ~MailRemover();
+
+ DPL::ScopedPtr<DPL::Thread> m_dbusThread;
+ DBus::ConnectionPtr m_dbus;
+ RemoveRequests m_requests;
+};
+}
+}
+#endif // MAILREMOVE_H_
+