policymanagement/policyengine/policyengineui/inc/PolicyEngineUi.h
changeset 51 2e64dc50f295
parent 0 b497e44ab2fc
child 72 8ee66fcd0a7c
equal deleted inserted replaced
50:a36219ae6585 51:2e64dc50f295
     1 /*
     1 /*
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2000 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 *
       
    17 */
    16 */
    18 
    17 
       
    18 #ifndef POLICYENGINEUI_H
       
    19 #define POLICYENGINEUI_H
    19 
    20 
    20 #ifndef POLICTY_ENGINE_UI_HEADER_
    21 #include <hbdialog.h>
    21 #define POLICTY_ENGINE_UI_HEADER_
    22 #include <hbdevicedialoginterface.h>
    22 
    23 
    23 //  INCLUDES
    24 class HbDialog;
    24 #include <e32base.h>
    25 class HbLineEdit;
    25 #include <eiknotapi.h>
       
    26 
    26 
    27 //  CONSTANTS
    27 class PolicyEngineUI : public HbDialog, public HbDeviceDialogInterface
       
    28     {
       
    29 Q_OBJECT
    28 
    30 
    29 _LIT8( KUserAcceptMark, "A");
    31 public:
    30 _LIT8( KUserDenyMark, "D");
    32     PolicyEngineUI(const QVariantMap& parameters);
    31 const TUint KDelimeterChar = '|';
    33     ~PolicyEngineUI();
       
    34     void DisplayNotificationDialog(const QVariantMap &parameters);
       
    35     void ShowInputDialog();
       
    36     bool verifyFingerPrint();
    32 
    37 
    33 enum TUserResponse
    38 public slots:
    34 	{
    39     void onOKSelected();
    35 	EUserAccept,
    40     void onCancelSelected();
    36 	EUserDeny,
    41     void establishTrust();
    37 	};
    42     void cancelTrust();
       
    43     void onTrustCreation();
       
    44     void codeTextChanged();
       
    45 public:
       
    46     //derived from HbDeviceDialogInterface
       
    47     bool setDeviceDialogParameters(const QVariantMap &parameters);
       
    48     int deviceDialogError() const;
       
    49     void closeDeviceDialog(bool byClient);
       
    50     HbDialog *deviceDialogWidget() const;
    38 
    51 
    39 //  FORWARD DECLARATIONS
    52 signals:
       
    53     //signal to be sent to client
       
    54     void deviceDialogClosed();
       
    55     void deviceDialogData(QVariantMap data);
       
    56     
       
    57 private:
       
    58     // number of tries user does
       
    59     int estbTrustCount;
       
    60     QString iServerName;
       
    61     QString iFingerprint;
       
    62     QString iCode;
       
    63     HbLineEdit *mContentEdit;
       
    64     HbDialog* mdialog;
       
    65     };
    40 
    66 
    41 class CCoeEnv;
    67 #endif // POLICYENGINEUI_H
    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
       
    86     {
       
    87     public:  // Constructors and destructor
       
    88 
       
    89         /**
       
    90         * Constructor.
       
    91         */
       
    92         CPolicyEngineUi();
       
    93 
       
    94         /**
       
    95         * Two-phased constructor.
       
    96         */
       
    97         static CPolicyEngineUi* NewL();
       
    98     
       
    99         /**
       
   100         * Destructor.
       
   101         */
       
   102         virtual ~CPolicyEngineUi();
       
   103         
       
   104         void ActivateL( const TDesC8& aCorporate, const TDesC8& aRandomPart, CPolicyEngineNotifier* iNotifier); 
       
   105     
       
   106 		void RunL();
       
   107 		void DoCancel();
       
   108 
       
   109 	public:
       
   110 
       
   111         /**
       
   112         * Execute corporate policy question chain, which user deny or accept. One response generated.
       
   113         * @param aCorporate - Corparate name used in queries
       
   114         * @param aRandomPart - Random part of certificate, which user must know.
       
   115         * @return TUserResponse - Response value for user
       
   116         */
       
   117         
       
   118         TUserResponse ShowCorporateConfirmationDialogL( const TDesC8& aCorporate,
       
   119         										   		 const TDesC8& aRandomPart);
       
   120 	private:
       
   121 	
       
   122 		//private enums
       
   123 		enum TDialog
       
   124 			{
       
   125 			EControl = 0, 
       
   126 			EQuestion,
       
   127 			ERemove,
       
   128 			EDenied,
       
   129 			EUnMatch
       
   130 			};
       
   131 		
       
   132 		enum TDlgResp
       
   133 			{
       
   134 			EOkResp,
       
   135 			ECancelResp
       
   136 			};
       
   137 		
       
   138 	private:
       
   139 	
       
   140         /**
       
   141         * Two-phased constructor.
       
   142         */
       
   143 		void ConstructL();
       
   144 
       
   145 	
       
   146 		TInt ShowDialogL( const TDialog& aDialog);
       
   147 		TDlgResp ShowConfirmationQueryL( const TDesC& aText, const TBool& aWithCancel );
       
   148 		TDlgResp ShowPossessionMessageQueryL();
       
   149 		TDlgResp DataQueryL( const TDesC& aText, TDes& aInput );
       
   150 
       
   151     private: // Data
       
   152     
       
   153     	HBufC * iCorporate;
       
   154     	HBufC * iRandomPart;
       
   155     	TInt iState;
       
   156     	CPolicyEngineNotifier * iNotifier;
       
   157     	
       
   158 	    TInt iResourceFileOffset;
       
   159         CCoeEnv* iCoeEnv;  // not owned
       
   160         };
       
   161 
       
   162 
       
   163 #endif      // POLICTY_ENGINE_UI_HEADER_
       
   164             
       
   165 // End of File