~ubuntu-branches/debian/experimental/kopete/experimental

« back to all changes in this revision

Viewing changes to libkopete/chatsessionmemberslistmodel.cpp

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2015-02-24 11:32:57 UTC
  • mfrom: (1.1.41 vivid)
  • Revision ID: package-import@ubuntu.com-20150224113257-gnupg4v7lzz18ij0
Tags: 4:14.12.2-1
* New upstream release (14.12.2).
* Bump Standards-Version to 3.9.6, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    *************************************************************************
16
16
*/
17
17
 
 
18
#include "chatsessionmemberslistmodel.h"
18
19
#include "kopetecontact.h"
19
20
#include "kopeteonlinestatus.h"
20
 
#include "chatsessionmemberslistmodel.h"
21
21
#include "kdebug.h"
22
22
 
23
23
//own contact comparator, needs sessions contact-online-status weight
24
24
inline bool lessThan(const Kopete::Contact *c1, int weight1, const Kopete::Contact *c2, int weight2){
25
25
                return (weight1 > weight2 || (weight1 == weight2
26
 
                                && c1->nickName().compare(c2->nickName(),Qt::CaseInsensitive)<=0));
 
26
                                && c1->displayName().compare(c2->displayName(),Qt::CaseInsensitive)<=0));
27
27
 
28
28
}
29
29
 
178
178
        if (role == Qt::DisplayRole)
179
179
        {
180
180
                
181
 
                return c->nickName();
 
181
                return c->displayName();
182
182
 
183
183
        }
184
184
        else if (role == Qt::DecorationRole)
206
206
 
207
207
void ChatSessionMembersListModel::slotContactAdded( const Kopete::Contact *contact )
208
208
{
209
 
        kDebug( 14010 ) << "memberslistmodel contact added "<< contact->nickName();
 
209
        kDebug( 14010 ) << "memberslistmodel contact added "<< contact->displayName();
210
210
        int index = d->getInsertIndex(contact);
211
211
        beginInsertRows(QModelIndex(),index,index);
212
212
        d->contacts.insert(index,(Contact*)contact);
215
215
 
216
216
void ChatSessionMembersListModel::slotContactRemoved( const Kopete::Contact *contact )
217
217
{
218
 
        kDebug( 14010 ) << "memberslistmodel contact removed "<< contact->nickName();
 
218
        kDebug( 14010 ) << "memberslistmodel contact removed "<< contact->displayName();
219
219
        int index = d->contacts.indexOf((Contact*)contact);
220
220
        if (index == -1) {
221
 
                kDebug( 14010 ) << "Trying to remove contact '" << contact->nickName() << "' which isn't in members list model!!!";
 
221
                kDebug( 14010 ) << "Trying to remove contact '" << contact->displayName() << "' which isn't in members list model!!!";
222
222
                return;
223
223
        }
224
224
 
230
230
void ChatSessionMembersListModel::slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &status )
231
231
{
232
232
        Q_UNUSED(status)
233
 
        kDebug( 14010 ) << "memberslistmodel contact status changed "<< contact->nickName();
 
233
        kDebug( 14010 ) << "memberslistmodel contact status changed "<< contact->displayName();
234
234
        slotContactRemoved(contact);
235
235
        slotContactAdded(contact);
236
236
}
243
243
 
244
244
void ChatSessionMembersListModel::slotContactNickNameChanged( Kopete::Contact *contact)
245
245
{
246
 
        kDebug( 14010 ) << "memberslistmodel nickname changed to "<< contact->nickName();
 
246
        kDebug( 14010 ) << "memberslistmodel nickname changed to "<< contact->displayName();
247
247
        slotContactRemoved(contact);
248
248
        slotContactAdded(contact);
249
249
}