policymanagement/policyengine/policyengineui/inc/PolicyEngineUi.h
branchRCL_3
changeset 26 19bba8228ff0
parent 25 b183ec05bd8c
equal deleted inserted replaced
25:b183ec05bd8c 26:19bba8228ff0
     1 /*
     1 /*
     2 * Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: Implementation of policymanagement components
    14 * Description: Implementation of policymanagement components
    15 *
    15 *
       
    16 *
    16 */
    17 */
    17 
    18 
    18 #ifndef POLICYENGINEUI_H
       
    19 #define POLICYENGINEUI_H
       
    20 
    19 
    21 #include <hbdialog.h>
    20 #ifndef POLICTY_ENGINE_UI_HEADER_
    22 #include <hbdevicedialoginterface.h>
    21 #define POLICTY_ENGINE_UI_HEADER_
    23 
    22 
    24 class HbDialog;
    23 //  INCLUDES
    25 class HbLineEdit;
    24 #include <e32base.h>
       
    25 #include <eiknotapi.h>
    26 
    26 
    27 class PolicyEngineUI : public HbDialog, public HbDeviceDialogInterface
    27 //  CONSTANTS
       
    28 
       
    29 _LIT8( KUserAcceptMark, "A");
       
    30 _LIT8( KUserDenyMark, "D");
       
    31 const TUint KDelimeterChar = '|';
       
    32 
       
    33 enum TUserResponse
       
    34 	{
       
    35 	EUserAccept,
       
    36 	EUserDeny,
       
    37 	};
       
    38 
       
    39 //  FORWARD DECLARATIONS
       
    40 
       
    41 class CCoeEnv;
       
    42 class CPolicyEngineUi;
       
    43 
       
    44 
       
    45 class CPolicyEngineNotifier : public CBase, public MEikSrvNotifierBase2
       
    46 	{
       
    47 	public:
       
    48 	
       
    49 		CPolicyEngineNotifier();
       
    50 		~CPolicyEngineNotifier();
       
    51 		static CPolicyEngineNotifier* NewL();
       
    52 		void ConstructL();
       
    53 		
       
    54 		void Complete( TUserResponse aResponse);
       
    55 		
       
    56     public: //From MEikSrvNotifierBase2
       
    57     
       
    58 		void Release();
       
    59 		TNotifierInfo RegisterL();
       
    60 		TNotifierInfo Info() const;
       
    61 		TPtrC8 StartL(const TDesC8& aBuffer);
       
    62 		void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
       
    63 		void Cancel();
       
    64 		TPtrC8 UpdateL(const TDesC8& aBuffer); 
       
    65 		  
       
    66 	private:
       
    67 		CPolicyEngineUi * iPolicyEngineUi;
       
    68 		
       
    69         /**
       
    70         * refers connections is intialized or not
       
    71         */
       
    72         TNotifierInfo         iInfo;             ///< Notifier info
       
    73         
       
    74         TInt iReplySlot;
       
    75         RMessagePtr2 iMessage;
       
    76 	};
       
    77 
       
    78 
       
    79 
       
    80 /**
       
    81 * This class provides a wrapper for some common dialogs for the policy engine
       
    82 *
       
    83 * @lib policyengineui.lib
       
    84 */
       
    85 class CPolicyEngineUi : public CActive
    28     {
    86     {
    29 Q_OBJECT
    87     public:  // Constructors and destructor
    30 
    88 
    31 public:
    89         /**
    32     PolicyEngineUI(const QVariantMap& parameters);
    90         * Constructor.
    33     ~PolicyEngineUI();
    91         */
    34     void DisplayNotificationDialog(const QVariantMap &parameters);
    92         CPolicyEngineUi();
    35     void ShowInputDialog();
       
    36     bool verifyFingerPrint();
       
    37 
    93 
    38 public slots:
    94         /**
    39     void onOKSelected();
    95         * Two-phased constructor.
    40     void onCancelSelected();
    96         */
    41     void establishTrust();
    97         static CPolicyEngineUi* NewL();
    42     void cancelTrust();
    98     
    43     void onTrustCreation();
    99         /**
    44     void codeTextChanged();
   100         * Destructor.
    45 public:
   101         */
    46     //derived from HbDeviceDialogInterface
   102         virtual ~CPolicyEngineUi();
    47     bool setDeviceDialogParameters(const QVariantMap &parameters);
   103         
    48     int deviceDialogError() const;
   104         void ActivateL( const TDesC8& aCorporate, const TDesC8& aRandomPart, CPolicyEngineNotifier* iNotifier); 
    49     void closeDeviceDialog(bool byClient);
   105     
    50     HbDialog *deviceDialogWidget() const;
   106 		void RunL();
       
   107 		TInt RunError(TInt aError);
       
   108 		void DoCancel();
    51 
   109 
    52 signals:
   110 	public:
    53     //signal to be sent to client
   111 
    54     void deviceDialogClosed();
   112         /**
    55     void deviceDialogData(QVariantMap data);
   113         * Execute corporate policy question chain, which user deny or accept. One response generated.
       
   114         * @param aCorporate - Corparate name used in queries
       
   115         * @param aRandomPart - Random part of certificate, which user must know.
       
   116         * @return TUserResponse - Response value for user
       
   117         */
       
   118         
       
   119         TUserResponse ShowCorporateConfirmationDialogL( const TDesC8& aCorporate,
       
   120         										   		 const TDesC8& aRandomPart);
       
   121 	private:
       
   122 	
       
   123 		//private enums
       
   124 		enum TDialog
       
   125 			{
       
   126 			EControl = 0, 
       
   127 			EQuestion,
       
   128 			ERemove,
       
   129 			EDenied,
       
   130 			EUnMatch
       
   131 			};
       
   132 		
       
   133 		enum TDlgResp
       
   134 			{
       
   135 			EOkResp,
       
   136 			ECancelResp
       
   137 			};
       
   138 		
       
   139 	private:
       
   140 	
       
   141         /**
       
   142         * Two-phased constructor.
       
   143         */
       
   144 		void ConstructL();
       
   145 
       
   146 	
       
   147 		TInt ShowDialogL( const TDialog& aDialog);
       
   148 		TDlgResp ShowConfirmationQueryL( const TDesC& aText, const TBool& aWithCancel );
       
   149 		TDlgResp ShowPossessionMessageQueryL();
       
   150 		TDlgResp DataQueryL( const TDesC& aText, TDes& aInput );
       
   151 
       
   152     private: // Data
    56     
   153     
    57 private:
   154     	HBufC * iCorporate;
    58     // number of tries user does
   155     	HBufC * iRandomPart;
    59     int estbTrustCount;
   156     	TInt iState;
    60     QString iServerName;
   157     	CPolicyEngineNotifier * iNotifier;
    61     QString iFingerprint;
   158     	
    62     QString iCode;
   159 	    TInt iResourceFileOffset;
    63     HbLineEdit *mContentEdit;
   160         CCoeEnv* iCoeEnv;  // not owned
    64     HbDialog* mdialog;
   161         };
    65     };
       
    66 
   162 
    67 #endif // POLICYENGINEUI_H
   163 
       
   164 #endif      // POLICTY_ENGINE_UI_HEADER_
       
   165             
       
   166 // End of File