PlasmaActivitiesStats

terms.h
1/*
2 SPDX-FileCopyrightText: 2015, 2016 Ivan Cukic <ivan.cukic(at)kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef KACTIVITIES_STATS_TERMS_H
8#define KACTIVITIES_STATS_TERMS_H
9
10#include <initializer_list>
11
12#include <QDate>
13#include <QString>
14#include <QStringList>
15
16#include "plasmaactivitiesstats_export.h"
17
18namespace KActivities
19{
20namespace Stats
21{
22/**
23 * @namespace KActivities::Stats::Terms
24 * Provides enums and strucss to use.for building queries with @c Query.
25 */
26namespace Terms
27{
28/**
29 * Enumerator specifying the ordering in which the
30 * results of the query should be listed
31 */
32enum PLASMAACTIVITIESSTATS_EXPORT Order {
33 HighScoredFirst, ///< Resources with the highest scores first
34 RecentlyUsedFirst, ///< Recently used resources first
35 RecentlyCreatedFirst, ///< Recently created resources first
36 OrderByUrl, ///< Order by uri, alphabetically
37 OrderByTitle, ///< Order by uri, alphabetically
38};
39
40/**
41 * Which resources should be returned
42 */
43enum PLASMAACTIVITIESSTATS_EXPORT Select {
44 LinkedResources, ///< Resources linked to an activity, or globally
45 UsedResources, ///< Resources that have been accessed
46 AllResources, ///< Combined set of accessed and linked resources
47};
48
49/**
50 * @struct KActivities::Stats::Terms::Limit terms.h <KActivities/Stats/Terms>
51 *
52 * How many items you need. The default is 50
53 */
54struct PLASMAACTIVITIESSTATS_EXPORT Limit {
55 Limit(int value);
56 int value;
57};
58
59/**
60 * @struct KActivities::Stats::Terms::Offset terms.h <KActivities/Stats/Terms>
61 *
62 * How many items to skip?
63 * This can be specified only if limit is also set to a finite value.
64 */
65struct PLASMAACTIVITIESSTATS_EXPORT Offset {
66 Offset(int value);
67 int value;
68};
69
70/**
71 * @struct KActivities::Stats::Terms::Type terms.h <KActivities/Stats/Terms>
72 *
73 * Term to filter the resources according to their types
74 */
75struct PLASMAACTIVITIESSTATS_EXPORT Type {
76 /**
77 * Show resources of any type
78 */
79 static Type any();
80 /**
81 * Show non-directory resources
82 */
83 static Type files();
84 /**
85 * Show directory resources aka folders
86 */
87 static Type directories();
88
89 inline Type(std::initializer_list<QString> types)
90 : values(types)
91 {
92 }
93
94 Type(QStringList types);
95 Type(QString type);
96
97 const QStringList values;
98};
99
100/**
101 * @struct KActivities::Stats::Terms::Agent terms.h <KActivities/Stats/Terms>
102 *
103 * Term to filter the resources according the agent (application) which
104 * accessed it
105 */
106struct PLASMAACTIVITIESSTATS_EXPORT Agent {
107 /**
108 * Show resources accessed/linked by any application
109 */
110 static Agent any();
111
112 /**
113 * Show resources not tied to a specific agent
114 */
115 static Agent global();
116
117 /**
118 * Show resources accessed/linked by the current application
119 */
120 static Agent current();
121
122 inline Agent(std::initializer_list<QString> agents)
123 : values(agents)
124 {
125 }
126
127 Agent(QStringList agents);
128 Agent(QString agent);
129
130 const QStringList values;
131};
132
133/**
134 * @struct KActivities::Stats::Terms::Activity terms.h <KActivities/Stats/Terms>
135 *
136 * Term to filter the resources according the activity in which they
137 * were accessed
138 */
139struct PLASMAACTIVITIESSTATS_EXPORT Activity {
140 /**
141 * Show resources accessed in / linked to any activity
142 */
143 static Activity any();
144
145 /**
146 * Show resources linked to all activities
147 */
148 static Activity global();
149
150 /**
151 * Show resources linked to all activities
152 */
153 static Activity current();
154
155 inline Activity(std::initializer_list<QString> activities)
156 : values(activities)
157 {
158 }
159
160 Activity(QStringList activities);
161 Activity(QString activity);
162
163 const QStringList values;
164};
165
166/**
167 * @struct KActivities::Stats::Terms::Url terms.h <KActivities/Stats/Terms>
168 *
169 * Url filtering.
170 */
171struct PLASMAACTIVITIESSTATS_EXPORT Url {
172 /**
173 * Show only resources that start with the specified prefix
174 */
175 static Url startsWith(const QString &prefix);
176
177 /**
178 * Show resources that contain the specified infix
179 */
180 static Url contains(const QString &infix);
181
182 /**
183 * Show local files
184 */
185 static Url localFile();
186
187 /**
188 * Show local files, smb, fish, ftp and sftp
189 */
190 static Url file();
191
192 inline Url(std::initializer_list<QString> urlPatterns)
193 : values(urlPatterns)
194 {
195 }
196
197 Url(QStringList urlPatterns);
198 Url(QString urlPattern);
199
200 const QStringList values;
201};
202/**
203 * @since 6.0
204 */
205struct PLASMAACTIVITIESSTATS_EXPORT Title {
206 /**
207 * Show resources with title that contain the specified pattern
208 */
209 Title(const QString &titlePattern)
210 : values({titlePattern})
211 {
212 }
213 /// Default constructor
215 {
216 }
217
218 const QStringList values;
219};
220
221/**
222 * @struct KActivities::Stats::Terms::Date terms.h <KActivities/Stats/Terms>
223 *
224 * On which start access date do you want to filter ?
225 */
226struct PLASMAACTIVITIESSTATS_EXPORT Date {
227 Date(QDate value);
228 Date(QDate start, QDate end);
229
230 static Date today();
231 static Date yesterday();
232 static Date currentWeek();
233 static Date previousWeek();
234 static Date fromString(QString);
235
236 QDate start, end;
237};
238
239} // namespace Terms
240
241} // namespace Stats
242} // namespace KActivities
243
244PLASMAACTIVITIESSTATS_EXPORT
245QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Order &order);
246
247PLASMAACTIVITIESSTATS_EXPORT
248QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Select &select);
249
250PLASMAACTIVITIESSTATS_EXPORT
251QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Type &type);
252
253PLASMAACTIVITIESSTATS_EXPORT
254QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Agent &agent);
255
256PLASMAACTIVITIESSTATS_EXPORT
257QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Activity &activity);
258
259PLASMAACTIVITIESSTATS_EXPORT
260QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Url &url);
261
262PLASMAACTIVITIESSTATS_EXPORT
263QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Limit &limit);
264
265PLASMAACTIVITIESSTATS_EXPORT
266QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Offset &offset);
267
268PLASMAACTIVITIESSTATS_EXPORT
269QDebug operator<<(QDebug dbg, const KActivities::Stats::Terms::Date &date);
270
271#endif // KACTIVITIES_STATS_TERMS_H
Provides enums and strucss to use.for building queries with Query.
Term to filter the resources according the activity in which they were accessed.
Definition terms.h:139
static Activity global()
Show resources linked to all activities.
static Activity current()
Show resources linked to all activities.
static Activity any()
Show resources accessed in / linked to any activity.
Term to filter the resources according the agent (application) which accessed it.
Definition terms.h:106
static Agent current()
Show resources accessed/linked by the current application.
static Agent global()
Show resources not tied to a specific agent.
static Agent any()
Show resources accessed/linked by any application.
On which start access date do you want to filter ?
Definition terms.h:226
How many items you need.
Definition terms.h:54
How many items to skip?
Definition terms.h:65
Title(const QString &titlePattern)
Show resources with title that contain the specified pattern.
Definition terms.h:209
Title()
Default constructor.
Definition terms.h:214
Term to filter the resources according to their types.
Definition terms.h:75
static Type files()
Show non-directory resources.
static Type directories()
Show directory resources aka folders.
static Type any()
Show resources of any type.
static Url file()
Show local files, smb, fish, ftp and sftp.
static Url startsWith(const QString &prefix)
Show only resources that start with the specified prefix.
Definition terms.cpp:119
static Url localFile()
Show local files.
static Url contains(const QString &infix)
Show resources that contain the specified infix.
Definition terms.cpp:124
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 28 2025 12:01:02 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.