Changeset 6259 for branches/qt4-gui_group/src/contactlist/contactlist.cpp
- Timestamp:
- 06/11/08 08:25:24 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/qt4-gui_group/src/contactlist/contactlist.cpp
r6200 r6259 103 103 { 104 104 unsigned short gid = sig->Argument(); 105 106 GroupList* g = gUserManager.LockGroupList(LOCK_R); 107 ContactGroup* newGroup = createGroup(gid, QString::fromLocal8Bit((*g)[gid-1])); 108 gUserManager.UnlockGroupList(); 105 ContactGroup* newGroup = createGroup(gid); 109 106 110 107 beginInsertRows(QModelIndex(), myUserGroups.size(), myUserGroups.size()); … … 144 141 break; 145 142 } 143 144 case LIST_GROUP_REORDERED: 145 { 146 // Get new sort keys for all groups 147 for (int i = 0; i < myUserGroups.size(); ++i) 148 myUserGroups.at(i)->updateSortKey(); 149 150 // Send one changed signal for all groups 151 emit dataChanged(createIndex(0, 0, myUserGroups.at(0)), 152 createIndex(myUserGroups.size() + NUM_GROUPS_SYSTEM_ALL - 1, myColumnCount - 1, 153 mySystemGroups[NUM_GROUPS_SYSTEM_ALL-1])); 154 155 break; 156 } 146 157 } 147 158 } … … 250 261 251 262 // Add all groups 252 GroupList* g = gUserManager.LockGroupList(LOCK_R); 253 beginInsertRows(QModelIndex(), 0, g->size()); 263 beginInsertRows(QModelIndex(), 0, gUserManager.NumGroups() + 1); 254 264 255 265 ContactGroup* newGroup = createGroup(0, tr("Other Users")); 256 266 myUserGroups.append(newGroup); 257 267 258 for (unsigned short i = 0; i < g->size(); ++i) 259 { 260 newGroup = createGroup(i+1, QString::fromLocal8Bit((*g)[i])); 261 myUserGroups.append(newGroup); 262 } 268 FOR_EACH_GROUP_START(LOCK_R) 269 { 270 ContactGroup* group = new ContactGroup(pGroup); 271 connect(group, SIGNAL(dataChanged(ContactGroup*)), 272 SLOT(groupDataChanged(ContactGroup*))); 273 connect(group, SIGNAL(barDataChanged(ContactBar*, int)), 274 SLOT(barDataChanged(ContactBar*, int))); 275 myUserGroups.append(group); 276 } 277 FOR_EACH_GROUP_END 263 278 264 279 endInsertRows(); 265 gUserManager.UnlockGroupList();266 280 267 281 // Add all users … … 307 321 unsigned short gid = group->groupId(); 308 322 bool shouldBeMember = (gid != 0 && licqUser->GetInGroup(GROUPS_USER, gid)) || 309 (gid == 0 && licqUser->GetGroups( GROUPS_USER) == 0&& !licqUser->IgnoreList());323 (gid == 0 && licqUser->GetGroups().empty() && !licqUser->IgnoreList()); 310 324 updateUserGroup(user, group, i, shouldBeMember); 311 325 }
