messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Listen to conversation server events and parse the 
       
    15  * events. These parsed information passed to notifications and indications.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef MSGNOTIFIER_PRIVATE_H
       
    20 #define MSGNOTIFIER_PRIVATE_H
       
    21 
       
    22 #include <mcsconversationlistchangeobserver.h>
       
    23 #include <QRunnable>
       
    24 
       
    25 // CLASS DECLARATION
       
    26 class MsgNotifier;
       
    27 class CCSRequestHandler;
       
    28 class MsgStoreHandler;
       
    29 class XQSettingsManager;
       
    30 class XQPublishAndSubscribeUtils;
       
    31 class XQSystemToneService;
       
    32 
       
    33 /**
       
    34  * Structure to hold the details of a class 0 SMS
       
    35  */
       
    36 struct Class0Info
       
    37 {
       
    38     QString body;
       
    39     QString address;
       
    40     QString alias;
       
    41     QString time;
       
    42     int messageId;
       
    43 };
       
    44 
       
    45 /**
       
    46  * @class MsgNotifierPrivate
       
    47  */
       
    48 
       
    49 class MsgNotifierPrivate : public CBase, public MCsConversationListChangeObserver
       
    50     {
       
    51 
       
    52 public:
       
    53     /**
       
    54      * Constructor
       
    55      */
       
    56     MsgNotifierPrivate(MsgNotifier* msgNotifier);
       
    57 
       
    58     /**
       
    59      * Destructor
       
    60      */
       
    61     ~MsgNotifierPrivate();
       
    62 
       
    63 public:
       
    64     /**  
       
    65      * AddConversationList
       
    66      * This is for handling new conversation event
       
    67      * asynchronously from the server 
       
    68      * @param aClientConversation CCsClientConversation The conversation object
       
    69      */
       
    70     void
       
    71             AddConversationList(
       
    72                     const CCsClientConversation& aClientConversation);
       
    73 
       
    74     /**  
       
    75      * DeleteConversationList
       
    76      * This is for handling delete conversation event
       
    77      * asynchronously from the server 
       
    78      * @param aClientConversation CCsClientConversation The conversation object
       
    79      */
       
    80     void DeleteConversationList(
       
    81             const CCsClientConversation& aClientConversation);
       
    82     
       
    83 	/**
       
    84 	 * PartialDeleteConversationList
       
    85 	 * This is for handling partial delete of conversation event
       
    86 	 * Asynchronous
       
    87 	 * @param aClientConversation CCsClientConversation - The conversation object
       
    88 	 */
       
    89     void PartialDeleteConversationList(
       
    90             const CCsClientConversation& aClientConversation);
       
    91 
       
    92 
       
    93     /**  
       
    94      * ModifyConversationList
       
    95      * This is for handling modify conversation asynchronously
       
    96      * from the server 
       
    97      * @param aClientConversation CCsClientConversation The conversation object
       
    98      * 
       
    99      */
       
   100     void ModifyConversationList(
       
   101             const CCsClientConversation& aClientConversation);
       
   102 
       
   103     /**
       
   104      * RefreshConversationList
       
   105      * This is for handling bulk changes. Message store change etc.
       
   106      */
       
   107     void RefreshConversationList();
       
   108 
       
   109 public:
       
   110 
       
   111     /**
       
   112      * updateFailedIndications
       
   113      * Activate/Deactivate message indications based on pending message count
       
   114      */
       
   115     void updateOutboxIndications();
       
   116 
       
   117     /**
       
   118      * displayOutboxIndications
       
   119      * Display the outbox indications based on the data in MsgInfo
       
   120      */
       
   121     void displayOutboxIndications(MsgInfo data);
       
   122 
       
   123     /**
       
   124      * displayFailedNote
       
   125      * Popup a message box when a message is not successfully sent.
       
   126      * @param msgInfo MsgInfo The message information object
       
   127      */
       
   128     void displayFailedNote(MsgInfo msgInfo);
       
   129 
       
   130     /**
       
   131      * ShowClass0Message
       
   132      * Popups a Dialog with Class 0 SMS message...
       
   133      * @param msgInfo MsgInfo The message information object
       
   134      */
       
   135     void ShowClass0Message(Class0Info& aClass0Info);
       
   136 
       
   137 private:
       
   138     /**
       
   139      * Does all the initializations. 
       
   140      */
       
   141     void initL();
       
   142 
       
   143     /**
       
   144      * Initializes the conversation store handler 
       
   145      */
       
   146     void initConvStoreHandler();
       
   147 
       
   148     /**
       
   149      * Process conversation entry for showing the notification.
       
   150      * @param aClientConversation conversation entry
       
   151      */
       
   152     void processListEntry(const CCsClientConversation& aClientConversation);
       
   153 
       
   154     /**
       
   155      * updateIndications
       
   156      * Activate/Deactivate message indications based on unread message count
       
   157      * @param bootup, true, if called on bootup else false
       
   158      */
       
   159     void updateUnreadIndications(bool bootup = false);
       
   160    
       
   161     /**
       
   162      * Show notification or not
       
   163      * @param receivedMsgConvId received message conversation id.
       
   164      * @return true if the received conversation id is not same as 
       
   165      * published conversation id ( opened conversation id) else false
       
   166      */
       
   167     bool showNotification(int receivedMsgConvId);
       
   168 private:
       
   169 
       
   170     /**
       
   171      * Pointer to msgnotifier
       
   172      */
       
   173     MsgNotifier* q_ptr;
       
   174 
       
   175     /**
       
   176      * Conversation server client 
       
   177      */
       
   178     CCSRequestHandler* mCvServer;
       
   179 
       
   180     /**
       
   181      * Pointer to Conversation Msg Store Handler.
       
   182      */
       
   183     MsgStoreHandler* iMsgStoreHandler;
       
   184     
       
   185     /**
       
   186      * Settings manager 
       
   187      * Owned.
       
   188      */
       
   189     XQSettingsManager* mSettingsManager;
       
   190 
       
   191     /**
       
   192      * Publish and subscribe utils.
       
   193      * Owned.
       
   194      */
       
   195     XQPublishAndSubscribeUtils* mPSUtils;
       
   196     
       
   197     /**
       
   198      * Object to handle audio alert when new message is received
       
   199      */
       
   200     XQSystemToneService* mSts;
       
   201     };
       
   202 
       
   203 
       
   204 /**
       
   205  * Class for launching the Class0 SMS dialog in a separate thread..
       
   206  */
       
   207 class Class0SmsServiceTask : public QRunnable
       
   208 {
       
   209 public:
       
   210     /**
       
   211      * Constructor
       
   212      */
       
   213     Class0SmsServiceTask(Class0Info& class0info);
       
   214     
       
   215     /**
       
   216      * Destructor
       
   217      */
       
   218     ~Class0SmsServiceTask();
       
   219      
       
   220     /**
       
   221      * create and send service request
       
   222      */
       
   223      void run();
       
   224 
       
   225 private: 
       
   226      Class0Info mClass0info;
       
   227 };
       
   228 
       
   229 
       
   230 
       
   231 
       
   232 
       
   233 #endif // MSGNOTIFIER_PRIVATE_H
       
   234 //EOF