1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#include "_globals.h"
#include "column_nick.h"
/*
* ColNick
*/
ColNick::ColNick()
: m_bDetail(true)
, m_bContactCount(true)
, m_hDetail(NULL)
, m_hContactCount(NULL)
{
}
void ColNick::impl_copyConfig(const Column* pSource)
{
const ColNick& src = *reinterpret_cast<const ColNick*>(pSource);
m_bDetail = src.m_bDetail;
m_bContactCount = src.m_bContactCount;
}
void ColNick::impl_configRead(const SettingsTree& settings)
{
m_bDetail = settings.readBool(con::KeyDetail, true);
m_bContactCount = settings.readBool(con::KeyContactCount, true);
}
void ColNick::impl_configWrite(SettingsTree& settings) const
{
settings.writeBool(con::KeyDetail, m_bDetail);
settings.writeBool(con::KeyContactCount, m_bContactCount);
}
void ColNick::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
m_hDetail = Opt.insertCheck(hGroup, TranslateT("First/last message time (tooltip)"));
m_hContactCount = Opt.insertCheck(hGroup, TranslateT("Show contact count for omitted/totals (tooltip)"));
Opt.checkItem(m_hDetail , m_bDetail );
Opt.checkItem(m_hContactCount, m_bContactCount);
}
void ColNick::impl_configFromUI(OptionsCtrl& Opt)
{
m_bDetail = Opt.isItemChecked(m_hDetail);
m_bContactCount = Opt.isItemChecked(m_hContactCount);
}
void ColNick::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
if (row == 1)
{
writeRowspanTD(tos, getCustomTitle(TranslateT("Nick"), TranslateT("Nick")), row, 1, rowSpan);
}
}
void ColNick::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, DisplayType display)
{
tos << _T("<td");
if (m_bDetail || (m_bContactCount && display != asContact))
{
ext::string strFirstTime = TranslateT("(unknown)");
ext::string strLastTime = TranslateT("(unknown)");
if (contact.isFirstLastTimeValid())
{
strFirstTime = utils::timestampToDateTime(contact.getFirstTime());
strLastTime = utils::timestampToDateTime(contact.getLastTime());
}
ext::string strTooltip;
if (m_bDetail && !(m_bContactCount && display != asContact))
{
strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("[First] #{first_time} / [Last] #{last_time}"))
% _T("#{first_time}") * strFirstTime
% _T("#{last_time}") * strLastTime));
}
else if (m_bDetail && (m_bContactCount && display != asContact))
{
strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{count} contacts / [First] #{first_time} / [Last] #{last_time}"))
% _T("#{count}") * contact.getNumContacts()
% _T("#{first_time}") * strFirstTime
% _T("#{last_time}") * strLastTime));
}
else // if (!m_bDetail && (m_bContactCount && display != asContact))
{
strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{count} contacts"))
% _T("#{count}") * contact.getNumContacts()));
}
tos << _T(" title=\"") << strTooltip << _T("\">");
}
else tos << _T(">");
if (display == asContact)
tos << utils::htmlEscape(contact.getNick()) << _T("</td>") << ext::endl;
else if (display == asOmitted)
tos << TranslateT("Omitted") << _T("</td>") << ext::endl;
else
tos << TranslateT("Totals") << _T("</td>") << ext::endl;
}
|