|
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 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
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 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 |
|
43 #ifndef QCONTACTACTION_H |
|
44 #define QCONTACTACTION_H |
|
45 |
|
46 #include "qtcontactsglobal.h" |
|
47 |
|
48 #include "qcontactfilter.h" |
|
49 #include "qcontactdetail.h" |
|
50 #include "qcontact.h" |
|
51 |
|
52 #include <QObject> |
|
53 |
|
54 QTM_BEGIN_NAMESPACE |
|
55 |
|
56 class QContactActionDescriptor; |
|
57 class QContactActionData; |
|
58 class Q_CONTACTS_EXPORT QContactAction : public QObject |
|
59 { |
|
60 Q_OBJECT |
|
61 |
|
62 public: |
|
63 /* return a list of names of actions which are available */ |
|
64 static QStringList availableActions(const QString& vendorName = QString(), int implementationVersion = -1); |
|
65 |
|
66 /* return a list of descriptors for action implementations matching the given criteria */ |
|
67 static QList<QContactActionDescriptor> actionDescriptors(const QString& actionName = QString(), const QString& vendorName = QString(), int implementationVersion = -1); |
|
68 |
|
69 /* return a pointer to an implementation of the action identified by the given descriptor */ |
|
70 static QContactAction* action(const QContactActionDescriptor& descriptor); |
|
71 |
|
72 public: |
|
73 virtual ~QContactAction() = 0; |
|
74 |
|
75 virtual QContactActionDescriptor actionDescriptor() const = 0; // the descriptor which uniquely identifies this action |
|
76 virtual QVariantMap metaData() const = 0; // label, icon etc - under discussion! - replaces the above |
|
77 |
|
78 virtual QContactFilter contactFilter(const QVariant& value = QVariant()) const = 0; // use for matching |
|
79 virtual bool isDetailSupported(const QContactDetail &detail, const QContact &contact = QContact()) const = 0; |
|
80 virtual QList<QContactDetail> supportedDetails(const QContact& contact) const = 0; |
|
81 |
|
82 /* Initiate the asynchronous action on the given contact (and optionally detail) */ |
|
83 virtual bool invokeAction(const QContact& contact, const QContactDetail& detail = QContactDetail(), const QVariantMap& parameters = QVariantMap()) = 0; |
|
84 |
|
85 /* The possible states of an action */ |
|
86 enum State { |
|
87 InactiveState = 0, // operation not yet started |
|
88 ActiveState, // operation started, not yet finished |
|
89 FinishedState, // operation successfully completed |
|
90 FinishedDetachedState, // operation started, no further information available - name under discussion. |
|
91 FinishedWithErrorState // operation finished, but error occurred |
|
92 }; |
|
93 |
|
94 virtual State state() const = 0; |
|
95 |
|
96 /* Returns the most recently received result, or an empty QVariantMap if no results received */ |
|
97 virtual QVariantMap results() const = 0; |
|
98 |
|
99 Q_SIGNALS: |
|
100 void stateChanged(QContactAction::State); |
|
101 void resultsAvailable(); |
|
102 }; |
|
103 |
|
104 QTM_END_NAMESPACE |
|
105 |
|
106 #endif |