Warning: That file was not part of the compilation database. It may have many parsing errors.

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#ifndef QCONTACTACTION_H
35#define QCONTACTACTION_H
36
37#include <QtCore/qmap.h>
38#include <QtCore/qobject.h>
39#include <QtCore/qstringlist.h>
40#include <QtCore/qvariant.h>
41
42#include <QtContacts/qcontact.h>
43#include <QtContacts/qcontactactiontarget.h>
44#include <QtContacts/qcontactactiondescriptor.h>
45#include <QtContacts/qcontactdetail.h>
46#include <QtContacts/qcontactfilter.h>
47
48QT_BEGIN_NAMESPACE_CONTACTS
49
50class QContactActionData;
51class Q_CONTACTS_EXPORT QContactAction : public QObject
52{
53 Q_OBJECT
54
55public:
56 virtual ~QContactAction() = 0;
57
58 /* Initiate the asynchronous action on the given list of contacts (and optionally, per-contact-details) with the given parameters */
59 virtual bool invokeAction(const QList<QContactActionTarget>& targets, const QVariantMap& parameters = QVariantMap()) = 0;
60
61 /* The possible states of an action */
62 enum State {
63 InactiveState = 0, // operation not yet started
64 ActiveState, // operation started, not yet finished
65 FinishedState, // operation successfully completed
66 FinishedDetachedState, // operation started, no further information available - name under discussion.
67 FinishedWithErrorState // operation finished, but error occurred
68 };
69
70 virtual State state() const = 0;
71
72 /* Returns the most recently received result, or an empty QVariantMap if no results received */
73 virtual QVariantMap results() const = 0;
74
75 /* Convenience functions */
76 bool invokeAction(const QContactActionTarget& target, const QVariantMap& parameters = QVariantMap())
77 {
78 return invokeAction(targets: QList<QContactActionTarget>() << target, parameters);
79 }
80 bool invokeAction(const QContact& contact, const QContactDetail& detail = QContactDetail(), const QVariantMap& parameters = QVariantMap())
81 {
82 return invokeAction(targets: QList<QContactActionTarget>() << QContactActionTarget(contact, detail), parameters);
83 }
84
85 // common actions
86 inline static const QString ActionCall() {return QStringLiteral("call");};
87 inline static const QString ActionEmail() {return QStringLiteral("email");};
88 inline static const QString ActionSms() {return QStringLiteral("sms");};
89 inline static const QString ActionMms() {return QStringLiteral("mms");};
90 inline static const QString ActionChat() {return QStringLiteral("chat");};
91 inline static const QString ActionVideoCall() {return QStringLiteral("videocall");};
92 inline static const QString ActionOpenInEditor() {return QStringLiteral("edit");};
93 inline static const QString ActionOpenInViewer() {return QStringLiteral("view");};
94
95Q_SIGNALS:
96 void stateChanged(QContactAction::State);
97 void resultsAvailable();
98
99public:
100 /* return a list of names of actions which are available */
101 static QStringList availableActions(const QString& serviceName = QString());
102
103 /* return a list of descriptors for action implementations matching the given criteria */
104 static QList<QContactActionDescriptor> actionDescriptors(const QString& actionName = QString());
105
106 /* return a pointer to an implementation of the action identified by the given descriptor */
107 static QContactAction* action(const QContactActionDescriptor& descriptor);
108};
109
110QT_END_NAMESPACE_CONTACTS
111
112#endif // QCONTACTACTION_H
113

Warning: That file was not part of the compilation database. It may have many parsing errors.

source code of qtpim/src/contacts/qcontactaction.h