idlefw/plugins/shortcutplugin/inc/caiscutplugin.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Plug-in main class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAISCUTPLUGIN_H
       
    20 #define CAISCUTPLUGIN_H
       
    21 
       
    22 #include <aicontentpublisher.h>
       
    23 #include <aipropertyextension.h>
       
    24 #include <aieventhandlerextension.h>
       
    25 #include <aicontentmodel.h>
       
    26 
       
    27 class CAiScutEngine;
       
    28 class MAiContentObserver;
       
    29 class MAiContentItemIterator;
       
    30 class CAiScutShortcut;
       
    31 
       
    32 /**
       
    33  *  Plug-in main class
       
    34  *
       
    35  *  @since S60 v3.2
       
    36  */
       
    37 class CAiScutPlugin : public CAiContentPublisher
       
    38                     , public MAiPropertyExtension
       
    39                     , public MAiEventHandlerExtension
       
    40 {
       
    41 
       
    42 public: // factory methods and destructor.
       
    43 
       
    44     static CAiScutPlugin* NewL();
       
    45 
       
    46     virtual ~CAiScutPlugin();
       
    47 
       
    48 public: // new methods
       
    49 
       
    50     /**
       
    51      * Publishes the given shortcut
       
    52      *
       
    53      * @since S60 v3.2
       
    54      * @return Reference to a shortcut to publish
       
    55      */
       
    56     void PublishShortcutsL(RAiShortcutArray& aShortcuts);
       
    57 
       
    58     /**
       
    59      *
       
    60      */
       
    61     TBool IsAlive() const;
       
    62 
       
    63     /**
       
    64      * @return Resume reason
       
    65      */
       
    66     TAiTransitionReason ResumeReason() const;
       
    67 
       
    68 public: // methods from base classes
       
    69 
       
    70     // from base class CAiContentPublisher
       
    71 
       
    72     void Resume(TAiTransitionReason aReason);
       
    73 
       
    74     void Suspend(TAiTransitionReason aReason);
       
    75 
       
    76     void Stop(TAiTransitionReason aReason);
       
    77 
       
    78     /**
       
    79      * From CAiContentPublisher
       
    80      * Adds the content observer / subscriber to plug-in. The plug-in MUST
       
    81      * maintain a registry of subscribers and send notification to all them
       
    82      * whenever the plug-in changes state or new content available.
       
    83      *
       
    84      * @since S60 3.2
       
    85      * @param aObserver content observer to register.
       
    86      */
       
    87     void SubscribeL(MAiContentObserver& aObserver);
       
    88 
       
    89     /**
       
    90      * From CAiContentPublisher
       
    91      * Configures the plug-in.
       
    92      * Plug-ins take ownership of the settings array, so it must either
       
    93      * store it in a member or free it. Framework has put the array in cleanup
       
    94      * stack so the plug-in shouldn't do that.
       
    95      * If this leaves, the plug-in will be destroyed by AI FW.
       
    96      * Plug-in must support LaunchByValue-event even if normal shortcuts don't
       
    97      * work. The only allowed serious enough leave is KErrNotFound from CenRep.
       
    98      *
       
    99      * @since S60 3.2
       
   100      * @param aSettings setting items defined in the UI definition.
       
   101      */
       
   102     void ConfigureL(RAiSettingsItemArray& aSettings);
       
   103 
       
   104     /**
       
   105      * From CAiContentPublisher
       
   106      * Returns interface extension. In Series 60 3.1 only event & property
       
   107      * extensions are supported. See MAiEventExtension & MAiPropertyExtension
       
   108      * interfaces.
       
   109      *
       
   110      * @since S60 3.2
       
   111      * @param  aUid - UID of the extension interface to access.
       
   112      * @return the extension interface. Actual type depends on the passed aUid
       
   113      *         argument.
       
   114      */
       
   115     TAny* Extension(TUid aUid);
       
   116 
       
   117     // from base class MAiEventHandlerExtension
       
   118 
       
   119     /**
       
   120      * From MAiEventHandlerExtension
       
   121      * Invoked by the framework when plug-in must handle an event.
       
   122      *
       
   123      * @param aEvent - unique identifier of event from plug-in content model.
       
   124      * @param aParam - parameters associated with event. Each UI Definition
       
   125      *        declares events in the format: <event name>(<event params>),
       
   126      *        where <event name> is mapped by the framework to unique
       
   127      *        identifier supplied in aEvent, <event params> are provided to
       
   128      *        plug-in as-is in the descriptor.
       
   129      * @since S60 3.2
       
   130      */
       
   131     void HandleEvent(TInt aEvent, const TDesC& aParam);
       
   132 
       
   133     /**
       
   134 	* Invoked by the framework for querying if plugin has menu item
       
   135 	*
       
   136 	* @return ETrue if plugin has specific menu item, EFalse otherwise
       
   137 	*/   
       
   138 	
       
   139 // Online/Offline - web widgets	
       
   140     TBool HasMenuItem(const TDesC16& aMenuItem);
       
   141     
       
   142     // from base class MAiPropertyExtension
       
   143 
       
   144     /**
       
   145      * From MAiPropertyExtension.
       
   146      * Read property of publisher plug-in.
       
   147      *
       
   148      * @param aProperty - identification of property.
       
   149      * @return pointer to property value.
       
   150      * @since S60 3.2
       
   151      */
       
   152     TAny* GetPropertyL(TInt aProperty);
       
   153 
       
   154     /**
       
   155      * From MAiPropertyExtension.
       
   156      * Write property value.
       
   157      *
       
   158      * @param aProperty - identification of property.
       
   159      * @param aValue - contains pointer to property value.
       
   160      * @since S60 3.2
       
   161      */
       
   162     void SetPropertyL(TInt aProperty, TAny* aValue);
       
   163 
       
   164 protected:
       
   165 
       
   166 private:
       
   167 
       
   168     CAiScutPlugin();
       
   169 
       
   170     void ConstructL();
       
   171 
       
   172     void DoResumeL(TAiTransitionReason aReason);
       
   173 
       
   174     void FreeEngine();
       
   175     
       
   176     void DeleteDefaultShortcutsL();
       
   177 
       
   178 
       
   179 private:  // data
       
   180 
       
   181     /**
       
   182      * Iterator for plug-in content.
       
   183      * Own.
       
   184      */
       
   185     MAiContentItemIterator*             iContent;
       
   186 
       
   187     /**
       
   188      * Iterator for plug-in resources.
       
   189      * Own.
       
   190      */
       
   191     MAiContentItemIterator*             iResources;
       
   192 
       
   193     /**
       
   194      * Iterator for plug-in events.
       
   195      * Own.
       
   196      */
       
   197     MAiContentItemIterator*             iEvents;
       
   198 
       
   199     /**
       
   200      * Plug-in engine
       
   201      * Own.
       
   202      */
       
   203     CAiScutEngine*                      iEngine;
       
   204 
       
   205     /**
       
   206      * Array of content observers
       
   207      * Not own.
       
   208      */
       
   209     RPointerArray<MAiContentObserver>   iObservers;
       
   210 
       
   211     /**
       
   212      * Information about the content publisher ( this plug-in ).
       
   213      */
       
   214     TAiPublisherInfo                    iInfo;
       
   215 
       
   216     /**
       
   217      * Plug-in state, suspended or alive.
       
   218      */
       
   219     TBool                               iAlive;
       
   220 
       
   221     /**
       
   222      * Resume reason
       
   223      */
       
   224     TAiTransitionReason                 iResumeReason;
       
   225 
       
   226     TBool                               iForcePublishAll;
       
   227 };
       
   228 
       
   229 #endif // CAISCUTPLUGIN_H
       
   230 
       
   231 // End of File.