Changeset View
Changeset View
Standalone View
Standalone View
src/subscription/subscriptionlistmodel.cpp
Show All 24 Lines | |||||
25 | #include "subscriptionlistmodel.h" | 25 | #include "subscriptionlistmodel.h" | ||
26 | #include "feed.h" | 26 | #include "feed.h" | ||
27 | #include "feedlist.h" | 27 | #include "feedlist.h" | ||
28 | #include "folder.h" | 28 | #include "folder.h" | ||
29 | #include "subscriptionlistjobs.h" | 29 | #include "subscriptionlistjobs.h" | ||
30 | #include "treenode.h" | 30 | #include "treenode.h" | ||
31 | 31 | | |||
32 | #include "akregator_debug.h" | 32 | #include "akregator_debug.h" | ||
33 | #include <KIconLoader> | | |||
34 | #include <KLocalizedString> | 33 | #include <KLocalizedString> | ||
35 | 34 | | |||
35 | #include <QApplication> | ||||
36 | #include <QByteArray> | 36 | #include <QByteArray> | ||
37 | #include <QDataStream> | 37 | #include <QDataStream> | ||
38 | #include <QIcon> | 38 | #include <QIcon> | ||
39 | #include <QList> | 39 | #include <QList> | ||
40 | #include <QMimeData> | 40 | #include <QMimeData> | ||
41 | #include <QUrl> | 41 | #include <QUrl> | ||
42 | #include <QVariant> | 42 | #include <QVariant> | ||
43 | #include <QItemSelection> | 43 | #include <QItemSelection> | ||
44 | #include <QStyle> | ||||
44 | 45 | | |||
45 | using namespace Akregator; | 46 | using namespace Akregator; | ||
46 | using namespace Syndication; | 47 | using namespace Syndication; | ||
47 | 48 | | |||
48 | #define AKREGATOR_TREENODE_MIMETYPE QStringLiteral("akregator/treenode-id") | 49 | #define AKREGATOR_TREENODE_MIMETYPE QStringLiteral("akregator/treenode-id") | ||
49 | 50 | | |||
50 | namespace { | 51 | namespace { | ||
51 | static uint nodeIdForIndex(const QModelIndex &idx) | 52 | static uint nodeIdForIndex(const QModelIndex &idx) | ||
▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Line(s) | 235 | { | |||
245 | return feed->title(); | 246 | return feed->title(); | ||
246 | } | 247 | } | ||
247 | case Qt::DecorationRole: | 248 | case Qt::DecorationRole: | ||
248 | { | 249 | { | ||
249 | if (index.column() != TitleColumn) { | 250 | if (index.column() != TitleColumn) { | ||
250 | return QVariant(); | 251 | return QVariant(); | ||
251 | } | 252 | } | ||
252 | const Feed *const feed = qobject_cast<const Feed *const>(node); | 253 | const Feed *const feed = qobject_cast<const Feed *const>(node); | ||
253 | return feed && feed->isFetching() ? node->icon().pixmap(KIconLoader::SizeSmall, QIcon::Active) : node->icon(); | 254 | const auto iconSize = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); | ||
255 | return feed && feed->isFetching() ? node->icon().pixmap(iconSize, QIcon::Active) : node->icon(); | ||||
254 | } | 256 | } | ||
255 | case SubscriptionIdRole: | 257 | case SubscriptionIdRole: | ||
256 | return node->id(); | 258 | return node->id(); | ||
257 | case IsGroupRole: | 259 | case IsGroupRole: | ||
258 | return node->isGroup(); | 260 | return node->isGroup(); | ||
259 | case IsFetchableRole: | 261 | case IsFetchableRole: | ||
260 | return !node->isGroup() && !node->isAggregation(); | 262 | return !node->isGroup() && !node->isAggregation(); | ||
261 | case IsAggregationRole: | 263 | case IsAggregationRole: | ||
▲ Show 20 Lines • Show All 316 Lines • Show Last 20 Lines |