--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/aboutplugin.pri Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,30 @@
+#
+# 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 - about
+#
+
+HEADERS += src/cpaboutview.h \
+ src/cpaboutplugin.h \
+ src/cpaboututils.h \
+ src/cpaboutthirdpartyview.h \
+ src/cpaboutopensourceview.h
+
+
+
+SOURCES += src/cpaboutview.cpp \
+ src/cpaboutplugin.cpp \
+ src/cpaboututils.cpp \
+ src/cpaboutthirdpartyview.cpp \
+ src/cpaboutopensourceview.cpp
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/aboutplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,88 @@
+#
+# 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 = cpaboutplugin
+
+LIBS += -lcpframework
+
+symbian {
+ LIBS += -lsysversioninfo \
+ -lsysutil \
+ -lxqutils
+}
+
+TRANSLATIONS = control_panel.ts
+CONFIG += hb plugin
+
+include (aboutplugin.pri)
+include (rom/aboutplugin_rom.pri)
+
+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
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ INCLUDEPATH += $$MOC_DIR
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.UID3 = 0X2002873B
+}
+
+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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/layers.sysdef.xml Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+ <!ENTITY layer_real_source_path "sf/app/settingsuis/controlpanelplugins/aboutplugin" >
+]>
+
+<SystemDefinition name="aboutplugin" schema="1.5.1">
+ <systemModel>
+ <layer name="app_layer">
+ <module name="aboutplugin">
+ <unit unitID="aboutplugin" mrp="" bldFile="&layer_real_source_path;" proFile="aboutplugin.pro" name="aboutplugin" qmakeArgs="-r"/>
+ </module>
+ </layer>
+ </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/rom/aboutplugin.iby Wed Sep 29 10:09:58 2010 +0800
@@ -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 __ABOUTPLUGIN_IBY__
+#define __ABOUTPLUGIN_IBY__
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR\BUILD_DIR\cpaboutplugin.dll SHARED_LIB_DIR\cpaboutplugin.dll
+
+data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpaboutplugin.qtplugin resource\qt\plugins\controlpanel\cpaboutplugin.qtplugin
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/rom/aboutplugin_rom.pri Wed Sep 29 10:09:58 2010 +0800
@@ -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<platform_paths.hrh>" \
+ "rom/aboutplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(aboutplugin.iby)"
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpabout_global.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,27 @@
+/*
+ * 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 CPABOUT_GLOBAL_H
+#define CPABOUT_GLOBAL_H
+
+#ifndef ABOUT_TEST
+ #define ABOUT_TEST_FRIEND_CLASS(aClassName)
+#else
+ #define ABOUT_TEST_FRIEND_CLASS(aClassName) friend class aClassName;
+#endif //ABOUT_TEST
+
+#endif // CPABOUT_GLOBAL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutopensourceview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,61 @@
+/*
+ * 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 "cpaboutopensourceview.h"
+#include "cpaboututils.h"
+#include <HbScrollArea>
+#include <HbGroupBox>
+#include <QGraphicsLinearLayout>
+/*!
+ \class CpAboutOpenSourceView
+*/
+
+/*!
+ Constructor
+*/
+CpAboutOpenSourceView::CpAboutOpenSourceView(QGraphicsItem *parent)
+: HbView(parent)
+{
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->setContentsMargins(0, 0, 0, 0);
+ //view title
+ HbGroupBox *label = new HbGroupBox();
+ label->setHeading(hbTrId("txt_cp_subhead_open_source_software_notices"));
+ layout->addItem(label);
+ for (int i=1; i <=2; ++i) {
+ HbTextEdit *edit = CpAboutUtils::createTextEdit();
+ QString str(CpAboutUtils::contentString(hbTrId("txt_cp_open_source_software_notices_"), i));
+ edit->setHtml(CpAboutUtils::preprocessText(str));
+ layout->addItem(edit);
+ }
+ HbScrollArea* scrollArea = new HbScrollArea();
+ QGraphicsWidget* content = new QGraphicsWidget();
+ content->setLayout(layout);
+ scrollArea->setContentWidget(content);
+ scrollArea->setScrollDirections(Qt::Vertical);
+ setWidget(scrollArea);
+}
+
+/*!
+ Destructor
+*/
+CpAboutOpenSourceView::~CpAboutOpenSourceView()
+{
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutopensourceview.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,33 @@
+/*
+ * 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 CPABOUTOPENSOURCEVIEW_H
+#define CPABOUTOPENSOURCEVIEW_H
+
+#include "cpabout_global.h"
+#include <HbView>
+
+class CpAboutOpenSourceView : public HbView
+{
+ Q_OBJECT
+public:
+ explicit CpAboutOpenSourceView(QGraphicsItem *parent = 0);
+ virtual ~CpAboutOpenSourceView();
+
+private:
+ ABOUT_TEST_FRIEND_CLASS(TestAboutPlugin)
+};
+#endif //CPABOUTOPENSOURCEVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,53 @@
+/*
+ * 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 "cpaboutplugin.h"
+#include "cpaboutview.h"
+#include <cpsettingformentryitemdataimpl.h>
+
+/*!
+ \class CpAboutPlugin
+*/
+
+/*!
+ Constructor
+*/
+CpAboutPlugin::CpAboutPlugin()
+{
+}
+
+/*!
+ Destructor
+*/
+CpAboutPlugin::~CpAboutPlugin()
+{
+}
+
+/*!
+ Creates setting form item data
+*/
+QList<CpSettingFormItemData*> CpAboutPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
+{
+ const QString aboutIconName = "qtg_large_info";
+ return QList<CpSettingFormItemData*>()
+ << new CpSettingFormEntryItemDataImpl<CpAboutView>(
+ itemDataHelper,
+ hbTrId("txt_cp_list_about"),
+ QString(), // shows two liner in list
+ HbIcon(aboutIconName));
+}
+
+Q_EXPORT_PLUGIN2(cpaboutplugin, CpAboutPlugin);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutplugin.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,38 @@
+/*
+ * 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 CPABOUTPLUGIN_H
+#define CPABOUTPLUGIN_H
+
+#include <qobject.h>
+#include <cpplugininterface.h>
+
+#include "cpabout_global.h"
+
+class CpAboutPlugin : public QObject, public CpPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(CpPluginInterface)
+
+public:
+ CpAboutPlugin();
+ virtual ~CpAboutPlugin();
+ virtual QList<CpSettingFormItemData*> createSettingFormItemData(CpItemDataHelper &itemDataHelper) const;
+
+ ABOUT_TEST_FRIEND_CLASS(TestAboutPlugin)
+};
+
+#endif //CPABOUTPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutthirdpartyview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,86 @@
+/*
+ * 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 "cpaboutthirdpartyview.h"
+#include "cpaboututils.h"
+#include <HbScrollArea>
+#include <HbGroupBox>
+#include <QGraphicsLinearLayout>
+#include <QDesktopServices>
+#include <QUrl>
+/*!
+ \class CpAboutThirdPartyView
+*/
+
+/*!
+ Constructor
+*/
+CpAboutThirdPartyView::CpAboutThirdPartyView(QGraphicsItem *parent)
+: HbView(parent)
+{
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ //view titile
+ HbGroupBox *label = new HbGroupBox();
+ label->setHeading(hbTrId("txt_cp_subhead_3rd_party_notices"));
+ layout->addItem(label);
+ //the first text edit contains the icon.
+ HbTextEdit *firstEdit = new HbTextEdit();//CpAboutUtils::createTextEdit();
+ QImage image("c:\\data\\qgn_graf_mup2_visualizer_image.svg");
+ QTextCursor cursor(firstEdit->textCursor());
+ cursor.insertImage(image);
+ QString str = CpAboutUtils::contentString("txt_cp_3rd_party_notices_",1 );
+ str.insert(0, doubleHtmlLineBreak);
+ cursor.insertHtml(str);
+ firstEdit->setTextCursor(cursor);
+ layout->addItem(firstEdit);
+ //2-14 logic string's text edit.
+ for (int i = 2; i<=14; i++ ) {
+ QString content(CpAboutUtils::findAndReplaceWithLink(\
+ CpAboutUtils::contentString("txt_cp_3rd_party_notices_", i)));
+ HbTextEdit *edit = CpAboutUtils::createTextEdit();
+ edit->setHtml(content);
+ connect(edit, SIGNAL(anchorTapped(QString)), this, SLOT(handleLinkClicked(QString)));
+ layout->addItem(edit);
+ }
+
+ HbScrollArea* scrollArea = new HbScrollArea();
+ QGraphicsWidget* contentWidget = new QGraphicsWidget();
+ contentWidget->setLayout(layout);
+ scrollArea->setContentWidget(contentWidget);
+ scrollArea->setScrollDirections(Qt::Vertical);
+ setWidget(scrollArea);
+}
+
+/*!
+ Destructor
+*/
+CpAboutThirdPartyView::~CpAboutThirdPartyView()
+{
+}
+
+/*!
+ Responds to link clicked signal.
+*/
+void CpAboutThirdPartyView::handleLinkClicked(const QString &anchor)
+{
+ if (!anchor.isEmpty() &&
+ !QDesktopServices::openUrl(QUrl(anchor))) {
+ return;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutthirdpartyview.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,38 @@
+/*
+ * 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 CPABOUTTHIRDPARTYVIEW_H
+#define CPABOUTTHIRDPARTYVIEW_H
+
+#include "cpabout_global.h"
+#include <HbView>
+
+class CpAboutThirdPartyView : public HbView
+{
+ Q_OBJECT
+
+public:
+ explicit CpAboutThirdPartyView(QGraphicsItem *parent = 0);
+ virtual ~CpAboutThirdPartyView();
+
+private slots:
+ void handleLinkClicked(const QString &anchor);
+
+private:
+
+ ABOUT_TEST_FRIEND_CLASS(TestAboutPlugin)
+};
+#endif //CPABOUTTHIRDPARTYVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboututils.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,190 @@
+/*
+* 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 "CpAboutUtils.h"
+#include <sysversioninfo.h>
+#include <sysutil.h>
+
+#include <HbTextEdit>
+#include <XQConversions>
+
+/*!
+ Create the readonly text edit.
+*/
+HbTextEdit *CpAboutUtils::createTextEdit()
+{
+ HbTextEdit *edit = new HbTextEdit();
+ edit->setReadOnly(true);
+ edit->setCursorVisibility(Hb::TextCursorHidden);
+ edit->clearContextMenuFlag(Hb::ShowTextContextMenuOnSelectionClicked);
+ edit->clearContextMenuFlag(Hb::ShowTextContextMenuOnLongPress);
+ return edit;
+}
+
+/*!
+ Return the localized string by logic string connecting \a prefixString and
+ \a index
+*/
+QString CpAboutUtils::contentString(const QString &prefixString, int index)
+{
+ QString contentString;
+ QString localization(prefixString);
+ localization.append(QString::number(index));
+ contentString.append(QString(hbTrId(localization.toAscii().constData())));
+ contentString.replace(lineBreak, htmlLineBreak);
+ return contentString;
+}
+
+/*!
+ Returns html link for \a textContent with content text.
+*/
+QString CpAboutUtils::linkHtmlContent(const QString &textContent)
+{
+ QString link(htmlLinkStart);
+ link.append(textContent);
+ link.append(htmlLinkEnd);
+ return link;
+}
+
+/*!
+ Trim the html address \a string, also replace \n with <br>
+ */
+QString CpAboutUtils::preprocessText(const QString &string)
+{
+ QString str(string.trimmed());
+ str.replace(lineBreak, htmlLineBreak);
+ return str;
+}
+
+/*!
+ Replace html link in \a stringwith anchor.
+ */
+QString CpAboutUtils::findAndReplaceWithLink(const QString &string)
+{
+ //stands for the web address.
+ QRegExp regExp("[a-zA-z]+://[^\\s]*");
+
+ QString str(string);
+ if (string.indexOf(regExp) != KErrNotFound) {
+ foreach(const QString &match, regExp.capturedTexts()) {
+ QString originalString(match.trimmed());
+ if (originalString.endsWith('.')) {
+ originalString = originalString.left(originalString.length()-1);
+ }
+ QString replaceString("<a href = \"" + originalString + "\">"+ originalString + "</a>");
+ str.replace(originalString, replaceString);
+ }
+ }
+ return str;
+}
+
+/*!
+ Returns the phone's model.
+*/
+QString CpAboutUtils::getPhoneModel()
+{
+ TBuf<100> phoneName;
+ TInt error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EModelVersion, phoneName);
+ QString model;
+ if (error == KErrNone) {
+ if (phoneName.Length() > 0) {
+ model = XQConversions::s60DescToQString(phoneName);
+
+ }
+ }
+ return model;
+}
+
+/*!
+ Returns the produce release.
+*/
+QString CpAboutUtils::getProductRelease()
+{
+
+ TBuf<sysUtilVersionTextLength> productRelease;
+ productRelease.Zero();
+ QString release;
+ if (SysUtil::GetPRInformation(productRelease) == KErrNone) {
+ release = XQConversions::s60DescToQString(productRelease);
+ }
+ return release;
+}
+
+/*!
+ Returns the software version.
+*/
+QString CpAboutUtils::getSoftwareVersion()
+{
+ TBuf<sysUtilVersionTextLength> swVersion;
+ TBuf<sysUtilVersionTextLength> version;
+ swVersion.Zero();
+ version.Zero();
+ QString versionText;
+ if (SysUtil::GetSWVersion(version) == KErrNone) {
+ TInt len = version.Length();
+ TInt pos1 = version.Find(KEol);
+ if (pos1 != KErrNotFound && len > pos1) {
+ TBuf<sysUtilVersionTextLength> version1;
+ version1.Zero();
+ swVersion.Append(version.Left(pos1));
+ versionText = XQConversions::s60DescToQString(swVersion);
+ }
+ }
+ return versionText;
+}
+
+/*!
+ Returns the phone type.
+*/
+QString CpAboutUtils::getPhoneType()
+{
+ TBuf<sysUtilVersionTextLength> swVersion;
+ TBuf<sysUtilVersionTextLength> swVersionDate;
+ TBuf<sysUtilVersionTextLength> typeDesignator;
+ TBuf<sysUtilVersionTextLength> version;
+ swVersion.Zero();
+ version.Zero();
+ typeDesignator.Zero();
+ swVersionDate.Zero();
+ QString type;
+ if (SysUtil::GetSWVersion(version) == KErrNone) {
+ TInt len = version.Length();
+ TInt pos1 = version.Find(KEol);
+ if (pos1 != KErrNotFound && len > pos1) {
+ TBuf<sysUtilVersionTextLength> version1;
+ version1.Zero();
+ swVersion.Append(version.Left(pos1));
+ version1.Append(version.Right(len - pos1 - 1));
+ len = version1.Length();
+ pos1 = version1.Find(KEol);
+ if (pos1 != KErrNotFound && len > pos1) {
+ swVersionDate.Append(version1.Left(pos1));
+ version.Zero();
+ version.Append(version1.Right(len - pos1 - 1));
+ len= version.Length();
+ pos1 = version.Find(KEol);
+ if (pos1 != KErrNotFound && len > pos1 ) {
+ typeDesignator.Append(version.Left(pos1));
+ if (typeDesignator.Length() > 0) {
+ type = XQConversions::s60DescToQString(typeDesignator);
+ }
+ }
+ }
+ }
+ }
+ return type;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboututils.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CPABOUTUTILS_H
+#define CPABOUTUTILS_H
+
+#include <QString>
+#include <QChar>
+#include <HbTextEdit>
+
+//for Qt
+const QChar lineBreak = '\n';
+const QString htmlLineBreak = "<br>";
+const QString doubleHtmlLineBreak = "<br><br>";
+const QString htmlLinkStart("<a href=\"link\">");
+const QString htmlLinkEnd("</a>");
+const TInt sysUtilVersionTextLength = 128;
+//for Symbian
+_LIT(KEol, "\n");
+
+class CpAboutUtils
+{
+public:
+ static HbTextEdit *createTextEdit();
+ static QString contentString(const QString &prefixString, int index);
+ static QString linkHtmlContent(const QString &textContent);
+ static QString findAndReplaceWithLink(const QString &string);
+ static QString preprocessText(const QString &string);
+ static QString getPhoneModel();
+ static QString getProductRelease();
+ static QString getSoftwareVersion();
+ static QString getPhoneType();
+};
+
+#endif /* CPABOUTUTILS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,170 @@
+/*
+ * 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 "cpaboutview.h"
+#include "cpaboutthirdpartyview.h"
+#include "cpaboutopensourceview.h"
+#include "cpaboututils.h"
+#include <hbgroupbox.h>
+#include <HbMainWindow>
+#include <HbInstance>
+#include <HbAction>
+#include <HbScrollArea>
+#include <QGraphicsLinearLayout>
+#include <HbParameterLengthLimiter>
+
+/*!
+ \class CpAboutView
+*/
+
+/*!
+ Constructor
+*/
+CpAboutView::CpAboutView(QGraphicsItem *parent)
+: CpBaseSettingView(0, parent),
+ mThirdPartyView(0),
+ mThirdPartyBackAction(0),
+ mOpenSourceView(0),
+ mOpenSourceBackAction(0)
+{
+ //application title
+ setTitle(hbTrId("txt_cp_title_control_panel"));
+ //view layout
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->setContentsMargins(0, 0, 0, 0);
+ //view's title
+ HbGroupBox *label = new HbGroupBox();
+ label->setHeading(hbTrId("txt_cp_subhead_about"));
+ layout->addItem(label);
+
+ //phone model
+ QString phoneInfo(HbParameterLengthLimiter("txt_cp_subhead_device_model").arg(\
+ CpAboutUtils::getPhoneModel()));
+ phoneInfo.append(doubleHtmlLineBreak);
+ //product release
+ phoneInfo.append(hbTrId("txt_cp_subhead_product_release"));
+ phoneInfo.append(htmlLineBreak);
+ phoneInfo.append(HbParameterLengthLimiter("txt_cp_info_product_release").arg(\
+ CpAboutUtils::getProductRelease()));
+ phoneInfo.append(doubleHtmlLineBreak);
+ //software version
+ phoneInfo.append(hbTrId("txt_cp_subhead_software_version"));
+ phoneInfo.append(htmlLineBreak);
+ phoneInfo.append(HbParameterLengthLimiter("txt_cp_info_software_vesion").arg(\
+ CpAboutUtils::getSoftwareVersion()));
+ phoneInfo.append(doubleHtmlLineBreak);
+ //produce type
+ phoneInfo.append(hbTrId("txt_cp_subhead_type"));
+ phoneInfo.append(htmlLineBreak);
+ phoneInfo.append(HbParameterLengthLimiter("txt_cp_info_type").arg(\
+ CpAboutUtils::getPhoneType()));
+ //first text edit for showing phone and release info
+ HbTextEdit *first = CpAboutUtils::createTextEdit();
+ first->setHtml(CpAboutUtils::preprocessText(phoneInfo));
+ layout->addItem(first);
+ //second text edit for showing nokia copy right.
+ HbTextEdit *second = CpAboutUtils::createTextEdit();
+ QString info(hbTrId("txt_cp_info_1"));
+ second->setHtml(CpAboutUtils::preprocessText(info));
+ layout->addItem(second);
+ //thirdParty content.
+ HbTextEdit *thirdParty = CpAboutUtils::createTextEdit();
+ thirdParty->setHtml(CpAboutUtils::linkHtmlContent(hbTrId("txt_cp_3rd_party_notices")));
+ layout->addItem(thirdParty);
+ connect(thirdParty, SIGNAL(anchorTapped(QString)), this, SLOT(openThirdPartyView()));
+ //Open source notices
+ HbTextEdit *openSourceEdit = CpAboutUtils::createTextEdit();
+ openSourceEdit->setHtml(CpAboutUtils::linkHtmlContent(hbTrId("txt_cp_open_source_software_notices")));
+ layout->addItem(openSourceEdit);
+ connect(openSourceEdit, SIGNAL(anchorTapped(QString)), this, SLOT(openOpenSourceView()));
+
+ HbScrollArea* scrollArea = new HbScrollArea();
+ QGraphicsWidget* widget = new QGraphicsWidget();
+ widget->setLayout(layout);
+ scrollArea->setContentWidget(widget);
+ scrollArea->setScrollDirections(Qt::Vertical);
+ setWidget(scrollArea);
+}
+
+/*!
+ Destructor
+*/
+CpAboutView::~CpAboutView()
+{
+ // delete mModel;
+ delete mThirdPartyBackAction;
+ delete mOpenSourceBackAction;
+}
+
+/*!
+ Opens the third party view
+*/
+void CpAboutView::openThirdPartyView()
+{
+ HbMainWindow *mainWindow = hbInstance->allMainWindows().first();
+ mThirdPartyView = new CpAboutThirdPartyView();
+ mainWindow->addView(mThirdPartyView);
+
+ mThirdPartyBackAction = new HbAction(Hb::BackNaviAction);
+ mThirdPartyView->setNavigationAction(mThirdPartyBackAction);
+ connect(mThirdPartyBackAction, SIGNAL(triggered()),
+ this, SLOT(handleThirdPartyViewBackAction()));
+
+ mThirdPartyView->setTitle(hbTrId("txt_cp_title_control_panel"));
+
+ mainWindow->setCurrentView(mThirdPartyView);
+}
+
+/*!
+ Opens the open source view
+*/
+void CpAboutView::openOpenSourceView()
+{
+ HbMainWindow *mainWindow = hbInstance->allMainWindows().first();
+
+ mOpenSourceView = new CpAboutOpenSourceView();
+ mainWindow->addView(mOpenSourceView);
+
+ mOpenSourceBackAction = new HbAction(Hb::BackNaviAction);
+ mOpenSourceView->setNavigationAction(mOpenSourceBackAction);
+ connect(mOpenSourceBackAction, SIGNAL(triggered()),
+ this, SLOT(handleOpenSourceViewBackAction()));
+
+ mOpenSourceView->setTitle(hbTrId("txt_cp_title_control_panel"));
+
+ mainWindow->setCurrentView(mOpenSourceView);
+}
+
+/*!
+ Handles the back action from Third Party view
+*/
+void CpAboutView::handleThirdPartyViewBackAction()
+{
+ HbMainWindow *mainWindow = hbInstance->allMainWindows().first();
+ mainWindow->removeView(mThirdPartyView);
+ mThirdPartyView->deleteLater();
+}
+
+/*!
+ Handles the back action from Open Source view
+*/
+void CpAboutView::handleOpenSourceViewBackAction()
+{
+ HbMainWindow *mainWindow = hbInstance->allMainWindows().first();
+ mainWindow->removeView(mOpenSourceView);
+ mOpenSourceView->deleteLater();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/src/cpaboutview.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+#ifndef CPABOUTVIEW_H
+#define CPABOUTVIEW_H
+
+#include <cpbasesettingview.h>
+#include "cpabout_global.h"
+
+class CpAboutThirdPartyView;
+class CpAboutOpenSourceView;
+
+class CpAboutView : public CpBaseSettingView
+{
+ Q_OBJECT
+
+public:
+ explicit CpAboutView(QGraphicsItem *parent = 0);
+ virtual ~CpAboutView();
+
+private slots:
+ void openThirdPartyView();
+ void openOpenSourceView();
+ void handleThirdPartyViewBackAction();
+ void handleOpenSourceViewBackAction();
+
+private:
+ CpAboutThirdPartyView *mThirdPartyView;
+ HbAction *mThirdPartyBackAction;
+ CpAboutOpenSourceView *mOpenSourceView;
+ HbAction *mOpenSourceBackAction;
+ ABOUT_TEST_FRIEND_CLASS(TestAboutPlugin)
+};
+#endif //CPABOUTVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/t_aboutplugin/inc/t_aboutplugin.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,55 @@
+/*
+* 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 About plugin
+*
+*/
+
+#ifndef T_CPABOUTPLUGIN_H
+#define T_CPABOUTPLUGIN_H
+
+#include <QtTest/QtTest>
+
+class CpAboutPlugin;
+
+/**
+* TestAboutPlugin
+*/
+class TestAboutPlugin : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+
+ // CpAboutPlugin
+ void testCreateSettingFormItemData();
+
+ // CpAboutView
+ void testCpAboutView();
+ void testCpAboutViewOpenThirdPartyView();
+ void testCpAboutViewOpenOpenSourceView();
+
+ //CpAboutThirdPartyView
+ void testCpAboutThirdPartyView();
+
+ //CpAboutOpenSourceView
+ void testCpAboutOpenSourceView();
+
+private:
+ CpAboutPlugin *mPlugin;
+
+};
+
+#endif // T_CPABOUTPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/t_aboutplugin/src/t_aboutplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,144 @@
+/*
+* 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: Main test class for about plugin library.
+*
+*/
+
+
+#include <QtTest/QtTest>
+#include "t_aboutplugin.h"
+#include "cpaboutplugin.h"
+#include "cpaboutview.h"
+#include "cpaboutthirdpartyview.h"
+#include "cpaboutopensourceview.h"
+#include <xqsysinfo.h>
+
+#include <CpItemDataHelper.h>
+#include <hbInstance>
+#include <QEvent>
+#include <QGraphicsSceneMouseEvent>
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::init()
+{
+ mPlugin = new CpAboutPlugin;
+ QVERIFY(mPlugin);
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::cleanup()
+{
+ if (mPlugin) {
+ delete mPlugin;
+ mPlugin = 0;
+ QVERIFY(mPlugin == 0);
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::testCreateSettingFormItemData()
+{
+ CpItemDataHelper itemDataHelper;
+ QList<CpSettingFormItemData*> itemData = mPlugin->createSettingFormItemData(itemDataHelper);
+ QVERIFY(itemData.count() == 1);
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::testCpAboutView()
+{
+ CpAboutView *view = new CpAboutView();
+ QVERIFY(view);
+ delete view;
+ view = 0;
+ QVERIFY(view == 0);
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::testCpAboutViewOpenThirdPartyView()
+{
+ CpAboutView *view = new CpAboutView();
+ QVERIFY(view);
+
+ HbMainWindow *mainWindow = new HbMainWindow();
+ mainWindow->addView(view);
+
+ view->openThirdPartyView();
+ const QString title = hbTrId("txt_cp_title_control_panel");
+ QVERIFY(view->mThirdPartyView->title() == title);
+ view->handleThirdPartyViewBackAction();
+
+ delete view;
+ view = 0;
+ QVERIFY(view == 0);
+ delete mainWindow;
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::testCpAboutViewOpenOpenSourceView()
+{
+ CpAboutView *view = new CpAboutView();
+ QVERIFY(view);
+
+ HbMainWindow *mainWindow = new HbMainWindow();
+ mainWindow->addView(view);
+
+ view->openOpenSourceView();
+ const QString title = hbTrId("txt_cp_title_control_panel");
+ QVERIFY(view->mOpenSourceView->title() == title);
+ view->handleOpenSourceViewBackAction();
+
+ delete view;
+ view = 0;
+ QVERIFY(view == 0);
+ delete mainWindow;
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+
+void TestAboutPlugin::testCpAboutThirdPartyView()
+{
+ CpAboutThirdPartyView *view = new CpAboutThirdPartyView();
+ QVERIFY(view);
+ delete view;
+ view = 0;
+ QVERIFY(view == 0);
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void TestAboutPlugin::testCpAboutOpenSourceView()
+{
+ CpAboutOpenSourceView *view = new CpAboutOpenSourceView();
+ QVERIFY(view);
+ delete view;
+ view = 0;
+ QVERIFY(view == 0);
+}
+QTEST_MAIN(TestAboutPlugin)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pri Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,32 @@
+#
+# 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 About plugin
+#
+
+HEADERS += ./inc/t_aboutplugin.h \
+ ../src/cpaboutplugin.h \
+ ../src/cpaboutview.h \
+ ../src/cpaboutthirdpartyview.h \
+ ../src/cpaboutopensourceview.h \
+ ../src/cpabout_global.h \
+ ../src/cpaboututils.h
+
+SOURCES += ./src/t_aboutplugin.cpp \
+ ../src/cpaboutplugin.cpp \
+ ../src/cpaboutview.cpp \
+ ../src/cpaboutthirdpartyview.cpp \
+ ../src/cpaboutopensourceview.cpp \
+ ../src/cpaboututils.cpp
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -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: tests for About plugin
+#
+
+TEMPLATE = app
+
+CONFIG += debug_and_release
+
+QT += testlib
+
+symbian {
+ LIBS += -lsysversioninfo \
+ -lsysutil \
+ -lxqutils
+}
+
+CONFIG(debug, debug|release) {
+ DESTDIR = ./debug
+} else {
+ DESTDIR = ./release
+}
+
+symbian: LIBS += -lcpframework
+CONFIG += hb
+
+INCLUDEPATH += ./inc
+
+
+
+DEPENDPATH += ./inc \
+ ./src \
+ ../inc \
+ ../src
+
+DEFINES += ABOUT_TEST
+
+symbian {
+ TARGET.UID3 = 0x2002BCD5
+ TARGET.CAPABILITY = CAP_APPLICATION AllFiles
+}
+symbian:MMP_RULES += SMPSAFE
+include(t_aboutplugin.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/data/cplanguagepluginlog.conf Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/languageplugin.pri Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/languageplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -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.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/languageplugin.qrc Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/logconf" >
+ <file alias="cplanguagepluginlog.conf">data/cplanguagepluginlog.conf</file>
+ </qresource>
+</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/layers.sysdef.xml Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+ <!ENTITY layer_real_source_path "sf/app/settingsuis/controlpanelplugins/langandregplugin" >
+]>
+
+<SystemDefinition name="langandregplugin" schema="1.5.1">
+ <systemModel>
+ <layer name="app_layer">
+ <module name="langandregplugin">
+ <unit unitID="langandregplugin" mrp="" bldFile="&layer_real_source_path;" proFile="languageplugin.pro" name="langandregplugin" qmakeArgs="-r"/>
+ </module>
+ </layer>
+ </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/rom/languageplugin.iby Wed Sep 29 10:09:58 2010 +0800
@@ -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 <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/rom/languageplugin_rom.pri Wed Sep 29 10:09:58 2010 +0800
@@ -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<platform_paths.hrh>" \
+ "rom/languageplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(languageplugin.iby)"
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguageplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QPointer>
+#include <HbLocaleUtil.h>
+#include <cpsettingformentryitemdataimpl.h>
+#include "cplanguagepluginlog.h"
+
+
+#ifdef ENABLE_CPLANG_LOG
+ INIT_LOGGER (CPLANG_LOGGER_NAME,CPLANG_LOGGER_CONFIG_PATH)
+#endif
+
+static QPointer<CpSettingFormItemData> g_pluginEntryItemData;
+
+/*!
+ * Constructor
+ */
+CpLanguagePlugin::CpLanguagePlugin()
+{
+ CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::CpLanguagePlugin")
+}
+
+/*!
+ * Destructor
+ */
+CpLanguagePlugin::~CpLanguagePlugin()
+{
+ CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::~CpLanguagePlugin")
+}
+
+/*!
+ * Overide CpPluginInterface::createSettingFormItemData
+ */
+QList<CpSettingFormItemData*> CpLanguagePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
+{
+ CPLANG_LOG_FUNC_ENTRY("CpLanguagePlugin::createSettingFormItemData")
+
+ g_pluginEntryItemData = new CpSettingFormEntryItemDataImpl<CpLanguageView>(
+ CpSettingFormEntryItemData::ListEntryItem,
+ itemDataHelper,
+ hbTrId("txt_cp_dblist_language_and_region"),
+ QString(),
+ "qtg_large_language" );
+
+ updateEntryItem();
+
+ return QList<CpSettingFormItemData*>() << 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguageplugin.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QObject.h>
+#include <cpplugininterface.h>
+#include "cplanguageplugin_global.h"
+
+class CpLanguagePlugin : public QObject, public CpPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(CpPluginInterface)
+public:
+ CpLanguagePlugin();
+ virtual ~CpLanguagePlugin();
+ virtual QList<CpSettingFormItemData*> createSettingFormItemData(CpItemDataHelper &itemDataHelper) const;
+public:
+ static void updateEntryItem();
+};
+
+#endif // CPLANGUAGEPLUGIN_H
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguageplugin_global.h Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguagepluginlog.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QLatin1String>
+#include <logger.h>
+
+#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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguagepluginutil.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QLocale>
+#include <hblocaleutil.h>
+#include "cplanguagepluginlog.h"
+#include <hbinputsettingproxy>
+
+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<HbInputLanguage> &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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguagepluginutil.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QStringList>
+#include <QList>
+#include <hbinputlanguage.h>
+
+class CpLanguagePluginUtil
+{
+public:
+ static QStringList localizedLanguageNames(const QStringList &languageNames);
+ static QStringList localizedRegionNames(const QStringList ®ionNames);
+ static QStringList localizedInputLanguageNames(const QList<HbInputLanguage> &inputLanguages);
+ static bool isChineseVariant();
+private:
+ CpLanguagePluginUtil();
+ Q_DISABLE_COPY(CpLanguagePluginUtil)
+};
+
+#endif
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguageview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QDebug>
+#include <QStringList>
+#include <QLocale>
+#include <QDir>
+#include <QPluginLoader>
+#include <hbdataform.h>
+#include <hbdataformmodel.h>
+#include <hbmessagebox.h>
+#include <cpsettingformentryitemdata.h>
+#include <ClockSettingsViewInterface>
+#include <hbinpututils.h>
+#include <hbinputsettingproxy>
+#include <hblocaleutil.h>
+#include <starterclient.h>
+#include <hbdevicemessagebox>
+#include <hbaction.h>
+#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<HbDataForm*>(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<HbDataFormModelItem::DataItemType>(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<ClockSettingsViewInterface*>(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<LanguageRegionMapping*>(&setting);
+ }
+ }
+
+ CPLANG_LOG("Not found.")
+
+ return 0;
+}
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/cplanguageview.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QList>
+#include <QStringList>
+#include <cpbasesettingview.h>
+#include <hbinputlanguage.h>
+#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<LanguageRegionMapping> mLanguageRegionMapping;
+
+ LanguageRegionMapping mPreviousSetting;
+ LanguageRegionMapping mCurrentSetting;
+
+ HbDataFormModel *mModel;
+
+ QList<HbDataFormModelItem*> mLanguagePages;
+ HbDataFormModelItem *mCurrentLanguagePage;
+
+ //Current items
+ HbDataFormModelItem *mCurrentRegionItem;
+ HbDataFormModelItem *mCurrentPrimaryInputLanguageItem;
+ HbDataFormModelItem *mCurrentSecondaryInputLanguageItem;
+
+ QList<HbInputLanguage> mPrimaryInputLanguages;
+ QList<HbInputLanguage> mSecondaryInputLanguages;
+ QStringList mSupportedLanguages;
+ QStringList mSupportedRegions;
+
+ QPluginLoader *mClockPluginLoader;
+
+ bool mChineseVariant;
+
+ LANGUAGEPLUGIN_TEST_FRIEND_CLASS(TestLanguagePlugin)
+};
+#endif //CPLANGUAGEVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/extendedlocaleutil.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QFile>
+#include <QTextStream>
+#include <QStringList>
+
+#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<LanguageRegionMapping> ExtendedLocaleUtil::localeMappings(bool onlySupported)
+{
+ CPLANG_LOG_FUNC_ENTRY("ExtendedLocaleUtil::localeMappings")
+
+ QList<LanguageRegionMapping> mps = allLocaleMappings();
+
+ if (!onlySupported) {
+ return mps;
+ }
+
+ QList<LanguageRegionMapping> 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<LanguageRegionMapping*>(&mps.at(i));
+ break;
+ }
+ }
+ if (found) {
+ supportedmps.append(*found);
+ }
+ else {
+ LanguageRegionMapping map;
+ map.languageId = language;
+ map.primaryWritingLan = HbInputLanguage(QLocale(language).language());
+ }
+
+ }
+
+ return supportedmps;
+}
+
+QList<LanguageRegionMapping> ExtendedLocaleUtil::allLocaleMappings()
+{
+ CPLANG_LOG_FUNC_ENTRY("ExtendedLocaleUtil::allLocaleMappings")
+
+ QList<LanguageRegionMapping> 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;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/src/extendedlocaleutil.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 <hblocaleutil.h>
+#include <hbinputlanguage.h>
+
+/*
+ * 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<LanguageRegionMapping> localeMappings(bool onlySupported);
+ private:
+ static QList<LanguageRegionMapping> allLocaleMappings();
+ };
+
+#endif /* EXTENDEDLOCALEUTIL_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/t_languageplugin/inc/t_languageplugin.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QtTest/QtTest>
+#include <HbInputLanguage>
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/t_languageplugin/src/t_languageplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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 <QtTest/QtTest>
+#include <QModelIndex>
+#include <hbmainwindow.h>
+#include <hbinputsettingproxy.h>
+#include <hblocaleutil.h>
+#include <hbinpututils.h>
+#include <cpsettingformentryitemdataimpl.h>
+#include <cpitemdatahelper.h>
+#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<CpSettingFormItemData*> itemData = mPlugin->createSettingFormItemData(itemDataHelper);
+ mEntryItemData = qobject_cast<CpSettingFormEntryItemData*>(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<CpSettingFormItemData*> itemData = mPlugin->createSettingFormItemData(itemDataHelper);
+ QVERIFY(itemData.count() == 1);
+
+ CpSettingFormEntryItemData *entryItemData = qobject_cast<CpSettingFormEntryItemData*>(itemData.front());
+ QVERIFY(entryItemData != 0);
+ QVERIFY(entryItemData->type() == static_cast<HbDataFormModelItem::DataItemType>(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<LanguageRegionMapping> allMaps = ExtendedLocaleUtil::localeMappings(false);
+ QVERIFY(allMaps.count() > 0);
+
+ QList<LanguageRegionMapping> 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<HbInputLanguage> 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<HbInputLanguage> 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<HbInputLanguage> 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<HbInputLanguage> 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<HbInputLanguage> 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<HbInputLanguage> 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/t_languageplugin/t_languageplugin.pri Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/langandregplugin/t_languageplugin/t_languageplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -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 )
+
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -39,7 +39,9 @@
QObject(p),
mCurrentTheme(0)
{
- connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished()));
+ if(hbInstance->theme()) {
+ connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished()));
+ }
setCurrentTheme();
}
@@ -73,8 +75,7 @@
if(mCurrentTheme && mCurrentTheme->name() == themeName) {
return;
- }
- else {
+ } else {
//buildThemeInfo creates new theme info.
CpThemeInfo* tmpTheme = CpThemeUtil::buildThemeInfo(HbThemeServices::themePath(), themeName);
@@ -92,15 +93,15 @@
/*!
Change a theme. Returns true on success, false otherwise.
*/
-bool CpThemeChanger::changeTheme(const QString& newTheme)
+bool CpThemeChanger::changeTheme(const CpThemeInfo& newTheme)
{
bool result = false;
// Skip doing this if the request is for the current theme
- if (newTheme.isEmpty() || newTheme == mCurrentTheme->name()) {
+ if (newTheme.name().isEmpty() || (mCurrentTheme && newTheme.name() == mCurrentTheme->name())) {
return result;
}
- QString themePath = CpThemeUtil::themePath(newTheme);
+ QString themePath = newTheme.itemData();
if(!themePath.isEmpty()) {
HbThemeServices::setTheme(themePath);
@@ -124,9 +125,7 @@
*/
void CpThemeChanger::changeFinished()
{
-
setCurrentTheme();
-
emit themeChangeFinished();
}
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Wed Sep 29 10:09:58 2010 +0800
@@ -39,12 +39,12 @@
~CpThemeChanger();
const CpThemeInfo* currentTheme() const;
- bool changeTheme(const QString& newtheme);
+ bool changeTheme(const CpThemeInfo& newtheme);
signals:
void themeChangeFinished();
-public slots:
+private slots:
void changeFinished();
private:
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -17,12 +17,9 @@
/*!
\class CpThemeControl
- \brief CpThemeControl creates and controls two views for Theme Changer plugin and handles
+ \brief CpThemeControl creates and controls views for Theme Changer plugin and handles
user interaction to preview and change the themes.
- It creates a list view of the themes. When a list item is selected, it creates a preview
- of the theme icon using a CpThemePreview class.
-
This class also connects to the theme server using the HbThemeChanger and sets the theme
based on user interaction with the views.
@@ -43,32 +40,19 @@
#include "cpthemecontrol.h"
#include "cpthemelistview.h"
-#include "cpthemepreview.h"
#include "cpthemeinfo.h"
#include "cpthemelistmodel.h"
#include <hbdialog.h>
#include <hblabel.h>
-
-/*!
- Helper function to fetch the main window.
-*/
-
-static HbMainWindow *mainWindow()
-{
- QList< HbMainWindow* > mainWindows = hbInstance->allMainWindows();
- if (!mainWindows.isEmpty()) {
- return mainWindows.front();
- }
- return 0;
-}
+//time out time before showing a processing dialog.
+static const int KThemeChangeTimeOutMilliSeconds = 2000;
/*!
constructor.
*/
CpThemeControl::CpThemeControl(): mThemeListView(0),
- mThemePreview(0),
mThemeChanger(0),
mListModel(0),
mThemeChangeFinished(false),
@@ -88,7 +72,7 @@
/*!
- destorys the list view, preview and theme changer objects.
+ destorys the list view and theme changer objects.
*/
CpThemeControl::~CpThemeControl()
{
@@ -98,16 +82,12 @@
delete mThemeChanger;
mThemeChanger = 0;
- delete mThemePreview;
- mThemePreview = 0;
-
delete mWaitDialog;
mWaitDialog = 0;
}
/*!
- Creates the theme list view. Gets the themes, creates a model based on
- theme names, icons, and icon paths and sets the list model.
+ Creates the theme list view. Gets the themes, creates a model and sets the list model.
*/
void CpThemeControl::createThemeList()
{
@@ -120,14 +100,14 @@
// Set the model for theme list.
mThemeListView->setModel(mListModel);
- mThemeListView->themeList()->setSelectionMode(HbAbstractItemView::SingleSelection);
setActiveThemeIndex();
+ //connect to signal for selecting a list item.
+ connect(mThemeListView,SIGNAL(newThemeSelected(QModelIndex)),
+ this,SLOT(newThemeSelected(QModelIndex)));
- //connect to signal for selecting a list item.
- connect(mThemeListView,SIGNAL(newThemeSelected(const QModelIndex&)),
- this,SLOT(newThemeSelected(const QModelIndex&)));
+ connect(mThemeListView, SIGNAL(oviClicked()), this, SLOT(getOviTheme()));
//handle signal for list view closing. (e.g Back softkey pressed)
connect(mThemeListView,SIGNAL(aboutToClose()),
@@ -188,83 +168,35 @@
//theme even though another list item is selected.
setActiveThemeIndex();
- // Figure out whether this is a URI and appropriately delegate
- data = index.data(CpThemeListModel::ItemTypeRole);
- if(data.isValid() && data.canConvert<CpThemeInfo::ThemeListItemType>()) {
-
- CpThemeInfo::ThemeListItemType type = data.value<CpThemeInfo::ThemeListItemType>();
-
- switch (type) {
- case CpThemeInfo::ThemeListItemType_URL:
- //get the URL
- data = index.data(CpThemeListModel::ItemDataRole);
- if(data.isValid()) {
- QString url = data.toString();
- // Launch the URL in the browser and
- // continue to Preview if not successful
- if (QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode))) {
- return;
- }
- }
- break;
-
- case CpThemeInfo::ThemeListItemType_APP:
- break;
-
- default:
- // do nothing
- qt_noop();
- }
- }
-
//get the theme name.
data = index.data(Qt::DisplayRole);
if(data.isValid()) {
themeInfo.setName(data.toString());
}
- //get theme icon.
- data = index.data(Qt::DecorationRole);
+ //get theme path
+ data = index.data(CpThemeListModel::ItemDataRole);
if(data.isValid()) {
- themeInfo.setIcon(data.value<HbIcon>());
- }
-
- data = index.data(CpThemeListModel::PortraitPreviewRole);
- if(data.isValid()) {
- themeInfo.setPortraitPreviewIcon(data.value<HbIcon>());
- }
-
- data = index.data(CpThemeListModel::LandscapePreviewRole);
- if(data.isValid()) {
- themeInfo.setLandscapePreviewIcon(data.value<HbIcon>());
+ themeInfo.setItemData(data.toString());
}
- //Set up the theme preview and set it to
- //the current view of main window.
- HbMainWindow* mWindow = ::mainWindow();
-
- if(!mThemePreview){
- mThemePreview = new CpThemePreview(themeInfo);
- mWindow->addView(mThemePreview);
-
- connect(mThemePreview,SIGNAL(aboutToClose()),
- this, SLOT(previewClosed()));
+ applyTheme(themeInfo);
+
+}
- connect(mThemePreview, SIGNAL(applyTheme(const QString&)),
- this, SLOT(themeApplied(const QString&)));
- } else {
- mThemePreview->setThemeInfo(themeInfo);
- }
- mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel"));
-
- mWindow->setCurrentView(mThemePreview);
-
+void CpThemeControl::getOviTheme()
+{
+ QString url = QString("http://lr.ovi.mobi/store/themes");
+ // Launch the URL in the browser and
+ // continue to Preview if not successful
+ QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode));
+
}
/*!
Slot called when a Select key is pressed in theme preview view.
*/
-void CpThemeControl::themeApplied(const QString& theme)
+void CpThemeControl::applyTheme(const CpThemeInfo& theme)
{
QThread::currentThread()->setPriority(QThread::HighPriority);
@@ -273,36 +205,17 @@
//Start a timer. If theme change takes more than 1 seconds,
//we will show a dialog (mWaitDialog) until theme change
//is done (themeChangeFinished is called).
- QTimer::singleShot(1000, this, SLOT(themeWaitTimeout()));
+ QTimer::singleShot(KThemeChangeTimeOutMilliSeconds, this, SLOT(themeWaitTimeout()));
mThemeChangeFinished = false;
} else {
//theme change failed, go back to control panel.
- previewClosed();
- triggerThemeListClose();
+ setActiveThemeIndex();
}
}
/*!
- Slot called when the theme preview view is closed.
-*/
-void CpThemeControl::previewClosed()
-{
- //The theme preview closed, go back
- //to theme list view.
- HbMainWindow* mainWindow = ::mainWindow();
- mainWindow->removeView(mThemePreview);
- mThemePreview->deleteLater();
- mThemePreview = 0;
-
- //reset the current index to active theme, so that the selection remains on current
- //theme even though another list item is selected.
- setActiveThemeIndex();
- mainWindow->setCurrentView(mThemeListView);
-}
-
-/*!
Slot for when the theme list view is closed. Ownership of the theme list was given to
control panel, so the class won't delete it.
@@ -310,9 +223,6 @@
void CpThemeControl::themeListClosed()
{
mThemeListView = 0;
-
- delete mThemePreview;
- mThemePreview = 0;
}
/*!
@@ -331,12 +241,7 @@
if(mWaitDialog && mWaitDialog->isVisible()) {
mWaitDialog->hide();
}
-
- previewClosed();
- //ask the themelistview to close. Control Panel will
- //take care of removing it from window.
- triggerThemeListClose();
-
+ setActiveThemeIndex();
QThread::currentThread()->setPriority(QThread::NormalPriority);
}
@@ -344,16 +249,15 @@
{
//If after this timeOut, theme change is still in progress,
//show a processing dialog.
- if(!mThemeChangeFinished)
- {
+ if(!mThemeChangeFinished){
if(!mWaitDialog) {
mWaitDialog = new HbDialog();
mWaitDialog->setDismissPolicy(HbPopup::NoDismiss);
mWaitDialog->setModal(false);
mWaitDialog->setTimeout(HbPopup::NoTimeout);
- //TODO: need localized text for Hb Dialog
// Create and set HbLabel as content widget.
- HbLabel *label = new HbLabel("Processing ...");
+ QString processingText = hbTrId("txt_common_info_processing") + QString("...");
+ HbLabel *label = new HbLabel(processingText);
label->setAlignment(Qt::AlignCenter);
mWaitDialog->setContentWidget(label);
}
@@ -389,6 +293,9 @@
//set current index.
mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent);
}
+ else {
+ mThemeListView->themeList()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear);
+ }
}
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Wed Sep 29 10:09:58 2010 +0800
@@ -32,7 +32,6 @@
class HbDialog;
class CpThemeListView;
-class CpThemePreview;
class CpBaseSettingView;
class CpThemeListModel;
@@ -51,14 +50,14 @@
signals:
void themeUpdated(const QString& themeName, const HbIcon& icon);
-public slots:
+private slots:
void newThemeSelected(const QModelIndex& index);
- void previewClosed();
- void themeApplied(const QString& theme);
+ void applyTheme(const CpThemeInfo& theme);
void themeListClosed();
void themeChangeTimeout();
void themeWaitTimeout();
void themeChangeFinished();
+ void getOviTheme();
private:
void createThemeList();
@@ -67,7 +66,6 @@
private:
CpThemeListView* mThemeListView;
- CpThemePreview* mThemePreview;
CpThemeChanger* mThemeChanger;
QAbstractItemModel* mListModel;
bool mThemeChangeFinished;
--- a/controlpanelplugins/themeplugin/src/cpthemeinfo.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.h Wed Sep 29 10:09:58 2010 +0800
@@ -26,7 +26,6 @@
public:
- Q_ENUMS(ThemeListItemType)
enum ThemeListItemType {
ThemeListItemType_default = 0,
--- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -18,6 +18,7 @@
#include <QDir>
#include <QStringList>
#include <QFileSystemWatcher>
+#include <QPair>
#include <HbIcon>
@@ -45,25 +46,14 @@
//Look into theme paths and add a file watcher for it
//to get notified when themes are added.
- QStringList themesPathList = CpThemeUtil::themePathList();
- foreach (const QString &path, themesPathList) {
- QDir themeDir;
- themeDir.setPath( path ) ;
- QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
- if(list.contains("themes", Qt::CaseSensitive )) {
- mFileWatcher->addPath(themeDir.path() + "/themes/");
- }
+ QStringList themePaths = CpThemeUtil::themeDirectories(mThemeList);
+ if(!themePaths.empty()) {
+ mFileWatcher->addPaths(themePaths);
}
- connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)),
+
+ connect(mFileWatcher, SIGNAL(directoryChanged(QString)),
this, SLOT(themeListChanged()));
-
- // data for the list which appears after the themes:
- CpThemeInfo fetchFromStore;
- fetchFromStore.setName(hbTrId("txt_cp_list_get_more_tones"));
- fetchFromStore.setItemType(CpThemeInfo::ThemeListItemType_URL);
- fetchFromStore.setItemData(QString("http://lr.ovi.mobi/store/themes"));
- fetchFromStore.setIcon(HbIcon("qtg_large_ovistore"));
- mBottomThemeList.append(fetchFromStore);
+
}
/*
@@ -116,23 +106,11 @@
case Qt::DisplayRole:
retVal = list->at(row).name();
break;
-
- case Qt::DecorationRole:
- retVal = list->at(row).icon();
- break;
-
+
case Qt::SizeHintRole:
retVal = list->at(row).icon().size();
break;
-
- case PortraitPreviewRole:
- retVal = list->at(row).portraitPreviewIcon();
- break;
-
- case LandscapePreviewRole:
- retVal = list->at(row).landscapePreviewIcon();
- break;
-
+
case ItemDataRole:
retVal = list->at(row).itemData();
break;
--- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -32,11 +32,9 @@
public:
enum ThemeListUserRole {
- PortraitPreviewRole = Qt::UserRole,
- LandscapePreviewRole,
- ItemTypeRole,
- ItemDataRole
- };
+ ItemTypeRole = Qt::UserRole,
+ ItemDataRole
+ };
explicit CpThemeListModel(QObject *parent = 0);
virtual ~CpThemeListModel();
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -20,20 +20,22 @@
#include <QModelIndex>
#include <hbview.h>
-#include <hblabel.h>
#include <hblistview.h>
#include <hblistviewitem.h>
+#include <hbtoolbar.h>
+#include <hbaction.h>
+#include <hbgroupbox.h>
+
#include "cpthemelistview.h"
/*!
\class CpThemeListView
- \brief CpThemeListView displays a heading (Select theme) and a list of themes with
+ \brief CpThemeListView displays a heading (e.g Theme) and a list of themes with
corresponding icons.
Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel
- framework. However, it does not use HbDataForm as its widget and as its parent does, so
- it uses SetWidget to set the listview to its widget instead of an HbDataForm.
+ framework.
*/
/*!
@@ -42,27 +44,46 @@
CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent),
mThemeList(new HbListView(this))
{
-
- //Create a layout with a heading "Select theme" at top and the list below it.
+
+ //Create a layout with a heading at top and the list below it.
HbWidget* contentWidget = new HbWidget(this);
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->setContentsMargins(0,0,0,0);
//setup the heading.
- HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);//txt_cp_title_select_theme
- layout->addItem(label);
-
- connect(mThemeList, SIGNAL(activated(const QModelIndex&)),
- this, SIGNAL(newThemeSelected(const QModelIndex&)));
+ HbGroupBox *simpleLabel = new HbGroupBox();
+ simpleLabel->setHeading(hbTrId("txt_cp_title_select_theme"));
+
+ layout->addItem(simpleLabel);
+
+ connect(mThemeList, SIGNAL(activated(QModelIndex)),
+ this, SIGNAL(newThemeSelected(QModelIndex)));
+ //set list item icons to be large.
HbListViewItem* listViewItem = mThemeList->listItemPrototype();
listViewItem->setGraphicsSize(HbListViewItem::LargeIcon);
-
+ //set singleSelection to enable showing an indicator (e.g check mark) next to active theme.
+ mThemeList->setSelectionMode(HbAbstractItemView::SingleSelection);
+
//add the list to layout.
layout->addItem(mThemeList);
+
+ //Create the toolbar for Ovi Store.
+ HbToolBar* toolBar = new HbToolBar(this);
+
+ HbAction* oviAction = new HbAction(HbIcon("qtg_large_ovistore"), hbTrId("txt_cp_list_get_more_tones"));
+ QObject::connect( oviAction, SIGNAL(triggered()),
+ this, SIGNAL(oviClicked()));
+
+ //Add Action to the toolbar and show toolbar
+ toolBar->addAction(oviAction);
+
+ setToolBar(toolBar);
contentWidget->setLayout(layout);
setWidget(contentWidget);
+
}
/*!
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.h Wed Sep 29 10:09:58 2010 +0800
@@ -32,7 +32,7 @@
Q_OBJECT
public:
- CpThemeListView(QGraphicsItem *parent = 0);
+ explicit CpThemeListView(QGraphicsItem *parent = 0);
~CpThemeListView();
void setWidget(QGraphicsWidget *widget);
HbListView* themeList() const;
@@ -41,6 +41,7 @@
signals:
void newThemeSelected(const QModelIndex& index);
+ void oviClicked();
private:
HbListView* mThemeList;
--- a/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -48,9 +48,9 @@
//create a cpthemepluginentryitemdata with default values and return it.
CpSettingFormEntryItemData *entryItem = new CpThemePluginEntryItemData(
itemDataHelper,
- tr("Theme"),
- tr("Theme Name"),
- HbIcon(":/image/qgn_menu_note.svg"));
+ hbTrId("txt_cp_dblist_theme"),
+ QString(),
+ HbIcon("qtg_large_personalization"));
return QList<CpSettingFormItemData*>() << entryItem;
}
--- a/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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);
}
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -15,6 +15,7 @@
*
*/
+#include <QObject>
#include <QString>
#include <QGraphicsPixmapItem>
#include <QGraphicsLinearLayout>
@@ -27,6 +28,7 @@
#include <hbiconitem.h>
#include <hbmainwindow.h>
#include <HbParameterLengthLimiter>
+#include <HbDataForm>
#include "cpthemepreview.h"
#include "cpthemeinfo.h"
@@ -38,6 +40,7 @@
the theme change or press Cancel and go back to theme list view.
*/
+
/*!
constructor.
*/
@@ -47,20 +50,52 @@
mSoftKeyBackAction(0),
mPreviewIcon(0)
{
+ QGraphicsLinearLayout* containerLayout = new QGraphicsLinearLayout(Qt::Vertical);
+ QGraphicsLinearLayout* bottomLayout = new QGraphicsLinearLayout(Qt::Vertical);
+
+ //Preview icon margins.
+ qreal leftMargin = 0.0;
+ qreal rightMargin = 0.0;
+ qreal topMargin = 0.0;
+ qreal bottomMargin = 0.0;
+
+ style()->parameter(QString("hb-param-margin-gene-left"), leftMargin);
+ style()->parameter("hb-param-margin-gene-right", rightMargin);
+ style()->parameter("hb-param-margin-gene-top", topMargin);
+ style()->parameter("hb-param-margin-gene-bottom", bottomMargin);
+
+ containerLayout->setContentsMargins(0,0,0,0);
+ bottomLayout->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin);
+
+ //Using an empty dataform as heading because the heading should
+ //look like an HbDataForm headiing.
+ HbDataForm* heading = new HbDataForm(this);
+ QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name());
+ heading->setHeading(themeHeading);
+
+ containerLayout->addItem(heading);
+ //Fixed vertical policy so that the heading doesn't expand.
+ heading->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType);
- //Create the layout and add heading and and preview icon to the layout.
- QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+ if(mainWindow()->orientation() == Qt::Horizontal) {
+ mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this);
+ }
+ else {
+ mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this);
+ //set to ignore aspect ratio so the layout would rezise the icon correctly.
+
+ }
+ mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio);
+
+ // set an object name for preview icon to make it testable for automation testing
+ mPreviewIcon->setObjectName(QString("themePreviewIcon"));
- //setup the heading.
- QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name());
- HbLabel* label = new HbLabel(themeHeading, this);
-
- layout->addItem(label);
-
- layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
- layout->itemAt(0)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType);
-
+ bottomLayout->addItem(mPreviewIcon);
+ containerLayout->addItem(bottomLayout);
+
+ setLayout(containerLayout);
+
//Create the toolbar and "Select" and "Cancel" actions.
HbToolBar* mToolBar = new HbToolBar(this);
@@ -77,24 +112,11 @@
QObject::connect( cancelAction, SIGNAL(triggered()),
this, SIGNAL(aboutToClose()));
-
QObject::connect( mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
this, SLOT(previewOrientationChanged(Qt::Orientation)));
-
- if(mainWindow()->orientation() == Qt::Horizontal) {
- mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this);
- }
- else {
- mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this);
- }
- layout->addItem(mPreviewIcon);
- layout->itemAt(1)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,QSizePolicy::DefaultType);
-
setToolBar(mToolBar);
- setLayout(layout);
-
//Setup the Back button action and set softkey. Back button
//takes the user to the theme list view.
mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
@@ -102,6 +124,7 @@
this, SIGNAL(aboutToClose()) );
setNavigationAction(mSoftKeyBackAction);
+
}
/*!
@@ -122,7 +145,7 @@
/*!
returns the themeName.
*/
-const QString& CpThemePreview::themeName() const
+const QString CpThemePreview::themeName() const
{
return mTheme.name();
}
@@ -130,7 +153,7 @@
/*!
returns the repersentative themeIcon of the current theme.
*/
-const HbIcon& CpThemePreview::themeIcon() const
+const HbIcon CpThemePreview::themeIcon() const
{
return mTheme.icon();
}
@@ -140,7 +163,7 @@
*/
void CpThemePreview::themeSelected()
{
- emit applyTheme(mTheme.name());
+ emit applyTheme(mTheme);
}
/*!
@@ -150,13 +173,20 @@
void CpThemePreview::previewOrientationChanged(Qt::Orientation orientation)
{
- QGraphicsLinearLayout* previewLayout = dynamic_cast<QGraphicsLinearLayout*>(layout());
+ QGraphicsLinearLayout* containerLayout = dynamic_cast<QGraphicsLinearLayout*>(layout());
+ QGraphicsLinearLayout* previewLayout = 0;
+ if(containerLayout) {
+ //get the layout that preview icon belongs to.
+ previewLayout = dynamic_cast<QGraphicsLinearLayout*>(containerLayout->itemAt(1));
+ }
- if(mPreviewIcon && mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(1)) ) {
- previewLayout->removeAt(1);
+ if(previewLayout && mPreviewIcon && mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(0)) ) {
+ //Remove preview icon.
+ previewLayout->removeAt(0);
if(orientation == Qt::Horizontal) {
mPreviewIcon->setIcon(mTheme.landscapePreviewIcon());
+
}
else {
mPreviewIcon->setIcon(mTheme.portraitPreviewIcon());
@@ -166,4 +196,6 @@
}
}
+
+
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Wed Sep 29 10:09:58 2010 +0800
@@ -41,17 +41,17 @@
explicit CpThemePreview(const CpThemeInfo &theme, QGraphicsItem *parent = 0);
~CpThemePreview();
void setThemeInfo(const CpThemeInfo& theme);
- const QString& themeName() const;
- const HbIcon& themeIcon() const;
+ const QString themeName() const;
+ const HbIcon themeIcon() const;
signals:
- void applyTheme(const QString&);
+ void applyTheme(const CpThemeInfo&);
void aboutToClose();
-public slots:
+private slots:
void themeSelected();
void previewOrientationChanged(Qt::Orientation orientation);
-
+
private:
CpThemeInfo mTheme;
HbAction* mSoftKeyBackAction;
--- a/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -26,6 +26,7 @@
#include <hbicon.h>
#include <hbinstance.h>
+#include <restricted/hbthemeservices_r.h>
/*!
* This class provides utility function to get Theme information.
@@ -36,94 +37,23 @@
#include <centralrepository.h>
static const TUid KServerUid3={0x20022E82};
static const TUint32 KDefaultThemeNameKey = 0x2;
- static const TUint32 KDefaultThemeRootPathKey = 0x3;
-
+
#endif
-#if !defined(Q_OS_SYMBIAN)
- #include <stdio.h>
- static const char* KThemePathKey = "HB_THEMES_DIR"; //used for getting default theme.
-#endif
-
-
-#ifdef Q_OS_WIN
- static char* _path = NULL;
- static size_t _size = 0;
- _dupenv_s(&_path, &_size, KThemePathKey);
- static QString themeRootPath = QString(_path);
- static QString themeRootPathPostfix = QString();
- free(_path);
-#elif defined(Q_OS_SYMBIAN)
- static QString themeRootPath = "c:\\resource\\hb";
- static QString themeRootPathPostfix = "resource\\hb";
-#elif defined(Q_OS_MACX)
- static QString themeRootPath = QDir::homePath() + '/' + "Library" + QString("hb");
- static QString themeRootPathPostfix = QString();
-#elif defined(Q_OS_UNIX)
- static QString themeRootPath = QString(getenv(KThemePathKey));
- static QString themeRootPathPostfix = QString();
-#else
- static QString themeRootPath = "c:\\resource\\hb";
- static QString themeRootPathPostfix = QString();
-#endif
//Location of theme preview and background icons.
static const QString KPreviewThumbnailNVG = "/scalable/qtg_graf_theme_preview_thumbnail.nvg";
static const QString KPreviewThumbnailSVG = "/scalable/qtg_graf_theme_preview_thumbnail.svg";
- static const QString KPreviewPrtNVG = "/scalable/qtg_graf_theme_preview_prt.nvg";
- static const QString KPreviewLscNVG = "/scalable/qtg_graf_theme_preview_lsc.nvg";
- static const QString KPreviewPrtSVG = "/scalable/qtg_graf_theme_preview_prt.svg";
- static const QString KPreviewLscSVG = "/scalable/qtg_graf_theme_preview_lsc.svg";
-
static const QString KBackgroundPrtNVG = "/scalable/qtg_graf_screen_bg_prt.nvg";
static const QString KBackgroundLscNVG = "/scalable/qtg_graf_screen_bg_lsc.nvg";
static const QString KBackgroundPrtSVG = "/scalable/qtg_graf_screen_bg_prt.svg";
static const QString KBackgroundLscSVG = "/scalable/qtg_graf_screen_bg_lsc.svg";
- static const QString KBackgroundPrtPNG = "/pixmap/qtg_graf_screen_bg_prt.png";
- static const QString KBackgroundLscPNG = "/pixmap/qtg_graf_screen_bg_lsc.png";
-/*!
- * Returns a list of paths where themes folder reside.
- */
-QStringList CpThemeUtil::themePathList()
-{
- static QStringList themesPathList;
-
- if(themesPathList.isEmpty()) {
-#if defined(Q_OS_SYMBIAN)
- QFileInfoList driveInfoList = QDir::drives();
- foreach (const QFileInfo &driveInfo, driveInfoList) {
- const QString themePath = driveInfo.absolutePath() + themeRootPathPostfix;
- if(QDir(themePath).exists())
- themesPathList << themePath;
- }
-#else
- themesPathList << themeRootPath;
-#endif
- }
- return themesPathList;
-}
-/*!
- * Given the theme name, it returns the absolute path of the theme.
- */
-QString CpThemeUtil::themePath(const QString& themeName)
-{
- QString themePath = "";
- QStringList themesPathList = themePathList();
- foreach (const QString &path, themesPathList) {
- QString tmpPath = path + "/themes/icons/" + themeName;
- if(QDir(tmpPath).exists()) {
- themePath = tmpPath;
- break;
- }
- }
- return themePath;
-}
-
+
/*
* Builds a CpThemeInfo object given theme path and theme name. It creates the name and
* preview icons for the object. Creates a new CpThemeInfo objects. Caller takes ownership.
@@ -134,8 +64,6 @@
CpThemeInfo *themeInfo = new CpThemeInfo();
QString iconPath;
- QString previewPathPrt;
- QString previewPathLsc;
QString name = themeName;
QString hidden = "";
@@ -147,18 +75,18 @@
name = iniSetting.value("Name").toString();
hidden = iniSetting.value("Hidden").toString();
iconPath = iniSetting.value("PreviewThumbnailPath").toString();
- previewPathPrt = iniSetting.value("PreviewIconPath_prt").toString();
- previewPathLsc = iniSetting.value("PreviewIconPath_lsc").toString();
iniSetting.endGroup();
}
if(name.isEmpty() || (hidden == "true") ||( hidden == "")) {
+ delete themeInfo;
return NULL;
}
themeInfo->setName(name);
themeInfo->setItemType(CpThemeInfo::ThemeListItemType_default);
+ themeInfo->setItemData(themePath);
//Get the icons. Logic is as follow:
/* 1. If the icon path is in index.theme and the icon exist, use it.
@@ -167,101 +95,63 @@
* 3. If no icon exist (background or preview),use default theme icon.
*/
if(iconPath.isEmpty() || !QFileInfo(themePath + iconPath).exists()){
- //Set thumbnail
- if(QFileInfo(themePath + KPreviewThumbnailNVG).exists()){
- themeInfo->setIcon(HbIcon(themePath + KPreviewThumbnailNVG));
- }else if(QFileInfo(themePath + KPreviewThumbnailSVG).exists()){
- themeInfo->setIcon(HbIcon(themePath + KPreviewThumbnailSVG));
- }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){
- themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtNVG));
- } else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){
- themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtSVG));
- } else if(QFileInfo(themePath + KBackgroundPrtPNG).exists()){
- themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtPNG));
- }else{
- themeInfo->setIcon(HbIcon(defaultTheme()->icon()));
+ //Set thumbnail
+ HbIcon themeIcon = getPreviewIcon(themePath);
+ if(themeIcon.isNull()){
+ QString defaultThemePath = defaultTheme();
+ if(!defaultThemePath.isEmpty()) {
+ themeIcon = getPreviewIcon(defaultThemePath);
+ }
}
-
+ themeInfo->setIcon(themeIcon);
} else {
themeInfo->setIcon(HbIcon(themePath + iconPath));
}
- //Portrait preview
-
- if(previewPathPrt.isEmpty() || !QFileInfo(themePath + previewPathPrt).exists()) {
-
- if(QFileInfo(themePath + KPreviewPrtNVG).exists()){
- themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KPreviewPrtNVG));
- }else if(QFileInfo(themePath + KPreviewPrtSVG).exists()){
- themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KPreviewPrtSVG));
- }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){
- themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtNVG));
- } else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){
- themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtSVG));
- } else if(QFileInfo(themePath + KBackgroundPrtPNG).exists()){
- themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtPNG));
- } else{
- themeInfo->setPortraitPreviewIcon(HbIcon(defaultTheme()->icon()));
- }
- }
- else {
- themeInfo->setPortraitPreviewIcon(HbIcon(themePath + previewPathPrt));
- }
-
- //Landscape preview
-
- if(previewPathLsc.isEmpty() || !QFileInfo(themePath + previewPathLsc).exists()) {
- if(QFileInfo(themePath + KPreviewLscNVG).exists()){
- themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KPreviewLscNVG));
- }else if(QFileInfo(themePath + KPreviewLscSVG).exists()){
- themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KPreviewLscSVG));
- }else if(QFileInfo(themePath + KBackgroundLscNVG).exists()){
- themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscNVG));
- } else if(QFileInfo(themePath + KBackgroundLscSVG).exists()){
- themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscSVG));
- } else if(QFileInfo(themePath + KBackgroundLscPNG).exists()){
- themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscPNG));
- } else{
- themeInfo->setLandscapePreviewIcon(HbIcon(defaultTheme()->icon()));
- }
- }
- else {
- themeInfo->setLandscapePreviewIcon(HbIcon(themePath + previewPathLsc));
- }
return themeInfo;
}
+/*!
+ * given a path to the theme, returns the preview icon or just a Null icon
+ * if it doesn't exist.
+ */
+HbIcon CpThemeUtil::getPreviewIcon(const QString& themePath)
+{
+ HbIcon themeIcon;
+ if(QFileInfo(themePath + KPreviewThumbnailNVG).exists()){
+ themeIcon = HbIcon(themePath + KPreviewThumbnailNVG);
+ }else if(QFileInfo(themePath + KPreviewThumbnailSVG).exists()){
+ themeIcon = HbIcon(themePath + KPreviewThumbnailSVG);
+ }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){
+ themeIcon = HbIcon(themePath + KBackgroundPrtNVG);
+ }else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){
+ themeIcon = HbIcon(themePath + KBackgroundPrtSVG);
+ }
+ return themeIcon;
+
+}
+
/*! Creates a list of CpThemeInfo objects representing theme information.
- * Caller should take ownership of the list.
+ *
*/
QList<CpThemeInfo> CpThemeUtil::buildThemeList()
{
QList<CpThemeInfo> themeList;
-
- QStringList mThemesPathList = themePathList();
- foreach (const QString &path, mThemesPathList) {
+ QList<QPair<QString, QString> > mThemesPathList = availableThemes();
+ QPair<QString, QString>pair;
+ foreach (pair, mThemesPathList) {
QDir themeDir;
+ QString name = pair.first;
+ QString path = pair.second;
themeDir.setPath( path ) ;
- QStringList iconthemeslist;
- QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
CpThemeInfo* themeInfo;
-
- if(list.contains("themes", Qt::CaseSensitive )) {
- QDir root(themeDir.path());
- themeDir.setPath(root.path() + "/themes/icons/") ;
- iconthemeslist = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
- foreach(QString themefolder, iconthemeslist) {
- QDir iconThemePath(root.path() + "/themes/icons/" + themefolder);
- if(iconThemePath.exists("index.theme") &&
- (iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) {
-
- themeInfo = buildThemeInfo(iconThemePath.path(), themefolder);
- if(themeInfo && !themeInfo->name().isEmpty()) {
- themeList.append(*themeInfo);
- }
- }
+ if(themeDir.exists("index.theme") &&
+ (themeDir.exists("scalable") || themeDir.exists("pixmap") )) {
+ themeInfo = buildThemeInfo(path, name);
+ if(themeInfo && !themeInfo->name().isEmpty()) {
+ themeList.append(*themeInfo);
}
}
}
@@ -270,15 +160,14 @@
}
/*!
- * Returns the default theme information.
+ * Returns the default theme path.
*/
-CpThemeInfo* CpThemeUtil::defaultTheme()
+QString CpThemeUtil::defaultTheme()
{
//static because default theme doesn't change.
- static CpThemeInfo *defaultTheme = new CpThemeInfo();
- QString defaultThemeName;
- QString defaultThemeRootDir;
- if(defaultTheme->name().isEmpty()) {
+ static QString defaultThemePath("");
+
+ if(defaultThemePath.isEmpty()) {
#ifdef Q_OS_SYMBIAN
@@ -288,24 +177,42 @@
TBuf<256> value;
if (KErrNone == repository->Get((TUint32)KDefaultThemeNameKey, value)) {
QString qvalue((QChar*)value.Ptr(), value.Length());
- defaultThemeName = qvalue.trimmed();
+ defaultThemePath = qvalue.trimmed();
}
value.Zero();
- if (KErrNone == repository->Get((TUint32)KDefaultThemeRootPathKey, value)) {
- QString qvalue((QChar*)value.Ptr(), value.Length());
- defaultThemeRootDir = qvalue.trimmed();
- }
- else {
- defaultThemeRootDir = themePath(defaultThemeName);
- }
- value.Zero();
- delete repository;
+ delete repository;
}
#endif
- defaultTheme = buildThemeInfo(defaultThemeRootDir, defaultThemeName);
-
+
}
- return defaultTheme;
+ return defaultThemePath;
}
+
+const QStringList CpThemeUtil::themeDirectories(const QList<CpThemeInfo>& themeInfoList)
+{
+ QStringList themeDirs;
+
+ foreach(const CpThemeInfo& themeInfo, themeInfoList) {
+ QDir themePath(themeInfo.itemData());
+ QString topDir;
+ if(themePath.cdUp()) {
+ topDir = themePath.path();
+ if(!themeDirs.contains(topDir)) {
+ themeDirs.append(topDir);
+ }
+ }
+ }
+ return themeDirs;
+}
+
+const QList< QPair< QString, QString > > CpThemeUtil::availableThemes( )
+{
+
+ QList<QPair<QString, QString> > result = HbThemeServices::availableThemes();
+ return result;
+
+}
+
+
--- a/controlpanelplugins/themeplugin/src/cpthemeutil.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeutil.h Wed Sep 29 10:09:58 2010 +0800
@@ -19,18 +19,25 @@
#define CPTHEMEUTIL_H_
#include <QList>
+#include <QPair>
class QStringList;
class CpThemeInfo;
+class HbIcon;
class CpThemeUtil {
public:
- static QStringList themePathList();
static QList<CpThemeInfo> buildThemeList();
- static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName);
- static QString themePath(const QString& themeName);
- static CpThemeInfo* defaultTheme();
+ static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName = QString());
+ static QString defaultTheme();
+ static const QList< QPair< QString, QString > > availableThemes();
+ static const QStringList themeDirectories(const QList<CpThemeInfo> &themeInfoList);
+
+private:
+ static HbIcon getPreviewIcon(const QString& themePath);
+
+
};
#endif /* CPTHEMEUTIL_H_ */
--- a/controlpanelplugins/themeplugin/themeplugin.pri Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/themeplugin.pri Wed Sep 29 10:09:58 2010 +0800
@@ -9,8 +9,7 @@
# Contributors:
# Description: cpthemeplugin source files
# Input
-HEADERS += src/cpthemepreview.h \
- src/cpthemecontrol.h \
+HEADERS += src/cpthemecontrol.h \
src/cpthemeplugin.h \
src/cpthemelistview.h \
src/cpthemelistmodel.h \
@@ -18,8 +17,7 @@
src/cpthemepluginentryitemdata.h \
src/cpthemeutil.h \
src/cpthemeinfo.h
-SOURCES += src/cpthemepreview.cpp \
- src/cpthemecontrol.cpp \
+SOURCES += src/cpthemecontrol.cpp \
src/cpthemeplugin.cpp \
src/cpthemelistview.cpp \
src/cpthemelistmodel.cpp \
--- a/controlpanelplugins/themeplugin/themeplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/themeplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -25,6 +25,10 @@
CONFIG += debug_and_release
RESOURCES += themeplugin.qrc
+#comment this out if theme plugin should have
+#a preview view.
+#DEFINES += CP_THEME_PREVIEW_DEFINED
+
include (themeplugin.pri)
include (rom/themeplugin_rom.pri)
@@ -61,6 +65,7 @@
LIBS += -L$$DESTDIR
+
#For some reason the default include path doesn't include MOC_DIR on symbian
symbian {
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
@@ -86,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 \
@@ -94,3 +100,4 @@
#
# End of file --Don't remove this.
+
--- a/controlpanelplugins/themeplugin/themeplugin.ts Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
-<context>
-<message numerus="no" id="txt_cp_title_select_theme">
- <comment>Select theme view title</comment>
- <source>Select theme</source>
- <translation variants="no">Select theme</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>CP_04</extra-loc-viewid>
- <extra-loc-positionid>subtitle</extra-loc-positionid>
- <extra-loc-feature>CP</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_cp_title_control_panel">
- <comment>This is the view title, shown in all Control Panel views.</comment>
- <source>Control Panel</source>
- <translation variants="no">Control Panel</translation>
- <extra-loc-layout_id>qtl_chrome_title</extra-loc-layout_id>
- <extra-loc-viewid>CP_01</extra-loc-viewid>
- <extra-loc-positionid>title</extra-loc-positionid>
- <extra-loc-feature>CP</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_cp_dblist_theme">
- <comment>List item, opens Theme selector view</comment>
- <source>Theme</source>
- <translation variants="no">Theme</translation>
- <extra-loc-layout_id>qtl_list_pri_large_graphic</extra-loc-layout_id>
- <extra-loc-viewid>CP_01</extra-loc-viewid>
- <extra-loc-positionid>list</extra-loc-positionid>
- <extra-loc-feature>CP</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_cp_title_preview_u">
- <comment>Theme preview view title, where %1 is the name of the theme that is previewed</comment>
- <source>Preview: %1</source>
- <translation variants="no">Preview: %1</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>CP_05</extra-loc-viewid>
- <extra-loc-positionid>subtitle</extra-loc-positionid>
- <extra-loc-feature>CP</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-</context>
-</TS>
--- a/controlpanelplugins/themeplugin/tsrc/tsrc.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/tsrc.pro Wed Sep 29 10:09:58 2010 +0800
@@ -19,6 +19,8 @@
SUBDIRS += unit/unittest_cpthemelistview
SUBDIRS += unit/unittest_cpthemeplugin
SUBDIRS += unit/unittest_cpthemepluginentryitemdata
+SUBDIRS += unit/unittest_cpthemelistmodel
+SUBDIRS += unit/unittest_cpthemeutil
CONFIG += ordered
test.depends = first
--- a/controlpanelplugins/themeplugin/tsrc/unit/common.pri Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/common.pri Wed Sep 29 10:09:58 2010 +0800
@@ -42,6 +42,7 @@
symbian {
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
INCLUDEPATH += $$MOC_DIR
+ LIBS += -lcentralrepository
TARGET.CAPABILITY = ALL -TCB
TARGET.EPOCALLOWDLLDATA = 1
}
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -16,45 +16,32 @@
*/
#include <QtTest/QtTest>
-#include <QModelIndex>
#include <QSignalSpy>
+#include <hbinstance.h>
+#include <hbtheme.h>
+
#include "cpthemechanger.h"
#include "cpthemecontrol.h"
-#include "cpthemechanger.h"
+#include "cpthemeinfo.h"
+#include "cpthemeutil.h"
class TestCpThemeControl : public QObject
{
Q_OBJECT
private slots:
- void init();
void testConstructor();
void testThemeListView();
void testCurrentThemeName();
void testCurrentThemeIcon();
- void testNewThemeSelected();
- void testPreviewClosed();
- void testThemeApplied();
- void testUpdateThemeList();
-
- void cleanup();
-
+
private:
CpThemeChanger* mThemeChanger;
};
-// setup and cleanup
-void TestCpThemeControl::init()
-{
- mThemeChanger = new CpThemeChanger();
-}
-void TestCpThemeControl::cleanup()
-{
- delete mThemeChanger;
-}
// verify that the constructor works and that the
// defaults are sane.
@@ -64,7 +51,7 @@
QVERIFY(control !=0 );
QVERIFY(!control->currentThemeName().isEmpty());
- QVERIFY(!control->currentThemeIcon().isEmpty());
+ QVERIFY(!control->currentThemeIcon().iconName().isEmpty());
delete control;
}
@@ -82,8 +69,8 @@
{
CpThemeControl control;
- QVERIFY((control.currentThemeName() == mThemeChanger->currentTheme())
- || (control.currentThemeName() == QString("hbdefault")));
+ QVERIFY( (control.currentThemeName() == hbInstance->theme()->name())
+ || (control.currentThemeName() == QString("hbdefault")));
}
// test that we get a non-empty string for current theme icon
@@ -91,56 +78,10 @@
{
CpThemeControl control;
- QVERIFY(!control.currentThemeIcon().isEmpty());
-}
-
-// NULL test there's no way to externally get the model the QModelIndex is based on
-void TestCpThemeControl::testNewThemeSelected()
-{
- CpThemeControl control;
-
- control.newThemeSelected(QModelIndex());
-
+ QVERIFY(!control.currentThemeIcon().isNull() && !control.currentThemeIcon().iconName().isEmpty());
}
-// NULL test - basically verifies that it doesn't burst into flames.
-void TestCpThemeControl::testPreviewClosed()
-{
- CpThemeControl control;
-
- control.previewClosed();
-
-}
-void TestCpThemeControl::testThemeApplied()
-{
- CpThemeControl control;
- QList<CpThemeChanger::ThemeInfo> themeList = mThemeChanger->themes();
- QSignalSpy spy(&control, SIGNAL(themeUpdated(const QString&, const QString&)));
- int expectedSignalCount = 0;
-
- for (int i = 0; i < themeList.size(); ++i) {
- CpThemeChanger::ThemeInfo info = themeList.at(i);
- QString name = info.themeName;
-
- if (control.currentThemeName() == mThemeChanger->currentTheme()) {
- ++expectedSignalCount;
- }
-
- control.themeApplied(name);
- QCOMPARE(control.currentThemeName(), mThemeChanger->currentTheme());
-
- QCOMPARE(spy.count(),expectedSignalCount);
- }
-}
-
-// NULL test - basically verifies that it doesn't burst into flames.
-void TestCpThemeControl::testUpdateThemeList()
-{
- CpThemeControl control;
-
- control.updateThemeList();
-}
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro Wed Sep 29 10:09:58 2010 +0800
@@ -37,18 +37,14 @@
HEADERS += ../../../src/cpthemecontrol.h
HEADERS += ../../../src/cpthemechanger.h
-HEADERS += ../../../src/cpthemechanger_p.h
-HEADERS += ../../../src/cpthemeclient_p.h
-symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h
-win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h
HEADERS += ../../../src/cpthemelistview.h
-HEADERS += ../../../src/cpthemepreview.h
+HEADERS += ../../../src/cpthemeutil.h
+HEADERS += ../../../src/cpthemeinfo.h
+HEADERS += ../../../src/cpthemelistmodel.h
SOURCES += unittest_cpthemecontrol.cpp
SOURCES += ../../../src/cpthemecontrol.cpp
SOURCES += ../../../src/cpthemechanger.cpp
-SOURCES += ../../../src/cpthemechanger_p.cpp
-SOURCES += ../../../src/cpthemeclient_p.cpp
-symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp
-win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp
+SOURCES += ../../../src/cpthemeinfo.cpp
+SOURCES += ../../../src/cpthemeutil.cpp
+SOURCES += ../../../src/cpthemelistmodel.cpp
SOURCES += ../../../src/cpthemelistview.cpp
-SOURCES += ../../../src/cpthemepreview.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistmodel/unittest_cpthemelistmodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors: XENT-MV
+*
+* Description: unit tests for the CpThemeListModel class from themeplugin
+*
+*/
+
+#include <QtTest/QtTest>
+
+#include "cpthemelistmodel.h"
+
+class TestCpThemeListModel : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+ void testConstructor();
+ void testRowCount();
+ void testData();
+ void testIndexOf();
+};
+
+
+void TestCpThemeListModel::testConstructor()
+{
+
+ CpThemeListModel *obj = new CpThemeListModel();
+
+
+ QVERIFY (obj != 0 );
+ QVERIFY (obj->rowCount() > 0);
+
+ delete obj;
+
+}
+
+void TestCpThemeListModel::testRowCount()
+{
+ CpThemeListModel *themeModel = new CpThemeListModel();
+ QList<QPair<QString, QString> > allThemes = CpThemeUtil::availableThemes();
+ QVERIFY(themeModel->rowCount() >= allThemes.size());
+}
+
+void TestCpThemeListModel::testData()
+{
+ CpThemeListModel *themeModel = new CpThemeListModel();
+ QList<QPair<QString, QString> > allThemes = CpThemeUtil::availableThemes();
+
+ QModelIndex index = themeModel->index(0,0, QModelIndex());
+
+ //Check theme name (first) and theme path (second). Skipping icons for now.
+ QCOMPARE(themeModel->data(index, Qt::DisplayRole).toString(), allThemes.at(0).first);
+ QCOMPARE(themeModel->data(index, CpThemeListModel::ItemDataRole).toString(), allThemes.at(0).second);
+
+
+}
+
+void TestCpThemeListModel::testIndexOf()
+{
+ CpThemeListModel *themeModel = new CpThemeListModel();
+ QList<QPair<QString, QString> > allThemes = CpThemeUtil::availableThemes();
+
+ CpThemeInfo *themeInfo = CpThemeUtil::buildThemeInfo(allThemes.at(1).second, allThemes.at(1).first);
+
+ int index = themeModel->indexOf(*themeInfo);
+
+ QVERIFY(index == 1);
+
+}
+QTEST_MAIN(TestCpThemeListModel)
+#include "unittest_cpthemelistmodel.moc"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistmodel/unittest_cpthemelistmodel.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,30 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0".
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors: XENT-MV
+# Description: unit tests for the cpthemelistmodel class in the themeplugin.
+include(../common.pri)
+TEMPLATE = app
+TARGET = unittest_cpthemelistmodel
+DEPENDPATH += .
+win32::DEPENDPATH += c:/ControlPanel/debug/bin
+INCLUDEPATH += .
+INCLUDEPATH += src/
+INCLUDEPATH += ../../../src
+LIBS += -lcpframework
+win32::LIBS += -LC:/ControlPanel/debug/bin
+symbian::TARGET.UID3 = 0x20031DAD
+
+# Input
+HEADERS += ../../../src/cpthemelistmodel.h
+HEADERS += ../../../src/cpthemeinfo.h
+HEADERS += ../../../src/cpthemeutil.h
+SOURCES += unittest_cpthemelistmodel.cpp
+SOURCES += ../../../src/cpthemelistmodel.cpp
+SOURCES += ../../../src/cpthemeinfo.cpp
+SOURCES += ../../../src/cpthemeutil.cpp
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -62,13 +62,13 @@
delete listView;
}
-// no getter so this is basically a NULL test.
void TestCpThemeListView::testSetModel()
{
CpThemeListView *listView = new CpThemeListView();
QStandardItemModel *model = new QStandardItemModel(this);
listView->setModel(model);
+ QVERIFY(listView->themeList()->model() == model);
// model shouldn't be deleted because it is a QObject with a parent.
@@ -88,4 +88,4 @@
QTEST_MAIN(TestCpThemeListView)
-#include "unittest_cpthemelistview.moc"
\ No newline at end of file
+#include "unittest_cpthemelistview.moc"
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -42,11 +42,11 @@
CpThemePlugin *obj = new CpThemePlugin();
CpItemDataHelper helper;
- QVERIFY(obj->createSettingFormItemData(helper) != 0);
+ QVERIFY(obj->createSettingFormItemData(helper).at(0) != 0);
delete obj;
}
QTEST_MAIN(TestCpThemePlugin)
-#include "unittest_cpthemeplugin.moc"
\ No newline at end of file
+#include "unittest_cpthemeplugin.moc"
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -35,23 +35,21 @@
# Input
HEADERS += ../../../src/cpthemecontrol.h
-HEADERS += ../../../src/cpthemeclient_p.h
-win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h
-symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h
-HEADERS += ../../../src/cpthemepreview.h
HEADERS += ../../../src/cpthemechanger.h
-HEADERS += ../../../src/cpthemechanger_p.h
HEADERS += ../../../src/cpthemelistview.h
HEADERS += ../../../src/cpthemeplugin.h
HEADERS += ../../../src/cpthemepluginentryitemdata.h
+HEADERS += ../../../src/cpthemeinfo.h
+HEADERS += ../../../src/cpthemeutil.h
+HEADERS += ../../../src/cpthemelistmodel.h
SOURCES += unittest_cpthemeplugin.cpp
SOURCES += ../../../src/cpthemecontrol.cpp
-SOURCES += ../../../src/cpthemeclient_p.cpp
-win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp
-symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp
-SOURCES += ../../../src/cpthemepreview.cpp
SOURCES += ../../../src/cpthemechanger.cpp
-SOURCES += ../../../src/cpthemechanger_p.cpp
SOURCES += ../../../src/cpthemelistview.cpp
SOURCES += ../../../src/cpthemeplugin.cpp
SOURCES += ../../../src/cpthemepluginentryitemdata.cpp
+SOURCES += ../../../src/cpthemeinfo.cpp
+SOURCES += ../../../src/cpthemeutil.cpp
+SOURCES += ../../../src/cpthemelistmodel.cpp
+
+
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -35,7 +35,7 @@
CpItemDataHelper helper;
CpThemePluginEntryItemData *obj = new CpThemePluginEntryItemData(helper);
-
+
QVERIFY(obj != NULL);
delete obj;
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro Wed Sep 29 10:09:58 2010 +0800
@@ -34,23 +34,19 @@
# Input
+HEADERS += ../../../src/cpthemeinfo.h
+HEADERS += ../../../src/cpthemeutil.h
+HEADERS += ../../../src/cpthemelistmodel.h
HEADERS += ../../../src/cpthemecontrol.h
HEADERS += ../../../src/cpthemelistview.h
HEADERS += ../../../src/cpthemechanger.h
-HEADERS += ../../../src/cpthemepreview.h
-HEADERS += ../../../src/cpthemechanger_p.h
-HEADERS += ../../../src/cpthemeclient_p.h
-win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h
-symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h
HEADERS += ../../../src/cpthemepluginentryitemdata.h
SOURCES += unittest_cpthemepluginentryitemdata.cpp
SOURCES += ../../../src/cpthemepluginentryitemdata.cpp
SOURCES += ../../../src/cpthemelistview.cpp
SOURCES += ../../../src/cpthemecontrol.cpp
-SOURCES += ../../../src/cpthemepreview.cpp
SOURCES += ../../../src/cpthemechanger.cpp
-SOURCES += ../../../src/cpthemechanger_p.cpp
-SOURCES += ../../../src/cpthemeclient_p.cpp
-win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp
-symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp
+SOURCES += ../../../src/cpthemeinfo.cpp
+SOURCES += ../../../src/cpthemeutil.cpp
+SOURCES += ../../../src/cpthemelistmodel.cpp
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -19,116 +19,54 @@
#include "cpthemepreview.h"
#include "cpthemechanger.h"
+#include "cpthemeutil.h"
class TestCpThemePreview : public QObject
{
Q_OBJECT
private slots:
- void init();
-
- void testConstructor();
- void testConstructor2();
- void testSetThemeName();
- void testSetPreviewIcon();
- void testThemeSelected();
-
- void cleanup();
-
-private:
- CpThemeChanger *mThemeChanger;
+
+ void testAll();
+
};
-void TestCpThemePreview::init()
-{
- mThemeChanger = new CpThemeChanger();
-}
-
-void TestCpThemePreview::cleanup()
+void TestCpThemePreview::testAll()
{
- delete mThemeChanger;
-}
+ QList<QPair<QString, QString> > themes = CpThemeUtil::availableThemes();
+
+ QPair<QString, QString> pair;
+
+ pair = themes.at(0);
+
+ QString name = pair.first;
+ QString themePath = pair.second;
+ CpThemeInfo* themeInfo = CpThemeUtil::buildThemeInfo(themePath, name);
+
+ CpThemePreview *obj = new CpThemePreview(*themeInfo);
+
+
+ QVERIFY (obj != 0 );
+ QCOMPARE(obj->themeName(), name);
+ QCOMPARE(obj->themeIcon(), themeInfo->icon());
-void TestCpThemePreview::testConstructor()
-{
- CpThemePreview *obj = new CpThemePreview();
-
- QVERIFY( obj != 0 );
+ delete themeInfo;
+
+ pair = themes.at(1);
+ name = pair.first;
+ themePath = pair.second;
+ themeInfo = CpThemeUtil::buildThemeInfo(themePath, name);
+
+ obj->setThemeInfo(*themeInfo);
+
+ QCOMPARE(obj->themeName(), name);
+ QCOMPARE(obj->themeIcon(), themeInfo->icon());
+
delete obj;
-}
-void TestCpThemePreview::testConstructor2()
-{
- QList<CpThemeChanger::ThemeInfo> themeInfo = mThemeChanger->themes();
-
- for (int i = 0; i < themeInfo.size(); ++i) {
- QString name = themeInfo.at(i).themeName;
- QString icon = themeInfo.at(i).iconPath;
-
- CpThemePreview *obj = new CpThemePreview(name, icon);
- QVERIFY (obj != 0 );
- QCOMPARE(obj->themeName(), name);
-
- delete obj;
- }
-
- // try with gibberish for the name and/or icon
- QString name = QString("alzihgiaureh");
- QString icon = QString("ahilwvihln");
- CpThemePreview *obj = new CpThemePreview(name);
- QVERIFY(obj != 0);
- delete obj;
-
- obj = new CpThemePreview(name,icon);
- QVERIFY(obj != 0);
- delete obj;
}
-void TestCpThemePreview::testSetThemeName()
-{
- CpThemePreview *obj = new CpThemePreview();
- QList<CpThemeChanger::ThemeInfo> themeInfo = mThemeChanger->themes();
-
- for (int i = 0; i < themeInfo.size(); ++i) {
- QString name = themeInfo.at(i).themeName;
-
- obj->setThemeName(name);
- QCOMPARE(obj->themeName(), name);
- }
-
- delete obj;
-}
-
-// NULL TEST
-void TestCpThemePreview::testSetPreviewIcon()
-{
- CpThemePreview *obj = new CpThemePreview();
- QList<CpThemeChanger::ThemeInfo> themeInfo = mThemeChanger->themes();
-
- for (int i = 0; i < themeInfo.size(); ++i) {
- QString name = themeInfo.at(i).themeName;
-
- obj->setThemeName(name);
- QCOMPARE(obj->themeName(), name);
- }
-
- delete obj;
-}
-
-void TestCpThemePreview::testThemeSelected()
-{
- CpThemePreview *obj = new CpThemePreview();
- QSignalSpy spy(obj,SIGNAL(applyTheme(const QString&)));
-
- obj->themeSelected();
-
- QCOMPARE(spy.count(), 1);
-
- delete obj;
-}
-
-
QTEST_MAIN(TestCpThemePreview)
#include "unittest_cpthemepreview.moc"
--- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro Wed Sep 29 10:09:58 2010 +0800
@@ -35,15 +35,11 @@
# Input
HEADERS += ../../../src/cpthemepreview.h
-HEADERS += ../../../src/cpthemeclient_p.h
-win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h
-symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h
+HEADERS += ../../../src/cpthemeinfo.h
+HEADERS += ../../../src/cpthemeutil.h
HEADERS += ../../../src/cpthemechanger.h
-HEADERS += ../../../src/cpthemechanger_p.h
SOURCES += unittest_cpthemepreview.cpp
SOURCES += ../../../src/cpthemepreview.cpp
+SOURCES += ../../../src/cpthemeinfo.cpp
+SOURCES += ../../../src/cpthemeutil.cpp
SOURCES += ../../../src/cpthemechanger.cpp
-SOURCES += ../../../src/cpthemeclient_p.cpp
-win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp
-symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp
-SOURCES += ../../../src/cpthemechanger_p.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeutil/unittest_cpthemeutil.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors: XENT-MV
+*
+* Description: unit tests for the CpThemePreview class from themeplugin
+*
+*/
+
+#include <QtTest/QtTest>
+
+#include <restricted/hbthemeservices_r.h>
+#include <QList>
+#include <QStringList>
+#include <QPair>
+#include "cpthemeutil.h"
+#include "cpthemeinfo.h"
+
+class TestCpThemeUtil : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+ void testMultiple();
+ void testAvailableThemes();
+ void testThemeDirectories();
+
+};
+
+void TestCpThemeUtil::testMultiple()
+{
+ QList<QPair<QString, QString> > themes = HbThemeServices::availableThemes();
+
+ QPair<QString, QString> pair;
+
+ pair = themes.at(0);
+
+ QString name = pair.first;
+ QString themePath = pair.second;
+
+ QList<CpThemeInfo> themeList = CpThemeUtil::buildThemeList();
+
+ QCOMPARE(name, themeList.at(0).name());
+ QCOMPARE(themePath, themeList.at(0).itemData());
+
+ CpThemeInfo *themeInfo = CpThemeUtil::buildThemeInfo(themePath, name);
+ QCOMPARE(name, themeInfo->name());
+ QCOMPARE(themePath, themeInfo->itemData());
+
+
+ //null test, making sure no crash happens.
+ QString defaultThemePath = CpThemeUtil::defaultTheme();
+
+ delete themeInfo;
+ themeInfo = 0;
+
+}
+void TestCpThemeUtil::testAvailableThemes()
+{
+ QList<QPair<QString, QString> > themes = HbThemeServices::availableThemes();
+ QList<QPair<QString, QString> > utilThemes = CpThemeUtil::availableThemes();
+
+ for(int i = 0; i < themes.size(); i++) {
+ QPair<QString, QString>pair1;
+ QPair<QString, QString>pair2;
+
+ pair1 = themes.at(i);
+ pair2 = utilThemes.at(i);
+ QCOMPARE(pair1.first, pair2.first);
+ QCOMPARE(pair1.second, pair2.second);
+ }
+}
+
+void TestCpThemeUtil::testThemeDirectories()
+{
+ QList<CpThemeInfo> themeList = CpThemeUtil::buildThemeList();
+ QStringList themeDirs = CpThemeUtil::themeDirectories(themeList);
+ QVERIFY(themeList.size() > 0 && themeDirs.size() > 0);
+}
+
+QTEST_MAIN(TestCpThemeUtil)
+#include "unittest_cpthemeutil.moc"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeutil/unittest_cpthemeutil.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0".
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors: XENT-MV
+#
+# Description: unit tests for the cpthemeutil class in the themeplugin.
+#
+#
+
+include(../common.pri)
+
+TEMPLATE = app
+TARGET = unittest_cpthemeutil
+DEPENDPATH += .
+win32::DEPENDPATH += c:/ControlPanel/debug/bin
+
+INCLUDEPATH += .
+INCLUDEPATH += src/
+INCLUDEPATH += ../../../src
+
+LIBS += -lcpframework
+win32::LIBS += -LC:/ControlPanel/debug/bin
+
+symbian::TARGET.UID3=0x20031DAE
+
+
+# Input
+
+HEADERS += ../../../src/cpthemeutil.h
+HEADERS += ../../../src/cpthemeinfo.h
+SOURCES += unittest_cpthemeutil.cpp
+SOURCES += ../../../src/cpthemeutil.cpp
+SOURCES += ../../../src/cpthemeinfo.cpp
--- a/controlpanelui/examples/groupplugin/groupplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/examples/groupplugin/groupplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -26,3 +26,6 @@
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro Wed Sep 29 10:09:58 2010 +0800
@@ -36,3 +36,6 @@
LIBS += -lxqservice -lcpframework
symbian::TARGET::UID3 = 0X2002873A
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/examples/themeplugin/themeplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/examples/themeplugin/themeplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -27,3 +27,6 @@
symbian {
TARGET.UID3 = 0X20025FDB
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/examples/viewplugin/viewplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/examples/viewplugin/viewplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -25,3 +25,6 @@
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/rom/controlpanelui.iby Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/rom/controlpanelui.iby Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- a/controlpanelui/src/cpapplication/cpapplication.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpapplication/cpapplication.pro Wed Sep 29 10:09:58 2010 +0800
@@ -26,14 +26,14 @@
RESOURCES += cpapplication.qrc
-LIBS += -lcpframework -lcpcategorymodel
+LIBS += -lcplogger -lcpframework -lcpcategorymodel
TRANSLATIONS = control_panel.ts
symbian: {
- SKINICON = qtg_large_settings
- TARGET.UID3 = 0x20025FD9
- TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
+ SKINICON = qtg_large_settings
+ TARGET.UID3 = 0x20025FD9
+ TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
deploy.path = C:
headers.sources += data/mainview.cpcfg
@@ -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
--- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -22,16 +22,28 @@
#include <hbdataform.h>
#include <cpitemdatahelper.h>
#include <cplogger.h>
+#include <hbactivitymanager.h>
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <QPixMap>
+#include <QMetaType>
+#include "cpcategorysettingformitemdata.h"
//CpMainView implementation
CpMainView::CpMainView(HbMainWindow *mainWindow/*= 0*/)
: CpBaseSettingView(0,0),
mMainModel(0),
mItemDataHelper(0),
- mMainWindow(mainWindow)
+ mMainWindow(mainWindow),
+ mActivityManager(0)
{
//delay loading
- connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel()));
+ //connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel()));
+ // AUTO SAVE ACTIVITY OF CONTROLPANEL
+ HbApplication *app= qobject_cast<HbApplication *>(qApp);
+ mActivityManager = app->activityManager();
+ initializeMainModel();
+ connect(this, SIGNAL(aboutToClose()),this, SLOT(saveActivity()));
}
CpMainView::~CpMainView()
@@ -56,9 +68,95 @@
mMainModel = new CpMainModel;
mMainModel->initialize(*mItemDataHelper);
form->setModel(mMainModel);
+ connect(form, SIGNAL(activated(QModelIndex)), this, SLOT(onDataFormItemActivated(QModelIndex)));
- connect(form,SIGNAL(activated(QModelIndex)),this,SLOT(onDataFormItemActivated(QModelIndex)));
+ connect(mMainWindow, SIGNAL(aboutToChangeView(HbView *, HbView *)), this, SLOT(onAboutToChangeView(HbView *, HbView *)));
}
}
+ loadActivity();
}
+
+void CpMainView::loadActivity()
+{
+ if (mMainModel == 0) {
+ return;
+ }
+ QVariant data = mActivityManager->activityData(QString("ControlPanelView"));
+ if (data.canConvert<QList<QVariant> >())
+ {
+ QList<QVariant> isExpanded = qvariant_cast<QList<QVariant> >(data);
+ HbDataFormModelItem *root = mMainModel->invisibleRootItem();
+ int groupCount = 0;
+
+ if (root) {
+ groupCount = root->childCount();
+ }
+
+ if (groupCount == isExpanded.count()) {
+ for (int i = 0; i < groupCount; i++) {
+ HbDataFormModelItem *groupItem = root->childAt(i);
+ QModelIndex index = mMainModel->indexFromItem(groupItem);
+ HbDataForm *form = qobject_cast<HbDataForm *>(widget());
+ if (form) {
+ if (isExpanded.at(i).toBool()) {
+ onDataFormItemActivated(index);
+ }
+ form->setExpanded(index,isExpanded.at(i).toBool());
+ }
+ }
+ }
+
+ mActivityManager->removeActivity("ControlPanelView");
+ }
+}
+
+void CpMainView::saveActivity()
+{
+ HbDataFormModelItem *root = mMainModel->invisibleRootItem();
+ int groupCount = 0;
+ QList<QVariant> isExpanded;
+ if (root) {
+ groupCount = root->childCount();
+ }
+ for (int i = 0; i < groupCount; i++) {
+ HbDataFormModelItem *groupItem = root->childAt(i);
+ QModelIndex index = mMainModel->indexFromItem(groupItem);
+ HbDataForm *form = qobject_cast<HbDataForm *>(widget());
+ isExpanded << form->isExpanded(index);
+ }
+
+ HbMainWindow *mainWindow = hbInstance->allMainWindows().first();
+ HbView *view = mainWindow->currentView();
+ if(this == view)
+ {
+ mScreenshot = QPixmap::grabWidget(mainWindow, mainWindow->rect());
+ }
+
+ QVariantHash metadata;
+ metadata.insert("screenshot", mScreenshot);
+ QVariant data(isExpanded);
+
+ mActivityManager->addActivity("ControlPanelView", data, metadata);
+}
+
+void CpMainView::onDataFormItemActivated(const QModelIndex &index)
+{
+ CPFW_LOG("CpMainView::onDataFormItemActivated");
+ HbDataFormModelItem *modelItem = mMainModel->itemFromIndex(index);
+ if (modelItem != 0 && modelItem->type() == HbDataFormModelItem::GroupItem) {
+ CpSettingFormItemData *itemData = static_cast<CpSettingFormItemData *>(modelItem);
+ if (CpCategorySettingFormItemData *categoryItemData = qobject_cast<CpCategorySettingFormItemData *>(itemData)) {
+ categoryItemData->initialize(*mItemDataHelper);
+ }
+ }
+
+}
+void CpMainView::onAboutToChangeView(HbView * oldView, HbView *newView)
+{
+ Q_UNUSED(newView);
+ if (this == oldView) {
+ mScreenshot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+ }
+ }
+
// End of File
--- a/controlpanelui/src/cpapplication/src/cpmainview.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/cpmainview.h Wed Sep 29 10:09:58 2010 +0800
@@ -24,6 +24,7 @@
class HbDataFormModelItem;
class CpItemDataHelper;
class HbMainWindow;
+class HbActivityManager;
class CpMainView : public CpBaseSettingView
{
@@ -32,14 +33,23 @@
explicit CpMainView(HbMainWindow *mainWindow = 0);
virtual ~CpMainView();
bool event(QEvent *e);
+public slots:
+ void loadActivity();
+ void saveActivity();
private slots:
void initializeMainModel();
+ void onAboutToChangeView(HbView * oldView, HbView *newView);
+ void onDataFormItemActivated(const QModelIndex &index);
private:
Q_DISABLE_COPY(CpMainView)
private:
CpMainModel *mMainModel;
CpItemDataHelper *mItemDataHelper;
HbMainWindow *mMainWindow;
+ // not own
+ HbActivityManager *mActivityManager;
+
+ QPixmap mScreenshot;
};
#endif
--- a/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -21,16 +21,26 @@
#include <cpcategorysettingformitemdata.h>
#include <hbapplication.h>
#include <cpevent.h>
-
+#include <QTimer>
//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<CpMainView *>(views().first());
+ if(mainView != 0) {
+ mainView->saveActivity();
+ }
+ if(mStartupTimer != 0) {
+ delete mStartupTimer;
+ }
}
bool CpMainWindow::event(QEvent *e)
@@ -43,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
--- a/controlpanelui/src/cpapplication/src/cpmainwindow.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/cpmainwindow.h Wed Sep 29 10:09:58 2010 +0800
@@ -19,7 +19,7 @@
#define CPMAINWINDOW_H
#include <hbmainwindow.h>
-
+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
--- a/controlpanelui/src/cpapplication/src/main.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/main.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -19,7 +19,7 @@
#include <cpmainwindow.h>
#include <cpmainview.h>
#include <hbstyleloader.h>
-#include <QTranslator>
+#include <hbtranslator.h>
#include <QLocale>
#include <QLatin1String>
#include <QDir>
@@ -35,23 +35,18 @@
QCoreApplication::setApplicationName("ControlPanel");
#ifdef ENABLE_CPFW_LOG
- Logger::instance(CPFW_LOGGER_NAME)->configure(
- CP_LOGGER_CONFIG_PATH,QSettings::IniFormat);
+ INIT_LOGGER(CPFW_LOGGER_NAME,CP_LOGGER_CONFIG_PATH)
#endif
#ifdef ENABLE_CPPERF_LOG
- Logger::instance(CPPERF_LOGGER_NAME)->configure(
- CP_LOGGER_CONFIG_PATH,QSettings::IniFormat);
+ INIT_LOGGER(CPPERF_LOGGER_NAME,CP_LOGGER_CONFIG_PATH)
#endif
CPFW_LOG("Entering ControlPanel.exe...");
CPPERF_LOG("Entering ControlPanel.exe...");
-
- QTranslator translator;
- if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations"))
- {
- qApp->installTranslator(&translator);
- }
+
+ HbTranslator translator("control_panel");
+ translator.loadCommon();
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css");
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css");
@@ -70,8 +65,6 @@
CPFW_LOG("Exiting ControlPanel.exe.");
- Logger::closeAll();
-
return ret;
}
--- a/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Wed Sep 29 10:09:58 2010 +0800
@@ -24,10 +24,13 @@
CONFIG += Hb xml
DEFINES += BUILD_CPCATEGORY_GLOBAL
-LIBS += -lcpframework
+LIBS += -lcplogger -lcpframework
symbian: {
TARGET.UID3 = 0X20028736
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: Utility class for cpcategorymodel.
*
*/
#include "cpcategorymodelutility.h"
@@ -110,7 +110,7 @@
event->mPluginFile = pluginConfig.mPluginFile;
//firstly, handle CpPluginInterface
- if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) {
+ if (CpPluginInterface *plugin = CpPluginLoader::loadCpPluginInterface(pluginConfig.mPluginFile)) {
CPFW_LOG("Load root component CpPluginInterface succeed.");
event->mPluginInterface = plugin;
}
@@ -164,7 +164,7 @@
QList<CpSettingFormItemData*> itemDataList;
//firstly, handle CpPluginInterface
- if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) {
+ if (CpPluginInterface *plugin = CpPluginLoader::loadCpPluginInterface(pluginConfig.mPluginFile)) {
CPFW_LOG("Load root component CpPluginInterface succeed.");
itemDataList = plugin->createSettingFormItemData(itemDataHelper);
}
@@ -181,11 +181,11 @@
if (itemData) {
//append the new created setting form item to its parent item.
parent->insertChild(startPosition++,itemData);
-
- if (CpCategorySettingFormItemData *categoryItemData
+ //commented this for only loading group plugin when startup
+ /*if (CpCategorySettingFormItemData *categoryItemData
= qobject_cast<CpCategorySettingFormItemData*>(itemData)) {
categoryItemData->initialize(itemDataHelper);
- }
+ }*/
//set the text and description from config if it is empty.
setEntryItemContentIfEmpty(itemData,pluginConfig.mDisplayName,pluginConfig.mDescription);
@@ -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<HbDataFormModelItem::DataItemType>(CpSettingFormEntryItemData::ListEntryItem)
+ && entryItemData->iconName().isEmpty()) {
+ entryItemData->setIconName(DEFAULT_ICON_LISTENTRYITEM);
}
return true;
--- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h Wed Sep 29 10:09:58 2010 +0800
@@ -19,6 +19,8 @@
#include <QString>
+#define DEFAULT_ICON_LISTENTRYITEM QLatin1String("qtg_large_non_default.nvg")
+
class HbDataFormModelItem;
class CpItemDataHelper;
class CpSettingFormItemData;
--- a/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -11,13 +11,16 @@
*
* Contributors:
*
-* Description:
+* Description: An extension to CpSettingFormItemData, can be filled with model items comes from controlpanel plugins.
*
*/
#include "cpcategorysettingformitemdata.h"
#include <QString>
#include "cpcategorymodelutility.h"
+/*
+ * Private implementation
+ */
class CpCategorySettingFormItemDataPrivate
{
public:
@@ -36,7 +39,9 @@
QString mConfigFile;
};
-
+/*
+ * Constructor
+ */
CpCategorySettingFormItemData::CpCategorySettingFormItemData(
HbDataFormModelItem::DataItemType type,
const QString &label,
@@ -47,6 +52,9 @@
{
}
+/*
+ * Overloaded constructor
+ */
CpCategorySettingFormItemData::CpCategorySettingFormItemData(
const QString &configFile /*= QString()*/,
const HbDataFormModelItem *parent /*= 0*/) :
@@ -55,11 +63,17 @@
{
}
+/*
+ * Desctructor
+ */
CpCategorySettingFormItemData::~CpCategorySettingFormItemData()
{
delete d;
}
+/*
+ * Initialize
+ */
void CpCategorySettingFormItemData::initialize(CpItemDataHelper &itemDataHelper)
{
//avoid to be called twice
@@ -82,12 +96,17 @@
}
}
-
+/*
+ * Derived class can override this function to do some specific work before loading config plugins
+ */
void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
{
}
-
+/*
+ * Derived class can override this function to do some specific work before loading config plugins
+ */
void CpCategorySettingFormItemData::afterLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
{
}
+//End of File
--- a/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -11,16 +11,18 @@
*
* Contributors:
*
-* Description:
+* Description: An extension to HbDataFormModel, can be filled with model items comes from controlpanel plugins.
*
*/
#include "cpcategorysettingformmodel.h"
#include <QString>
-
#include "cpcategorymodelutility.h"
#include <cpitemdatahelper.h>
+/*
+ * Private implementation
+ */
class CpCategorySettingFormModelPrivate
{
public:
@@ -39,16 +41,25 @@
QString mConfigFile;
};
+/*
+ * Constructor
+ */
CpCategorySettingFormModel::CpCategorySettingFormModel(const QString &configFile) :
d (new CpCategorySettingFormModelPrivate(configFile))
{
}
+/*
+ * Destructor
+ */
CpCategorySettingFormModel::~CpCategorySettingFormModel()
{
delete d;
}
+/*
+ * Initialize
+ */
void CpCategorySettingFormModel::initialize(CpItemDataHelper &itemDataHelper)
{
//avoid to be called twice
@@ -70,11 +81,18 @@
}
}
-
+/*
+ * Derived class can override this function to do some specific work before loading config plugins
+ */
void CpCategorySettingFormModel::beforeLoadingConfigPlugins(CpItemDataHelper&/*itemDataHelper*/)
{
}
+/*
+ * Derived class can override this function to do some specific work after loading config plugins
+ */
void CpCategorySettingFormModel::afterLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
{
}
+
+//End of File
--- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: Placeholder for plugin configured in cpcfg file but the target is missing.
*
*/
@@ -64,3 +64,6 @@
{
return 0;
}
+
+//End of File
+
--- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: Placeholder for plugin configured in cpcfg file but the target is missing.
*
*/
@@ -36,5 +36,6 @@
virtual CpBaseSettingView *createSettingView() const;
};
+#endif //CPPLACEHOLDERITEMDATA_H
-#endif //CPPLACEHOLDERITEMDATA_H
+//End of File
--- a/controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: An entry for a plugin defined in cpcfg file.
*
*/
--- a/controlpanelui/src/cpcategorymodel/src/cppluginconfig.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfig.h Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: An entry for a controlpanel plugin defined in cpcfg file.
*
*/
@@ -26,9 +26,9 @@
CpPluginConfig();
void dump();
public:
- int mUid;
+ int mUid; //UID3 for the plugin
QString mDisplayName;
- QString mPluginFile;
+ QString mPluginFile;
QString mDescription;
};
--- a/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: This class reads cpcfg files.
*
*/
@@ -27,19 +27,30 @@
const QString PLUGIN_DISPALYNAME_ATTR = "displayname";
const QString DESC_TAG = "desc";
+/*
+ * Constructor.
+ * @configPath : the full path of the config file.
+ */
CpPluginConfigReader::CpPluginConfigReader(const QString &configPath)
: mConfigPath (configPath)
{
}
+/*
+ * Desctructor
+ */
CpPluginConfigReader::~CpPluginConfigReader()
{
}
+/*
+ * Reads a cpcfg file, returns a list of CpPluginConfig.
+ */
QList<CpPluginConfig> CpPluginConfigReader::readCpPluginConfigs()
{
CPFW_LOG(QLatin1String("reading cpcfg file:") + mConfigPath);
+ // Empty config file
if (mConfigPath.isNull() || mConfigPath.isEmpty()) {
CPFW_LOG("CpPluginConfigReader::readCpPluginConfigs() mConfigPath is empty.");
return QList<CpPluginConfig> ();
@@ -47,11 +58,13 @@
QFile file(mConfigPath);
+ // Config file doesn't exist
if (!file.exists()) {
CPFW_LOG( mConfigPath + " does not exist.");
return QList<CpPluginConfig> ();
}
+ // Open config file failed
if (!file.open(QFile::ReadOnly | QFile::Text)) {
CPFW_LOG(QString("CpPluginConfigReader::readCpPluginConfigs() open file failed. Error:%1")
.arg(static_cast<int>(file.error()),0,10));
@@ -69,6 +82,9 @@
return cpPluginConfigList;
}
+/*
+ * Read a list of CpPluginConfig from a xml stream.
+ */
void CpPluginConfigReader::readCpPluginConfigs(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList)
{
xmlReader.readNext();
@@ -76,6 +92,7 @@
while (!xmlReader.atEnd()) {
if (xmlReader.isStartElement()) {
+ // Read <childplugins> node
if (xmlReader.name() == CHILD_PLUGINS_TAG) {
readChildPluginsElement(xmlReader, cpPluginConfigList);
}
@@ -90,6 +107,9 @@
}
}
+/*
+ * Read <childplugins> node.
+ */
void CpPluginConfigReader::readChildPluginsElement(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList)
{
xmlReader.readNext();
@@ -102,9 +122,11 @@
}
if (xmlReader.isStartElement()) {
+ // Read <plugin> node
if (xmlReader.name() == PLUGIN_TAG) {
readPluginElement(xmlReader, cpPluginConfigList);
}
+ // Skip invalid node
else {
skipUnknownElement(xmlReader);
}
@@ -116,34 +138,46 @@
}
}
+/*
+ * Read <plugin> node.
+ */
void CpPluginConfigReader::readPluginElement(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList)
{
CpPluginConfig cpPluginConfig;
QXmlStreamAttributes xmlAttributes = xmlReader.attributes();
+ // Read <id> attribute
if (xmlAttributes.hasAttribute(PLUGIN_ID_ATTR)) {
cpPluginConfig.mUid
= (xmlAttributes.value(PLUGIN_ID_ATTR)).toString().toUInt(0,16);
}
+ // Read <dll> attribute
if (xmlAttributes.hasAttribute(PLUGIN_DLL_ATTR)) {
cpPluginConfig.mPluginFile
= (xmlAttributes.value(PLUGIN_DLL_ATTR)).toString();
}
+ // Read <displayname> attribute
if (xmlAttributes.hasAttribute(PLUGIN_DISPALYNAME_ATTR)) {
cpPluginConfig.mDisplayName
= (xmlAttributes.value(PLUGIN_DISPALYNAME_ATTR)).toString();
}
+ // Read <description> node
readDescElement(xmlReader,cpPluginConfig);
+#ifdef ENABLE_CPFW_LOG
cpPluginConfig.dump();
+#endif
cpPluginConfigList.append(cpPluginConfig);
}
+/*
+ * Read <description> node.
+ */
void CpPluginConfigReader::readDescElement(QXmlStreamReader &xmlReader,CpPluginConfig &cpPluginConfig)
{
xmlReader.readNext();
@@ -156,12 +190,17 @@
}
if (xmlReader.isStartElement()) {
+ // valid description node
if (xmlReader.name() == DESC_TAG) {
cpPluginConfig.mDescription = xmlReader.readElementText();
if (xmlReader.isEndElement()) {
xmlReader.readNext();
}
}
+ // invalid node, skip it
+ else {
+ skipUnknownElement(xmlReader);
+ }
}
else {
@@ -170,6 +209,9 @@
}
}
+/*
+ * ignore invalid node.
+ */
void CpPluginConfigReader::skipUnknownElement(QXmlStreamReader &xmlReader)
{
xmlReader.readNext();
--- a/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: This class reads cpcfg files.
*
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/firstpluginforcpcategorymodel.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,58 @@
+#
+# 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 = firstpluginforcpcategorymodel
+
+MOC_DIR = moc
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ INCLUDEPATH += $$MOC_DIR
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+}
+
+CONFIG += hb plugin
+LIBS += -lcpframework
+CONFIG += symbian_test
+
+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)"
+}
+
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += src/firstpluginforcpcategorymodel.h \
+ src/firstpluginviewforcpcategorymodel.h
+
+SOURCES += src/firstpluginforcpcategorymodel.cpp \
+ src/firstpluginviewforcpcategorymodel.cpp
+
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginforcpcategorymodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,26 @@
+#include "firstpluginforcpcategorymodel.h"
+#include "firstpluginviewforcpcategorymodel.h"
+#include <cpsettingformentryitemdataimpl.h>
+
+FirstPluginForCpCategoryModel::FirstPluginForCpCategoryModel()
+{
+}
+
+FirstPluginForCpCategoryModel::~FirstPluginForCpCategoryModel()
+{
+}
+QList<CpSettingFormItemData*> FirstPluginForCpCategoryModel::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
+{
+ return QList<CpSettingFormItemData*>()
+ << new CpSettingFormEntryItemDataImpl<FirstPluginViewForCategoryModel>(
+ itemDataHelper,
+ tr("The plugin for test"),
+ tr("TestPlugin."));
+}
+
+CpBaseSettingView *FirstPluginForCpCategoryModel::createSettingView(const QVariant &hint) const
+{
+ return 0;
+}
+
+Q_EXPORT_PLUGIN2(FirstPluginForCpCategoryModel, FirstPluginForCpCategoryModel);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginforcpcategorymodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,20 @@
+#ifndef FIRSTPLUGINFORCPCATEGORYMODEL_H
+#define FIRSTPLUGINFORCPCATEGORYMODEL_H
+
+#include <qobject.h>
+#include <cpplugininterface.h>
+#include <cplauncherinterface.h>
+
+class FirstPluginForCpCategoryModel : public QObject, public CpPluginInterface, public CpLauncherInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(CpPluginInterface)
+ Q_INTERFACES(CpLauncherInterface)
+public:
+ FirstPluginForCpCategoryModel();
+ virtual ~FirstPluginForCpCategoryModel();
+ virtual QList<CpSettingFormItemData*> createSettingFormItemData(CpItemDataHelper &itemDataHelper) const;
+ virtual CpBaseSettingView *createSettingView(const QVariant &hint) const;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginviewforcpcategorymodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,45 @@
+#include "firstpluginviewforcpcategorymodel.h"
+
+#include <hbdataform.h>
+#include <qstringlist>
+#include <QDebug>
+#include <hbdataformmodel.h>
+#include <cpsettingformitemdata.h>
+#include <hbmessagebox.h>
+
+FirstPluginViewForCategoryModel::FirstPluginViewForCategoryModel(QGraphicsItem *parent)
+ : CpBaseSettingView(0,parent),
+ mGroupItem(0),
+ mSliderItem(0)
+{
+ HbDataForm *form = qobject_cast<HbDataForm*>(widget());
+ if (form) {
+ HbDataFormModel *model = new HbDataFormModel;
+
+ form->setHeading(tr("View from test plugin"));
+ mGroupItem = new HbDataFormModelItem(HbDataFormModelItem::GroupItem, QString("Group"));
+
+ model->appendDataFormItem(mGroupItem);
+
+ mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem,
+ QString("New Slider"));
+ mSliderItem->setContentWidgetData("iconEnabled","FALSE");
+ form->addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int)));
+ mGroupItem->appendChild(mSliderItem);
+
+ form->setModel(model);
+ }
+}
+FirstPluginViewForCategoryModel::~FirstPluginViewForCategoryModel()
+{
+}
+
+void FirstPluginViewForCategoryModel::testClose()
+{
+ close();
+}
+void FirstPluginViewForCategoryModel::sliderValueChanged(int value)
+{
+ //Disable the slider alert.
+ HbMessageBox::information(QString("slider value changed to:%1").arg(value));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginviewforcpcategorymodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,25 @@
+#ifndef FIRSTPLUGINVIEWFORCPCATEGORYMODEL_H
+#define FIRSTPLUGINVIEWFORCPCATEGORYMODEL_H
+
+#include <cpbasesettingview.h>
+#include <QGraphicsItem>
+
+class HbDataFormModelItem;
+class CpSettingFormItemData;
+
+class FirstPluginViewForCategoryModel : public CpBaseSettingView
+{
+ Q_OBJECT
+public:
+ explicit FirstPluginViewForCategoryModel(QGraphicsItem *parent = 0);
+ virtual ~FirstPluginViewForCategoryModel();
+public:
+ void testClose();
+private slots:
+ void sliderValueChanged(int value);
+
+private:
+ HbDataFormModelItem *mGroupItem;
+ CpSettingFormItemData *mSliderItem;
+};
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/secondpluginforcpcategorymodel.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,58 @@
+#
+# 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 = secondpluginforcpcategorymodel
+
+MOC_DIR = moc
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ INCLUDEPATH += $$MOC_DIR
+ TARGET.CAPABILITY = ALL -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+}
+
+CONFIG += hb plugin
+LIBS += -lcpframework
+CONFIG += symbian_test
+
+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)"
+}
+
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += src/secondpluginforcpcategorymodel.h \
+ src/secondpluginviewforcpcategorymodel.h
+SOURCES += src/secondpluginforcpcategorymodel.cpp \
+ src/secondpluginviewforcpcategorymodel.cpp
+
+
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginforcpcategorymodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,26 @@
+#include "secondpluginforcpcategorymodel.h"
+#include "secondpluginviewforcpcategorymodel.h"
+#include <cpsettingformentryitemdataimpl.h>
+
+SecondPluginForCpCategoryModel::SecondPluginForCpCategoryModel()
+{
+}
+
+SecondPluginForCpCategoryModel::~SecondPluginForCpCategoryModel()
+{
+}
+QList<CpSettingFormItemData*> SecondPluginForCpCategoryModel::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
+{
+ return QList<CpSettingFormItemData*>()
+ << new CpSettingFormEntryItemDataImpl<SecondPluginViewForCategoryModel>(
+ itemDataHelper,
+ tr("The plugin for test"),
+ tr("TestPlugin."));
+}
+
+CpBaseSettingView *SecondPluginForCpCategoryModel::createSettingView(const QVariant &hint) const
+{
+ return 0;
+}
+
+Q_EXPORT_PLUGIN2(SecondPluginForCpCategoryModel, SecondPluginForCpCategoryModel);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginforcpcategorymodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,20 @@
+#ifndef SECONDPLUGINFORCPCATEGORYMODEL_H
+#define SECONDPLUGINFORCPCATEGORYMODEL_H
+
+#include <qobject.h>
+#include <cpplugininterface.h>
+#include <cplauncherinterface.h>
+
+class SecondPluginForCpCategoryModel : public QObject, public CpPluginInterface, public CpLauncherInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(CpPluginInterface)
+ Q_INTERFACES(CpLauncherInterface)
+public:
+ SecondPluginForCpCategoryModel();
+ virtual ~SecondPluginForCpCategoryModel();
+ virtual QList<CpSettingFormItemData*> createSettingFormItemData(CpItemDataHelper &itemDataHelper) const;
+ virtual CpBaseSettingView *createSettingView(const QVariant &hint) const;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginviewforcpcategorymodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,45 @@
+#include "secondpluginviewforcpcategorymodel.h"
+
+#include <hbdataform.h>
+#include <qstringlist>
+#include <QDebug>
+#include <hbdataformmodel.h>
+#include <cpsettingformitemdata.h>
+#include <hbmessagebox.h>
+
+SecondPluginViewForCategoryModel::SecondPluginViewForCategoryModel(QGraphicsItem *parent)
+ : CpBaseSettingView(0,parent),
+ mGroupItem(0),
+ mSliderItem(0)
+{
+ HbDataForm *form = qobject_cast<HbDataForm*>(widget());
+ if (form) {
+ HbDataFormModel *model = new HbDataFormModel;
+
+ form->setHeading(tr("View from test plugin"));
+ mGroupItem = new HbDataFormModelItem(HbDataFormModelItem::GroupItem, QString("Group"));
+
+ model->appendDataFormItem(mGroupItem);
+
+ mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem,
+ QString("New Slider"));
+ mSliderItem->setContentWidgetData("iconEnabled","FALSE");
+ form->addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int)));
+ mGroupItem->appendChild(mSliderItem);
+
+ form->setModel(model);
+ }
+}
+SecondPluginViewForCategoryModel::~SecondPluginViewForCategoryModel()
+{
+}
+
+void SecondPluginViewForCategoryModel::testClose()
+{
+ close();
+}
+void SecondPluginViewForCategoryModel::sliderValueChanged(int value)
+{
+ //Disable the slider alert.
+ HbMessageBox::information(QString("slider value changed to:%1").arg(value));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginviewforcpcategorymodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,25 @@
+#ifndef SECONDPLUGINVIEWFORCPCATEGORYMODEL_H
+#define SECONDPLUGINVIEWFORCPCATEGORYMODEL_H
+
+#include <cpbasesettingview.h>
+#include <QGraphicsItem>
+
+class HbDataFormModelItem;
+class CpSettingFormItemData;
+
+class SecondPluginViewForCategoryModel : public CpBaseSettingView
+{
+ Q_OBJECT
+public:
+ explicit SecondPluginViewForCategoryModel(QGraphicsItem *parent = 0);
+ virtual ~SecondPluginViewForCategoryModel();
+public:
+ void testClose();
+private slots:
+ void sliderValueChanged(int value);
+
+private:
+ HbDataFormModelItem *mGroupItem;
+ CpSettingFormItemData *mSliderItem;
+};
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/unit_common.pri Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,29 @@
+#
+# 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:
+#
+
+QT += testlib
+CONFIG += hb qtestlib
+
+QMAKE_EXTRA_TARGETS += test autotest
+
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger)
+ TARGET.CAPABILITY = ALL -TCB
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/data/pluginfileformodelitemdata.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,5 @@
+<childplugins>
+ <plugin displayname = "firstpluginforcpcategorymodel" dll = "firstpluginforcpcategorymodel.dll">
+ <desc></desc>
+ </plugin>
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/runtest.bat Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+\epoc32\RELEASE\WINSCW\udeb\ut_categorymodelitemdata.exe -xml -o c:\ut_categorymodelitemdata.xml
+copy \epoc32\winscw\c\ut_categorymodelitemdata.xml
+del \epoc32\winscw\c\ut_categorymodelitemdata.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/src/ut_categorymodelitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,136 @@
+/*
+* 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:
+* test application for qt cpcategorymodel functions.
+*/
+
+#include "ut_categorymodelitemdata.h"
+#include "cpcategorysettingformitemdata.h"
+#include <QtTest/QtTest>
+#include <cpitemdatahelper.h>
+#include <hbdataformmodel.h>
+#include <hbdataformmodelitem.h>
+#include <HbView.h>
+
+/*!
+ \class TestCpCategorySettingFormItem \n
+ \brief class name: TestCpCategorySettingFormItem \n
+ type of test case: unit test \n
+ test cases' number totally: 3 \n
+ */
+
+void TestCpCategorySettingFormItem::initTestCase()
+{
+ // initialize public test data here
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: \n
+ CpCategorySettingFormItemData(HbDataFormModelItem::DataItemType type,
+ const QString &label,
+ const QString &configFile,
+ const HbDataFormModelItem *parent = 0) \n
+ 2. Case Descrition: Test the first constructor function. \n
+ 3. Input Parameters: \n
+ (1) type = HbDataFormModelItem::DataItemType,
+ label = QString("XX"),
+ configFile = QString("XX"),
+ parent = new HbDataFormModelItem() \n
+ (2) type = HbDataFormModelItem::DataItemType,
+ label = QString(),
+ configFile = QString(),
+ parent = new HbDataFormModelItem()\n
+ 4. Expected result: \n
+ (1) no crash\n
+ (2) no crash \n
+ */
+void TestCpCategorySettingFormItem::testFirstConstructor()
+{
+ HbDataFormModelItem::DataItemType aType = HbDataFormModelItem::CheckBoxItem;
+ QString aLabel = "testLabel";
+ QString configFile = "testFile";
+ HbDataFormModelItem *pParent = new HbDataFormModelItem();
+
+ CpCategorySettingFormItemData *pCategoryItemData = new CpCategorySettingFormItemData(aType, aLabel, configFile, pParent);
+ QVERIFY(pCategoryItemData != 0 );
+ QVERIFY(pCategoryItemData->type()== aType);
+ delete pParent;
+
+ pCategoryItemData = new CpCategorySettingFormItemData(aType, QString(), QString(), 0);
+ QVERIFY(pCategoryItemData != 0 );
+ QVERIFY(pCategoryItemData->type()== aType);
+ delete pCategoryItemData;
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: \n
+ explicit CpCategorySettingFormItemData(const QString &configFile = QString(), const HbDataFormModelItem *parent = 0);
+ 2. Case Descrition: \n
+ Test the second constructor function. \n
+ 3. Input Parameters: \n
+ (1) configFile = QString("XX"), *parent = new HbDataFormModelItem()\n
+ (2) configFile = QString(""), *parent = new HbDataFormModelItem() \n
+ 4. Expected result: \n
+ (1) no crash \n
+ (2) no crash
+ */
+void TestCpCategorySettingFormItem::testSecondConstructor()
+{
+ QString configFile = "testFile";
+ HbDataFormModelItem *pParent = new HbDataFormModelItem();
+ CpCategorySettingFormItemData *pCategoryItemData = new CpCategorySettingFormItemData(configFile, pParent);
+ delete pParent;
+
+ pCategoryItemData = new CpCategorySettingFormItemData(QString(), 0);
+ QVERIFY(pCategoryItemData != 0 );
+ delete pCategoryItemData;
+ pCategoryItemData = 0;
+
+ pCategoryItemData = new CpCategorySettingFormItemData();
+ QVERIFY(pCategoryItemData != 0 );
+ delete pCategoryItemData;
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: void initialize(CpItemDataHelper &itemDataHelper); \n
+ 2. Case Descrition: Test the initialize() function. \n
+ 3. Input Parameters: (1) itemDataHelper = new itemDataHelper() \n
+ 4. Expected result: (1) no crash \n
+ */
+void TestCpCategorySettingFormItem::testInit()
+{
+ CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
+ QString configFile = "pluginfileformodelitemdata.cpcfg";
+ HbDataFormModelItem *pParent = new HbDataFormModelItem();
+ CpCategorySettingFormItemData *pCategoryItemData = new CpCategorySettingFormItemData(configFile, pParent);
+ QVERIFY(pCategoryItemData != 0 );
+ // mInitialized = FALSE
+ pCategoryItemData->initialize(*itemDataHelper);
+ // call initialize() again in order to test another branch (mInitialized = TRUE)
+ pCategoryItemData->initialize(*itemDataHelper);
+ delete itemDataHelper;
+ delete pParent;
+}
+
+void TestCpCategorySettingFormItem::cleanupTestCase()
+{
+ // release all test data
+ QCoreApplication::processEvents();
+}
+
+QTEST_MAIN(TestCpCategorySettingFormItem)
+//QTEST_APPLESS_MAIN(TestCpCategorySettingFormItem)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/src/ut_categorymodelitemdata.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* 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:
+* test the functions in cpcategorysettingformmodel class
+*/
+
+#ifndef UT_CATEGORYMODELITEMDATA_H_
+#define UT_CATEGORYMODELITEMDATA_H_
+
+#include <QObject>
+class TestCpCategorySettingFormItem :public QObject
+{
+ Q_OBJECT
+private slots:
+
+ void initTestCase();
+
+ void testFirstConstructor(); // test the constructor
+ void testSecondConstructor(); // test the constructor
+ void testInit(); // test the initialize function
+
+ void cleanupTestCase();
+};
+#endif /* UT_CATEGORYMODELITEMDATA_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/ut_categorymodelitemdata.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = app
+TARGET = ut_categorymodelitemdata
+QT += testlib
+CONFIG += hb qtestlib
+CONFIG += symbian_test
+
+QMAKE_EXTRA_TARGETS += test autotest
+
+DEPENDPATH += .
+
+INCLUDEPATH += ../../src \
+ ../../../inc
+
+LIBS += -lcpframework
+LIBS += -lcpcategorymodel
+
+# Input
+HEADERS += src/ut_categorymodelitemdata.h
+SOURCES += src/ut_categorymodelitemdata.cpp
+
+symbian*: {
+ TARGET.CAPABILITY = CAP_APPLICATION
+ LIBS += -lfirstpluginforcpcategorymodel
+
+ deploy.path = C:
+ testdll.sources += firstpluginforcpcategorymodel.dll
+ testdll.path = /sys/bin
+
+ testqtplugin.sources += ../testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/qmakepluginstubs/firstpluginforcpcategorymodel.qtplugin
+ testqtplugin.path = /resource/qt/plugins/controlpanel
+
+ testqtcfgfile.sources += data/pluginfileformodelitemdata.cpcfg
+ testqtcfgfile.path = /resource/qt/plugins/controlpanel/config
+
+ DEPLOYMENT += testdll \
+ testqtplugin \
+ testqtcfgfile
+}
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/data/configfiletestformodelutility.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,8 @@
+<childplugins>
+ <plugin displayname = "" id = "" dll = "firstpluginforcpcategorymodel.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "" id = "" dll = "secondpluginforcpcategorymodel.dll">
+ <desc></desc>
+ </plugin>
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/runtest.bat Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+\epoc32\RELEASE\WINSCW\udeb\ut_categorymodelutility.exe -xml -o c:\ut_categorymodelutility.xml
+copy \epoc32\winscw\c\ut_categorymodelutility.xml
+del \epoc32\winscw\c\ut_categorymodelutility.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/cptestpluginentryitem.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,34 @@
+#include "CpTestPluginEntryItem.h"
+
+#include <cpitemdatahelper.h>
+#include <hbaction.h>
+#include <QFileInfo>
+CpTestPluginEntryItemData::CpTestPluginEntryItemData(const HbDataFormModelItem *parent /* = 0*/)
+{
+
+}
+CpTestPluginEntryItemData::CpTestPluginEntryItemData(CpItemDataHelper &itemDataHelper,
+ const QString &text /*= QString()*/,
+ const QString &description /*= QString()*/,
+ const HbIcon &icon /*= HbIcon()*/,
+ const HbDataFormModelItem *parent /*= 0*/)
+ : CpSettingFormEntryItemData(itemDataHelper,
+ text,
+ description,
+ icon,
+ parent)
+{
+}
+
+CpTestPluginEntryItemData::~CpTestPluginEntryItemData()
+{
+}
+
+void CpTestPluginEntryItemData::testOnLaunchView()
+{
+ onLaunchView();
+}
+CpBaseSettingView *CpTestPluginEntryItemData::createSettingView() const
+{
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/cptestpluginentryitem.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,21 @@
+#ifndef CPTESTPLUGINENTRYITEM_H
+#define CPTESTPLUGINENTRYITEM_H
+#include <cpsettingformentryitemdata.h>
+
+class CpTestPluginEntryItemData : public CpSettingFormEntryItemData
+{
+ Q_OBJECT
+public:
+ explicit CpTestPluginEntryItemData(const HbDataFormModelItem *parent /* = 0*/);
+ explicit CpTestPluginEntryItemData(CpItemDataHelper &itemDataHelper,
+ const QString &text = QString(),
+ const QString &description = QString(),
+ const HbIcon &icon = HbIcon(),
+ const HbDataFormModelItem *parent = 0);
+ virtual ~CpTestPluginEntryItemData();
+public slots:
+ void testOnLaunchView();
+private:
+ virtual CpBaseSettingView *createSettingView() const;
+};
+#endif // CPTESTPLUGINENTRYITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,220 @@
+/*
+* 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:
+* test application for qt cpcategorymodel functions.
+*/
+
+#include "ut_categorymodelutility.h"
+#include "cptestpluginentryitem.h"
+#include <cpsettingformentryitemData.h>
+#include "cpcategorysettingformitemdata.h"
+#include "cpcategorysettingformmodel.h"
+#include "cppluginconfig.h"
+#include "cpcategorymodelutility.h"
+#include <QtTest/QtTest>
+//#include <cpplaceholderitemdata.h>
+#include <cppluginconfigreader.h>
+#include <cpitemdatahelper.h>
+//#include <cpbasepath.h>
+//#include <cpevent.h>
+
+
+//the class for test
+#include "cpcategorymodelutility.h"
+/*!
+ \class TestCpCategoryModelUtility \n
+ \brief class name: TestCpCategoryModelUtility \n
+ type of test case: unit test \n
+ test cases' number totally: 7 \n
+ */
+
+void TestCpCategoryModelUtility::initTestCase()
+{
+ // initialize public test data here
+
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: \n
+ static bool setEntryItemContentIfEmpty(CpSettingFormItemData *itemData,
+ const QString &displayName,
+ const QString &description) \n
+ 2. Case Descrition: \n
+ Test the function when setting itemData as 0. \n
+ 3. Input Parameters:\n
+ <1> itemData = 0, QString(), QString() \n
+ 4. Expected result: \n
+ <1> bSetResult = false \n
+ */
+void TestCpCategoryModelUtility::testSetEntryItemReturnFalse()
+{
+ bool bSetResult = CpCategoryModelUtility::setEntryItemContentIfEmpty(0, QString(), QString());
+ QVERIFY(bSetResult == false);
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: \n
+ static bool setEntryItemContentIfEmpty(CpSettingFormItemData *itemData,
+ const QString &displayName,
+ const QString &description) \n
+ 2. Case Descrition: \n
+ setEntryItemContentIfEmpty \n
+ 3. Input Parameters:\n
+ new a subclass from CpSettingFormEntryItemData firstly. \n
+ <1> itemData = new CpTestPluginEntryItemData(CpItemDataHelper, QString(XX), QString(XX),HbIcon(QString(XX))), \n
+ newText = QString(XX), \n
+ newDes = QString(XX),\n
+ newIconName = QString(XX).\n
+ <2> itemData = new CpTestPluginEntryItemData(CpItemDataHelper, QString(),QString(), HbIcon())\n
+ newText = QString(XX),\n
+ newDes = QString(XX) \n
+ 4. Expected result: \n
+ <1> bSetResult = true,\n
+ <2> bSetResult = true, \n
+ */
+void TestCpCategoryModelUtility::testSetEntryItemContent()
+{
+ CpItemDataHelper *pHelper = new CpItemDataHelper();
+ QString textNotEmpty = "TextNotEmpty";
+ QString description = "descriptionNotEmpty";
+ QString iconName = "iconNameNotEmpty";
+ HbIcon icon = HbIcon(iconName);
+ CpTestPluginEntryItemData *itemData1 = new CpTestPluginEntryItemData(*pHelper, textNotEmpty, description,icon);
+ QString newText = "newSetText";
+ QString newDes = "newSetdescription";
+ bool bSetResult1 = CpCategoryModelUtility::setEntryItemContentIfEmpty(itemData1, newText, newDes);
+ QVERIFY(bSetResult1 == true);
+ // verify the text, description and icon name cannot be set when they are not empty.
+ QVERIFY( itemData1->text() == textNotEmpty );
+ QVERIFY( itemData1->description() == description );
+ QVERIFY( itemData1->iconName() == iconName );
+ delete itemData1;
+
+ CpTestPluginEntryItemData *itemData2 = new CpTestPluginEntryItemData(*pHelper, QString(), QString(),HbIcon());
+ bool bSetResult2 = CpCategoryModelUtility::setEntryItemContentIfEmpty(itemData2, newText, newDes);
+ QVERIFY(bSetResult2 == true);
+ // verify the text, description and icon name are set as default when they are empty.
+ QVERIFY(itemData2->text() == newText);
+ QVERIFY( itemData2->description() == newDes );
+ QString temp = itemData2->iconName();
+ QVERIFY( itemData2->iconName() == DEFAULT_ICON_LISTENTRYITEM );
+ delete itemData2;
+ delete pHelper;
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: drives()\n
+ 2. Case Descrition: \n
+ Verify that it can get all physical drives of the devices \n
+ 3. Input Parameters: none \n
+ 4. Expected result: dirs.count() != 0 \n
+ */
+void TestCpCategoryModelUtility::testDrives()
+{
+ QStringList dirs = CpCategoryModelUtility::drives();
+ // verify the drives "C:, D:, Z:" are contained in the string list.
+ QVERIFY( dirs.contains( "C:", Qt::CaseSensitive ) );
+ QVERIFY( dirs.contains( "D:", Qt::CaseSensitive ) );
+ QVERIFY( dirs.contains( "Z:", Qt::CaseSensitive ) );
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: configFileDirectories() \n
+ 2. Case Descrition: \n
+ Verify that it can get all config directories of the device \n
+ 3. Input Parameters: none \n
+ 4. Expected result: dirs.count() != 0 \n
+ */
+void TestCpCategoryModelUtility::testPluginDirectories()
+{
+ QStringList dirs = CpCategoryModelUtility::pluginDirectories();
+ qDebug() << dirs;
+ // Verify the right plugin directory path is returned.
+ QVERIFY( dirs.contains( QString( "C:/resource/qt/plugins/controlpanel" ) + QDir::separator(), Qt::CaseSensitive ) );
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: configFileDirectories() \n
+ 2. Case Descrition: Verify that it can get all config directories of the device. \n
+ 3. Input Parameters: none \n
+ 4. Expected result: dirs.count() != 0 \n
+ */
+void TestCpCategoryModelUtility::testConfigFileDirectories()
+{
+ QStringList dirs = CpCategoryModelUtility::configFileDirectories();
+ qDebug() << dirs;
+ // Verify the right config file directory path is returned.
+ QVERIFY( dirs.contains( QString( "C:/resource/qt/plugins/controlpanel/config" ) + QDir::separator(), Qt::CaseSensitive ) );
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: buildConfigPluginItems()\n
+ 2. Case Descrition: Verify that it can load the plugins via the plugin config file and create item data of the corresponding plugin succesfully.\n
+ 3. Input Parameters:\n
+ <1> parent = HbDataFormModelItem(), configFile = QString(XX), pHelper = new CpItemDataHelper(), startPosition = -10\n
+ <2> parent = HbDataFormModelItem(), configFile = QString(), pHelper = new CpItemDataHelper(), startPosition = 1\n
+
+ 4. Expected result: \n
+ <1> parent->childCount() == 2 \n
+ <2> parent->childCount() == 2 \n
+ */
+void TestCpCategoryModelUtility::testBuildConfigPluginItems()
+{
+// HbDataFormModelItem *parent = new HbDataFormModelItem();
+// QString configFile = "configfiletestformodelutility.cpcfg";
+// int startPosition = 1;
+//
+// CpItemDataHelper helper;
+// CpCategoryModelUtility::buildConfigPluginItems(parent, configFile, helper, startPosition);
+// int childCount = parent->childCount();
+// // the configfiletestformodelutility.cpcfg contains two control panel plugins.
+// QVERIFY( parent->childCount() == 2 );
+//
+// CpCategoryModelUtility::buildConfigPluginItems(parent, configFile, helper, -10);
+// QVERIFY( parent->childCount() == 2 );
+//
+// delete parent;
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: CreateCpPluginItemData() \n
+ 2. Case Descrition: \n
+
+ 3. Input Parameters: \n
+
+ 4. Expected result: \n
+
+ */
+void TestCpCategoryModelUtility::testCreateCpPluginItemData()
+{
+ //
+}
+
+/*!
+ Descrition of what you will do in this function
+ */
+void TestCpCategoryModelUtility::cleanupTestCase()
+{
+ // release all test data
+ QCoreApplication::processEvents();
+}
+
+QTEST_MAIN(TestCpCategoryModelUtility)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* test the functions in cpcategorysettingformmodel class
+*/
+
+#ifndef UT_CATEGORYMODELUTILITY_H_
+#define UT_CATEGORYMODELUTILITY_H_
+
+#include <QObject>
+
+class TestCpCategoryModelUtility :public QObject
+{
+ Q_OBJECT
+private slots:
+
+ void initTestCase();
+
+ void testSetEntryItemReturnFalse(); // test the setEntryItemContentIfEmpty() function can return false
+ void testSetEntryItemContent(); //
+ void testDrives(); // test the drives() function
+ void testPluginDirectories(); // test the pluginDirectories() function
+ void testConfigFileDirectories(); // test the configFileDirectories() function
+ void testBuildConfigPluginItems(); // test the buildConfigPluginItems() function
+ void testCreateCpPluginItemData();
+ void cleanupTestCase();
+};
+#endif /* UT_CATEGORYMODELUTILITY_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/ut_categorymodelutility.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,62 @@
+#
+# 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 = app
+TARGET = ut_categorymodelutility
+
+QT += testlib
+CONFIG += hb qtestlib
+CONFIG += symbian_test
+
+DEPENDPATH += .
+
+QMAKE_EXTRA_TARGETS += test autotest
+
+include ( ../../../common.pri )
+include (../unit_common.pri)
+include(../../../inc/inc.pri)
+include(../../cpcategorymodel.pri)
+
+LIBS += -lcpframework -lcplogger
+
+CONFIG += Hb xml
+DEFINES += BUILD_CPCATEGORY_GLOBAL
+
+symbian*: {
+ TARGET.CAPABILITY = CAP_APPLICATION
+ LIBS += -lfirstpluginforcpcategorymodel \
+ -lsecondpluginforcpcategorymodel
+
+ deploy.path = C:
+ testdlls.sources += firstpluginforcpcategorymodel.dll \
+ secondpluginforcpcategorymodel.dll
+ testdlls.path = /sys/bin
+
+ testqtplugins.sources += ../testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/qmakepluginstubs/firstpluginforcpcategorymodel.qtplugin \
+ ../testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/qmakepluginstubs/secondpluginforcpcategorymodel.qtplugin
+ testqtplugins.path = /resource/qt/plugins/controlpanel
+
+ testqtcfgfile.sources += data/configfiletestformodelutility.cpcfg
+ testqtcfgfile.path = /resource/qt/plugins/controlpanel/config
+
+ DEPLOYMENT += testdlls \
+ testqtplugins \
+ testqtcfgfile
+}
+HEADERS += src/*.h
+SOURCES += src/*.cpp
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/data/pluginfileforformmodel.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,5 @@
+<childplugins>
+ <plugin displayname = "firstpluginforcpcategorymodel" dll = "firstpluginforcpcategorymodel.dll">
+ <desc></desc>
+ </plugin>
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/runtest.bat Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+\epoc32\RELEASE\WINSCW\udeb\ut_cpcategorysettingformmodel.exe -xml -o c:\ut_cpcategorysettingformmodel.xml
+copy \epoc32\winscw\c\ut_cpcategorysettingformmodel.xml
+del \epoc32\winscw\c\ut_cpcategorysettingformmodel.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/src/ut_cpcategorysettingformmodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,100 @@
+/*
+* 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:
+* test application for qt cpcategorymodel functions.
+*/
+
+#include "ut_cpcategorysettingformmodel.h"
+
+#include <QtTest/QtTest>
+#include <cpitemdatahelper.h>
+#include <hbdataformmodel.h>
+#include <hbdataformmodelitem.h>
+#include <HbView.h>
+//the class for test
+#include "cpcategorysettingformmodel.h"
+/*!
+ \class TestCpCategorySettingFormModel
+ \brief describe the test case's goal, like: \n
+ class name: cpcategorysettingformmodel \n
+ class's description \n
+ type of test case: unit test \n
+ test cases' number totally: 2\n
+ */
+
+void TestCpCategorySettingFormModel::initTestCase()
+{
+ // initialize public test data here
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: explicit CpCategorySettingFormModel(const QString &configFile);\n
+ 2. Case Descrition: test the constructor function. \n
+ 3. Input Parameters: \n
+ (1) configFile = QString("pluginfileforformmodel.cpcfg")\n
+ (2) configFile = QString()\n
+ (3) conFile = QString("invaildConfigFile")\n
+4. Expected result: \n
+ (1) no crash\n
+ (2) no crash\n
+ (3) no crash \n
+ */
+void TestCpCategorySettingFormModel::testConstructor()
+{
+ CpCategorySettingFormModel *testCategoryModel = new CpCategorySettingFormModel(QString("pluginfileforformmodel.cpcfg"));
+ QVERIFY(testCategoryModel!=0);
+ delete testCategoryModel;
+ testCategoryModel = 0;
+ testCategoryModel = new CpCategorySettingFormModel(QString());
+ QVERIFY(testCategoryModel!=0);
+ delete testCategoryModel;
+ testCategoryModel = 0;
+ testCategoryModel = new CpCategorySettingFormModel(QString("invaildConfigFile"));
+ QVERIFY(testCategoryModel!=0);
+ delete testCategoryModel;
+ testCategoryModel = 0;
+}
+
+/*!
+ Test Case Description: \n
+ 1. Fucntion Name: virtual void initialize(CpItemDataHelper &itemDataHelper)\n
+ 2. Case Descrition: Verify that it can initialize the new categoryformmodel. \n
+ 3. Input Parameters: (1) itemDataHelper = CpItemDataHelper\n
+ 4. Expected result: (1) no crash\n
+ */
+void TestCpCategorySettingFormModel::testInit()
+{
+ CpCategorySettingFormModel *testCategoryModel = new CpCategorySettingFormModel(QString("pluginfileforformmodel.cpcfg"));
+ CpItemDataHelper *pHelper = new CpItemDataHelper();
+ testCategoryModel->initialize(*pHelper);
+ // set mInitialized = TRUE
+ testCategoryModel->initialize(*pHelper);
+ delete testCategoryModel;
+ testCategoryModel = 0;
+ delete pHelper;
+ pHelper = 0;
+}
+
+/*!
+ Release all the test data.
+ */
+void TestCpCategorySettingFormModel::cleanupTestCase()
+{
+ // release all test data
+ QCoreApplication::processEvents();
+}
+
+QTEST_MAIN(TestCpCategorySettingFormModel)
+//QTEST_APPLESS_MAIN(TestCpCategorySettingFormModel)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/src/ut_cpcategorysettingformmodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* test the functions in cpcategorysettingformmodel class
+*/
+
+#ifndef UT_CPCATEGORYSETTINGFORMMODEL_H_
+#define UT_CPCATEGORYSETTINGFORMMODEL_H_
+
+#include <QObject>
+class TestCpCategorySettingFormModel :public QObject
+{
+ Q_OBJECT
+private slots:
+
+ void initTestCase();
+
+ void testConstructor(); // test the constructor
+ void testInit(); // test the initialize() funtion
+
+ void cleanupTestCase();
+};
+#endif /* UT_CPCATEGORYSETTINGFORMMODEL_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/ut_cpcategorysettingformmodel.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = app
+TARGET = ut_cpcategorysettingformmodel
+QT += testlib
+CONFIG += hb qtestlib
+CONFIG += symbian_test
+
+
+QMAKE_EXTRA_TARGETS += test autotest
+
+DEPENDPATH += .
+
+INCLUDEPATH += ../../src \
+ ../../../inc
+
+LIBS += -lcpframework
+LIBS += -lcpcategorymodel
+
+# Input
+HEADERS += src/ut_cpcategorysettingformmodel.h
+SOURCES += src/ut_cpcategorysettingformmodel.cpp
+
+symbian*: {
+ TARGET.CAPABILITY = CAP_APPLICATION
+ LIBS += -lfirstpluginforcpcategorymodel
+
+ deploy.path = C:
+ testdll.sources += firstpluginforcpcategorymodel.dll
+ testdll.path = /sys/bin
+
+ testqtplugin.sources += data/firstpluginforcpcategorymodel.qtplugin
+ testqtplugin.path = /resource/qt/plugins/controlpanel
+
+ testqtcfgfile.sources += data/pluginfileforformmodel.cpcfg
+ testqtcfgfile.path = /resource/qt/plugins/controlpanel/config
+
+ DEPLOYMENT += testdll \
+ testqtplugin \
+ testqtcfgfile
+}
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithemptychildelement.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,1 @@
+<childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithoutattrs.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,5 @@
+<childplugins>
+ <plugin>
+ <desc></desc>
+ </plugin>
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongchildtag.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,14 @@
+<wrongchildplugins>
+ <plugin displayname = "Ring tone" id = "0X20028738" dll = "cpringtoneplugin.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Theme" id = "0X2002C2F3" dll = "cpthemeplugin.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Profile" id = "0X20028739" dll = "cpprofileactivator.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Key touch screen" id = "0X20025FDE" dll = "cpkeytouchfdbkplugin.dll">
+ <desc></desc>
+ </plugin>
+</childplugins
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongdesctag.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,11 @@
+<childplugins>
+ <plugin displayname = "Ring tone" id = "0X20028738" dll = "cpringtoneplugin.dll">
+
+ </plugin>
+ <plugin displayname = "Profile" id = "0X20028739" dll = "cpprofileactivator.dll">
+ <wrongdesc></wrongdesc>
+ </plugin>
+ <plugin displayname = "Key touch screen" id = "0X20025FDE" dll = "cpkeytouchfdbkplugin.dll">
+ <desc></wrongdesc>
+ </plugin>
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongplugintag.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,8 @@
+<childplugins>
+ <wrongplugintag displayname = "Ring tone" id = "0X20028738" dll = "cpringtoneplugin.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Theme" id = "0X2002C2F3" dll = "cpthemeplugin.dll">
+ <desc></desc>
+ </wrong plugin
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfortest.cpcfg Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,14 @@
+<childplugins>
+ <plugin displayname = "Ring tone" id = "0X20028738" dll = "cpringtoneplugin.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Theme" id = "0X2002C2F3" dll = "cpthemeplugin.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Profile" id = "0X20028739" dll = "cpprofileactivator.dll">
+ <desc></desc>
+ </plugin>
+ <plugin displayname = "Key touch screen" id = "0X20025FDE" dll = "cpkeytouchfdbkplugin.dll">
+ <desc></desc>
+ </plugin>
+</childplugins>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/runtest.bat Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+\epoc32\RELEASE\WINSCW\udeb\ut_cppluginconfigreader.exe -xml -o c:\ut_cppluginconfigreader.xml
+copy \epoc32\winscw\c\ut_cppluginconfigreader.xml
+del \epoc32\winscw\c\ut_cppluginconfigreader.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/src/ut_cppluginconfigreader.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,226 @@
+/*
+* 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:
+* test the functions in cppluginconfigreader class
+*/
+
+#include "ut_cppluginconfigreader.h"
+#include <QtTest/QtTest>
+#include <cppluginconfigreader.h>
+#include <cpbasepath.h>
+#include <qdir.h>
+
+/*!
+ class name: cppluginconfigreader
+ class's description:
+ type of test case: unit test
+ test cases' number totally: \n
+*/
+
+/*!
+ Description of test data \n
+ */
+void TestCppluginConfigReader::initTestCase()
+{
+ // initialize public test data here
+}
+
+void TestCppluginConfigReader::testConstructor()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "mainview.cpcfg");
+ QVERIFY(pReader!=0);
+ delete pReader;
+}
+
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ QList<CpPluginConfig> readCpPluginConfigs();\n
+ 2. Case Descrition: \n
+ Verify that the valid config file can be read correctly. \n
+ 3. Input Parameters:\n
+ <1> valid configfiles: pluginfortest.cpcfg \n
+ 4. Expected result: \n
+ <1> return the correct plugin number \n
+ */
+void TestCppluginConfigReader::testReadValidConfigFile()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfortest.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY(mCorrectConfig.count() == 4 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ QList<CpPluginConfig> readCpPluginConfigs(); \n
+ 2. Case Descrition: \n
+ Verify the empty config file path can be dealed without any crash. \n
+ 3. Input Parameters: \n
+ <1> empty config plugin path \n
+ <2> config plugin path = null \n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ */
+void TestCppluginConfigReader::testReadEmptyConfigFilePath()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader("");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY(mCorrectConfig.count() == 0 );
+ delete pReader;
+ pReader = 0;
+ pReader = new CpPluginConfigReader(0);
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY(mCorrectConfig.count() == 0 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ QList<CpPluginConfig> readCpPluginConfigs(); \n
+ 2. Case Descrition: \n
+ Verify that the empty config file could be read. \n
+ 3. Input Parameters: \n
+ <1> empty config file "emptypluginfortest.cpcfg" \n
+ 4. Expected result: \n
+ <1> no crash \n
+ */
+void TestCppluginConfigReader::testReadEmptyConfigFile()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "emptypluginfortest.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY(mCorrectConfig.count() == 0 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ void readCpPluginConfigs(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList) \n
+ 2. Case Descrition: \n
+ Verify that the function can work without crash when reading the plugin files with wrong tag. \n
+ 3. Input Parameters: \n
+ <1> config file with wrong child plugin tag: "pluginfilewithwrongchildtag.cpcfg" \n
+ 4. Expected result: \n
+ <1> no crash \n
+ */
+void TestCppluginConfigReader::testReaderWithWrongChildPluginTag()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithwrongchildtag.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY( mCorrectConfig.count() == 0 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ void readChildPluginsElement(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList) \n
+ 2. Case Descrition: \n
+ Verify that the function can work without crash when reading the plugin files with empty child plugin element. \n
+ 3. Input Parameters: \n
+ <1> config file with empty child plugin element: "pluginfilewithemptychildelement.cpcfg" \n
+ 4. Expected result: \n
+ <1> no crash \n
+ */
+void TestCppluginConfigReader::testReaderWithEmptyChildElement()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithemptychildelement.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY( mCorrectConfig.count() == 0 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ void readChildPluginsElement(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList) \n
+ 2. Case Descrition: \n
+ Verify that the function can work without crash when reading plugin files with wrong tags. \n
+ 3. Input Parameters: \n
+ <1> config file with wrong plugin tag: "pluginfilewithwrongplugintag.cpcfg" \n
+ 4. Expected result: \n
+ <1> no crash \n
+ */
+void TestCppluginConfigReader::testReaderWithWrongPluginTag()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithwrongplugintag.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY( mCorrectConfig.count() == 0 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ void readPluginElement(QXmlStreamReader &xmlReader,QList<CpPluginConfig> &cpPluginConfigList); \n
+ 2. Case Descrition: \n
+ Verify that the function can work without crash when reading the plugin files having no attrs. \n
+ 3. Input Parameters: \n
+ <1> plugin element has no plugin attrs: "pluginfilewithoutattrs.cpcfg" \n
+ <2> plugin element has wrong plugin attrs. \n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ */
+void TestCppluginConfigReader::testReaderWithoutAttrs()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithoutattrs.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ QVERIFY( mCorrectConfig.count() == 1 );
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Test Case Description: \n
+ 1. Function Name: \n
+ void readDescElement(QXmlStreamReader &xmlReader,CpPluginConfig &cpPluginConfig) \n
+ 2. Case Descrition: \n
+ Verify that the function can work without crash when reading the plugin files with wrong tag. \n
+ 3. Input Parameters: \n
+ <1> plugin element has no desc tag: "pluginfilewithwrongdesctag.cpcfg" \n
+ <2> plugin element has wrong desc tag \n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ */
+void TestCppluginConfigReader::testReaderWithWrongDescTag()
+{
+ CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithwrongdesctag.cpcfg");
+ QVERIFY(pReader!=0);
+ mCorrectConfig = pReader->readCpPluginConfigs();
+ delete pReader;
+ pReader = 0;
+}
+/*!
+ Descrition of what you will do in this function
+ */
+void TestCppluginConfigReader::cleanupTestCase()
+{
+ // release all test data
+ QCoreApplication::processEvents();
+}
+
+QTEST_APPLESS_MAIN(TestCppluginConfigReader)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/src/ut_cppluginconfigreader.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* test the functions in cppluginconfigreader class
+*/
+
+#ifndef UT_CPPLUGINCONFIGREADER_H
+#define UT_CPPLUGINCONFIGREADER_H
+
+
+#include "cppluginconfig.h"
+
+#include <QObject>
+#include <QList>
+
+class TestCppluginConfigReader :public QObject
+{
+ Q_OBJECT
+private slots:
+
+ void initTestCase();
+ void testConstructor();
+ void testReadValidConfigFile(); // test with a valid config file.
+ void testReadEmptyConfigFilePath(); // test testReadEmptyConfigFilePath() with empty path.
+ void testReadEmptyConfigFile(); // test with empty config file.
+ void testReaderWithWrongChildPluginTag(); // test with wrong child plugin tags.
+ void testReaderWithEmptyChildElement(); // test with empty child plugin element.
+ void testReaderWithWrongPluginTag(); // test with wrong plugin tag.
+ void testReaderWithoutAttrs(); // test without any plugin attrs.
+ void testReaderWithWrongDescTag(); // test with wrong desc tag.
+ void cleanupTestCase();
+private:
+ QList<CpPluginConfig> mCorrectConfig;
+};
+#endif /* UT_CPPLUGINCONFIGREADER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pri Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+HEADERS += src/*.h
+SOURCES += src/*.cpp
+
+include(../../../inc/inc.pri)
+include(../../cpcategorymodel.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+QT += testlib
+CONFIG += hb qtestlib
+CONFIG += symbian_test
+
+TEMPLATE = app
+TARGET = ut_cppluginconfigreader
+QMAKE_EXTRA_TARGETS += test autotest
+
+DEPENDPATH += .
+INCLUDEPATH += . ../../src\
+ ../../../inc
+
+include (../unit_common.pri)
+include(../../../inc/inc.pri)
+include(../../cpcategorymodel.pri)
+
+LIBS += -lcpframework
+LIBS += -lcpcategorymodel
+DEFINES += BUILD_CPCATEGORY_GLOBAL
+
+symbian {
+
+ deploy.path = C:
+ configfiles.sources += data/pluginfortest.cpcfg \
+ data/emptypluginfortest.cpcfg \
+ data/pluginfilewithwrongchildtag.cpcfg \
+ data/pluginfilewithemptychildelement.cpcfg \
+ data/pluginfilewithwrongplugintag.cpcfg \
+ data/pluginfilewithoutattrs.cpcfg \
+ data/pluginfilewithwrongdesctag.cpcfg
+ configfiles.path = /resource/qt/plugins/controlpanel/config
+ DEPLOYMENT += configfiles
+
+ # This is for new exporting system coming in garden
+ for(configfile, configfiles.sources):BLD_INF_RULES.prj_exports += "./$$configfile $$deploy.path$$configfiles.path/$$basename(configfile)"
+}
+
+HEADERS += src/*.h
+SOURCES += src/*.cpp
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -19,8 +19,6 @@
CONFIG += hb plugin
-
-
include ( ../cpplugincommon.pri )
include ( communicationplugin.pri )
@@ -38,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
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -48,13 +48,16 @@
void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
{
- mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem);
+ mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem);
+ mAirplaneModeItem->setContentWidgetData("text", hbTrId("txt_cp_button_offline"));
+ mAirplaneModeItem->setContentWidgetData("additionalText", hbTrId("txt_cp_button_offline"));
mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica"));
-
+ mAirplaneModeItem->setContentWidgetData("objectName", "airplaneModeToggle");
+ mAirplaneModeItem->setContentWidgetData("checkable", true);
itemDataHelper.addConnection(mAirplaneModeItem,
- SIGNAL(clicked()),
+ SIGNAL(toggled(bool)),
this,
- SLOT(toggleAirplaneMode()));
+ SLOT(toggleAirplaneMode(bool)));
XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed);
QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
@@ -68,14 +71,13 @@
}
-void CpCommunicationGroupItemData::toggleAirplaneMode()
-{
+void CpCommunicationGroupItemData::toggleAirplaneMode(bool toggled)
+{
XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed);
- QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
-
- airplaneMode.setValue( static_cast<int> (!airplaneMode.toBool()) );
-
- mSettingManager->writeItemValue(key,airplaneMode);
+ //toggled = true means ECoreAppUIsNetworkConnectionNotAllowed
+ //toggled = false means ECoreAppUIsNetworkConnectionAllowed
+ QVariant airplaneMode(static_cast<int>(!toggled));
+ mSettingManager->writeItemValue(key, airplaneMode);
}
void CpCommunicationGroupItemData::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
@@ -83,14 +85,11 @@
if (mAirplaneModeItem
&& key.uid() == KCRUidCoreApplicationUIs.iUid
&& key.key() == KCoreAppUIsNetworkConnectionAllowed
- && value.isValid()) {
- QString text = hbTrId("txt_cp_setlabel_offline_mode_val_on");
- QString additionalText = hbTrId("txt_cp_setlabel_offline_mode_val_off");
- if (ECoreAppUIsNetworkConnectionAllowed == value.toInt()) {
- ::qSwap (text, additionalText);
- }
- mAirplaneModeItem->setContentWidgetData("text",text);
- mAirplaneModeItem->setContentWidgetData("additionalText",additionalText);
+ && value.isValid()) {
+ //value.toBool() returns
+ //true(1) if value equals ECoreAppUIsNetworkConnectionAllowed, that means offline mode off.
+ //false(0) if value equals ECoreAppUIsNetworkConnectionNotAllowed, that means offline mode on.
+ mAirplaneModeItem->setContentWidgetData("checked", !value.toBool());
}
}
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Wed Sep 29 10:09:58 2010 +0800
@@ -36,7 +36,7 @@
~CpCommunicationGroupItemData();
private slots:
- void toggleAirplaneMode();
+ void toggleAirplaneMode(bool toggled);
void settingValueChanged(const XQSettingsKey &key, const QVariant &value);
private:
virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper);
--- a/controlpanelui/src/cpplugins/cpplugincommon.pri Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/cpplugincommon.pri Wed Sep 29 10:09:58 2010 +0800
@@ -15,8 +15,7 @@
#
include (../common.pri)
-
-LIBS += -lcpframework -lcpcategorymodel
+LIBS += -lcplogger -lcpframework -lcpcategorymodel
symbian: plugin { # copy qtstub and manifest
--- a/controlpanelui/src/cpplugins/cpplugins.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/cpplugins.pro Wed Sep 29 10:09:58 2010 +0800
@@ -19,11 +19,10 @@
deviceplugin \
privacyplugin \
personalizationplugin \
- lookfeelplugin \
- profileactivatorplugin \
- volumeplugin \
- ringtoneplugin \
- keytouchfdbkplugin
+ profileactivatorplugin \
+ volumeplugin \
+ ringtoneplugin \
+ keytouchfdbkplugin
#displayplugin \
#applicationsettingsplugin \
#accountsplugin
--- a/controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -36,3 +36,6 @@
TARGET.CAPABILITY = All -TCB
TARGET.EPOCALLOWDLLDATA = 1
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -32,7 +32,7 @@
CpSettingFormEntryItemData::ListEntryItem, // item type
itemDataHelper,
hbTrId("txt_cp_list_keys_screen"), // text
- QString(" "), // description
+ QString(""), // description
"qtg_large_key_screen"); // icon name
return QList<CpSettingFormItemData*>() << itemData;
}
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -100,6 +100,7 @@
QStringList items = mScreenLockValues.values();
mScreenComboButton->setContentWidgetData( QString("items"), items );
mScreenComboButton->setContentWidgetData( QString("currentIndex"), selectedIndex);
+ mScreenComboButton->setContentWidgetData("objectName", "screenComboButton");
}
void CpKeyScreenView::makeRotateItem(HbDataFormModel& model)
@@ -117,6 +118,7 @@
state = Qt::Unchecked;
}
mRotateCheckbox->setContentWidgetData( QString("checkState"), state );
+ mRotateCheckbox->setContentWidgetData("objectName", "rotateCheckbox");
}
void CpKeyScreenView::makeBrightnessItem(HbDataFormModel& model)
@@ -136,6 +138,7 @@
iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
mBrightSliderItem->setContentWidgetData( QString( "elementIcons" ), iconElements );
+ mRotateCheckbox->setContentWidgetData("objectName", "brightSliderItem");
}
void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model)
--- a/controlpanelui/src/cpplugins/lookfeelplugin/data/cplookfeelplugin.cpcfg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-<childplugins>
- <plugin displayname = "Theme" id = "0X2002C2F3" dll = "cpthemeplugin.dll">
- <desc></desc>
- </plugin>
- <plugin displayname = "WallPaper" id = "0X20025FE8" dll = "cpplaceholderplugin.dll">
- <desc>Name of the WallPaper</desc>
- </plugin>
- <plugin displayname = "Display" id = "0X20028735" dll = "cpdisplayplugin.dll">
- <desc></desc>
- </plugin>
- <plugin displayname = "Key & touch screen feedback" id = "0X20025FDE" dll = "cpkeytouchfdbkplugin.dll">
- <desc></desc>
- </plugin>
-</childplugins>
\ No newline at end of file
--- a/controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pri Fri Jun 25 17:12:20 2010 +0800
+++ /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
--- a/controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ /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
--- a/controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.cpp Fri Jun 25 17:12:20 2010 +0800
+++ /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<CpSettingFormItemData*> CpLookFeelPlugin::createSettingFormItemData(CpItemDataHelper &/*itemDataHelper*/) const
-{
- CpCategorySettingFormItemData *itemData =
- new CpCategorySettingFormItemData(
- HbDataFormModelItem::GroupItem,
- tr("Look&Feel"),
- QString("cplookfeelplugin.cpcfg") );
- return QList<CpSettingFormItemData*>() << itemData;
-}
-
-Q_EXPORT_PLUGIN2(cplookfeelplugin, CpLookFeelPlugin);
--- a/controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.h Fri Jun 25 17:12:20 2010 +0800
+++ /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 <qobject.h>
-#include <cpplugininterface.h>
-
-class CpLookFeelPlugin : public QObject,
- public CpPluginInterface
-{
- Q_OBJECT
- Q_INTERFACES(CpPluginInterface)
-public:
- CpLookFeelPlugin();
- virtual ~CpLookFeelPlugin();
- virtual QList<CpSettingFormItemData*> createSettingFormItemData(CpItemDataHelper &itemDataHelper) const;
-};
-
-
-#endif /* CPLOOKFEELPLUGIN_H */
--- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="33.999,26 10,26 10,17.998 33.999,17.998 "/>
-<rect fill="#FFFFFF" height="4" width="20" x="12" y="20"/>
-</svg>
--- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement_pressed.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="33.999,26 10,26 10,17.998 33.999,17.998 "/>
-<rect fill="#00FF00" height="4" width="20" x="12" y="20"/>
-</svg>
--- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="26.001,33.999 18,33.999 18,26.001 10,26.001 10,18 18,18 18,9.999 26.001,9.999 26.001,18 33.999,18 33.999,26.001 26.001,26.001 "/>
-<polygon fill="#FFFFFF" points="31.999,20 23.999,20 23.999,12 20,12 20,20 12,20 12,23.999 20,23.999 20,31.999 23.999,31.999 23.999,23.999 31.999,23.999 "/>
-</svg>
--- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment_pressed.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="26.001,33.999 18,33.999 18,26.001 10,26.001 10,18 18,18 18,9.999 26.001,9.999 26.001,18 33.999,18 33.999,26.001 26.001,26.001 "/>
-<polygon fill="#00FF00" points="31.999,20 23.999,20 23.999,12 20,12 20,20 12,20 12,23.999 20,23.999 20,31.999 23.999,31.999 23.999,23.999 31.999,23.999 "/>
-</svg>
--- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_muted.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<path d="M25.824,21.015V8.411h-9.979l-1.025,1.6L8.354,3.545L3.651,8.242l6.797,6.795H4.931v15.818h6.671l4.24,6.625h9.982v-7.067 l7.902,7.905l4.697-4.703L25.824,21.015z M19.179,30.336L15.26,24.21h-3.682v-2.524h3.682l0.715-1.121l3.204,3.203V30.336z"/>
-<rect fill="#FFFFFF" height="2.648" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 21.1169 50.6082)" width="38.533" x="1.773" y="19.607"/>
-<polygon fill="#FFFFFF" points="21.179,32.835 18.403,32.835 14.166,26.209 9.578,26.209 9.578,19.685 14.166,19.685 14.463,19.219 12.279,17.037 6.931,17.037 6.931,28.855 12.695,28.855 16.937,35.48 23.824,35.48 23.824,28.579 21.179,25.936 "/>
-<polygon fill="#FFFFFF" points="18.403,13.06 21.179,13.06 21.179,16.202 23.824,18.847 23.824,10.412 16.937,10.412 16.332,11.355 18.259,13.284 "/>
-</svg>
--- a/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_unmuted.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<path d="M34.951,38.12l-5.054-4.302l1.282-1.521c0.877-1.04,8.324-10.39,0.111-18.605l-1.414-1.413l4.697-4.701l1.413,1.415 c12.695,12.699,0.386,27.46,0.259,27.606L34.951,38.12L34.951,38.12z"/>
-<path d="M30.761,14.545l-1.414-1.412l-3.521,3.521V8.411h-9.981l-4.24,6.624H4.93v15.82h6.674l4.24,6.625h9.981v-8.201l3.855,3.287 l1.298-1.521C33.574,28.005,36.864,20.643,30.761,14.545z M19.18,30.335l-3.921-6.128h-3.682v-2.522h3.682l3.921-6.128V30.335z M25.918,26.742l-0.094,0.109v-7.844l0.237,0.236C29.324,22.505,26.277,26.318,25.918,26.742z"/>
-<path d="M27.476,17.83c4.622,4.622,0.158,9.979-0.031,10.203l2.014,1.714c2.181-2.554,4.957-8.725-0.11-13.788 L27.476,17.83z" fill="#FFFFFF"/>
-<path d="M34.576,10.406l-1.873,1.871c9.664,9.663,0.404,20.838,0.006,21.309l2.017,1.717 C34.838,35.17,45.974,21.811,34.576,10.406z" fill="#FFFFFF"/>
-<path d="M16.937,10.411l-4.242,6.625H6.931v11.819h5.764l4.242,6.625h6.887V10.411H16.937z M21.179,32.834h-2.776 l-4.237-6.626H9.578v-6.524h4.588l4.237-6.625h2.776V32.834z" fill="#FFFFFF"/>
-</svg>
--- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc Wed Sep 29 10:09:58 2010 +0800
@@ -1,10 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>icon/hb_vol_slider_decrement.svg</file>
- <file>icon/hb_vol_slider_decrement_pressed.svg</file>
- <file>icon/hb_vol_slider_increment.svg</file>
- <file>icon/hb_vol_slider_increment_pressed.svg</file>
- <file>icon/hb_vol_slider_muted.svg</file>
- <file>icon/hb_vol_slider_unmuted.svg</file>
+ <file>resources/hbslider_color.css</file>
</qresource>
</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpplugins/personalizationplugin/resources/hbslider_color.css Wed Sep 29 10:09:58 2010 +0800
@@ -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);
+}
+
+
+
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -28,8 +28,10 @@
#include <cppluginutility.h>
#include <hbaction.h>
#include <hbmenu.h>
+#include <hbstyleloader.h>
+
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);
+ }
+}
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h Wed Sep 29 10:09:58 2010 +0800
@@ -20,6 +20,11 @@
#include <cpbasesettingview.h>
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
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -58,7 +58,7 @@
itemDataHelper, hbTrId("txt_cp_button_advanced_settings"));
advanceSettingItem->setContentWidgetData("textAlignment", QVariant( Qt::AlignHCenter | Qt::AlignVCenter) );
-
+ advanceSettingItem->setContentWidgetData("objectName", "advanceSettingButton" );
appendChild(advanceSettingItem);
CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END");
}
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -24,8 +24,8 @@
#include <QGraphicsLinearLayout>
#include <QScopedPointer>
-CpProfileNameEditDialog::CpProfileNameEditDialog( QGraphicsItem *parent )
- :HbDialog( parent )
+CpProfileNameEditDialog::CpProfileNameEditDialog(QGraphicsItem *parent)
+ : HbDialog(parent)
{
init();
}
@@ -36,60 +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() );
-}
-
-QString CpProfileNameEditDialog::getLineEditText()
-{
- QString text = mTextEdit->text();
- return text;
+ mLineEdit->setText(text);
}
-bool CpProfileNameEditDialog::launchProfileNameEditDialog( QString &profileName )
+QString CpProfileNameEditDialog::lineEditText()
{
- CpProfileNameEditDialog *profileEditNameDialog = new CpProfileNameEditDialog();
-
- profileEditNameDialog->setLineEditText( profileName );
- profileEditNameDialog->checkPrimaryAction();
-
- HbAction *secondAction = qobject_cast<HbAction *>
- (profileEditNameDialog->actions().at(1));
- profileEditNameDialog->show();
- return false;
+ return mLineEdit->text().trimmed();
+}
+
+void CpProfileNameEditDialog::setLineEditMaxLength(int length)
+{
+ mLineEdit->setMaxLength(length);
}
void CpProfileNameEditDialog::checkPrimaryAction()
{
- HbAction *const primaryAction = qobject_cast<HbAction *>
- (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<HbAction *>(actions().at(0));
+ if (primaryAction) {
+ if (!mLineEdit->text().trimmed().isEmpty()) {
+ primaryAction->setEnabled(true);
} else {
primaryAction->setEnabled(false);
- }
+ }
}
}
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h Wed Sep 29 10:09:58 2010 +0800
@@ -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 */
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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();
@@ -137,7 +164,8 @@
//notification tones item
modelItem= mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),parent);
modelItem->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
- modelItem->setContentWidgetData( "checkState", profileSettings.mNotificationTone ? 2 : 0 );
+ modelItem->setContentWidgetData("checkState", profileSettings.mNotificationTone ? 2 : 0);
+ modelItem->setContentWidgetData("objectName", "notificationTonesCheckBox" + QString::number(profileId));
if (profileId == EProfileWrapperGeneralId) {
addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int )));
}
@@ -156,7 +184,7 @@
<< QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement)
<< QVariant(HbSlider::TextElement);
modelItem->setContentWidgetData("sliderElements",sliderElements);
-
+ modelItem->setContentWidgetData("objectName", "keyTonesSlider" + QString::number(profileId));
//TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
@@ -164,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 );
@@ -192,13 +220,13 @@
sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
<< QVariant(HbSlider::DecreaseElement);
modelItem->setContentWidgetData("sliderElements",sliderElements);
-
+ modelItem->setContentWidgetData("objectName", "vibrationSlider" + QString::number(profileId));
modelItem->setContentWidgetData( QString( "minimum" ), 0 );
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) {
@@ -214,197 +242,7 @@
}
-/*
-void CpProfileSettingForm::initGeneralTonesGroup()
-{
- CpProfileSettings profileSettings;
- mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
-
- //HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup(
- // hbTrId("txt_cp_subhead_tones"),mGeneralPage);
- QFileInfo ringToneFileInfo( profileSettings.mRingTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mGeneralPage);
-
- QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ) ), mGeneralPage);
-
- QFileInfo emailToneFileInfo( profileSettings.mEmailTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ) ), mGeneralPage);
-
- QFileInfo reminderToneFileInfo( profileSettings.mReminderTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ) ), mGeneralPage);
-
- HbDataFormModelItem *notificationTones = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),mGeneralPage);
- notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
- notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 );
-
- mGeneralKeysAndScreenToneSlider =
- mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mGeneralPage);
-
- //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("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
- //mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "elementIcons" ), elements );
-
- //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
- mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 );
- mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 );
- mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
-
-
- mGeneralSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), mGeneralPage );
- //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
- mGeneralSreenVibra->setContentWidgetData( QString( "minimum" ), 0 );
- mGeneralSreenVibra->setContentWidgetData( QString( "maximum" ), 5 );
- mGeneralSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
-
- addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int )));
- addConnection( mGeneralKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int )));
- addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
-}
-*/
-/*void CpProfileSettingForm::initGeneralVibraGroup()
-{
- CpProfileSettings profileSettings;
- mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
-
- HbDataFormModelItem *vibraGroup = mModel->appendDataFormGroup(
- hbTrId( "txt_cp_subhead_vibra" ), mGeneralPage );
- HbDataFormModelItem *ringVibar = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- ringVibar->setContentWidgetData( "text", hbTrId( "txt_cp_list_ring_alet" ) );
- ringVibar->setContentWidgetData( "checkState", profileSettings.mRingAlertVibra?2:0 );
-
- HbDataFormModelItem *messageVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- messageVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_message" ) );
- messageVibra->setContentWidgetData( "checkState", profileSettings.mMessageVibra?2:0 );
-
- HbDataFormModelItem *emailVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- emailVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_email" ) );
- emailVibra->setContentWidgetData( "checkState", profileSettings.mEmailVibra?2:0 );
-
- HbDataFormModelItem *reminderVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- reminderVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_reminder_alert" ));
- reminderVibra->setContentWidgetData( "checkState", profileSettings.mReminderAlertVibra?2:0 );
-
- HbDataFormModelItem *notificationVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- notificationVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_notification" ) );
- notificationVibra->setContentWidgetData( "checkState", profileSettings.mNotificationVibra?2:0 );
-
- mGeneralSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), vibraGroup );
- //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
- mGeneralSreenVibra->setContentWidgetData( QString( "minimum" ), 0 );
- mGeneralSreenVibra->setContentWidgetData( QString( "maximum" ), 5 );
- mGeneralSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
-
- addConnection( ringVibar, SIGNAL( stateChanged( int )), this, SLOT( on_general_ringVibar_stateChanged( int )));
- addConnection( messageVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_messageVibra_stateChanged( int )));
- addConnection( emailVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_emailVibra_stateChanged( int )));
- addConnection( reminderVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_reminderVibra_stateChanged( int )));
- addConnection( notificationVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationVibra_stateChanged( int )));
-
- addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
-}*/
-
-////////////////////////////////////////////////////////////
-/*void CpProfileSettingForm::initMeetingTonesGroup()
-{
- CpProfileSettings profileSettings;
- mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
-
- //HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup(
- // hbTrId("txt_cp_subhead_tones"),mMeetingPage);
- QFileInfo ringToneFileInfo( profileSettings.mRingTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mMeetingPage);
-
- QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ) ), mMeetingPage);
-
- QFileInfo emailToneFileInfo( profileSettings.mEmailTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ) ), mMeetingPage);
-
- QFileInfo reminderToneFileInfo( profileSettings.mReminderTone );
- mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
- hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ) ), mMeetingPage);
-
- HbDataFormModelItem *notificationTones = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),mMeetingPage);
- notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
- notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 );
-
- mMeetingKeysAndScreenToneSlider =
- mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mMeetingPage);
-
- //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("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
- //mMeetingkeysAndScreenSlider->setContentWidgetData( QString( "elementIcons" ), elements );
-
- //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
- mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 );
- mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 );
- mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
-
- mMeetingSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), mMeetingPage );
- //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
- mMeetingSreenVibra->setContentWidgetData( QString( "minimum" ), 0 );
- mMeetingSreenVibra->setContentWidgetData( QString( "maximum" ), 5 );
- mMeetingSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
-
- addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int )));
- addConnection( mMeetingKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenSlider_ValueChanged( int )));
- addConnection( mMeetingSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int )));
-}
-*/
-/*void CpProfileSettingForm::initMeetingVibraGroup()
-{
- CpProfileSettings profileSettings;
- mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
-
- HbDataFormModelItem *vibraGroup = mModel->appendDataFormGroup(
- hbTrId( "txt_cp_subhead_vibra" ), mMeetingPage );
- HbDataFormModelItem *ringVibar = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- ringVibar->setContentWidgetData( "text", hbTrId( "txt_cp_list_ring_alet" ) );
- ringVibar->setContentWidgetData( "checkState", profileSettings.mRingAlertVibra?2:0 );
-
- HbDataFormModelItem *messageVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- messageVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_message" ) );
- messageVibra->setContentWidgetData( "checkState", profileSettings.mMessageVibra?2:0 );
-
- HbDataFormModelItem *emailVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- emailVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_email" ) );
- emailVibra->setContentWidgetData( "checkState", profileSettings.mEmailVibra?2:0 );
-
- HbDataFormModelItem *reminderVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- reminderVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_reminder_alert" ));
- reminderVibra->setContentWidgetData( "checkState", profileSettings.mReminderAlertVibra?2:0 );
-
- HbDataFormModelItem *notificationVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup );
- notificationVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_notification" ) );
- notificationVibra->setContentWidgetData( "checkState", profileSettings.mNotificationVibra?2:0 );
-
- mMeetingSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), vibraGroup );
- //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
- mMeetingSreenVibra->setContentWidgetData( QString( "minimum" ), 0 );
- mMeetingSreenVibra->setContentWidgetData( QString( "maximum" ), 5 );
- mMeetingSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
-
- addConnection( ringVibar, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_ringVibar_stateChanged( int )));
- addConnection( messageVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_messageVibra_stateChanged( int )));
- addConnection( emailVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_emailVibra_stateChanged( int )));
- addConnection( reminderVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_reminderVibra_stateChanged( int )));
- addConnection( notificationVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationVibra_stateChanged( int )));
-
- addConnection( mMeetingSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int )));
-}*/
////////////////////////////////////////////////////
//general tones
@@ -425,26 +263,6 @@
//general vibra
-void CpProfileSettingForm::on_general_ringVibar_stateChanged( int state )
-{
- mProfileModel->setRingAlertVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_general_messageVibra_stateChanged( int state )
-{
- mProfileModel->setMessageVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_general_emailVibra_stateChanged( int state )
-{
- mProfileModel->setEmailVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_general_reminderVibra_stateChanged( int state )
-{
- mProfileModel->setReminderVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_general_notificationVibra_stateChanged( int state )
-{
- mProfileModel->setNotificationVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
-}
void CpProfileSettingForm::on_general_screenVibra_ValueChanged( int value )
{
mProfileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, value );
@@ -474,28 +292,6 @@
}
}
-
-//meeting vibra
-void CpProfileSettingForm::on_meeting_ringVibar_stateChanged( int state )
-{
- mProfileModel->setRingAlertVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_meeting_messageVibra_stateChanged( int state )
-{
- mProfileModel->setMessageVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_meeting_emailVibra_stateChanged( int state )
-{
- mProfileModel->setEmailVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_meeting_reminderVibra_stateChanged( int state )
-{
- mProfileModel->setReminderVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
-}
-void CpProfileSettingForm::on_meeting_notificationVibra_stateChanged( int state )
-{
- mProfileModel->setNotificationVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
-}
void CpProfileSettingForm::on_meeting_screenVibra_ValueChanged( int value )
{
mProfileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, value );
@@ -572,10 +368,10 @@
QMap<QString, QVariant> 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 );
}
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Wed Sep 29 10:09:58 2010 +0800
@@ -20,6 +20,7 @@
#include <hbdataform.h>
#include <QHash>
+#include "cpprofilemodel.h"
class HbDataFormModel;
class HbDataFormModelItem;
@@ -47,19 +48,15 @@
CpProfileSettingForm();
virtual ~CpProfileSettingForm();
-
+ QString currentPageProfileName();
+ void setCurrentPageProfileName(const QString &name);
+ void updateModifiedProfileName(const QString &name);
private slots:
//general tones
void on_general_notificationTones_stateChanged(int state);
void on_general_keysAndScreenToneSlider_ValueChanged( int value );
-
//general vibra
- void on_general_ringVibar_stateChanged( int state );
- void on_general_messageVibra_stateChanged( int state );
- void on_general_emailVibra_stateChanged( int state );
- void on_general_reminderVibra_stateChanged( int state );
- void on_general_notificationVibra_stateChanged( int state );
void on_general_screenVibra_ValueChanged( int value );
//meeting tones
@@ -67,14 +64,11 @@
void on_meeting_keysAndScreenToneSlider_ValueChanged( int value );
//meeting vibar
- void on_meeting_ringVibar_stateChanged( int state );
- void on_meeting_messageVibra_stateChanged( int state );
- void on_meeting_emailVibra_stateChanged( int state );
- void on_meeting_reminderVibra_stateChanged( int state );
- void on_meeting_notificationVibra_stateChanged( int state );
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();
@@ -82,6 +76,7 @@
void initMeetingTonesGroup();
//void initMeetingVibraGroup();
bool checkBoxStateToBool( int state );
+
// void initRingToneGroup(HbDataFormModelItem *parent);
// void initMessageToneGroup(HbDataFormModelItem *parent);
// void initAlertToneGroup(HbDataFormModelItem *parent);
@@ -98,9 +93,7 @@
HbDataFormModelItem *mGeneralPage;
HbDataFormModelItem *mMeetingPage;
-
HbDataFormModelItem *mCurrentPage;
-
// HbDataFormModelItem *mGeneralKeysAndScreenToneSlider;
// HbDataFormModelItem *mGeneralSreenVibra;
// HbDataFormModelItem *mMeetingKeysAndScreenToneSlider;
--- a/controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -29,3 +29,6 @@
TARGET.EPOCALLOWDLLDATA = 1
LIBS += -lprofileeng
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -78,13 +78,6 @@
// the best choice is no need to convert the index to id
mProfileModel.activateProfile(mProfileIds.at(currentIndex));
- // ret should be remove from here
- // no invalid profile exsit
- QString profileName = mProfileModel.profileName(mProfileModel.activeProfileId());
- //change the descripton of entry item
- if (CpSettingFormEntryItemData *entryItem = qobject_cast<CpSettingFormEntryItemData*>(mProfileActivator)) {
- entryItem->setDescription(profileName);
- }
}
void CpProfileActivatorDialog::cancelProfileSelection()
{
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -20,7 +20,7 @@
#include <cpitemdatahelper.h>
#include <cpprofilemodel.h>
#include <QScopedPointer>
-#include "cpprofilemonitor.h"
+#include <cpprofilemonitor.h>
CpProfileActivatorEntryItem::CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper,
const QString &text,
@@ -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()
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.cpp Fri Jun 25 17:12:20 2010 +0800
+++ /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:
- *
- */
-
-#include "cpprofilemonitor.h"
-
-#include <CProfileChangeNotifyHandler.h>
-
-CpProfileMonitor::CpProfileMonitor(QObject *parent)
- :QObject(parent),mProfileNotifier(0)
-{
- mProfileNotifier = CProfileChangeNotifyHandler::NewL(this);
-}
-
-CpProfileMonitor::~CpProfileMonitor()
-{
- delete mProfileNotifier;
-}
-
-void CpProfileMonitor::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId)
-{
- if (EProfileNewActiveProfile == aProfileEvent) {
- emit profileActivated(aProfileId);
- }
-}
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.h Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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 CPPROFILEMONITOR_H_
-#define CPPROFILEMONITOR_H_
-
-#include <QObject>
-#include <MProfileChangeObserver.h>
-
-class CProfileChangeNotifyHandler;
-
-class CpProfileMonitor: public QObject,public MProfileChangeObserver
-{
- Q_OBJECT
-public:
- explicit CpProfileMonitor(QObject *parent = 0);
- ~CpProfileMonitor();
-signals:
- void profileActivated(int activeProfileId);
-private:
- virtual void HandleActiveProfileEventL(
- TProfileEvent aProfileEvent, TInt aProfileId );
-
-private:
- CProfileChangeNotifyHandler* mProfileNotifier;
-};
-
-#endif /* CPPROFILEMONITOR_H_ */
--- a/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -27,3 +27,6 @@
TARGET.CAPABILITY = All -TCB
TARGET.EPOCALLOWDLLDATA = 1
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -47,13 +47,13 @@
if( mProfileModel )
{
QString strRing = loadStringValue();
- if( strRing.contains( "No_Sound.wav", Qt::CaseInsensitive) )
+ if( QFileInfo(strRing) == QFileInfo(g_strNoTone) )
{
setDescription( hbTrId("txt_cp_list_no_tone" ) ); //sepcial handling about NoTone
}
else
{
- setDescription( strRing.section(QDir::separator (),-1) );
+ setDescription( QFileInfo(strRing).baseName() );
}
}
else
@@ -62,18 +62,43 @@
}
mSettingManager = new XQSettingsManager();
XQCentralRepositorySettingsKey key(KCRUidProfileEngine.iUid,KProEngSilenceMode);
-
+
+ //Monitoring the active ring tone
+ XQCentralRepositorySettingsKey keyForActiveRingTone(KCRUidProfileEngine.iUid,KProEngActiveRingTone);
+
QVariant silenceMode = mSettingManager->readItemValue( key,XQSettingsManager::TypeInt );
setEnabled( !silenceMode.toInt() );
mSettingManager->startMonitoring( key,XQSettingsManager::TypeInt );
+ mSettingManager->startMonitoring(keyForActiveRingTone, XQSettingsManager::TypeString);
connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)),
this, SLOT(settingValueChanged(XQSettingsKey, QVariant)));
}
void CpPersonalizationEntryItemData::settingValueChanged( const XQSettingsKey& key, const QVariant& value )
{
- Q_UNUSED(key);
- setEnabled( !value.toInt() );
+ switch (key.key()) {
+ case KProEngActiveRingTone:
+ {
+ QString strRing = loadStringValue();
+ if( QFileInfo(strRing) == QFileInfo(g_strNoTone) )
+ {
+ setDescription( hbTrId("txt_cp_list_no_tone" ) ); //sepcial handling about NoTone
+ }
+ else
+ {
+ setDescription( QFileInfo(strRing).baseName() );
+ }
+ break;
+ }
+ case KProEngSilenceMode:
+ {
+ setEnabled( !value.toInt() );
+ break;
+
+ }
+ default:
+ break;
+ }
}
CpPersonalizationEntryItemData::~CpPersonalizationEntryItemData()
@@ -116,6 +141,7 @@
default:
if( m_profileID <0 )
{
+
strRing = mProfileModel->ringTone();
}
else
@@ -171,8 +197,10 @@
void CpPersonalizationEntryItemData::handleOk(const QString &strFname)
{
if(strFname.length())
- {
- setDescription( strFname.section(QDir::separator (),-1) );
+ {
+ //lower level services(tone fetcher or music fetcher)
+ //will guarantee strFname is a valid absolute file path.
+ setDescription(QFileInfo(strFname).baseName());
}
else
{
--- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="33.999,26 10,26 10,17.998 33.999,17.998 "/>
-<rect fill="#FFFFFF" height="4" width="20" x="12" y="20"/>
-</svg>
--- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement_pressed.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="33.999,26 10,26 10,17.998 33.999,17.998 "/>
-<rect fill="#00FF00" height="4" width="20" x="12" y="20"/>
-</svg>
--- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="26.001,33.999 18,33.999 18,26.001 10,26.001 10,18 18,18 18,9.999 26.001,9.999 26.001,18 33.999,18 33.999,26.001 26.001,26.001 "/>
-<polygon fill="#FFFFFF" points="31.999,20 23.999,20 23.999,12 20,12 20,20 12,20 12,23.999 20,23.999 20,31.999 23.999,31.999 23.999,23.999 31.999,23.999 "/>
-</svg>
--- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment_pressed.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<polygon points="26.001,33.999 18,33.999 18,26.001 10,26.001 10,18 18,18 18,9.999 26.001,9.999 26.001,18 33.999,18 33.999,26.001 26.001,26.001 "/>
-<polygon fill="#00FF00" points="31.999,20 23.999,20 23.999,12 20,12 20,20 12,20 12,23.999 20,23.999 20,31.999 23.999,31.999 23.999,23.999 31.999,23.999 "/>
-</svg>
--- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_muted.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<path d="M25.824,21.015V8.411h-9.979l-1.025,1.6L8.354,3.545L3.651,8.242l6.797,6.795H4.931v15.818h6.671l4.24,6.625h9.982v-7.067 l7.902,7.905l4.697-4.703L25.824,21.015z M19.179,30.336L15.26,24.21h-3.682v-2.524h3.682l0.715-1.121l3.204,3.203V30.336z"/>
-<rect fill="#FFFFFF" height="2.648" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 21.1169 50.6082)" width="38.533" x="1.773" y="19.607"/>
-<polygon fill="#FFFFFF" points="21.179,32.835 18.403,32.835 14.166,26.209 9.578,26.209 9.578,19.685 14.166,19.685 14.463,19.219 12.279,17.037 6.931,17.037 6.931,28.855 12.695,28.855 16.937,35.48 23.824,35.48 23.824,28.579 21.179,25.936 "/>
-<polygon fill="#FFFFFF" points="18.403,13.06 21.179,13.06 21.179,16.202 23.824,18.847 23.824,10.412 16.937,10.412 16.332,11.355 18.259,13.284 "/>
-</svg>
--- a/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_unmuted.svg Fri Jun 25 17:12:20 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<path d="M34.951,38.12l-5.054-4.302l1.282-1.521c0.877-1.04,8.324-10.39,0.111-18.605l-1.414-1.413l4.697-4.701l1.413,1.415 c12.695,12.699,0.386,27.46,0.259,27.606L34.951,38.12L34.951,38.12z"/>
-<path d="M30.761,14.545l-1.414-1.412l-3.521,3.521V8.411h-9.981l-4.24,6.624H4.93v15.82h6.674l4.24,6.625h9.981v-8.201l3.855,3.287 l1.298-1.521C33.574,28.005,36.864,20.643,30.761,14.545z M19.18,30.335l-3.921-6.128h-3.682v-2.522h3.682l3.921-6.128V30.335z M25.918,26.742l-0.094,0.109v-7.844l0.237,0.236C29.324,22.505,26.277,26.318,25.918,26.742z"/>
-<path d="M27.476,17.83c4.622,4.622,0.158,9.979-0.031,10.203l2.014,1.714c2.181-2.554,4.957-8.725-0.11-13.788 L27.476,17.83z" fill="#FFFFFF"/>
-<path d="M34.576,10.406l-1.873,1.871c9.664,9.663,0.404,20.838,0.006,21.309l2.017,1.717 C34.838,35.17,45.974,21.811,34.576,10.406z" fill="#FFFFFF"/>
-<path d="M16.937,10.411l-4.242,6.625H6.931v11.819h5.764l4.242,6.625h6.887V10.411H16.937z M21.179,32.834h-2.776 l-4.237-6.626H9.578v-6.524h4.588l4.237-6.625h2.776V32.834z" fill="#FFFFFF"/>
-</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpplugins/volumeplugin/resources/hbslider_color.css Wed Sep 29 10:09:58 2010 +0800
@@ -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);
+}
+
+
+
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -93,8 +93,8 @@
void CpVolumeController::masterVolumeChange(int value)
{
-#ifdef Q_OS_SYMBIAN
- mProfileModel->setMasterVolume( volumeLevelToInt( (CpVolumeController::VolumeLevel)value ) );
+#ifdef Q_OS_SYMBIAN
+ mProfileModel->setMasterVolume(value);
HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
masterVolume->setContentWidgetData("value",value);
#endif
@@ -118,22 +118,10 @@
HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
if (masterVolume) {
CPFW_LOG("::updateMasterVolumeValue(), Start using profile model.");
- QMap<QString, QVariant> 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",intToVolumeLevel(mProfileModel->masterVolume()));
+ masterVolume->setContentWidgetData("value",mProfileModel->masterVolume());
}
HbDataFormModelItem *masterVibra = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem);
if (masterVibra) {
@@ -143,47 +131,12 @@
#endif
}
-int CpVolumeController::volumeLevelToInt( CpVolumeController::VolumeLevel volumeLevel )
-{
- switch( volumeLevel ){
- case VolumenLevelSoft:
- return EProfileMasterVolumeSoft;
- case VolumeLevelMed:
- return EProfileMasterVolumeMed;
- case VolumeLevelLoud:
- return EProfileMasterVolumeLoud;
- default:
- return 1;
- }
-}
-CpVolumeController::VolumeLevel CpVolumeController::intToVolumeLevel( int value )
-{
- if( value < 4 ) {
- return VolumenLevelSoft;
- } else if( value < 8 )
- return VolumeLevelMed;
- else{
- return VolumeLevelLoud;
- }
-}
-
void CpVolumeController::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
{
if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode) {
HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
if (masterVolume) {
- QMap<QString, QVariant> 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);
@@ -194,7 +147,7 @@
else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVolume) {
HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
if (masterVolume) {
- masterVolume->setContentWidgetData("value",intToVolumeLevel(value.toInt()));
+ masterVolume->setContentWidgetData("value",value.toInt());
}
}
else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVibra) {
@@ -204,5 +157,23 @@
}
}
}
+/**
+ * set speaker icon for volume silder
+ */
+void CpVolumeController::setSilderSpeakerIcon(bool isSpeakerOff)
+{
+ HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
+ if (masterVolume != 0) {
+ QMap<QString, QVariant> 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
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Wed Sep 29 10:09:58 2010 +0800
@@ -34,12 +34,7 @@
const QList<HbDataFormModelItem *> &itemList,
CpItemDataHelper &itemDataHelper);
virtual ~CpVolumeController();
-private:
- enum VolumeLevel{
- VolumenLevelSoft = 1,
- VolumeLevelMed = 2 ,
- VolumeLevelLoud = 3
- };
+
private slots:
void silenceModeChange(bool isSilence);
void masterVolumeChange(int value);
@@ -48,10 +43,8 @@
void settingValueChanged(const XQSettingsKey &key, const QVariant &value);
private:
- void updateUi();
- int volumeLevelToInt( CpVolumeController::VolumeLevel volumeLevel );
- CpVolumeController::VolumeLevel intToVolumeLevel( int value );
-
+ void updateUi();
+ void setSilderSpeakerIcon(bool isSpeakerOff);
private:
CpProfileModel *mProfileModel;
QList<HbDataFormModelItem *> mItemList;
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -26,6 +26,7 @@
#include "cpvolumecontroller.h"
#include "cppersonalizationcustomviewitem.h"
#include <hbslider.h>
+#include <hbstyleloader.h>
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()
@@ -54,6 +56,7 @@
HbDataFormModelItem *silenceIndicator = new HbDataFormModelItem(static_cast<HbDataFormModelItem::DataItemType>(SilenceIndicatorItem));
mItemList.insert(CpVolumeGroupItemData::EVolumeSilenceItem, silenceIndicator);
silenceIndicator->setContentWidgetData("text",hbTrId("txt_cp_button_silence"));
+ silenceIndicator->setContentWidgetData("objectName", "silenceIndicatorButton");
this->appendChild(silenceIndicator);
HbDataFormModelItem *masterVolume = new HbDataFormModelItem(HbDataFormModelItem::SliderItem,
@@ -64,23 +67,17 @@
<< QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement)
<< QVariant(HbSlider::TextElement);
masterVolume->setContentWidgetData("sliderElements",elements);
+ masterVolume->setContentWidgetData("objectName","masterVolumeSlider");
QMap<QString, QVariant> 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", 3);
+ masterVolume->setContentWidgetData("maximum", 10);
masterVolume->setContentWidgetData("majorTickInterval",1);
masterVolume->setContentWidgetData("tickPosition",Hb::SliderTicksBelow);
-
- /*QStringList tickLabels;
- tickLabels<<hbTrId("txt_cp_setlabel_volume_val_soft")
- <<hbTrId("txt_cp_setlabel_volume_val_med")
- <<hbTrId("txt_cp_setlabel_volume_val_loud");
- masterVolume->setContentWidgetData("majorTickLabels",tickLabels);*/
masterVolume->setContentWidgetData("iconCheckable",false);
this->appendChild(masterVolume);
@@ -88,6 +85,7 @@
HbDataFormModelItem *masterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem);
mItemList.insert(CpVolumeGroupItemData::EVolumeMasterVibraItem, masterVibra);
masterVibra->setContentWidgetData("text",hbTrId("txt_cp_list_vibrate"));
+ masterVibra->setContentWidgetData("objectName","masterVibraCheckBox");
this->appendChild(masterVibra);
--- a/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -27,3 +27,6 @@
symbian {
TARGET.UID3 = 0X20028737
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc Wed Sep 29 10:09:58 2010 +0800
@@ -1,10 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>icon/hb_vol_slider_decrement.svg</file>
- <file>icon/hb_vol_slider_decrement_pressed.svg</file>
- <file>icon/hb_vol_slider_increment.svg</file>
- <file>icon/hb_vol_slider_increment_pressed.svg</file>
- <file>icon/hb_vol_slider_muted.svg</file>
- <file>icon/hb_vol_slider_unmuted.svg</file>
+ <file>resources/hbslider_color.css</file>
</qresource>
</RCC>
\ No newline at end of file
--- a/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Wed Sep 29 10:09:58 2010 +0800
@@ -1,57 +1,61 @@
EXPORTS
?setKeyTouchScreenVibra@CpProfileModel@@QAEXHH@Z @ 1 NONAME ; void CpProfileModel::setKeyTouchScreenVibra(int, int)
?tr@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString CpProfileModel::tr(char const *, char const *, int)
- ?setReminderVibra@CpProfileModel@@QAEXH_N@Z @ 3 NONAME ; void CpProfileModel::setReminderVibra(int, bool)
- ?offLineMode@CpProfileModel@@QBE_NXZ @ 4 NONAME ; bool CpProfileModel::offLineMode(void) const
- ?masterVibra@CpProfileModel@@QBE_NXZ @ 5 NONAME ; bool CpProfileModel::masterVibra(void) const
- ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 6 NONAME ; class QString CpProfileModel::ringTone(void) const
- ?qt_metacast@CpProfileModel@@UAEPAXPBD@Z @ 7 NONAME ; void * CpProfileModel::qt_metacast(char const *)
- ?setRingTone@CpProfileModel@@QAEXABVQString@@@Z @ 8 NONAME ; void CpProfileModel::setRingTone(class QString const &)
- ?setReminderTone@CpProfileModel@@QAEXHABVQString@@@Z @ 9 NONAME ; void CpProfileModel::setReminderTone(int, class QString const &)
- ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *)
- ?silenceMode@CpProfileModel@@QBE_NXZ @ 11 NONAME ; bool CpProfileModel::silenceMode(void) const
- ?reminderVibra@CpProfileModel@@QBE_NH@Z @ 12 NONAME ; bool CpProfileModel::reminderVibra(int) const
- ?setEmailTone@CpProfileModel@@QAEXHABVQString@@@Z @ 13 NONAME ; void CpProfileModel::setEmailTone(int, class QString const &)
- ?ringAlertVibra@CpProfileModel@@QBE_NH@Z @ 14 NONAME ; bool CpProfileModel::ringAlertVibra(int) const
- ?emailTone@CpProfileModel@@QBE?AVQString@@H@Z @ 15 NONAME ; class QString CpProfileModel::emailTone(int) const
- ?activeProfileId@CpProfileModel@@QBEHXZ @ 16 NONAME ; int CpProfileModel::activeProfileId(void) const
- ?masterVolume@CpProfileModel@@QBEHXZ @ 17 NONAME ; int CpProfileModel::masterVolume(void) const
- ?notificationTone@CpProfileModel@@QBE_NH@Z @ 18 NONAME ; bool CpProfileModel::notificationTone(int) const
- ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 19 NONAME ; class QString CpProfileModel::tr(char const *, char const *)
- ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void)
- ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 21 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const
- ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 22 NONAME ; void CpProfileModel::setRingTone(int, class QString const &)
- ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 23 NONAME ; class QString CpProfileModel::reminderTone(int) const
- ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 24 NONAME ; class QString CpProfileModel::profileName(int) const
- ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 25 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int)
- ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 26 NONAME ; void CpProfileModel::setMasterVolume(int)
- ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject
- ?activateProfile@CpProfileModel@@QAEHH@Z @ 28 NONAME ; int CpProfileModel::activateProfile(int)
- ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 29 NONAME ; class QStringList CpProfileModel::profileNames(void) const
- ?setNotificationVibra@CpProfileModel@@QAEXH_N@Z @ 30 NONAME ; void CpProfileModel::setNotificationVibra(int, bool)
- ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 31 NONAME ; void CpProfileModel::setNotificationTone(int, bool)
- ?metaObject@CpProfileModel@@UBEPBUQMetaObject@@XZ @ 32 NONAME ; struct QMetaObject const * CpProfileModel::metaObject(void) const
- ?setRingAlertVibra@CpProfileModel@@QAEXH_N@Z @ 33 NONAME ; void CpProfileModel::setRingAlertVibra(int, bool)
- ??0CpProfileModel@@QAE@PAVQObject@@@Z @ 34 NONAME ; CpProfileModel::CpProfileModel(class QObject *)
- ?emailVibra@CpProfileModel@@QBE_NH@Z @ 35 NONAME ; bool CpProfileModel::emailVibra(int) const
- ?setProfileSettings@CpProfileModel@@QAEHHAAVCpProfileSettings@@@Z @ 36 NONAME ; int CpProfileModel::setProfileSettings(int, class CpProfileSettings &)
- ?setEmailVibra@CpProfileModel@@QAEXH_N@Z @ 37 NONAME ; void CpProfileModel::setEmailVibra(int, bool)
- ?setOffLineMode@CpProfileModel@@QAEX_N@Z @ 38 NONAME ; void CpProfileModel::setOffLineMode(bool)
- ??1CpProfileModel@@UAE@XZ @ 39 NONAME ; CpProfileModel::~CpProfileModel(void)
- ?notificationVibra@CpProfileModel@@QBE_NH@Z @ 40 NONAME ; bool CpProfileModel::notificationVibra(int) const
- ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 41 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 42 NONAME ; class QString CpProfileModel::messageTone(int) const
- ?profileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 43 NONAME ; void CpProfileModel::profileSettings(int, class CpProfileSettings &)
- ?d_func@CpProfileModel@@ABEPBVCpProfileModelPrivate@@XZ @ 44 NONAME ; class CpProfileModelPrivate const * CpProfileModel::d_func(void) const
- ?setSilenceMode@CpProfileModel@@QAEX_N@Z @ 45 NONAME ; void CpProfileModel::setSilenceMode(bool)
- ?setMessageVibra@CpProfileModel@@QAEXH_N@Z @ 46 NONAME ; void CpProfileModel::setMessageVibra(int, bool)
- ?keyTouchScreenVibra@CpProfileModel@@QBEHH@Z @ 47 NONAME ; int CpProfileModel::keyTouchScreenVibra(int) const
- ?d_func@CpProfileModel@@AAEPAVCpProfileModelPrivate@@XZ @ 48 NONAME ; class CpProfileModelPrivate * CpProfileModel::d_func(void)
- ?initiationFlag@CpProfileModel@@QAEHXZ @ 49 NONAME ; int CpProfileModel::initiationFlag(void)
- ?messageVibra@CpProfileModel@@QBE_NH@Z @ 50 NONAME ; bool CpProfileModel::messageVibra(int) const
- ??_ECpProfileModel@@UAE@I@Z @ 51 NONAME ; CpProfileModel::~CpProfileModel(unsigned int)
- ?ringTone@CpProfileModel@@QBE?AVQString@@H@Z @ 52 NONAME ; class QString CpProfileModel::ringTone(int) const
- ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 53 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *, int)
- ?setMessageTone@CpProfileModel@@QAEXHABVQString@@@Z @ 54 NONAME ; void CpProfileModel::setMessageTone(int, class QString const &)
- ?setMasterVibra@CpProfileModel@@QAEX_N@Z @ 55 NONAME ; void CpProfileModel::setMasterVibra(bool)
+ ?masterVibra@CpProfileModel@@QBE_NXZ @ 3 NONAME ; bool CpProfileModel::masterVibra(void) const
+ ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 4 NONAME ; class QString CpProfileModel::ringTone(void) const
+ ?setProfileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 5 NONAME ; void CpProfileModel::setProfileSettings(int, class CpProfileSettings &)
+ ?qt_metacast@CpProfileModel@@UAEPAXPBD@Z @ 6 NONAME ; void * CpProfileModel::qt_metacast(char const *)
+ ?setRingTone@CpProfileModel@@QAEXABVQString@@@Z @ 7 NONAME ; void CpProfileModel::setRingTone(class QString const &)
+ ?setReminderTone@CpProfileModel@@QAEXHABVQString@@@Z @ 8 NONAME ; void CpProfileModel::setReminderTone(int, class QString const &)
+ ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *)
+ ?silenceMode@CpProfileModel@@QBE_NXZ @ 10 NONAME ; bool CpProfileModel::silenceMode(void) const
+ ?setEmailTone@CpProfileModel@@QAEXHABVQString@@@Z @ 11 NONAME ; void CpProfileModel::setEmailTone(int, class QString const &)
+ ?emailTone@CpProfileModel@@QBE?AVQString@@H@Z @ 12 NONAME ; class QString CpProfileModel::emailTone(int) const
+ ?activeProfileId@CpProfileModel@@QBEHXZ @ 13 NONAME ; int CpProfileModel::activeProfileId(void) const
+ ?masterVolume@CpProfileModel@@QBEHXZ @ 14 NONAME ; int CpProfileModel::masterVolume(void) const
+ ?notificationTone@CpProfileModel@@QBE_NH@Z @ 15 NONAME ; bool CpProfileModel::notificationTone(int) const
+ ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpProfileModel::tr(char const *, char const *)
+ ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void)
+ ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 18 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const
+ ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 19 NONAME ; class QString CpProfileModel::reminderTone(int) const
+ ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 20 NONAME ; class QString CpProfileModel::profileName(int) const
+ ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 21 NONAME ; void CpProfileModel::setRingTone(int, class QString const &)
+ ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 22 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int)
+ ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 23 NONAME ; void CpProfileModel::setMasterVolume(int)
+ ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 24 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject
+ ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 25 NONAME ; class QStringList CpProfileModel::profileNames(void) const
+ ?activateProfile@CpProfileModel@@QAEHH@Z @ 26 NONAME ; int CpProfileModel::activateProfile(int)
+ ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 27 NONAME ; void CpProfileModel::setNotificationTone(int, bool)
+ ?metaObject@CpProfileModel@@UBEPBUQMetaObject@@XZ @ 28 NONAME ; struct QMetaObject const * CpProfileModel::metaObject(void) const
+ ??0CpProfileModel@@QAE@PAVQObject@@@Z @ 29 NONAME ; CpProfileModel::CpProfileModel(class QObject *)
+ ??1CpProfileModel@@UAE@XZ @ 30 NONAME ; CpProfileModel::~CpProfileModel(void)
+ ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 31 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?profileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 32 NONAME ; void CpProfileModel::profileSettings(int, class CpProfileSettings &)
+ ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 33 NONAME ; class QString CpProfileModel::messageTone(int) const
+ ?d_func@CpProfileModel@@ABEPBVCpProfileModelPrivate@@XZ @ 34 NONAME ; class CpProfileModelPrivate const * CpProfileModel::d_func(void) const
+ ?setSilenceMode@CpProfileModel@@QAEX_N@Z @ 35 NONAME ; void CpProfileModel::setSilenceMode(bool)
+ ?keyTouchScreenVibra@CpProfileModel@@QBEHH@Z @ 36 NONAME ; int CpProfileModel::keyTouchScreenVibra(int) const
+ ?d_func@CpProfileModel@@AAEPAVCpProfileModelPrivate@@XZ @ 37 NONAME ; class CpProfileModelPrivate * CpProfileModel::d_func(void)
+ ??_ECpProfileModel@@UAE@I@Z @ 38 NONAME ; CpProfileModel::~CpProfileModel(unsigned int)
+ ?ringTone@CpProfileModel@@QBE?AVQString@@H@Z @ 39 NONAME ; class QString CpProfileModel::ringTone(int) const
+ ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *, int)
+ ?setMessageTone@CpProfileModel@@QAEXHABVQString@@@Z @ 41 NONAME ; void CpProfileModel::setMessageTone(int, class QString const &)
+ ?setMasterVibra@CpProfileModel@@QAEX_N@Z @ 42 NONAME ; void CpProfileModel::setMasterVibra(bool)
+ ?trUtf8@CpProfileMonitor@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString CpProfileMonitor::trUtf8(char const *, char const *, int)
+ ??_ECpProfileMonitor@@UAE@I@Z @ 44 NONAME ; CpProfileMonitor::~CpProfileMonitor(unsigned int)
+ ?activeProfileModified@CpProfileMonitor@@IAEXH@Z @ 45 NONAME ; void CpProfileMonitor::activeProfileModified(int)
+ ?tr@CpProfileMonitor@@SA?AVQString@@PBD0H@Z @ 46 NONAME ; class QString CpProfileMonitor::tr(char const *, char const *, int)
+ ?trUtf8@CpProfileMonitor@@SA?AVQString@@PBD0@Z @ 47 NONAME ; class QString CpProfileMonitor::trUtf8(char const *, char const *)
+ ?staticMetaObject@CpProfileMonitor@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const CpProfileMonitor::staticMetaObject
+ ??0CpProfileMonitor@@QAE@PAVQObject@@@Z @ 49 NONAME ; CpProfileMonitor::CpProfileMonitor(class QObject *)
+ ?metaObject@CpProfileMonitor@@UBEPBUQMetaObject@@XZ @ 50 NONAME ; struct QMetaObject const * CpProfileMonitor::metaObject(void) const
+ ?d_func@CpProfileMonitor@@ABEPBVCpProfileMonitorPrivate@@XZ @ 51 NONAME ; class CpProfileMonitorPrivate const * CpProfileMonitor::d_func(void) const
+ ?d_func@CpProfileMonitor@@AAEPAVCpProfileMonitorPrivate@@XZ @ 52 NONAME ; class CpProfileMonitorPrivate * CpProfileMonitor::d_func(void)
+ ?profileActivated@CpProfileMonitor@@IAEXH@Z @ 53 NONAME ; void CpProfileMonitor::profileActivated(int)
+ ?tr@CpProfileMonitor@@SA?AVQString@@PBD0@Z @ 54 NONAME ; class QString CpProfileMonitor::tr(char const *, char const *)
+ ?getStaticMetaObject@CpProfileMonitor@@SAABUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const & CpProfileMonitor::getStaticMetaObject(void)
+ ?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 &)
--- a/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Wed Sep 29 10:09:58 2010 +0800
@@ -50,8 +50,11 @@
HEADERS += ../inc/cpprofilemodel.h \
../inc/cpprofilewrappermacro.h \
- src/cpprofilemodel_p.h
-SOURCES += src/cpprofilemodel.cpp
+ ../inc/cpprofilemonitor.h \
+ src/cpprofilemodel_p.h \
+ src/cpprofilemonitor_p.h
+SOURCES += src/cpprofilemodel.cpp \
+ src/cpprofilemonitor.cpp
CONFIG += hb
win32 {
INCLUDEPATH += $$PWD/src
@@ -65,15 +68,20 @@
$$MOC_DIR
INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger)
- SOURCES += src/cpprofilemodel_p.cpp
+ SOURCES += src/cpprofilemodel_p.cpp \
+ src/cpprofilemonitor_p.cpp
LIBS += -lprofileeng \
-lcentralrepository \
-lcharconv \
- -lcpframework # For cplogger
+ -lcplogger \ # For cplogger
+ -lxqutils
TARGET.CAPABILITY = All -TCB
TARGET.EPOCALLOWDLLDATA = 1
TARGET.UID3 = 0x20025FE6
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Wed Sep 29 10:09:58 2010 +0800
@@ -4,52 +4,54 @@
_ZN14CpProfileModel11setRingToneERK7QString @ 3 NONAME
_ZN14CpProfileModel11setRingToneEiRK7QString @ 4 NONAME
_ZN14CpProfileModel12setEmailToneEiRK7QString @ 5 NONAME
- _ZN14CpProfileModel13setEmailVibraEib @ 6 NONAME
- _ZN14CpProfileModel14initiationFlagEv @ 7 NONAME
- _ZN14CpProfileModel14setMasterVibraEb @ 8 NONAME
- _ZN14CpProfileModel14setMessageToneEiRK7QString @ 9 NONAME
- _ZN14CpProfileModel14setOffLineModeEb @ 10 NONAME
- _ZN14CpProfileModel14setSilenceModeEb @ 11 NONAME
- _ZN14CpProfileModel15activateProfileEi @ 12 NONAME
- _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 13 NONAME
- _ZN14CpProfileModel15setMasterVolumeEi @ 14 NONAME
- _ZN14CpProfileModel15setMessageVibraEib @ 15 NONAME
- _ZN14CpProfileModel15setReminderToneEiRK7QString @ 16 NONAME
- _ZN14CpProfileModel16setReminderVibraEib @ 17 NONAME
- _ZN14CpProfileModel16staticMetaObjectE @ 18 NONAME DATA 16
- _ZN14CpProfileModel17setRingAlertVibraEib @ 19 NONAME
- _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 20 NONAME
- _ZN14CpProfileModel19getStaticMetaObjectEv @ 21 NONAME
- _ZN14CpProfileModel19setNotificationToneEib @ 22 NONAME
- _ZN14CpProfileModel20setNotificationVibraEib @ 23 NONAME
- _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 24 NONAME
- _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 25 NONAME
- _ZN14CpProfileModelC1EP7QObject @ 26 NONAME
- _ZN14CpProfileModelC2EP7QObject @ 27 NONAME
- _ZN14CpProfileModelD0Ev @ 28 NONAME
- _ZN14CpProfileModelD1Ev @ 29 NONAME
- _ZN14CpProfileModelD2Ev @ 30 NONAME
- _ZNK14CpProfileModel10emailVibraEi @ 31 NONAME
- _ZNK14CpProfileModel10metaObjectEv @ 32 NONAME
- _ZNK14CpProfileModel11masterVibraEv @ 33 NONAME
- _ZNK14CpProfileModel11messageToneEi @ 34 NONAME
- _ZNK14CpProfileModel11offLineModeEv @ 35 NONAME
- _ZNK14CpProfileModel11profileNameEi @ 36 NONAME
- _ZNK14CpProfileModel11silenceModeEv @ 37 NONAME
- _ZNK14CpProfileModel12masterVolumeEv @ 38 NONAME
- _ZNK14CpProfileModel12messageVibraEi @ 39 NONAME
- _ZNK14CpProfileModel12profileNamesEv @ 40 NONAME
- _ZNK14CpProfileModel12reminderToneEi @ 41 NONAME
- _ZNK14CpProfileModel13reminderVibraEi @ 42 NONAME
- _ZNK14CpProfileModel14ringAlertVibraEi @ 43 NONAME
- _ZNK14CpProfileModel15activeProfileIdEv @ 44 NONAME
- _ZNK14CpProfileModel16notificationToneEi @ 45 NONAME
- _ZNK14CpProfileModel17notificationVibraEi @ 46 NONAME
- _ZNK14CpProfileModel18keyTouchScreenToneEi @ 47 NONAME
- _ZNK14CpProfileModel19keyTouchScreenVibraEi @ 48 NONAME
- _ZNK14CpProfileModel8ringToneEi @ 49 NONAME
- _ZNK14CpProfileModel8ringToneEv @ 50 NONAME
- _ZNK14CpProfileModel9emailToneEi @ 51 NONAME
- _ZTI14CpProfileModel @ 52 NONAME
- _ZTV14CpProfileModel @ 53 NONAME
+ _ZN14CpProfileModel14setMasterVibraEb @ 6 NONAME
+ _ZN14CpProfileModel14setMessageToneEiRK7QString @ 7 NONAME
+ _ZN14CpProfileModel14setSilenceModeEb @ 8 NONAME
+ _ZN14CpProfileModel15activateProfileEi @ 9 NONAME
+ _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 10 NONAME
+ _ZN14CpProfileModel15setMasterVolumeEi @ 11 NONAME
+ _ZN14CpProfileModel15setReminderToneEiRK7QString @ 12 NONAME
+ _ZN14CpProfileModel16staticMetaObjectE @ 13 NONAME DATA 16
+ _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 14 NONAME
+ _ZN14CpProfileModel19getStaticMetaObjectEv @ 15 NONAME
+ _ZN14CpProfileModel19setNotificationToneEib @ 16 NONAME
+ _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 17 NONAME
+ _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 18 NONAME
+ _ZN14CpProfileModelC1EP7QObject @ 19 NONAME
+ _ZN14CpProfileModelC2EP7QObject @ 20 NONAME
+ _ZN14CpProfileModelD0Ev @ 21 NONAME
+ _ZN14CpProfileModelD1Ev @ 22 NONAME
+ _ZN14CpProfileModelD2Ev @ 23 NONAME
+ _ZNK14CpProfileModel10metaObjectEv @ 24 NONAME
+ _ZNK14CpProfileModel11masterVibraEv @ 25 NONAME
+ _ZNK14CpProfileModel11messageToneEi @ 26 NONAME
+ _ZNK14CpProfileModel11profileNameEi @ 27 NONAME
+ _ZNK14CpProfileModel11silenceModeEv @ 28 NONAME
+ _ZNK14CpProfileModel12masterVolumeEv @ 29 NONAME
+ _ZNK14CpProfileModel12profileNamesEv @ 30 NONAME
+ _ZNK14CpProfileModel12reminderToneEi @ 31 NONAME
+ _ZNK14CpProfileModel15activeProfileIdEv @ 32 NONAME
+ _ZNK14CpProfileModel16notificationToneEi @ 33 NONAME
+ _ZNK14CpProfileModel18keyTouchScreenToneEi @ 34 NONAME
+ _ZNK14CpProfileModel19keyTouchScreenVibraEi @ 35 NONAME
+ _ZNK14CpProfileModel8ringToneEi @ 36 NONAME
+ _ZNK14CpProfileModel8ringToneEv @ 37 NONAME
+ _ZNK14CpProfileModel9emailToneEi @ 38 NONAME
+ _ZTI14CpProfileModel @ 39 NONAME
+ _ZTV14CpProfileModel @ 40 NONAME
+ _ZN16CpProfileMonitor11qt_metacallEN11QMetaObject4CallEiPPv @ 41 NONAME
+ _ZN16CpProfileMonitor11qt_metacastEPKc @ 42 NONAME
+ _ZN16CpProfileMonitor16profileActivatedEi @ 43 NONAME
+ _ZN16CpProfileMonitor16staticMetaObjectE @ 44 NONAME DATA 16
+ _ZN16CpProfileMonitor19getStaticMetaObjectEv @ 45 NONAME
+ _ZN16CpProfileMonitor21activeProfileModifiedEi @ 46 NONAME
+ _ZN16CpProfileMonitorC1EP7QObject @ 47 NONAME
+ _ZN16CpProfileMonitorC2EP7QObject @ 48 NONAME
+ _ZN16CpProfileMonitorD0Ev @ 49 NONAME
+ _ZN16CpProfileMonitorD1Ev @ 50 NONAME
+ _ZN16CpProfileMonitorD2Ev @ 51 NONAME
+ _ZNK16CpProfileMonitor10metaObjectEv @ 52 NONAME
+ _ZTI16CpProfileMonitor @ 53 NONAME
+ _ZTV16CpProfileMonitor @ 54 NONAME
+ _ZN14CpProfileModel14setProfileNameEiRK7QString @ 55 NONAME
--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -19,49 +19,56 @@
#include "cpprofilemodel_p.h"
#include <QtCore/QStringList>
+/*!
+ Contructor
+ */
CpProfileModel::CpProfileModel(QObject *parent /*=0*/):QObject(parent),
d_ptr(new CpProfileModelPrivate())
{
d_ptr->initialize(this);
}
+/*!
+ Destrutor
+ */
CpProfileModel::~CpProfileModel()
{
delete d_ptr;
}
-/*
- * Get the result of the initiation
- */
-int CpProfileModel::initiationFlag()
-{
- return d_ptr->initiationFlag();
-}
-
-/*
- * Get profile name with its id
+/*!
+ Get profile name with its id
*/
QString CpProfileModel::profileName(int profileId) const
{
return d_ptr->profileName(profileId);
}
+
/*!
- * get profile name list
+ 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
*/
QStringList CpProfileModel::profileNames()const
{
return d_ptr->profileNames();
}
-/*
- * Activate a profile with its id, return the operation code.
+/*!
+ Activate a profile with its id, return the result code.
*/
int CpProfileModel::activateProfile(int profileId)
{
return d_ptr->activateProfile(profileId);
}
-/*
- * Get active profile's id
+/*!
+ Get active profile's id
*/
int CpProfileModel::activeProfileId() const
{
@@ -79,14 +86,13 @@
/*!
Set profile settings from center repository keys
*/
-int CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings )
+void CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings )
{
return d_ptr->setProfileSettings(profileId, profileSettings);
}
/*!
- Get ring tone of profiles, if the general profile's ring tone is different with
- meeting ring tone, it returns the general profile's ring tone
+ Get ring tone of active profile
*/
QString CpProfileModel::ringTone() const
{
@@ -102,7 +108,7 @@
}
/*!
- Return master volume for device
+ Return ringing volume of device
*/
int CpProfileModel::masterVolume() const
{
@@ -110,7 +116,7 @@
}
/*!
- Set device's master volume
+ Set device's ringing volume
*/
void CpProfileModel::setMasterVolume(int volume)
{
@@ -126,9 +132,7 @@
}
/*!
- Set the master vibra's status of device, if the master vibra is on,
- the vibra settings in profiles are valid, if the master is off, the
- vibra settings in profiles are invalid.
+ Set the master vibra's status of device
*/
void CpProfileModel::setMasterVibra(bool isVibra)
{
@@ -136,8 +140,7 @@
}
/*!
- Return the silence mode of device, silence mode will kill all outgoing
- audio.
+ Return the silence mode of device
*/
bool CpProfileModel::silenceMode() const
{
@@ -153,346 +156,137 @@
}
/*!
- Return the status of off line mode (air plane mode) of device
+ Get profile's ring tone, if the profile id is invalid, always return an empty string
+ \param profileId profile's id
*/
-bool CpProfileModel::offLineMode() const
-{
- return d_ptr->offLineMode();
-}
-
-/*!
- Set off line mode of device
- */
-void CpProfileModel::setOffLineMode(bool isOffLine)
-{
- d_ptr->setOffLineMode(isOffLine);
-}
-
QString CpProfileModel::ringTone(int profileId)const
{
return d_ptr->ringTone(profileId);
}
+/*!
+ Set ring tone for a profile, if the profile id is invalid, nothing happens
+ \param profileId profile's id
+ \param filePath ring tone's path
+ */
void CpProfileModel::setRingTone(int profileId, const QString& filePath)
{
d_ptr->setRingTone(profileId, filePath);
}
+/*!
+ Get message tone's name, if the profile id is invalid, always return an empty string
+ \param profileId profile's id
+ */
QString CpProfileModel::messageTone(int profileId) const
{
return d_ptr->messageTone(profileId);
}
+/*!
+ Set message tone for a profile, if the profile id is invalid, nothing happens
+ \param profileId profile's id
+ \param filePath message tone's path
+ */
void CpProfileModel::setMessageTone(int profileId, const QString& filePath)
{
d_ptr->setMessageTone(profileId, filePath);
}
+/*!
+ Get email tone's name, if the profile id is invalid, always return an empty string
+ \param profileId profile's id
+ */
QString CpProfileModel::emailTone(int profileId) const
{
return d_ptr->emailTone(profileId);
}
+/*!
+ Set email tone for a profile, if the profile id is invalid, nothing happens
+ \param profileId profile's id
+ \param filePath message tone's path
+ */
void CpProfileModel::setEmailTone(int profileId, const QString& filePath)
{
d_ptr->setEmailTone(profileId,filePath);
}
+/*!
+ Get reminder tone's name, if the profile id is invalid, always return an empty string
+ \param profileId profile's id
+ */
QString CpProfileModel::reminderTone(int profileId) const
{
return d_ptr->reminderTone(profileId);
}
+/*!
+ Set reminder tone for a profile, if the profile id is invalid, nothing happens
+ \param profileId profile's id
+ \param filePath reminder tone's path
+ */
void CpProfileModel::setReminderTone(int profileId, const QString& filePath)
{
d_ptr->setReminderTone(profileId,filePath);
}
+/*!
+ Get notification tone's status, if the profile id is invalid, always return false
+ \param profileId profile's id
+ \return return the status of notification tone, true value stands for the tone being on
+ */
bool CpProfileModel::notificationTone(int profileId) const
{
return d_ptr->notificationTone(profileId);
}
+/*!
+ Set notification tone's status for a profile, if the profile id is invalid, nothing happens
+ \param profileId profile's id
+ \return isActive the status of notification tone
+ */
void CpProfileModel::setNotificationTone(int profileId, bool isActive)
{
d_ptr->setNotificationTone(profileId, isActive);
}
+/*!
+ Get key & touch screen tone's value, if the profile id is invalid, always return 0
+ */
int CpProfileModel::keyTouchScreenTone(int profileId) const
{
return d_ptr->keyTouchScreenTone(profileId);
}
+/*!
+ set key & touch screen tone, if the profile id is invalid, nothing happens
+ \param profileId identify the profile
+ \param level 0-5
+ */
void CpProfileModel::setKeyTouchScreenTone(int profileId, int level)
{
d_ptr->setKeyTouchScreenTone(profileId,level);
}
-bool CpProfileModel::ringAlertVibra(int profileId) const
-{
- return d_ptr->ringAlertVibra(profileId);
-}
-
-void CpProfileModel::setRingAlertVibra(int profileId, bool isActive)
-{
- d_ptr->setRingAlertVibra(profileId,isActive);
-}
-
-bool CpProfileModel::messageVibra(int profileId) const
+/*!
+ Get key & touch screen vibra's value, if the profile id is invalid, always return 0
+ \param profileId identify the profile
+ */
+int CpProfileModel::keyTouchScreenVibra(int profileId) const
{
- return d_ptr->messageVibra(profileId);
-}
-
-void CpProfileModel::setMessageVibra(int profileId, bool isActive)
-{
- return d_ptr->setMessageVibra(profileId,isActive);
-}
-
-bool CpProfileModel::emailVibra(int profileId) const
-{
- return d_ptr->emailVibra(profileId);
+ return d_ptr->keyTouchScreenVibra(profileId);
}
-void CpProfileModel::setEmailVibra(int profileId, bool isActive)
-{
- d_ptr->setEmailVibra(profileId,isActive);
-}
-
-bool CpProfileModel::reminderVibra(int profileId) const
-{
- return d_ptr->reminderVibra(profileId);
-}
-
-void CpProfileModel::setReminderVibra(int profileId, bool isActive)
-{
- d_ptr->setReminderVibra(profileId,isActive);
-}
-
-bool CpProfileModel::notificationVibra(int profileId) const
-{
- return d_ptr->notificationVibra(profileId);
-}
-
-void CpProfileModel::setNotificationVibra(int profileId, bool isActive)
-{
- d_ptr->setNotificationVibra(profileId,isActive);
-}
-
-int CpProfileModel::keyTouchScreenVibra(int profileId)const
-{
- return d_ptr->keyTouchScreenVibra(profileId);
-}
-
+/*!
+ Set key touch screen vibar for a profile, if the profile id is invalid, nothing happens
+ \param profileId identify the profile
+ \param level 0-5
+ */
void CpProfileModel::setKeyTouchScreenVibra(int profileId, int level)
{
d_ptr->setKeyTouchScreenVibra(profileId,level);
}
-///*
-// * Set a profile as current editing profile
-// */
-//int CpProfileModel::setEditingProfile(int profileId)
-//{
-// return d_ptr->setEditingProfile(profileId);
-//}
-//
-///*
-// * Get path and file name of ring tone file
-// */
-//QString CpProfileModel::ringTone()
-//{
-// return d_ptr->ringTone();
-//}
-//
-///*
-// * Set path and file to ring tone
-// */
-//int CpProfileModel::setRingTone(const QString& filePath)
-//{
-// int err = d_ptr->setRingTone(filePath);
-// return err;
-//}
-//
-///*
-// * Get path and file name of message tone file
-// */
-//QString CpProfileModel::messageTone()
-//{
-// return d_ptr->messageTone();
-//}
-//
-///*
-// * Set path and file to message tone
-// */
-//int CpProfileModel::setMessageTone(const QString& filePath)
-//{
-// int err = d_ptr->setMessageTone(filePath);
-// return err;
-//}
-//
-///*
-// * Get path and file name of email tone file
-// */
-//QString CpProfileModel::emailTone()
-//{
-// return d_ptr->emailTone();
-//}
-//
-///*
-// * Set path and file to email tone
-// */
-//int CpProfileModel::setEmailTone(const QString& filePath)
-//{
-// int err = d_ptr->setEmailTone(filePath);
-// return err;
-//}
-//
-///*
-// * Get path and file name of calendar event tone file
-// */
-//QString CpProfileModel::calendarTone()
-//{
-// return d_ptr->calendarTone();
-//}
-//
-///*
-// * Set path and file to calendar event tone
-// */
-//void CpProfileModel::setCalendarTone(const QString& filePath)
-//{
-// d_ptr->setCalendarTone(filePath);
-//}
-//
-///*
-// * Get path and file name of clock alarm tone file
-// */
-//QString CpProfileModel::alarmTone()
-//{
-// return d_ptr->alarmTone();
-//}
-//
-///*
-// * Set path and file to clock alarm tone
-// */
-//void CpProfileModel::setAlarmTone(const QString& filePath)
-//{
-// d_ptr->setAlarmTone(filePath);
-//}
-//
-///*
-// * Get the value of master volume
-// */
-//int CpProfileModel::ringVolume()
-//{
-// return d_ptr->ringVolume();
-//}
-//
-///*
-// * Set master volume, the value should be between 1-10
-// */
-//void CpProfileModel::setRingVolume(int volume)
-//{
-// d_ptr->setRingVolume(volume);
-//}
-//
-///*
-// * Activate master volume to beep
-// */
-//void CpProfileModel::activateBeep()
-//{
-// d_ptr->activateBeep();
-//}
-//
-///*
-// * Get beep status in master volume
-// */
-//bool CpProfileModel::isBeep()
-//{
-// return d_ptr->isBeep();
-//}
-//
-///*
-// * Activate master volume to silent
-// */
-//void CpProfileModel::activateSilent()
-//{
-// d_ptr->activateSilent();
-//}
-//
-///*
-// * Get silent status in master volume
-// */
-//bool CpProfileModel::isSilent()
-//{
-// return d_ptr->isSilent();
-//}
-//
-///*
-// * Get master vibra's status
-// */
-//bool CpProfileModel::vibraStatus()
-//{
-// return d_ptr->vibraStatus();
-//}
-//
-///*
-// * Set master vibra's status
-// */
-//void CpProfileModel::setVibraStatus(bool status)
-//{
-// d_ptr->setVibraStatus(status);
-//}
-//
-///*
-// * Get keypad' volume
-// */
-//int CpProfileModel::keyVolume()
-//{
-// return d_ptr->keyVolume();
-//}
-//
-///*
-// * Set keypad's volume,
-// * the value of the volume should be between 0-3
-// */
-//void CpProfileModel::setKeyVolume(int volume)
-//{
-// d_ptr->setKeyVolume(volume);
-//}
-//
-///*
-// * Get screen tone's volume
-// */
-//int CpProfileModel::screenVolume()
-//{
-// return d_ptr->screenVolume();
-//}
-//
-///*
-// * Set screen tone's volume,
-// * the value of the volume should be between 0-3
-// */
-//void CpProfileModel::setScreenVolume(int volume)
-//{
-// d_ptr->setScreenVolume(volume);
-//}
-//
-///*
-// * Get screen vibra's level
-// */
-//int CpProfileModel::screenVibra()
-//{
-// return d_ptr->screenVibra();
-//}
-//
-///*
-// * Set screen vibra's level,
-// * the value of the level should be between 0-3
-// */
-//void CpProfileModel::setScreenVibra(int volume)
-//{
-// d_ptr->setScreenVibra(volume);
-//}
-
// End of file
--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -33,6 +33,7 @@
#include <MProfileFeedbackSettings.h>
#include <MProfileSetFeedbackSettings.h>
#include <MProfilesNamesArray.h>
+#include <MProfileSetName.h>
#include <settingsinternalcrkeys.h>
#include <hbglobal.h>
#include <QtCore/QStringList>
@@ -44,80 +45,54 @@
#include <TProfileToneSettings.h>
#include <hwrmvibrasdkcrkeys.h>
#include <centralrepository.h>
-
-
-QString stringFromDescriptor(const TDesC& dsp)
-{
- return QString::fromUtf16(dsp.Ptr(), dsp.Length());
-}
-
-HBufC* descriptorFromString(const QString& str)
-{
- TPtrC ptr(reinterpret_cast<const TUint16*>(str.utf16()));
- return ptr.Alloc();
-}
-
+#include <XQConversions>
+#include <profile.hrh>
+/*
+ * Constructor
+ */
CpProfileModelPrivate::CpProfileModelPrivate()
- : mEngine(0),
- mInitErrFlag(0),
- mOffLineCenRep(0),
+ : mEngine(0),
q_ptr(0)
{
}
+/*
+ * Initialize the profile engine and available profile list for profile wrapper.
+ */
void CpProfileModelPrivate::initialize(CpProfileModel *parent)
{
q_ptr = parent;
CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START.");
- TRAPD( err,
- mEngine = CreateProfileEngineExtended2L();
- mOffLineCenRep = CRepository::NewL( KCRUidCommunicationSettings );
-
- /*
- * Currently, engine part will return all previous version of profile
- * so some invalid profile will be added in the new list, to avoid this
- * use hard code to get the right list of profile.
- */
- /*MProfilesNamesArray* nameList = mEngine->ProfilesNamesArrayLC();
- int profileCount = nameList->MdcaCount();
- for (int i = 0; i<profileCount; i++) {
- MProfileName *profileName = nameList->ProfileName(i);
- mProfileList.insert(profileName->Id(), mEngine->Profile2L(profileName->Id()));
- }
- CleanupStack::PopAndDestroy(*nameList);*/
- mProfileList.insert(0, mEngine->Profile2L(0)); // general id
- mProfileList.insert(2, mEngine->Profile2L(2));
+ TRAP_IGNORE(
+ mEngine = CreateProfileEngineExtended2L();
+ /*
+ * Currently, engine part will return all previous version of profile
+ * so some invalid profile will be added in the new list, to avoid this
+ * use hard code to get the right list of profile.
+ */
+ /*MProfilesNamesArray* nameList = mEngine->ProfilesNamesArrayLC();
+ int profileCount = nameList->MdcaCount();
+ for (int i = 0; i<profileCount; i++) {
+ MProfileName *profileName = nameList->ProfileName(i);
+ mProfileList.insert(profileName->Id(), mEngine->Profile2L(profileName->Id()));
+ }
+ CleanupStack::PopAndDestroy(*nameList);*/
);
-
- // currently, reserve a error code for deal with low memory ... leave
- // as known, qt in symbian exception safety's development is ongoing.
- // we will follow the official way to deal with symbian leave or exception
- mInitErrFlag = err;
- CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END, err is." + QString(err) );
+ mProfileList.append(static_cast<int>(EProfileWrapperGeneralId)); // general id
+ mProfileList.append(static_cast<int>(EProfileWrapperMeetingId)); // meeting id
+ CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END");
}
+/*
+ * Destructor
+ */
CpProfileModelPrivate::~CpProfileModelPrivate()
{
if (mEngine!=0) {
mEngine->Release();
}
- foreach(MProfileExtended2* profile, mProfileList)
- {
- if (profile!=0 ) {
- profile->Release();
- }
- }
- mProfileList.clear();
- delete mOffLineCenRep;
-}
-
-/*
- * Get the result of the initiation
- */
-int CpProfileModelPrivate::initiationFlag()
-{
- return mInitErrFlag;
+ mProfileList.clear();
}
/*
@@ -126,49 +101,78 @@
QString CpProfileModelPrivate::profileName(int profileId) const
{
CPFW_LOG("CpProfileModelPrivate::profileName(), START.");
+ // Return an empty string if id is not valid.
+ 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;
+
+}
-// MProfileName* name = 0;
-// TRAPD( err, *name = mEngine->ProfileL(profileId)->ProfileName(); );
-//
-// if ( !err && name){
-// CPFW_LOG("CpProfileModelPrivate::profileName(), have name, END.");
-// return stringFromDescriptor( name->Name() );
-// } else {
-// CPFW_LOG("CpProfileModelPrivate::profileName(), no name, END.");
-// return "";
-// }
- // should return qt localized profile name
- // engine return symbian localized name, that is a wrong way to got it
- // so hard code here, wait for engine's correcting.
- switch (profileId) {
- case EProfileWrapperGeneralId:
- return hbTrId("txt_cp_list_general");
- case EProfileWrapperMeetingId:
- return hbTrId("txt_cp_list_meeting");
- default:
- return QString("");
- }
+/*
+ * 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();
+ )
}
+
+/*
+ * Get available profiles' name list.
+ */
QStringList CpProfileModelPrivate::profileNames() const
{
- //hard code, until engine part support qt localized name
- QStringList nameList;
- nameList<<hbTrId("txt_cp_list_general")
- <<hbTrId("txt_cp_list_meeting");
+ CPFW_LOG("CpProfileModelPrivate::profileNames(), START.");
+ 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;
}
/*
- * Activate a profile with its id, return the operation code.
+ * Activate a profile with its id, return the result.
*/
int CpProfileModelPrivate::activateProfile(int profileId)
{
CPFW_LOG("CpProfileModelPrivate::activateProfile(), START.");
-
+ // currently, only two profile remains: general and meeting,
+ // But profile engine also support the old profile like:
+ // silence, out ...
+ // so filter the invalid profile id first.
+ if (!isValidProfile(profileId)) {
+ return KErrNotFound;
+ }
TRAPD( err,
mEngine->SetActiveProfileL( profileId );
- //UpdateProfileSettingsL( profileId );
);
CPFW_LOG("CpProfileModelPrivate::activateProfile(), END.");
return err;
@@ -182,540 +186,534 @@
return mEngine->ActiveProfileId();
}
+/*
+ * Return all profile settings according to profile's id
+ */
void CpProfileModelPrivate::profileSettings(int profileId,
CpProfileSettings& profileSettings)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- const MProfileTones &setTones = profileExtend->ProfileTones();
- const TProfileToneSettings &toneSettings = setTones.ToneSettings();
- const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2();
- const MProfileVibraSettings &vibraSettings =
- profileExtend->ProfileVibraSettings();
- const MProfileExtraSettings &extraSettings =
- profileExtend->ProfileExtraSettings();
- const MProfileFeedbackSettings &feedbackSettings =
- extraSettings.ProfileFeedbackSettings();
-
- profileSettings.mRingTone = stringFromDescriptor(setTones.RingingTone1());
- profileSettings.mMessageTone = stringFromDescriptor(setTones.MessageAlertTone());
- profileSettings.mEmailTone = stringFromDescriptor(extTones.EmailAlertTone());
- profileSettings.mReminderTone = stringFromDescriptor(extTones.ReminderTone());
- profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones;
- // only use Keypad Volume as a base value for display in key & touch screen setting option
- profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume;
-
- profileSettings.mRingAlertVibra = vibraSettings.RingAlertVibra();
- profileSettings.mMessageVibra = vibraSettings.MessageAlertVibra();
- profileSettings.mEmailVibra = vibraSettings.EmailAlertVibra();
- profileSettings.mReminderAlertVibra = vibraSettings.ReminderAlarmVibra();
- profileSettings.mNotificationVibra = vibraSettings.InformationVibra();
- profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback();
-
+ if (!isValidProfile(profileId)) {
+ return;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ const MProfileTones &setTones = profileExtend->ProfileTones();
+ const TProfileToneSettings &toneSettings = setTones.ToneSettings();
+ const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2();
+ const MProfileVibraSettings &vibraSettings =
+ profileExtend->ProfileVibraSettings();
+ const MProfileExtraSettings &extraSettings =
+ profileExtend->ProfileExtraSettings();
+ const MProfileFeedbackSettings &feedbackSettings =
+ extraSettings.ProfileFeedbackSettings();
+
+ profileSettings.mRingTone = XQConversions::s60DescToQString(setTones.RingingTone1());
+ profileSettings.mMessageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone());
+ profileSettings.mEmailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone());
+ profileSettings.mReminderTone = XQConversions::s60DescToQString(extTones.ReminderTone());
+ profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones;
+
+ // only use Keypad Volume as a base value for display in key & touch screen setting option
+ profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume;
+ profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback();
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ );
}
-/*!
- set profile settings
- \param profileId identify the profile
- \param profileSettings value of profile options
+/*
+ * set profile settings
*/
-int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings)
+void CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetTones &setTones = profileExtend->ProfileSetTones();
- TProfileToneSettings &toneSettings = setTones.SetToneSettings();
- MProfileSetExtraTones2 &setExtTones =
- profileExtend->ProfileSetExtraTones2();
- MProfileSetVibraSettings &setVibraSettings =
- profileExtend->ProfileSetVibraSettings();
- MProfileSetExtraSettings &extraSettings =
- profileExtend->ProfileSetExtraSettings();
- MProfileSetFeedbackSettings &setFeedbackSettings =
- extraSettings.ProfileSetFeedbackSettings();
+ if (!isValidProfile(profileId)) {
+ return;
+ }
- TRAP_IGNORE(
- setTones.SetRingingTone1L(*descriptorFromString(
- profileSettings.mRingTone));
- setTones.SetMessageAlertToneL(*descriptorFromString(
- profileSettings.mMessageTone));
- setExtTones.SetEmailAlertToneL(*descriptorFromString(
- profileSettings.mEmailTone));
- setExtTones.SetReminderToneL(*descriptorFromString(
- profileSettings.mReminderTone));
- )
- toneSettings.iWarningAndGameTones
- = profileSettings.mNotificationTone;
- // Change the keypad volume and touch screen tone together
- toneSettings.iKeypadVolume
- = static_cast<TProfileKeypadVolume> (profileSettings.mKeyTouchScreenTone);
- setFeedbackSettings.SetAudioFeedback(
- static_cast<TProfileAudioFeedback> (profileSettings.mKeyTouchScreenTone));
-
- setVibraSettings.SetRingAlertVibra(profileSettings.mRingAlertVibra);
- setVibraSettings.SetMessageAlertVibra(profileSettings.mMessageVibra);
- setVibraSettings.SetEmailAlertVibra(profileSettings.mEmailVibra);
- setVibraSettings.SetReminderAlarmVibra(
- profileSettings.mReminderAlertVibra);
- setVibraSettings.SetInformationVibra(
- profileSettings.mNotificationVibra);
- setFeedbackSettings.SetTactileFeedback(
- static_cast<TProfileTactileFeedback> (profileSettings.mKeyTouchScreenVibra));
+ QT_TRAP_THROWING (
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ MProfileSetTones &setTones = profileExtend->ProfileSetTones();
+ TProfileToneSettings &toneSettings = setTones.SetToneSettings();
+ MProfileSetExtraTones2 &setExtTones =
+ profileExtend->ProfileSetExtraTones2();
+ MProfileSetVibraSettings &setVibraSettings =
+ profileExtend->ProfileSetVibraSettings();
+ MProfileSetExtraSettings &extraSettings =
+ profileExtend->ProfileSetExtraSettings();
+ MProfileSetFeedbackSettings &setFeedbackSettings =
+ extraSettings.ProfileSetFeedbackSettings();
+
+
+ setTones.SetRingingTone1L(*XQConversions::qStringToS60Desc(
+ profileSettings.mRingTone));
+ setTones.SetMessageAlertToneL(*XQConversions::qStringToS60Desc(
+ profileSettings.mMessageTone));
+ setExtTones.SetEmailAlertToneL(*XQConversions::qStringToS60Desc(
+ profileSettings.mEmailTone));
+ setExtTones.SetReminderToneL(*XQConversions::qStringToS60Desc(
+ profileSettings.mReminderTone));
- TRAPD(err,
- mEngine->CommitChangeL(*profileExtend);
+ toneSettings.iWarningAndGameTones
+ = profileSettings.mNotificationTone;
+ // Change the keypad volume and touch screen tone together
+ toneSettings.iKeypadVolume
+ = static_cast<TProfileKeypadVolume> (profileSettings.mKeyTouchScreenTone);
+ setFeedbackSettings.SetAudioFeedback(
+ static_cast<TProfileAudioFeedback> (profileSettings.mKeyTouchScreenTone));
+ setFeedbackSettings.SetTactileFeedback(
+ static_cast<TProfileTactileFeedback> (profileSettings.mKeyTouchScreenVibra));
+
+ mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
)
- return err;
}
+/*
+ * Get the active profile's ring tone name
+ */
QString CpProfileModelPrivate::ringTone() const
{
- MProfileExtended2 *profileExtend = mProfileList.value(EProfileWrapperGeneralId);
- QString ringTone = stringFromDescriptor(
- profileExtend->ProfileTones().RingingTone1());
+ // return empty string when active profile id is invalid,
+ // some old application still set the profile which is not available now,
+ // this check can be removed when every application use a correct profile id
+
+ QString ringTone;
+ if (!isValidProfile(activeProfileId())) {
+ return ringTone;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(activeProfileId());
+ CleanupStack::PushL(profileExtend);
+ const MProfileTones &setTones = profileExtend->ProfileTones();
+
+ ringTone = XQConversions::s60DescToQString(setTones.RingingTone1());
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
+
return ringTone;
}
+/*
+ * Set the ring tone for all profiles
+ */
void CpProfileModelPrivate::setRingTone(const QString& filePath)
-{
- int ids[] = {EProfileWrapperGeneralId,EProfileWrapperMeetingId};
-
- for (TInt i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i) {
- MProfileExtended2 *profileExtend = mProfileList.value(ids[i]);
-
- MProfileSetTones &setTones = profileExtend->ProfileSetTones();
- TRAP_IGNORE(
- setTones.SetRingingTone1L( *descriptorFromString(filePath) );
- mEngine ->CommitChangeL(*profileExtend);
- )
- // ERROR SHOULD BE DEAL HERE OR RETURN A ERROR CODE
+{
+ for (TInt i = 0; i < mProfileList.count(); ++i) {
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(mProfileList.at(i));
+ CleanupStack::PushL(profileExtend);
+
+ MProfileSetTones &setTones = profileExtend->ProfileSetTones();
+
+ setTones.SetRingingTone1L( *XQConversions::qStringToS60Desc(filePath) );
+ mEngine ->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
}
}
+/*
+ * Get the ringing volume value
+ */
int CpProfileModelPrivate::masterVolume() const
{
int masterVolume = 0;
- TRAP_IGNORE(masterVolume = mEngine->MasterVolumeL();)
+ QT_TRAP_THROWING(masterVolume = mEngine->MasterVolumeL();)
return masterVolume;
}
+/*
+ * Set the ringing volume
+ */
void CpProfileModelPrivate::setMasterVolume(int volume)
{
- TRAP_IGNORE(mEngine->SetMasterVolumeL( volume );)
+ // the volume range 1-10
+ if (volume >= EProfileRingingVolumeLevel1 && volume <= EProfileRingingVolumeLevel10) {
+ QT_TRAP_THROWING(mEngine->SetMasterVolumeL( volume );)
+ }
}
-
+/*
+ * Get the master vibra's status
+ */
bool CpProfileModelPrivate::masterVibra() const
{
bool masterVibra = false;
- TRAP_IGNORE(masterVibra = mEngine->MasterVibraL();)
+ QT_TRAP_THROWING(masterVibra = mEngine->MasterVibraL();)
return masterVibra;
}
+
+/*
+ * Set master vibra's status
+ */
void CpProfileModelPrivate::setMasterVibra(bool isVibra)
{
- TRAP_IGNORE(mEngine->SetMasterVibraL( isVibra );)
+ QT_TRAP_THROWING(mEngine->SetMasterVibraL( isVibra );)
}
+/*
+ * Get the status of silence mode.
+ */
bool CpProfileModelPrivate::silenceMode() const
{
bool isSlience = false;
- TRAP_IGNORE(isSlience = mEngine->SilenceModeL();)
+ QT_TRAP_THROWING(isSlience = mEngine->SilenceModeL();)
return isSlience;
}
+
+/*
+ * Set the status of silence mode
+ */
void CpProfileModelPrivate::setSilenceMode(bool isSilence)
{
- TRAP_IGNORE(mEngine->SetSilenceModeL( isSilence );)
+ QT_TRAP_THROWING(mEngine->SetSilenceModeL( isSilence );)
}
-bool CpProfileModelPrivate::offLineMode() const
-{
- int offLineMode = 0;
- // What we should do if we can't set offline mode
- mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode );
-
- return offLineMode;
-}
-void CpProfileModelPrivate::setOffLineMode(bool isOffLine)
-{
- mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine);
-}
-
+/*
+ * Return the ring tone of a profile, if the profile id is invalid, always
+ * return an empty string
+ */
QString CpProfileModelPrivate::ringTone(int profileId) const
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- const MProfileTones &setTones = profileExtend->ProfileTones();
-
- QString ringTone = stringFromDescriptor(setTones.RingingTone1());
+ QString ringTone;
+ if(!isValidProfile(profileId)) {
+ return ringTone;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ const MProfileTones &setTones = profileExtend->ProfileTones();
+
+ ringTone = XQConversions::s60DescToQString(setTones.RingingTone1());
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
return ringTone;
}
+/*
+ * Set the ring tone for a profile, if the profile id is invalid, nothing happens
+ */
void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetTones &setTones = profileExtend->ProfileSetTones();
- TRAP_IGNORE(
- setTones.SetRingingTone1L(*descriptorFromString(filePath));
- mEngine->CommitChangeL(*profileExtend);
- )
+ if(!isValidProfile(profileId)) {
+ return;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ MProfileSetTones &setTones = profileExtend->ProfileSetTones();
+
+ setTones.SetRingingTone1L(*XQConversions::qStringToS60Desc(filePath));
+ mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
}
+/*
+ * Get the message tone of a profile, if the profile id is invalid, always return
+ * an empty string
+ */
QString CpProfileModelPrivate::messageTone(int profileId) const
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
+ QString messageTone;
+ if(!isValidProfile(profileId)) {
+ return messageTone;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ const MProfileTones &setTones = profileExtend->ProfileTones();
+
+ messageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone());
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
- const MProfileTones &setTones = profileExtend->ProfileTones();
-
- QString messageTone = stringFromDescriptor(setTones.MessageAlertTone());
-
return messageTone;
}
+/*
+ * Set the message tone of a profile, if the profile id is invalid, nothing happens
+ */
void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetTones &setTones =
+ if(!isValidProfile(profileId)) {
+ return;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ MProfileSetTones &setTones =
profileExtend->ProfileSetTones();
- TRAP_IGNORE(
- setTones.SetMessageAlertToneL(*descriptorFromString(filePath));
+ setTones.SetMessageAlertToneL(*XQConversions::qStringToS60Desc(filePath));
mEngine->CommitChangeL(*profileExtend);
- )
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
}
+/*
+ * Get the email tone of a profile, if profile id is invalid, return an empty string
+ */
QString CpProfileModelPrivate::emailTone(int profileId) const
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- const MProfileExtraTones2 &extTones =
- profileExtend->ProfileExtraTones2();
+ QString emailTone;
+
+ if(!isValidProfile(profileId)) {
+ return emailTone;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ const MProfileExtraTones2 &extTones =
+ profileExtend->ProfileExtraTones2();
- QString emailTone = stringFromDescriptor(extTones.EmailAlertTone());
- return emailTone;
+ emailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone());
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
+ return emailTone;
}
+/*
+ * Set the email tone for a profile, if the profile id is invalid, nothing happens
+ */
void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetExtraTones2 &setExtTones =
- profileExtend->ProfileSetExtraTones2();
- TRAP_IGNORE (
- setExtTones.SetEmailAlertToneL(*descriptorFromString(filePath));
+ if(!isValidProfile(profileId)) {
+ return ;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ MProfileSetExtraTones2 &setExtTones =
+ profileExtend->ProfileSetExtraTones2();
+ setExtTones.SetEmailAlertToneL(*XQConversions::qStringToS60Desc(filePath));
mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
)
}
+/*
+ * Get a reminder tone for a profile, if the profile id is invalid,
+ * always return an emtpy string
+ */
QString CpProfileModelPrivate::reminderTone(int profileId) const
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2();
-
- QString reminderTone = stringFromDescriptor(extTones.ReminderTone());
+ QString reminderTone;
+ if(!isValidProfile(profileId)) {
+ return reminderTone;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2();
+
+ reminderTone = XQConversions::s60DescToQString(extTones.ReminderTone());
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
return reminderTone;
}
+/*
+ * Set a reminder tone for a profile, if the profile id is invalid,
+ * nothing happens
+ */
void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2();
-
- TRAP_IGNORE(
- setExtTones.SetReminderToneL( *descriptorFromString(filePath) );
- mEngine->CommitChangeL(*profileExtend);
+ if(!isValidProfile(profileId)) {
+ return;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2();
+ setExtTones.SetReminderToneL( *XQConversions::qStringToS60Desc(filePath) );
+ mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
)
}
+/*
+ * Get the status of notification tone, if the profile id is invalid,
+ * always return false
+ */
bool CpProfileModelPrivate::notificationTone(int profileId) const
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- const MProfileTones &setTones = profileExtend->ProfileTones();
- const TProfileToneSettings &toneSettings = setTones.ToneSettings();
-
- bool notificationTone = toneSettings.iWarningAndGameTones;
- return notificationTone;
+ bool ret = false;
+ if(!isValidProfile(profileId)) {
+ return false;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+
+ const MProfileTones &setTones = profileExtend->ProfileTones();
+ const TProfileToneSettings &toneSettings = setTones.ToneSettings();
+ ret = toneSettings.iWarningAndGameTones;
+
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
+ return ret;
}
+/*
+ * Set the status of notification tone, if the profile id is
+ * invalid, nothing happens
+ */
void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive)
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetTones &setTones = profileExtend->ProfileSetTones();
- TProfileToneSettings &toneSettings = setTones.SetToneSettings();
+ if(!isValidProfile(profileId)) {
+ return ;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ MProfileSetTones &setTones = profileExtend->ProfileSetTones();
+ TProfileToneSettings &toneSettings = setTones.SetToneSettings();
- toneSettings.iWarningAndGameTones = isActive;
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
+ toneSettings.iWarningAndGameTones = isActive;
+
+ mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
}
-/*!
- return key & touch screen tone's value
- \sa setKeyTouchScreenTone
+/*
+ * Get key & touch screen tone's value, if the profile id
+ * is invalid, always return 0
*/
int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const
{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
+ int level = 0;
+ if(!isValidProfile(profileId)) {
+ return level;
+ }
- const MProfileTones &setTones = profileExtend->ProfileTones();
- const TProfileToneSettings &toneSettings = setTones.ToneSettings();
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
- int keyTouchScreenTone = toneSettings.iKeypadVolume;
- return keyTouchScreenTone;
+ const MProfileTones &setTones = profileExtend->ProfileTones();
+ const TProfileToneSettings &toneSettings = setTones.ToneSettings();
+
+ // Return only keypad volume, but touch tone volume will be synchronized in
+ // SetKeyTouchScreenTone(), these two settings also have the same default value
+ // in cenrep key
+ level = toneSettings.iKeypadVolume;
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
+ return level;
}
-/*!
- set key & touch screen tone
- \param profileId identify the profile
- \param level 0-5
- \sa keyTouchScreenTone
+/*
+ * set key & touch screen tone, if the profile id
+ * is invalid, nothing happens
*/
void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level)
-{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetTones &setTones =
- profileExtend->ProfileSetTones();
- TProfileToneSettings &toneSettings =
- setTones.SetToneSettings();
+{
+ if(!isValidProfile(profileId)) {
+ return ;
+ }
+ QT_TRAP_THROWING(
- MProfileSetExtraSettings &extraSettings =
- profileExtend->ProfileSetExtraSettings();
- MProfileSetFeedbackSettings &setFeedbackSettings =
- extraSettings.ProfileSetFeedbackSettings();
-
- toneSettings.iKeypadVolume
- = static_cast<TProfileKeypadVolume> (level);
-
- setFeedbackSettings.SetAudioFeedback(
- static_cast<TProfileAudioFeedback> (level));
- TRAP_IGNORE (
- mEngine->CommitChangeL(*profileExtend);
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ MProfileSetTones &setTones =
+ profileExtend->ProfileSetTones();
+ TProfileToneSettings &toneSettings =
+ setTones.SetToneSettings();
+
+ MProfileSetExtraSettings &extraSettings =
+ profileExtend->ProfileSetExtraSettings();
+ MProfileSetFeedbackSettings &setFeedbackSettings =
+ extraSettings.ProfileSetFeedbackSettings();
+
+ // Update the key pad volume and touch tone volume together
+ toneSettings.iKeypadVolume
+ = static_cast<TProfileKeypadVolume> (level);
+
+ setFeedbackSettings.SetAudioFeedback(
+ static_cast<TProfileAudioFeedback> (level));
+
+ mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
)
}
-bool CpProfileModelPrivate::ringAlertVibra(int profileId) const
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD(err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err != KErrNone) {
- return false;
- }
- CleanupReleasePushL(*profileExtend);
- const MProfileVibraSettings &vibraSettings =
- profileExtend->ProfileVibraSettings();
-
-
- bool ringAlertVibra = vibraSettings.RingAlertVibra();
- CleanupStack::PopAndDestroy(profileExtend);
- return ringAlertVibra;
-
-}
-
-void CpProfileModelPrivate::setRingAlertVibra(int profileId, bool isActive)
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD( err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err==KErrNone) {
- CleanupReleasePushL(*profileExtend);
- MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings();
-
- setVibraSettings.SetRingAlertVibra(isActive);
-
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
- CleanupStack::PopAndDestroy(profileExtend);
- }
-}
-
-bool CpProfileModelPrivate::messageVibra(int profileId) const
+/*
+ * Get key touch screen vibra's value of a profile, return 0 if the
+ * profile id is invalid
+ */
+int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const
{
- MProfileExtended2 *profileExtend = 0;
- TRAPD(err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err != KErrNone) {
- return false;
- }
- CleanupReleasePushL(*profileExtend);
- const MProfileVibraSettings &vibraSettings =
- profileExtend->ProfileVibraSettings();
-
-
- bool messageVibra = vibraSettings.MessageAlertVibra();
- CleanupStack::PopAndDestroy(profileExtend);
- return messageVibra;
-
-}
+ int level = 0;
+ if(!isValidProfile(profileId)) {
+ return level;
+ }
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
+ const MProfileExtraSettings &extraSettings =
+ profileExtend->ProfileExtraSettings();
+ const MProfileFeedbackSettings &feedbackSettings =
+ extraSettings.ProfileFeedbackSettings();
+ level = feedbackSettings.TactileFeedback();
-void CpProfileModelPrivate::setMessageVibra(int profileId, bool isActive)
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD( err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err==KErrNone) {
- CleanupReleasePushL(*profileExtend);
- MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings();
-
- setVibraSettings.SetMessageAlertVibra(isActive);
-
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
- CleanupStack::PopAndDestroy(profileExtend);
- }
-}
-
-bool CpProfileModelPrivate::emailVibra(int profileId) const
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD(err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err != KErrNone) {
- return false;
- }
- CleanupReleasePushL(*profileExtend);
- const MProfileVibraSettings &vibraSettings =
- profileExtend->ProfileVibraSettings();
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
-
- bool emailVibra = vibraSettings.EmailAlertVibra();
-
- CleanupStack::PopAndDestroy(profileExtend);
- return emailVibra;
-
+ return level;
}
-void CpProfileModelPrivate::setEmailVibra(int profileId, bool isActive)
+/*
+ * Set key & touch screen vibra for a profile,
+ * if the profile id is invalid, nothing happens
+ */
+void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level)
{
- MProfileExtended2 *profileExtend = 0;
- TRAPD( err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err==KErrNone) {
- CleanupReleasePushL(*profileExtend);
- MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings();
-
- setVibraSettings.SetEmailAlertVibra ( isActive );
-
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
- CleanupStack::PopAndDestroy(profileExtend);
- }
-}
-
-bool CpProfileModelPrivate::reminderVibra(int profileId) const
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD(err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err != KErrNone) {
- return false;
+ if(!isValidProfile(profileId)) {
+ return ;
}
- CleanupReleasePushL(*profileExtend);
- const MProfileVibraSettings &vibraSettings =
- profileExtend->ProfileVibraSettings();
-
-
- bool reminderAlarmVibra = vibraSettings.ReminderAlarmVibra();
-
- CleanupStack::PopAndDestroy(profileExtend);
- return reminderAlarmVibra;
-
-}
+ QT_TRAP_THROWING(
+ MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId);
+ CleanupStack::PushL(profileExtend);
-void CpProfileModelPrivate::setReminderVibra(int profileId, bool isActive)
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD( err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err==KErrNone) {
- CleanupReleasePushL(*profileExtend);
- MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings();
-
- setVibraSettings.SetReminderAlarmVibra ( isActive );
-
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
- CleanupStack::PopAndDestroy(profileExtend);
- }
+ MProfileSetExtraSettings &extraSettings =
+ profileExtend->ProfileSetExtraSettings();
+ MProfileSetFeedbackSettings &setFeedbackSettings =
+ extraSettings.ProfileSetFeedbackSettings();
+ setFeedbackSettings.SetTactileFeedback(
+ static_cast<TProfileTactileFeedback> (level));
+ mEngine->CommitChangeL(*profileExtend);
+ CleanupStack::Pop(); // profileExtend
+ profileExtend->Release();
+ )
}
-bool CpProfileModelPrivate::notificationVibra(int profileId) const
-{
- MProfileExtended2 *profileExtend = 0;
- TRAPD(err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err != KErrNone) {
- return false;
- }
- CleanupReleasePushL(*profileExtend);
- const MProfileVibraSettings &vibraSettings =
- profileExtend->ProfileVibraSettings();
-
-
- bool notificationVibra = vibraSettings.InformationVibra();
-
- CleanupStack::PopAndDestroy(profileExtend);
- return notificationVibra;
-
-}
+/*
+ * Judge the profile is valid or not
+ */
-void CpProfileModelPrivate::setNotificationVibra(int profileId, bool isActive)
+bool CpProfileModelPrivate::isValidProfile(int profileId) const
{
- MProfileExtended2 *profileExtend = 0;
- TRAPD( err,
- profileExtend = mEngine->Profile2L(profileId);
- //CleanupReleasePushL(*profileExtend);
- )
- if (err==KErrNone) {
- CleanupReleasePushL(*profileExtend);
- MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings();
-
- setVibraSettings.SetInformationVibra( isActive );
-
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
- CleanupStack::PopAndDestroy(profileExtend);
- }
-}
-
-int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const
-{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
-
- const MProfileExtraSettings &extraSettings =
- profileExtend->ProfileExtraSettings();
- const MProfileFeedbackSettings &feedbackSettings =
- extraSettings.ProfileFeedbackSettings();
-
- int keyTouchScreenVibra = feedbackSettings.TactileFeedback();
- return keyTouchScreenVibra;
-}
-
-void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level)
-{
- MProfileExtended2 *profileExtend = mProfileList.value(profileId);
- MProfileSetExtraSettings &extraSettings =
- profileExtend->ProfileSetExtraSettings();
- MProfileSetFeedbackSettings &setFeedbackSettings =
- extraSettings.ProfileSetFeedbackSettings();
- setFeedbackSettings.SetTactileFeedback(
- static_cast<TProfileTactileFeedback> (level));
-
- TRAP_IGNORE(
- mEngine->CommitChangeL(*profileExtend);
- )
+ return mProfileList.contains(profileId);
}
// End of file
--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Wed Sep 29 10:09:58 2010 +0800
@@ -19,7 +19,7 @@
#define CPPROFILEMODEL_P_H
#include <qglobal.h>
-#include <QMap>
+#include <QList>
class CpProfileModel;
class CpProfileSettings;
class MProfileEngineExtended2;
@@ -28,8 +28,8 @@
class MProfileSetFeedbackSettings;
class CRepository;
class QStringList;
-struct TProfileToneSettings;
-
+class MProfilesNamesArray;
+struct TProfileToneSettings;
class CpProfileModelPrivate
{
Q_DECLARE_PUBLIC(CpProfileModel)
@@ -38,17 +38,14 @@
~CpProfileModelPrivate();
void initialize(CpProfileModel *parent);
public:
- int initiationFlag();
- QString profileName(int profileId)const;
+ 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);
- int setProfileSettings(int profileId, CpProfileSettings& profileSettings);
+ void setProfileSettings(int profileId, CpProfileSettings& profileSettings);
- /*!
- * set ring tone in personalization group in control panel's homeview
- */
QString ringTone() const;
void setRingTone(const QString& filePath);
@@ -61,9 +58,6 @@
bool silenceMode() const;
void setSilenceMode(bool isSlience);
- bool offLineMode() const;
- void setOffLineMode(bool isOffLine);
-
QString ringTone(int profileId)const;
void setRingTone(int profileId, const QString& filePath);
QString messageTone(int profileId) const;
@@ -79,66 +73,21 @@
int keyTouchScreenTone(int profileId) const;
void setKeyTouchScreenTone(int profileId, int level);
- bool ringAlertVibra(int profileId) const;
- void setRingAlertVibra(int profileId, bool isActive);
-
- bool messageVibra(int profileId) const;
- void setMessageVibra(int profileId, bool isActive);
-
- bool emailVibra(int profileId) const;
- void setEmailVibra(int profileId, bool isActive);
-
- bool reminderVibra(int profileId) const;
- void setReminderVibra(int profileId, bool isActive) ;
-
- bool notificationVibra(int profileId) const;
- void setNotificationVibra(int profileId, bool isActive);
-
int keyTouchScreenVibra(int profileId)const;
void setKeyTouchScreenVibra(int profileId, int level);
- /* int setEditingProfile(int profileId);
- QString ringTone();
- int setRingTone(const QString& filePath);
- QString messageTone();
- int setMessageTone(const QString& filePath);
- QString emailTone();
- int setEmailTone(const QString& filePath);
- QString calendarTone();
- void setCalendarTone(const QString& filePath);
- QString alarmTone();
- void setAlarmTone(const QString& filePath);
- int ringVolume();
- void setRingVolume(int volume);
- void activateBeep();
- bool isBeep();
- void activateSilent();
- bool isSilent();
- bool vibraStatus();
- void setVibraStatus(bool status);
- int keyVolume();
- void setKeyVolume(int volume);
- int screenVolume();
- void setScreenVolume(int volume);
- int screenVibra();
- void setScreenVibra(int volume);
- */
-#ifdef Q_OS_SYMBIAN
-private:
- //void UpdateProfileSettingsL(int profileId);
- //int commitChange();
private:
+ bool isValidProfile(int profileId) const;
+
+private:
+#ifdef Q_OS_SYMBIAN
MProfileEngineExtended2 *mEngine;
- QMap<int, MProfileExtended2*> mProfileList;
- //MProfileExtended2 *mProfileExt;
- //TProfileToneSettings *mToneSettings;
- //const MProfileFeedbackSettings *mFeedbackSettings;
- //MProfileSetFeedbackSettings *mSetFeedbackSettings;
- //CRepository *mVibraCenRep;
- int mInitErrFlag;
- CRepository *mOffLineCenRep;
+ // Valid profile id list
+ QList<int> mProfileList;
+ MProfilesNamesArray *mProfileNames;
+
+#endif // Q_OS_SYMBIAN
CpProfileModel *q_ptr;
-#endif // Q_OS_SYMBIAN
};
#endif
--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,48 @@
+/*
+ * 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 "cpprofilemonitor.h"
+#include "cpprofilemonitor_p.h"
+
+/*!
+ \class CpProfileMonitor
+ \brief This class will observe the profile change or modification, and emit related signals.
+ */
+/*!
+ \fn void profileActivated(int activeProfileId)
+ This signal will emmit when a new profile activated
+ */
+/*!
+ \fn void activeProfileModified(int activeProfileId)
+ This signal will emmit when active profile's settings are modified
+ */
+/*!
+ Constructor
+ */
+CpProfileMonitor::CpProfileMonitor(QObject *parent)
+ :QObject(parent),d_ptr(new CpProfileMonitorPrivate())
+{
+ d_ptr->initialize(this);
+}
+
+/*!
+ Descontructor
+ */
+CpProfileMonitor::~CpProfileMonitor()
+{
+ delete d_ptr;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,68 @@
+/*
+ * 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 "cpprofilemonitor_p.h"
+#include "cpprofilemonitor.h"
+
+#include <CProfileChangeNotifyHandler.h>
+
+/*
+ * Construtor
+ */
+CpProfileMonitorPrivate::CpProfileMonitorPrivate():
+ mProfileNotifier(0)
+{
+
+}
+
+/*
+ * Desconstructor
+ */
+CpProfileMonitorPrivate::~CpProfileMonitorPrivate()
+{
+ delete mProfileNotifier;
+}
+
+/*
+ * Initializing for the monitoring profile event
+ */
+void CpProfileMonitorPrivate::initialize(CpProfileMonitor *parent)
+{
+ q_ptr = parent;
+ TRAP_IGNORE(mProfileNotifier = CProfileChangeNotifyHandler::NewL(this));
+}
+
+/*
+ * From MProfileChangeObserver, monitor the profile event
+ */
+void CpProfileMonitorPrivate::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId)
+{
+ switch (aProfileEvent) {
+ case EProfileNewActiveProfile:
+ {
+ q_ptr->profileActivated(aProfileId);
+ break;
+ }
+ case EProfileActiveProfileModified:
+ {
+ q_ptr->activeProfileModified(aProfileId);
+ break;
+ }
+ default:
+ break;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,44 @@
+/*
+ * 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 CPPROFILEMONITORPRIVATE_H
+#define CPPROFILEMONITORPRIVATE_H
+
+#include <MProfileChangeObserver.h>
+#include <qglobal.h>
+
+class CProfileChangeNotifyHandler;
+class CpProfileMonitor;
+
+class CpProfileMonitorPrivate:public MProfileChangeObserver
+{
+ Q_DECLARE_PUBLIC(CpProfileMonitor)
+public:
+ CpProfileMonitorPrivate();
+ ~CpProfileMonitorPrivate();
+ void initialize(CpProfileMonitor *parent);
+
+#ifdef Q_OS_SYMBIAN
+private:
+ void HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId);
+private:
+ CProfileChangeNotifyHandler *mProfileNotifier;
+#endif
+private:
+ CpProfileMonitor *q_ptr;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/tsrc/unit_common.pri Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,40 @@
+#
+# 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:
+#
+
+QT += testlib
+CONFIG += hb qtestlib
+
+unix {
+ test.commands = /epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe
+ autotest.commands = /epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe -xml -o c:/$${TARGET}.xml
+} else:win32 {
+ test.CONFIG += recursive
+ autotest.CONFIG += recursive
+ build_pass {
+ test.commands =/epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe
+ autotest.commands =/epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe -xml -o c:/$${TARGET}.xml
+ }
+}
+QMAKE_EXTRA_TARGETS += test autotest
+
+symbian {
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger)
+ TARGET.CAPABILITY = ALL -TCB
+}
+
+
+
Binary file controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound.aac has changed
Binary file controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound2.aac has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/runtest.bat Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+\epoc32\RELEASE\WINSCW\udeb\ut_cprofilemodel.exe -xml -o c:\ut_cprofilemodel.xml
+copy \epoc32\winscw\c\ut_cprofilemodel.xml
+del \epoc32\winscw\c\ut_cprofilemodel.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,1305 @@
+/* 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:
+* test the functions in cpprofilemodel class
+*/
+
+#include "ut_cpprofilemodel.h"
+
+
+#include <QtTest/QtTest>
+
+#include <QtCore/QStringList>
+#include <cpprofilemodel.h>
+#include <hbpushbutton.h>
+#include <hbtranslator.h>
+#include <profile.hrh>
+
+/*!
+ \class TestCpProfileModel \n
+ \brief describe the test case's goal, like: \n
+ class name: cpprofilemodel \n
+ class's description: \n
+ type of test case: unit test\n
+ test cases' number totally: \n
+ */
+
+void TestCpProfileModel::initTestCase()
+{
+ //translate the hbTrId text in control panel.
+ HbTranslator translator("control_panel");
+ translator.loadCommon();
+ ringTonePath1 = QString("C:") + QDir::separator() + QString("resource") + QDir::separator() + QString("cptestdata") + QDir::separator() + QString("sounds") + QDir::separator() + QString("testsound.aac");
+ ringTonePath2 = QString("C:") + QDir::separator() + QString("resource") + QDir::separator() + QString("cptestdata") + QDir::separator() + QString("sounds") + QDir::separator() + QString("testsound2.aac");
+}
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: CpProfileModel(QObject *parent = 0); \n
+ 2. Case Descrition: verify the constructor can work correctly. \n
+ 3. Input Parameters: \n
+ <1> parent = 0; \n
+ <2> parent = new QObject(); \n
+ 4. Expected result: \n
+ no crash \n
+ */
+void TestCpProfileModel::testConstructor()
+{
+ QObject *pObject = new QObject();
+
+ //test constructor without parent.
+ CpProfileModel *profileModel = new CpProfileModel(0);
+ QVERIFY( profileModel != 0 );
+ delete profileModel;
+ profileModel = 0;
+ // test constructor with parent.
+ profileModel = new CpProfileModel(pObject);
+ QVERIFY( profileModel != 0 );
+
+ delete pObject;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString profileName(int profileId)const; \n
+ 2. Case Descrition: verify that it can return the corresponding profile name when using valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId,\n
+ <2> profileId = EProfileWrapperMeetingId,\n
+ 4. Expected result: \n \n
+ <1> return QString( "General" ) \n
+ <2> return QString( "Meeting" ) \n
+ */
+/*void TestCpProfileModel::testProfileNameWithValidProfileID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QString profileName1 = profileModel->profileName(EProfileWrapperGeneralId);
+ QVERIFY( profileName1 == QString( "General" ) );
+
+ QString profileName2 = profileModel->profileName(EProfileWrapperMeetingId);
+ QVERIFY( profileName2 == QString("Meeting") );
+
+ delete profileModel;
+}*/
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString profileName(int profileId)const; \n
+ 2. Case Descrition: verify that it doesn't crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -80, \n
+ <3> profileId = 888, \n
+ 4. Expected result: \n \n
+ <1> return QString() \n
+ <2> return QString() \n
+ <3> return QString() \n
+ <4> return QString() \n
+ */
+void TestCpProfileModel::testProfileNameWithInvalidProfileID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QString profileName1 = profileModel->profileName(EProfileWapperStart);
+ QVERIFY( profileName1 == QString() );
+
+ QString profileName2 = profileModel->profileName(EPRofileWrapperEnd);
+ QVERIFY( profileName2 == QString() );
+
+ QString profileName3 = profileModel->profileName( -80 );
+ QVERIFY( profileName3 == QString() );
+
+ QString profileName4 = profileModel->profileName( 888 );
+ QVERIFY( profileName4 == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QStringList profileNames()const; \n
+ 2. Case Descrition: Verify that the profile name list can be get correctly with this function \n
+ 3. Input Parameters: \n
+ none \n
+ 4. Expected result: \n
+ \n
+ */
+/*void TestCpProfileModel::testProfileNames()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QStringList profilesNames = profileModel->profileNames();
+
+ // Verify the right profile names are returned.
+ QVERIFY ( profilesNames.count() == 2 );
+ QVERIFY( profilesNames.contains("General", Qt::CaseInsensitive));
+ QVERIFY( profilesNames.contains("Meeting", Qt::CaseInsensitive));
+
+ delete profileModel;
+}*/
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int activateProfile(int profileId); \n
+ 2. Case Descrition: Verify that the profile cannot be actived with the invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -6 \n
+ <4> profileId = 356 \n
+ 4. Expected result: \n
+ <1> return KErrNotFound \n
+ <2> return KErrNotFound \n
+ <3> return KErrNotFound \n
+ <4> return KErrNotFound \n
+ */
+void TestCpProfileModel::testActivateProfileWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ int retErr1 = profileModel->activateProfile(EProfileWapperStart);
+ QVERIFY( retErr1 == KErrNotFound );
+
+ int retErr2 = profileModel->activateProfile(EPRofileWrapperEnd);
+ QVERIFY( retErr2 == KErrNotFound );
+
+ int retErr3 = profileModel->activateProfile( -6 );
+ QVERIFY( retErr3 == KErrNotFound );
+
+ int retErr4 = profileModel->activateProfile( 356 );
+ QVERIFY( retErr4 == KErrNotFound );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int activateProfile(int profileId); \n
+ 2. Case Descrition: Verify that the profile can be actived with the valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId,\n
+ <2> profileId = EProfileWrapperMeetingId,\n
+ 4. Expected result: \n
+ <1> the current active profile ID is EProfileWrapperGeneralId \n
+ <2> the current active profile ID is EProfileWrapperMeetingId \n
+ */
+void TestCpProfileModel::testActivateProfileWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->activateProfile(EProfileWrapperGeneralId);
+ QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId );
+
+ profileModel->activateProfile(EProfileWrapperMeetingId);
+ QVERIFY( profileModel->activeProfileId() == EProfileWrapperMeetingId );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int activeProfileId() const;\n
+ 2. Case Descrition: Verify that it can return the right profile ID or Error code. \n
+ 3. Input Parameters: \n
+ <1> set an active valid profile \n
+ <2> set an active invaild profile \n
+ 4. Expected result: \n
+ <1> return the right ID \n
+ <2> no crash \n
+ */
+void TestCpProfileModel::testActiveProfileId()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->activateProfile(EProfileWrapperGeneralId);
+ QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId );
+
+ profileModel->activateProfile(-8);
+ // set profile failed, so the active profileID is still the previous ID, EProfileWrapperGeneralId.
+ QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId );
+
+ delete profileModel;
+}
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void profileSettings(int profileId, CpProfileSettings& profileSettings);\n
+ 2. Case Descrition: get profile settings,\n
+ 3. Input Parameters: \n
+ <1> profileID = EProfileWrapperGeneralId, profileSettings = CpProfileSettings; \n
+ <2> profileID = EProfileWrapperMeetingId, profileSettings = CpProfileSettings; \n
+ <3> profileID = EProfileWapperStart, profileSettings = CpProfileSettings; \n
+ <4> profileID = EPRofileWrapperEnd, profileSettings = CpProfileSettings; \n
+ <5> profileID = int, profileSettings = CpProfileSettings; \n
+ 4. Expected result: \n
+ no crash \n
+ */
+void TestCpProfileModel::testProfileSettings()
+{
+ CpProfileSettings profileSettings;
+ CpProfileModel *profileModel = new CpProfileModel();
+ profileSettings.mKeyTouchScreenVibra = 0;
+ profileSettings.mKeyTouchScreenTone = 2;
+ // test with valid profile ID.
+ profileModel->setProfileSettings( EProfileWrapperGeneralId, profileSettings );
+ profileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
+ QVERIFY( profileSettings.mKeyTouchScreenTone == 2);
+
+ profileModel->setProfileSettings( EProfileWrapperMeetingId, profileSettings );
+ profileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
+ QVERIFY( profileSettings.mKeyTouchScreenVibra == 0);
+ // test with invalid profile ID.
+ profileModel->profileSettings( EProfileWapperStart, profileSettings );
+
+ profileModel->profileSettings( EPRofileWrapperEnd, profileSettings );
+
+ profileModel->profileSettings( 98, profileSettings );
+
+ delete profileModel;
+}
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int setProfileSettings(int profileId, CpProfileSettings& profileSettings );\n
+ 2. Case Descrition: Set profile settings from center repository keys \n
+ 3. Input Parameters: \n
+ <1> profileID = EProfileWrapperGeneralId, profileSettings = CpProfileSettings; \n
+ <2> profileID = EProfileWrapperMeetingId, profileSettings = CpProfileSettings; \n
+ <3> profileID = EProfileWapperStart, profileSettings = CpProfileSettings; \n
+ <4> profileID = EPRofileWrapperEnd, profileSettings = CpProfileSettings; \n
+ <5> profileID = 98, profileSettings = CpProfileSettings; \n
+ 4. Expected result: \n
+ no crash \n
+ */
+void TestCpProfileModel::testSetProfileSettings()
+{
+ CpProfileSettings profileSettings;
+ profileSettings.mKeyTouchScreenVibra = 4;
+ profileSettings.mKeyTouchScreenTone = 3;
+ CpProfileModel *profileModel = new CpProfileModel();
+ // test with valid profile ID.
+ profileModel->setProfileSettings( EProfileWrapperGeneralId, profileSettings );
+ profileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
+ QVERIFY( profileSettings.mKeyTouchScreenTone == 3);
+
+ profileModel->setProfileSettings( EProfileWrapperMeetingId, profileSettings );
+ profileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
+ QVERIFY( profileSettings.mKeyTouchScreenVibra == 4);
+
+ // test with invalid profile ID.
+ profileModel->setProfileSettings( EProfileWapperStart, profileSettings );
+ profileModel->setProfileSettings( EPRofileWrapperEnd, profileSettings );
+ profileModel->setProfileSettings( 98, profileSettings );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString ringTone() const;\n
+ 2. Case Descrition: Verify that it return the right active ring tone path. \n
+ 3. Input Parameters: \n
+ <1> set ringtone for profiles. \n
+ <2> no ringtone is set. \n
+ 4. Expected result: \n
+ <1> return the right path \n
+ <2> return QString() \n
+ */
+void TestCpProfileModel::testRingToneOfActive()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+ // set a ringtone for profiles.
+ profileModel->setRingTone(ringTonePath1);
+ QString retRingTonePath1 = profileModel->ringTone();
+ QVERIFY( retRingTonePath1 == ringTonePath1 );
+ // no ringtone is set.
+ profileModel->setRingTone(QString());
+ QString retRingTonePath2 = profileModel->ringTone();
+ QVERIFY( retRingTonePath2 == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setRingTone(const QString& filePath);\n
+ 2. Case Descrition: Verify that it can set ring tone successfully with valid sound path. \n
+ 3. Input Parameters: \n
+ <1> soundPath = QString(), \n
+ 4. Expected result: \n
+ <1> profileModel->ringTone() == soundPath \n
+ */
+void TestCpProfileModel::testSetRingToneAllWithValidPath()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setRingTone(ringTonePath1);
+ QVERIFY( profileModel->ringTone() == ringTonePath1 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setRingTone(const QString& filePath);\n
+ 2. Case Descrition: Verify that no crash when setting ring tone with invalid sound path. \n
+ 3. Input Parameters: \n
+ <1> path = QString(), \n
+ <2> path = QString(XX), XX is an invalid path \n
+ 4. Expected result: \n
+ <1> profileModel->ringTone() == QString() \n
+ <2> profileModel->ringTone() == path \n
+ */
+void TestCpProfileModel::testSetRingToneAllWithInvalidPath()
+{
+ QString inValidPath = "Z:/InvalidSoundPath";
+ CpProfileModel *profileModel = new CpProfileModel();
+ // using empty path.
+ profileModel->setRingTone( QString() );
+ QVERIFY( profileModel->ringTone() == QString() );
+ // using an invalid path.
+ profileModel->setRingTone( QString( inValidPath ) );
+ QString retStr = profileModel->ringTone();
+ QVERIFY( profileModel->ringTone() == inValidPath );
+
+ delete profileModel;
+}
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int void setMasterVolume(int volume);\n
+ 2. Case Descrition: Verify that the valid volume can be set correctly \n
+ 3. Input Parameters: \n
+ <1> volume = int X, X = {1,2,3,4,5,6,7,8,9,10} \n
+ 4. Expected result: \n
+ <1> profileModel->masterVolume() == X. \n
+ */
+void TestCpProfileModel::testSetMasterWithValidVolume()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ for( int i = EProfileRingingVolumeLevel1; i <= EProfileRingingVolumeLevel10; i++ )
+ {
+ profileModel->setMasterVolume(i);
+ QVERIFY( profileModel->masterVolume() == i );
+ }
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int void setMasterVolume(int volume);\n
+ 2. Case Descrition: Verify that no crash when using \n
+ 3. Input Parameters: \n
+ <1> volume = -8 \n
+ <2> volume = 230 \n
+ 4. Expected result: \n
+ <1> no crash and the master volume is not changed. \n
+ <2> no crash and the master volume is not changed. \n
+ */
+void TestCpProfileModel::testSetMasterWithInvalidVolume()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+ int oldVolume = profileModel->masterVolume();
+
+ profileModel->setMasterVolume( -8 );
+ QVERIFY( profileModel->masterVolume() == oldVolume );
+
+ profileModel->setMasterVolume( 230 );
+ QVERIFY( profileModel->masterVolume() == oldVolume );
+
+ delete profileModel;
+}
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: int masterVolume() const;\n
+ 2. Case Descrition: Verify that it returns the right master volume for device. \n
+ 3. Input Parameters: \n
+ <1> setMasterVolume( EProfileRingingVolumeLevel3 ) \n
+ 4. Expected result: \n
+ <1> returnMasterVolume == EProfileRingingVolumeLevel3 \n
+ */
+void TestCpProfileModel::testMasterVolume()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+ profileModel->setMasterVolume( EProfileRingingVolumeLevel3 );
+
+ int returnMasterVolume = profileModel->masterVolume();
+ QVERIFY( returnMasterVolume == EProfileRingingVolumeLevel3 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ void setMasterVibra(bool isVibra);\n
+ 2. Case Descrition: Verify that the master vibra's status can be set successfully. \n
+ 3. Input Parameters: \n
+ <1> isVibra = true; \n
+ <2> isVibra = false; \n
+ 4. Expected result: \n
+ <1> profileModel->masterVibra() == true. \n
+ <1> profileModel->masterVibra() == false. \n
+ */
+void TestCpProfileModel::testSetMasterVibra()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setMasterVibra(true);
+ QVERIFY( profileModel->masterVibra() == true );
+
+ profileModel->setMasterVibra(false);
+ QVERIFY( profileModel->masterVibra() == false );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ bool masterVibra() const;\n
+ 2. Case Descrition: Verify that it returns the correct master vibra's status. \n
+ 3. Input Parameters: \n
+ <1> isVibra = true; \n
+ <2> isVibra = false; \n
+ 4. Expected result: \n
+ <1> profileModel->masterVibra() == true. \n
+ <1> profileModel->masterVibra() == false. \n
+ */
+void TestCpProfileModel::testMasterVibra()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setMasterVibra(true);
+ QVERIFY( profileModel->masterVibra() == true );
+
+ profileModel->setMasterVibra(false);
+ QVERIFY( profileModel->masterVibra() == false );
+
+ delete profileModel;
+}
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ void setSilenceMode(bool isSlience);\n
+ 2. Case Descrition: Verify the right slicence mode can be set. \n
+ 3. Input Parameters: \n
+ <1> isSlience = true; \n
+ <2> isSlience = false; \n
+ 4. Expected result: \n
+ <1> profileModel->silenceMode() == true. \n
+ <1> profileModel->silenceMode() == false. \n
+ */
+void TestCpProfileModel::testSetSilenceMode()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setSilenceMode(true);
+ QVERIFY( profileModel->silenceMode() == true );
+
+ profileModel->setSilenceMode(false);
+ QVERIFY( profileModel->silenceMode() == false );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ bool silenceMode() const;\n
+ void setSilenceMode(bool isSlience);\n
+ 2. Case Descrition: Verify it get the correct silence mode of device. \n
+ 3. Input Parameters: \n
+ <1> isSlience = true; \n
+ <2> isSlience = false; \n
+ 4. Expected result: \n
+ <1> profileModel->silenceMode() == true. \n
+ <1> profileModel->silenceMode() == false. \n
+ */
+void TestCpProfileModel::testSilenceMode()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setSilenceMode(true);
+ QVERIFY( profileModel->silenceMode() == true );
+
+ profileModel->setSilenceMode(false);
+ QVERIFY( profileModel->silenceMode() == false );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString ringTone(int profileId)const; \n
+ 2. Case Descrition: Verify that it can return the right ringtone when using valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, set ringtone with ringTonePath1 \n
+ <2> profileId = EProfileWrapperMeetingId, set ringtone with ringTonePath2 \n
+ 4. Expected result: \n
+ <1> profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath1 \n
+ <2> profileModel->ringTone(EProfileWrapperMeetingId) == ringTonePath2 \n
+ */
+void TestCpProfileModel::testRingToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setRingTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath1 );
+
+ profileModel->setRingTone( EProfileWrapperMeetingId, ringTonePath2 );
+ QVERIFY( profileModel->ringTone(EProfileWrapperMeetingId) == ringTonePath2 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString ringTone(int profileId)const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 100,\n
+ 4. Expected result: \n
+ <1> no crash and return QString() \n
+ <2> no crash and return QString() \n
+ <3> no crash and return QString() \n
+ <4> no crash and return QString() \n
+ */
+void TestCpProfileModel::testRingToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+ // set ring tone for all profile
+ profileModel->setRingTone(ringTonePath1);
+
+ QVERIFY( profileModel->ringTone( EProfileWapperStart ) == QString() );
+ QVERIFY( profileModel->ringTone( EPRofileWrapperEnd ) == QString() );
+ QVERIFY( profileModel->ringTone( -9 ) == QString() );
+ QVERIFY( profileModel->ringTone( 100 ) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setRingTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it can set the profile ringtone successfully with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, filePath = QString(ringTonePath) \n
+ <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n
+ 4. Expected result: \n
+ <1> profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath \n
+ <2> profileModel->ringTone(EProfileWrapperMeetingId) == QString() \n
+ */
+void TestCpProfileModel::testSetRingToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setRingTone(EProfileWrapperGeneralId, ringTonePath2);
+ QVERIFY( profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath2 );
+
+ profileModel->setRingTone(EProfileWrapperMeetingId, QString());
+ QVERIFY( profileModel->ringTone(EProfileWrapperMeetingId) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setRingTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -19,\n
+ <4> profileId = 101,\n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ <3> no crash \n
+ <4> no crash \n
+ */
+void TestCpProfileModel::testSetRingToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setRingTone(EProfileWapperStart, ringTonePath2);
+
+ profileModel->setRingTone(EPRofileWrapperEnd, ringTonePath2);
+
+ profileModel->setRingTone(-19, ringTonePath2);
+
+ profileModel->setRingTone(101, ringTonePath2);
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString messageTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it can return the right message tone when using valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n
+ <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n
+ 4. Expected result: \n
+ <1> profileModel->messageTone(EProfileWrapperGeneralId) == soundPath1 \n
+ <2> profileModel->messageTone(EProfileWrapperMeetingId) == soundPath2 \n
+ */
+void TestCpProfileModel::testMessageToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setMessageTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath1 );
+
+ profileModel->setMessageTone( EProfileWrapperMeetingId, ringTonePath2 );
+ QVERIFY( profileModel->messageTone(EProfileWrapperMeetingId) == ringTonePath2 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString messageTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 59,\n
+ 4. Expected result: \n
+ <1> no crash and return QString() \n
+ <2> no crash and return QString() \n
+ <3> no crash and return QString() \n
+ <4> no crash and return QString() \n
+ */
+void TestCpProfileModel::testMessageToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QVERIFY( profileModel->messageTone( EProfileWapperStart ) == QString() );
+ QVERIFY( profileModel->messageTone( EPRofileWrapperEnd ) == QString() );
+ QVERIFY( profileModel->messageTone( -9 ) == QString() );
+ QVERIFY( profileModel->messageTone( 59 ) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setMessageTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it can set the message tone successfully with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n
+ <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n
+ 4. Expected result: \n \n
+ <1> profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath \n
+ <2> profileModel->messageTone(EProfileWrapperMeetingId) == QString() \n
+ */
+void TestCpProfileModel::testSetMessageToneWithValidID()
+{
+ QString soundPath2 = QString("C:/unavailable path");
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setMessageTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath1 );
+ // set an unavailable path.
+ profileModel->setMessageTone( EProfileWrapperGeneralId, soundPath2 );
+ QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == soundPath2 );
+
+ profileModel->setMessageTone( EProfileWrapperMeetingId, QString() );
+ QVERIFY( profileModel->messageTone(EProfileWrapperMeetingId) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setMessageTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -100,\n
+ <4> profileId = 100,\n
+ 4. Expected result: \n \n
+ <1> no crash \n
+ <2> no crash \n
+ <3> no crash \n
+ <4> no crash \n
+ */
+void TestCpProfileModel::testSetMessageToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setMessageTone( EProfileWapperStart, ringTonePath1 );
+// QVERIFY( profileModel->messageTone(EProfileWapperStart) == QString() );
+
+ profileModel->setMessageTone( EPRofileWrapperEnd, QString() );
+// QVERIFY( profileModel->messageTone(EPRofileWrapperEnd) == QString() );
+
+ profileModel->setMessageTone( -100, ringTonePath1 );
+// QVERIFY( profileModel->messageTone(-100) == QString() );
+
+ profileModel->setMessageTone( 100, QString() );
+// QVERIFY( profileModel->messageTone(100) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString emailTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it can return the right email tone when using valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n
+ <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n
+ 4. Expected result: \n
+ <1> profileModel->emailTone(EProfileWrapperGeneralId) == soundPath1 \n
+ <2> profileModel->emailTone(EProfileWrapperMeetingId) == soundPath2 \n
+ */
+void TestCpProfileModel::testEmailToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setEmailTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == ringTonePath1 );
+
+ profileModel->setEmailTone( EProfileWrapperMeetingId, ringTonePath2 );
+ QVERIFY( profileModel->emailTone(EProfileWrapperMeetingId) == ringTonePath2 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString emailTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 59,\n
+ 4. Expected result: \n
+ <1> no crash and return QString() \n
+ <2> no crash and return QString() \n
+ <3> no crash and return QString() \n
+ <4> no crash and return QString() \n
+ */
+void TestCpProfileModel::testEmailToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QVERIFY( profileModel->emailTone( EProfileWapperStart ) == QString() );
+ QVERIFY( profileModel->emailTone( EPRofileWrapperEnd ) == QString() );
+ QVERIFY( profileModel->emailTone( -9 ) == QString() );
+ QVERIFY( profileModel->emailTone( 59 ) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setEmailTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it can set the email tone successfully with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n
+ <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n
+ 4. Expected result: \n \n
+ <1> profileModel->emailTone(EProfileWrapperGeneralId) == soundPath \n
+ <2> profileModel->emailTone(EProfileWrapperMeetingId) == QString() \n
+ */
+void TestCpProfileModel::testSetEmailToneWithValidID()
+{
+ QString soundPath2 = QString("C:/unavailable path");
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setEmailTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == ringTonePath1 );
+ // set an unavailable path.
+ profileModel->setEmailTone( EProfileWrapperGeneralId, soundPath2 );
+ QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == soundPath2 );
+
+ profileModel->setEmailTone( EProfileWrapperMeetingId, QString() );
+ QVERIFY( profileModel->emailTone(EProfileWrapperMeetingId) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setEmailTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -100,\n
+ <4> profileId = 100,\n
+ 4. Expected result: \n \n
+ <1> no crash \n
+ <2> no crash \n
+ <3> no crash \n
+ <4> no crash \n
+ */
+void TestCpProfileModel::testSetEmailToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setEmailTone( EProfileWapperStart, ringTonePath1 );
+// QVERIFY( profileModel->emailTone(EProfileWapperStart) == QString() );
+
+ profileModel->setEmailTone( EPRofileWrapperEnd, QString() );
+// QVERIFY( profileModel->emailTone(EPRofileWrapperEnd) == QString() );
+
+ profileModel->setEmailTone( -100, ringTonePath1 );
+// QVERIFY( profileModel->emailTone(-100) == QString() );
+
+ profileModel->setEmailTone( 100, QString() );
+// QVERIFY( profileModel->emailTone(100) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString reminderTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it can return the right reminder tone when using valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n
+ <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n
+ 4. Expected result: \n
+ <1> profileModel->reminderTone(EProfileWrapperGeneralId) == soundPath1 \n
+ <2> profileModel->reminderTone(EProfileWrapperMeetingId) == soundPath2 \n
+ */
+void TestCpProfileModel::testReminderToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath1 );
+
+ profileModel->setReminderTone( EProfileWrapperMeetingId, ringTonePath2 );
+ QVERIFY( profileModel->reminderTone(EProfileWrapperMeetingId) == ringTonePath2 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString reminderTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 59,\n
+ 4. Expected result: \n
+ <1> no crash and return QString() \n
+ <2> no crash and return QString() \n
+ <3> no crash and return QString() \n
+ <4> no crash and return QString() \n
+ */
+void TestCpProfileModel::testReminderToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QVERIFY( profileModel->reminderTone( EProfileWapperStart ) == QString() );
+ QVERIFY( profileModel->reminderTone( EPRofileWrapperEnd ) == QString() );
+ QVERIFY( profileModel->reminderTone( -9 ) == QString() );
+ QVERIFY( profileModel->reminderTone( 59 ) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setReminderTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it can set the reminder tone successfully with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n
+ <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n
+ 4. Expected result: \n \n
+ <1> profileModel->reminderTone(EProfileWrapperGeneralId) == soundPath \n
+ <2> profileModel->reminderTone(EProfileWrapperMeetingId) == QString() \n
+ */
+void TestCpProfileModel::testSetReminderToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath1 );
+ QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath1 );
+ // set an unavailable path.
+ profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath2 );
+ QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath2 );
+
+ profileModel->setReminderTone( EProfileWrapperMeetingId, QString() );
+ QVERIFY( profileModel->reminderTone(EProfileWrapperMeetingId) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setReminderTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -100,\n
+ <4> profileId = 100,\n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ <3> no crash \n
+ <4> no crash \n
+ */
+void TestCpProfileModel::testSetReminderToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setReminderTone( EProfileWapperStart, ringTonePath1 );
+// QVERIFY( profileModel->reminderTone(EProfileWapperStart) == QString() );
+
+ profileModel->setReminderTone( EPRofileWrapperEnd, QString() );
+// QVERIFY( profileModel->reminderTone(EPRofileWrapperEnd) == QString() );
+
+ profileModel->setReminderTone( -100, ringTonePath1 );
+// QVERIFY( profileModel->reminderTone(-100) == QString() );
+
+ profileModel->setReminderTone( 100, QString() );
+// QVERIFY( profileModel->reminderTone(100) == QString() );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString notificationTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it can return the right notification tone when using valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, isActive = true \n
+ <2> profileId = EProfileWrapperMeetingId, isActive = false \n
+ 4. Expected result: \n
+ <1> profileModel->notificationTone(EProfileWrapperGeneralId) == true \n
+ <2> profileModel->notificationTone(EProfileWrapperMeetingId) == false \n
+ */
+void TestCpProfileModel::testNotificationToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setNotificationTone( EProfileWrapperGeneralId, true );
+ QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == true );
+
+ profileModel->setNotificationTone( EProfileWrapperMeetingId, false );
+ QVERIFY( profileModel->notificationTone(EProfileWrapperMeetingId) == false );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: QString notificationTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 59,\n
+ 4. Expected result: \n
+ <1> no crash and return QString() \n
+ <2> no crash and return QString() \n
+ <3> no crash and return QString() \n
+ <4> no crash and return QString() \n
+ */
+void TestCpProfileModel::testNotificationToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QVERIFY( profileModel->notificationTone( EProfileWapperStart ) == false );
+ QVERIFY( profileModel->notificationTone( EPRofileWrapperEnd ) == false );
+ QVERIFY( profileModel->notificationTone( -9 ) == false );
+ QVERIFY( profileModel->notificationTone( 59 ) == false );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: void setNotificationTone(int profileId, const QString& filePath); \n
+ 2. Case Descrition: Verify that it can set the notification tone successfully with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, isActive = true \n
+ <2> profileId = EProfileWrapperMeetingId, isActive = false \n
+ 4. Expected result: \n \n
+ <1> profileModel->notificationTone(EProfileWrapperGeneralId) == true \n
+ <2> profileModel->notificationTone(EProfileWrapperMeetingId) == false \n
+ */
+void TestCpProfileModel::testSetNotificationTone()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setNotificationTone( EProfileWrapperGeneralId, true );
+ QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == true );
+
+ profileModel->setNotificationTone( EProfileWrapperGeneralId, false );
+ QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == false );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ void setKeyTouchScreenTone(int profileId, int level);\n
+ 2. Case Descrition: Verify that the tone of the valid profile can be set with valid level value. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, level = int X (X = 0,1,2,3,4,5); \n
+ <2> profileId = EProfileWrapperMeetingId, level = int X; \n
+ 4. Expected result: \n
+ <1> profileModel->keyTouchScreenTone(EProfileWrapperGeneralId) == X. \n
+ <2> profileModel->keyTouchScreenTone(EProfileWrapperMeetingId) == X. \n
+ */
+void TestCpProfileModel::testSetKeyTouchScreenToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ int i = 0;
+ for ( ; i <= 5; i++ ) {
+ profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, i );
+ QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ) == i );
+
+ profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, i );
+ QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ) == i );
+ }
+
+ profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, 12 );
+ int b = profileModel->keyTouchScreenTone( EProfileWrapperGeneralId );
+
+ profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, -12 );
+ int c = profileModel->keyTouchScreenTone( EProfileWrapperMeetingId );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ void setKeyTouchScreenTone(int profileId, int level);\n
+ 2. Case Descrition: Verify that it does not crash with invalid level value. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart, level = int X \n
+ <2> profileId = EPRofileWrapperEnd, level = int X \n
+ <3> profileId = -8, level = int X \n
+ <4> profileId = 99, level = int X \n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ <3> no crash \n
+ <4> no crash \n
+ */
+void TestCpProfileModel::testSetKeyTouchScreenToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setKeyTouchScreenTone( EProfileWapperStart, 4 );
+
+ profileModel->setKeyTouchScreenTone( EPRofileWrapperEnd, 2 );
+
+ profileModel->setKeyTouchScreenTone( -8, 4 );
+
+ profileModel->setKeyTouchScreenTone( 99, 3 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ int keyTouchScreenTone(int profileId) const; \n
+ 2. Case Descrition: Verify that the tone can be get with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId \n
+ <2> profileId = EProfileWrapperMeetingId \n
+ 4. Expected result: \n
+ <1> return the right tone level. \n
+ <2> return the right tone level. \n
+ */
+void TestCpProfileModel::testKeyTouchScreenToneWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, 4 );
+ QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ) == 4);
+
+ profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, 5 );
+ QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ) == 5);
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ int keyTouchScreenTone(int profileId) const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 100,\n
+ 4. Expected result: \n
+ <1> no crash and return 0 \n
+ <2> no crash and return 0 \n
+ <3> no crash and return 0 \n
+ <4> no crash and return 0 \n
+ */
+void TestCpProfileModel::testKeyTouchScreenToneWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QVERIFY( profileModel->keyTouchScreenTone( EProfileWapperStart ) == 0);
+ QVERIFY( profileModel->keyTouchScreenTone( EPRofileWrapperEnd ) == 0);
+ QVERIFY( profileModel->keyTouchScreenTone( -9 ) == 0);
+ QVERIFY( profileModel->keyTouchScreenTone( 100 ) == 0);
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ void setKeyTouchScreenVibra(int profileId, int level);\n
+ 2. Case Descrition: Verify that the vibra mode of the valid profile can be set with valid level value. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId, level = int X (X = 0,1,2,3,4,5); \n
+ <2> profileId = EProfileWrapperMeetingId, level = int X; \n
+ 4. Expected result: \n
+ <1> profileModel->keyTouchScreenVibra(EProfileWrapperGeneralId) == X. \n
+ <2> profileModel->keyTouchScreenVibra(EProfileWrapperMeetingId) == X. \n
+ */
+void TestCpProfileModel::testSetKeyTouchScreenVibraWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ int i = 0;
+ for ( ; i <= 5; i++ ) {
+ profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, i );
+ QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ) == i );
+
+ profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, i );
+ QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ) == i );
+ }
+
+ profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, 12 );
+ int b = profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId );
+
+ profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, -12 );
+ int c = profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ void setKeyTouchScreenVibra(int profileId, int level);\n
+ 2. Case Descrition: Verify that it does not crash with the invalid level value. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart, level = int X \n
+ <2> profileId = EPRofileWrapperEnd, level = int X \n
+ <3> profileId = -8, level = int X \n
+ <4> profileId = 99, level = int X \n
+ 4. Expected result: \n
+ <1> no crash \n
+ <2> no crash \n
+ <3> no crash \n
+ <4> no crash \n
+ */
+void TestCpProfileModel::testSetKeyTouchScreenVibraWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setKeyTouchScreenVibra( EProfileWapperStart, 4 );
+
+ profileModel->setKeyTouchScreenVibra( EPRofileWrapperEnd, 2 );
+
+ profileModel->setKeyTouchScreenVibra( -8, 4 );
+
+ profileModel->setKeyTouchScreenVibra( 99, 3 );
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ int keyTouchScreenVibra(int profileId) const; \n
+ 2. Case Descrition: Verify that the vibra value can be get with valid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWrapperGeneralId \n
+ <2> profileId = EProfileWrapperMeetingId \n
+ 4. Expected result: \n
+ <1> return the right key touch screen vibra's value. \n
+ <2> return the right key touch screen vibra's value. \n
+ */
+void TestCpProfileModel::testKeyTouchScreenVibraWithValidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, 4 );
+ QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ) == 4);
+
+ profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, 5 );
+ QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ) == 5);
+
+ delete profileModel;
+}
+
+/*!
+ Test Case Description:\n
+ 1. Fucntion Name: \n
+ int keyTouchScreenVibra(int profileId) const; \n
+ 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n
+ 3. Input Parameters: \n
+ <1> profileId = EProfileWapperStart,\n
+ <2> profileId = EPRofileWrapperEnd,\n
+ <3> profileId = -9,\n
+ <4> profileId = 100,\n
+ 4. Expected result: \n
+ <1> no crash and return 0 \n
+ <2> no crash and return 0 \n
+ <3> no crash and return 0 \n
+ <4> no crash and return 0 \n
+ */
+void TestCpProfileModel::testKeyTouchScreenVibraWithInvalidID()
+{
+ CpProfileModel *profileModel = new CpProfileModel();
+
+ QVERIFY( profileModel->keyTouchScreenVibra( EProfileWapperStart ) == 0);
+ QVERIFY( profileModel->keyTouchScreenVibra( EPRofileWrapperEnd ) == 0);
+ QVERIFY( profileModel->keyTouchScreenVibra( -9 ) == 0);
+ QVERIFY( profileModel->keyTouchScreenVibra( 100 ) == 0);
+
+ delete profileModel;
+}
+
+/*!
+ Descrition of what you will do in this function
+ */
+void TestCpProfileModel::cleanupTestCase()
+{
+ // release all test data
+ QCoreApplication::processEvents();
+}
+
+QTEST_MAIN(TestCpProfileModel)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,97 @@
+/*
+* 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:
+* test the functions in cppluginconfigreader class
+*/
+
+#ifndef UT_CPPROFILEMODEL_H_
+#define UT_CPPROFILEMODEL_H_
+
+class CpPluginConfig;
+#include <QObject>
+
+class TestCpProfileModel :public QObject
+{
+ Q_OBJECT
+private slots:
+ // init function
+ void initTestCase();
+
+ void testConstructor(); // test the constructor.
+
+ //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 testActivateProfileWithInvalidID(); //test the activateProfile() function with invalid profile ID.
+ void testActivateProfileWithValidID(); // test the activateProfile() function with valid profile ID.
+ void testActiveProfileId(); // test the activeProfileId() function.
+
+ void testProfileSettings(); // test the profileSettings() function.
+ void testSetProfileSettings(); // test the setProfileSettings() function.
+
+ void testRingToneOfActive(); // test the ringTone() function.
+ void testSetRingToneAllWithValidPath(); // test the setRingTone() function with valid sound path.
+ void testSetRingToneAllWithInvalidPath(); // test the setRingTone() function with invalid sound path.
+
+ void testSetMasterWithValidVolume(); // test the setMasterVolume() function with valid volume value.
+ void testSetMasterWithInvalidVolume(); // test the setMasterVolume() function with invalid volume value.
+ void testMasterVolume(); // test the masterVolume() function.
+
+ void testSetMasterVibra(); // test the setMasterVibra() functions.
+ void testMasterVibra(); // test the masterVibra() functions.
+
+ void testSetSilenceMode(); // test the setSilenceMode() functions.
+ void testSilenceMode(); // test the silenceMode() functions.
+
+ void testRingToneWithValidID(); // test the ringTone(int profileId) function with valid profile ID.
+ void testRingToneWithInvalidID(); // test the ringTone(int profileId) function with invalid profile ID.
+ void testSetRingToneWithValidID(); // test the setRingTone(int profileId, const QString& filePath) function with valid profile ID.
+ void testSetRingToneWithInvalidID(); // test the setRingTone(int profileId, const QString& filePath) function with invalid profile ID.
+
+ void testMessageToneWithValidID(); // test MessageTone() function with valid profile ID.
+ void testMessageToneWithInvalidID(); // test MessageTone() function with valid profile ID.
+ void testSetMessageToneWithValidID(); // test the setMessageTone() function with valid profile ID.
+ void testSetMessageToneWithInvalidID(); // test the setMessageTone() function with invalid profile ID.
+
+ void testEmailToneWithValidID(); // test emailTone() function with valid profile ID.
+ void testEmailToneWithInvalidID(); // test emailTone() function with valid profile ID.
+ void testSetEmailToneWithValidID(); // test the setEmailTone() function with valid profile ID.
+ void testSetEmailToneWithInvalidID(); // test the setEmailTone() function with invalid profile ID.
+
+ void testReminderToneWithValidID(); // test reminderTone() function with valid profile ID.
+ void testReminderToneWithInvalidID(); // test reminderTone() function with valid profile ID.
+ void testSetReminderToneWithValidID(); // test the setReminderTone() function with valid profile ID.
+ void testSetReminderToneWithInvalidID(); // test the setReminderTone() function with invalid profile ID.
+
+ void testNotificationToneWithValidID(); // test notificationTone() function with valid profile ID.
+ void testNotificationToneWithInvalidID(); // test notificationTone() function with valid profile ID.
+ void testSetNotificationTone(); // test the setNotificationTone() function with valid profile ID.
+
+ void testSetKeyTouchScreenToneWithValidID(); // test the setKeyTouchScreenTone()function with valid profile ID.
+ void testSetKeyTouchScreenToneWithInvalidID(); // test the setKeyTouchScreenTone()function with invalid profile ID.
+ void testKeyTouchScreenToneWithValidID(); // test the keyTouchScreenTone()function with valid profile ID.
+ void testKeyTouchScreenToneWithInvalidID(); // test the keyTouchScreenTone()function with invalid profile ID.
+
+ void testSetKeyTouchScreenVibraWithValidID(); // test the setKeyTouchScreenVibra()function with valid profile ID.
+ void testSetKeyTouchScreenVibraWithInvalidID(); // test the setKeyTouchScreenVibra()function with invalid profile ID.
+ void testKeyTouchScreenVibraWithValidID(); // test the keyTouchScreenVibra()function with valid profile ID.
+ void testKeyTouchScreenVibraWithInvalidID(); // test the keyTouchScreenVibra()function with invalid profile ID.
+
+ void cleanupTestCase();
+private:
+ QString ringTonePath1;
+ QString ringTonePath2;
+};
+#endif /* UT_CPPROFILEMODEL_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/ut_cpprofilemodel.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = app
+TARGET = ut_cpprofilemodel
+
+QT += testlib
+CONFIG += hb qtestlib
+CONFIG += symbian_test
+
+include (../unit_common.pri)
+
+HEADERS += src/*.h
+SOURCES += src/*.cpp
+
+QMAKE_EXTRA_TARGETS += test autotest
+
+DEPENDPATH += .
+
+INCLUDEPATH += . ../../src\
+ ../../../inc
+
+LIBS += -lcpframework
+LIBS += -lcpprofilewrapper \
+ -lprofileeng \
+ -lcentralrepository \
+ -lcharconv
+symbian {
+ deploy.path = C:
+ soundfiles.sources += data/testsound.aac \
+ data/testsound2.aac
+ soundfiles.path = /resource/cptestdata/sounds
+ DEPLOYMENT += soundfiles
+
+ # 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)"
+}
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def Wed Sep 29 10:09:58 2010 +0800
@@ -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<class QVariant> 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 &)
--- a/controlpanelui/src/cpringtoneview/cpringtoneview.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpringtoneview/cpringtoneview.pro Wed Sep 29 10:09:58 2010 +0800
@@ -21,8 +21,11 @@
CONFIG += hb
DEFINES += CPRINGTONEVIEW_LIBRARY
symbian {
- LIBS += -lcpprofilewrapper -lcpframework -lxqservice -lxqserviceutil
+ LIBS += -lcpprofilewrapper -lcplogger -lcpframework -lxqservice -lxqserviceutil
TARGET.UID3 = 0X2002873A
TARGET.CAPABILITY = All -TCB
TARGET.EPOCALLOWDLLDATA = 1
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def Wed Sep 29 10:09:58 2010 +0800
@@ -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
--- a/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -34,14 +34,14 @@
CpRingToneView::CpRingToneView( QGraphicsItem *parent ):
CpBaseSettingView(0, parent),
mToneTypeList( new HbListWidget(this) ),
- mReq(0)
+ mReq(0), mProcessing(false)
{
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css");
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css");
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml");
HbDataForm *form = qobject_cast<HbDataForm*> ( widget() );
- form->setHeading("txt_cp_subhead_select_tone_type");
+ form->setHeading(hbTrId("txt_cp_subhead_select_tone_type"));
HbDataFormModel *model = new HbDataFormModel();
QList< QPair<QString,QString> > tonesTypeList;
@@ -62,31 +62,43 @@
}
CpRingToneView::~CpRingToneView()
{
- if(mReq) delete mReq;
+ if (mReq) {
+ delete mReq;
+ }
}
+
void CpRingToneView::itemActivated( const QModelIndex &index )
{
- int nRow = index.row();
-
+ //avoid responding to the second or later consecutive click
+ if (mProcessing) {
+ return;
+ }
+ mProcessing = true;
+ 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<QVariant>(), requestInfo );
+ break;
+ }
case 3: //get more tones
default:
- break;
+ break;
}
}
void CpRingToneView::handleOk(const QVariant &result)
{
- CPFW_LOG( "CpPersonalizationEntryItemData::handleOk" );
+ mProcessing = false;
+ CPFW_LOG( "CpRingToneView::handleOk" );
if (!result.canConvert<QString>() || result.toString().length() == 0 ) //error result
{
return;
@@ -97,12 +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<QVariant> &arguments, const XQRequestInfo &info )
{
CPFW_LOG("CpRingToneView::launchMediaFetcher, START");
if(mReq)
@@ -112,20 +133,23 @@
}
//launch media fetcher
mReq = mAppMgr.create(strService, strItface, true);
+ mReq->setSynchronous(false);
if (!mReq)
{
CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher start failed");
return;
}
else
- {
- connect(mReq, SIGNAL( requestOk( const QVariant&)), SLOT( handleOk(const QVariant&)) );
- connect(mReq, SIGNAL( requestError( int,const QString&)), SLOT(handleError(int,const QString&)) );
+ { //use QueuedConnection so that requestError will not be emitted when selecting one tone
+ connect(mReq, SIGNAL(requestOk(QVariant)), SLOT( handleOk(QVariant)), Qt::QueuedConnection);
+ connect(mReq, SIGNAL(requestError(int, QString)), SLOT(handleError(int, QString)));
}
-
- QList<QVariant> args;
- args << QVariant(QString("<app_name>"));
- mReq->setArguments(args);
+ if (!arguments.isEmpty()) {
+ mReq->setArguments(arguments);
+ }
+ if (info.isValid()) {
+ mReq->setInfo(info);
+ }
// Make the request
if (!mReq->send())
{
--- a/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Wed Sep 29 10:09:58 2010 +0800
@@ -14,8 +14,8 @@
# Description: cpserviceprovider project - qmake settings
#
-TEMPLATE=app
-TARGET=cpserviceprovider
+TEMPLATE = app
+TARGET = cpserviceprovider
CONFIG += hb service
symbian:TARGET.UID3 = 0x2002873F
@@ -23,12 +23,14 @@
include( ../common.pri )
include( cpserviceprovider.pri )
-LIBS+=-lxqservice -lxqserviceutil -lcpframework
+# DEFINES += ENABLE_CPSP_LOG
+RESOURCES += cpserviceprovider.qrc
+
+LIBS += -lxqservice -lxqserviceutil -lcplogger -lcpframework
SERVICE.FILE = service_conf.xml
SERVICE.OPTIONS = embeddable
SERVICE.OPTIONS += hidden
-libFiles.sources = xqservice.dll
-libFiles.path = "!:\sys\bin"
-DEPLOYMENT += libFiles
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.qrc Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/logconf" >
+ <file alias="cpserviceproviderlog.conf">data/cpserviceproviderlog.conf</file>
+ </qresource>
+</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpserviceprovider/data/cpserviceproviderlog.conf Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,7 @@
+[CpServiceProvider]
+logdatetime = 1
+logloggername = 1
+datetimeformat = hh:mm:ss
+output = debugoutput fileoutput
+fileoutput/logfile = C:/data/logs/cpserviceprovider.log
+fileoutput/truncate = 1
--- a/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -29,20 +29,24 @@
mAsyncRequestIndex(-1),
mReturnValue(false)
{
- CPSP_LOG("CpLauncherService Constructing...");
+ CPSP_LOG_FUNC_ENTRY("CpLauncherService::CpLauncherService")
+
publishAll();
connect(this,SIGNAL(clientDisconnected()),this,SLOT(handleClientDisconnected()));
}
CpLauncherService::~CpLauncherService()
{
- CPSP_LOG("CpLauncherService Destructing...");
+ CPSP_LOG_FUNC_ENTRY("CpLauncherService::~CpLauncherService")
}
bool CpLauncherService::complete()
{
+ CPSP_LOG_FUNC_ENTRY("CpLauncherService::complete")
+
CPSP_LOG( QString("CpLauncherService::complete() mAsyncRequestIndex = %1, mReturnValue = %2").arg(
- mAsyncRequestIndex).arg(mReturnValue.toBool()) );
+ mAsyncRequestIndex).arg(mReturnValue.toBool()) )
+
bool ret = completeRequest(mAsyncRequestIndex, mReturnValue);
mAsyncRequestIndex = -1;
return ret;
@@ -50,12 +54,14 @@
void CpLauncherService::setReturnValue(const QVariant &returnValue)
{
+ CPSP_LOG_FUNC_ENTRY("CpLauncherService::setReturnValue")
+
mReturnValue = returnValue;
}
bool CpLauncherService::launchSettingView(const QString &pluginFile,const QVariant &hint)
{
- CPSP_LOG("Entering CpLauncherService::launchSettingView");
+ CPSP_LOG_FUNC_ENTRY("CpLauncherService::launchSettingView");
mAsyncRequestIndex = setCurrentRequestAsync();
@@ -83,14 +89,14 @@
qApp->quit(); //quit application if loading plugin failed or creating setting view failed.
}
}
-
- CPSP_LOG("Leaving CpLauncherService::launchSettingView");
return succeed;
}
void CpLauncherService::handleClientDisconnected()
{
+ CPSP_LOG_FUNC_ENTRY("CpLauncherService::handleClientDisconnected")
+
qApp->quit();
}
--- a/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -24,17 +24,20 @@
CpServiceMainWindow::CpServiceMainWindow(QWidget *parent /* = 0*/)
: HbMainWindow(parent), mLauncherService(0), mPreviousView(0)
{
- CPSP_LOG("CpServiceMainWindow Constructing...");
+ CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::CpServiceMainWindow")
+
mLauncherService = new CpLauncherService(this);
}
CpServiceMainWindow::~CpServiceMainWindow()
{
- CPSP_LOG("CpServiceMainWindow Destructing...");
+ CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::~CpServiceMainWindow")
}
void CpServiceMainWindow::setSettingView(CpBaseSettingView *settingView)
{
+ CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::setSettingView")
+
mSettingViewPointer = settingView;
mPreviousView = currentView();
@@ -46,7 +49,7 @@
void CpServiceMainWindow::quit()
{
- CPSP_LOG("CpServiceMainWindow::quit()");
+ CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::quit");
closeSettingView();
@@ -65,6 +68,8 @@
void CpServiceMainWindow::closeSettingView()
{
+ CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::closeSettingView")
+
if (mSettingViewPointer) {
removeView(mSettingViewPointer);
mSettingViewPointer->deleteLater();
--- a/controlpanelui/src/cpserviceprovider/src/cpsplogger.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/src/cpsplogger.h Wed Sep 29 10:09:58 2010 +0800
@@ -21,18 +21,16 @@
#include <QLatin1String>
#include <logger.h>
-#define CPSP_LOGGER_NAME QLatin1String("CpServiceProvider")
+#ifdef ENABLE_CPSP_LOG
+ #define CPSP_LOGGER_NAME QLatin1String("CpServiceProvider")
+ #define CPSP_LOGGER_CONFIG_PATH QLatin1String(":/logconf/cpserviceproviderlog.conf")
-#if defined (Q_OS_SYMBIAN)
- #define CPSP_LOGGER_CONFIG_PATH QLatin1String("C:/data/.config/cpserviceproviderlog.conf")
-#elif defined (Q_WS_WIN)
- #ifdef _DEBUG
- #define CPSP_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/debug/bin/cpserviceproviderlog.conf")
- #else
- #define CPSP_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/release/bin/cpserviceproviderlog.conf")
- #endif
+ #define CPSP_LOG(str) Logger::instance(CPSP_LOGGER_NAME)->log(str);
+ #define CPSP_LOG_FUNC_ENTRY(func) LogFunctionEntryHelper ___cpsp_log_func_entry_helper(CPSP_LOGGER_NAME,func);
+#else
+ #define CPSP_LOG(str)
+ #define CPSP_LOG_FUNC_ENTRY(func)
#endif
-#define CPSP_LOG(str) Logger::instance(CPSP_LOGGER_NAME)->log(str);
#endif
--- a/controlpanelui/src/cpserviceprovider/src/main.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/src/main.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -16,8 +16,7 @@
*/
#include <hbapplication.h>
#include <hbstyleloader.h>
-#include <QDir>
-#include <QTranslator>
+#include <hbtranslator.h>
#include <QLocale>
#include "cpservicemainwindow.h"
#include "cpsplogger.h"
@@ -25,29 +24,29 @@
int main(int argc, char **argv)
{
HbApplication app(argc,argv );
+
+#ifdef ENABLE_CPSP_LOG
+ INIT_LOGGER(CPSP_LOGGER_NAME,CPSP_LOGGER_CONFIG_PATH)
+#endif
- Logger::instance(CPSP_LOGGER_NAME)->configure(
- CPSP_LOGGER_CONFIG_PATH,QSettings::IniFormat);
CPSP_LOG("Entering CpServiceProvider.exe...");
- QTranslator translator;
- if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations"))
- {
- qApp->installTranslator(&translator);
- }
+ HbTranslator translator("control_panel");
+ translator.loadCommon();
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css");
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css");
HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml");
CpServiceMainWindow wnd;
- wnd.show();
+ /*
+ DON'T call wnd.show(),
+ it will cause deadlock problem if cpserviceprovider is launched from an indicator plugin.
+ */
int ret = app.exec();
CPSP_LOG("Exiting CpServiceProvider.exe.");
-
- Logger::closeAll();
return ret;
}
--- a/controlpanelui/src/inc/cpcategorysettingformitemdata.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/inc/cpcategorysettingformitemdata.h Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: An extension to CpSettingFormItemData, can be filled with model items comes from controlpanel plugins.
*
*/
#ifndef CPCATEGORYSETTINGFORMITEMDATA_H
@@ -44,3 +44,5 @@
};
#endif
+
+//End of File
--- a/controlpanelui/src/inc/cpcategorysettingformmodel.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/inc/cpcategorysettingformmodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description: An extension to HbDataFormModel, can be filled with model items comes from controlpanel plugins.
*
*/
#ifndef CPCATEGORYSETTINGFORMMODEL_H
@@ -37,5 +37,7 @@
CpCategorySettingFormModelPrivate *d;
};
+#endif
-#endif
+//End of File
+
--- a/controlpanelui/src/inc/cpprofilemodel.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/inc/cpprofilemodel.h Wed Sep 29 10:09:58 2010 +0800
@@ -44,11 +44,6 @@
bool mNotificationTone;
int mKeyTouchScreenTone; // 0-5
- bool mRingAlertVibra;
- bool mMessageVibra;
- bool mEmailVibra;
- bool mReminderAlertVibra;
- bool mNotificationVibra;
int mKeyTouchScreenVibra; //0-5
};
class PROFILE_WRAPPER_EXPORT CpProfileModel : QObject
@@ -59,23 +54,18 @@
~CpProfileModel();
public:
- int initiationFlag();
QString profileName(int profileId)const;
+ void setProfileName(int profileId, const QString &name);
QStringList profileNames()const;
int activateProfile(int profileId);
int activeProfileId() const;
- void profileSettings(int profileId, CpProfileSettings& profileSettings);
- int setProfileSettings(int profileId, CpProfileSettings& profileSettings );
- /*!
- * set ring tone in personalization group in control panel's homeview
- */
+ void profileSettings(int profileId, CpProfileSettings& profileSettings);
+ void setProfileSettings(int profileId, CpProfileSettings& profileSettings );
+
QString ringTone() const;
void setRingTone(const QString& filePath);
- /* QString alarmTone();
- void setAlarmTone(const QString& filePath);*/
-
int masterVolume() const;
void setMasterVolume(int volume);
@@ -86,9 +76,6 @@
bool silenceMode() const;
void setSilenceMode(bool isSlience);
- bool offLineMode() const;
- void setOffLineMode(bool isOffLine);
-
/*!
* For profile settings
*/
@@ -108,21 +95,6 @@
int keyTouchScreenTone(int profileId) const;
void setKeyTouchScreenTone(int profileId, int level);
- bool ringAlertVibra(int profileId) const;
- void setRingAlertVibra(int profileId, bool isActive);
-
- bool messageVibra(int profileId) const;
- void setMessageVibra(int profileId, bool isActive);
-
- bool emailVibra(int profileId) const;
- void setEmailVibra(int profileId, bool isActive);
-
- bool reminderVibra(int profileId) const;
- void setReminderVibra(int profileId, bool isActive);
-
- bool notificationVibra(int profileId) const;
- void setNotificationVibra(int profileId, bool isActive);
-
int keyTouchScreenVibra(int profileId)const;
void setKeyTouchScreenVibra(int profileId, int level);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/inc/cpprofilemonitor.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,43 @@
+/*
+ * 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 CPPROFILEMONITOR_H
+#define CPPROFILEMONITOR_H
+
+#include <QObject>
+#include <cpprofilewrappermacro.h>
+
+class CpProfileMonitorPrivate;
+
+class PROFILE_WRAPPER_EXPORT CpProfileMonitor: public QObject
+{
+ Q_OBJECT
+public:
+ explicit CpProfileMonitor(QObject *parent = 0);
+ ~CpProfileMonitor();
+signals:
+ void profileActivated(int activeProfileId);
+ void activeProfileModified(int activeProfileId);
+private:
+ CpProfileMonitorPrivate *const d_ptr;
+
+private:
+ Q_DISABLE_COPY(CpProfileMonitor)
+ Q_DECLARE_PRIVATE_D(d_ptr,CpProfileMonitor)
+};
+
+#endif /* CPPROFILEMONITOR_H */
--- a/controlpanelui/src/inc/cpringtoneview.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/inc/cpringtoneview.h Wed Sep 29 10:09:58 2010 +0800
@@ -44,9 +44,12 @@
HbListWidget* mToneTypeList;
XQAiwRequest* mReq;
XQApplicationManager mAppMgr;
-
-private:
- void launchMediaFetcher( const QString &strService, const QString &strItface );
+ //used to mark if there is a request being processed
+ bool mProcessing;
+
+private:
+ void launchMediaFetcher( const QString &strService, const QString &strItface, \
+ const QList<QVariant> &arguments = QList<QVariant>(), const XQRequestInfo &info = XQRequestInfo() );
};
#endif // CPRINGTONEVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/silenceindicatorplugin/rom/cpsilenceindicatorplugin.iby Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,30 @@
+/*
+ * 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 CPSILENCEINDICATORPLUGIN_IBY
+#define CPSILENCEINDICATORPLUGIN_IBY
+
+#include <bldprivate.hrh>
+
+#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
+
+file=ABI_DIR\BUILD_DIR\cpsilenceindicatorplugin.dll SHARED_LIB_DIR\cpsilenceindicatorplugin.dll
+data=\epoc32\data\z\resource\plugins\indicators\cpsilenceindicatorplugin.qtplugin RESOURCE_FILES_DIR\plugins\indicators\cpsilenceindicatorplugin.qtplugin
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/silenceindicatorplugin/rom/cpsilenceindicatorplugin_resources.iby Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,26 @@
+/*
+ * 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 SILENCEINDICATORPLUGIN_RESOURCES_IBY
+#define SILENCEINDICATORPLUGIN_RESOURCES_IBY
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_/QT_TRANSLATIONS_DIR/cpsilenceindicatorplugin.qm QT_TRANSLATIONS_DIR/cpsilenceindicatorplugin.qm
+
+#endif // SILENCEINDICATORPLUGIN_RESOURCES_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/silenceindicatorplugin/silenceindicatorplugin.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,38 @@
+# 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 = cpsilenceindicatorplugin
+CONFIG += plugin
+CONFIG += hb
+
+# directories
+DEPENDPATH += .
+
+HEADERS += src/cpsilenceindicatorplugin.h
+SOURCES += src/cpsilenceindicatorplugin.cpp
+symbian*::LIBS += -HbCore \
+ -HbWidgets
+symbian*: {
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = ProtServ SwEvent TrustedUI ReadDeviceData
+
+ TARGET.UID3 = 0x2002C39F
+ SYMBIAN_PLATFORMS = WINSCW \
+ ARMV5
+ LIBS += -lprofileeng
+
+ BLD_INF_RULES.prj_exports += "rom/cpsilenceindicatorplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(cpsilenceindicatorplugin.iby)"
+ BLD_INF_RULES.prj_exports += "rom/cpsilenceindicatorplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(cpsilenceindicatorplugin_resources.iby)"
+ pluginstub.sources = cpsilenceindicatorplugin.dll
+ pluginstub.path = /resource/plugins/indicators
+ DEPLOYMENT += pluginstub
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,154 @@
+/*
+ * 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 <QTranslator>
+#include <QLocale>
+#include <QtCore/qplugin.h>
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+#include <QtCore/QMetaType>
+
+#include <HbLabel>
+#include <hbglobal.h>
+#include <hbapplication.h>
+#include <hbindicatorplugininterface.h>
+#include <hbindicatorinterface.h>
+#include <hbtranslator.h>
+#include "cpsilenceindicatorplugin.h"
+#include <MProfileEngineExtended2.h>
+#include <w32std.h>
+
+Q_EXPORT_PLUGIN(CpSilenceIndicatorPlugin)
+
+const static QString IndicatorType("com.nokia.hb.indicator.controlpanel.cpsilenceindicatorplugin/1.0");
+
+
+/*!
+ SilenceIndicatorPlugin constructor.
+*/
+CpSilenceIndicatorPlugin::CpSilenceIndicatorPlugin() :
+ HbIndicatorInterface(IndicatorType, SettingCategory, InteractionActivated),
+ mError(0)
+{
+ mIndicatorTypes << IndicatorType;
+}
+
+/*!
+ SilenceIndicatorPlugin destructor.
+*/
+CpSilenceIndicatorPlugin::~CpSilenceIndicatorPlugin()
+{
+}
+
+/*!
+ The indicatorTypes returns type of indicator. In this case it is CpSilenceIndicatorPlugin.
+*/
+QStringList CpSilenceIndicatorPlugin::indicatorTypes() const
+{
+ return mIndicatorTypes;
+}
+
+/*!
+ The handleClientRequest handles client request to change indicators parameters.
+*/
+bool CpSilenceIndicatorPlugin::accessAllowed(const QString &indicatorType,
+ const QVariantMap &securityInfo) const
+{
+ Q_UNUSED(indicatorType)
+ Q_UNUSED(securityInfo)
+ return true;
+}
+
+/*!
+ The createIndicator creates indicator plugin instance.
+*/
+HbIndicatorInterface* CpSilenceIndicatorPlugin::createIndicator(
+ const QString &indicatorType)
+{
+ Q_UNUSED(indicatorType)
+ // Install localization
+ HbTranslator translator("control_panel");
+ translator.loadCommon();
+ mEngine = CreateProfileEngineExtended2L();
+ return this;
+}
+
+/*!
+ The error returns indicator error to HbIndicatorPluginInterface.
+*/
+int CpSilenceIndicatorPlugin::error() const
+{
+ return mError;
+}
+
+/*!
+ The handleInteraction is used to emit dataChange signal.
+*/
+bool CpSilenceIndicatorPlugin::handleInteraction(InteractionType type)
+{
+ bool handled = false;
+ switch (type) {
+ case InteractionActivated:
+ emit dataChanged();
+ handled = true;
+ break;
+ default:
+ break;
+ }
+ return handled;
+}
+
+/*!
+ The handleClientRequest handles client request to change indicators paramters.
+*/
+bool CpSilenceIndicatorPlugin::handleClientRequest(RequestType type, const QVariant ¶meter)
+{
+ Q_UNUSED(parameter)
+ bool handled(false);
+ switch (type) {
+ case RequestActivate:
+ case RequestDeactivate:
+ handled = true;
+ emit dataChanged();
+ break;
+ default:
+ break;
+ }
+
+ return handled;
+}
+
+/*!
+ The indicatorData takes care of showing indicator's data.
+*/
+QVariant CpSilenceIndicatorPlugin::indicatorData(int role) const
+{
+ QVariant variant;
+ switch (role) {
+ // this is the statusbar icon, which is shown only when silence mode is on
+ case MonoDecorationNameRole:
+ if (mEngine->SilenceModeL()) {
+ variant = QString("qtg_status_profile_silent");
+ } else {
+ variant = QString();
+ }
+ break;
+ default:
+ break;
+ }
+ return variant;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.h Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CPSILENCEINDICATORPLUGIN_H
+#define CPSILENCEINDICATORPLUGIN_H
+
+#include <QtCore/QVariant>
+#include <hbindicatorplugininterface.h>
+#include <hbindicatorinterface.h>
+
+class MProfileEngineExtended2;
+class CpSilenceIndicatorPlugin : public HbIndicatorInterface, public HbIndicatorPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(HbIndicatorPluginInterface)
+
+public:
+ CpSilenceIndicatorPlugin();
+ ~CpSilenceIndicatorPlugin();
+
+public:
+ //from HbIndicatorPluginInterface
+ QStringList indicatorTypes() const;
+ bool accessAllowed(const QString &indicatorType,
+ const QVariantMap &securityInfo ) const;
+ HbIndicatorInterface* createIndicator(const QString &indicatorType);
+ int error() const;
+
+public:
+ //from HbIndicatorInterface
+ bool handleClientRequest (RequestType type, const QVariant ¶meter);
+ bool handleInteraction (InteractionType type);
+ QVariant indicatorData(int role) const;
+
+private:
+
+ Q_DISABLE_COPY(CpSilenceIndicatorPlugin)
+ QStringList mIndicatorTypes; // Type of indicator
+ int mError; // Indicator errors
+ MProfileEngineExtended2 *mEngine;
+};
+#endif //CPSILENCEINDICATORPLUGIN_H
--- a/controlpanelui/src/src.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/src.pro Wed Sep 29 10:09:58 2010 +0800
@@ -15,5 +15,5 @@
#
TEMPLATE = subdirs
-SUBDIRS = cpprofilewrapper cpcategorymodel cpringtoneview cpapplication cpserviceprovider tonefetcher cpplugins
+SUBDIRS = cpprofilewrapper cpcategorymodel cpringtoneview cpapplication cpserviceprovider tonefetcher cpplugins silenceindicatorplugin
CONFIG += ordered
\ No newline at end of file
--- a/controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h Wed Sep 29 10:09:58 2010 +0800
@@ -12,7 +12,7 @@
* Contributors:
*
* Description:
- * The header file for tone fetcher utilities.
+ * The header file for tone fetcher logger.
*
*/
@@ -22,6 +22,12 @@
#include <QLatin1String>
#include <logger.h>
+/*
+ make LOG work
+*/
+
+//#define ENABLE_TONEFETCHER_LOG
+
#define TONEFETCHER_LOGGER_NAME QLatin1String("ToneFetcher")
#if defined (Q_OS_SYMBIAN)
@@ -34,6 +40,10 @@
#endif
#endif
-#define TF_LOG(str) Logger::instance(TONEFETCHER_LOGGER_NAME)->log(str);
+#ifdef ENABLE_TONEFETCHER_LOG
+ #define TF_LOG(str) Logger::instance(TONEFETCHER_LOGGER_NAME)->log(str);
+#else
+ #define TF_LOG(str)
+#endif
#endif /* TONEFETCHERLOGGER_H */
--- a/controlpanelui/src/tonefetcher/src/main.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/main.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -25,12 +25,17 @@
{
HbApplication a(argc, argv);
-
+#ifdef ENABLE_TONEFETCHER_LOG
Logger::instance(TONEFETCHER_LOGGER_NAME)->configure(
TF_LOGGER_CONFIG_PATH,QSettings::IniFormat);
-
+#endif
TF_LOG("Entering tonefetcher.exe...");
ToneFetcherMainWindow w;
w.show();
- return a.exec();
+ int ret = a.exec();
+ TF_LOG("Leaving tonefetcher.exe...");
+#ifdef ENABLE_TONEFETCHER_LOG
+ Logger::closeAll();
+#endif
+ return ret;
}
--- a/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -38,7 +38,7 @@
void ToneFetcherView::initMainWidget()
{
- mWidget = new ToneFetcherWidget(this);
+ mWidget = new ToneFetcherWidget(this, this);
Q_ASSERT(mWidget);
setWidget(mWidget);
//mWidget->setCurrentToolBarType( ToneServiceWidget::GeneralTone );
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -36,8 +36,8 @@
#include <hbmessagebox.h>
#include <hbprogressdialog.h>
-ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView )
- : HbWidget(this),
+ToneFetcherWidget::ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView)
+ : HbWidget(parent),
mLabel(0),
mListView(0),
mLayout(0),
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Wed Sep 29 10:09:58 2010 +0800
@@ -39,7 +39,7 @@
Q_OBJECT
public:
- explicit ToneFetcherWidget(ToneFetcherView *serviceView);
+ explicit ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView);
~ToneFetcherWidget();
QString getCurrentItemPath();
void playOrPause();
--- a/controlpanelui/src/tonefetcher/tonefetcher.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Wed Sep 29 10:09:58 2010 +0800
@@ -22,6 +22,7 @@
include( tonefetcher.pri )
LIBS += -lxqservice \
-lxqserviceutil \
+ -lcplogger \
-lcpframework \
-lxqutils
symbian {
@@ -45,6 +46,7 @@
TARGET.UID3 = 0x2002BCCA
TARGET.CAPABILITY = ALL -TCB
+ TARGET.VID = VID_DEFAULT
BLD_INF_RULES.prj_exports += "./service_conf.xml z:/private/2002BCCA/service_conf.xml"
}
symbian {
@@ -58,3 +60,6 @@
libFiles.sources = xqservice.dll
libFiles.path = "!:\sys\bin"
DEPLOYMENT += libFiles
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -28,6 +28,7 @@
//refresh interval, 2 seconds.
const TInt KTimerInterval = 2 * 1000 * 1000;
const TInt KObserverCallStep = 100;
+const TInt KOneKiloByte = 1024;
// CONSTANTS
_LIT( KMimeMp3, "mp3" );
@@ -172,8 +173,8 @@
}
void CToneSelection::HandleObjectNotification( CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray )
+ TObserverNotificationType /*aType*/,
+ const RArray<TItemId>& /*aObjectIdArray*/ )
{
/*if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) )
{
@@ -300,7 +301,7 @@
return PropertyDefL( iSession, aAttr );
}
-CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* aSession, TInt aAttr )
+CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* /*aSession*/, TInt aAttr )
{
CMdEObjectDef& objectDef =
iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject );
@@ -337,6 +338,8 @@
{
User::Leave( KErrNotSupported );
}
+ //avoid critical warning
+ return objectDef.GetPropertyDefL( MdeConstants::Audio::KAudioObject );
}
void CToneSelection::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition )
@@ -357,7 +360,7 @@
CMdELogicCondition& condition =
aCondition.AddLogicConditionL( ELogicConditionOperatorAnd );
- condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize, EMdERangeTypeBetween) );
+ condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize * KOneKiloByte, EMdERangeTypeNotBetween) );
condition.AddPropertyConditionL( mimeTypeDef,
ETextPropertyConditionCompareContains, KMimeMp3 );
condition.AddPropertyConditionL( artistTypeDef );
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp Wed Sep 29 10:09:58 2010 +0800
@@ -25,8 +25,8 @@
ToneFetcherEnginePrivate::ToneFetcherEnginePrivate()
{
- TRAPD( err, mToneSelection = CToneSelection::NewL( this ) );
- TRAPD( error, mTonePlayer = CTonePlayer::NewL( this ) );
+ TRAP_IGNORE( mToneSelection = CToneSelection::NewL( this ) );
+ TRAP_IGNORE( mTonePlayer = CTonePlayer::NewL( this ) );
}
ToneFetcherEnginePrivate::~ToneFetcherEnginePrivate()
--- a/controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro Fri Jun 25 17:12:20 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro Wed Sep 29 10:09:58 2010 +0800
@@ -33,3 +33,6 @@
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
}
+
+
+symbian:MMP_RULES += SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/tsrc/tsrc.pro Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+SUBDIRS = ../src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel \
+ ../src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel \
+ ../src/cpcategorymodel/tsrc/ut_cppluginconfigreader \
+ ../src/cpcategorymodel/tsrc/ut_categorymodelitemdata \
+ ../src/cpcategorymodel/tsrc/ut_categorymodelutility \
+ ../src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel \
+ ../src/cpprofilewrapper/tsrc/ut_cpprofilemodel
+
+CONFIG += ordered
+
--- a/layers.sysdef.xml Fri Jun 25 17:12:20 2010 +0800
+++ b/layers.sysdef.xml Wed Sep 29 10:09:58 2010 +0800
@@ -9,9 +9,20 @@
<module name="themeplugin">
<unit unitID="themeplugin" mrp="" bldFile="&layer_real_source_path;/controlpanelplugins/themeplugin" name="themeplugin" proFile="themeplugin.pro" qmakeArgs="-r -config rom"/>
</module>
+ <module name="langandregplugin">
+ <unit unitID="langandregplugin" mrp="" bldFile="&layer_real_source_path;/controlpanelplugins/langandregplugin" name="langandregplugin" proFile="languageplugin.pro" qmakeArgs="-r -config rom"/>
+ </module>
+ <module name="aboutplugin">
+ <unit unitID="aboutplugin" mrp="" bldFile="&layer_real_source_path;/controlpanelplugins/aboutplugin" name="aboutplugin" proFile="aboutplugin.pro" qmakeArgs="-r -config rom"/>
+ </module>
<module name="controlpanelui">
<unit unitID="controlpanelui" mrp="" bldFile="&layer_real_source_path;/controlpanelui" name="controlpanelui" proFile="controlpanelui.pro" qmakeArgs="-r -config rom"/>
</module>
</layer>
+ <layer name="qt_unit_test_layer">
+ <module name="controlpanelui_tests">
+ <unit unitID="presdoe.controlpanelui_tests" mrp="" bldFile="&layer_real_source_path;/controlpanelui/tsrc" proFile="tsrc.pro" name="controlpanelui_tests" qmakeArgs="-r"/>
+ </module>
+ </layer>
</systemModel>
</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
+ <package id="settingsuis" name="Settings UIs" levels="plugin ui">
+ <collection id="controlpanelplugins" name="Control Panel Plugins" level="plugin">
+ <component id="themeplugin" filter="s60" name="Theme Plugin" introduced="^4">
+ <unit bldFile="controlpanelplugins/themeplugin" qt:proFile="themeplugin.pro" qt:qmakeArgs="-r -config rom"/>
+ </component>
+ <component id="aboutplugin" filter="s60" name="About Plugin" introduced="^4">
+ <unit bldFile="controlpanelplugins/aboutplugin" qt:proFile="aboutplugin.pro" qt:qmakeArgs="-r -config rom"/>
+ </component>
+ <component id="langandregplugin" filter="s60" name="Language Region Plugin" introduced="^4">
+ <unit bldFile="controlpanelplugins/langandregplugin" qt:proFile="languageplugin.pro" qt:qmakeArgs="-r -config rom"/>
+ </component>
+ </collection>
+ <collection id="controlpanelui" name="Control Panel UI" level="ui">
+ <!-- collection is really a component, move down a dir -->
+ <component id="controlpanelui_build" filter="s60" name="Control Panel UI Build" introduced="^4">
+ <unit bldFile="controlpanelui" qt:proFile="controlpanelui.pro" qt:qmakeArgs="-r -config rom"/>
+ </component>
+ </collection>
+ </package>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml Wed Sep 29 10:09:58 2010 +0800
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="app"/>