| 127 | | |
| 128 | | CMMUserView::CMMUserView (ColumnInfos &_colInfo, bool bHeader, |
| 129 | | unsigned long nUin, CMainWindow *pMainwin, |
| 130 | | QWidget *parent) |
| 131 | | : QListView(parent, "MMUserView") |
| 132 | | { |
| 133 | | mnuMM = new QPopupMenu(NULL); |
| 134 | | mnuMM->insertItem(tr("Remove"), mnuMM_remove); |
| 135 | | mnuMM->insertItem(tr("Crop"), mnuMM_crop); |
| 136 | | mnuMM->insertItem(tr("Clear"), mnuMM_clear); |
| 137 | | mnuMM->insertSeparator(); |
| 138 | | mnuMM->insertItem(tr("Add Group"), mnuMM_addgroup); |
| 139 | | mnuMM->insertItem(tr("Add All"), mnuMM_addall); |
| 140 | | connect(mnuMM, SIGNAL(activated(int)), SLOT(slot_menu(int))); |
| 141 | | |
| 142 | | colInfo = _colInfo; |
| 143 | | m_szId = 0; |
| 144 | | m_nUin = nUin; |
| 145 | | mainwin = pMainwin; |
| 146 | | |
| 147 | | for (unsigned short i = 0; i < colInfo.size(); i++) |
| 148 | | { |
| 149 | | addColumn(colInfo[i]->m_sTitle, colInfo[i]->m_nWidth); |
| 150 | | setColumnAlignment(i, 1<<colInfo[i]->m_nAlign); |
| 151 | | } |
| 152 | | |
| 153 | | setAllColumnsShowFocus (true); |
| 154 | | setSelectionMode(Extended); |
| 155 | | setSorting(0); |
| 156 | | bHeader ? header()->show() : header()->hide(); |
| 157 | | |
| 158 | | setAcceptDrops(true); |
| 159 | | } |
| 160 | | |
| 161 | | |
| 269 | | |
| 270 | | void CMMUserView::AddUser(unsigned long nUin) |
| 271 | | { |
| 272 | | if (nUin == 0 || nUin == m_nUin) return; |
| 273 | | |
| 274 | | CMMUserViewItem *i = (CMMUserViewItem *)firstChild(); |
| 275 | | while (i != NULL && i->Uin() != nUin) |
| 276 | | i = (CMMUserViewItem *)i->nextSibling(); |
| 277 | | if (i != NULL) return; |
| 278 | | |
| 279 | | |
| 280 | | ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); |
| 281 | | if (u == NULL) return; |
| 282 | | (void) new CMMUserViewItem(u, this); |
| 283 | | gUserManager.DropUser(u); |
| 284 | | } |
| 285 | | |
| 286 | | |