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