|
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 CNTUICONTACTCARDEXT_H |
|
19 #define CNTUICONTACTCARDEXT_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QIcon> |
|
23 #include <QString> |
|
24 #include <qcontact.h> |
|
25 #include <qcontactdetail.h> |
|
26 |
|
27 QTM_USE_NAMESPACE |
|
28 |
|
29 |
|
30 /** |
|
31 * Represents one extension action. |
|
32 */ |
|
33 class CntUiContactCardExtAction |
|
34 { |
|
35 public: |
|
36 |
|
37 /// First line of text on the button. |
|
38 virtual QString firstTextLine() const = 0; |
|
39 |
|
40 /// Second line of text on the button. |
|
41 virtual QString secondTextLine() const = 0; |
|
42 |
|
43 /// Large icon that appears on the left. |
|
44 virtual const QIcon icon() const = 0; |
|
45 |
|
46 /** |
|
47 * The position of the action button is set based on detail type. |
|
48 * If the detail is empty (dummy detail) then the button appears at the end. |
|
49 */ |
|
50 virtual const QContactDetail& detailUsedForChoosingPosition() const = 0; |
|
51 |
|
52 protected: |
|
53 virtual ~CntUiContactCardExtAction() {} |
|
54 }; |
|
55 |
|
56 |
|
57 /** |
|
58 * UI extension class for extending Contact Card and MyCard |
|
59 */ |
|
60 class CntUiContactCardExtension : public QObject |
|
61 { |
|
62 public: |
|
63 CntUiContactCardExtension() {} |
|
64 |
|
65 /** |
|
66 * Prepare the data that will be queried by other methods. |
|
67 * \param aContact The contact which is being displayed. |
|
68 * \param aMyCard Tells whether the contact is my contact. |
|
69 */ |
|
70 virtual void prepare( QContact& aContact, bool aMyCard ) = 0; |
|
71 |
|
72 /** |
|
73 * Gives the action count. |
|
74 * The prepare() will be called before this. |
|
75 */ |
|
76 virtual int actionCount() const = 0; |
|
77 |
|
78 /** |
|
79 * Gives an action. |
|
80 * The prepare() will be called before this. |
|
81 */ |
|
82 virtual const CntUiContactCardExtAction& actionAt( int aIndex ) const = 0; |
|
83 |
|
84 |
|
85 /** |
|
86 * Allows the plugin to handle the short pressing. |
|
87 * \param aIndex The index of the action in the scope of this extension. |
|
88 * Should be implemented synchronously. |
|
89 */ |
|
90 virtual void handleShortPress( int aIndex ) = 0; |
|
91 |
|
92 // TODO Pending UX comments on this. |
|
93 // virtual void handleLongPress( int aIndex ) = 0; |
|
94 |
|
95 public: |
|
96 /// For extending this interface later on without BC break. |
|
97 virtual void* ContactCardExtensionExtension( |
|
98 int /*aExtensionId*/ ) { return NULL; } |
|
99 |
|
100 signals: |
|
101 |
|
102 /** |
|
103 * Plugin should re-implement this signal and emit it |
|
104 * once extension data changes. |
|
105 * Note that an action should not disappear. It can change, but not disappear. |
|
106 */ |
|
107 void contactCardExtensionDataChanged( QList<int> aChangedActionIndexes ); |
|
108 |
|
109 protected: |
|
110 // prevent deleting by client |
|
111 virtual ~CntUiContactCardExtension() {} |
|
112 }; |
|
113 |
|
114 #endif //CNTUICONTACTCARDEXT_H |
|
115 |