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