diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2009 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"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include + +#include +#include "cpthemecontrol.h" +#include "cpthemepluginentryitemdata.h" +#include + +/*! + \class CpThemePluginEntryItemData + \brief CpThemePluginEntryItemData is the entry item view for Theme Changer plugin. It displays a title "Theme", + the name of current theme and the preview icon of the current theme. + +*/ + +/*! + constructor. +*/ +CpThemePluginEntryItemData::CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text, + const QString &description, + const HbIcon &icon, + const HbDataFormModelItem *parent) : + CpSettingFormEntryItemData(itemDataHelper, + text, + description, + icon, + parent) +{ + //Create a CpThemeControl. the themeControl takes care of displaying the themes + //and letting user select a theme and apply a theme change. + mThemeControl = new CpThemeControl(); + + setEntryItemIcon(mThemeControl->currentThemeIcon()); + setDescription(mThemeControl->currentThemeName()); + + //connect to signal to update the current theme name and icon whenever the theme changes. + QObject::connect(mThemeControl, SIGNAL(themeUpdated(const QString&, const HbIcon&)), this, + SLOT(themeUpdated(const QString&, const HbIcon&))); +} + +/*! + destructor. +*/ +CpThemePluginEntryItemData::~CpThemePluginEntryItemData() +{ + delete mThemeControl; + mThemeControl = 0; +} + +/*! + Slot used for updating entry item's description and icon with current theme name and its + preview icon. + */ +void CpThemePluginEntryItemData::themeUpdated(const QString& themeName, const HbIcon& icon) +{ + setEntryItemIcon(icon); + setDescription(themeName); +} + +/*! + Return the theme changer UI view. Returns 0 if it can't create + the view. +*/ +CpBaseSettingView *CpThemePluginEntryItemData::createSettingView() const +{ + if(mThemeControl) { + CpBaseSettingView *view = mThemeControl->themeListView(); + return view; + } + + return 0; +}