# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284704419 -10800 # Node ID 6be25656cbbb90b879707adb3fd02591de8043a3 Revision: 201037 diff -r 000000000000 -r 6be25656cbbb inc/silentmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentmodel.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,43 @@ +/* +* 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: Silent model for silent widget +* +*/ + +#ifndef SILENTMODEL_H +#define SILENTMODEL_H + +// System includes +#include + +// Forward declarations +class SilentModelPrivate; + +// Class declaration +class SilentModel : public QObject +{ +public: + SilentModel(QObject *parent = 0); + ~SilentModel(); + bool silenceMode() const; + void setSilenceMode(bool isSlience); + +private: + Q_DISABLE_COPY(SilentModel) + +private: + SilentModelPrivate *dptr; +}; + +#endif //SILENTMODEL_H diff -r 000000000000 -r 6be25656cbbb inc/silentmodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentmodel_p.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,41 @@ +/* +* 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: Silent model private +* +*/ + +#ifndef SILENTMODEL_P_H +#define SILENTMODEL_P_H + +// Forward declarations +class MProfileEngineExtended2; + +// Class declaration +class SilentModelPrivate +{ +public: + static SilentModelPrivate *NewL(); + ~SilentModelPrivate(); + bool silenceMode() const; + void setSilenceMode(bool isSlience); + +private: + SilentModelPrivate(); + void ConstructL(); + +private: + MProfileEngineExtended2 *mEngine; +}; + +#endif //SILENTMODEL_P_H diff -r 000000000000 -r 6be25656cbbb inc/silentobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentobserver.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,41 @@ +/* +* 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: Silent profiles observer +* +*/ + +#ifndef SILENTOBSERVER_H +#define SILENTOBSERVER_H + +// System includes +#include + +// Forward declarations +class SilentObserverPrivate; + +// Class declaration +class SilentObserver : public QObject +{ +public: + SilentObserver(QObject *parent = 0); + ~SilentObserver(); + +private: + Q_DISABLE_COPY(SilentObserver) + +private: + SilentObserverPrivate *dptr; + }; + +#endif //SILENTOBSERVER_H diff -r 000000000000 -r 6be25656cbbb inc/silentobserver_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentobserver_p.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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: Silent profiles observer +* +*/ + +#ifndef SILENTOBSERVER_P_H +#define SILENTOBSERVER_P_H + +// System includes +#include +#include +#include + +// Forward declarations +class CProfileChangeNotifyHandler; + +// Class declaration +class SilentObserverPrivate : public CBase, public MProfileChangeObserver +{ +public: + static SilentObserverPrivate *NewL(QObject *parent); + SilentObserverPrivate(); + ~SilentObserverPrivate(); + +private: + void ConstructL(QObject *parent); + virtual void HandleActiveProfileEventL( + TProfileEvent aProfileEvent, + TInt aProfileId ); + +private: + CProfileChangeNotifyHandler *iHandler; + QObject *iParent; +}; + +#endif //SILENTOBSERVER_P_H diff -r 000000000000 -r 6be25656cbbb inc/silentwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentwidget.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,59 @@ +/* +* 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: Silent widget +* +*/ + +#ifndef SILENTWIDGET_H +#define SILENTWIDGET_H + +// System includes +#include + +// Forward declarations +class HbPushButton; +class SilentModel; +class SilentObserver; +class XQSettingsManager; +class XQSettingsKey; + +// Class declaration +class SilentWidget : public HbWidget +{ + Q_OBJECT + +public: + SilentWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0); + ~SilentWidget(); + QRectF boundingRect() const; + QPainterPath shape() const; + void changeIcon(); + +public slots: + void onShow(); + void onHide(); + void settingValueChanged(const XQSettingsKey &key, const QVariant &value); + +private slots: + void handleClickEvent(bool state); + +private: + Q_DISABLE_COPY(SilentWidget) + HbPushButton *mButton; + SilentModel *mModel; + SilentObserver *mObserver; + XQSettingsManager *mSettingManager; +}; + +#endif // SILENTWIDGET_H diff -r 000000000000 -r 6be25656cbbb inc/silentwidgetconsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentwidgetconsts.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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: Silent widget constants +* +*/ + +#ifndef SILENTWIDGETCONSTS_H +#define SILENTWIDGETCONSTS_H + +const int SilentWidgetGeneralProfileId = 0; +const int SilentWidgetSilentProfileId = 1; +const int SilentWidgetMeetingProfileId = 2; + +#endif //SILENTWIDGETCONSTS_H diff -r 000000000000 -r 6be25656cbbb inc/silentwidgetplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/silentwidgetplugin.h Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,37 @@ +/* +* 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: Silent widget plugin +* +*/ + +#ifndef SILENTWIDGETPLUGIN_H +#define SILENTWIDGETPLUGIN_H + +// System includes +#include +#include + +// Class declaration +QTM_USE_NAMESPACE +class SilentWidgetPlugin : public QObject, public QServicePluginInterface +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QServicePluginInterface) + +public: + QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, + QServiceContext *context, QAbstractSecuritySession *session); +}; + +#endif // SILENTWIDGETPLUGIN_H diff -r 000000000000 -r 6be25656cbbb layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,19 @@ + + +]> + + + + + + + + + + + + + + + diff -r 000000000000 -r 6be25656cbbb package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 6be25656cbbb package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 000000000000 -r 6be25656cbbb resource/silentwidgetplugin.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/silentwidgetplugin.manifest Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,10 @@ + + + silentwidgetplugin + txt_applib_list_silent_widget + Set volume on/off. + silentwidgetplugin.png + false + silentwidgetplugin.xml + silent_widget + diff -r 000000000000 -r 6be25656cbbb resource/silentwidgetplugin.png Binary file resource/silentwidgetplugin.png has changed diff -r 000000000000 -r 6be25656cbbb resource/silentwidgetplugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/silentwidgetplugin.xml Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,14 @@ + + + silentwidgetplugin + silentwidgetplugin + Silent widget + + com.nokia.symbian.IHomeScreenWidget + 1.0 + Silent widget + + silentwidgetplugin.png + Silent widget + + diff -r 000000000000 -r 6be25656cbbb resource/silentwidgetplugin.xml_for_sisx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/silentwidgetplugin.xml_for_sisx Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,14 @@ + + + silentwidgetplugin + c:/private/20022F35/import/widgetregistry/2002EAD3/silentwidgetplugin.qtplugin + Silent widget + + com.nokia.symbian.IHomeScreenWidget + 1.0 + Silent widget + + silentwidgetplugin.png + Silent widget + + diff -r 000000000000 -r 6be25656cbbb rom/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/bld.inf Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_MMPFILES + + + +prj_extensions + +PRJ_EXPORTS + +silentwidgetplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(silentwidgetplugin.iby) +silentwidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(silentwidgetplugin_resources.iby) diff -r 000000000000 -r 6be25656cbbb rom/silentwidgetplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/silentwidgetplugin.iby Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,34 @@ +/* + * 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: + * The iby file for silentwidgetplugin component + * + */ + +#ifndef SILENTWIDGETPLUGIN_IBY +#define SILENTWIDGETPLUGIN_IBY + +#include +#include + +file=ABI_DIR\BUILD_DIR\silentwidgetplugin.dll SHARED_LIB_DIR\silentwidgetplugin.dll + +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD3\silentwidgetplugin.qtplugin private\20022f35\import\widgetregistry\2002EAD3\silentwidgetplugin.qtplugin +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD3\silentwidgetplugin.manifest private\20022f35\import\widgetregistry\2002EAD3\silentwidgetplugin.manifest +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD3\silentwidgetplugin.png private\20022f35\import\widgetregistry\2002EAD3\silentwidgetplugin.png +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD3\silentwidgetplugin.xml private\20022f35\import\widgetregistry\2002EAD3\silentwidgetplugin.xml + +#endif // SILENTWIDGETPLUGIN_IBY + +// End of file --Don't remove this. \ No newline at end of file diff -r 000000000000 -r 6be25656cbbb rom/silentwidgetplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/silentwidgetplugin_resources.iby Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __SILENTWIDGETRLUGIN_RESOURCE_IBY__ +#define __SILENTWIDGETRLUGIN_RESOURCE_IBY__ + +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\silent_widget.qm QT_TRANSLATIONS_DIR\silent_widget.qm + +#endif \ No newline at end of file diff -r 000000000000 -r 6be25656cbbb rom/silentwidgetplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/silentwidgetplugin_rom.pri Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/silentwidgetplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(silentwidgetplugin.iby)" \ + "rom/silentwidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(silentwidgetplugin_resources.iby)" +} \ No newline at end of file diff -r 000000000000 -r 6be25656cbbb silentwidgetplugin.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/silentwidgetplugin.docml Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 6be25656cbbb silentwidgetplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/silentwidgetplugin.pri Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,31 @@ +# +# 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: Silent widget +# + +HEADERS += ./inc/*.h +SOURCES += src/silentwidgetplugin.cpp \ + src/silentwidget.cpp \ + src/silentmodel.cpp \ + src/silentobserver.cpp \ + +symbian : { + SOURCES += src/silentmodel_p_symbian.cpp \ + src/silentobserver_p_symbian.cpp +} + +win32 : { + SOURCES += src/silentmodel_p_win.cpp \ + src/silentobserver_p_win.cpp +} \ No newline at end of file diff -r 000000000000 -r 6be25656cbbb silentwidgetplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/silentwidgetplugin.pro Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,71 @@ +# +# 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: Silent widget +# + +TEMPLATE = lib +CONFIG += plugin mobility hb +MOBILITY = serviceframework + +include(../../common.pri) +include(silentwidgetplugin.pri) +include (rom/silentwidgetplugin_rom.pri) + +INCLUDEPATH += ./inc + +RESOURCES += silentwidgetplugin.qrc + +TRANSLATIONS = silent_widget.ts + +symbian: { + + PLUGIN_SUBDIR = /private/20022F35/import/widgetregistry/2002EAD3 + + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.UID3 = 0x2002EAD3 + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = ALL -TCB + + LIBS += -lprofileeng -lxqsettingsmanager + + plugins.path = $${PLUGIN_SUBDIR} + plugins.sources = $${TARGET}.dll + + widgetResources.path = $${PLUGIN_SUBDIR} + widgetResources.sources += resource/$${TARGET}.xml + widgetResources.sources += resource/$${TARGET}.manifest + widgetResources.sources += resource/$${TARGET}.png + + DEPLOYMENT += plugins \ + widgetResources +} + +win32: { + + CONFIG(debug, debug|release) { + SUBDIRPART = debug + } else { + SUBDIRPART = release + } + + PLUGIN_SUBDIR = /hsresources/import/widgetregistry/2002EAD3 + + DESTDIR = $$PWD/../../../../../bin/$${SUBDIRPART}/$${PLUGIN_SUBDIR} + + manifest.path = $${DESTDIR} + manifest.files = ./resource/*.manifest ./resource/*.xml ./resource/*.png + + INSTALLS += manifest + +} diff -r 000000000000 -r 6be25656cbbb silentwidgetplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/silentwidgetplugin.qrc Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,5 @@ + + + silentwidgetplugin.docml + + diff -r 000000000000 -r 6be25656cbbb src/silentmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentmodel.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,63 @@ +/* +* 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: Silent widget model +* +*/ + +// User includes +#include "silentmodel.h" +#include "silentmodel_p.h" +#include "silentwidgetconsts.h" + +/*! + \class SilentModel + \Silent widget model class + + This class is used to create silent widget model +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SilentModel::SilentModel(QObject *parent/*= 0*/) + : QObject(parent) +{ + QT_TRAP_THROWING(dptr = SilentModelPrivate::NewL()); +} + +/*! + Destroyer +*/ +SilentModel::~SilentModel() +{ + delete dptr; +} + +/* + Get silent status in master volume + */ +bool SilentModel::silenceMode() const +{ + return dptr->silenceMode(); +} + +/* + Set silent status in master volume + */ +void SilentModel::setSilenceMode(bool isSilence) +{ + return dptr->setSilenceMode(isSilence); +} diff -r 000000000000 -r 6be25656cbbb src/silentmodel_p_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentmodel_p_symbian.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,89 @@ +/* +* 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: Silent widget model +* +*/ + +// System includes +#include +#include + +// User includes +#include "silentmodel_p.h" +#include "silentwidgetconsts.h" + +/*! + \class SilentModelPrivate + \silent widget model private class + + This class is used to create silent model +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +SilentModelPrivate *SilentModelPrivate::NewL() +{ + SilentModelPrivate *self = new (ELeave) SilentModelPrivate(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; +} + +/*! + Constructor +*/ +SilentModelPrivate::SilentModelPrivate() +{ + mEngine = NULL; +} + +/*! + ConstructL +*/ +void SilentModelPrivate::ConstructL() +{ + mEngine = CreateProfileEngineExtended2L(); +} + +/*! + Destroyer +*/ +SilentModelPrivate::~SilentModelPrivate() +{ + if (mEngine!=0) { + mEngine->Release(); + } +} + +/* + Get silent status in master volume + */ +bool SilentModelPrivate::silenceMode() const +{ + bool isSlience = false; + TRAP_IGNORE(isSlience = mEngine->SilenceModeL();) + return isSlience; +} + +/* + Set silent status in master volume + */ +void SilentModelPrivate::setSilenceMode(bool isSilence) +{ + TRAP_IGNORE(mEngine->SetSilenceModeL(isSilence);) +} diff -r 000000000000 -r 6be25656cbbb src/silentmodel_p_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentmodel_p_win.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,72 @@ +/* +* 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: Silent widget model +* +*/ + +// User includes +#include "silentmodel_p.h" + +/*! + \class SilentModelPrivate + \Silent widget model class + + This class is used to create silent widget model +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +SilentModelPrivate *SilentModelPrivate::NewL() +{ +} + +/*! + Constructor +*/ +SilentModelPrivate::SilentModelPrivate() +{ +} + +/*! + ConstructL +*/ +void SilentModelPrivate::ConstructL() +{ +} + +/*! + Destroyer +*/ +SilentModelPrivate::~SilentModelPrivate() +{ + +} + +/* + Get silent status in master volume + */ +bool SilentModelPrivate::silenceMode() const +{ + return true; +} + +/* + Set silent status in master volume + */ +void SilentModelPrivate::setSilenceMode(bool isSilence) +{ +} diff -r 000000000000 -r 6be25656cbbb src/silentobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentobserver.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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: Silent widget observer +* +*/ + +// User includes +#include "silentobserver.h" +#include "silentobserver_p.h" + +/*! + \class SilentObserver + \Silent observer class + + This class is used to create silent widget observer +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SilentObserver::SilentObserver(QObject *parent/*= 0*/) +: QObject(parent) +{ + QT_TRAP_THROWING(dptr = SilentObserverPrivate::NewL(parent)); +} + +/*! + Destroyer +*/ +SilentObserver::~SilentObserver() +{ + delete dptr; +} diff -r 000000000000 -r 6be25656cbbb src/silentobserver_p_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentobserver_p_symbian.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,83 @@ +/* +* 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: Silent widget observer +* +*/ + +// System includes +#include + +// User includes +#include "silentobserver_p.h" +#include "silentwidget.h" + +/*! + \class SilentObserverPrivate + \Silent observer class + + This class is used to create silent widget observer +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +SilentObserverPrivate *SilentObserverPrivate::NewL(QObject *parent) +{ + SilentObserverPrivate *self = new (ELeave)SilentObserverPrivate(); + CleanupStack::PushL(self); + self->ConstructL(parent); + CleanupStack::Pop(); //self + return self; +} + +/*! + Constructor +*/ +SilentObserverPrivate::SilentObserverPrivate() +{ +} + +/*! + ConstructL +*/ +void SilentObserverPrivate::ConstructL(QObject *parent) +{ + iHandler = CProfileChangeNotifyHandler::NewL( this ); + iParent = parent; +} + +/*! + Destroyer +*/ +SilentObserverPrivate::~SilentObserverPrivate() +{ + if (iHandler) { + delete iHandler; + iHandler = NULL; + } +} + +/*! + Handle active profile events +*/ +void SilentObserverPrivate::HandleActiveProfileEventL( + TProfileEvent /*aProfileEvent*/, + TInt /*aProfileId*/ ) +{ + // handle event + (reinterpret_cast(iParent))->changeIcon(); + +} diff -r 000000000000 -r 6be25656cbbb src/silentobserver_p_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentobserver_p_win.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,65 @@ +/* +* 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: Silent widget plugin. +* +*/ + +// User includes +#include "silentobserver_p.h" + +/*! + \class SilentObserverPrivate + \Silent observer class + + This class is used to create silent widget observer +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +SilentObserverPrivate *SilentObserverPrivate::NewL(QObject *parent) +{ +} + +/*! + Constructor +*/ +SilentObserverPrivate::SilentObserverPrivate() +{ +} + +/*! + ConstructL +*/ +void SilentObserverPrivate::ConstructL(QObject *parent) +{ +} + +/*! + Destroyer +*/ +SilentObserverPrivate::~SilentObserverPrivate() +{ +} + +/*! + Handle active profile events +*/ +void SilentObserverPrivate::HandleActiveProfileEventL( + TProfileEvent /*aProfileEvent*/, + TInt /*aProfileId*/ ) +{ +} diff -r 000000000000 -r 6be25656cbbb src/silentwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentwidget.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,203 @@ +/* +* 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: Silent widget +* +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "silentwidget.h" +#include "silentwidgetconsts.h" +#include "silentmodel.h" +#include "silentobserver.h" + +/*! + \class SilentWidget + \implementation for silent widget + + This class is used to create silent widget +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SilentWidget::SilentWidget(QGraphicsItem* parent, Qt::WindowFlags flags) + : HbWidget(parent, flags), + mButton(0), + mModel(new SilentModel), + mObserver(new SilentObserver(this)) +{ + QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout( + Qt::Vertical, this); + + // load the widget from .docml + HbDocumentLoader loader; + bool ok = false; + loader.load(":/docml/silentdocml", &ok); + if (!ok) { + // fail to load .docml file + return; + } + mButton = (HbPushButton *) loader.findWidget("pushButton"); + if (!mButton) { + // fail to find push button + return; + } + + // set icon and background + HbFrameDrawer *background = new HbFrameDrawer("qtg_fr_hsshortcut_normal", + HbFrameDrawer::NinePieces); + mButton->setFrameBackground(background); + HbFrameDrawer *foreground; + if (mModel->silenceMode()) { + foreground = new HbFrameDrawer("qtg_large_tone_off", + HbFrameDrawer::NinePieces); + } else { + foreground = new HbFrameDrawer("qtg_large_tone", + HbFrameDrawer::NinePieces); + } + HbFrameItem* frameItem = new HbFrameItem(foreground); + mButton->setBackgroundItem(frameItem); + + mButton->setCheckable(true); + mainLayout->addItem(mButton); + + connect(mButton, SIGNAL(toggled(bool)), this, SLOT(handleClickEvent(bool))); + setLayout(mainLayout); + + // create XQSettingsManager, monitor KProEngSilenceMode + mSettingManager = new XQSettingsManager(); + XQCentralRepositorySettingsKey silenceKey(KCRUidProfileEngine.iUid, + KProEngSilenceMode); + mSettingManager->startMonitoring(silenceKey, XQSettingsManager::TypeInt); + connect(mSettingManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); +} + +/*! + Monitor KProEngSilenceMode +*/ +void SilentWidget::settingValueChanged(const XQSettingsKey &key, + const QVariant &value) +{ + // change icon according to latest silence mode + if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode) { + HbFrameDrawer *foreground; + if (value.toBool()) { + foreground = new HbFrameDrawer("qtg_large_tone_off", + HbFrameDrawer::NinePieces); + } else { + foreground = new HbFrameDrawer("qtg_large_tone", + HbFrameDrawer::NinePieces); + } + HbFrameItem* frameItem = new HbFrameItem(foreground); + mButton->setBackgroundItem(frameItem); + } +} + +/*! + Handle click events +*/ +void SilentWidget::handleClickEvent(bool /*state*/) +{ + // switch icon and activate silece state + HbFrameDrawer *foreground; + if (!mModel->silenceMode()) { + mModel->setSilenceMode(true); + foreground = new HbFrameDrawer("qtg_large_tone_off", + HbFrameDrawer::NinePieces); + } else { + mModel->setSilenceMode(false); + foreground = new HbFrameDrawer("qtg_large_tone", + HbFrameDrawer::NinePieces); + } + HbFrameItem* frameItem = new HbFrameItem(foreground); + mButton->setBackgroundItem(frameItem); +} + +/*! + Change icon according to observer event +*/ +void SilentWidget::changeIcon() +{ + HbFrameDrawer *foreground; + if (mModel->silenceMode()) { + foreground = new HbFrameDrawer("qtg_large_tone_off", + HbFrameDrawer::NinePieces); + } else { + foreground = new HbFrameDrawer("qtg_large_tone", + HbFrameDrawer::NinePieces); + } + HbFrameItem* frameItem = new HbFrameItem(foreground); + mButton->setBackgroundItem(frameItem); +} + +/*! + Destructor +*/ +SilentWidget::~SilentWidget() +{ + if (mModel) { + delete mModel; + mModel = NULL; + } + + if (mSettingManager) { + delete mSettingManager; + mSettingManager = NULL; + } +} + +/*! + Return bounding rect +*/ +QRectF SilentWidget::boundingRect() const +{ + return childrenBoundingRect(); +} + +/*! + Return shape +*/ +QPainterPath SilentWidget::shape() const +{ + QPainterPath path; + path.addRect(boundingRect()); + return path; +} + +/*! + Called when widget is shown in the home screen +*/ +void SilentWidget::onShow() +{ +} + +/*! + Called when widget is hidden from the home screen +*/ +void SilentWidget::onHide() +{ +} diff -r 000000000000 -r 6be25656cbbb src/silentwidgetplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/silentwidgetplugin.cpp Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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: Silent widget plugin +* +*/ + +// System includes +#include +#include +#include + +// User includes +#include "silentwidgetplugin.h" +#include "silentwidget.h" + +/*! + \class SilentWidgetPlugin + \implementation of silent widget plugin. +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Initialize plugin for silent world widget +*/ +QObject *SilentWidgetPlugin::createInstance( + const QServiceInterfaceDescriptor &descriptor, + QServiceContext *context, + QAbstractSecuritySession *session) +{ + Q_UNUSED(context); + Q_UNUSED(session); + + if (descriptor.interfaceName() == + QLatin1String("com.nokia.symbian.IHomeScreenWidget")) { + return new SilentWidget(); + } else { + return 0; + } +} + +Q_EXPORT_PLUGIN2(silentwidgetplugin, SilentWidgetPlugin) diff -r 000000000000 -r 6be25656cbbb sysdef_1_5_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_5_1.dtd Fri Sep 17 09:20:19 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +