Ticket #1389: licq_1.3.4-rc1_format_date_loki.patch
| File licq_1.3.4-rc1_format_date_loki.patch, 10.3 kB (added by Loki (loki@…, 2 years ago) |
|---|
-
licq-1.3.4-RC1/plugins/qt-gui/src/ewidgets.cpp
752 752 m_szId = szId ? strdup(szId) : 0; 753 753 m_nPPID = nPPID; 754 754 m_nMsgStyle = m->m_nMsgStyle; 755 m_nDateFormat = m->m_nDateFormat; 755 756 m_bAppendLineBreak = m->m_bAppendLineBreak; 756 757 m_colorRcv = m->m_colorRcv; 757 758 m_colorSnt = m->m_colorSnt; … … 785 786 m_nUin= _nUin; 786 787 m_szId = NULL; // avoid desalocation error at destructor 787 788 m_nMsgStyle = m->m_nMsgStyle; 789 m_nDateFormat = m->m_nDateFormat; 788 790 m_bAppendLineBreak = m->m_bAppendLineBreak; 789 791 m_colorRcv = m->m_colorRcv; 790 792 m_colorSnt = m->m_colorSnt; … … 860 862 } 861 863 } 862 864 865 QString my_date = date.toString( m_nDateFormat ); 863 866 864 867 switch (m_nMsgStyle) { 865 868 case 0: 866 869 s = QString("<html><body><font color=\"%1\"><b>%2%3 [%4%5%6%7] %8:</b></font><br>") 867 870 .arg(color) 868 871 .arg(eventDescription) 869 .arg( date.time().toString())872 .arg(my_date) 870 873 .arg(isDirect ? 'D' : '-') 871 874 .arg(isMultiRec ? 'M' : '-') 872 875 .arg(isUrgent ? 'U' : '-') … … 880 883 s = QString("<font color=\"%1\"><b>(%2%3) [%4%5%6%7] %8: </b></font>") 881 884 .arg(color) 882 885 .arg(eventDescription) 883 .arg( date.time().toString())886 .arg(my_date) 884 887 .arg(isDirect ? 'D' : '-') 885 888 .arg(isMultiRec ? 'M' : '-') 886 889 .arg(isUrgent ? 'U' : '-') … … 900 903 s = QString("<font color=\"%1\"><b>%2%3 - %4: </b></font>") 901 904 .arg(color) 902 905 .arg(eventDescription) 903 .arg( date.time().toString())906 .arg(my_date) 904 907 .arg(contactName); 905 908 s.append(QString("<font color=\"%1\">%2</font>") 906 909 .arg(color) … … 917 920 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>") 918 921 .arg(color) 919 922 .arg(eventDescription) 920 .arg( date.time().toString())923 .arg(my_date) 921 924 .arg(color) 922 925 .arg(contactName); 923 926 s.append(QString("<td><font color=\"%1\">%2</font></td></tr></table>") … … 930 933 .arg((dir == D_RECEIVER ? tr("%1 from %2") : tr("%1 to %2"))) 931 934 .arg(eventDescription) 932 935 .arg(contactName) 933 .arg( date.toString())936 .arg(my_date) 934 937 .arg(isDirect ? 'D' : '-') 935 938 .arg(isMultiRec ? 'M' : '-') 936 939 .arg(isUrgent ? 'U' : '-') … … 955 958 { 956 959 QDateTime date; 957 960 date.setTime_t(e->Time()); 958 QString sd = date.time().toString( );961 QString sd = date.time().toString( m_nDateFormat ); 959 962 bool bUseHTML = false; 960 963 961 964 QString contactName; -
ewidgets.h
old new 197 197 void addNotice(QString dateTime, QString messageText); 198 198 199 199 unsigned short m_nMsgStyle; 200 QString m_nDateFormat; 200 201 bool m_bAppendLineBreak; 201 202 QColor m_colorRcvHistory; 202 203 QColor m_colorSntHistory; -
mainwin.cpp
old new 452 452 licqConf.ReadBool("MsgWinSticky", m_bMsgWinSticky, false); 453 453 licqConf.ReadBool("SingleLineChatMode", m_bSingleLineChatMode, false); 454 454 licqConf.ReadBool("CheckSpellingEnabled", m_bCheckSpellingEnabled, false); 455 licqConf.ReadStr("DateFormat", szTemp, "yyyy-MM-dd hh:mm:ss"); 456 m_nDateFormat = QString::fromLatin1(szTemp); 457 455 458 456 459 licqConf.ReadStr("ReceiveMessageColor", szTemp, "red"); 457 460 m_colorRcv = QColor(szTemp); … … 3676 3679 licqConf.WriteStr("TabFontColor", m_colorTab.name()); 3677 3680 licqConf.WriteStr("TabOnTypingColor", m_colorTabTyping.name()); 3678 3681 licqConf.WriteStr("ChatBackground", m_colorChatBkg.name()); 3682 licqConf.WriteStr("DateFormat", m_nDateFormat.latin1()); 3679 3683 3680 3684 licqConf.WriteBool("showPopAlias", m_bPopAlias); 3681 3685 licqConf.WriteBool("showPopName", m_bPopName); -
mainwin.h
old new 172 172 unsigned short m_nSortByStatus, 173 173 m_nSortColumn, 174 174 m_nMsgStyle; 175 QString m_nDateFormat; 175 176 176 177 QColor m_colorRcvHistory, 177 178 m_colorSntHistory, -
optionsdlg.cpp
old new 209 209 chkSysBack->setChecked(mainwin->m_bSystemBackground); 210 210 chkSendFromClipboard->setChecked(mainwin->m_bSendFromClipboard); 211 211 chkMsgChatView->setChecked(mainwin->m_bMsgChatView); 212 213 unsigned short int isCustomDate = 1; 214 for (int i = 1; i < cmbDateFormat->count(); i++) 215 { 216 if (cmbDateFormat->text(i) == mainwin->m_nDateFormat) 217 { 218 cmbDateFormat->setCurrentItem(i); 219 isCustomDate = 0; 220 break; 221 } 222 } 223 224 if (isCustomDate) { 225 cmbDateFormat->setEnabled(false); 226 chkCustomDateFormat->setChecked(true); 227 } 228 229 customDateFormat->setText(mainwin->m_nDateFormat); 212 230 213 231 chkLineBreak->setChecked(mainwin->m_bAppendLineBreak); 214 232 cmbStyle->setCurrentItem(mainwin->m_nMsgStyle); … … 523 541 mainwin->m_bMsgChatView = chkMsgChatView->isChecked(); 524 542 mainwin->m_bAppendLineBreak = chkLineBreak->isChecked(); 525 543 mainwin->m_nMsgStyle = cmbStyle->currentItem(); 544 mainwin->m_nDateFormat = customDateFormat->text(); 526 545 mainwin->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 527 546 mainwin->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 528 547 mainwin->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); … … 1586 1605 1587 1606 chkLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxOptions); 1588 1607 connect(chkLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 1608 1609 new QLabel(tr("Date Format:"), boxOptions); 1610 cmbDateFormat = new QComboBox(false, boxOptions); 1611 cmbDateFormat->insertItem("yyyy-MM-dd hh:mm:ss"); 1612 cmbDateFormat->insertItem("yyyy-MM-dd"); 1613 cmbDateFormat->insertItem("yyyy/MM/dd hh:mm:ss"); 1614 cmbDateFormat->insertItem("yyyy/MM/dd"); 1615 connect(cmbDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 1616 1617 chkCustomDateFormat = new QCheckBox(tr("Custom Date Format:"), boxOptions); 1618 1619 connect(chkCustomDateFormat, SIGNAL(toggled(bool)), this, SLOT(chkCustomDateFormatEnable(bool))); 1620 1621 QGroupBox* boxCDateFormat = new QGroupBox(2, Horizontal, boxOptions); 1622 boxCDateFormat->setFlat(1); 1623 1624 customDateFormat = new QLineEdit(boxCDateFormat); 1625 QWhatsThis::add(customDateFormat, tr( 1626 1627 "Available custom datetime format variables:\n" 1628 "\n" 1629 "d the day as number without a leading zero (1-31)\n" 1630 "dd the day as number with a leading zero (01-31)\n" 1631 "ddd the abbreviated localized day name (e.g. 'Mon'..'Sun')\n" 1632 "dddd the long localized day name (e.g. 'Monday'..'Sunday')\n" 1633 "M the month as number without a leading zero (1-12)\n" 1634 "MM the month as number with a leading zero (01-12)\n" 1635 "MMM the abbreviated localized month name (e.g. 'Jan'..'Dec')\n" 1636 "MMMM the long localized month name (e.g. 'January'..'December')\n" 1637 "yy the year as two digit number (00-99)\n" 1638 "yyyy the year as four digit number (1752-8000)\n" 1639 "\n" 1640 "h the hour without a leading zero (0..23 or 1..12 if AM/PM display)\n" 1641 "hh the hour with a leading zero (00..23 or 01..12 if AM/PM display\n" 1642 "m the minute without a leading zero (0..59\n" 1643 "mm the minute with a leading zero (00..59\n" 1644 "s the second whithout a leading zero (0..59)\n" 1645 "ss the second whith a leading zero (00..59\n" 1646 "z the milliseconds without leading zeroes (0..999)\n" 1647 "zzz the milliseconds with leading zeroes (000..999\n" 1648 "AP use AM/PM display. AP will be replaced by either 'AM' or 'PM'\n" 1649 "ap use am/pm display. ap will be replaced by either 'am' or 'pm'\n" )); 1650 1651 btnSetCustomDateFormat = new QPushButton(tr("Set"), boxCDateFormat); 1652 //btnSaveIt->setFixedWidth(40); 1653 connect(btnSetCustomDateFormat, SIGNAL(clicked()), this, SLOT(slot_refresh_msgViewer())); 1589 1654 1590 1655 QGroupBox *boxColors = new QGroupBox(2, Horizontal, tr("Colors"), boxRight); 1591 1656 … … 1629 1694 return w; 1630 1695 } 1631 1696 1697 void OptionsDlg::chkCustomDateFormatEnable(bool isOn) 1698 { 1699 if (isOn) { 1700 cmbDateFormat->setEnabled(false); 1701 customDateFormat->setEnabled(true); 1702 btnSetCustomDateFormat->setEnabled(true); 1703 } else { 1704 cmbDateFormat->setEnabled(true); 1705 customDateFormat->setEnabled(false); 1706 btnSetCustomDateFormat->setEnabled(false); 1707 } 1708 } 1709 1632 1710 void OptionsDlg::slot_refresh_msgViewer() 1633 1711 { 1634 1712 QDateTime date; 1713 date.setTime_t(time(TIME_NOW)); 1635 1714 const char *names[2] = {"Marge", "Homer"}; 1636 1715 const char *msgs[7] = { 1637 1716 "This is received message", … … 1650 1729 msgViewer->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); 1651 1730 tabViewer->setPaletteForegroundColor(btnColorTypingLabel->paletteBackgroundColor()); 1652 1731 msgViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 1732 1733 if (chkCustomDateFormat->isChecked()) { 1734 msgViewer->m_nDateFormat = customDateFormat->text(); 1735 } else { 1736 customDateFormat->setText(cmbDateFormat->currentText()); 1737 msgViewer->m_nDateFormat = cmbDateFormat->currentText(); 1738 } 1653 1739 1654 1740 msgViewer->clear(); 1655 1741 for (unsigned int i = 0; i<7; i++) -
optionsdlg.h
old new 143 143 CMessageViewWidget *msgViewer; 144 144 QTabWidget *tabViewer; 145 145 QComboBox *cmbStyle; 146 QComboBox *cmbDateFormat; 147 QCheckBox *chkCustomDateFormat; 148 QPushButton *btnSetCustomDateFormat; 149 QLineEdit *customDateFormat; 146 150 QCheckBox *chkLineBreak; 147 151 CColorOption *btnColorRcv; 148 152 CColorOption *btnColorSnt; … … 167 171 virtual void accept(); 168 172 virtual void reject(); 169 173 void colEnable(bool); 174 void chkCustomDateFormatEnable(bool); 170 175 void ApplyOptions(); 171 176 void slot_selectfont(); 172 177 void slot_selecteditfont();
