messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator.h
changeset 31 ebfee66fde93
child 47 5b14749788d7
child 70 a15d9966050f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator.h	Fri Jun 04 10:25:39 2010 +0100
@@ -0,0 +1,162 @@
+/*
+ * 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: Message Indicator class
+ *
+ */
+
+#ifndef MSGINDICATOR_H
+#define MSGINDICATOR_H
+
+#include <QObject>
+#include <QRunnable>
+#include <hbindicatorinterface.h>
+
+#include "msginfodefs.h"
+class MsgIndicatorPrivate;
+
+class ServiceRequestSenderTask : public QRunnable
+{
+public:
+    /**
+     * Constructor
+     */
+    ServiceRequestSenderTask(qint64 conversationId);
+    
+    /**
+     * Destructor
+     */
+    ~ServiceRequestSenderTask();
+     
+    /**
+     * create and send service request
+     */
+     void run();
+
+private: 
+     qint64 mConvId;
+};
+
+/**
+ * Message indicator class. 
+ * Handles client request and showing the indications. 
+ */
+class MsgIndicator : public HbIndicatorInterface
+{
+public:
+    /**
+     * Constructor
+     */
+    MsgIndicator(const QString &indicatorType);
+    
+    /**
+     * Destructor
+     */
+    ~MsgIndicator();
+    
+    /**
+     * @see HbIndicatorInterface
+     */
+    bool handleInteraction(InteractionType type);
+    
+    /**
+     * @see HbIndicatorInterface
+     */
+    QVariant indicatorData(int role) const;
+
+    
+protected:
+    /**
+     * @see HbIndicatorInterface
+     */
+    bool handleClientRequest(RequestType type, const QVariant &parameter);
+    
+private: 
+    /**
+     * Prepares the display name from stream.
+     * @param IindicatorData inidcator data.
+     */
+    QString prepareDisplayName(MsgInfo& indicatorData) const;
+    
+    /**
+     * Gets the primary text for an indicator type
+     * @param data MsgInfo the message information.
+     * @return QString the primary text
+     */
+    QString getPrimaryText(MsgInfo& data);
+
+    /**
+     * Gets the primary text for unread messages
+     * @param data MsgInfo the message information.
+     */
+    QString getUnreadPrimaryText(MsgInfo& data);
+    
+    /**
+     * Get the secondary Text for messages.
+     * @param type The type of the indicator
+     * @return QString the secondary text
+     */
+    QString getSecondaryText(MsgInfo& info);
+
+private:
+    
+    /**
+     * Body text
+     */
+    mutable QString mBodyText;
+    
+    /**
+     * Conversation id
+     */
+    mutable qint64 mConversationId;
+    
+    /**
+     * Message type
+     */
+    mutable int mMessageType;
+
+    /**
+     * Message from single or multiple contact
+     */
+    mutable bool mConversationFromSingleContact;
+    
+    /**
+     * Private implementaion object.
+     * Owned.
+     */
+    MsgIndicatorPrivate* d_ptr;
+   
+    /**
+     * Primary Text
+     * 
+     */
+    QString mPrimaryText;
+    
+    /**
+     * Secondary Text
+     */
+    QString mSecondaryText;
+    
+    /**
+     * Number of messages
+     */    
+    int mCount;
+    
+    /**
+     * Indicator type
+     */
+    int mIndicatorType;
+};
+
+#endif // MSGINDICATOR_H
+