|
a/src/qtgui/restable.cpp |
|
b/src/qtgui/restable.cpp |
|
... |
|
... |
360 |
QVariant RecollModel::data(const QModelIndex& index, int role) const
|
360 |
QVariant RecollModel::data(const QModelIndex& index, int role) const
|
361 |
{
|
361 |
{
|
362 |
LOGDEB2("RecollModel::data: row " << index.row() << " col " <<
|
362 |
LOGDEB2("RecollModel::data: row " << index.row() << " col " <<
|
363 |
index.column() << " role " << role << "\n");
|
363 |
index.column() << " role " << role << "\n");
|
364 |
if (!m_source || role != Qt::DisplayRole || !index.isValid() ||
|
364 |
if (!m_source || role != Qt::DisplayRole || !index.isValid() ||
|
365 |
index.column() >= int(m_fields.size())) {
|
365 |
index.column() >= int(m_fields.size())) {
|
366 |
return QVariant();
|
366 |
return QVariant();
|
367 |
}
|
367 |
}
|
368 |
|
368 |
|
369 |
Rcl::Doc doc;
|
369 |
Rcl::Doc doc;
|
370 |
if (!m_source->getDoc(index.row(), doc)) {
|
370 |
if (!m_source->getDoc(index.row(), doc)) {
|
371 |
return QVariant();
|
371 |
return QVariant();
|
372 |
}
|
372 |
}
|
373 |
|
373 |
|
374 |
string colname = m_fields[index.column()];
|
374 |
string colname = m_fields[index.column()];
|
375 |
|
375 |
|
|
|
376 |
string data = m_getters[index.column()](colname, doc);
|
|
|
377 |
|
|
|
378 |
// Special case url, because it may not be utf-8. URL-encode in this case.
|
|
|
379 |
if (!colname.compare("url")) {
|
|
|
380 |
int ecnt;
|
|
|
381 |
string data1;
|
|
|
382 |
if (!transcode(data, data1, "UTF-8", "UTF-8", &ecnt) || ecnt > 0) {
|
|
|
383 |
data = url_encode(data);
|
|
|
384 |
}
|
|
|
385 |
}
|
|
|
386 |
|
376 |
list<string> lr;
|
387 |
list<string> lr;
|
377 |
g_hiliter.plaintorich(m_getters[index.column()](colname, doc), lr, m_hdata);
|
388 |
g_hiliter.plaintorich(data, lr, m_hdata);
|
378 |
return QString::fromUtf8(lr.front().c_str());
|
389 |
return QString::fromUtf8(lr.front().c_str());
|
379 |
}
|
390 |
}
|
380 |
|
391 |
|
381 |
void RecollModel::saveAsCSV(FILE *fp)
|
392 |
void RecollModel::saveAsCSV(FILE *fp)
|
382 |
{
|
393 |
{
|