pkiutilities/CertmanUi/INC/CertmanuiKeeper.h
changeset 0 164170e6151a
child 9 a005fc61b02a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003-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:   Declaration of the CCertManUIKeeper class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef  CERTMANUIKEEPER_H
       
    20 #define  CERTMANUIKEEPER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <unifiedcertstore.h>
       
    24 #include <mctwritablecertstore.h>
       
    25 #include <unifiedkeystore.h>
       
    26 #include <AknProgressDialog.h>
       
    27 #include <ConeResLoader.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CCrCertEntry;
       
    31 class CCertManUISyncWrapper;
       
    32 class CCertManUICertData;
       
    33 class CCertManUiDialogs;
       
    34 class CEikColumnListBox;
       
    35 class CAknTabGroup;
       
    36 class CAknNavigationDecorator;
       
    37 class CAknNavigationControlContainer;
       
    38 class CCertManUICertificateHelper;
       
    39 class CCertManUIWaitDialog;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  CCertManUIKeeper view control class.
       
    45 *
       
    46 *  @lib certmanui.lib
       
    47 */
       
    48 NONSHARABLE_CLASS( CCertManUIKeeper ): public CCoeControl, public MCoeControlObserver
       
    49     {
       
    50     public: // functions
       
    51 
       
    52         /**
       
    53         * Default constructor
       
    54         */
       
    55         CCertManUIKeeper();
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         ~CCertManUIKeeper();
       
    61 
       
    62         /**
       
    63         * NewL
       
    64         */
       
    65         static class CCertManUIKeeper* NewL(const TRect& aRect, TUid aViewId);
       
    66 
       
    67         /**
       
    68         * NewLC
       
    69         */
       
    70         static class CCertManUIKeeper* NewLC(const TRect& aRect, TUid aViewId);
       
    71 
       
    72         /**
       
    73         * Activates the WimTitle and CertManUI Trust Settings title
       
    74         */
       
    75         void ActivateTitleL(TInt aCurrentTitle);
       
    76 
       
    77         /**
       
    78         * Returns *iCertStore
       
    79         */
       
    80         CUnifiedCertStore*& CertManager();
       
    81 
       
    82 
       
    83         /**
       
    84         * Initializes CertManUI Keeper
       
    85         */
       
    86         void InitializeL(const TRect& aRect, TUid aViewId);
       
    87 
       
    88         /**
       
    89         * Returns *iKeyStore
       
    90         */
       
    91         CUnifiedKeyStore*& KeyManager();
       
    92 
       
    93         /**
       
    94         * Added here because FocusChanged need to be included
       
    95         * in every control derived from CCoeControl that can have listbox
       
    96         */
       
    97         void FocusChanged(TDrawNow aDrawNow);
       
    98 
       
    99         /**
       
   100         * Checks that cacerts.dat file is not corrupt
       
   101         * and returns CA certificates from it.
       
   102         */
       
   103         void RefreshCAEntriesL();
       
   104 
       
   105         /**
       
   106         * Checks that cacerts.dat file is not corrupt
       
   107         * and returns user certificates from it.
       
   108         */
       
   109         void RefreshUserCertEntriesL();
       
   110 
       
   111         /**
       
   112         * Returns peer certificates.
       
   113         */
       
   114         void RefreshPeerCertEntriesL();
       
   115 
       
   116         /**
       
   117         * Returns peer certificates.
       
   118         */
       
   119         void RefreshDeviceCertEntriesL();
       
   120 
       
   121         /**
       
   122         * Shows error note
       
   123         */
       
   124         void ShowErrorNoteL(TInt aError);
       
   125 
       
   126         /**
       
   127         * Displays wait dialog
       
   128         */
       
   129         void StartWaitDialogL(TInt aDialogSelector);
       
   130 
       
   131         /**
       
   132         * Closes wait dialog
       
   133         */
       
   134         void CloseWaitDialogL();
       
   135 
       
   136         /**
       
   137         * Check whether local feature is on
       
   138         */
       
   139         TBool IsLocalFeatureSupported( const TInt aFeature ) const;
       
   140 
       
   141     public: //data
       
   142 
       
   143         /**
       
   144         * Added here because FocusChanged need to be included
       
   145         * in every control derived from CCoeControl that can have listbox
       
   146         */
       
   147         CEikColumnListBox*    iListBox;
       
   148 
       
   149 
       
   150         /**
       
   151         * To store CA certificate entries for Authority and Trust view
       
   152         * Includes label from x509certnameparser.
       
   153         */
       
   154         RMPointerArray<CCertManUICertData>     iCALabelEntries;
       
   155 
       
   156         /**
       
   157         * To store CA certificate entries for Authority and Trust view
       
   158         * Includes label from x509certnameparser.
       
   159         */
       
   160         RMPointerArray<CCertManUICertData>     iUserLabelEntries;
       
   161 
       
   162         /**
       
   163         * To store Peer certificate entries for Trusted Site view
       
   164         * Includes label from x509certnameparser.
       
   165         */
       
   166         RMPointerArray<CCertManUICertData>     iPeerLabelEntries;
       
   167 
       
   168         /**
       
   169         * To store Peer certificate entries for Device certificate view
       
   170         * Includes label from x509certnameparser.
       
   171         */
       
   172         RMPointerArray<CCertManUICertData>     iDeviceLabelEntries;
       
   173 
       
   174         /**
       
   175         * Used to wrap asynchronous calls
       
   176         */
       
   177         CCertManUISyncWrapper*          iWrapper;
       
   178 
       
   179         /**
       
   180         * File session handle.
       
   181         */
       
   182         RFs                             iRfs;
       
   183 
       
   184         /**
       
   185         * To keep track of the currupted state of cacerts.dat
       
   186         * ETrue = not corrupted
       
   187         * EFalse = corrupted
       
   188         */
       
   189         TBool   iCertsDatOK;
       
   190 
       
   191         /**
       
   192         * To know when CertManUI is started the first time
       
   193         * ETrue = startup
       
   194         * EFalse = not startup
       
   195         */
       
   196         TBool   iStartup;
       
   197 
       
   198          /**
       
   199         * Certificate helper class
       
   200         */
       
   201         CCertManUICertificateHelper*    iCertificateHelper;
       
   202 
       
   203     private: // functions
       
   204 
       
   205         /**
       
   206         * EPOC default constructor.
       
   207         * @param aRect Frame rectangle for container.
       
   208         */
       
   209         void ConstructL(const TRect& aRect, TUid aViewId);
       
   210 
       
   211         /**
       
   212         * Opens resource file.
       
   213         */
       
   214         void AddResourceFileL();
       
   215 
       
   216         /**
       
   217         * Handles control events
       
   218         * Cannot be changed to non-leaving function.
       
   219         * L-function is required by the class definition, even if empty.
       
   220         */
       
   221         void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
       
   222 
       
   223         /**
       
   224         * Called when a key is pressed
       
   225         * Cannot be changed to non-leaving function.
       
   226         * L-function is required by the class definition, even if empty.
       
   227         */
       
   228         TKeyResponse OfferKeyEventL(
       
   229                 const TKeyEvent& aKeyEvent, TEventCode aType);
       
   230 
       
   231         /**
       
   232         * Read local variation settings
       
   233         */
       
   234         void ReadLocalVariationL();
       
   235 
       
   236 
       
   237     private: //data
       
   238 
       
   239         /**
       
   240         * To store the previous view id inside CertManUI
       
   241         */
       
   242         TUid    iPreviousViewId;
       
   243 
       
   244         /**
       
   245         * To store the previous view id outside CertManUI, KSettListSecurityViewId
       
   246         */
       
   247         TUid    iPreviousAppViewId;
       
   248 
       
   249         /**
       
   250         * To list certificates with criteria.
       
   251         */
       
   252         CCertAttributeFilter*   iFilter;
       
   253 
       
   254         /**
       
   255         * To list certificates with criteria.
       
   256         */
       
   257 
       
   258         TCTKeyAttributeFilter*    iKeyFilter;
       
   259 
       
   260         /**
       
   261         * UnifiedCertStore
       
   262         */
       
   263         CUnifiedCertStore*    iStore;
       
   264 
       
   265         /**
       
   266         * UnifiedCertStore
       
   267         */
       
   268         CUnifiedKeyStore*   iKeyStore;
       
   269 
       
   270         /**
       
   271         * To store CA certificate entries.
       
   272         */
       
   273         RMPointerArray<CCTCertInfo>     iCAEntries;
       
   274 
       
   275         /**
       
   276         * To store User certificate entries.
       
   277         */
       
   278         RMPointerArray<CCTCertInfo>     iUserEntries;
       
   279 
       
   280         /**
       
   281         * To store Peer certificate entries.
       
   282         */
       
   283         RMPointerArray<CCTCertInfo>     iPeerEntries;
       
   284 
       
   285         /**
       
   286         * To store Device certificate entries.
       
   287         */
       
   288         RMPointerArray<CCTCertInfo>     iDeviceEntries;
       
   289 
       
   290         /**
       
   291         * To store Key entries
       
   292         */
       
   293         RMPointerArray<CCTKeyInfo>      iKeyEntries;
       
   294 
       
   295         /*
       
   296         * Wait dialog
       
   297         */
       
   298         CCertManUIWaitDialog*           iCertmanUIDialog;
       
   299 
       
   300         /**
       
   301         * Local variantion mask
       
   302         */
       
   303         TInt    iLocalFeaturesMask;
       
   304 
       
   305         /**
       
   306         * Resource loader
       
   307         */
       
   308         RConeResourceLoader iResourceLoader;
       
   309 
       
   310 
       
   311    };
       
   312 
       
   313 /**
       
   314 *  Small helper class to put label and certificate in same class.
       
   315 *
       
   316 *  @lib certmanui.lib
       
   317 */
       
   318 NONSHARABLE_CLASS( CCertManUICertData ): public CBase
       
   319     {
       
   320     public:
       
   321 
       
   322         CCertManUICertData();
       
   323 
       
   324         void Release();
       
   325 
       
   326         HBufC* iCAEntryLabel;
       
   327         HBufC* iUserEntryLabel;
       
   328         HBufC* iPeerEntryLabel;
       
   329         HBufC* iDeviceEntryLabel;
       
   330         CCTCertInfo* iCAEntry;
       
   331         CCTCertInfo* iUserEntry;
       
   332         CCTCertInfo* iPeerEntry;
       
   333         CCTCertInfo* iDeviceEntry;
       
   334 
       
   335     private:
       
   336         ~CCertManUICertData();
       
   337 
       
   338     };
       
   339 
       
   340 
       
   341 /**
       
   342  * Helper function to close wait dialog if leave happens.
       
   343  * CCertManUIKeeper::StartWaitDialogL() brings wait dialog visible.
       
   344  * Wait dialog must be closed by calling CCertManUIKeeper::CloseWaitDialogL().
       
   345  * If code leaves after StartWaitDialogL() and before CloseWaitDialogL(),
       
   346  * the wait dialog is never closed.
       
   347  */
       
   348 void CleanupCloseWaitDialogPushL( CCertManUIKeeper& aKeeper );
       
   349 
       
   350 
       
   351 #endif // __CERTMANUIKEEPER_H
       
   352 
       
   353 // End of File