1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2015 The Qt Company Ltd. |
4 | ** Contact: http://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtContacts module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at http://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 or version 3 as published by the Free |
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
22 | ** following information to ensure the GNU Lesser General Public License |
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
25 | ** |
26 | ** As a special exception, The Qt Company gives you certain additional |
27 | ** rights. These rights are described in The Qt Company LGPL Exception |
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
29 | ** |
30 | ** $QT_END_LICENSE$ |
31 | ** |
32 | ****************************************************************************/ |
33 | |
34 | #include "qcontactchangelogfilter.h" |
35 | #include "qcontactchangelogfilter_p.h" |
36 | |
37 | QT_BEGIN_NAMESPACE_CONTACTS |
38 | |
39 | /*! |
40 | \class QContactChangeLogFilter |
41 | \brief The QContactChangeLogFilter class provides a filter based around a |
42 | contact timestamp criterion. |
43 | |
44 | \inmodule QtContacts |
45 | |
46 | \ingroup contacts-filters |
47 | |
48 | It may be used to select contacts which have been updated or created |
49 | within a certain period of time. |
50 | */ |
51 | |
52 | /*! |
53 | * \enum QContactChangeLogFilter::EventType |
54 | * Enumerates the type of changes which a changelog filter can match against |
55 | * \value EventAdded |
56 | * \value EventChanged |
57 | * \value EventRemoved |
58 | */ |
59 | |
60 | Q_IMPLEMENT_CONTACTFILTER_PRIVATE(QContactChangeLogFilter); |
61 | |
62 | /*! |
63 | * \fn QContactChangeLogFilter::QContactChangeLogFilter(const QContactFilter& other) |
64 | * Constructs a copy of \a other if possible, otherwise constructs a new changelog filter |
65 | */ |
66 | |
67 | /*! |
68 | * Constructs a new changelog filter which matches changes of the specified \a type |
69 | */ |
70 | QContactChangeLogFilter::QContactChangeLogFilter(QContactChangeLogFilter::EventType type) |
71 | : QContactFilter(new QContactChangeLogFilterPrivate(type)) |
72 | { |
73 | } |
74 | |
75 | /*! |
76 | * Sets the type of change that this filter will match against to \a type |
77 | * \sa eventType() |
78 | */ |
79 | void QContactChangeLogFilter::setEventType(QContactChangeLogFilter::EventType type) |
80 | { |
81 | Q_D(QContactChangeLogFilter); |
82 | d->m_eventType = type; |
83 | } |
84 | |
85 | /*! |
86 | * Sets the date and time lower-bound criterion of the filter to \a since |
87 | * \sa since() |
88 | */ |
89 | void QContactChangeLogFilter::setSince(const QDateTime& since) |
90 | { |
91 | Q_D(QContactChangeLogFilter); |
92 | d->m_since = since; |
93 | } |
94 | |
95 | /*! |
96 | * Returns the date and time lower-bound criterion of the filter |
97 | * \sa setSince() |
98 | */ |
99 | QDateTime QContactChangeLogFilter::since() const |
100 | { |
101 | Q_D(const QContactChangeLogFilter); |
102 | return d->m_since; |
103 | } |
104 | |
105 | /*! |
106 | * Returns the type of change that this filter will match against |
107 | * \sa setEventType() |
108 | */ |
109 | QContactChangeLogFilter::EventType QContactChangeLogFilter::eventType() const |
110 | { |
111 | Q_D(const QContactChangeLogFilter); |
112 | return d->m_eventType; |
113 | } |
114 | |
115 | QT_END_NAMESPACE_CONTACTS |
116 | |