messagingapp/msgui/conversationview/src/msgconversationview.cpp
changeset 38 4e4b6adb1024
parent 37 518b245aa84c
child 41 25fe1fe642e3
equal deleted inserted replaced
37:518b245aa84c 38:4e4b6adb1024
   100     mMessageModel(NULL),
   100     mMessageModel(NULL),
   101     mEditorWidget(NULL),
   101     mEditorWidget(NULL),
   102     mContactCardWidget(contactCardWidget),
   102     mContactCardWidget(contactCardWidget),
   103     mSendUtil(NULL),
   103     mSendUtil(NULL),
   104     mVkbHost(NULL),
   104     mVkbHost(NULL),
       
   105     mVisibleIndex(),
   105     mVkbopened(false),
   106     mVkbopened(false),
   106     mVisibleIndex()
   107     mModelPopulated(false),
   107 {
   108     mViewReady(false)
   108     connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(onViewReady()));
   109 {
   109     //create send utils
   110     //create send utils
   110     mSendUtil = new MsgSendUtil(this);
   111     mSendUtil = new MsgSendUtil(this);
   111     //initialize view
   112     //initialize view
   112     setupView();
   113     setupView();
   113     setupMenu();
   114     setupMenu();
   211     // Just create dummy menu.
   212     // Just create dummy menu.
   212     // Actual menu will be created in menuAboutToShow()
   213     // Actual menu will be created in menuAboutToShow()
   213     HbMenu *mainMenu = this->menu();
   214     HbMenu *mainMenu = this->menu();
   214     HbAction* clearConversation = mainMenu->addAction(QString());
   215     HbAction* clearConversation = mainMenu->addAction(QString());
   215     connect(mainMenu, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
   216     connect(mainMenu, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
       
   217 }
       
   218 
       
   219 //---------------------------------------------------------------
       
   220 // MsgConversationView::fetchMoreConversations
       
   221 // @see header file
       
   222 //---------------------------------------------------------------
       
   223 void MsgConversationView::fetchMoreConversations()
       
   224 {
       
   225     if (mViewReady && mModelPopulated) {
       
   226         ConversationsEngine::instance()->fetchMoreConversations();
       
   227         mViewReady = mModelPopulated = false;
       
   228     }
   216 }
   229 }
   217 
   230 
   218 //---------------------------------------------------------------
   231 //---------------------------------------------------------------
   219 // MsgConversationView::refreshView()
   232 // MsgConversationView::refreshView()
   220 // @see header file
   233 // @see header file
   818     QList<QVariant> args;
   831     QList<QVariant> args;
   819     QString serviceName("com.nokia.services.btmsgdispservices");
   832     QString serviceName("com.nokia.services.btmsgdispservices");
   820     QString operation("displaymsg(int)");
   833     QString operation("displaymsg(int)");
   821     XQAiwRequest* request;
   834     XQAiwRequest* request;
   822     XQApplicationManager appManager;
   835     XQApplicationManager appManager;
   823     request = appManager.create(serviceName, "displaymsg", operation, true); // embedded
   836     request = appManager.create(serviceName, "displaymsg", operation, false); // embedded
   824     
   837     
   825     if ( request == NULL )
   838     if ( request == NULL )
   826         {
   839         {
   827         return;
   840         return;
   828         }
   841         }
   829 
   842 
   830     args << QVariant(messageId);
   843     args << QVariant(messageId);
       
   844     request->setSynchronous(true);
   831     
   845     
   832     request->setArguments(args);
   846     request->setArguments(args);
   833     request->send();
   847     request->send();
   834     delete request;    
   848     delete request;    
   835 }
   849 }
  1119 // MsgConversationView::populateConversationsView
  1133 // MsgConversationView::populateConversationsView
  1120 // @see header file
  1134 // @see header file
  1121 //---------------------------------------------------------------
  1135 //---------------------------------------------------------------
  1122 void MsgConversationView::populateConversationsView()
  1136 void MsgConversationView::populateConversationsView()
  1123 {    
  1137 {    
       
  1138     mModelPopulated = true;
  1124     mConversationList->setModel(mMessageModel);
  1139     mConversationList->setModel(mMessageModel);
  1125     
  1140     
  1126     refreshView();
  1141     refreshView();
  1127     scrollToBottom();
  1142     scrollToBottom();
       
  1143     fetchMoreConversations();
  1128 }
  1144 }
  1129 
  1145 
  1130 //---------------------------------------------------------------
  1146 //---------------------------------------------------------------
  1131 // MsgConversationView::saveRingingTone
  1147 // MsgConversationView::saveRingingTone
  1132 // @see header file
  1148 // @see header file
  1377 // MsgConversationView::onViewReady
  1393 // MsgConversationView::onViewReady
  1378 // @see header file
  1394 // @see header file
  1379 //---------------------------------------------------------------
  1395 //---------------------------------------------------------------
  1380 void MsgConversationView::onViewReady()
  1396 void MsgConversationView::onViewReady()
  1381 {
  1397 {
       
  1398     mViewReady = true;
  1382     //Disconnect list View's signals, for avoiding execution of the default implementaion
  1399     //Disconnect list View's signals, for avoiding execution of the default implementaion
  1383     disconnect(mainWindow(), SIGNAL(aboutToChangeOrientation()), mConversationList, 0);
  1400     disconnect(mainWindow(), SIGNAL(aboutToChangeOrientation()), mConversationList, 0);
  1384     disconnect(mainWindow(), SIGNAL(orientationChanged(Qt: rientation)), mConversationList, 0);
  1401     disconnect(mainWindow(), SIGNAL(orientationChanged(Qt: rientation)), mConversationList, 0);
       
  1402     
       
  1403    fetchMoreConversations();
  1385 }
  1404 }
  1386 // EOF
  1405 // EOF