~ubuntu-branches/ubuntu/quantal/qtmobility/quantal

« back to all changes in this revision

Viewing changes to src/organizer/filters/qorganizeritemidfilter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-16 16:18:07 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101116161807-k2dzt2nyse975r3l
Tags: 1.1.0-0ubuntu1
* New upstream release
* Syncronise with Debian, no remaining changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 
4
** All rights reserved.
 
5
** Contact: Nokia Corporation (qt-info@nokia.com)
 
6
**
 
7
** This file is part of the Qt Mobility Components.
 
8
**
 
9
** $QT_BEGIN_LICENSE:LGPL$
 
10
** Commercial Usage
 
11
** Licensees holding valid Qt Commercial licenses may use this file in 
 
12
** accordance with the Qt Commercial License Agreement provided with
 
13
** the Software or, alternatively, in accordance with the terms
 
14
** contained in a written agreement between you and Nokia.
 
15
**
 
16
** GNU Lesser General Public License Usage
 
17
** Alternatively, this file may be used under the terms of the GNU Lesser
 
18
** General Public License version 2.1 as published by the Free Software
 
19
** Foundation and appearing in the file LICENSE.LGPL included in the
 
20
** packaging of this file.  Please review the following information to
 
21
** ensure the GNU Lesser General Public License version 2.1 requirements
 
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
23
**
 
24
** In addition, as a special exception, Nokia gives you certain additional
 
25
** rights.  These rights are described in the Nokia Qt LGPL Exception
 
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
27
**
 
28
** GNU General Public License Usage
 
29
** Alternatively, this file may be used under the terms of the GNU
 
30
** General Public License version 3.0 as published by the Free Software
 
31
** Foundation and appearing in the file LICENSE.GPL included in the
 
32
** packaging of this file.  Please review the following information to
 
33
** ensure the GNU General Public License version 3.0 requirements will be
 
34
** met: http://www.gnu.org/copyleft/gpl.html.
 
35
**
 
36
** If you are unsure which license is appropriate for your use, please
 
37
** contact the sales department at qt-sales@nokia.com.
 
38
** $QT_END_LICENSE$
 
39
**
 
40
****************************************************************************/
 
41
 
 
42
#include "qorganizeritemidfilter.h"
 
43
#include "qorganizeritemidfilter_p.h"
 
44
#include "qorganizeritemfilter_p.h"
 
45
#include "qorganizermanager.h"
 
46
 
 
47
QTM_BEGIN_NAMESPACE
 
48
 
 
49
/*!
 
50
  \class QOrganizerItemIdFilter
 
51
  \brief The QOrganizerItemIdFilter class provides a filter based around a list of organizer item ids
 
52
  \inmodule QtOrganizer
 
53
  \ingroup organizer-filters
 
54
  
 
55
  It may be used to select organizer items whose ids are contained in the given list of ids.
 
56
 
 
57
  Note: a QOrganizerItemIdFilter will not be preserved if streamed to a QDataStream.
 
58
 */
 
59
 
 
60
Q_IMPLEMENT_ORGANIZERITEMFILTER_PRIVATE(QOrganizerItemIdFilter);
 
61
 
 
62
/*!
 
63
 * \fn QOrganizerItemIdFilter::QOrganizerItemIdFilter(const QOrganizerItemFilter& other)
 
64
 * Constructs a copy of \a other if possible, otherwise constructs a new organizer item id filter
 
65
 */
 
66
 
 
67
/*!
 
68
 * Constructs a new organizer item id filter
 
69
 */
 
70
QOrganizerItemIdFilter::QOrganizerItemIdFilter()
 
71
    : QOrganizerItemFilter(new QOrganizerItemIdFilterPrivate)
 
72
{
 
73
}
 
74
 
 
75
/*!
 
76
 * Sets the list which contains the ids of possible matching organizer items to \a ids
 
77
 * \sa ids()
 
78
 */
 
79
void QOrganizerItemIdFilter::setIds(const QList<QOrganizerItemId>& ids)
 
80
{
 
81
    Q_D(QOrganizerItemIdFilter);
 
82
    d->m_ids = ids;
 
83
}
 
84
 
 
85
/*!
 
86
 * Inserts the id \a id into the list which contains the ids of possible matching items
 
87
 * \sa setIds()
 
88
 */
 
89
void QOrganizerItemIdFilter::insert(const QOrganizerItemId& id)
 
90
{
 
91
    Q_D(QOrganizerItemIdFilter);
 
92
    if (!d->m_ids.contains(id))
 
93
        d->m_ids.append(id);
 
94
}
 
95
 
 
96
/*!
 
97
 * Removes the id \a id from the list which contains the ids of possible matching items,
 
98
 * if it is contained in the list, otherwise has no effect.
 
99
 * \sa clear()
 
100
 */
 
101
void QOrganizerItemIdFilter::remove(const QOrganizerItemId& id)
 
102
{
 
103
    Q_D(QOrganizerItemIdFilter);
 
104
    d->m_ids.removeAll(id);
 
105
}
 
106
 
 
107
/*!
 
108
 * Clears the list which contains the ids of possible matching items.
 
109
 * A id filter with a cleared list will match no items.
 
110
 * \sa setIds()
 
111
 */
 
112
void QOrganizerItemIdFilter::clear()
 
113
{
 
114
    Q_D(QOrganizerItemIdFilter);
 
115
    d->m_ids.clear();
 
116
}
 
117
 
 
118
/*!
 
119
 * Returns the list of ids of organizer items which match this filter
 
120
 * \sa setIds()
 
121
 */
 
122
QList<QOrganizerItemId> QOrganizerItemIdFilter::ids() const
 
123
{
 
124
    Q_D(const QOrganizerItemIdFilter);
 
125
    return d->m_ids;
 
126
}
 
127
 
 
128
QTM_END_NAMESPACE