|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CNTSERVICES_H |
|
19 #define CNTSERVICES_H |
|
20 |
|
21 #include <cntviewparams.h> |
|
22 #include <qtcontacts.h> |
|
23 |
|
24 #include "cntabstractserviceprovider.h" |
|
25 |
|
26 class CntAbstractViewManager; |
|
27 class XQServiceProvider; |
|
28 |
|
29 QTM_USE_NAMESPACE |
|
30 |
|
31 class CntServices : public QObject, public CntAbstractServiceProvider |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 CntServices(); |
|
37 ~CntServices(); |
|
38 |
|
39 public: |
|
40 |
|
41 void setViewManager( CntAbstractViewManager& aViewManager ); |
|
42 |
|
43 /** |
|
44 * Opens contact selection view where multiple contacts can be selected. |
|
45 * @param title The view title |
|
46 * @param action Filter definition for filtering contacts based on supported action. Can be left empty. |
|
47 * @param aServiceProvider The service provider |
|
48 */ |
|
49 void singleFetch(const QString &title, |
|
50 const QString &action, |
|
51 CntAbstractServiceProvider& aServiceProvider ); |
|
52 |
|
53 /** |
|
54 * Opens contact selection view where multiple contacts can be selected. |
|
55 * @param title The view title |
|
56 * @param action Filter definition for filtering contacts based on supported action. Can be left empty. |
|
57 * @param aServiceProvider The service provider |
|
58 */ |
|
59 void multiFetch(const QString &title, |
|
60 const QString &action, |
|
61 CntAbstractServiceProvider& aServiceProvider ); |
|
62 |
|
63 /** |
|
64 * Launch editor for creating a new contact with a given detail. |
|
65 * @param definitionName The field type |
|
66 * @param value The value for the field. |
|
67 * @param aServiceProvider The service provider |
|
68 */ |
|
69 void editCreateNew(const QString &definitionName, const QString &value, |
|
70 CntAbstractServiceProvider& aServiceProvider ); |
|
71 |
|
72 /** |
|
73 * Launch editor for creating a new contact based on vCard file indicated in arg. |
|
74 * @param vCardFile The vCard file name and path. |
|
75 * @param aServiceProvider The service provider |
|
76 */ |
|
77 void editCreateNewFromVCard(const QString &vCardFile, |
|
78 CntAbstractServiceProvider& aServiceProvider ); |
|
79 |
|
80 /** |
|
81 * User can first choose a contact, and then an editor is opened. |
|
82 * A new detail is provided by caller and it will be prefilled in the editor. |
|
83 * @param definitionName The field type |
|
84 * @param value The value for the field. |
|
85 * @param aServiceProvider The service provider |
|
86 */ |
|
87 void editUpdateExisting(const QString &definitionName, const QString &value, |
|
88 CntAbstractServiceProvider& aServiceProvider ); |
|
89 |
|
90 /** |
|
91 * Open the editor for an existing contact.' |
|
92 * @param contactId |
|
93 * @param aServiceProvider The service provider |
|
94 */ |
|
95 void editExisting(int contactId, |
|
96 CntAbstractServiceProvider& aServiceProvider); |
|
97 |
|
98 /** |
|
99 * Opens Contact Card. |
|
100 * @param contactId The contact ID |
|
101 * @param aServiceProvider The service provider |
|
102 */ |
|
103 void launchContactCard(int contactId, |
|
104 CntAbstractServiceProvider& aServiceProvider ); |
|
105 |
|
106 /** |
|
107 * Opens Contact Card for non-saved contact. |
|
108 * @param definitionName Field name. |
|
109 * @param value The field value. |
|
110 * @param aServiceProvider The service provider |
|
111 */ |
|
112 void launchTemporaryContactCard(const QString &definitionName, const QString &value, |
|
113 CntAbstractServiceProvider& aServiceProvider ); |
|
114 |
|
115 /** |
|
116 * Set the flag that allows quiting the application explicitly |
|
117 * using the quitApp slot. By default the value is always true. |
|
118 */ |
|
119 void setQuitable(bool quitable); |
|
120 |
|
121 public slots: |
|
122 /** |
|
123 * Quit the application |
|
124 */ |
|
125 void quitApp(); |
|
126 |
|
127 private: |
|
128 void removeNotSupportedFields(QContact& contact); |
|
129 void removeNotSupportedDetails(QContact& contact); |
|
130 |
|
131 private: // from CntAbstractServiceProvider |
|
132 void CompleteServiceAndCloseApp(const QVariant& retValue); |
|
133 private: |
|
134 CntAbstractViewManager* mViewManager; // not owned |
|
135 QStringList m_definitionNames; |
|
136 CntAbstractServiceProvider* mCurrentProvider; // not owned |
|
137 bool mIsQuitable; |
|
138 }; |
|
139 |
|
140 #endif /* CNTSERVICES_H */ |