messagingapp/msgui/appengine/inc/conversationsengine.h
author William Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:32:06 +0100
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
permissions -rw-r--r--
Catchup to latest Symbian^4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
 * Contributors:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
 * Description:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
 */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
#ifndef CONVERSATIONS_ENGINE_H
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#define CONVERSATIONS_ENGINE_H
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
// INCLUDES
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <QObject>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <QStandardItemModel>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <sqldb.h>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#ifdef BUILD_DLL
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#define CONVERSATIONS_ENGINE_API_EXPORT Q_DECL_EXPORT
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#else
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#define CONVERSATIONS_ENGINE_API_EXPORT Q_DECL_IMPORT
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#endif
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
class ConversationsSummaryModel;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
class ConversationsModel;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
class DraftsModel;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
class ConversationMsgStoreHandler;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
class ConversationsEnginePrivate;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
/**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
 * This is a singleton class which
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
 * implements the models for the model/view framework.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
 * The models hold data for the conversations fetched from the
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
 * server.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
 */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
class CONVERSATIONS_ENGINE_API_EXPORT ConversationsEngine : public QObject
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
{
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
    Q_OBJECT
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
public:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
     * Returns pointer to sole instance.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
     * @return ConversationEngine object
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
    static ConversationsEngine* instance();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
     * Destructor
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
    virtual ~ConversationsEngine();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
public:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
     * Returns Conversations Summary Model instance
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
    QStandardItemModel* getConversationsSummaryModel();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
     * Returns Conversations Model instance
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
    QStandardItemModel* getConversationsModel();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
     * Returns drafts Model instance
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
    QStandardItemModel* getDraftsModel();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
     * Get all conversations.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
     * @param conversationId, conversationId
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
     * @return returns true if call is successful
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
    bool getConversations(qint64 conversationId);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
	
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
     * Deregisters the current conversationId and clears the model
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
     * @return returns true if call is successful
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
    bool clearConversations();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
     * Delete all conversations.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
     * @param conversationId, conversationId
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
     * @return returns true if call is successful
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
     */    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
    bool deleteConversations(qint64 conversationId);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
     * Delete all messages.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
     * @param msgIdList, message list.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
     */  
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
    void deleteMessages(QList<int>& msgIdList);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
     * Delete all draft messages.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
    void deleteAllDraftMessages();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
     * Marks all the unread conversations to read
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
     * @param conversationId, conversationId
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
     * @return returns true if call is successful
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
     */        
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
    bool markConversationRead(qint64 conversationId);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
     * Mark messages as read.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
     * @param msgIdList, message list.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
     * @return returns true if call is successful
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
     */      
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
    bool markMessagesRead(QList<int>& msgIdList);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
     * Get Contact details name.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
     * @param conversationId, conversationId
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
     * @param displayName, Name
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
     */  
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
    void getContactDetails(qint64 conversationId,
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
        QString& displayName,
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
        QString& address);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
     * Get conversationId for a given address.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
     * @param address, Phone number
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
     * @return conversation id
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
     */  
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
    qint64 getConversationIdFromAddress(QString address);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
     * Get current conversation id.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
     */  
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
    qint64 getCurrentConversationId();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
     * Get conversationId for a given contactId.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
     * @param contactId, Contact Id
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
     * @return conversation id
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
     */ 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
    qint64 getConversationIdFromContactId(qint32 contactId);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
     * Emits conversationModelPopulated signal
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
     */ 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
    void emitConversationModelPopulated();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
     * Emits conversationModelUpdated signal
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
     */ 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
    void emitConversationModelUpdated();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
    /**
44
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   164
     * Updates the new conversation id for list view
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   165
     */
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   166
    void emitOpenConversationViewIdUpdate(int newConversationId);
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   167
    
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   168
    void disableRegisterationForCVEvents();
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   169
    
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   170
    /**
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
     * Emits conversationListModelPopulated signal
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
     */ 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
    void emitConversationListModelPopulated();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
    /**
44
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   176
     * Emits conversationListModelEntryDeleted
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   177
     */
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   178
    void emitConversationListModelEntryDeleted( int conversationId );
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   179
    
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   180
    /**
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
     *  Starts fetching remaing conversations
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
    void fetchMoreConversations();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
     *  Resend a failed message
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
	 *@param  messageId qint32 the Id of the message to be sent
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
	 *@return bool true if succeeded
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
    bool resendMessage(qint32 messageId);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
     * Download a specified message
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
     * @param messageId qint32 the Id of the message 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
     * @return KErrNone if Download request is successful, 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
     *         KErrNotFound if settings are not available,
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
     *         KErrGeneral for other cases
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
    int downloadMessage(qint32 messageId);  
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
     * Query if the download operation be performed for
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
     * a message notification entry
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
     * @param aId, message notification id
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
     * @return true if download operation is possible
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
    bool downloadOperationSupported(qint32 messageId);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
	
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
     * Mark message as read and get the message type
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
     * @param messageId  message Id 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
     * @param msgType message type is written to this.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
     * @param msgType message sub type is written to this.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
    void markAsReadAndGetType( qint32 messageId,
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
                               int& msgType,
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
                               int& msgSubType);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
    /*
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
     * Get SQL DB handle
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
     * @param isOpen, set to true if open, check this before using the handle
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
    RSqlDatabase& getDBHandle(TBool& isOpen);
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
    
34
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   225
    /**
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   226
     * Get the biotype of a message
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   227
     * @param messageId
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   228
     */
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   229
    int getMsgSubType(int messageId);
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   230
    
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
private:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
     * Constructor
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
    explicit ConversationsEngine(QObject* parent = 0);    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
signals:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
     * ConversationListModelPopulated signal indicating 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
     * that the model is ready to be displayed
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
     */ 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
    void conversationModelPopulated();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
     * ConversationModelUpdated signal indicating dynamic 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
     * updates in the model
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
     */ 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
    void conversationModelUpdated();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
     * ConversationListModelPopulated signal indicating 
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
     * that the model is ready to be displayed
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    void conversationListModelPopulated();
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    
44
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   258
	/** 
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   259
	 * Signal to indicate the completion of conversation delete
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   260
	 * operation.
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   261
	 */
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   262
     void conversationListEntryDeleted( int conversationId );
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   263
	 
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   264
    /**
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   265
     * Signal to specify the CV model empty now
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   266
     */
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   267
    void conversationViewEmpty();
36f374c67aa8 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 34
diff changeset
   268
    
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
private:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
     * Conversations Summary Model
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
     * Own
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
     */        
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
    ConversationsSummaryModel* mConversationsSummaryModel;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
     * Conversations Model
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
     * Own
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
     */    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
    ConversationsModel* mConversationsModel;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
     * Drafts Model
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
     * Own
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
     */    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
    DraftsModel* mDraftsModel;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
     * MsgStoreHandler
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
     * Own
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
     */    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
    ConversationMsgStoreHandler* mConversationMsgStoreHandler;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
    
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
    /**
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
     * ConversationsEnginePrivate
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
     * Own
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
     */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
    ConversationsEnginePrivate* d_ptr;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
};
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
#endif // CONVERSATIONS_ENGINE_H