messagingapp/msgui/appengine/src/conversationsengineutility.cpp
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
   117         break;
   117         break;
   118     }
   118     }
   119     return messageSubType;
   119     return messageSubType;
   120 }
   120 }
   121 
   121 
   122 //---------------------------------------------------------------
       
   123 // ConversationsEngineUtility::getVcardDisplayName
       
   124 // @see header
       
   125 //---------------------------------------------------------------
       
   126 QString ConversationsEngineUtility::getVcardDisplayName(QString filePath)
       
   127 {
       
   128     QString displayName;
       
   129     //open file for parsing
       
   130     QFile file(filePath);
       
   131     if (!file.open(QIODevice::ReadOnly)) {
       
   132         return displayName;
       
   133     }
       
   134     // parse contents
       
   135     QVersitReader reader;
       
   136     reader.setDevice(&file);
       
   137     if (reader.startReading()) {
       
   138         if (reader.waitForFinished()) {
       
   139             QList<QVersitDocument> versitDocuments = reader.results();
       
   140             // Use the resulting document
       
   141             if (versitDocuments.count() > 0) {
       
   142                 QVersitContactImporter importer;
       
   143                 QList<QContact> contacts = importer.importContacts(versitDocuments);
       
   144                 // get display-name
       
   145                 if (contacts.count() > 0) {
       
   146                     QContactManager* contactManager = new QContactManager("symbian");
       
   147                     displayName = contactManager->synthesizedDisplayLabel(contacts[0]);
       
   148                     delete contactManager;
       
   149                 }
       
   150             }
       
   151         }
       
   152     }
       
   153     file.close();
       
   154 
       
   155     return displayName;
       
   156 }
       
   157 
       
   158 // End of file
   122 // End of file