115 mMessageListWidget->contentWidget()->setProperty("indentation", 0); |
115 mMessageListWidget->contentWidget()->setProperty("indentation", 0); |
116 mMessageListWidget->setScrollDirections(Qt::Vertical); |
116 mMessageListWidget->setScrollDirections(Qt::Vertical); |
117 mMessageListWidget->setClampingStyle(HbScrollArea::BounceBackClamping); |
117 mMessageListWidget->setClampingStyle(HbScrollArea::BounceBackClamping); |
118 mMessageListWidget->setFrictionEnabled(true); |
118 mMessageListWidget->setFrictionEnabled(true); |
119 mMessageListWidget->setItemPixmapCacheEnabled(true); |
119 mMessageListWidget->setItemPixmapCacheEnabled(true); |
120 |
120 mMessageListWidget->setEnabledAnimations(HbAbstractItemView::All); |
121 // Enable animations to display an email as soon as it is added to |
|
122 // the list. |
|
123 mMessageListWidget->setEnabledAnimations(HbAbstractItemView::Appear & |
|
124 HbAbstractItemView::Expand); |
|
125 } |
121 } |
126 else { |
122 else { |
127 NM_ERROR(1,"nmailui: list object loading failed"); |
123 NM_ERROR(1,"nmailui: list object loading failed"); |
128 } |
124 } |
129 |
125 |
294 void NmMessageListView::refreshList() |
290 void NmMessageListView::refreshList() |
295 { |
291 { |
296 NM_FUNCTION; |
292 NM_FUNCTION; |
297 |
293 |
298 if (mMessageListModel) { |
294 if (mMessageListModel) { |
299 NmId mailboxId = mStartParam->mailboxId(); |
|
300 |
|
301 // In each refresh, e.g. in folder change the UI signals lower layer |
295 // In each refresh, e.g. in folder change the UI signals lower layer |
302 // about the folder that has been opened. |
296 // about the folder that has been opened. |
303 if (mStartParam){ |
297 if (mStartParam) { |
|
298 NmId mailboxId = mStartParam->mailboxId(); |
304 mUiEngine.updateActiveFolder(mailboxId, mStartParam->folderId()); |
299 mUiEngine.updateActiveFolder(mailboxId, mStartParam->folderId()); |
305 |
300 |
306 NmFolderType folderType(NmFolderInbox); |
301 NmFolderType folderType(NmFolderInbox); |
307 if (mStartParam->folderId()!= 0){ |
302 if (mStartParam->folderId()!= 0){ |
308 folderType = mUiEngine.folderTypeById(mStartParam->mailboxId(), |
303 folderType = mUiEngine.folderTypeById(mStartParam->mailboxId(), |
311 |
306 |
312 // If the new folder is an inbox, first automatic sync should be shown |
307 // If the new folder is an inbox, first automatic sync should be shown |
313 if (folderType == NmFolderInbox) { |
308 if (folderType == NmFolderInbox) { |
314 mIsFirstSyncInMessageList = true; |
309 mIsFirstSyncInMessageList = true; |
315 } |
310 } |
316 } |
311 |
317 |
312 // Set item model to message list widget |
318 // Set item model to message list widget |
313 if (mMessageListWidget) { |
319 if (mMessageListWidget) { |
314 mMessageListWidget->setModel(static_cast<QStandardItemModel*>(mMessageListModel)); |
320 mMessageListWidget->setModel(static_cast<QStandardItemModel*>(mMessageListModel)); |
315 |
321 |
316 QObject::connect(mMessageListModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), |
322 QObject::connect(mMessageListModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), |
317 this, SLOT(itemsAdded(const QModelIndex&,int,int)),Qt::UniqueConnection); |
323 this, SLOT(itemsAdded(const QModelIndex&,int,int)),Qt::UniqueConnection); |
318 QObject::connect(mMessageListModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), |
324 QObject::connect(mMessageListModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), |
319 this, SLOT(itemsRemoved()),Qt::UniqueConnection); |
325 this, SLOT(itemsRemoved()),Qt::UniqueConnection); |
320 QObject::connect(mMessageListModel, SIGNAL(setNewParam(NmUiStartParam*)), |
326 QObject::connect(mMessageListModel, SIGNAL(setNewParam(NmUiStartParam*)), |
321 this, SLOT(reloadViewContents(NmUiStartParam*)),Qt::UniqueConnection); |
327 this, SLOT(reloadViewContents(NmUiStartParam*)),Qt::UniqueConnection); |
322 |
328 |
323 mPreviousModelCount = mMessageListModel->rowCount(); |
329 mPreviousModelCount=mMessageListModel->rowCount(); |
324 |
330 |
325 if (mPreviousModelCount == 0) { |
331 if (mPreviousModelCount == 0) { |
326 showNoMessagesText(); |
332 showNoMessagesText(); |
327 } |
333 } |
328 else { |
334 else { |
329 hideNoMessagesText(); |
335 hideNoMessagesText(); |
330 } |
336 } |
331 } |
337 } |
332 |
338 |
333 // Notify the mail agent. |
339 // Notify the mail agent. |
334 NmUiEventsNotifier::notifyViewStateChanged(NmUiEventsNotifier::NmViewShownEvent, |
340 NmUiEventsNotifier::notifyViewStateChanged(NmUiEventsNotifier::NmViewShownEvent, |
335 NmUiViewMessageList, |
341 NmUiViewMessageList, |
336 mailboxId); |
342 mStartParam->mailboxId()); |
337 } |
343 } |
338 } |
344 } |
339 } |
345 |
340 |
346 |
341 |
347 /*! |
342 /*! |