# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1271419162 -10800 # Node ID 10d0dd0e43f156964953ce7417cb3852d6a623dc # Parent 0a74be98a8bc9545e1eb219d37ae65ff780fd0a4 Revision: 201011 Kit: 201015 diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/image/qgn_menu_note.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/image/qgn_menu_note.svg Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/image/themePreview.png Binary file controlpanelplugins/themeplugin/image/themePreview.png has changed diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/image/themePreview.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/image/themePreview.svg Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/rom/themeplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/rom/themeplugin.iby Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + +#ifndef __THEMEPLUGIN_IBY__ +#define __THEMEPLUGIN_IBY__ + +#include +#include + +file=ABI_DIR\BUILD_DIR\cpthemeplugin.dll SHARED_LIB_DIR\cpthemeplugin.dll + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpthemeplugin.qtplugin resource\qt\plugins\controlpanel\cpthemeplugin.qtplugin + +#endif diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/rom/themeplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/rom/themeplugin_rom.pri Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,21 @@ +# +# 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: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/themeplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(themeplugin.iby)" +} \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemechanger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2008-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: Implementation of the HbThemeChanger class + * +*/ + + +#include "cpthemechanger.h" +#include "cpthemechanger_p.h" + +/*! + @alpha + @hbcore + \class CpThemeChanger + + \brief CpThemeChanger provides an interface for changing the current + theme and enumerating the available themes (e.g., for the UI to provide + a list of themes to show). + + This API is only for use with the control panel and its theme + changing plugin. +*/ + +/*! + Constructor. +*/ +CpThemeChanger::CpThemeChanger(QObject* p) : + QObject(p), + d_ptr(new CpThemeChangerPrivate(this)) +{ +} + +/*! + Provides a list of themes as a const QAbstractItemModel*. +*/ +QAbstractItemModel& CpThemeChanger::model() +{ + Q_D(CpThemeChanger); + + return d->model; +} + +/*! + Provide a list of currently available themes. +*/ +const QList CpThemeChanger::themes() const +{ + Q_D(const CpThemeChanger); + + return d->themes(); +} + +/*! + Creates a connection to the theme server for the purpose of + changing the theme. + */ +bool CpThemeChanger::connectToServer() +{ + Q_D(CpThemeChanger); + + return d->connectToServer(); +} + +/*! + Indicates if the client is connected to the theme server. +*/ +bool CpThemeChanger::isConnected() const +{ + Q_D(const CpThemeChanger); + + return d->isConnected(); +} + + +/*! + Returns a ThemeInfo struct containing the current theme name and + a repersentative HbIcon. + + If no repersentative icon exists, the HbIcon returned will be + uninitialized. +*/ +const CpThemeChanger::ThemeInfo& CpThemeChanger::currentTheme() const +{ + Q_D(const CpThemeChanger); + + return d->currentTheme(); +} + +/*! + Change a theme. Returns true on success, false otherwise. + */ +bool CpThemeChanger::changeTheme(const QString& newtheme) +{ + Q_D(CpThemeChanger); + + return d->changeTheme(newtheme); +} + +/*! + Destructor + */ +CpThemeChanger::~CpThemeChanger() +{ + delete d_ptr; + d_ptr = 0; +} + +#include "moc_cpthemechanger.cpp" + +// End of file + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemechanger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-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: HbThemeChanger class definition +* +*/ + + +#ifndef CPTHEMECHANGER_H +#define CPTHEMECHANGER_H + +#include +#include +#include + +class CpThemeChangerPrivate; + +QT_BEGIN_NAMESPACE +class QAbstractItemModel; +QT_END_NAMESPACE + +class CpThemeChanger : public QObject +{ + Q_OBJECT + +public: + explicit CpThemeChanger(QObject* parent=0); + ~CpThemeChanger(); + + struct ThemeInfo + { + QString name; + HbIcon icon; + bool operator < (const struct ThemeInfo &other) const { + return name.localeAwareCompare(other.name) < 0; + } + }; + + const QList themes() const; + QAbstractItemModel& model(); + + const ThemeInfo& currentTheme() const; + + bool changeTheme(const QString& newtheme); + + bool connectToServer(); + bool isConnected() const; + +private: + CpThemeChangerPrivate* d_ptr; + Q_DECLARE_PRIVATE(CpThemeChanger) + Q_PRIVATE_SLOT(d_func(), void _q_themeDirectoryChanged(const QString&)) +}; + +#endif /* CPTHEMECHANGER_H */ diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2008-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: Private implementation of the theme changer. + * +*/ + +#include "cpthemechanger.h" +#include "cpthemechanger_p.h" +#include +#include +#include +#include +#include +#include "cpthemeclient_p.h" +#include "cpthemecommon_p.h" +#ifdef Q_OS_SYMBIAN +#include "cpthemeclientsymbian_p.h" +#else +#include "cpthemeclientqt_p.h" +#endif + +namespace { +#if !defined(Q_OS_SYMBIAN) + #include + static const char* KThemePathKey = "HB_THEMES_DIR"; +#endif + + static const char* KDefaultTheme = "hbdefault"; + static const char* KSettingsGroup = "hborbit"; + static const char* KSettingsCategory = "currenttheme"; + static const bool KDefaultPreviewAvailable = true; +} + +CpThemeChangerPrivate::CpThemeChangerPrivate(CpThemeChanger* qq): + q_ptr(qq), + themeClient(CpThemeClient::global()), + fileWatcher(new QFileSystemWatcher(qq)), + model(this, qq) + +{ + Q_Q(CpThemeChanger); + + // Figure out where our themes are. This is platform-dependent, + // but not worth breaking out into platform-private implementations + // at the moment. Ideally, this would be given to us by the theme server, + #ifdef Q_OS_WIN + static char* _path=NULL; + static size_t _size=0; + _dupenv_s(&_path, &_size, KThemePathKey); + themeRootPath = QString(_path); + themeRootPathPostfix = QString(); + free(_path); + #elif defined(Q_OS_SYMBIAN) + themeRootPath = "c:\\resource\\hb"; + themeRootPathPostfix = "resource\\hb"; + #elif defined(Q_OS_UNIX) + themeRootPath = QString(getenv(KThemePathKey)); + themeRootPathPostfix = QString(); + #elif defined(Q_OS_MACX) + themeRootPath = QDir::homePath() + '/' + "Library" + QString("hb"); + themeRootPathPostfix = QString(); + #else + themeRootPath = "c:\\resource\\hb"; + themeRootPathPostfix = QString(); + #endif + + // Get our current state + QSettings settings(QLatin1String(ORGANIZATION), QLatin1String(THEME_COMPONENT)); + mCurrentTheme.name = settings.value(KSettingsCategory).toString(); + updateThemeList(mCurrentTheme.name); + + // Watch for changes to the theme directory in flash. + // This may change once we start offering a model. + fileWatcher->addPath(themeRootPath+"/themes/"); + q->connect(fileWatcher, SIGNAL(directoryChanged(const QString&)), + q, SLOT(_q_themeDirectoryChanged(const QString&))); + + // Connect to the theme server + connectToServer(); +} + +CpThemeChangerPrivate::~CpThemeChangerPrivate() +{ + themeClient->releaseInstance(); +} + +const CpThemeChanger::ThemeInfo& CpThemeChangerPrivate::currentTheme() const +{ + return mCurrentTheme; +} + +const QString& CpThemeChangerPrivate::currentThemeName() const +{ + return mCurrentTheme.name.isEmpty() ? KDefaultTheme : mCurrentTheme.name; +} + +void CpThemeChangerPrivate::updateThemeList(const QString& newThemeName) +{ + if(!themeList.isEmpty()) { + themeList.clear(); + } + + mCurrentTheme.name = newThemeName.isEmpty() ? KDefaultTheme : newThemeName; + + // Get the list of Drives here + QStringList themesPathList; + +#if defined(Q_OS_WIN32) + themesPathList << themeRootPath; +#elif defined(Q_OS_SYMBIAN) + QFileInfoList driveInfoList = QDir::drives(); + foreach (const QFileInfo &driveInfo, driveInfoList) { + const QString drive = driveInfo.absolutePath(); + themesPathList << drive + themeRootPathPostfix; + } +#elif defined(Q_OS_UNIX) + themesPathList << themeRootPath; +#elif defined(Q_OS_MACX) + themesPathList << themeRootPath; +#endif + + foreach (const QString &path, themesPathList) { + QDir themeDir; + themeDir.setPath( path ) ; + QStringList iconthemeslist; + QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name); + CpThemeChanger::ThemeInfo nameIconPair; + + if(list.contains("themes",Qt::CaseSensitive )) { + QDir root(themeDir.path()); + themeDir.setPath(root.path()+"/themes/icons/") ; + iconthemeslist=themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name); + foreach(QString themefolder, iconthemeslist) { + QDir iconThemePath(root.path()+"/themes/icons/"+themefolder); + if(iconThemePath.exists("index.theme") && + (iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) { + QSettings iniSetting(iconThemePath.path()+"/index.theme",QSettings::IniFormat); + iniSetting.beginGroup("Icon Theme"); + QString hidden = iniSetting.value("Hidden").toString(); + QString name = iniSetting.value("Name").toString(); + QString iconPath = iniSetting.value("PreviewIconPath").toString(); + if (name.isEmpty()) { + continue; + } + if (!KDefaultPreviewAvailable && iconPath.isEmpty()) + { + continue; + } + QString fullPathToIcon(iconThemePath.path() + iconPath); + // Don't treat this as a theme unless it's got a preview. + if (!QFileInfo(fullPathToIcon).exists() && !KDefaultPreviewAvailable) { + continue; + } + if(iconPath.isEmpty()){ + + //if no preview graphics path specified,look for the background graphic. + //first look in /scalable folder. if not there, look in pixmap folder. + if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ + nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); + } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ + nameIconPair.icon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); + } else{ + nameIconPair.icon = HbIcon(":/image/themePreview.svg"); + } + } else { + nameIconPair.icon = HbIcon(fullPathToIcon); + } + nameIconPair.name = name; + themeList.append(nameIconPair); + + if (name == mCurrentTheme.name) { + mCurrentTheme = nameIconPair; + } + + iniSetting.endGroup(); + if((hidden == "true") ||( hidden == "")||(name!=themefolder) ) { + iconthemeslist.removeOne(themefolder); + if(!themeList.isEmpty()) { + themeList.removeLast(); + } + } + } else { + iconthemeslist.removeOne(themefolder); + if(!themeList.isEmpty()) { + themeList.removeLast(); + } + } + } + } + } + // Include default + CpThemeChanger::ThemeInfo def; + def.name = KDefaultTheme; + def.icon = HbIcon(":/image/themePreview.svg"); + themeList.append(def); + if (mCurrentTheme.name == KDefaultTheme) + { + mCurrentTheme = def; + } + + // Sort the themes list + qSort(themeList.begin(), themeList.end()); +} + +const QList& CpThemeChangerPrivate::themes() const +{ + return themeList; +} + +bool CpThemeChangerPrivate::connectToServer() +{ + return themeClient->connectToServer(); +} + +/** + * Indicate if the client is connected to the server + */ +bool CpThemeChangerPrivate::isConnected() const +{ + return themeClient->isConnected(); +} + +/** + * Change a theme + */ +bool CpThemeChangerPrivate::changeTheme(const QString& newTheme) +{ + bool result = false; + // Skip doing this if the request is for the current theme + if (newTheme.isEmpty() || newTheme == mCurrentTheme.name) return result; + + // Make sure it's a valid theme name + bool exists = false; + QList themeList = themes(); + QList::const_iterator i; + for (i = themeList.constBegin(); i != themeList.constEnd(); ++i) { + if ( newTheme == i->name) { + exists = true; + break; + } + } + + if (exists) { + result = themeClient->changeTheme(newTheme); + updateThemeList(newTheme); +} + return result; +} + +void CpThemeChangerPrivate::_q_themeDirectoryChanged(const QString&) +{ + updateThemeList(); +} + +/* + HbThemeChangerModel provides an interface to the data contained in the + HbThemeChanger using QAbstractListModel. +*/ + +/* + Constructor +*/ +HbThemeListModel::HbThemeListModel(CpThemeChangerPrivate *dd, QObject* parent) + : QAbstractListModel(parent) + , mThemeChangerPrivate(dd) +{ + connect(dd->fileWatcher, SIGNAL(directoryChanged(const QString&)), + this, SLOT(themeListChanged())); +} + +/* + Destructor +*/ +HbThemeListModel::~HbThemeListModel() +{ + +} + +/* + Reimplemented from QAbstractListModel. +*/ +int HbThemeListModel::rowCount(const QModelIndex&) const +{ + return mThemeChangerPrivate->themeList.size(); +} + +/* + Reimplemented from QAbstractListModel. Provides the data for Qt::DisplayRole and + Qt::DecorationRole. +*/ +QVariant HbThemeListModel::data(const QModelIndex& index, int role) const +{ + QVariant retVal = QVariant(); + + if (index.isValid()) { + switch (role) { + case Qt::DisplayRole: + retVal = mThemeChangerPrivate->themeList.at(index.row()).name; + break; + + case Qt::DecorationRole: + retVal = mThemeChangerPrivate->themeList.at(index.row()).icon; + break; + + case Qt::SizeHintRole: + retVal = mThemeChangerPrivate->themeList.at(index.row()).icon.size(); + break; + + default: + // do nothing + qt_noop(); + } + } + + return retVal; +} + +/* + Responds appropriately when the underlying data in the theme changer is modified. + + Unfortunately the directory watcher from QFileWatcher only says when something changed + not what changed. Therefore the model is considered reset rather than having rows + with dataChanged. +*/ +void HbThemeListModel::themeListChanged() +{ + beginResetModel(); + + mThemeChangerPrivate->themes(); + + endResetModel(); +} + +// End of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemechanger_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: HbThemeChangerPrivate class definition +* +*/ + + +#ifndef HBTHEMECHANGER_P_H +#define HBTHEMECHANGER_P_H + +#include + +#include + +#include +#include +#include +#include +#include + +#include "cpthemechanger.h" + +QT_BEGIN_NAMESPACE +class QFileSystemWatcher; +QT_END_NAMESPACE + +class CpThemeClient; + +class HbThemeListModel : public QAbstractListModel +{ + Q_OBJECT + +public: + HbThemeListModel(CpThemeChangerPrivate* dd, QObject *parent = 0); + virtual ~HbThemeListModel(); + + virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + +public slots: + void themeListChanged(); + +private: + CpThemeChangerPrivate *mThemeChangerPrivate; +}; + +class CpThemeChangerPrivate +{ + CpThemeChanger* q_ptr; + Q_DECLARE_PUBLIC(CpThemeChanger) + +public: + CpThemeChangerPrivate(CpThemeChanger* q); + ~CpThemeChangerPrivate(); + + bool connectToServer(); + bool isConnected() const; + + const QList& themes() const; + void updateThemeList(const QString& currentThemeName = QString()); + + const QStringList directories() const; + + const CpThemeChanger::ThemeInfo& currentTheme() const; + + const QString& currentThemeName() const; + bool changeTheme(const QString& newtheme); + + void _q_themeDirectoryChanged(const QString&); + + CpThemeChanger::ThemeInfo mCurrentTheme; + + QString themeRootPath; + QString themeRootPathPostfix; + + CpThemeClient* themeClient; + QFileSystemWatcher* fileWatcher; + QList themeList; + HbThemeListModel model; + friend class HbThemeChangerModel; +}; + +#endif /* HBTHEMECHANGER_P_H */ diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2008-2010 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 "cpthemeclient_p.h" + +#ifdef Q_OS_SYMBIAN +#include "cpthemeclientsymbian_p.h" +#else +#include "cpthemeclientqt_p.h" +#endif + +static CpThemeClient *clientInst=0; + +/** + * Constructor + */ +CpThemeClient::CpThemeClient():d_ptr(new CpThemeClientPrivate) +{ + +} + +/** + * CpThemeClient::connectToServer() + */ +bool CpThemeClient::connectToServer() +{ + Q_D(CpThemeClient); + return d->connectToServer(); +} + +bool CpThemeClient::isConnected() +{ + Q_D(CpThemeClient); + return d->isConnected(); +} + +/** + * Change a theme + */ +bool CpThemeClient::changeTheme(const QString& newtheme) +{ + Q_D(CpThemeClient); + return d->changeTheme(newtheme); +} + + + +/** + * CpThemeClient::~CpThemeClient() + */ +CpThemeClient::~CpThemeClient() +{ + Q_D(CpThemeClient); + delete d; +} + + + +/** + * CpThemeClient::global() + */ +CpThemeClient *CpThemeClient::global() +{ + if ( !clientInst ) { + clientInst = new CpThemeClient; + } + return clientInst; +} + +/** + * CpThemeClient::releaseInstance() + */ +void CpThemeClient::releaseInstance() +{ + delete clientInst; + clientInst = 0; +} diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeclient_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-2010 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: +* +*/ + +#ifndef CPTHEMECLIENT_P_H +#define CPTHEMECLIENT_P_H + +#include +#include + + +class CpThemeClientPrivate; + +class CpThemeClient +{ + CpThemeClientPrivate* d_ptr; + Q_DECLARE_PRIVATE_D(d_ptr, CpThemeClient) + +public: + bool connectToServer(); + + bool changeTheme(const QString& newtheme); + + bool isConnected(); + +public: + static CpThemeClient *global(); + static void releaseInstance(); + ~CpThemeClient(); + +private: + CpThemeClient(); +}; + +#endif /* CPTHEMECLIENT_P_H */ diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2008-2010 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 "cpthemeclientqt_p.h" +#include +#include +#include +#include +#include +#include + +#include +// TODO Do we need these? +//#include +//#include +//#include +//#include "hbthemecommon_p.h" + +#define WAIT_TIME_TO_CONNECT_TO_SERVER 500 +#define WAIT_TIME_TO_START_SERVER 5000 +//static const QString SERVERFILEPATH = QLatin1String(HB_BIN_DIR) + QDir::separator() + QLatin1String("hbthemeserver"); + +/** + * Constructor + */ +CpThemeClientPrivate::CpThemeClientPrivate():clientConnected( false ),localSocket( new QLocalSocket() ) +{ +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO ; +#endif +} + +/** + * connectToServer + */ +bool CpThemeClientPrivate::connectToServer() +{ + localSocket->connectToServer(THEME_SERVER_NAME); + // This logic needs to be improved + bool success = localSocket->waitForConnected( WAIT_TIME_TO_CONNECT_TO_SERVER ); + +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO << "Socket Connect status: " << success; +#endif + +// Stub shouldn't try starting the theme server yet again. +#if 0 + if(!success) { + QProcess *newProcess = new QProcess(); + newProcess->start(SERVERFILEPATH); + success = newProcess->waitForStarted( WAIT_TIME_TO_START_SERVER ); +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO << "Server Start Status: " << success << "Error = " << newProcess->error (); +#endif + + // If server started + if (success) { + // ToDo: This is to wait for server to start running. Logic needs to be improved. + newProcess->waitForFinished(3000); +#ifdef THEME_SERVER_TRACES + qDebug() <connectToServer(THEME_SERVER_NAME); + success = localSocket->waitForConnected(); +#ifdef THEME_SERVER_TRACES + qDebug() <disconnectFromServer(); + delete localSocket; +} + +/** + * CpThemeClientPrivate::themeChanged() + */ +void CpThemeClientPrivate::themeChanged() +{ +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO; +#endif + + QByteArray inputByteArray = localSocket->readAll(); + QDataStream inputDataStream(inputByteArray); + int request; + inputDataStream >> request; + +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO << "recognizer: "<theme()->d_ptr->clearCache(); + } +#endif +} + +/** + * CpThemeClientPrivate::handleThemeChangeRequest() + */ +void CpThemeClientPrivate::handleThemeChangeRequest(QDataStream &dataStream) +{ + QString themeName; + dataStream >> themeName; +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO <<"themeName is : " <theme()->name() == themeName)) { +#ifdef THEME_SERVER_TRACES + qDebug() << Q_FUNC_INFO <<"themeChanged(): called"; +#endif +#if 0 + // TODO determine if we need this for the control panel app + hbInstance->theme()->d_ptr->handleThemeChange(); +#endif + } +} + +/** + * changeTheme + */ +bool CpThemeClientPrivate::changeTheme(const QString &newTheme) +{ +#ifdef THEME_CHANGER_TRACES + qDebug() <<"ThemeClientQt::changeTheme("<write(outputByteArray); +#ifdef THEME_CHANGER_TRACES + qDebug()<<"ThemeClientQt::ThemeName written to server"; +#endif + localSocket->flush(); + return count == expected; +} + + + + + + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008-2010 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: +* +*/ + + +#ifndef CPTHEMECLIENTQT_P_H +#define CPTHEMECLIENTQT_P_H + +#include +#include "cpthemecommon_p.h" + +class QString; +class QSizeF; +class QLocalSocket; + +class CpThemeClientPrivate : public QObject +{ + Q_OBJECT + +public: + CpThemeClientPrivate(); + bool connectToServer(); + bool isConnected(); + + bool changeTheme(const QString& newtheme); + + ~CpThemeClientPrivate(); + +public slots: + void themeChanged(); + +public: + bool clientConnected; + +private: + void handleThemeChangeRequest(QDataStream &dataStream); + +private: + QLocalSocket* localSocket; + QString themeName; +}; + +#endif // HBTHEMECLIENTQT_P_H diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008-2010 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 "cpthemeclientsymbian_p.h" +#include "cpthemesymbiancommon_p.h" + +#include +#include +#include + +const TUint KDefaultMessageSlots = 4; + +/** +* constructor +*/ +CpThemeClientPrivate::CpThemeClientPrivate(): + clientConnected(false) +{ +} + +/** +* CpThemeClientPrivate::connectToServer() +* +* Connects to the server +*/ +bool CpThemeClientPrivate::connectToServer() +{ + + TInt error; + + error = CreateSession(KThemeServerName, Version(), KDefaultMessageSlots); + return( clientConnected = (KErrNone == error ) ); +} + +/** +Indicates a connection to the server +*/ +bool CpThemeClientPrivate::isConnected() +{ + return connected; +} + + + +/** +Returns the version number +*/ +TVersion CpThemeClientPrivate::Version(void) const +{ + return(TVersion(KThemeServerMajorVersionNumber, + KThemeServerMinorVersionNumber, + KThemeServerBuildVersionNumber)); +} + +/** + * Destructor + */ +CpThemeClientPrivate::~CpThemeClientPrivate() +{ + RSessionBase::Close(); +} + +/** + * StartServer + */ +TInt CpThemeClientPrivate::StartServer() +{ + TFindServer findThemeServer(KThemeServerName); + TFullName name; + if ( KErrNone == findThemeServer.Next( name ) ) { + // Server already running + return KErrNone; + } + return CreateServerProcess(); +} + +/** + * CreateServerProcess + */ +TInt CpThemeClientPrivate::CreateServerProcess() +{ + TInt result; + const TUid KServerUid2={0x100039CE}; + const TUidType serverUid( KNullUid, KServerUid2, KServerUid3 ); + RProcess server; + _LIT(KThemeServerExe,"hbthemeserver.exe"); + + result = server.Create( KThemeServerExe, KNullDesC, EOwnerProcess ); + + if (KErrNone != result) { + return result; + } + else { + TRequestStatus status; + server.Rendezvous(status); + if (status!=KRequestPending) { + server.Kill(0); // abort startup + } + else { + server.Resume(); // logon OK - start the server + } + User::WaitForRequest(status);// wait for start or death + server.Close(); + connected == status.Int() == KErrNone ? true : false; + return status.Int(); // return the error + } +} + +/** + * changeTheme + */ +bool CpThemeClientPrivate::changeTheme(const QString& aString ) +{ + TPtrC themeName(reinterpret_cast(aString.constData())); + TIpcArgs args(&themeName); + TInt err = SendReceive(EThemeSelection, args); + return KErrNone == err; +} diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2008-2010 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: +* +*/ + + +#ifndef CPTHEMECLIENTSYMBIAN_P_H +#define CPTHEMECLIENTSYMBIAN_P_H + + +#include +// TODO Do we need this? +//#include "hbthemecommon_p.h" +//ToDo: replace this with forward declaration +#if !defined(__E32BASE_H__) +#include +#endif + +class CThemeListenerPrivate; +class QSizeF; +class HbEffectFxmlData; +struct MeshItem; + +class CpThemeClientPrivate : public RSessionBase +{ +public: + CpThemeClientPrivate(); + + bool connectToServer(); + bool isConnected(); + + bool changeTheme(const QString& newtheme); + ~CpThemeClientPrivate(); + +public: + bool clientConnected; + +private: + TVersion Version() const; + TInt StartServer(); + TInt CreateServerProcess(); + +private: + CThemeListenerPrivate *themelistener; + QString themeName; + bool connected; +}; + +#endif /* CPTHEMECLIENTSYMBIAN_P_H */ diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemecommon_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemecommon_p.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2008-2010 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: +* +*/ + + +#ifndef HBTHEMECOMMON_P_H +#define HBTHEMECOMMON_P_H + +#include +#include +#include +#include + +#define THEME_SERVER_NAME "hbthemeserver" +#define HB_THEME_SHARED_PIXMAP_CHUNK "themeserver_chunk" +#define ORGANIZATION "Nokia" +#define THEME_COMPONENT "ThemeFramework" + +// To enable/disable debug messages for theme server functionality +#undef THEME_SERVER_TRACES + +// To enable fute testing for cache +//#define HB_ICON_CACHE_DEBUG +struct MultiPartSizeData +{ + // Indexing order is: + + // 'NinePieces' -> tl, t, tr, l, c, r, bl, b, br + // 'ThreePiecesHorizontal' -> l, c, r + // 'ThreePiecesVertical' -> t, c, b + QString multiPartIconId; + QRect sources[9]; // rects used from the rasterized frame part pixmaps + QRect targets[9]; // frame part target rects inside the bounding rectangle of the frame + QSize pixmapSizes[9]; // frame part pixmaps are rasterized to these sizes +}; + + +struct HbMultiIconParams +{ + QString multiPartIconId; + QStringList multiPartIconList; + MultiPartSizeData multiPartIconData; + QSizeF size; + int aspectRatioMode; + int mode; + int options; + bool mirrored; + QColor color; + int rgba; + bool colorflag; +}; + + +enum IconFormatType { + INVALID_FORMAT = -1, + NVG, + PIC, + SVG, + BLOB, + OTHER_SUPPORTED_FORMATS +}; + +struct HbSharedPixmapInfo +{ + int offset; + int width; + int height; + int defaultWidth; + int defaultHeight; + QImage::Format format; +}; + +struct HbSharedNVGInfo +{ + int offset; + int dataSize; + int width; + int height; + int defaultWidth; + int defaultHeight; + +}; + +struct HbSharedPICInfo +{ + int offset; + int dataSize; + int width; + int height; + int defaultWidth; + int defaultHeight; +}; + +struct HbSharedBLOBInfo +{ + int offset; + int dataSize; +}; + +struct HbSharedIconInfo +{ + IconFormatType type; + + union + { + HbSharedPixmapInfo pixmapData; + HbSharedNVGInfo nvgData; + HbSharedPICInfo picData; + HbSharedBLOBInfo blobData; + }; + +}; + +struct HbSharedStyleSheetInfo +{ + int offset; + int refCount; + HbSharedStyleSheetInfo(): + offset(-1), + refCount(0) + {} +}; + +struct HbSharedEffectInfo +{ + int offset; + HbSharedEffectInfo(): offset(-1){} +}; + +struct HbSharedWMLInfo +{ + int offset; + HbSharedWMLInfo() : offset(-1) {} +}; + +struct HbDeviceProfileInfo +{ + int offset; + HbDeviceProfileInfo() : offset(-1) {} +}; + +// Function codes (opcodes) used in message passing between client and server +enum ThemeServerRequest + { + EIconLookup = 1, + EIconDefaultSize, + EStyleSheetLookup, + EThemeSelection, + EMultiPieceIcon, + EWidgetMLLookup, + EDeviceProfileOffset, + #ifdef HB_ICON_CACHE_DEBUG + EIconCleanUp, + ECacheIconCount, + ERasterMemLimit, + EVectorMemLimit, + EFreeRasterMem, + EFreeVectorMem, + ELastAddedItemMem, + ELastAddedItemRefCount, + ELastRemovedItemMem, + ELastRemovedItemRefCount, + EEnableCache, + ECacheHit, + ECacheMiss, + ECleanRasterLRUList, + ECleanVectorLRUList, + EServerHeap, + EGpuLruCount, + ECpuLruCount, + EServerStat, + EServerHeapMarkStart, + EServerHeapMarkEnd, + EServerAllocFail, + EServerAllocReset, + #endif + EThemeContentUpdate, + EEffectLookupFilePath, + EEffectAdd, + EUnloadIcon, + EThemeServerStop + }; + +#endif /* HBTHEMECOMMON_P_H */ diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,241 @@ +/* + * 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: + * + */ + +/*! + \class CpThemeControl + \brief CpThemeControl creates and controls two views for Theme Changer plugin and handles + user interaction to preview and change the themes. + + It creates a list view of the themes. When a list item is selected, it creates a preview + of the theme icon using a CpThemePreview class. + + This class also connects to the theme server using the HbThemeChanger and sets the theme + based on user interaction with the views. + + */ + +#include +#include +#include +#include +#include + +#include +#include +#include "cpthemechanger.h" + +#include "cpthemecontrol.h" +#include "cpthemelistview.h" +#include "cpthemepreview.h" + +static const QString KPlaceholderPreview = ":/image/themePreview.svg"; + +/*! + Helper function to fetch the main window. +*/ + +static HbMainWindow *mainWindow() +{ + QList< HbMainWindow* > mainWindows = hbInstance->allMainWindows(); + if (!mainWindows.isEmpty()) { + return mainWindows.front(); + } + return 0; +} + +/*! + constructor. +*/ +CpThemeControl::CpThemeControl(): mThemeListView(0), + mThemePreview(0), + mThemeChanger(0), + mListModel(0) +{ + mThemeChanger = new CpThemeChanger(); + + + QTranslator *translator = new QTranslator(this); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + translator->load("control_panel_" + lang, path); + qApp->installTranslator(translator); + +} + + + +/*! + destorys the list view, preview and theme changer objects. +*/ +CpThemeControl::~CpThemeControl() +{ + delete mThemeListView; + mThemeListView = 0; + + delete mThemeChanger; + mThemeChanger = 0; + + delete mThemePreview; + mThemePreview = 0; +} + +/*! + Creates the theme list view. Gets the themes, creates a model based on + theme names, icons, and icon paths and sets the list model. +*/ +void CpThemeControl::createThemeList() +{ + + mThemeListView = new CpThemeListView(); + + mListModel = &mThemeChanger->model(); + + // Set the model for theme list. + mThemeListView->setModel(mListModel); + + //connect to signal for selecting a list item. + connect(mThemeListView,SIGNAL(newThemeSelected(const QModelIndex&)), + this,SLOT(newThemeSelected(const QModelIndex&))); + + //handle signal for list view closing. (e.g Back softkey pressed) + connect(mThemeListView,SIGNAL(aboutToClose()), + this,SLOT(themeListClosed())); +} + +/*! + returns the instance of themelist view. Used by control panel to set + the view. +*/ +CpBaseSettingView* CpThemeControl::themeListView() +{ + //If the view was removed before by control panel app, create it again. + if(!mThemeListView) + createThemeList(); + + return mThemeListView; +} + +/*! + returns the name of the current theme. +*/ +QString CpThemeControl::currentThemeName() const +{ + return mThemeChanger->currentTheme().name; +} + +/*! + returns the repersenatative icon of the current theme. +*/ +HbIcon CpThemeControl::currentThemeIcon() const +{ + return mThemeChanger->currentTheme().icon; +} + +/*! + Slot called when a list item of the theme list is selected. +*/ +void CpThemeControl::newThemeSelected(const QModelIndex& index) +{ + if(!index.isValid()) { + return; + } + + CpThemeChanger::ThemeInfo themeInfo = mThemeChanger->themes().at(index.row()); + + //Set up the theme preview and set it to + //the current view of main window. + HbMainWindow* mWindow = ::mainWindow(); + + if(!mThemePreview){ + mThemePreview = new CpThemePreview(themeInfo); + mWindow->addView(mThemePreview); + + connect(mThemePreview,SIGNAL(aboutToClose()), + this, SLOT(previewClosed())); + + connect(mThemePreview, SIGNAL(applyTheme(const QString&)), + this, SLOT(themeApplied(const QString&))); + } else { + mThemePreview->setThemeInfo(themeInfo); + } + //TODO: use qtTrId(text_id). + mThemePreview->setTitle(tr("Control Panel")); + + mWindow->setCurrentView(mThemePreview); + +} + +/*! + Slot called when a Select key is pressed in theme preview view. +*/ +void CpThemeControl::themeApplied(const QString& theme) +{ + bool success = false; + + success = mThemeChanger->connectToServer(); + + if (success) { + mThemeChanger->changeTheme(theme); + emit themeUpdated(mThemeChanger->currentTheme().name, mThemeChanger->currentTheme().icon); + } + + //Go back to control panel view. Close theme preview. + previewClosed(); + //ask the themelistview to close. Control Panel will + //take care of removing it from window. + triggerThemeListClose(); + +} +/*! + Slot called when the theme preview view is closed. +*/ +void CpThemeControl::previewClosed() +{ + //The theme preview closed, go back + //to theme list view. + HbMainWindow* mainWindow = ::mainWindow(); + mainWindow->removeView(mThemePreview); + mThemePreview->deleteLater(); + mThemePreview = 0; + + mainWindow->setCurrentView(mThemeListView); +} + +/*! + Slot for when the theme list view is closed. Ownership of the theme list was given to + control panel, so the class won't delete it. + +*/ +void CpThemeControl::themeListClosed() +{ + mThemeListView = 0; + + delete mThemePreview; + mThemePreview = 0; +} + +/*! + asks the theme list view to close. +*/ +void CpThemeControl::triggerThemeListClose() +{ + mThemeListView->closeView(); +} + + + + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,70 @@ +/* + * 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: + * + */ + +#ifndef CPTHEMECONTROL_H +#define CPTHEMECONTROL_H + +#include +#include + +#include "cpthemechanger.h" +#include + +QT_BEGIN_NAMESPACE +class QModelIndex; +class QString; +class QStandardItemModel; +QT_END_NAMESPACE + +class CpThemeListView; +class CpThemePreview; +class CpBaseSettingView; + + + +class CpThemeControl : public QObject +{ + Q_OBJECT + +public: + CpThemeControl(); + ~CpThemeControl(); + CpBaseSettingView* themeListView(); + QString currentThemeName() const; + HbIcon currentThemeIcon() const; + +signals: + void themeUpdated(const QString& themeName, const HbIcon& icon); + +public slots: + void newThemeSelected(const QModelIndex& index); + void previewClosed(); + void themeApplied(const QString& theme); + void themeListClosed(); + +private: + void createThemeList(); + void triggerThemeListClose(); + +private: + CpThemeListView* mThemeListView; + CpThemePreview* mThemePreview; + CpThemeChanger* mThemeChanger; + QAbstractItemModel* mListModel; +}; + +#endif //CPTHEMECONTROL_H diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemelistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-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 +#include + +#include "cpthemelistview.h" + +/*! + \class CpThemeListView + \brief CpThemeListView displays a heading (Select theme) and a list of themes with + corresponding icons. + + Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel + framework. However, it does not use HbDataForm as its widget and as its parent does, so + it uses SetWidget to set the listview to its widget instead of an HbDataForm. + */ + +/*! + constructor. Creates the heading label and the list and adds it to layout. +*/ +CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), + mThemeList(new HbListView(this)) +{ + + //Create a layout with a heading "Select theme" at top and the list below it. + HbWidget* contentWidget = new HbWidget(this); + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + + + + //setup the heading. + HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget); + label->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + layout->addItem(label); + + connect(mThemeList, SIGNAL(activated(const QModelIndex&)), + this, SIGNAL(newThemeSelected(const QModelIndex&))); + + //add the list to layout. + layout->addItem(mThemeList); + + contentWidget->setLayout(layout); + + setWidget(contentWidget); +} + +/*! + destructor. +*/ +CpThemeListView::~CpThemeListView() +{ +} + +/*! + returns the listview instance (list of themes). +*/ +HbListView* CpThemeListView::themeList() const +{ + return mThemeList; +} + +/*! + Sets the model of its listView. +*/ +void CpThemeListView::setModel(QAbstractItemModel* model) +{ + mThemeList->setModel(model); +} + +/*! + sets the widget. Reimplementation from HbView. +*/ +void CpThemeListView::setWidget(QGraphicsWidget *widget) +{ + HbView::setWidget(widget); +} + +/*! + emits aboutToClose() signal. +*/ +void CpThemeListView::closeView() +{ + emit aboutToClose(); +} + + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemelistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,51 @@ +/* + * 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: + * + */ +#ifndef CPTHEMELISTVIEW_H +#define CPTHEMELISTVIEW_H + +#include + +#include +#include + +#include + + +class CpThemeSelectionList; + +class CpThemeListView : public CpBaseSettingView +{ + Q_OBJECT + +public: + CpThemeListView(QGraphicsItem *parent = 0); + ~CpThemeListView(); + void setWidget(QGraphicsWidget *widget); + HbListView* themeList() const; + void setModel(QAbstractItemModel* model); + void closeView(); + +signals: + void newThemeSelected(const QModelIndex& index); + +private: + HbListView* mThemeList; + +}; + +#endif //CPTHEMELISTVIEW_H + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,57 @@ +/* + * 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 "cpthemeplugin.h" +#include "cpthemepluginentryitemdata.h" + +/*! + \class CpThemePlugin + \brief CpThemePlugin is a control panel plugin that allows a user to view available themes and + change the current theme of the phone. + +*/ + +/*! + constructor. +*/ +CpThemePlugin::CpThemePlugin() +{ +} + +/*! + destructor. +*/ +CpThemePlugin::~CpThemePlugin() +{ +} + +/*! + create the control panel entry item data for Theme settins. +*/ +CpSettingFormItemData *CpThemePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + + //create a cpthemepluginentryitemdata with default values and return it. + CpSettingFormEntryItemData *entryItem = new CpThemePluginEntryItemData( + itemDataHelper, + tr("Theme"), + tr("Theme Name"), + HbIcon(":/image/qgn_menu_note.svg")); + return entryItem; +} + +Q_EXPORT_PLUGIN2(cpthemeplugin, CpThemePlugin); + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemeplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,34 @@ +/* + * 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: + * + */ + +#ifndef CPTHEMEPLUGIN_H +#define CPTHEMEPLUGIN_H + +#include +#include + +class CpThemePlugin : public QObject, public CpPluginPlatInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginPlatInterface) +public: + CpThemePlugin(); + virtual ~CpThemePlugin(); + virtual CpSettingFormItemData *createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPTHEMEPLUGIN_H diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Fri Apr 16 14:59:22 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; +} diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,46 @@ +/* + * 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: + * + */ + +#ifndef CPTHEMEPLUGINENTRYITEMDATA_H +#define CPTHEMEPLUGINENTRYITEMDATA_H + +#include +#include + +class CpThemeControl; + +class CpThemePluginEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT + +public: + explicit CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const HbIcon &icon = HbIcon(), + const HbDataFormModelItem *parent = 0); + virtual ~CpThemePluginEntryItemData(); + +private slots: + void themeUpdated(const QString& themeName, const HbIcon& icon); +private: + CpThemeControl* mThemeControl; + virtual CpBaseSettingView *createSettingView() const; + +}; + +#endif //CPTHEMEPLUGINENTRYITEMDATA_H diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemepreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,130 @@ +/* + * 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 +#include +#include +#include +#include +#include + +#include "cpthemepreview.h" + +/*! + \class CpThemePreview + \brief CpThemePreview shows a preview of a selected theme with a heading displaying the name of the theme as well as + a toolbar with Select and Cancel buttons. This view is used for the user to either select the theme and apply + the theme change or press Cancel and go back to theme list view. +*/ + +/*! + constructor. +*/ +CpThemePreview::CpThemePreview(const CpThemeChanger::ThemeInfo& theme, QGraphicsItem *parent) : + HbView(parent), + mTheme(theme), + mSoftKeyBackAction(0) +{ + + //Create the layout and add heading and and preview icon to the layout. + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + + + //setup the heading. + //TODO: translation of string hbTrId("txt_cp_title_preview_1") + + QString themeHeading = tr("Preview: ") + mTheme.name; + HbLabel* label = new HbLabel(themeHeading, this); + label->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + + layout->addItem(label); + + //Create the toolbar and "Select" and "Cancel" actions. + HbToolBar* mToolBar = new HbToolBar(this); + + HbAction* selectAction = new HbAction(tr("Select")); + + //Add Action to the toolbar and show toolbar + mToolBar->addAction( selectAction ); + + HbAction* cancelAction = new HbAction(tr("Cancel")); + mToolBar->addAction( cancelAction ); + + QObject::connect( selectAction, SIGNAL(triggered()), + this, SLOT(themeSelected())); + + QObject::connect( cancelAction, SIGNAL(triggered()), + this, SIGNAL(aboutToClose())); + + //layout->addItem(&HbIconItem(mTheme.icon, this )); + HbIconItem* layoutItem = new HbIconItem(mTheme.icon, this); + layout->addItem(layoutItem); + setToolBar(mToolBar); + setLayout(layout); + + //Setup the Back button action and set softkey. Back button + //takes the user to the theme list view. + mSoftKeyBackAction = new HbAction(Hb::BackAction, this); + QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()), + this, SIGNAL(aboutToClose()) ); + + this->setNavigationAction(mSoftKeyBackAction); +} + +/*! + destructor. +*/ +CpThemePreview::~CpThemePreview() +{ +} + +/*! + sets the theme to \a theme. +*/ +void CpThemePreview::setThemeInfo(const CpThemeChanger::ThemeInfo& theme) +{ + mTheme = theme; +} + +/*! + returns the themeName. +*/ +const QString& CpThemePreview::themeName() const +{ + return mTheme.name; +} + +/*! + returns the repersentative themeIcon of the current theme. +*/ +const HbIcon& CpThemePreview::themeIcon() const +{ + return mTheme.icon; +} + +/*! + Slot to handle when the user selects a theme. +*/ +void CpThemePreview::themeSelected() +{ + emit applyTheme(mTheme.name); +} + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemepreview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,57 @@ +/* + * 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: + * + */ + +#ifndef CPTHEMEPREVIEW_H +#define CPTHEMEPREVIEW_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QString; +QT_END_NAMESPACE + +class HbAction; +class HbMainWindow; +class HbIconItem; + +class CpThemePreview : public HbView +{ + Q_OBJECT + +public: + explicit CpThemePreview(const CpThemeChanger::ThemeInfo &theme, QGraphicsItem *parent = 0); + ~CpThemePreview(); + void setThemeInfo(const CpThemeChanger::ThemeInfo& theme); + const QString& themeName() const; + const HbIcon& themeIcon() const; + +signals: + void applyTheme(const QString&); + void aboutToClose(); + +public slots: + void themeSelected(); + +private: + CpThemeChanger::ThemeInfo mTheme; + HbAction* mSoftKeyBackAction; +}; + +#endif //CPTHEMEPREVIEW_H diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2008-2010 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: +* +*/ + + +#ifndef HBTHEMESYMBIANCOMMON_P_H +#define HBTHEMESYMBIANCOMMON_P_H + +#include +#include "cpthemecommon_p.h" +struct TIconParams +{ + TBuf<256> fileName; + TReal width; + TReal height; + TUint8 aspectRatioMode; + TUint8 mode; + TUint8 options; + TBool mirrored; + TUint32 rgba; + TBool colorflag; + }; + +struct TMultiIconSymbParams +{ + TBuf<256> multiPartIconId; + TBuf<256> multiPartIconList[9]; + TRect sources[9]; + TRect targets[9]; + TSize pixmapSizes[9]; + QSizeF size; + TInt aspectRatioMode; + TInt mode; + TInt options; + TBool mirrored; + TInt rgba; + TBool colorflag; + }; + +// server name +_LIT(KThemeServerName,"hbthemeserver"); +const TUid KServerUid3={0x20022E82}; + +// A version must be specifyed when creating a session with the server + + +const TUint KThemeServerMajorVersionNumber=0; +const TUint KThemeServerMinorVersionNumber=1; +const TUint KThemeServerBuildVersionNumber=1; + +enum TThemeServerLeave +{ + ENonNumericString = 99 +}; + +#endif // HBTHEMESYMBIANCOMMON_P_H + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/themeplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.pri Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,52 @@ +# +# 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: cpthemeplugin source files +# + +# Input +HEADERS += src/cpthemepreview.h \ + src/cpthemecontrol.h \ + src/cpthemeplugin.h \ + src/cpthemelistview.h \ + src/cpthemepluginentryitemdata.h + +SOURCES += src/cpthemepreview.cpp \ + src/cpthemecontrol.cpp \ + src/cpthemeplugin.cpp \ + src/cpthemelistview.cpp \ + src/cpthemepluginentryitemdata.cpp + +# Remove once this goes into Hb. +HEADERS += src/cpthemechanger.h \ + src/cpthemeclient_p.h \ + src/cpthemecommon_p.h \ + src/cpthemechanger_p.h + +# Remove once this goes into Hb. +SOURCES += src/cpthemechanger.cpp \ + src/cpthemechanger_p.cpp \ + src/cpthemeclient_p.cpp + +# Remove once this goes into Hb. +win32|mac { + HEADERS += src/cpthemeclientqt_p.h + SOURCES += src/cpthemeclientqt_p.cpp +} + +# Remove once this goes into Hb. +symbian { + HEADERS += src/cpthemeclientsymbian_p.h \ + src/cpthemesymbiancommon_p.h + SOURCES += src/cpthemeclientsymbian_p.cpp +} diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/themeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,95 @@ +# +# 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: +# + +TEMPLATE = lib +TARGET = cpthemeplugin + +CONFIG += hb plugin + +LIBS += -lcpframework +TRANSLATIONS = control_panel.ts + +CONFIG += debug_and_release +RESOURCES += themeplugin.qrc + +include (themeplugin.pri) +include (rom/themeplugin_rom.pri) + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin + OBJECTS_DIR = $$PWD/$$SUBDIRPART/tmp/$$TARGET + # add platfrom API for windows + INCLUDEPATH += $$PWD/../../../controlpanel_plat/inc +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0X2002C2F3 +} + + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} + +#symbian: INCLUDEPATH += /sf/mw/hb/include/hbservices \ +# /sf/mw/hb/include/hbservices/private \ +# /sf/mw/hb/include/hbcore \ +# /sf/mw/hb/include/hbcore/private +# + +# End of file --Don't remove this. diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/themeplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.qrc Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,7 @@ + + + image/qgn_menu_note.svg + image/themePreview.png + image/themePreview.svg + + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/themeplugin.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.ts Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + Select theme view title + Select theme + Select theme + + CP_04 + subtitle + CP + False + + + This is the view title, shown in all Control Panel views. + Control Panel + Control Panel + qtl_chrome_title + CP_01 + title + CP + False + + + List item, opens Theme selector view + Theme + Theme + qtl_list_pri_large_graphic + CP_01 + list + CP + False + + + Theme preview view title, where %1 is the name of the theme that is previewed + Preview: %1 + Preview: %1 + + CP_05 + subtitle + CP + False + + + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/tsrc.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,28 @@ +# +# 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: +# + +TEMPLATE = subdirs +SUBDIRS += unit/unittest_cpthemecontrol +SUBDIRS += unit/unittest_cpthemelistview +SUBDIRS += unit/unittest_cpthemeplugin +SUBDIRS += unit/unittest_cpthemepluginentryitemdata + +CONFIG += ordered +test.depends = first +test.CONFIG += recursive +autotest.depends = first +autotest.CONFIG += recursive +QMAKE_EXTRA_TARGETS += test autotest diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/common.pri Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,49 @@ +# +# 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: XENT-MV +# +# Description: Stuff for all unit tests +# + +QT += testlib +CONFIG += qtestlib hb + + +win32 { + INCLUDEPATH += . + INCLUDEPATH += ../../../src/inc + INCLUDEPATH += ../../../src/cpframework/src + INCLUDEPATH += ../../../controlpanel_plat/inc +} + +unix { + test.commands = ./$(TARGET) + autotest.commands = ./$(TARGET) -xml -o ../$(QMAKE_TARGET).xml +} else:win32 { + test.CONFIG += recursive + autotest.CONFIG += recursive + build_pass { + test.commands =/epoc32/RELEASE/WINSCW/udeb/$(QMAKE_TARGET).exe + autotest.commands =/epoc32/RELEASE/WINSCW/udeb/$(QMAKE_TARGET).exe -xml -o c:/$(QMAKE_TARGET).xml + } +} + +QMAKE_EXTRA_TARGETS += test autotest + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + + \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,148 @@ +/* +* 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: XENT-MV +* +* Description: unit tests for the CpThemeControl class from themeplugin +* +*/ + +#include +#include +#include + +#include "cpthemechanger.h" +#include "cpthemecontrol.h" +#include "cpthemechanger.h" + +class TestCpThemeControl : public QObject +{ + Q_OBJECT + +private slots: + void init(); + + void testConstructor(); + void testThemeListView(); + void testCurrentThemeName(); + void testCurrentThemeIcon(); + void testNewThemeSelected(); + void testPreviewClosed(); + void testThemeApplied(); + void testUpdateThemeList(); + + void cleanup(); + +private: + CpThemeChanger* mThemeChanger; +}; + +// setup and cleanup +void TestCpThemeControl::init() +{ + mThemeChanger = new CpThemeChanger(); +} + +void TestCpThemeControl::cleanup() +{ + delete mThemeChanger; +} + +// verify that the constructor works and that the +// defaults are sane. +void TestCpThemeControl::testConstructor() +{ + CpThemeControl * control = new CpThemeControl(); + + QVERIFY(control !=0 ); + QVERIFY(!control->currentThemeName().isEmpty()); + QVERIFY(!control->currentThemeIcon().isEmpty()); + + delete control; +} + +// verify that the themeListView doesn't return NULL (or crash) +void TestCpThemeControl::testThemeListView() +{ + CpThemeControl control; + + QVERIFY(control.themeListView() != 0); +} + +// test that we get back a non-empty QString +void TestCpThemeControl::testCurrentThemeName() +{ + CpThemeControl control; + + QVERIFY((control.currentThemeName() == mThemeChanger->currentTheme()) + || (control.currentThemeName() == QString("hbdefault"))); +} + +// test that we get a non-empty string for current theme icon +void TestCpThemeControl::testCurrentThemeIcon() +{ + CpThemeControl control; + + QVERIFY(!control.currentThemeIcon().isEmpty()); +} + +// NULL test there's no way to externally get the model the QModelIndex is based on +void TestCpThemeControl::testNewThemeSelected() +{ + CpThemeControl control; + + control.newThemeSelected(QModelIndex()); + +} + +// NULL test - basically verifies that it doesn't burst into flames. +void TestCpThemeControl::testPreviewClosed() +{ + CpThemeControl control; + + control.previewClosed(); + +} + +void TestCpThemeControl::testThemeApplied() +{ + CpThemeControl control; + QList themeList = mThemeChanger->themes(); + QSignalSpy spy(&control, SIGNAL(themeUpdated(const QString&, const QString&))); + int expectedSignalCount = 0; + + for (int i = 0; i < themeList.size(); ++i) { + CpThemeChanger::ThemeInfo info = themeList.at(i); + QString name = info.themeName; + + if (control.currentThemeName() == mThemeChanger->currentTheme()) { + ++expectedSignalCount; + } + + control.themeApplied(name); + QCOMPARE(control.currentThemeName(), mThemeChanger->currentTheme()); + + QCOMPARE(spy.count(),expectedSignalCount); + } +} + +// NULL test - basically verifies that it doesn't burst into flames. +void TestCpThemeControl::testUpdateThemeList() +{ + CpThemeControl control; + + control.updateThemeList(); +} + + + +QTEST_MAIN(TestCpThemeControl) +#include "unittest_cpthemecontrol.moc" diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,54 @@ +# +# 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: XENT-MV +# +# Description: unit tests for the cpthemecontrol class in the themeplugin. +# +# + +include(../common.pri) + + +TEMPLATE = app +TARGET = unittest_cpthemecontrol +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2A + + +# Input + +HEADERS += ../../../src/cpthemecontrol.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemechanger_p.h +HEADERS += ../../../src/cpthemeclient_p.h +symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h +win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h +HEADERS += ../../../src/cpthemelistview.h +HEADERS += ../../../src/cpthemepreview.h +SOURCES += unittest_cpthemecontrol.cpp +SOURCES += ../../../src/cpthemecontrol.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemechanger_p.cpp +SOURCES += ../../../src/cpthemeclient_p.cpp +symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp +win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp +SOURCES += ../../../src/cpthemelistview.cpp +SOURCES += ../../../src/cpthemepreview.cpp diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,91 @@ +/* +* 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: XENT-MV +* +* Description: unit tests for the CpThemeControl class from themeplugin +* +*/ + +#include +#include +#include + +#include "cpthemelistview.h" + +class TestCpThemeListView : public QObject +{ + Q_OBJECT + +private slots: + void testConstructor(); + void testSetWidget(); + void testThemeList(); + void testSetModel(); + void testCloseView(); +}; + +void TestCpThemeListView::testConstructor() +{ + CpThemeListView* obj = new CpThemeListView(); + QVERIFY( obj != 0 ); + delete obj; +} + +void TestCpThemeListView::testSetWidget() +{ + CpThemeListView *listView = new CpThemeListView(); + QGraphicsWidget *testWidget = new QGraphicsWidget(); + + listView->setWidget(testWidget); + + QVERIFY( listView->widget() == testWidget); + + delete testWidget; + delete listView; +} + +void TestCpThemeListView::testThemeList() +{ + CpThemeListView *listView = new CpThemeListView(); + + QVERIFY( listView->themeList() != 0 ); + + delete listView; +} + +// no getter so this is basically a NULL test. +void TestCpThemeListView::testSetModel() +{ + CpThemeListView *listView = new CpThemeListView(); + QStandardItemModel *model = new QStandardItemModel(this); + + listView->setModel(model); + + // model shouldn't be deleted because it is a QObject with a parent. + + delete listView; +} + +// null test +void TestCpThemeListView::testCloseView() +{ + CpThemeListView *listView = new CpThemeListView(); + + listView->closeView(); + + delete listView; +} + + + +QTEST_MAIN(TestCpThemeListView) +#include "unittest_cpthemelistview.moc" \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,39 @@ +# +# 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: XENT-MV +# +# Description: unit tests for the cpthemelistview class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemelistview +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2C + + +# Input + +HEADERS += ../../../src/cpthemelistview.h +SOURCES += unittest_cpthemelistview.cpp +SOURCES += ../../../src/cpthemelistview.cpp diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,52 @@ +/* +* 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: XENT-MV +* +* Description: unit tests for the CpThemeControl class from themeplugin +* +*/ + +#include + +#include "cpthemeplugin.h" +#include +#include + +class TestCpThemePlugin : public QObject +{ + Q_OBJECT + +private slots: + void testConstructor(); + void testCreateSettingFormItemData(); +}; + +void TestCpThemePlugin::testConstructor() +{ + CpThemePlugin *obj = new CpThemePlugin(); + + delete obj; +} + +void TestCpThemePlugin::testCreateSettingFormItemData() +{ + CpThemePlugin *obj = new CpThemePlugin(); + CpItemDataHelper helper; + + QVERIFY(obj->createSettingFormItemData(helper) != 0); + + delete obj; +} + + +QTEST_MAIN(TestCpThemePlugin) +#include "unittest_cpthemeplugin.moc" \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,57 @@ +# +# 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: XENT-MV +# +# Description: unit tests for the cpthemeplugin class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemeplugin +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2D + + +# Input + +HEADERS += ../../../src/cpthemecontrol.h +HEADERS += ../../../src/cpthemeclient_p.h +win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h +symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h +HEADERS += ../../../src/cpthemepreview.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemechanger_p.h +HEADERS += ../../../src/cpthemelistview.h +HEADERS += ../../../src/cpthemeplugin.h +HEADERS += ../../../src/cpthemepluginentryitemdata.h +SOURCES += unittest_cpthemeplugin.cpp +SOURCES += ../../../src/cpthemecontrol.cpp +SOURCES += ../../../src/cpthemeclient_p.cpp +win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp +symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp +SOURCES += ../../../src/cpthemepreview.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemechanger_p.cpp +SOURCES += ../../../src/cpthemelistview.cpp +SOURCES += ../../../src/cpthemeplugin.cpp +SOURCES += ../../../src/cpthemepluginentryitemdata.cpp diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,47 @@ +/* +* 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: XENT-MV +* +* Description: unit tests for the CpThemePluginEntryItemData class from themeplugin +* +*/ + +#include +#include + +#include + +#include "cpthemepluginentryitemdata.h" + +class TestCpThemePluginEntryItemData : public QObject +{ + Q_OBJECT + +private slots: + void testConstructor(); +}; + +void TestCpThemePluginEntryItemData::testConstructor() +{ + CpItemDataHelper helper; + + CpThemePluginEntryItemData *obj = new CpThemePluginEntryItemData(helper); + + QVERIFY(obj != NULL); + + delete obj; +} + + +QTEST_MAIN(TestCpThemePluginEntryItemData) +#include "unittest_cpthemepluginentryitemdata.moc" + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,56 @@ +# +# 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: XENT-MV +# +# Description: unit tests for the cpthemepluginentryitemdata class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemepluginentryitemdata +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2E + + +# Input + +HEADERS += ../../../src/cpthemecontrol.h +HEADERS += ../../../src/cpthemelistview.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemepreview.h +HEADERS += ../../../src/cpthemechanger_p.h +HEADERS += ../../../src/cpthemeclient_p.h +win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h +symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h +HEADERS += ../../../src/cpthemepluginentryitemdata.h +SOURCES += unittest_cpthemepluginentryitemdata.cpp +SOURCES += ../../../src/cpthemepluginentryitemdata.cpp +SOURCES += ../../../src/cpthemelistview.cpp +SOURCES += ../../../src/cpthemecontrol.cpp +SOURCES += ../../../src/cpthemepreview.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemechanger_p.cpp +SOURCES += ../../../src/cpthemeclient_p.cpp +win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp +symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,134 @@ +/* +* 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: XENT-MV +* +* Description: unit tests for the CpThemePreview class from themeplugin +* +*/ + +#include + +#include "cpthemepreview.h" +#include "cpthemechanger.h" + +class TestCpThemePreview : public QObject +{ + Q_OBJECT + +private slots: + void init(); + + void testConstructor(); + void testConstructor2(); + void testSetThemeName(); + void testSetPreviewIcon(); + void testThemeSelected(); + + void cleanup(); + +private: + CpThemeChanger *mThemeChanger; +}; + +void TestCpThemePreview::init() +{ + mThemeChanger = new CpThemeChanger(); +} + +void TestCpThemePreview::cleanup() +{ + delete mThemeChanger; +} + +void TestCpThemePreview::testConstructor() +{ + CpThemePreview *obj = new CpThemePreview(); + + QVERIFY( obj != 0 ); + + delete obj; +} + +void TestCpThemePreview::testConstructor2() +{ + QList themeInfo = mThemeChanger->themes(); + + for (int i = 0; i < themeInfo.size(); ++i) { + QString name = themeInfo.at(i).themeName; + QString icon = themeInfo.at(i).iconPath; + + CpThemePreview *obj = new CpThemePreview(name, icon); + QVERIFY (obj != 0 ); + QCOMPARE(obj->themeName(), name); + + delete obj; + } + + // try with gibberish for the name and/or icon + QString name = QString("alzihgiaureh"); + QString icon = QString("ahilwvihln"); + CpThemePreview *obj = new CpThemePreview(name); + QVERIFY(obj != 0); + delete obj; + + obj = new CpThemePreview(name,icon); + QVERIFY(obj != 0); + delete obj; +} + +void TestCpThemePreview::testSetThemeName() +{ + CpThemePreview *obj = new CpThemePreview(); + QList themeInfo = mThemeChanger->themes(); + + for (int i = 0; i < themeInfo.size(); ++i) { + QString name = themeInfo.at(i).themeName; + + obj->setThemeName(name); + QCOMPARE(obj->themeName(), name); + } + + delete obj; +} + +// NULL TEST +void TestCpThemePreview::testSetPreviewIcon() +{ + CpThemePreview *obj = new CpThemePreview(); + QList themeInfo = mThemeChanger->themes(); + + for (int i = 0; i < themeInfo.size(); ++i) { + QString name = themeInfo.at(i).themeName; + + obj->setThemeName(name); + QCOMPARE(obj->themeName(), name); + } + + delete obj; +} + +void TestCpThemePreview::testThemeSelected() +{ + CpThemePreview *obj = new CpThemePreview(); + QSignalSpy spy(obj,SIGNAL(applyTheme(const QString&))); + + obj->themeSelected(); + + QCOMPARE(spy.count(), 1); + + delete obj; +} + + +QTEST_MAIN(TestCpThemePreview) +#include "unittest_cpthemepreview.moc" + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,49 @@ +# +# 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: XENT-MV +# +# Description: unit tests for the cpthemepreview class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemepreview +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DDEF + + +# Input + +HEADERS += ../../../src/cpthemepreview.h +HEADERS += ../../../src/cpthemeclient_p.h +win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h +symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemechanger_p.h +SOURCES += unittest_cpthemepreview.cpp +SOURCES += ../../../src/cpthemepreview.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemeclient_p.cpp +win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp +symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp +SOURCES += ../../../src/cpthemechanger_p.cpp diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/cpcfg_win.pl --- a/controlpanelui/cpcfg_win.pl Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/cpcfg_win.pl Fri Apr 16 14:59:22 2010 +0300 @@ -1,3 +1,18 @@ +# +# 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: +# # description: copy all cpcfg files to destination directory when building control panel in window envionment # usage: go to control panel source directory, diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/rom/controlpanelui.iby --- a/controlpanelui/rom/controlpanelui.iby Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/rom/controlpanelui.iby Fri Apr 16 14:59:22 2010 +0300 @@ -41,7 +41,6 @@ file=ABI_DIR\BUILD_DIR\cpplaceholdernoiconplugin.dll SHARED_LIB_DIR\cpplaceholdernoiconplugin.dll file=ABI_DIR\BUILD_DIR\cpdisplayplugin.dll SHARED_LIB_DIR\cpdisplayplugin.dll file=ABI_DIR\BUILD_DIR\cplookfeelplugin.dll SHARED_LIB_DIR\cplookfeelplugin.dll -file=ABI_DIR\BUILD_DIR\cpthemeplugin.dll SHARED_LIB_DIR\cpthemeplugin.dll file=ABI_DIR\BUILD_DIR\cpkeytouchfdbkplugin.dll SHARED_LIB_DIR\cpkeytouchfdbkplugin.dll file=ABI_DIR\BUILD_DIR\cpaccountsplugin.dll SHARED_LIB_DIR\cpaccountsplugin.dll file=ABI_DIR\BUILD_DIR\cppincodeplugin.dll SHARED_LIB_DIR\cppincodeplugin.dll @@ -64,7 +63,6 @@ data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpplaceholdernoiconplugin.qtplugin resource\qt\plugins\controlpanel\cpplaceholdernoiconplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin -data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpthemeplugin.qtplugin resource\qt\plugins\controlpanel\cpthemeplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpdisplayplugin.qtplugin resource\qt\plugins\controlpanel\cpdisplayplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpaccountsplugin.qtplugin resource\qt\plugins\controlpanel\cpaccountsplugin.qtplugin diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/rom/controlpanelui_resources.iby --- a/controlpanelui/rom/controlpanelui_resources.iby Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/rom/controlpanelui_resources.iby Fri Apr 16 14:59:22 2010 +0300 @@ -22,5 +22,7 @@ #include data=DATAZ_\QT_TRANSLATIONS_DIR\control_panel.qm QT_TRANSLATIONS_DIR\control_panel.qm +data=DATAZ_\APP_RESOURCE_DIR\ControlPanel.RSC APP_RESOURCE_DIR\ControlPanel.rsc + #endif // CONTROLPANELUI_RESOURCES \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/common.pri --- a/controlpanelui/src/common.pri Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/common.pri Fri Apr 16 14:59:22 2010 +0300 @@ -50,6 +50,7 @@ symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE INCLUDEPATH += $$MOC_DIR TARGET.CAPABILITY = ALL -TCB TARGET.EPOCALLOWDLLDATA = 1 diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpapplication/data/controlpanellog.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/data/controlpanellog.conf Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,17 @@ + +# copy the file(controlpanellog.conf) to C:/data/.config to enable logging + +[CpFramework] +logdatetime = 1 +logloggername = 1 +datetimeformat = hh:mm:ss:zzz +output = debugoutput fileoutput +fileoutput/logfile = C:/data/logs/cpframework.log +fileoutput/truncate = 1 + +#[CpPerformance] +logdatetime = 1 +datetimeformat = hh:mm:ss:zzz +output = fileoutput +fileoutput/logfile = C:/data/logs/cpperformance.log +fileoutput/truncate = 1 \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpapplication/data/mainview.cpcfg --- a/controlpanelui/src/cpapplication/data/mainview.cpcfg Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpapplication/data/mainview.cpcfg Fri Apr 16 14:59:22 2010 +0300 @@ -13,14 +13,7 @@ - - - - - - - - + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpapplication/src/cpmainview.cpp --- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include CpMainView::CpMainView(QGraphicsItem *parent /*= 0*/) : CpBaseSettingView(0,parent), mMainModel(0), mItemDataHelper(0) @@ -39,4 +40,12 @@ delete mItemDataHelper; } +bool CpMainView::event(QEvent *e) +{ + if (e->type() == QEvent::Show || e->type() == QEvent::ShowToParent) { + CPPERF_LOG("CpMainView shown."); + } + return CpBaseSettingView::event(e); +} + // End of File diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpapplication/src/cpmainview.h --- a/controlpanelui/src/cpapplication/src/cpmainview.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpapplication/src/cpmainview.h Fri Apr 16 14:59:22 2010 +0300 @@ -30,6 +30,7 @@ public: explicit CpMainView(QGraphicsItem *parent = 0); virtual ~CpMainView(); + bool event(QEvent *e); private: Q_DISABLE_COPY(CpMainView) private: diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpapplication/src/main.cpp --- a/controlpanelui/src/cpapplication/src/main.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpapplication/src/main.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -32,11 +32,14 @@ Logger::instance(CPFW_LOGGER_NAME)->configure( CP_LOGGER_CONFIG_PATH,QSettings::IniFormat); + Logger::instance(CPPERF_LOGGER_NAME)->configure( + CP_LOGGER_CONFIG_PATH,QSettings::IniFormat); CPFW_LOG("Entering ControlPanel.exe..."); + CPPERF_LOG("Entering ControlPanel.exe..."); QTranslator translator; - if (translator.load("controlpanel_" + QLocale::system().name())) + if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations")) { qApp->installTranslator(&translator); } diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -47,7 +47,7 @@ << "3. if the plugin stub file is in place.\n" << "4. if the dll is valid Qt plugin."; - HbMessageBox::launchWarningMessageBox(message); + HbMessageBox::warning(message); } CpBaseSettingView *CpPlaceHolderItemData::createSettingView() const diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpcategorymodel/src/cputility.cpp --- a/controlpanelui/src/cpcategorymodel/src/cputility.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpcategorymodel/src/cputility.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -160,17 +160,6 @@ return dirs; } -QStringList CpUtility::applicationPluginDirectories() -{ - static QStringList dirs; - if (dirs.empty()) { - CPFW_LOG("ControlPanel application plugin derectories:"); -// dirs = directoriesFromAllDrives(CP_APPLICATION_PLUGIN_PATH); - } - return dirs; -} - - QStringList CpUtility::configFileDirectories() { static QStringList dirs; diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpcategorymodel/src/cputility.h --- a/controlpanelui/src/cpcategorymodel/src/cputility.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpcategorymodel/src/cputility.h Fri Apr 16 14:59:22 2010 +0300 @@ -44,10 +44,6 @@ */ static QStringList pluginDirectories(); - /* - get all application plugin directories of the device - */ - static QStringList applicationPluginDirectories(); /* get all config directories of the device diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/applicationsettingsplugin/data/cpapplicationsettingsplugin.cpcfg --- a/controlpanelui/src/cpplugins/applicationsettingsplugin/data/cpapplicationsettingsplugin.cpcfg Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/applicationsettingsplugin/data/cpapplicationsettingsplugin.cpcfg Fri Apr 16 14:59:22 2010 +0300 @@ -6,7 +6,7 @@ - + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -39,7 +39,7 @@ void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/) { HbDataFormModelItem *airPlaneMode = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem, - QString("Airplane Mode")); + tr("Offline mode")); QStringList airModeList; airModeList << QObject::tr("On") << QObject::tr("Off"); diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/cpplugins.pro --- a/controlpanelui/src/cpplugins/cpplugins.pro Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/cpplugins.pro Fri Apr 16 14:59:22 2010 +0300 @@ -16,17 +16,17 @@ TEMPLATE = subdirs SUBDIRS = communicationplugin \ - placeholderplugin \ deviceplugin \ privacyplugin \ personalizationplugin \ - applicationsettingsplugin \ - lookfeelplugin \ - placeholdernoiconplugin \ - displayplugin \ - keytouchfdbkplugin \ + lookfeelplugin \ + keytouchfdbkplugin \ pincodeplugin \ - devicelockplugin \ - accountsplugin + devicelockplugin + #displayplugin \ + #applicationsettingsplugin \ + #accountsplugin + #placeholdernoiconplugin \ + #placeholderplugin \ CONFIG += ordered \ No newline at end of file diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- a/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Fri Apr 16 14:59:22 2010 +0300 @@ -9,13 +9,16 @@ + + + - + - + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/displayplugin/src/cpdisplaymodel.cpp --- a/controlpanelui/src/cpplugins/displayplugin/src/cpdisplaymodel.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/displayplugin/src/cpdisplaymodel.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -15,13 +15,15 @@ * */ -#include + #include "cpdisplaymodel.h" #ifdef Q_OS_SYMBIAN #include "cpdisplaymodel_p.h" #endif +#include + CpDisplayModel::CpDisplayModel() { #ifdef Q_OS_SYMBIAN diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -16,7 +16,7 @@ */ #include "cpktfdbkview.h" #include -#include +#include #include #include #include diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri --- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri Fri Apr 16 14:59:22 2010 +0300 @@ -21,7 +21,8 @@ src/cppersonalizationcustomviewitem.h \ src/cpmastervolumevaluecontroller.h \ src/cpprofilesgroupitemdata.h \ - src/cpprofilesettingform.h + src/cpprofilesettingform.h \ + src/cppersonalizationentryitemdata.h SOURCES += src/cppersonalizationplugin.cpp \ src/cppersonalizationgroupitemdata.cpp \ @@ -29,4 +30,5 @@ src/cppersonalizationcustomviewitem.cpp \ src/cpmastervolumevaluecontroller.cpp \ src/cpprofilesgroupitemdata.cpp \ - src/cpprofilesettingform.cpp \ No newline at end of file + src/cpprofilesettingform.cpp \ + src/cppersonalizationentryitemdata.cpp diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro --- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Fri Apr 16 14:59:22 2010 +0300 @@ -21,6 +21,7 @@ RESOURCES += personalizationplugin.qrc LIBS += -lcpprofilewrapper +LIBS += -lxqservice -lxqserviceutil include ( ../cpplugincommon.pri ) include ( personalizationplugin.pri ) diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -29,7 +29,7 @@ setElements( elements ); setOrientation(Qt::Horizontal); - setMaximum(11); + setMaximum(10); setMinimum(0); setIcon(HbSlider::DecreaseElement, HbIcon(":/icon/hb_vol_slider_decrement.svg")); @@ -41,8 +41,8 @@ // set tick and beep label #if 1 - setMajorTickInterval(1); - setTickPosition(Hb::SliderTicksBothSides); +// setMajorTickInterval(1); +// setTickPosition(Hb::SliderTicksBothSides); // QStringList labelList; // labelList<< tr("") // << tr("Beep"); @@ -61,7 +61,7 @@ { } -bool CpMasterVolumeSlider::isBeepMode() +/*bool CpMasterVolumeSlider::isBeepMode() { if (value() == minimum()+1) { return true; @@ -79,9 +79,9 @@ else { setValue(mPreviousValue); } -} +}*/ -bool CpMasterVolumeSlider::isSilentMode() +/*bool CpMasterVolumeSlider::isSilentMode() { if (value() == minimum()) { return true; @@ -110,7 +110,7 @@ { setValue(normalValue+1); } - +*/ void CpMasterVolumeSlider::onValueChanged(int value) { if (this->minimum( ) == value) { @@ -127,23 +127,23 @@ this->setIconCheckable(true); - if (value == 1) { + /*if (value == 1) { emit beepActivated(); - } - else { - int valueMap = value - 1; - emit normalValueChanged(valueMap); - } + }*/ + //else { + int valueMap = value; + emit normalValueChanged(valueMap); + //} } } -void CpMasterVolumeSlider::onIncreaseIconClicked() +/*void CpMasterVolumeSlider::onIncreaseIconClicked() { } void CpMasterVolumeSlider::onDecreaseIconClicked() { -} +}*/ void CpMasterVolumeSlider::onMuteIconToggled(bool isToggled) { diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.h Fri Apr 16 14:59:22 2010 +0300 @@ -22,30 +22,30 @@ class CpMasterVolumeSlider: public HbSlider { Q_OBJECT - Q_PROPERTY(bool beepMode READ isBeepMode WRITE setBeepMode) - Q_PROPERTY(bool silentMode READ isSilentMode WRITE setSilentMode) - Q_PROPERTY(int normalValue READ normalValue WRITE setNormalValue) + //Q_PROPERTY(bool beepMode READ isBeepMode WRITE setBeepMode) + //Q_PROPERTY(bool silentMode READ isSilentMode WRITE setSilentMode) + //Q_PROPERTY(int normalValue READ normalValue WRITE setNormalValue) public: explicit CpMasterVolumeSlider(QGraphicsItem *parent = 0); ~CpMasterVolumeSlider(); public: - bool isBeepMode(); - void setBeepMode(bool isBeepMode); - bool isSilentMode(); - void setSilentMode(bool isSilentMode); - int normalValue(); - void setNormalValue(int normalValue); + //bool isBeepMode(); + //void setBeepMode(bool isBeepMode); + //bool isSilentMode(); + //void setSilentMode(bool isSilentMode); + //int normalValue(); + //void setNormalValue(int normalValue); signals: - void beepActivated(); + //void beepActivated(); void silentActivated(); void normalValueChanged(int value); private slots: void onValueChanged(int value); - void onIncreaseIconClicked(); - void onDecreaseIconClicked(); + //void onIncreaseIconClicked(); + //void onDecreaseIconClicked(); void onMuteIconToggled(bool isToggled); private: int mPreviousValue; diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -26,11 +26,13 @@ CpMasterVolumeValueController::CpMasterVolumeValueController(CpProfileModel *profileModel, HbDataFormModelItem *masterVolumeItem, - CpItemDataHelper &itemDataHelper) - : mProfileModle(profileModel), - mMasterVolumeItem(masterVolumeItem) + CpItemDataHelper &itemDataHelper, + HbDataFormModelItem *profileItem) + : mProfileModel(profileModel), + mMasterVolumeItem(masterVolumeItem), + mProfileItem(profileItem) { - itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(beepActivated()),this,SLOT(onBeepActivated())); + //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(beepActivated()),this,SLOT(onBeepActivated())); itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(silentActivated()),this,SLOT(onSilentActivated())); itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(normalValueChanged(int)),this,SLOT(onNormalValueChanged(int))); updateMasterVolumeValue(); @@ -41,38 +43,49 @@ } -void CpMasterVolumeValueController::onBeepActivated() +/*void CpMasterVolumeValueController::onBeepActivated() { #ifdef Q_OS_SYMBIAN - mProfileModle->activateBeep(); + mProfileModel->activateBeep(); #endif -} +}*/ void CpMasterVolumeValueController::onSilentActivated() { #ifdef Q_OS_SYMBIAN - mProfileModle->activateSilent(); + //mProfileModel->activateSilent(); + int err = mProfileModel->activateProfile(EProfileWrapperSilentId); + if (err == KErrNone) { + //update the radio buttonlist of profile + mProfileItem->setContentWidgetData("selected",2); + //mMasterVolumeItem->setContentWidgetData("value",0); + //mMasterVolumeItem->setContentWidgetData("enabled",false); + updateMasterVolumeValue(); + } #endif } void CpMasterVolumeValueController::onNormalValueChanged(int value) { #ifdef Q_OS_SYMBIAN - mProfileModle->setRingVolume(value); + mProfileModel->setRingVolume(value); #endif } void CpMasterVolumeValueController::updateMasterVolumeValue() { #ifdef Q_OS_SYMBIAN - if (mProfileModle->isBeep()) { + /*if (mProfileModel->isBeep()) { mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(1)); } - else if (mProfileModle->isSilent()) { + else*/ + if (mProfileModel->isSilent()) { mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(0)); + + mMasterVolumeItem->setEnabled(false); } else { - mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(mProfileModle->ringVolume()+1)); + mMasterVolumeItem->setContentWidgetData(QString("value"),QVariant(mProfileModel->ringVolume())); } #endif } diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumevaluecontroller.h Fri Apr 16 14:59:22 2010 +0300 @@ -29,17 +29,19 @@ public: CpMasterVolumeValueController(CpProfileModel *profileModel, HbDataFormModelItem *masterVolumeItem, - CpItemDataHelper &itemDataHelper); + CpItemDataHelper &itemDataHelper, + HbDataFormModelItem *profileItem); virtual ~CpMasterVolumeValueController(); private slots: - void onBeepActivated(); + //void onBeepActivated(); void onSilentActivated(); void onNormalValueChanged(int value); private: void updateMasterVolumeValue(); private: - CpProfileModel *mProfileModle; + CpProfileModel *mProfileModel; HbDataFormModelItem *mMasterVolumeItem; + HbDataFormModelItem *mProfileItem; }; #endif diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,85 @@ +/* + * 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 "cppersonalizationentryitemdata.h" +#include +#include + +CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text, + const QString &description, + const HbIcon &icon, + const HbDataFormModelItem *parent) + :CpSettingFormEntryItemData(itemDataHelper,text,description, + icon,parent),mReq(0) +{ +} +CpPersonalizationEntryItemData::~CpPersonalizationEntryItemData() +{ +} +void CpPersonalizationEntryItemData::onLaunchView() +{ + //launch media fetcher + if (!mReq) + { + mReq = mAppMgr.create("com.nokia.services.media.Music", "fetch(QString)", true); + + if (!mReq) + { + return; + } + else + { + connect(mReq, SIGNAL(requestOk(const QVariant&)), SLOT(handleOk(const QVariant&))); + connect(mReq, SIGNAL(requestError(int,const QString&)), SLOT(handleError(int,const QString&))); + } + } + + // Set arguments for request (music fetcher application title) + QList args; + args << QVariant( text() ); + mReq->setArguments(args); + + // Make the request + if (!mReq->send()) + { + //report error + return; + } +} +void CpPersonalizationEntryItemData::handleOk(const QVariant &result) +{ + if (!result.canConvert()) + { + setDescription( "Corrupt result" ); + } + else + { + setDescription( result.value() ); + } +} +void CpPersonalizationEntryItemData::handleError(int errorCode, const QString& errorMessage) +{ + // + Q_UNUSED(errorCode); + Q_UNUSED(errorMessage); + setDescription("Error"); +} + +CpBaseSettingView *CpPersonalizationEntryItemData::createSettingView() const +{ + return 0; +} diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.h Fri Apr 16 14:59:22 2010 +0300 @@ -0,0 +1,49 @@ +/* + * 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: + * + */ +#ifndef CPPERSONALIZATIONENTRYITEMDATA_H +#define CPPERSONALIZATIONENTRYITEMDATA_H + +#include +#include + + +class XQApplicationManager; +class XQAiwRequest; + + +class CpPersonalizationEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT +public: + explicit CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const HbIcon &icon = HbIcon(), + const HbDataFormModelItem *parent = 0); + virtual ~CpPersonalizationEntryItemData(); +private slots: + void onLaunchView(); + void handleOk(const QVariant &result); + void handleError(int errorCode, const QString& errorMessage); +private: + virtual CpBaseSettingView *createSettingView() const; +private: + XQApplicationManager mAppMgr; + XQAiwRequest* mReq; +}; + +#endif // CPPERSONALIZATIONENTRYITEMDATA_H diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -37,6 +37,7 @@ mEmailTone(0), mReminderTone(0), mClockTone(0), + mSayCallerName(0), mProfileModel(0), mMasterVolumeValueController(0) { @@ -51,7 +52,7 @@ void CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper) { - + /* itemDataHelper.addItemPrototype(new CpPersonalizationCustomViewItem); mMasterVolume = new HbDataFormModelItem(static_cast(MasterVolumeSliderItem)); @@ -76,12 +77,19 @@ this->appendChild(mMasterVibra); + */ mRingTone = new CpSettingFormEntryItemDataImpl(itemDataHelper, tr("Ring tone"), tr("Nokia tone")); this->appendChild(mRingTone); + + /*mSayCallerName = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem, QString()); + mSayCallerName->setContentWidgetData("text", tr("Say caller's name")); + this->appendChild(mSayCallerName);*/ + + mMessageTone = new CpSettingFormEntryItemDataImpl(itemDataHelper, tr("Message tone"), tr("Nokia message tone")); @@ -105,7 +113,7 @@ void CpPersonalizationGroupItemData::masterVolumeValueChanged(int value) { Q_UNUSED(value); - HbMessageBox::launchInformationMessageBox(QString("volume changed to:%1").arg(value)); + HbMessageBox::information(QString("volume changed to:%1").arg(value)); } void CpPersonalizationGroupItemData::onVibraValueChange(int isVibra) { diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.h Fri Apr 16 14:59:22 2010 +0300 @@ -48,6 +48,7 @@ CpSettingFormEntryItemData *mEmailTone; CpSettingFormEntryItemData *mReminderTone; CpSettingFormEntryItemData *mClockTone; + HbDataFormModelItem *mSayCallerName; CpProfileModel *mProfileModel; CpMasterVolumeValueController *mMasterVolumeValueController; }; diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -31,18 +31,16 @@ QList CpPersonalizationPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const { - Q_UNUSED(itemDataHelper); - /* CpProfilesGroupItemData *profileItemData = new CpProfilesGroupItemData(itemDataHelper); - */ + CpPersonalizationGroupItemData *personalItemData = new CpPersonalizationGroupItemData( HbDataFormModelItem::GroupItem, - tr("Default tones"), + tr("Tones"), QString("cppersonalizationplugin.cpcfg") ); - return QList() /*<< profileItemData*/ << personalItemData; + return QList() << profileItemData << personalItemData; } Q_EXPORT_PLUGIN2(cppersonalizationplugin, CpPersonalizationPlugin); diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -43,14 +43,18 @@ mModel = new HbDataFormModel(); QStringList profileList; - profileList << "Normal" << "Meeting" << "Silent"; //should be got from engine. + profileList << "General" << "Meeting" << "Silent"; //should be got from engine. foreach (const QString &profile,profileList) { HbDataFormModelItem *profilePage = mModel->appendDataFormPage(profile); + //hard code: profile name should be got from profile engine + if (profile != "Silent") { initVolumeGroup(profilePage); - initRingToneGroup(profilePage); - initMessageToneGroup(profilePage); - initAlertToneGroup(profilePage); - initKeyAndScreenToneGroup(profilePage); + } + initVibraGroup(profilePage); + //initRingToneGroup(profilePage); + //initMessageToneGroup(profilePage); + //initAlertToneGroup(profilePage); + //initKeyAndScreenToneGroup(profilePage); } setModel(mModel); } @@ -59,15 +63,36 @@ { HbDataFormModelItem *volumeGroup = mModel->appendDataFormGroup( tr("Volume"),parent); - mModel->appendDataFormItem(static_cast(MasterVolumeSliderItem),QString(),volumeGroup); - mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,tr("Ring alert vibra"),volumeGroup); - mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,tr("New message alert vibra"),volumeGroup); - mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,tr("New e-mail alert vibra"),volumeGroup); - mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,tr("Reminder alarm vibra"),volumeGroup); - mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,tr("Clock alarm vibra"),volumeGroup); + // mModel->appendDataFormItem(static_cast(MasterVolumeSliderItem),QString("Master volume"),volumeGroup); + HbDataFormModelItem *informationTone = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),volumeGroup); + informationTone->setContentWidgetData("text", tr("information tones")); + mModel->appendDataFormItem(static_cast(MasterVolumeSliderItem),QString("Key and touch screen tones"),volumeGroup); +} +void CpProfileSettingForm::initVibraGroup(HbDataFormModelItem *parent) +{ + HbDataFormModelItem *vibraGroup = mModel->appendDataFormGroup( + tr("Vibra"),parent); + HbDataFormModelItem *ringVibar = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),vibraGroup); + ringVibar->setContentWidgetData("text", tr("Ring alert vibra")); + + HbDataFormModelItem *messageVibra = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),vibraGroup); + messageVibra->setContentWidgetData("text", tr("New message alert vibra")); + + HbDataFormModelItem *emailVibra = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),vibraGroup); + emailVibra->setContentWidgetData("text", tr("New e-mail alert vibra")); + + HbDataFormModelItem *reminderVibra = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),vibraGroup); + reminderVibra->setContentWidgetData("text", tr("Reminder alarm vibra")); + + HbDataFormModelItem *clockVibra = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),vibraGroup); + clockVibra->setContentWidgetData("text", tr("Clock alarm vibra")); + + HbDataFormModelItem *informationVibra = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),vibraGroup); + informationVibra->setContentWidgetData("text", tr("Information vibra")); + } -void CpProfileSettingForm::initRingToneGroup(HbDataFormModelItem *parent) +/*void CpProfileSettingForm::initRingToneGroup(HbDataFormModelItem *parent) { HbDataFormModelItem *ringToneGroup = mModel->appendDataFormGroup( tr("Ring tone"),parent); @@ -146,3 +171,4 @@ mModel->appendDataFormItem(HbDataFormModelItem::SliderItem, tr("Touch screen vibra"),keyAndScreenToneGroup); } +*/ diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Fri Apr 16 14:59:22 2010 +0300 @@ -32,10 +32,11 @@ private: void initModel(); void initVolumeGroup(HbDataFormModelItem *parent); - void initRingToneGroup(HbDataFormModelItem *parent); - void initMessageToneGroup(HbDataFormModelItem *parent); - void initAlertToneGroup(HbDataFormModelItem *parent); - void initKeyAndScreenToneGroup(HbDataFormModelItem *parent); + void initVibraGroup(HbDataFormModelItem *parent); + // void initRingToneGroup(HbDataFormModelItem *parent); + // void initMessageToneGroup(HbDataFormModelItem *parent); + // void initAlertToneGroup(HbDataFormModelItem *parent); + // void initKeyAndScreenToneGroup(HbDataFormModelItem *parent); private: HbDataFormModel *mModel; }; diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesgroupitemdata.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesgroupitemdata.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -18,16 +18,26 @@ #include #include #include +#include +#include #include "cpprofilesettingform.h" +#include "cpmastervolumevaluecontroller.h" +#include "cppersonalizationcustomviewitem.h" + CpProfilesGroupItemData::CpProfilesGroupItemData(CpItemDataHelper &itemDataHelper) -: CpSettingFormItemData(HbDataFormModelItem::GroupItem,tr("Profiles")) +: CpSettingFormItemData(HbDataFormModelItem::GroupItem,tr("Profiles")),mProfileModel(0) { + mProfileModel = new CpProfileModel(); initItems(itemDataHelper); } CpProfilesGroupItemData::~CpProfilesGroupItemData() { + delete mProfileModel; + if (mMasterVolumeValueController != 0) { + delete mMasterVolumeValueController; + } } namespace @@ -39,21 +49,80 @@ { } }; -}; +} void CpProfilesGroupItemData::initItems(CpItemDataHelper &itemDataHelper) { + itemDataHelper.addItemPrototype(new CpPersonalizationCustomViewItem); HbDataFormModelItem *activeProfileItem = new HbDataFormModelItem( HbDataFormModelItem::RadioButtonListItem,tr("Profiles")); - + //enable the profile activating + // why come into slots twice when select a item? + itemDataHelper.addConnection(activeProfileItem,SIGNAL(itemSelected(int)),this,SLOT(activateProfile(int))); + + mCurrentProfileId = static_cast(mProfileModel->activeProfileId()); + // QString warnningNote = "Profile Id = "+ mCurrentProfileId; + //HbMessageBox::information(warnningNote); QStringList items; - items << tr("Normal") << tr("Meeting") << tr("Silent"); + items << tr("General") << tr("Meeting") << tr("Silent"); activeProfileItem->setContentWidgetData("items",items); - activeProfileItem->setContentWidgetData("selected",0); + switch (mCurrentProfileId) { + case EProfileWrapperGeneralId: + activeProfileItem->setContentWidgetData("selected",0); + break; + case EProfileWrapperSilentId: + activeProfileItem->setContentWidgetData("selected",2); + break; + case EProfileWrapperMeetingId: + activeProfileItem->setContentWidgetData("selected",1); + break; + default: + // HbMessageBox::information("unknown id of profile"); + break; + }; + + appendChild(activeProfileItem); + + mMasterVolume = new HbDataFormModelItem(static_cast(MasterVolumeSliderItem)); - appendChild(activeProfileItem); + mMasterVolumeValueController = new CpMasterVolumeValueController(mProfileModel, mMasterVolume, + itemDataHelper, activeProfileItem); + this->appendChild(mMasterVolume); HbDataFormModelItem *editProfileItem = new CpSettingFormEntryItemDataImpl( itemDataHelper,tr("Edit profiles")); appendChild(editProfileItem); } +void CpProfilesGroupItemData::activateProfile(int profileIndex) +{ + switch (profileIndex) { + case 0: // general + { + mProfileModel->activateProfile(EProfileWrapperGeneralId); + int volumeValue = mProfileModel->ringVolume(); + // update the master volume when profile changed + // should be used profileChangedObserver in the future; + mMasterVolume->setEnabled(true); + mMasterVolume->setContentWidgetData("value", volumeValue); + break; + } + case 1: // meeting + { + mProfileModel->activateProfile(EProfileWrapperMeetingId); + int volumeValue = mProfileModel->ringVolume(); + mMasterVolume->setEnabled(true); + mMasterVolume->setContentWidgetData("value", volumeValue); + break; + } + case 2: // silent + { + mProfileModel->activateProfile(EProfileWrapperSilentId); + mMasterVolume->setContentWidgetData("value", 0); + mMasterVolume->setEnabled(false); + break; + } + default: + break; + + } +} diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesgroupitemdata.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesgroupitemdata.h Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesgroupitemdata.h Fri Apr 16 14:59:22 2010 +0300 @@ -19,17 +19,26 @@ #define CPPROFILESGROUPITEMDATA_H #include +#include +class CpProfileModel; class CpItemDataHelper; +class CpMasterVolumeValueController; class CpProfilesGroupItemData : public CpSettingFormItemData { Q_OBJECT public: explicit CpProfilesGroupItemData(CpItemDataHelper &itemDataHelper); virtual ~CpProfilesGroupItemData(); +private slots: + void activateProfile(int profileIndex); private: Q_DISABLE_COPY(CpProfilesGroupItemData) void initItems(CpItemDataHelper &itemDataHelper); + CpProfileModel *mProfileModel; + ProfileWrapperProfileId mCurrentProfileId; + HbDataFormModelItem *mMasterVolume; + CpMasterVolumeValueController *mMasterVolumeValueController; }; #endif diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg --- a/controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg Fri Apr 16 14:59:22 2010 +0300 @@ -1,13 +1,13 @@ - + - + - + diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro --- a/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Fri Apr 16 14:59:22 2010 +0300 @@ -61,6 +61,7 @@ symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$APP_LAYER_SYSTEMINCLUDE \ $$MOC_DIR SOURCES += src/cpprofilemodel_p.cpp diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -16,6 +16,7 @@ */ #include "cpprofilemodel_p.h" +#include #include #include #include @@ -78,7 +79,7 @@ CpProfileModelPrivate::~CpProfileModelPrivate() { delete mVibraCenRep; - mVibraCenRep = NULL; + mVibraCenRep = 0; } /* @@ -238,10 +239,29 @@ { return; } + mProfileExt = mEngine->ProfileL( EProfileWrapperGeneralId ); + // General tones volume + TProfileToneSettings& toneSettingsGeneral = mProfileExt->ProfileSetTones().SetToneSettings(); + mToneSettings = &toneSettingsGeneral; + mToneSettings->iRingingType = EProfileRingingTypeRinging; mToneSettings->iRingingVolume = volume; commitChange(); + + mProfileExt = mEngine->ProfileL( EProfileWrapperMeetingId ); + + // meeting tones volume + TProfileToneSettings& toneSettingsMeeting = mProfileExt->ProfileSetTones().SetToneSettings(); + mToneSettings = &toneSettingsMeeting; + + mToneSettings->iRingingType = EProfileRingingTypeRinging; + mToneSettings->iRingingVolume = volume; + + commitChange(); + + mProfileExt = mEngine->ProfileL(mEngine->ActiveProfileId()); + // currently implementation: keep the two profiles same volume } /* diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/seccodeui/seccodeui.pro --- a/controlpanelui/src/seccodeui/seccodeui.pro Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/seccodeui/seccodeui.pro Fri Apr 16 14:59:22 2010 +0300 @@ -43,6 +43,7 @@ symbian: { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE INCLUDEPATH += $$MOC_DIR TARGET.CAPABILITY = ALL -TCB TARGET.EPOCALLOWDLLDATA = 1 diff -r 0a74be98a8bc -r 10d0dd0e43f1 controlpanelui/src/seccodeui/src/seccodeuiutility.cpp --- a/controlpanelui/src/seccodeui/src/seccodeuiutility.cpp Fri Mar 19 09:29:29 2010 +0200 +++ b/controlpanelui/src/seccodeui/src/seccodeuiutility.cpp Fri Apr 16 14:59:22 2010 +0300 @@ -35,7 +35,7 @@ if(ok) { *ok = true; } - result = dlg->textValue().toString(); + result = dlg->value().toString(); } delete dlg; return result; @@ -43,17 +43,17 @@ void SecCodeUiUtility::showInformationMessage(const QString &message,QGraphicsItem *parent /*= 0*/ ) { - HbMessageBox::launchInformationMessageBox(message,0,0,parent); + HbMessageBox::information(message,0,0,parent); } void SecCodeUiUtility::showWarningMessage(const QString &message,QGraphicsItem *parent /*= 0*/) { - HbMessageBox::launchWarningMessageBox(message,0,0,parent); + HbMessageBox::warning(message,0,0,parent); } void SecCodeUiUtility::showErrorMessage(const QString &message,QGraphicsItem *parent /*= 0*/) { - HbMessageBox::launchInformationMessageBox(message,0,0,parent); + HbMessageBox::information(message,0,0,parent); } QString SecCodeUiUtility::getPinRemainingAttemptsMessage(int remainingAttempts) diff -r 0a74be98a8bc -r 10d0dd0e43f1 layers.sysdef.xml --- a/layers.sysdef.xml Fri Mar 19 09:29:29 2010 +0200 +++ b/layers.sysdef.xml Fri Apr 16 14:59:22 2010 +0300 @@ -6,6 +6,9 @@ + + + diff -r 0a74be98a8bc -r 10d0dd0e43f1 package_definition.xml --- a/package_definition.xml Fri Mar 19 09:29:29 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -