# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286140692 -10800 # Node ID 3487b2ea501aeb6050714f816a8492fa649dff8d # Parent 5aa7c7ec6b8eaa8509cacffbcc1cb6994a4cda6d Revision: 201037 Kit: 201039 diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/aboutplugin/aboutplugin.pro --- a/controlpanelplugins/aboutplugin/aboutplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/aboutplugin/aboutplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -83,4 +83,6 @@ qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" -} \ No newline at end of file +} +symbian:MMP_RULES += SMPSAFE +# End of file --Don't remove this. diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pro --- a/controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -50,5 +50,5 @@ TARGET.UID3 = 0x2002BCD5 TARGET.CAPABILITY = CAP_APPLICATION AllFiles } - +symbian:MMP_RULES += SMPSAFE include(t_aboutplugin.pri) diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/data/cplanguagepluginlog.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/data/cplanguagepluginlog.conf Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,7 @@ +[CpLanguagePlugin] +logdatetime = 1 +logloggername = 1 +datetimeformat = hh:mm:ss +output = debugoutput fileoutput +fileoutput/logfile = C:/data/logs/cplanguageplugin.log +fileoutput/truncate = 0 diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/languageplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/languageplugin.pri Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,25 @@ +# +# 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: controlpanel project - common qmake settings +# + +HEADERS += src/cplanguageview.h \ + src/cplanguageplugin.h \ + src/cplanguagepluginutil.h \ + src/extendedlocaleutil.h + +SOURCES += src/cplanguageview.cpp \ + src/cplanguageplugin.cpp \ + src/cplanguagepluginutil.cpp \ + src/extendedlocaleutil.cpp diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/languageplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/languageplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,99 @@ +# +# Copyright (c) 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: +# + +TEMPLATE = lib +TARGET = cplanguageplugin + +CONFIG += hb plugin + +include ( languageplugin.pri ) +include (rom/languageplugin_rom.pri) + +LIBS += -lcpframework +LIBS += -lstarterclient + +TRANSLATIONS = control_panel.ts + +CONFIG += debug_and_release + + +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 +LIBS += -lcplogger + +RESOURCES += languageplugin.qrc + +#DEFINES += ENABLE_CPLANG_LOG + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0X2002873C + + INCLUDEPATH += /sf/app/organizer/organizer_plat/clock_settingsview_plugin_api/inc +} + +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:MMP_RULES += SMPSAFE + +# End of file --Don't remove this. + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/languageplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/languageplugin.qrc Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,5 @@ + + + data/cplanguagepluginlog.conf + + \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/layers.sysdef.xml Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/rom/languageplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/rom/languageplugin.iby Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 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 __LANGUAGEPLUGIN_IBY__ +#define __LANGUAGEPLUGIN_IBY__ + +#include +#include + +file=ABI_DIR\BUILD_DIR\cplanguageplugin.dll SHARED_LIB_DIR\cplanguageplugin.dll + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cplanguageplugin.qtplugin resource\qt\plugins\controlpanel\cplanguageplugin.qtplugin + +#endif diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/rom/languageplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/rom/languageplugin_rom.pri Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 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: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/languageplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(languageplugin.iby)" +} \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguageplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguageplugin.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 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 "cplanguageplugin.h" +#include "cplanguageview.h" +#include +#include +#include +#include "cplanguagepluginlog.h" + + +#ifdef ENABLE_CPLANG_LOG + INIT_LOGGER (CPLANG_LOGGER_NAME,CPLANG_LOGGER_CONFIG_PATH) +#endif + +static QPointer g_pluginEntryItemData; + +/*! + * Constructor + */ +CpLanguagePlugin::CpLanguagePlugin() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::CpLanguagePlugin") +} + +/*! + * Destructor + */ +CpLanguagePlugin::~CpLanguagePlugin() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::~CpLanguagePlugin") +} + +/*! + * Overide CpPluginInterface::createSettingFormItemData + */ +QList CpLanguagePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::createSettingFormItemData") + + g_pluginEntryItemData = new CpSettingFormEntryItemDataImpl( + CpSettingFormEntryItemData::ListEntryItem, + itemDataHelper, + hbTrId("txt_cp_dblist_language_and_region"), + QString(), + "qtg_large_language" ); + + updateEntryItem(); + + return QList() << g_pluginEntryItemData; +} + +/*! + * update the description of the entry item. + */ +void CpLanguagePlugin::updateEntryItem() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::updateEntryItem") + + + if (g_pluginEntryItemData) { + QStringList allLanguages = HbLocaleUtil::supportedLanguages(); + QString currentLanguage = HbLocaleUtil::currentLanguage(); + + CPLANG_LOG(QLatin1String("Current language:") + currentLanguage); + + int index = allLanguages.indexOf(currentLanguage); + + CPLANG_LOG(QString("Index of current language: %1").arg(index)); + + QString localisedLanguage; + if (index >= 0) { + localisedLanguage = HbLocaleUtil::localisedLanguageName(currentLanguage); + CPLANG_LOG(QLatin1String("Localised Region:") + localisedLanguage); + } + g_pluginEntryItemData->setDescription(localisedLanguage); + } +} + +Q_EXPORT_PLUGIN2(cplanguageplugin, CpLanguagePlugin); + +//End of File diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguageplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguageplugin.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 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 CPLANGUAGEPLUGIN_H +#define CPLANGUAGEPLUGIN_H + +#include +#include +#include "cplanguageplugin_global.h" + +class CpLanguagePlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpLanguagePlugin(); + virtual ~CpLanguagePlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +public: + static void updateEntryItem(); +}; + +#endif // CPLANGUAGEPLUGIN_H + +//End of File diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguageplugin_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguageplugin_global.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 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 CPLANGUAGEPLUGIN_GLOBAL_H +#define CPLANGUAGEPLUGIN_GLOBAL_H + +#ifndef LANGUAGEPLUGIN_TEST + #define LANGUAGEPLUGIN_TEST_FRIEND_CLASS(aClassName) +#else + #define LANGUAGEPLUGIN_TEST_FRIEND_CLASS(aClassName) friend class aClassName; +#endif //LANGUAGEPLUGIN_TEST + +#endif // CPLANGUAGEPLUGIN_GLOBAL_H diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguagepluginlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguagepluginlog.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 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 CPLANGUAGEPLUGINLOG_H +#define CPLANGUAGEPLUGINLOG_H + +#include +#include + +#ifdef ENABLE_CPLANG_LOG + #define CPLANG_LOGGER_NAME QLatin1String("CpLanguagePlugin") + #define CPLANG_LOGGER_CONFIG_PATH QLatin1String(":/logconf/cplanguagepluginlog.conf") + + #define CPLANG_LOG(str) Logger::instance(CPLANG_LOGGER_NAME)->log(str); + #define CPLANG_LOG_FUNC_ENTRY(func) LogFunctionEntryHelper ___cplang_log_func_entry_helper(CPLANG_LOGGER_NAME,func); +#else + #define CPLANG_LOG(str) + #define CPLANG_LOG_FUNC_ENTRY(func) +#endif + +#endif + +//End of File + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguagepluginutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguagepluginutil.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 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: utility class + * + */ +#include "cplanguagepluginutil.h" +#include +#include +#include "cplanguagepluginlog.h" +#include + +QStringList CpLanguagePluginUtil::localizedLanguageNames(const QStringList &languageNames) +{ + QStringList localizedLanguages; + + CPLANG_LOG("=================All languages======================="); + foreach(const QString &language,languageNames) { + CPLANG_LOG("Language: " + language + "\tLocalised:" + HbLocaleUtil::localisedLanguageName(language)); + localizedLanguages << HbLocaleUtil::localisedLanguageName(language); + } + CPLANG_LOG("======================================================"); + + return localizedLanguages; +} + +QStringList CpLanguagePluginUtil::localizedRegionNames(const QStringList ®ionNames) +{ + QStringList localizedRegions; + + CPLANG_LOG("=================All regions======================="); + foreach(const QString ®ion,regionNames) { + CPLANG_LOG("Region: " + region + "\tLocalised:" + HbLocaleUtil::localisedRegionName(region)); + localizedRegions << HbLocaleUtil::localisedRegionName(region); + } + CPLANG_LOG("==================================================="); + return localizedRegions; +} + +QStringList CpLanguagePluginUtil::localizedInputLanguageNames(const QList &inputLanguages) +{ + QStringList localizedInputLanguages; + + CPLANG_LOG("=================All Input languages======================="); + foreach (HbInputLanguage inputLanguage, inputLanguages) { + CPLANG_LOG("Input language:" + inputLanguage.asString() + "\tLocalised:" + inputLanguage.localisedName()); + if (inputLanguage == HbInputLanguage()) { + localizedInputLanguages << hbTrId("txt_cp_setlabel_secondary_writing_language_val_non"); + } + else { + localizedInputLanguages << inputLanguage.localisedName(); + } + } + CPLANG_LOG("============================================================"); + + return localizedInputLanguages; +} + +bool CpLanguagePluginUtil::isChineseVariant() +{ + QStringList supportedLanguages = HbLocaleUtil::supportedLanguages(); + foreach(const QString &language, supportedLanguages) { + if (QLocale(language).language() == QLocale::Chinese) { + CPLANG_LOG("Chinese Variant."); + return true; + } + } + return false; +} + +//End of File + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguagepluginutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguagepluginutil.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 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: utility class + * + */ +#ifndef CPLANGUAGEPLUGINUTIL_H +#define CPLANGUAGEPLUGINUTIL_H + +#include +#include +#include + +class CpLanguagePluginUtil +{ +public: + static QStringList localizedLanguageNames(const QStringList &languageNames); + static QStringList localizedRegionNames(const QStringList ®ionNames); + static QStringList localizedInputLanguageNames(const QList &inputLanguages); + static bool isChineseVariant(); +private: + CpLanguagePluginUtil(); + Q_DISABLE_COPY(CpLanguagePluginUtil) +}; + +#endif + +//End of File diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguageview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguageview.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,558 @@ +/* + * Copyright (c) 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: Language plugin view class + * + */ + +#include "cplanguageview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cplanguageplugin.h" +#include "cplanguagepluginlog.h" + +static int PRIMARY_INPUT_ITEM_INDEX = 0; +static int SECONDARY_INPUT_ITEM_INDEX = 1; +static int REGION_ITEM_INDEX = 2; + +/* + * Constructor + */ +CpLanguageView::CpLanguageView(QGraphicsItem *parent) : + CpBaseSettingView(0,parent), + mModel(0), + mCurrentLanguagePage(0), + mCurrentRegionItem(0), + mCurrentPrimaryInputLanguageItem(0), + mCurrentSecondaryInputLanguageItem(0), + mClockPluginLoader(0) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::CpLanguageView") + + mChineseVariant = CpLanguagePluginUtil::isChineseVariant(); + if (mChineseVariant) { + PRIMARY_INPUT_ITEM_INDEX = 0; + SECONDARY_INPUT_ITEM_INDEX = -1; // no secondary writing language in Chinese variant + REGION_ITEM_INDEX = 1; + } + + HbDataForm *form = qobject_cast(widget()); + if (form) { + mModel = new HbDataFormModel; + + form->setHeading(hbTrId("txt_cp_subhead_display_language")); + form->setDescription(hbTrId("txt_cp_info_after_changign_deivce_language_device")); + + mLanguageRegionMapping = ExtendedLocaleUtil::localeMappings(true); + + mSupportedLanguages = HbLocaleUtil::supportedLanguages(); + QStringList localizedLanguages = CpLanguagePluginUtil::localizedLanguageNames(mSupportedLanguages); + + mSupportedRegions = HbLocaleUtil::supportedRegions(); + QStringList localizedRegions = CpLanguagePluginUtil::localizedRegionNames(mSupportedRegions); + + CPLANG_LOG ( QString("map count:%1").arg(mLanguageRegionMapping.count()) ); + CPLANG_LOG ( QString("support language count:%1").arg(mSupportedLanguages.count()) ); + CPLANG_LOG ( QString("support region count:%1").arg(mSupportedRegions.count()) ); + + HbInputUtils::listSupportedInputLanguages(mPrimaryInputLanguages); + QStringList localizedInputLanguages = CpLanguagePluginUtil::localizedInputLanguageNames(mPrimaryInputLanguages); + + QString currentLanguage = HbLocaleUtil::currentLanguage(); + + //prvious setting + mPreviousSetting.languageId = currentLanguage; + mPreviousSetting.regionId = HbLocaleUtil::currentRegion(); + mPreviousSetting.primaryWritingLan = HbInputSettingProxy::instance()->globalInputLanguage(); + mPreviousSetting.secondaryWritingLan = HbInputSettingProxy::instance()->globalSecondaryInputLanguage(); + + mCurrentSetting = mPreviousSetting; + + //update with current setting + if (LanguageRegionMapping *setting = languageRegionMapping(currentLanguage)) { + *setting = mCurrentSetting; + } + + for (int index = 0; index < mLanguageRegionMapping.count();index++) { + const LanguageRegionMapping &setting = mLanguageRegionMapping.at(index); + HbDataFormModelItem *languageAndRegionPage = mModel->appendDataFormPage( HbLocaleUtil::localisedLanguageName(setting.languageId) ); + mLanguagePages.append(languageAndRegionPage); + + /* + * Create primary writing language item. + */ + HbDataFormModelItem *primaryInputLanguageItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, + hbTrId("txt_cp_setlabel_primary_writing_language")); + + + int primaryInputLanguageIndex = mPrimaryInputLanguages.indexOf(setting.primaryWritingLan); + + CPLANG_LOG(QLatin1String("Primary input Language:") + setting.primaryWritingLan.asString()); + CPLANG_LOG(QString("Index of primary input language: %1").arg(primaryInputLanguageIndex)); + + fillDataFormComboBoxItem(primaryInputLanguageItem,localizedInputLanguages,primaryInputLanguageIndex); + + form->addConnection(primaryInputLanguageItem, SIGNAL(currentIndexChanged (int)), + this,SLOT(onPrimaryInputLanguageChanged(int))); + languageAndRegionPage->appendChild(primaryInputLanguageItem); + + /* + * Create secondary writing language item. + * (No secondary writing language for Chinese variant) + */ + if (!mChineseVariant) { + HbDataFormModelItem *secondaryInputLanguageItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, + hbTrId("txt_cp_setlabel_secondary_writing_language")); + + form->addConnection(secondaryInputLanguageItem, SIGNAL(currentIndexChanged (int)), + this,SLOT(onSecondaryInputLanguageChanged(int))); + languageAndRegionPage->appendChild(secondaryInputLanguageItem); + } + + /* + * Create region item. + */ + HbDataFormModelItem *regionItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, + hbTrId("Region")); + + int regionIndex = mSupportedRegions.indexOf(setting.regionId); + + CPLANG_LOG(QLatin1String("Current region:") + setting.regionId); + CPLANG_LOG(QString("Index of current region: %1").arg(regionIndex)); + + fillDataFormComboBoxItem(regionItem,localizedRegions,regionIndex); + + form->addConnection(regionItem, SIGNAL(currentIndexChanged (int)), + this,SLOT(onRegionChanged(int))); + languageAndRegionPage->appendChild(regionItem); + + if (mSupportedLanguages.at(index) == currentLanguage) { + mCurrentLanguagePage = languageAndRegionPage; + mCurrentRegionItem = mCurrentLanguagePage->childAt(REGION_ITEM_INDEX); + mCurrentPrimaryInputLanguageItem = mCurrentLanguagePage->childAt(PRIMARY_INPUT_ITEM_INDEX); + mCurrentSecondaryInputLanguageItem = mCurrentLanguagePage->childAt(SECONDARY_INPUT_ITEM_INDEX); + } + } + + // update secondary input language item according to primary input language + updateSecondaryInputLanguageItem(); + + /* + * Create region settings item. + */ + HbDataFormModelItem *regionalSettingsItem = new HbDataFormModelItem( + static_cast(CpSettingFormEntryItemData::ButtonEntryItem)); + regionalSettingsItem->setContentWidgetData("text",hbTrId("txt_cp_button_regional_settings")); + regionalSettingsItem->setContentWidgetData("textAlignment", + QVariant(Qt::AlignHCenter | Qt::AlignVCenter)); + form->addConnection(regionalSettingsItem,SIGNAL(clicked()), + this,SLOT(launchRegionalSettingsView())); + + mModel->appendDataFormItem(regionalSettingsItem); + + form->setModel(mModel); + // active current language page + form->setExpanded(mModel->indexFromItem(mCurrentLanguagePage),true); + + + /* + * observe input language changed event + */ + connect(HbInputSettingProxy::instance(), + SIGNAL(globalInputLanguageChanged(HbInputLanguage)), + this, + SLOT(onPrimaryInputLanguageChanged(HbInputLanguage))); + + connect(HbInputSettingProxy::instance(), + SIGNAL(globalSecondaryInputLanguageChanged(HbInputLanguage)), + this, + SLOT(onSecondaryInputLanguageChanged(HbInputLanguage))); + + connect(form, + SIGNAL(activated(QModelIndex)), + this, + SLOT(onDataFormItemActivated(QModelIndex))); + + } +} + +/* + * Destructor + */ +CpLanguageView::~CpLanguageView() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::~CpLanguageView") + // Unload RegionalSettingsView plugin + if (mClockPluginLoader) { + mClockPluginLoader->unload(); + delete mClockPluginLoader; + } + delete mModel; +} + +/*! + * Handle region changed + */ +void CpLanguageView::onRegionChanged(int index) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::onRegionChanged") + + CPLANG_LOG(QLatin1String("Before change region:") + HbLocaleUtil::currentRegion()); + + if (index >= 0 && index < mSupportedRegions.count()) { + HbLocaleUtil::changeRegion( mSupportedRegions.at(index) ); + mCurrentSetting.regionId = mSupportedRegions.at(index); + if (LanguageRegionMapping *setting = languageRegionMapping(mCurrentSetting.languageId)) { + setting->regionId = mCurrentSetting.regionId; + } + + CPLANG_LOG(QLatin1String("After change region:") + HbLocaleUtil::currentRegion()); + } +} + + +/* + * prompt user to restart device. + */ +bool CpLanguageView::promptRestart() +{ + HbDeviceMessageBox messageBox( + hbTrId("txt_cp_text_edit_device_will_be_restarted_to_chang"), + HbMessageBox::MessageTypeQuestion, this); + + QString okText = hbTrId("txt_cp_button_restart"); + QString cancelText = hbTrId("txt_cp_button_discard_changes"); + messageBox.setAction(new QAction(okText,&messageBox), + HbDeviceMessageBox::AcceptButtonRole); + messageBox.setAction(new QAction(cancelText,&messageBox), + HbDeviceMessageBox::RejectButtonRole); + messageBox.setIconVisible(false); + + return (messageBox.exec() + == messageBox.action(HbDeviceMessageBox::AcceptButtonRole) ); +} + +/*! + * Handle primary language changed. + */ +void CpLanguageView::onPrimaryInputLanguageChanged(int index) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::onPrimaryInputLanguageChanged(int index)") + + CPLANG_LOG(QLatin1String("Before change primary input language:") + HbInputSettingProxy::instance()->globalInputLanguage().asString()); + + if (index >= 0 && index < mPrimaryInputLanguages.count()) { + HbInputLanguage inputLanguage = mPrimaryInputLanguages.at(index); + if (inputLanguage != HbInputSettingProxy::instance()->globalInputLanguage()) { + HbInputSettingProxy::instance()->setGlobalInputLanguage(inputLanguage); + mCurrentSetting.primaryWritingLan = inputLanguage; + if (LanguageRegionMapping *setting = languageRegionMapping(mCurrentSetting.languageId)) { + setting->primaryWritingLan = mCurrentSetting.primaryWritingLan; + } + + updateSecondaryInputLanguageItem(); + CPLANG_LOG(QLatin1String("After change primary input language:") + HbInputSettingProxy::instance()->globalInputLanguage().asString()); + } + } +} + +/*! + * Handle secondary language changed. + */ +void CpLanguageView::onSecondaryInputLanguageChanged(int index) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::onSecondaryInputLanguageChanged(int index)") + + CPLANG_LOG(QLatin1String("Before change secondary input language:") + HbInputSettingProxy::instance()->globalSecondaryInputLanguage().asString()); + + if (index >= 0 && index < mSecondaryInputLanguages.count()) { + HbInputLanguage inputLanguage = mSecondaryInputLanguages.at(index); + if (inputLanguage != HbInputSettingProxy::instance()->globalSecondaryInputLanguage() ) { + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(inputLanguage); + mCurrentSetting.secondaryWritingLan = inputLanguage; + if (LanguageRegionMapping *setting = languageRegionMapping(mCurrentSetting.languageId)) { + setting->secondaryWritingLan = mCurrentSetting.secondaryWritingLan; + } + + CPLANG_LOG(QLatin1String("After change secondary input language:") + HbInputSettingProxy::instance()->globalSecondaryInputLanguage().asString()); + } + } +} + +/*! + * Observe primary input language changed event and update the ui, if it is being changed from outside of this plugin + */ +void CpLanguageView::onPrimaryInputLanguageChanged(const HbInputLanguage &inputLanguage) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::onPrimaryInputLanguageChanged(const HbInputLanguage &inputLanguage)") + if (mCurrentPrimaryInputLanguageItem) { + int index = mPrimaryInputLanguages.indexOf(inputLanguage); + if (index != mCurrentPrimaryInputLanguageItem->contentWidgetData("currentIndex").toInt() ) { + CPLANG_LOG( QString("New Index: %1").arg(index) ) + + mCurrentSetting.primaryWritingLan = inputLanguage; + mCurrentPrimaryInputLanguageItem->setContentWidgetData("currentIndex",index); + updateSecondaryInputLanguageItem(); + } + } +} + +/*! + * Observe secondary input language changed event and update the ui, if it is being changed from outside of this plugin + */ +void CpLanguageView::onSecondaryInputLanguageChanged(const HbInputLanguage &inputLanguage) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::onSecondaryInputLanguageChanged(const HbInputLanguage &inputLanguage)") + + if (mCurrentSecondaryInputLanguageItem) { + int index = mSecondaryInputLanguages.indexOf(inputLanguage); + if (index != mCurrentSecondaryInputLanguageItem->contentWidgetData("currentIndex").toInt()) { + CPLANG_LOG( QString("New Index: %1").arg(index) ) + mCurrentSetting.secondaryWritingLan = inputLanguage; + mCurrentSecondaryInputLanguageItem->setContentWidgetData("currentIndex",index); + } + } +} + + +/*! + * Fill contents in the data form model items. + * \param comboBoxItem a data form model item whose type is HbDataFormModelItem::ComboBoxItem + * \param items items showing in the combobox + * \param currentIndex index of the selected item + */ +void CpLanguageView::fillDataFormComboBoxItem(HbDataFormModelItem *comboBoxItem, + const QStringList &items, + int currentIndex /*= -1*/) +{ + Q_ASSERT(comboBoxItem); + Q_ASSERT(comboBoxItem->type() == HbDataFormModelItem::ComboBoxItem); + + comboBoxItem->setContentWidgetData("items", items); + comboBoxItem->setContentWidgetData("currentIndex",currentIndex); +} + +/*! + * Update secondary input language item according to primary input language + */ +void CpLanguageView::updateSecondaryInputLanguageItem() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::updateSecondaryInputLanguageItem") + + // no secondary writing language in Chinese variant. + if (mChineseVariant) { + return; + } + + HbInputLanguage primaryInputLanguage = HbInputSettingProxy::instance()->globalInputLanguage(); + + mSecondaryInputLanguages.clear(); + // append a "none set" item + mSecondaryInputLanguages.append(HbInputLanguage()); + + // Chinese input doesn't have secondary input language + if (primaryInputLanguage.language() == QLocale::Chinese) { + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(HbInputLanguage()); + CPLANG_LOG("Primary input language: Chinese"); + } + else { + foreach(const HbInputLanguage &inputLanguage,mPrimaryInputLanguages) { + if ( inputLanguage != primaryInputLanguage // Secondary input language can't be set the same as primary input language + && inputLanguage.language() != QLocale::Chinese) { // Chinese input can't be set as secondary input language + mSecondaryInputLanguages.append(inputLanguage); + } + } + } + + QStringList localisedNames = CpLanguagePluginUtil::localizedInputLanguageNames(mSecondaryInputLanguages); + + // if the secondary input language is the same as primary input language, set it as "none set" + HbInputLanguage secondaryInputLanguage = HbInputSettingProxy::instance()->globalSecondaryInputLanguage(); + + if (secondaryInputLanguage == primaryInputLanguage) { + secondaryInputLanguage = HbInputLanguage(); + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(HbInputLanguage()); + + CPLANG_LOG("secondary == primary, set secondary input as \"None\""); + } + + mCurrentSetting.secondaryWritingLan = secondaryInputLanguage; + if (LanguageRegionMapping *setting = languageRegionMapping(mCurrentSetting.languageId)) { + setting->secondaryWritingLan = mCurrentSetting.secondaryWritingLan; + } + + fillDataFormComboBoxItem(mCurrentSecondaryInputLanguageItem,localisedNames,mSecondaryInputLanguages.indexOf(secondaryInputLanguage)); +} + +/*! + * Restart the device. + */ +int CpLanguageView::restartDevice() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::restartDevice") +#ifdef Q_OS_SYMBIAN + RStarterSession session; + TInt error = session.Connect(); + + if (error == KErrNone) { + session.Reset( RStarterSession::ELanguageSwitchReset ); + session.Close(); + } + + return error; +#else + return 0; +#endif +} + +/*! + Launch the regional settings view. + */ +void CpLanguageView::launchRegionalSettingsView() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::launchRegionalSettingsView") + + //Load the clock settings view plugin if it is not loaded + if (!mClockPluginLoader) { + QDir dir(CLOCK_SETTINGSVIEW_PLUGIN_PATH); + QString pluginName = dir.absoluteFilePath(CLOCK_SETTINGSVIEW_PLUGIN_NAME); + mClockPluginLoader = new QPluginLoader(pluginName); + mClockPluginLoader->load(); + } + + //Launch the settings view + ClockSettingsViewInterface *clockSettingsViewInterface + = qobject_cast(mClockPluginLoader->instance()); + if (clockSettingsViewInterface) { + clockSettingsViewInterface->launchRegionalSettingsView(); + } + else { + CPLANG_LOG("Load clocksettingsviewplugin failed."); + } +} + +/*! + * handle data form page changed event + */ +void CpLanguageView::onDataFormItemActivated(const QModelIndex &modelIndex) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::onDataFormItemActivated") + + mCurrentLanguagePage = mModel->itemFromIndex(modelIndex); + + mCurrentRegionItem = mCurrentLanguagePage->childAt(REGION_ITEM_INDEX); + mCurrentPrimaryInputLanguageItem = mCurrentLanguagePage->childAt(PRIMARY_INPUT_ITEM_INDEX); + mCurrentSecondaryInputLanguageItem = mCurrentLanguagePage->childAt(SECONDARY_INPUT_ITEM_INDEX); + + int index = mLanguagePages.indexOf(mCurrentLanguagePage); + + if (index >= 0) { + QString newLanguage = mSupportedLanguages.at(index); + LanguageRegionMapping *setting = languageRegionMapping(newLanguage); + if (setting) { + setting->secondaryWritingLan = HbInputSettingProxy::instance()->globalSecondaryInputLanguage(); + mCurrentSetting = *setting; + + HbLocaleUtil::changeRegion(mCurrentSetting.regionId); + HbInputSettingProxy::instance()->setGlobalInputLanguage(mCurrentSetting.primaryWritingLan); + + //update combobox + mCurrentPrimaryInputLanguageItem->setContentWidgetData("currentIndex",mPrimaryInputLanguages.indexOf(mCurrentSetting.primaryWritingLan)); + mCurrentRegionItem->setContentWidgetData("currentIndex",mSupportedRegions.indexOf(mCurrentSetting.regionId)); + + CPLANG_LOG(QString("Primary writing:") + HbInputSettingProxy::instance()->globalInputLanguage().asString()); + CPLANG_LOG(QString("Secondary writing:") + HbInputSettingProxy::instance()->globalSecondaryInputLanguage().asString()); + + updateSecondaryInputLanguageItem(); + } + } + +} + +/*! + * From CpBaseSettingView, prompt user to restart device before exiting the view + */ +void CpLanguageView::close() +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::close()") + + CPLANG_LOG( QString("mCurrentSetting.languageId :") + mCurrentSetting.languageId ) + CPLANG_LOG( QString("HbLocaleUtil::currentLanguage():") + HbLocaleUtil::currentLanguage() ) + + if (mCurrentSetting.languageId != HbLocaleUtil::currentLanguage()) { + // apply new settings + if (promptRestart()) { + HbLocaleUtil::changeLocale(mCurrentSetting.languageId); + + /* + * change other settings. + */ + if (mSupportedRegions.contains(mCurrentSetting.regionId,Qt::CaseInsensitive)) { + HbLocaleUtil::changeRegion(mCurrentSetting.regionId); + } + CpLanguagePlugin::updateEntryItem(); + HbInputSettingProxy::instance()->setGlobalInputLanguage(mCurrentSetting.primaryWritingLan); + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(mCurrentSetting.secondaryWritingLan); + + restartDevice(); + } + // restore previous values + else { + if (mCurrentSetting.regionId != mPreviousSetting.regionId) { + HbLocaleUtil::changeRegion(mPreviousSetting.regionId); + } + if (mCurrentSetting.primaryWritingLan != mPreviousSetting.primaryWritingLan) { + HbInputSettingProxy::instance()->setGlobalInputLanguage(mPreviousSetting.primaryWritingLan); + } + if (mCurrentSetting.secondaryWritingLan != mPreviousSetting.secondaryWritingLan) { + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(mPreviousSetting.secondaryWritingLan); + } + } + } + + CpBaseSettingView::close(); +} + +/*! + * get the language-region mapping table + */ +LanguageRegionMapping *CpLanguageView::languageRegionMapping(const QString &language) +{ + CPLANG_LOG_FUNC_ENTRY("CpLanguageView::languageRegionMapping(const QString &language)") + + foreach(const LanguageRegionMapping &setting,mLanguageRegionMapping) { + if (setting.languageId.compare(language,Qt::CaseInsensitive) == 0) { + return const_cast(&setting); + } + } + + CPLANG_LOG("Not found.") + + return 0; +} + +//End of File diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/cplanguageview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/cplanguageview.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 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: Language plugin view class + * + */ +#ifndef CPLANGUAGEVIEW_H +#define CPLANGUAGEVIEW_H + +#include +#include +#include +#include +#include "cplanguagepluginutil.h" +#include "extendedlocaleutil.h" +#include "cplanguageplugin_global.h" + +class QStringList; +class QPluginLoader; +class HbDataFormModel; +class HbDataFormModelItem; +class HbInputLanguage; +class QModelIndex; + +class CpLanguageView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpLanguageView(QGraphicsItem *parent = 0); + virtual ~CpLanguageView(); + +private slots: + //handle combobox index changes + void onRegionChanged(int index); + void onPrimaryInputLanguageChanged(int index); + void onSecondaryInputLanguageChanged(int index); + + //observe input language changed event + void onPrimaryInputLanguageChanged(const HbInputLanguage &inputLanguage); + void onSecondaryInputLanguageChanged(const HbInputLanguage &inputLanguage); + + //launch regional setting view + void launchRegionalSettingsView(); + + //handle data form page changed event + void onDataFormItemActivated(const QModelIndex &modelIndex); +protected: + //From CpBaseSettingView + virtual void close(); +private: + void fillDataFormComboBoxItem(HbDataFormModelItem *comboBoxItem, + const QStringList &items, int currentIndex = -1); + void updateSecondaryInputLanguageItem(); + bool promptRestart(); + int restartDevice(); + LanguageRegionMapping *languageRegionMapping(const QString &language); +private: + QList mLanguageRegionMapping; + + LanguageRegionMapping mPreviousSetting; + LanguageRegionMapping mCurrentSetting; + + HbDataFormModel *mModel; + + QList mLanguagePages; + HbDataFormModelItem *mCurrentLanguagePage; + + //Current items + HbDataFormModelItem *mCurrentRegionItem; + HbDataFormModelItem *mCurrentPrimaryInputLanguageItem; + HbDataFormModelItem *mCurrentSecondaryInputLanguageItem; + + QList mPrimaryInputLanguages; + QList mSecondaryInputLanguages; + QStringList mSupportedLanguages; + QStringList mSupportedRegions; + + QPluginLoader *mClockPluginLoader; + + bool mChineseVariant; + + LANGUAGEPLUGIN_TEST_FRIEND_CLASS(TestLanguagePlugin) +}; +#endif //CPLANGUAGEVIEW_H diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/extendedlocaleutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/extendedlocaleutil.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (developer.feedback@nokia.com) +** +** This file is part of the HbCore module of the UI Extensions for Mobile. +** +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at developer.feedback@nokia.com. +** +****************************************************************************/ +#include "extendedlocaleutil.h" + +#if defined(Q_OS_SYMBIAN) +#include +#include +#include + +#define LANGUAGE_LIST_FILE "/resource/hbi18n/translations/language_list.txt" +#define LANGUAGE_MAPPINGS_FILE "/resource/hbi18n/translations/locale_mappings.txt" +#endif // Q_OS_SYMBIAN + +#include "cplanguagepluginlog.h" + +/*! + @beta + @hbcore + \class ExtendedLocaleUtil + \brief ExtendedLocaleUtil provides mappings needed for Control Panel plugin which are not available through HbLocaleUtil class. +*/ + + +/*! + \brief Return list of language, region, collation and writing language mappings. + + \attention Symbian specific API + + \return a list containing mapped locale properties +*/ + +//#define __TESTCODE__ + +QList ExtendedLocaleUtil::localeMappings(bool onlySupported) +{ + CPLANG_LOG_FUNC_ENTRY("ExtendedLocaleUtil::localeMappings") + + QList mps = allLocaleMappings(); + + if (!onlySupported) { + return mps; + } + + QList supportedmps; + + QStringList supportedLanguages = HbLocaleUtil::supportedLanguages(); + QStringList supportedRegions = HbLocaleUtil::supportedRegions(); + + foreach (const QString &language,supportedLanguages) { + LanguageRegionMapping *found = 0; + for (int i = 0; i < mps.count();i++) { + if (mps.at(i).languageId == language) { + found = const_cast(&mps.at(i)); + break; + } + } + if (found) { + supportedmps.append(*found); + } + else { + LanguageRegionMapping map; + map.languageId = language; + map.primaryWritingLan = HbInputLanguage(QLocale(language).language()); + } + + } + + return supportedmps; +} + +QList ExtendedLocaleUtil::allLocaleMappings() +{ + CPLANG_LOG_FUNC_ENTRY("ExtendedLocaleUtil::allLocaleMappings") + + QList mps; + +#if defined(Q_OS_SYMBIAN) + + QString path = "c:"; + path += QString(LANGUAGE_MAPPINGS_FILE); + QFile* file = new QFile(path); + if (!file->exists() ) { + path = "z:"; + path += QString(LANGUAGE_MAPPINGS_FILE); + delete file; + file = new QFile(path); + } + if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) { + delete file; + return mps; + } + + QTextStream in(file); + while (!in.atEnd()) { + QString line = in.readLine(256); + if (!line.isEmpty()) { + QStringList list = line.split(',', QString::SkipEmptyParts); + if (list.count() < 7) { + continue; + } + + QString strCode = list[0]; + QString lanName = list[4]; + QString region = list[5]; + QString collation = list[6]; + + bool ok; + int code = strCode.toUInt(&ok); + if (!ok) { + continue; + } + + QString lanPart = (lanName.indexOf('_')>0) ? lanName.left(lanName.indexOf('_')) : lanName; + QString regPart = (region.indexOf('_')>0) ? region.left(region.indexOf('_')) : region; + QLocale loc = QLocale(QString(lanPart+'_'+regPart)); + HbInputLanguage primaryWriting = HbInputLanguage(loc.language(), loc.country()); + HbInputLanguage secondaryWriting = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom); + + LanguageRegionMapping map; + map.languageId = lanName; + map.regionId = region; + map.collationId = collation; + map.primaryWritingLan = primaryWriting; + map.secondaryWritingLan = secondaryWriting; + mps.append(map); + + } + } + delete file; + +#endif // Q_OS_SYMBIAN + + + return mps; +} diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/src/extendedlocaleutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/src/extendedlocaleutil.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 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: Language plugin view class + * + */ + +/* + * extendedlocaleutil.h + * + * Created on: 24.8.2010 + * Author: mhujanen + */ + +#ifndef EXTENDEDLOCALEUTIL_H_ +#define EXTENDEDLOCALEUTIL_H_ + +#include +#include + +/* + * Temporary class. + * will be replaced by function added in HbLocaleUtil in future. + * + * */ + +struct LanguageRegionMapping + { + QString languageId; + QString regionId; + QString collationId; + HbInputLanguage primaryWritingLan; + HbInputLanguage secondaryWritingLan; + }; + +class ExtendedLocaleUtil : public HbLocaleUtil + { + public: + static QList localeMappings(bool onlySupported); + private: + static QList allLocaleMappings(); + }; + +#endif /* EXTENDEDLOCALEUTIL_H_ */ diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/t_languageplugin/inc/t_languageplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/t_languageplugin/inc/t_languageplugin.h Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 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: Main test class for Control Panel's Language plugin +* +*/ + +#ifndef TESTLANGUAGEPLUGIN_H +#define TESTLANGUAGEPLUGIN_H + +#include +#include + +class CpLanguagePlugin; +class CpLanguageView; +class CpSettingFormEntryItemData; +class HbMainWindow; + +/** +* TestLanguagePlugin +*/ +class TestLanguagePlugin : public QObject +{ + Q_OBJECT + +private slots: + void init(); + void cleanup(); + // Test cases start from here + // CpLanguagePlugin + void test_CpLanguagePlugin_createSettingFormItemData(); + void test_CpLanguagePlugin_updateEntryItem(); + + void test_ExtendedLocaleUtil_localeMappings(); + + void test_CpLanguagePluginUtil_localizedLanguageNames(); + void test_CpLanguagePluginUtil_localizedRegionNames(); + void test_CpLanguagePluginUtil_localizedInputLanguageNames(); + void test_CpLanguagePluginUtil_isChineseVariant(); + + void test_CpLanguageView_new(); + void test_CpLanguageView_onRegionChanged(); + void test_CpLanguageView_onPrimaryInputLanguageChanged(); + void test_CpLanguageView_onSecondaryInputLanguageChanged(); + void test_CpLanguageView_onPrimaryInputLanguageChanged2(); + void test_CpLanguageView_onSecondaryInputLanguageChanged2(); + void test_CpLanguageView_launchRegionalSettingsView(); + void test_CpLanguageView_onDataFormItemActivated(); + void test_CpLanguageView_close(); + void test_CpLanguageView_fillDataFormComboBoxItem(); + void test_CpLanguageView_updateSecondaryInputLanguageItem(); + void test_CpLanguageView_promptRestart(); + void test_CpLanguageView_restartDevice(); + void test_CpLanguageView_languageRegionMapping(); + +private: + HbMainWindow *mMainWindow; + CpLanguagePlugin* mPlugin; + CpLanguageView* mView; + CpSettingFormEntryItemData *mEntryItemData; + +}; + +#endif // T_CPLANGUAGEPLUGIN_H diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/t_languageplugin/src/t_languageplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/t_languageplugin/src/t_languageplugin.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,389 @@ +/* +* Copyright (c) 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: Main test class for Control Panel's Language plugin. +* +*/ + +#include "t_languageplugin.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "cplanguageplugin.h" +#include "extendedlocaleutil.h" +#include "cplanguageview.h" +#include "cplanguagepluginutil.h" + +/*! + Initialize test case. + Called before each testfunction is executed. +*/ +void TestLanguagePlugin::init() +{ + mMainWindow = new HbMainWindow(); + QVERIFY(mMainWindow); + + mPlugin = new CpLanguagePlugin; + QVERIFY(mPlugin); + // Note: we get different values for condition coverage of CpLanguageView() + // depending on which values have been selected in Control Panel settings. + mView = new CpLanguageView(); + QVERIFY(mView); + + CpItemDataHelper itemDataHelper; + QList itemData = mPlugin->createSettingFormItemData(itemDataHelper); + mEntryItemData = qobject_cast(itemData.front()); +} + +/*! + Cleanup test case. + Called after every testfunction. +*/ +void TestLanguagePlugin::cleanup() +{ + delete mView; + mView = 0; + + delete mPlugin; + mPlugin = 0; + + delete mEntryItemData; + mEntryItemData = 0; + + delete mMainWindow; + mMainWindow = 0; +} + +/* --------------------------------------------------------------------------- + * Unit test cases + * ---------------------------------------------------------------------------*/ + +/*! + * test CpLanguagePlugin::createSettingFormItemData + */ +void TestLanguagePlugin::test_CpLanguagePlugin_createSettingFormItemData() +{ + CpItemDataHelper itemDataHelper; + QList itemData = mPlugin->createSettingFormItemData(itemDataHelper); + QVERIFY(itemData.count() == 1); + + CpSettingFormEntryItemData *entryItemData = qobject_cast(itemData.front()); + QVERIFY(entryItemData != 0); + QVERIFY(entryItemData->type() == static_cast(CpSettingFormEntryItemData::ListEntryItem) ); +} + +/*! + * test CpLanguagePlugin::updateEntryItem + */ +void TestLanguagePlugin::test_CpLanguagePlugin_updateEntryItem() +{ + CpLanguagePlugin::updateEntryItem(); + + QString localisedLanguage = HbLocaleUtil::localisedLanguageName(HbLocaleUtil::currentLanguage()); + + QVERIFY(mEntryItemData->description() == localisedLanguage); +} + +/*! + * test ExtendedLocaleUtil::localeMappings + */ +void TestLanguagePlugin::test_ExtendedLocaleUtil_localeMappings() +{ + QList allMaps = ExtendedLocaleUtil::localeMappings(false); + QVERIFY(allMaps.count() > 0); + + QList supportedMaps = ExtendedLocaleUtil::localeMappings(true); + QVERIFY(supportedMaps.count() > 0); + + QVERIFY(allMaps.count() >= supportedMaps.count()); +} + +/*! + * test CpLanguagePluginUtil::localizedLanguageNames + */ +void TestLanguagePlugin::test_CpLanguagePluginUtil_localizedLanguageNames() +{ + QStringList supportLanguages = HbLocaleUtil::supportedLanguages(); + QStringList localisedLanguages = CpLanguagePluginUtil::localizedLanguageNames(supportLanguages); + + QVERIFY (supportLanguages.count() == localisedLanguages.count()); +} + +/*! + * test CpLanguagePluginUtil::localizedRegionNames + */ +void TestLanguagePlugin::test_CpLanguagePluginUtil_localizedRegionNames() +{ + QStringList supportedRegions = HbLocaleUtil::supportedRegions(); + QStringList localisedRegions = CpLanguagePluginUtil::localizedRegionNames(supportedRegions); + + QVERIFY (supportedRegions.count() == localisedRegions.count()); +} + +/* + * test CpLanguagePluginUtil::localizedInputLanguageNames + */ +void TestLanguagePlugin::test_CpLanguagePluginUtil_localizedInputLanguageNames() +{ + QList supportedInputLanguages; + HbInputUtils::listSupportedInputLanguages(supportedInputLanguages); + + QStringList localisedInputLanguages = CpLanguagePluginUtil::localizedInputLanguageNames(supportedInputLanguages); + QVERIFY(supportedInputLanguages.count() == localisedInputLanguages.count()); +} + +/*! + * test CpLanguagePluginUtil::isChineseVariant + */ +void TestLanguagePlugin::test_CpLanguagePluginUtil_isChineseVariant() +{ + bool isChineseVariant = CpLanguagePluginUtil::isChineseVariant(); + + QStringList supportedLanguages = HbLocaleUtil::supportedLanguages(); + foreach(const QString &language, supportedLanguages) { + if (QLocale(language).language() == QLocale::Chinese) { + QVERIFY (isChineseVariant); + return; + } + } + + QVERIFY (!isChineseVariant); +} + +/*! + * test new CpLanguageView + */ +void TestLanguagePlugin::test_CpLanguageView_new() +{ + CpLanguageView* view = new CpLanguageView(); + QVERIFY(view != 0); + delete view; +} + +/*! + * test CpLanguageView::onRegionChanged(int index) + */ +void TestLanguagePlugin::test_CpLanguageView_onRegionChanged() +{ + QString oldRegion = HbLocaleUtil::currentRegion(); + + QStringList allRegions = mView->mSupportedRegions; + QVERIFY(allRegions.count() > 0); + + for(int i = 0; i < allRegions.count();i++) { + if (!allRegions.at(i).trimmed().isEmpty()) { + mView->onRegionChanged(i); + QVERIFY(HbLocaleUtil::currentRegion() == allRegions.at(i)); + } + } + + HbLocaleUtil::changeRegion(oldRegion); + QVERIFY(HbLocaleUtil::currentRegion() == oldRegion); + + mView->onRegionChanged(-1); + QVERIFY(HbLocaleUtil::currentRegion() == oldRegion); + + mView->onRegionChanged(allRegions.count()); + QVERIFY(HbLocaleUtil::currentRegion() == oldRegion); +} + +/*! + * test CpLanguageView::onPrimaryInputLanguageChanged(int index) + */ +void TestLanguagePlugin::test_CpLanguageView_onPrimaryInputLanguageChanged() +{ + HbInputLanguage oldPrimaryInputLanguage = HbInputSettingProxy::instance()->globalInputLanguage(); + + QList supportedInputLanguages = mView->mPrimaryInputLanguages; + + QVERIFY(supportedInputLanguages.count() > 0); + for (int i = 0; i < supportedInputLanguages.count();i++) { + mView->onPrimaryInputLanguageChanged(i); + QVERIFY(HbInputSettingProxy::instance()->globalInputLanguage() == supportedInputLanguages.at(i)); + } + + HbInputSettingProxy::instance()->setGlobalInputLanguage(oldPrimaryInputLanguage); + QVERIFY(HbInputSettingProxy::instance()->globalInputLanguage() == oldPrimaryInputLanguage); + + mView->onPrimaryInputLanguageChanged(-1); + QVERIFY(HbInputSettingProxy::instance()->globalInputLanguage() == oldPrimaryInputLanguage); + + mView->onPrimaryInputLanguageChanged(supportedInputLanguages.count()); + QVERIFY(HbInputSettingProxy::instance()->globalInputLanguage() == oldPrimaryInputLanguage); +} + +/*! + * test CpLanguageView::onSecondaryInputLanguageChanged(int index) + */ +void TestLanguagePlugin::test_CpLanguageView_onSecondaryInputLanguageChanged() +{ + HbInputLanguage primaryInputLanguage = HbInputSettingProxy::instance()->globalInputLanguage(); + HbInputLanguage oldSecondaryInputLanguage = HbInputSettingProxy::instance()->globalSecondaryInputLanguage(); + + QList supportedInputLanguages = mView->mSecondaryInputLanguages; + + QVERIFY(supportedInputLanguages.count() > 0); + for (int i = 0; i < supportedInputLanguages.count();i++) { + if ( supportedInputLanguages.at(i) != primaryInputLanguage) { + mView->onSecondaryInputLanguageChanged(i); + QVERIFY(HbInputSettingProxy::instance()->globalSecondaryInputLanguage() == supportedInputLanguages.at(i)); + } + } + + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(oldSecondaryInputLanguage); + QVERIFY(HbInputSettingProxy::instance()->globalSecondaryInputLanguage() == oldSecondaryInputLanguage); + + mView->onSecondaryInputLanguageChanged(-1); + QVERIFY(HbInputSettingProxy::instance()->globalSecondaryInputLanguage() == oldSecondaryInputLanguage); + + mView->onSecondaryInputLanguageChanged(supportedInputLanguages.count()); + QVERIFY(HbInputSettingProxy::instance()->globalSecondaryInputLanguage() == oldSecondaryInputLanguage); +} + +/*! + * test CpLanguageView::onPrimaryInputLanguageChanged(const HbInputLanguage &inputLanguage) + */ +void TestLanguagePlugin::test_CpLanguageView_onPrimaryInputLanguageChanged2() +{ + int oldIndex = mView->mCurrentPrimaryInputLanguageItem->contentWidgetData("currentIndex").toInt(); + + QList supportedInputLanguages = mView->mPrimaryInputLanguages; + + QVERIFY(supportedInputLanguages.count() > 0); + for (int i = 0; i < supportedInputLanguages.count();i++) { + mView->onPrimaryInputLanguageChanged(supportedInputLanguages.at(i)); + QVERIFY( mView->mCurrentPrimaryInputLanguageItem->contentWidgetData("currentIndex").toInt() == i ); + } + + mView->mCurrentPrimaryInputLanguageItem->setContentWidgetData("currentIndex",oldIndex); + + QVERIFY(oldIndex == mView->mCurrentPrimaryInputLanguageItem->contentWidgetData("currentIndex").toInt()); +} + +/*! + * test CpLanguageView::onSecondaryInputLanguageChanged(const HbInputLanguage &inputLanguage) + */ +void TestLanguagePlugin::test_CpLanguageView_onSecondaryInputLanguageChanged2() +{ + int oldIndex = mView->mCurrentSecondaryInputLanguageItem->contentWidgetData("currentIndex").toInt(); + + QList supportedInputLanguages = mView->mSecondaryInputLanguages; + + QVERIFY(supportedInputLanguages.count() > 0); + for (int i = 0; i < supportedInputLanguages.count();i++) { + mView->onSecondaryInputLanguageChanged(supportedInputLanguages.at(i)); + QVERIFY( mView->mCurrentSecondaryInputLanguageItem->contentWidgetData("currentIndex").toInt() == i ); + } + + mView->mCurrentSecondaryInputLanguageItem->setContentWidgetData("currentIndex",oldIndex); + + QVERIFY(oldIndex == mView->mCurrentSecondaryInputLanguageItem->contentWidgetData("currentIndex").toInt()); +} + +/*! + * test CpLanguageView::launchRegionalSettingsView() + */ +void TestLanguagePlugin::test_CpLanguageView_launchRegionalSettingsView() +{ + mView->launchRegionalSettingsView(); + QVERIFY(mView->mClockPluginLoader != 0); +} + +/*! + * test CpLanguageView::onDataFormItemActivated(const QModelIndex &modelIndex) + */ +void TestLanguagePlugin::test_CpLanguageView_onDataFormItemActivated() +{ + QVERIFY(true); +} + +/*! + * test CpLanguageView::close() + */ +void TestLanguagePlugin::test_CpLanguageView_close() +{ + QVERIFY(true); +} + +/*! + * test CpLanguageView::fillDataFormComboBoxItem + */ +void TestLanguagePlugin::test_CpLanguageView_fillDataFormComboBoxItem() +{ + QStringList supportedRegions = HbLocaleUtil::supportedRegions(); + QStringList localizedRegions = CpLanguagePluginUtil::localizedRegionNames(supportedRegions); + + int regionIndex = supportedRegions.indexOf(HbLocaleUtil::currentRegion()); + + mView->fillDataFormComboBoxItem(mView->mCurrentRegionItem,localizedRegions,regionIndex); + + QVERIFY(mView->mCurrentRegionItem->contentWidgetData("currentIndex").toInt() == regionIndex); + QVERIFY(mView->mCurrentRegionItem->contentWidgetData("items").toStringList() == localizedRegions); +} + +/*! + * test CpLanguageView::updateSecondaryInputLanguageItem + */ +void TestLanguagePlugin::test_CpLanguageView_updateSecondaryInputLanguageItem() +{ + QList supportedInputLanguages; + HbInputUtils::listSupportedInputLanguages(supportedInputLanguages); + + HbInputLanguage primaryInputLanguage = HbInputSettingProxy::instance()->globalInputLanguage(); + HbInputLanguage secondaryInputLanguage = HbInputSettingProxy::instance()->globalSecondaryInputLanguage(); + + QVERIFY(supportedInputLanguages.count() > 0); + + HbInputSettingProxy::instance()->setGlobalInputLanguage(supportedInputLanguages.front()); + HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(supportedInputLanguages.front()); + + mView->updateSecondaryInputLanguageItem(); + + QVERIFY(mView->mCurrentSecondaryInputLanguageItem->contentWidgetData("currentIndex").toInt() == 0); + +} + +/*! + * test CpLanguageView::promptRestart + */ +void TestLanguagePlugin::test_CpLanguageView_promptRestart() +{ + QVERIFY(true); +} + +/*! + * test CpLanguageView::restartDevice + */ +void TestLanguagePlugin::test_CpLanguageView_restartDevice() +{ + QVERIFY(true); +} + +/*! + * test CpLanguageView::languageRegionMapping + */ +void TestLanguagePlugin::test_CpLanguageView_languageRegionMapping() +{ + QStringList supportedLanguages = HbLocaleUtil::supportedLanguages(); + foreach(const QString &language,supportedLanguages) { + LanguageRegionMapping *entry = mView->languageRegionMapping(language); + QVERIFY(entry != 0); + } +} + +QTEST_MAIN(TestLanguagePlugin) diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/t_languageplugin/t_languageplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/t_languageplugin/t_languageplugin.pri Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,27 @@ +# +# Copyright (c) 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: tests for Language plugin +# + +HEADERS += ./inc/t_languageplugin.h \ + ../src/cplanguageview.h \ + ../src/cplanguageplugin.h \ + ../src/cplanguagepluginutil.h \ + ../src/extendedlocaleutil.h + +SOURCES += ./src/t_languageplugin.cpp \ + ../src/cplanguageview.cpp \ + ../src/cplanguageplugin.cpp \ + ../src/cplanguagepluginutil.cpp \ + ../src/extendedlocaleutil.cpp diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/langandregplugin/t_languageplugin/t_languageplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/langandregplugin/t_languageplugin/t_languageplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,60 @@ +# +# Copyright (c) 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: tests for Language plugin +# + +TEMPLATE = app + +CONFIG += debug_and_release +QT += testlib +CONFIG += hb qtestlib +CONFIG += symbian_test + +CONFIG(debug, debug|release) { + DESTDIR = ./debug +} else { + DESTDIR = ./release +} + +symbian: LIBS+=-lcpframework +LIBS += -lstarterclient + +CONFIG += hb + +INCLUDEPATH += ./inc \ + ../inc + + +DEPENDPATH += ./inc \ + ./src \ + ../inc \ + ../src + +DEFINES += LANGUAGEPLUGIN_TEST + + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x2002BCD6 + TARGET.CAPABILITY = CAP_APPLICATION AllFiles + PLUGIN_SUBDIR = c:/private/2002BCD6 +} +symbian:MMP_RULES += SMPSAFE +include( t_languageplugin.pri ) + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -50,18 +50,6 @@ static const int KThemeChangeTimeOutMilliSeconds = 2000; /*! - 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), diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/themeplugin/src/cpthemeplugin.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -50,7 +50,7 @@ itemDataHelper, hbTrId("txt_cp_dblist_theme"), QString(), - HbIcon()); + HbIcon("qtg_large_personalization")); return QList() << entryItem; } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp --- a/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -47,8 +47,7 @@ //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. @@ -71,7 +70,7 @@ */ void CpThemePluginEntryItemData::themeUpdated(const QString& themeName, const HbIcon& icon) { - setEntryItemIcon(icon); + Q_UNUSED(icon); setDescription(themeName); } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/themeplugin/src/cpthemeutil.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -80,6 +80,7 @@ } if(name.isEmpty() || (hidden == "true") ||( hidden == "")) { + delete themeInfo; return NULL; } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelplugins/themeplugin/themeplugin.pro --- a/controlpanelplugins/themeplugin/themeplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelplugins/themeplugin/themeplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -91,6 +91,7 @@ for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" } +symbian:MMP_RULES += SMPSAFE #symbian: INCLUDEPATH += /sf/mw/hb/include/hbservices \ # /sf/mw/hb/include/hbservices/private \ @@ -99,3 +100,4 @@ # # End of file --Don't remove this. + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/examples/groupplugin/groupplugin.pro --- a/controlpanelui/examples/groupplugin/groupplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/examples/groupplugin/groupplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -26,3 +26,6 @@ } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro --- a/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro Mon Oct 04 00:18:12 2010 +0300 @@ -36,3 +36,6 @@ LIBS += -lxqservice -lcpframework symbian::TARGET::UID3 = 0X2002873A + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/examples/themeplugin/themeplugin.pro --- a/controlpanelui/examples/themeplugin/themeplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/examples/themeplugin/themeplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -27,3 +27,6 @@ symbian { TARGET.UID3 = 0X20025FDB } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/examples/viewplugin/viewplugin.pro --- a/controlpanelui/examples/viewplugin/viewplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/examples/viewplugin/viewplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -25,3 +25,6 @@ } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/rom/controlpanelui.iby --- a/controlpanelui/rom/controlpanelui.iby Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/rom/controlpanelui.iby Mon Oct 04 00:18:12 2010 +0300 @@ -40,7 +40,6 @@ file=ABI_DIR\BUILD_DIR\cpcommunicationplugin.dll SHARED_LIB_DIR\cpcommunicationplugin.dll file=ABI_DIR\BUILD_DIR\cpdeviceplugin.dll SHARED_LIB_DIR\cpdeviceplugin.dll file=ABI_DIR\BUILD_DIR\cpprivacyplugin.dll SHARED_LIB_DIR\cpprivacyplugin.dll -file=ABI_DIR\BUILD_DIR\cplookfeelplugin.dll SHARED_LIB_DIR\cplookfeelplugin.dll file=ABI_DIR\BUILD_DIR\cpkeytouchfdbkplugin.dll SHARED_LIB_DIR\cpkeytouchfdbkplugin.dll file=ABI_DIR\BUILD_DIR\cpprofileactivator.dll SHARED_LIB_DIR\cpprofileactivator.dll file=ABI_DIR\BUILD_DIR\cpvolumeplugin.dll SHARED_LIB_DIR\cpvolumeplugin.dll @@ -51,14 +50,12 @@ data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cpcommunicationplugin.cpcfg resource\qt\plugins\controlpanel\config\cpcommunicationplugin.cpcfg data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cpdeviceplugin.cpcfg resource\qt\plugins\controlpanel\config\cpdeviceplugin.cpcfg data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cpprivacyplugin.cpcfg resource\qt\plugins\controlpanel\config\cpprivacyplugin.cpcfg -data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cplookfeelplugin.cpcfg resource\qt\plugins\controlpanel\config\cplookfeelplugin.cpcfg data=\epoc32\data\c\resource\qt\plugins\controlpanel\cppersonalizationplugin.qtplugin resource\qt\plugins\controlpanel\cppersonalizationplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpcommunicationplugin.qtplugin resource\qt\plugins\controlpanel\cpcommunicationplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpdeviceplugin.qtplugin resource\qt\plugins\controlpanel\cpdeviceplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin resource\qt\plugins\controlpanel\cpprivacyplugin.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\cpkeytouchfdbkplugin.qtplugin resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpapplication/cpapplication.pro --- a/controlpanelui/src/cpapplication/cpapplication.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpapplication/cpapplication.pro Mon Oct 04 00:18:12 2010 +0300 @@ -41,4 +41,6 @@ DEPLOYMENT += exportheaders for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpapplication/src/cpmainview.cpp --- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -142,11 +142,14 @@ void CpMainView::onDataFormItemActivated(const QModelIndex &index) { CPFW_LOG("CpMainView::onDataFormItemActivated"); - CpSettingFormItemData *itemData = static_cast(mMainModel->itemFromIndex(index)); - - if (CpCategorySettingFormItemData *categoryItemData = qobject_cast(itemData)) { - categoryItemData->initialize(*mItemDataHelper); - } + HbDataFormModelItem *modelItem = mMainModel->itemFromIndex(index); + if (modelItem != 0 && modelItem->type() == HbDataFormModelItem::GroupItem) { + CpSettingFormItemData *itemData = static_cast(modelItem); + if (CpCategorySettingFormItemData *categoryItemData = qobject_cast(itemData)) { + categoryItemData->initialize(*mItemDataHelper); + } + } + } void CpMainView::onAboutToChangeView(HbView * oldView, HbView *newView) { diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpapplication/src/cpmainwindow.cpp --- a/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -21,20 +21,26 @@ #include #include #include - +#include //CpMainWindow implementation CpMainWindow::CpMainWindow(QWidget *parent /*= 0*/, Hb::WindowFlags windowFlags /*= Hb::WindowFlagNone*/) -: HbMainWindow(parent,windowFlags) +: HbMainWindow(parent,windowFlags),mStartupTimer(0) { + // start a zero interval timer to identify the startup of control panel is finished. + mStartupTimer = new QTimer(this); + connect(mStartupTimer, SIGNAL(timeout()), this, SLOT(onStartupFininshed())); + mStartupTimer->start(); } CpMainWindow::~CpMainWindow() { CpMainView *mainView = qobject_cast(views().first()); - if(mainView) - { + if(mainView != 0) { mainView->saveActivity(); - } + } + if(mStartupTimer != 0) { + delete mStartupTimer; + } } bool CpMainWindow::event(QEvent *e) @@ -47,6 +53,20 @@ return HbMainWindow::event(e); } +/** + * Emit applicationReady signal when start up process is finished. + */ +void CpMainWindow::onStartupFininshed() +{ + // emit applicationReady signal when the all initilizing event has been deal with. + // only emit it once + emit applicationReady(); + if (mStartupTimer != 0) { + mStartupTimer->stop(); + delete mStartupTimer; + mStartupTimer = 0; + } +} //End of File diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpapplication/src/cpmainwindow.h --- a/controlpanelui/src/cpapplication/src/cpmainwindow.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.h Mon Oct 04 00:18:12 2010 +0300 @@ -19,7 +19,7 @@ #define CPMAINWINDOW_H #include - +class QTimer; class CpMainWindow : public HbMainWindow { Q_OBJECT @@ -28,6 +28,16 @@ ~CpMainWindow(); public: virtual bool event(QEvent *e); +signals: + /** + * Emit when control panel's startup is finished + */ + void applicationReady(); +private slots: + void onStartupFininshed(); + +private: + QTimer *mStartupTimer; }; #endif // CPMAINWINDOW_H diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/cpcategorymodel.pro --- a/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Mon Oct 04 00:18:12 2010 +0300 @@ -31,3 +31,6 @@ } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -212,9 +212,10 @@ if (entryItemData->description().isEmpty()) { entryItemData->setDescription(description); } - if (entryItemData->iconName().isEmpty()) { - entryItemData->setIconName( - QLatin1String(":/icon/qgn_prop_set_default_sub.svg") ); + + if (entryItemData->type() == static_cast(CpSettingFormEntryItemData::ListEntryItem) + && entryItemData->iconName().isEmpty()) { + entryItemData->setIconName(DEFAULT_ICON_LISTENTRYITEM); } return true; diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h --- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h Mon Oct 04 00:18:12 2010 +0300 @@ -19,6 +19,8 @@ #include +#define DEFAULT_ICON_LISTENTRYITEM QLatin1String("qtg_large_non_default.nvg") + class HbDataFormModelItem; class CpItemDataHelper; class CpSettingFormItemData; diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/firstpluginforcpcategorymodel.pro --- a/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/firstpluginforcpcategorymodel.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/firstpluginforcpcategorymodel.pro Mon Oct 04 00:18:12 2010 +0300 @@ -53,3 +53,6 @@ SOURCES += src/firstpluginforcpcategorymodel.cpp \ src/firstpluginviewforcpcategorymodel.cpp + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/secondpluginforcpcategorymodel.pro --- a/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/secondpluginforcpcategorymodel.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/secondpluginforcpcategorymodel.pro Mon Oct 04 00:18:12 2010 +0300 @@ -53,3 +53,6 @@ SOURCES += src/secondpluginforcpcategorymodel.cpp \ src/secondpluginviewforcpcategorymodel.cpp + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/ut_categorymodelitemdata.pro --- a/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/ut_categorymodelitemdata.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/ut_categorymodelitemdata.pro Mon Oct 04 00:18:12 2010 +0300 @@ -51,4 +51,6 @@ DEPLOYMENT += testdll \ testqtplugin \ testqtcfgfile -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.cpp --- a/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -110,8 +110,7 @@ QVERIFY(itemData2->text() == newText); QVERIFY( itemData2->description() == newDes ); QString temp = itemData2->iconName(); - QString newIconName = QLatin1String(":/icon/qgn_prop_set_default_sub.svg"); - QVERIFY( itemData2->iconName() == newIconName ); + QVERIFY( itemData2->iconName() == DEFAULT_ICON_LISTENTRYITEM ); delete itemData2; delete pHelper; } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/ut_categorymodelutility.pro --- a/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/ut_categorymodelutility.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/ut_categorymodelutility.pro Mon Oct 04 00:18:12 2010 +0300 @@ -57,4 +57,6 @@ testqtcfgfile } HEADERS += src/*.h -SOURCES += src/*.cpp \ No newline at end of file +SOURCES += src/*.cpp + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/ut_cpcategorysettingformmodel.pro --- a/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/ut_cpcategorysettingformmodel.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/ut_cpcategorysettingformmodel.pro Mon Oct 04 00:18:12 2010 +0300 @@ -52,4 +52,6 @@ DEPLOYMENT += testdll \ testqtplugin \ testqtcfgfile -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pro --- a/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pro Mon Oct 04 00:18:12 2010 +0300 @@ -52,4 +52,6 @@ } HEADERS += src/*.h -SOURCES += src/*.cpp \ No newline at end of file +SOURCES += src/*.cpp + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro --- a/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -36,3 +36,6 @@ # This is for new exporting system coming in garden for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- a/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Mon Oct 04 00:18:12 2010 +0300 @@ -3,7 +3,7 @@ - + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro --- a/controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -35,4 +35,6 @@ # This is for new exporting system coming in garden for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -36,3 +36,6 @@ TARGET.CAPABILITY = All -TCB TARGET.EPOCALLOWDLLDATA = 1 } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/lookfeelplugin/data/cplookfeelplugin.cpcfg --- a/controlpanelui/src/cpplugins/lookfeelplugin/data/cplookfeelplugin.cpcfg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - Name of the WallPaper - - - - - - - - \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pri --- a/controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pri Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -# -# 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: cpdeviceplugin source files -# - - -# Input -HEADERS += src/cplookfeelplugin.h -SOURCES += src/cplookfeelplugin.cpp \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pro --- a/controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -# -# 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 = cplookfeelplugin - -CONFIG += hb plugin - - -include ( ../cpplugincommon.pri ) -include ( lookfeelplugin.pri ) - -symbian { - TARGET.UID3 = 0X20025FE0 -} - -symbian { - deploy.path = C: - headers.sources = data/cplookfeelplugin.cpcfg - headers.path = /resource/qt/plugins/controlpanel/config - DEPLOYMENT += exportheaders - - # This is for new exporting system coming in garden - for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" -} \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.cpp --- a/controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.cpp Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * 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 "cplookfeelplugin.h" -#include "cpcategorysettingformitemdata.h" - -CpLookFeelPlugin::CpLookFeelPlugin() -{ -} - -CpLookFeelPlugin::~CpLookFeelPlugin() -{ -} - -QList CpLookFeelPlugin::createSettingFormItemData(CpItemDataHelper &/*itemDataHelper*/) const -{ - CpCategorySettingFormItemData *itemData = - new CpCategorySettingFormItemData( - HbDataFormModelItem::GroupItem, - tr("Look&Feel"), - QString("cplookfeelplugin.cpcfg") ); - return QList() << itemData; -} - -Q_EXPORT_PLUGIN2(cplookfeelplugin, CpLookFeelPlugin); diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.h --- a/controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.h Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * 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 CPLOOKFEELPLUGIN_H -#define CPLOOKFEELPLUGIN_H - - -#include -#include - -class CpLookFeelPlugin : public QObject, - public CpPluginInterface -{ - Q_OBJECT - Q_INTERFACES(CpPluginInterface) -public: - CpLookFeelPlugin(); - virtual ~CpLookFeelPlugin(); - virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; -}; - - -#endif /* CPLOOKFEELPLUGIN_H */ diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement.svg --- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement_pressed.svg --- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement_pressed.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment.svg --- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment_pressed.svg --- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment_pressed.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_muted.svg --- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_muted.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_unmuted.svg --- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_unmuted.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro --- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -39,3 +39,6 @@ # This is for new exporting system coming in garden for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc --- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc Mon Oct 04 00:18:12 2010 +0300 @@ -1,10 +1,5 @@ - icon/hb_vol_slider_decrement.svg - icon/hb_vol_slider_decrement_pressed.svg - icon/hb_vol_slider_increment.svg - icon/hb_vol_slider_increment_pressed.svg - icon/hb_vol_slider_muted.svg - icon/hb_vol_slider_unmuted.svg + resources/hbslider_color.css \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/resources/hbslider_color.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/resources/hbslider_color.css Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,19 @@ + +HbSlider::increment-icon +{ + color: var(qtc_list_item_title_normal); +} + + +HbSlider::decrement-icon +{ + color: var(qtc_list_item_title_normal); +} + +HbSlider::icon-icon +{ + color: var(qtc_list_item_title_normal); +} + + + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -28,8 +28,10 @@ #include #include #include +#include + CpPersonalizationAdvanceView::CpPersonalizationAdvanceView(QGraphicsItem *parent /*=0*/): - CpBaseSettingView(0,parent) + CpBaseSettingView(0,parent), mEditProfileNameDialog(0), mOkButton(0), mCancelButton(0) { // 1.init the dataform for advance settings here // 2.please modify the cpprofilesettingform.h/ cpp according to current ui spec @@ -37,14 +39,23 @@ // 4.use cppersonalizationentryitemdata class to create ringtone, message tone... // 5.ignore cpmastervolumeslider class, please use default slideritem to create keyandscreen slider, new property added in slider, if any question, please contact me. // 6. don't forget the cfg file in data folder, you can try to add the profile activator plugin and ringtone plugin here - HbDataForm *form = new CpProfileSettingForm(); - setWidget( form ); - CpPluginUtility::addCpItemPrototype(form); + HbStyleLoader::registerFilePath(":/resources/hbslider_color.css"); + mDataForm = new CpProfileSettingForm(); + setWidget( mDataForm ); + CpPluginUtility::addCpItemPrototype(mDataForm); initMenu(); } CpPersonalizationAdvanceView::~CpPersonalizationAdvanceView() { - + if (mEditProfileNameDialog) { + delete mEditProfileNameDialog; + } + if (mOkButton) { + delete mOkButton; + } + if (mCancelButton) { + delete mCancelButton; + } } void CpPersonalizationAdvanceView::initMenu() @@ -59,6 +70,30 @@ void CpPersonalizationAdvanceView::on_editNameAction_triggered() { - QString string = QString( "general" ); - bool ret = CpProfileNameEditDialog::launchProfileNameEditDialog( string ); + mProfileName = mDataForm->currentPageProfileName().trimmed(); + + if (mEditProfileNameDialog) { + delete mEditProfileNameDialog; + delete mCancelButton; + delete mOkButton; + } + mCancelButton = new HbAction(hbTrId("txt_common_button_cancel")); + mOkButton = new HbAction(hbTrId("txt_common_button_ok")); + mEditProfileNameDialog = new CpProfileNameEditDialog(); + mEditProfileNameDialog->addAction(mOkButton); + mEditProfileNameDialog->addAction(mCancelButton); + mEditProfileNameDialog->setLineEditMaxLength(maxProfileNameLength); + mEditProfileNameDialog->setLineEditText(mProfileName); + mEditProfileNameDialog->open(this, SLOT(onDialogClosed(HbAction*))); + } + +void CpPersonalizationAdvanceView::onDialogClosed(HbAction *action) +{ + if (action == mOkButton && + mProfileName != mEditProfileNameDialog->lineEditText()) { + mProfileName = mEditProfileNameDialog->lineEditText(); + mDataForm->setCurrentPageProfileName(mProfileName); + mDataForm->updateModifiedProfileName(mProfileName); + } +} diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h Mon Oct 04 00:18:12 2010 +0300 @@ -20,6 +20,11 @@ #include class CpItemDataHelper; +class CpProfileSettingForm; +class CpProfileNameEditDialog; + +//max profile name length is 64 bytes. +const int maxProfileNameLength = 64; class CpPersonalizationAdvanceView: public CpBaseSettingView { @@ -30,8 +35,16 @@ private slots: void on_editNameAction_triggered(); + void onDialogClosed(HbAction *action); private: void initMenu(); + +private: + CpProfileSettingForm *mDataForm; + CpProfileNameEditDialog *mEditProfileNameDialog; + HbAction *mOkButton; + HbAction *mCancelButton; + QString mProfileName; }; #endif diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -24,8 +24,8 @@ #include #include -CpProfileNameEditDialog::CpProfileNameEditDialog( QGraphicsItem *parent ) - :HbDialog( parent ) +CpProfileNameEditDialog::CpProfileNameEditDialog(QGraphicsItem *parent) + : HbDialog(parent) { init(); } @@ -36,57 +36,48 @@ void CpProfileNameEditDialog::init() { - setDismissPolicy( HbPopup::NoDismiss ); - setHeadingWidget( new HbLabel( hbTrId( "txt_cp_title_edit_name" ), this )); + setDismissPolicy(HbPopup::NoDismiss); + setHeadingWidget(new HbLabel(hbTrId("txt_cp_title_edit_name"), this)); QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); - vLayout->setOrientation( Qt::Vertical ); - HbWidget *contentWidget = new HbWidget( this ); - mTextEdit = new HbLineEdit( this ); - mTextEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); - vLayout->addItem( mTextEdit ); - contentWidget->setLayout( vLayout ); - setContentWidget( contentWidget ); + vLayout->setOrientation(Qt::Vertical); + HbWidget *contentWidget = new HbWidget(this); + HbLabel *label = new HbLabel(hbTrId("txt_cp_heading_profile_name")); + vLayout->addItem(label); + mLineEdit = new HbLineEdit(this); + mLineEdit->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + vLayout->addItem(mLineEdit); + contentWidget->setLayout(vLayout); + setContentWidget(contentWidget); + connect(mLineEdit, SIGNAL(contentsChanged()), this, SLOT(checkPrimaryAction())); - connect( mTextEdit, SIGNAL( contentsChanged() ), this, SLOT( checkPrimaryAction() ) ); - - addAction( new HbAction( hbTrId( "txt_common_button_ok" ), this )); - addAction( new HbAction( hbTrId( "txt_common_button_cancel" ), this ) ); - - setTimeout( NoTimeout ); + setTimeout(NoTimeout); } -void CpProfileNameEditDialog::setLineEditText( const QString &text ) +void CpProfileNameEditDialog::setLineEditText(const QString &text) { - mTextEdit->setText( text ); - mTextEdit->setSelection( 0, text.length() ); + mLineEdit->setText(text); } -QString CpProfileNameEditDialog::getLineEditText() +QString CpProfileNameEditDialog::lineEditText() { - QString text = mTextEdit->text(); - return text; + return mLineEdit->text().trimmed(); } -bool CpProfileNameEditDialog::launchProfileNameEditDialog( QString &profileName ) +void CpProfileNameEditDialog::setLineEditMaxLength(int length) { - CpProfileNameEditDialog *profileEditNameDialog = new CpProfileNameEditDialog(); - - profileEditNameDialog->setLineEditText( profileName ); - profileEditNameDialog->checkPrimaryAction(); - profileEditNameDialog->show(); - return false; + mLineEdit->setMaxLength(length); } void CpProfileNameEditDialog::checkPrimaryAction() { - HbAction *const primaryAction = qobject_cast - (actions().at(0)); - if (primaryAction) { - if ( !mTextEdit->text().isEmpty() ) { - primaryAction->setEnabled(true); + //the first button(number 0) is Ok Button. + HbAction *const primaryAction = qobject_cast(actions().at(0)); + if (primaryAction) { + if (!mLineEdit->text().trimmed().isEmpty()) { + primaryAction->setEnabled(true); } else { primaryAction->setEnabled(false); - } + } } } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h Mon Oct 04 00:18:12 2010 +0300 @@ -30,20 +30,19 @@ public: CpProfileNameEditDialog( QGraphicsItem *parent = 0 ); virtual ~CpProfileNameEditDialog(); - - static bool launchProfileNameEditDialog( QString &profileName ); + void setLineEditText(const QString &text); + QString lineEditText(); + void setLineEditMaxLength(int length); private slots: void checkPrimaryAction(); private: void init(); - void setLineEditText( const QString &text ); - QString getLineEditText(); - -private: + +private: HbWidget *mContentWidget; - HbLineEdit *mTextEdit; + HbLineEdit *mLineEdit; }; #endif /* CPPROFILENAMEEDITDIALOG_H */ diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -36,12 +36,13 @@ CpProfileSettingForm::CpProfileSettingForm() : mModel(0), mItemDataHelper(new CpItemDataHelper( this )), mProfileModel(new CpProfileModel()), mFileIconProvider(new QFileIconProvider), - mGeneralPage(0),mMeetingPage(0),mCurrentPage( 0 ), mSettingManager(0) + mGeneralPage(0),mMeetingPage(0), mSettingManager(0), mCurrentPage(0) { this->setHeading(hbTrId("txt_cp_button_advanced_settings")); - this->setDescription(hbTrId("txt_cp_info_select_tones_that_play_when_you_select")); - + this->setDescription(hbTrId("txt_cp_info_select_tones_that_play_when_you_select")); initModel(); + connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(onDataFormActivated(QModelIndex))); + } CpProfileSettingForm::~CpProfileSettingForm() @@ -52,6 +53,31 @@ delete mSettingManager; } +void CpProfileSettingForm::onDataFormActivated(const QModelIndex &index) +{ + HbDataFormModelItem *item = mModel->itemFromIndex(index); + mCurrentPage = item; +} + +QString CpProfileSettingForm::currentPageProfileName() +{ + return mCurrentPage->label(); +} + +void CpProfileSettingForm::setCurrentPageProfileName(const QString &name) +{ + mCurrentPage->setLabel(name); +} + +void CpProfileSettingForm::updateModifiedProfileName(const QString &name) +{ + if (mCurrentPage == mGeneralPage) { + mProfileModel->setProfileName(EProfileWrapperGeneralId, name); + } else if (mCurrentPage == mMeetingPage) { + mProfileModel->setProfileName(EProfileWrapperMeetingId, name); + } +} + void CpProfileSettingForm::initModel() { mModel = new HbDataFormModel(); @@ -77,7 +103,8 @@ connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); - mGeneralPage = mModel->appendDataFormPage( generalString ); + mGeneralPage = mModel->appendDataFormPage( generalString ); + mCurrentPage = mGeneralPage; initProfileItems(EProfileWrapperGeneralId,mGeneralPage); //initGeneralTonesGroup(); @@ -165,13 +192,13 @@ modelItem->setContentWidgetData( QString( "maximum" ), 5 ); modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone ); QMap< QString, QVariant > elements; - elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); - elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); + elements.insert(QString("IncreaseElement") , QVariant("qtg_mono_vol_up")); + elements.insert(QString("DecreaseElement"), QVariant("qtg_mono_vol_down") ); if (profileSettings.mKeyTouchScreenTone != 0) { - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); + elements.insert(QString("IconElement"), QVariant("qtg_mono_speaker") ); } else { - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); + elements.insert(QString("IconElement"), QVariant("qtg_mono_speaker_off") ); } modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); @@ -198,8 +225,8 @@ modelItem->setContentWidgetData( QString( "maximum" ), 5 ); modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); QMap< QString, QVariant > iconElements; - iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); - iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); + iconElements.insert(QString("IncreaseElement") , QVariant("qtg_mono_vol_up")); + iconElements.insert(QString("DecreaseElement"), QVariant("qtg_mono_vol_down") ); modelItem->setContentWidgetData( QString( "elementIcons" ), iconElements ); if (profileId == EProfileWrapperGeneralId) { @@ -341,10 +368,10 @@ QMap elements = sliderItem->contentWidgetData("elementIcons").toMap(); if (isMute) { - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + elements.insert(QString("IconElement"), QVariant("qtg_mono_speaker_off")); } else { - elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); + elements.insert(QString("IconElement"), QVariant("qtg_mono_speaker")); } sliderItem->setContentWidgetData( QString( "elementIcons" ), elements ); } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Mon Oct 04 00:18:12 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include "cpprofilemodel.h" class HbDataFormModel; class HbDataFormModelItem; @@ -47,7 +48,9 @@ CpProfileSettingForm(); virtual ~CpProfileSettingForm(); - + QString currentPageProfileName(); + void setCurrentPageProfileName(const QString &name); + void updateModifiedProfileName(const QString &name); private slots: //general tones @@ -64,6 +67,8 @@ void on_meeting_screenVibra_ValueChanged( int value ); void settingValueChanged(const XQSettingsKey &key, const QVariant &value); + + void onDataFormActivated(const QModelIndex &index); private: void initModel(); void initGeneralTonesGroup(); @@ -71,6 +76,7 @@ void initMeetingTonesGroup(); //void initMeetingVibraGroup(); bool checkBoxStateToBool( int state ); + // void initRingToneGroup(HbDataFormModelItem *parent); // void initMessageToneGroup(HbDataFormModelItem *parent); // void initAlertToneGroup(HbDataFormModelItem *parent); @@ -87,9 +93,7 @@ HbDataFormModelItem *mGeneralPage; HbDataFormModelItem *mMeetingPage; - HbDataFormModelItem *mCurrentPage; - // HbDataFormModelItem *mGeneralKeysAndScreenToneSlider; // HbDataFormModelItem *mGeneralSreenVibra; // HbDataFormModelItem *mMeetingKeysAndScreenToneSlider; diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro --- a/controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -37,4 +37,6 @@ # This is for new exporting system coming in garden for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro --- a/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -29,3 +29,6 @@ TARGET.EPOCALLOWDLLDATA = 1 LIBS += -lprofileeng } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -36,7 +36,8 @@ int currentId = mProfileModel->activeProfileId(); QString currentName = mProfileModel->profileName(currentId); this->setDescription(currentName); - connect(mProfileMonitor, SIGNAL(profileActivated(int)), this, SLOT(onProfileChanged(int))); + connect(mProfileMonitor, SIGNAL(profileActivated(int)), this, SLOT(onProfileChanged(int))); + connect(mProfileMonitor, SIGNAL(activeProfileModified(int)), this, SLOT(onProfileChanged(int))); } CpProfileActivatorEntryItem::~CpProfileActivatorEntryItem() diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro --- a/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -27,3 +27,6 @@ TARGET.CAPABILITY = All -TCB TARGET.EPOCALLOWDLLDATA = 1 } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement.svg --- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement_pressed.svg --- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement_pressed.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment.svg --- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment_pressed.svg --- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment_pressed.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_muted.svg --- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_muted.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_unmuted.svg --- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_unmuted.svg Fri Sep 17 08:29:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - - - - - - diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/resources/hbslider_color.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/resources/hbslider_color.css Mon Oct 04 00:18:12 2010 +0300 @@ -0,0 +1,19 @@ + +HbSlider::increment-icon +{ + color: var(qtc_list_item_title_normal); +} + + +HbSlider::decrement-icon +{ + color: var(qtc_list_item_title_normal); +} + +HbSlider::icon-icon +{ + color: var(qtc_list_item_title_normal); +} + + + diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -118,19 +118,7 @@ HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); if (masterVolume) { CPFW_LOG("::updateMasterVolumeValue(), Start using profile model."); - QMap iconMaps; - if (isSilenceMode) { - CPFW_LOG("::updateMasterVolumeValue(), Got silent state."); - iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); - } - else { - iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); - } - masterVolume->setContentWidgetData("elementIcons", iconMaps); + setSilderSpeakerIcon(isSilenceMode); masterVolume->setEnabled(!isSilenceMode); //masterVolume->setContentWidgetData("enabled",!isSilenceMode); masterVolume->setContentWidgetData("value",mProfileModel->masterVolume()); @@ -148,18 +136,7 @@ if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode) { HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); if (masterVolume) { - QMap iconMaps; - if (value.toBool()) { - iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); - } - else { - iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); - } - masterVolume->setContentWidgetData("elementIcons", iconMaps); + setSilderSpeakerIcon(value.toBool()); masterVolume->setEnabled(!value.toBool()); } HbDataFormModelItem *silenceMode = mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem); @@ -180,5 +157,23 @@ } } } +/** + * set speaker icon for volume silder + */ +void CpVolumeController::setSilderSpeakerIcon(bool isSpeakerOff) +{ + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + if (masterVolume != 0) { + QMap iconMaps; + iconMaps = masterVolume->contentWidgetData("elementIcons").toMap(); + if (isSpeakerOff) { + iconMaps.insert("IconElement", QVariant("qtg_mono_speaker_off")); + } + else { + iconMaps.insert("IconElement", QVariant("qtg_mono_speaker")); + } + masterVolume->setContentWidgetData("elementIcons", QVariant(iconMaps)); + } +} //End of File diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Mon Oct 04 00:18:12 2010 +0300 @@ -44,7 +44,7 @@ private: void updateUi(); - + void setSilderSpeakerIcon(bool isSpeakerOff); private: CpProfileModel *mProfileModel; QList mItemList; diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -26,6 +26,7 @@ #include "cpvolumecontroller.h" #include "cppersonalizationcustomviewitem.h" #include +#include CpVolumeGroupItemData::CpVolumeGroupItemData(CpItemDataHelper &itemDataHelper) : CpSettingFormItemData(HbDataFormModelItem::GroupItem,hbTrId("txt_cp_subhead_volume")),//mSilenceIndicator(0), @@ -35,6 +36,7 @@ mProfileModel(0) { initItems(itemDataHelper); + HbStyleLoader::registerFilePath(":/resources/hbslider_color.css"); } CpVolumeGroupItemData::~CpVolumeGroupItemData() @@ -68,21 +70,14 @@ masterVolume->setContentWidgetData("objectName","masterVolumeSlider"); QMap iconMaps; - iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); - iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); - //iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + iconMaps.insert(QString("DecreaseElement"), QVariant("qtg_mono_vol_down")); + iconMaps.insert(QString("IncreaseElement"), QVariant("qtg_mono_vol_up")); masterVolume->setContentWidgetData("elementIcons", iconMaps); masterVolume->setContentWidgetData("minimum", 1); masterVolume->setContentWidgetData("maximum", 10); masterVolume->setContentWidgetData("majorTickInterval",1); masterVolume->setContentWidgetData("tickPosition",Hb::SliderTicksBelow); - - /*QStringList tickLabels; - tickLabels<setContentWidgetData("majorTickLabels",tickLabels);*/ masterVolume->setContentWidgetData("iconCheckable",false); this->appendChild(masterVolume); diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro --- a/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -27,3 +27,6 @@ symbian { TARGET.UID3 = 0X20028737 } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc --- a/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc Mon Oct 04 00:18:12 2010 +0300 @@ -1,10 +1,5 @@ - icon/hb_vol_slider_decrement.svg - icon/hb_vol_slider_decrement_pressed.svg - icon/hb_vol_slider_increment.svg - icon/hb_vol_slider_increment_pressed.svg - icon/hb_vol_slider_muted.svg - icon/hb_vol_slider_unmuted.svg + resources/hbslider_color.css \ No newline at end of file diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def --- a/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Mon Oct 04 00:18:12 2010 +0300 @@ -57,4 +57,5 @@ ?qt_metacast@CpProfileMonitor@@UAEPAXPBD@Z @ 56 NONAME ; void * CpProfileMonitor::qt_metacast(char const *) ??1CpProfileMonitor@@UAE@XZ @ 57 NONAME ; CpProfileMonitor::~CpProfileMonitor(void) ?qt_metacall@CpProfileMonitor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 58 NONAME ; int CpProfileMonitor::qt_metacall(enum QMetaObject::Call, int, void * *) + ?setProfileName@CpProfileModel@@QAEXHABVQString@@@Z @ 59 NONAME ; void CpProfileModel::setProfileName(int, class QString const &) diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro --- a/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Mon Oct 04 00:18:12 2010 +0300 @@ -82,3 +82,6 @@ } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def --- a/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Mon Oct 04 00:18:12 2010 +0300 @@ -53,4 +53,5 @@ _ZNK16CpProfileMonitor10metaObjectEv @ 52 NONAME _ZTI16CpProfileMonitor @ 53 NONAME _ZTV16CpProfileMonitor @ 54 NONAME + _ZN14CpProfileModel14setProfileNameEiRK7QString @ 55 NONAME diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -43,6 +43,15 @@ { return d_ptr->profileName(profileId); } + +/*! + Set profile id \a profileId 's name with \a name. +*/ +void CpProfileModel::setProfileName(int profileId, const QString &name) +{ + d_ptr->setProfileName(profileId, name); +} + /*! get profile name list */ diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -50,8 +51,7 @@ * Constructor */ CpProfileModelPrivate::CpProfileModelPrivate() - : mEngine(0), - mProfileNames(0), + : mEngine(0), q_ptr(0) { @@ -66,8 +66,6 @@ CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START."); TRAP_IGNORE( mEngine = CreateProfileEngineExtended2L(); - mProfileNames = mEngine->ProfilesNamesArrayLC(); - CleanupStack::Pop(); // pop the pointer of mProfileNames /* * Currently, engine part will return all previous version of profile * so some invalid profile will be added in the new list, to avoid this @@ -94,9 +92,6 @@ if (mEngine!=0) { mEngine->Release(); } - if (mProfileNames) { - delete mProfileNames; - } mProfileList.clear(); } @@ -110,14 +105,35 @@ if (!isValidProfile(profileId)) { return QString(); } + QString profileName; + QT_TRAP_THROWING( + MProfile *profile = mEngine->Profile2L(profileId); + const MProfileName &name = profile->ProfileName(); + if (name.Name().Length() > 0) { + profileName = XQConversions::s60DescToQString(name.Name()); + } + profile->Release(); + ) + return profileName; - const MProfileName* name = mProfileNames->ProfileName(profileId); - QString profileName; - if (name != 0) { - profileName = XQConversions::s60DescToQString(name->Name()); - } - CPFW_LOG("CpProfileModelPrivate::profileName(), END."); - return profileName; +} + +/* + * Set profile name with \a profileId. + */ +void CpProfileModelPrivate::setProfileName(int profileId, const QString &name) +{ + HBufC *des = XQConversions::qStringToS60Desc( name ); + QT_TRAP_THROWING( + CleanupStack::PushL(des); + MProfileExtended *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + MProfileSetName &profileSetName = profileExtend->ProfileSetName(); + profileSetName.SetNameL(*des); + mEngine ->CommitChangeL(*profileExtend); + CleanupStack::Pop(2); // des, profileExtend + profileExtend->Release(); + ) } /* @@ -126,15 +142,17 @@ QStringList CpProfileModelPrivate::profileNames() const { CPFW_LOG("CpProfileModelPrivate::profileNames(), START."); - QStringList nameList; - - foreach(int profileId, mProfileList) { - const MProfileName *name = mProfileNames->ProfileName(profileId); - if (name != 0) { - nameList.append(XQConversions::s60DescToQString(name->Name())); - } + QStringList nameList; + foreach(int profileId, mProfileList) { + QT_TRAP_THROWING( + MProfile *profile = mEngine->Profile2L(profileId); + const MProfileName &name = profile->ProfileName(); + if (name.Name().Length() > 0) { + nameList.append(XQConversions::s60DescToQString(name.Name())); + } + profile->Release(); + ) } - CPFW_LOG("CpProfileModelPrivate::profileNames(), END."); return nameList; } diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Mon Oct 04 00:18:12 2010 +0300 @@ -40,6 +40,7 @@ public: QString profileName(int profileId) const; QStringList profileNames() const; + void setProfileName(int profileId, const QString &name); int activateProfile(int profileId); int activeProfileId() const; void profileSettings(int profileId, CpProfileSettings& profileSettings); diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -45,6 +45,16 @@ } /* + * Set profile name with \a profileId. + */ +int CpProfileModelPrivate::setProfileName(int profileId, const QString &name) +{ + Q_UNUSED(profileId); + Q_UNUSED(name); + return -1; +} + +/* * Activate a profile with its id, return the operation code. */ int CpProfileModelPrivate::activateProfile(int profileId) diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.cpp --- a/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -79,7 +79,7 @@ <1> return QString( "General" ) \n    <2> return QString( "Meeting" ) \n */ -void TestCpProfileModel::testProfileNameWithValidProfileID() +/*void TestCpProfileModel::testProfileNameWithValidProfileID() { CpProfileModel *profileModel = new CpProfileModel(); @@ -90,7 +90,7 @@ QVERIFY( profileName2 == QString("Meeting") ); delete profileModel; -} +}*/ /*! Test Case Description:\n 1. Fucntion Name: QString profileName(int profileId)const; \n @@ -134,7 +134,7 @@ 4. Expected result: \n    \n */ -void TestCpProfileModel::testProfileNames() +/*void TestCpProfileModel::testProfileNames() { CpProfileModel *profileModel = new CpProfileModel(); @@ -146,7 +146,7 @@ QVERIFY( profilesNames.contains("Meeting", Qt::CaseInsensitive)); delete profileModel; -} +}*/ /*! Test Case Description:\n diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.h --- a/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.h Mon Oct 04 00:18:12 2010 +0300 @@ -30,9 +30,9 @@ void testConstructor(); // test the constructor. - void testProfileNameWithValidProfileID(); // test the profileName() function with valid profile ID. + //void testProfileNameWithValidProfileID(); // test the profileName() function with valid profile ID. void testProfileNameWithInvalidProfileID(); // test the profileName() function with invalid profile ID. - void testProfileNames(); // test the profileNames() function. + //void testProfileNames(); // test the profileNames() function. void testActivateProfileWithInvalidID(); //test the activateProfile() function with invalid profile ID. void testActivateProfileWithValidID(); // test the activateProfile() function with valid profile ID. diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/ut_cpprofilemodel.pro --- a/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/ut_cpprofilemodel.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/ut_cpprofilemodel.pro Mon Oct 04 00:18:12 2010 +0300 @@ -47,4 +47,6 @@ # This is for new exporting system coming in garden for(soundfile, soundfiles.sources):BLD_INF_RULES.prj_exports += "./$$soundfile $$deploy.path$$soundfiles.path/$$basename(soundfile)" -} \ No newline at end of file +} + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def --- a/controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def Mon Oct 04 00:18:12 2010 +0300 @@ -4,15 +4,15 @@ ??1CpRingToneView@@UAE@XZ @ 3 NONAME ; CpRingToneView::~CpRingToneView(void) ?getStaticMetaObject@CpRingToneView@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & CpRingToneView::getStaticMetaObject(void) ?handleError@CpRingToneView@@AAEXHABVQString@@@Z @ 5 NONAME ; void CpRingToneView::handleError(int, class QString const &) - ?launchMediaFetcher@CpRingToneView@@AAEXABVQString@@0@Z @ 6 NONAME ; void CpRingToneView::launchMediaFetcher(class QString const &, class QString const &) - ?selError@CpRingToneView@@IAEXHABVQString@@@Z @ 7 NONAME ; void CpRingToneView::selError(int, class QString const &) - ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 8 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *, int) - ?qt_metacall@CpRingToneView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int CpRingToneView::qt_metacall(enum QMetaObject::Call, int, void * *) - ?staticMetaObject@CpRingToneView@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const CpRingToneView::staticMetaObject - ?metaObject@CpRingToneView@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * CpRingToneView::metaObject(void) const - ?tr@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString CpRingToneView::tr(char const *, char const *, int) - ??0CpRingToneView@@QAE@PAVQGraphicsItem@@@Z @ 13 NONAME ; CpRingToneView::CpRingToneView(class QGraphicsItem *) - ?itemActivated@CpRingToneView@@AAEXABVQModelIndex@@@Z @ 14 NONAME ; void CpRingToneView::itemActivated(class QModelIndex const &) + ?selError@CpRingToneView@@IAEXHABVQString@@@Z @ 6 NONAME ; void CpRingToneView::selError(int, class QString const &) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *, int) + ?qt_metacall@CpRingToneView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 8 NONAME ; int CpRingToneView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?staticMetaObject@CpRingToneView@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const CpRingToneView::staticMetaObject + ?metaObject@CpRingToneView@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * CpRingToneView::metaObject(void) const + ?tr@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString CpRingToneView::tr(char const *, char const *, int) + ??0CpRingToneView@@QAE@PAVQGraphicsItem@@@Z @ 12 NONAME ; CpRingToneView::CpRingToneView(class QGraphicsItem *) + ?itemActivated@CpRingToneView@@AAEXABVQModelIndex@@@Z @ 13 NONAME ; void CpRingToneView::itemActivated(class QModelIndex const &) + ?launchMediaFetcher@CpRingToneView@@AAEXABVQString@@0ABV?$QList@VQVariant@@@@ABVXQRequestInfo@@@Z @ 14 NONAME ; void CpRingToneView::launchMediaFetcher(class QString const &, class QString const &, class QList const &, class XQRequestInfo const &) ??_ECpRingToneView@@UAE@I@Z @ 15 NONAME ; CpRingToneView::~CpRingToneView(unsigned int) ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *) ?handleOk@CpRingToneView@@AAEXABVQVariant@@@Z @ 17 NONAME ; void CpRingToneView::handleOk(class QVariant const &) diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpringtoneview/cpringtoneview.pro --- a/controlpanelui/src/cpringtoneview/cpringtoneview.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpringtoneview/cpringtoneview.pro Mon Oct 04 00:18:12 2010 +0300 @@ -26,3 +26,6 @@ TARGET.CAPABILITY = All -TCB TARGET.EPOCALLOWDLLDATA = 1 } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def --- a/controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def Mon Oct 04 00:18:12 2010 +0300 @@ -4,7 +4,7 @@ _ZN14CpRingToneView11qt_metacastEPKc @ 3 NONAME _ZN14CpRingToneView13itemActivatedERK11QModelIndex @ 4 NONAME _ZN14CpRingToneView16staticMetaObjectE @ 5 NONAME DATA 16 - _ZN14CpRingToneView18launchMediaFetcherERK7QStringS2_ @ 6 NONAME + _ZN14CpRingToneView18launchMediaFetcherERK7QStringS2_RK5QListI8QVariantERK13XQRequestInfo @ 6 NONAME _ZN14CpRingToneView19getStaticMetaObjectEv @ 7 NONAME _ZN14CpRingToneView5selOKERK7QString @ 8 NONAME _ZN14CpRingToneView8handleOkERK8QVariant @ 9 NONAME diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp --- a/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -74,22 +74,25 @@ return; } mProcessing = true; - int nRow = index.row(); - + int nRow = index.row(); switch(nRow) { case 0: //no tone, set default no sound - emit selOK(QString("")); - emit aboutToClose(); - break; - case 1: //tone - launchMediaFetcher( "com.nokia.symbian.IToneFetch", "fetch()" ); - break; - case 2: //music - launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()" ); - break; + emit selOK(QString("")); + emit aboutToClose(); + break; + case 1: { //tone + launchMediaFetcher( "com.nokia.symbian.IToneFetch", "fetch()" ); + break; + } + case 2: { //music + XQRequestInfo requestInfo; + requestInfo.setInfo("WindowTitle", QVariant(hbTrId("txt_cp_title_control_panel"))); + launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()", QList(), requestInfo ); + break; + } case 3: //get more tones default: - break; + break; } } void CpRingToneView::handleOk(const QVariant &result) @@ -106,13 +109,21 @@ } -void CpRingToneView::handleError(int errorCode, const QString& errorMessage) +void CpRingToneView::handleError(int errorCode, const QString &errorMessage) { mProcessing = false; emit(selError( errorCode, errorMessage )); } -void CpRingToneView::launchMediaFetcher( const QString &strService, const QString &strItface ) +/*! + Launch media fetcher service. + \a strService, the service interface name. + \a srItface, the service operation name. + \a arguments, the request arguments, preserved. + \a info, the request info. +*/ +void CpRingToneView::launchMediaFetcher( const QString &strService, const QString &strItface,\ + const QList &arguments, const XQRequestInfo &info ) { CPFW_LOG("CpRingToneView::launchMediaFetcher, START"); if(mReq) @@ -133,10 +144,12 @@ connect(mReq, SIGNAL(requestOk(QVariant)), SLOT( handleOk(QVariant)), Qt::QueuedConnection); connect(mReq, SIGNAL(requestError(int, QString)), SLOT(handleError(int, QString))); } - - QList args; - args << QVariant(QString("")); - mReq->setArguments(args); + if (!arguments.isEmpty()) { + mReq->setArguments(arguments); + } + if (info.isValid()) { + mReq->setInfo(info); + } // Make the request if (!mReq->send()) { diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/cpserviceprovider/cpserviceprovider.pro --- a/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Mon Oct 04 00:18:12 2010 +0300 @@ -31,3 +31,6 @@ SERVICE.FILE = service_conf.xml SERVICE.OPTIONS = embeddable SERVICE.OPTIONS += hidden + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/inc/cpprofilemodel.h --- a/controlpanelui/src/inc/cpprofilemodel.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/inc/cpprofilemodel.h Mon Oct 04 00:18:12 2010 +0300 @@ -55,6 +55,7 @@ public: QString profileName(int profileId)const; + void setProfileName(int profileId, const QString &name); QStringList profileNames()const; int activateProfile(int profileId); int activeProfileId() const; diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/inc/cpringtoneview.h --- a/controlpanelui/src/inc/cpringtoneview.h Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/inc/cpringtoneview.h Mon Oct 04 00:18:12 2010 +0300 @@ -47,8 +47,9 @@ //used to mark if there is a request being processed bool mProcessing; -private: - void launchMediaFetcher( const QString &strService, const QString &strItface ); +private: + void launchMediaFetcher( const QString &strService, const QString &strItface, \ + const QList &arguments = QList(), const XQRequestInfo &info = XQRequestInfo() ); }; #endif // CPRINGTONEVIEW_H diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/silenceindicatorplugin/silenceindicatorplugin.pro --- a/controlpanelui/src/silenceindicatorplugin/silenceindicatorplugin.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/silenceindicatorplugin/silenceindicatorplugin.pro Mon Oct 04 00:18:12 2010 +0300 @@ -18,12 +18,12 @@ HEADERS += src/cpsilenceindicatorplugin.h SOURCES += src/cpsilenceindicatorplugin.cpp -TRANSLATIONS = control_panel.ts symbian*::LIBS += -HbCore \ -HbWidgets symbian*: { TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = All -TCB + TARGET.CAPABILITY = ProtServ SwEvent TrustedUI ReadDeviceData + TARGET.UID3 = 0x2002C39F SYMBIAN_PLATFORMS = WINSCW \ ARMV5 diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp --- a/controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp Mon Oct 04 00:18:12 2010 +0300 @@ -80,6 +80,9 @@ const QString &indicatorType) { Q_UNUSED(indicatorType) + // Install localization + HbTranslator translator("control_panel"); + translator.loadCommon(); mEngine = CreateProfileEngineExtended2L(); return this; } @@ -93,26 +96,20 @@ } /*! - The handleInteraction is used launch WLAN list view. + The handleInteraction is used to emit dataChange signal. */ bool CpSilenceIndicatorPlugin::handleInteraction(InteractionType type) { - bool handled = false; - switch (type) { - case InteractionActivated: - // set silence mode or disable silence mode - bool isSilence = false; - TRAP(mError, - isSilence = mEngine->SilenceModeL(); - mEngine->SetSilenceModeL(!isSilence); - ) - emit dataChanged(); - handled = true; - break; - default: - break; - } - return handled; + bool handled = false; + switch (type) { + case InteractionActivated: + emit dataChanged(); + handled = true; + break; + default: + break; + } + return handled; } /*! @@ -124,13 +121,7 @@ bool handled(false); switch (type) { case RequestActivate: - TRAP(mError, mEngine->SetSilenceModeL(true);) - handled = true; - emit dataChanged(); - break; - case RequestDeactivate: - TRAP(mError, mEngine->SetSilenceModeL(false);) handled = true; emit dataChanged(); break; @@ -151,9 +142,9 @@ // this is the statusbar icon, which is shown only when silence mode is on case MonoDecorationNameRole: if (mEngine->SilenceModeL()) { - variant = HbIcon("qtg_status_profile_silent"); + variant = QString("qtg_status_profile_silent"); } else { - variant = HbIcon(); + variant = QString(); } break; default: diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/tonefetcher/tonefetcher.pro --- a/controlpanelui/src/tonefetcher/tonefetcher.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Mon Oct 04 00:18:12 2010 +0300 @@ -60,3 +60,6 @@ libFiles.sources = xqservice.dll libFiles.path = "!:\sys\bin" DEPLOYMENT += libFiles + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro --- a/controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro Fri Sep 17 08:29:50 2010 +0300 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro Mon Oct 04 00:18:12 2010 +0300 @@ -33,3 +33,6 @@ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } + + +symbian:MMP_RULES += SMPSAFE diff -r 5aa7c7ec6b8e -r 3487b2ea501a layers.sysdef.xml --- a/layers.sysdef.xml Fri Sep 17 08:29:50 2010 +0300 +++ b/layers.sysdef.xml Mon Oct 04 00:18:12 2010 +0300 @@ -9,6 +9,9 @@ + + + diff -r 5aa7c7ec6b8e -r 3487b2ea501a package_definition.xml --- a/package_definition.xml Fri Sep 17 08:29:50 2010 +0300 +++ b/package_definition.xml Mon Oct 04 00:18:12 2010 +0300 @@ -1,3 +1,4 @@ + @@ -7,6 +8,9 @@ + + +