email_plat/nmail_client_api/nmapimessagetask.h
changeset 18 578830873419
child 23 2dc6caa42ec3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/email_plat/nmail_client_api/nmapimessagetask.h	Fri Apr 16 14:51:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef NMAPIMESSAGETASK_H_
+#define NMAPIMESSAGETASK_H_
+
+#include <QObject>
+
+#include "nmenginedef.h"
+
+/**
+ * base class for async tasks
+ */
+class NMENGINE_EXPORT NmMessageTask : public QObject
+{
+    Q_OBJECT
+protected:
+    NmMessageTask( QObject *parent );
+
+public:
+    virtual ~NmMessageTask();
+
+public slots:
+    /*!
+     * Starts task and returns true if starting succeeded.
+     */
+    virtual bool start()=0;
+
+    /*!
+     * Cancels started but not yet completed task. may not be applicable
+     * in all tasks.
+     */
+    virtual void cancel() =0;
+
+    signals:
+    /*!
+     * task failed, error code is specific to concrete task
+     */
+    void failed(int error);
+    /*!
+     * task canceled
+     */
+    void canceled();
+};
+
+#endif /* NMMESSAGETASK_H_ */