messagingapp/msgui/conversationview/src/msgconversationview.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
    18 #include "msgconversationview.h"
    18 #include "msgconversationview.h"
    19 
    19 
    20 // SYSTEM INCLUDES
    20 // SYSTEM INCLUDES
    21 #include <HbMenu>
    21 #include <HbMenu>
    22 #include <HbAction>
    22 #include <HbAction>
    23 #include <HbInstance>
       
    24 #include <HbApplication>
       
    25 #include <HbDialog>
       
    26 #include <HbLabel>
       
    27 #include <HbWidget>
       
    28 #include <HbListView>
    23 #include <HbListView>
    29 #include <hbmessagebox.h>
    24 #include <HbMessageBox>
    30 #include <hbnotificationdialog.h>
    25 #include <HbNotificationDialog>
    31 #include <HbEffect>
    26 #include <XQServiceRequest.h>
       
    27 #include <HbStaticVkbHost>
       
    28 #include <xqaiwrequest.h>
       
    29 #include <xqappmgr.h>
    32 
    30 
    33 #include <QDir>
    31 #include <QDir>
    34 #include <QLibraryInfo>
       
    35 #include <QPluginLoader>
       
    36 #include <QDateTime>
    32 #include <QDateTime>
    37 #include <QGraphicsLinearLayout>
    33 #include <QGraphicsLinearLayout>
    38 #include <QStandardItemModel>
    34 #include <QStandardItemModel>
    39 
    35 
       
    36 #include <cntservicescontact.h>
       
    37 #include <ccsdefs.h>
       
    38 #include <centralrepository.h>
       
    39 #include <MmsEngineDomainCRKeys.h>
       
    40 
    40 // USER INCLUDES
    41 // USER INCLUDES
    41 #include "msguiutilsmanager.h"
    42 #include "msgsendutil.h"
    42 #include "msgconversationviewitem.h"
    43 #include "msgconversationviewitem.h"
    43 #include "conversationsengine.h"
    44 #include "conversationsengine.h"
    44 #include "convergedmessageid.h"
    45 #include "convergedmessageid.h"
    45 #include "convergedmessage.h"
       
    46 #include "conversationsenginedefines.h"
    46 #include "conversationsenginedefines.h"
    47 #include "msgcontactcardwidget.h"
    47 #include "msgcontactcardwidget.h"
    48 #include "msgeditorwidget.h"
    48 #include "msgeditorwidget.h"
    49 #include "msgviewdefines.h"
    49 #include "msgviewdefines.h"
    50 #include "debugtraces.h"
    50 #include "debugtraces.h"
    51 #include "unidatamodelloader.h"
    51 #include "unidatamodelloader.h"
    52 #include "unidatamodelplugininterface.h"
    52 #include "unidatamodelplugininterface.h"
    53 #include "ringbc.h"
    53 #include "ringbc.h"
    54 
    54 #include "mmsconformancecheck.h"
    55 // LOCAL CONSTANTS
    55 
    56 const QString M_SERVER("mserver");
    56 //Item specific menu.
    57 const QString SMS("sms");
       
    58 
    57 
    59 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    58 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open")
    60 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
    59 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
    61 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward")
    60 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward")
    62 #define LOC_COMMON_SAVE hbTrId("txt_common_menu_save")
    61 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download")
    63 
    62 #define LOC_COMMON_SEND  hbTrId("txt_common_menu_send") 
    64 #define LOC_DELETE_CONVERSATION hbTrId("txt_messaging_dialog_delete_conversation")
    63 
    65 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    64 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
    66 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    65 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
       
    66 #define LOC_BUTTON_OK hbTrId("txt_common_button_ok")
    67 
    67 
    68 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    68 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
    69 #define LOC_DELETE_POPINFO hbTrId("txt_messaging_dpopinfo_message_deleted")
    69 
    70 
    70 //main menu
    71 const QString HELP(QObject::tr("Help"));
    71 #define LOC_ATTACH          hbTrId("txt_messaging_opt_attach")
    72 
    72 #define LOC_PHOTO           hbTrId("txt_messaging_opt_attach_sub_photo")
    73 #define LOC_ADD hbTrId("txt_messaging_opt_add")
    73 #define LOC_SOUND           hbTrId("txt_messaging_opt_attach_sub_sound")
    74 #define LOC_RECIPIENTS hbTrId("txt_messaging_opt_sub_recipients")
    74 #define LOC_VCARD           hbTrId("txt_messaging_list_business_card")
    75 #define LOC_SUBJECT hbTrId("txt_messaging_opt_sub_subject")
    75 #define LOC_ADD_RECIPIENTS  hbTrId("txt_messaging_opt_add_recipients")
    76 
    76 #define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
    77 #define LOC_ATTACH hbTrId("txt_messaging_opt_attach")
    77 
    78 #define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo")
    78 #define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dpopinfo_sending_failed")
    79 #define LOC_VIDEO hbTrId("txt_messaging_opt_attach_sub_video")
    79 
    80 #define LOC_SOUND hbTrId("txt_messaging_opt_attach_sub_sound")
       
    81 #define LOC_MORE hbTrId("txt_messaging_opt_attach_sub_more")
       
    82 
    80 
    83 const QString PLUGINPATH("conversationviewplugin.dll");
    81 const QString PLUGINPATH("conversationviewplugin.dll");
    84 
    82 
    85 const int INVALID_MSGID = -1;
    83 const int INVALID_MSGID = -1;
       
    84 const int INVALID_CONVID = -1;
       
    85 const int CONTACT_INSERTION_MODE = 1;
       
    86 const int VCARD_INSERTION_MODE = 0;
       
    87 
    86 //---------------------------------------------------------------
    88 //---------------------------------------------------------------
    87 // MsgConversationView::MsgConversationView
    89 // MsgConversationView::MsgConversationView
    88 // @see header file
    90 // @see header file
    89 //---------------------------------------------------------------
    91 //---------------------------------------------------------------
    90 MsgConversationView::MsgConversationView(MsgContactCardWidget *contactCardWidget,
    92 MsgConversationView::MsgConversationView(MsgContactCardWidget *contactCardWidget,
    92     MsgBaseView(parent),
    94     MsgBaseView(parent),
    93     mConversationList(NULL),
    95     mConversationList(NULL),
    94     mMessageModel(NULL),
    96     mMessageModel(NULL),
    95     mEditorWidget(NULL),
    97     mEditorWidget(NULL),
    96     mContactCardWidget(contactCardWidget),
    98     mContactCardWidget(contactCardWidget),
    97     mUiUtilsManager(NULL)
    99     mSendUtil(NULL),
    98 {
   100     mItemLongPressed(false),
    99     // Initialize the Utils manager
   101     mVkbHost(NULL),
   100     mUiUtilsManager = new MsgUiUtilsManager(this);
   102     mVkbopened(false)
   101     // connect the error signal from UtilsManager to the slot
   103 {
   102     // in the conversation view.
   104     //create send utils
   103     connect(mUiUtilsManager,
   105     mSendUtil = new MsgSendUtil(this);
   104             SIGNAL(serviceError(const QString&)),
       
   105             this,
       
   106             SLOT(serviceError(const QString&)));
       
   107 
       
   108     connect(mUiUtilsManager, SIGNAL(imagesFetched(const QVariant&)),
       
   109                      this, SLOT(imagesFetched(const QVariant&)));
       
   110     connect(mUiUtilsManager, SIGNAL(audiosFetched(const QVariant&)),
       
   111                      this, SLOT(audiosFetched(const QVariant&)));
       
   112 
       
   113     //initialize view
   106     //initialize view
   114     setupView();
   107     setupView();
   115     addMenu();
   108     setupMenu();
   116 }
   109 }
   117 
   110 
   118 //---------------------------------------------------------------
   111 //---------------------------------------------------------------
   119 // MsgConversationView::~MsgConversationView
   112 // MsgConversationView::~MsgConversationView
   120 // @see header file
   113 // @see header file
   121 //---------------------------------------------------------------
   114 //---------------------------------------------------------------
   122 MsgConversationView::~MsgConversationView()
   115 MsgConversationView::~MsgConversationView()
   123 {
   116 {
   124 mConversationList->setModel(NULL);    
   117     
   125 }
   118 }
   126 //---------------------------------------------------------------
   119 //---------------------------------------------------------------
   127 // MsgConversationView::setupView
   120 // MsgConversationView::setupView
   128 // @see header file
   121 // @see header file
   129 //---------------------------------------------------------------
   122 //---------------------------------------------------------------
   138     mConversationList->setItemPrototype(item);
   131     mConversationList->setItemPrototype(item);
   139     mConversationList->setSelectionMode(HbListView::NoSelection);
   132     mConversationList->setSelectionMode(HbListView::NoSelection);
   140     mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
   133     mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
   141     mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick);
   134     mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick);
   142 
   135 
   143 
       
   144     mMessageModel = ConversationsEngine::instance()->getConversationsModel();
   136     mMessageModel = ConversationsEngine::instance()->getConversationsModel();
   145     
   137     
   146     connect(ConversationsEngine::instance(), 
   138     connect(ConversationsEngine::instance(), 
   147         SIGNAL(conversationModelPopulated()), 
   139             SIGNAL(conversationModelPopulated()), 
   148         this, 
   140             this, 
   149         SLOT(populateConversationsView()));
   141             SLOT(populateConversationsView()));
   150     
   142     
   151     connect(mConversationList, SIGNAL(activated(QModelIndex)),
   143     connect(mConversationList, SIGNAL(activated(QModelIndex)),
   152         this, SLOT(openItem(QModelIndex)));
   144             this, SLOT(openItem(QModelIndex)));
   153 
   145 
   154     // Long tap list item
   146     // Long tap list item
   155     connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)),
   147     connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)),
   156         this, SLOT(longPressed(HbAbstractViewItem*, QPointF)));
   148             this, SLOT(longPressed(HbAbstractViewItem*, QPointF)));
   157 
   149 
   158     // Create message editor widget.
   150     // Create message editor widget, will be displayed based on msg type.
   159     mEditorWidget = new MsgEditorWidget();
   151     mEditorWidget = new MsgEditorWidget(this);
       
   152     mEditorWidget->hide();
   160 
   153 
   161     connect(mEditorWidget, SIGNAL(sendMessage()), this, SLOT(send()));
   154     connect(mEditorWidget, SIGNAL(sendMessage()), this, SLOT(send()));
       
   155     connect(mEditorWidget, SIGNAL(smsCharLimitReached()), 
       
   156         this, SLOT(handleSmsCharLimitReached()));
   162     connect(mEditorWidget, SIGNAL(replyStarted()), this, SIGNAL(replyStarted()));
   157     connect(mEditorWidget, SIGNAL(replyStarted()), this, SIGNAL(replyStarted()));
   163 
   158 
   164     QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
   159     qreal spacing = HbDeviceProfile::profile(mConversationList).unitValue();
   165     mainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN,
   160     
   166         CONTENT_MARGIN, CONTENT_MARGIN);
   161     mMainLayout = new QGraphicsLinearLayout(Qt::Vertical,this); 
   167     mainLayout->setSpacing(CONTENT_SPACING);
   162     
   168     mainLayout->addItem(mConversationList);
   163     mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN,
   169     mainLayout->addItem(mEditorWidget);
   164                                     CONTENT_MARGIN, CONTENT_MARGIN);   
   170     setLayout(mainLayout);
   165     mMainLayout->setSpacing(spacing);
       
   166 
       
   167     mMainLayout->addItem(mConversationList);
       
   168 
       
   169     setLayout(mMainLayout);
       
   170 
       
   171     //Create VKB instance and listen to VKB open and close signals for resizing the view.
       
   172     mVkbHost = new HbStaticVkbHost(this);
       
   173 	connect(mVkbHost, SIGNAL(keypadOpened()), this, SLOT(vkbOpened()));
       
   174 	connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(vkbClosed()));
   171 
   175 
   172     // Refresh view to show the header details
   176     // Refresh view to show the header details
   173     refreshView();
   177     refreshView();
   174     
       
   175     HbEffect::add(QString("ConversationView"), 
       
   176                       QString(":/xml/conversationview_effect.fxml"), 
       
   177                       QString("show") );
       
   178 }
   178 }
   179 
   179 
   180 //---------------------------------------------------------------
   180 //---------------------------------------------------------------
   181 // MsgConversationView::addMenu
   181 // MsgConversationView::addMenu
   182 // @see header file
   182 // @see header file
   183 //---------------------------------------------------------------
   183 //---------------------------------------------------------------
   184 void MsgConversationView::addMenu()
   184 void MsgConversationView::setupMenu()
   185 {
   185 {
   186     HbMenu *mainMenu = new HbMenu();
   186     // Just create dummy menu.
   187 
   187     // Actual menu will be created in menuAboutToShow()
   188     // Clear conversation 
   188     HbMenu *mainMenu = this->menu();
   189     HbAction* clearConversation = mainMenu->addAction(LOC_COMMON_DELETE);
   189     HbAction* clearConversation = mainMenu->addAction(QString());
   190     connect(clearConversation, SIGNAL(triggered()), this, SLOT(deleteAll()));
   190     connect(mainMenu, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
   191 
       
   192     // Attach sub-menu
       
   193     HbMenu *attachSubMenu = mainMenu->addMenu(LOC_ATTACH);
       
   194 
       
   195     HbAction *addPhoto = attachSubMenu->addAction(LOC_PHOTO);
       
   196     connect(addPhoto, SIGNAL(triggered()),mUiUtilsManager, SLOT(fetchImages()));
       
   197 
       
   198     HbAction *addVideo = attachSubMenu->addAction(LOC_VIDEO);
       
   199     connect(addVideo, SIGNAL(triggered()),mUiUtilsManager, SLOT(fetchVideo()));
       
   200 
       
   201     HbAction *addSound = attachSubMenu->addAction(LOC_SOUND);
       
   202     connect(addSound, SIGNAL(triggered()),mUiUtilsManager, SLOT(fetchAudio()));
       
   203 
       
   204     HbAction *addOther = attachSubMenu->addAction(LOC_MORE);
       
   205     connect(addOther, SIGNAL(triggered()),mUiUtilsManager, SLOT(fetchOther()));
       
   206 
       
   207     HbMenu *addSubMenu = mainMenu->addMenu(LOC_ADD);
       
   208     
       
   209     HbAction *addRecipients = addSubMenu->addAction(LOC_RECIPIENTS);
       
   210     connect(addRecipients, SIGNAL(triggered()), this, SLOT(addRecipients()));
       
   211 
       
   212     HbAction *addSubject = addSubMenu->addAction(LOC_SUBJECT);
       
   213     connect(addSubject, SIGNAL(triggered()),this, SLOT(addSubject()));
       
   214 
       
   215     // Help
       
   216     HbAction* help = mainMenu->addAction(HELP);
       
   217     connect(help, SIGNAL(triggered()),this, SLOT(launchHelp()));
       
   218 
       
   219     setMenu(mainMenu);
       
   220 }
   191 }
   221 
   192 
   222 //---------------------------------------------------------------
   193 //---------------------------------------------------------------
   223 // MsgConversationView::refreshView()
   194 // MsgConversationView::refreshView()
   224 // @see header file
   195 // @see header file
   225 //---------------------------------------------------------------
   196 //---------------------------------------------------------------
   226 void MsgConversationView::refreshView()
   197 void MsgConversationView::refreshView()
   227 {
   198 {
   228     mContactCardWidget->updateContents();
   199     // Hide editor in case of BT conversations.
   229     mContactCardWidget->resize(mContactCardWidget->boundingRect().size());
   200     qint64 convId = ConversationsEngine::instance()->getCurrentConversationId();
   230     scrollToBottom();
   201     if (INVALID_CONVID != convId) {
       
   202         if (KBluetoothMsgsConversationId == convId) {
       
   203             mMainLayout->removeItem(mEditorWidget);
       
   204             mEditorWidget->hide();
       
   205             mEditorWidget->setParent(this);
       
   206         }
       
   207         else {
       
   208             mMainLayout->addItem(mEditorWidget);
       
   209             mEditorWidget->setEncodingSettings();
       
   210             mEditorWidget->show();
       
   211         }
       
   212         mContactCardWidget->updateContents();
       
   213     }
   231 }
   214 }
   232 
   215 
   233 //---------------------------------------------------------------
   216 //---------------------------------------------------------------
   234 // MsgConversationView::scrollToBottom()
   217 // MsgConversationView::scrollToBottom()
   235 // @see header file
   218 // @see header file
   245 // MsgConversationView::longPressed
   228 // MsgConversationView::longPressed
   246 // @see header file
   229 // @see header file
   247 //---------------------------------------------------------------
   230 //---------------------------------------------------------------
   248 void MsgConversationView::longPressed(HbAbstractViewItem* viewItem,
   231 void MsgConversationView::longPressed(HbAbstractViewItem* viewItem,
   249     const QPointF& point)
   232     const QPointF& point)
   250 {
   233 {    
       
   234     mItemLongPressed = true;
       
   235     
   251     MsgConversationViewItem* item = qgraphicsitem_cast<
   236     MsgConversationViewItem* item = qgraphicsitem_cast<
   252             MsgConversationViewItem *> (viewItem);
   237             MsgConversationViewItem *> (viewItem);
   253 
   238 
   254     bool inSide = false;
   239     // Show the item-specific menu
   255 
   240     if (this->isVisible())
   256     if (item)
       
   257     {
       
   258         inSide = item->containsPoint(point);
       
   259     }
       
   260 
       
   261     //If point is within the item then show the item-specific menu
       
   262     if (this->isVisible() && inSide)
       
   263     {
   241     {
   264         //If message is in Sending state or is Scheduled to be sent later,
   242         //If message is in Sending state or is Scheduled to be sent later,
   265         //do not allow any operations on the message
   243         //do not allow any operations on the message
   266         int sendingState = item->modelIndex().data(SendingState).toInt();
   244         int sendingState = item->modelIndex().data(SendingState).toInt();
   267         if(sendingState == ConvergedMessage::Suspended || 
   245         // Create new menu
   268                 sendingState == ConvergedMessage::Resend || 
   246         HbMenu* contextMenu = new HbMenu();
   269                 sendingState == ConvergedMessage::Scheduled ||
   247         setContextMenu(item, contextMenu, sendingState);
   270                 sendingState == ConvergedMessage::Sending ||
       
   271                 sendingState == ConvergedMessage::Waiting)
       
   272         {
       
   273             return;
       
   274         }
       
   275         
   248         
   276         // Create new menu
   249         //Before showing menu reset the flag
   277         HbMenu *contextMenu = new HbMenu();
   250         mItemLongPressed = false;
   278         
       
   279         int messageType = item->modelIndex().data(MessageType).toInt();  
       
   280              
       
   281         // Add the menu items
       
   282         HbAction *contextItem4 = contextMenu->addAction(LOC_COMMON_OPEN);
       
   283         connect(contextItem4, SIGNAL(triggered()),
       
   284             this, SLOT(openItem()));
       
   285 
       
   286         HbAction *contextItem3 = contextMenu->addAction(LOC_COMMON_DELETE);
       
   287         connect(contextItem3, SIGNAL(triggered()),
       
   288                 this, SLOT(deleteItem()));
       
   289         
       
   290         // for provisioning messages don't add forward option
       
   291         if(messageType != ConvergedMessage::Provisioning &&
       
   292                 messageType != ConvergedMessage::RingingTone)
       
   293             {
       
   294             HbAction *contextItem2 = contextMenu->addAction(LOC_COMMON_FORWARD);
       
   295             connect(contextItem2, SIGNAL(triggered()),
       
   296                     this, SLOT(forwardMessage()));
       
   297             }
       
   298 
       
   299            
       
   300         contextMenu->exec(point);
   251         contextMenu->exec(point);
   301 
       
   302         // Cleanup
   252         // Cleanup
   303         delete contextMenu;
   253         delete contextMenu;
   304     }
   254 
   305 }
   255     }
   306 
   256     else
       
   257     {
       
   258         // For cases where the long tap check failed
       
   259         mItemLongPressed = false;
       
   260     }
       
   261 }
       
   262 
       
   263 //---------------------------------------------------------------
       
   264 // MsgConversationView::setContextMenu
       
   265 // @see header
       
   266 //---------------------------------------------------------------
       
   267 
       
   268 void MsgConversationView::setContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
       
   269 {
       
   270     addOpenItemToContextMenu(item , contextMenu,sendingState);
       
   271     addResendItemToContextMenu(item, contextMenu, sendingState);
       
   272     addForwardItemToContextMenu(item, contextMenu, sendingState);
       
   273     addDownloadItemToContextMenu(item, contextMenu);
       
   274     addDeleteItemToContextMenu(item, contextMenu, sendingState);  
       
   275 }
       
   276 
       
   277 //---------------------------------------------------------------
       
   278 // MsgEditorPrivate::addOpenItemToContextMenu
       
   279 // @see header
       
   280 //---------------------------------------------------------------
       
   281 
       
   282 void MsgConversationView::addOpenItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
       
   283 {
       
   284     int direction = item->modelIndex().data(Direction).toInt();
       
   285     int messageType = item->modelIndex().data(MessageType).toInt();
       
   286     int messageSubType = item->modelIndex().data(MessageSubType).toInt();
       
   287     
       
   288     if((messageSubType == ConvergedMessage::VCal) ||
       
   289         (messageSubType == ConvergedMessage::RingingTone) ||
       
   290         (messageType == ConvergedMessage::MmsNotification))
       
   291         {
       
   292         return;
       
   293         }
       
   294     
       
   295     if( (sendingState == ConvergedMessage::SentState ) ||
       
   296         (sendingState == ConvergedMessage::Resend ) ||
       
   297         (sendingState == ConvergedMessage::Failed ) ||
       
   298         (direction == ConvergedMessage::Incoming))
       
   299     {
       
   300         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN);
       
   301         connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem()));
       
   302     }
       
   303     
       
   304 }
       
   305 
       
   306 //---------------------------------------------------------------
       
   307 // MsgEditorPrivate::addResendItemToContextMenu
       
   308 // @see header
       
   309 //---------------------------------------------------------------
       
   310 
       
   311 void MsgConversationView::addResendItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
       
   312 {
       
   313     Q_UNUSED(item)
       
   314     int direction = item->modelIndex().data(Direction).toInt();
       
   315     
       
   316     if( (direction == ConvergedMessage::Outgoing)&&
       
   317         ((sendingState == ConvergedMessage::Resend ) ||
       
   318         (sendingState == ConvergedMessage::Suspended )||
       
   319         (sendingState == ConvergedMessage::Failed )))
       
   320     {
       
   321         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SEND);
       
   322         connect(contextItem, SIGNAL(triggered()),this, SLOT(resendMessage()));
       
   323     }
       
   324 }
       
   325 
       
   326 //---------------------------------------------------------------
       
   327 // MsgEditorPrivate::addForwardItemToContextMenu
       
   328 // @see header
       
   329 //---------------------------------------------------------------
       
   330 void MsgConversationView::addForwardItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
       
   331 {
       
   332     int messageType = item->modelIndex().data(MessageType).toInt();
       
   333     int direction = item->modelIndex().data(Direction).toInt();
       
   334     int messageSubType = item->modelIndex().data(MessageSubType).toInt();
       
   335     
       
   336     if( (messageType == ConvergedMessage::BT) ||
       
   337         (messageType == ConvergedMessage::MmsNotification) ||
       
   338         (messageSubType == ConvergedMessage::Provisioning ) ||
       
   339         (messageSubType == ConvergedMessage::RingingTone) ||
       
   340         (messageSubType == ConvergedMessage::VCal))
       
   341     {
       
   342         return;
       
   343     }
       
   344     
       
   345     qint32 messageId = item->modelIndex().data(ConvergedMsgId).toInt();
       
   346 
       
   347     if( ((sendingState == ConvergedMessage::SentState) ||
       
   348         (sendingState == ConvergedMessage::Resend) ||
       
   349         (sendingState == ConvergedMessage::Failed) ||
       
   350         (direction == ConvergedMessage::Incoming) ) &&
       
   351         (validateMsgForForward(messageType,messageId))	)
       
   352     {
       
   353         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD);
       
   354         connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage()));
       
   355     }
       
   356 
       
   357 }
       
   358 
       
   359 //---------------------------------------------------------------
       
   360 // MsgEditorPrivate::addDeleteItemToContextMenu
       
   361 // @see header
       
   362 //---------------------------------------------------------------
       
   363 void MsgConversationView::addDeleteItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState)
       
   364 {
       
   365     int direction = item->modelIndex().data(Direction).toInt();
       
   366     int messageType = item->modelIndex().data(MessageType).toInt();
       
   367     int notificationState = item->modelIndex().data(NotificationStatus).toInt();
       
   368     
       
   369     if( (messageType == ConvergedMessage::MmsNotification) && 
       
   370         ((notificationState == ConvergedMessage::NotifNull) || 
       
   371          (notificationState ==  ConvergedMessage::NotifRetrieving) ||
       
   372          (notificationState == ConvergedMessage::NotifWaiting)))
       
   373     {
       
   374         return;
       
   375     }
       
   376     
       
   377     if( (sendingState == ConvergedMessage::SentState) ||
       
   378         (sendingState == ConvergedMessage::Resend) ||
       
   379         (sendingState == ConvergedMessage::Suspended) ||
       
   380         (sendingState == ConvergedMessage::Failed) ||
       
   381         (direction == ConvergedMessage::Incoming))
       
   382     {
       
   383         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_DELETE);
       
   384         connect(contextItem, SIGNAL(triggered()),this, SLOT(deleteItem()));
       
   385     }  
       
   386 }
       
   387 
       
   388 //---------------------------------------------------------------
       
   389 // MsgEditorPrivate::addDownloadItemToContextMenu
       
   390 // @see header
       
   391 //---------------------------------------------------------------
       
   392 void MsgConversationView::addDownloadItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu)
       
   393 {
       
   394     int notificationState = item->modelIndex().data(NotificationStatus).toInt();
       
   395     int messageType = item->modelIndex().data(MessageType).toInt();
       
   396     qint32 messageId = item->modelIndex().data(ConvergedMsgId).toLongLong();
       
   397         
       
   398     if( messageType == ConvergedMessage::MmsNotification &&
       
   399         ConversationsEngine::instance()->downloadOperationSupported(messageId))
       
   400     {            
       
   401         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_DOWNLOAD);
       
   402         connect(contextItem, SIGNAL(triggered()),this, SLOT(downloadMessage()));
       
   403     }
       
   404 }
   307 //---------------------------------------------------------------
   405 //---------------------------------------------------------------
   308 // MsgEditorPrivate::send
   406 // MsgEditorPrivate::send
   309 // @see header
   407 // @see header
   310 //---------------------------------------------------------------
   408 //---------------------------------------------------------------
   311 void MsgConversationView::send()
   409 void MsgConversationView::send()
   312 {
   410 {
   313     mUiUtilsManager->activateInputBlocker(this);
   411     activateInputBlocker();
   314     ConvergedMessageAddressList addresses;
   412     ConvergedMessageAddressList addresses;
   315     addresses = mContactCardWidget->address();
   413     addresses = mContactCardWidget->address();
   316     int sendResult = KErrNone;
   414     int sendResult = KErrNone;
   317 
   415 
   318     // Populate the ConvergedMessage.
   416     // Populate the ConvergedMessage.
   321         ConvergedMessage msg;
   419         ConvergedMessage msg;
   322         populateForSending(msg);
   420         populateForSending(msg);
   323         msg.addToRecipients(addresses);
   421         msg.addToRecipients(addresses);
   324 
   422 
   325         // Send
   423         // Send
   326         sendResult = mUiUtilsManager->send(msg);
   424         sendResult = mSendUtil->send(msg);
       
   425                    
   327         if( sendResult == KErrNone)
   426         if( sendResult == KErrNone)
   328         {
   427         {
   329             mEditorWidget->clear();
   428             mEditorWidget->clear();
   330         }
   429         }
   331     }
   430     }
   332     mUiUtilsManager->deactivateInputBlocker();
   431     deactivateInputBlocker();
   333     if( sendResult == KErrNotFound)
   432     if( sendResult == KErrNotFound)
   334     {
   433     {
   335         //switch to settings view
   434     bool result = HbMessageBox::question("SMS Settings not defined\nDefine now ?",
   336         QVariantList param;
   435             LOC_BUTTON_OK,
   337         param << MsgBaseView::MSGSETTINGS;
   436             LOC_BUTTON_CANCEL);
   338         param << MsgBaseView::CV;
   437         if (result)
   339         emit switchView(param);
   438         {
   340     }
   439             //switch to settings view
   341 }
   440             QVariantList param;
   342 
   441             param << MsgBaseView::MSGSETTINGS;
   343 //---------------------------------------------------------------
   442             param << MsgBaseView::CV;
   344 // MsgConversationView::deleteAll
   443             emit switchView(param);
   345 // Deletes all the conversations
   444         }
   346 //---------------------------------------------------------------
   445     }
   347 void MsgConversationView::deleteAll()
   446 }
   348     {
   447 
   349     bool result = HbMessageBox::question(LOC_DELETE_CONVERSATION,
   448 //---------------------------------------------------------------
   350                              LOC_BUTTON_DELETE,
   449 // MsgConversationView::contactsFetchedForVCards
   351                              LOC_BUTTON_CANCEL);
   450 // @see header file
   352     if(result)
   451 //---------------------------------------------------------------
   353         {      
   452 void MsgConversationView::contactsFetchedForVCards(const QVariant& value)
   354         ConversationsEngine* engine = ConversationsEngine::instance();    
   453 {
   355         engine->deleteConversations(engine->getCurrentConversationId());
   454     // get received contact-list and launch unieditor
   356         //show dialog
   455     CntServicesContactList contactList = 
   357         HbNotificationDialog::launchDialog("Conversation Deleted");
   456             qVariantValue<CntServicesContactList>(value);
   358         //switch to CLV
   457     int cntCount = contactList.count();
   359         QVariantList param;
   458     if(cntCount > 0)
   360         param << MsgBaseView::CLV; // target view
   459     {
   361         param << MsgBaseView::CV;  // source view
   460         QVariantList params;
   362         emit switchView(param);
   461         params << MsgBaseView::ADD_VCARD;
   363         }
   462         params << value;
   364     }
   463         launchUniEditor(params);        
   365 
   464     }
   366 //---------------------------------------------------------------
   465 }
   367 // MsgConversationView::addPhoto()
   466 
       
   467 //---------------------------------------------------------------
       
   468 // MsgConversationView::fetchContacts
       
   469 // @see header file
       
   470 //---------------------------------------------------------------
       
   471 void MsgConversationView::fetchContacts()
       
   472 {
       
   473     HbAction* action = qobject_cast<HbAction*>(sender());
       
   474 
       
   475     if(!action)
       
   476         return;
       
   477 
       
   478     QList<QVariant> args;
       
   479     QString serviceName("com.nokia.services.phonebookservices");
       
   480     QString operation("fetch(QString,QString,QString)");
       
   481     XQAiwRequest* request;
       
   482     XQApplicationManager appManager;
       
   483     request = appManager.create(serviceName, "Fetch", operation, true); //embedded
       
   484     if ( request == NULL )
       
   485     {
       
   486         return;       
       
   487     }
       
   488 
       
   489     int mode = action->data().toInt();
       
   490     
       
   491     if( VCARD_INSERTION_MODE == mode) //vcard-insert mode
       
   492     {
       
   493         connect(request, SIGNAL(requestOk(const QVariant&)),
       
   494             this, SLOT(contactsFetchedForVCards(const QVariant&)));      
       
   495     }
       
   496     else  //contact-insert mode
       
   497     {
       
   498         connect(request, SIGNAL(requestOk(const QVariant&)),
       
   499             this, SLOT(contactsFetched(const QVariant&)));
       
   500     }
       
   501     connect (request, SIGNAL(requestError(int,const QString&)), 
       
   502         this, SLOT(serviceRequestError(int,const QString&)));
       
   503 
       
   504     args << QString(tr("Phonebook")); 
       
   505     args << KCntActionAll;
       
   506     args << KCntFilterDisplayAll;
       
   507 
       
   508     request->setArguments(args);
       
   509     request->send();
       
   510     delete request;
       
   511 }
       
   512 //---------------------------------------------------------------
       
   513 // MsgConversationView::fetchImages
       
   514 // @see header file
       
   515 //---------------------------------------------------------------
       
   516 void MsgConversationView::fetchImages()
       
   517 {
       
   518     QString interface("Image");
       
   519     QString operation("fetch(QVariantMap,QVariant)");
       
   520     XQAiwRequest* request = NULL;
       
   521     XQApplicationManager appManager;
       
   522     request = appManager.create(interface, operation, true);//embedded
       
   523     if(!request)
       
   524     {
       
   525         QDEBUG_WRITE("AIW-ERROR: NULL request");
       
   526         return;
       
   527     }
       
   528 
       
   529     connect(request, SIGNAL(requestOk(const QVariant&)),
       
   530         this, SLOT(imagesFetched(const QVariant&)));
       
   531     connect(request, SIGNAL(requestError(int,const QString&)),
       
   532         this, SLOT(serviceRequestError(int,const QString&)));
       
   533    
       
   534     // Make the request
       
   535     if (!request->send())
       
   536     {
       
   537         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError());
       
   538     }  
       
   539     delete request;
       
   540 }
       
   541 
       
   542 //---------------------------------------------------------------
       
   543 // MsgConversationView::fetchAudio
       
   544 // @see header file
       
   545 //---------------------------------------------------------------
       
   546 void MsgConversationView::fetchAudio()
       
   547 {
       
   548     QString service("Music Fetcher");
       
   549     QString interface("com.nokia.services.media.Music");
       
   550     QString operation("fetch(QString)");
       
   551     XQAiwRequest* request = NULL;
       
   552     XQApplicationManager appManager;
       
   553     request = appManager.create(service, interface, operation, true); //embedded
       
   554     if(!request)
       
   555     {
       
   556         QDEBUG_WRITE("AIW-ERROR: NULL request");
       
   557         return;
       
   558     }
       
   559 
       
   560     connect(request, SIGNAL(requestOk(const QVariant&)),
       
   561         this, SLOT(audiosFetched(const QVariant&)));
       
   562     connect(request, SIGNAL(requestError(int,const QString&)),
       
   563         this, SLOT(serviceRequestError(int,const QString&)));
       
   564 
       
   565     // Make the request
       
   566     if (!request->send())
       
   567     {
       
   568         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed  ",request->lastError());
       
   569     }
       
   570     delete request;
       
   571 }
       
   572 
       
   573 //---------------------------------------------------------------
       
   574 // MsgConversationView::contactsFetched
       
   575 // @see header file
       
   576 //---------------------------------------------------------------
       
   577 void MsgConversationView::contactsFetched(const QVariant& value)
       
   578 {
       
   579     CntServicesContactList contactList;
       
   580     contactList = qVariantValue<CntServicesContactList>(value);
       
   581     ConvergedMessageAddressList addresses;
       
   582 	int count = contactList.count();
       
   583 	if(count > 0)
       
   584       {
       
   585 	  ConvergedMessageAddress* address = new ConvergedMessageAddress;
       
   586       address->setAlias(mContactCardWidget->address().at(0)->alias());
       
   587       address->setAddress(mContactCardWidget->address().at(0)->address());
       
   588       addresses.append(address);
       
   589     	for(int i = 0; i < contactList.count(); i++ )
       
   590 	    {
       
   591 	    ConvergedMessageAddress* address = new ConvergedMessageAddress;
       
   592 	    address->setAlias(contactList[i].mDisplayName);
       
   593 	    address->setAddress(contactList[i].mPhoneNumber);
       
   594 	    addresses.append(address);
       
   595 	    }
       
   596 
       
   597       ConvergedMessage message;
       
   598       message.setBodyText(mEditorWidget->content());
       
   599       message.addToRecipients(addresses);//takes the ownership of list elements
       
   600       QByteArray dataArray;
       
   601       QDataStream messageStream
       
   602       (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
       
   603       message.serialize(messageStream);
       
   604       QVariantList params;
       
   605       params << MsgBaseView::UNIEDITOR; // target view
       
   606       params << MsgBaseView::CV; // source view
       
   607       params << dataArray;
       
   608       clearEditors();
       
   609       emit switchView(params);
       
   610      }    
       
   611 }
       
   612 
       
   613 //---------------------------------------------------------------
       
   614 // MsgConversationView::imagesFetched()
   368 // @see header file
   615 // @see header file
   369 //---------------------------------------------------------------
   616 //---------------------------------------------------------------
   370 void MsgConversationView::imagesFetched(const QVariant& result )
   617 void MsgConversationView::imagesFetched(const QVariant& result )
   371 {
   618 {
   372     if(result.canConvert<QStringList>())
   619     if(result.canConvert<QStringList>())
   373     {
   620     {
   374         QStringList fileList = result.value<QStringList>();
   621         QStringList fileList = result.value<QStringList>();
   375         if ( fileList.size()>0 )
   622         if ( fileList.size()>0 )
   376         {
   623         {
   377             QString filepath(fileList.at(0));
   624             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
   378             launchUniEditor(MsgBaseView::ADD_PHOTO, filepath);
   625             QVariantList params;
       
   626             params << MsgBaseView::ADD_PHOTO;
       
   627             params << filepath;
       
   628             launchUniEditor(params);
   379         }
   629         }
   380     }
   630     }
   381 }
   631 }
   382 
   632 
   383 //---------------------------------------------------------------
   633 //---------------------------------------------------------------
   390     {
   640     {
   391         QStringList fileList = result.value<QStringList>();
   641         QStringList fileList = result.value<QStringList>();
   392         if ( fileList.size()>0 && !fileList.at(0).isEmpty())
   642         if ( fileList.size()>0 && !fileList.at(0).isEmpty())
   393         {
   643         {
   394             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
   644             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
   395             launchUniEditor(MsgBaseView::ADD_AUDIO, filepath);
   645             QVariantList params;
   396         }
   646             params << MsgBaseView::ADD_AUDIO;
   397     }
   647             params << filepath;
   398 }
   648             launchUniEditor(params);
   399 
   649         }
   400 //---------------------------------------------------------------
   650     }
   401 // MsgConversationView::addRecipients()
   651 }
   402 // @see header file
   652 
   403 //---------------------------------------------------------------
   653 //---------------------------------------------------------------
   404 void MsgConversationView::addRecipients()
   654 // MsgConversationView::addSubject()
   405 {
   655 // @see header file
       
   656 //---------------------------------------------------------------
       
   657 void MsgConversationView::addSubject()
       
   658 {
       
   659 
   406     QString filepath;
   660     QString filepath;
   407     launchUniEditor(MsgBaseView::ADD_RECIPIENTS, filepath);
   661     QVariantList params;
   408 }
   662     params << MsgBaseView::ADD_SUBJECT;
   409 
   663     launchUniEditor(params);
   410 //---------------------------------------------------------------
       
   411 // MsgConversationView::addSubject()
       
   412 // @see header file
       
   413 //---------------------------------------------------------------
       
   414 void MsgConversationView::addSubject()
       
   415 {
       
   416 
       
   417     QString filepath;
       
   418     launchUniEditor(MsgBaseView::ADD_SUBJECT, filepath);
       
   419 }
       
   420 
       
   421 //---------------------------------------------------------------
       
   422 // MsgConversationView::launchHelp()
       
   423 // Launches the help content
       
   424 //---------------------------------------------------------------
       
   425 void MsgConversationView::launchHelp()
       
   426 {
       
   427 }
       
   428 
       
   429 //---------------------------------------------------------------
       
   430 // MsgConversationView::exitApp()
       
   431 // Exits the application
       
   432 //---------------------------------------------------------------
       
   433 void MsgConversationView::exitApp()
       
   434 {
       
   435     HbApplication::quit();
       
   436 }
   664 }
   437 
   665 
   438 //---------------------------------------------------------------
   666 //---------------------------------------------------------------
   439 // MsgConversationView::forwardMessage()
   667 // MsgConversationView::forwardMessage()
   440 // Forwards the message
   668 // Forwards the message
   441 //---------------------------------------------------------------
   669 //---------------------------------------------------------------
   442 void MsgConversationView::forwardMessage()
   670 void MsgConversationView::forwardMessage()
   443 {
   671 {
       
   672     QModelIndex index = mConversationList->currentIndex();
       
   673     //messageId & messageType to be forwarded
       
   674     qint32 messageId = index.data(ConvergedMsgId).toLongLong();
       
   675     int messageType = index.data(MessageType).toInt();
       
   676  
       
   677     //Mark the message to read before forwarding.
       
   678     if(index.data(UnReadStatus).toBool())
       
   679     {
       
   680         QList<int> msgIdList;
       
   681         msgIdList.append(messageId);
       
   682         ConversationsEngine::instance()->markMessagesRead(msgIdList);
       
   683     }
       
   684     // populate params and launch editor 
       
   685     QVariantList params;
       
   686     params << MsgBaseView::FORWARD_MSG;
       
   687     params << messageId;
       
   688     params << messageType;
       
   689     launchUniEditor(params);
       
   690 }
       
   691 
       
   692 //---------------------------------------------------------------
       
   693 // MsgConversationView::resendMessage()
       
   694 // Resends the message in the failed messages case
       
   695 //---------------------------------------------------------------
       
   696 void MsgConversationView::resendMessage()
       
   697 {
       
   698     QModelIndex index = mConversationList->currentIndex();
       
   699     if(index.isValid())
       
   700     {
       
   701         qint32 messageId = index.data(ConvergedMsgId).toLongLong();    
       
   702         if(!(ConversationsEngine::instance()->resendMessage(messageId)))
       
   703         {
       
   704             HbMessageBox::warning(LOC_MSG_SEND_FAILED);
       
   705         }
       
   706     }
       
   707     
       
   708 }
       
   709 
       
   710 //---------------------------------------------------------------
       
   711 // MsgConversationView::downloadMessage()
       
   712 // @see header
       
   713 //---------------------------------------------------------------
       
   714 void MsgConversationView::downloadMessage()
       
   715 {
       
   716     QModelIndex index = mConversationList->currentIndex();
       
   717     if(index.isValid())
       
   718     {
       
   719         qint32 messageId = index.data(ConvergedMsgId).toLongLong();    
       
   720         if(ConversationsEngine::instance()->downloadMessage(messageId)!=KErrNone)
       
   721         {
       
   722             HbMessageBox::warning("Message Retrieval Failed!"); //TODO: use logical str name
       
   723         }
       
   724     }
       
   725     
   444 }
   726 }
   445 
   727 
   446 //---------------------------------------------------------------
   728 //---------------------------------------------------------------
   447 // MsgConversationView::deleteItem()
   729 // MsgConversationView::deleteItem()
   448 // Deletes the message
   730 // Deletes the message
   462         if (messageId)
   744         if (messageId)
   463             {
   745             {
   464             QList<int> msgIdList;
   746             QList<int> msgIdList;
   465             msgIdList.append(messageId);          
   747             msgIdList.append(messageId);          
   466             ConversationsEngine::instance()->deleteMessages(msgIdList);
   748             ConversationsEngine::instance()->deleteMessages(msgIdList);
   467             HbNotificationDialog::launchDialog(LOC_DELETE_POPINFO);
       
   468             //switch view               
   749             //switch view               
   469             if (count == 1)
   750             if (count == 1)
   470                 {
   751                 {
   471                 QVariantList param;
   752                 QVariantList param;
   472                 param << MsgBaseView::CLV; // target view
   753                 param << MsgBaseView::CLV; // target view
   486     QModelIndex index = mConversationList->currentIndex();
   767     QModelIndex index = mConversationList->currentIndex();
   487     openItem(index);
   768     openItem(index);
   488 }
   769 }
   489 
   770 
   490 //---------------------------------------------------------------
   771 //---------------------------------------------------------------
   491 // MsgConversationView::setMessageData()
       
   492 // Set message data
       
   493 //---------------------------------------------------------------
       
   494 void MsgConversationView::setMessageData(const ConvergedMessage &message)
       
   495 {
       
   496     mEditorWidget->setContent(message.bodyText());
       
   497 }
       
   498 
       
   499 //---------------------------------------------------------------
       
   500 // MsgConversationView::clearEditors()
   772 // MsgConversationView::clearEditors()
   501 // @See header
   773 // @See header
   502 //---------------------------------------------------------------
   774 //---------------------------------------------------------------
   503 void MsgConversationView::clearEditors()
   775 void MsgConversationView::clearEditors()
   504 {
   776 {
   514 bool MsgConversationView::saveContentToDrafts()
   786 bool MsgConversationView::saveContentToDrafts()
   515 {
   787 {
   516     int msgId = INVALID_MSGID;
   788     int msgId = INVALID_MSGID;
   517     if(!mEditorWidget->content().isEmpty())
   789     if(!mEditorWidget->content().isEmpty())
   518     {
   790     {
   519         mUiUtilsManager->activateInputBlocker(this);
   791         activateInputBlocker();
   520         ConvergedMessageAddressList addresses;
   792         ConvergedMessageAddressList addresses;
   521         addresses = mContactCardWidget->address();
   793         addresses = mContactCardWidget->address();
   522 
   794 
   523         // Populate the ConvergedMessage.
   795         // Populate the ConvergedMessage.
   524         if (!addresses.isEmpty())
   796         if (!addresses.isEmpty())
   525         {
   797         {
   526             ConvergedMessage msg;
   798             ConvergedMessage msg;
   527             populateForSending(msg);
   799             populateForSending(msg);
   528             msg.addToRecipients(addresses);
   800             msg.addToRecipients(addresses);
   529 
   801             
   530             // Send
   802             // save to drafts
   531             msgId = mUiUtilsManager->saveToDrafts(msg);
   803             msgId = mSendUtil->saveToDrafts(msg);
   532 
   804                      
   533             mEditorWidget->clear();
   805             mEditorWidget->clear();
   534         }
   806         }
   535         mUiUtilsManager->deactivateInputBlocker();
   807         deactivateInputBlocker();
   536     }
   808     }
   537     return ((msgId > INVALID_MSGID)? true : false);
   809     return ((msgId > INVALID_MSGID)? true : false);
   538 }
   810 }
   539 
   811 
   540 //---------------------------------------------------------------
       
   541 // MsgConversationView::loadCommandPlugin()
       
   542 // @See header
       
   543 //---------------------------------------------------------------
       
   544 bool MsgConversationView::loadCommandPlugin()
       
   545 {
       
   546     /*
       
   547 #ifdef _DEBUG
       
   548     QDir dir(QLibraryInfo::location(QLibraryInfo::PluginsPath));
       
   549     dir.cd("messaging");
       
   550 #else
       
   551     QDir dir("Z:/resource/qt/plugins/messaging");
       
   552 #endif
       
   553 #ifdef _DEBUG_TRACES_
       
   554     qDebug() << "MsgConversationView::plugins path" << dir.path();
       
   555 #endif
       
   556 
       
   557     // load the plugins
       
   558     QFileInfoList entries = dir.entryInfoList(QDir::Files | QDir::Readable);
       
   559     foreach (QFileInfo entry, entries)
       
   560         {
       
   561             QPluginLoader loader(entry.absoluteFilePath());
       
   562 #ifdef _DEBUG_TRACES_
       
   563             qDebug() << "MsgConversationView::absolute path"
       
   564                     << entry.absoluteFilePath();
       
   565 #endif
       
   566             mMsgCmdPlugin = qobject_cast<MsgCommandPluginInterface*> (
       
   567                 loader.instance());
       
   568             if (mMsgCmdPlugin)
       
   569             {
       
   570                 return true;
       
   571             }
       
   572         }*/
       
   573     return false;
       
   574 }
       
   575 
       
   576 //---------------------------------------------------------------
       
   577 //MsgConversationView::parseServiceId()
       
   578 //@see header
       
   579 //---------------------------------------------------------------
       
   580 QString MsgConversationView::parseServiceId(const QString &serviceId)
       
   581 {
       
   582     QStringList services = serviceId.split('.');
       
   583     // the service id is in the form "messaging.mserver.mms"
       
   584     // split the string by '.' and compare the middle part
       
   585     // by the server names.
       
   586     return services[1];
       
   587 }
       
   588 
       
   589 //---------------------------------------------------------------
       
   590 //MsgConversationView::currentMessageType()
       
   591 //@see header
       
   592 //---------------------------------------------------------------
       
   593 int MsgConversationView::currentMessageType()
       
   594 {
       
   595     QString serviceId = mEditorWidget->serviceId();
       
   596     QString sendClientType = parseServiceId(serviceId);
       
   597 
       
   598     ConvergedMessage::MessageType messageType = ConvergedMessage::None;
       
   599     if ( (M_SERVER == sendClientType) && serviceId.contains(SMS))
       
   600     {
       
   601         messageType = ConvergedMessage::Sms;
       
   602     }
       
   603     return messageType;
       
   604 }
       
   605 //---------------------------------------------------------------
   812 //---------------------------------------------------------------
   606 //MsgConversationView::populateForSending()
   813 //MsgConversationView::populateForSending()
   607 //@see header
   814 //@see header
   608 //---------------------------------------------------------------
   815 //---------------------------------------------------------------
   609 void MsgConversationView::populateForSending(ConvergedMessage &message)
   816 void MsgConversationView::populateForSending(ConvergedMessage &message)
   610 {
   817 {
   611     ConvergedMessage::MessageType messageType =
   818     message.setMessageType(ConvergedMessage::Sms);
   612             static_cast<ConvergedMessage::MessageType> (currentMessageType());
   819     message.setBodyText(mEditorWidget->content());
   613 
   820     message.setDirection(ConvergedMessage::Outgoing);
   614     if (ConvergedMessage::Sms == messageType)
   821     QDateTime time = QDateTime::currentDateTime();
   615     {
   822     message.setTimeStamp(time.toTime_t());
   616         message.setMessageType(messageType);
   823 }
   617         message.setBodyText(mEditorWidget->content());
   824 
   618         message.setDirection(ConvergedMessage::Outgoing);
   825 //---------------------------------------------------------------
   619         QDateTime time = QDateTime::currentDateTime();
   826 //MsgConversationView::launchBtDisplayService()
   620         message.setTimeStamp(time.toTime_t());
   827 //@see header
   621     }
   828 //---------------------------------------------------------------
   622 }
   829 void MsgConversationView::launchBtDisplayService(const QModelIndex & index)
   623 
   830 {
   624 //---------------------------------------------------------------
   831     qint32 messageId = index.data(ConvergedMsgId).toLongLong();
   625 // MsgConversationView::serviceError()
   832 
       
   833     QString interface("com.nokia.services.btmsgdispservices.displaymsg");
       
   834     QString operation("displaymsg(int)");
       
   835 
       
   836     XQServiceRequest request(interface, operation, false);
       
   837 
       
   838     request << messageId;
       
   839 
       
   840     bool result = request.send();
       
   841 }
       
   842 
       
   843 //---------------------------------------------------------------
       
   844 // MsgConversationView::menuAboutToShow()
   626 // @See header
   845 // @See header
   627 //---------------------------------------------------------------
   846 //---------------------------------------------------------------
   628 void MsgConversationView::serviceError(const QString& error)
   847 void MsgConversationView::menuAboutToShow()
   629 {
   848 {
   630     Q_UNUSED(error)
   849     // Clear all the previously added actions.
   631 //    HbDialog popup;
   850     HbMenu *mainMenu = this->menu();
   632 //
   851     mainMenu->clearActions();
   633 //    popup.setDismissPolicy(HbDialog::TapAnywhere);
   852 
   634 //    popup.setHeadingWidget(new HbLabel(tr("Error Notification")));
   853     // Message type specific menu items
   635 //
   854     QModelIndex index = ConversationsEngine::instance()->getConversationsModel()->index(0, 0);
   636 //    /// set a label as the content widget in the popup.
   855     if (ConvergedMessage::BT != index.data(MessageType).toInt())
   637 //    HbLabel contentLabel(error);
   856     {
   638 //    popup.setContentWidget(&contentLabel);
   857         // Attach sub-menu
   639 //
   858         HbMenu *attachSubMenu = mainMenu->addMenu(LOC_ATTACH);
   640 //    popup.setPrimaryAction(new HbAction(tr("Ok"), &popup));
   859         
   641 //    popup.exec();
   860         attachSubMenu->addAction(LOC_PHOTO,this, SLOT(fetchImages()));
       
   861         attachSubMenu->addAction(LOC_SOUND,this, SLOT(fetchAudio()));
       
   862 		
       
   863         HbAction* addVCard = attachSubMenu->addAction(LOC_VCARD);
       
   864         addVCard->setData(VCARD_INSERTION_MODE);        
       
   865         connect(addVCard, SIGNAL(triggered()),this,SLOT(fetchContacts()));
       
   866 
       
   867         HbAction *addRecipients = mainMenu->addAction(LOC_ADD_RECIPIENTS);
       
   868         addRecipients->setData(CONTACT_INSERTION_MODE);        
       
   869         connect(addRecipients, SIGNAL(triggered()), this, SLOT(fetchContacts()));
       
   870 
       
   871         mainMenu->addAction(LOC_ADD_SUBJECT,this, SLOT(addSubject()));
       
   872     }
   642 }
   873 }
   643 
   874 
   644 //---------------------------------------------------------------
   875 //---------------------------------------------------------------
   645 //MsgConversationView::openItem
   876 //MsgConversationView::openItem
   646 //@see header
   877 //@see header
   647 //---------------------------------------------------------------
   878 //---------------------------------------------------------------
   648 void MsgConversationView::openItem(const QModelIndex & index)
   879 void MsgConversationView::openItem(const QModelIndex & index)
   649     {
   880     {
   650     int messageType = index.data(MessageType).toInt();    
   881     // Return if invalid index.
   651     if(messageType == ConvergedMessage::RingingTone )
   882     if (!index.isValid() || mVkbopened)
   652         {
   883         {
   653         if(RingBc::askSaveQuery())
   884         return;
       
   885         }
       
   886 
       
   887     if(mItemLongPressed)
       
   888         return;
       
   889     
       
   890     int messageType = index.data(MessageType).toInt();
       
   891     int messageSubType = index.data(MessageSubType).toInt();
       
   892     
       
   893     if (ConvergedMessage::BioMsg == messageType) {
       
   894         if (ConvergedMessage::RingingTone == messageSubType) {
       
   895             if (RingBc::askSaveQuery()) {
       
   896                 saveRingingTone();
       
   897             }
       
   898             return;
       
   899         }
       
   900         // Unsupported messages
       
   901         else if (ConvergedMessage::VCard == messageSubType
       
   902             || ConvergedMessage::VCal == messageSubType
       
   903             || ConvergedMessage::Provisioning == messageSubType) {
       
   904             return;
       
   905         }
       
   906     }
       
   907     else if (ConvergedMessage::BT == messageType) {
       
   908         launchBtDisplayService(index);
       
   909         return;
       
   910     }
       
   911     else if(ConvergedMessage::MmsNotification == messageType)
       
   912     {
       
   913         qint32 messageId = index.data(ConvergedMsgId).toLongLong();    
       
   914         if(!ConversationsEngine::instance()->downloadOperationSupported(messageId))           
       
   915         {
       
   916            int notificationState = index.data(NotificationStatus).toInt();
       
   917            if( notificationState == ConvergedMessage::NotifExpired)
       
   918            {
       
   919                deleteItem();
       
   920            }
       
   921            return;
       
   922         }
       
   923         else
       
   924         {
       
   925             //TODO: use logical str name
       
   926             if(HbMessageBox::question("Download Message?",
       
   927                 LOC_COMMON_DOWNLOAD,
       
   928                 LOC_BUTTON_CANCEL))
   654             {
   929             {
   655             saveRingingTone();
   930                 downloadMessage();
   656             }
   931             }
   657         return;
   932             return;
   658         }
   933         }
   659 	
   934     }
   660 	/// smart messages hardcoded due to common handling
   935 
   661 	if (messageType == ConvergedMessage::BioMsg
       
   662 	    || messageType >= ConvergedMessage::VCard)  
       
   663 	{
       
   664 	    return;
       
   665 	}
       
   666 			
       
   667     ConvergedMessage message;
   936     ConvergedMessage message;
   668     // check whether message is in sending progress, then donot launch viewer.
   937     // check whether message is in sending progress, then donot launch viewer.
   669     int location = index.data(MessageLocation).toInt();
   938     int location = index.data(MessageLocation).toInt();
   670     int sendingState = index.data(SendingState).toInt();
   939     int sendingState = index.data(SendingState).toInt();
   671     
   940     
   672     //If message is in Sending state or is Scheduled to be sent later,
   941     //If message is in Sending state or is Scheduled to be sent later,
   673     //do not open the message
   942     //do not open the message
   674     if(sendingState == ConvergedMessage::Suspended ||
   943     if(sendingState == ConvergedMessage::Suspended ||
   675             sendingState == ConvergedMessage::Resend ||
       
   676             sendingState == ConvergedMessage::Scheduled ||
   944             sendingState == ConvergedMessage::Scheduled ||
   677             sendingState == ConvergedMessage::Sending ||
   945             sendingState == ConvergedMessage::Sending ||
   678             sendingState == ConvergedMessage::Waiting)
   946             sendingState == ConvergedMessage::Waiting)
   679     {
   947     {
   680         return;
   948         return;
   682 
   950 
   683     //TODO: sendingState check should be removed once msg
   951     //TODO: sendingState check should be removed once msg
   684     // movement lock issue is resolved from mw
   952     // movement lock issue is resolved from mw
   685     if( !((location == ConvergedMessage::Inbox) ||
   953     if( !((location == ConvergedMessage::Inbox) ||
   686         (location == ConvergedMessage::Sent) ||
   954         (location == ConvergedMessage::Sent) ||
   687         (sendingState == ConvergedMessage::SentState)) )
   955         (sendingState == ConvergedMessage::SentState)||
       
   956         (sendingState == ConvergedMessage::Failed) ||
       
   957         (sendingState == ConvergedMessage::Resend)))
   688         {// do not launch viewer, show a note
   958         {// do not launch viewer, show a note
   689         HbNotificationDialog* dlg = new HbNotificationDialog();
   959         HbNotificationDialog* dlg = new HbNotificationDialog();
   690         dlg->setFocusPolicy(Qt::NoFocus);
   960         dlg->setFocusPolicy(Qt::NoFocus);
   691         QString text(tr("Message Locked"));
   961         QString text(tr("Message Locked"));
   692         dlg->setText(text);
   962         dlg->setText(text);
   705         qint32 contactId = index.data(ContactId).toLongLong();
   975         qint32 contactId = index.data(ContactId).toLongLong();
   706 
   976 
   707         // message type
   977         // message type
   708 
   978 
   709         message.setMessageType((ConvergedMessage::MessageType) messageType);
   979         message.setMessageType((ConvergedMessage::MessageType) messageType);
       
   980         message.setMessageSubType((ConvergedMessage::MessageSubType) messageSubType);
   710 
   981 
   711         if (messageType == ConvergedMessage::Mms)
   982         if (messageType == ConvergedMessage::Mms)
   712         {
   983         {
   713             message.setSubject(index.data(Subject).toString());
   984             message.setSubject(index.data(Subject).toString());
   714             message.setPriority((ConvergedMessage::Priority) index.data(
   985             message.setPriority((ConvergedMessage::Priority) index.data(
   760 
  1031 
   761 //---------------------------------------------------------------
  1032 //---------------------------------------------------------------
   762 // MsgConversationView::launchUniEditor
  1033 // MsgConversationView::launchUniEditor
   763 // @see header file
  1034 // @see header file
   764 //---------------------------------------------------------------
  1035 //---------------------------------------------------------------
   765 void MsgConversationView::launchUniEditor(const int editorFields, QString& filepath)
  1036 void MsgConversationView::launchUniEditor(const QVariantList& data)
   766 {
  1037 {
   767     ConvergedMessage message;
  1038     // param list for switching to editor view
   768     message.setBodyText(mEditorWidget->content());
  1039     QVariantList params;
   769 
       
   770     ConvergedMessageAddress address;
       
   771     address.setAlias(mContactCardWidget->address().at(0)->alias());
       
   772     address.setAddress(mContactCardWidget->address().at(0)->address());
       
   773     message.addToRecipient(address);
       
   774 
       
   775     if(!filepath.isEmpty())
       
   776     {
       
   777         ConvergedMessageAttachment* attachment = new ConvergedMessageAttachment(filepath);
       
   778         ConvergedMessageAttachmentList attachmentList;
       
   779         attachmentList.append(attachment);
       
   780         message.addAttachments(attachmentList);
       
   781     }
       
   782 
       
   783     QByteArray dataArray;
  1040     QByteArray dataArray;
   784     QDataStream messageStream
  1041     QDataStream messageStream
   785     (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
  1042     (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
       
  1043 
       
  1044     // first arg is always the editor operation
       
  1045     int editorOperation = data.at(0).toInt();
       
  1046     
       
  1047     ConvergedMessage message;
       
  1048     QVariant data2;
       
  1049     if( editorOperation != MsgBaseView::FORWARD_MSG )
       
  1050     {
       
  1051         message.setBodyText(mEditorWidget->content());
       
  1052 
       
  1053         ConvergedMessageAddress address;
       
  1054         address.setAlias(mContactCardWidget->address().at(0)->alias());
       
  1055         address.setAddress(mContactCardWidget->address().at(0)->address());
       
  1056         message.addToRecipient(address);
       
  1057 
       
  1058         if(editorOperation == MsgBaseView::ADD_PHOTO ||
       
  1059            editorOperation == MsgBaseView::ADD_AUDIO ||
       
  1060            editorOperation == MsgBaseView::ADD_VIDEO )
       
  1061         {
       
  1062             // filepath is sent in cases like ADD_PHOTO, ADD_AUDIO etc.
       
  1063             QString filepath;
       
  1064             filepath = data.at(1).toString();
       
  1065             if(!filepath.isEmpty())
       
  1066             {
       
  1067                 ConvergedMessageAttachment* attachment = 
       
  1068                         new ConvergedMessageAttachment(filepath);
       
  1069                 ConvergedMessageAttachmentList attachmentList;
       
  1070                 attachmentList.append(attachment);
       
  1071                 message.addAttachments(attachmentList);
       
  1072             }            
       
  1073         }
       
  1074         else if(editorOperation == MsgBaseView::ADD_VCARD)
       
  1075         {
       
  1076             // filepath is not sent in cases like VCards & recipients
       
  1077             // instead, we will get a list of contacts. Pass it as it is.
       
  1078             data2 = data.at(1);
       
  1079         }
       
  1080     }
       
  1081     else
       
  1082     {
       
  1083         qint32 msgId = (qint32)data.at(1).toInt();
       
  1084         int msgType = data.at(2).toInt();
       
  1085         ConvergedMessageId id(msgId);
       
  1086         message.setMessageId(id);
       
  1087         message.setMessageType((ConvergedMessage::MessageType)msgType);
       
  1088     }
       
  1089 
   786     message.serialize(messageStream);
  1090     message.serialize(messageStream);
   787 
  1091     params << MsgBaseView::UNIEDITOR;
   788     QVariantList params;
  1092     params << MsgBaseView::CV;
   789     params << MsgBaseView::UNIEDITOR; // target view
       
   790     params << MsgBaseView::CV; // source view
       
   791 
       
   792     params << dataArray;
  1093     params << dataArray;
   793     params << editorFields;
  1094     params << editorOperation;
       
  1095     if(!data2.isNull())
       
  1096         params << data2;
   794 
  1097 
   795     clearEditors();
  1098     clearEditors();
   796     emit switchView(params);
  1099     emit switchView(params);
   797 }
  1100 }
   798 
  1101 
   800 // MsgConversationView::populateConversationsView
  1103 // MsgConversationView::populateConversationsView
   801 // @see header file
  1104 // @see header file
   802 //---------------------------------------------------------------
  1105 //---------------------------------------------------------------
   803 void MsgConversationView::populateConversationsView()
  1106 void MsgConversationView::populateConversationsView()
   804 {
  1107 {
   805     connect(mMessageModel, SIGNAL(conversationModelUpdated()),
  1108     bool b = connect(ConversationsEngine::instance(), 
   806         this, SLOT(refreshView()));
  1109                      SIGNAL(conversationModelUpdated()),
       
  1110                      this, 
       
  1111                      SLOT(scrollToBottom()));
   807 
  1112 
   808     mConversationList->setModel(mMessageModel);
  1113     mConversationList->setModel(mMessageModel);
   809     
  1114     
   810     refreshView();
  1115     refreshView();
   811     
  1116     scrollToBottom();
   812     HbEffect::start(this,QString("ConversationView"),
  1117 }
   813         QString("show"),this,"effectFinished");
       
   814 }
       
   815 
       
   816 //---------------------------------------------------------------
       
   817 // MsgConversationView::effectFinished
       
   818 // @see header file
       
   819 //---------------------------------------------------------------
       
   820 void MsgConversationView::effectFinished(
       
   821     const HbEffect::EffectStatus& /*status*/)
       
   822   {
       
   823   // Effect is finished. Start fetching remaing conversations
       
   824     ConversationsEngine::instance()->fetchMoreConversations();
       
   825   }
       
   826 
  1118 
   827 //---------------------------------------------------------------
  1119 //---------------------------------------------------------------
   828 // MsgConversationView::saveRingingTone
  1120 // MsgConversationView::saveRingingTone
   829 // @see header file
  1121 // @see header file
   830 //---------------------------------------------------------------
  1122 //---------------------------------------------------------------
   831 void MsgConversationView::saveRingingTone()
  1123 void MsgConversationView::saveRingingTone()
   832     {
  1124 {
   833     QModelIndex index = mConversationList->currentIndex();
  1125     QModelIndex index = mConversationList->currentIndex();
   834     int messageId = index.data(ConvergedMsgId).toInt();
  1126     int messageId = index.data(ConvergedMsgId).toInt();
   835     
  1127 
   836     UniDataModelLoader* pluginLoader = new UniDataModelLoader();
  1128     UniDataModelLoader* pluginLoader = new UniDataModelLoader();
   837     pluginLoader->loadPlugins();
       
   838     UniDataModelPluginInterface* pluginInterface = 
  1129     UniDataModelPluginInterface* pluginInterface = 
   839                         pluginLoader->getDataModelPlugin("bio:vcal");
  1130     pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
   840     pluginInterface->setMessageId(messageId);
  1131     pluginInterface->setMessageId(messageId);
   841     UniMessageInfoList attachments = pluginInterface->attachmentList();
  1132     UniMessageInfoList attachments = pluginInterface->attachmentList();
   842     
  1133     if(attachments.count() > 0)
   843     QString attachmentPath = attachments[0]->path();
  1134     {
   844     
  1135         QString attachmentPath = attachments[0]->path();
   845     RingBc* ringBc = new RingBc();
  1136 
   846     
  1137         RingBc* ringBc = new RingBc();
   847     ringBc->saveTone(attachmentPath);
  1138 
   848       
  1139         ringBc->saveTone(attachmentPath);
   849     // clear attachement list : its allocated at data model
  1140 
   850     while(!attachments.isEmpty())
  1141         // clear attachement list : its allocated at data model
   851         {
  1142         while(!attachments.isEmpty())
   852         delete attachments.takeFirst();
  1143         {
   853         }
  1144             delete attachments.takeFirst();
   854 
  1145         }
   855     delete ringBc;
  1146 
       
  1147         delete ringBc;
       
  1148     }
   856     delete pluginLoader;
  1149     delete pluginLoader;
   857     }
  1150 }
       
  1151 
       
  1152 //---------------------------------------------------------------
       
  1153 // MsgConversationView::handleSmsCharLimitReached
       
  1154 // @see header file
       
  1155 //---------------------------------------------------------------
       
  1156 void MsgConversationView::handleSmsCharLimitReached()   
       
  1157 {
       
  1158     QString filepath;
       
  1159     QVariantList params;
       
  1160     params << MsgBaseView::ADD_OTHERS;
       
  1161     launchUniEditor(params);   
       
  1162 }
       
  1163 
       
  1164 //---------------------------------------------------------------
       
  1165 // MsgConversationView::validateMsgForForward
       
  1166 // @see header file
       
  1167 //---------------------------------------------------------------
       
  1168 bool MsgConversationView::validateMsgForForward(int &messageType,
       
  1169     qint32 &messageId)
       
  1170 {
       
  1171     bool retValue = true;
       
  1172     if (messageType == ConvergedMessage::Mms)
       
  1173     {
       
  1174         //Validate if the mms msg can be forwarded or not
       
  1175         MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck;
       
  1176         retValue = mmsConformanceCheck->validateMsgForForward(messageId);
       
  1177         
       
  1178         delete mmsConformanceCheck;
       
  1179     }
       
  1180 
       
  1181     return retValue;
       
  1182 }
       
  1183 
       
  1184 //---------------------------------------------------------------
       
  1185 // MsgConversationView::vkbOpened
       
  1186 // @see header file
       
  1187 //---------------------------------------------------------------
       
  1188 void MsgConversationView::vkbOpened()
       
  1189 {
       
  1190     mVkbopened = true;
       
  1191     
       
  1192     mContactCardWidget->connectSignals(false);
       
  1193     
       
  1194     emit hideChrome(true);
       
  1195     
       
  1196     QRectF appRect = mVkbHost->applicationArea();    
       
  1197     qreal spacing = 0.0;
       
  1198     qreal cardHeight = 0.0;
       
  1199     if(mContactCardWidget->isVisible())
       
  1200         {
       
  1201         cardHeight = mContactCardWidget->rect().height();
       
  1202         spacing = HbDeviceProfile::profile(this).unitValue();
       
  1203         }
       
  1204     
       
  1205     this->setMaximumHeight(appRect.height()- cardHeight - spacing);
       
  1206     
       
  1207     disconnect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
       
  1208     
       
  1209     scrollToBottom();
       
  1210 }
       
  1211 	  
       
  1212 //---------------------------------------------------------------
       
  1213 // MsgConversationView::vkbClosed
       
  1214 // @see header file
       
  1215 //---------------------------------------------------------------
       
  1216 void MsgConversationView::vkbClosed()
       
  1217 {
       
  1218     mVkbopened = false;
       
  1219     
       
  1220     mContactCardWidget->connectSignals(true);
       
  1221     
       
  1222     emit hideChrome(false);
       
  1223     
       
  1224     this->setMaximumHeight(-1);
       
  1225     connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
       
  1226 }
       
  1227 
       
  1228 //---------------------------------------------------------------
       
  1229 // MsgConversationView::serviceRequestError
       
  1230 // @see header file
       
  1231 //---------------------------------------------------------------
       
  1232 void MsgConversationView::serviceRequestError(int errorCode, const QString& errorMessage)
       
  1233 {
       
  1234     QDEBUG_WRITE_FORMAT(errorMessage,errorCode);
       
  1235 }
       
  1236 
       
  1237 //---------------------------------------------------------------
       
  1238 // MsgConversationView::activateInputBlocker
       
  1239 // @see header file
       
  1240 //--------------------------------------------------------------
       
  1241 void MsgConversationView::activateInputBlocker()
       
  1242     {
       
  1243         this->grabMouse();
       
  1244         this->grabKeyboard();
       
  1245     }
       
  1246 
       
  1247 //---------------------------------------------------------------
       
  1248 // MsgConversationView::deactivateInputBlocker
       
  1249 // @see header file
       
  1250 //--------------------------------------------------------------
       
  1251 void MsgConversationView::deactivateInputBlocker()
       
  1252     {    
       
  1253         this->ungrabKeyboard();
       
  1254         this->ungrabMouse();
       
  1255     }
       
  1256 
   858 
  1257 
   859 // EOF
  1258 // EOF