Messagelib

aggregation.h
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <[email protected]>
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  *
7  *******************************************************************************/
8 
9 #ifndef MESSAGELIST_CORE_AGGREGATION_H
10 #define MESSAGELIST_CORE_AGGREGATION_H
11 
12 class QDataStream;
13 
14 #include <QVector>
15 #include <QPair>
16 #include <QString>
17 
18 #include "core/optionset.h"
19 
20 namespace MessageList {
21 namespace Core {
27 class Aggregation : public OptionSet
28 {
29 public:
30 
36  enum Grouping {
43  // Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
44  // TODO: Group by message status: "Important messages", "Urgent messages", "To reply", "To do" etc...
45  // TODO: Group by message unread status: "Unread messages", "Read messages" (maybe "New" ?)
46  };
47 
57  // Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
58  };
59 
65  enum Threading {
70  // Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
71  };
72 
78  enum ThreadLeader {
81  // Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
82  };
83 
95  // Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
96  };
97 
107  // Warning: Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
108  };
109 
110 private:
111  Grouping mGrouping;
112  GroupExpandPolicy mGroupExpandPolicy;
113  Threading mThreading;
114  ThreadLeader mThreadLeader;
115  ThreadExpandPolicy mThreadExpandPolicy;
116  FillViewStrategy mFillViewStrategy;
117 
118 public:
119  explicit Aggregation();
120  explicit Aggregation(const Aggregation &opt);
121  explicit Aggregation(
123  static Q_REQUIRED_RESULT bool compareName(Aggregation *agg1, Aggregation *agg2)
124  {
125  return agg1->name() < agg2->name();
126  }
127 
128 public:
132  Q_REQUIRED_RESULT Grouping grouping() const;
133 
138  {
139  mGrouping = g;
140  }
141 
148 
152  Q_REQUIRED_RESULT GroupExpandPolicy groupExpandPolicy() const
153  {
154  return mGroupExpandPolicy;
155  }
156 
162  {
163  mGroupExpandPolicy = groupExpandPolicy;
164  }
165 
173 
177  Q_REQUIRED_RESULT Threading threading() const
178  {
179  return mThreading;
180  }
181 
186  {
187  mThreading = t;
188  }
189 
196 
200  Q_REQUIRED_RESULT ThreadLeader threadLeader() const
201  {
202  return mThreadLeader;
203  }
204 
211  {
212  mThreadLeader = tl;
213  }
214 
223 
228  {
229  return mThreadExpandPolicy;
230  }
231 
238  {
239  mThreadExpandPolicy = threadExpandPolicy;
240  }
241 
249 
253  Q_REQUIRED_RESULT FillViewStrategy fillViewStrategy() const
254  {
255  return mFillViewStrategy;
256  }
257 
262  {
263  mFillViewStrategy = fillViewStrategy;
264  }
265 
272 
276  void save(QDataStream &stream) const override;
277 
281  bool load(QDataStream &stream) override;
282 };
283 } // namespace Core
284 } // namespace MessageList
285 
286 #endif
static QVector< QPair< QString, int > > enumerateGroupExpandPolicyOptions(Grouping g)
Enumerates the group sort direction options compatible with the specified Grouping.
Thread by "In-Reply-To" and "References" fields.
Definition: aggregation.h:68
A set of aggregation options that can be applied to the MessageList::Model in a single shot...
Definition: aggregation.h:27
static QVector< QPair< QString, int > > enumerateThreadExpandPolicyOptions(Threading t)
Enumerates the thread expand policies compatible with the specified Threading option.
void setFillViewStrategy(FillViewStrategy fillViewStrategy)
Sets the current fill view strategy.
Definition: aggregation.h:261
void setGroupExpandPolicy(GroupExpandPolicy groupExpandPolicy)
Sets the GroupExpandPolicy for the groups.
Definition: aggregation.h:161
A set of options that can be applied to the MessageList in one shot.
Definition: optionset.h:31
ThreadExpandPolicy
The available thread expand policies.
Definition: aggregation.h:89
ThreadLeader threadLeader() const
Returns the current thread leader determination method.
Definition: aggregation.h:200
static QVector< QPair< QString, int > > enumerateThreadingOptions()
Enumerates the available threading method options.
Thread by all of the above and try to match subjects too.
Definition: aggregation.h:69
Perform no threading at all.
Definition: aggregation.h:66
Threading
The available threading methods.
Definition: aggregation.h:65
Makes sense only with GroupByDate or GroupByDateRange.
Definition: aggregation.h:55
Threading threading() const
Returns the current threading method.
Definition: aggregation.h:177
FillViewStrategy
The available fill view strategies.
Definition: aggregation.h:103
const QString & description() const
Returns a description of this option set.
Definition: optionset.h:78
Group the messages by the date of the thread leader.
Definition: aggregation.h:38
Thread by "In-Reply-To" field only.
Definition: aggregation.h:67
Never expand groups during a view fill algorithm.
Definition: aggregation.h:54
Use smart (thread leader) date ranges ("Today","Yesterday","Last Week"...)
Definition: aggregation.h:39
Grouping grouping() const
Returns the currently set Grouping option.
Definition: aggregation.cpp:31
Don&#39;t group messages at all.
Definition: aggregation.h:37
GroupExpandPolicy
The available group expand policies.
Definition: aggregation.h:53
The thread grouping is computed from the topmost message (very similar to least recent, but might be different if timezones or machine clocks are screwed)
Definition: aggregation.h:79
void setThreadExpandPolicy(ThreadExpandPolicy threadExpandPolicy)
Sets the current thread expand policy.
Definition: aggregation.h:237
const QString & name() const
Returns the name of this OptionSet.
Definition: optionset.h:58
Expand all threads (this might be very slow)
Definition: aggregation.h:93
ThreadLeader
The available thread leading options.
Definition: aggregation.h:78
Expand threads with unread messages (this includes new)
Definition: aggregation.h:92
void setThreadLeader(ThreadLeader tl)
Sets the current thread leader determination method.
Definition: aggregation.h:210
static QVector< QPair< QString, int > > enumerateThreadLeaderOptions(Grouping g, Threading t)
Enumerates the thread leader determination methods compatible with the specified Threading and the sp...
All groups are expanded as they are inserted.
Definition: aggregation.h:56
static QVector< QPair< QString, int > > enumerateGroupingOptions()
Enumerates the available grouping options as a QList of pairs in that the first item is the localized...
static QVector< QPair< QString, int > > enumerateFillViewStrategyOptions()
Enumerates the fill view strategies.
Do larger chunks of work, zero intervals between chunks.
Definition: aggregation.h:105
GroupExpandPolicy groupExpandPolicy() const
Returns the current GroupExpandPolicy.
Definition: aggregation.h:152
void setGrouping(Grouping g)
Sets the Grouping option.
Definition: aggregation.h:137
Expand threads with "hot" messages (this includes new, unread, important, todo)
Definition: aggregation.h:94
Never expand any thread, this is fast.
Definition: aggregation.h:90
Grouping
Message grouping.
Definition: aggregation.h:36
The thread grouping is computed from the most recent message.
Definition: aggregation.h:80
Do small chunks of work, small intervals between chunks to allow for UI event processing.
Definition: aggregation.h:104
bool load(QDataStream &stream) override
Pure virtual reimplemented from OptionSet.
Definition: aggregation.cpp:59
void setThreading(Threading t)
Sets the threading method option.
Definition: aggregation.h:185
DEPRECATED. New message status no longer exists.
Definition: aggregation.h:91
FillViewStrategy fillViewStrategy() const
Returns the current fill view strategy.
Definition: aggregation.h:253
Do one large chunk, no interactivity at all.
Definition: aggregation.h:106
Group by sender (incoming) or receiver (outgoing) field.
Definition: aggregation.h:40
ThreadExpandPolicy threadExpandPolicy() const
Returns the current thread expand policy.
Definition: aggregation.h:227
void save(QDataStream &stream) const override
Pure virtual reimplemented from OptionSet.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Jul 14 2020 23:13:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.