# HG changeset patch # User hgs # Date 1283418687 -28800 # Node ID 2fee987ebaff3ffe3137b649146df6d188b992b2 # Parent 0cfa53de576f1a4b53d45817bf593aa6cd7ad0a0 201035 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/aboutplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/aboutplugin.pri Thu Sep 02 17:11:27 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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/aboutplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/aboutplugin.pro Thu Sep 02 17:11:27 2010 +0800 @@ -0,0 +1,86 @@ +# +# 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)" +} \ No newline at end of file diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/layers.sysdef.xml Thu Sep 02 17:11:27 2010 +0800 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/rom/aboutplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/rom/aboutplugin.iby Thu Sep 02 17:11:27 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 +#include + +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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/rom/aboutplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/rom/aboutplugin_rom.pri Thu Sep 02 17:11:27 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" \ + "rom/aboutplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(aboutplugin.iby)" +} \ No newline at end of file diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpabout_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpabout_global.h Thu Sep 02 17:11:27 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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutopensourceview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutopensourceview.cpp Thu Sep 02 17:11:27 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 +#include +#include +/*! + \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() +{ +} + + + + diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutopensourceview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutopensourceview.h Thu Sep 02 17:11:27 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 + +class CpAboutOpenSourceView : public HbView +{ + Q_OBJECT +public: + explicit CpAboutOpenSourceView(QGraphicsItem *parent = 0); + virtual ~CpAboutOpenSourceView(); + +private: + ABOUT_TEST_FRIEND_CLASS(TestAboutPlugin) +}; +#endif //CPABOUTOPENSOURCEVIEW_H diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutplugin.cpp Thu Sep 02 17:11:27 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 + +/*! + \class CpAboutPlugin +*/ + +/*! + Constructor +*/ +CpAboutPlugin::CpAboutPlugin() +{ +} + +/*! + Destructor +*/ +CpAboutPlugin::~CpAboutPlugin() +{ +} + +/*! + Creates setting form item data +*/ +QList CpAboutPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + const QString aboutIconName = "qtg_large_info"; + return QList() + << new CpSettingFormEntryItemDataImpl( + itemDataHelper, + hbTrId("txt_cp_list_about"), + QString(), // shows two liner in list + HbIcon(aboutIconName)); +} + +Q_EXPORT_PLUGIN2(cpaboutplugin, CpAboutPlugin); diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutplugin.h Thu Sep 02 17:11:27 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 +#include + +#include "cpabout_global.h" + +class CpAboutPlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) + +public: + CpAboutPlugin(); + virtual ~CpAboutPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + + ABOUT_TEST_FRIEND_CLASS(TestAboutPlugin) +}; + +#endif //CPABOUTPLUGIN_H diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutthirdpartyview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutthirdpartyview.cpp Thu Sep 02 17:11:27 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 +#include +#include +#include +#include +/*! + \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; + } +} + diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutthirdpartyview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutthirdpartyview.h Thu Sep 02 17:11:27 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 + +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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboututils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboututils.cpp Thu Sep 02 17:11:27 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 +#include + +#include +#include + +/*! + 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
+ */ +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(""+ originalString + ""); + 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 productRelease; + productRelease.Zero(); + QString release; + if (SysUtil::GetPRInformation(productRelease) == KErrNone) { + release = XQConversions::s60DescToQString(productRelease); + } + return release; +} + +/*! + Returns the software version. +*/ +QString CpAboutUtils::getSoftwareVersion() +{ + TBuf swVersion; + TBuf 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 version1; + version1.Zero(); + swVersion.Append(version.Left(pos1)); + versionText = XQConversions::s60DescToQString(swVersion); + } + } + return versionText; +} + +/*! + Returns the phone type. +*/ +QString CpAboutUtils::getPhoneType() +{ + TBuf swVersion; + TBuf swVersionDate; + TBuf typeDesignator; + TBuf 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 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; +} diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboututils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboututils.h Thu Sep 02 17:11:27 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 +#include +#include + +//for Qt +const QChar lineBreak = '\n'; +const QString htmlLineBreak = "
"; +const QString doubleHtmlLineBreak = "

"; +const QString htmlLinkStart(""); +const QString htmlLinkEnd(""); +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 */ diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutview.cpp Thu Sep 02 17:11:27 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 +#include +#include +#include +#include +#include +#include + +/*! + \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(); +} diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/src/cpaboutview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/src/cpaboutview.h Thu Sep 02 17:11:27 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 +#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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/t_aboutplugin/inc/t_aboutplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/t_aboutplugin/inc/t_aboutplugin.h Thu Sep 02 17:11:27 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 + +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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/t_aboutplugin/src/t_aboutplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/t_aboutplugin/src/t_aboutplugin.cpp Thu Sep 02 17:11:27 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 +#include "t_aboutplugin.h" +#include "cpaboutplugin.h" +#include "cpaboutview.h" +#include "cpaboutthirdpartyview.h" +#include "cpaboutopensourceview.h" +#include + +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +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 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) diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pri Thu Sep 02 17:11:27 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 + + diff -r 0cfa53de576f -r 2fee987ebaff controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/aboutplugin/t_aboutplugin/t_aboutplugin.pro Thu Sep 02 17:11:27 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 +} + +include(t_aboutplugin.pri) diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- a/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Tue Aug 24 10:56:32 2010 +0800 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Thu Sep 02 17:11:27 2010 +0800 @@ -21,7 +21,7 @@ - + \ No newline at end of file diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/silenceindicatorplugin/rom/cpsilenceindicatorplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/silenceindicatorplugin/rom/cpsilenceindicatorplugin.iby Thu Sep 02 17:11:27 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 + +#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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/silenceindicatorplugin/rom/cpsilenceindicatorplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/silenceindicatorplugin/rom/cpsilenceindicatorplugin_resources.iby Thu Sep 02 17:11:27 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 +#include + +data=DATAZ_/QT_TRANSLATIONS_DIR/cpsilenceindicatorplugin.qm QT_TRANSLATIONS_DIR/cpsilenceindicatorplugin.qm + +#endif // SILENCEINDICATORPLUGIN_RESOURCES_IBY diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/silenceindicatorplugin/silenceindicatorplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/silenceindicatorplugin/silenceindicatorplugin.pro Thu Sep 02 17:11:27 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 +TRANSLATIONS = control_panel.ts +symbian*::LIBS += -HbCore \ + -HbWidgets +symbian*: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = All -TCB + 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 +} + diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp Thu Sep 02 17:11:27 2010 +0800 @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "cpsilenceindicatorplugin.h" +#include +#include + +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) + mEngine = CreateProfileEngineExtended2L(); + return this; +} + +/*! + The error returns indicator error to HbIndicatorPluginInterface. +*/ +int CpSilenceIndicatorPlugin::error() const +{ + return mError; +} + +/*! + The handleInteraction is used launch WLAN list view. +*/ +bool CpSilenceIndicatorPlugin::handleInteraction(InteractionType type) +{ + bool handled = false; + switch (type) { + case InteractionActivated: + // set silence mode or disable silence mode + bool isSilence = false; + TRAP(mError, + isSilence = mEngine->SilenceModeL(); + mEngine->SetSilenceModeL(!isSilence); + ) + emit dataChanged(); + handled = true; + break; + default: + break; + } + return handled; +} + +/*! + 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: + TRAP(mError, mEngine->SetSilenceModeL(true);) + handled = true; + emit dataChanged(); + break; + + case RequestDeactivate: + TRAP(mError, mEngine->SetSilenceModeL(false);) + 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 = HbIcon("qtg_status_profile_silent"); + } else { + variant = HbIcon(); + } + break; + default: + break; + } + return variant; +} diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.h Thu Sep 02 17:11:27 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 +#include +#include + +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 diff -r 0cfa53de576f -r 2fee987ebaff controlpanelui/src/src.pro --- a/controlpanelui/src/src.pro Tue Aug 24 10:56:32 2010 +0800 +++ b/controlpanelui/src/src.pro Thu Sep 02 17:11:27 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 diff -r 0cfa53de576f -r 2fee987ebaff layers.sysdef.xml --- a/layers.sysdef.xml Tue Aug 24 10:56:32 2010 +0800 +++ b/layers.sysdef.xml Thu Sep 02 17:11:27 2010 +0800 @@ -9,9 +9,17 @@ + + + + + + + + diff -r 0cfa53de576f -r 2fee987ebaff package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Sep 02 17:11:27 2010 +0800 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff -r 0cfa53de576f -r 2fee987ebaff package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Thu Sep 02 17:11:27 2010 +0800 @@ -0,0 +1,1 @@ +