Changeset 4791

Show
Ignore:
Timestamp:
11/30/06 03:02:49 (23 months ago)
Author:
erijo
Message:

Patch from Anders Olofsson to make the history layout configurable. Also adds a new style format that can be used in the history. Fixes part of #1449.

With this commit, <font> tags are removed before the message is displayed. This means that the sender can no longer choose the font or color to show the message in. IMHO, this is a good thing. But if you have an other opinion, speak up and maybe I'll make it configurable.

Location:
trunk/qt-gui/src
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt-gui/src/ewidgets.cpp

    r4788 r4791  
    4545#include <qlayout.h> 
    4646#include <qheader.h> 
     47#include <qstringlist.h> 
    4748#include <ctype.h> 
    4849#include <algorithm> 
     
    662663 
    663664//- Message View Widget --------------------------------------------------------- 
     665 
     666QStringList CMessageViewWidget::getStyleNames(bool includeHistoryStyles) 
     667{ 
     668  static const char *const styleNames[] = { 
     669    QT_TR_NOOP("Default"), 
     670    QT_TR_NOOP("Compact"), 
     671    QT_TR_NOOP("Tiny"), 
     672    QT_TR_NOOP("Table"), 
     673    QT_TR_NOOP("Long"), 
     674    QT_TR_NOOP("Wide") 
     675  }; 
     676 
     677  int listLength; 
     678 
     679  // Style 5 (Wide) is currently only supported in buffered mode which is not used for chat 
     680  if(includeHistoryStyles) 
     681    listLength = 6; 
     682  else 
     683    listLength = 5; 
     684 
     685  QStringList styleList; 
     686  for(int i = 0; i < listLength; ++i) 
     687    styleList.append(tr(styleNames[i])); 
     688 
     689  return styleList; 
     690} 
     691 
    664692CMessageViewWidget::CMessageViewWidget(const char *szId, unsigned long nPPID, 
    665   CMainWindow *m, QWidget* parent, const char * name) 
     693  CMainWindow *m, QWidget* parent, const char *name, bool historyMode) 
    666694  : CHistoryWidget(parent, name) 
    667695{ 
    668696  m_szId = szId ? strdup(szId) : 0; 
    669697  m_nPPID = nPPID; 
    670   m_nMsgStyle = m->m_nMsgStyle; 
    671   m_nDateFormat = m->m_nDateFormat; 
    672   m_bAppendLineBreak = m->m_bAppendLineBreak; 
     698  if (historyMode) 
     699  { 
     700    m_useBuffer = true; 
     701    m_nMsgStyle = m->m_histMsgStyle; 
     702    m_nDateFormat = m->m_histDateFormat; 
     703    m_extraSpacing = m->m_histVertSpacing; 
     704    m_appendLineBreak = false; 
     705  } 
     706  else 
     707  { 
     708    m_useBuffer = false; 
     709    m_nMsgStyle = m->m_chatMsgStyle; 
     710    m_nDateFormat = m->m_chatDateFormat; 
     711    m_extraSpacing = m->m_chatVertSpacing; 
     712    m_appendLineBreak = m->m_chatAppendLineBreak; 
     713  } 
    673714  m_colorRcv = m->m_colorRcv; 
    674715  m_colorSnt = m->m_colorSnt; 
     
    679720  mainwin = m; 
    680721 
     722  clear(); 
     723 
    681724/* 
    682725  // add all unread messages. 
     
    698741} 
    699742 
    700 CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget* parent, const char * name) 
     743CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget *parent, const char *name, bool historyMode) 
    701744:CHistoryWidget(parent,name) 
    702745{ 
    703746  m_nUin= _nUin; 
    704747  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; 
     748  if (historyMode) 
     749  { 
     750    m_useBuffer = true; 
     751    m_nMsgStyle = m->m_histMsgStyle; 
     752    m_nDateFormat = m->m_histDateFormat; 
     753    m_extraSpacing = m->m_histVertSpacing; 
     754    m_appendLineBreak = false; 
     755  } 
     756  else 
     757  { 
     758    m_useBuffer = false; 
     759    m_nMsgStyle = m->m_chatMsgStyle; 
     760    m_nDateFormat = m->m_chatDateFormat; 
     761    m_extraSpacing = m->m_chatVertSpacing; 
     762    m_appendLineBreak = m->m_chatAppendLineBreak; 
     763  } 
    708764  m_colorRcv = m->m_colorRcv; 
    709765  m_colorSnt = m->m_colorSnt; 
     
    713769  setPaletteBackgroundColor(m->m_colorChatBkg); 
    714770  mainwin = m; 
     771 
     772  clear(); 
     773 
    715774/* 
    716775  // add all unread messages. 
     
    746805} 
    747806 
     807void CMessageViewWidget::clear() 
     808{ 
     809  CHistoryWidget::clear(); 
     810 
     811  m_buffer = ""; 
     812 
     813  switch (m_nMsgStyle) 
     814  { 
     815    case 5: 
     816      // table doesn't work when appending so must buffer when using this style 
     817      m_buffer.append("<table border=\"0\">"); 
     818      m_useBuffer = true; 
     819      break; 
     820  } 
     821  if (m_useBuffer) 
     822    m_buffer.prepend("<html><body>"); 
     823} 
     824 
     825void CMessageViewWidget::updateContent() 
     826{ 
     827  if (m_useBuffer) 
     828    setText(m_buffer); 
     829} 
     830 
     831void CMessageViewWidget::internalAddMsg(QString s) 
     832{ 
     833  if (m_extraSpacing) 
     834  { 
     835    if (m_nMsgStyle != 5) 
     836    { 
     837      if (m_useBuffer) 
     838      { 
     839        s.prepend("<p>"); 
     840        s.append("</p>"); 
     841      } 
     842      else 
     843      { 
     844        s.append("<br>"); 
     845      } 
     846    } 
     847    else 
     848    { 
     849      s.append("<tr><td colspan=\"3\"></td></tr>"); 
     850    } 
     851  } 
     852 
     853  if (m_useBuffer) 
     854  { 
     855    if (!m_extraSpacing && m_nMsgStyle != 5) 
     856      s.append("<br>"); 
     857 
     858    m_buffer.append(s); 
     859    if (m_appendLineBreak) 
     860      m_buffer.append("<hr>"); 
     861  } 
     862  else 
     863  { 
     864    append(s); 
     865    if (m_appendLineBreak) 
     866      append("<hr>"); 
     867  } 
     868} 
     869 
    748870void CMessageViewWidget::addMsg(ICQEvent * _e) 
    749871{ 
     
    759881  QString s; 
    760882  QString color; 
    761   bool bAIM = (m_nPPID == LICQ_PPID) && !isdigit(m_szId[0]); 
    762  
    763   if (fromHistory)  
     883 
     884  if (fromHistory) 
     885  { 
    764886    if (dir == D_RECEIVER)  
    765887      color = m_colorRcvHistory.name(); 
    766888    else  
    767       color = m_colorSntHistory.name();   
     889      color = m_colorSntHistory.name(); 
     890  } 
    768891  else 
     892  { 
    769893    if (dir == D_RECEIVER)  
    770894      color = m_colorRcv.name(); 
    771895    else  
    772       color = m_colorSnt.name();   
    773    
    774   /* Remove trailing line breaks. */ 
    775   for (unsigned int i = messageText.length() - 1; i>=0; i--) { 
    776     if (messageText.at(i) == '\n' || messageText.at(i) == '\r') { 
     896      color = m_colorSnt.name(); 
     897  } 
     898 
     899  // Remove trailing line breaks. 
     900  for (int i = messageText.length(); i >= 0; i--) 
     901  { 
     902    if (messageText.at(i - 1) != '\n' && messageText.at(i - 1) != '\r') 
     903    { 
    777904      messageText.truncate(i); 
    778     } else { 
    779905      break; 
    780906    } 
    781907  } 
    782       
     908 
     909  // Extract everything inside <body>...</body> 
     910  // Leaving <html> and <body> messes with our message display 
     911  QRegExp body("<body[^>]*>(.*)</body>"); 
     912  if (body.search(messageText) != -1) 
     913    messageText = body.cap(1); 
     914 
     915  // Remove all font tags 
     916  messageText.replace(QRegExp("</?font[^>]*>"), ""); 
     917 
    783918  QString my_date = date.toString( m_nDateFormat ); 
    784    
     919 
    785920  switch (m_nMsgStyle) { 
    786921    case 0: 
    787       s = QString("<html><body><font color=\"%1\"><b>%2%3 [%4%5%6%7] %8:</b></font><br>") 
     922      s = QString("<font color=\"%1\"><b>%2%3 [%4%5%6%7] %8:</b></font><br>") 
    788923                  .arg(color) 
    789924                  .arg(eventDescription) 
     
    794929                  .arg(isEncrypted ? 'E' : '-') 
    795930                  .arg(contactName); 
    796       s.append(QString("<font color=\"%1\">%2</font></body></html>") 
     931      s.append(QString("<font color=\"%1\">%2</font>") 
    797932                      .arg(color) 
    798933                      .arg(messageText)); 
     
    811946                      .arg(color) 
    812947                      .arg(messageText)); 
    813       if (bAIM) 
    814       { 
    815         s.prepend("<html><body>"); 
    816         s.append("</body></html>"); 
    817       } 
    818  
    819948      break; 
    820949    case 2: 
     
    827956                      .arg(color) 
    828957                      .arg(messageText)); 
    829  
    830       if (bAIM) 
    831       { 
    832         s.prepend("<html><body>"); 
    833         s.append("</body></html>"); 
    834       } 
    835  
    836958      break;   
    837959    case 3: 
     
    864986                  .arg(color) 
    865987                  .arg(messageText)); 
    866     break;      
    867   } 
    868    
    869   append(s); 
    870   if (m_bAppendLineBreak) { 
    871     append("<hr>"); 
    872   } 
     988      break; 
     989    case 5: 
     990      // Mode 5 is a table so it cannot be displayed in paragraphs 
     991      s = QString("<tr><td><nobr><b><font color=\"%1\">%2</font><b></nobr></td>") 
     992                  .arg(color) 
     993                  .arg(my_date); 
     994      s.append(QString("<td><b><font color=\"%3\">%4</font></b></font></td>") 
     995                       .arg(color) 
     996                       .arg(contactName)); 
     997      s.append(QString("<td><font color=\"%1\">%2</font></td></tr>") 
     998                      .arg(color) 
     999                      .arg(messageText)); 
     1000      break; 
     1001  } 
     1002 
     1003  internalAddMsg(s); 
    8731004} 
    8741005 
     
    9891120      break;  
    9901121 
     1122    case 5: 
     1123      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>") 
     1124                  .arg(color) 
     1125                  .arg(dateTime) 
     1126                  .arg(color) 
     1127                  .arg(messageText); 
     1128      break; 
     1129 
    9911130    case 0: 
    9921131    default: 
    993       s = QString("<html><body><font color=\"%1\"><b>[%2] %3</b></font><br></body></html>") 
     1132      s = QString("<font color=\"%1\"><b>[%2] %3</b></font><br>") 
    9941133                  .arg(color) 
    9951134                  .arg(dateTime) 
     
    9981137  } 
    9991138 
    1000   append(s); 
    1001   if (m_bAppendLineBreak) 
    1002     append("<hr>"); 
     1139  internalAddMsg(s); 
    10031140} 
    10041141 
  • trunk/qt-gui/src/ewidgets.h

    r4736 r4791  
    3333#include <qsize.h> 
    3434#include <qlistview.h> 
     35#include <qstringlist.h> 
    3536 
    3637#include "mlview.h" 
     
    199200  CMainWindow *mainwin; 
    200201public: 
     202  static QStringList getStyleNames(bool includeHistoryStyles = false); 
     203 
    201204  CMessageViewWidget(const char *szId, unsigned long nPPID, 
    202     CMainWindow *m, QWidget *parent = 0, const char *name = 0); 
     205    CMainWindow *m, QWidget *parent = 0, const char *name = 0, bool historyMode = false); 
    203206  CMessageViewWidget(unsigned long _nUin, CMainWindow *m, 
    204              QWidget* parent=0, const char * name =0); 
     207    QWidget* parent = 0, const char *name = 0, bool historyMode = false); 
    205208  virtual ~CMessageViewWidget(); 
    206209 
    207210  void setOwner(const char *szId); 
     211  void updateContent(); 
     212  void clear(); 
    208213  void addMsg(direction dir, bool fromHistory, QString eventDescription, QDateTime date,  
    209214    bool isDirect, bool isMultiRec, bool isUrgent, bool isEncrypted,  
     
    213218  unsigned short m_nMsgStyle; 
    214219  QString m_nDateFormat; 
    215   bool m_bAppendLineBreak; 
     220  bool m_extraSpacing; 
     221  bool m_appendLineBreak; 
     222  bool m_useBuffer; 
    216223  QColor m_colorRcvHistory; 
    217224  QColor m_colorSntHistory; 
     
    223230  virtual void addMsg(CUserEvent *, const char * = 0, unsigned long = 0); 
    224231  void addMsg(ICQEvent *); 
     232 
     233private: 
     234  void internalAddMsg(QString s); 
     235  QString m_buffer; 
    225236}; 
    226237 
  • trunk/qt-gui/src/mainwin.cpp

    r4775 r4791  
    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); 
     
    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"); 
     
    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()); 
     
    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); 
  • trunk/qt-gui/src/mainwin.h

    r4736 r4791  
    162162       m_bDisableDockIcon, 
    163163       m_bSortColumnAscending, 
    164        m_bAppendLineBreak, 
     164       m_chatVertSpacing, 
     165       m_chatAppendLineBreak, 
     166       m_histVertSpacing, 
    165167       m_bFlashTaskbar, 
    166168       m_bMainWinSticky, 
     
    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, 
  • trunk/qt-gui/src/mlview.cpp

    r4682 r4791  
    157157} 
    158158 
     159void MLView::GotoHome() 
     160{ 
     161  setContentsPos(0, 0); 
     162} 
     163 
    159164void MLView::GotoEnd() 
    160165{ 
  • trunk/qt-gui/src/mlview.h

    r4550 r4791  
    3232  void appendNoNewLine(const QString& s); 
    3333  void append(const QString& s); 
     34  void GotoHome(); 
    3435  void GotoEnd(); 
    3536 
  • trunk/qt-gui/src/optionsdlg.cpp

    r4782 r4791  
    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); 
     
    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(); 
     
    15671558  lay->addWidget(boxRight); 
    15681559 
    1569   QGroupBox* boxOptions = new QGroupBox(1, Horizontal, tr("Options"), boxRight); 
    1570  
    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())); 
    1579  
    1580   chkLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxOptions); 
    1581   connect(chkLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
    1582  
    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())); 
    1593  
    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))); 
    1597  
    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( 
     1560  QGroupBox* boxChatOptions = new QGroupBox(1, Horizontal, tr("Chat Options"), boxRight); 
     1561 
     1562  static const int dateFormatsLength = 7; 
     1563  static const char *const dateFormats[dateFormatsLength] = { 
     1564      "hh:mm:ss", 
     1565      "yyyy-MM-dd hh:mm:ss", 
     1566      "yyyy-MM-dd", 
     1567      "yyyy/MM/dd hh:mm:ss", 
     1568      "yyyy/MM/dd", 
     1569      "dd.MM.yyyy hh:mm:ss", 
     1570      "dd.MM.yyyy" 
     1571  }; 
     1572 
     1573  new QLabel(tr("Style:"), boxChatOptions); 
     1574  cmbChatStyle = new QComboBox(false, boxChatOptions); 
     1575  cmbChatStyle->insertStringList(CMessageViewWidget::getStyleNames(false)); 
     1576  connect(cmbChatStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1577 
     1578  chkChatVertSpacing = new QCheckBox(tr("Insert Vertical Spacing"), boxChatOptions); 
     1579  connect(chkChatVertSpacing, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
     1580  QWhatsThis::add(chkChatVertSpacing, tr("Insert extra space between messages.")); 
     1581 
     1582  chkChatLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxChatOptions); 
     1583  connect(chkChatLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
     1584  QWhatsThis::add(chkChatLineBreak, tr("Insert a line between each message.")); 
     1585 
     1586  QLabel* lblChatDateFormat = new QLabel(tr("Date Format:"), boxChatOptions); 
     1587  cmbChatDateFormat = new QComboBox(true, boxChatOptions); 
     1588  for(int i = 0; i < dateFormatsLength; ++i) 
     1589    cmbChatDateFormat->insertItem(dateFormats[i]); 
     1590  connect(cmbChatDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1591  connect(cmbChatDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); 
     1592 
     1593  QString helpDateFormat = tr( 
    16021594      "<p>Available custom date format variables.</p>\n" 
    16031595      "<table>\n" 
     
    16241616      "<tr><td>AP</td><td>use AM/PM display. AP will be replaced by either 'AM' or 'PM'</td></tr>\n" 
    16251617      "<tr><td>ap</td><td>use am/pm display. ap will be replaced by either 'am' or 'pm'</td></tr>\n" 
    1626       "</table>")); 
     1618      "</table>"); 
     1619 
     1620  QWhatsThis::add(lblChatDateFormat, helpDateFormat); 
     1621  QWhatsThis::add(cmbChatDateFormat, helpDateFormat); 
     1622 
     1623  QGroupBox* boxHistOptions = new QGroupBox(1, Horizontal, tr("History Options"), boxRight); 
     1624  new QLabel(tr("Style:"), boxHistOptions); 
     1625  cmbHistStyle = new QComboBox(false, boxHistOptions); 
     1626  cmbHistStyle->insertStringList(CMessageViewWidget::getStyleNames(true)); 
     1627  connect(cmbHistStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1628 
     1629  chkHistVertSpacing = new QCheckBox(tr("Insert Vertical Spacing"), boxHistOptions); 
     1630  connect(chkHistVertSpacing, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
     1631  QWhatsThis::add(chkHistVertSpacing, tr("Insert extra space between messages.")); 
     1632 
     1633  QLabel* lblHistDateFormat = new QLabel(tr("Date Format:"), boxHistOptions); 
     1634  cmbHistDateFormat = new QComboBox(true, boxHistOptions); 
     1635  for(int i = 0; i < dateFormatsLength; ++i) 
     1636    cmbHistDateFormat->insertItem(dateFormats[i]); 
     1637  connect(cmbHistDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 
     1638  connect(cmbHistDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); 
     1639  QWhatsThis::add(lblHistDateFormat, helpDateFormat); 
     1640  QWhatsThis::add(cmbHistDateFormat, helpDateFormat); 
     1641 
    16271642 
    16281643  QGroupBox *boxColors = new QGroupBox(2, Horizontal, tr("Colors"), boxRight); 
     
    16611676  connect(btnColorChatBkg, SIGNAL(changed()), this, SLOT(slot_refresh_msgViewer())); 
    16621677 
    1663   tabViewer = new QTabWidget(w); 
     1678  tabViewer = new CETabWidget(w); 
    16641679  lay->addWidget(tabViewer); 
    16651680 
    1666   msgViewer = new CMessageViewWidget(0, gMainWindow, tabViewer); 
    1667   tabViewer->insertTab(msgViewer, "Marge"); 
     1681  msgChatViewer = new CMessageViewWidget(0, gMainWindow, tabViewer); 
     1682  tabViewer->insertTab(msgChatViewer, "Marge"); 
     1683 
     1684  msgHistViewer = new CMessageViewWidget(0, gMainWindow, tabViewer, 0, true); 
     1685  tabViewer->insertTab(msgHistViewer, "History"); 
    16681686 
    16691687  lay->activate(); 
    16701688 
    16711689  return w; 
    1672 } 
    1673  
    1674 QString OptionsDlg::getCurrentDateFormat() const 
    1675 { 
    1676   if (chkCustomDateFormat->isChecked()) 
    1677     return customDateFormat->text(); 
    1678   else 
    1679     return cmbDateFormat->currentText(); 
    16801690} 
    16811691 
     
    16971707  }; 
    16981708 
    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(); 
    1706   tabViewer->setPaletteForegroundColor(btnColorTypingLabel->paletteBackgroundColor()); 
    1707   msgViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 
    1708  
    1709   msgViewer->m_nDateFormat = getCurrentDateFormat(); 
    1710  
    1711   msgViewer->clear(); 
     1709  msgChatViewer->m_nMsgStyle = cmbChatStyle->currentItem(); 
     1710  msgChatViewer->m_extraSpacing = chkChatVertSpacing->isChecked(); 
     1711  msgChatViewer->m_appendLineBreak = chkChatLineBreak->isChecked(); 
     1712  msgChatViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor();