From: Jon K. <em...@us...> - 2005-04-21 06:12:57
|
Update of /cvsroot/licq/qt-gui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12652 Modified Files: mainwin.cpp mainwin.h searchuserdlg.cpp searchuserdlg.h userbox.cpp userbox.h userinfodlg.cpp userinfodlg.h Log Message: dd a user to the list, but not on a permament basis. This is used to retrieve i nfo from search results without keeping the user on our list. The functionality in the daemon is complete, but the qt-gui can have some improvements and more wo rk done, such as authorization requests, new users, etc. Index: mainwin.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/mainwin.cpp,v retrieving revision 1.358 retrieving revision 1.359 diff -u -d -r1.358 -r1.359 --- mainwin.cpp 14 Apr 2005 04:33:58 -0000 1.358 +++ mainwin.cpp 21 Apr 2005 06:12:48 -0000 1.359 @@ -1406,7 +1406,7 @@ inline bool CMainWindow::show_user(ICQUser *u) { return (m_bShowOffline || !u->StatusOffline() || u->NewMessages() > 0 || - (m_bAlwaysShowONU && u->OnlineNotify())); + (m_bAlwaysShowONU && u->OnlineNotify()) || u->NotInList()); } @@ -2598,7 +2598,7 @@ } void CMainWindow::callInfoTab(int fcn, const char *szId, unsigned long nPPID, - bool toggle) + bool toggle, bool bUpdateNow) { if(szId == 0 || nPPID == 0) return; @@ -2664,6 +2664,8 @@ } f->show(); f->raise(); + if (bUpdateNow) + f->retrieveSettings(); } @@ -4685,7 +4687,7 @@ void CMainWindow::showSearchUserDlg() { - SearchUserDlg *searchUserDlg = new SearchUserDlg(licqDaemon, licqSigMan, m_DefaultEncoding); + SearchUserDlg *searchUserDlg = new SearchUserDlg(this, licqDaemon, licqSigMan, m_DefaultEncoding); searchUserDlg->show(); } Index: mainwin.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/mainwin.h,v retrieving revision 1.140 retrieving revision 1.141 diff -u -d -r1.140 -r1.141 --- mainwin.h 14 Apr 2005 04:33:58 -0000 1.140 +++ mainwin.h 21 Apr 2005 06:12:48 -0000 1.141 @@ -196,7 +196,7 @@ QString usprintfHelp; public slots: - void callInfoTab(int, const char *, unsigned long, bool toggle=false); + void callInfoTab(int, const char *, unsigned long, bool = false, bool =false); public: // Command Tools Index: searchuserdlg.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/searchuserdlg.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- searchuserdlg.cpp 25 Sep 2004 23:19:31 -0000 1.45 +++ searchuserdlg.cpp 21 Apr 2005 06:12:48 -0000 1.46 @@ -129,9 +129,10 @@ // ----------------------------------------------------------------------------- -SearchUserDlg::SearchUserDlg(CICQDaemon *s, CSignalManager *theSigMan, const QString &encoding) +SearchUserDlg::SearchUserDlg(CMainWindow *m, CICQDaemon *s, CSignalManager *theSigMan, const QString &encoding) : QWidget(NULL, "SearchUserDialog", WDestructiveClose) { + mainwin = m; server = s; sigman = theSigMan; m_Encoding = encoding; @@ -276,12 +277,17 @@ lay->addStretch(1); + btnInfo = new QPushButton(tr("View &Info"), this); + btnInfo->setEnabled(false); + lay->addWidget(btnInfo); + btnAdd = new QPushButton(tr("&Add User"), this); btnAdd->setEnabled(false); lay->addWidget(btnAdd); connect(btnDone, SIGNAL(clicked()), this, SLOT(close())); connect(foundView, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); + connect(btnInfo, SIGNAL(clicked()), this, SLOT(viewInfo())); connect (btnAdd, SIGNAL(clicked()), this, SLOT(addUser())); top_lay->addWidget(lblSearch); @@ -323,6 +329,7 @@ btnReset->setEnabled(true); btnReset->setText(tr("Cancel")); btnDone->setEnabled(false); + btnInfo->setEnabled(false); btnAdd->setEnabled(false); if (search_tab->currentPage() == uin_tab) @@ -405,6 +412,7 @@ btnDone->setEnabled(true); btnSearch->setEnabled(true); + btnInfo->setEnabled(false); btnAdd->setEnabled(false); lblSearch->setText(tr("Enter search parameters and select 'Search'")); } @@ -482,9 +490,11 @@ current = current->nextSibling(); } + btnInfo->setEnabled(true); btnAdd->setEnabled(true); switch(count) { case 0: + btnInfo->setEnabled(false); btnAdd->setEnabled(false); // fall through case 1: @@ -495,6 +505,29 @@ } } +void SearchUserDlg::viewInfo() +{ + SearchItem *current = static_cast<SearchItem *>(foundView->firstChild()); + + while (current) + { + if (current->isSelected()) + { + //XXX Convert this to a string + char szId[64]; + snprintf(szId, 64, "%lu", current->uin()); + ICQUser *u = gUserManager.FetchUser(szId, LICQ_PPID, LOCK_R); + if (!u) + server->AddUserToList(szId, LICQ_PPID, false, true); + else + gUserManager.DropUser(u); + + mainwin->callInfoTab(mnuUserGeneral, szId, LICQ_PPID, false, true); + break; + } + current = static_cast<SearchItem*>(current->nextSibling()); + } +} void SearchUserDlg::addUser() { Index: searchuserdlg.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/searchuserdlg.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- searchuserdlg.h 19 Sep 2004 13:18:07 -0000 1.25 +++ searchuserdlg.h 21 Apr 2005 06:12:48 -0000 1.26 @@ -24,6 +24,8 @@ #include <qwidget.h> #include <qlistview.h> +#include "mainwin.h" + class QTabWidget; class QCheckBox; class QLabel; @@ -64,7 +66,7 @@ { Q_OBJECT public: - SearchUserDlg (CICQDaemon *s, CSignalManager *theSigMan, const QString &); + SearchUserDlg (CMainWindow *mainwin, CICQDaemon *s, CSignalManager *theSigMan, const QString &); ~SearchUserDlg(); private: @@ -72,6 +74,7 @@ protected: + CMainWindow *mainwin; CICQDaemon *server; CSignalManager *sigman; QPushButton *btnSearch, *btnReset; @@ -87,7 +90,7 @@ QCheckBox *chkOnlineOnly; unsigned long searchTag; - QPushButton *btnDone, *btnAdd; + QPushButton *btnDone, *btnInfo, *btnAdd; SearchUserView *foundView; QString m_Encoding; @@ -97,6 +100,7 @@ public slots: void startSearch(); + void viewInfo(); void addUser(); void resetSearch(); void searchResult(ICQEvent *); Index: userbox.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/userbox.cpp,v retrieving revision 1.169 retrieving revision 1.170 diff -u -d -r1.169 -r1.170 --- userbox.cpp 6 Apr 2005 09:26:12 -0000 1.169 +++ userbox.cpp 21 Apr 2005 06:12:48 -0000 1.170 @@ -88,6 +88,7 @@ m_nEvents = 0; m_nStatus = ICQ_STATUS_OFFLINE; m_bGPGKey = false; + m_bNotInList = _cUser->NotInList(); setGraphics(_cUser); } @@ -120,6 +121,7 @@ m_nEvents = 0; m_nStatus = ICQ_STATUS_OFFLINE; m_bGPGKey = false; + m_bNotInList = _cUser->NotInList(); setGraphics(_cUser); } @@ -176,8 +178,10 @@ m_sSortKey = ""; if (barType == BAR_ONLINE) m_sPrefix = "0"; - else + else if (barType == BAR_OFFLINE) m_sPrefix = "2"; + else + m_sPrefix = "4"; } void CUserViewItem::SetThreadViewGroupTitle() @@ -201,13 +205,18 @@ if (v == NULL) return; - if (this == v->barOffline || this == v->barOnline) + if (this == v->barOffline || this == v->barOnline || this == v->barNotInList) return; - if (m_nStatus == ICQ_STATUS_OFFLINE) - v->numOffline--; + if (m_bNotInList) + v->numNotInList--; else - v->numOnline--; + { + if (m_nStatus == ICQ_STATUS_OFFLINE) + v->numOffline--; + else + v->numOnline--; + } if (parent()) { @@ -227,6 +236,11 @@ delete v->barOnline; v->barOnline = NULL; } + if (v->numNotInList == 0 && v->barNotInList != NULL) + { + delete v->barNotInList; + v->barNotInList = NULL; + } } //-----CUserViewItem::setGraphics----------------------------------------------- @@ -267,23 +281,34 @@ m_bGPGKeyEnabled = ( u->UseGPG() ); // Create any necessary bars - if (u->StatusOffline()) + if (u->NotInList()) { - v->numOffline++; - if (v->barOffline == NULL && v->parent() - && gMainWindow->m_bShowDividers + v->numNotInList++; + if (v->barNotInList == NULL && v->parent() && !(gMainWindow->m_bThreadView && gMainWindow->m_nGroupType == GROUPS_USER - && gMainWindow->m_nCurrentGroup == 0)) - v->barOffline = new CUserViewItem(BAR_OFFLINE, listView()); + && gMainWindow->m_nCurrentGroup == 0)) + v->barNotInList = new CUserViewItem(BAR_NOTINLIST, listView()); } else { - v->numOnline++; - if (v->barOnline == NULL && v->parent() - && gMainWindow->m_bShowDividers && - !(gMainWindow->m_bThreadView && gMainWindow->m_nGroupType == GROUPS_USER + if (u->StatusOffline()) + { + v->numOffline++; + if (v->barOffline == NULL && v->parent() + && gMainWindow->m_bShowDividers + && !(gMainWindow->m_bThreadView && gMainWindow->m_nGroupType == GROUPS_USER && gMainWindow->m_nCurrentGroup == 0)) - v->barOnline = new CUserViewItem(BAR_ONLINE, listView()); + v->barOffline = new CUserViewItem(BAR_OFFLINE, listView()); + } + else + { + v->numOnline++; + if (v->barOnline == NULL && v->parent() + && gMainWindow->m_bShowDividers && + !(gMainWindow->m_bThreadView && gMainWindow->m_nGroupType == GROUPS_USER + && gMainWindow->m_nCurrentGroup == 0)) + v->barOnline = new CUserViewItem(BAR_ONLINE, listView()); + } } m_sPrefix = "1"; @@ -307,6 +332,9 @@ m_cFore = s_cOnline; } + if (m_bNotInList) + m_sPrefix = "5"; + //if (u->StatusInvisible()) // m_cFore = s_cAway; @@ -676,6 +704,8 @@ QString sz = CUserView::tr("Offline"); if (m_sPrefix == "0") sz = CUserView::tr("Online"); + else if (m_sPrefix == "4") + sz = CUserView::tr("Not In List"); if (pix) { @@ -900,8 +930,8 @@ m_nFlashCounter = carCounter = onlCounter = 0; msgTimerId = carTimerId = onlTimerId = 0; mnuUser = m; - barOnline = barOffline = NULL; - numOnline = numOffline = 0; + barOnline = barOffline = barNotInList = NULL; + numOnline = numOffline = numNotInList = 0; m_typeAhead = ""; m_typePos = 0; @@ -958,7 +988,7 @@ CUserView::~CUserView() { - barOnline = barOffline = NULL; + barOnline = barOffline = barNotInList = NULL; if (parent() == NULL) { unsigned int i = 0; @@ -997,9 +1027,9 @@ void CUserView::clear() { - barOnline = barOffline = NULL; + barOnline = barOffline = barNotInList = NULL; QListView::clear(); - numOffline = numOnline = 0; + numOffline = numOnline = numNotInList = 0; } Index: userbox.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/userbox.h,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- userbox.h 6 Apr 2005 09:26:12 -0000 1.58 +++ userbox.h 21 Apr 2005 06:12:48 -0000 1.59 @@ -13,7 +13,8 @@ enum BarType { BAR_ONLINE, - BAR_OFFLINE + BAR_OFFLINE, + BAR_NOTINLIST }; enum FlashType @@ -84,7 +85,7 @@ unsigned short m_nGroupId; int m_nOnlCount, m_nEvents; QCString m_sGroupName; - bool m_bStatusInvisible, m_bStatusTyping, m_bCustomAR, m_bSecure, m_bFlash, m_bBirthday, m_bPhone, m_bCellular, m_bGPGKey, m_bGPGKeyEnabled; + bool m_bStatusInvisible, m_bStatusTyping, m_bCustomAR, m_bSecure, m_bFlash, m_bBirthday, m_bPhone, m_bCellular, m_bGPGKey, m_bGPGKeyEnabled, m_bNotInList; unsigned long m_nPhoneFollowMeStatus, m_nICQphoneStatus, m_nSharedFilesStatus; QFont::Weight m_nWeight; bool m_bItalic, m_bStrike, m_bUrgent; @@ -150,9 +151,9 @@ unsigned int m_typePos; /*! hmmm */ QPopupMenu *mnuUser; - CUserViewItem *barOnline, *barOffline; + CUserViewItem *barOnline, *barOffline, *barNotInList; QPoint mousePressPos; - int numOnline, numOffline; + int numOnline, numOffline, numNotInList; virtual void timerEvent(QTimerEvent*); virtual void viewportMousePressEvent(QMouseEvent *e); Index: userinfodlg.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/userinfodlg.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- userinfodlg.cpp 13 Apr 2005 18:08:17 -0000 1.89 +++ userinfodlg.cpp 21 Apr 2005 06:12:48 -0000 1.90 @@ -88,7 +88,7 @@ // ----------------------------------------------------------------------------- UserInfoDlg::UserInfoDlg(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - const char *szId, unsigned long nPPID, QWidget* parent) + const char *szId, unsigned long nPPID, QWidget *parent) : QWidget(parent, "UserInfoDialog", WDestructiveClose) { server = s; Index: userinfodlg.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/userinfodlg.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- userinfodlg.h 13 Apr 2005 18:08:18 -0000 1.28 +++ userinfodlg.h 21 Apr 2005 06:12:49 -0000 1.29 @@ -73,6 +73,7 @@ unsigned long PPID() { return m_nPPID; } void showTab(int); bool isTabShown(int); + void retrieveSettings() { slotRetrieve(); } protected: // common stuff |