messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
child 48 4f501b74aeb1
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
    18 
    18 
    19 // SYSTEM INCLUDES
    19 // SYSTEM INCLUDES
    20 #include <hbdevicedialog.h>
    20 #include <hbdevicedialog.h>
    21 #include <hbindicator.h>
    21 #include <hbindicator.h>
    22 #include <qfileinfo.h>
    22 #include <qfileinfo.h>
    23 #include <qversitcontactimporter.h>
    23 
    24 #include <qversitreader.h>
       
    25 #include <qtcontacts.h>
       
    26 QTM_USE_NAMESPACE
       
    27 //USER INCLUDES
    24 //USER INCLUDES
    28 #include "msgnotifier.h"
    25 #include "msgnotifier.h"
    29 #include "msgnotifier_p.h"
    26 #include "msgnotifier_p.h"
    30 #include "msgsimnumberdetector.h"
    27 #include "msgsimnumberdetector.h"
    31 #include "msgnotificationdialogpluginkeys.h"
    28 #include "msgnotificationdialogpluginkeys.h"
    32 #include "msginfodefs.h"
    29 #include "msginfodefs.h"
    33 #include "ccsdefs.h"
    30 #include "ccsdefs.h"
    34 #include "unidatamodelloader.h"
    31 #include "unidatamodelloader.h"
    35 #include "unidatamodelplugininterface.h"
    32 #include "unidatamodelplugininterface.h"
       
    33 #include "msgcontacthandler.h"
       
    34 
    36 #include "debugtraces.h"
    35 #include "debugtraces.h"
    37 
    36 
    38 // LOCALIZATION CONSTANTS
    37 // LOCALIZATION CONSTANTS
    39 #define LOC_RECEIVED_FILES           hbTrId("txt_messaging_title_received_files")
    38 #define LOC_RECEIVED_FILES           hbTrId("txt_messaging_title_received_files")
    40 #define LOC_BUSINESS_CARD           hbTrId("txt_messaging_dpopinfo_business_card")
    39 #define LOC_BUSINESS_CARD           hbTrId("txt_messaging_dpopinfo_business_card")
   112             {
   111             {
   113             UniMessageInfoList attList = bioMsgPlugin->attachmentList();
   112             UniMessageInfoList attList = bioMsgPlugin->attachmentList();
   114             QString attachmentPath = attList[0]->path();
   113             QString attachmentPath = attList[0]->path();
   115             description = LOC_BUSINESS_CARD;
   114             description = LOC_BUSINESS_CARD;
   116             description.append(CARD_SEPERATOR);
   115             description.append(CARD_SEPERATOR);
   117             description.append(getVcardDisplayName(attachmentPath));
   116             description.append(
       
   117                     MsgContactHandler::getVCardDisplayName(attachmentPath));
   118             } 
   118             } 
   119         delete pluginLoader;
   119         delete pluginLoader;
   120         }
   120         }
   121     else
   121     else
   122         {
   122         {
   195     }
   195     }
   196 
   196 
   197     QDEBUG_WRITE("MsgNotifier::updateOutboxIndications  Exit")
   197     QDEBUG_WRITE("MsgNotifier::updateOutboxIndications  Exit")
   198 }
   198 }
   199 
   199 
   200 //---------------------------------------------------------------
       
   201 // MsgNotifier::getVcardDisplayName
       
   202 // @see header
       
   203 //---------------------------------------------------------------
       
   204 QString MsgNotifier::getVcardDisplayName(const QString& filePath)
       
   205 {
       
   206     QString displayName;
       
   207     //open file for parsing
       
   208     QFile file(filePath);
       
   209     if (!file.open(QIODevice::ReadOnly)) {
       
   210         return displayName;
       
   211     }
       
   212     // parse contents
       
   213     QVersitReader reader;
       
   214     reader.setDevice(&file);
       
   215     if (reader.startReading()) {
       
   216         if (reader.waitForFinished()) {
       
   217             QList<QVersitDocument> versitDocuments = reader.results();
       
   218             // Use the resulting document
       
   219             if (versitDocuments.count() > 0) {
       
   220                 QVersitContactImporter importer;
       
   221                 QList<QContact> contacts = importer.importContacts(versitDocuments);
       
   222                 // get display-name
       
   223                 if (contacts.count() > 0) {
       
   224                     QContactManager* contactManager = new QContactManager("symbian");
       
   225                     displayName = contactManager->synthesizedDisplayLabel(contacts[0]);
       
   226                     delete contactManager;
       
   227                 }
       
   228             }
       
   229         }
       
   230     }
       
   231     file.close();
       
   232     return displayName;
       
   233 }
       
   234 
       
   235 //EOF
   200 //EOF