Skip to content

Commit

Permalink
fix problems when source field is huge in feed
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Feb 13, 2024
1 parent 4cd363e commit 65fa66b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/librssguard/core/feedsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ QVariant FeedsModel::headerData(int section, Qt::Orientation orientation, int ro
}

switch (role) {
case Qt::DisplayRole:
case Qt::ItemDataRole::DisplayRole:
if (section == FDS_MODEL_TITLE_INDEX) {
return m_headerData.at(FDS_MODEL_TITLE_INDEX);
}
else {
return QVariant();
}

case Qt::ToolTipRole:
case Qt::ItemDataRole::ToolTipRole:
return m_tooltipData.at(section);

case Qt::DecorationRole:
case Qt::ItemDataRole::DecorationRole:
if (section == FDS_MODEL_COUNTS_INDEX) {
return m_countsIcon;
}
Expand Down
41 changes: 35 additions & 6 deletions src/librssguard/services/standard/standardfeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,41 @@ QList<QAction*> StandardFeed::contextMenuFeedsList() {
}

QString StandardFeed::additionalTooltip() const {
return Feed::additionalTooltip() + tr("\nEncoding: %1\n"
"Type: %2\n"
"Post-processing script: %3")
.arg(encoding(),
StandardFeed::typeToString(type()),
m_postProcessScript.isEmpty() ? QSL("-") : m_postProcessScript);
QString stat = getStatusDescription();
QString stat_string = statusString();

if (!stat_string.simplified().isEmpty()) {
stat += QSL(" (%1)").arg(stat_string);
}

auto filters = messageFilters();
auto std_fltrs = boolinq::from(filters)
.select([](const QPointer<MessageFilter>& pn) {
return pn->name();
})
.toStdList();
QStringList fltrs = FROM_STD_LIST(QStringList, std_fltrs);

QString base_tooltip =
tr("Auto-update status: %1\n"
"Active message filters: %2\n"
"Status: %3\n"
"Source: %4\n"
"Item ID: %5\n")
.arg(getAutoUpdateStatusDescription(),
filters.size() > 0 ? QSL("%1 (%2)").arg(QString::number(filters.size()), fltrs.join(QSL(", ")))
: QString::number(filters.size()),
stat,
m_sourceType == SourceType::Url ? QString("<a href=\"%1\">%1</a>").arg(source().left(100))
: source().left(100),
customId());

return base_tooltip + tr("Encoding: %1\n"
"Type: %2\n"
"Post-processing script: %3")
.arg(encoding(),
StandardFeed::typeToString(type()),
m_postProcessScript.isEmpty() ? QSL("-") : m_postProcessScript);
}

bool StandardFeed::canBeDeleted() const {
Expand Down

0 comments on commit 65fa66b

Please sign in to comment.