~chris.gagnon/+junk/qtpim-coverage

« back to all changes in this revision

Viewing changes to src/contacts/qcontactactionfactory.cpp

  • Committer: chris.gagnon
  • Date: 2013-12-10 23:09:37 UTC
  • Revision ID: chris.gagnon@canonical.com-20131210230937-2akf1ft1edcttk87
first post

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of the QtContacts module of the Qt Toolkit.
 
7
**
 
8
** $QT_BEGIN_LICENSE:LGPL$
 
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 Digia.  For licensing terms and
 
14
** conditions see http://qt.digia.com/licensing.  For further information
 
15
** use the contact form at http://qt.digia.com/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 as published by the Free Software
 
20
** Foundation and appearing in the file LICENSE.LGPL included in the
 
21
** packaging of this file.  Please review the following information to
 
22
** ensure the GNU Lesser General Public License version 2.1 requirements
 
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
24
**
 
25
** In addition, as a special exception, Digia gives you certain additional
 
26
** rights.  These rights are described in the Digia Qt LGPL Exception
 
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
28
**
 
29
** GNU General Public License Usage
 
30
** Alternatively, this file may be used under the terms of the GNU
 
31
** General Public License version 3.0 as published by the Free Software
 
32
** Foundation and appearing in the file LICENSE.GPL included in the
 
33
** packaging of this file.  Please review the following information to
 
34
** ensure the GNU General Public License version 3.0 requirements will be
 
35
** met: http://www.gnu.org/copyleft/gpl.html.
 
36
**
 
37
**
 
38
** $QT_END_LICENSE$
 
39
**
 
40
****************************************************************************/
 
41
 
 
42
#include "qcontactactionfactory.h"
 
43
#include "qcontactactiondescriptor_p.h"
 
44
 
 
45
QT_BEGIN_NAMESPACE_CONTACTS
 
46
 
 
47
/*!
 
48
  \class QContactActionFactory
 
49
  \brief The QContactActionFactory class provides an interface for clients
 
50
  to retrieve instances of action implementations
 
51
  \inmodule QtContacts
 
52
  \ingroup contacts-actions
 
53
 */
 
54
 
 
55
/*!
 
56
  \fn QContactActionFactory::QContactActionFactory(QObject* parent)
 
57
    Default constructor for this interface.  Passes \a parent to the QObject constructor.
 
58
*/
 
59
 
 
60
/*!
 
61
  \fn QContactActionFactory::~QContactActionFactory()
 
62
 
 
63
  Clears any memory in use by this factory
 
64
 */
 
65
 
 
66
QContactActionFactory::~QContactActionFactory()
 
67
{
 
68
}
 
69
 
 
70
 
 
71
/*!
 
72
  \fn QContactActionFactory::actionDescriptors() const
 
73
 
 
74
  Return a list of action descriptors for the actions that this factory supports.
 
75
*/
 
76
 
 
77
/*!
 
78
  \fn QContactActionFactory::contactFilter(const QContactActionDescriptor& which) const
 
79
 
 
80
  Returns a filter to select contacts that are supported by the action specified by \a which.
 
81
*/
 
82
 
 
83
/*!
 
84
  \fn QContactActionFactory::supportedTargets(const QContact& contact, const QContactActionDescriptor& which) const
 
85
 
 
86
  Returns the targets which are supported by the action described by \a which that may be instantiated by this factory
 
87
  for the given \a contact.  If there are no supported targets for the \a contact, then that
 
88
  contact is not supported by the action.
 
89
 
 
90
  \sa supportsContact()
 
91
 */
 
92
 
 
93
/*!
 
94
  \fn QContactActionFactory::supportsContact(const QContact& contact, const QContactActionDescriptor& which) const
 
95
 
 
96
  Returns true if there are any targets for the given \a contact supported by the action described by \a which.
 
97
 */
 
98
 
 
99
/*!
 
100
  \fn QContactActionFactory::create(const QContactActionDescriptor& which) const
 
101
 
 
102
  Returns a new \l QContactAction instance for the supplied action descriptor \a which.
 
103
 
 
104
  The caller will own this object.
 
105
*/
 
106
 
 
107
/*!
 
108
  \fn QContactActionFactory::metaData(const QString& key, const QList<QContactActionTarget>& targets, const QVariantMap& parameters = QVariantMap(), const QContactActionDescriptor& which) const
 
109
 
 
110
  Returns the meta-data associated with the action described by \a which for the given \a key (such as icon, label or sound cues).
 
111
  The meta-data may vary depending on the \a targets of the action and any \a parameters to invocation which the client may specify.
 
112
 */
 
113
 
 
114
/*!
 
115
  \fn QContactActionFactory::InterfaceName()
 
116
  The name of the interface that action plugins should implement.
 
117
 */
 
118
 
 
119
bool QContactActionFactory::supportsContact(const QContact& contact, const QContactActionDescriptor& which) const
 
120
{
 
121
    // default implementation is naive.
 
122
    return !supportedTargets(contact, which).isEmpty();
 
123
}
 
124
 
 
125
/*!
 
126
  Creates an action descriptor based on the supplied action name \a actionName, service name \a serviceName, action identifier \a actionIdentifier, and version \a implementationVersion.
 
127
*/
 
128
QContactActionDescriptor QContactActionFactory::createDescriptor(const QString& actionName, const QString& serviceName, const QString& actionIdentifier, int implementationVersion) const
 
129
{
 
130
    QContactActionDescriptor retn;
 
131
    retn.d->m_actionName = actionName;
 
132
    retn.d->m_serviceName = serviceName;
 
133
    retn.d->m_identifier = actionIdentifier;
 
134
    retn.d->m_implementationVersion = implementationVersion;
 
135
    retn.d->m_factory = this;
 
136
    return retn;
 
137
}
 
138
 
 
139
#include "moc_qcontactactionfactory.cpp"
 
140
 
 
141
QT_END_NAMESPACE_CONTACTS