13 * |
13 * |
14 * Description:Header for entering To field (phone number, contact name). |
14 * Description:Header for entering To field (phone number, contact name). |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef UNIFIED_EDITOR_ADDRESS_H |
18 #ifndef MSG_UNIFIED_EDITOR_ADDRESS_H |
19 #define UNIFIED_EDITOR_ADDRESS_H |
19 #define MSG_UNIFIED_EDITOR_ADDRESS_H |
20 |
20 |
21 #include <hbwidget.h> |
21 #include <msgunieditorbasewidget.h> |
22 |
22 |
23 #include <convergedmessageaddress.h> |
23 #include <convergedmessageaddress.h> |
24 #include <QMap> |
24 #include <QMap> |
25 |
25 |
26 class HbTextItem; |
26 class HbTextItem; |
27 class HbPushButton; |
27 class HbPushButton; |
28 class HbLineEdit; |
28 class HbLineEdit; |
|
29 class HbAction; |
29 class MsgUnifiedEditorLineEdit; |
30 class MsgUnifiedEditorLineEdit; |
30 |
31 |
31 class MsgUnifiedEditorAddress : public HbWidget |
32 class MsgUnifiedEditorAddress : public MsgUnifiedEditorBaseWidget |
32 { |
33 { |
33 Q_OBJECT |
34 Q_OBJECT |
34 |
35 |
35 public: |
36 public: |
36 |
37 |
37 /** |
38 /** |
38 * Constructor |
39 * Constructor |
39 */ |
40 */ |
40 MsgUnifiedEditorAddress(const QString& label, |
41 MsgUnifiedEditorAddress(const QString& label, |
41 const QString& pluginPath, |
|
42 QGraphicsItem *parent = 0); |
42 QGraphicsItem *parent = 0); |
43 |
43 |
44 /** |
44 /** |
45 * Destructor |
45 * Destructor |
46 */ |
46 */ |
47 ~MsgUnifiedEditorAddress(); |
47 ~MsgUnifiedEditorAddress(); |
48 |
48 |
49 /** |
49 /** |
50 * Seeker method to return back data to editor's view |
50 * Seeker method to return back data to editor's view |
51 * Removes duplicates. |
51 * By default, does not remove duplicates. |
52 */ |
52 * @param removeDuplicates, True if duplicate removal is needed |
53 ConvergedMessageAddressList addresses(); |
53 */ |
|
54 ConvergedMessageAddressList addresses(bool removeDuplicates=false); |
54 |
55 |
55 /** |
56 /** |
56 * Get total number of recipient's (including duplicates) |
57 * Get total number of recipient's (including duplicates) |
57 */ |
58 */ |
58 int addressCount(); |
59 int addressCount(); |
59 |
60 |
60 /** |
61 /** |
61 * setter method to set address |
62 * setter method to set address |
|
63 * @param addrlist, list of addresses to be set in address editor |
62 */ |
64 */ |
63 void setAddresses(ConvergedMessageAddressList addrlist); |
65 void setAddresses(ConvergedMessageAddressList addrlist); |
|
66 |
|
67 /** |
|
68 * Get amount of digits to be used in contact matching |
|
69 */ |
|
70 static int contactMatchDigits(); |
|
71 |
|
72 /** |
|
73 * setter method to enable flag to skip max recipient limit query |
|
74 */ |
|
75 void skipMaxRecipientQuery(bool skip); |
|
76 |
|
77 /** |
|
78 * validate contacts |
|
79 */ |
|
80 bool validateContacts(); |
|
81 |
|
82 public slots: |
|
83 /** |
|
84 * To set focus on editable field. |
|
85 */ |
|
86 void setFocus(); |
|
87 |
|
88 signals: |
|
89 /** |
|
90 * Emitted when send button from virtual ITUT is pressed. |
|
91 */ |
|
92 void sendMessage(); |
|
93 |
|
94 /** |
|
95 * Emitted when content is added or removed |
|
96 */ |
|
97 void contentChanged(); |
|
98 |
|
99 private slots: |
|
100 |
|
101 /** |
|
102 * called after selection from pbk. |
|
103 */ |
|
104 void fetchContacts(); |
|
105 /** |
|
106 * Slot for handling valid returns from the phonebook contacts fetched. |
|
107 */ |
|
108 void handleOk(const QVariant& result); |
|
109 |
|
110 /** |
|
111 * Slot for handling errors. Error ids are provided as |
|
112 */ |
|
113 void handleError(int errorCode, const QString& errorMessage); |
|
114 |
|
115 /** |
|
116 * Called when contentsChanged signal is emitted by the line edit |
|
117 */ |
|
118 void onContentsChanged(const QString&); |
|
119 |
|
120 /** |
|
121 * launch query for recipient limit usecase |
|
122 */ |
|
123 void handleRecipientLimitReached(); |
|
124 |
|
125 /** |
|
126 * This slot is called when max recipients reached dialog is launched. |
|
127 * @param action selected action (yes or no). |
|
128 */ |
|
129 void onMaxRecipientsReached(HbAction*); |
|
130 |
|
131 /** |
|
132 * Handle invalid contact dialog useraction |
|
133 */ |
|
134 void handleInvalidContactDialog(HbAction* act); |
64 |
135 |
65 /** |
136 /** |
66 * Get amount of digits to be used in contact matching |
137 * Unblocks signals for pbk buttion after some delay. |
67 */ |
138 */ |
68 static int contactMatchDigits(); |
139 void unblockSignals(); |
69 |
140 |
70 signals: |
141 private: |
71 /** |
142 /** |
72 * Emitted when send button from virtual ITUT is pressed. |
143 * Remove edit-field's user-deleted addresses from Map |
73 */ |
144 */ |
74 void sendMessage(); |
145 void syncDeletionsToMap(); |
75 |
146 |
76 /** |
147 /** |
77 * Emitted when content is added or removed |
148 * Add edit-field's user-added addresses to Map |
78 */ |
149 */ |
79 void contentChanged(); |
150 void syncAdditionsToMap(); |
80 |
151 |
81 private slots: |
152 /** |
82 |
153 * Removes duplicate addresses and gives unique address list |
83 /** |
154 */ |
84 * called after selection from pbk. |
155 QStringList uniqueAddressList(); |
85 */ |
156 |
86 void fetchContacts(); |
157 /** |
87 /** |
158 * Reset the addresslist to previous list |
88 * Slot for handling valid returns from the phonebook contacts fetched. |
159 */ |
89 */ |
160 void resetToPrevious(); |
90 void handleOk(const QVariant& result); |
|
91 |
161 |
92 /** |
162 /** |
93 * Slot for handling errors. Error ids are provided as |
163 * checks if the passed sting is a valid address or not. |
94 */ |
164 * @param addr |
95 void handleError(int errorCode, const QString& errorMessage); |
165 * @retunr true/false based on valid/invalid. |
96 |
166 */ |
97 /** |
167 bool checkValidAddress(const QString& addr); |
98 * Called when contentsChanged signal is emitted by the line edit |
|
99 */ |
|
100 void onContentsAdded(const QString&); |
|
101 |
|
102 /** |
|
103 * Called when contentsChanged signal is emitted by the line edit |
|
104 * Checks for empty text content |
|
105 */ |
|
106 void onContentsRemoved(const QString& text); |
|
107 |
168 |
108 private: |
169 private: |
109 /** |
170 |
110 * Remove edit-field's user-deleted addresses from Map |
|
111 */ |
|
112 void syncDeletionsToMap(); |
|
113 |
|
114 /** |
|
115 * Add edit-field's user-added addresses to Map |
|
116 */ |
|
117 void syncAdditionsToMap(); |
|
118 |
|
119 /** |
|
120 * Removes duplicate addresses and gives unique address list |
|
121 */ |
|
122 QStringList uniqueAddressList(); |
|
123 private: |
|
124 |
|
125 /** |
171 /** |
126 * Push button to launch phone book. |
172 * Push button to launch phone book. |
127 */ |
173 */ |
128 HbPushButton* mLaunchBtn; |
174 HbPushButton* mLaunchBtn; |
129 |
175 |
131 * line edit field. |
177 * line edit field. |
132 */ |
178 */ |
133 MsgUnifiedEditorLineEdit* mAddressEdit; |
179 MsgUnifiedEditorLineEdit* mAddressEdit; |
134 |
180 |
135 /** |
181 /** |
136 * string to hold plugin path. |
|
137 */ |
|
138 QString mPluginPath; |
|
139 |
|
140 /** |
|
141 * address map. |
182 * address map. |
142 */ |
183 */ |
143 QMap<QString, QString> mAddressMap; |
184 QMap<QString, QString> mAddressMap; |
144 |
185 |
|
186 /** |
|
187 * holds the previous buffer inside address field |
|
188 */ |
|
189 QString mPrevBuffer; |
|
190 |
|
191 /** |
|
192 * flag to skip max recipient limit query |
|
193 */ |
|
194 bool mSkipMaxRecipientQuery; |
|
195 |
|
196 /** |
|
197 * flag to indicate that the SMS recipient limit is about |
|
198 * to be exceeded by a bulk insertion of addresses e.g. multiple |
|
199 * selection from contact selection dialog |
|
200 */ |
|
201 bool mAboutToExceedMaxSmsRecipients; |
|
202 |
|
203 /** |
|
204 * flag to indicate that the MMS recipient limit is about |
|
205 * to be exceeded by a bulk insertion of addresses e.g. multiple |
|
206 * selection from contact selection dialog |
|
207 */ |
|
208 bool mAboutToExceedMaxMmsRecipients; |
|
209 |
|
210 /** |
|
211 * count by which a bulk-insertion will exceed max MMS recipient |
|
212 * limit e.g. multiple selection from contact selection dialog |
|
213 */ |
|
214 int mExceedsMaxMmsRecipientsBy; |
145 }; |
215 }; |
146 |
216 |
147 #endif //UNIFIED_EDITOR_ADDRESS_H |
217 #endif //MSG_UNIFIED_EDITOR_ADDRESS_H |