Changeset 6139

Show
Ignore:
Timestamp:
04/10/08 02:50:04 (8 months ago)
Author:
flynd
Message:

Added option to not change status until away message dialog is closed. This closes #1421.

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

Legend:

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

    r6090 r6139  
    6464  iniFile.ReadStr("MsgPopupKey", szTemp, "none"); 
    6565  myMsgPopupKey = (strcmp(szTemp, "none") != 0 ? QString::fromLatin1(szTemp) : QString()); 
     66  iniFile.ReadBool("DelayStatusChange", myDelayStatusChange, false); 
    6667 
    6768  iniFile.SetSection("appearance"); 
     
    133134  iniFile.SetSection("functions"); 
    134135  iniFile.WriteStr("MsgPopupKey", myMsgPopupKey.isEmpty() ? "none" : myMsgPopupKey.toLatin1()); 
     136  iniFile.WriteBool("DelayStatusChange", myDelayStatusChange); 
    135137 
    136138  iniFile.SetSection("appearance"); 
     
    208210} 
    209211 
     212void Config::General::setDelayStatusChange(bool delayStatusChange) 
     213{ 
     214  if (delayStatusChange == myDelayStatusChange) 
     215    return; 
     216 
     217  myDelayStatusChange = delayStatusChange; 
     218} 
     219 
    210220void Config::General::setMsgPopupKey(QString msgPopupKey) 
    211221{ 
  • trunk/qt4-gui/src/config/general.h

    r6090 r6139  
    7878  bool useDoubleReturn() const { return myUseDoubleReturn; } 
    7979  QString msgPopupKey() const { return myMsgPopupKey; } 
     80  bool delayStatusChange() const { return myDelayStatusChange; } 
    8081  QFont defaultFont() const { return myDefaultFont; } 
    8182  QFont normalFont() const; 
     
    120121  void setUseDoubleReturn(bool useDoubleReturn); 
    121122  void setMsgPopupKey(QString msgPopupKey); 
     123  void setDelayStatusChange(bool delayStatusChange); 
    122124  void setNormalFont(QString normalFont); 
    123125  void setEditFont(QString editFont); 
     
    189191  bool myUseDoubleReturn; 
    190192  QString myMsgPopupKey; 
     193  bool myDelayStatusChange; 
    191194  QFont myDefaultFont; 
    192195  QFont myEditFont; 
  • trunk/qt4-gui/src/core/systemmenu.cpp

    r6054 r6139  
    445445{ 
    446446  unsigned long status = action->data().toUInt(); 
    447  
    448   if (status != ICQ_STATUS_OFFLINE && status != ICQ_STATUS_ONLINE) 
    449     AwayMsgDlg::showAwayMsgDlg(status, true); 
    450  
    451   LicqGui::instance()->changeStatus(status, myStatusInvisibleAction->isChecked()); 
     447  bool withMsg = (status != ICQ_STATUS_OFFLINE && status != ICQ_STATUS_ONLINE); 
     448  bool changeNow = !Config::General::instance()->delayStatusChange(); 
     449 
     450  if (withMsg) 
     451    AwayMsgDlg::showAwayMsgDlg(status, true, 0, myStatusInvisibleAction->isChecked(), !changeNow); 
     452 
     453  if (changeNow || !withMsg) 
     454    LicqGui::instance()->changeStatus(status, myStatusInvisibleAction->isChecked()); 
    452455} 
    453456 
     
    697700{ 
    698701  int status = action->data().toInt(); 
    699   if (status != ICQ_STATUS_OFFLINE && status != ICQ_STATUS_ONLINE) 
    700     AwayMsgDlg::showAwayMsgDlg(status, true); 
    701   LicqGui::instance()->changeStatus(status, myPpid, myStatusInvisibleAction->isChecked()); 
     702  bool withMsg = (status != ICQ_STATUS_OFFLINE && status != ICQ_STATUS_ONLINE); 
     703  bool changeNow = !Config::General::instance()->delayStatusChange(); 
     704 
     705  if (withMsg) 
     706    AwayMsgDlg::showAwayMsgDlg(status, true, myPpid, myStatusInvisibleAction->isChecked(), !changeNow); 
     707 
     708  if (changeNow || !withMsg) 
     709    LicqGui::instance()->changeStatus(status, myPpid, myStatusInvisibleAction->isChecked()); 
    702710} 
    703711 
  • trunk/qt4-gui/src/dialogs/awaymsgdlg.cpp

    r6068 r6139  
    4040#include <licq_user.h> 
    4141 
     42#include "core/licqgui.h" 
     43 
    4244#include "helpers/licqstrings.h" 
    4345#include "helpers/support.h" 
     
    5557AwayMsgDlg* AwayMsgDlg::myInstance = NULL; 
    5658 
    57 void AwayMsgDlg::showAwayMsgDlg(unsigned short status, bool autoClose) 
     59void AwayMsgDlg::showAwayMsgDlg(unsigned short status, bool autoClose, 
     60    unsigned long ppid, bool invisible, bool setStatus) 
    5861{ 
    5962  if (myInstance == NULL) 
     
    6265    myInstance->raise(); 
    6366 
    64   myInstance->selectAutoResponse(status, autoClose); 
     67  myInstance->selectAutoResponse(status, autoClose, ppid, invisible, setStatus); 
    6568} 
    6669 
     
    109112} 
    110113 
    111 void AwayMsgDlg::selectAutoResponse(unsigned short status, bool autoClose) 
     114void AwayMsgDlg::selectAutoResponse(unsigned short status, bool autoClose, 
     115    unsigned long ppid, bool invisible, bool setStatus) 
    112116{ 
    113117  switch (status & 0x00FF) 
     
    120124 
    121125  myStatus = status; 
     126  myInvisible = invisible; 
     127  myPpid = ppid; 
     128  mySetStatus = setStatus; 
    122129 
    123130  // Fill in the select menu 
     
    235242  myAutoCloseCounter = -1; 
    236243 
     244  if (mySetStatus) 
     245  { 
     246    if (myPpid == 0) 
     247      LicqGui::instance()->changeStatus(myStatus, myInvisible); 
     248    else 
     249      LicqGui::instance()->changeStatus(myStatus, myPpid, myInvisible); 
     250  } 
     251 
    237252  QString s = myAwayMsg->toPlainText().trimmed(); 
    238253 
  • trunk/qt4-gui/src/dialogs/awaymsgdlg.h

    r5811 r6139  
    4343   * @param status Status to prompt for away message to 
    4444   * @param autoClose True if dialog should close after a timeout 
     45   * @param ppid Protocol to set status for or 0 to change globaly 
     46   * @param invisible True if new status is also invisible 
     47   * @param setStatus True if status should be set when dialog is closed 
    4548   */ 
    46   static void showAwayMsgDlg(unsigned short status, bool autoClose = false); 
     49  static void showAwayMsgDlg(unsigned short status, bool autoClose = false, 
     50      unsigned long ppid = 0, bool invisible = false, bool setStatus = false); 
    4751 
    4852  static void showAutoResponseHints(QWidget* parent = 0); 
     
    5357  AwayMsgDlg(QWidget* parent = 0); 
    5458  ~AwayMsgDlg(); 
    55   void selectAutoResponse(unsigned short status, bool autoClose = false); 
     59  void selectAutoResponse(unsigned short status, bool autoClose = false, 
     60      unsigned long ppid = 0, bool invisible = false, bool setStatus = false); 
    5661 
    5762  MLEdit* myAwayMsg; 
     
    6166 
    6267  unsigned short myStatus; 
     68  bool myInvisible; 
     69  unsigned long myPpid; 
     70  bool mySetStatus; 
    6371  short mySAR; 
    6472  int myAutoCloseCounter; 
  • trunk/qt4-gui/src/settings/status.cpp

    r6134 r6139  
    6363  myPageStatusLayout->setContentsMargins(0, 0, 0, 0); 
    6464 
     65  myGeneralBox = new QGroupBox(tr("General Status Options")); 
     66  myGeneralLayout = new QVBoxLayout(myGeneralBox); 
     67 
     68  myDelayStatusChangeCheck = new QCheckBox(tr("Delay status changes")); 
     69  myDelayStatusChangeCheck->setToolTip(tr("Set status after closing the away message dialog instead of setting it directly.")); 
     70  myGeneralLayout->addWidget(myDelayStatusChangeCheck); 
     71 
    6572  myAutoLogonBox = new QGroupBox(tr("Startup")); 
    6673  myAutoLogonLayout = new QVBoxLayout(myAutoLogonBox); 
     
    120127  buildAutoStatusCombos(1); 
    121128 
     129  myPageStatusLayout->addWidget(myGeneralBox); 
    122130  myPageStatusLayout->addWidget(myAutoLogonBox); 
    123131  myPageStatusLayout->addWidget(myAutoAwayBox); 
     
    264272  Config::General* generalConfig = Config::General::instance(); 
    265273 
     274  myDelayStatusChangeCheck->setChecked(generalConfig->delayStatusChange()); 
    266275  myAutoAwaySpin->setValue(generalConfig->autoAwayTime()); 
    267276  myAutoNaSpin->setValue(generalConfig->autoNaTime()); 
     
    278287  generalConfig->blockUpdates(true); 
    279288 
     289  generalConfig->setDelayStatusChange(myDelayStatusChangeCheck->isChecked()); 
    280290  generalConfig->setAutoAwayTime(myAutoAwaySpin->value()); 
    281291  generalConfig->setAutoNaTime(myAutoNaSpin->value()); 
  • trunk/qt4-gui/src/settings/status.h

    r6091 r6139  
    7676 
    7777  // Widgets for status settings 
     78  QGroupBox* myGeneralBox; 
     79  QVBoxLayout* myGeneralLayout; 
     80  QCheckBox* myDelayStatusChangeCheck; 
    7881  QVBoxLayout* myPageStatusLayout; 
    7982  QGroupBox* myAutoLogonBox;