Changeset 6366
- Timestamp:
- 07/01/2008 03:50:37 AM (12 months ago)
- Location:
- trunk/qt-gui/src
- Files:
-
- 3 modified
-
mmlistview.cpp (modified) (5 diffs)
-
mmlistview.h (modified) (3 diffs)
-
usereventdlg.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt-gui/src/mmlistview.cpp
r5328 r6366 47 47 char *sTemp; 48 48 49 m_nUin = u->Uin();50 49 m_szId = u->IdString() ? strdup(u->IdString()) : 0; 51 50 m_nPPID = u->PPID(); … … 93 92 //-----UserList::constructor----------------------------------------------------------------------- 94 93 CMMUserView::CMMUserView (ColumnInfos &_colInfo, bool bHeader, 95 char *szId, unsigned long nPPID, CMainWindow *pMainwin,94 const char* szId, unsigned long nPPID, CMainWindow *pMainwin, 96 95 QWidget *parent) 97 96 : QListView(parent, "MMUserView") … … 125 124 } 126 125 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 162 126 CMMUserView::~CMMUserView() 163 127 { … … 267 231 gUserManager.DropUser(u); 268 232 } 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 287 233 288 234 //-----CUserList::mousePressEvent--------------------------------------------- … … 350 296 item = firstChild(); 351 297 if (item == NULL) return; 352 if (((CMMUserViewItem *)item)-> Uin() == 0)298 if (((CMMUserViewItem *)item)->Id() == NULL) 353 299 item = item->nextSibling(); 354 300 setCurrentItem(item); -
trunk/qt-gui/src/mmlistview.h
r4699 r6366 39 39 CMMUserViewItem (ICQUser *, QListView *); 40 40 virtual ~CMMUserViewItem(); 41 unsigned long Uin() { return m_nUin; }42 41 char *Id() { return m_szId; } 43 42 unsigned long PPID() { return m_nPPID; } 44 43 45 44 protected: 46 unsigned long m_nUin;47 45 char *m_szId; 48 46 unsigned long m_nPPID; … … 57 55 Q_OBJECT 58 56 public: 59 CMMUserView (ColumnInfos &_colInfo, bool, unsigned long, CMainWindow *, 60 QWidget *parent = 0); 61 CMMUserView(ColumnInfos &_colInfo, bool, char *, unsigned long, 57 CMMUserView(ColumnInfos &_colInfo, bool, const char*, unsigned long, 62 58 CMainWindow *, QWidget *parent = 0); 63 59 virtual ~CMMUserView(); … … 69 65 QPopupMenu *mnuMM; 70 66 ColumnInfos colInfo; 71 unsigned long m_nUin;72 67 char *m_szId; 73 68 unsigned long m_nPPID; -
trunk/qt-gui/src/usereventdlg.cpp
r6305 r6366 2191 2191 //TODO in CMMUserView 2192 2192 lstMultipleRecipients = new CMMUserView(mainwin->colInfo, mainwin->m_bShowHeader, 2193 strtoul(m_lUsers.front().c_str(), (char **)NULL, 10), mainwin, grpMR);2193 m_lUsers.front().c_str(), LICQ_PPID, mainwin, grpMR); 2194 2194 lstMultipleRecipients->setFixedWidth(mainwin->UserView()->width()); 2195 2195 } … … 2545 2545 CEventContactList* ue = (CEventContactList *) e->UserEvent(); 2546 2546 const ContactList& clist = ue->Contacts(); 2547 UinList uins; 2548 2547 UserStringList users; 2548 2549 // ContactList is const but string list holds "char*" so we have to copy each string 2549 2550 for(ContactList::const_iterator i = clist.begin(); i != clist.end(); i++) 2550 u ins.push_back((*i)->Uin());2551 2552 if(u ins.size() == 0)2551 users.push_back(strdup((*i)->IdString())); 2552 2553 if(users.size() == 0) 2553 2554 break; 2554 2555 2555 icqEventTag = server->icqSendContactList(strtoul(m_lUsers.front().c_str(), (char **)NULL, 10), 2556 uins, bOnline, nLevel, false, &icqColor); 2556 icqEventTag = server->icqSendContactList(m_lUsers.front().c_str(), 2557 users, bOnline, nLevel, false, &icqColor); 2558 2559 // Free the strings in the list 2560 for (UserStringList::iterator i = users.begin(); i != users.end(); ++i) 2561 free(*i); 2557 2562 2558 2563 break;
