upnpsharing/upnpsecurity/inc/server/upnpauthorizationnote.h
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /** @file
       
     2  * Copyright (c) 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 : Authorization query dialog
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef UPNPAUTHORISATIONNOTE_H
       
    19 #define UPNPAUTHORISATIONNOTE_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>	// For CActive, link against: euser.lib
       
    23 #include "upnpnotifytimer.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CAknGlobalNote;
       
    27 // CONSTANTS
       
    28 #define KResourcePath KDC_RESOURCE_FILES_DIR
       
    29 _LIT( KResourceFileName, "upnpnotifier.rsc" );
       
    30 const TInt KAuthorizationNoteTimeout = 15;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * Observer of CUpnpAuthorizationNote results
       
    36  */
       
    37 class MUpnpAuthorizationNoteObserver
       
    38     {
       
    39 public:
       
    40 
       
    41     /**
       
    42      * A callback function.
       
    43      * @param aAuthorized The result of authorization.
       
    44      */
       
    45     virtual void NoteResponseL( TBool aAuthorized ) = 0;
       
    46     };
       
    47 
       
    48 /**
       
    49  * Active wrapper of CAknGlobalNote YES/NO query dialog
       
    50  */
       
    51 class CUpnpAuthorizationNote : public CActive,
       
    52         public MUpnpNotifyTimerObserver
       
    53     {
       
    54 public:
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     ~CUpnpAuthorizationNote();
       
    59 
       
    60     /**
       
    61      * A two-phased constructor functions.
       
    62      */
       
    63     static CUpnpAuthorizationNote* NewL();
       
    64     static CUpnpAuthorizationNote* NewLC();
       
    65 
       
    66     /** 
       
    67      * Creates CAknGlobalNote dialog and performs
       
    68      * ShowNoteL() on it. The dialog is destroyed after user 
       
    69      * confirmation or 15 second timeout.
       
    70      *
       
    71      * @param aObserver ShowNoteL results observer
       
    72      */
       
    73     void ShowNoteL( MUpnpAuthorizationNoteObserver* aObserver );
       
    74 private:
       
    75     // from MUpnpNotifyTimerObserver
       
    76     virtual void TimerEventL( CUpnpNotifyTimer* aTimer );
       
    77     // from CActive
       
    78     void RunL();
       
    79     void DoCancel();
       
    80     TInt RunError( TInt aError );
       
    81     // other
       
    82     CUpnpAuthorizationNote();
       
    83     void ConstructL();
       
    84     void CancelNoteL();
       
    85     void GetResourceFilePathLC( RBuf& aPath );
       
    86     void ReadAuthorisationStringL( const TDesC& aFilename );
       
    87 private:
       
    88     CUpnpNotifyTimer* iTimer;
       
    89     MUpnpAuthorizationNoteObserver* iObserver;
       
    90     CAknGlobalNote* iNote;
       
    91     TInt iNoteId;
       
    92     HBufC* iAuthorizationString;
       
    93     };
       
    94 
       
    95 #endif // UPNPAUTHORISATIONNOTE_H
       
    96 // End of File