Changeset 6424 for trunk/qt4-gui/src

Show
Ignore:
Timestamp:
07/04/08 23:12:17 (5 months ago)
Author:
flynd
Message:

Always autofocus message window/tab if it's opened by the user.

Location:
trunk/qt4-gui/src/core
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/core/licqgui.cpp

    r6393 r6424  
    818818} 
    819819 
    820 UserEventCommon* LicqGui::showEventDialog(int fcn, QString id, unsigned long ppid, int convoId) 
     820UserEventCommon* LicqGui::showEventDialog(int fcn, QString id, unsigned long ppid, int convoId, bool autoPopup) 
    821821{ 
    822822  if (id.isEmpty() || ppid == 0) 
    823823    return NULL; 
    824824 
    825   // Check if a message window should be made active 
    826   bool activateMsgwin = Config::Chat::instance()->autoFocus(); 
    827  
    828   // Don't change focus if another message window is already active 
    829   const QWidget* activeWin = QApplication::activeWindow(); 
    830   if (activeWin != NULL && ((qobject_cast<const UserEventCommon*>(activeWin)) != NULL || 
    831       (qobject_cast<const UserEventTabDlg*>(activeWin)) != NULL)) 
    832     activateMsgwin = false; 
     825  // Focus the new window/tab after showing it 
     826  bool activateMsgwin = true; 
     827 
     828  if (autoPopup) 
     829  { 
     830    // Message is triggered by auto-popup (and not by user) so check if it 
     831    // really should be activated 
     832    activateMsgwin = Config::Chat::instance()->autoFocus(); 
     833 
     834    // Don't change focus if another message window is already active 
     835    const QWidget* activeWin = QApplication::activeWindow(); 
     836    if (activeWin != NULL && ((qobject_cast<const UserEventCommon*>(activeWin)) != NULL || 
     837        (qobject_cast<const UserEventTabDlg*>(activeWin)) != NULL)) 
     838      activateMsgwin = false; 
     839  } 
    833840 
    834841  if (Config::Chat::instance()->msgChatView()) 
     
    14831490 
    14841491            if (bCallSendMsg) 
    1485               showEventDialog(MessageEvent, id, ppid, sig->CID()); 
     1492              showEventDialog(MessageEvent, id, ppid, sig->CID(), true); 
    14861493            if (bCallUserView) 
    14871494              showViewEventDialog(id, ppid); 
  • trunk/qt4-gui/src/core/licqgui.h

    r6319 r6424  
    134134   * @param ppid Contact protocol id 
    135135   * @param convoId Conversation id 
    136    */ 
    137   UserEventCommon* showEventDialog(int fcn, QString id, unsigned long ppid, int convoId = -1); 
     136   * @param autoPopup True if the dialog was triggered automatically, false if triggered by the user 
     137   */ 
     138  UserEventCommon* showEventDialog(int fcn, QString id, unsigned long ppid, int convoId = -1, bool autoPopup = false); 
    138139 
    139140  /**