Changeset 6319
- Timestamp:
- 06/17/08 02:19:46 (2 months ago)
- Location:
- trunk/qt4-gui/src/core
- Files:
-
- 3 modified
-
licqgui.cpp (modified) (1 diff)
-
licqgui.h (modified) (1 diff)
-
mainwin.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/core/licqgui.cpp
r6318 r6319 736 736 return true; 737 737 } 738 return false;739 }740 741 bool LicqGui::removeUserFromGroup(GroupType gtype, unsigned long group,742 QString id, unsigned long ppid, QWidget* parent)743 {744 if (parent == NULL)745 parent = myMainWindow;746 747 if (gtype == GROUPS_USER)748 {749 if (group == 0)750 return true;751 else752 {753 ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R);754 if (u == NULL)755 return true;756 LicqGroup* g = gUserManager.FetchGroup(group, LOCK_R);757 if (g == NULL)758 {759 gUserManager.DropUser(u);760 return true;761 }762 QString warning(tr("Are you sure you want to remove\n%1 (%2)\nfrom the '%3' group?")763 .arg(QString::fromUtf8(u->GetAlias()))764 .arg(u->IdString()).arg(QString::fromLocal8Bit(g->name().c_str())));765 gUserManager.DropGroup(g);766 gUserManager.DropUser(u);767 if (QueryYesNo(parent, warning))768 {769 gUserManager.RemoveUserFromGroup(id.toLatin1(), ppid, group);770 return true;771 }772 }773 }774 else if (gtype == GROUPS_SYSTEM)775 {776 if (group == 0)777 return removeUserFromList(id, ppid, parent);778 ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_W);779 if (u == NULL)780 return true;781 u->RemoveFromGroup(GROUPS_SYSTEM, group);782 gUserManager.DropUser(u);783 784 // The daemon does not send an update when group membership changes785 // so tell the contactList it needs to update786 myContactList->updateUser(id, ppid);787 return true;788 }789 790 738 return false; 791 739 } -
trunk/qt4-gui/src/core/licqgui.h
r6185 r6319 109 109 110 110 /** 111 * Remove a contact from a group112 *113 * @param gtype Group type114 * @param group Group id115 * @param id Contact id116 * @param ppid Contact protocol id117 * @param parent Parent window to use for confirmation box or NULL to use mainwin118 * @return true if contact was removed from group119 */120 bool removeUserFromGroup(GroupType gtype, unsigned long group,121 QString id, unsigned long ppid, QWidget* parent = NULL);122 123 /**124 111 * Show contact info dialog 125 112 * -
trunk/qt4-gui/src/core/mainwin.cpp
r6283 r6319 502 502 void MainWindow::removeUserFromGroup() 503 503 { 504 GroupType gtype = Config::ContactList::instance()->groupType(); 505 unsigned short gid = Config::ContactList::instance()->groupId(); 506 507 // Removing "All users" is the same as removing user from the list 508 if (gtype == GROUPS_SYSTEM && gid == 0) 509 { 510 removeUserFromList(); 511 return; 512 } 513 514 // Removing user from "Other users" is not allowed 515 if (gtype == GROUPS_USER && gid == 0) 516 return; 517 518 // Get currently selected user 504 519 QString id; 505 520 unsigned long ppid = 0; 506 521 myUserView->MainWindowSelectedItemUser(id, ppid); 507 522 508 LicqGui::instance()->removeUserFromGroup( 509 Config::ContactList::instance()->groupType(), 510 Config::ContactList::instance()->groupId(), 511 id, ppid, this); 523 gUserManager.SetUserInGroup(id.toLatin1(), ppid, GROUPS_USER, gid, false); 512 524 } 513 525 … … 728 740 void MainWindow::setCurrentGroup(int groupId) 729 741 { 742 //TODO: This is bugged 730 743 GroupType groupType = GROUPS_USER; 731 744 unsigned short nNumGroups = gUserManager.NumGroups();
