messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp
changeset 73 ecf6a73a9186
parent 67 fc91263aee62
child 76 60a8a215b0ec
equal deleted inserted replaced
68:e8a69c93c830 73:ecf6a73a9186
    86 // Max vcards inside a msg. Using a very large number.
    86 // Max vcards inside a msg. Using a very large number.
    87 // TODO: how we can avoid this?
    87 // TODO: how we can avoid this?
    88 const int MAX_VCARDS(1000);
    88 const int MAX_VCARDS(1000);
    89 
    89 
    90 // LOCALIZED CONSTANTS
    90 // LOCALIZED CONSTANTS
       
    91 #define LOC_TITLE hbTrId("txt_messaging_title_messaging")
    91 //To,Cc.Bcc
    92 //To,Cc.Bcc
    92 #define LOC_TO  hbTrId("txt_messaging_formlabel_to")
    93 #define LOC_TO  hbTrId("txt_messaging_formlabel_to")
    93 #define LOC_CC hbTrId("txt_messaging_formlabel_cc")
    94 #define LOC_CC hbTrId("txt_messaging_formlabel_cc")
    94 #define LOC_BCC hbTrId("txt_messaging_formlabel_bcc")
    95 #define LOC_BCC hbTrId("txt_messaging_formlabel_bcc")
    95 
    96 
   242 }
   243 }
   243 
   244 
   244 void MsgUnifiedEditorView::addMenu()
   245 void MsgUnifiedEditorView::addMenu()
   245 {
   246 {
   246     //Create Menu Options
   247     //Create Menu Options
   247     HbMenu* mainMenu = new HbMenu();
   248     HbMenu* mainMenu = this->menu();
   248     mainMenu->setFocusPolicy(Qt::NoFocus);
   249     mainMenu->setFocusPolicy(Qt::NoFocus);
   249 	
   250 	
   250     //if subject field / cc,bcc fields are already present don't add corresponding actions.
   251     //if subject field / cc,bcc fields are already present don't add corresponding actions.
   251     if(!mSubjectField)
   252     if(!mSubjectField)
   252     {
   253     {
   276     connect(highPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
   277     connect(highPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
   277     connect(normalPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
   278     connect(normalPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
   278     connect(lowPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
   279     connect(lowPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
   279     connect(deleteMsgAction,SIGNAL(triggered()),this, SLOT(deleteMessage()));
   280     connect(deleteMsgAction,SIGNAL(triggered()),this, SLOT(deleteMessage()));
   280 
   281 
   281     setMenu(mainMenu);
       
   282 }
   282 }
   283 
   283 
   284 void MsgUnifiedEditorView::openDraftsMessage(const QVariantList& editorData)
   284 void MsgUnifiedEditorView::openDraftsMessage(const QVariantList& editorData)
   285 {
   285 {
   286     // unpack editor's data
   286     // unpack editor's data
  1476 void MsgUnifiedEditorView::fetchContacts()
  1476 void MsgUnifiedEditorView::fetchContacts()
  1477 {
  1477 {
  1478     QString service("phonebookservices");
  1478     QString service("phonebookservices");
  1479     QString interface("com.nokia.symbian.IContactsFetch");
  1479     QString interface("com.nokia.symbian.IContactsFetch");
  1480     QString operation("multiFetch(QString,QString)");
  1480     QString operation("multiFetch(QString,QString)");
  1481     XQAiwRequest* request;
  1481   
  1482     XQApplicationManager appManager;
  1482     XQApplicationManager appManager;   
  1483     request = appManager.create(service, interface, operation, true); //embedded
  1483     XQAiwRequest* request = appManager.create(service, interface, operation, true); //embedded
       
  1484 	
  1484     if ( request == NULL )
  1485     if ( request == NULL )
  1485     {
  1486     {
  1486         QCRITICAL_WRITE("AIW-ERROR: NULL request");
  1487         QCRITICAL_WRITE("AIW-ERROR: NULL request");
  1487         return;
  1488         return;
  1488     }
  1489     }
  1489 
  1490 	
       
  1491     request->setSynchronous(false); // synchronous
       
  1492 	
  1490     // Result handlers
  1493     // Result handlers
  1491     connect (request, SIGNAL(requestOk(const QVariant&)),
  1494     connect (request, SIGNAL(requestOk(const QVariant&)),
  1492         this, SLOT(contactsFetched(const QVariant&)));
  1495         this, SLOT(contactsFetched(const QVariant&)));
  1493     connect (request, SIGNAL(requestError(int,const QString&)),
  1496     connect (request, SIGNAL(requestError(int,const QString&)),
  1494         this, SLOT(serviceRequestError(int,const QString&)));
  1497         this, SLOT(serviceRequestError(int,const QString&)));
  1495 
  1498 
  1496     QList<QVariant> args;
  1499     QList<QVariant> args;
  1497     args << QString(tr("Phonebook"));
  1500     args << LOC_TITLE;
  1498     args << KCntActionAll;
  1501     args << KCntActionAll;
  1499     args << KCntFilterDisplayAll;
  1502     args << KCntFilterDisplayAll;
  1500 
  1503 
  1501     request->setArguments(args);
  1504     request->setArguments(args);
  1502     if(!request->send())
  1505     if(!request->send())
  1503     {
  1506     {
  1504         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:",request->lastError());
  1507         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:",request->lastError());
  1505     }
  1508     }
  1506     delete request;
       
  1507 }
  1509 }
  1508 
  1510 
  1509 //---------------------------------------------------------------
  1511 //---------------------------------------------------------------
  1510 // MsgUnifiedEditorView::fetchImages
  1512 // MsgUnifiedEditorView::fetchImages
  1511 // @see header file
  1513 // @see header file
  1513 void MsgUnifiedEditorView::fetchImages()
  1515 void MsgUnifiedEditorView::fetchImages()
  1514 {
  1516 {
  1515     QString service("photos");
  1517     QString service("photos");
  1516     QString interface("com.nokia.symbian.IImageFetch");
  1518     QString interface("com.nokia.symbian.IImageFetch");
  1517     QString operation("fetch()");
  1519     QString operation("fetch()");
  1518     XQAiwRequest* request = NULL;
       
  1519     XQApplicationManager appManager;
  1520     XQApplicationManager appManager;
  1520     request = appManager.create(service,interface, operation, true);//embedded
  1521     XQAiwRequest* request = appManager.create(service,interface, operation, true);//embedded
  1521   
       
  1522     if(!request)
  1522     if(!request)
  1523     {     
  1523     {     
  1524         QCRITICAL_WRITE("AIW-ERROR: NULL request");
  1524         QCRITICAL_WRITE("AIW-ERROR: NULL request");
  1525         return;
  1525         return;
  1526     }
  1526     }
  1527     
  1527     request->setSynchronous(false); // synchronous
  1528     request->setSynchronous(true); // synchronous
       
  1529 
  1528 
  1530     connect(request, SIGNAL(requestOk(const QVariant&)),
  1529     connect(request, SIGNAL(requestOk(const QVariant&)),
  1531         this, SLOT(imagesFetched(const QVariant&)));
  1530         this, SLOT(imagesFetched(const QVariant&)));
  1532     connect(request, SIGNAL(requestError(int,const QString&)),
  1531     connect(request, SIGNAL(requestError(int,const QString&)),
  1533         this, SLOT(serviceRequestError(int,const QString&)));
  1532         this, SLOT(serviceRequestError(int,const QString&)));
  1535     // Make the request
  1534     // Make the request
  1536     if (!request->send())
  1535     if (!request->send())
  1537     {
  1536     {
  1538         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError());
  1537         QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError());
  1539     }  
  1538     }  
  1540     delete request;
       
  1541 }
  1539 }
  1542 
  1540 
  1543 //---------------------------------------------------------------
  1541 //---------------------------------------------------------------
  1544 // MsgUnifiedEditorView::fetchAudio
  1542 // MsgUnifiedEditorView::fetchAudio
  1545 // @see header file
  1543 // @see header file
  1564 // MsgUnifiedEditorView::contactsFetched
  1562 // MsgUnifiedEditorView::contactsFetched
  1565 // @see header file
  1563 // @see header file
  1566 //---------------------------------------------------------------
  1564 //---------------------------------------------------------------
  1567 void MsgUnifiedEditorView::contactsFetched(const QVariant& value)
  1565 void MsgUnifiedEditorView::contactsFetched(const QVariant& value)
  1568 {
  1566 {
       
  1567     XQAiwRequest* request = qobject_cast<XQAiwRequest*>(this->sender());
       
  1568     if(request)
       
  1569     {
       
  1570         delete request;
       
  1571     }
       
  1572 
  1569     // create a vcard for each contact fetched and add as attachment
  1573     // create a vcard for each contact fetched and add as attachment
  1570     QStringList attachmentList;
  1574     QStringList attachmentList;
  1571     if(createVCards(value, attachmentList) == KErrNone)
  1575     if(createVCards(value, attachmentList) == KErrNone)
  1572     {
  1576     {
  1573         addAttachments(attachmentList);
  1577         addAttachments(attachmentList);
  1578 // MsgUnifiedEditorView::imagesFetched
  1582 // MsgUnifiedEditorView::imagesFetched
  1579 // @see header file
  1583 // @see header file
  1580 //---------------------------------------------------------------
  1584 //---------------------------------------------------------------
  1581 void MsgUnifiedEditorView::imagesFetched(const QVariant& result )
  1585 void MsgUnifiedEditorView::imagesFetched(const QVariant& result )
  1582 {
  1586 {
       
  1587     XQAiwRequest* request = qobject_cast<XQAiwRequest*>(this->sender());
       
  1588     if(request)
       
  1589     {
       
  1590         delete request;        
       
  1591     }
       
  1592 	
  1583     if(result.canConvert<QStringList>())
  1593     if(result.canConvert<QStringList>())
  1584     {
  1594     {
  1585         QStringList fileList = result.value<QStringList>();
  1595         QStringList fileList = result.value<QStringList>();
  1586         if ( fileList.size()>0 )
  1596         if ( fileList.size()>0 )
  1587         {
  1597         {
  1596 // @see header file
  1606 // @see header file
  1597 //---------------------------------------------------------------
  1607 //---------------------------------------------------------------
  1598 void MsgUnifiedEditorView::serviceRequestError(int errorCode, const QString& errorMessage)
  1608 void MsgUnifiedEditorView::serviceRequestError(int errorCode, const QString& errorMessage)
  1599 {
  1609 {
  1600     QDEBUG_WRITE_FORMAT(errorMessage,errorCode);
  1610     QDEBUG_WRITE_FORMAT(errorMessage,errorCode);
       
  1611     Q_UNUSED(errorCode)
       
  1612     Q_UNUSED(errorMessage)
       
  1613 
       
  1614     XQAiwRequest* request = qobject_cast<XQAiwRequest*>(this->sender());
       
  1615     if(request)
       
  1616     {
       
  1617         delete request;	
       
  1618     }
  1601 }
  1619 }
  1602 
  1620 
  1603 //---------------------------------------------------------------
  1621 //---------------------------------------------------------------
  1604 // MsgUnifiedEditorView::activateInputBlocker
  1622 // MsgUnifiedEditorView::activateInputBlocker
  1605 // @see header file
  1623 // @see header file