contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h
branchRCL_3
changeset 45 34879f5cfc63
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
--- a/contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h	Wed Jun 09 09:26:27 2010 +0300
+++ b/contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h	Mon Jun 21 15:24:27 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,10 +21,17 @@
 #include <e32base.h>
 
 class MCCAViewLauncher;
+class MCCAStatusProvider;
 
 /**
  *  ECom interface for CCA Extension factory.
- *
+ *  At the moment extension factory interface is used only for extend CCA 
+ *  Status button implementation:
+ *   - CCA Status button implementation uses this interface to launch external 
+ *   views (MCCAViewLauncher) when user tap the Status button.
+ *   - CCA Status button implementation uses MCCAStatusProvider interface to
+ *   read status information from plug-in if status infromation doesn't found in 
+ *   Presence Cache.
  *  @lib n/a
  *  @since 9.2
  */
@@ -45,7 +52,7 @@
         {
         return NULL;
         }
-
+    
     /**
      * Returns Service ID of the plug-in.
      */
@@ -67,6 +74,32 @@
 
     };
 
+// Use this UID to access CCCAExtensionFactory's status provider creator.
+// Used as a parameter to CCCAExtensionFactory::FactoryExtension method.
+const TUid KCCAExtensionFactoryStatusProviderCreatorUid = { 2 };
+
+/**
+ * This class is an extension to CCCAExtensionFactory.
+ *
+ * @see CCCAExtensionFactory
+ * @see KCCAExtensionFactoryStatusProviderCreatorUid
+ */
+class MCCAExtensionFactoryStatusProviderCreator
+    {
+    protected:  // Destructor
+        virtual ~MCCAExtensionFactoryStatusProviderCreator() { }
+
+    public:
+
+        /**
+         * Creates a status provider.
+         * Ownership is given.
+         * @return Status provider instance @see MCCAStatusProvider
+         */
+        virtual MCCAStatusProvider* CreateStatusProviderL() = 0;
+
+    };
+
 /**
  *  View launcher extension for the CCA.
  */
@@ -112,6 +145,112 @@
 
     };
 
+class MCCAStatusProviderObserver;
+class MVPbkContactLink;
+class CGulIcon;
+
+/**
+ * Status provider extension for the CCA
+ */
+class MCCAStatusProvider
+    {
+public:
+    /// virtual destructor
+    virtual ~MCCAStatusProvider() {};
+
+    /**
+     * Add observer
+     * @param aObserver instance @see MCCAStatusProviderObserver
+     */
+    virtual void AddObserverL(
+            MCCAStatusProviderObserver& aObserver ) = 0;
+
+    /**
+     * Removes observer
+     * @param aObserver instance @see MCCAStatusProviderObserver
+     */
+    virtual void RemoveObserver(
+            MCCAStatusProviderObserver& aObserver ) = 0;
+
+    /**
+     * CCA fetch status information for the Status button with this method 
+     * if status information is not found from Presence Cache
+     * @param aLink
+     * @param aText Status Text, ownership is transfered 
+     * @param aIcon Status Icon, ownership is transfered
+     */
+    virtual void GetStatusInformationL(
+            const MVPbkContactLink& aLink,
+            HBufC*& aText,
+            CGulIcon*& aIcon ) = 0;
+
+    /**
+     * CCA fetch status information for the Status button with this method 
+     * if status information is not found from Presence Cache
+     * This function is used only for fetching My card status information
+     * @param aLink
+     * @param aText Status Text, ownership is transfered 
+     * @param aIcon Status Icon, ownership is transfered
+     */
+     virtual void GetMyCardStatusInformationL(
+             const MVPbkContactLink& aLink,
+             HBufC*& aText,
+             CGulIcon*& aIcon ) = 0;
+
+    /**
+     *  Extension point for the status provider
+     */
+    virtual TAny* StatusProviderExtension(
+            TUid /*aExtensionUid*/ )
+        {
+        return NULL;
+        }
+
+protected:
+    MCCAStatusProvider() {};
+	
+    };
+
+/**
+ * Interface to observe content changes
+ */
+class MCCAStatusProviderObserver
+    {
+public:
+    /**
+     * Event types
+     */
+    enum TCCAStatusProviderObserverEvent
+        {
+        /// Status is changed and CCA should fetch status information again
+        EStatusChanged = 0x0
+        };
+
+    /**
+     * Plug-in can notify CCA about status events 
+     * @param aEvent Type of the event
+     * @param aLink Contact which the event is about
+     */
+    virtual void StatusEvent(
+        MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent,
+        const MVPbkContactLink* aLink = NULL ) = 0;
+
+    /**
+     *  Extension point for the MCCAStatusProviderObserver
+     */
+    virtual TAny* StatusProviderObserverExtension(
+            TUid /*aExtensionUid*/ )
+        {
+        return NULL;
+        }
+   
+protected:
+    MCCAStatusProviderObserver(){};
+    virtual ~MCCAStatusProviderObserver() {};
+	
+    };
+
+
 #include "ccaextensionfactory.inl"
 
 #endif // CCAEXTENSIONFACTORY_H