controlpanelui/examples/themeplugin/src/cpthemepluginentryitemdata.cpp
branchRCL_3
changeset 14 5f281e37a2f5
parent 13 90fe62538f66
equal deleted inserted replaced
13:90fe62538f66 14: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:  
       
    15  *   
       
    16  */
       
    17 
       
    18 #include "cpthemepluginentryitemdata.h"
       
    19 #include <cpitemdatahelper.h>
       
    20 #include <hbfiledialog.h>
       
    21 #include <hbaction.h>
       
    22 #include <QFileInfo>
       
    23 
       
    24 CpThemePluginEntryItemData::CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper,
       
    25 													   const QString &text /*= QString()*/,
       
    26 													   const QString &description /*= QString()*/,
       
    27 													   const HbIcon &icon /*= HbIcon()*/,
       
    28 													   const HbDataFormModelItem *parent /*= 0*/)
       
    29 													   : CpSettingFormEntryItemData(itemDataHelper,
       
    30 													   text,
       
    31 													   description,
       
    32 													   icon,
       
    33 													   parent)
       
    34 {
       
    35 }
       
    36 
       
    37 CpThemePluginEntryItemData::~CpThemePluginEntryItemData()
       
    38 {
       
    39 }
       
    40 
       
    41 void CpThemePluginEntryItemData::onLaunchView()
       
    42 {
       
    43 	HbFileDialog *dlg = new HbFileDialog();
       
    44 	dlg->setDirectory(QString("C:/ControlPanel/resource"));
       
    45 	dlg->setTitle("Select file:");
       
    46 	dlg->setPrimaryActionText(QString("Done"));
       
    47 	dlg->setSecondaryActionText(QString("Close"));
       
    48 	QString filePath = dlg->getFileName();
       
    49 	if (!filePath.isEmpty()) {
       
    50 	   setDescription(QFileInfo(filePath).baseName());
       
    51 	   setEntryItemIcon(HbIcon(filePath));
       
    52 	}
       
    53 	delete dlg;
       
    54 }
       
    55 
       
    56 CpBaseSettingView *CpThemePluginEntryItemData::createSettingView() const
       
    57 {
       
    58 	return 0;
       
    59 }