controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp
branchRCL_3
changeset 35 5f281e37a2f5
parent 34 90fe62538f66
child 46 ed95320285d0
equal deleted inserted replaced
34:90fe62538f66 35:5f281e37a2f5
     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:  An extension to CpSettingFormItemData, can be filled with model items comes from controlpanel plugins.
       
    15 *
       
    16 */
       
    17 #include "cpcategorysettingformitemdata.h"
       
    18 #include <QString>
       
    19 #include "cpcategorymodelutility.h"
       
    20 
       
    21 /*
       
    22  * Private implementation
       
    23  */
       
    24 class CpCategorySettingFormItemDataPrivate
       
    25 {
       
    26 public:
       
    27 	CpCategorySettingFormItemDataPrivate(const QString &configFile) : 
       
    28 	  mInitialized(false),
       
    29 	  mConfigFile(configFile)
       
    30 	{
       
    31 	}
       
    32 
       
    33 	~CpCategorySettingFormItemDataPrivate()
       
    34 	{
       
    35 	}
       
    36 
       
    37 public:
       
    38 	bool mInitialized;
       
    39 	QString mConfigFile;
       
    40 };
       
    41 
       
    42 /*
       
    43  * Constructor
       
    44  */
       
    45 CpCategorySettingFormItemData::CpCategorySettingFormItemData(
       
    46                HbDataFormModelItem::DataItemType type,
       
    47 	           const QString &label,
       
    48 			   const QString &configFile,
       
    49 			   const HbDataFormModelItem *parent /*= 0*/) : 
       
    50 			   CpSettingFormItemData(type,label,parent),
       
    51 			   d(new CpCategorySettingFormItemDataPrivate(configFile))
       
    52 {
       
    53 }
       
    54 
       
    55 /*
       
    56  * Overloaded constructor
       
    57  */
       
    58 CpCategorySettingFormItemData::CpCategorySettingFormItemData(
       
    59 			   const QString &configFile /*= QString()*/,
       
    60 			   const HbDataFormModelItem *parent /*= 0*/) : 
       
    61 	           CpSettingFormItemData(parent),
       
    62 			   d(new CpCategorySettingFormItemDataPrivate(configFile))
       
    63 {
       
    64 }
       
    65 
       
    66 /*
       
    67  * Desctructor
       
    68  */
       
    69 CpCategorySettingFormItemData::~CpCategorySettingFormItemData()
       
    70 {
       
    71 	delete d;
       
    72 }
       
    73 
       
    74 /*
       
    75  * Initialize
       
    76  */
       
    77 void CpCategorySettingFormItemData::initialize(CpItemDataHelper &itemDataHelper)
       
    78 {
       
    79     //avoid to be called twice
       
    80     if (!d->mInitialized) {
       
    81         //give derived class a chance do their special things before loading config plugins
       
    82         beforeLoadingConfigPlugins(itemDataHelper);
       
    83         
       
    84         int pluginItemStartPosition = childCount();
       
    85         //give derived class a chance do their special things after loading config plugins
       
    86         afterLoadingConfigPlugins(itemDataHelper);
       
    87         
       
    88         //load plugins which are configured
       
    89         CpCategoryModelUtility::buildConfigPluginItems(
       
    90 		    this,
       
    91 		    d->mConfigFile,
       
    92 		    itemDataHelper,
       
    93 		    pluginItemStartPosition);
       
    94 		    
       
    95         d->mInitialized = true;
       
    96     }
       
    97 }
       
    98 
       
    99 /*
       
   100  * Derived class can override this function to do some specific work before loading config plugins
       
   101  */
       
   102 void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
       
   103 {
       
   104 }
       
   105 /*
       
   106  * Derived class can override this function to do some specific work before loading config plugins
       
   107  */
       
   108 void CpCategorySettingFormItemData::afterLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
       
   109 {
       
   110 }
       
   111 
       
   112 //End of File