Show
Ignore:
Timestamp:
06/11/08 08:25:24 (6 months ago)
Author:
eugene
Message:

Applied the latest version of flynd's qt4-gui patch.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/qt4-gui_group/src/contactlist/contactgroup.cpp

    r6200 r6259  
    3636{ 
    3737  if (myGroupId != 0) 
    38   { 
    39     mySortKey.sprintf("%10i", myGroupId); 
    40   } 
     38    mySortKey = myGroupId; 
    4139  else 
    42   { 
    4340    // Put "Other Users" last when sorting 
    44     mySortKey = QString("9999999999"); 
    45   } 
    46  
     41    mySortKey = 65535; 
     42 
     43  update(); 
     44 
     45  for (int i = 0; i < 3; ++i) 
     46    myBars[i] = new ContactBar(static_cast<ContactListModel::SubGroupType>(i), this); 
     47} 
     48 
     49ContactGroup::ContactGroup(const LicqGroup* group) 
     50  : ContactItem(ContactListModel::GroupItem), 
     51    myGroupId(group->id()), 
     52    myName(group->name().c_str()), 
     53    mySortKey(group->sortIndex()), 
     54    myEvents(0), 
     55    myVisibleContacts(0) 
     56{ 
    4757  for (int i = 0; i < 3; ++i) 
    4858    myBars[i] = new ContactBar(static_cast<ContactListModel::SubGroupType>(i), this); 
     
    6171void ContactGroup::update() 
    6272{ 
    63   GroupList* g = gUserManager.LockGroupList(LOCK_R); 
    64   myName = QString::fromLocal8Bit((*g)[myGroupId-1]); 
    65   gUserManager.UnlockGroupList(); 
    66  
    67   emit dataChanged(this); 
     73  // System groups and "Other users" aren't present in daemon group list 
     74  if (myGroupId == 0 || myGroupId >= ContactListModel::SystemGroupOffset) 
     75    return; 
     76 
     77  LicqGroup* g = gUserManager.FetchGroup(myGroupId, LOCK_R); 
     78  if (g == NULL) 
     79    return; 
     80 
     81  myName = QString::fromLocal8Bit(g->name().c_str()); 
     82  mySortKey = g->sortIndex(); 
     83  gUserManager.DropGroup(g); 
     84 
     85  emit dataChanged(this); 
     86} 
     87 
     88void ContactGroup::updateSortKey() 
     89{ 
     90  // System groups and "Other users" aren't present in daemon group list 
     91  if (myGroupId == 0 || myGroupId >= ContactListModel::SystemGroupOffset) 
     92    return; 
     93 
     94  LicqGroup* g = gUserManager.FetchGroup(myGroupId, LOCK_R); 
     95  if (g == NULL) 
     96    return; 
     97 
     98  mySortKey = g->sortIndex(); 
     99  gUserManager.DropGroup(g); 
    68100} 
    69101 
     
    214246 
    215247  // Don't save new name here, daemon will signal us when name has changed 
    216   gUserManager.RenameGroup(myGroupId, newName.toLocal8Bit()); 
     248  gUserManager.RenameGroup(myGroupId, newName.toLocal8Bit().data()); 
    217249 
    218250  return true;