~tiagosh/telephony-service/remove_ofono_dependency

« back to all changes in this revision

Viewing changes to indicator/messagingmenu.cpp

  • Committer: Tiago Salem Herrmann
  • Date: 2015-06-25 15:02:13 UTC
  • mto: (1040.2.28 chat_state)
  • mto: This revision was merged to the branch mainline in revision 1140.
  • Revision ID: tiago.herrmann@canonical.com-20150625150213-higt21txkkozlqef
Fix notifications and messaging menu for generic IM accounts

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
 
106
106
}
107
107
 
108
 
void MessagingMenu::addMessage(const QString &senderId, const QStringList &participantIds, const QString &accountId, const QString &messageId, const QDateTime &timestamp, const QString &text)
 
108
void MessagingMenu::addMessage(const QString &senderId, const QString &contactAlias, const QStringList &participantIds, const QString &accountId, const QString &messageId, const QDateTime &timestamp, const QString &text)
109
109
{
110
110
    // try to get a contact for that phone number
111
111
    QUrl iconPath = QUrl::fromLocalFile(telephonyServiceDir() + "/assets/avatar-default@18.png");
112
 
    QString contactAlias = senderId;
113
112
 
114
113
    AccountEntry *account = TelepathyHelper::instance()->accountForId(accountId);
115
114
    if (!account) {
125
124
 
126
125
    // place the messaging-menu item only after the contact fetch request is finished, as we can´t simply update
127
126
    QObject::connect(request, &QContactAbstractRequest::stateChanged,
128
 
                     [request, senderId, participantIds, accountId, messageId, text, timestamp, iconPath, contactAlias, this]() {
 
127
                     [request, senderId, participantIds, accountId, messageId, text, timestamp, iconPath, contactAlias, this](QContactAbstractRequest::State newState) {
129
128
 
130
129
        GFile *file = NULL;
131
130
        GIcon *icon = NULL;
132
131
 
133
132
        // only process the results after the finished state is reached
134
 
        if (request->state() != QContactAbstractRequest::FinishedState) {
 
133
        if (newState != QContactAbstractRequest::FinishedState) {
135
134
            return;
136
135
        }
137
136