|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 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 QtCore module of the Qt Toolkit. |
|
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 #ifndef CNTDISPLAYLABEL_H_ |
|
43 #define CNTDISPLAYLABEL_H_ |
|
44 |
|
45 #include <QObject> |
|
46 #include <QLatin1String> |
|
47 #include <e32base.h> |
|
48 |
|
49 #include <qcontactmanager.h> |
|
50 #include <qcontact.h> |
|
51 #include <qcontactdetail.h> |
|
52 |
|
53 |
|
54 #include <qmobilityglobal.h> |
|
55 |
|
56 QTM_USE_NAMESPACE |
|
57 |
|
58 class CRepository; |
|
59 class CntDisplayLabel; |
|
60 |
|
61 #ifdef SYMBIAN_BACKEND_USE_SQLITE |
|
62 #include <centralrepository.h> |
|
63 |
|
64 // CONSTANTS |
|
65 // Please keep this in sync with the values in the system header file <cntuids.h> |
|
66 // We cannot include this system header file because it is owned by an app layer |
|
67 // package (Contacts package). This being a mw layer, the dependency is not allowed |
|
68 const TUid KCRCntSettings = {0x2002FF54}; |
|
69 const TUint32 KCntNameOrdering = 0x00000001; |
|
70 |
|
71 // name order enumerations |
|
72 // Please keep this in sync with <cntuids.h> See above comments |
|
73 enum NameOrder { |
|
74 CntOrderLastFirst = 0x0, |
|
75 CntOrderLastCommaFirst = 0x1, |
|
76 CntOrderFirstLast = 0x2 |
|
77 }; |
|
78 |
|
79 /** |
|
80 * This class is used to listen to central repository value changes |
|
81 * of Contacts app settings. It is also used to get key values for |
|
82 * name ordering |
|
83 */ |
|
84 class CntCenrep : public CActive |
|
85 { |
|
86 public: |
|
87 CntCenrep(TUint32 aKey, CntDisplayLabel& aDisplayLabel ); |
|
88 ~CntCenrep(); |
|
89 |
|
90 public: |
|
91 int getValue(); |
|
92 |
|
93 private: |
|
94 void RunL(); |
|
95 TInt RunError(TInt aError); |
|
96 void DoCancel(); |
|
97 |
|
98 private: |
|
99 CRepository* iCenrep; |
|
100 CntDisplayLabel* iDisplayLabel; |
|
101 const TUint32 iKey; |
|
102 int iValue; |
|
103 }; |
|
104 |
|
105 #else |
|
106 // No problem on earlier platforms |
|
107 #include <cntuids.h> |
|
108 #endif |
|
109 |
|
110 class CntDisplayLabel : public QObject |
|
111 { |
|
112 Q_OBJECT |
|
113 |
|
114 public: |
|
115 CntDisplayLabel(); |
|
116 virtual ~CntDisplayLabel(); |
|
117 |
|
118 QString synthesizedDisplayLabel( const QContact& contact, QContactManager::Error* error); |
|
119 QList<QPair<QLatin1String, QLatin1String> > contactFilterDetails() const; |
|
120 QList<QPair<QLatin1String, QLatin1String> > groupFilterDetails() const; |
|
121 |
|
122 #ifdef SYMBIAN_BACKEND_USE_SQLITE |
|
123 void updateNameOrdering(); |
|
124 #endif |
|
125 |
|
126 signals: |
|
127 void displayLabelChanged(); |
|
128 |
|
129 private: |
|
130 void setDisplayLabelDetails(); |
|
131 QString generateDisplayLabel( const QContact &contact, const QList<QList<QPair<QLatin1String, QLatin1String> > > detailList) const; |
|
132 QString delimiter() const; |
|
133 QString comma() const; |
|
134 |
|
135 private: |
|
136 QList<QList<QPair<QLatin1String, QLatin1String> > > m_contactDisplayLabelDetails; |
|
137 QList<QList<QPair<QLatin1String, QLatin1String> > > m_groupDisplayLabelDetails; |
|
138 #ifdef SYMBIAN_BACKEND_USE_SQLITE |
|
139 CntCenrep* m_settings; |
|
140 #endif |
|
141 int m_nameOrder; |
|
142 }; |
|
143 |
|
144 #endif /* CNTDISPLAYLABEL_H_ */ |