Changeset 67:578192d6fe64 in SMSSender for src/ui/models/contactgroupmodel.cpp
- Timestamp:
- Feb 7, 2010 4:11:28 PM (12 years ago)
- Branch:
- 3.0
- Convert:
- svn:3639001d-8e34-449c-bb86-3782b86c4877/branches/3.0@66
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ui/models/contactgroupmodel.cpp
r55 r67 9 9 { 10 10 connect(BCContactManager::instance(), SIGNAL(contactAdded(IContact*)), 11 this, SLOT( dataUpdated(IContact*)));11 this, SLOT(listAltered())); 12 12 connect(BCContactManager::instance(), SIGNAL(contactUpdated(IContact*)), 13 13 this, SLOT(dataUpdated(IContact*))); 14 14 connect(BCContactManager::instance(), SIGNAL(contactRemoved(IContact*)), 15 this, SLOT( dataUpdated(IContact*)));15 this, SLOT(listAltered())); 16 16 17 17 connect(BCGroupManager::instance(), SIGNAL(groupAdded(IGroup*)), 18 this, SLOT( dataUpdated(IGroup*)));18 this, SLOT(listAltered())); 19 19 connect(BCGroupManager::instance(), SIGNAL(groupUpdated(IGroup*)), 20 20 this, SLOT(dataUpdated(IGroup*))); 21 21 connect(BCGroupManager::instance(), SIGNAL(groupRemoved(IGroup*)), 22 this, SLOT( dataUpdated(IGroup*)));22 this, SLOT(listAltered())); 23 23 24 24 reloadList(); … … 26 26 ContactGroupListModel::~ContactGroupListModel() { 27 27 disconnect(BCContactManager::instance(), SIGNAL(contactAdded(IContact*)), 28 this, SLOT( dataUpdated(IContact*)));28 this, SLOT(listAltered())); 29 29 disconnect(BCContactManager::instance(), SIGNAL(contactUpdated(IContact*)), 30 30 this, SLOT(dataUpdated(IContact*))); 31 31 disconnect(BCContactManager::instance(), SIGNAL(contactRemoved(IContact*)), 32 this, SLOT( dataUpdated(IContact*)));32 this, SLOT(listAltered())); 33 33 34 34 disconnect(BCGroupManager::instance(), SIGNAL(groupAdded(IGroup*)), 35 this, SLOT( dataUpdated(IGroup*)));35 this, SLOT(listAltered())); 36 36 disconnect(BCGroupManager::instance(), SIGNAL(groupUpdated(IGroup*)), 37 37 this, SLOT(dataUpdated(IGroup*))); 38 38 disconnect(BCGroupManager::instance(), SIGNAL(groupRemoved(IGroup*)), 39 this, SLOT(dataUpdated(IGroup*))); 39 this, SLOT(listAltered())); 40 } 41 42 void ContactGroupListModel::listAltered() { 43 reloadList(); 40 44 } 41 45 … … 48 52 void ContactGroupListModel::dataUpdated(IInterface* contactOrGroup) { 49 53 int row = items_.indexOf(contactOrGroup); 54 50 55 QModelIndex idx1 = index(row, 0); 51 52 row = items_.indexOf(contactOrGroup); 53 54 reloadList(); 55 56 if (row < 0) { // New contact/group added 57 reset(); 58 } else { 59 row = items_.indexOf(contactOrGroup); 60 61 if (row < 0) { // Contact/group removed 62 reset(); 63 } else { 64 QModelIndex idx2 = index(row, 0); 65 66 emit dataChanged(idx1, idx1); 67 if (idx1 != idx2) { 68 emit dataChanged(idx2, idx2); 69 } 70 } 56 QModelIndex idx2 = index(row, columnCount()); 57 58 if (idx1.isValid() && idx2.isValid()) { // Contact/group in list 59 emit dataChanged(idx1, idx2); 71 60 } 72 61 } … … 80 69 items_.append(group); 81 70 } 71 72 reset(); 82 73 } 83 74
Note: See TracChangeset
for help on using the changeset viewer.