Ticket #1449: licq-4782-history_newstyle.patch
| File licq-4782-history_newstyle.patch, 6.5 kB (added by flynd, 22 months ago) |
|---|
-
licq/plugins/qt-gui/src/userinfodlg.cpp
1726 1726 l->addWidget(chkHistoryReverse); 1727 1727 1728 1728 mlvHistory = new CMessageViewWidget(m_szId, m_nPPID, mainwin, p, "history"); 1729 mlvHistory->m_nMsgStyle = 4; /* STYLE_HISTORY */1729 mlvHistory->m_nMsgStyle = 5; /* STYLE_HISTORY */ 1730 1730 1731 1731 connect(mlvHistory, SIGNAL(viewurl(QWidget*, QString)), mainwin, SLOT(slot_viewurl(QWidget *, QString))); 1732 1732 … … 2027 2027 barFiltering->setTotalSteps(NUM_MSG_PER_HISTORY); 2028 2028 char* ftxt = qstrdup(codec->fromUnicode(lneFilter->text())); 2029 2029 int flen = strlen(ftxt); 2030 2030 2031 QString ownerName; 2032 ICQOwner *o = gUserManager.FetchOwner(m_nPPID, LOCK_R); 2033 if (o != NULL) 2034 { 2035 // Don't use this codec to decode our conversation with the contact 2036 // since we're using the contact's encoding, not ours. 2037 QTextCodec *ownerCodec = UserCodec::codecForICQUser(o); 2038 ownerName = ownerCodec->toUnicode(o->GetAlias()); 2039 gUserManager.DropOwner(m_nPPID); 2040 } 2041 2031 2042 mlvHistory->clear(); 2032 2043 while (m_nHistoryShowing < (NUM_MSG_PER_HISTORY)) 2033 2044 { … … 2047 2058 (*tempIter)->IsMultiRec(), 2048 2059 (*tempIter)->IsUrgent(), 2049 2060 (*tempIter)->IsEncrypted(), 2050 contactName,2061 ((*tempIter)->Direction() == D_RECEIVER ? contactName : ownerName), 2051 2062 MLView::toRichText(messageText, true, bUseHTML)); 2052 2063 m_nHistoryShowing++; 2053 2064 barFiltering->setProgress(m_nHistoryShowing); … … 2067 2078 break; 2068 2079 } 2069 2080 } 2081 2082 // History view may be buffered so write buffer to output now that all entries has been added 2083 mlvHistory->updateContent(); 2084 2070 2085 delete [] ftxt; 2071 2086 if(lneFilter->text().isEmpty()) 2072 2087 lblHistory->setText(tr("[<font color=\"%1\">Received</font>] " … … 2089 2104 if(!m_bHistoryReverse) 2090 2105 mlvHistory->GotoEnd(); 2091 2106 else 2092 mlvHistory-> setCursorPosition(0, 0);2107 mlvHistory->GotoHome(); 2093 2108 barFiltering->reset(); 2094 2109 } 2095 2110 -
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
197 197 unsigned long m_nPPID; 198 198 unsigned long m_nUin; 199 199 CMainWindow *mainwin; 200 QString m_buffer; 200 201 public: 201 202 CMessageViewWidget(const char *szId, unsigned long nPPID, 202 203 CMainWindow *m, QWidget *parent = 0, const char *name = 0); … … 205 206 virtual ~CMessageViewWidget(); 206 207 207 208 void setOwner(const char *szId); 209 void updateContent(); 210 void clear(); 208 211 void addMsg(direction dir, bool fromHistory, QString eventDescription, QDateTime date, 209 212 bool isDirect, bool isMultiRec, bool isUrgent, bool isEncrypted, 210 213 QString contactName, QString messageText); … … 213 216 unsigned short m_nMsgStyle; 214 217 QString m_nDateFormat; 215 218 bool m_bAppendLineBreak; 219 bool m_useBuffer; 216 220 QColor m_colorRcvHistory; 217 221 QColor m_colorSntHistory; 218 222 QColor m_colorRcv; -
licq/plugins/qt-gui/src/ewidgets.cpp
745 745 m_szId = strdup(_szId); 746 746 } 747 747 748 void CMessageViewWidget::clear() 749 { 750 CHistoryWidget::clear(); 751 752 m_buffer = "<html><body>"; 753 switch(m_nMsgStyle) 754 { 755 case 5: 756 m_buffer.append("<table border=\"0\">"); 757 m_useBuffer = true; 758 break; 759 default: 760 m_useBuffer = false; 761 } 762 } 763 764 void CMessageViewWidget::updateContent() 765 { 766 if (m_useBuffer == false) 767 return; 768 setText(m_buffer); 769 } 770 748 771 void CMessageViewWidget::addMsg(ICQEvent * _e) 749 772 { 750 773 if (strcmp(_e->Id(), m_szId) == 0 && _e->PPID() == m_nPPID && … … 864 887 .arg(color) 865 888 .arg(messageText)); 866 889 break; 890 891 case 5: 892 // Mode 5 is a table so it cannot be displayed in paragraphs 893 s = QString("<tr><td><nobr><b><font color=\"%1\">%2</font><b></nobr></td>") 894 .arg(color) 895 .arg(my_date); 896 s.append(QString("<td><b><font color=\"%3\">%4</font></b></font></td>") 897 .arg(color) 898 .arg(contactName)); 899 s.append(QString("<td><font color=\"%1\">%2</font></td></tr>") 900 .arg(color) 901 .arg(messageText)); 902 break; 867 903 } 868 869 append(s); 870 if (m_bAppendLineBreak) { 871 append("<hr>"); 904 905 if (m_useBuffer) 906 { 907 m_buffer.append(s); 908 if (m_bAppendLineBreak) 909 m_buffer.append("<hr>"); 872 910 } 911 else 912 { 913 append(s); 914 if (m_bAppendLineBreak) 915 append("<hr>"); 916 } 873 917 } 874 918 875 919 void CMessageViewWidget::addMsg(CUserEvent* e, const char *_szId, unsigned long _nPPID) … … 988 1032 .arg(messageText); 989 1033 break; 990 1034 1035 case 5: 1036 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>") 1037 .arg(color) 1038 .arg(dateTime) 1039 .arg(color) 1040 .arg(messageText); 1041 break; 1042 991 1043 case 0: 992 1044 default: 993 1045 s = QString("<html><body><font color=\"%1\"><b>[%2] %3</b></font><br></body></html>") … … 997 1049 break; 998 1050 } 999 1051 1000 append(s); 1001 if (m_bAppendLineBreak) 1002 append("<hr>"); 1052 if (m_useBuffer) 1053 { 1054 m_buffer.append(s); 1055 if (m_bAppendLineBreak) 1056 m_buffer.append("<hr>"); 1057 } 1058 else 1059 { 1060 append(s); 1061 if (m_bAppendLineBreak) 1062 append("<hr>"); 1063 } 1003 1064 } 1004 1065 1005 1066 CLicqMessageBox::CLicqMessageBox(QWidget *parent)
