Here comes the initial patch for the tabbed chatting feature.
I made the feature configurable in the options dialog and it can be enabled only if message chat view is enabled. I'm pretty sure that this patch includes some bugs but so far I didn't find any. This feature can be implemented in many ways and I'm not sure if my way is the right one but at least this seems to work. Feel free to criticize. :)
One feature is still missing: the tab label should be colorized when there are new messages behind it. I don't know yet if that is possible with qt (guess it should) but it would be really nice feature.
Too bad that icq icons can't be added to the tab labels (next to the aliases) so it would be easy to check the status of the user from there. This would be cool feature as well.
This patch can be found also from the web: http://tumppi.net/licq/tabbedchatting1.diff
Hope you enjoy this!
-- # Tuomas Jaakola
Index: ewidgets.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/ewidgets.cpp,v retrieving revision 1.68 diff -u -r1.68 ewidgets.cpp --- ewidgets.cpp 22 Feb 2003 08:34:38 -0000 1.68 +++ ewidgets.cpp 24 Mar 2003 21:24:52 -0000 @@ -25,6 +25,7 @@ #include "eventdesc.h" #include "ewidgets.h" #include "usercodec.h" +#include "usereventdlg.h" using namespace std; @@ -516,11 +517,11 @@ //- Message View Widget --------------------------------------------------------- -CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, QWidget* parent, const char * name) +CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget* parent, const char * name) :CHistoryWidget(parent,name) { m_nUin= _nUin; - parentWidget = parent; + mainwin = m; // add all unread messages. vector<CUserEvent*> newEventList; @@ -628,9 +629,16 @@ #endif GotoEnd(); + QWidget *parent = NULL; + if (parentWidget() && + parentWidget()->parentWidget() && + parentWidget()->parentWidget()->parentWidget()) + parent = parentWidget()->parentWidget()->parentWidget(); if ( #if QT_VERSION >= 300 - parentWidget && parentWidget->isActiveWindow() && + parent && parent->isActiveWindow() && + (!mainwin->m_bTabbedChatting || (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(parent))) && #endif e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG) { ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R ); Index: ewidgets.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/ewidgets.h,v retrieving revision 1.26 diff -u -r1.26 ewidgets.h --- ewidgets.h 22 Feb 2003 08:34:39 -0000 1.26 +++ ewidgets.h 24 Mar 2003 21:24:52 -0000 @@ -13,6 +13,7 @@ class CUserEvent; class ICQEvent; +class CMainWindow; bool QueryUser(QWidget *, QString, QString, QString); int QueryUser(QWidget *, QString, QString, QString, QString); @@ -128,9 +129,10 @@ Q_OBJECT private: unsigned long m_nUin; - QWidget *parentWidget; + CMainWindow *mainwin; public: - CMessageViewWidget(unsigned long _nUin, QWidget* parent=0, const char * name =0); + CMessageViewWidget(unsigned long _nUin, CMainWindow *m, + QWidget* parent=0, const char * name =0); virtual ~CMessageViewWidget(){}; public slots: virtual void addMsg(CUserEvent *); Index: mainwin.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/mainwin.cpp,v retrieving revision 1.275 diff -u -r1.275 mainwin.cpp --- mainwin.cpp 24 Mar 2003 15:33:52 -0000 1.275 +++ mainwin.cpp 24 Mar 2003 21:24:54 -0000 @@ -41,6 +41,7 @@ #include <qlayout.h> #include <qtextview.h> #include <qpainter.h> +#include <qtabwidget.h> #if QT_VERSION >= 300 #include <qstylefactory.h> #endif @@ -345,6 +346,7 @@ licqConf.ReadBool("SystemBackground", m_bSystemBackground, false); licqConf.ReadBool("SendFromClipboard", m_bSendFromClipboard, true); licqConf.ReadBool("MsgChatView", m_bMsgChatView, true ); + licqConf.ReadBool("TabbedChatting", m_bTabbedChatting, true); licqConf.ReadBool("AutoPosReplyWin", m_bAutoPosReplyWin, true); licqConf.ReadBool("AutoSendThroughServer", m_bAutoSendThroughServer, false); licqConf.ReadBool("EnableMainwinMouseMovement", m_bEnableMainwinMouseMovement, true); @@ -453,6 +455,7 @@ awayMsgDlg = NULL; optionsDlg = NULL; registerUserDlg = NULL; + userEventTabDlg = NULL; m_nRealHeight = 0; ICQOwner *o = gUserManager.FetchOwner(LOCK_R); @@ -640,6 +643,8 @@ ClassHint.res_name = (char *)name(); XSetClassHint(x11Display(), winId(), &ClassHint); #endif + + m_bTabbedChatting = true; } //-----ApplySkin---------------------------------------------------------------- @@ -2026,7 +2031,7 @@ case mnuUserSendSms: { #if QT_VERSION < 300 - QListIterator<UserSendCommon> it(licqUserSend ); + QListIterator<UserSendCommon> it(licqUserSend); #else QPtrListIterator<UserSendCommon> it(licqUserSend); #endif @@ -2036,79 +2041,116 @@ for (; it.current(); ++it) if ((*it)->Uin() == nUin) { - e = *it; - e->show(); - if(!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) - { - e->raise(); + e = *it; + if (m_bTabbedChatting) + { + userEventTabDlg->show(); + userEventTabDlg->selectTab(e); + userEventTabDlg->raise(); #ifdef USE_KDE - KWin::setActiveWindow(e->winId()); + KWin::setActiveWindow(userEventTabDlg->winId()); #endif - } - return e; - } + } + else + { + e->show(); + if(!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) + { + e->raise(); +#ifdef USE_KDE + KWin::setActiveWindow(e->winId()); +#endif + } + } + return e; + } } default: break; } + 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())); + } + } switch (fcn) { case mnuUserView: { - e = new UserViewEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserViewEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } case mnuUserSendMsg: { - e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } case mnuUserSendUrl: { - e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } case mnuUserSendChat: { - e = new UserSendChatEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserSendChatEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } case mnuUserSendFile: { - e = new UserSendFileEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserSendFileEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } case mnuUserSendContact: { - e = new UserSendContactEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserSendContactEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } case mnuUserSendSms: { - e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, nUin); + e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, nUin, + m_bTabbedChatting ? userEventTabDlg : NULL); break; } default: gLog.Warn("%sunknown callFunction() fcn: %d\n", L_WARNxSTR, fcn); } - if(e) { - connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); + if (e == NULL) return NULL; + + connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); + if (m_bTabbedChatting) + { + userEventTabDlg->addTab(e); + userEventTabDlg->show(); + } + else e->show(); - // there might be more than one send window open - // make sure we only remember one, or it will get compliated - 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)); - } + + // 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; @@ -2139,6 +2181,11 @@ // ----------------------------------------------------------------------------- +void CMainWindow::slot_doneUserEventTabDlg() +{ + userEventTabDlg = NULL; +} + void CMainWindow::slot_userfinished(unsigned long nUin) { #if QT_VERSION < 300 @@ -2166,7 +2213,6 @@ #else QPtrListIterator<UserSendCommon> it(licqUserSend); #endif - // go through the whole list, there might be more than // one hit for ( ; it.current(); ++it) @@ -2564,6 +2610,7 @@ licqConf.WriteBool("SystemBackground", m_bSystemBackground); licqConf.WriteBool("SendFromClipboard", m_bSendFromClipboard); licqConf.WriteBool("MsgChatView", m_bMsgChatView); + licqConf.WriteBool("TabbedChatting", m_bTabbedChatting); licqConf.WriteBool("AutoPosReplyWin", m_bAutoPosReplyWin); licqConf.WriteBool("AutoSendThroughServer", m_bAutoSendThroughServer); licqConf.WriteBool("EnableMainwinMouseMovement", m_bEnableMainwinMouseMovement); Index: mainwin.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/mainwin.h,v retrieving revision 1.102 diff -u -r1.102 mainwin.h --- mainwin.h 18 Mar 2003 17:03:49 -0000 1.102 +++ mainwin.h 24 Mar 2003 21:24:54 -0000 @@ -49,6 +49,7 @@ class CICQSignal; class UserInfoDlg; +class UserEventTabDlg; #if QT_VERSION < 300 typedef QList<UserViewEvent> UserViewEventList; @@ -118,7 +119,8 @@ m_bPopLastOnline, m_bPopOnlineSince, m_bPopIdleTime, - m_bShowAllEncodings; + m_bShowAllEncodings, + m_bTabbedChatting; QString m_MsgAutopopupKey; QString m_DefaultEncoding; @@ -149,6 +151,7 @@ AwayMsgDlg *awayMsgDlg; OptionsDlg *optionsDlg; RegisterUserDlg *registerUserDlg; + UserEventTabDlg *userEventTabDlg; // Widgets CUserView *userView; @@ -292,6 +295,7 @@ void slot_popupall(); void slot_aboutToQuit(); void UserInfoDlg_finished(unsigned long); + void slot_doneUserEventTabDlg(); signals: void changeDockStatus(unsigned short); Index: optionsdlg.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/optionsdlg.cpp,v retrieving revision 1.133 diff -u -r1.133 optionsdlg.cpp --- optionsdlg.cpp 19 Mar 2003 07:44:34 -0000 1.133 +++ optionsdlg.cpp 24 Mar 2003 21:24:55 -0000 @@ -207,6 +207,7 @@ chkSysBack->setChecked(mainwin->m_bSystemBackground); chkSendFromClipboard->setChecked(mainwin->m_bSendFromClipboard); chkMsgChatView->setChecked( mainwin->m_bMsgChatView ); + chkTabbedChatting->setChecked(mainwin->m_bTabbedChatting); chkAutoPosReplyWin->setChecked(mainwin->m_bAutoPosReplyWin); chkAutoSendThroughServer->setChecked(mainwin->m_bAutoSendThroughServer); chkEnableMainwinMouseMovement->setChecked(mainwin->m_bEnableMainwinMouseMovement); @@ -458,6 +459,7 @@ mainwin->m_bSystemBackground = chkSysBack->isChecked(); mainwin->m_bSendFromClipboard = chkSendFromClipboard->isChecked(); mainwin->m_bMsgChatView = chkMsgChatView->isChecked(); + mainwin->m_bTabbedChatting = chkTabbedChatting->isChecked(); mainwin->m_bAutoPosReplyWin = chkAutoPosReplyWin->isChecked(); mainwin->m_bAutoSendThroughServer = chkAutoSendThroughServer->isChecked(); mainwin->m_bEnableMainwinMouseMovement = chkEnableMainwinMouseMovement->isChecked(); @@ -709,6 +711,10 @@ chkMsgChatView = new QCheckBox(tr("Chatmode Messageview"), boxMainWin); QWhatsThis::add(chkMsgChatView, tr("Show the current chat history in Send Window")); + chkTabbedChatting = new QCheckBox(tr("Tabbed Chatting"), boxMainWin); + QWhatsThis::add(chkTabbedChatting, tr("Use tabs in Send Window")); + connect(chkMsgChatView, SIGNAL(toggled(bool)), this, SLOT(slot_useMsgChatView(bool))); + l = new QVBoxLayout(l); boxLocale = new QGroupBox(1, Horizontal, tr("Localization"), w); lblDefaultEncoding = new QLabel(tr("Default Encoding:"), boxLocale); @@ -973,6 +979,12 @@ { spnPortLow->setEnabled(b); spnPortHigh->setEnabled(b); +} + +void OptionsDlg::slot_useMsgChatView(bool b) +{ + if (!b) chkTabbedChatting->setChecked(false); + chkTabbedChatting->setEnabled(b); } void OptionsDlg::slot_useProxy(bool b) Index: optionsdlg.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/optionsdlg.h,v retrieving revision 1.62 diff -u -r1.62 optionsdlg.h --- optionsdlg.h 18 Mar 2003 17:03:53 -0000 1.62 +++ optionsdlg.h 24 Mar 2003 21:24:55 -0000 @@ -77,7 +77,7 @@ *chkBoldOnMsg, *chkManualNewUser, *chkAlwaysShowONU, *chkScrollBar, *chkShowExtIcons, *chkSysBack, *chkSendFromClipboard, *chkMsgChatView, *chkAutoPosReplyWin, - *chkAutoSendThroughServer, + *chkAutoSendThroughServer, *chkTabbedChatting, *chkEnableMainwinMouseMovement; QRadioButton *rdbDockDefault, *rdbDockThemed; QComboBox *cmbDockTheme, *cmbSortBy; @@ -145,6 +145,7 @@ void slot_useDockToggled(bool); void slot_useFirewall(bool); void slot_usePortRange(bool b); + void slot_useMsgChatView(bool); void slot_ok(); }; Index: usereventdlg.cpp =================================================================== RCS file: /cvsroot/licq/qt-gui/src/usereventdlg.cpp,v retrieving revision 1.113 diff -u -r1.113 usereventdlg.cpp --- usereventdlg.cpp 23 Mar 2003 17:49:39 -0000 1.113 +++ usereventdlg.cpp 24 Mar 2003 21:24:56 -0000 @@ -37,6 +37,7 @@ #include <qpopupmenu.h> #include <qtextcodec.h> #include <qwhatsthis.h> +#include <qtabwidget.h> #ifdef USE_KDE #include <kfiledialog.h> @@ -74,6 +75,95 @@ // ----------------------------------------------------------------------------- +UserEventTabDlg::UserEventTabDlg(QWidget *parent, const char *name) + : QWidget(parent, name, WDestructiveClose) +{ + QBoxLayout *lay = new QVBoxLayout(this); + tabw = new QTabWidget(this); + lay->addWidget(tabw); + connect(tabw, SIGNAL(currentChanged(QWidget *)), + this, SLOT(updateTitle(QWidget *))); + connect(tabw, SIGNAL(currentChanged(QWidget *)), + this, SLOT(clearEvents(QWidget *))); +} + +UserEventTabDlg::~UserEventTabDlg() +{ + emit signal_done(); +} + +void UserEventTabDlg::addTab(UserEventCommon *tab, int index) +{ + QString label; + ICQUser *u = gUserManager.FetchUser(tab->Uin(), LOCK_W); + if (u != NULL) + { + // initalize codec + QTextCodec *codec = QTextCodec::codecForLocale(); + label = codec->toUnicode(u->GetAlias()); + gUserManager.DropUser(u); + } + tabw->insertTab(tab, label, index); + selectTab(tab); +} + +void UserEventTabDlg::removeTab(QWidget *tab) +{ + if (tabw->count() > 1) + tabw->removePage(tab); + else + close(); +} + +void UserEventTabDlg::selectTab(QWidget *tab) +{ + tabw->showPage(tab); + updateTitle(tab); +} + +void UserEventTabDlg::replaceTab(QWidget *oldTab, + UserEventCommon *newTab) +{ + addTab(newTab, tabw->indexOf(oldTab)); + removeTab(oldTab); +} + +bool UserEventTabDlg::tabIsSelected(QWidget *tab) +{ + if (tabw->currentPageIndex() == tabw->indexOf(tab)) + return true; + else + return false; +} + +void UserEventTabDlg::updateTitle(QWidget *tab) +{ + setCaption(tab->caption()); +} + +void UserEventTabDlg::clearEvents(QWidget *tab) +{ + if (!isActiveWindow()) return; + UserEventCommon *e = static_cast<UserEventCommon*>(tab); + ICQUser *u = gUserManager.FetchUser(e->Uin(), LOCK_R); + if (u != NULL && u->NewMessages() > 0) + { + std::vector<int> idList; + for (unsigned short i = 0; i < u->NewMessages(); i++) + { + CUserEvent *e = u->EventPeek(i); + if (e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG) + idList.push_back(e->Id()); + } + + for (unsigned short i = 0; i < idList.size(); i++) + u->EventClearId(idList[i]); + } + gUserManager.DropUser(u); +} + +// ----------------------------------------------------------------------------- + UserEventCommon::UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, CMainWindow *m, unsigned long _nUin, QWidget* parent, const char* name) @@ -245,6 +335,9 @@ m_sBaseTitle = codec->toUnicode(u->GetAlias()) + " (" + codec->toUnicode(u->GetFirstName()) + " " + codec->toUnicode(u->GetLastName())+ ")"; + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); setIconText(codec->toUnicode(u->GetAlias())); } @@ -1010,7 +1103,7 @@ //splView->setOpaqueResize(); mleHistory=0; if (mainwin->m_bMsgChatView) { - mleHistory = new CMessageViewWidget(_nUin, splView); + mleHistory = new CMessageViewWidget(_nUin, mainwin, splView); #if QT_VERSION >= 300 connect(mleHistory, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); #endif @@ -1041,7 +1134,9 @@ //-----UserSendCommon::windowActivationChange-------------------------------- void UserSendCommon::windowActivationChange(bool oldActive) { - if (isActiveWindow() && mainwin->m_bMsgChatView) + if (isActiveWindow() && mainwin->m_bMsgChatView && + (!mainwin->m_bTabbedChatting || (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)))) { ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); if (u != NULL && u->NewMessages() > 0) @@ -1063,6 +1158,15 @@ } #endif +//-----UserSendCommon::slot_resettitle--------------------------------------- +void UserSendCommon::slot_resettitle() +{ + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); + setCaption(m_sBaseTitle); +} + //-----UserSendCommon::slot_SetForegroundColor------------------------------- void UserSendCommon::slot_SetForegroundICQColor() { @@ -1118,28 +1222,33 @@ switch(id) { case 0: - e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin); + e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin, + mainwin->m_bTabbedChatting ? parentWidget() : 0); break; case 1: - e = new UserSendUrlEvent(server, sigman, mainwin, m_nUin); + e = new UserSendUrlEvent(server, sigman, mainwin, m_nUin, + mainwin->m_bTabbedChatting ? parentWidget() : 0); break; case 2: - e = new UserSendChatEvent(server, sigman, mainwin, m_nUin); + e = new UserSendChatEvent(server, sigman, mainwin, m_nUin, + mainwin->m_bTabbedChatting ? parentWidget() : 0); break; case 3: - e = new UserSendFileEvent(server, sigman, mainwin, m_nUin); + e = new UserSendFileEvent(server, sigman, mainwin, m_nUin, + mainwin->m_bTabbedChatting ? parentWidget() : 0); break; case 4: - e = new UserSendContactEvent(server, sigman, mainwin, m_nUin); + e = new UserSendContactEvent(server, sigman, mainwin, m_nUin, + mainwin->m_bTabbedChatting ? parentWidget() : 0); break; case 5: - e = new UserSendSmsEvent(server, sigman, mainwin, m_nUin); + e = new UserSendSmsEvent(server, sigman, mainwin, m_nUin, + mainwin->m_bTabbedChatting ? parentWidget() : 0); break; } if (e != NULL) { - QPoint p = topLevelWidget()->pos(); if (e->mleSend && mleSend) { e->mleSend->setText(mleSend->text()); @@ -1149,11 +1258,20 @@ e->mleHistory->setText(mleHistory->text()); e->mleHistory->GotoEnd(); } - e->move(p); + if (mainwin->m_bTabbedChatting) + { + mainwin->userEventTabDlg->replaceTab(this, e); + } + else + { + QPoint p = topLevelWidget()->pos(); + e->move(p); + } emit signal_msgtypechanged(this, e); - QTimer::singleShot( 10, e, SLOT( show() ) ); + if (!mainwin->m_bTabbedChatting) + QTimer::singleShot( 10, e, SLOT( show() ) ); QTimer::singleShot( 100, this, SLOT( close() ) ); } @@ -1168,7 +1286,9 @@ { if (b) { - tmpWidgetWidth = width(); + if (mainwin->m_bTabbedChatting) + tmpWidgetWidth = mainwin->userEventTabDlg->width(); + else tmpWidgetWidth = width(); if (grpMR == NULL) { grpMR = new QVGroupBox(this); @@ -1194,15 +1314,30 @@ // resize the widget to it's origin width. // This is a workaroung and not perfect, but resize() does not // work as expected. Maybe we find a better solution for this in future. - QSize tmpMaxSize = maximumSize(); - if (tmpWidgetWidth == 0) - setFixedWidth(width() - grpMRWidth); + if (mainwin->m_bTabbedChatting) + { + QSize tmpMaxSize = mainwin->userEventTabDlg->maximumSize(); + if (tmpWidgetWidth == 0) + mainwin->userEventTabDlg->setFixedWidth(mainwin->userEventTabDlg->width() - grpMRWidth); + else + { + mainwin->userEventTabDlg->setFixedWidth(tmpWidgetWidth); + tmpWidgetWidth = 0; + } + mainwin->userEventTabDlg->setMaximumSize(tmpMaxSize); + } else { - setFixedWidth(tmpWidgetWidth); - tmpWidgetWidth = 0; + QSize tmpMaxSize = maximumSize(); + if (tmpWidgetWidth == 0) + setFixedWidth(width() - grpMRWidth); + else + { + setFixedWidth(tmpWidgetWidth); + tmpWidgetWidth = 0; + } + setMaximumSize(tmpMaxSize); } - setMaximumSize(tmpMaxSize); } } } @@ -1237,6 +1372,9 @@ m_sProgressMsg += via_server ? tr("via server") : tr("direct"); m_sProgressMsg += "..."; QString title = m_sBaseTitle + " [" + m_sProgressMsg + "]"; + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(title); setCaption(title); setCursor(waitCursor); btnSend->setEnabled(false); @@ -1261,7 +1399,13 @@ { if (e == NULL) { - setCaption(m_sBaseTitle + " [" + m_sProgressMsg + tr("error") + "]"); + QString title = m_sBaseTitle + " [" + m_sProgressMsg + tr("error") + "]"; + + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(title); + setCaption(title); + return; } @@ -1304,6 +1448,9 @@ break; } title = m_sBaseTitle + " [" + m_sProgressMsg + result + "]"; + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(title); setCaption(title); setCursor(arrowCursor); @@ -1524,10 +1671,16 @@ if (!icqEventTag) { - close(); + if (mainwin->m_bTabbedChatting) + mainwin->userEventTabDlg->removeTab(this); + else + close(); return; } + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); server->CancelEvent(icqEventTag); icqEventTag = 0; @@ -1604,6 +1757,9 @@ mleSend->setFocus (); m_sBaseTitle += tr(" - Message"); + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); cmbSendType->setCurrentItem(0); } @@ -1750,6 +1906,9 @@ h_lay->addWidget(edtItem); m_sBaseTitle += tr(" - URL"); + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); cmbSendType->setCurrentItem(1); } @@ -1853,6 +2012,9 @@ h_lay->addWidget(btnEdit); m_sBaseTitle += tr(" - File Transfer"); + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); cmbSendType->setCurrentItem(3); } @@ -2014,6 +2176,9 @@ h_lay->addWidget(btnBrowse); m_sBaseTitle += tr(" - Chat Request"); + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); cmbSendType->setCurrentItem(2); } @@ -2124,6 +2289,9 @@ lay->addWidget(lstContacts); m_sBaseTitle += tr(" - Contact List"); + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); cmbSendType->setCurrentItem(4); } @@ -2249,6 +2417,9 @@ } m_sBaseTitle += tr(" - SMS"); + if (mainwin->m_bTabbedChatting && + mainwin->userEventTabDlg->tabIsSelected(this)) + mainwin->userEventTabDlg->setCaption(m_sBaseTitle); setCaption(m_sBaseTitle); cmbSendType->setCurrentItem(5); } Index: usereventdlg.h =================================================================== RCS file: /cvsroot/licq/qt-gui/src/usereventdlg.h,v retrieving revision 1.47 diff -u -r1.47 usereventdlg.h --- usereventdlg.h 15 Mar 2003 01:52:14 -0000 1.47 +++ usereventdlg.h 24 Mar 2003 21:24:56 -0000 @@ -25,6 +25,7 @@ #include "licq_color.h" #include "licq_filetransfer.h" +class QTabWidget; class QBoxLayout; class QGroupBox; class QVGroupBox; @@ -55,6 +56,32 @@ /* ----------------------------------------------------------------------------- */ +class UserEventTabDlg : public QWidget +{ + Q_OBJECT +public: + UserEventTabDlg(QWidget *parent = 0, const char *name = 0); + ~UserEventTabDlg(); + + void addTab(UserEventCommon *tab, int index = -1); + void removeTab(QWidget *tab); + void selectTab(QWidget *tab); + void replaceTab(QWidget *oldTab, UserEventCommon *newTab); + bool tabIsSelected(QWidget *tab); + +private: + QTabWidget *tabw; + +public slots: + void updateTitle(QWidget *tab); + void clearEvents(QWidget *tab); + +signals: + void signal_done(); +}; + +/* ----------------------------------------------------------------------------- */ + class UserEventCommon : public QWidget { Q_OBJECT @@ -199,7 +226,7 @@ void changeEventType(int); void cancelSend(); void massMessageToggled(bool); - void slot_resettitle() { setCaption(m_sBaseTitle); } + void slot_resettitle(); void slot_SetForegroundICQColor(); void slot_SetBackgroundICQColor(); void trySecure();