i sent this one to Jon 20 days ago, but i think no bit got into cvs. Im using it since then without any trouble (IIRC,it prevents some sigsegvs IIRC).
-- Buenos Aires, Argentina 12°C with winds at 16 km/h ESE
Index: plugins/qt-gui/src/mainwin.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/mainwin.cpp,v retrieving revision 1.292 diff -u -d -p -r1.292 mainwin.cpp --- plugins/qt-gui/src/mainwin.cpp 2 Jul 2003 17:11:31 -0000 1.292 +++ plugins/qt-gui/src/mainwin.cpp 8 Jul 2003 03:37:11 -0000 @@ -599,8 +599,8 @@ CMainWindow::CMainWindow(CICQDaemon *the this, SLOT(slot_logon())); // connect (licqSigMan, SIGNAL(signal_ui_viewevent(unsigned long)), // this, SLOT(slot_ui_viewevent(unsigned long))); - connect (licqSigMan, SIGNAL(signal_ui_message(unsigned long)), - this, SLOT(slot_ui_message(unsigned long))); + connect (licqSigMan, SIGNAL(signal_ui_message(const char *,unsigned long)), + this, SLOT(slot_ui_message(const char *, unsigned long))); connect (licqSigMan, SIGNAL(signal_ui_viewevent(const char *)), this, SLOT(slot_ui_viewevent(const char *))); connect (licqSigMan, SIGNAL(signal_protocolPlugin(unsigned long)), @@ -2503,190 +2503,6 @@ UserEventCommon *CMainWindow::callFuncti return e; } -//-----CMainWindow::callICQFunction------------------------------------------- -UserEventCommon *CMainWindow::callFunction(int fcn, unsigned long nUin) -{ - if (nUin == 0) return NULL; - - UserEventCommon *e = NULL; - - switch (fcn) - { - case mnuUserView: - { -#if QT_VERSION < 300 - QListIterator<UserViewEvent> it(licqUserView); -#else - QPtrListIterator<UserViewEvent> it(licqUserView); -#endif - - for (; it.current(); ++it) - if ((*it)->Uin() == nUin) { - e = *it; - e->show(); - if(!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) - { - e->raise(); -#ifdef USE_KDE - KWin::setActiveWindow(e->winId()); -#endif - } - return e; - } - } - break; - case mnuUserSendMsg: - case mnuUserSendUrl: - case mnuUserSendChat: - case mnuUserSendFile: - case mnuUserSendContact: - case mnuUserSendSms: - { -#if QT_VERSION < 300 - QListIterator<UserSendCommon> it(licqUserSend); -#else - QPtrListIterator<UserSendCommon> it(licqUserSend); -#endif - - if (!m_bMsgChatView) break; - - UserSendCommon *e = NULL; - for (; it.current(); ++it) - if ((*it)->Uin() == nUin) - { - e = static_cast<UserSendCommon*>(*it); -// e->changeEventType(fcn - 1); - break; - } - - if (e != NULL) - { -#if QT_VERSION < 300 - QListIterator<UserSendCommon> it(licqUserSend); -#else - QPtrListIterator<UserSendCommon> it(licqUserSend); -#endif - for (; it.current(); ++it) - if ((*it)->Uin() == nUin) - { - e = static_cast<UserSendCommon*>(*it); -#if QT_VERSION >= 300 - if (userEventTabDlg && userEventTabDlg->tabExists(e)) - { - userEventTabDlg->show(); - userEventTabDlg->selectTab(e); - userEventTabDlg->raise(); - -#ifdef USE_KDE - KWin::setActiveWindow(userEventTabDlg->winId()); -#endif - } - else -#endif - { - e->show(); - if (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) - { - e->raise(); -#ifdef USE_KDE - KWin::setActiveWindow(e->winId()); -#endif - } - } - return e; - } - } - } - default: - break; - } - - QWidget *parent = NULL; -#if QT_VERSION >= 300 - if (m_bTabbedChatting) - { - if (userEventTabDlg != NULL) - userEventTabDlg->raise(); - else - { - // create the tab dialog if it does not exist - userEventTabDlg = new UserEventTabDlg(); - connect(userEventTabDlg, SIGNAL(signal_done()), this, SLOT(slot_doneUserEventTabDlg())); - } - parent = userEventTabDlg; - } -#endif - switch (fcn) - { - case mnuUserView: - { - e = new UserViewEvent(licqDaemon, licqSigMan, this, nUin); - break; - } - case mnuUserSendMsg: - { - e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, nUin, parent); - break; - } - case mnuUserSendUrl: - { - e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, nUin, parent); - break; - } - case mnuUserSendChat: - { - e = new UserSendChatEvent(licqDaemon, licqSigMan, this, nUin, parent); - break; - } - case mnuUserSendFile: - { - e = new UserSendFileEvent(licqDaemon, licqSigMan, this, nUin, parent); - break; - } - case mnuUserSendContact: - { - e = new UserSendContactEvent(licqDaemon, licqSigMan, this, nUin, parent); - break; - } - case mnuUserSendSms: - { - e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, nUin, parent); - break; - } - default: - gLog.Warn("%sunknown callFunction() fcn: %d\n", L_WARNxSTR, fcn); - } - if (e == NULL) return NULL; - - connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); -#if QT_VERSION >= 300 - if (m_bTabbedChatting && fcn != mnuUserView) - { - userEventTabDlg->addTab(e); - userEventTabDlg->show(); - } - else -#endif - e->show(); - - // there might be more than one send window open - // make sure we only remember one, or it will get complicated - if (fcn == mnuUserView) - { - slot_userfinished(nUin); - connect(e, SIGNAL(finished(unsigned long)), SLOT(slot_userfinished(unsigned long))); - licqUserView.append(static_cast<UserViewEvent*>(e)); - } - else - { - slot_sendfinished(nUin); - connect(e, SIGNAL(finished(unsigned long)), SLOT(slot_sendfinished(unsigned long))); - licqUserSend.append(static_cast<UserSendCommon*>(e)); - } - return e; -} - - // ----------------------------------------------------------------------------- void CMainWindow::UserInfoDlg_finished(const char *szId, unsigned long nPPID) { @@ -2753,26 +2569,6 @@ void CMainWindow::slot_userfinished(cons } } -void CMainWindow::slot_userfinished(unsigned long nUin) -{ -#if QT_VERSION < 300 - QListIterator<UserViewEvent> it(licqUserView); -#else - QPtrListIterator<UserViewEvent> it(licqUserView); -#endif - - for ( ; it.current(); ++it) - { - if ((*it)->Uin() == nUin) - { - licqUserView.remove(*it); - return; - } - } - //gLog.Warn("%sUser finished signal for user with no window (%ld)!\n", - // L_WARNxSTR, nUin); -} - void CMainWindow::slot_sendfinished(const char *szId, unsigned long nPPID) { #if QT_VERSION < 300 @@ -2788,21 +2584,6 @@ void CMainWindow::slot_sendfinished(cons licqUserSend.remove(*it); } -void CMainWindow::slot_sendfinished(unsigned long nUin) -{ -#if QT_VERSION < 300 - QListIterator<UserSendCommon> it(licqUserSend); -#else - QPtrListIterator<UserSendCommon> it(licqUserSend); -#endif - // go through the whole list, there might be more than - // one hit - for ( ; it.current(); ++it) - if ((*it)->Uin() == nUin) - licqUserSend.remove(*it); -} - - void CMainWindow::slot_shutdown() { licqDaemon->Shutdown(); @@ -2878,9 +2659,9 @@ void CMainWindow::slot_ui_viewevent(cons } //-----CMainWindow::slot_ui_message--------------------------------------------- -void CMainWindow::slot_ui_message(unsigned long nUin) +void CMainWindow::slot_ui_message(const char *szId, unsigned long nPPID) { - callFunction(mnuUserSendMsg, nUin); + callFunction(mnuUserSendMsg, szId, nPPID); } //-----slot_protocolPlugin------------------------------------------------------ Index: plugins/qt-gui/src/mainwin.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/mainwin.h,v retrieving revision 1.111 diff -u -d -p -r1.111 mainwin.h --- plugins/qt-gui/src/mainwin.h 2 Jul 2003 04:41:02 -0000 1.111 +++ plugins/qt-gui/src/mainwin.h 8 Jul 2003 03:37:12 -0000 @@ -75,7 +75,6 @@ public: const char *skinName, const char *iconsName, const char *extendedIconsName, QWidget *parent = 0); virtual ~CMainWindow(); - UserEventCommon *callFunction(int fcn, unsigned long nUin); bool RemoveUserFromList(unsigned long, QWidget *); bool RemoveUserFromGroup(GroupType gtype, unsigned long group, unsigned long, QWidget *); UserEventCommon *callFunction(int fcn, const char *, unsigned long); @@ -285,13 +284,10 @@ protected slots: //void callUserFunction(const char *, unsigned long); void slot_userfinished(const char *, unsigned long); void slot_sendfinished(const char *, unsigned long); - //void slot_ui_message(const char *, unsigned long); - void slot_userfinished(unsigned long); - void slot_sendfinished(unsigned long); + void slot_ui_message(const char *, unsigned long); void slot_usermenu(); void slot_logon(); //void slot_ui_viewevent(unsigned long); - void slot_ui_message(unsigned long); void slot_ui_viewevent(const char *); void slot_protocolPlugin(unsigned long); void slot_register(); Index: plugins/qt-gui/src/randomchatdlg.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/randomchatdlg.cpp,v retrieving revision 1.11 diff -u -d -p -r1.11 randomchatdlg.cpp --- plugins/qt-gui/src/randomchatdlg.cpp 16 Apr 2003 19:03:53 -0000 1.11 +++ plugins/qt-gui/src/randomchatdlg.cpp 8 Jul 2003 03:37:13 -0000 @@ -136,7 +136,8 @@ void CRandomChatDlg::slot_doneUserFcn(IC break; default: //TODO when CSearchAck changes - mainwin->callFunction(mnuUserSendChat, e->SearchAck()->Uin()); + mainwin->callFunction(mnuUserSendChat, e->SearchAck()->Id(), + e->SearchAck()->PPID() ); close(); return; } Index: plugins/qt-gui/src/sigman.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/sigman.cpp,v retrieving revision 1.25 diff -u -d -p -r1.25 sigman.cpp --- plugins/qt-gui/src/sigman.cpp 2 Jul 2003 04:41:02 -0000 1.25 +++ plugins/qt-gui/src/sigman.cpp 8 Jul 2003 03:37:13 -0000 @@ -108,7 +108,7 @@ void CSignalManager::ProcessSignal(CICQS break; case SIGNAL_UI_MESSAGE: //TODO - emit signal_ui_message(s->Uin()); + emit signal_ui_message(s->Id(), s->PPID()); break; case SIGNAL_ADDxSERVERxLIST: //TODO Index: plugins/qt-gui/src/sigman.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/sigman.h,v retrieving revision 1.8 diff -u -d -p -r1.8 sigman.h --- plugins/qt-gui/src/sigman.h 2 Jul 2003 04:41:02 -0000 1.8 +++ plugins/qt-gui/src/sigman.h 8 Jul 2003 03:37:13 -0000 @@ -35,7 +35,7 @@ signals: void signal_logoff(); void signal_ui_viewevent(unsigned long); void signal_ui_viewevent(const char *); - void signal_ui_message(unsigned long); + void signal_ui_message(const char *, unsigned long); void signal_protocolPlugin(unsigned long); // Event signals Index: plugins/qt-gui/src/usereventdlg.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/usereventdlg.cpp,v retrieving revision 1.134 diff -u -d -p -r1.134 usereventdlg.cpp --- plugins/qt-gui/src/usereventdlg.cpp 2 Jul 2003 15:58:31 -0000 1.134 +++ plugins/qt-gui/src/usereventdlg.cpp 8 Jul 2003 03:37:14 -0000 @@ -359,113 +359,6 @@ void UserEventTabDlg::moveRight() // ----------------------------------------------------------------------------- -UserEventCommon::UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, - QWidget* parent, const char* name) - : QWidget(parent, name, WDestructiveClose), m_highestEventId(-1) -{ - char szUin[24]; - sprintf(szUin, "%lu", _nUin); - m_szId = strdup(szUin); - m_nPPID = LICQ_PPID; - - server = s; - mainwin = m; - sigman = theSigMan; - m_nUin = _nUin; - m_bOwner = (m_nUin == gUserManager.OwnerUin()); - m_bDeleteUser = false; - - top_hlay = new QHBoxLayout(this, 6); - top_lay = new QVBoxLayout(top_hlay); - top_hlay->setStretchFactor(top_lay, 1); - - // initalize codec - codec = QTextCodec::codecForLocale(); - - QBoxLayout *layt = new QHBoxLayout(top_lay, 8); - layt->addWidget(new QLabel(tr("Status:"), this)); - nfoStatus = new CInfoField(this, true); - nfoStatus->setMinimumWidth(nfoStatus->sizeHint().width()+30); - layt->addWidget(nfoStatus); - layt->addWidget(new QLabel(tr("Time:"), this)); - nfoTimezone = new CInfoField(this, true); - nfoTimezone->setMinimumWidth(nfoTimezone->sizeHint().width()/2+10); - layt->addWidget(nfoTimezone); - - popupEncoding = new QPopupMenu(this); - btnSecure = new QPushButton(this); - QToolTip::add(btnSecure, tr("Open / Close secure channel")); - layt->addWidget(btnSecure); - connect(btnSecure, SIGNAL(clicked()), this, SLOT(slot_security())); - btnHistory = new QPushButton(this); - btnHistory->setPixmap(mainwin->pmHistory); - QToolTip::add(btnHistory, tr("Show User History")); - connect(btnHistory, SIGNAL(clicked()), this, SLOT(showHistory())); - layt->addWidget(btnHistory); - btnInfo = new QPushButton(this); - btnInfo->setPixmap(mainwin->pmInfo); - QToolTip::add(btnInfo, tr("Show User Info")); - connect(btnInfo, SIGNAL(clicked()), this, SLOT(showUserInfo())); - layt->addWidget(btnInfo); - btnEncoding = new QPushButton(this); - btnEncoding->setPixmap(mainwin->pmEncoding); - QToolTip::add(btnEncoding, tr("Change user text encoding")); - QWhatsThis::add(btnEncoding, tr("This button selects the text encoding used when communicating with this user. You might need to change the encoding to communicate in a different language.")); - btnEncoding->setPopup(popupEncoding); - - layt->addWidget(btnEncoding); - - tmrTime = NULL; - - ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); - if (u != NULL) - { - nfoStatus->setData(u->StatusStr()); - if (u->NewMessages() == 0) - setIcon(CMainWindow::iconForStatus(u->StatusFull())); - else - setIcon(CMainWindow::iconForEvent(ICQ_CMDxSUB_MSG)); - SetGeneralInfo(u); - - // restore prefered encoding - codec = UserCodec::codecForICQUser(u); - - gUserManager.DropUser(u); - } - - QString codec_name = QString::fromLatin1( codec->name() ).lower(); - popupEncoding->setCheckable(true); - - // populate the popup menu - UserCodec::encoding_t *it = &UserCodec::m_encodings[0]; - while(it->encoding != NULL) { - - if (QString::fromLatin1(it->encoding).lower() == codec_name) { - if (mainwin->m_bShowAllEncodings || it->isMinimal) { - popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib); - } else { - // if the current encoding does not appear in the minimal list - popupEncoding->insertSeparator(0); - popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib, 0); - } - popupEncoding->setItemChecked(it->mib, true); - } else { - if (mainwin->m_bShowAllEncodings || it->isMinimal) { - popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib); - } - } - - ++it; - } - - connect (sigman, SIGNAL(signal_updatedUser(CICQSignal *)), - this, SLOT(slot_userupdated(CICQSignal *))); - - mainWidget = new QWidget(this); - top_lay->addWidget(mainWidget); -} - void UserEventCommon::slot_setEncoding(int encodingMib) { /* initialize a codec according to the encoding menu item id */ QString encoding( UserCodec::encodingForMib(encodingMib) ); @@ -745,128 +638,6 @@ UserViewEvent::UserViewEvent(CICQDaemon connect(this, SIGNAL(encodingChanged()), this, SLOT(slot_setEncoding())); } -UserViewEvent::UserViewEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, QWidget* parent) - : UserEventCommon(s, theSigMan, m, _nUin, parent, "UserViewEvent") -{ - QBoxLayout* lay = new QVBoxLayout(mainWidget); - splRead = new QSplitter(Vertical, mainWidget); - lay->addWidget(splRead); - splRead->setOpaqueResize(); - - QAccel *a = new QAccel( this ); - a->connectItem(a->insertItem(Key_Escape), this, SLOT(close())); - - msgView = new MsgView(splRead); - mlvRead = new MLView(splRead, "mlvRead"); -#if QT_VERSION < 300 - mlvRead->setFormatQuoted(true); -#else - connect(mlvRead, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); -#endif - splRead->setResizeMode(msgView, QSplitter::FollowSizeHint); - splRead->setResizeMode(mlvRead, QSplitter::Stretch); - - connect (msgView, SIGNAL(currentChanged(QListViewItem *)), this, SLOT(slot_printMessage(QListViewItem *))); - connect (mainwin, SIGNAL(signal_sentevent(ICQEvent *)), this, SLOT(slot_sentevent(ICQEvent *))); - - QHGroupBox *h_action = new QHGroupBox(mainWidget); - lay->addSpacing(10); - lay->addWidget(h_action); - btnRead1 = new CEButton(h_action); - btnRead2 = new QPushButton(h_action); - btnRead3 = new QPushButton(h_action); - btnRead4 = new QPushButton(h_action); - - btnRead1->setEnabled(false); - btnRead2->setEnabled(false); - btnRead3->setEnabled(false); - btnRead4->setEnabled(false); - - connect(btnRead1, SIGNAL(clicked()), this, SLOT(slot_btnRead1())); - connect(btnRead2, SIGNAL(clicked()), this, SLOT(slot_btnRead2())); - connect(btnRead3, SIGNAL(clicked()), this, SLOT(slot_btnRead3())); - connect(btnRead4, SIGNAL(clicked()), this, SLOT(slot_btnRead4())); - - QBoxLayout *h_lay = new QHBoxLayout(top_lay, 4); - if (!m_bOwner) - { - QPushButton *btnMenu = new QPushButton(tr("&Menu"), this); - h_lay->addWidget(btnMenu); - connect(btnMenu, SIGNAL(pressed()), this, SLOT(slot_usermenu())); - btnMenu->setPopup(mainwin->UserMenu()); - chkAutoClose = new QCheckBox(tr("Aut&o Close"), this); - chkAutoClose->setChecked(mainwin->m_bAutoClose); - h_lay->addWidget(chkAutoClose); - } - h_lay->addStretch(1); - int bw = 75; - btnReadNext = new QPushButton(tr("Nex&t"), this); - setTabOrder(btnRead4, btnReadNext); - btnClose = new CEButton(tr("&Close"), this); - QToolTip::add(btnClose, tr("Normal Click - Close Window\n<CTRL>+Click - also delete User")); - setTabOrder(btnReadNext, btnClose); - bw = QMAX(bw, btnReadNext->sizeHint().width()); - bw = QMAX(bw, btnClose->sizeHint().width()); - btnReadNext->setFixedWidth(bw); - btnClose->setFixedWidth(bw); - h_lay->addWidget(btnReadNext); - btnReadNext->setEnabled(false); - connect(btnReadNext, SIGNAL(clicked()), this, SLOT(slot_btnReadNext())); - connect(btnClose, SIGNAL(clicked()), SLOT(slot_close())); - h_lay->addWidget(btnClose); - - ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); - if (u != NULL && u->NewMessages() > 0) - { - unsigned short i; - /* - Create an item for the message we're currently viewing. - */ - if (mainwin->m_bMsgChatView) - { - for (i = 0; i < u->NewMessages(); i++) - if (u->EventPeek(i)->SubCommand() != ICQ_CMDxSUB_MSG) - break; - if (i == u->NewMessages()) - i = 0; - } - else - i = 0; - - MsgViewItem *e = new MsgViewItem(u->EventPeek(i), codec, msgView); - m_highestEventId = u->EventPeek(i)->Id(); - /* - Create items for all the messages which already await - in the queue. We cannot rely on getting CICQSignals for them - since they might've arrived before the dialog appeared, - possibly being undisplayed messages from previous licq session. - */ - for (i++; i < u->NewMessages(); i++) - { - CUserEvent* event = u->EventPeek(i); - if (!mainwin->m_bMsgChatView || - event->SubCommand() != ICQ_CMDxSUB_MSG) - { - new MsgViewItem(event, codec, msgView); - // Make sure we don't add this message again, even if we'll - // receive an userUpdated signal for it. - if (m_highestEventId < event->Id()) - m_highestEventId = event->Id(); - } - } - gUserManager.DropUser(u); - slot_printMessage(e); - msgView->setSelected(e, true); - msgView->ensureItemVisible(e); - } - else - gUserManager.DropUser(u); - - connect(this, SIGNAL(encodingChanged()), this, SLOT(slot_setEncoding())); -} - - void UserViewEvent::slot_setEncoding() { /* if we have an open view, refresh it */ if (this->msgView) { @@ -1533,129 +1304,6 @@ UserSendCommon::UserSendCommon(CICQDaemo connect(this, SIGNAL(updateUser(CICQSignal*)), mainwin, SLOT(slot_updatedUser(CICQSignal*))); } -UserSendCommon::UserSendCommon(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, QWidget* parent, const char* name) - : UserEventCommon(s, theSigMan, m, _nUin, parent, name) -{ - grpMR = NULL; - tmpWidgetWidth = 0; - m_bGrpMRIsVisible = false; - clearDelay = 250; - - QAccel *a = new QAccel( this ); - a->connectItem(a->insertItem(Key_Escape), this, SLOT(cancelSend())); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - parent == mainwin->userEventTabDlg) - { - a->connectItem(a->insertItem(ALT + Key_Left), mainwin->userEventTabDlg, SLOT(moveLeft())); - a->connectItem(a->insertItem(ALT + Key_Right), mainwin->userEventTabDlg, SLOT(moveRight())); - } -#endif - - QGroupBox *box = new QGroupBox(this); - top_lay->addWidget(box); - QBoxLayout *vlay = new QVBoxLayout(box, 10, 5); - QBoxLayout *hlay = new QHBoxLayout(vlay); - chkSendServer = new QCheckBox(tr("Se&nd through server"), box); - ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); - chkSendServer->setChecked(u->SendServer() || (u->StatusOffline() && u->SocketDesc() == -1)); - - if( (u->GetInGroup(GROUPS_SYSTEM, GROUP_INVISIBLE_LIST)) || - (u->Port() == 0 && u->SocketDesc() == -1)) - { - chkSendServer->setChecked(true); - chkSendServer->setEnabled(false); - } - gUserManager.DropUser(u); - hlay->addWidget(chkSendServer); - chkUrgent = new QCheckBox(tr("U&rgent"), box); - hlay->addWidget(chkUrgent); - chkMass = new QCheckBox(tr("M&ultiple recipients"), box); - hlay->addWidget(chkMass); - connect(chkMass, SIGNAL(toggled(bool)), this, SLOT(massMessageToggled(bool))); - btnForeColor = new QPushButton(box); - btnForeColor->setPixmap(chatChangeFg_xpm); - connect(btnForeColor, SIGNAL(clicked()), this, SLOT(slot_SetForegroundICQColor())); - hlay->addWidget(btnForeColor); - btnBackColor = new QPushButton(box); - btnBackColor->setPixmap(chatChangeBg_xpm); - connect(btnBackColor, SIGNAL(clicked()), this, SLOT(slot_SetBackgroundICQColor())); - hlay->addWidget(btnBackColor); - - QBoxLayout *h_lay = new QHBoxLayout(top_lay); - if (!m_bOwner) - { - QPushButton *btnMenu = new QPushButton(tr("&Menu"), this); - h_lay->addWidget(btnMenu); - connect(btnMenu, SIGNAL(pressed()), this, SLOT(slot_usermenu())); - btnMenu->setPopup(mainwin->UserMenu()); - } - cmbSendType = new QComboBox(this); - cmbSendType->insertItem(tr("Message")); - cmbSendType->insertItem(tr("URL")); - cmbSendType->insertItem(tr("Chat Request")); - cmbSendType->insertItem(tr("File Transfer")); - cmbSendType->insertItem(tr("Contact List")); - cmbSendType->insertItem(tr("SMS")); - connect(cmbSendType, SIGNAL(activated(int)), this, SLOT(changeEventType(int))); - h_lay->addWidget(cmbSendType); - h_lay->addStretch(1); - btnSend = new QPushButton(tr("&Send"), this); - int w = QMAX(btnSend->sizeHint().width(), 75); - // add a wrapper around the send button that - // tries to establish a secure connection first. - connect( btnSend, SIGNAL( clicked() ), this, SLOT( trySecure() ) ); - - btnCancel = new QPushButton(tr("&Close"), this); - w = QMAX(btnCancel->sizeHint().width(), w); - btnSend->setFixedWidth(w); - btnCancel->setFixedWidth(w); - h_lay->addWidget(btnSend); - h_lay->addWidget(btnCancel); - connect(btnCancel, SIGNAL(clicked()), this, SLOT(cancelSend())); - splView = new QSplitter(Vertical, mainWidget); - //splView->setOpaqueResize(); - mleHistory=0; - if (mainwin->m_bMsgChatView) { - mleHistory = new CMessageViewWidget(_nUin, mainwin, splView); - // add all unread messages. - ICQUser *u = gUserManager.FetchUser(_nUin, LOCK_R); - if (u != NULL && u->NewMessages() > 0) - { - for (unsigned short i = 0; i < u->NewMessages(); i++) - { - CUserEvent *e = u->EventPeek(i); - if (e->Id() > m_highestEventId) - m_highestEventId = e->Id(); - - mleHistory->addMsg(e); - } - } - gUserManager.DropUser(u); - -#if QT_VERSION >= 300 - connect(mleHistory, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); -#endif - connect (mainwin, SIGNAL(signal_sentevent(ICQEvent *)), mleHistory, SLOT(addMsg(ICQEvent *))); - //splView->setResizeMode(mleHistory, QSplitter::FollowSizeHint); - } - mleSend = new MLEditWrap(true, splView, true); - if (mainwin->m_bMsgChatView) - { - splView->setResizeMode(mleSend, QSplitter::KeepSize); - mleSend->resize(mleSend->width(), 90); - } - setTabOrder(mleSend, btnSend); - setTabOrder(btnSend, btnCancel); - icqColor.SetToDefault(); - mleSend->setBackground(QColor(icqColor.BackRed(), icqColor.BackGreen(), icqColor.BackBlue())); - mleSend->setForeground(QColor(icqColor.ForeRed(), icqColor.ForeGreen(), icqColor.ForeBlue())); - connect (mleSend, SIGNAL(signal_CtrlEnterPressed()), btnSend, SIGNAL(clicked())); - connect(this, SIGNAL(updateUser(CICQSignal*)), mainwin, SLOT(slot_updatedUser(CICQSignal*))); -} - - UserSendCommon::~UserSendCommon() { } @@ -1775,7 +1423,7 @@ void UserSendCommon::changeEventType(int #endif switch(id) { -#ifdef QT_PROTOCOL_PLUGIN + case 0: e = new UserSendMsgEvent(server, sigman, mainwin, m_szId, m_nPPID); break; @@ -1794,26 +1442,6 @@ void UserSendCommon::changeEventType(int case 5: e = new UserSendSmsEvent(server, sigman, mainwin, m_szId, m_nPPID); break; -#else - case 0: - e = new UserSendMsgEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); - break; - case 1: - e = new UserSendUrlEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); - break; - case 2: - e = new UserSendChatEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); - break; - case 3: - e = new UserSendFileEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); - break; - case 4: - e = new UserSendContactEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); - break; - case 5: - e = new UserSendSmsEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); - break; -#endif } if (e != NULL) @@ -1834,9 +1462,11 @@ void UserSendCommon::changeEventType(int e->move(p); } - disconnect(this, SIGNAL(finished(unsigned long)), mainwin, SLOT(slot_sendfinished(unsigned long))); - mainwin->slot_sendfinished(m_nUin); - connect(e, SIGNAL(finished(unsigned long)), mainwin, SLOT(slot_sendfinished(unsigned long))); + disconnect(this, SIGNAL(finished(const char *, unsigned long)), + mainwin, SLOT(slot_sendfinished(const char *,unsigned long))); + mainwin->slot_sendfinished(m_szId, m_nPPID); + connect(e, SIGNAL(finished(const char *, unsigned long)), mainwin, + SLOT(slot_sendfinished(const char *, unsigned long))); mainwin->licqUserSend.append(e); emit signal_msgtypechanged(this, e); @@ -1876,14 +1506,9 @@ void UserSendCommon::massMessageToggled( top_hlay->addWidget(grpMR); (void) new QLabel(tr("Drag Users Here\nRight Click for Options"), grpMR); -#ifdef QT_PROTOCOL_PLUGIN //TODO in CMMUserView lstMultipleRecipients = new CMMUserView(mainwin->colInfo, mainwin->m_bShowHeader, strtoul(m_szId, (char **)NULL, 10), mainwin, grpMR); -#else - lstMultipleRecipients = new CMMUserView(mainwin->colInfo, mainwin->m_bShowHeader, - m_nUin, mainwin, grpMR); -#endif lstMultipleRecipients->setFixedWidth(mainwin->UserView()->width()); } grpMR->show(); @@ -2405,26 +2030,6 @@ UserSendMsgEvent::UserSendMsgEvent(CICQD cmbSendType->setCurrentItem(0); } -UserSendMsgEvent::UserSendMsgEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long nUin, QWidget *parent) - : UserSendCommon(s, theSigMan, m, nUin, parent, "UserSendMsgEvent") -{ - QBoxLayout* lay = new QVBoxLayout(mainWidget); - lay->addWidget(splView); - if (!m->m_bMsgChatView) mleSend->setMinimumHeight(150); - mleSend->setFocus (); - - m_sBaseTitle += tr(" - Message"); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - mainwin->userEventTabDlg->tabIsSelected(this)) - mainwin->userEventTabDlg->setCaption(m_sBaseTitle); -#endif - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(0); -} - - UserSendMsgEvent::~UserSendMsgEvent() { } @@ -2548,29 +2153,6 @@ void UserSendMsgEvent::resetSettings() massMessageToggled( false ); } -//=====UserSendUrlEvent====================================================== -#ifdef QT_PROTOCOL_PLUGIN -UserSendUrlEvent::UserSendUrlEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, const char *szId, - unsigned long nPPID, QWidget* parent) - : UserSendCommon(s, theSigMan, m, szId, nPPID, parent, "UserSendUrlEvent") -{ - QBoxLayout* lay = new QVBoxLayout(mainWidget, 4); - lay->addWidget(splView); - mleSend->setFocus (); - - QBoxLayout* h_lay = new QHBoxLayout(lay); - lblItem = new QLabel(tr("URL : "), mainWidget); - h_lay->addWidget(lblItem); - edtItem = new CInfoField(mainWidget, false); - h_lay->addWidget(edtItem); - - m_sBaseTitle += tr(" - URL"); - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(1); -} -#endif - UserSendUrlEvent::UserSendUrlEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *szId, unsigned long nPPID, QWidget* parent) @@ -2596,31 +2178,6 @@ UserSendUrlEvent::UserSendUrlEvent(CICQD cmbSendType->setCurrentItem(1); } -UserSendUrlEvent::UserSendUrlEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, QWidget* parent) - : UserSendCommon(s, theSigMan, m, _nUin, parent, "UserSendUrlEvent") -{ - QBoxLayout* lay = new QVBoxLayout(mainWidget, 4); - lay->addWidget(splView); - mleSend->setFocus (); - - QBoxLayout* h_lay = new QHBoxLayout(lay); - lblItem = new QLabel(tr("URL : "), mainWidget); - h_lay->addWidget(lblItem); - edtItem = new CInfoField(mainWidget, false); - h_lay->addWidget(edtItem); - - m_sBaseTitle += tr(" - URL"); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - mainwin->userEventTabDlg->tabIsSelected(this)) - mainwin->userEventTabDlg->setCaption(m_sBaseTitle); -#endif - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(1); -} - - UserSendUrlEvent::~UserSendUrlEvent() { } @@ -2689,45 +2246,6 @@ bool UserSendUrlEvent::sendDone(ICQEvent return true; } - -//=====UserSendFileEvent===================================================== -#ifdef QT_PROTOCOL_PLUGIN -UserSendFileEvent::UserSendFileEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, const char *szId, - unsigned long nPPID, QWidget* parent) - : UserSendCommon(s, theSigMan, m, szId, nPPID, parent, "UserSendFileEvent") -{ - chkMass->setChecked(false); - chkMass->setEnabled(false); - btnForeColor->setEnabled(false); - btnBackColor->setEnabled(false); - - QBoxLayout* lay = new QVBoxLayout(mainWidget, 4); - lay->addWidget(splView); - - QBoxLayout* h_lay = new QHBoxLayout(lay); - lblItem = new QLabel(tr("File(s): "), mainWidget); - h_lay->addWidget(lblItem); - - edtItem = new CInfoField(mainWidget, false); - edtItem->SetReadOnly(true); - h_lay->addWidget(edtItem); - - btnBrowse = new QPushButton(tr("Browse"), mainWidget); - connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browseFile())); - h_lay->addWidget(btnBrowse); - - btnEdit = new QPushButton(tr("Edit"), mainWidget); - btnEdit->setEnabled(false); - connect(btnEdit, SIGNAL(clicked()), this, SLOT(editFileList())); - h_lay->addWidget(btnEdit); - - m_sBaseTitle += tr(" - File Transfer"); - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(3); -} -#endif - UserSendFileEvent::UserSendFileEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *szId, unsigned long nPPID, QWidget* parent) @@ -2768,46 +2286,6 @@ UserSendFileEvent::UserSendFileEvent(CIC cmbSendType->setCurrentItem(3); } -UserSendFileEvent::UserSendFileEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, QWidget* parent) - : UserSendCommon(s, theSigMan, m, _nUin, parent, "UserSendFileEvent") -{ - chkMass->setChecked(false); - chkMass->setEnabled(false); - btnForeColor->setEnabled(false); - btnBackColor->setEnabled(false); - - QBoxLayout* lay = new QVBoxLayout(mainWidget, 4); - lay->addWidget(splView); - - QBoxLayout* h_lay = new QHBoxLayout(lay); - lblItem = new QLabel(tr("File(s): "), mainWidget); - h_lay->addWidget(lblItem); - - edtItem = new CInfoField(mainWidget, false); - edtItem->SetReadOnly(true); - h_lay->addWidget(edtItem); - - btnBrowse = new QPushButton(tr("Browse"), mainWidget); - connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browseFile())); - h_lay->addWidget(btnBrowse); - - btnEdit = new QPushButton(tr("Edit"), mainWidget); - btnEdit->setEnabled(false); - connect(btnEdit, SIGNAL(clicked()), this, SLOT(editFileList())); - h_lay->addWidget(btnEdit); - - m_sBaseTitle += tr(" - File Transfer"); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - mainwin->userEventTabDlg->tabIsSelected(this)) - mainwin->userEventTabDlg->setCaption(m_sBaseTitle); -#endif - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(3); -} - - void UserSendFileEvent::browseFile() { #ifdef USE_KDE @@ -2982,43 +2460,6 @@ UserSendChatEvent::UserSendChatEvent(CIC cmbSendType->setCurrentItem(2); } -UserSendChatEvent::UserSendChatEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, QWidget* parent) - : UserSendCommon(s, theSigMan, m, _nUin, parent, "UserSendChatEvent") -{ - m_nMPChatPort = 0; - chkMass->setChecked(false); - chkMass->setEnabled(false); - btnForeColor->setEnabled(false); - btnBackColor->setEnabled(false); - - QBoxLayout *lay = new QVBoxLayout(mainWidget, 9); - lay->addWidget(splView); - - if (!m->m_bMsgChatView) mleSend->setMinimumHeight(150); - - QBoxLayout* h_lay = new QHBoxLayout(lay); - lblItem = new QLabel(tr("Multiparty: "), mainWidget); - h_lay->addWidget(lblItem); - - edtItem = new CInfoField(mainWidget, false); - h_lay->addWidget(edtItem); - - btnBrowse = new QPushButton(tr("Invite"), mainWidget); - connect(btnBrowse, SIGNAL(clicked()), this, SLOT(InviteUser())); - h_lay->addWidget(btnBrowse); - - m_sBaseTitle += tr(" - Chat Request"); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - mainwin->userEventTabDlg->tabIsSelected(this)) - mainwin->userEventTabDlg->setCaption(m_sBaseTitle); -#endif - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(2); -} - - UserSendChatEvent::~UserSendChatEvent() { } @@ -3125,32 +2566,7 @@ UserSendContactEvent::UserSendContactEve lay->addWidget(lblContact); lstContacts = new CMMUserView(mainwin->colInfo, mainwin->m_bShowHeader, - m_nUin, mainwin, mainWidget); - lay->addWidget(lstContacts); - - m_sBaseTitle += tr(" - Contact List"); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - mainwin->userEventTabDlg->tabIsSelected(this)) - mainwin->userEventTabDlg->setCaption(m_sBaseTitle); -#endif - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(4); -} - -UserSendContactEvent::UserSendContactEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long _nUin, QWidget* parent) - : UserSendCommon(s, theSigMan, m, _nUin, parent, "UserSendContactEvent") -{ - delete mleSend; mleSend = NULL; - - QBoxLayout* lay = new QVBoxLayout(mainWidget); - lay->addWidget(splView); - QLabel* lblContact = new QLabel(tr("Drag Users Here - Right Click for Options"), mainWidget); - lay->addWidget(lblContact); - - lstContacts = new CMMUserView(mainwin->colInfo, mainwin->m_bShowHeader, - m_nUin, mainwin, mainWidget); + m_szId, nPPID, mainwin, mainWidget); lay->addWidget(lstContacts); m_sBaseTitle += tr(" - Contact List"); @@ -3163,7 +2579,6 @@ UserSendContactEvent::UserSendContactEve cmbSendType->setCurrentItem(4); } - UserSendContactEvent::~UserSendContactEvent() { } @@ -3278,57 +2693,6 @@ UserSendSmsEvent::UserSendSmsEvent(CICQD connect(mleSend, SIGNAL(textChanged()), this, SLOT(slot_count())); ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); - if (u != NULL) - { - nfoNumber->setData(codec->toUnicode(u->GetCellularNumber())); - gUserManager.DropUser(u); - } - - m_sBaseTitle += tr(" - SMS"); -#if QT_VERSION >= 300 - if (mainwin->userEventTabDlg && - mainwin->userEventTabDlg->tabIsSelected(this)) - mainwin->userEventTabDlg->setCaption(m_sBaseTitle); -#endif - setCaption(m_sBaseTitle); - cmbSendType->setCurrentItem(5); -} - -UserSendSmsEvent::UserSendSmsEvent(CICQDaemon *s, CSignalManager *theSigMan, - CMainWindow *m, unsigned long nUin, QWidget *parent) - : UserSendCommon(s, theSigMan, m, nUin, parent, "UserSendSmsEvent") -{ - chkSendServer->setChecked(true); - chkSendServer->setEnabled(false); - chkUrgent->setChecked(false); - chkUrgent->setEnabled(false); - chkMass->setChecked(false); - chkMass->setEnabled(false); - btnForeColor->setEnabled(false); - btnBackColor->setEnabled(false); - btnEncoding->setEnabled(false); // SMSs are always UTF-8 - - QBoxLayout* lay = new QVBoxLayout(mainWidget, 4); - lay->addWidget(splView); - mleSend->setFocus(); - - QBoxLayout* h_lay = new QHBoxLayout(lay); - lblNumber = new QLabel(tr("Phone : "), mainWidget); - h_lay->addWidget(lblNumber); - nfoNumber = new CInfoField(mainWidget, false); - h_lay->addWidget(nfoNumber); - nfoNumber->setFixedWidth(QMAX(140, nfoNumber->sizeHint().width())); - h_lay->addStretch(1); - lblCount = new QLabel(tr("Chars left : "), mainWidget); - h_lay->addWidget(lblCount); - nfoCount = new CInfoField(mainWidget, false); - h_lay->addWidget(nfoCount); - nfoCount->setFixedWidth(40); - nfoCount->setAlignment(AlignCenter); - slot_count(); - connect(mleSend, SIGNAL(textChanged()), this, SLOT(slot_count())); - - ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); if (u != NULL) { nfoNumber->setData(codec->toUnicode(u->GetCellularNumber())); Index: plugins/qt-gui/src/usereventdlg.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/usereventdlg.h,v retrieving revision 1.56 diff -u -d -p -r1.56 usereventdlg.h --- plugins/qt-gui/src/usereventdlg.h 2 Jul 2003 04:41:02 -0000 1.56 +++ plugins/qt-gui/src/usereventdlg.h 8 Jul 2003 03:37:14 -0000 @@ -88,22 +88,17 @@ class UserEventCommon : public QWidget { Q_OBJECT public: - - UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0, const char* name =0); UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0, const char *name = 0); virtual ~UserEventCommon(); - unsigned long Uin() { return m_nUin; } char *Id() { return m_szId; } unsigned long PPID() { return m_nPPID; } protected: QTextCodec *codec; bool m_bOwner; - unsigned long m_nUin; char *m_szId; unsigned long m_nPPID; QBoxLayout* top_lay, *top_hlay; @@ -133,13 +128,12 @@ protected slots: void slot_updatetime(); void showHistory(); void showUserInfo(); - void slot_usermenu() { gMainWindow->SetUserMenuUin(m_nUin); } + void slot_usermenu() { gMainWindow->SetUserMenuUser(m_szId, m_nPPID); } void slot_security(); void slot_setEncoding(int encodingMib); signals: void finished(const char *, unsigned long); - void finished(unsigned long); void encodingChanged(); void viewurl(QWidget*, QString); }; @@ -153,8 +147,6 @@ class UserViewEvent : public UserEventCo public: UserViewEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0); - UserViewEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0); virtual ~UserViewEvent(); @@ -201,8 +193,6 @@ class UserSendCommon : public UserEventC public: UserSendCommon(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0, const char* name=0); - UserSendCommon(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0, const char *name = 0); virtual ~UserSendCommon(); @@ -292,8 +282,6 @@ class UserSendUrlEvent : public UserSend public: UserSendUrlEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0); - UserSendUrlEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0); virtual ~UserSendUrlEvent(); @@ -319,8 +307,6 @@ class UserSendFileEvent : public UserSen public: UserSendFileEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0); - UserSendFileEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0); virtual ~UserSendFileEvent(); @@ -351,8 +337,6 @@ class UserSendChatEvent : public UserSen public: UserSendChatEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0); - UserSendChatEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0); virtual ~UserSendChatEvent(); @@ -407,8 +391,6 @@ class UserSendSmsEvent : public UserSend Q_OBJECT public: - UserSendSmsEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, - unsigned long _nUin, QWidget* parent = 0); UserSendSmsEvent(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, const char *_szId, unsigned long _nPPID, QWidget *parent = 0); virtual ~UserSendSmsEvent();
pgp00000.pgp
Description: signature