MauiKit Calendar

filter.cpp
1// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3
4#include "filter.h"
5
6qint64 Filter::collectionId() const
7{
8 return m_collectionId;
9}
10
11QStringList Filter::tags() const
12{
13 return m_tags;
14}
15
16QString Filter::name() const
17{
18 return m_name;
19}
20
21void Filter::setCollectionId(qint64 collectionId)
22{
23 if (m_collectionId == collectionId) {
24 return;
25 }
26 m_collectionId = collectionId;
27 Q_EMIT collectionIdChanged();
28}
29
30void Filter::setTags(QStringList tags)
31{
32 if (m_tags == tags) {
33 return;
34 }
35 m_tags = tags;
36 Q_EMIT tagsChanged();
37}
38
39void Filter::setName(const QString &name)
40{
41 if (m_name == name) {
42 return;
43 }
44 m_name = name;
45 Q_EMIT nameChanged();
46}
47
48void Filter::toggleFilterTag(const QString tagName)
49{
50 if (!m_tags.contains(tagName)) {
51 m_tags.append(tagName);
52 Q_EMIT tagsChanged();
53 } else {
54 m_tags.removeAll(tagName);
55 Q_EMIT tagsChanged();
56 }
57}
58
59void Filter::removeTag(const QString &tagName)
60{
61 m_tags.removeAll(tagName);
62 Q_EMIT tagsChanged();
63}
64
65void Filter::reset()
66{
67 setName({});
68 setTags({});
69 setCollectionId(-1);
70}
QString name(StandardAction id)
void append(QList< T > &&value)
qsizetype removeAll(const AT &t)
Q_EMITQ_EMIT
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.