Show
Ignore:
Timestamp:
05/03/03 10:51:05 (6 years ago)
Author:
emostar
Message:

Get tabbed chatting to work.
Hopefully I got all the spots that needed the code for protocol plugin support..

Location:
branches/protocol_plugin_1_3_0/qt-gui/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/protocol_plugin_1_3_0/qt-gui/src/mainwin.cpp

    r3483 r3490  
    22192219             (*it)->PPID() == nPPID) 
    22202220          { 
    2221             e = *it; 
    2222             e->show(); 
    2223             if(!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) 
    2224             { 
    2225               e->raise(); 
     2221          e = static_cast<UserSendCommon*>(*it); 
     2222#if QT_VERSION >= 300 
     2223          if (userEventTabDlg && userEventTabDlg->tabExists(e)) 
     2224          { 
     2225          userEventTabDlg->show(); 
     2226          userEventTabDlg->selectTab(e); 
     2227          userEventTabDlg->raise(); 
    22262228#ifdef USE_KDE 
    2227               KWin::setActiveWindow(e->winId()); 
    2228 #endif 
    2229             } 
     2229          KWin::setActiveWindow(userEventTabDlg->winId()); 
     2230#endif 
     2231          } 
     2232#endif 
     2233          else 
     2234          { 
     2235          e->show(); 
     2236          if (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon")) 
     2237          { 
     2238            e->raise(); 
     2239#ifdef USE_KDE 
     2240            KWin::setActiveWindow(e->winId()); 
     2241#endif 
     2242          } 
     2243          } 
    22302244            return e; 
    22312245          } 
     
    22352249  } 
    22362250 
     2251  QWidget *parent = NULL; 
     2252#if QT_VERSION >= 300 
     2253  if (m_bTabbedChatting) 
     2254  { 
     2255    if (userEventTabDlg != NULL) 
     2256      userEventTabDlg->raise(); 
     2257    else 
     2258    { 
     2259      // create the tab dialog if it does not exist 
     2260      userEventTabDlg = new UserEventTabDlg(); 
     2261      connect(userEventTabDlg, SIGNAL(signal_done()), this, SLOT(slot_doneUserEventTabDlg())); 
     2262    } 
     2263    parent = userEventTabDlg; 
     2264  } 
     2265#endif 
     2266 
    22372267  switch (fcn) 
    22382268  { 
     
    22442274    case mnuUserSendMsg: 
    22452275    { 
    2246       e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, szId, nPPID); 
     2276      e = new UserSendMsgEvent(licqDaemon, licqSigMan, this, szId, nPPID, parent); 
    22472277      break; 
    22482278    } 
    22492279    case mnuUserSendUrl: 
    22502280    { 
    2251       e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, szId, nPPID); 
     2281      e = new UserSendUrlEvent(licqDaemon, licqSigMan, this, szId, nPPID, parent); 
    22522282      break; 
    22532283    } 
    22542284    case mnuUserSendChat: 
    22552285    { 
    2256       e = new UserSendChatEvent(licqDaemon, licqSigMan, this, szId, nPPID); 
     2286      e = new UserSendChatEvent(licqDaemon, licqSigMan, this, szId, nPPID, parent); 
    22572287      break; 
    22582288    } 
    22592289    case mnuUserSendFile: 
    22602290    { 
    2261       e = new UserSendFileEvent(licqDaemon, licqSigMan, this, szId, nPPID); 
     2291      e = new UserSendFileEvent(licqDaemon, licqSigMan, this, szId, nPPID, parent); 
    22622292      break; 
    22632293    } 
    22642294    case mnuUserSendContact: 
    22652295    { 
    2266       e = new UserSendContactEvent(licqDaemon, licqSigMan, this, szId, nPPID); 
     2296      e = new UserSendContactEvent(licqDaemon, licqSigMan, this, szId, nPPID, parent); 
    22672297      break; 
    22682298    } 
    22692299    case mnuUserSendSms: 
    22702300    { 
    2271       e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, szId, nPPID); 
     2301      e = new UserSendSmsEvent(licqDaemon, licqSigMan, this, szId, nPPID, parent); 
    22722302      break; 
    22732303    } 
     
    22752305      gLog.Warn("%sunknown callFunction() fcn: %d\n", L_WARNxSTR, fcn); 
    22762306  } 
    2277   if(e) { 
    2278     connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); 
     2307  if (e == NULL) return NULL; 
     2308 
     2309  connect(e, SIGNAL(viewurl(QWidget*, QString)), this, SLOT(slot_viewurl(QWidget *, QString))); 
     2310#if QT_VERSION >= 300 
     2311  if (m_bTabbedChatting && fcn != mnuUserView) 
     2312  { 
     2313    userEventTabDlg->addTab(e); 
     2314    userEventTabDlg->show(); 
     2315  } 
     2316  else 
     2317#endif 
    22792318    e->show(); 
    2280     // there might be more than one send window open 
    2281     // make sure we only remember one, or it will get compliated 
    2282     if (fcn == mnuUserView) 
    2283     { 
    2284       slot_userfinished(szId, nPPID); 
    2285       connect(e, SIGNAL(finished(const char *, unsigned long)), 
    2286         SLOT(slot_userfinished(const char *, unsigned long))); 
    2287       licqUserView.append(static_cast<UserViewEvent*>(e)); 
    2288     } 
    2289     else 
    2290     { 
    2291       slot_sendfinished(szId, nPPID); 
    2292       connect(e, SIGNAL(finished(const char *, unsigned long)), 
    2293         SLOT(slot_sendfinished(const char *, unsigned long))); 
    2294       licqUserSend.append(static_cast<UserSendCommon*>(e)); 
    2295     } 
    2296   } 
    2297  
     2319 
     2320  // there might be more than one send window open 
     2321  // make sure we only remember one, or it will get complicated 
     2322  if (fcn == mnuUserView) 
     2323  { 
     2324    slot_userfinished(szId, nPPID); 
     2325    connect(e, SIGNAL(finished(const char *, unsigned long)), 
     2326      SLOT(slot_userfinished(const char *, unsigned long))); 
     2327    licqUserView.append(static_cast<UserViewEvent*>(e)); 
     2328  } 
     2329  else 
     2330  { 
     2331    slot_sendfinished(szId, nPPID); 
     2332    connect(e, SIGNAL(finished(const char *, unsigned long)), 
     2333      SLOT(slot_sendfinished(const char *, unsigned long))); 
     2334    licqUserSend.append(static_cast<UserSendCommon*>(e)); 
     2335  } 
    22982336  return e; 
    22992337} 
  • branches/protocol_plugin_1_3_0/qt-gui/src/usereventdlg.cpp

    r3489 r3490  
    8888  m_bOwner = (gUserManager.FindOwner(m_szId, m_nPPID) != NULL); 
    8989  m_bDeleteUser = false; 
    90    
     90 
    9191  top_hlay = new QHBoxLayout(this, 6); 
    9292  top_lay = new QVBoxLayout(top_hlay); 
     
    200200{ 
    201201  QString label; 
    202   ICQUser *u = gUserManager.FetchUser(tab->Uin(), LOCK_W); 
     202  ICQUser *u = gUserManager.FetchUser(tab->Id(), tab->PPID(), LOCK_W); 
    203203  if (u == NULL) return; 
    204204 
     
    13691369  QAccel *a = new QAccel( this ); 
    13701370  a->connectItem(a->insertItem(Key_Escape), this, SLOT(cancelSend())); 
     1371#if QT_VERSION >= 300 
     1372  if (mainwin->userEventTabDlg && 
     1373      parent == mainwin->userEventTabDlg) 
     1374  { 
     1375    a->connectItem(a->insertItem(ALT + Key_Left), 
     1376           mainwin->userEventTabDlg, SLOT(moveLeft())); 
     1377    a->connectItem(a->insertItem(ALT + Key_Right), 
     1378           mainwin->userEventTabDlg, SLOT(moveRight())); 
     1379  } 
     1380#endif 
    13711381 
    13721382  QGroupBox *box = new QGroupBox(this); 
     
    16731683  { 
    16741684  case 0: 
    1675     e = new UserSendMsgEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1685    e = new UserSendMsgEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); 
    16761686    break; 
    16771687  case 1: 
    1678     e = new UserSendUrlEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1688    e = new UserSendUrlEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); 
    16791689    break; 
    16801690  case 2: 
    1681     e = new UserSendChatEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1691    e = new UserSendChatEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); 
    16821692    break; 
    16831693  case 3: 
    1684     e = new UserSendFileEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1694    e = new UserSendFileEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); 
    16851695    break; 
    16861696  case 4: 
    1687     e = new UserSendContactEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1697    e = new UserSendContactEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); 
    16881698    break; 
    16891699  case 5: 
    1690     e = new UserSendSmsEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1700    e = new UserSendSmsEvent(server, sigman, mainwin, m_szId, m_nPPID, parent); 
    16911701    break; 
    16921702  } 
     
    22302240 
    22312241  m_sBaseTitle += tr(" - Message"); 
     2242#if QT_VERSION >= 300 
     2243  if (mainwin->userEventTabDlg && 
     2244      mainwin->userEventTabDlg->tabIsSelected(this)) 
     2245    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     2246#endif 
    22322247  setCaption(m_sBaseTitle); 
    22332248  cmbSendType->setCurrentItem(0); 
     
    23962411 
    23972412  m_sBaseTitle += tr(" - URL"); 
     2413#if QT_VERSION >= 300 
     2414  if (mainwin->userEventTabDlg && 
     2415      mainwin->userEventTabDlg->tabIsSelected(this)) 
     2416    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     2417#endif 
    23982418  setCaption(m_sBaseTitle); 
    23992419  cmbSendType->setCurrentItem(1); 
     
    25242544 
    25252545  m_sBaseTitle += tr(" - File Transfer"); 
     2546#if QT_VERSION >= 300 
     2547  if (mainwin->userEventTabDlg && 
     2548      mainwin->userEventTabDlg->tabIsSelected(this)) 
     2549    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     2550#endif 
    25262551  setCaption(m_sBaseTitle); 
    25272552  cmbSendType->setCurrentItem(3); 
     
    27272752 
    27282753  m_sBaseTitle += tr(" - Chat Request"); 
     2754#if QT_VERSION >= 300 
     2755  if (mainwin->userEventTabDlg && 
     2756      mainwin->userEventTabDlg->tabIsSelected(this)) 
     2757    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     2758#endif 
    27292759  setCaption(m_sBaseTitle); 
    27302760  cmbSendType->setCurrentItem(2); 
     
    28772907 
    28782908  m_sBaseTitle += tr(" - Contact List"); 
     2909#if QT_VERSION >= 300 
     2910  if (mainwin->userEventTabDlg && 
     2911      mainwin->userEventTabDlg->tabIsSelected(this)) 
     2912    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     2913#endif 
    28792914  setCaption(m_sBaseTitle); 
    28802915  cmbSendType->setCurrentItem(4); 
     
    30293064 
    30303065  m_sBaseTitle += tr(" - SMS"); 
     3066#if QT_VERSION >= 300 
     3067  if (mainwin->userEventTabDlg && 
     3068      mainwin->userEventTabDlg->tabIsSelected(this)) 
     3069    mainwin->userEventTabDlg->setCaption(m_sBaseTitle); 
     3070#endif 
    30313071  setCaption(m_sBaseTitle); 
    30323072  cmbSendType->setCurrentItem(5);