Changeset View
Changeset View
Standalone View
Standalone View
src/resultmodel.cpp
Show All 40 Lines | |||||
41 | #include <common/database/Database.h> | 41 | #include <common/database/Database.h> | ||
42 | #include <utils/qsqlquery_iterator.h> | 42 | #include <utils/qsqlquery_iterator.h> | ||
43 | #include <utils/slide.h> | 43 | #include <utils/slide.h> | ||
44 | #include <utils/member_matcher.h> | 44 | #include <utils/member_matcher.h> | ||
45 | #include "resultset.h" | 45 | #include "resultset.h" | ||
46 | #include "resultwatcher.h" | 46 | #include "resultwatcher.h" | ||
47 | #include "cleaning.h" | 47 | #include "cleaning.h" | ||
48 | #include "kactivities/consumer.h" | 48 | #include "kactivities/consumer.h" | ||
49 | #include "kactivities-stat-logsettings.h" | ||||
49 | 50 | | |||
50 | #include <common/specialvalues.h> | 51 | #include <common/specialvalues.h> | ||
51 | 52 | | |||
52 | #define MAX_CHUNK_LOAD_SIZE 50 | 53 | #define MAX_CHUNK_LOAD_SIZE 50 | ||
53 | #define MAX_RELOAD_CACHE_SIZE 50 | 54 | #define MAX_RELOAD_CACHE_SIZE 50 | ||
54 | 55 | | |||
55 | #define QDBG qDebug() << "KActivitiesStats(" << (void*)this << ")" | 56 | #define QDBG qCDebug(KACTIVITY_STAT_LOG) << "KActivitiesStats(" << (void*)this << ")" | ||
56 | 57 | | |||
57 | namespace KActivities { | 58 | namespace KActivities { | ||
58 | namespace Stats { | 59 | namespace Stats { | ||
59 | 60 | | |||
60 | class ResultModelPrivate { | 61 | class ResultModelPrivate { | ||
61 | public: | 62 | public: | ||
62 | ResultModelPrivate(Query query, const QString &clientId, ResultModel *parent) | 63 | ResultModelPrivate(Query query, const QString &clientId, ResultModel *parent) | ||
63 | : cache(this, clientId, query.limit()) | 64 | : cache(this, clientId, query.limit()) | ||
Show All 40 Lines | 87 | public: | |||
104 | { | 105 | { | ||
105 | return m_items.size(); | 106 | return m_items.size(); | ||
106 | } | 107 | } | ||
107 | 108 | | |||
108 | inline void setLinkedResultPosition(const QString &resourcePath, | 109 | inline void setLinkedResultPosition(const QString &resourcePath, | ||
109 | int position) | 110 | int position) | ||
110 | { | 111 | { | ||
111 | if (!m_orderingConfig.isValid()) { | 112 | if (!m_orderingConfig.isValid()) { | ||
112 | qWarning() << "We can not reorder the results, no clientId was specified"; | 113 | qCWarning(KACTIVITY_STAT_LOG) << "We can not reorder the results, no clientId was specified"; | ||
113 | return; | 114 | return; | ||
114 | } | 115 | } | ||
115 | 116 | | |||
116 | // Preconditions: | 117 | // Preconditions: | ||
117 | // - cache is ordered properly, first on the user's desired order, | 118 | // - cache is ordered properly, first on the user's desired order, | ||
118 | // then on the query specified order | 119 | // then on the query specified order | ||
119 | // - the resource that needs to be moved is a linked resource, not | 120 | // - the resource that needs to be moved is a linked resource, not | ||
120 | // one that comes from the stats (there are overly many | 121 | // one that comes from the stats (there are overly many | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 187 | if (other != d && other->cache.m_clientId == m_clientId) { | |||
187 | other->fetch(FetchReset); | 188 | other->fetch(FetchReset); | ||
188 | } | 189 | } | ||
189 | } | 190 | } | ||
190 | } | 191 | } | ||
191 | 192 | | |||
192 | inline void debug() const | 193 | inline void debug() const | ||
193 | { | 194 | { | ||
194 | for (const auto& item: m_items) { | 195 | for (const auto& item: m_items) { | ||
195 | qDebug() << "Item: " << item; | 196 | qCDebug(KACTIVITY_STAT_LOG) << "Item: " << item; | ||
196 | } | 197 | } | ||
197 | } | 198 | } | ||
198 | 199 | | |||
199 | void loadOrderingConfig(const QString &activityTag) | 200 | void loadOrderingConfig(const QString &activityTag) | ||
200 | { | 201 | { | ||
201 | if (!m_configFile) { | 202 | if (!m_configFile) { | ||
202 | qDebug() << "Nothing to load - the client id is empty"; | 203 | qCDebug(KACTIVITY_STAT_LOG) << "Nothing to load - the client id is empty"; | ||
203 | return; | 204 | return; | ||
204 | } | 205 | } | ||
205 | 206 | | |||
206 | m_orderingConfig = | 207 | m_orderingConfig = | ||
207 | KConfigGroup(m_configFile, | 208 | KConfigGroup(m_configFile, | ||
208 | QStringLiteral("ResultModel-OrderingFor-") + m_clientId + activityTag); | 209 | QStringLiteral("ResultModel-OrderingFor-") + m_clientId + activityTag); | ||
209 | 210 | | |||
210 | if (m_orderingConfig.hasKey("kactivitiesLinkedItemsOrder")) { | 211 | if (m_orderingConfig.hasKey("kactivitiesLinkedItemsOrder")) { | ||
▲ Show 20 Lines • Show All 896 Lines • Show Last 20 Lines |