|
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:Message send utility. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MSG_SEND_UTIL_H |
|
19 #define MSG_SEND_UTIL_H |
|
20 |
|
21 #include <msvstd.h> |
|
22 #include <QObject> |
|
23 #include "convergedmessage.h" |
|
24 |
|
25 class UniEditorPluginLoader; |
|
26 class UniEditorGenUtils; |
|
27 class UniEditorPluginInterface; |
|
28 |
|
29 /** |
|
30 * This class manages the message send functionality. |
|
31 * |
|
32 */ |
|
33 class MsgSendUtil : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 public: |
|
38 /** |
|
39 * Constructor |
|
40 */ |
|
41 MsgSendUtil(QObject* parent=0); |
|
42 |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 ~MsgSendUtil(); |
|
47 |
|
48 /** |
|
49 * Save message to drafts |
|
50 * @param msg Message to be sent |
|
51 * @return true if message is saved to drafts |
|
52 */ |
|
53 TMsvId saveToDrafts(ConvergedMessage& msg); |
|
54 |
|
55 /** |
|
56 * Send message |
|
57 * @param msg Message to be sent |
|
58 * @return KErrNone if send is successful, |
|
59 * KErrNotFound if settings are not available, |
|
60 * KErrGeneral for other cases |
|
61 */ |
|
62 int send(ConvergedMessage& msg); |
|
63 |
|
64 private: |
|
65 /** |
|
66 * Check if email over sms is supported and change msgtype appropriately. |
|
67 * @param msg Message to be sent |
|
68 * @param emailOverSmsSupported OUT true if email over sms is supported |
|
69 * @return true if ok to send message |
|
70 */ |
|
71 bool checkEmailOverSms(ConvergedMessage& msg, bool& emailOverSmsSupported); |
|
72 |
|
73 /** |
|
74 * Check max recipient count and change msg type appropriately. |
|
75 * @param msg Message to be sent |
|
76 * @return true if ok to send message |
|
77 */ |
|
78 bool checkMaxRecipientCount(ConvergedMessage& msg); |
|
79 |
|
80 /** |
|
81 * Check max message size limit and change msg type appropriately. |
|
82 * @param msg Message to be sent |
|
83 * @return true if ok to send message |
|
84 */ |
|
85 bool checkMaxMsgSizeLimit(ConvergedMessage& msg); |
|
86 |
|
87 /** |
|
88 * Calculate sms message size |
|
89 * @param msg Message to be sent |
|
90 * @return size of the message |
|
91 */ |
|
92 int getSmsMsgSize(ConvergedMessage& msg); |
|
93 |
|
94 /** |
|
95 * Get the longest email address's size |
|
96 * @return size |
|
97 */ |
|
98 int longestEmailAddressSize(ConvergedMessageAddressList addrList); |
|
99 |
|
100 /** |
|
101 * Calculate mms message size |
|
102 * @param msg Message to be sent |
|
103 * @return size of the message |
|
104 */ |
|
105 int getMmsMsgSize(ConvergedMessage& msg); |
|
106 |
|
107 /** |
|
108 * Validate service and check for the send settings |
|
109 * @param pluginInterface plugin to be used for msg-send |
|
110 * @param emailOverSmsSupported true if email over sms is supported |
|
111 * @return true if ok to send message |
|
112 */ |
|
113 bool validateService(UniEditorPluginInterface* pluginInterface, |
|
114 bool emailOverSmsSupported); |
|
115 |
|
116 private: |
|
117 |
|
118 /** |
|
119 * Sms/Mms send plugin loader |
|
120 * Own |
|
121 */ |
|
122 UniEditorPluginLoader* mPluginLoader; |
|
123 |
|
124 /** |
|
125 * General utils for send-time checks |
|
126 * Own |
|
127 */ |
|
128 UniEditorGenUtils* mUniEditorGenUtils; |
|
129 }; |
|
130 |
|
131 #endif // MSG_SEND_UTIL_H |
|
132 |
|
133 // EOF |