menufw/hierarchynavigator/hnmetadatamodel/inc/hnmdsuite.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_HNMDSUITE_H
       
    20 #define C_HNMDSUITE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 #include "hnmdmodel.h"
       
    26 #include "hnsuitemodel.h"
       
    27 #include "hnglobals.h"
       
    28 #include "hnmdmodel.h"
       
    29 #include "hnqueryresultcollector.h"
       
    30 
       
    31 class CHnSuiteModelContainer;
       
    32 class CHnFilter;
       
    33 class CHnMdItem;
       
    34 class CHnMdLocalization;
       
    35 class CHnItemId;
       
    36 class CHnMdQueries;
       
    37 class CHnMdEventMapping;
       
    38 
       
    39 /**
       
    40  * Suite.
       
    41  * 
       
    42  * This is the representation of the suite. The crucial member variable
       
    43  * of this suite is the list of the items.
       
    44  *
       
    45  * @lib hnmetadatamodel
       
    46  * @since S60 5.0
       
    47  * @ingroup group_hnmetadatamodel
       
    48  */
       
    49 NONSHARABLE_CLASS(CHnMdSuite) : public CBase,
       
    50     public MHnQueryResultCollectorNotification
       
    51     {
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Two-phase constructor.
       
    56      *
       
    57      * @since S60 5.0
       
    58      * @param aElement Element.
       
    59      * @param aCmnPtrs Common pointers.
       
    60      * @return Fully constructed object.
       
    61      */
       
    62     static CHnMdSuite* NewL( TXmlEngElement aElement, THnMdCommonPointers* aCmnPtrs );
       
    63 
       
    64     /**
       
    65      * Two-phase constructor.
       
    66      *
       
    67      * @since S60 5.0
       
    68      * @param aElement Element.
       
    69      * @param aCmnPtrs Common pointers.
       
    70      * @return Fully constructed object.
       
    71      */
       
    72     static CHnMdSuite* NewLC( TXmlEngElement aElement, THnMdCommonPointers* aCmnPtrs );
       
    73 
       
    74     /**
       
    75      * Standard C++ virtual destructor.
       
    76      */
       
    77     virtual ~CHnMdSuite();
       
    78 
       
    79     /**
       
    80      * Evaluates suite.
       
    81      *
       
    82      * @since S60 5.0
       
    83      * @param aSuiteModel Suite model.
       
    84      * @return Status code. 
       
    85      */
       
    86     TInt EvaluateL( CHnSuiteModel & aSuiteModel );
       
    87 
       
    88     /**
       
    89      * Marks according to filter which item should be evaluated.
       
    90      *
       
    91      * @since S60 5.0
       
    92      * @param aFilter Filter.
       
    93      * @param aSuiteModel Suite Model to get Custom Id
       
    94      */
       
    95     void MarkEvaluationL( CHnFilter& aFilter, CHnSuiteModel& aSuiteModel );
       
    96     
       
    97     /**
       
    98      * Handles back event.
       
    99      *
       
   100      * @since S60 ?S60_version
       
   101      * @param aMulContainer Suite model container.
       
   102      * @param aGenre Suite's name.
       
   103      * @return Error code.
       
   104      */
       
   105     TInt HandleBackEventL( CHnSuiteModelContainer* aMulContainer, TDesC* aGenre );
       
   106     
       
   107     /**
       
   108      * Switches between edit mode and normal mode
       
   109      *
       
   110      * @since S60 5.0
       
   111      * @param aMode Mode, e.g. normal / edit.
       
   112      */
       
   113     void SetModeL( TMdMode aMode );
       
   114     
       
   115     /**
       
   116      * Returns mode type.
       
   117      * 
       
   118      * @return Mode type, e.g. normal / edit. 
       
   119      */
       
   120     TMdMode Mode();
       
   121     
       
   122     /**
       
   123      * Returns name of the suite.
       
   124      * 
       
   125      * @since S60 v3.2
       
   126      * @return Name of the suite.
       
   127      */          
       
   128     IMPORT_C const TDesC& SuiteName();
       
   129     
       
   130     /**
       
   131      * Return suite parameters.
       
   132      * 
       
   133      * @return Suite parameters.
       
   134      */
       
   135     IMPORT_C CLiwGenericParamList& GetSuiteParameters();
       
   136     
       
   137     /**
       
   138      * Sets suite parameters.
       
   139      * 
       
   140      * @param aParams Suite parameters.
       
   141      */
       
   142     IMPORT_C void SetSuiteParametersL(CLiwGenericParamList& aParams);
       
   143     
       
   144     
       
   145     /**
       
   146      * Returns alternative widget number.
       
   147      * 
       
   148      * @since S60 v5.0
       
   149      * @return Alternative widget number.
       
   150      */ 
       
   151     IMPORT_C TInt GetAlternativeWidgetNumber();
       
   152 
       
   153 private:
       
   154 
       
   155     /**
       
   156      * Set genre.
       
   157      *
       
   158      * @since S60 5.0
       
   159      * @param aGenre Genre descriptor.
       
   160      */
       
   161     void SetGenreL(const TDesC& aGenre);
       
   162 
       
   163     /**
       
   164      * Set genre.
       
   165      *
       
   166      * @since S60 5.0
       
   167      * @param aAttr Xml attribute.
       
   168      */
       
   169     void SetGenreL(TXmlEngAttr aAttr);
       
   170     
       
   171     /**
       
   172      * Set template.
       
   173      *
       
   174      * @since S60 5.0
       
   175      * @param aTemplate Template descriptor.
       
   176      */
       
   177     void SetTemplateL( const TDesC8& aTemplate );
       
   178     
       
   179     /**
       
   180      * Set template.
       
   181      *
       
   182      * @since S60 5.0
       
   183      * @param aTemplate Xml attribute.
       
   184      */
       
   185     void SetTemplateL( TXmlEngAttr aTemplate );
       
   186     
       
   187     /**
       
   188      * Sets widget type.
       
   189      *
       
   190      * @since S60 5.0
       
   191      * @param aWidgetType Xml attribute.
       
   192      */
       
   193     void SetWidgetTypeL( TXmlEngAttr aWidgetType );
       
   194     
       
   195     /**
       
   196      * Sets allowable widget types.
       
   197      *
       
   198      * @since S60 5.0
       
   199      * @param aWidgetType Contains widget types.
       
   200      */
       
   201     void SetWidgetTypeL( TDesC8& aWidgetType );
       
   202 
       
   203     /**
       
   204      * Sets allowable widget types and store it in CR.
       
   205      *
       
   206      * @since S60 5.0
       
   207      * @param aWidgetType Widget type.
       
   208      */
       
   209     void SaveWidgetTypeL( TDesC8& aWidgetType );
       
   210     
       
   211     /**
       
   212      * Sets title.
       
   213      *
       
   214      * @since S60 5.0
       
   215      * @param aTitle Xml attribute.
       
   216      */
       
   217     void SetTitleL( TXmlEngAttr aTitle );
       
   218     
       
   219     /**
       
   220      * Sets empty text.
       
   221      *
       
   222      * @since S60 5.0
       
   223      * @param aEmptyText The text displayed for empty suite.
       
   224      */
       
   225     void SetEmptyTextL( TXmlEngAttr aEmptyText );
       
   226 
       
   227     /**
       
   228      * Evaluate suite itself.
       
   229      *
       
   230      * @since S60 5.0
       
   231      * @param aSuiteModel Suite model.
       
   232      */
       
   233     void EvaluateSuiteItselfL( CHnSuiteModel & aSuiteModel );
       
   234 
       
   235     /**
       
   236      * Creates items.
       
   237      *
       
   238      * @since S60 5.0
       
   239      * @param aEntries Xml element.
       
   240      * @param aCmnPtrs Common pointers.
       
   241      */
       
   242     void CreateItemsL(TXmlEngElement aEntries,
       
   243             THnMdCommonPointers* aCmnPtrs );
       
   244 
       
   245     /**
       
   246      * Gets direct child property.
       
   247      *
       
   248      * @since S60 5.0
       
   249      * @param iIndex Index.
       
   250      * @param aPropertyType Property type.
       
   251      * @param aResult Result variant.
       
   252      * @return Status.
       
   253      */
       
   254     TBool GetDirectChildProperty( TInt iIndex,
       
   255             TPropertyType aPropertyType,
       
   256             TLiwVariant& aResult );
       
   257     
       
   258     /**
       
   259      * Called when results have finished being collected.
       
   260      * 
       
   261      * @param aResults The results.
       
   262      */
       
   263     void ResultsCollectedL( CLiwGenericParamList* aResults );
       
   264     
       
   265     /**
       
   266      * Sets custom id using parameters.
       
   267      * 
       
   268      * @param aSuiteModel Suite model.
       
   269      * @param aParams Parameters used to set custom id.
       
   270      * @param aPos Positions of the custom id in aParams.
       
   271      */
       
   272     void SetCustomIdL( CHnSuiteModel* aSuiteModel, 
       
   273     		const CLiwGenericParamList& aParams, TInt aPos );
       
   274     
       
   275     /**
       
   276      * Sets exit mode for a suite.
       
   277      */
       
   278     void SetExitModeL();
       
   279 
       
   280 
       
   281 private:
       
   282 
       
   283     /**
       
   284      * Standar C++ constructor.
       
   285      * 
       
   286      * @since S60 5.0
       
   287      * @param aCmnPtrs Common pointers.
       
   288      */
       
   289     CHnMdSuite( THnMdCommonPointers* aCmnPtrs );
       
   290 
       
   291     /**
       
   292      * Restores widget type for this suite from central repository.
       
   293      *
       
   294      * @return Error code.
       
   295      */
       
   296     TInt ReadWidgetTypeL();
       
   297     
       
   298     /**
       
   299      * Saves widget type for this suite in central repository.
       
   300      *
       
   301      * @return Error code.
       
   302      */
       
   303     TInt SaveWidgetTypeL() const;
       
   304         
       
   305     /**
       
   306      * Checks if the widget type is stored in service 
       
   307      * and saves it in given descriptor.
       
   308      *
       
   309      * @param aParams Contains data from service.
       
   310      * @param aWidgetType Widget type to be set.
       
   311      * @return True if widget was set, False 
       
   312      *      when no widget stored in service.
       
   313      */
       
   314     TBool ReadWidgetTypeFromServiceL( CLiwGenericParamList& aParams, 
       
   315             RBuf8& aWidgetType );
       
   316     
       
   317     /**
       
   318      * Sets the appropriate widget flag for allowable widgets.
       
   319      * 
       
   320      * @param aConfDes Configuration string.
       
   321      */ 
       
   322     void DoSetWidgetTypeL( TDesC8 & aConfDes );
       
   323     
       
   324     /**
       
   325      * Sets the alternative template for widget switch.
       
   326      * 
       
   327      * @param aOption Position of widget in xml configuration.
       
   328      */ 
       
   329     void SetAlternativeTemplateL( TInt aOption );
       
   330     
       
   331     /**
       
   332      * Sets the alternative widget.
       
   333      * 
       
   334      * @param aParams List of data from service.
       
   335      */ 
       
   336     void SetAlternativeWidgetL( CLiwGenericParamList& aParams );
       
   337     
       
   338     /**
       
   339      * Sets the alternative template.
       
   340      * 
       
   341      * @param aParams List of data from service.
       
   342      */ 
       
   343     void SetAlternativeTemplateL( CLiwGenericParamList& aParams );
       
   344         
       
   345     /**
       
   346      * Standard symbian 2nd phase constructor.
       
   347      * 
       
   348      * @since S60 5.0
       
   349      * @param element Xml element.
       
   350      */
       
   351     void ConstructL( TXmlEngElement element );
       
   352     
       
   353     /**
       
   354      * Adds widget type to generic param list passed to
       
   355      * items when evaluating the suite.
       
   356      * 
       
   357      * The information about widget type can be retrieved
       
   358      * using the following path:
       
   359      *      mm:/suite:type
       
   360      * 
       
   361      * @param aParamList a param list into which the wigdet
       
   362      *                   type is added.
       
   363      * 
       
   364      */
       
   365     void AddInternalStateL( CLiwGenericParamList& aParamList );
       
   366     
       
   367 
       
   368     /**
       
   369      * Sets custom identifier.
       
   370      * 
       
   371      * @since S60 5.50
       
   372      * @param aElement Xml element.
       
   373      */
       
   374     void SetCustomIdL( TXmlEngElement aElement );
       
   375     
       
   376     /**
       
   377      * Sets highlight according to parameters passed in uri.
       
   378      */
       
   379     void SetUriBasedHighlightL();
       
   380     
       
   381 
       
   382 
       
   383 private: // data
       
   384 
       
   385     /**
       
   386      * Own - Suite name.
       
   387      */
       
   388     RBuf iSuiteName;
       
   389 
       
   390     /**
       
   391      * Own - Title
       
   392      */
       
   393     RBuf8 iTitle;
       
   394 
       
   395     /**
       
   396      * Own - Empty text
       
   397      */
       
   398     RBuf8 iEmptyText;
       
   399 
       
   400     /**
       
   401      * Own - Items.
       
   402      */
       
   403     RPointerArray< CHnMdItem > iItems;
       
   404 
       
   405     /**
       
   406      * Common pointers.
       
   407      */
       
   408     THnMdCommonPointers* iCmnPtrs;
       
   409     
       
   410     /**
       
   411      * Template.
       
   412      */
       
   413     RBuf8 iTemplate;
       
   414     
       
   415     /**
       
   416      * Allowable templates.
       
   417      */
       
   418     CDesC8Array * iAllowableTemplate;
       
   419     
       
   420     /**
       
   421      * Widget type.
       
   422      */
       
   423     THnSuiteWidgetType iWidgetType;
       
   424      
       
   425     /**
       
   426      * Widget type.
       
   427      */
       
   428     RArray< THnSuiteWidgetType > iAllowableWidgetType;
       
   429     
       
   430     /**
       
   431      * Allowed types - as string.
       
   432      */
       
   433     RBuf8 iAllowedTypes;
       
   434     
       
   435     /**
       
   436      * Event mapping
       
   437      */
       
   438     CHnMdEventMapping* iEventMapping;
       
   439     
       
   440     /**
       
   441      * Queries
       
   442      */
       
   443     CHnMdQueries* iQueries;
       
   444     
       
   445     /**
       
   446      * Cached evaluation parameters, i.e. params:folder_id, etc.
       
   447      */
       
   448     CLiwGenericParamList* iSuiteParams;
       
   449     
       
   450     /**
       
   451      * Stores information about mode.
       
   452      */
       
   453     TMdMode iMode;
       
   454     
       
   455     /**
       
   456      * Own.
       
   457      */
       
   458     CHnQueryResultCollector* iQc;
       
   459     
       
   460     /**
       
   461      * Suite model.
       
   462      * Not Own
       
   463      */
       
   464     CHnSuiteModel* iSuiteModel;
       
   465     
       
   466     /**
       
   467      * Custom identifier. 
       
   468      */
       
   469     RBuf8 iCustomId8;
       
   470 
       
   471 public:
       
   472     /**
       
   473      * Marks if evaulation should take place. 
       
   474      */    
       
   475     TBool iEvaluationNeeded;
       
   476     
       
   477     };
       
   478 
       
   479 #endif // C_HNMMSUITE_H