Changeset 5740

Show
Ignore:
Timestamp:
10/31/07 18:57:49 (13 months ago)
Author:
eugene
Message:

Revised viewInfo() and addUser() of search dialog.
This fixes #1575.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/qt-gui_qt4/src/dialogs/searchuserdlg.cpp

    r5728 r5740  
    489489  foreach (QTreeWidgetItem* current, foundView->selectedItems()) 
    490490  { 
    491     QString szId = QString("%1").arg(current->data(0, Qt::UserRole).toUInt()); 
    492     ICQUser* u = gUserManager.FetchUser(szId.toLatin1(), LICQ_PPID, LOCK_R); 
    493     if (u == NULL) 
     491    QString szId = current->data(0, Qt::UserRole).toString(); 
     492 
     493    if (!gUserManager.IsOnList(szId.toLatin1(), LICQ_PPID)) 
    494494      server->AddUserToList(szId.toLatin1(), LICQ_PPID, false, true); 
    495     else 
    496       gUserManager.DropUser(u); 
    497495 
    498496    mainwin->callInfoTab(mnuUserGeneral, szId, LICQ_PPID, false, true); 
    499     break; 
    500497  } 
    501498} 
     
    505502  foreach (QTreeWidgetItem* current, foundView->selectedItems()) 
    506503  { 
    507     unsigned long uin = current->data(0, Qt::UserRole).toUInt(); 
    508     ICQUser* user = gUserManager.FetchUser(uin, LOCK_N); 
    509  
    510     if (user != NULL) 
    511     { 
    512       gUserManager.DropUser(user); 
    513       continue; 
    514     } 
    515  
    516     server->AddUserToList(uin); 
    517  
    518     if (qcbAlertUser->isChecked()) // alert the user they were added 
     504    unsigned long uin = current->data(0, Qt::UserRole).toString().toULong(); 
     505 
     506    if (server->AddUserToList(uin) &&   // try to add a user 
     507        qcbAlertUser->isChecked())      // alert the user they were added 
    519508      server->icqAlertUser(uin); 
    520509  } 
     510 
    521511  foundView->clearSelection(); 
    522512}