qtcontactsmobility/plugins/contacts/symbian/inc/cntdisplaylabel.h
changeset 46 efe85016a067
parent 37 fd64c38c277d
--- a/qtcontactsmobility/plugins/contacts/symbian/inc/cntdisplaylabel.h	Fri Jun 11 13:29:23 2010 +0300
+++ b/qtcontactsmobility/plugins/contacts/symbian/inc/cntdisplaylabel.h	Wed Jun 23 18:02:44 2010 +0300
@@ -44,6 +44,7 @@
 
 #include <QObject>
 #include <QLatin1String>
+#include <e32base.h>
 
 #include <qcontactmanager.h>
 #include <qcontact.h>
@@ -53,6 +54,57 @@
 
 QTM_USE_NAMESPACE
 
+class CRepository;
+class CntDisplayLabel;
+
+#ifdef SYMBIAN_BACKEND_USE_SQLITE
+#include <centralrepository.h>
+
+// CONSTANTS
+// Please keep this in sync with the values in the system header file <cntuids.h>
+// We cannot include this system header file because it is owned by an app layer
+// package (Contacts package). This being a mw layer, the dependency is not allowed
+const TUid KCRUiContacts = {0x2002FF54};
+const TUint32 KCntNameOrdering = 0x00000001;
+
+// name order enumerations
+// Please keep this in sync with <cntuids.h> See above comments
+enum NameOrder {
+    CntOrderLastFirst = 0x0,
+    CntOrderLastCommaFirst = 0x1,
+    CntOrderFirstLast = 0x2
+};
+
+/**
+ * This class is used to listen to central repository value changes
+ * of Contacts app settings. It is also used to get key values for
+ * name ordering
+ */
+class CntCenrep : public CActive
+{
+public:
+    CntCenrep(TUint32 aKey, CntDisplayLabel& aDisplayLabel );
+    ~CntCenrep();
+ 
+public:
+    int getValue();
+
+private:
+    void RunL();
+    TInt RunError(TInt aError);
+    void DoCancel();
+
+private:
+    CRepository*                iCenrep;
+    CntDisplayLabel*            iDisplayLabel;
+    const TUint32               iKey;
+    int                         iValue;
+};
+
+#else
+class CntCenrep;
+#endif
+
 class CntDisplayLabel : public QObject
 {
     Q_OBJECT
@@ -61,11 +113,17 @@
     CntDisplayLabel();
     virtual ~CntDisplayLabel();
 
-    QString synthesizedDisplayLabel( const QContact& contact, QContactManager::Error* error) const;
-    QString unNamned() const;
+    QString synthesizedDisplayLabel( const QContact& contact, QContactManager::Error* error);
     QList<QPair<QLatin1String, QLatin1String> > contactFilterDetails() const;
     QList<QPair<QLatin1String, QLatin1String> > groupFilterDetails() const;
     
+#ifdef SYMBIAN_BACKEND_USE_SQLITE
+    void updateNameOrdering();
+#endif
+
+signals:
+    void displayLabelChanged();
+    
 private:
     void setDisplayLabelDetails();
     QString generateDisplayLabel( const QContact &contact, const QList<QList<QPair<QLatin1String, QLatin1String> > > detailList) const;
@@ -75,6 +133,7 @@
 private:
     QList<QList<QPair<QLatin1String, QLatin1String> > > m_contactDisplayLabelDetails;
     QList<QList<QPair<QLatin1String, QLatin1String> > > m_groupDisplayLabelDetails;
+    CntCenrep* m_settings;
     int m_nameOrder;
 };