Changeset 6189

Show
Ignore:
Timestamp:
05/10/08 23:03:16 (4 months ago)
Author:
flynd
Message:

Don't send updates while reloading the contact list. reset() at the end will force views to reload anyway.

Location:
trunk/qt4-gui/src/contactlist
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/contactlist/contactlist.cpp

    r6153 r6189  
    3939 
    4040ContactListModel::ContactListModel(QObject* parent) 
    41   : QAbstractItemModel(parent) 
     41  : QAbstractItemModel(parent), 
     42    myBlockUpdates(false) 
    4243{ 
    4344  // Create the system groups 
     
    157158void ContactListModel::slot_userDataChanged(const ContactUserData* user) 
    158159{ 
     160  if (myBlockUpdates) 
     161    return; 
     162 
    159163  // Emit signal that the user has changed in all groups 
    160164  foreach (ContactUser* u, user->groupList()) 
     
    167171void ContactListModel::groupDataChanged(ContactGroup* group) 
    168172{ 
     173  if (myBlockUpdates) 
     174    return; 
     175 
    169176  int groupRow = (group->groupId() < SystemGroupOffset 
    170177      ? myUserGroups.indexOf(group) 
     
    176183void ContactListModel::slot_barDataChanged(ContactBar* bar, int row) 
    177184{ 
     185  if (myBlockUpdates) 
     186    return; 
     187 
    178188  emit dataChanged(createIndex(row, 0, bar), createIndex(row, myColumnCount - 1, bar)); 
    179189} 
     
    181191void ContactListModel::reloadAll() 
    182192{ 
     193  // Don't send out signals while reloading, the reset at the end will be enough 
     194  myBlockUpdates = true; 
     195 
    183196  // Clear the list of all old groups and users 
    184197  clear(); 
     
    217230 
    218231  // Tell views that we have done major changes 
     232  myBlockUpdates = false; 
    219233  reset(); 
    220234} 
  • trunk/qt4-gui/src/contactlist/contactlist.h

    r6153 r6189  
    408408  QList<ContactUserData*> myUsers; 
    409409  int myColumnCount; 
     410  bool myBlockUpdates; 
    410411}; 
    411412