Changeset 3437 for trunk

Show
Ignore:
Timestamp:
04/15/03 11:12:20 (6 years ago)
Author:
emostar
Message:

Patch by Tuomas Jaakola <tuomas.jaakola@…> for tabbed chatting.

Location:
trunk/qt-gui/src
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt-gui/src/ewidgets.cpp

    r3294 r3437  
    2626#include "ewidgets.h" 
    2727#include "usercodec.h" 
     28#include "usereventdlg.h" 
    2829 
    2930using namespace std; 
     
    517518//- Message View Widget --------------------------------------------------------- 
    518519 
    519 CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, QWidget* parent, const char * name) 
     520CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget* parent, const char * name) 
    520521:CHistoryWidget(parent,name) 
    521522{ 
    522523  m_nUin= _nUin; 
    523   parentWidget = parent; 
     524  mainwin = m; 
    524525 
    525526  // add all unread messages. 
     
    629630  GotoEnd(); 
    630631 
     632  QWidget *parent = NULL; 
     633  if (parentWidget() && 
     634      parentWidget()->parentWidget() && 
     635      parentWidget()->parentWidget()->parentWidget()) 
     636    parent = parentWidget()->parentWidget()->parentWidget(); 
    631637  if ( 
    632638#if QT_VERSION >= 300 
    633       parentWidget && parentWidget->isActiveWindow() && 
     639      parent && parent->isActiveWindow() && 
     640      (!mainwin->m_bTabbedChatting || (mainwin->m_bTabbedChatting && 
     641       mainwin->userEventTabDlg->tabIsSelected(parent))) && 
    634642#endif 
    635643      e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG) { 
  • trunk/qt-gui/src/ewidgets.h

    r3294 r3437  
    1414class CUserEvent; 
    1515class ICQEvent; 
     16class CMainWindow; 
    1617 
    1718bool QueryUser(QWidget *, QString, QString, QString); 
     
    129130private: 
    130131  unsigned long m_nUin; 
    131   QWidget *parentWidget; 
     132  CMainWindow *mainwin; 
    132133public: 
    133   CMessageViewWidget(unsigned long _nUin, QWidget* parent=0, const char * name =0); 
     134  CMessageViewWidget(unsigned long _nUin, CMainWindow *m, 
     135             QWidget* parent=0, const char * name =0); 
    134136  virtual ~CMessageViewWidget(){}; 
    135137public slots: 
  • trunk/qt-gui/src/mainwin.cpp

    r3431 r3437  
    4242#include <qtextview.h> 
    4343#include <qpainter.h> 
     44#include <qtabwidget.h> 
    4445#if QT_VERSION >= 300 
    4546#include <qstylefactory.h> 
     
    346347  licqConf.ReadBool("SendFromClipboard", m_bSendFromClipboard, true); 
    347348  licqConf.ReadBool("MsgChatView", m_bMsgChatView, true ); 
     349#if QT_VERSION < 300 
     350  m_bTabbedChatting = false; 
     351#else 
     352  licqConf.ReadBool("TabbedChatting", m_bTabbedChatting, true); 
     353#endif 
    348354  licqConf.ReadBool("AutoPosReplyWin", m_bAutoPosReplyWin, true); 
    349355  licqConf.ReadBool("AutoSendThroughServer", m_bAutoSendThroughServer, false); 
     
    454460  optionsDlg = NULL; 
    455461  registerUserDlg = NULL; 
     462#if QT_VERSION >= 300 
     463  userEventTabDlg = NULL; 
     464#endif 
    456465  m_nRealHeight = 0; 
    457466 
     
    641650  XSetClassHint(x11Display(), winId(), &ClassHint); 
    642651#endif 
     652 
    643653} 
    644654 
     
    12581268      } 
    12591269 
     1270#if QT_VERSION >= 300 
     1271      // update the tab icon of this user 
     1272      if (m_bTabbedChatting && userEventTabDlg) 
     1273        userEventTabDlg->updateTabLabel(u); 
     1274#endif 
    12601275      gUserManager.DropUser(u); 
    12611276 
     
    20272042    { 
    20282043#if QT_VERSION < 300 
    2029         QListIterator<UserSendCommon> it(licqUserSend ); 
     2044        QListIterator<UserSendCommon> it(licqUserSend); 
    20302045#else 
    20312046        QPtrListIterator<UserSendCommon> it(licqUserSend); 
     
    20532068            if ((*it)->Uin() == nUin) 
    20542069            { 
    2055               e = static_cast<UserSendCommon*>(*it); 
    2056             e->show(); 
    2057             if(!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) 
    2058             { 
    2059               e->raise(); 
     2070          e = static_cast<UserSendCommon*>(*it); 
     2071#if QT_VERSION >= 300 
     2072          if (userEventTabDlg && userEventTabDlg->tabExists(e)) 
     2073          { 
     2074        userEventTabDlg->show(); 
     2075        userEventTabDlg->selectTab(e); 
     2076        userEventTabDlg->raise(); 
    20602077#ifdef USE_KDE 
    2061               KWin::setActiveWindow(e->winId()); 
    2062 #endif 
    2063             } 
    2064             return e; 
    2065             } 
    2066           } 
     2078        KWin::setActiveWindow(userEventTabDlg->winId()); 
     2079#endif 
     2080          } 
     2081#endif 
     2082          else 
     2083          { 
     2084        e->show(); 
     2085        if (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) 
     2086        { 
     2087          e->raise(); 
     2088#ifdef USE_KDE 
     2089          KWin::setActiveWindow(e->winId()); 
     2090#endif 
     2091        } 
     2092          } 
     2093          return e; 
     2094        } 
     2095    } 
    20672096    } 
    20682097  default: 
     
    20702099  } 
    20712100 
     2101  QWidget *parent = NULL; 
     2102#if QT_VERSION >= 300 
     2103  if (m_bTabbedChatting) 
     2104  { 
     2105    if (userEventTabDlg != NULL) 
     2106      userEventTabDlg->raise(); 
     2107    else 
     2108    { 
     2109      // create the tab dialog if it does not exist 
     2110      userEventTabDlg = new UserEventTabDlg(); 
     2111      connect(userEventTabDlg, SIGNAL(signal_done()), this, SLOT(slot_doneUserEventTabDlg())); 
     2112    } 
     2113    parent = userEventTabDlg; 
     2114  } 
     2115#endif 
    20722116  switch (fcn) 
    20732117  { 
     
    20792123    case mnuUserSendMsg: 
    20802124    { 
    2081       e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, nUin); 
     2125      e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, nUin, parent); 
    20822126      break; 
    20832127    } 
    20842128    case mnuUserSendUrl: 
    20852129    { 
    2086       e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, nUin); 
     2130      e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, nUin, parent); 
    20872131      break; 
    20882132    } 
    20892133    case mnuUserSendChat: 
    20902134    { 
    2091       e = new UserSendChatEvent(licqDaemon, licqSigMan, this, nUin); 
     2135      e = new UserSendChatEvent(licqDaemon, licqSigMan, this, nUin, parent); 
    20922136      break; 
    20932137    } 
    20942138    case mnuUserSendFile: 
    20952139    { 
    2096       e = new UserSendFileEvent(licqDaemon, licqSigMan, this, nUin); 
     2140      e = new UserSendFileEvent(licqDaemon, licqSigMan, this, nUin, parent); 
    20972141      break; 
    20982142    } 
    20992143    case mnuUserSendContact: 
    21002144    { 
    2101       e = new UserSendContactEvent(licqDaemon, licqSigMan, this, nUin); 
     2145      e = new UserSendContactEvent(licqDaemon, licqSigMan, this, nUin, parent); 
    21022146      break; 
    21032147    } 
    21042148    case mnuUserSendSms: 
    21052149    { 
    2106       e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, nUin); 
     2150      e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, nUin, parent); 
    21072151      break; 
    21082152    } 
     
    21102154      gLog.Warn("%sunknown callFunction() fcn: %d\n", L_WARNxSTR, fcn); 
    21112155  } 
    2112   if(e) { 
    2113     connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); 
     2156  if (e == NULL) return NULL; 
     2157 
     2158  connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); 
     2159#if QT_VERSION >= 300 
     2160  if (m_bTabbedChatting && fcn != mnuUserView) 
     2161  { 
     2162    userEventTabDlg->addTab(e); 
     2163    userEventTabDlg->show(); 
     2164  } 
     2165  else 
     2166#endif 
    21142167    e->show(); 
    2115     // there might be more than one send window open 
    2116     // make sure we only remember one, or it will get compliated 
    2117     if (fcn == mnuUserView) 
    2118     { 
    2119       slot_userfinished(nUin); 
    2120       connect(e, SIGNAL(finished(unsigned long)), SLOT(slot_userfinished(unsigned long))); 
    2121       licqUserView.append(static_cast<UserViewEvent*>(e)); 
    2122     } 
    2123     else 
    2124     { 
    2125       slot_sendfinished(nUin); 
    2126       connect(e, SIGNAL(finished(unsigned long)), SLOT(slot_sendfinished(unsigned long))); 
    2127       licqUserSend.append(static_cast<UserSendCommon*>(e)); 
    2128     } 
    2129   } 
    2130  
     2168 
     2169  // there might be more than one send window open 
     2170  // make sure we only remember one, or it will get complicated 
     2171  if (fcn == mnuUserView) 
     2172  { 
     2173    slot_userfinished(nUin); 
     2174    connect(e, SIGNAL(finished(unsigned long)), SLOT(slot_userfinished(unsigned long))); 
     2175    licqUserView.append(static_cast<UserViewEvent*>(e)); 
     2176  } 
     2177  else 
     2178  { 
     2179    slot_sendfinished(nUin); 
     2180    connect(e, SIGNAL(finished(unsigned long)), SLOT(slot_sendfinished(unsigned long))); 
     2181    licqUserSend.append(static_cast<UserSendCommon*>(e)); 
     2182  } 
    21312183  return e; 
    21322184} 
     
    21562208 
    21572209// ----------------------------------------------------------------------------- 
     2210#if QT_VERSION >= 300 
     2211void CMainWindow::slot_doneUserEventTabDlg() 
     2212{ 
     2213  userEventTabDlg = NULL; 
     2214} 
     2215#endif 
    21582216 
    21592217void CMainWindow::slot_userfinished(unsigned long nUin) 
     
    21842242  QPtrListIterator<UserSendCommon> it(licqUserSend); 
    21852243#endif 
    2186  
    21872244  // go through the whole list, there might be more than 
    21882245  // one hit 
     
    25822639  licqConf.WriteBool("SendFromClipboard", m_bSendFromClipboard); 
    25832640  licqConf.WriteBool("MsgChatView", m_bMsgChatView); 
     2641  licqConf.WriteBool("TabbedChatting", m_bTabbedChatting); 
    25842642  licqConf.WriteBool("AutoPosReplyWin", m_bAutoPosReplyWin); 
    25852643  licqConf.WriteBool("AutoSendThroughServer", m_bAutoSendThroughServer); 
  • trunk/qt-gui/src/mainwin.h

    r3376 r3437  
    5050class CICQSignal; 
    5151class UserInfoDlg; 
     52#if QT_VERSION >= 300 
     53class UserEventTabDlg; 
     54#endif 
    5255 
    5356#if QT_VERSION < 300 
     
    119122       m_bPopOnlineSince, 
    120123       m_bPopIdleTime, 
    121        m_bShowAllEncodings; 
     124       m_bShowAllEncodings, 
     125       m_bTabbedChatting; 
    122126 
    123127  QString m_MsgAutopopupKey; 
     
    150154  OptionsDlg *optionsDlg; 
    151155  RegisterUserDlg *registerUserDlg; 
     156#if QT_VERSION >= 300 
     157  UserEventTabDlg *userEventTabDlg; 
     158#endif 
    152159 
    153160  // Widgets 
     
    293300  void slot_aboutToQuit(); 
    294301  void UserInfoDlg_finished(unsigned long); 
     302#if QT_VERSION >= 300 
     303  void slot_doneUserEventTabDlg(); 
     304#endif 
    295305 
    296306signals: 
  • trunk/qt-gui/src/optionsdlg.cpp

    r3380 r3437  
    208208  chkSendFromClipboard->setChecked(mainwin->m_bSendFromClipboard); 
    209209  chkMsgChatView->setChecked( mainwin->m_bMsgChatView ); 
     210#if QT_VERSION >= 300 
     211  chkTabbedChatting->setChecked(mainwin->m_bTabbedChatting); 
     212#endif 
    210213  chkAutoPosReplyWin->setChecked(mainwin->m_bAutoPosReplyWin); 
    211214  chkAutoSendThroughServer->setChecked(mainwin->m_bAutoSendThroughServer); 
     
    459462  mainwin->m_bSendFromClipboard = chkSendFromClipboard->isChecked(); 
    460463  mainwin->m_bMsgChatView = chkMsgChatView->isChecked(); 
     464#if QT_VERSION >= 300 
     465  mainwin->m_bTabbedChatting = chkTabbedChatting->isChecked(); 
     466#endif 
    461467  mainwin->m_bAutoPosReplyWin = chkAutoPosReplyWin->isChecked(); 
    462468  mainwin->m_bAutoSendThroughServer = chkAutoSendThroughServer->isChecked(); 
     
    710716  QWhatsThis::add(chkMsgChatView, tr("Show the current chat history in Send Window")); 
    711717 
     718#if QT_VERSION >= 300 
     719  chkTabbedChatting = new QCheckBox(tr("Tabbed Chatting"), boxMainWin); 
     720  QWhatsThis::add(chkTabbedChatting, tr("Use tabs in Send Window")); 
     721  connect(chkMsgChatView, SIGNAL(toggled(bool)), this, SLOT(slot_useMsgChatView(bool))); 
     722#endif 
     723 
    712724  l = new QVBoxLayout(l); 
    713725  boxLocale = new QGroupBox(1, Horizontal, tr("Localization"), w); 
     
    974986  spnPortLow->setEnabled(b); 
    975987  spnPortHigh->setEnabled(b); 
     988} 
     989 
     990void OptionsDlg::slot_useMsgChatView(bool b) 
     991{ 
     992  if (!b) chkTabbedChatting->setChecked(false); 
     993  chkTabbedChatting->setEnabled(b); 
    976994} 
    977995 
  • trunk/qt-gui/src/optionsdlg.h

    r3376 r3437  
    7878             *chkAlwaysShowONU, *chkScrollBar, *chkShowExtIcons, 
    7979             *chkSysBack, *chkSendFromClipboard, *chkMsgChatView, *chkAutoPosReplyWin, 
    80          *chkAutoSendThroughServer, 
     80         *chkAutoSendThroughServer, *chkTabbedChatting, 
    8181             *chkEnableMainwinMouseMovement; 
    8282   QRadioButton *rdbDockDefault, *rdbDockThemed; 
     
    146146  void slot_useFirewall(bool); 
    147147  void slot_usePortRange(bool b); 
     148  void slot_useMsgChatView(bool); 
    148149  void slot_ok(); 
    149150}; 
  • trunk/qt-gui/src/usereventdlg.cpp

    r3429 r3437  
    3838#include <qtextcodec.h> 
    3939#include <qwhatsthis.h> 
     40#include <qtabwidget.h> 
    4041 
    4142#ifdef USE_KDE 
     
    7273#include "xpm/chatChangeFg.xpm" 
    7374#include "xpm/chatChangeBg.xpm" 
     75 
     76// ----------------------------------------------------------------------------- 
     77#if QT_VERSION >= 300 
     78UserEventTabDlg::UserEventTabDlg(QWidget *parent, const char *name) 
     79  : QWidget(parent, name, WDestructiveClose) 
     80{ 
     81  QBoxLayout *lay = new QVBoxLayout(this); 
     82  tabw = new QTabWidget(this); 
     83  lay->addWidget(tabw); 
     84  connect(tabw, SIGNAL(currentChanged(QWidget *)), 
     85      this, SLOT(updateTitle(QWidget *))); 
     86  connect(tabw, SIGNAL(currentChanged(QWidget *)), 
     87          this, SLOT(clearEvents(QWidget *))); 
     88} 
     89 
     90UserEventTabDlg::~UserEventTabDlg() 
     91{ 
     92  emit signal_done(); 
     93} 
     94 
     95void UserEventTabDlg::addTab(UserEventCommon *tab, int index) 
     96{ 
     97  QString label; 
     98  ICQUser *u = gUserManager.FetchUser(tab->Uin(), LOCK_W); 
     99  if (u == NULL) return; 
     100 
     101  // initalize codec 
     102  QTextCodec *codec = QTextCodec::codecForLocale(); 
     103  label = codec->toUnicode(u->GetAlias()); 
     104  tabw->insertTab(tab, label, index); 
     105  updateTabLabel(u); 
     106  gUserManager.DropUser(u); 
     107  tabw->showPage(tab); 
     108} 
     109 
     110void UserEventTabDlg::removeTab(QWidget *tab) 
     111{ 
     112  if (tabw->count() > 1) 
     113  { 
     114    tabw->removePage(tab); 
     115    tab->close(true); 
     116  } 
     117  else 
     118    close(); 
     119} 
     120 
     121void UserEventTabDlg::selectTab(QWidget *tab) 
     122{ 
     123  tabw->showPage(tab); 
     124  updateTitle(tab); 
     125} 
     126 
     127void UserEventTabDlg::replaceTab(QWidget *oldTab, 
     128                 UserEventCommon *newTab) 
     129{ 
     130  addTab(newTab, tabw->indexOf(oldTab)); 
     131  removeTab(oldTab); 
     132} 
     133 
     134bool UserEventTabDlg::tabIsSelected(QWidget *tab) 
     135{ 
     136  if (tabw->currentPageIndex() == tabw->indexOf(tab)) 
     137    return true; 
     138  else 
     139    return false; 
     140} 
     141 
     142bool UserEventTabDlg::tabExists(QWidget *tab) 
     143{ 
     144  if (tabw->indexOf(tab) != -1) 
     145    return true; 
     146  else return false; 
     147} 
     148 
     149void UserEventTabDlg::updateTabLabel(ICQUser *u) 
     150{ 
     151  for (int index = 0; index < tabw->count(); index++) 
     152  { 
     153    UserEventCommon *tab = static_cast<UserEventCommon*>(tabw->page(index)); 
     154    if (tab->Uin() == u->Uin()) 
     155    { 
     156      if (u->NewMessages() > 0) 
     157      { 
     158    // use an event icon 
     159    unsigned short SubCommand = 0; 
     160    for (unsigned short i = 0; i < u->NewMessages(); i++) 
     161    { 
     162      switch(u->EventPeek(i)->SubCommand()) 
     163      { 
     164      case ICQ_CMDxSUB_FILE: 
     165        SubCommand = ICQ_CMDxSUB_FILE; 
     166        break; 
     167      case ICQ_CMDxSUB_CHAT: 
     168        if (SubCommand != ICQ_CMDxSUB_FILE) SubCommand = ICQ_CMDxSUB_CHAT; 
     169        break; 
     170      case ICQ_CMDxSUB_URL: 
     171        if (SubCommand != ICQ_CMDxSUB_FILE && SubCommand != ICQ_CMDxSUB_CHAT) 
     172          SubCommand = ICQ_CMDxSUB_URL; 
     173        break; 
     174      case ICQ_CMDxSUB_CONTACTxLIST: 
     175        if(SubCommand != ICQ_CMDxSUB_FILE && SubCommand != ICQ_CMDxSUB_CHAT 
     176           && SubCommand != ICQ_CMDxSUB_URL) 
     177          SubCommand = ICQ_CMDxSUB_CONTACTxLIST; 
     178      case ICQ_CMDxSUB_MSG: 
     179      default: 
     180        if (SubCommand == 0) SubCommand = ICQ_CMDxSUB_MSG; 
     181        break; 
     182      } 
     183    } 
     184    if(SubCommand) 
     185      tabw->setTabIconSet(tab, CMainWindow::iconForEvent(SubCommand)); 
     186      } 
     187      // use status icon 
     188      else tabw->setTabIconSet(tab, CMainWindow::iconForStatus(u->StatusFull())); 
     189      return; 
     190    } 
     191  } 
     192} 
     193 
     194void UserEventTabDlg::updateTitle(QWidget *tab) 
     195{ 
     196  if (tab->caption()) 
     197    setCaption(tab->caption()); 
     198} 
     199 
     200void UserEventTabDlg::clearEvents(QWidget *tab) 
     201{ 
     202  if (!isActiveWindow()) return; 
     203  UserEventCommon *e = static_cast<UserEventCommon*>(tab); 
     204  ICQUser *u = gUserManager.FetchUser(e->Uin(), LOCK_R); 
     205  if (u != NULL && u->NewMessages() > 0) 
     206  { 
     207    std::vector<int> idList; 
     208    for (unsigned short i = 0; i < u->NewMessages(); i++) 
     209    { 
     210      CUserEvent *e = u->EventPeek(i); 
     211      if (e->Direction() == D_RECEIVER && e->SubCommand() == ICQ_CMDxSUB_MSG) 
     212    idList.push_back(e->Id()); 
     213    } 
     214 
     215    for (unsigned short i = 0; i < idList.size(); i++) 
     216      u->EventClearId(idList[i]); 
     217  } 
     218  gUserManager.DropUser(u); 
     219} 
     220 
     221void UserEventTabDlg::moveLeft() 
     222{ 
     223  int index = tabw->currentPageIndex(); 
     224  if (index > 0) 
     225    tabw->setCurrentPage(index - 1); 
     226} 
     227 
     228void UserEventTabDlg::moveRight() 
     229{ 
     230  int index = tabw->currentPageIndex(); 
     231  if (index < tabw->count() - 1) 
     232    tabw->setCurrentPage(index + 1); 
     233} 
     234#endif 
    74235 
    75236// ----------------------------------------------------------------------------- 
     
    246407             codec->toUnicode(u->GetFirstName()) + " " + 
    247408             codec->toUnicode(u->GetLastName())+ ")"; 
     409#if QT_VERSION >= 300 
     410  if (mainwin->userEventTabDlg && 
     411      mainwin->userEventTabDlg->tabIsSelected(this)) 
     412    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     413#endif 
    248414  setCaption(m_sBaseTitle); 
    249415  setIconText(codec->toUnicode(u->GetAlias())); 
     
    9451111  QAccel *a = new QAccel( this ); 
    9461112  a->connectItem(a->insertItem(Key_Escape), this, SLOT(cancelSend())); 
     1113#if QT_VERSION >= 300 
     1114  if (mainwin->userEventTabDlg && 
     1115      parent == mainwin->userEventTabDlg) 
     1116  { 
     1117    a->connectItem(a->insertItem(ALT + Key_Left), 
     1118           mainwin->userEventTabDlg, SLOT(moveLeft())); 
     1119    a->connectItem(a->insertItem(ALT + Key_Right), 
     1120           mainwin->userEventTabDlg, SLOT(moveRight())); 
     1121  } 
     1122#endif 
    9471123 
    9481124  QGroupBox *box = new QGroupBox(this); 
     
    10111187  mleHistory=0; 
    10121188  if (mainwin->m_bMsgChatView) { 
    1013     mleHistory = new CMessageViewWidget(_nUin, splView); 
     1189    mleHistory = new CMessageViewWidget(_nUin, mainwin, splView); 
    10141190#if QT_VERSION >= 300 
    10151191    connect(mleHistory, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); 
     
    10421218void UserSendCommon::windowActivationChange(bool oldActive) 
    10431219{ 
    1044   if (isActiveWindow() && mainwin->m_bMsgChatView) 
    1045   { 
     1220  if (isActiveWindow() && mainwin->m_bMsgChatView && 
     1221      (!mainwin->userEventTabDlg || 
     1222       (mainwin->userEventTabDlg && 
     1223    (!mainwin->userEventTabDlg->tabExists(this) || 
     1224     mainwin->userEventTabDlg->tabIsSelected(this))))) 
     1225    { 
    10461226    ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); 
    10471227    if (u != NULL && u->NewMessages() > 0) 
     
    10631243} 
    10641244#endif 
     1245 
     1246//-----UserSendCommon::slot_resettitle--------------------------------------- 
     1247void UserSendCommon::slot_resettitle() 
     1248{ 
     1249#if QT_VERSION >= 300 
     1250  if (mainwin->userEventTabDlg && 
     1251      mainwin->userEventTabDlg->tabIsSelected(this)) 
     1252    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     1253#endif 
     1254  setCaption(m_sBaseTitle); 
     1255} 
    10651256 
    10661257//-----UserSendCommon::slot_SetForegroundColor------------------------------- 
     
    11161307{ 
    11171308  UserSendCommon* e = NULL; 
     1309  QWidget *parent = NULL; 
     1310#if QT_VERSION >= 300 
     1311  if (mainwin->userEventTabDlg && 
     1312      mainwin->userEventTabDlg->tabIsSelected(this)) 
     1313      parent = mainwin->userEventTabDlg; 
     1314#endif 
    11181315  switch(id) 
    11191316  { 
    11201317  case 0: 
    1121     e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin); 
     1318    e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin, parent); 
    11221319    break; 
    11231320  case 1: 
    1124     e = new UserSendUrlEvent(server, sigman, mainwin, m_nUin); 
     1321    e = new UserSendUrlEvent(server, sigman, mainwin, m_nUin, parent); 
    11251322    break; 
    11261323  case 2: 
    1127     e = new UserSendChatEvent(server, sigman, mainwin, m_nUin); 
     1324    e = new UserSendChatEvent(server, sigman, mainwin, m_nUin, parent); 
    11281325    break; 
    11291326  case 3: 
    1130     e = new UserSendFileEvent(server, sigman, mainwin, m_nUin); 
     1327    e = new UserSendFileEvent(server, sigman, mainwin, m_nUin, parent); 
    11311328    break; 
    11321329  case 4: 
    1133     e = new UserSendContactEvent(server, sigman, mainwin, m_nUin); 
     1330    e = new UserSendContactEvent(server, sigman, mainwin, m_nUin, parent); 
    11341331    break; 
    11351332  case 5: 
    1136     e = new UserSendSmsEvent(server, sigman, mainwin, m_nUin); 
     1333    e = new UserSendSmsEvent(server, sigman, mainwin, m_nUin, parent); 
    11371334    break; 
    11381335  } 
     
    11401337  if (e != NULL) 
    11411338  { 
    1142     QPoint p = topLevelWidget()->pos(); 
    11431339    if (e->mleSend && mleSend) 
    11441340    {   
     
    11501346      e->mleHistory->GotoEnd(); 
    11511347    } 
    1152     e->move(p); 
     1348 
     1349    if (!parent) 
     1350    { 
     1351      QPoint p = topLevelWidget()->pos(); 
     1352      e->move(p); 
     1353    } 
    11531354 
    11541355    disconnect(this, SIGNAL(finished(unsigned long)), mainwin, SLOT(slot_sendfinished(unsigned long))); 
     
    11591360    emit signal_msgtypechanged(this, e); 
    11601361 
    1161     QTimer::singleShot( 10, e, SLOT( show() ) ); 
    1162  
    1163