# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284704442 -10800 # Node ID dc71378f48908cc1a85fc945c48694ca6df53ba8 Revision: 201037 diff -r 000000000000 -r dc71378f4890 inc/profilesmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profilesmodel.h Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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: Profiles model for profiles widget +* +*/ + +#ifndef PROFILESMODEL_H +#define PROFILESMODEL_H + +// System includes +#include + +// Forward declarations +class ProfilesModelPrivate; + +// Class declaration +class ProfilesModel : public QObject +{ +public: + ProfilesModel(QObject *parent = 0); + ~ProfilesModel(); + int activeProfileId(); + int activateProfile(int profileId); + QString activeProfileName(); + +private: + Q_DISABLE_COPY(ProfilesModel) + +private: + ProfilesModelPrivate *dptr; +}; + +#endif //PROFILESMODEL_H diff -r 000000000000 -r dc71378f4890 inc/profilesmodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profilesmodel_p.h Fri Sep 17 09:20:42 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: Profiles model private +* +*/ + +#ifndef PROFILESMODEL_P_H +#define PROFILESMODEL_P_H + +// Forward declarations +class MProfileEngineExtended; +class QString; + +// Class declaration +class ProfilesModelPrivate +{ +public: + static ProfilesModelPrivate *NewL(); + ~ProfilesModelPrivate(); + int activeProfileId(); + int activateProfile(int profileId); + QString activeProfileName(); + +private: + ProfilesModelPrivate(); + void ConstructL(); + +private: + MProfileEngineExtended *mEngine; +}; + +#endif //PROFILESMODEL_P_H diff -r 000000000000 -r dc71378f4890 inc/profilesobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profilesobserver.h Fri Sep 17 09:20:42 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: Profiles model for profiles widget +* +*/ + +#ifndef PROFILESOBSERVER_H +#define PROFILESOBSERVER_H + +// System includes +#include + +// Forward declarations +class ProfilesObserverPrivate; + +// Class declaration +class ProfilesObserver : public QObject +{ +public: + ProfilesObserver(QObject *parent = 0); + ~ProfilesObserver(); + +private: + Q_DISABLE_COPY(ProfilesObserver) + +private: + ProfilesObserverPrivate *dptr; +}; + +#endif //PROFILESOBSERVER_H diff -r 000000000000 -r dc71378f4890 inc/profilesobserver_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profilesobserver_p.h Fri Sep 17 09:20:42 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: Profiles model private +* +*/ + +#ifndef PROFILESOBSERVER_P_H +#define PROFILESOBSERVER_P_H + +// System includes +#include +#include +#include + +// Forward declarations +class CProfileChangeNotifyHandler; + +// Class declaration +class ProfilesObserverPrivate : public CBase, public MProfileChangeObserver +{ +public: + static ProfilesObserverPrivate* NewL(QObject *parent); + ProfilesObserverPrivate(); + ~ProfilesObserverPrivate(); + +private: + void ConstructL(QObject *parent); + virtual void HandleActiveProfileEventL( + TProfileEvent aProfileEvent, + TInt aProfileId); + +private: + CProfileChangeNotifyHandler *iHandler; + QObject *iParent; +}; + +#endif //PROFILESOBSERVER_P_H diff -r 000000000000 -r dc71378f4890 inc/profileswidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profileswidget.h Fri Sep 17 09:20:42 2010 +0300 @@ -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: Profiles widget +* +*/ + +#ifndef PROFILESWIDGET_H +#define PROFILESWIDGET_H + +// System includes +#include + +// Forward declarations +class HbPushButton; +class ProfilesModel; +class ProfilesObserver; + +// Class declaration +class ProfilesWidget : public HbWidget +{ + Q_OBJECT + +public: + ProfilesWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0); + ~ProfilesWidget(); + QRectF boundingRect() const; + QPainterPath shape() const; + void changeIcon(); + +public slots: + void onShow(); + void onHide(); + +private slots: + void onButtonPressed(); + +private: + Q_DISABLE_COPY(ProfilesWidget) + HbPushButton *mButton; + ProfilesModel *mModel; + ProfilesObserver *mObserver; +}; + +#endif //PROFILESWIDGET_H diff -r 000000000000 -r dc71378f4890 inc/profileswidgetconsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profileswidgetconsts.h Fri Sep 17 09:20:42 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: Profiles widget constants +* +*/ + +#ifndef PROFILESWIDGETCONSTS_H +#define PROFILESWIDGETCONSTS_H + +const int ProfilesWidgetGeneralProfileId = 0; +const int ProfilesWidgetSilentProfileId = 1; +const int ProfilesWidgetMeetingProfileId = 2; + +#endif //PROFILESWIDGETCONSTS_H diff -r 000000000000 -r dc71378f4890 inc/profileswidgetplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/profileswidgetplugin.h Fri Sep 17 09:20:42 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: Profiles widget plugin +* +*/ + +#ifndef PROFILESWIDGETPLUGIN_H +#define PROFILESWIDGETPLUGIN_H + +// System includes +#include +#include + +// Class declaration +QTM_USE_NAMESPACE +class ProfilesWidgetPlugin : public QObject, public QServicePluginInterface +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QServicePluginInterface) + +public: + QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, + QServiceContext *context, QAbstractSecuritySession *session); +}; + +#endif // PROFILESWIDGETPLUGIN_H diff -r 000000000000 -r dc71378f4890 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,19 @@ + + +]> + + + + + + + + + + + + + + + diff -r 000000000000 -r dc71378f4890 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r dc71378f4890 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 000000000000 -r dc71378f4890 profileswidgetplugin.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profileswidgetplugin.docml Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r dc71378f4890 profileswidgetplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profileswidgetplugin.pri Fri Sep 17 09:20:42 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: Profiles widget +# + +HEADERS += ./inc/*.h +SOURCES += src/profileswidgetplugin.cpp \ + src/profileswidget.cpp \ + src/profilesmodel.cpp \ + src/profilesobserver.cpp \ + +symbian : { + SOURCES += src/profilesmodel_p_symbian.cpp \ + src/profilesobserver_p_symbian.cpp +} + +win32 : { + SOURCES += src/profilesmodel_p_win.cpp \ + src/profilesobserver_p_win.cpp +} \ No newline at end of file diff -r 000000000000 -r dc71378f4890 profileswidgetplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profileswidgetplugin.pro Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,70 @@ +# +# 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: Profiles widget +# + +TEMPLATE = lib +CONFIG += plugin mobility hb +MOBILITY = serviceframework + +include(../../common.pri) +include(profileswidgetplugin.pri) +include(rom/profileswidgetplugin_rom.pri) + +INCLUDEPATH += ./inc +RESOURCES += resources.qrc + +TRANSLATIONS = profiles_widget.ts + +symbian: { + + PLUGIN_SUBDIR = /private/20022F35/import/widgetregistry/2002EAD2 + + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.UID3 = 0x2002EAD2 + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = ALL -TCB + + LIBS += -lprofileeng -lxqutils + + 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/2002EAD2 + + DESTDIR = $$PWD/../../../../../bin/$${SUBDIRPART}/$${PLUGIN_SUBDIR} + + manifest.path = $${DESTDIR} + manifest.files = ./resource/*.manifest ./resource/*.xml ./resource/*.png + + INSTALLS += manifest + +} diff -r 000000000000 -r dc71378f4890 resource/profileswidgetplugin.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/profileswidgetplugin.manifest Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,10 @@ + + + profileswidgetplugin + txt_applib_grid_profiles_widget + Change profiles. + profileswidgetplugin.png + false + profileswidgetplugin.xml + profiles_widget + diff -r 000000000000 -r dc71378f4890 resource/profileswidgetplugin.png Binary file resource/profileswidgetplugin.png has changed diff -r 000000000000 -r dc71378f4890 resource/profileswidgetplugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/profileswidgetplugin.xml Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,14 @@ + + + profileswidgetplugin + profileswidgetplugin + Profiles Widget + + com.nokia.symbian.IHomeScreenWidget + 1.0 + Profiles Widget + + profileswidgetplugin.png + Profiles Widget + + diff -r 000000000000 -r dc71378f4890 resource/profileswidgetplugin.xml_for_sisx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resource/profileswidgetplugin.xml_for_sisx Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,14 @@ + + + profileswidgetplugin + c:/private/20022F35/import/widgetregistry/2002EAD2/profileswidgetplugin.qtplugin + Profiles Widget + + com.nokia.symbian.IHomeScreenWidget + 1.0 + Profiles Widget + + profileswidgetplugin.png + Profiles Widget + + diff -r 000000000000 -r dc71378f4890 resources.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resources.qrc Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,6 @@ + + + + profileswidgetplugin.docml + + diff -r 000000000000 -r dc71378f4890 rom/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/bld.inf Fri Sep 17 09:20:42 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 + +profileswidgetplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(profileswidgetplugin.iby) +profileswidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(profileswidgetplugin_resources.iby) diff -r 000000000000 -r dc71378f4890 rom/profileswidgetplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/profileswidgetplugin.iby Fri Sep 17 09:20:42 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 profileswidgetplugin component + * + */ + +#ifndef PROFILESWIDGETPLUGIN_IBY +#define PROFILESWIDGETPLUGIN_IBY + +#include +#include + +file=ABI_DIR\BUILD_DIR\profileswidgetplugin.dll SHARED_LIB_DIR\profileswidgetplugin.dll + +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD2\profileswidgetplugin.qtplugin private\20022f35\import\widgetregistry\2002EAD2\profileswidgetplugin.qtplugin +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD2\profileswidgetplugin.manifest private\20022f35\import\widgetregistry\2002EAD2\profileswidgetplugin.manifest +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD2\profileswidgetplugin.png private\20022f35\import\widgetregistry\2002EAD2\profileswidgetplugin.png +data=ZPRIVATE\20022F35\import\widgetregistry\2002EAD2\profileswidgetplugin.xml private\20022f35\import\widgetregistry\2002EAD2\profileswidgetplugin.xml + +#endif // PROFILESWIDGETPLUGIN_IBY + +// End of file --Don't remove this. \ No newline at end of file diff -r 000000000000 -r dc71378f4890 rom/profileswidgetplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/profileswidgetplugin_resources.iby Fri Sep 17 09:20:42 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 __PROFILESWIDGETRLUGIN_RESOURCE_IBY__ +#define __PROFILESWIDGETRLUGIN_RESOURCE_IBY__ + +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\profiles_widget.qm QT_TRANSLATIONS_DIR\profiles_widget.qm + +#endif \ No newline at end of file diff -r 000000000000 -r dc71378f4890 rom/profileswidgetplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/profileswidgetplugin_rom.pri Fri Sep 17 09:20:42 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/profileswidgetplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(profileswidgetplugin.iby)" \ + "rom/profileswidgetplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(profileswidgetplugin_resources.iby)" +} \ No newline at end of file diff -r 000000000000 -r dc71378f4890 src/profilesmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profilesmodel.cpp Fri Sep 17 09:20:42 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: Profiles model +* +*/ + +// User includes +#include "profilesmodel.h" +#include "profilesmodel_p.h" +#include "profileswidgetconsts.h" + +/*! + \class ProfilesModelPrivate + \profiles widget model class + + This class is used to create profiles widget model +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +ProfilesModel::ProfilesModel(QObject *parent/*= 0*/) + : QObject(parent) +{ + QT_TRAP_THROWING(dptr = ProfilesModelPrivate::NewL()); +} + +/*! + Destroyer +*/ +ProfilesModel::~ProfilesModel() +{ + delete dptr; +} + +/*! + Get the actived profile ID +*/ +int ProfilesModel::activeProfileId() +{ + return dptr->activeProfileId(); +} + +/*! + Set active profile to specified ID +*/ +int ProfilesModel::activateProfile(int profileId) +{ + return dptr->activateProfile(profileId); +} + +/*! + Get actived profile name +*/ +QString ProfilesModel::activeProfileName() +{ + return dptr->activeProfileName(); +} diff -r 000000000000 -r dc71378f4890 src/profilesmodel_p_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profilesmodel_p_symbian.cpp Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,104 @@ +/* +* 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: Profiles widget plugin. +* +*/ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "profilesmodel_p.h" +#include "profileswidgetconsts.h" + +/*! + \class ProfilesModelPrivate + \profiles widget model class + + This class is used to create profiles widget model +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +ProfilesModelPrivate* ProfilesModelPrivate::NewL() +{ + ProfilesModelPrivate *self = new (ELeave)ProfilesModelPrivate(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; +} + +/*! + Constructor +*/ +ProfilesModelPrivate::ProfilesModelPrivate() +{ + mEngine = NULL; +} + +/*! + ConstructL +*/ +void ProfilesModelPrivate::ConstructL() +{ + mEngine = CreateProfileEngineExtendedL(); +} + +/*! + Destroyer +*/ +ProfilesModelPrivate::~ProfilesModelPrivate() +{ + mEngine->Release(); +} + +/*! + Get the actived profile ID +*/ +int ProfilesModelPrivate::activeProfileId() +{ + return mEngine->ActiveProfileId(); +} + +/*! + Set active profile to specified ID +*/ +int ProfilesModelPrivate::activateProfile(int profileId) +{ + TRAPD(err, mEngine->SetActiveProfileL(profileId)); + return err; +} + +/*! + Get actived profile name +*/ +QString ProfilesModelPrivate::activeProfileName() +{ + MProfile *lProfile = mEngine->ActiveProfileL(); + CleanupReleasePushL(*lProfile); + + const MProfileName &lMProfileName = lProfile->ProfileName(); + TBuf<10> lProfileName = lMProfileName.Name(); + CleanupStack::PopAndDestroy(); + QString profileName = XQConversions::s60DescToQString(lProfileName); + return profileName; +} diff -r 000000000000 -r dc71378f4890 src/profilesmodel_p_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profilesmodel_p_win.cpp Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,81 @@ +/* +* 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: Profiles widget model +* +*/ + +// User includes +#include "profilesmodel_p.h" + +/*! + \class ProfilesModelPrivate + \profiles widget model class + + This class is used to create profiles widget model +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +ProfilesModelPrivate* ProfilesModelPrivate::NewL() +{ +} + +/*! + Constructor +*/ +ProfilesModelPrivate::ProfilesModelPrivate() +{ +} + +/*! + ConstructL +*/ +void ProfilesModelPrivate::ConstructL() +{ +} + +/*! + Destroyer +*/ +ProfilesModelPrivate::~ProfilesModelPrivate() +{ + +} + +/*! + Get the actived profile ID +*/ +int ProfilesModelPrivate::activeProfileId() +{ + return 0; +} + +/*! + Set active profile to specified ID +*/ +int ProfilesModelPrivate::activateProfile(int) +{ + return 0; +} + +/*! + Get actived profile name +*/ +QString ProfilesModelPrivate::activeProfileName() +{ + return NULL; +} diff -r 000000000000 -r dc71378f4890 src/profilesobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profilesobserver.cpp Fri Sep 17 09:20:42 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: Profiles widget +* +*/ + +// User includes +#include "profilesobserver.h" +#include "profilesobserver_p.h" + +/*! + \class ProfilesObserver + \profiles widget observer + + This class is used to create profiles widget observer +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +ProfilesObserver::ProfilesObserver(QObject *parent/*= 0*/) + : QObject(parent) +{ + QT_TRAP_THROWING(dptr = ProfilesObserverPrivate::NewL(parent)); +} + +/*! + Destroyer +*/ +ProfilesObserver::~ProfilesObserver() +{ + delete dptr; +} diff -r 000000000000 -r dc71378f4890 src/profilesobserver_p_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profilesobserver_p_symbian.cpp Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Profiles widget plugin. +* +*/ + +// System includes +#include + +// User includes +#include "profilesobserver_p.h" +#include "profileswidget.h" + +/*! + \class ProfilesObserverPrivate + \profiles observer class + + This class is used to create profiles observer +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +ProfilesObserverPrivate* ProfilesObserverPrivate::NewL(QObject *parent) +{ + ProfilesObserverPrivate* self = new (ELeave) ProfilesObserverPrivate(); + CleanupStack::PushL(self); + self->ConstructL(parent); + CleanupStack::Pop(); //self + return self; +} + +/*! + Constructor +*/ +ProfilesObserverPrivate::ProfilesObserverPrivate() +{ +} + +/*! + ConstructL +*/ +void ProfilesObserverPrivate::ConstructL(QObject *parent) +{ + iHandler = CProfileChangeNotifyHandler::NewL(this); + iParent = parent; +} + +/*! + Destroyer +*/ +ProfilesObserverPrivate::~ProfilesObserverPrivate() +{ + if(iHandler) { + delete iHandler; + iHandler = NULL; + } +} + +/*! + Handle the active profile events +*/ +void ProfilesObserverPrivate::HandleActiveProfileEventL( + TProfileEvent /*aProfileEvent*/, + TInt /*aProfileId*/ ) +{ + // handle event + (reinterpret_cast(iParent))->changeIcon(); +} diff -r 000000000000 -r dc71378f4890 src/profilesobserver_p_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profilesobserver_p_win.cpp Fri Sep 17 09:20:42 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: Profiles widget plugin. +* +*/ + +// User includes +#include "profilesobserver_p.h" + +/*! + \class ProfilesObserverPrivate + \profiles observer class + + This class is used to create profiles observer +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +ProfilesObserverPrivate* ProfilesObserverPrivate::NewL(QObject *parent) +{ +} + +/*! + Constructor +*/ +ProfilesObserverPrivate::ProfilesObserverPrivate() +{ +} + +/*! + ConstructL +*/ +void ProfilesObserverPrivate::ConstructL(QObject *parent) +{ +} + +/*! + Destroyer +*/ +ProfilesObserverPrivate::~ProfilesObserverPrivate() +{ +} + +/*! + Handle the active profile events +*/ +void ProfilesObserverPrivate::HandleActiveProfileEventL( + TProfileEvent aProfileEvent, + TInt aProfileId ) +{ +} diff -r 000000000000 -r dc71378f4890 src/profileswidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profileswidget.cpp Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,136 @@ +/* +* 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: Profiles widget +* +*/ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "profileswidget.h" +#include "profileswidgetconsts.h" +#include "profilesmodel.h" +#include "profilesobserver.h" + +/*! + \class ProfilesWidget + \implementation for home screen profiles widget +*/ + +/*! + Constructor +*/ +ProfilesWidget::ProfilesWidget(QGraphicsItem* parent, Qt::WindowFlags flags) + : HbWidget(parent, flags), + mButton(0), + mModel(new ProfilesModel), + mObserver(new ProfilesObserver(this)) +{ + //QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this); + QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout( + Qt::Vertical, this); + + // load the widget from .docml + HbDocumentLoader loader; + bool ok = false; + loader.load(":/profileswidgetplugin", &ok); + if (!ok) { + // fail to load .docml file + return; + } + mButton = (HbPushButton *) loader.findWidget("pushButton"); + if (!mButton) { + // fail to find push button + return; + } + + mButton->setText(mModel->activeProfileName()); + HbFrameDrawer *background = new HbFrameDrawer("qtg_fr_hsshortcut_normal", + HbFrameDrawer::NinePieces); + mButton->setFrameBackground(background); + mainLayout->addItem(mButton); + connect(mButton, SIGNAL(pressed()), this, SLOT(onButtonPressed())); + + setLayout(mainLayout); +} + +/*! + Handle toggled event of button +*/ +void ProfilesWidget::onButtonPressed() +{ + int profileId = mModel->activeProfileId(); + if (profileId != ProfilesWidgetGeneralProfileId) { + mModel->activateProfile(ProfilesWidgetGeneralProfileId); + } else { + mModel->activateProfile(ProfilesWidgetMeetingProfileId); + } + mButton->setText(mModel->activeProfileName()); +} + +/*! + Change icon of widget +*/ +void ProfilesWidget::changeIcon() +{ + mButton->setText(mModel->activeProfileName()); +} + +/*! + Destroyer +*/ +ProfilesWidget::~ProfilesWidget() +{ + if (mModel) { + delete mModel; + mModel = NULL; + } +} + +/*! + Return bounding rect +*/ +QRectF ProfilesWidget::boundingRect() const +{ + return childrenBoundingRect(); +} + +/*! + Return shape +*/ +QPainterPath ProfilesWidget::shape() const +{ + QPainterPath path; + path.addRect(boundingRect()); + return path; +} + +/*! + Called when widget is shown in the home screen +*/ +void ProfilesWidget::onShow() +{ +} + +/*! + Called when widget is hidden from the home screen +*/ +void ProfilesWidget::onHide() +{ +} diff -r 000000000000 -r dc71378f4890 src/profileswidgetplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/profileswidgetplugin.cpp Fri Sep 17 09:20:42 2010 +0300 @@ -0,0 +1,51 @@ +/* +* 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: Profiles widget plugin +* +*/ + +// System includes +#include +#include +#include + +// User includes +#include "profileswidgetplugin.h" +#include "profileswidget.h" + +/*! + \class ProfilesWidgetPlugin + \implementation of profiles widget plugin +*/ + +/*! + Initialize plugin of profiles widget +*/ +QObject *ProfilesWidgetPlugin::createInstance(const + QServiceInterfaceDescriptor &descriptor, + QServiceContext *context, + QAbstractSecuritySession *session) +{ + Q_UNUSED(context); + Q_UNUSED(session); + + if (descriptor.interfaceName() == + QLatin1String("com.nokia.symbian.IHomeScreenWidget")) { + return new ProfilesWidget(); + } else { + return 0; + } +} + +Q_EXPORT_PLUGIN2(profileswidgetplugin, ProfilesWidgetPlugin) diff -r 000000000000 -r dc71378f4890 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:42 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +