Show
Ignore:
Timestamp:
05/25/08 06:25:18 (6 months ago)
Author:
flynd
Message:

Use new group subsignals from daemon. Removed some workarounds no longer needed.

Location:
trunk/qt4-gui/src/core
Files:
3 modified

Legend:

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

    r6154 r6200  
    8989    delete a; 
    9090 
    91   ContactListModel* list = LicqGui::instance()->contactList(); 
    92   int groupCount = list->rowCount(QModelIndex()); 
     91  GroupList* g = gUserManager.LockGroupList(LOCK_R); 
     92  for (unsigned int i = 0; i < g->size(); ++i) 
     93  { 
     94    QString name = QString::fromLocal8Bit((*g)[i]); 
    9395 
    94   for (int i = 0; i < groupCount; ++i) 
    95   { 
    96     QModelIndex groupIndex = list->index(i, 0, QModelIndex()); 
    97     unsigned int groupId = groupIndex.data(ContactListModel::GroupIdRole).toUInt(); 
     96    a = myUserGroupActions->addAction(name); 
     97    a->setData(i + 1); 
    9898 
    99     // Don't add system groups or other users group 
    100     if (groupId == 0 || groupId >= ContactListModel::SystemGroupOffset) 
    101       continue; 
    102  
    103     a = myUserGroupActions->addAction(groupIndex.data(ContactListModel::NameRole).toString()); 
    104     a->setData(groupId); 
     99    myGroupsMenu->insertAction(myGroupSeparator, a); 
    105100  } 
     101  gUserManager.UnlockGroupList(); 
    106102 
    107103  // Add groups to menu 
     
    139135  // Model uses group+1 so substract one before sending to daemon 
    140136  gUserManager.SwapGroups(myGroupId, myGroupId - 1); 
    141  
    142   // Daemon doesn't notify us when groups change so notify model from here 
    143   LicqGui::instance()->contactList()->reloadAll(); 
    144   LicqGui::instance()->mainWindow()->updateGroups(); 
    145137} 
    146138 
     
    149141  // Model uses group+1 so substract one before sending to daemon 
    150142  gUserManager.SwapGroups(myGroupId, myGroupId + 1); 
    151  
    152   // Daemon doesn't notify us when groups change so notify model from here 
    153   LicqGui::instance()->contactList()->reloadAll(); 
    154   LicqGui::instance()->mainWindow()->updateGroups(); 
    155143} 
    156144 
     
    165153 
    166154  gUserManager.RemoveGroup(myGroupId); 
    167  
    168   // Daemon doesn't notify us when groups change so notify model from here 
    169   LicqGui::instance()->contactList()->reloadAll(); 
    170   LicqGui::instance()->mainWindow()->updateGroups(); 
    171155} 
    172156 
  • trunk/qt4-gui/src/core/licqgui.cpp

    r6190 r6200  
    13891389  switch (sig->SubSignal()) 
    13901390  { 
    1391     case LIST_ALL: 
    1392       // Handled by ContactListModel 
    1393       break; 
    1394  
    13951391    case LIST_ADD: 
    13961392    { 
     
    14591455    } 
    14601456 
     1457    case LIST_ALL: 
     1458    case LIST_GROUP_ADDED: 
     1459    case LIST_GROUP_REMOVED: 
     1460    case LIST_GROUP_CHANGED: 
     1461      myMainWindow->updateGroups(); 
     1462      myUserMenu->updateGroups(); 
     1463      myGroupMenu->updateGroups(); 
     1464      break; 
    14611465  } 
    14621466} 
  • trunk/qt4-gui/src/core/mainwin.cpp

    r6188 r6200  
    765765  if (!initial) 
    766766  { 
    767     // Daemon does not send an update when groups change so tell contactList it 
    768     // needs to update 
    769     LicqGui::instance()->contactList()->reloadAll(); 
    770  
    771767    // update group list in user and system menus 
    772     LicqGui::instance()->userMenu()->updateGroups(); 
    773768    mySystemMenu->updateGroups(); 
    774769  }