Show
Ignore:
Timestamp:
08/10/08 18:22:00 (4 months ago)
Author:
flynd
Message:

Added option to move users when dragging in contact list.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/views/userviewbase.cpp

    r6346 r6482  
    284284 
    285285        if (!dropId.isEmpty()) 
    286           gUserManager.SetUserInGroup(dropId.toLatin1(), dropPpid, GROUPS_USER, gid, true); 
     286        { 
     287          bool moveUser = Config::ContactList::instance()->dragMovesUser(); 
     288          gUserManager.SetUserInGroup(dropId.toLatin1(), dropPpid, GROUPS_USER, gid, true, moveUser); 
     289 
     290          // If we are moving user we now need to remove it from the old group. 
     291          // However, since the drop event doesn't contain the originating 
     292          // group, we don't know which group that is so we'll just have to 
     293          // remove the user from all other groups. 
     294          if (moveUser) 
     295          { 
     296            const ICQUser* u = gUserManager.FetchUser(dropId.toLatin1(), dropPpid, LOCK_R); 
     297            if (u != NULL) 
     298            { 
     299              UserGroupList userGroups = u->GetGroups(); 
     300              gUserManager.DropUser(u); 
     301 
     302              UserGroupList::const_iterator i; 
     303              for (i = userGroups.begin(); i != userGroups.end(); ++i) 
     304                if (*i != gid) 
     305                  gUserManager.SetUserInGroup(dropId.toLatin1(), dropPpid, GROUPS_USER, *i, false, false); 
     306            } 
     307          } 
     308        } 
    287309      } 
    288310      else