contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h
branchRCL_3
changeset 45 34879f5cfc63
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
39:a6539d1e8e43 45:34879f5cfc63
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 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".
    19 #define CCAEXTENSIONFACTORY_H
    19 #define CCAEXTENSIONFACTORY_H
    20 
    20 
    21 #include <e32base.h>
    21 #include <e32base.h>
    22 
    22 
    23 class MCCAViewLauncher;
    23 class MCCAViewLauncher;
       
    24 class MCCAStatusProvider;
    24 
    25 
    25 /**
    26 /**
    26  *  ECom interface for CCA Extension factory.
    27  *  ECom interface for CCA Extension factory.
    27  *
    28  *  At the moment extension factory interface is used only for extend CCA 
       
    29  *  Status button implementation:
       
    30  *   - CCA Status button implementation uses this interface to launch external 
       
    31  *   views (MCCAViewLauncher) when user tap the Status button.
       
    32  *   - CCA Status button implementation uses MCCAStatusProvider interface to
       
    33  *   read status information from plug-in if status infromation doesn't found in 
       
    34  *   Presence Cache.
    28  *  @lib n/a
    35  *  @lib n/a
    29  *  @since 9.2
    36  *  @since 9.2
    30  */
    37  */
    31 class CCCAExtensionFactory : public CBase
    38 class CCCAExtensionFactory : public CBase
    32     {
    39     {
    43      */
    50      */
    44     virtual MCCAViewLauncher* CreateViewLauncherL()
    51     virtual MCCAViewLauncher* CreateViewLauncherL()
    45         {
    52         {
    46         return NULL;
    53         return NULL;
    47         }
    54         }
    48 
    55     
    49     /**
    56     /**
    50      * Returns Service ID of the plug-in.
    57      * Returns Service ID of the plug-in.
    51      */
    58      */
    52     virtual const TDesC& ServiceID() const = 0;
    59     virtual const TDesC& ServiceID() const = 0;
    53 
    60 
    62 
    69 
    63 private: // data
    70 private: // data
    64 
    71 
    65     // Own: ID key
    72     // Own: ID key
    66     TUid iDtor_ID_Key;
    73     TUid iDtor_ID_Key;
       
    74 
       
    75     };
       
    76 
       
    77 // Use this UID to access CCCAExtensionFactory's status provider creator.
       
    78 // Used as a parameter to CCCAExtensionFactory::FactoryExtension method.
       
    79 const TUid KCCAExtensionFactoryStatusProviderCreatorUid = { 2 };
       
    80 
       
    81 /**
       
    82  * This class is an extension to CCCAExtensionFactory.
       
    83  *
       
    84  * @see CCCAExtensionFactory
       
    85  * @see KCCAExtensionFactoryStatusProviderCreatorUid
       
    86  */
       
    87 class MCCAExtensionFactoryStatusProviderCreator
       
    88     {
       
    89     protected:  // Destructor
       
    90         virtual ~MCCAExtensionFactoryStatusProviderCreator() { }
       
    91 
       
    92     public:
       
    93 
       
    94         /**
       
    95          * Creates a status provider.
       
    96          * Ownership is given.
       
    97          * @return Status provider instance @see MCCAStatusProvider
       
    98          */
       
    99         virtual MCCAStatusProvider* CreateStatusProviderL() = 0;
    67 
   100 
    68     };
   101     };
    69 
   102 
    70 /**
   103 /**
    71  *  View launcher extension for the CCA.
   104  *  View launcher extension for the CCA.
   110 protected:
   143 protected:
   111     MCCAViewLauncher() {};
   144     MCCAViewLauncher() {};
   112 
   145 
   113     };
   146     };
   114 
   147 
       
   148 class MCCAStatusProviderObserver;
       
   149 class MVPbkContactLink;
       
   150 class CGulIcon;
       
   151 
       
   152 /**
       
   153  * Status provider extension for the CCA
       
   154  */
       
   155 class MCCAStatusProvider
       
   156     {
       
   157 public:
       
   158     /// virtual destructor
       
   159     virtual ~MCCAStatusProvider() {};
       
   160 
       
   161     /**
       
   162      * Add observer
       
   163      * @param aObserver instance @see MCCAStatusProviderObserver
       
   164      */
       
   165     virtual void AddObserverL(
       
   166             MCCAStatusProviderObserver& aObserver ) = 0;
       
   167 
       
   168     /**
       
   169      * Removes observer
       
   170      * @param aObserver instance @see MCCAStatusProviderObserver
       
   171      */
       
   172     virtual void RemoveObserver(
       
   173             MCCAStatusProviderObserver& aObserver ) = 0;
       
   174 
       
   175     /**
       
   176      * CCA fetch status information for the Status button with this method 
       
   177      * if status information is not found from Presence Cache
       
   178      * @param aLink
       
   179      * @param aText Status Text, ownership is transfered 
       
   180      * @param aIcon Status Icon, ownership is transfered
       
   181      */
       
   182     virtual void GetStatusInformationL(
       
   183             const MVPbkContactLink& aLink,
       
   184             HBufC*& aText,
       
   185             CGulIcon*& aIcon ) = 0;
       
   186 
       
   187     /**
       
   188      * CCA fetch status information for the Status button with this method 
       
   189      * if status information is not found from Presence Cache
       
   190      * This function is used only for fetching My card status information
       
   191      * @param aLink
       
   192      * @param aText Status Text, ownership is transfered 
       
   193      * @param aIcon Status Icon, ownership is transfered
       
   194      */
       
   195      virtual void GetMyCardStatusInformationL(
       
   196              const MVPbkContactLink& aLink,
       
   197              HBufC*& aText,
       
   198              CGulIcon*& aIcon ) = 0;
       
   199 
       
   200     /**
       
   201      *  Extension point for the status provider
       
   202      */
       
   203     virtual TAny* StatusProviderExtension(
       
   204             TUid /*aExtensionUid*/ )
       
   205         {
       
   206         return NULL;
       
   207         }
       
   208 
       
   209 protected:
       
   210     MCCAStatusProvider() {};
       
   211 	
       
   212     };
       
   213 
       
   214 /**
       
   215  * Interface to observe content changes
       
   216  */
       
   217 class MCCAStatusProviderObserver
       
   218     {
       
   219 public:
       
   220     /**
       
   221      * Event types
       
   222      */
       
   223     enum TCCAStatusProviderObserverEvent
       
   224         {
       
   225         /// Status is changed and CCA should fetch status information again
       
   226         EStatusChanged = 0x0
       
   227         };
       
   228 
       
   229     /**
       
   230      * Plug-in can notify CCA about status events 
       
   231      * @param aEvent Type of the event
       
   232      * @param aLink Contact which the event is about
       
   233      */
       
   234     virtual void StatusEvent(
       
   235         MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent,
       
   236         const MVPbkContactLink* aLink = NULL ) = 0;
       
   237 
       
   238     /**
       
   239      *  Extension point for the MCCAStatusProviderObserver
       
   240      */
       
   241     virtual TAny* StatusProviderObserverExtension(
       
   242             TUid /*aExtensionUid*/ )
       
   243         {
       
   244         return NULL;
       
   245         }
       
   246    
       
   247 protected:
       
   248     MCCAStatusProviderObserver(){};
       
   249     virtual ~MCCAStatusProviderObserver() {};
       
   250 	
       
   251     };
       
   252 
       
   253 
   115 #include "ccaextensionfactory.inl"
   254 #include "ccaextensionfactory.inl"
   116 
   255 
   117 #endif // CCAEXTENSIONFACTORY_H
   256 #endif // CCAEXTENSIONFACTORY_H