equal
deleted
inserted
replaced
24 #include <QVariant> |
24 #include <QVariant> |
25 #include <QCoreApplication> |
25 #include <QCoreApplication> |
26 |
26 |
27 #include <HbStringUtil> |
27 #include <HbStringUtil> |
28 |
28 |
29 const int NmMailboxInfoItemCount = 7; |
29 const int NmMailboxInfoItemCount = 8; |
30 const int NmSendingStateDelay = 2000; // delay for 'send in progress' indicator |
30 const int NmSendingStateDelay = 2000; // delay for 'send in progress' indicator |
31 const int NmMaxOutboxCount = 99; |
31 const int NmMaxOutboxCount = 99; |
32 |
32 |
33 /*! |
33 /*! |
34 \class NmMailboxInfo |
34 \class NmMailboxInfo |
125 |
125 |
126 For the roles not supported by the plugin, empty QVariant should be returned. |
126 For the roles not supported by the plugin, empty QVariant should be returned. |
127 */ |
127 */ |
128 QVariant NmIndicator::indicatorData(int role) const |
128 QVariant NmIndicator::indicatorData(int role) const |
129 { |
129 { |
130 NMLOG("NmIndicator::indicatorData"); |
130 NMLOG(QString("NmIndicator::indicatorData %1").arg(role)); |
131 switch(role) { |
131 switch(role) { |
132 case TextRole: |
132 case PrimaryTextRole: |
133 { |
133 { |
134 return mMailbox.mName; |
134 return mMailbox.mName; |
135 } |
135 } |
136 case SecondaryTextRole: |
136 case SecondaryTextRole: |
137 { |
137 { |
151 } |
151 } |
152 case DecorationNameRole: |
152 case DecorationNameRole: |
153 { |
153 { |
154 // Icon for the mailbox in the menu |
154 // Icon for the mailbox in the menu |
155 if (mActive) { |
155 if (mActive) { |
156 return QString("qtg_large_email"); |
156 if (!mMailbox.mMailboxIconName.isEmpty()) { |
|
157 return mMailbox.mMailboxIconName; |
|
158 } |
|
159 else { |
|
160 return QString("qtg_large_email"); |
|
161 } |
157 } |
162 } |
158 break; |
163 break; |
159 } |
164 } |
160 case MonoDecorationNameRole: |
165 case MonoDecorationNameRole: |
161 if (mShowIndicator) { |
166 if (mShowIndicator) { |
167 } |
172 } |
168 return QVariant(); |
173 return QVariant(); |
169 } |
174 } |
170 |
175 |
171 /*! |
176 /*! |
172 Timer callback for hiding 'send in progress' indicator |
177 Timer callback for hiding 'send in progress' indicator |
173 */ |
178 */ |
174 void NmIndicator::hideSendIndicator() |
179 void NmIndicator::hideSendIndicator() |
175 { |
180 { |
176 if (mShowSendProgress) { |
181 if (mShowSendProgress) { |
177 NMLOG("NmIndicator::hideSendIndicator - hide progress state"); |
182 NMLOG("NmIndicator::hideSendIndicator - hide progress state"); |
178 mShowSendProgress = false; |
183 mShowSendProgress = false; |
179 emit dataChanged(); |
184 emit dataChanged(); |
220 switch (type) { |
225 switch (type) { |
221 case RequestActivate: |
226 case RequestActivate: |
222 { |
227 { |
223 mActive = true; |
228 mActive = true; |
224 storeMailboxData(parameter); |
229 storeMailboxData(parameter); |
|
230 |
225 emit dataChanged(); |
231 emit dataChanged(); |
226 handled = true; |
232 handled = true; |
227 } |
233 } |
228 break; |
234 break; |
229 case RequestDeactivate: |
235 case RequestDeactivate: |
254 void NmIndicator::showSendProgress() |
260 void NmIndicator::showSendProgress() |
255 { |
261 { |
256 // Activate the progress indicator |
262 // Activate the progress indicator |
257 if (!mShowSendProgress && mActive) { |
263 if (!mShowSendProgress && mActive) { |
258 mShowSendProgress = true; |
264 mShowSendProgress = true; |
259 |
265 |
260 // Hide the progress state after some delay |
266 // Hide the progress state after some delay |
261 QTimer::singleShot(NmSendingStateDelay, this, SLOT(hideSendIndicator())); |
267 QTimer::singleShot(NmSendingStateDelay, this, SLOT(hideSendIndicator())); |
262 } |
268 } |
263 } |
269 } |
264 |
270 |
275 mMailbox.mName = infoList.at(1).toString(); |
281 mMailbox.mName = infoList.at(1).toString(); |
276 mMailbox.mUnreadMails = infoList.at(2).toInt(); |
282 mMailbox.mUnreadMails = infoList.at(2).toInt(); |
277 mMailbox.mSyncState = infoList.at(3).value<NmSyncState>(); |
283 mMailbox.mSyncState = infoList.at(3).value<NmSyncState>(); |
278 mMailbox.mConnectState = infoList.at(4).value<NmConnectState>(); |
284 mMailbox.mConnectState = infoList.at(4).value<NmConnectState>(); |
279 mMailbox.mOutboxMails = infoList.at(5).toInt(); |
285 mMailbox.mOutboxMails = infoList.at(5).toInt(); |
280 |
286 mMailbox.mMailboxIconName = infoList.at(6).toString(); |
|
287 |
281 bool oldSendingState = mSendingState; |
288 bool oldSendingState = mSendingState; |
282 mSendingState = infoList.at(6).toInt(); |
289 mSendingState = infoList.at(7).toInt(); |
283 |
290 |
284 // Sending state now activated |
291 // Sending state now activated |
285 if (!oldSendingState && mSendingState) { |
292 if (!oldSendingState && mSendingState) { |
286 showSendProgress(); |
293 showSendProgress(); |
287 } |
294 } |
288 |
295 |