messagingapp/msgui/msgapp/src/msglistview.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
    17 
    17 
    18 #include "msglistview.h"
    18 #include "msglistview.h"
    19 
    19 
    20 // SYSTEM INCLUDES
    20 // SYSTEM INCLUDES
    21 #include <hbmenu.h>
    21 #include <hbmenu.h>
    22 #include <hbinstance.h>
       
    23 #include <hbapplication.h>
       
    24 #include <hbaction.h>
    22 #include <hbaction.h>
    25 #include <hbtoolbar.h>
    23 #include <hbtoolbar.h>
    26 #include <hbtoolbarextension.h>
    24 #include <hbtoolbarextension.h>
    27 #include <hblistview.h>
    25 #include <hblistview.h>
    28 #include <hblistwidget.h>
    26 #include <hblistwidget.h>
    29 #include <hblistwidgetitem.h>
    27 #include <hblistwidgetitem.h>
    30 #include <hbnotificationdialog.h>
       
    31 #include <hbgroupbox.h>
    28 #include <hbgroupbox.h>
    32 #include <hbmessagebox.h>
    29 #include <hbmessagebox.h>
    33 #include <hbframebackground.h>
    30 #include <hbframebackground.h>
    34 #include <QProcess>
       
    35 #include <QSortFilterProxyModel>
    31 #include <QSortFilterProxyModel>
    36 #include <QGraphicsLinearLayout>
    32 #include <QGraphicsLinearLayout>
    37 //cp settings launcher.
       
    38 #include <cppluginlauncher.h>
       
    39 #include <hblistviewitem.h>
    33 #include <hblistviewitem.h>
    40 #include <HbStyleLoader>
    34 #include <HbStyleLoader>
    41 #include <hbeffect.h>
    35 #include <HbMainWindow>
       
    36 #include <xqaiwrequest.h>
       
    37 #include <xqappmgr.h>
       
    38 #include <qtcontacts.h>
    42 
    39 
    43 // USER INCLUDES
    40 // USER INCLUDES
    44 #include "msgconversationviewinterface.h"
    41 #include "msgconversationviewinterface.h"
    45 #include "debugtraces.h"
    42 #include "debugtraces.h"
    46 #include "conversationsengine.h"
    43 #include "conversationsengine.h"
    47 #include "conversationsenginedefines.h"
    44 #include "conversationsenginedefines.h"
    48 
    45 #include "convergedmessage.h"
    49 #include "msglistviewitem.h"
    46 #include "msglistviewitem.h"
       
    47 
       
    48 QTM_USE_NAMESPACE
    50 
    49 
    51 //Icons
    50 //Icons
    52 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal");
    51 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal");
    53 const QString NEW_MESSAGE_ICON("qtg_mono_create_message");
    52 const QString NEW_MESSAGE_ICON("qtg_mono_create_message");
    54 const QString SORT_ICON("qtg_mono_sort");
    53 const QString SORT_ICON("qtg_mono_sort");
    55 
    54 
    56 //Localized constants
    55 //Localized constants
    57 #define LOC_MENU_DELETE_CONVERSATION hbTrId("txt_messaging_menu_delete_conversation")
    56 
    58 #define LOC_DIALOG_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_delete_conversation")
    57 #define LOC_DIALOG_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_delete_conversation")
    59 #define LOC_POPINFO_CONVERSATION_DELETED hbTrId("txt_messaging_dpopinfo_conversation_deleted")
    58 
    60 
    59 //itemspecific menu
    61 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    60 #define LOC_OPEN hbTrId("txt_common_menu_open")
       
    61 #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
       
    62 #define LOC_DELETE_CONVERSATION hbTrId("txt_messaging_menu_delete_conversation")
       
    63 #define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
       
    64 
    62 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    65 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    63 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    66 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    64 
    67 
    65 #define LOC_SETTINGS hbTrId("txt_messaging_opt_settings")
    68 //main menu
       
    69 #define LOC_SETTINGS    hbTrId("txt_messaging_opt_settings")
    66 
    70 
    67 #define LOC_TB_VIEW_EXTN hbTrId("txt_messaging_button_view")
    71 #define LOC_TB_VIEW_EXTN hbTrId("txt_messaging_button_view")
    68 #define LOC_TB_NEW_MESSAGE hbTrId("txt_messaging_button_new_message")
    72 #define LOC_TB_NEW_MESSAGE hbTrId("txt_messaging_button_new_message")
    69 #define LOC_TB_EXTN_DRAFTS hbTrId("txt_messaging_button_drafts")
    73 #define LOC_TB_EXTN_DRAFTS hbTrId("txt_messaging_button_drafts")
    70 #define LOC_TB_EXTN_CONVERSATIONS hbTrId("txt_messaging_button_conversations")
    74 #define LOC_TB_EXTN_CONVERSATIONS hbTrId("txt_messaging_button_conversations")
    71 
    75 
    72 #define LOC_VIEW_HEADING hbTrId("txt_messaging_title_conversations")
    76 #define LOC_VIEW_HEADING hbTrId("txt_messaging_title_conversations")
    73 
    77 
    74 //const int MSGSETTINGSPLUGIN_UID = 0x2001FE74;
       
    75 //---------------------------------------------------------------
    78 //---------------------------------------------------------------
    76 // MsgListView::MsgListView
    79 // MsgListView::MsgListView
    77 // @see header
    80 // @see header
    78 //---------------------------------------------------------------
    81 //---------------------------------------------------------------
    79 MsgListView::MsgListView(QGraphicsItem *parent) :
    82 MsgListView::MsgListView(QGraphicsItem *parent) :
    80     MsgBaseView(parent)
    83     MsgBaseView(parent)
    81 {
    84 {
    82     // Create the MsgListView.
    85     connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
    83     createView();
       
    84 }
    86 }
    85 
    87 
    86 //---------------------------------------------------------------
    88 //---------------------------------------------------------------
    87 // MsgListView::~MsgListView
    89 // MsgListView::~MsgListView
    88 // @see header
    90 // @see header
    89 //---------------------------------------------------------------
    91 //---------------------------------------------------------------
    90 MsgListView::~MsgListView()
    92 MsgListView::~MsgListView()
    91 {
    93 {
    92     mMsgList->setModel(NULL);
    94     
    93 }
    95 }
    94 
    96 
    95 //---------------------------------------------------------------
    97 //---------------------------------------------------------------
    96 // MsgListView::longPressed
    98 // MsgListView::longPressed
    97 // @see header
    99 // @see header
   104         mMsgList->setCurrentIndex(viewItem->modelIndex(), QItemSelectionModel::Select);
   106         mMsgList->setCurrentIndex(viewItem->modelIndex(), QItemSelectionModel::Select);
   105 
   107 
   106         // Create new menu
   108         // Create new menu
   107         HbMenu *contextMenu = new HbMenu();
   109         HbMenu *contextMenu = new HbMenu();
   108 
   110 
   109         // Add the menu items
   111         //open menu option
   110         HbAction *contextItem1 = contextMenu->addAction(LOC_COMMON_OPEN);
   112         contextMenu->addAction(LOC_OPEN,this,SLOT(openConversation()));
   111         connect(contextItem1, SIGNAL(triggered()), this, SLOT(
   113         
   112             openConversation()));
   114         //save to contacts for unresolved.
   113 
   115         int msgType = viewItem->modelIndex().data(MessageType).toInt();
   114         //This Item specific option is not mentioned in the UI spec
   116         if(msgType == ConvergedMessage::Sms || 
   115         HbAction *contextItem2 = contextMenu->addAction(tr("Show contact info"));
   117            msgType == ConvergedMessage::Mms || 
   116         connect(contextItem2, SIGNAL(triggered()), this, SLOT(showContact()));
   118            msgType == ConvergedMessage::BioMsg)
   117 
   119             {
   118         qint64 conversationId = mMsgList->currentIndex().data(ConversationId).toLongLong();
   120             qint64 contactId = mMsgList->currentIndex().data(ContactId).toLongLong();
   119 
   121             if(contactId < 0)
   120         bool isNotSent = false; //TODO implement new api 
   122                 {
   121         //MessageModel::instance()->isMessageSendingOrScheduled(conversationId);
   123                 contextMenu->addAction(LOC_SAVETO_CONTACTS,this,SLOT(saveToContacts()));
   122         // Display Delete option only if conversation does not contain 
   124                 }
   123         // any message which is yet to be sent
   125             else
   124         if (isNotSent == false) {
   126                 {
   125             HbAction *contextItem3 = contextMenu->addAction(LOC_MENU_DELETE_CONVERSATION);
   127                 contextMenu->addAction(LOC_OPEN_CONTACT_INFO,this,SLOT(contactInfo()));
   126             connect(contextItem3, SIGNAL(triggered()), this, SLOT(deleteItem()));
   128                 }
   127         }
   129             }
       
   130         
       
   131         //delete conversation
       
   132         contextMenu->addAction(LOC_DELETE_CONVERSATION,this,SLOT(deleteItem()));
   128 
   133 
   129         contextMenu->exec(point);
   134         contextMenu->exec(point);
   130 
       
   131         // Cleanup
   135         // Cleanup
   132         delete contextMenu;
   136         delete contextMenu;
   133     }
   137     }
   134 }
   138 }
   135 
   139 
   153         emit switchView(param);
   157         emit switchView(param);
   154     }
   158     }
   155 }
   159 }
   156 
   160 
   157 //---------------------------------------------------------------
   161 //---------------------------------------------------------------
   158 // MsgListView::sortBySubject
       
   159 // @see header
       
   160 //---------------------------------------------------------------
       
   161 void MsgListView::sortBySubject()
       
   162 {
       
   163     //	mProxyModel->setSortRole(LatestMsg);
       
   164     //	mProxyModel->sort(0, Qt::AscendingOrder);
       
   165 }
       
   166 
       
   167 //---------------------------------------------------------------
       
   168 // MsgListView::sortByDate
       
   169 // @see header
       
   170 //---------------------------------------------------------------
       
   171 void MsgListView::sortByDate()
       
   172 {
       
   173     //	mProxyModel->setSortRole(LatestMsgTimeStamp);
       
   174     //	mProxyModel->sort(0, Qt::DescendingOrder);
       
   175 }
       
   176 
       
   177 //---------------------------------------------------------------
       
   178 // MsgListView::sortBySender
       
   179 // @see header
       
   180 //---------------------------------------------------------------
       
   181 void MsgListView::sortBySender()
       
   182 {
       
   183     //	mProxyModel->setSortRole(ContactName);
       
   184     //	mProxyModel->sort(0, Qt::AscendingOrder);
       
   185 }
       
   186 
       
   187 //---------------------------------------------------------------
       
   188 // MsgListView::sendNewMessage
   162 // MsgListView::sendNewMessage
   189 // @see header
   163 // @see header
   190 //---------------------------------------------------------------
   164 //---------------------------------------------------------------
   191 void MsgListView::sendNewMessage()
   165 void MsgListView::sendNewMessage()
   192 {
   166 {
   193     QVariantList param;
   167     QVariantList param;
   194     param << MsgBaseView::UNIEDITOR; // target view
   168     param << MsgBaseView::UNIEDITOR; // target view
   195     param << MsgBaseView::CLV; // source view
   169     param << MsgBaseView::CLV; // source view
   196 
   170 
   197     emit switchView(param);
   171     emit switchView(param);
   198 }
       
   199 
       
   200 //---------------------------------------------------------------
       
   201 // MsgListView::closeActiveClats
       
   202 // @see header
       
   203 //---------------------------------------------------------------
       
   204 void MsgListView::closeActiveChats()
       
   205 {
       
   206     // Implementation for closing all active chats
       
   207 }
       
   208 
       
   209 //---------------------------------------------------------------
       
   210 // MsgListView::deleteAll
       
   211 // @see header
       
   212 //---------------------------------------------------------------
       
   213 void MsgListView::deleteAll()
       
   214 {
       
   215 }
       
   216 
       
   217 //---------------------------------------------------------------
       
   218 // MsgListView::viewImMessagesSeperately
       
   219 // @see header
       
   220 //---------------------------------------------------------------
       
   221 void MsgListView::viewImMessagesSeparately()
       
   222 {
       
   223     //Lists all the Im messages separately
       
   224 }
   172 }
   225 
   173 
   226 //---------------------------------------------------------------
   174 //---------------------------------------------------------------
   227 // MsgListView::settings
   175 // MsgListView::settings
   228 // @see header
   176 // @see header
   263 #ifdef _DEBUG_TRACES_
   211 #ifdef _DEBUG_TRACES_
   264     qDebug() << "Inside MsgListView::deleteItem";
   212     qDebug() << "Inside MsgListView::deleteItem";
   265 #endif
   213 #endif
   266 
   214 
   267     QModelIndex index = mMsgList->currentIndex();
   215     QModelIndex index = mMsgList->currentIndex();
   268     qint64 conversationId = 0;
   216     qint64 conversationId = index.data(ConversationId).toLongLong();
   269     conversationId = index.data(ConversationId).toLongLong();
   217 
   270 
   218     //confirmation dialog.
   271     bool result = HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION,
   219     bool result = HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION,
   272         LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL);
   220                                          LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL);
   273     if (result) {
   221     if (result) 
       
   222         {
   274         ConversationsEngine::instance()->deleteConversations(conversationId);
   223         ConversationsEngine::instance()->deleteConversations(conversationId);
   275         HbNotificationDialog::launchDialog(LOC_POPINFO_CONVERSATION_DELETED);
   224         }
   276     }
   225     
   277 #ifdef _DEBUG_TRACES_	
   226 #ifdef _DEBUG_TRACES_	
   278     qDebug() << " Leaving MsgConversationView::deleteItem";
   227     qDebug() << " Leaving MsgConversationView::deleteItem";
   279 #endif
   228 #endif
   280 }
       
   281 
       
   282 //---------------------------------------------------------------
       
   283 // MsgListView::createView
       
   284 // @see header
       
   285 //---------------------------------------------------------------
       
   286 void MsgListView::createView()
       
   287 {
       
   288     setupMenu();
       
   289     setupToolBar();
       
   290     setupListView();
       
   291 }
   229 }
   292 
   230 
   293 //---------------------------------------------------------------
   231 //---------------------------------------------------------------
   294 // MsgListView::setupView
   232 // MsgListView::setupView
   295 // @see header
   233 // @see header
   301     mainLayout->setContentsMargins(0, 0, 0, 0);
   239     mainLayout->setContentsMargins(0, 0, 0, 0);
   302     mainLayout->setSpacing(0);
   240     mainLayout->setSpacing(0);
   303 
   241 
   304     // Create view heading.
   242     // Create view heading.
   305     HbGroupBox *viewHeading = new HbGroupBox();
   243     HbGroupBox *viewHeading = new HbGroupBox();
   306     viewHeading->setTitleText(LOC_VIEW_HEADING);
   244     viewHeading->setHeading(LOC_VIEW_HEADING);
   307 
   245 
   308     // Register the custorm css path.
   246     // Register the custorm css path.
   309     HbStyleLoader::registerFilePath(":/msglistviewitem.css");
   247     HbStyleLoader::registerFilePath(":/xml/msglistviewitem.css");
   310     HbStyleLoader::registerFilePath(":/msglistviewitem.widgetml");
   248     HbStyleLoader::registerFilePath(":/xml/msglistviewitem.widgetml");
   311 
   249 
   312     mMsgList = new HbListView(this);
   250     mMsgList = new HbListView(this);
   313 
   251     mMsgList->setScrollingStyle(HbScrollArea::PanOrFlick);
   314     HbEffect::add(QString("ListView"), QString(":/slide_in_from_screen_bottom.fxml"), QString(
   252     mMsgList->setClampingStyle(HbScrollArea::BounceBackClamping);
   315         "show"));
       
   316 
   253 
   317     mMsgList->setLayoutName("custom");
   254     mMsgList->setLayoutName("custom");
   318     mMsgList->setItemRecycling(false);
   255     mMsgList->setItemRecycling(true);
   319     mMsgList->setUniformItemSizes(true);
   256     mMsgList->setUniformItemSizes(true);   
   320    
   257 
   321     mMsgList->setScrollingStyle(HbScrollArea::PanOrFlick);
       
   322     MsgListViewItem *prototype = new MsgListViewItem(this);
   258     MsgListViewItem *prototype = new MsgListViewItem(this);
   323     mMsgList->setItemPrototype(prototype);
   259     mMsgList->setItemPrototype(prototype);
   324 
   260 
   325     // Set proxy model
   261     // Set proxy model
   326     mProxyModel = new QSortFilterProxyModel(this);
   262     QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
   327     mProxyModel->setDynamicSortFilter(true);
   263     proxyModel->setDynamicSortFilter(true);
   328     mProxyModel->setSourceModel(ConversationsEngine::instance()->getConversationsSummaryModel());
   264     proxyModel->setSourceModel(ConversationsEngine::instance()->getConversationsSummaryModel());
   329     mProxyModel->setSortRole(TimeStamp);
   265     proxyModel->setSortRole(TimeStamp);
   330     mProxyModel->sort(0, Qt::DescendingOrder);
   266     proxyModel->sort(0, Qt::DescendingOrder);
   331 
   267 
   332     mMsgList->setModel(mProxyModel);
   268     mMsgList->setModel(proxyModel);
   333 
   269 
   334     connect(ConversationsEngine::instance(), SIGNAL(conversationListModelPopulated()), this,
   270     connect(ConversationsEngine::instance(), SIGNAL(conversationListModelPopulated()),
   335         SLOT(populateListView()));
   271             this, SLOT(populateListView()));
   336 
   272 
   337     // Single tap list item
   273     // Single tap list item
   338     connect(mMsgList, SIGNAL(activated(const QModelIndex&)), this,
   274     connect(mMsgList, SIGNAL(activated(const QModelIndex&)),
   339         SLOT(openConversation(const QModelIndex&)));
   275             this, SLOT(openConversation(const QModelIndex&)));
   340 
   276 
   341     // Long tap list item
   277     // Long tap list item
   342     connect(mMsgList, SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)), this,
   278     connect(mMsgList, SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
   343         SLOT(longPressed(HbAbstractViewItem*, const QPointF&)));
   279             this, SLOT(longPressed(HbAbstractViewItem*, const QPointF&)));
   344 
   280 
   345     // Add all widgets to main layout.
   281     // Add all widgets to main layout.
   346     mainLayout->addItem(viewHeading);
   282     mainLayout->addItem(viewHeading);
   347     mainLayout->addItem(mMsgList);
   283     mainLayout->addItem(mMsgList);
   348 
   284 
   354 // @see header
   290 // @see header
   355 //---------------------------------------------------------------
   291 //---------------------------------------------------------------
   356 void MsgListView::setupMenu()
   292 void MsgListView::setupMenu()
   357 {
   293 {
   358     // Main menu
   294     // Main menu
   359     // Get the menu pointer for the view
       
   360 
       
   361     HbMenu* mainMenu = this->menu();
   295     HbMenu* mainMenu = this->menu();
   362 
   296     mainMenu->addAction(LOC_SETTINGS,this,SLOT(settings()));
   363     // Delete (This option is not mentioned in the UI spec 1.04)
       
   364     HbAction* deleteItem = mainMenu->addAction(tr("Delete"));
       
   365     connect(deleteItem, SIGNAL(triggered()), this, SLOT(deleteAll()));
       
   366 
       
   367     // Settings
       
   368     HbAction* settings = mainMenu->addAction(LOC_SETTINGS);
       
   369     connect(settings, SIGNAL(triggered()), this, SLOT(settings()));
       
   370 }
   297 }
   371 
   298 
   372 //---------------------------------------------------------------
   299 //---------------------------------------------------------------
   373 // MsgListView::setupToolBar
   300 // MsgListView::setupToolBar
   374 // @see header
   301 // @see header
   380     toolBar->setOrientation(Qt::Horizontal);
   307     toolBar->setOrientation(Qt::Horizontal);
   381 
   308 
   382     // Create & setup ToolBar Extension
   309     // Create & setup ToolBar Extension
   383     HbToolBarExtension *viewExtn = new HbToolBarExtension();
   310     HbToolBarExtension *viewExtn = new HbToolBarExtension();
   384     HbAction *viewAction = toolBar->addExtension(viewExtn);
   311     HbAction *viewAction = toolBar->addExtension(viewExtn);
   385     viewAction->setText(LOC_TB_VIEW_EXTN);
       
   386     viewAction->setIcon(HbIcon(SORT_ICON));
   312     viewAction->setIcon(HbIcon(SORT_ICON));
   387 
   313 
   388     mViewExtnList = new HbListWidget();
   314     mViewExtnList = new HbListWidget();
   389     mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS);
   315     mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS);
   390     mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS);
   316     mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS);
   391 
   317 
   392     HbListViewItem *prototype = mViewExtnList->listItemPrototype();
   318     HbListViewItem *prototype = mViewExtnList->listItemPrototype();
   393     HbFrameBackground frame(POPUP_LIST_FRAME, HbFrameDrawer::NinePieces);
   319     HbFrameBackground frame(POPUP_LIST_FRAME, HbFrameDrawer::NinePieces);
   394     prototype->setDefaultFrame(frame);
   320     prototype->setDefaultFrame(frame);
   395 
   321 
   396     connect(mViewExtnList, SIGNAL(activated(HbListWidgetItem*)), this,
   322     connect(mViewExtnList, SIGNAL(activated(HbListWidgetItem*)),
   397         SLOT(handleViewExtnActivated(HbListWidgetItem*)));
   323             this,SLOT(handleViewExtnActivated(HbListWidgetItem*)));
   398     connect(mViewExtnList, SIGNAL(activated(HbListWidgetItem*)), viewExtn, SLOT(close()));
   324     connect(mViewExtnList, SIGNAL(released(HbListWidgetItem*)), viewExtn, SLOT(close()));
   399 
   325 
   400     viewExtn->setContentWidget(mViewExtnList);
   326     viewExtn->setContentWidget(mViewExtnList);
   401 
   327     
   402     // Create & setup 2nd ToolBar button.
   328     // Create & setup 2nd ToolBar button.
   403     HbAction* newMessageAction = new HbAction(HbIcon(NEW_MESSAGE_ICON), LOC_TB_NEW_MESSAGE, this);
   329     toolBar->addAction(HbIcon(NEW_MESSAGE_ICON),"",this,SLOT(sendNewMessage()));
   404     connect(newMessageAction, SIGNAL(triggered()), this, SLOT(sendNewMessage()));
       
   405     toolBar->addAction(newMessageAction);
       
   406 }
       
   407 
       
   408 //---------------------------------------------------------------
       
   409 // MsgListView::activateView
       
   410 // @see header
       
   411 //---------------------------------------------------------------
       
   412 void MsgListView::activateView()
       
   413 {
       
   414     HbEffect::start(mMsgList, QString("ListView"), QString("show"), this, NULL);
       
   415 }
       
   416 
       
   417 //---------------------------------------------------------------
       
   418 // MsgListView::populateListView
       
   419 // @see header
       
   420 //---------------------------------------------------------------
       
   421 void MsgListView::populateListView()
       
   422 {
       
   423 
       
   424 }
   330 }
   425 
   331 
   426 //---------------------------------------------------------------
   332 //---------------------------------------------------------------
   427 // MsgListView::handleViewExtnActivated
   333 // MsgListView::handleViewExtnActivated
   428 // @see header
   334 // @see header
   437 
   343 
   438         emit switchView(param);
   344         emit switchView(param);
   439     }
   345     }
   440 }
   346 }
   441 
   347 
       
   348 //---------------------------------------------------------------
       
   349 // MsgListView::doDelayedConstruction
       
   350 // @see header
       
   351 //---------------------------------------------------------------
       
   352 void MsgListView::doDelayedConstruction()
       
   353     {
       
   354     setupToolBar();    
       
   355     setupListView();
       
   356     setupMenu();
       
   357     
       
   358     disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
       
   359     }
       
   360 
       
   361 //---------------------------------------------------------------
       
   362 // MsgListView::saveToContacts
       
   363 // @see header
       
   364 //---------------------------------------------------------------
       
   365 void MsgListView::saveToContacts()
       
   366     {
       
   367     //save to contacts with phone number field prefilled.
       
   368     QList<QVariant> args;  
       
   369 
       
   370     QString data = mMsgList->currentIndex().data(DisplayName).toString();
       
   371 
       
   372     QString type = QContactPhoneNumber::DefinitionName;
       
   373 
       
   374     args << type;
       
   375     args << data;
       
   376 
       
   377     //service stuff.
       
   378     QString serviceName("com.nokia.services.phonebookservices");
       
   379     QString operation("editCreateNew(QString,QString)");
       
   380 
       
   381     XQAiwRequest* request;
       
   382     XQApplicationManager appManager;
       
   383     request = appManager.create(serviceName, "Fetch", operation, true); // embedded
       
   384     if ( request == NULL )
       
   385         {
       
   386         return;       
       
   387         }
       
   388 
       
   389     request->setArguments(args);
       
   390     request->send();
       
   391     
       
   392     delete request;
       
   393     }
       
   394 
       
   395 //---------------------------------------------------------------
       
   396 // MsgListView::contactInfo
       
   397 // @see header
       
   398 //---------------------------------------------------------------
       
   399 void MsgListView::contactInfo()
       
   400     {
       
   401     //open contact info.
       
   402     QList<QVariant> args;  
       
   403 
       
   404     int contactId = mMsgList->currentIndex().data(ContactId).toInt();
       
   405 
       
   406     args << contactId;
       
   407 
       
   408     //service stuff.
       
   409     QString serviceName("com.nokia.services.phonebookservices");
       
   410     QString operation("open(int)");
       
   411 
       
   412     XQAiwRequest* request;
       
   413     XQApplicationManager appManager;
       
   414     request = appManager.create(serviceName, "Fetch", operation, true); // embedded
       
   415     if ( request == NULL )
       
   416         {
       
   417         return;       
       
   418         }
       
   419 
       
   420     request->setArguments(args);
       
   421     request->send();
       
   422     
       
   423     delete request;
       
   424     }
       
   425 
   442 //EOF
   426 //EOF