|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 //SYSTEM INCLUDE |
|
19 #include <msghistory.h> |
|
20 //USER INCLUDE |
|
21 #include "msghistoryimpl.h" |
|
22 #include "msghistoryprivate.h" |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // Constructor. |
|
26 // --------------------------------------------------------------------------- |
|
27 MsgHistoryImpl::MsgHistoryImpl(QObject* parent) |
|
28 :QObject(parent) |
|
29 { |
|
30 d_ptr = q_check_ptr (new MsgHistoryPrivate(this)); |
|
31 |
|
32 //connect signals |
|
33 connect(this, SIGNAL(messagesReady(QList<MsgItem>&)), |
|
34 this->parent(), SIGNAL(messagesReady(QList<MsgItem>&))); |
|
35 connect(this, SIGNAL(messageAdded(MsgItem&)), |
|
36 this->parent(), SIGNAL(messageAdded(MsgItem&))); |
|
37 connect(this, SIGNAL(messageChanged(MsgItem&)), |
|
38 this->parent(), SIGNAL(messageChanged(MsgItem&))); |
|
39 connect(this, SIGNAL(messageDeleted(MsgItem&)), |
|
40 this->parent(), SIGNAL(messageDeleted(MsgItem&))); |
|
41 |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Destructor. |
|
46 // --------------------------------------------------------------------------- |
|
47 MsgHistoryImpl::~MsgHistoryImpl() |
|
48 { |
|
49 if ( d_ptr ) |
|
50 delete d_ptr; |
|
51 } |
|
52 |
|
53 //--------------------------------------------------------------- |
|
54 // MsgHistoryImpl::getMessages |
|
55 // @see header file |
|
56 //--------------------------------------------------------------- |
|
57 bool MsgHistoryImpl::getMessages(int contactId) |
|
58 { |
|
59 return (d_ptr->GetMessagingHistory(contactId)); |
|
60 } |
|
61 |
|
62 //--------------------------------------------------------------- |
|
63 // MsgHistoryImpl::clearMessages |
|
64 // @see header file |
|
65 //--------------------------------------------------------------- |
|
66 bool MsgHistoryImpl::clearMessages(int contactId) |
|
67 { |
|
68 return (d_ptr->ClearMessagingHistory(contactId)); |
|
69 } |
|
70 |
|
71 //--------------------------------------------------------------- |
|
72 // MsgHistoryImpl::markRead |
|
73 // @see header file |
|
74 //--------------------------------------------------------------- |
|
75 bool MsgHistoryImpl::markRead(int contactId) |
|
76 { |
|
77 return (d_ptr->MarkReadMessagingHistory(contactId)); |
|
78 } |
|
79 |
|
80 //--------------------------------------------------------------- |
|
81 // MsgHistoryImpl::subscribe |
|
82 // @see header file |
|
83 //--------------------------------------------------------------- |
|
84 bool MsgHistoryImpl::subscribe(int contactId) |
|
85 { |
|
86 return (d_ptr->Subscribe(contactId)); |
|
87 } |
|
88 |
|
89 //--------------------------------------------------------------- |
|
90 // MsgHistoryImpl::unSubscribe |
|
91 // @see header file |
|
92 //--------------------------------------------------------------- |
|
93 bool MsgHistoryImpl::unSubscribe(int contactId) |
|
94 { |
|
95 return (d_ptr->UnSubscribe(contactId)); |
|
96 } |
|
97 |
|
98 //--------------------------------------------------------------- |
|
99 // MsgHistoryImpl::messagesReadyEvent |
|
100 // @see header file |
|
101 //--------------------------------------------------------------- |
|
102 void MsgHistoryImpl::messagesReadyEvent(QList<MsgItem>& msgs) |
|
103 { |
|
104 //emit messagesReady |
|
105 emit messagesReady(msgs); |
|
106 } |
|
107 |
|
108 //--------------------------------------------------------------- |
|
109 // MsgHistoryImpl::messageAddedEvent |
|
110 // @see header file |
|
111 //--------------------------------------------------------------- |
|
112 void MsgHistoryImpl::messageAddedEvent(MsgItem& msg) |
|
113 { |
|
114 //emit messageAdded |
|
115 emit messageAdded(msg); |
|
116 } |
|
117 |
|
118 //--------------------------------------------------------------- |
|
119 // MsgHistoryImpl::messageChangedEvent |
|
120 // @see header file |
|
121 //--------------------------------------------------------------- |
|
122 void MsgHistoryImpl::messageChangedEvent(MsgItem& msg) |
|
123 { |
|
124 //emit messageChanged |
|
125 emit messageChanged(msg); |
|
126 } |
|
127 |
|
128 //--------------------------------------------------------------- |
|
129 // MsgHistoryImpl::messageDeletedEvent |
|
130 // @see header file |
|
131 //--------------------------------------------------------------- |
|
132 void MsgHistoryImpl::messageDeletedEvent(MsgItem& msg) |
|
133 { |
|
134 //emit messageDeleted |
|
135 emit messageDeleted(msg); |
|
136 } |
|
137 |
|
138 //EOF |