Changeset 6283 for trunk/qt4-gui/src/core
- Timestamp:
- 06/14/08 03:47:03 (6 months ago)
- Location:
- trunk/qt4-gui/src/core
- Files:
-
- 6 modified
-
groupmenu.cpp (modified) (4 diffs)
-
groupmenu.h (modified) (1 diff)
-
licqgui.cpp (modified) (1 diff)
-
mainwin.cpp (modified) (1 diff)
-
systemmenu.cpp (modified) (1 diff)
-
usermenu.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/core/groupmenu.cpp
r6279 r6283 89 89 delete a; 90 90 91 GroupList* g = gUserManager.LockGroupList(LOCK_R); 92 for (unsigned int i = 0; i < g->size(); ++i) 91 FOR_EACH_GROUP_START_SORTED(LOCK_R) 93 92 { 94 QString name = QString::fromLocal8Bit( (*g)[i]);93 QString name = QString::fromLocal8Bit(pGroup->name().c_str()); 95 94 96 95 a = myUserGroupActions->addAction(name); 97 a->setData( i + 1);96 a->setData(pGroup->id()); 98 97 99 98 myGroupsMenu->insertAction(myGroupSeparator, a); 100 99 } 101 gUserManager.UnlockGroupList();100 FOR_EACH_GROUP_END 102 101 103 102 // Add groups to menu … … 118 117 myMoveDownAction->setEnabled(!special && myGroupId < gUserManager.NumGroups()); 119 118 myRemoveGroupAction->setEnabled(!special); 119 120 mySortIndex = 0; 121 if (!special) 122 { 123 LicqGroup* group = gUserManager.FetchGroup(myGroupId, LOCK_R); 124 if (group != NULL) 125 { 126 mySortIndex = group->sortIndex(); 127 myGroupName = QString::fromLocal8Bit(group->name().c_str()); 128 gUserManager.DropGroup(group); 129 } 130 } 120 131 } 121 132 … … 133 144 void GroupMenu::moveGroupUp() 134 145 { 135 // Model uses group+1 so substract one before sending to daemon 136 gUserManager.SwapGroups(myGroupId, myGroupId - 1); 146 if (mySortIndex == 0) 147 return; 148 149 gUserManager.ModifyGroupSorting(myGroupId, mySortIndex - 1); 137 150 } 138 151 139 152 void GroupMenu::moveGroupDown() 140 153 { 141 // Model uses group+1 so substract one before sending to daemon 142 gUserManager.SwapGroups(myGroupId, myGroupId + 1); 154 gUserManager.ModifyGroupSorting(myGroupId, mySortIndex + 1); 143 155 } 144 156 145 157 void GroupMenu::removeGroup() 146 158 { 147 GroupList* g = gUserManager.LockGroupList(LOCK_R);148 159 QString warning(tr("Are you sure you want to remove the group '%1'?") 149 .arg(QString::fromLocal8Bit((*g)[myGroupId-1]))); 150 gUserManager.UnlockGroupList(); 160 .arg(myGroupName)); 151 161 if (!QueryYesNo(this, warning)) 152 162 return; … … 177 187 gUserManager.SetUserInGroup(id.toLatin1(), ppid, gtype, gid, true, 178 188 gtype == GROUPS_SYSTEM); 179 180 // Daemon doesn't notify us when group memberships change so notify model from here181 LicqGui::instance()->contactList()->updateUser(id, ppid);182 189 } 183 190 } -
trunk/qt4-gui/src/core/groupmenu.h
r6153 r6283 102 102 // Current group 103 103 unsigned int myGroupId; 104 unsigned short mySortIndex; 105 QString myGroupName; 104 106 105 107 // Actions not in any sub menu -
trunk/qt4-gui/src/core/licqgui.cpp
r6249 r6283 754 754 if (u == NULL) 755 755 return true; 756 GroupList* g = gUserManager.LockGroupList(LOCK_R); 756 LicqGroup* g = gUserManager.FetchGroup(group, LOCK_R); 757 if (g == NULL) 758 { 759 gUserManager.DropUser(u); 760 return true; 761 } 757 762 QString warning(tr("Are you sure you want to remove\n%1 (%2)\nfrom the '%3' group?") 758 763 .arg(QString::fromUtf8(u->GetAlias())) 759 .arg(u->IdString()).arg(QString::fromLocal8Bit( (*g)[group - 1])));760 gUserManager. UnlockGroupList();764 .arg(u->IdString()).arg(QString::fromLocal8Bit(g->name().c_str()))); 765 gUserManager.DropGroup(g); 761 766 gUserManager.DropUser(u); 762 767 if (QueryYesNo(parent, warning)) 763 768 { 764 769 gUserManager.RemoveUserFromGroup(id.toLatin1(), ppid, group); 765 766 // The daemon does not send an update when group membership changes767 // so tell the contactList it needs to update768 myContactList->updateUser(id, ppid);769 770 return true; 770 771 } -
trunk/qt4-gui/src/core/mainwin.cpp
r6200 r6283 773 773 myUserGroupsBox->addItem(LicqStrings::getSystemGroupName(GROUP_ALL_USERS)); 774 774 775 GroupList* g = gUserManager.LockGroupList(LOCK_R); 776 for (unsigned short i = 0; i < g->size(); i++) 777 { 778 myUserGroupsBox->addItem(QString::fromLocal8Bit((*g)[i])); 779 } 780 gUserManager.UnlockGroupList(); 775 FOR_EACH_GROUP_START_SORTED(LOCK_R) 776 { 777 myUserGroupsBox->addItem(QString::fromLocal8Bit(pGroup->name().c_str())); 778 } 779 FOR_EACH_GROUP_END 781 780 782 781 for (unsigned short i = 1; i < NUM_GROUPS_SYSTEM_ALL; i++) -
trunk/qt4-gui/src/core/systemmenu.cpp
r6152 r6283 302 302 delete a; 303 303 304 GroupList* g = gUserManager.LockGroupList(LOCK_R); 305 for (unsigned int i = 0; i < g->size(); ++i) 304 FOR_EACH_GROUP_START_SORTED(LOCK_R) 306 305 { 307 QString name = QString::fromLocal8Bit( (*g)[i]);306 QString name = QString::fromLocal8Bit(pGroup->name().c_str()); 308 307 309 308 a = myUserGroupActions->addAction(name); 310 a->setData( i + 1);309 a->setData(pGroup->id()); 311 310 a->setCheckable(true); 312 311 313 312 myGroupMenu->insertAction(myGroupSeparator, a); 314 313 } 315 gUserManager.UnlockGroupList();314 FOR_EACH_GROUP_END 316 315 } 317 316 -
trunk/qt4-gui/src/core/usermenu.cpp
r6281 r6283 206 206 delete a; 207 207 208 GroupList* g = gUserManager.LockGroupList(LOCK_R); 209 for (unsigned int i = 0; i < g->size(); ++i) 210 { 211 QString name = QString::fromLocal8Bit((*g)[i]); 208 FOR_EACH_GROUP_START_SORTED(LOCK_R) 209 { 210 QString name = QString::fromLocal8Bit(pGroup->name().c_str()); 212 211 213 212 a = myUserGroupActions->addAction(name); 214 a->setData( i + 1);213 a->setData(pGroup->id()); 215 214 a->setCheckable(true); 216 215 217 216 a = myServerGroupActions->addAction(name); 218 a->setData( i + 1);217 a->setData(pGroup->id()); 219 218 a->setCheckable(true); 220 219 } 221 gUserManager.UnlockGroupList();220 FOR_EACH_GROUP_END 222 221 223 222 // Add groups to menu … … 552 551 gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_USER, gid, 553 552 action->isChecked(), false); 554 555 // The daemon does not send an update when group membership changes556 // so tell the contactList it needs to update557 LicqGui::instance()->contactList()->updateUser(myId, myPpid);558 553 } 559 554 … … 578 573 gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_SYSTEM, gid, 579 574 action->isChecked(), true); 580 581 // The daemon does not send an update when group membership changes582 // so tell the contactList it needs to update583 LicqGui::instance()->contactList()->updateUser(myId, myPpid);584 575 } 585 576 … … 588 579 unsigned int gid = action->data().toUInt(); 589 580 gUserManager.SetUserInGroup(myId.toLatin1(), myPpid, GROUPS_USER, gid, true, true); 590 591 // The daemon does not send an update when group membership changes 592 // so tell the contactList it needs to update 593 LicqGui::instance()->contactList()->updateUser(myId, myPpid); 594 } 581 }
