Skip to content

Commit

Permalink
display tooltip with more feed data in discover feeds dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Nov 6, 2024
1 parent fb5ff84 commit 5664b39
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/librssguard/services/abstract/accountcheckmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "3rd-party/boolinq/boolinq.h"
#include "definitions/definitions.h"
#include "services/abstract/feed.h"

AccountCheckModel::AccountCheckModel(QObject* parent)
: QAbstractItemModel(parent), m_rootItem(nullptr), m_recursiveChange(false) {}
Expand Down Expand Up @@ -172,7 +173,7 @@ QVariant AccountCheckModel::data(const QModelIndex& index, int role) const {
return m_checkStates.value(item);
}
else {
return static_cast<int>(Qt::Unchecked);
return static_cast<int>(Qt::CheckState::Unchecked);
}
}
else if (role == Qt::ItemDataRole::DecorationRole) {
Expand All @@ -193,9 +194,22 @@ QVariant AccountCheckModel::data(const QModelIndex& index, int role) const {
return item->title();
}
}
else {
return QVariant();
else if (role == Qt::ItemDataRole::ToolTipRole) {
if (item->kind() == RootItem::Kind::Feed) {
auto desc = item->description();
auto url = item->toFeed()->source();

QString txt = url;

if (!desc.isEmpty()) {
txt += QSL("\n\n%1").arg(desc);
}

return txt;
}
}

return QVariant();
}

bool AccountCheckModel::setData(const QModelIndex& index, const QVariant& value, int role) {
Expand Down

0 comments on commit 5664b39

Please sign in to comment.