Ignore:
Timestamp:
Mar 12, 2010 9:47:05 PM (3 years ago)
Author:
laurent@…
Branch:
default
Message:

bug fix : first im message is not displayed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wengophone/src/presentation/qt/chat/QtChatWidget.cpp

    r587 r594  
    4949#include <cutil/global.h> 
    5050#include <qtutil/SafeConnect.h> 
     51#include <qtutil/StringListConvert.h> 
    5152 
    5253#include <string> 
     
    163164 
    164165        //load theme 
     166        connect(_ui.chatHistory,SIGNAL(loadFinished(bool)),this,SLOT(htmlLoadFinished(bool))); 
    165167        _ui.chatHistory->setTheme(QString::fromStdString(config.getChatTheme()),QString::fromStdString(config.getChatThemeVariant())); 
    166168} 
     
    610612        return false; 
    611613} 
     614 
     615void QtChatWidget::readyToLoadHistory() 
     616{        
     617 
     618        HistoryMementoCollection * hmc = _cChatHandler.getCUserProfile().getUserProfile().getHistory().getSessionCollection(_imChatSession->getId()); 
     619         
     620         
     621        if(hmc) 
     622                for (HistoryMap::iterator it = hmc->begin(); it != hmc->end(); it++) { 
     623                         
     624                        HistoryMemento * memento = it->second; 
     625 
     626                        Time mementoTime = memento->getTime(); 
     627                        QTime time = QTime(mementoTime.getHour(), mementoTime.getMinute()); 
     628                         
     629                        QString contactName = QString::fromUtf8(memento->getPeer().c_str()); 
     630                        contactName.remove("sip:"); 
     631                         
     632                        QtContactList * qtContactList = _qtWengoPhone->getQtContactList(); 
     633                        CContactList & cContactList = qtContactList->getCContactList(); 
     634                        QString contactId = QString::fromStdString(cContactList.findContactThatOwns(contactName.toStdString())); 
     635                         
     636                        _ui.chatHistory->insertMessage( 
     637                                                                                        contactId, 
     638                                                                                        contactName, 
     639                                                                                        QString::fromUtf8(memento->getData().c_str()), 
     640                                                                                        time 
     641                                                                                        ); 
     642                } 
     643} 
     644 
     645void QtChatWidget::htmlLoadFinished(bool) 
     646{ 
     647        //WebKit need a little time to load resources ... 
     648        QTimer::singleShot(500, this, SLOT(readyToLoadHistory())); 
     649} 
Note: See TracChangeset for help on using the changeset viewer.