Ticket #1449: licq-4786-configurable_history.patch
| File licq-4786-configurable_history.patch, 28.1 kB (added by flynd, 22 months ago) |
|---|
-
licq/plugins/qt-gui/src/mainwin.h
161 161 m_bShowHistory, 162 162 m_bDisableDockIcon, 163 163 m_bSortColumnAscending, 164 m_bAppendLineBreak, 164 m_chatVertSpacing, 165 m_chatAppendLineBreak, 166 m_histVertSpacing, 165 167 m_bFlashTaskbar, 166 168 m_bMainWinSticky, 167 169 m_bMsgWinSticky, … … 179 181 unsigned long m_nCurrentGroup, m_nGroupStates; 180 182 unsigned short m_nSortByStatus, 181 183 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 185 190 QColor m_colorRcvHistory, 186 191 m_colorSntHistory, 187 192 m_colorRcv, -
licq/plugins/qt-gui/src/userinfodlg.cpp
1725 1725 chkHistoryReverse->setFixedSize(chkHistoryReverse->sizeHint()); 1726 1726 l->addWidget(chkHistoryReverse); 1727 1727 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); 1730 1729 1731 1730 connect(mlvHistory, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); 1732 1731 … … 2027 2026 barFiltering->setTotalSteps(NUM_MSG_PER_HISTORY); 2028 2027 char* ftxt = qstrdup(codec->fromUnicode(lneFilter->text())); 2029 2028 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 2031 2041 mlvHistory->clear(); 2032 2042 while (m_nHistoryShowing < (NUM_MSG_PER_HISTORY)) 2033 2043 { … … 2041 2051 messageText = codec->toUnicode((*tempIter)->Text()); 2042 2052 2043 2053 mlvHistory->addMsg((*tempIter)->Direction(), false, 2044 EventDescription(*tempIter),2054 ((*tempIter)->SubCommand() == ICQ_CMDxSUB_MSG ? QString("") : (EventDescription(*tempIter) + " ")), 2045 2055 date, 2046 2056 (*tempIter)->IsDirect(), 2047 2057 (*tempIter)->IsMultiRec(), 2048 2058 (*tempIter)->IsUrgent(), 2049 2059 (*tempIter)->IsEncrypted(), 2050 contactName,2060 ((*tempIter)->Direction() == D_RECEIVER ? contactName : ownerName), 2051 2061 MLView::toRichText(messageText, true, bUseHTML)); 2052 2062 m_nHistoryShowing++; 2053 2063 barFiltering->setProgress(m_nHistoryShowing); … … 2067 2077 break; 2068 2078 } 2069 2079 } 2080 2081 // History view is buffered so tell it write buffer to output now that all entries have been added 2082 mlvHistory->updateContent(); 2083 2070 2084 delete [] ftxt; 2071 2085 if(lneFilter->text().isEmpty()) 2072 2086 lblHistory->setText(tr("[<font color=\"%1\">Received</font>] " … … 2089 2103 if(!m_bHistoryReverse) 2090 2104 mlvHistory->GotoEnd(); 2091 2105 else 2092 mlvHistory-> setCursorPosition(0, 0);2106 mlvHistory->GotoHome(); 2093 2107 barFiltering->reset(); 2094 2108 } 2095 2109 -
licq/plugins/qt-gui/src/mlview.h
31 31 32 32 void appendNoNewLine(const QString& s); 33 33 void append(const QString& s); 34 void GotoHome(); 34 35 void GotoEnd(); 35 36 36 37 bool hasMarkedText() const; -
licq/plugins/qt-gui/src/mlview.cpp
156 156 return text; 157 157 } 158 158 159 void MLView::GotoHome() 160 { 161 setContentsPos(0, 0); 162 } 163 159 164 void MLView::GotoEnd() 160 165 { 161 166 moveCursor(QTextBrowser::MoveEnd, false); -
licq/plugins/qt-gui/src/ewidgets.h
198 198 unsigned long m_nUin; 199 199 CMainWindow *mainwin; 200 200 public: 201 static const char *const styleNames[]; 202 201 203 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); 203 205 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); 205 207 virtual ~CMessageViewWidget(); 206 208 207 209 void setOwner(const char *szId); 210 void updateContent(); 211 void clear(); 208 212 void addMsg(direction dir, bool fromHistory, QString eventDescription, QDateTime date, 209 213 bool isDirect, bool isMultiRec, bool isUrgent, bool isEncrypted, 210 214 QString contactName, QString messageText); … … 212 216 213 217 unsigned short m_nMsgStyle; 214 218 QString m_nDateFormat; 215 bool m_bAppendLineBreak; 219 bool m_extraSpacing; 220 bool m_appendLineBreak; 221 bool m_useBuffer; 216 222 QColor m_colorRcvHistory; 217 223 QColor m_colorSntHistory; 218 224 QColor m_colorRcv; … … 222 228 public slots: 223 229 virtual void addMsg(CUserEvent *, const char * = 0, unsigned long = 0); 224 230 void addMsg(ICQEvent *); 231 232 private: 233 void internalAddMsg(QString s); 234 QString m_buffer; 225 235 }; 226 236 227 237 /* ----------------------------------------------------------------------------- */ -
licq/plugins/qt-gui/src/optionsdlg.cpp
212 212 chkSysBack->setChecked(mainwin->m_bSystemBackground); 213 213 chkSendFromClipboard->setChecked(mainwin->m_bSendFromClipboard); 214 214 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); 235 222 btnColorRcv->setPaletteBackgroundColor(mainwin->m_colorRcv); 236 223 btnColorSnt->setPaletteBackgroundColor(mainwin->m_colorSnt); 237 224 btnColorRcvHistory->setPaletteBackgroundColor(mainwin->m_colorRcvHistory); … … 527 514 mainwin->m_bSystemBackground = chkSysBack->isChecked(); 528 515 mainwin->m_bSendFromClipboard = chkSendFromClipboard->isChecked(); 529 516 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(); 533 524 mainwin->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 534 525 mainwin->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 535 526 mainwin->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); … … 1566 1557 QVBox* boxRight = new QVBox(w); 1567 1558 lay->addWidget(boxRight); 1568 1559 1569 QGroupBox* box Options = new QGroupBox(1, Horizontal, tr("Options"), boxRight);1560 QGroupBox* boxChatOptions = new QGroupBox(1, Horizontal, tr("Chat Options"), boxRight); 1570 1561 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"}; 1579 1570 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())); 1582 1576 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())); 1593 1579 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())); 1597 1582 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( 1602 1591 "<p>Available custom date format variables.</p>\n" 1603 1592 "<table>\n" 1604 1593 "<tr><th>Expression</th><th>Output</th></tr>\n" … … 1623 1612 "<tr><td>zzz</td><td>the millisecond with leading zero (000..999)</td></tr>\n" 1624 1613 "<tr><td>AP</td><td>use AM/PM display. AP will be replaced by either 'AM' or 'PM'</td></tr>\n" 1625 1614 "<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>"); 1627 1616 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 1628 1638 QGroupBox *boxColors = new QGroupBox(2, Horizontal, tr("Colors"), boxRight); 1629 1639 1630 1640 new QLabel(tr("Message Received:"), boxColors); … … 1663 1673 tabViewer = new QTabWidget(w); 1664 1674 lay->addWidget(tabViewer); 1665 1675 1666 msg Viewer = new CMessageViewWidget(0, gMainWindow, tabViewer);1667 tabViewer->insertTab(msg Viewer, "Marge");1676 msgChatViewer = new CMessageViewWidget(0, gMainWindow, tabViewer); 1677 tabViewer->insertTab(msgChatViewer, "Marge"); 1668 1678 1679 msgHistViewer = new CMessageViewWidget(0, gMainWindow, tabViewer, 0, true); 1680 tabViewer->insertTab(msgHistViewer, "History"); 1681 1669 1682 lay->activate(); 1670 1683 1671 1684 return w; 1672 1685 } 1673 1686 1674 QString OptionsDlg::getCurrentDateFormat() const1675 {1676 if (chkCustomDateFormat->isChecked())1677 return customDateFormat->text();1678 else1679 return cmbDateFormat->currentText();1680 }1681 1682 1687 void OptionsDlg::slot_refresh_msgViewer() 1683 1688 { 1684 1689 // Don't update the time at every refresh … … 1696 1701 QT_TR_NOOP("Marge has left the conversation.") 1697 1702 }; 1698 1703 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(); 1706 1712 tabViewer->setPaletteForegroundColor(btnColorTypingLabel->paletteBackgroundColor()); 1707 msg Viewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor());1713 msgChatViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 1708 1714 1709 msg Viewer->m_nDateFormat = getCurrentDateFormat();1715 msgChatViewer->m_nDateFormat = cmbChatDateFormat->currentText(); 1710 1716 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(); 1712 1726 for (unsigned int i = 0; i<7; i++) 1713 1727 { 1714 msg Viewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, (i<2),1728 msgChatViewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, (i<2), 1715 1729 QString(""), 1716 1730 date, 1717 1731 true, false, false, false, 1718 1732 names[i % 2], 1719 1733 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)); 1720 1741 } 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(); 1722 1745 } 1723 1746 1724 1747 CColorOption::CColorOption (QWidget* parent) -
licq/plugins/qt-gui/src/mainwin.cpp
432 432 licqConf.ReadBool("AutoPosReplyWin", m_bAutoPosReplyWin, true); 433 433 licqConf.ReadBool("AutoSendThroughServer", m_bAutoSendThroughServer, false); 434 434 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); 437 438 licqConf.ReadBool("FlashTaskbar", m_bFlashTaskbar, true); 438 439 licqConf.ReadBool("ShowUserIcons", m_bShowUserIcons, true); 439 440 licqConf.ReadBool("MainWinSticky", m_bMainWinSticky, false); … … 441 442 licqConf.ReadBool("SingleLineChatMode", m_bSingleLineChatMode, false); 442 443 licqConf.ReadBool("CheckSpellingEnabled", m_bCheckSpellingEnabled, false); 443 444 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); 445 450 446 451 licqConf.ReadStr("ReceiveMessageColor", szTemp, "red"); 447 452 m_colorRcv = QColor(szTemp); … … 3576 3581 licqConf.WriteBool("SingleLineChatMode", m_bSingleLineChatMode); 3577 3582 licqConf.WriteBool("CheckSpellingEnabled", m_bCheckSpellingEnabled); 3578 3583 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); 3581 3587 licqConf.WriteStr("ReceiveMessageColor", m_colorRcv.name()); 3582 3588 licqConf.WriteStr("ReceiveHistoryColor", m_colorRcvHistory.name()); 3583 3589 licqConf.WriteStr("SentMessageColor", m_colorSnt.name()); … … 3586 3592 licqConf.WriteStr("TabFontColor", m_colorTab.name()); 3587 3593 licqConf.WriteStr("TabOnTypingColor", m_colorTabTyping.name()); 3588 3594 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()); 3590 3599 3591 3600 licqConf.WriteBool("showPopPicture", m_bPopPicture); 3592 3601 licqConf.WriteBool("showPopAlias", m_bPopAlias); -
licq/plugins/qt-gui/src/ewidgets.cpp
661 661 // ----------------------------------------------------------------------------- 662 662 663 663 //- Message View Widget --------------------------------------------------------- 664 665 // Names of the message styles 666 const char *const CMessageViewWidget::styleNames[] = { 667 "Default", 668 "Compact", 669 "Tiny", 670 "Table", 671 "Long", 672 "Wide"}; 673 674 664 675 CMessageViewWidget::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) 666 677 : CHistoryWidget(parent, name) 667 678 { 668 679 m_szId = szId ? strdup(szId) : 0; 669 680 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 } 673 697 m_colorRcv = m->m_colorRcv; 674 698 m_colorSnt = m->m_colorSnt; 675 699 m_colorRcvHistory = m->m_colorRcvHistory; … … 697 721 */ 698 722 } 699 723 700 CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget * parent, const char * name)724 CMessageViewWidget::CMessageViewWidget(unsigned long _nUin, CMainWindow *m, QWidget *parent, const char *name, bool historyMode) 701 725 :CHistoryWidget(parent,name) 702 726 { 703 727 m_nUin= _nUin; 704 728 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 } 708 745 m_colorRcv = m->m_colorRcv; 709 746 m_colorSnt = m->m_colorSnt; 710 747 m_colorRcvHistory = m->m_colorRcvHistory; … … 745 782 m_szId = strdup(_szId); 746 783 } 747 784 785 void 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 803 void CMessageViewWidget::updateContent() 804 { 805 if (m_useBuffer == false) 806 return; 807 setText(m_buffer); 808 } 809 810 void 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 748 849 void CMessageViewWidget::addMsg(ICQEvent * _e) 749 850 { 750 851 if (strcmp(_e->Id(), m_szId) == 0 && _e->PPID() == m_nPPID && … … 758 859 { 759 860 QString s; 760 861 QString color; 761 bool bAIM = (m_nPPID == LICQ_PPID) && !isdigit(m_szId[0]);762 862 763 863 if (fromHistory) 764 864 if (dir == D_RECEIVER) … … 784 884 785 885 switch (m_nMsgStyle) { 786 886 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>") 788 888 .arg(color) 789 889 .arg(eventDescription) 790 890 .arg(my_date) … … 793 893 .arg(isUrgent ? 'U' : '-') 794 894 .arg(isEncrypted ? 'E' : '-') 795 895 .arg(contactName); 796 s.append(QString("<font color=\"%1\">%2</font> </body></html>")896 s.append(QString("<font color=\"%1\">%2</font>") 797 897 .arg(color) 798 898 .arg(messageText)); 799 899 break; … … 810 910 s.append(QString("<font color=\"%1\">%2</font>") 811 911 .arg(color) 812 912 .arg(messageText)); 813 if (bAIM)814 {815 s.prepend("<html><body>");816 s.append("</body></html>");817 }818 819 913 break; 820 914 case 2: 821 915 s = QString("<font color=\"%1\"><b>%2%3 - %4: </b></font>") … … 826 920 s.append(QString("<font color=\"%1\">%2</font>") 827 921 .arg(color) 828 922 .arg(messageText)); 829 830 if (bAIM)831 {832 s.prepend("<html><body>");833 s.append("</body></html>");834 }835 836 923 break; 837 924 case 3: 838 925 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>") … … 864 951 .arg(color) 865 952 .arg(messageText)); 866 953 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; 867 967 } 868 869 append(s); 870 if (m_bAppendLineBreak) { 871 append("<hr>"); 872 } 968 969 internalAddMsg(s); 873 970 } 874 971 875 972 void CMessageViewWidget::addMsg(CUserEvent* e, const char *_szId, unsigned long _nPPID) … … 988 1085 .arg(messageText); 989 1086 break; 990 1087 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
