Changeset 6200 for trunk/qt4-gui/src/contactlist/contactlist.cpp
- Timestamp:
- 05/25/08 06:25:18 (8 months ago)
- Files:
-
- 1 modified
-
trunk/qt4-gui/src/contactlist/contactlist.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/contactlist/contactlist.cpp
r6198 r6200 56 56 } 57 57 58 ContactListModel::~ContactListModel()59 {60 // Delete all users and groups61 clear();62 63 // Delete the system groups64 for (unsigned long i = 0; i < NUM_GROUPS_SYSTEM_ALL; ++i)65 delete mySystemGroups[i];66 }67 68 58 ContactGroup* ContactListModel::createGroup(unsigned short id, QString name) 69 59 { … … 76 66 } 77 67 68 ContactListModel::~ContactListModel() 69 { 70 // Delete all users and groups 71 clear(); 72 73 // Delete the system groups 74 for (unsigned long i = 0; i < NUM_GROUPS_SYSTEM_ALL; ++i) 75 delete mySystemGroups[i]; 76 } 77 78 78 void ContactListModel::listUpdated(CICQSignal* sig) 79 79 { 80 80 switch(sig->SubSignal()) 81 81 { 82 case LIST_ ALL:82 case LIST_INVALIDATE: 83 83 reloadAll(); 84 84 break; 85 85 86 case LIST_ ADD:86 case LIST_CONTACT_ADDED: 87 87 { 88 88 ICQUser* u = gUserManager.FetchUser(sig->Id(), sig->PPID(), LOCK_R); … … 96 96 break; 97 97 } 98 case LIST_ REMOVE:98 case LIST_CONTACT_REMOVED: 99 99 removeUser(sig->Id(), sig->PPID()); 100 100 break; 101 102 case LIST_GROUP_ADDED: 103 { 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(); 109 110 beginInsertRows(QModelIndex(), myUserGroups.size(), myUserGroups.size()); 111 myUserGroups.append(newGroup); 112 endInsertRows(); 113 break; 114 } 115 116 case LIST_GROUP_REMOVED: 117 { 118 unsigned short gid = sig->Argument(); 119 120 for (int i = 0; i < myUserGroups.size(); ++i) 121 { 122 ContactGroup* group = myUserGroups.at(i); 123 if (group->groupId() == gid) 124 { 125 beginRemoveRows(QModelIndex(), i, i); 126 myUserGroups.removeAll(group); 127 endRemoveRows(); 128 delete group; 129 } 130 } 131 break; 132 } 133 134 case LIST_GROUP_CHANGED: 135 { 136 unsigned short gid = sig->Argument(); 137 138 for (int i = 0; i < myUserGroups.size(); ++i) 139 { 140 ContactGroup* group = myUserGroups.at(i); 141 if (group->groupId() == gid) 142 group->update(); 143 } 144 break; 145 } 101 146 } 102 147 }
