--- a/messagingapp/msgui/msgapp/src/draftslistview.cpp Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/draftslistview.cpp Fri Jun 25 15:47:40 2010 +0530
@@ -43,7 +43,6 @@
#include "convergedmessageid.h"
// LOCAL CONSTANTS
-const QString LIST_ITEM_FRAME("qtg_fr_list_normal");
const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal");
const QString NEW_MESSAGE_ICON("qtg_mono_create_message");
const QString SORT_ICON("qtg_mono_sort");
@@ -67,15 +66,16 @@
// Confirmation note
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
#define LOC_DELETE_ALL_DRAFTS hbTrId("txt_messaging_dialog_delate_all_drafts")
-#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
//---------------------------------------------------------------
// DraftsListView::DraftsListView
// @see header
//---------------------------------------------------------------
DraftsListView::DraftsListView(QGraphicsItem *parent) :
- MsgBaseView(parent), mListView(0), mViewExtnList(0), mToolBar(0)
+ MsgBaseView(parent),
+ mListView(0),
+ mViewExtnList(0),
+ mToolBar(0)
{
// Delayed loading.
connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedLoading()));
@@ -120,6 +120,7 @@
viewAction->setIcon(HbIcon(SORT_ICON));
mViewExtnList = new HbListWidget();
+ mViewExtnList->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS);
mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS);
@@ -163,7 +164,7 @@
mListView->setClampingStyle(HbScrollArea::BounceBackClamping);
// Register the custorm css path.
- HbStyleLoader::registerFilePath(":/xml/hblistviewitem.css");
+ HbStyleLoader::registerFilePath(":/dlv");
// mListView->setLayoutName("custom");
// Set list item properties.
@@ -171,8 +172,6 @@
prototype->setGraphicsSize(HbListViewItem::SmallIcon);
prototype->setStretchingStyle(HbListViewItem::StretchLandscape);
prototype->setSecondaryTextRowCount(1, 1);
- HbFrameBackground frame(LIST_ITEM_FRAME, HbFrameDrawer::NinePieces);
- prototype->setDefaultFrame(frame);
// Create and set model
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
@@ -229,14 +228,9 @@
return;
}
- bool result = HbMessageBox::question(LOC_DELETE_MESSAGE, LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL);
-
- if (result) {
- int msgId = index.data(ConvergedMsgId).toInt();
- QList<int> msgIdList;
- msgIdList.append(msgId);
- ConversationsEngine::instance()->deleteMessages(msgIdList);
- }
+ HbMessageBox::question(LOC_DELETE_MESSAGE,
+ this,SLOT(onDialogDeleteMsg(HbAction*)),
+ HbMessageBox::Delete | HbMessageBox::Cancel);
}
@@ -246,12 +240,9 @@
//------------------------------------------------------------------------------
void DraftsListView::deleteAllDraftMessage()
{
- bool result = HbMessageBox::question(LOC_DELETE_ALL_DRAFTS, LOC_BUTTON_DELETE,
- LOC_BUTTON_CANCEL);
-
- if (result) {
- ConversationsEngine::instance()->deleteAllDraftMessages();
- }
+ HbMessageBox::question(LOC_DELETE_ALL_DRAFTS,
+ this,SLOT(onDialogDeleteAllMessages(HbAction*)),
+ HbMessageBox::Delete | HbMessageBox::Cancel);
}
//------------------------------------------------------------------------------
@@ -305,7 +296,7 @@
mListView->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Select);
HbMenu *contextMenu = new HbMenu();
-
+ contextMenu->setAttribute(Qt::WA_DeleteOnClose);
// Open
HbAction* openAction = contextMenu->addAction(LOC_COMMON_OPEN);
connect(openAction, SIGNAL(triggered()), this, SLOT(openDraftMessage()));
@@ -314,8 +305,8 @@
HbAction *deletAction = contextMenu->addAction(LOC_COMMON_DELETE);
connect(deletAction, SIGNAL(triggered()), this, SLOT(deleteDraftMessage()));
- contextMenu->exec(coords);
- delete contextMenu;
+ contextMenu->setPreferredPos(coords);
+ contextMenu->show();
}
}
@@ -353,4 +344,35 @@
}
}
+//------------------------------------------------------------------------------
+// DraftsListView::onDialogDeleteMsg
+// @see header
+//------------------------------------------------------------------------------
+void DraftsListView::onDialogDeleteMsg(HbAction* action)
+{
+ HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+ if (action == dlg->actions().at(0)) {
+ QModelIndex index = mListView->currentIndex();
+ if (index.isValid()) {
+ int msgId = index.data(ConvergedMsgId).toInt();
+ QList<int> msgIdList;
+ msgIdList.append(msgId);
+ ConversationsEngine::instance()->deleteMessages(msgIdList);
+ }
+
+ }
+}
+
+//------------------------------------------------------------------------------
+// DraftsListView::onDialogDeleteMsg
+// @see header
+//------------------------------------------------------------------------------
+void DraftsListView::onDialogDeleteAllMessages(HbAction* action)
+{
+ HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+ if (action == dlg->actions().at(0)) {
+ ConversationsEngine::instance()->deleteAllDraftMessages();
+ }
+}
+
// EOF