16 */ |
16 */ |
17 |
17 |
18 #ifndef UNIFIED_EDITOR_ADDRESS_H |
18 #ifndef UNIFIED_EDITOR_ADDRESS_H |
19 #define UNIFIED_EDITOR_ADDRESS_H |
19 #define UNIFIED_EDITOR_ADDRESS_H |
20 |
20 |
21 #include <hbwidget.h> |
21 #include <msgunifiededitorbasewidget.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); |
64 |
66 |
65 /** |
67 /** |
66 * Get amount of digits to be used in contact matching |
68 * Get amount of digits to be used in contact matching |
67 */ |
69 */ |
68 static int contactMatchDigits(); |
70 static int contactMatchDigits(); |
69 |
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 |
70 signals: |
88 signals: |
71 /** |
89 /** |
72 * Emitted when send button from virtual ITUT is pressed. |
90 * Emitted when send button from virtual ITUT is pressed. |
73 */ |
91 */ |
74 void sendMessage(); |
92 void sendMessage(); |
77 * Emitted when content is added or removed |
95 * Emitted when content is added or removed |
78 */ |
96 */ |
79 void contentChanged(); |
97 void contentChanged(); |
80 |
98 |
81 private slots: |
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(); |
82 |
124 |
83 /** |
125 /** |
84 * called after selection from pbk. |
126 * This slot is called when max recipients reached dialog is launched. |
85 */ |
127 * @param action selected action (yes or no). |
86 void fetchContacts(); |
128 */ |
87 /** |
129 void onMaxRecipientsReached(HbAction*); |
88 * Slot for handling valid returns from the phonebook contacts fetched. |
130 |
89 */ |
131 /** |
90 void handleOk(const QVariant& result); |
132 * Handle invalid contact dialog useraction |
91 |
133 */ |
92 /** |
134 void handleInvalidContactDialog(HbAction* act); |
93 * Slot for handling errors. Error ids are provided as |
|
94 */ |
|
95 void handleError(int errorCode, const QString& errorMessage); |
|
96 |
|
97 /** |
|
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 |
135 |
108 private: |
136 private: |
109 /** |
137 /** |
110 * Remove edit-field's user-deleted addresses from Map |
138 * Remove edit-field's user-deleted addresses from Map |
111 */ |
139 */ |
113 |
141 |
114 /** |
142 /** |
115 * Add edit-field's user-added addresses to Map |
143 * Add edit-field's user-added addresses to Map |
116 */ |
144 */ |
117 void syncAdditionsToMap(); |
145 void syncAdditionsToMap(); |
118 |
146 |
119 /** |
147 /** |
120 * Removes duplicate addresses and gives unique address list |
148 * Removes duplicate addresses and gives unique address list |
121 */ |
149 */ |
122 QStringList uniqueAddressList(); |
150 QStringList uniqueAddressList(); |
|
151 |
|
152 /** |
|
153 * Reset the addresslist to previous list |
|
154 */ |
|
155 void resetToPrevious(); |
|
156 |
123 private: |
157 private: |
124 |
158 |
125 /** |
159 /** |
126 * Push button to launch phone book. |
160 * Push button to launch phone book. |
127 */ |
161 */ |
128 HbPushButton* mLaunchBtn; |
162 HbPushButton* mLaunchBtn; |
129 |
163 |
131 * line edit field. |
165 * line edit field. |
132 */ |
166 */ |
133 MsgUnifiedEditorLineEdit* mAddressEdit; |
167 MsgUnifiedEditorLineEdit* mAddressEdit; |
134 |
168 |
135 /** |
169 /** |
136 * string to hold plugin path. |
|
137 */ |
|
138 QString mPluginPath; |
|
139 |
|
140 /** |
|
141 * address map. |
170 * address map. |
142 */ |
171 */ |
143 QMap<QString, QString> mAddressMap; |
172 QMap<QString, QString> mAddressMap; |
144 |
173 |
|
174 /** |
|
175 * holds the previous buffer inside address field |
|
176 */ |
|
177 QString mPrevBuffer; |
|
178 |
|
179 /** |
|
180 * flag to skip max recipient limit query |
|
181 */ |
|
182 bool mSkipMaxRecipientQuery; |
|
183 |
|
184 /** |
|
185 * flag to indicate that the SMS recipient limit is about |
|
186 * to be exceeded by a bulk insertion of addresses e.g. multiple |
|
187 * selection from contact selection dialog |
|
188 */ |
|
189 bool mAboutToExceedMaxSmsRecipients; |
|
190 |
|
191 /** |
|
192 * flag to indicate that the MMS recipient limit is about |
|
193 * to be exceeded by a bulk insertion of addresses e.g. multiple |
|
194 * selection from contact selection dialog |
|
195 */ |
|
196 bool mAboutToExceedMaxMmsRecipients; |
|
197 |
|
198 /** |
|
199 * count by which a bulk-insertion will exceed max MMS recipient |
|
200 * limit e.g. multiple selection from contact selection dialog |
|
201 */ |
|
202 int mExceedsMaxMmsRecipientsBy; |
145 }; |
203 }; |
146 |
204 |
147 #endif //UNIFIED_EDITOR_ADDRESS_H |
205 #endif //UNIFIED_EDITOR_ADDRESS_H |