Ticket #1449: licq-4786-configurable_history.patch

File licq-4786-configurable_history.patch, 28.1 kB (added by flynd, 22 months ago)

Patch for improvments 1 and 4: Options to configure history separate from chat. Adds a new style (same as previous patch).

  • licq/plugins/qt-gui/src/mainwin.h

     
    161161       m_bShowHistory, 
    162162       m_bDisableDockIcon, 
    163163       m_bSortColumnAscending, 
    164        m_bAppendLineBreak, 
     164       m_chatVertSpacing, 
     165       m_chatAppendLineBreak, 
     166       m_histVertSpacing, 
    165167       m_bFlashTaskbar, 
    166168       m_bMainWinSticky, 
    167169       m_bMsgWinSticky, 
     
    179181  unsigned long m_nCurrentGroup, m_nGroupStates; 
    180182  unsigned short m_nSortByStatus, 
    181183                 m_nSortColumn, 
    182                  m_nMsgStyle; 
    183   QString m_nDateFormat; 
    184                   
     184                 m_chatMsgStyle, 
     185                 m_histMsgStyle; 
     186 
     187  QString m_chatDateFormat, 
     188          m_histDateFormat; 
     189 
    185190  QColor m_colorRcvHistory, 
    186191         m_colorSntHistory, 
    187192         m_colorRcv, 
  • licq/plugins/qt-gui/src/userinfodlg.cpp

     
    17251725  chkHistoryReverse->setFixedSize(chkHistoryReverse->sizeHint()); 
    17261726  l->addWidget(chkHistoryReverse); 
    17271727 
    1728   mlvHistory = new CMessageViewWidget(m_szId, m_nPPID, mainwin, p, "history"); 
    1729   mlvHistory->m_nMsgStyle = 4; /* STYLE_HISTORY */ 
     1728  mlvHistory = new CMessageViewWidget(m_szId, m_nPPID, mainwin, p, "history", true); 
    17301729 
    17311730  connect(mlvHistory, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); 
    17321731 
     
    20272026  barFiltering->setTotalSteps(NUM_MSG_PER_HISTORY); 
    20282027  char* ftxt = qstrdup(codec->fromUnicode(lneFilter->text())); 
    20292028  int flen = strlen(ftxt); 
    2030    
     2029 
     2030  QString ownerName; 
     2031  ICQOwner *o = gUserManager.FetchOwner(m_nPPID, LOCK_R); 
     2032  if (o != NULL) 
     2033  { 
     2034    // Don't use this codec to decode our conversation with the contact 
     2035    // since we're using the contact's encoding, not ours. 
     2036    QTextCodec *ownerCodec = UserCodec::codecForICQUser(o); 
     2037    ownerName = ownerCodec->toUnicode(o->GetAlias()); 
     2038    gUserManager.DropOwner(m_nPPID); 
     2039  } 
     2040 
    20312041  mlvHistory->clear(); 
    20322042  while (m_nHistoryShowing < (NUM_MSG_PER_HISTORY)) 
    20332043  { 
     
    20412051        messageText = codec->toUnicode((*tempIter)->Text()); 
    20422052 
    20432053      mlvHistory->addMsg((*tempIter)->Direction(), false, 
    2044                   EventDescription(*tempIter), 
     2054                  ((*tempIter)->SubCommand() == ICQ_CMDxSUB_MSG ? QString("") : (EventDescription(*tempIter) + " ")), 
    20452055                  date, 
    20462056                  (*tempIter)->IsDirect(), 
    20472057                  (*tempIter)->IsMultiRec(), 
    20482058                  (*tempIter)->IsUrgent(), 
    20492059                  (*tempIter)->IsEncrypted(), 
    2050                   contactName, 
     2060                  ((*tempIter)->Direction() == D_RECEIVER ? contactName : ownerName), 
    20512061                  MLView::toRichText(messageText, true, bUseHTML)); 
    20522062      m_nHistoryShowing++; 
    20532063      barFiltering->setProgress(m_nHistoryShowing); 
     
    20672077         break; 
    20682078    } 
    20692079  } 
     2080 
     2081  // History view is buffered so tell it write buffer to output now that all entries have been added 
     2082  mlvHistory->updateContent(); 
     2083 
    20702084  delete [] ftxt; 
    20712085  if(lneFilter->text().isEmpty()) 
    20722086    lblHistory->setText(tr("[<font color=\"%1\">Received</font>] " 
     
    20892103  if(!m_bHistoryReverse) 
    20902104    mlvHistory->GotoEnd(); 
    20912105  else 
    2092     mlvHistory->setCursorPosition(0, 0); 
     2106    mlvHistory->GotoHome(); 
    20932107  barFiltering->reset(); 
    20942108} 
    20952109 
  • licq/plugins/qt-gui/src/mlview.h

     
    3131 
    3232  void appendNoNewLine(const QString& s); 
    3333  void append(const QString& s); 
     34  void GotoHome(); 
    3435  void GotoEnd(); 
    3536 
    3637  bool hasMarkedText() const; 
  • licq/plugins/qt-gui/src/mlview.cpp

     
    156156  return text; 
    157157} 
    158158 
     159void MLView::GotoHome() 
     160{ 
     161  setContentsPos(0, 0); 
     162} 
     163 
    159164void MLView::GotoEnd() 
    160165{ 
    161166  moveCursor(QTextBrowser::MoveEnd, false); 
  • licq/plugins/qt-gui/src/ewidgets.h

     
    198198  unsigned long m_nUin; 
    199199  CMainWindow *mainwin; 
    200200public: 
     201  static const char *const styleNames[]; 
     202 
    201203  CMessageViewWidget(const char *szId, unsigned long nPPID, 
    202     CMainWindow *m, QWidget *parent = 0, const char *name = 0); 
     204    CMainWindow *m, QWidget *parent = 0, const char *name = 0, bool historyMode = false); 
    203205  CMessageViewWidget(unsigned long _nUin, CMainWindow *m, 
    204              QWidget* parent=0, const char * name =0); 
     206    QWidget* parent = 0, const char *name = 0, bool historyMode = false); 
    205207  virtual ~CMessageViewWidget(); 
    206208 
    207209  void setOwner(const char *szId); 
     210  void updateContent(); 
     211  void clear(); 
    208212  void addMsg(direction dir, bool fromHistory, QString eventDescription, QDateTime date,  
    209213    bool isDirect, bool isMultiRec, bool isUrgent, bool isEncrypted,  
    210214    QString contactName, QString messageText); 
     
    212216 
    213217  unsigned short m_nMsgStyle; 
    214218  QString m_nDateFormat; 
    215   bool m_bAppendLineBreak; 
     219  bool m_extraSpacing; 
     220  bool m_appendLineBreak; 
     221  bool m_useBuffer; 
    216222  QColor m_colorRcvHistory; 
    217223  QColor m_colorSntHistory; 
    218224  QColor m_colorRcv; 
     
    222228public slots: 
    223229  virtual void addMsg(CUserEvent *, const char * = 0, unsigned long = 0); 
    224230  void addMsg(ICQEvent *); 
     231 
     232private: 
     233  void internalAddMsg(QString s); 
     234  QString m_buffer; 
    225235}; 
    226236 
    227237/* ----------------------------------------------------------------------------- */ 
  • licq/plugins/qt-gui/src/optionsdlg.cpp

     
    212212  chkSysBack->setChecked(mainwin->m_bSystemBackground); 
    213213  chkSendFromClipboard->setChecked(mainwin->m_bSendFromClipboard); 
    214214  chkMsgChatView->setChecked(mainwin->m_bMsgChatView); 
    215  
    216   bool isCustomDate = true; 
    217   for (int i = 0; i < cmbDateFormat->count(); i++) 
    218   { 
    219     if (cmbDateFormat->text(i) == mainwin->m_nDateFormat) 
    220     { 
    221       cmbDateFormat->setCurrentItem(i); 
    222       isCustomDate = false; 
    223       break; 
    224     } 
    225   } 
    226  
    227   // Make sure the checkbox is actually toggled, so that widgets are enabled/disabled. 
    228   chkCustomDateFormat->setChecked(!isCustomDate); 
    229   chkCustomDateFormat->setChecked(isCustomDate); 
    230  
    231   customDateFormat->setText(mainwin->m_nDateFormat); 
    232  
    233   chkLineBreak->setChecked(mainwin->m_bAppendLineBreak); 
    234   cmbStyle->setCurrentItem(mainwin->m_nMsgStyle); 
     215  cmbChatDateFormat->lineEdit()->setText(mainwin->m_chatDateFormat); 
     216  chkChatVertSpacing->setChecked(mainwin->m_chatVertSpacing); 
     217  chkChatLineBreak->setChecked(mainwin->m_chatAppendLineBreak); 
     218  cmbChatStyle->setCurrentItem(mainwin->m_chatMsgStyle); 
     219  cmbHistStyle->setCurrentItem(mainwin->m_histMsgStyle); 
     220  chkHistVertSpacing->setChecked(mainwin->m_histVertSpacing); 
     221  cmbHistDateFormat->lineEdit()->setText(mainwin->m_histDateFormat); 
    235222  btnColorRcv->setPaletteBackgroundColor(mainwin->m_colorRcv); 
    236223  btnColorSnt->setPaletteBackgroundColor(mainwin->m_colorSnt); 
    237224  btnColorRcvHistory->setPaletteBackgroundColor(mainwin->m_colorRcvHistory); 
     
    527514  mainwin->m_bSystemBackground = chkSysBack->isChecked(); 
    528515  mainwin->m_bSendFromClipboard = chkSendFromClipboard->isChecked(); 
    529516  mainwin->m_bMsgChatView = chkMsgChatView->isChecked(); 
    530   mainwin->m_bAppendLineBreak = chkLineBreak->isChecked(); 
    531   mainwin->m_nMsgStyle = cmbStyle->currentItem(); 
    532   mainwin->m_nDateFormat = getCurrentDateFormat(); 
     517  mainwin->m_chatVertSpacing = chkChatVertSpacing->isChecked(); 
     518  mainwin->m_chatAppendLineBreak = chkChatLineBreak->isChecked(); 
     519  mainwin->m_chatMsgStyle = cmbChatStyle->currentItem(); 
     520  mainwin->m_chatDateFormat = cmbChatDateFormat->currentText(); 
     521  mainwin->m_histMsgStyle = cmbHistStyle->currentItem(); 
     522  mainwin->m_histVertSpacing = chkHistVertSpacing->isChecked(); 
     523  mainwin->m_histDateFormat = cmbHistDateFormat->currentText(); 
    533524  mainwin->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 
    534525  mainwin->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 
    535526  mainwin->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); 
     
    15661557  QVBox* boxRight = new QVBox(w); 
    15671558  lay->addWidget(boxRight); 
    15681559 
    1569   QGroupBox* boxOptions = new QGroupBox(1, Horizontal, tr("Options"), boxRight); 
     1560  QGroupBox* boxChatOptions = new QGroupBox(1, Horizontal, tr("Chat Options"), boxRight); 
    15701561 
    1571   new QLabel(tr("Style:"), boxOptions); 
    1572   cmbStyle = new QComboBox(false, boxOptions); 
    1573   cmbStyle->insertItem("Default"); 
    1574   cmbStyle->insertItem("Compact"); 
    1575   cmbStyle->insertItem("Tiny"); 
    1576   cmbStyle->insertItem("Table"); 
    1577   cmbStyle->insertItem("History"); 
    1578   connect(cmbStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1562  const char *const dateFormats[7] = { 
     1563      "hh:mm:ss", 
     1564      "yyyy-MM-dd hh:mm:ss", 
     1565      "yyyy-MM-dd", 
     1566      "yyyy/MM/dd hh:mm:ss", 
     1567      "yyyy/MM/dd", 
     1568      "dd.MM.yyyy hh:mm:ss", 
     1569      "dd.MM.yyyy"}; 
    15791570 
    1580   chkLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxOptions); 
    1581   connect(chkLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
     1571  new QLabel(tr("Style:"), boxChatOptions); 
     1572  cmbChatStyle = new QComboBox(false, boxChatOptions); 
     1573  for(int i = 0; i < 5; ++i) 
     1574    cmbChatStyle->insertItem(CMessageViewWidget::styleNames[i]); 
     1575  connect(cmbChatStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
    15821576 
    1583   new QLabel(tr("Date Format:"), boxOptions); 
    1584   cmbDateFormat = new QComboBox(false, boxOptions); 
    1585   cmbDateFormat->insertItem("hh:mm:ss"); 
    1586   cmbDateFormat->insertItem("yyyy-MM-dd hh:mm:ss"); 
    1587   cmbDateFormat->insertItem("yyyy-MM-dd"); 
    1588   cmbDateFormat->insertItem("yyyy/MM/dd hh:mm:ss"); 
    1589   cmbDateFormat->insertItem("yyyy/MM/dd"); 
    1590   cmbDateFormat->insertItem("dd.MM.yyyy hh:mm:ss"); 
    1591   cmbDateFormat->insertItem("dd.MM.yyyy"); 
    1592   connect(cmbDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1577  chkChatVertSpacing = new QCheckBox(tr("Insert Vertical Spacing"), boxChatOptions); 
     1578  connect(chkChatVertSpacing, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
    15931579 
    1594   chkCustomDateFormat = new QCheckBox(tr("Custom Date Format:"), boxOptions); 
    1595   connect(chkCustomDateFormat, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
    1596   connect(chkCustomDateFormat, SIGNAL(toggled(bool)), cmbDateFormat, SLOT(setDisabled(bool))); 
     1580  chkChatLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxChatOptions); 
     1581  connect(chkChatLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
    15971582 
    1598   customDateFormat = new QLineEdit(boxOptions); 
    1599   connect(chkCustomDateFormat, SIGNAL(toggled(bool)), customDateFormat, SLOT(setEnabled(bool))); 
    1600   connect(customDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); 
    1601   QWhatsThis::add(customDateFormat, tr( 
     1583  new QLabel(tr("Date Format:"), boxChatOptions); 
     1584  cmbChatDateFormat = new QComboBox(true, boxChatOptions); 
     1585  for(int i = 0; i < 7; ++i) 
     1586    cmbChatDateFormat->insertItem(dateFormats[i]); 
     1587  connect(cmbChatDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1588  connect(cmbChatDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); 
     1589 
     1590  QString helpDateFormat = tr( 
    16021591      "<p>Available custom date format variables.</p>\n" 
    16031592      "<table>\n" 
    16041593      "<tr><th>Expression</th><th>Output</th></tr>\n" 
     
    16231612      "<tr><td>zzz</td><td>the millisecond with leading zero (000..999)</td></tr>\n" 
    16241613      "<tr><td>AP</td><td>use AM/PM display. AP will be replaced by either 'AM' or 'PM'</td></tr>\n" 
    16251614      "<tr><td>ap</td><td>use am/pm display. ap will be replaced by either 'am' or 'pm'</td></tr>\n" 
    1626       "</table>")); 
     1615      "</table>"); 
    16271616 
     1617  QWhatsThis::add(cmbChatDateFormat, helpDateFormat); 
     1618 
     1619  QGroupBox* boxHistOptions = new QGroupBox(1, Horizontal, tr("History Options"), boxRight); 
     1620  new QLabel(tr("Style:"), boxHistOptions); 
     1621  cmbHistStyle = new QComboBox(false, boxHistOptions); 
     1622  for(int i = 0; i < 6; ++i) 
     1623    cmbHistStyle->insertItem(CMessageViewWidget::styleNames[i]); 
     1624  connect(cmbHistStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1625 
     1626  chkHistVertSpacing = new QCheckBox(tr("Insert Vertical Spacing"), boxHistOptions); 
     1627  connect(chkHistVertSpacing, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
     1628 
     1629  new QLabel(tr("Date Format:"), boxHistOptions); 
     1630  cmbHistDateFormat = new QComboBox(true, boxHistOptions); 
     1631  for(int i = 0; i < 7; ++i) 
     1632    cmbHistDateFormat->insertItem(dateFormats[i]); 
     1633  connect(cmbHistDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1634  connect(cmbHistDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); 
     1635  QWhatsThis::add(cmbHistDateFormat, helpDateFormat); 
     1636 
     1637 
    16281638  QGroupBox *boxColors = new QGroupBox(2, Horizontal, tr("Colors"), boxRight); 
    16291639 
    16301640  new QLabel(tr("Message Received:"), boxColors); 
     
    16631673  tabViewer = new QTabWidget(w); 
    16641674  lay->addWidget(tabViewer); 
    16651675 
    1666   msgViewer = new CMessageViewWidget(0, gMainWindow, tabViewer); 
    1667   tabViewer->insertTab(msgViewer, "Marge"); 
     1676  msgChatViewer = new CMessageViewWidget(0, gMainWindow, tabViewer); 
     1677  tabViewer->insertTab(msgChatViewer, "Marge"); 
    16681678 
     1679  msgHistViewer = new CMessageViewWidget(0, gMainWindow, tabViewer, 0, true); 
     1680  tabViewer->insertTab(msgHistViewer, "History"); 
     1681 
    16691682  lay->activate(); 
    16701683 
    16711684  return w; 
    16721685} 
    16731686 
    1674 QString OptionsDlg::getCurrentDateFormat() const 
    1675 { 
    1676   if (chkCustomDateFormat->isChecked()) 
    1677     return customDateFormat->text(); 
    1678   else 
    1679     return cmbDateFormat->currentText(); 
    1680 } 
    1681  
    16821687void OptionsDlg::slot_refresh_msgViewer() 
    16831688{ 
    16841689  // Don't update the time at every refresh 
     
    16961701      QT_TR_NOOP("Marge has left the conversation.") 
    16971702  }; 
    16981703 
    1699   msgViewer->m_nMsgStyle = cmbStyle->currentItem(); 
    1700   msgViewer->m_bAppendLineBreak = chkLineBreak->isChecked(); 
    1701   msgViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 
    1702   msgViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 
    1703   msgViewer->m_colorSntHistory = btnColorSntHistory->paletteBackgroundColor(); 
    1704   msgViewer->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); 
    1705   msgViewer->m_colorNotice = btnColorNotice->paletteBackgroundColor(); 
     1704  msgChatViewer->m_nMsgStyle = cmbChatStyle->currentItem(); 
     1705  msgChatViewer->m_extraSpacing = chkChatVertSpacing->isChecked(); 
     1706  msgChatViewer->m_appendLineBreak = chkChatLineBreak->isChecked(); 
     1707  msgChatViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 
     1708  msgChatViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 
     1709  msgChatViewer->m_colorSntHistory = btnColorSntHistory->paletteBackgroundColor(); 
     1710  msgChatViewer->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); 
     1711  msgChatViewer->m_colorNotice = btnColorNotice->paletteBackgroundColor(); 
    17061712  tabViewer->setPaletteForegroundColor(btnColorTypingLabel->paletteBackgroundColor()); 
    1707   msgViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 
     1713  msgChatViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 
    17081714 
    1709   msgViewer->m_nDateFormat = getCurrentDateFormat(); 
     1715  msgChatViewer->m_nDateFormat = cmbChatDateFormat->currentText(); 
    17101716 
    1711   msgViewer->clear(); 
     1717  msgHistViewer->m_nMsgStyle = cmbHistStyle->currentItem(); 
     1718  msgHistViewer->m_extraSpacing = chkHistVertSpacing->isChecked(); 
     1719  msgHistViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 
     1720  msgHistViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 
     1721  msgHistViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 
     1722  msgHistViewer->m_nDateFormat = cmbHistDateFormat->currentText(); 
     1723 
     1724  msgChatViewer->clear(); 
     1725  msgHistViewer->clear(); 
    17121726  for (unsigned int i = 0; i<7; i++) 
    17131727  { 
    1714     msgViewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, (i<2), 
     1728    msgChatViewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, (i<2), 
    17151729          QString(""), 
    17161730          date, 
    17171731          true, false, false, false,  
    17181732          names[i % 2], 
    17191733          MLView::toRichText(tr(msgs[i]), true, true)); 
     1734 
     1735    msgHistViewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, false, 
     1736          QString(""), 
     1737          date, 
     1738          true, false, false, false, 
     1739          names[i % 2], 
     1740          MLView::toRichText(tr(msgs[i]), true, true)); 
    17201741  } 
    1721   msgViewer->addNotice(date, MLView::toRichText(tr(msgs[7]), true, true)); 
     1742  msgChatViewer->addNotice(date, MLView::toRichText(tr(msgs[7]), true, true)); 
     1743 
     1744  msgHistViewer->updateContent(); 
    17221745} 
    17231746 
    17241747CColorOption::CColorOption (QWidget* parent) 
  • licq/plugins/qt-gui/src/mainwin.cpp

     
    432432  licqConf.ReadBool("AutoPosReplyWin", m_bAutoPosReplyWin, true); 
    433433  licqConf.ReadBool("AutoSendThroughServer", m_bAutoSendThroughServer, false); 
    434434  licqConf.ReadBool("EnableMainwinMouseMovement", m_bEnableMainwinMouseMovement, true); 
    435   licqConf.ReadNum("ChatMessageStyle", m_nMsgStyle, 0); 
    436   licqConf.ReadBool("ChatAppendLinebreak", m_bAppendLineBreak, false); 
     435  licqConf.ReadNum("ChatMessageStyle", m_chatMsgStyle, 0); 
     436  licqConf.ReadBool("ChatVerticalSpacing", m_chatVertSpacing, true); 
     437  licqConf.ReadBool("ChatAppendLinebreak", m_chatAppendLineBreak, false); 
    437438  licqConf.ReadBool("FlashTaskbar", m_bFlashTaskbar, true); 
    438439  licqConf.ReadBool("ShowUserIcons", m_bShowUserIcons, true); 
    439440  licqConf.ReadBool("MainWinSticky", m_bMainWinSticky, false); 
     
    441442  licqConf.ReadBool("SingleLineChatMode", m_bSingleLineChatMode, false); 
    442443  licqConf.ReadBool("CheckSpellingEnabled", m_bCheckSpellingEnabled, false); 
    443444  licqConf.ReadStr("DateFormat", szTemp, "hh:mm:ss"); 
    444   m_nDateFormat = QString::fromLatin1(szTemp); 
     445  m_chatDateFormat = QString::fromLatin1(szTemp); 
     446  licqConf.ReadNum("HistoryMessageStyle", m_histMsgStyle, 0); 
     447  licqConf.ReadBool("HistoryVerticalSpacing", m_histVertSpacing, true); 
     448  licqConf.ReadStr("HistoryDateFormat", szTemp, "yyyy-MM-dd hh:mm:ss"); 
     449  m_histDateFormat = QString::fromLatin1(szTemp); 
    445450 
    446451  licqConf.ReadStr("ReceiveMessageColor", szTemp, "red"); 
    447452  m_colorRcv = QColor(szTemp); 
     
    35763581  licqConf.WriteBool("SingleLineChatMode", m_bSingleLineChatMode); 
    35773582  licqConf.WriteBool("CheckSpellingEnabled", m_bCheckSpellingEnabled); 
    35783583 
    3579   licqConf.WriteNum("ChatMessageStyle", m_nMsgStyle); 
    3580   licqConf.WriteBool("ChatAppendLinebreak", m_bAppendLineBreak); 
     3584  licqConf.WriteNum("ChatMessageStyle", m_chatMsgStyle); 
     3585  licqConf.WriteBool("ChatVerticalSpacing", m_chatVertSpacing); 
     3586  licqConf.WriteBool("ChatAppendLinebreak", m_chatAppendLineBreak); 
    35813587  licqConf.WriteStr("ReceiveMessageColor", m_colorRcv.name()); 
    35823588  licqConf.WriteStr("ReceiveHistoryColor", m_colorRcvHistory.name()); 
    35833589  licqConf.WriteStr("SentMessageColor", m_colorSnt.name()); 
     
    35863592  licqConf.WriteStr("TabFontColor", m_colorTab.name()); 
    35873593  licqConf.WriteStr("TabOnTypingColor", m_colorTabTyping.name()); 
    35883594  licqConf.WriteStr("ChatBackground", m_colorChatBkg.name()); 
    3589   licqConf.WriteStr("DateFormat", m_nDateFormat.latin1()); 
     3595  licqConf.WriteStr("DateFormat", m_chatDateFormat.latin1()); 
     3596  licqConf.WriteNum("HistoryMessageStyle", m_histMsgStyle); 
     3597  licqConf.WriteBool("HistoryVerticalSpacing", m_histVertSpacing); 
     3598  licqConf.WriteStr("HistoryDateFormat", m_histDateFormat.latin1()); 
    35903599 
    35913600  licqConf.WriteBool("showPopPicture", m_bPopPicture); 
    35923601  licqConf.WriteBool("showPopAlias", m_bPopAlias); 
  • licq/plugins/qt-gui/src/ewidgets.cpp

     
    661661// ----------------------------------------------------------------------------- 
    662662 
    663663//- Message View Widget --------------------------------------------------------- 
     664 
     665// Names of the message styles 
     666const char *const CMessageViewWidget::styleNames[] = { 
     667    "Default", 
     668    "Compact", 
     669    "Tiny", 
     670    "Table", 
     671    "Long", 
     672    "Wide"}; 
     673 
     674 
    664675CMessageViewWidget::CMessageViewWidget(const char *szId, unsigned long nPPID, 
    665   CMainWindow *m, QWidget* parent, const char * name) 
     676  CMainWindow *m, QWidget* parent, const char *name, bool historyMode) 
    666677  : CHistoryWidget(parent, name) 
    667678{ 
    668679  m_szId = szId ? strdup(szId) : 0; 
    669680  m_nPPID = nPPID; 
    670   m_nMsgStyle = m->m_nMsgStyle; 
    671   m_nDateFormat = m->m_nDateFormat; 
    672   m_bAppendLineBreak = m->m_bAppendLineBreak; 
     681  if (historyMode) 
     682  { 
     683    m_useBuffer = true; 
     684    m_nMsgStyle = m->m_histMsgStyle; 
     685    m_nDateFormat = m->m_histDateFormat; 
     686    m_extraSpacing = m->m_histVertSpacing; 
     687    m_appendLineBreak = false; 
     688  } 
     689  else 
     690  { 
     691    m_useBuffer = false; 
     692    m_nMsgStyle = m->m_chatMsgStyle; 
     693    m_nDateFormat = m->m_chatDateFormat; 
     694    m_extraSpacing = m->m_chatVertSpacing; 
     695    m_appendLineBreak = m->m_chatAppendLineBreak; 
     696  } 
    673697  m_colorRcv = m->m_colorRcv; 
    674698  m_colorSnt = m->m_colorSnt; 
    675699  m_colorRcvHistory = m->m_colorRcvHistory; 
     
    697721*/ 
    698722} 
    699723 
    700 CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget* parent, const char * name) 
     724CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget *parent, const char *name, bool historyMode) 
    701725:CHistoryWidget(parent,name) 
    702726{ 
    703727  m_nUin= _nUin; 
    704728  m_szId = NULL; // avoid desalocation error at destructor 
    705   m_nMsgStyle = m->m_nMsgStyle; 
    706   m_nDateFormat = m->m_nDateFormat; 
    707   m_bAppendLineBreak = m->m_bAppendLineBreak; 
     729  if (historyMode) 
     730  { 
     731    m_useBuffer = true; 
     732    m_nMsgStyle = m->m_histMsgStyle; 
     733    m_nDateFormat = m->m_histDateFormat; 
     734    m_extraSpacing = m->m_histVertSpacing; 
     735    m_appendLineBreak = false; 
     736  } 
     737  else 
     738  { 
     739    m_useBuffer = false; 
     740    m_nMsgStyle = m->m_chatMsgStyle; 
     741    m_nDateFormat = m->m_chatDateFormat; 
     742    m_extraSpacing = m->m_chatVertSpacing; 
     743    m_appendLineBreak = m->m_chatAppendLineBreak; 
     744  } 
    708745  m_colorRcv = m->m_colorRcv; 
    709746  m_colorSnt = m->m_colorSnt; 
    710747  m_colorRcvHistory = m->m_colorRcvHistory; 
     
    745782  m_szId = strdup(_szId); 
    746783} 
    747784 
     785void CMessageViewWidget::clear() 
     786{ 
     787  CHistoryWidget::clear(); 
     788 
     789  m_buffer = ""; 
     790 
     791  switch (m_nMsgStyle) 
     792  { 
     793    case 5: 
     794      // table doesn't work when appending so must buffer when using this style 
     795      m_buffer.append("<table border=\"0\">"); 
     796      m_useBuffer = true; 
     797      break; 
     798  } 
     799  if (m_useBuffer) 
     800    m_buffer.prepend("<html><body>"); 
     801} 
     802 
     803void CMessageViewWidget::updateContent() 
     804{ 
     805  if (m_useBuffer == false) 
     806    return; 
     807  setText(m_buffer); 
     808} 
     809 
     810void CMessageViewWidget::internalAddMsg(QString s) 
     811{ 
     812  if (m_extraSpacing) 
     813  { 
     814    if (m_nMsgStyle != 5) 
     815    { 
     816      if (m_useBuffer) 
     817      { 
     818        s.prepend("<p>"); 
     819        s.append("</p>"); 
     820      } 
     821      else 
     822      { 
     823        s.append("<br>"); 
     824      } 
     825    } 
     826    else 
     827    { 
     828      s.append("<tr><td colspan=\"3\"></td></tr>"); 
     829    } 
     830  } 
     831 
     832  if (m_useBuffer) 
     833  { 
     834    if (m_extraSpacing == false && m_nMsgStyle != 5) 
     835      s.append("<br>"); 
     836 
     837    m_buffer.append(s); 
     838    if (m_appendLineBreak) 
     839      m_buffer.append("<hr>"); 
     840  } 
     841  else 
     842  { 
     843    append(s); 
     844    if (m_appendLineBreak) 
     845      append("<hr>"); 
     846  } 
     847} 
     848 
    748849void CMessageViewWidget::addMsg(ICQEvent * _e) 
    749850{ 
    750851  if (strcmp(_e->Id(), m_szId) == 0 && _e->PPID() == m_nPPID && 
     
    758859{ 
    759860  QString s; 
    760861  QString color; 
    761   bool bAIM = (m_nPPID == LICQ_PPID) && !isdigit(m_szId[0]); 
    762862 
    763863  if (fromHistory)  
    764864    if (dir == D_RECEIVER)  
     
    784884   
    785885  switch (m_nMsgStyle) { 
    786886    case 0: 
    787       s = QString("<html><body><font color=\"%1\"><b>%2%3 [%4%5%6%7] %8:</b></font><br>") 
     887      s = QString("<font color=\"%1\"><b>%2%3 [%4%5%6%7] %8:</b></font><br>") 
    788888                  .arg(color) 
    789889                  .arg(eventDescription) 
    790890                  .arg(my_date) 
     
    793893                  .arg(isUrgent ? 'U' : '-') 
    794894                  .arg(isEncrypted ? 'E' : '-') 
    795895                  .arg(contactName); 
    796       s.append(QString("<font color=\"%1\">%2</font></body></html>") 
     896      s.append(QString("<font color=\"%1\">%2</font>") 
    797897                      .arg(color) 
    798898                      .arg(messageText)); 
    799899      break; 
     
    810910      s.append(QString("<font color=\"%1\">%2</font>") 
    811911                      .arg(color) 
    812912                      .arg(messageText)); 
    813       if (bAIM) 
    814       { 
    815         s.prepend("<html><body>"); 
    816         s.append("</body></html>"); 
    817       } 
    818  
    819913      break; 
    820914    case 2: 
    821915      s = QString("<font color=\"%1\"><b>%2%3 - %4: </b></font>") 
     
    826920      s.append(QString("<font color=\"%1\">%2</font>") 
    827921                      .arg(color) 
    828922                      .arg(messageText)); 
    829  
    830       if (bAIM) 
    831       { 
    832         s.prepend("<html><body>"); 
    833         s.append("</body></html>"); 
    834       } 
    835  
    836923      break;   
    837924    case 3: 
    838925      s = QString("<table border=\"1\"><tr><td><b><font color=\"%1\">%2%3</font><b><td><b><font color=\"%4\">%5</font></b></font></td>") 
     
    864951                  .arg(color) 
    865952                  .arg(messageText)); 
    866953    break;      
     954 
     955    case 5: 
     956      // Mode 5 is a table so it cannot be displayed in paragraphs 
     957      s = QString("<tr><td><nobr><b><font color=\"%1\">%2</font><b></nobr></td>") 
     958                  .arg(color) 
     959                  .arg(my_date); 
     960      s.append(QString("<td><b><font color=\"%3\">%4</font></b></font></td>") 
     961                       .arg(color) 
     962                       .arg(contactName)); 
     963      s.append(QString("<td><font color=\"%1\">%2</font></td></tr>") 
     964                      .arg(color) 
     965                      .arg(messageText)); 
     966      break; 
    867967  } 
    868    
    869   append(s); 
    870   if (m_bAppendLineBreak) { 
    871     append("<hr>"); 
    872   } 
     968 
     969  internalAddMsg(s); 
    873970} 
    874971 
    875972void CMessageViewWidget::addMsg(CUserEvent* e, const char *_szId, unsigned long _nPPID) 
     
    9881085                  .arg(messageText); 
    9891086      break;  
    9901087 
     1088    case 5: 
     1089      s = QString("<tr><td><b><font color=\"%1\">%2</font><b></td><td colspan=\"2\"><b><font color=\"%3\">%4</font></b></font></td></tr>") 
     1090                  .arg(color) 
     1091