Messagelib

threadingcache.h
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2016 Daniel Vrátil <[email protected]>
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  *
7  *******************************************************************************/
8 
9 #pragma once
10 
11 #include "messageitem.h"
12 #include <QHash>
13 
14 namespace MessageList
15 {
16 namespace Core
17 {
18 class Aggregation;
19 
20 class ThreadingCache
21 {
22 public:
23  ThreadingCache();
24  ~ThreadingCache();
25 
26  Q_REQUIRED_RESULT bool isEnabled() const;
27  void setEnabled(bool enabled);
28 
29  void load(const QString &id, const Aggregation *aggregation);
30  void save();
31 
32  void addItemToCache(MessageItem *mi);
33 
34  void updateParent(MessageItem *mi, MessageItem *parent);
35 
36  MessageItem *parentForItem(MessageItem *mi, qint64 &parentId) const;
37 
38  void expireParent(MessageItem *item);
39 
40 private:
41  QHash<qint64 /* child */, qint64 /* parent */> mParentCache;
42  QHash<qint64 /* ID */, MessageItem *> mItemCache;
43 
44  QString mCacheId;
48  bool mEnabled = true;
49 };
50 } // namespace Core
51 } // namespace MessageList
@ NoThreading
Perform no threading at all.
Definition: aggregation.h:66
QAction * load(const QObject *recvr, const char *slot, QObject *parent)
@ TopmostMessage
The thread grouping is computed from the topmost message (very similar to least recent,...
Definition: aggregation.h:79
@ NoGrouping
Don't group messages at all.
Definition: aggregation.h:37
Threading
The available threading methods.
Definition: aggregation.h:65
const QList< QKeySequence > & save()
ThreadLeader
The available thread leading options.
Definition: aggregation.h:78
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Mar 24 2023 04:08:32 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.