htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h
changeset 0 d6fe6244b863
child 11 454d022d514b
equal deleted inserted replaced
-1:000000000000 0:d6fe6244b863
       
     1 /*
       
     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:  Class that handles browser bookmark creation and deletion.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HTIBOOKMARKHANDLER_H
       
    20 #define HTIBOOKMARKHANDLER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <FavouritesLimits.h>
       
    25 #include <FavouritesSession.h>
       
    26 #include <HTIServicePluginInterface.h>
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KApMaxConnNameLength = 30;
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Class that handles browser bookmark creation and deletion.
       
    43 */
       
    44 class CHtiBookmarkHandler : public CBase
       
    45     {
       
    46     public:
       
    47 
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         */
       
    51         static CHtiBookmarkHandler* NewL();
       
    52 
       
    53         /**
       
    54         * Called when there is a message to be processed by this service.
       
    55         * @param aMessage message body destinated to the servive
       
    56         * @param aPriority message priority
       
    57         */
       
    58         void ProcessMessageL( const TDesC8& aMessage,
       
    59             THtiMessagePriority aPriority );
       
    60 
       
    61         /**
       
    62         * Indicates whether this handler is ready to receive
       
    63         * a new message or if it's busy processing previous message.
       
    64         * @return ETrue if processing, EFalse if ready for new request
       
    65         */
       
    66         TBool IsBusy();
       
    67 
       
    68         /**
       
    69         * Destructor.
       
    70         */
       
    71         virtual ~CHtiBookmarkHandler();
       
    72 
       
    73         /**
       
    74         * Sets the dispatcher to send outgoing messages to.
       
    75         * @param aDispatcher pointer to dispatcher instance
       
    76         */
       
    77         void SetDispatcher( MHtiDispatcher* aDispatcher );
       
    78 
       
    79     private: // constructors
       
    80 
       
    81         /**
       
    82         * C++ default constructor.
       
    83         */
       
    84         CHtiBookmarkHandler();
       
    85 
       
    86         /**
       
    87         * 2nd phase constructor.
       
    88         */
       
    89         void ConstructL();
       
    90 
       
    91     private: // helpers
       
    92 
       
    93         void HandleCreateBookmarkL();
       
    94         void HandleDeleteBookmarkL();
       
    95         void ParseCreateMessageL( const TDesC8& aMessage );
       
    96         void ParseDeleteMessageL( const TDesC8& aMessage );
       
    97         TInt ExtractStringL( const TDesC8& aMessage, TInt aOffset,
       
    98                              TInt aLengthBytes, TInt aMinLength,
       
    99                              TInt aMaxLength, TDes& aResult );
       
   100         TInt GetFolderUidL( const TDesC& aFolderName );
       
   101         TInt GetApUidL( const TDesC& aApName );
       
   102         void SendOkMsgL( const TDesC8& aData );
       
   103         void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
       
   104 
       
   105     private: // data
       
   106 
       
   107         // Pointer to the dispatcher (referenced)
       
   108         MHtiDispatcher* iDispatcher;
       
   109 
       
   110         // Session to the favourites engine
       
   111         RFavouritesSession iFavSession;
       
   112 
       
   113         // The parsed parameter values from the command messages
       
   114         TBuf<KFavouritesMaxName>     iFolderName;
       
   115         TBuf<KFavouritesMaxName>     iBookmarkName;
       
   116         TBuf<KApMaxConnNameLength>   iApName;
       
   117         TBuf<KFavouritesMaxUserName> iUserName;
       
   118         TBuf<KFavouritesMaxPassword> iPassword;
       
   119         HBufC*                       iUrl;
       
   120     };
       
   121 
       
   122 #endif // HTIBOOKMARKHANDLER_H