Show
Ignore:
Timestamp:
06/14/08 03:47:03 (6 months ago)
Author:
flynd
Message:

Updated to work with and take advantage of new group handling. Contact list model is now properly updated from signals when groups change.

Files:
1 modified

Legend:

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

    r6281 r6283  
    206206    delete a; 
    207207 
    208   GroupList* g = gUserManager.LockGroupList(LOCK_R); 
    209   for (unsigned int i = 0; i < g->size(); ++i) 
    210   { 
    211     QString name = QString::fromLocal8Bit((*g)[i]); 
     208  FOR_EACH_GROUP_START_SORTED(LOCK_R) 
     209  { 
     210    QString name = QString::fromLocal8Bit(pGroup->name().c_str()); 
    212211 
    213212    a = myUserGroupActions->addAction(name); 
    214     a->setData(i + 1); 
     213    a->setData(pGroup->id()); 
    215214    a->setCheckable(true); 
    216215 
    217216    a = myServerGroupActions->addAction(name); 
    218     a->setData(i + 1); 
     217    a->setData(pGroup->id()); 
    219218    a->setCheckable(true); 
    220219  } 
    221   gUserManager.UnlockGroupList(); 
     220  FOR_EACH_GROUP_END 
    222221 
    223222  // Add groups to menu 
     
    552551  gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_USER, gid, 
    553552      action->isChecked(), false); 
    554  
    555   // The daemon does not send an update when group membership changes 
    556   // so tell the contactList it needs to update 
    557   LicqGui::instance()->contactList()->updateUser(myId, myPpid); 
    558553} 
    559554 
     
    578573  gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_SYSTEM, gid, 
    579574      action->isChecked(), true); 
    580  
    581   // The daemon does not send an update when group membership changes 
    582   // so tell the contactList it needs to update 
    583   LicqGui::instance()->contactList()->updateUser(myId, myPpid); 
    584575} 
    585576 
     
    588579  unsigned int gid = action->data().toUInt(); 
    589580  gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_USER, gid, true, true); 
    590  
    591   // The daemon does not send an update when group membership changes 
    592   // so tell the contactList it needs to update 
    593   LicqGui::instance()->contactList()->updateUser(myId, myPpid); 
    594 } 
     581}