Changeset 6143

Show
Ignore:
Timestamp:
04/11/08 04:54:45 (8 months ago)
Author:
flynd
Message:

Changed 'Auto popup message' setting to be user configurable which statuses to allow it for. This closes #1416.

Location:
trunk/qt4-gui/src
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/config/chat.cpp

    r6142 r6143  
    9595  iniFile.SetSection("functions"); 
    9696  iniFile.ReadBool("AutoClose", myAutoClose, true); 
    97   iniFile.ReadBool("AutoPopup", myAutoPopup, false); 
     97  iniFile.ReadNum("AutoPopup", myAutoPopup, 0); 
    9898  iniFile.ReadBool("AutoFocus", myAutoFocus, true); 
    9999  iniFile.ReadBool("PopupAutoResponse", myPopupAutoResponse, true); 
     
    154154  iniFile.SetSection("functions"); 
    155155  iniFile.WriteBool("AutoClose", myAutoClose); 
    156   iniFile.WriteBool("AutoPopup", myAutoPopup); 
     156  iniFile.WriteNum("AutoPopup", myAutoPopup); 
    157157  iniFile.WriteBool("AutoFocus", myAutoFocus); 
    158158  iniFile.WriteBool("PopupAutoResponse", myPopupAutoResponse); 
     
    191191} 
    192192 
    193 void Config::Chat::setAutoPopup(bool autoPopup) 
     193void Config::Chat::setAutoPopup(unsigned short autoPopup) 
    194194{ 
    195195  if (autoPopup == myAutoPopup) 
  • trunk/qt4-gui/src/config/chat.h

    r6142 r6143  
    6767  // Get functions 
    6868  bool autoClose() const { return myAutoClose; } 
    69   bool autoPopup() const { return myAutoPopup; } 
     69  unsigned short autoPopup() const { return myAutoPopup; } 
    7070  bool autoFocus() const { return myAutoFocus; } 
    7171  bool manualNewUser() const { return myManualNewUser; } 
     
    117117  // Set functions 
    118118  void setAutoClose(bool autoClose); 
    119   void setAutoPopup(bool autoPopup); 
     119  void setAutoPopup(unsigned short autoPopup); 
    120120  void setAutoFocus(bool autoFocus); 
    121121  void setManualNewUser(bool manualNewUser); 
     
    165165 
    166166  bool myAutoFocus; 
    167   bool myAutoPopup; 
     167  unsigned short myAutoPopup; 
    168168  bool myAutoClose; 
    169169  bool myManualNewUser; 
  • trunk/qt4-gui/src/core/licqgui.cpp

    r6138 r6143  
    14801480        break; 
    14811481 
    1482       if (Config::Chat::instance()->autoPopup() && sig->Argument() > 0) 
    1483       { 
    1484         bool popCheck = false; 
     1482      if (sig->Argument() > 0) 
     1483      { 
     1484        unsigned short popCheck = 99; 
    14851485 
    14861486        ICQOwner* o = gUserManager.FetchOwner(ppid, LOCK_R); 
     
    14911491            case ICQ_STATUS_ONLINE: 
    14921492            case ICQ_STATUS_FREEFORCHAT: 
    1493               popCheck = true; 
    1494             default: 
    1495               gUserManager.DropOwner(ppid); 
     1493              popCheck = 1; 
     1494              break; 
     1495            case ICQ_STATUS_AWAY: 
     1496              popCheck = 2; 
     1497              break; 
     1498            case ICQ_STATUS_NA: 
     1499              popCheck = 3; 
     1500              break; 
     1501            case ICQ_STATUS_OCCUPIED: 
     1502              popCheck = 4; 
     1503              break; 
     1504            case ICQ_STATUS_DND: 
     1505              popCheck = 5; 
     1506              break; 
    14961507          } 
     1508          gUserManager.DropOwner(ppid); 
    14971509        } 
    14981510 
    1499         if (popCheck) 
     1511        if (Config::Chat::instance()->autoPopup() >= popCheck) 
    15001512        { 
    15011513          ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R); 
  • trunk/qt4-gui/src/settings/events.cpp

    r6091 r6143  
    2424 
    2525#include <QCheckBox> 
     26#include <QComboBox> 
    2627#include <QGridLayout> 
    2728#include <QGroupBox> 
     
    6970  myMsgActionsLayout->addWidget(myBoldOnMsgCheck, 0, 0); 
    7071 
    71   myAutoPopupCheck = new QCheckBox(tr("Auto-popup message")); 
    72   myAutoPopupCheck->setToolTip(tr("Open all incoming messages automatically when received if we are online (or free for chat)")); 
    73   myMsgActionsLayout->addWidget(myAutoPopupCheck, 1, 0); 
    74  
    7572  myAutoFocusCheck = new QCheckBox(tr("Auto-focus message")); 
    7673  myAutoFocusCheck->setToolTip(tr("Automatically focus opened message windows.")); 
    77   myMsgActionsLayout->addWidget(myAutoFocusCheck, 2, 0); 
     74  myMsgActionsLayout->addWidget(myAutoFocusCheck, 1, 0); 
    7875 
    7976  myAutoRaiseCheck = new QCheckBox(tr("Auto-raise main window")); 
    8077  myAutoRaiseCheck->setToolTip(tr("Raise the main window on incoming messages")); 
    81   myMsgActionsLayout->addWidget(myAutoRaiseCheck, 3, 0); 
     78  myMsgActionsLayout->addWidget(myAutoRaiseCheck, 2, 0); 
     79 
     80  QHBoxLayout* autoPopupLayout = new QHBoxLayout(); 
     81  QLabel* autoPopupLabel = new QLabel(tr("Auto-popup message:")); 
     82  autoPopupLayout->addWidget(autoPopupLabel); 
     83  myAutoPopupCombo = new QComboBox(); 
     84  myAutoPopupCombo->addItem(tr("Never")); 
     85  myAutoPopupCombo->addItem(tr("Only when online")); 
     86  myAutoPopupCombo->addItem(tr("When online or away")); 
     87  myAutoPopupCombo->addItem(tr("When online, away or N/A")); 
     88  myAutoPopupCombo->addItem(tr("Always except DND")); 
     89  myAutoPopupCombo->addItem(tr("Always")); 
     90  myAutoPopupCombo->setToolTip(tr("Select for which statuses incoming messages should " 
     91      "open automatically.\nOnline also includes Free for chat.")); 
     92  autoPopupLabel->setBuddy(myAutoPopupCombo); 
     93  autoPopupLayout->addWidget(myAutoPopupCombo); 
     94  myMsgActionsLayout->addLayout(autoPopupLayout, 3, 0); 
    8295 
    8396  myFlashTaskbarCheck = new QCheckBox(tr("Flash taskbar")); 
     
    292305  myFlashAllCheck->setChecked(flash == Config::ContactList::FlashAll); 
    293306 
    294   myAutoPopupCheck->setChecked(chatConfig->autoPopup()); 
     307  myAutoPopupCombo->setCurrentIndex(chatConfig->autoPopup()); 
    295308  myAutoFocusCheck->setChecked(chatConfig->autoFocus()); 
    296309  myFlashTaskbarCheck->setChecked(chatConfig->flashTaskbar()); 
     
    346359    contactListConfig->setFlash(Config::ContactList::FlashNone); 
    347360 
    348   chatConfig->setAutoPopup(myAutoPopupCheck->isChecked()); 
     361  chatConfig->setAutoPopup(myAutoPopupCombo->currentIndex()); 
    349362  chatConfig->setAutoFocus(myAutoFocusCheck->isChecked()); 
    350363  chatConfig->setFlashTaskbar(myFlashTaskbarCheck->isChecked()); 
  • trunk/qt4-gui/src/settings/events.h

    r6091 r6143  
    2626 
    2727class QCheckBox; 
     28class QComboBox; 
    2829class QGridLayout; 
    2930class QGroupBox; 
     
    8283  QCheckBox* myAlwaysOnlineNotifyCheck; 
    8384  QCheckBox* myBoldOnMsgCheck; 
    84   QCheckBox* myAutoPopupCheck; 
     85  QComboBox* myAutoPopupCombo; 
    8586  QCheckBox* myAutoRaiseCheck; 
    8687  QCheckBox* myAutoFocusCheck;