# HG changeset patch # User hgs # Date 1286370384 -10800 # Node ID 66b5fe3c07fd768e42b1092f43aeecbe87cf83e2 # Parent 32e56106abf21357ac62f37d0f001045374c0092 201039_01 diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/homescreenclient_api.pri --- a/homescreen_plat/homescreenclient_api/homescreenclient_api.pri Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreen_plat/homescreenclient_api/homescreenclient_api.pri Wed Oct 06 16:06:24 2010 +0300 @@ -15,4 +15,4 @@ # PLATFORM_HEADERS += \ - homescreenclient_api/hsmenuclient.h \ No newline at end of file + homescreenclient_api/inc/hsmenuclient.h \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/hsmenuclient.h --- a/homescreen_plat/homescreenclient_api/hsmenuclient.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * 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: hsmenuclient.h - * - */ - -#ifndef HSMENUCLIENT_H -#define HSMENUCLIENT_H - -#include -#include -#include - -QTM_USE_NAMESPACE - -//mandatory keys -const QString hsItemName("item:name"); -// or for localized name -const QString hsItemLocName("item:locname"); - -const QString hsitemLaunchUri("item:launchuri"); -const QString hsitemPublisherId("item:publisherId"); - -//not mandatory -const QString hsItemWidgetUri("widget:uri"); -const QString hsItemDescription("item:description"); -// or for localized name -const QString hsItemLocDescription("item:locdescription"); - -//for icon - not mandatory -const QString hsIconFileName("icon:filename");//to display specific icon from file -const QString hsIconName("icon:name");// HbIcon -const QString hsIconApplicationId("icon:applicationid"); // icon from associated application - - -class HsMenuClientPrivate; - -class HsMenuClient : public QObject -{ - Q_OBJECT - -public: - HsMenuClient(QObject *parent = 0); - ~HsMenuClient(); -public slots: - bool add(const QVariantMap &entryPreference = QVariantMap()); - bool remove(const QVariantMap &queryPreference = QVariantMap()) const; - - QList getList(const QVariantMap &queryPreference = QVariantMap()); - -private: - Q_DISABLE_COPY(HsMenuClient) - /** - * Pointer to a private implementation. - */ - HsMenuClientPrivate * const m_d; -}; - - - -#endif // HSMENUCLIENT_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/inc/hsmenuclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/inc/hsmenuclient.h Wed Oct 06 16:06:24 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: hsmenuclient.h + * + */ + +#ifndef HSMENUCLIENT_H +#define HSMENUCLIENT_H + +#include +#include +#include + +QTM_USE_NAMESPACE + +//mandatory keys +const QString hsItemName("item:name"); +// or for localized name +const QString hsItemLocName("item:locname"); + +const QString hsitemLaunchUri("item:launchuri"); +const QString hsitemPublisherId("item:publisherId"); + +//not mandatory +const QString hsItemWidgetUri("widget:uri"); +const QString hsItemDescription("item:description"); +// or for localized name +const QString hsItemLocDescription("item:locdescription"); + +//for icon - not mandatory +const QString hsIconFileName("icon:filename");//to display specific icon from file +const QString hsIconName("icon:name");// HbIcon +const QString hsIconApplicationId("icon:applicationid"); // icon from associated application + + +class HsMenuClientPrivate; + +class HsMenuClient : public QObject +{ + Q_OBJECT + +public: + HsMenuClient(QObject *parent = 0); + ~HsMenuClient(); +public slots: + bool add(const QVariantMap &entryPreference = QVariantMap()); + bool remove(const QVariantMap &queryPreference = QVariantMap()) const; + + QList getList(const QVariantMap &queryPreference = QVariantMap()); + +private: + Q_DISABLE_COPY(HsMenuClient) + /** + * Pointer to a private implementation. + */ + HsMenuClientPrivate * const m_d; +}; + + + +#endif // HSMENUCLIENT_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/inc/caservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/inc/caservice_p.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,54 @@ +/* + * 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: caservice_p.h + * + */ + +#ifndef CASERVICE_PRIVATE_H +#define CASERVICE_PRIVATE_H + +#include +#include + +class QString; +class CaQuery; +class CaServicePrivate +{ + +public: + ~CaServicePrivate() { + clearAll(); + } + + QList< QSharedPointer > mCreatedEntries; + QList< QSharedPointer > mReturnedEntries; + int mEntryToRemove; + QSharedPointer mUpdatedEntry; + CaQuery* mQueryPassedToGetList; + + void AddEntriesForUpdate(); + void clearAll(); + static CaServicePrivate& instance() { + static CaServicePrivate caServicePrivate; + return caServicePrivate; + } + +private: + + explicit CaServicePrivate(): mUpdatedEntry (NULL), mQueryPassedToGetList (NULL) + { + } +}; + +#endif //CASERVICE_PRIVATE_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/inc/t_hsmenuclientplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/inc/t_hsmenuclientplugin.h Wed Oct 06 16:06:24 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: Tests for hsmenuclientplugin class. +* +*/ + +#ifndef T_HSMMENUCLIENTPLUGINTEST_H +#define T_HSMMENUCLIENTPLUGINTEST_H + +#include +#include + +#ifdef Q_OS_SYMBIAN +#include +#endif//Q_OS_SYMBIAN + +#include "caservice_p.h" //mock +/** +* @test Test class for homescreen::hsutils modules. +*/ +class HsMenuClientPluginTest : public QObject +{ + Q_OBJECT + +private slots: + + void initTestCase(); + void init(); + + void testCreateEntry(); + void testCreateLocalizedEntry(); + void testUpdateEntry(); + void testRemoveEntry(); + void testListEntry(); + + + /** + * cleanup + */ + void cleanupTestCase(); + void cleanup(); + +private: + CaServicePrivate *mCaServicePrivateMock; + +}; + +#endif //T_HSMMENUCLIENTPLUGINTEST_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/src/caservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/src/caservice.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,426 @@ +/* + * 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: caservice.cpp + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "hsapp_defs.h" +#include "t_hsmenuclientplugin.h" +#include "hsmenuclient.h" + + +// ======== MEMBER FUNCTIONS ======== + +/*! + + \class CaService. + \brief This class operates on data, anable creating and inserting new entry + to DB, removing entry from DB, update entry or get entry from DB, executeC + command on entry and create notifier to notify client about changes onto DB. + + CaService class uses singleton design pattern, so that it contains static + method called instance() to get instance of a class. + + \code + QSharedPointer service = CaService::instance(); + \endcode + + For every operations on data is used always one instantiation of a class. + Below are examples how to create data and work on those ones. + + */ + +// Initialization of a static member variable. +//QWeakPointer CaService::m_instance = QWeakPointer(); + +/*! + Constructor. + \param parent pointer to a parent. It defaults to NULL. + */ +CaService::CaService(QObject *parent) : + QObject(parent), m_d(&CaServicePrivate::instance()) +{ + +} + +/*! + Returns a pointer to the instance of the CaService class. + \retval A pointer to the instance of the CaService class. + */ +QSharedPointer CaService::instance() +{ + static QSharedPointer instance (new CaService); + return instance; +} + +/*! + Destructor. + */ +CaService::~CaService() +{ + +} + +// HELP METHODS + +void CaServicePrivate::clearAll() +{ + mEntryToRemove = -1; + + mUpdatedEntry.clear(); + + delete mQueryPassedToGetList; + mQueryPassedToGetList = NULL; + + mCreatedEntries.clear(); + mReturnedEntries.clear(); +} + +void CaServicePrivate::AddEntriesForUpdate() +{ + QSharedPointer item0 (new CaEntry()); + + // this will be updated: + QSharedPointer item1 (new CaEntry()); + item1->setText("ModuleTestTApp"); + item1->setDescription("Unit test app for HsClientPlugin"); + + item1->setAttribute(hsitemLaunchUri, "appto://2002DCEC?"); + item1->setAttribute(hsitemPublisherId, "tappModuleTest"); + item1->setAttribute(hsitemLaunchUri, "hsclockwidgetplugin"); + + item1->setEntryTypeName(Hs::templatedApplicationTypeName); + item1->setFlags(VisibleEntryFlag); + + CaIconDescription iconDescription1; + iconDescription1.setFilename("iconFileName"); + iconDescription1.setSkinId("iconSkinId"); + iconDescription1.setApplicationId("268458321"); //Bluetouth app UID + item1->setIconDescription(iconDescription1); + + mCreatedEntries << item0; + mCreatedEntries << item1; +} +QSharedPointer CaService::getEntry(int entryId) const +{ + return m_d->mCreatedEntries.at(entryId); +} + + +bool CaService::updateEntry(const CaEntry &entry) const +{ + m_d->mUpdatedEntry.clear(); + m_d->mUpdatedEntry = QSharedPointer(new CaEntry(entry)); + return true; +} + +QSharedPointer CaService::createEntry(const CaEntry &entry) const +{ + QSharedPointer newEntry(new CaEntry(entry)); + m_d->mCreatedEntries << newEntry; + return newEntry; +} + + +bool CaService::removeEntry(int entryId) const +{ + m_d->mEntryToRemove = entryId; + + return true; +} + + +QList< QSharedPointer > CaService::getEntries( + const QList &entryIdList) const +{ + Q_UNUSED(entryIdList); + QList< QSharedPointer > result; + return result; + +} + +QList< QSharedPointer > CaService::getEntries(const CaQuery &query) const +{ + // store the query for verification + m_d->mQueryPassedToGetList = new CaQuery (query); + + // return mock list of 2 entires + QSharedPointer item1 (new CaEntry()); + item1->setText("ModuleTestTApp1"); + item1->setDescription("Unit test app for HsClientPlugin1"); + item1->setAttribute(hsitemLaunchUri, "appto://1002DCEC?"); + item1->setAttribute(hsitemPublisherId, "tappModuleTest1"); + item1->setAttribute(hsitemLaunchUri, "hsclockwidgetplugin1"); + item1->setEntryTypeName(Hs::templatedApplicationTypeName); + item1->setFlags(VisibleEntryFlag); + CaIconDescription iconDescription1; + iconDescription1.setFilename("iconFileName1"); + iconDescription1.setSkinId("iconSkinId1"); + iconDescription1.setApplicationId("168458321"); + item1->setIconDescription(iconDescription1); + + QSharedPointer item2 (new CaEntry()); + item2->setText("ModuleTestTApp2"); + item2->setDescription("Unit test app for HsClientPlugin2"); + item2->setAttribute(hsitemLaunchUri, "appto://2002DCEC?"); + item2->setAttribute(hsitemPublisherId, "tappModuleTest2"); + item2->setAttribute(hsitemLaunchUri, "hsclockwidgetplugin2"); + item2->setEntryTypeName(Hs::templatedApplicationTypeName); + item2->setFlags(VisibleEntryFlag); + CaIconDescription iconDescription2; + iconDescription2.setFilename("iconFileName2"); + iconDescription2.setSkinId("iconSkinId2"); + iconDescription2.setApplicationId("268458321"); + item2->setIconDescription(iconDescription2); + + // store items for verification + m_d->mReturnedEntries << item1 << item2; + + // return copies to caller + QList< QSharedPointer > resultList; + resultList << item1; + resultList << item2; + + return resultList; +} + +QList CaService::getEntryIds(const CaQuery &query) const +{ + Q_UNUSED(query); + QList result; + return result; + +} + + + +bool CaService::removeEntry(const CaEntry &entry) const +{ + return removeEntry(entry.id()); +} + + +bool CaService::removeEntries(const QList &entryIdList) const +{ + Q_UNUSED(entryIdList); + return true; +} + + +bool CaService::removeEntries( + const QList< QSharedPointer > &entryList) const +{ + Q_UNUSED(entryList); + return true; +} + +bool CaService::touch(const CaEntry &entry) const +{ + Q_UNUSED(entry); + return true; +} + + +bool CaService::insertEntryIntoGroup(int groupId, int entryId, + int beforeEntryId) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryId); + Q_UNUSED(beforeEntryId); + return true; +} + + +bool CaService::insertEntryIntoGroup( + const CaEntry &group, const CaEntry &entry, int beforeEntryId) const +{ + Q_UNUSED(group); + Q_UNUSED(entry); + Q_UNUSED(beforeEntryId); + return true; +} + + +bool CaService::insertEntriesIntoGroup(int groupId, + const QList &entryIdList, int beforeEntryId) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryIdList); + Q_UNUSED(beforeEntryId); + return true; +} + + +bool CaService::insertEntriesIntoGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList, + int beforeEntryId) const +{ + Q_UNUSED(group); + Q_UNUSED(entryList); + Q_UNUSED(beforeEntryId); + return true; +} + + +bool CaService::removeEntryFromGroup(int groupId, int entryId) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryId); + return true; +} + + +bool CaService::removeEntryFromGroup(const CaEntry &group, + const CaEntry &entry) const +{ + Q_UNUSED(group); + Q_UNUSED(entry); + return true; +} + + +bool CaService::removeEntriesFromGroup(int groupId, + const QList &entryIdList) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryIdList); + return true; +} + + +bool CaService::removeEntriesFromGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList) const +{ + Q_UNUSED(group); + Q_UNUSED(entryList); + return true; +} + + +bool CaService::appendEntryToGroup(int groupId, int entryId) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryId); + return true; +} + + +bool CaService::appendEntryToGroup(const CaEntry &group, + const CaEntry &entry) const +{ + Q_UNUSED(group); + Q_UNUSED(entry); + return true; +} + + +bool CaService::appendEntriesToGroup(int groupId, + const QList &entryIdList) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryIdList); + return true; +} + + +bool CaService::appendEntriesToGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList) const +{ + Q_UNUSED(group); + Q_UNUSED(entryList); + return true; +} + + +bool CaService::prependEntryToGroup(int groupId, int entryId) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryId); + return true; +} + + +bool CaService::prependEntryToGroup(const CaEntry &group, + const CaEntry &entry) const +{ + Q_UNUSED(group); + Q_UNUSED(entry); + return true; +} + +bool CaService::prependEntriesToGroup(int groupId, + const QList &entryIdList) const +{ + Q_UNUSED(groupId); + Q_UNUSED(entryIdList); + return true; +} + +bool CaService::prependEntriesToGroup(const CaEntry &group, + const QList< QSharedPointer > &entryList) const +{ + Q_UNUSED(group); + Q_UNUSED(entryList); + return true; +} + +int CaService::executeCommand(int entryId, const QString &command, + QObject* receiver, const char* member) const +{ + Q_UNUSED(entryId); + Q_UNUSED(command); + Q_UNUSED(receiver); + Q_UNUSED(member); + return 0; +} + +int CaService::executeCommand(const CaEntry &entry, const QString &command, + QObject* receiver, const char* member) const +{ + Q_UNUSED(entry); + Q_UNUSED(command); + Q_UNUSED(receiver); + Q_UNUSED(member); + return 0; +} + +CaNotifier *CaService::createNotifier(const CaNotifierFilter &filter) const +{ + Q_UNUSED(filter); + return NULL; +} + + +bool CaService::customSort(int groupId, QList &entryIdList) const +{ + Q_UNUSED(entryIdList); + return true; +} + +ErrorCode CaService::lastError() const +{ + return NoErrorCode; +} diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/src/t_hsmenuclientplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/src/t_hsmenuclientplugin.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,349 @@ +/* +* 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 test library. +* +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include "t_hsmenuclientplugin.h" +#include "hsmenuclient.h" + +const QString hsItemId("id"); + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void HsMenuClientPluginTest::initTestCase() +{ + mCaServicePrivateMock = &CaServicePrivate::instance(); +// mainWindow(); +} + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void HsMenuClientPluginTest::init() +{ + mCaServicePrivateMock->clearAll(); +} + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void HsMenuClientPluginTest::cleanupTestCase() +{ + +// delete mainWindow(); + +} + +void HsMenuClientPluginTest::cleanup() +{ + mCaServicePrivateMock->clearAll(); + qApp->processEvents(); +} + +void HsMenuClientPluginTest::testCreateEntry() +{ + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARK; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN + { + QList list; + QMap map; + map[hsItemName] = "ModuleTestTApp"; + map[hsItemDescription] = "Unit test app for HsClientPlugin"; + + map[hsitemLaunchUri] = "appto://2002DCEC?"; + map[hsitemPublisherId] = "tappModuleTest"; + map[hsItemWidgetUri] = "hsclockwidgetplugin"; + + map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\tclock.png"; + map[hsIconName] = "qtg_large_applications_user"; + map[hsIconApplicationId] = "268458321"; + + + + HsMenuClient *publisher = new HsMenuClient(); + QVERIFY(publisher->add(map)); + + QSharedPointer res_entry = mCaServicePrivateMock->mCreatedEntries[0]; + + + QCOMPARE(res_entry->entryTypeName(), + QString(Hs::templatedApplicationTypeName)); + QCOMPARE(res_entry->role(), ItemEntryRole); + QCOMPARE(res_entry->text(), map[hsItemName].toString()); + QCOMPARE(res_entry->description(), map[hsItemDescription].toString()); + + QCOMPARE(res_entry->attributes().count(), 3); + QCOMPARE(res_entry->attribute(hsitemLaunchUri), map[hsitemLaunchUri].toString()); + QCOMPARE(res_entry->attribute(hsitemPublisherId), map[hsitemPublisherId].toString()); + QCOMPARE(res_entry->attribute(hsItemWidgetUri), map[hsItemWidgetUri].toString()); + + // icon + QCOMPARE(res_entry->iconDescription().filename(), map[hsIconFileName].toString()); + QCOMPARE(res_entry->iconDescription().skinId(),map[hsIconName].toString()); + QCOMPARE(res_entry->iconDescription().applicationId(), map[hsIconApplicationId].toString()); + + QCOMPARE(res_entry->flags(), VisibleEntryFlag); // Visible by default, entry not removable + + delete publisher; + + } + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARKEND; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN +} + +void HsMenuClientPluginTest::testCreateLocalizedEntry() +{ + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARK; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN + { + QList list; + QMap map; + QString testName("Games"); + QString testDesc(""); + map[hsItemName] = "ModuleTestTApp"; + map[hsItemLocName] = "loc://emailTest/txt_applib_dblist_games"; + map[hsItemDescription] = "Unit test app for HsClientPlugin"; + map[hsItemLocDescription] = "loc://emailTest/txt_applib_subtitle_office"; + + map[hsitemLaunchUri] = "appto://2002DCEC?"; + map[hsitemPublisherId] = "tappModuleTest"; + map[hsItemWidgetUri] = "hsclockwidgetplugin"; + + map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\tclock.png"; + map[hsIconName] = "qtg_large_applications_user"; + map[hsIconApplicationId] = "268458321"; + + + + HsMenuClient *publisher = new HsMenuClient(); + QVERIFY(publisher->add(map)); + + QSharedPointer res_entry = mCaServicePrivateMock->mCreatedEntries[0]; + + + QCOMPARE(res_entry->entryTypeName(), + QString(Hs::templatedApplicationTypeName)); + QCOMPARE(res_entry->role(), ItemEntryRole); + QCOMPARE(res_entry->text(), map[hsItemLocName].toString()); + QCOMPARE(res_entry->description(), map[hsItemLocDescription].toString()); + + QCOMPARE(res_entry->attribute(hsitemLaunchUri), map[hsitemLaunchUri].toString()); + QCOMPARE(res_entry->attribute(hsitemPublisherId), map[hsitemPublisherId].toString()); + QCOMPARE(res_entry->attribute(hsItemWidgetUri), map[hsItemWidgetUri].toString()); + + // icon + QCOMPARE(res_entry->iconDescription().filename(), map[hsIconFileName].toString()); + QCOMPARE(res_entry->iconDescription().skinId(),map[hsIconName].toString()); + QCOMPARE(res_entry->iconDescription().applicationId(), map[hsIconApplicationId].toString()); + + QCOMPARE(res_entry->flags(), VisibleEntryFlag); // Visible by default, entry not removable + + delete publisher; + + } + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARKEND; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN +} + +void HsMenuClientPluginTest::testUpdateEntry() +{ + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARK; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN + { + QMap map; + map[hsItemId] = 1; // entry id == 1, entry to update + + map[hsItemName] = "UpdatedName"; + map[hsItemDescription] = "UpdatedDescription"; + + map[hsitemLaunchUri] = "appto://102828D6?"; + map[hsitemPublisherId] = "tappModuleTestUpdated"; + map[hsItemWidgetUri] = "hsclockwidgetpluginUpdated"; + + map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\UpdatedClockIcon.png"; + map[hsIconName] = "qtg_large_applications_user_updated"; + map[hsIconApplicationId] = "123458321"; + + // create original entry to be updated + mCaServicePrivateMock->AddEntriesForUpdate(); + + QScopedPointer publisher (new HsMenuClient()); + QVERIFY(publisher->add(map)); + + // from mock + QSharedPointer res_entry = mCaServicePrivateMock->mCreatedEntries[1]; + + QCOMPARE(res_entry->entryTypeName(), + QString(Hs::templatedApplicationTypeName)); + QCOMPARE(res_entry->role(), ItemEntryRole); + QCOMPARE(res_entry->flags(), VisibleEntryFlag); // Visible by default, entry not removable + + QCOMPARE(res_entry->text(), map[hsItemName].toString()); + QCOMPARE(res_entry->description(), map[hsItemDescription].toString()); + QCOMPARE(res_entry->attributes().count(), 3); + QCOMPARE(res_entry->attribute(hsitemLaunchUri), map[hsitemLaunchUri].toString()); + QCOMPARE(res_entry->attribute(hsitemPublisherId), map[hsitemPublisherId].toString()); + QCOMPARE(res_entry->attribute(hsItemWidgetUri), map[hsItemWidgetUri].toString()); + + // icon + QCOMPARE(res_entry->iconDescription().filename(), map[hsIconFileName].toString()); + QCOMPARE(res_entry->iconDescription().skinId(),map[hsIconName].toString()); + QCOMPARE(res_entry->iconDescription().applicationId(), map[hsIconApplicationId].toString()); + } + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARKEND; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN +} + +void HsMenuClientPluginTest::testRemoveEntry() +{ + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARK; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN + { + QMap map; + map[hsItemName] = "ModuleTestTApp"; + map[hsitemLaunchUri] = "appto://2002DCEC?"; + map[hsitemPublisherId] = "tappModuleTest"; + map[hsItemDescription] = "Unit test app for HsClientPlugin"; + map[hsIconApplicationId] = "268458321"; + + HsMenuClient *publisher = new HsMenuClient(); + bool result = publisher->remove(map); + QVERIFY(!result); + + mCaServicePrivateMock->mEntryToRemove = -1; + map[hsItemId] = 1; // entry id == 1 + result = publisher->remove(map); + QCOMPARE(mCaServicePrivateMock->mEntryToRemove, map[hsItemId].toInt()); + delete publisher; + } + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARKEND; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN +} + +void HsMenuClientPluginTest::testListEntry() +{ + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARK; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN + { + QMap map; + map[hsItemName] = "Name"; + map[hsItemDescription] = "Description"; + + map[hsitemLaunchUri] = "appto://102828D6?"; + map[hsitemPublisherId] = "tappModuleTest"; + map[hsItemWidgetUri] = "hsclockwidgetplugin"; + map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\clockIcon.png"; + map[hsIconName] = "qtg_large_applications_user"; + map[hsIconApplicationId] = "223458321"; + + HsMenuClient *publisher = new HsMenuClient(); + QList list; + list = publisher->getList(map); + + // verify query passed to GetEntries + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->flagsOn(), VisibleEntryFlag); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->entryRoles(), ItemEntryRole); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->entryTypeNames(), + QStringList(Hs::templatedApplicationTypeName)); + + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsItemName), QString()); // not used + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsItemDescription), QString()); // not used + + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsitemLaunchUri), + map.value(hsitemLaunchUri).toString()); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsitemPublisherId), + map.value(hsitemPublisherId).toString()); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsItemWidgetUri), + map.value(hsItemWidgetUri).toString()); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsIconFileName), + map.value(hsIconFileName).toString()); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsIconName), + map.value(hsIconName).toString()); + QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsIconApplicationId), + map.value(hsIconApplicationId).toString()); + + // Verify if all values are added to the map + QVERIFY(list.count() == 2); + QSharedPointer res_entry = mCaServicePrivateMock->mReturnedEntries[0]; + QCOMPARE(res_entry->id(), list.at(0).value(hsItemId).toInt()); + QCOMPARE(res_entry->text(), list.at(0).value(hsItemName).toString()); + QCOMPARE(res_entry->description(), list.at(0).value(hsItemDescription).toString()); + QCOMPARE(res_entry->attribute(hsitemLaunchUri), list.at(0).value(hsitemLaunchUri).toString()); + QCOMPARE(res_entry->attribute(hsitemPublisherId), list.at(0).value(hsitemPublisherId).toString()); + QCOMPARE(res_entry->attribute(hsItemWidgetUri), list.at(0).value(hsItemWidgetUri).toString()); + QCOMPARE(res_entry->iconDescription().filename(), list.at(0).value(hsIconFileName).toString()); + QCOMPARE(res_entry->iconDescription().skinId(),list.at(0).value(hsIconName).toString()); + QCOMPARE(res_entry->iconDescription().applicationId(), list.at(0).value(hsIconApplicationId).toString()); + + res_entry = mCaServicePrivateMock->mReturnedEntries[1]; + QCOMPARE(res_entry->id(), list.at(1).value(hsItemId).toInt()); + QCOMPARE(res_entry->text(), list.at(1).value(hsItemName).toString()); + QCOMPARE(res_entry->description(), list.at(1).value(hsItemDescription).toString()); + QCOMPARE(res_entry->attribute(hsitemLaunchUri), list.at(1).value(hsitemLaunchUri).toString()); + QCOMPARE(res_entry->attribute(hsitemPublisherId), list.at(1).value(hsitemPublisherId).toString()); + QCOMPARE(res_entry->attribute(hsItemWidgetUri), list.at(1).value(hsItemWidgetUri).toString()); + QCOMPARE(res_entry->iconDescription().filename(), list.at(1).value(hsIconFileName).toString()); + QCOMPARE(res_entry->iconDescription().skinId(),list.at(1).value(hsIconName).toString()); + QCOMPARE(res_entry->iconDescription().applicationId(), list.at(1).value(hsIconApplicationId).toString()); + delete publisher; + } + #ifdef Q_OS_SYMBIAN + #ifdef UT_MEMORY_CHECK + __UHEAP_MARKEND; + #endif//UT_MEMORY_CHECK + #endif//Q_OS_SYMBIAN +} + +QTEST_MAIN(HsMenuClientPluginTest) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pri Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,23 @@ +# +# 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: +# +#Header files +HEADERS += ./inc/*.h \ + ../../../../homescreenapp/hsmenuclientplugin/inc/*.h \ + ../../inc/hsmenuclient.h + +#Source files +SOURCES += ./src/*.cpp \ + ../../../../homescreenapp/hsmenuclientplugin/src/*.cpp diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app + +include(../../../../homescreenapp/common.pri) + +CONFIG += debug_and_release \ + console \ + hb \ + mobility + +MOBILITY = serviceframework + +coverage:DEFINES += COVERAGE_MEASUREMENT + +QT += testlib +LIBS += -lcaclient + +DEFINES += HSDOMAINMODEL_TEST\ + HSMENUCLIENTPLUGIN_UNITTEST + +win32: { +DEFINES += CACLIENT_TEST +} + +DEPENDPATH += .\ + ./src \ + ./inc \ + ../../../../homescreenapp/hsmenuclientplugin/src \ + ../../../../homescreenapp/hsmenuclientplugin/inc + +INCLUDEPATH += .\ + ./inc \ + ../../../../homescreenapp/hsmenuclientplugin/inc \ + ../../inc/ + +symbian: { + ### get rid of localization warnings + CONFIG -= hb + load(hb.prf) + CONFIG -= symbian_i18n + ### + CONFIG += symbian_test + coverage: CONFIG -= symbian_test + TARGET.UID3 = 20028716 + TARGET.CAPABILITY = CAP_APPLICATION AllFiles + TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB +} + +include(t_hsmenuclientplugin.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/homescreenclient_api/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/homescreenclient_api/tsrc/tsrc.pro Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS += t_hsmenuclientplugin + +CONFIG += ordered + diff -r 32e56106abf2 -r 66b5fe3c07fd homescreen_plat/hswidgetmodel_api/hswidgetmodel_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreen_plat/hswidgetmodel_api/hswidgetmodel_api.metaxml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,12 @@ + + + hswidgetmodel_api + Home screen widget model api + c++ + + + + no + no + + diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/common.pri --- a/homescreenapp/common.pri Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/common.pri Wed Oct 06 16:06:24 2010 +0300 @@ -72,8 +72,9 @@ } else { # add platfrom API for windows INCLUDEPATH += \ - $$PWD/../../homescreensrv/homescreensrv_plat/contentstorage_api \ - $$PWD/../../homescreensrv/homescreensrv_plat/homescreen_information_api/inc + $$PWD/../../homescreensrv/homescreensrv_plat/contentstorage_api/inc \ + $$PWD/../../homescreensrv/homescreensrv_plat/homescreen_information_api/inc \ + $$PWD/../homescreen_plat/homescreenclient_api/inc } plugin: !isEmpty(PLUGIN_SUBDIR): DESTDIR = $$OUTPUT_DIR/$$PLUGIN_SUBDIR diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/homescreenapp.pro --- a/homescreenapp/homescreenapp.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/homescreenapp.pro Wed Oct 06 16:06:24 2010 +0300 @@ -19,10 +19,10 @@ SUBDIRS += hsutils \ hsdomainmodel \ serviceproviders \ + hsmenuclientplugin \ stateplugins \ widgetplugins \ - hsapplication \ - hsmenuclientplugin + hsapplication symbian: { SUBDIRS += hshomescreenclientplugin \ diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplication/resource/wallpapers/page/1_landscape.png Binary file homescreenapp/hsapplication/resource/wallpapers/page/1_landscape.png has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplication/resource/wallpapers/page/1_portrait.png Binary file homescreenapp/hsapplication/resource/wallpapers/page/1_portrait.png has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplication/resource/wallpapers/page/2_landscape.png Binary file homescreenapp/hsapplication/resource/wallpapers/page/2_landscape.png has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplication/resource/wallpapers/page/2_portrait.png Binary file homescreenapp/hsapplication/resource/wallpapers/page/2_portrait.png has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplication/resource/wallpapers/page/3_landscape.png Binary file homescreenapp/hsapplication/resource/wallpapers/page/3_landscape.png has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplication/resource/wallpapers/page/3_portrait.png Binary file homescreenapp/hsapplication/resource/wallpapers/page/3_portrait.png has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsapplicationlauncher/src/hsapplicationlauncher.cpp --- a/homescreenapp/hsapplicationlauncher/src/hsapplicationlauncher.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsapplicationlauncher/src/hsapplicationlauncher.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -168,6 +168,9 @@ delete iShutdownMonitor; iShutdownMonitor = NULL; + + delete iCenRepNotifyHandler; + iCenRepNotifyHandler = NULL; } // ----------------------------------------------------------------------------- diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsdomainmodel/src/hsbackuprestoreobserver.cpp --- a/homescreenapp/hsdomainmodel/src/hsbackuprestoreobserver.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hsbackuprestoreobserver.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -87,12 +87,20 @@ { if ( !mCallBack ) { - mCallBack = CHsBURActiveCallback::NewL(mQ); + TRAPD(err, mCallBack = CHsBURActiveCallback::NewL(mQ)); + if ( err ) + { + qDebug() << "HsBackupRestoreObserverPrivate::handleKeyChange - BUR active callback creation failed with error " << err; + } } if ( !mActiveBackupClient ) { - mActiveBackupClient = conn::CActiveBackupClient::NewL( mCallBack ); + TRAPD(err, mActiveBackupClient = conn::CActiveBackupClient::NewL( mCallBack )); + if ( err ) + { + qDebug() << "HsBackupRestoreObserverPrivate::handleKeyChange - Active backup client creation failed with error " << err; + } if ( ( type == conn::EBURBackupPartial || type == conn::EBURRestorePartial ) && diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsdomainmodel/src/hswallpaperloaderthread.cpp --- a/homescreenapp/hsdomainmodel/src/hswallpaperloaderthread.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsdomainmodel/src/hswallpaperloaderthread.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -65,7 +65,7 @@ imageReader.setScaledSize(sourceSize); //Crop center part of the scaled image as a target image - clipRect.moveCenter(QPoint(sourceSize.width() / 2, sourceSize.height() / 2)); + clipRect.moveCenter(QPoint(sourceSize.width() / 2 - 1, sourceSize.height() / 2 - 1)); imageReader.setScaledClipRect(clipRect); mResult = imageReader.read().save(mTargetPath); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/hsmenuclientplugin.pro --- a/homescreenapp/hsmenuclientplugin/hsmenuclientplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsmenuclientplugin/hsmenuclientplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -23,21 +23,21 @@ LIBS += -lcaclient -INCLUDEPATH += inc \ - ../../homescreen_plat/homescreenclient_api +INCLUDEPATH += inc -HEADERS += ../../homescreen_plat/homescreenclient_api/hsmenuclient.h \ - inc/hsmenuclientplugin.h +HEADERS += inc/hsmenuclientplugin.h \ + ../../homescreen_plat/homescreenclient_api/inc/hsmenuclient.h SOURCES += src/hsmenuclient.cpp \ src/hsmenuclientplugin.cpp symbian: { - TARGET.UID3 = 0x20028715 - - MMP_RULES += SMPSAFE + TARGET.UID3 = 0x20028715 +} +!symbian: { + INCLUDEPATH += ../../homescreen_plat/homescreenclient_api/inc } include(../common.pri) - +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/src/hsmenuclient.cpp --- a/homescreenapp/hsmenuclientplugin/src/hsmenuclient.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsmenuclientplugin/src/hsmenuclient.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -22,9 +22,9 @@ #include #include #include +#include #include "hsapp_defs.h" -#include "hsmenuclient.h" #include "hsmenuclient_p.h" /*! diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/src/hsmenuclientplugin.cpp --- a/homescreenapp/hsmenuclientplugin/src/hsmenuclientplugin.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsmenuclientplugin/src/hsmenuclientplugin.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -18,9 +18,9 @@ #include #include #include +#include #include "hsmenuclientplugin.h" -#include "hsmenuclient.h" #ifdef COVERAGE_MEASUREMENT #pragma CTC SKIP diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/inc/caservice_p.h --- a/homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/inc/caservice_p.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: caservice_p.h - * - */ - -#ifndef CASERVICE_PRIVATE_H -#define CASERVICE_PRIVATE_H - -#include -#include - -class QString; -class CaQuery; -class CaServicePrivate -{ - -public: - ~CaServicePrivate() { - clearAll(); - } - - QList< QSharedPointer > mCreatedEntries; - QList< QSharedPointer > mReturnedEntries; - int mEntryToRemove; - QSharedPointer mUpdatedEntry; - CaQuery* mQueryPassedToGetList; - - void AddEntriesForUpdate(); - void clearAll(); - static CaServicePrivate& instance() { - static CaServicePrivate caServicePrivate; - return caServicePrivate; - } - -private: - - explicit CaServicePrivate(): mUpdatedEntry (NULL), mQueryPassedToGetList (NULL) - { - } -}; - -#endif //CASERVICE_PRIVATE_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/inc/t_hsmenuclientplugin.h --- a/homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/inc/t_hsmenuclientplugin.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* 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 hsmenuclientplugin class. -* -*/ - -#ifndef T_HSMMENUCLIENTPLUGINTEST_H -#define T_HSMMENUCLIENTPLUGINTEST_H - -#include -#include - -#ifdef Q_OS_SYMBIAN -#include -#endif//Q_OS_SYMBIAN - -#include "caservice_p.h" //mock -/** -* @test Test class for homescreen::hsutils modules. -*/ -class HsMenuClientPluginTest : public QObject -{ - Q_OBJECT - -private slots: - - void initTestCase(); - void init(); - - void testCreateEntry(); - void testCreateLocalizedEntry(); - void testUpdateEntry(); - void testRemoveEntry(); - void testListEntry(); - - - /** - * cleanup - */ - void cleanupTestCase(); - void cleanup(); - -private: - CaServicePrivate *mCaServicePrivateMock; - -}; - -#endif //T_HSMMENUCLIENTPLUGINTEST_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/src/caservice.cpp --- a/homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/src/caservice.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,426 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: caservice.cpp - * - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "hsapp_defs.h" -#include "t_hsmenuclientplugin.h" -#include "hsmenuclient.h" - - -// ======== MEMBER FUNCTIONS ======== - -/*! - - \class CaService. - \brief This class operates on data, anable creating and inserting new entry - to DB, removing entry from DB, update entry or get entry from DB, executeC - command on entry and create notifier to notify client about changes onto DB. - - CaService class uses singleton design pattern, so that it contains static - method called instance() to get instance of a class. - - \code - QSharedPointer service = CaService::instance(); - \endcode - - For every operations on data is used always one instantiation of a class. - Below are examples how to create data and work on those ones. - - */ - -// Initialization of a static member variable. -//QWeakPointer CaService::m_instance = QWeakPointer(); - -/*! - Constructor. - \param parent pointer to a parent. It defaults to NULL. - */ -CaService::CaService(QObject *parent) : - QObject(parent), m_d(&CaServicePrivate::instance()) -{ - -} - -/*! - Returns a pointer to the instance of the CaService class. - \retval A pointer to the instance of the CaService class. - */ -QSharedPointer CaService::instance() -{ - static QSharedPointer instance (new CaService); - return instance; -} - -/*! - Destructor. - */ -CaService::~CaService() -{ - -} - -// HELP METHODS - -void CaServicePrivate::clearAll() -{ - mEntryToRemove = -1; - - mUpdatedEntry.clear(); - - delete mQueryPassedToGetList; - mQueryPassedToGetList = NULL; - - mCreatedEntries.clear(); - mReturnedEntries.clear(); -} - -void CaServicePrivate::AddEntriesForUpdate() -{ - QSharedPointer item0 (new CaEntry()); - - // this will be updated: - QSharedPointer item1 (new CaEntry()); - item1->setText("ModuleTestTApp"); - item1->setDescription("Unit test app for HsClientPlugin"); - - item1->setAttribute(hsitemLaunchUri, "appto://2002DCEC?"); - item1->setAttribute(hsitemPublisherId, "tappModuleTest"); - item1->setAttribute(hsitemLaunchUri, "hsclockwidgetplugin"); - - item1->setEntryTypeName(Hs::templatedApplicationTypeName); - item1->setFlags(VisibleEntryFlag); - - CaIconDescription iconDescription1; - iconDescription1.setFilename("iconFileName"); - iconDescription1.setSkinId("iconSkinId"); - iconDescription1.setApplicationId("268458321"); //Bluetouth app UID - item1->setIconDescription(iconDescription1); - - mCreatedEntries << item0; - mCreatedEntries << item1; -} -QSharedPointer CaService::getEntry(int entryId) const -{ - return m_d->mCreatedEntries.at(entryId); -} - - -bool CaService::updateEntry(const CaEntry &entry) const -{ - m_d->mUpdatedEntry.clear(); - m_d->mUpdatedEntry = QSharedPointer(new CaEntry(entry)); - return true; -} - -QSharedPointer CaService::createEntry(const CaEntry &entry) const -{ - QSharedPointer newEntry(new CaEntry(entry)); - m_d->mCreatedEntries << newEntry; - return newEntry; -} - - -bool CaService::removeEntry(int entryId) const -{ - m_d->mEntryToRemove = entryId; - - return true; -} - - -QList< QSharedPointer > CaService::getEntries( - const QList &entryIdList) const -{ - Q_UNUSED(entryIdList); - QList< QSharedPointer > result; - return result; - -} - -QList< QSharedPointer > CaService::getEntries(const CaQuery &query) const -{ - // store the query for verification - m_d->mQueryPassedToGetList = new CaQuery (query); - - // return mock list of 2 entires - QSharedPointer item1 (new CaEntry()); - item1->setText("ModuleTestTApp1"); - item1->setDescription("Unit test app for HsClientPlugin1"); - item1->setAttribute(hsitemLaunchUri, "appto://1002DCEC?"); - item1->setAttribute(hsitemPublisherId, "tappModuleTest1"); - item1->setAttribute(hsitemLaunchUri, "hsclockwidgetplugin1"); - item1->setEntryTypeName(Hs::templatedApplicationTypeName); - item1->setFlags(VisibleEntryFlag); - CaIconDescription iconDescription1; - iconDescription1.setFilename("iconFileName1"); - iconDescription1.setSkinId("iconSkinId1"); - iconDescription1.setApplicationId("168458321"); - item1->setIconDescription(iconDescription1); - - QSharedPointer item2 (new CaEntry()); - item2->setText("ModuleTestTApp2"); - item2->setDescription("Unit test app for HsClientPlugin2"); - item2->setAttribute(hsitemLaunchUri, "appto://2002DCEC?"); - item2->setAttribute(hsitemPublisherId, "tappModuleTest2"); - item2->setAttribute(hsitemLaunchUri, "hsclockwidgetplugin2"); - item2->setEntryTypeName(Hs::templatedApplicationTypeName); - item2->setFlags(VisibleEntryFlag); - CaIconDescription iconDescription2; - iconDescription2.setFilename("iconFileName2"); - iconDescription2.setSkinId("iconSkinId2"); - iconDescription2.setApplicationId("268458321"); - item2->setIconDescription(iconDescription2); - - // store items for verification - m_d->mReturnedEntries << item1 << item2; - - // return copies to caller - QList< QSharedPointer > resultList; - resultList << item1; - resultList << item2; - - return resultList; -} - -QList CaService::getEntryIds(const CaQuery &query) const -{ - Q_UNUSED(query); - QList result; - return result; - -} - - - -bool CaService::removeEntry(const CaEntry &entry) const -{ - return removeEntry(entry.id()); -} - - -bool CaService::removeEntries(const QList &entryIdList) const -{ - Q_UNUSED(entryIdList); - return true; -} - - -bool CaService::removeEntries( - const QList< QSharedPointer > &entryList) const -{ - Q_UNUSED(entryList); - return true; -} - -bool CaService::touch(const CaEntry &entry) const -{ - Q_UNUSED(entry); - return true; -} - - -bool CaService::insertEntryIntoGroup(int groupId, int entryId, - int beforeEntryId) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryId); - Q_UNUSED(beforeEntryId); - return true; -} - - -bool CaService::insertEntryIntoGroup( - const CaEntry &group, const CaEntry &entry, int beforeEntryId) const -{ - Q_UNUSED(group); - Q_UNUSED(entry); - Q_UNUSED(beforeEntryId); - return true; -} - - -bool CaService::insertEntriesIntoGroup(int groupId, - const QList &entryIdList, int beforeEntryId) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryIdList); - Q_UNUSED(beforeEntryId); - return true; -} - - -bool CaService::insertEntriesIntoGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList, - int beforeEntryId) const -{ - Q_UNUSED(group); - Q_UNUSED(entryList); - Q_UNUSED(beforeEntryId); - return true; -} - - -bool CaService::removeEntryFromGroup(int groupId, int entryId) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryId); - return true; -} - - -bool CaService::removeEntryFromGroup(const CaEntry &group, - const CaEntry &entry) const -{ - Q_UNUSED(group); - Q_UNUSED(entry); - return true; -} - - -bool CaService::removeEntriesFromGroup(int groupId, - const QList &entryIdList) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryIdList); - return true; -} - - -bool CaService::removeEntriesFromGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList) const -{ - Q_UNUSED(group); - Q_UNUSED(entryList); - return true; -} - - -bool CaService::appendEntryToGroup(int groupId, int entryId) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryId); - return true; -} - - -bool CaService::appendEntryToGroup(const CaEntry &group, - const CaEntry &entry) const -{ - Q_UNUSED(group); - Q_UNUSED(entry); - return true; -} - - -bool CaService::appendEntriesToGroup(int groupId, - const QList &entryIdList) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryIdList); - return true; -} - - -bool CaService::appendEntriesToGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList) const -{ - Q_UNUSED(group); - Q_UNUSED(entryList); - return true; -} - - -bool CaService::prependEntryToGroup(int groupId, int entryId) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryId); - return true; -} - - -bool CaService::prependEntryToGroup(const CaEntry &group, - const CaEntry &entry) const -{ - Q_UNUSED(group); - Q_UNUSED(entry); - return true; -} - -bool CaService::prependEntriesToGroup(int groupId, - const QList &entryIdList) const -{ - Q_UNUSED(groupId); - Q_UNUSED(entryIdList); - return true; -} - -bool CaService::prependEntriesToGroup(const CaEntry &group, - const QList< QSharedPointer > &entryList) const -{ - Q_UNUSED(group); - Q_UNUSED(entryList); - return true; -} - -int CaService::executeCommand(int entryId, const QString &command, - QObject* receiver, const char* member) const -{ - Q_UNUSED(entryId); - Q_UNUSED(command); - Q_UNUSED(receiver); - Q_UNUSED(member); - return 0; -} - -int CaService::executeCommand(const CaEntry &entry, const QString &command, - QObject* receiver, const char* member) const -{ - Q_UNUSED(entry); - Q_UNUSED(command); - Q_UNUSED(receiver); - Q_UNUSED(member); - return 0; -} - -CaNotifier *CaService::createNotifier(const CaNotifierFilter &filter) const -{ - Q_UNUSED(filter); - return NULL; -} - - -bool CaService::customSort(int groupId, QList &entryIdList) const -{ - Q_UNUSED(entryIdList); - return true; -} - -ErrorCode CaService::lastError() const -{ - return NoErrorCode; -} diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/src/t_hsmenuclientplugin.cpp --- a/homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/src/t_hsmenuclientplugin.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +0,0 @@ -/* -* 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 test library. -* -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include "t_hsmenuclientplugin.h" -#include "hsmenuclient.h" - -const QString hsItemId("id"); - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void HsMenuClientPluginTest::initTestCase() -{ - mCaServicePrivateMock = &CaServicePrivate::instance(); -// mainWindow(); -} - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void HsMenuClientPluginTest::init() -{ - mCaServicePrivateMock->clearAll(); -} - - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void HsMenuClientPluginTest::cleanupTestCase() -{ - -// delete mainWindow(); - -} - -void HsMenuClientPluginTest::cleanup() -{ - mCaServicePrivateMock->clearAll(); - qApp->processEvents(); -} - -void HsMenuClientPluginTest::testCreateEntry() -{ - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARK; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN - { - QList list; - QMap map; - map[hsItemName] = "ModuleTestTApp"; - map[hsItemDescription] = "Unit test app for HsClientPlugin"; - - map[hsitemLaunchUri] = "appto://2002DCEC?"; - map[hsitemPublisherId] = "tappModuleTest"; - map[hsItemWidgetUri] = "hsclockwidgetplugin"; - - map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\tclock.png"; - map[hsIconName] = "qtg_large_applications_user"; - map[hsIconApplicationId] = "268458321"; - - - - HsMenuClient *publisher = new HsMenuClient(); - QVERIFY(publisher->add(map)); - - QSharedPointer res_entry = mCaServicePrivateMock->mCreatedEntries[0]; - - - QCOMPARE(res_entry->entryTypeName(), - QString(Hs::templatedApplicationTypeName)); - QCOMPARE(res_entry->role(), ItemEntryRole); - QCOMPARE(res_entry->text(), map[hsItemName].toString()); - QCOMPARE(res_entry->description(), map[hsItemDescription].toString()); - - QCOMPARE(res_entry->attributes().count(), 3); - QCOMPARE(res_entry->attribute(hsitemLaunchUri), map[hsitemLaunchUri].toString()); - QCOMPARE(res_entry->attribute(hsitemPublisherId), map[hsitemPublisherId].toString()); - QCOMPARE(res_entry->attribute(hsItemWidgetUri), map[hsItemWidgetUri].toString()); - - // icon - QCOMPARE(res_entry->iconDescription().filename(), map[hsIconFileName].toString()); - QCOMPARE(res_entry->iconDescription().skinId(),map[hsIconName].toString()); - QCOMPARE(res_entry->iconDescription().applicationId(), map[hsIconApplicationId].toString()); - - QCOMPARE(res_entry->flags(), VisibleEntryFlag); // Visible by default, entry not removable - - delete publisher; - - } - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARKEND; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN -} - -void HsMenuClientPluginTest::testCreateLocalizedEntry() -{ - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARK; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN - { - QList list; - QMap map; - QString testName("Games"); - QString testDesc(""); - map[hsItemName] = "ModuleTestTApp"; - map[hsItemLocName] = "loc://emailTest/txt_applib_dblist_games"; - map[hsItemDescription] = "Unit test app for HsClientPlugin"; - map[hsItemLocDescription] = "loc://emailTest/txt_applib_subtitle_office"; - - map[hsitemLaunchUri] = "appto://2002DCEC?"; - map[hsitemPublisherId] = "tappModuleTest"; - map[hsItemWidgetUri] = "hsclockwidgetplugin"; - - map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\tclock.png"; - map[hsIconName] = "qtg_large_applications_user"; - map[hsIconApplicationId] = "268458321"; - - - - HsMenuClient *publisher = new HsMenuClient(); - QVERIFY(publisher->add(map)); - - QSharedPointer res_entry = mCaServicePrivateMock->mCreatedEntries[0]; - - - QCOMPARE(res_entry->entryTypeName(), - QString(Hs::templatedApplicationTypeName)); - QCOMPARE(res_entry->role(), ItemEntryRole); - QCOMPARE(res_entry->text(), map[hsItemLocName].toString()); - QCOMPARE(res_entry->description(), map[hsItemLocDescription].toString()); - - QCOMPARE(res_entry->attribute(hsitemLaunchUri), map[hsitemLaunchUri].toString()); - QCOMPARE(res_entry->attribute(hsitemPublisherId), map[hsitemPublisherId].toString()); - QCOMPARE(res_entry->attribute(hsItemWidgetUri), map[hsItemWidgetUri].toString()); - - // icon - QCOMPARE(res_entry->iconDescription().filename(), map[hsIconFileName].toString()); - QCOMPARE(res_entry->iconDescription().skinId(),map[hsIconName].toString()); - QCOMPARE(res_entry->iconDescription().applicationId(), map[hsIconApplicationId].toString()); - - QCOMPARE(res_entry->flags(), VisibleEntryFlag); // Visible by default, entry not removable - - delete publisher; - - } - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARKEND; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN -} - -void HsMenuClientPluginTest::testUpdateEntry() -{ - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARK; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN - { - QMap map; - map[hsItemId] = 1; // entry id == 1, entry to update - - map[hsItemName] = "UpdatedName"; - map[hsItemDescription] = "UpdatedDescription"; - - map[hsitemLaunchUri] = "appto://102828D6?"; - map[hsitemPublisherId] = "tappModuleTestUpdated"; - map[hsItemWidgetUri] = "hsclockwidgetpluginUpdated"; - - map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\UpdatedClockIcon.png"; - map[hsIconName] = "qtg_large_applications_user_updated"; - map[hsIconApplicationId] = "123458321"; - - // create original entry to be updated - mCaServicePrivateMock->AddEntriesForUpdate(); - - QScopedPointer publisher (new HsMenuClient()); - QVERIFY(publisher->add(map)); - - // from mock - QSharedPointer res_entry = mCaServicePrivateMock->mCreatedEntries[1]; - - QCOMPARE(res_entry->entryTypeName(), - QString(Hs::templatedApplicationTypeName)); - QCOMPARE(res_entry->role(), ItemEntryRole); - QCOMPARE(res_entry->flags(), VisibleEntryFlag); // Visible by default, entry not removable - - QCOMPARE(res_entry->text(), map[hsItemName].toString()); - QCOMPARE(res_entry->description(), map[hsItemDescription].toString()); - QCOMPARE(res_entry->attributes().count(), 3); - QCOMPARE(res_entry->attribute(hsitemLaunchUri), map[hsitemLaunchUri].toString()); - QCOMPARE(res_entry->attribute(hsitemPublisherId), map[hsitemPublisherId].toString()); - QCOMPARE(res_entry->attribute(hsItemWidgetUri), map[hsItemWidgetUri].toString()); - - // icon - QCOMPARE(res_entry->iconDescription().filename(), map[hsIconFileName].toString()); - QCOMPARE(res_entry->iconDescription().skinId(),map[hsIconName].toString()); - QCOMPARE(res_entry->iconDescription().applicationId(), map[hsIconApplicationId].toString()); - } - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARKEND; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN -} - -void HsMenuClientPluginTest::testRemoveEntry() -{ - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARK; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN - { - QMap map; - map[hsItemName] = "ModuleTestTApp"; - map[hsitemLaunchUri] = "appto://2002DCEC?"; - map[hsitemPublisherId] = "tappModuleTest"; - map[hsItemDescription] = "Unit test app for HsClientPlugin"; - map[hsIconApplicationId] = "268458321"; - - HsMenuClient *publisher = new HsMenuClient(); - bool result = publisher->remove(map); - QVERIFY(!result); - - mCaServicePrivateMock->mEntryToRemove = -1; - map[hsItemId] = 1; // entry id == 1 - result = publisher->remove(map); - QCOMPARE(mCaServicePrivateMock->mEntryToRemove, map[hsItemId].toInt()); - delete publisher; - } - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARKEND; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN -} - -void HsMenuClientPluginTest::testListEntry() -{ - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARK; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN - { - QMap map; - map[hsItemName] = "Name"; - map[hsItemDescription] = "Description"; - - map[hsitemLaunchUri] = "appto://102828D6?"; - map[hsitemPublisherId] = "tappModuleTest"; - map[hsItemWidgetUri] = "hsclockwidgetplugin"; - map[hsIconFileName] = "Z:\\private\\20022F35\\import\\widgetregistry\\20022F6C\\clockIcon.png"; - map[hsIconName] = "qtg_large_applications_user"; - map[hsIconApplicationId] = "223458321"; - - HsMenuClient *publisher = new HsMenuClient(); - QList list; - list = publisher->getList(map); - - // verify query passed to GetEntries - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->flagsOn(), VisibleEntryFlag); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->entryRoles(), ItemEntryRole); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->entryTypeNames(), - QStringList(Hs::templatedApplicationTypeName)); - - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsItemName), QString()); // not used - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsItemDescription), QString()); // not used - - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsitemLaunchUri), - map.value(hsitemLaunchUri).toString()); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsitemPublisherId), - map.value(hsitemPublisherId).toString()); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsItemWidgetUri), - map.value(hsItemWidgetUri).toString()); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsIconFileName), - map.value(hsIconFileName).toString()); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsIconName), - map.value(hsIconName).toString()); - QCOMPARE(mCaServicePrivateMock->mQueryPassedToGetList->attribute(hsIconApplicationId), - map.value(hsIconApplicationId).toString()); - - // Verify if all values are added to the map - QVERIFY(list.count() == 2); - QSharedPointer res_entry = mCaServicePrivateMock->mReturnedEntries[0]; - QCOMPARE(res_entry->id(), list.at(0).value(hsItemId).toInt()); - QCOMPARE(res_entry->text(), list.at(0).value(hsItemName).toString()); - QCOMPARE(res_entry->description(), list.at(0).value(hsItemDescription).toString()); - QCOMPARE(res_entry->attribute(hsitemLaunchUri), list.at(0).value(hsitemLaunchUri).toString()); - QCOMPARE(res_entry->attribute(hsitemPublisherId), list.at(0).value(hsitemPublisherId).toString()); - QCOMPARE(res_entry->attribute(hsItemWidgetUri), list.at(0).value(hsItemWidgetUri).toString()); - QCOMPARE(res_entry->iconDescription().filename(), list.at(0).value(hsIconFileName).toString()); - QCOMPARE(res_entry->iconDescription().skinId(),list.at(0).value(hsIconName).toString()); - QCOMPARE(res_entry->iconDescription().applicationId(), list.at(0).value(hsIconApplicationId).toString()); - - res_entry = mCaServicePrivateMock->mReturnedEntries[1]; - QCOMPARE(res_entry->id(), list.at(1).value(hsItemId).toInt()); - QCOMPARE(res_entry->text(), list.at(1).value(hsItemName).toString()); - QCOMPARE(res_entry->description(), list.at(1).value(hsItemDescription).toString()); - QCOMPARE(res_entry->attribute(hsitemLaunchUri), list.at(1).value(hsitemLaunchUri).toString()); - QCOMPARE(res_entry->attribute(hsitemPublisherId), list.at(1).value(hsitemPublisherId).toString()); - QCOMPARE(res_entry->attribute(hsItemWidgetUri), list.at(1).value(hsItemWidgetUri).toString()); - QCOMPARE(res_entry->iconDescription().filename(), list.at(1).value(hsIconFileName).toString()); - QCOMPARE(res_entry->iconDescription().skinId(),list.at(1).value(hsIconName).toString()); - QCOMPARE(res_entry->iconDescription().applicationId(), list.at(1).value(hsIconApplicationId).toString()); - delete publisher; - } - #ifdef Q_OS_SYMBIAN - #ifdef UT_MEMORY_CHECK - __UHEAP_MARKEND; - #endif//UT_MEMORY_CHECK - #endif//Q_OS_SYMBIAN -} - -QTEST_MAIN(HsMenuClientPluginTest) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pri --- a/homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pri Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -#Header files -HEADERS += ./inc/*.h \ - ../../inc/*.h \ - ../../../../homescreen_plat/homescreenclient_api/hsmenuclient.h - -#Source files -SOURCES += ./src/*.cpp \ - ../../src/*.cpp diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pro --- a/homescreenapp/hsmenuclientplugin/tsrc/t_hsmenuclientplugin/t_hsmenuclientplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = app - -include(../../../common.pri) - -CONFIG += debug_and_release \ - console \ - hb \ - mobility - -MOBILITY = serviceframework - -coverage:DEFINES += COVERAGE_MEASUREMENT - -QT += testlib -LIBS += -lcaclient - -DEFINES += HSDOMAINMODEL_TEST\ - HSMENUCLIENTPLUGIN_UNITTEST - -win32: { -DEFINES += CACLIENT_TEST -} - -DEPENDPATH += .\ - ./src \ - ./inc \ - ../../src \ - ../../inc - -INCLUDEPATH += .\ - ./inc \ - ../../inc \ - ../../../../homescreen_plat/homescreenclient_api - -symbian: { - ### get rid of localization warnings - CONFIG -= hb - load(hb.prf) - CONFIG -= symbian_i18n - ### - CONFIG += symbian_test - coverage: CONFIG -= symbian_test - TARGET.UID3 = 20028716 - TARGET.CAPABILITY = CAP_APPLICATION AllFiles - TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB - - MMP_RULES += SMPSAFE -} - -include(t_hsmenuclientplugin.pri) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsmenuclientplugin/tsrc/tsrc.pro --- a/homescreenapp/hsmenuclientplugin/tsrc/tsrc.pro Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = subdirs -SUBDIRS += t_hsmenuclientplugin - -CONFIG += ordered - diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/inc/hsmenudialogfactory.h --- a/homescreenapp/hsutils/inc/hsmenudialogfactory.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/inc/hsmenudialogfactory.h Wed Oct 06 16:06:24 2010 +0300 @@ -30,7 +30,7 @@ class HSUTILS_EXPORT HsMenuDialogFactory { public: - enum Options { OkCancel, Close }; + enum Options { OkCancel, Close, DeleteCancel }; virtual HbMessageBox *create(const QString &text, Options options = OkCancel) const; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/src/hsmenudialogfactory.cpp --- a/homescreenapp/hsutils/src/hsmenudialogfactory.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/src/hsmenudialogfactory.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -59,18 +59,22 @@ switch (options) { case OkCancel: - actionIdentifiers << hbTrId("txt_common_button_ok"); actionIdentifiers << hbTrId("txt_common_button_cancel"); type = HbMessageBox::MessageTypeQuestion; break; case Close: - actionIdentifiers << hbTrId("txt_common_button_close"); type = HbMessageBox::MessageTypeInformation; break; + case DeleteCancel: + actionIdentifiers << hbTrId("txt_common_button_delete"); + actionIdentifiers << hbTrId("txt_common_button_cancel"); + type = HbMessageBox::MessageTypeQuestion; + break; + default: break; } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/tsrc/t_hsutils/inc/mocksysteminfo.h --- a/homescreenapp/hsutils/tsrc/t_hsutils/inc/mocksysteminfo.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/tsrc/t_hsutils/inc/mocksysteminfo.h Wed Oct 06 16:06:24 2010 +0300 @@ -15,9 +15,6 @@ * */ - - - #ifndef QSYSTEMINFO_H #define QSYSTEMINFO_H @@ -33,7 +30,6 @@ Q_ENUMS(NetworkStatus) Q_ENUMS(NetworkMode) - public: QSystemNetworkInfo(QObject *parent = 0); @@ -105,7 +101,7 @@ SingleSimAvailable, DualSimAvailable, SimLocked - }; + }; QSystemDeviceInfo::SimStatus simStatus(); QSystemDeviceInfo::Profile currentProfile(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/tsrc/t_hsutils/inc/t_hsutils.h --- a/homescreenapp/hsutils/tsrc/t_hsutils/inc/t_hsutils.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/tsrc/t_hsutils/inc/t_hsutils.h Wed Oct 06 16:06:24 2010 +0300 @@ -45,7 +45,7 @@ void testAdvancedWidgetPositioningOnOrientationChange_data(); void testAdvancedWidgetPositioningOnOrientationChange(); - /** + /** * t_hswidgetpositioningonwidgetmove.cpp */ void testWidgetPositioningOnWidgetMoveInstance(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/tsrc/t_hsutils/src/mocksysteminfo.cpp --- a/homescreenapp/hsutils/tsrc/t_hsutils/src/mocksysteminfo.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/tsrc/t_hsutils/src/mocksysteminfo.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -24,6 +24,7 @@ QSystemNetworkInfo::QSystemNetworkInfo(QObject *parent) : QObject(parent) { } + QSystemNetworkInfo::~QSystemNetworkInfo() { } @@ -57,6 +58,7 @@ QSystemDeviceInfo::QSystemDeviceInfo(QObject *parent) : QObject(parent) { } + QSystemDeviceInfo::~QSystemDeviceInfo() { } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsutils.cpp --- a/homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsutils.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsutils.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -15,13 +15,8 @@ * */ - #include "t_hsutils.h" - - - - // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -36,7 +31,4 @@ { } - - - QTEST_MAIN(t_hsUtils) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsutils_menuevent.cpp --- a/homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsutils_menuevent.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsutils_menuevent.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -158,7 +158,7 @@ // void t_hsUtils::testMenuEventFactoryCreateAppSettingsViewEvent() { - int dummyId = 12345; + int dummyId = 12345; QEvent *menuEvent(NULL); menuEvent = HsMenuEventFactory::createAppSettingsViewEvent(dummyId); QCOMPARE(static_cast(menuEvent)->operation(), @@ -175,7 +175,7 @@ // void t_hsUtils::testMenuEventFactoryCreateAppDetailsViewEvent() { - int dummyId = 12345; + int dummyId = 12345; QEvent *menuEvent(NULL); menuEvent = HsMenuEventFactory::createAppDetailsViewEvent(dummyId); QCOMPARE(static_cast(menuEvent)->operation(), @@ -492,6 +492,9 @@ QCOMPARE(wrongResult, false); } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// void t_hsUtils::testMenuEventFactoryCreateArrangeCollectionEvent() { const int topItemId = 12345; @@ -510,6 +513,9 @@ delete menuEvent; } +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// void t_hsUtils::testMenuEventFactorycreateArrangeAllCollectionsEvent() { const int topItemId = 12345; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/hsutils/tsrc/t_hsutils/src/t_hswidgetpositioningonwidgetmove.cpp --- a/homescreenapp/hsutils/tsrc/t_hsutils/src/t_hswidgetpositioningonwidgetmove.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/hsutils/tsrc/t_hsutils/src/t_hswidgetpositioningonwidgetmove.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -20,10 +20,6 @@ #include "t_hsutils.h" #include "hsapp_defs.h" -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// - #define SNAP_GAP_VALUE 6 #define SNAP_FORCE_VALUE 30 #define SNAP_ENABLED_VALUE true diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/inc/hsapp_defs.h --- a/homescreenapp/inc/hsapp_defs.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/inc/hsapp_defs.h Wed Oct 06 16:06:24 2010 +0300 @@ -77,6 +77,8 @@ const int softwareUpdateApplicationUid = 0x2001FE2F; const int oviLauncherApplicationUid = 0x2002D07F; + + const char drivesIconIdsAttributeName[] = "drivesIconIds"; // Sort attribute enum HsSortAttribute { diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/rom/homescreenapp_core.iby --- a/homescreenapp/rom/homescreenapp_core.iby Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/rom/homescreenapp_core.iby Wed Oct 06 16:06:24 2010 +0300 @@ -85,8 +85,9 @@ data=ZPRIVATE\20022F35\import\widgetregistry\20022F46\hsshortcutwidgetplugin.manifest private\20022f35\import\widgetregistry\20022F46\hsshortcutwidgetplugin.manifest // -------- hsclockwidgetplugin -file=ABI_DIR\BUILD_DIR\hsclockwidgetplugin.dll SHARED_LIB_DIR\hsclockwidgetplugin.dll -data=DATAZ_\RESOURCE_FILES_DIR\qt\plugins\homescreen\hsclockwidgetplugin.qtplugin RESOURCE_FILES_DIR\qt\plugins\homescreen\hsclockwidgetplugin.qtplugin -data=ZPRIVATE\20022f35\import\widgetregistry\20022F6C\hsclockwidgetplugin.manifest private\20022f35\import\widgetregistry\20022F6C\hsclockwidgetplugin.manifest +file=ABI_DIR\BUILD_DIR\hsclockwidgetplugin.dll SHARED_LIB_DIR\hsclockwidgetplugin.dll +data=DATAZ_\RESOURCE_FILES_DIR\qt\plugins\homescreen\hsclockwidgetplugin.qtplugin RESOURCE_FILES_DIR\qt\plugins\homescreen\hsclockwidgetplugin.qtplugin +data=ZPRIVATE\20022f35\import\widgetregistry\20022F6C\hsclockwidgetplugin.manifest private\20022f35\import\widgetregistry\20022F6C\hsclockwidgetplugin.manifest +data=ZPRIVATE\20022f35\import\widgetregistry\20022F6C\qtg_graf_hswidget_preview_clock.svg private\20022f35\import\widgetregistry\20022F6C\qtg_graf_hswidget_preview_clock.svg #endif //__HOMESCREENAPP_CORE_IBY__ diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/bwins/hsmenuserviceprovideru.def --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/bwins/hsmenuserviceprovideru.def Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/bwins/hsmenuserviceprovideru.def Wed Oct 06 16:06:24 2010 +0300 @@ -28,35 +28,36 @@ ?tr@HsMenuEntryRemovedHandler@@SA?AVQString@@PBD0@Z @ 27 NONAME ; class QString HsMenuEntryRemovedHandler::tr(char const *, char const *) ?createCollection@HsMenuService@@SAHABVQString@@@Z @ 28 NONAME ; int HsMenuService::createCollection(class QString const &) ?data@HsMenuItemModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 29 NONAME ; class QVariant HsMenuItemModel::data(class QModelIndex const &, int) const - ?launchSoftwareUpdate@HsMenuService@@SAHXZ @ 30 NONAME ; int HsMenuService::launchSoftwareUpdate(void) - ?getStaticMetaObject@HsMenuItemModel@@SAABUQMetaObject@@XZ @ 31 NONAME ; struct QMetaObject const & HsMenuItemModel::getStaticMetaObject(void) - ?executeAction@HsMenuService@@SAHHABVQString@@PAVQObject@@PBD@Z @ 32 NONAME ; int HsMenuService::executeAction(int, class QString const &, class QObject *, char const *) - ?touch@HsMenuService@@SAXABV?$QList@H@@@Z @ 33 NONAME ; void HsMenuService::touch(class QList const &) - ?getSecondLine@HsMenuCollectionsItemModel@@ABE?AVQString@@PBVCaEntry@@@Z @ 34 NONAME ; class QString HsMenuCollectionsItemModel::getSecondLine(class CaEntry const *) const - ?sortOrder@HsMenuServiceUtils@@SA?AW4SortOrder@Qt@@W4HsSortAttribute@Hs@@@Z @ 35 NONAME ; enum Qt::SortOrder HsMenuServiceUtils::sortOrder(enum Hs::HsSortAttribute) - ?newIconNeeded@HsMenuItemModel@@QBE_NABVQModelIndex@@@Z @ 36 NONAME ; bool HsMenuItemModel::newIconNeeded(class QModelIndex const &) const - ?getAllApplicationsModel@HsMenuService@@SAPAVHsMenuItemModel@@W4HsSortAttribute@Hs@@@Z @ 37 NONAME ; class HsMenuItemModel * HsMenuService::getAllApplicationsModel(enum Hs::HsSortAttribute) - ?uninstallChange@HsMenuItemModel@@AAEXHH@Z @ 38 NONAME ; void HsMenuItemModel::uninstallChange(int, int) - ??1HsMenuEntryRemovedHandler@@UAE@XZ @ 39 NONAME ; HsMenuEntryRemovedHandler::~HsMenuEntryRemovedHandler(void) - ?trUtf8@HsMenuItemModel@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString HsMenuItemModel::trUtf8(char const *, char const *, int) - ??_EHsMenuEntryRemovedHandler@@UAE@I@Z @ 41 NONAME ; HsMenuEntryRemovedHandler::~HsMenuEntryRemovedHandler(unsigned int) - ?getCollectionNames@HsMenuService@@SA?AVQStringList@@XZ @ 42 NONAME ; class QStringList HsMenuService::getCollectionNames(void) - ?mAllCollectionsId@HsMenuService@@0HA @ 43 NONAME ; int HsMenuService::mAllCollectionsId - ?removeCollection@HsMenuService@@SA_NH@Z @ 44 NONAME ; bool HsMenuService::removeCollection(int) - ?collectionIdByType@HsMenuService@@SAHABVQString@@@Z @ 45 NONAME ; int HsMenuService::collectionIdByType(class QString const &) - ?staticMetaObject@HsMenuEntryRemovedHandler@@2UQMetaObject@@B @ 46 NONAME ; struct QMetaObject const HsMenuEntryRemovedHandler::staticMetaObject - ?entryChanged@HsMenuEntryRemovedHandler@@EAEXHW4ChangeType@@@Z @ 47 NONAME ; void HsMenuEntryRemovedHandler::entryChanged(int, enum ChangeType) - ?sortBy@HsMenuServiceUtils@@SA?AW4SortAttribute@@W4HsSortAttribute@Hs@@@Z @ 48 NONAME ; enum SortAttribute HsMenuServiceUtils::sortBy(enum Hs::HsSortAttribute) - ?getAllCollectionsModel@HsMenuService@@SAPAVHsMenuItemModel@@XZ @ 49 NONAME ; class HsMenuItemModel * HsMenuService::getAllCollectionsModel(void) - ?setSort@HsMenuItemModel@@QAEXW4HsSortAttribute@Hs@@@Z @ 50 NONAME ; void HsMenuItemModel::setSort(enum Hs::HsSortAttribute) - ??0HsMenuEntryRemovedHandler@@QAE@HPAVQObject@@PBD@Z @ 51 NONAME ; HsMenuEntryRemovedHandler::HsMenuEntryRemovedHandler(int, class QObject *, char const *) - ?qt_metacall@HsMenuEntryRemovedHandler@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 52 NONAME ; int HsMenuEntryRemovedHandler::qt_metacall(enum QMetaObject::Call, int, void * *) - ?notify@HsMenuEntryRemovedHandler@@IAEXXZ @ 53 NONAME ; void HsMenuEntryRemovedHandler::notify(void) - ?subscribe@HsMenuEntryRemovedHandler@@AAEXH@Z @ 54 NONAME ; void HsMenuEntryRemovedHandler::subscribe(int) - ?trUtf8@HsMenuItemModel@@SA?AVQString@@PBD0@Z @ 55 NONAME ; class QString HsMenuItemModel::trUtf8(char const *, char const *) - ?renameCollection@HsMenuService@@SA_NHABVQString@@@Z @ 56 NONAME ; bool HsMenuService::renameCollection(int, class QString const &) - ?removeApplicationFromCollection@HsMenuService@@SA_NHH@Z @ 57 NONAME ; bool HsMenuService::removeApplicationFromCollection(int, int) - ?tr@HsMenuItemModel@@SA?AVQString@@PBD0@Z @ 58 NONAME ; class QString HsMenuItemModel::tr(char const *, char const *) - ?getStaticMetaObject@HsMenuEntryRemovedHandler@@SAABUQMetaObject@@XZ @ 59 NONAME ; struct QMetaObject const & HsMenuEntryRemovedHandler::getStaticMetaObject(void) - ?executeAction@HsMenuService@@SAHABVCaEntry@@ABVQString@@PAVQObject@@PBD@Z @ 60 NONAME ; int HsMenuService::executeAction(class CaEntry const &, class QString const &, class QObject *, char const *) + ?executeAction@HsMenuService@@SAHABVCaEntry@@ABVQString@@PAVQObject@@PBD@Z @ 30 NONAME ; int HsMenuService::executeAction(class CaEntry const &, class QString const &, class QObject *, char const *) + ?launchSoftwareUpdate@HsMenuService@@SAHXZ @ 31 NONAME ; int HsMenuService::launchSoftwareUpdate(void) + ?getStaticMetaObject@HsMenuItemModel@@SAABUQMetaObject@@XZ @ 32 NONAME ; struct QMetaObject const & HsMenuItemModel::getStaticMetaObject(void) + ?executeAction@HsMenuService@@SAHHABVQString@@PAVQObject@@PBD@Z @ 33 NONAME ; int HsMenuService::executeAction(int, class QString const &, class QObject *, char const *) + ?touch@HsMenuService@@SAXABV?$QList@H@@@Z @ 34 NONAME ; void HsMenuService::touch(class QList const &) + ?getSecondLine@HsMenuCollectionsItemModel@@ABE?AVQString@@PBVCaEntry@@@Z @ 35 NONAME ; class QString HsMenuCollectionsItemModel::getSecondLine(class CaEntry const *) const + ?sortOrder@HsMenuServiceUtils@@SA?AW4SortOrder@Qt@@W4HsSortAttribute@Hs@@@Z @ 36 NONAME ; enum Qt::SortOrder HsMenuServiceUtils::sortOrder(enum Hs::HsSortAttribute) + ?newIconNeeded@HsMenuItemModel@@QBE_NABVQModelIndex@@@Z @ 37 NONAME ; bool HsMenuItemModel::newIconNeeded(class QModelIndex const &) const + ?getAllApplicationsModel@HsMenuService@@SAPAVHsMenuItemModel@@W4HsSortAttribute@Hs@@@Z @ 38 NONAME ; class HsMenuItemModel * HsMenuService::getAllApplicationsModel(enum Hs::HsSortAttribute) + ?uninstallChange@HsMenuItemModel@@AAEXHH@Z @ 39 NONAME ; void HsMenuItemModel::uninstallChange(int, int) + ??1HsMenuEntryRemovedHandler@@UAE@XZ @ 40 NONAME ; HsMenuEntryRemovedHandler::~HsMenuEntryRemovedHandler(void) + ?trUtf8@HsMenuItemModel@@SA?AVQString@@PBD0H@Z @ 41 NONAME ; class QString HsMenuItemModel::trUtf8(char const *, char const *, int) + ??_EHsMenuEntryRemovedHandler@@UAE@I@Z @ 42 NONAME ; HsMenuEntryRemovedHandler::~HsMenuEntryRemovedHandler(unsigned int) + ?getCollectionNames@HsMenuService@@SA?AVQStringList@@XZ @ 43 NONAME ; class QStringList HsMenuService::getCollectionNames(void) + ?mAllCollectionsId@HsMenuService@@0HA @ 44 NONAME ; int HsMenuService::mAllCollectionsId + ?removeCollection@HsMenuService@@SA_NH@Z @ 45 NONAME ; bool HsMenuService::removeCollection(int) + ?collectionIdByType@HsMenuService@@SAHABVQString@@@Z @ 46 NONAME ; int HsMenuService::collectionIdByType(class QString const &) + ?staticMetaObject@HsMenuEntryRemovedHandler@@2UQMetaObject@@B @ 47 NONAME ; struct QMetaObject const HsMenuEntryRemovedHandler::staticMetaObject + ?entryChanged@HsMenuEntryRemovedHandler@@EAEXHW4ChangeType@@@Z @ 48 NONAME ; void HsMenuEntryRemovedHandler::entryChanged(int, enum ChangeType) + ?sortBy@HsMenuServiceUtils@@SA?AW4SortAttribute@@W4HsSortAttribute@Hs@@@Z @ 49 NONAME ; enum SortAttribute HsMenuServiceUtils::sortBy(enum Hs::HsSortAttribute) + ?getAllCollectionsModel@HsMenuService@@SAPAVHsMenuItemModel@@XZ @ 50 NONAME ; class HsMenuItemModel * HsMenuService::getAllCollectionsModel(void) + ?setSort@HsMenuItemModel@@QAEXW4HsSortAttribute@Hs@@@Z @ 51 NONAME ; void HsMenuItemModel::setSort(enum Hs::HsSortAttribute) + ??0HsMenuEntryRemovedHandler@@QAE@HPAVQObject@@PBD@Z @ 52 NONAME ; HsMenuEntryRemovedHandler::HsMenuEntryRemovedHandler(int, class QObject *, char const *) + ?qt_metacall@HsMenuEntryRemovedHandler@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 53 NONAME ; int HsMenuEntryRemovedHandler::qt_metacall(enum QMetaObject::Call, int, void * *) + ?notify@HsMenuEntryRemovedHandler@@IAEXXZ @ 54 NONAME ; void HsMenuEntryRemovedHandler::notify(void) + ?touch@HsMenuService@@SAXABVCaEntry@@@Z @ 55 NONAME ; void HsMenuService::touch(class CaEntry const &) + ?subscribe@HsMenuEntryRemovedHandler@@AAEXH@Z @ 56 NONAME ; void HsMenuEntryRemovedHandler::subscribe(int) + ?trUtf8@HsMenuItemModel@@SA?AVQString@@PBD0@Z @ 57 NONAME ; class QString HsMenuItemModel::trUtf8(char const *, char const *) + ?renameCollection@HsMenuService@@SA_NHABVQString@@@Z @ 58 NONAME ; bool HsMenuService::renameCollection(int, class QString const &) + ?removeApplicationFromCollection@HsMenuService@@SA_NHH@Z @ 59 NONAME ; bool HsMenuService::removeApplicationFromCollection(int, int) + ?tr@HsMenuItemModel@@SA?AVQString@@PBD0@Z @ 60 NONAME ; class QString HsMenuItemModel::tr(char const *, char const *) + ?getStaticMetaObject@HsMenuEntryRemovedHandler@@SAABUQMetaObject@@XZ @ 61 NONAME ; struct QMetaObject const & HsMenuEntryRemovedHandler::getStaticMetaObject(void) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/eabi/hsmenuserviceprovideru.def --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/eabi/hsmenuserviceprovideru.def Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/eabi/hsmenuserviceprovideru.def Wed Oct 06 16:06:24 2010 +0300 @@ -1,66 +1,67 @@ EXPORTS - _ZN13HsMenuService13executeActionEiRK7QStringP7QObjectPKc @ 1 NONAME - _ZN13HsMenuService16allCollectionsIdEv @ 2 NONAME - _ZN13HsMenuService16createCollectionERK7QString @ 3 NONAME - _ZN13HsMenuService16removeCollectionEi @ 4 NONAME - _ZN13HsMenuService16renameCollectionEiRK7QString @ 5 NONAME - _ZN13HsMenuService17getInstalledModelEN2Hs15HsSortAttributeE @ 6 NONAME - _ZN13HsMenuService17mAllCollectionsIdE @ 7 NONAME DATA 4 - _ZN13HsMenuService18collectionIdByTypeERK7QString @ 8 NONAME - _ZN13HsMenuService18getCollectionModelEiN2Hs15HsSortAttributeERK7QString @ 9 NONAME - _ZN13HsMenuService18getCollectionNamesEv @ 10 NONAME - _ZN13HsMenuService18launchTaskSwitcherEv @ 11 NONAME - _ZN13HsMenuService18organizeCollectionEiR5QListIiE @ 12 NONAME - _ZN13HsMenuService20launchSoftwareUpdateEv @ 13 NONAME - _ZN13HsMenuService22getAllCollectionsModelEv @ 14 NONAME - _ZN13HsMenuService23getAllApplicationsModelEN2Hs15HsSortAttributeE @ 15 NONAME - _ZN13HsMenuService27addApplicationsToCollectionERK5QListIiEi @ 16 NONAME - _ZN13HsMenuService31removeApplicationFromCollectionEii @ 17 NONAME - _ZN13HsMenuService5touchERK5QListIiE @ 18 NONAME - _ZN13HsMenuService5touchEi @ 19 NONAME - _ZN13HsMenuService7getNameEi @ 20 NONAME - _ZN15HsMenuItemModel11qt_metacallEN11QMetaObject4CallEiPPv @ 21 NONAME - _ZN15HsMenuItemModel11qt_metacastEPKc @ 22 NONAME - _ZN15HsMenuItemModel12preloadIconsEv @ 23 NONAME - _ZN15HsMenuItemModel15uninstallChangeEii @ 24 NONAME - _ZN15HsMenuItemModel16staticMetaObjectE @ 25 NONAME DATA 16 - _ZN15HsMenuItemModel19getStaticMetaObjectEv @ 26 NONAME - _ZN15HsMenuItemModel7setSortEN2Hs15HsSortAttributeE @ 27 NONAME - _ZN15HsMenuItemModelC1ERK7CaQueryP7QObject @ 28 NONAME - _ZN15HsMenuItemModelC2ERK7CaQueryP7QObject @ 29 NONAME - _ZN15HsMenuItemModelD0Ev @ 30 NONAME - _ZN15HsMenuItemModelD1Ev @ 31 NONAME - _ZN15HsMenuItemModelD2Ev @ 32 NONAME - _ZN18HsMenuServiceUtils6sortByEN2Hs15HsSortAttributeE @ 33 NONAME - _ZN18HsMenuServiceUtils9sortOrderEN2Hs15HsSortAttributeE @ 34 NONAME - _ZN25HsMenuEntryRemovedHandler11qt_metacallEN11QMetaObject4CallEiPPv @ 35 NONAME - _ZN25HsMenuEntryRemovedHandler11qt_metacastEPKc @ 36 NONAME - _ZN25HsMenuEntryRemovedHandler12entryChangedEi10ChangeType @ 37 NONAME - _ZN25HsMenuEntryRemovedHandler16staticMetaObjectE @ 38 NONAME DATA 16 - _ZN25HsMenuEntryRemovedHandler19getStaticMetaObjectEv @ 39 NONAME - _ZN25HsMenuEntryRemovedHandler6notifyEv @ 40 NONAME - _ZN25HsMenuEntryRemovedHandler9subscribeEi @ 41 NONAME - _ZN25HsMenuEntryRemovedHandlerC1EiP7QObjectPKc @ 42 NONAME - _ZN25HsMenuEntryRemovedHandlerC2EiP7QObjectPKc @ 43 NONAME - _ZN25HsMenuEntryRemovedHandlerD0Ev @ 44 NONAME - _ZN25HsMenuEntryRemovedHandlerD1Ev @ 45 NONAME - _ZN25HsMenuEntryRemovedHandlerD2Ev @ 46 NONAME - _ZN26HsMenuCollectionsItemModelC1ERK7CaQueryP7QObject @ 47 NONAME - _ZN26HsMenuCollectionsItemModelC2ERK7CaQueryP7QObject @ 48 NONAME - _ZN26HsMenuCollectionsItemModelD0Ev @ 49 NONAME - _ZN26HsMenuCollectionsItemModelD1Ev @ 50 NONAME - _ZN26HsMenuCollectionsItemModelD2Ev @ 51 NONAME - _ZNK15HsMenuItemModel10metaObjectEv @ 52 NONAME - _ZNK15HsMenuItemModel13newIconNeededERK11QModelIndex @ 53 NONAME - _ZNK15HsMenuItemModel4dataERK11QModelIndexi @ 54 NONAME - _ZNK25HsMenuEntryRemovedHandler10metaObjectEv @ 55 NONAME - _ZNK26HsMenuCollectionsItemModel13getSecondLineEPK7CaEntry @ 56 NONAME - _ZNK26HsMenuCollectionsItemModel4dataERK11QModelIndexi @ 57 NONAME - _ZTI15HsMenuItemModel @ 58 NONAME - _ZTI25HsMenuEntryRemovedHandler @ 59 NONAME - _ZTI26HsMenuCollectionsItemModel @ 60 NONAME - _ZTV15HsMenuItemModel @ 61 NONAME - _ZTV25HsMenuEntryRemovedHandler @ 62 NONAME - _ZTV26HsMenuCollectionsItemModel @ 63 NONAME - _ZN13HsMenuService13executeActionERK7CaEntryRK7QStringP7QObjectPKc @ 64 NONAME + _ZN13HsMenuService13executeActionERK7CaEntryRK7QStringP7QObjectPKc @ 1 NONAME + _ZN13HsMenuService13executeActionEiRK7QStringP7QObjectPKc @ 2 NONAME + _ZN13HsMenuService16allCollectionsIdEv @ 3 NONAME + _ZN13HsMenuService16createCollectionERK7QString @ 4 NONAME + _ZN13HsMenuService16removeCollectionEi @ 5 NONAME + _ZN13HsMenuService16renameCollectionEiRK7QString @ 6 NONAME + _ZN13HsMenuService17getInstalledModelEN2Hs15HsSortAttributeE @ 7 NONAME + _ZN13HsMenuService17mAllCollectionsIdE @ 8 NONAME DATA 4 + _ZN13HsMenuService18collectionIdByTypeERK7QString @ 9 NONAME + _ZN13HsMenuService18getCollectionModelEiN2Hs15HsSortAttributeERK7QString @ 10 NONAME + _ZN13HsMenuService18getCollectionNamesEv @ 11 NONAME + _ZN13HsMenuService18launchTaskSwitcherEv @ 12 NONAME + _ZN13HsMenuService18organizeCollectionEiR5QListIiE @ 13 NONAME + _ZN13HsMenuService20launchSoftwareUpdateEv @ 14 NONAME + _ZN13HsMenuService22getAllCollectionsModelEv @ 15 NONAME + _ZN13HsMenuService23getAllApplicationsModelEN2Hs15HsSortAttributeE @ 16 NONAME + _ZN13HsMenuService27addApplicationsToCollectionERK5QListIiEi @ 17 NONAME + _ZN13HsMenuService31removeApplicationFromCollectionEii @ 18 NONAME + _ZN13HsMenuService5touchERK5QListIiE @ 19 NONAME + _ZN13HsMenuService5touchERK7CaEntry @ 20 NONAME + _ZN13HsMenuService5touchEi @ 21 NONAME + _ZN13HsMenuService7getNameEi @ 22 NONAME + _ZN15HsMenuItemModel11qt_metacallEN11QMetaObject4CallEiPPv @ 23 NONAME + _ZN15HsMenuItemModel11qt_metacastEPKc @ 24 NONAME + _ZN15HsMenuItemModel12preloadIconsEv @ 25 NONAME + _ZN15HsMenuItemModel15uninstallChangeEii @ 26 NONAME + _ZN15HsMenuItemModel16staticMetaObjectE @ 27 NONAME DATA 16 + _ZN15HsMenuItemModel19getStaticMetaObjectEv @ 28 NONAME + _ZN15HsMenuItemModel7setSortEN2Hs15HsSortAttributeE @ 29 NONAME + _ZN15HsMenuItemModelC1ERK7CaQueryP7QObject @ 30 NONAME + _ZN15HsMenuItemModelC2ERK7CaQueryP7QObject @ 31 NONAME + _ZN15HsMenuItemModelD0Ev @ 32 NONAME + _ZN15HsMenuItemModelD1Ev @ 33 NONAME + _ZN15HsMenuItemModelD2Ev @ 34 NONAME + _ZN18HsMenuServiceUtils6sortByEN2Hs15HsSortAttributeE @ 35 NONAME + _ZN18HsMenuServiceUtils9sortOrderEN2Hs15HsSortAttributeE @ 36 NONAME + _ZN25HsMenuEntryRemovedHandler11qt_metacallEN11QMetaObject4CallEiPPv @ 37 NONAME + _ZN25HsMenuEntryRemovedHandler11qt_metacastEPKc @ 38 NONAME + _ZN25HsMenuEntryRemovedHandler12entryChangedEi10ChangeType @ 39 NONAME + _ZN25HsMenuEntryRemovedHandler16staticMetaObjectE @ 40 NONAME DATA 16 + _ZN25HsMenuEntryRemovedHandler19getStaticMetaObjectEv @ 41 NONAME + _ZN25HsMenuEntryRemovedHandler6notifyEv @ 42 NONAME + _ZN25HsMenuEntryRemovedHandler9subscribeEi @ 43 NONAME + _ZN25HsMenuEntryRemovedHandlerC1EiP7QObjectPKc @ 44 NONAME + _ZN25HsMenuEntryRemovedHandlerC2EiP7QObjectPKc @ 45 NONAME + _ZN25HsMenuEntryRemovedHandlerD0Ev @ 46 NONAME + _ZN25HsMenuEntryRemovedHandlerD1Ev @ 47 NONAME + _ZN25HsMenuEntryRemovedHandlerD2Ev @ 48 NONAME + _ZN26HsMenuCollectionsItemModelC1ERK7CaQueryP7QObject @ 49 NONAME + _ZN26HsMenuCollectionsItemModelC2ERK7CaQueryP7QObject @ 50 NONAME + _ZN26HsMenuCollectionsItemModelD0Ev @ 51 NONAME + _ZN26HsMenuCollectionsItemModelD1Ev @ 52 NONAME + _ZN26HsMenuCollectionsItemModelD2Ev @ 53 NONAME + _ZNK15HsMenuItemModel10metaObjectEv @ 54 NONAME + _ZNK15HsMenuItemModel13newIconNeededERK11QModelIndex @ 55 NONAME + _ZNK15HsMenuItemModel4dataERK11QModelIndexi @ 56 NONAME + _ZNK25HsMenuEntryRemovedHandler10metaObjectEv @ 57 NONAME + _ZNK26HsMenuCollectionsItemModel13getSecondLineEPK7CaEntry @ 58 NONAME + _ZNK26HsMenuCollectionsItemModel4dataERK11QModelIndexi @ 59 NONAME + _ZTI15HsMenuItemModel @ 60 NONAME + _ZTI25HsMenuEntryRemovedHandler @ 61 NONAME + _ZTI26HsMenuCollectionsItemModel @ 62 NONAME + _ZTV15HsMenuItemModel @ 63 NONAME + _ZTV25HsMenuEntryRemovedHandler @ 64 NONAME + _ZTV26HsMenuCollectionsItemModel @ 65 NONAME diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/hsmenuserviceprovider.pro --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/hsmenuserviceprovider.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/hsmenuserviceprovider.pro Wed Oct 06 16:06:24 2010 +0300 @@ -27,5 +27,7 @@ -lcasoftwareregistry symbian::TARGET.UID3 = 0x20026FA9 +!symbian:exportResources(./resource/*.png, resource) + + symbian:MMP_RULES += SMPSAFE -!symbian:exportResources(./resource/*.png, resource) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/inc/hsmenuservice.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/inc/hsmenuservice.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/inc/hsmenuservice.h Wed Oct 06 16:06:24 2010 +0300 @@ -74,6 +74,8 @@ static int collectionIdByType(const QString& collectionType); static void touch(int entryId); + + static void touch(const CaEntry &entry); static void touch(const QList &entryIdList); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/inc/hsmenuservice_global.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/inc/hsmenuservice_global.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/inc/hsmenuservice_global.h Wed Oct 06 16:06:24 2010 +0300 @@ -20,6 +20,7 @@ // System includes #include +#include #ifdef MENUSERVICE_LIB #define MENUSERVICE_EXPORT Q_DECL_EXPORT @@ -104,25 +105,9 @@ #endif -#define HSMENUTESTTIME_ENTRY(function) \ - TInt64 HSMENUTEST_ENTRY_TIME(0); \ - { \ - TTime t; \ - t.UniversalTime(); \ - qDebug("\n" function " entry:%20lld", t.Int64()); \ - HSMENUTEST_ENTRY_TIME = t.Int64(); \ - } - -#define HSMENUTESTTIME_EXIT(function) { \ - TTime t; \ - t.UniversalTime(); \ - qDebug("\n" function " entry:%20lld\n" function " difference:%20lld", t.Int64(), \ - t.Int64()-HSMENUTEST_ENTRY_TIME); \ - } - #define HSMENUTEST_FUNC_ENTRY(function) HSMENUTEST_FREERAM_ENTRY(function) \ - HSMENUTESTTIME_ENTRY(function) -#define HSMENUTEST_FUNC_EXIT(function) HSMENUTESTTIME_EXIT(function) \ + qDebug()<< function << " entry"; +#define HSMENUTEST_FUNC_EXIT(function) qDebug()<< function << " exit"; \ HSMENUTEST_FREERAM_EXIT(function) #else //Q_OS_SYMBIAN @@ -132,6 +117,7 @@ #else //NFT #define HSMENUTEST_FUNC_ENTRY(function) #define HSMENUTEST_FUNC_EXIT(function) +#define HSMENUTEST(aText) #endif //NFT diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuitemmodel.cpp --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuitemmodel.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuitemmodel.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -85,14 +85,16 @@ HSMENUTEST_FUNC_ENTRY("HsMenuItemModel::data"); QVariant variant; - if (role == Qt::DecorationRole && secondLineVisibility() - && newIconNeeded(index)) { + if (role == Qt::DecorationRole && newIconNeeded(index)) { QList icons; + + QVariant iconVariant = CaItemModel::data(index, role); + HbIcon icon = iconVariant.value(); + icon.addProportionalBadge(Qt::AlignTop | Qt::AlignRight, + HbIcon(Hs::newIconId), QSizeF(0.5, 0.5)); + icons << HbIcon(icon); - icons << CaItemModel::data(index, role); - icons << HbIcon(Hs::newIconId); - - variant = QVariant(icons); + variant = QVariant(icons); } else if (role == Hb::IndexFeedbackRole){ QVariant display = CaItemModel::data(index, Qt::DisplayRole); if (display.type() == QVariant::String){ @@ -100,9 +102,20 @@ } else { variant = QVariant(display.toList().at(0).toString().at(0).toUpper()); } + } else if (role == Qt::DecorationRole && secondLineVisibility() + && !(entry(index)->flags() & MissingEntryFlag) + && entry(index)->entryTypeName() == Hs::packageTypeName) { + QList icons; + + icons << CaItemModel::data(index, role); + icons << HbIcon(entry(index)->attribute(Hs::drivesIconIdsAttributeName)); + + variant = QVariant(icons); } else { + variant = CaItemModel::data(index, role); } + HSMENUTEST(QString("role: %1, value: %2").arg(role).arg(variant.toString())); HSMENUTEST_FUNC_EXIT("HsMenuItemModel::data"); return variant; @@ -157,3 +170,4 @@ { mIconsIdleLoader = new HsIconsIdleLoader(this, this); } + diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/src/hsmenuservice.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -266,8 +266,8 @@ << collection; collection->setText(newCollectionName); - collection->setAttribute(COLLECTION_TITLE_NAME, newCollectionName); collection->setAttribute(COLLECTION_SHORT_NAME, newCollectionName); + collection->removeAttribute(COLLECTION_TITLE_NAME); result = CaService::instance()->updateEntry(*collection); } HSMENUTEST_FUNC_EXIT("HsMenuService::renameCollection"); @@ -393,8 +393,7 @@ /*! Touch action on an entry. \param entryId of this entry. - \retval boolean error code. - */ +*/ void HsMenuService::touch(int entryId) { QSharedPointer entry = CaService::instance()->getEntry(entryId); @@ -402,9 +401,17 @@ } /*! + Touch action on an entry. + \param entry of this item. + */ +void HsMenuService::touch(const CaEntry &entry) +{ + CaService::instance()->touch(entry); +} + +/*! Touch action on an lists of entries. \param entryIdList of this entry. - \retval boolean error code. */ void HsMenuService::touch(const QList &entryIdList) { diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caentry.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caentry.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caentry.h Wed Oct 06 16:06:24 2010 +0300 @@ -66,10 +66,12 @@ { mSetCaIconDescription = iconDescription; } + EntryFlags flags() const { return mFlagsResult; } + void setFlags(EntryFlags flags) { mFlagsResult = flags; @@ -89,6 +91,13 @@ { mAttributes.insert(name, value); } + + + void removeAttribute(const QString &name) + { + mAttributes.remove(name); + } + QString attribute(const QString &name) const { return mAttributes[name]; @@ -102,7 +111,7 @@ EntryRole role() const { - return mCaEntryRole; + return mCaEntryRole; } // test helper, not belonging to ContentStorage CaEntry diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caitemmodel.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caitemmodel.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caitemmodel.h Wed Oct 06 16:06:24 2010 +0300 @@ -108,14 +108,17 @@ mDataRole = role; return mDataResult; } + void setAutoUpdate(bool autoUpdate) { mIsAutoUpdateResult = autoUpdate; } + void setSecondLineVisibility(bool secondLineVisible) { mSecondLineVisibilityResult = secondLineVisible; } + bool secondLineVisibility() const { return mSecondLineVisibilityResult; @@ -142,24 +145,30 @@ { return mGetIconSizeResult; } + void updateModel(){} + void setParentId(int parentId) { Q_UNUSED(parentId); } + void setFlagsOn(const EntryFlags &onFlags) { Q_UNUSED(onFlags); } + void setFlagsOff(const EntryFlags &offFlags) { Q_UNUSED(offFlags); } + QSharedPointer entry(const QModelIndex &index) const { Q_UNUSED(index); return mEntryResult; } + QList getUninstallingEntriesIds(int componentId) { Q_UNUSED(componentId); @@ -168,6 +177,7 @@ ids.append(4); return ids; } + void updateProgress(int id, int valueOfProgress) { if (id == mEntryResult->id()) { diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/canotifierfilter.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/canotifierfilter.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/canotifierfilter.h Wed Oct 06 16:06:24 2010 +0300 @@ -19,11 +19,8 @@ #define CANOTIFIERFILTER_H #include - #include - - class CaQuery; class CaNotifierFilter diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caservice.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caservice.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/caservice.h Wed Oct 06 16:06:24 2010 +0300 @@ -25,7 +25,6 @@ #include #include - #include "caservice.h" #include "caquery.h" #include "caentry.h" @@ -166,10 +165,6 @@ friend class QtSharedPointer::ExternalRefCount; }; - - - - inline CaService::CaService(QObject *parent) : QObject(parent), mGetEntryId(0), @@ -190,7 +185,6 @@ mCustomSortGroupId(0), mCustomSortResult(false), mCreateNotifierResult(0) - { } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/t_hsmenuserviceprovider.h --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/t_hsmenuserviceprovider.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/inc/t_hsmenuserviceprovider.h Wed Oct 06 16:06:24 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -15,7 +15,6 @@ * */ - #ifndef T_HSMCSSTATES_H #define T_HSMCSSTATES_H #include @@ -61,6 +60,7 @@ void MenuService_removeApplicationFromCollection(); void MenuService_organizeCollection(); void MenuService_touchAction(); + void MenuService_touchAction_ByEntry(); void MenuService_touchListOfIdsAction(); void MenuService_launchSoftwareUpdate(); void MenuService_collectionIdByType(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_hsmenuentryremovedhandler.cpp --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_hsmenuentryremovedhandler.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_hsmenuentryremovedhandler.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -26,8 +26,10 @@ #include "canotifier.h" #include "canotifierfilter.h" - - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuEntryRemovedHandlerTest_data() { // define testing data table @@ -48,6 +50,10 @@ QTest::newRow("no_notification") << 1 << static_cast(RemoveChangeType) << 0 << 0; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuEntryRemovedHandlerTest() { QFETCH(int, subscribedId); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_menuitemmodel.cpp --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_menuitemmodel.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_menuitemmodel.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -14,6 +14,7 @@ * Description: * */ + #include #include #include "caquery.h" @@ -25,6 +26,11 @@ #include "t_hsmenuserviceprovider.h" #include "hsiconsidleloader.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuItemModel_construction() { QScopedPointer parent(new QObject); @@ -36,6 +42,10 @@ QVERIFY(model.getIconSize().isValid()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuItemModel_setSort() { HsMenuItemModel model(CaQuery(), this); @@ -56,34 +66,39 @@ } } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuItemModel_getData() { HsMenuItemModel model(CaQuery(), this); Qt::ItemDataRole role = Qt::DecorationRole; const QModelIndex index = model.index(0, 0); - const QVariant expectedDecoration(QString("entryText")); - QList expectedResult; - expectedResult << expectedDecoration; - expectedResult << HbIcon(Hs::newIconId); + const QVariant expectedDecoration = QVariant(HbIcon(Hs::newIconId)); model.mRootResult = index; model.mEntryResult->mFlagsResult = 0; model.mEntryResult->mEntryTypeNameResult = Hs::collectionDownloadedTypeName; model.setSecondLineVisibility(true); - model.mDataResult = QVariant(expectedDecoration); + model.mDataResult = expectedDecoration; QList actualResult = model.data(index, role).toList(); - - QCOMPARE(actualResult.at(0).toString(), - expectedDecoration.toString()); - QCOMPARE(actualResult.at(1).value().iconName(), + + QCOMPARE(model.mDataIndex,index); + QCOMPARE(model.mDataRole,(int)role); + QCOMPARE(actualResult.empty(),false); + QCOMPARE(actualResult.at(0).value().iconName(), QString(Hs::newIconId)); - + QCOMPARE(model.data(index), model.mDataResult); } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuItemModel_newIconNeeded() { HsMenuItemModel model(CaQuery(), this); @@ -111,7 +126,10 @@ } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuItemModel_uninstallChange() { HsMenuItemModel model(CaQuery(), this); @@ -132,6 +150,10 @@ QString("uninstall_progress")), QString("20")); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuCollectionsItemModel_construction() { QScopedPointer parent(new QObject); @@ -143,8 +165,10 @@ QVERIFY(model.getIconSize().isValid()); } - - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuCollectionsItemModel_getData() { HsMenuCollectionsItemModel model(CaQuery(), this); @@ -175,8 +199,11 @@ model.setSecondLineVisibility(false); QCOMPARE(model.data(index), expectedData); } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- +// void MenuServiceTest::HsMenuCollectionsItemModel_getSecondLine() { HsMenuCollectionsItemModel model(CaQuery(), this); @@ -243,10 +270,7 @@ // set up mock data Qt::ItemDataRole role = Qt::DecorationRole; const QModelIndex index = model.index(0, 0); - const QVariant expectedDecoration(QString("entryText")); - QList expectedResult; - expectedResult << expectedDecoration; - expectedResult << HbIcon(Hs::newIconId); + const QVariant expectedDecoration = QVariant(HbIcon(Hs::newIconId)); model.mRootResult = index; model.mEntryResult->mFlagsResult = 0; model.mEntryResult->mEntryTypeNameResult = Hs::collectionDownloadedTypeName; @@ -257,9 +281,10 @@ model.mEntryResult->mMakeIconResult = HbIcon(Hs::newIconId); // verify mock setup - QCOMPARE(actualResult.at(0).toString(), - expectedDecoration.toString()); - QCOMPARE(actualResult.at(1).value().iconName(), + QCOMPARE(model.mDataIndex,index); + QCOMPARE(model.mDataRole,(int)role); + QCOMPARE(actualResult.empty(),false); + QCOMPARE(actualResult.at(0).value().iconName(), QString(Hs::newIconId)); QCOMPARE(model.data(index), model.mDataResult); @@ -289,10 +314,7 @@ // set up mock data Qt::ItemDataRole role = Qt::DecorationRole; const QModelIndex index = model.index(0, 0); - const QVariant expectedDecoration(QString("entryText")); - QList expectedResult; - expectedResult << expectedDecoration; - expectedResult << HbIcon(Hs::newIconId); + const QVariant expectedDecoration = QVariant(HbIcon(Hs::newIconId)); model.mRootResult = index; model.mEntryResult->mFlagsResult = 0; model.mEntryResult->mEntryTypeNameResult = Hs::collectionDownloadedTypeName; @@ -301,10 +323,11 @@ model.mRowCountResult = 1; // i.e. how many rows the mock model pretends to have QList actualResult = model.data(index, role).toList(); model.mEntryResult->mMakeIconResult = HbIcon(Hs::newIconId); - - QCOMPARE(actualResult.at(0).toString(), - expectedDecoration.toString()); - QCOMPARE(actualResult.at(1).value().iconName(), + + QCOMPARE(model.mDataIndex,index); + QCOMPARE(model.mDataRole,(int)role); + QCOMPARE(actualResult.empty(),false); + QCOMPARE(actualResult.at(0).value().iconName(), QString(Hs::newIconId)); QCOMPARE(model.data(index), model.mDataResult); @@ -322,7 +345,9 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- +// int MenuServiceTest::getId(HsMenuItemModel *model , int idx) { return model->data(model->index(idx), CaItemModel::IdRole).toInt(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_menuservice.cpp --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_menuservice.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/src/t_menuservice.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -34,6 +34,7 @@ QTM_USE_NAMESPACE // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_getAllApplicationsModel() @@ -96,6 +97,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_getAllCollectionsModel() @@ -134,6 +136,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_getInstalledModel() @@ -190,6 +193,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_getCollectionModel() @@ -231,8 +235,6 @@ expectedQuery.setSort( HsMenuServiceUtils::sortBy(Hs::NoHsSortAttribute), HsMenuServiceUtils::sortOrder(Hs::NoHsSortAttribute)); - - } #ifdef Q_OS_SYMBIAN #ifdef UT_MEMORY_CHECK @@ -242,6 +244,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_getCollectionNames() @@ -252,9 +255,6 @@ #endif #endif { - - - QSharedPointer collectionA(new CaEntry); collectionA->mTextResult = "A"; QSharedPointer collectionB(new CaEntry); @@ -290,6 +290,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_getName() @@ -325,6 +326,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_executeAction() @@ -361,6 +363,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_executeActionEntry() @@ -396,6 +399,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // #ifdef Q_OS_SYMBIAN @@ -413,6 +417,10 @@ } #endif//Q_OS_SYMBIAN +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::MenuService_createCollection() { #ifdef Q_OS_SYMBIAN @@ -463,6 +471,10 @@ #endif } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::MenuService_renameCollection() { #ifdef Q_OS_SYMBIAN @@ -499,6 +511,10 @@ #endif } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::MenuService_removeCollection() { #ifdef Q_OS_SYMBIAN @@ -526,7 +542,10 @@ #endif } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::MenuService_addApplicationsToCollection() { #ifdef Q_OS_SYMBIAN @@ -559,6 +578,10 @@ #endif } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuServiceTest::MenuService_removeApplicationFromCollection() { #ifdef Q_OS_SYMBIAN @@ -591,8 +614,8 @@ #endif } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_organizeCollection() @@ -629,8 +652,8 @@ } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_touchAction() @@ -679,8 +702,56 @@ } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void MenuServiceTest::MenuService_touchAction_ByEntry() +{ +#ifdef Q_OS_SYMBIAN +#ifdef UT_MEMORY_CHECK + __UHEAP_MARK; +#endif +#endif + { + QSharedPointer service = CaService::instance(); + + ////touch on unused entry + const int touchedEntryId = 5; + QSharedPointer touchedEntry(new CaEntry); + touchedEntry->mIdResult = touchedEntryId; + touchedEntry->setText("GHI"); + touchedEntry->setFlags(RemovableEntryFlag | VisibleEntryFlag); + service->mGetEntryResult = touchedEntry; + service->mTouchResult = true; + + HsMenuService::touch(*touchedEntry); + QCOMPARE(service->mTouchEntry.id(), touchedEntryId); + QCOMPARE(service->mTouchEntry.text(), touchedEntry->text()); + + ////touch on already used entry + const int unTouchedEntryId = 5; + QSharedPointer unTouchedEntry(new CaEntry); + unTouchedEntry->mIdResult = unTouchedEntryId; + unTouchedEntry->setText("GHI_UT"); + unTouchedEntry->setFlags(0); + service->mGetEntryResult = unTouchedEntry; + service->mTouchResult = true; + + HsMenuService::touch(*touchedEntry); + QCOMPARE(service->mTouchEntry.id(), touchedEntryId); + QCOMPARE(service->mTouchEntry.text(), touchedEntry->text()); + } +#ifdef Q_OS_SYMBIAN +#ifdef UT_MEMORY_CHECK + __UHEAP_MARKEND; +#endif +#endif + +} // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_touchListOfIdsAction() @@ -730,8 +801,8 @@ #endif } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_launchSoftwareUpdate() @@ -763,6 +834,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::MenuService_collectionIdByType() @@ -789,8 +861,8 @@ #endif } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::initTestCase() @@ -806,7 +878,9 @@ { CaService::instance()->clear(); } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::cleanupTestCase() @@ -816,9 +890,10 @@ #endif //Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- +// int threadFunction(void *params) { Q_UNUSED(params) @@ -834,6 +909,7 @@ #ifdef Q_OS_SYMBIAN // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::startThread() @@ -852,7 +928,9 @@ #ifdef Q_OS_SYMBIAN + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuServiceTest::stopThread() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/t_hsmenuserviceprovider.pro --- a/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/t_hsmenuserviceprovider.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/serviceproviders/hsmenuserviceprovider/tsrc/t_hsmenuserviceprovider/t_hsmenuserviceprovider.pro Wed Oct 06 16:06:24 2010 +0300 @@ -75,9 +75,10 @@ - \ 16MB INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - - MMP_RULES += SMPSAFE } include(t_hsmenuserviceprovider.pri) win32:include(installs_win32.pri) !symbian:unix:include(installs_unix.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/docml.pri --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/docml.pri Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/docml.pri Wed Oct 06 16:06:24 2010 +0300 @@ -19,9 +19,8 @@ resource/common_objects.docml \ resource/emptylabeledview.docml \ resource/labeledlistview.docml \ - resource/listview.docml \ resource/searchview.docml - + qrcFile = hsapplibrarystateplugin.qrc } else { qrcFile = hsapplibrarystateplugin_non_symbian.qrc diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrary.qm Binary file homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrary.qm has changed diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrary.ts --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrary.ts Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrary.ts Wed Oct 06 16:06:24 2010 +0300 @@ -14,8 +14,8 @@ Options list item. Note! Only use this text ID if there are no icons. Allows user to rename the selected item (file, folder, music track, image etc.). - Rename - Rename + Rename… + Rename… qtl_menu_sec common opt @@ -27,7 +27,7 @@ View installed applications View installed applications qtl_menu_pri - applib_01 + applib_001, applib_002, applib_003 opt applib False @@ -37,7 +37,7 @@ Add to Home Screen Add to Home Screen qtl_menu_pri - applib_03, applib_09 + applib_001, applib_003, applib_005, applib_009 opt applib False @@ -57,7 +57,7 @@ Following applications will be removed: Following applications will be removed: qtl_dialog_pri5 - applib_29 + applib_029 info applib False @@ -70,7 +70,7 @@ (p)%Ln new applications qtl_list_sec_large_graphic - applib_03 + applib_003 dblist_1_val applib False @@ -80,7 +80,7 @@ Installed Installed qtl_list_popup_pri - applib_20 + applib_020 dialog applib False @@ -90,7 +90,7 @@ Ovi Store Ovi Store qtl_toolbar_extension_tiny_vrt - applib + applib_037 grid applib False @@ -100,7 +100,7 @@ Delete %1 and associated data? Delete %1 and associated data? qtl_dialog_pri5 - applib_29 + applib_029 info applib False @@ -110,7 +110,7 @@ %1 will be removed from phone. Continue? %1 will be removed from phone. Continue? qtl_dialog_pri5_large_graphic - applib_27 + applib_027 info applib False @@ -120,17 +120,27 @@ Add content Add content qtl_menu_pri - applib_09 + applib_009 opt applib False + + This default entry text is used when user has given an already existing collection name. %2 is the user-given name and %L1 is the next available number to differentiate the collection names. + %2(%L1) + %2(%L1) + qtl_list_pri_large_graphic + applib_015 + dialog_1_entry + applib + False + Name label shown in application details dialog Name: Name: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -140,7 +150,7 @@ %L1 MB %L1 MB qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -150,7 +160,7 @@ Add to Homescreen Add to Homescreen qtl_dialog_softkey_2 - applib_13 + applib_013 button applib False @@ -160,7 +170,7 @@ %1: Mass storage %1: Mass storage qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -170,7 +180,7 @@ Delete %1, all it's shortcuts and associated data? Delete %1, all it's shortcuts and associated data? qtl_dialog_pri5 - applib_29 + applib_029 info applib False @@ -180,7 +190,7 @@ Sort by oldest on top Sort by oldest on top qtl_menu_pri - applib_07, applib_05 + applib_007, applib_005 menu applib False @@ -190,7 +200,7 @@ Uninstalling %1 Uninstalling %1 qtl_list_pri_large_graphic - applib_21 + applib_021 dblist_1 applib False @@ -230,7 +240,7 @@ Arrange Arrange qtl_dialog_pri_heading - applib_16 + applib_016 title applib False @@ -240,7 +250,7 @@ Installation log Installation log qtl_menu_pri - applib_07 + applib_007 opt applib False @@ -250,7 +260,7 @@ Task Switcher Task Switcher qtl_menu_pri - applib_01, applib_03, applib_05, applib_07, applib_09, applib_11 + applib_001, applib_003, applib_005, applib_007, applib_009 opt applib False @@ -260,7 +270,7 @@ (No preview available) (No preview available) qtl_dialog_pri5 - applib_30 + applib_030 info applib False @@ -270,7 +280,7 @@ Add to collection... Add to collection... qtl_menu_pri - applib_01 + applib_001 opt applib False @@ -280,11 +290,21 @@ Added to Homescreen Added to Homescreen qtl_notifdialog_pri - applib_18 + applib_018 dpophead applib False + + GroupBox widget, shows the label for the All applications view. %L1 is the number of apps and widgets. + Applications & widgets (%L1) + Applications & widgets (%L1) + qtl_groupbox_simple_sec + applib_001 + subtitle + applib + False + Item specific menu item. Note! Only use this text ID if there are no icons. Opens a view where information about the item is given. Details @@ -300,7 +320,7 @@ Check software updates Check software updates qtl_menu_pri - applib_01 + applib_001, applib_002, applib_003 opt applib False @@ -310,7 +330,7 @@ Collection(%L1) Collection(%L1) qtl_list_pri_large_graphic - applib_15 + applib_015 dialog_1_entry applib False @@ -320,7 +340,7 @@ Sort by ascending Sort by ascending qtl_menu_pri - applib_01 + applib_001 menu applib False @@ -340,7 +360,7 @@ Installer is currently busy Installer is currently busy qtl_dialog_pri5_large_graphic - applib_08 + applib_008 info applib False @@ -350,7 +370,7 @@ Sort by descending Sort by descending qtl_menu_pri - applib_01 + applib_001 menu applib False @@ -370,17 +390,27 @@ Delete %1? Delete %1? qtl_dialog_pri5_large_graphic - applib_24 + applib_024 info applib False + + GroupBox widget, shows the label for the Collections view. %L1 is the number of collections. + Collections (%L1) + Collections (%L1) + qtl_groupbox_simple_sec + applib_003 + subtitle + applib + False + If lauching an application fails, thie note is shown. %1 is error code. Launching the application failed (error code %L1) Launching the application failed (error code %L1) qtl_dialog_pri5_large_graphic - applib_31 + applib_031 info applib False @@ -390,7 +420,7 @@ Deletes %1 also from Home Screen. Continue? Deletes %1 also from Home Screen. Continue? qtl_dialog_pri5_large_graphic - applib_25 + applib_025 info applib False @@ -400,7 +430,7 @@ Format: Format: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -410,7 +440,7 @@ Description: Description: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -420,7 +450,7 @@ %L1 KB %L1 KB qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -430,7 +460,7 @@ Collection name: Collection name: qtl_dialog_sec - applib_15 + applib_015 dialog_1 applib False @@ -450,7 +480,7 @@ Added to collection %1 Added to collection %1 qtl_notifdialog_pri2 - applib_32 + applib_032 dpophead applib False @@ -460,7 +490,7 @@ Empty Empty qtl_list_sec_large_graphic - applib_03 + applib_003 dblist_1_val applib False @@ -470,7 +500,7 @@ Uninstallation failed Uninstallation failed qtl_dialog_pri5_large_graphic - applib_08 + applib_008 info applib False @@ -480,7 +510,7 @@ Removed Removed qtl_list_popup_pri - applib_20 + applib_020 dialog applib False @@ -500,7 +530,7 @@ Arrange Arrange qtl_menu_pri - applib_03 + applib_003 opt applib False @@ -510,7 +540,7 @@ Sort by latest on top Sort by latest on top qtl_menu_pri - applib_07, applib_05 + applib_007, applib_005 menu applib False @@ -520,7 +550,7 @@ %1: Memory card %1: Memory card qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -530,7 +560,7 @@ Supplier: Supplier: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -540,7 +570,7 @@ Select item: Select item: qtl_titlebar - applib_11 + applib_011, applib_012 title applib False @@ -549,8 +579,8 @@ Item specific menu item. Allows the user to add the application/widget to a (virtual) collection. Does not move the item but replicates it in virtual collection. Add to collection Add to collection - qtl_menu_pri - applib_01, applib_05, applib_09 + qtl_menu_sec + applib_001, applib_005, applib_009 menu applib False @@ -560,7 +590,7 @@ No search results No search results qtl_dataform_pri - applib_19 + applib_040 formlabel_1 applib False @@ -570,7 +600,7 @@ Size: Size: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -580,7 +610,7 @@ %1: Device memory %1: Device memory qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -590,7 +620,7 @@ %1: %2 %1: %2 qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -600,7 +630,7 @@ Add to: Add to: qtl_dialog_pri_heading - applib_34 + applib_034 title applib False @@ -610,7 +640,7 @@ Installation logs Installation logs qtl_dialog_pri_heading - applib_20 + applib_020 title applib False @@ -620,7 +650,7 @@ No content No content qtl_dataform_pri - applib_22 + applib_022 formlabel_1 applib False @@ -630,7 +660,7 @@ Create new Create new qtl_dialog_softkey_2 - applib_34 + applib_034 button applib False @@ -640,7 +670,7 @@ %1 and all its shortcuts will be removed from phone. Continue? %1 and all its shortcuts will be removed from phone. Continue? qtl_dialog_pri5_large_graphic - applib_23 + applib_023 info applib False @@ -650,7 +680,7 @@ Remove from collection Remove from collection qtl_menu_sec - applib_09 + applib_009 menu applib False @@ -670,7 +700,7 @@ Memory in use: Memory in use: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -680,7 +710,7 @@ Add to Home Screen Add to Home Screen qtl_menu_sec - applib_01, applib_03, applib_05, applib_09 + applib_001, applib_003, applib_005, applib_009 menu applib False @@ -690,27 +720,27 @@ New collection New collection qtl_menu_pri - applib_03 + applib_003 opt applib False - GroupBox widget, shows the label for the Installed applications view. - Installed - Installed + GroupBox widget, shows the label for the Installed applications view. %L1 is the number of installed items. + Installed (%L1) + Installed (%L1) qtl_groupbox_simple_sec - applib_07 + applib_007 subtitle applib False - Confirmation for removing an app/widget from a collection. Does not delete the item from the device. - Remove %1 from collection? - Remove %1 from collection? + Confirmation for deleting an app/widget from a collection. Does not delete the item from the device. + Delete %1 from collection? + Delete %1 from collection? qtl_dialog_pri5 - applib_26 + applib_026 info applib False @@ -720,7 +750,7 @@ Collection Collection qtl_list_pri_large_graphic - applib_15 + applib_015 dialog_1_entry applib False @@ -730,7 +760,7 @@ Select items: Select items: qtl_dialog_pri_heading - applib_35 + applib_035 title applib False @@ -740,7 +770,7 @@ Protection domain: Protection domain: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -750,7 +780,7 @@ Version: Version: qtl_list_popup_pri - applib_17 + applib_017 dialog applib False @@ -760,7 +790,7 @@ Details Details qtl_dialog_pri_heading - applib_17 + applib_017 title applib False diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -39,10 +39,10 @@ include(hsapplibrarystateplugin_exports_to_rom.pri) LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } RESOURCES = $$qrcFile -exportResources(./*.qm, resource/qt/translations) \ No newline at end of file +exportResources(./*.qm, resource/qt/translations) + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin.qrc --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin.qrc Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin.qrc Wed Oct 06 16:06:24 2010 +0300 @@ -3,7 +3,6 @@ resource/common_objects.docml.bin resource/emptylabeledview.docml.bin resource/labeledlistview.docml.bin - resource/listview.docml.bin resource/searchview.docml.bin diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin_non_symbian.qrc --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin_non_symbian.qrc Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/hsapplibrarystateplugin_non_symbian.qrc Wed Oct 06 16:06:24 2010 +0300 @@ -3,7 +3,6 @@ resource/common_objects.docml resource/emptylabeledview.docml resource/labeledlistview.docml - resource/listview.docml resource/searchview.docml diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallappsstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallappsstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallappsstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -56,6 +56,8 @@ void descendingMenuAction(); void normalModeEntered(); void stateExited(); + void updateLabel(); + private: void construct(); void setMenuOptions(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallcollectionsstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallcollectionsstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsallcollectionsstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -52,6 +52,7 @@ void normalModeEntered(); void normalModeExited(); void stateExited(); + void updateLabel(); private: void construct(); void setMenuOptions(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hscollectionstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hscollectionstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hscollectionstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -72,6 +72,7 @@ void makeDisconnect(); void setContextMenuOptions(HbAbstractViewItem *item, EntryFlags flags); void setMenuOptions(); + void reconnectViewComponents(bool empty); private: Hs::HsSortAttribute mSortAttribute; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsinstalledappsstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsinstalledappsstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsinstalledappsstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -57,6 +57,7 @@ void stateEntered(); void stateExited(); void setEmptyLabelVisibility(bool visibility); + void updateLabel(); void latestOnTopMenuAction(); void oldestOnTopMenuAction(); void launchDetails(const QModelIndex &index); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h Wed Oct 06 16:06:24 2010 +0300 @@ -76,6 +76,7 @@ void hideSearchPanel(); void disableSearch(bool disable); + void disableOviStore(bool disable); private slots: void scrollToRow(int row, diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h Wed Oct 06 16:06:24 2010 +0300 @@ -69,6 +69,7 @@ HbToolBar *toolBar() const; QActionGroup *toolBarActionGroup() const; HbToolBarExtension *toolBarExtension() const; + HbAction *toolBarExtensionAction() const; // mandatory context dependent widgets accessors HbView *currentView(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/resource/listview.docml --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/resource/listview.docml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsaddmodeproxymodel.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsaddmodeproxymodel.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsaddmodeproxymodel.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -133,8 +133,7 @@ } QList< QSharedPointer > entries = CaService::instance()->getEntries(query); - if( entries.count() > 0 ) - { + if (entries.count() > 0) { result = entries[0]->id(); } return result; @@ -147,7 +146,8 @@ \param preferences widget preferences. */ void HsAddModeProxyModel::updateCacheOnAddWidget(const QString &uri, - const QVariantHash &preferences){ + const QVariantHash &preferences) +{ if (uri == Hs::HS_WIDGET_URI_ATTRIBUTE_CWRT_VALUE) { int entryId = findCwrtWidgetEntryId(preferences); if (!mCwrtWidgetCache.value(entryId) ) { @@ -202,5 +202,6 @@ mCwrtWidgetCache.insert(entry.id(), HsAppLibStateUtils::isCWRTWidgetOnHomeScreen(&entry)); } + invalidateFilter(); } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -21,8 +21,8 @@ #include #include #include -#include #include +#include #include #include @@ -93,10 +93,11 @@ mModel = HsMenuService::getAllApplicationsModel(mSortAttribute); mMenuView->setModel(mModel); - + updateLabel(); + connect(mModel, SIGNAL(countChange()), SLOT(updateLabel())); + mModel->preloadIcons(); - mMenuView->listView()->verticalScrollBar()->setInteractive(true); HbIndexFeedback *indexFeedback = new HbIndexFeedback(mMenuView->view()); indexFeedback->setIndexFeedbackPolicy(HbIndexFeedback::IndexFeedbackSingleCharacter); indexFeedback->setItemView(mMenuView->listView()); @@ -201,6 +202,15 @@ } /*! + Slot invoked label has to be changed. + */ +void HsAllAppsState::updateLabel() +{ + mMenuView->viewLabel()->setHeading( + hbTrId("txt_applib_subtitle_applications_widgets_l1").arg( + mModel->rowCount())); +} +/*! Slot called when application is adding to collection. */ void HsAllAppsState::addToCollection() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -74,6 +75,9 @@ mModel = HsMenuService::getAllCollectionsModel(); mMenuView->setModel(mModel); + + updateLabel(); + connect(mModel, SIGNAL(countChange()), SLOT(updateLabel())); HSMENUTEST_FUNC_EXIT("HsAllCollectionsState::construct"); } @@ -174,6 +178,16 @@ } /*! + Slot invoked label has to be changed. + */ +void HsAllCollectionsState::updateLabel() +{ + mMenuView->viewLabel()->setHeading( + hbTrId("txt_applib_subtitle_collections_l1").arg( + mModel->rowCount())); +} + +/*! Slot connected to constructMenu. */ void HsAllCollectionsState::createNewCollection() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsapplibrarystate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsapplibrarystate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsapplibrarystate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -89,7 +89,7 @@ */ HsAppLibraryState::HsAppLibraryState(QState *parent) : QState(parent), mAllAppsState(0), - mHistoryTransaction(0), mAllCollectionsState(0), mCollectionState(0), + mHistoryTransaction(0), mAllCollectionsState(0), mCollectionState(0), mMenuMode(),mMainWindow(&mMenuMode) { construct(); @@ -114,7 +114,7 @@ { HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::construct"); setObjectName("homescreen.nokia.com/state/applibrarystate"); - + mAllAppsState = new HsAllAppsState( mMenuViewBuilder, mMenuMode, mMainWindow, this); @@ -167,7 +167,7 @@ new HsMenuEventTransition(HsMenuEvent::OpenInstalledView, mAllAppsState, mInstalledAppsState); mAllAppsState->addTransition(allViewToInstalledTransition); - + HsMenuEventTransition *allCollectionsToInstalledTransition = new HsMenuEventTransition(HsMenuEvent::OpenInstalledView, mAllCollectionsState, mInstalledAppsState); @@ -225,7 +225,7 @@ mAllAppsState->scrollToBeginning(); mAllCollectionsState->scrollToBeginning(); } - + HSMENUTEST_FUNC_EXIT("HsAppLibraryState::onEntry"); } @@ -244,25 +244,23 @@ if (operatorHandler->oviStorePresent() && operatorHandler->operatorStorePresent()) { - //TODO HbToolBarExtension is not supported in docml currently - //should be changed in future + mMenuViewBuilder.toolBarExtensionAction()->setVisible(true); bool loaded = HbStyleLoader::registerFilePath( ":/css/hsapplibrarystateplugin.css"); Q_ASSERT(loaded); + //TODO HbToolBarExtension is not supported in docml currently + //should be changed in future HbToolBarExtension *const extension( - mMenuViewBuilder.toolBarExtension()); - HbAction *const extensionAction( - mMenuViewBuilder.toolBar()->addExtension(extension)); - - extensionAction->setIcon(HbIcon("qtg_mono_store")); + mMenuViewBuilder.toolBarExtension()); HbAction *const operatorAction( - operatorHandler->prepareOperatorStoreAction( - mMenuViewBuilder.operatorAction())); + operatorHandler->prepareOperatorStoreAction( + mMenuViewBuilder.operatorAction())); operatorAction->setText(hbTrId(operatorHandler->text().toLatin1())); - mMenuViewBuilder.oviStoreAction()->setText(hbTrId("txt_applib_grid_ovi_store")); + mMenuViewBuilder.oviStoreAction()->setText( + hbTrId("txt_applib_grid_ovi_store")); if (operatorHandler->operatorStoreFirst()) { extension->addAction(operatorAction); extension->addAction(mMenuViewBuilder.oviStoreAction()); @@ -272,31 +270,31 @@ } } else if (operatorHandler->oviStorePresent()) { mMenuViewBuilder.toolBar()->addAction( - mMenuViewBuilder.oviStoreAction()); + mMenuViewBuilder.oviStoreAction()); } else if (operatorHandler->operatorStorePresent()) { mMenuViewBuilder.toolBar()->addAction( - operatorHandler->prepareOperatorStoreAction( - mMenuViewBuilder.operatorAction())); + operatorHandler->prepareOperatorStoreAction( + mMenuViewBuilder.operatorAction())); } HbAction *const allCollectionsAction( - mMenuViewBuilder.allCollectionsAction()); + mMenuViewBuilder.allCollectionsAction()); mAllAppsState->addTransition( - allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState); + allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState); mCollectionState->addTransition( - allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState); + allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState); HbAction *const allAppsAction(mMenuViewBuilder.allAppsAction()); mAllCollectionsState->addTransition( - allAppsAction, SIGNAL(triggered()), mAllAppsState); + allAppsAction, SIGNAL(triggered()), mAllAppsState); mCollectionState->addTransition( - allAppsAction, SIGNAL(triggered()), mAllAppsState); + allAppsAction, SIGNAL(triggered()), mAllAppsState); mAllAppsState->assignProperty(allAppsAction, "checked", true); mAllCollectionsState->assignProperty( - allCollectionsAction, "checked", true); + allCollectionsAction, "checked", true); HSMENUTEST_FUNC_EXIT("HsAppLibraryState::constructToolbar"); } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsbaseviewstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsbaseviewstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsbaseviewstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -114,7 +114,7 @@ message, HsMenuDialogFactory::Close); QScopedPointer entryObserver( - new HsMenuEntryRemovedHandler(itemId, + new HsMenuEntryRemovedHandler(itemId, mApplicationLaunchFailMessage.data(), SLOT(close()))); entryObserver.take()->setParent(mApplicationLaunchFailMessage.data()); @@ -159,6 +159,7 @@ void HsBaseViewState::addModeEntered() { mViewOptions = mMenuView->view()->takeMenu(); + mMenuView->disableOviStore(true); connect(mMenuView.data(), SIGNAL(activated(QModelIndex)), SLOT(addActivated(QModelIndex))); @@ -181,6 +182,7 @@ void HsBaseViewState::normalModeEntered() { setMenuOptions(); + mMenuView->disableOviStore(false); connect(mMenuView.data(), SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), SLOT(showContextMenu(HbAbstractViewItem *, QPointF))); @@ -210,10 +212,9 @@ machine()->postEvent(HsMenuEventFactory::createPreviewHSWidgetEvent(entry->id(), entry->entryTypeName(), entry->attribute(Hs::widgetUriAttributeName), entry->attribute(Hs::widgetLibraryAttributeName))); - HsMenuService::touch(entry->id()); - } - else { - int errCode = HsMenuService::executeAction(entry->id()); + HsMenuService::touch(*entry); + } else { + int errCode = HsMenuService::executeAction(*entry); if (errCode != 0) { createApplicationLaunchFailMessage(errCode, entry->id()); } @@ -233,7 +234,7 @@ int id = data.toInt(); QString collectionType = mModel->data( index, CaItemModel::TypeRole).toString(); - qDebug("HsBaseViewState::openCollection - MCS ID: %d", data.toInt()); + qDebug("HsBaseViewState::openCollection - ID: %d", data.toInt()); machine()->postEvent( HsMenuEventFactory::createOpenCollectionFromAppLibraryEvent( @@ -253,7 +254,7 @@ EntryFlags flags = item->modelIndex().data( CaItemModel::FlagsRole).value (); - if (!(flags & UninstallEntryFlag)) { + if ((!(flags & UninstallEntryFlag)) && (flags & VisibleEntryFlag)) { mContextMenu = new HbMenu; setContextMenuOptions(item,flags); mContextModelIndex = item->modelIndex(); @@ -316,7 +317,7 @@ { if (mContextMenu) { mContextMenu->close(); - } + } } /*! @@ -329,7 +330,7 @@ static_cast(action->data().toInt()); const int itemId = mContextModelIndex.data(CaItemModel::IdRole).toInt(); - + if (itemId > 0) { switch (command) { case Hs::AddToHomeScreenContextAction: diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hscollectionstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hscollectionstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hscollectionstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -152,7 +152,7 @@ mCollectionId, mSortAttribute, mCollectionType); } - handleEmptyChange(mModel->rowCount() == 0); + reconnectViewComponents(mModel->rowCount() == 0); makeConnect(); @@ -267,6 +267,7 @@ static_cast(this), SLOT(showContextMenu(HbAbstractViewItem *, QPointF))); connect(mModel, SIGNAL(modelReset()), SLOT(updateLabel())); + connect(mModel, SIGNAL(countChange()), SLOT(updateLabel())); connect(mModel, SIGNAL(empty(bool)),this, SLOT(handleEmptyChange(bool))); connect(mModel, SIGNAL(empty(bool)),this, @@ -292,11 +293,11 @@ disconnect(mModel, SIGNAL(empty(bool)),this, SLOT(handleEmptyChange(bool))); - disconnect(mModel, SIGNAL(empty(bool)),this, + disconnect(mModel, SIGNAL(empty(bool)), this, SLOT(lockSearchButton(bool))); - disconnect(mModel, SIGNAL(modelReset()), - this, SLOT(updateLabel())); + disconnect(mModel, SIGNAL(modelReset()), this, SLOT(updateLabel())); + disconnect(mModel, SIGNAL(countChange()), this, SLOT(updateLabel())); } /*! @@ -304,7 +305,7 @@ \param action action taken in context menu */ void HsCollectionState::contextMenuAction(HbAction *action) - { +{ const int itemId = mContextModelIndex.data(CaItemModel::IdRole).toInt(); if (itemId > 0) { @@ -336,9 +337,16 @@ */ void HsCollectionState::handleEmptyChange(bool empty) { - EntryFlags flags = mModel->root().data( - CaItemModel::FlagsRole).value (); + reconnectViewComponents(empty); + mMenuView->activate(); +} +/*! + Reconnects view componets beetwen empty/not empty view. + \param empty \a true when model becomes empty \a false otherwise. + */ +void HsCollectionState::reconnectViewComponents(bool empty) +{ if (empty){ mMenuView->reset(HsEmptyLabelContext); } else { @@ -348,11 +356,9 @@ mModel->index(0), HbAbstractItemView::PositionAtTop); } mMenuView->disableSearch(empty); - mMenuView->activate(); setMenuOptions(); } - /*! Handles lock search button \param lock if true lock search button. @@ -410,7 +416,7 @@ HSMENUTEST_FUNC_ENTRY("HsCollectionState::updateLabel"); if (mModel) { mMenuView->viewLabel()->setHeading( - mModel->root().data(Qt::DisplayRole).toString()); + mModel->root().data(CaItemModel::CollectionTitleRole).toString()); } HSMENUTEST_FUNC_EXIT("HsCollectionState::updateLabel"); } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -136,21 +136,18 @@ \param item the context menu is built for. \param flags of the \item. */ -void HsInstalledAppsState::setContextMenuOptions(HbAbstractViewItem *item, EntryFlags flags) +void HsInstalledAppsState::setContextMenuOptions( + HbAbstractViewItem *item, EntryFlags flags) { + Q_UNUSED(item) + Q_UNUSED(flags) HbAction *uninstallAction = mContextMenu->addAction( - hbTrId("txt_common_menu_delete")); - HbAction *appDetailsAction(NULL); + hbTrId("txt_common_menu_delete")); uninstallAction->setData(Hs::UninstallContextAction); - QSharedPointer entry = mModel->entry(item->modelIndex()); - - if (!(entry->attribute(Hs::componentIdAttributeName).isEmpty()) && - (flags & RemovableEntryFlag) ) { - appDetailsAction = mContextMenu->addAction(hbTrId( - "txt_common_menu_details")); - appDetailsAction->setData(Hs::AppDetailsContextAction); - } + HbAction *appDetailsAction = mContextMenu->addAction( + hbTrId("txt_common_menu_details")); + appDetailsAction->setData(Hs::AppDetailsContextAction); } @@ -172,14 +169,13 @@ qDebug("AllAppsState::stateEntered()"); HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::stateEntered"); - mMenuView->viewLabel()->setHeading( - hbTrId("txt_applib_subtitle_installed")); - if (!mModel) { mModel = HsMenuService::getInstalledModel(mSortAttribute); } - + + updateLabel(); + if (mModel->rowCount() == 0) { mMenuView->reset(HsEmptyLabelContext); } @@ -189,20 +185,24 @@ mMenuView->listView()->scrollTo( mModel->index(0)); } - + setMenuOptions(); connect(mMenuView.data(), SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), SLOT(showContextMenu(HbAbstractViewItem *, QPointF))); - + connect(mMenuView.data(), SIGNAL(activated(QModelIndex)), SLOT(launchDetails(QModelIndex))); connect(mModel, SIGNAL(empty(bool)),this, SLOT(setEmptyLabelVisibility(bool))); - + + connect(mModel, SIGNAL(countChange()),this, + SLOT(updateLabel())); + + HsBaseViewState::stateEntered(); HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::stateEntered"); @@ -215,9 +215,12 @@ { HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::stateExited"); + disconnect(mModel, SIGNAL(countChange()),this, + SLOT(updateLabel())); + disconnect(mModel, SIGNAL(empty(bool)),this, SLOT(setEmptyLabelVisibility(bool))); - + disconnect(mMenuView.data(), SIGNAL(activated(QModelIndex)), this, SLOT(launchDetails(QModelIndex))); @@ -249,6 +252,16 @@ } /*! + Slot update label. + */ +void HsInstalledAppsState::updateLabel() +{ + mMenuView->viewLabel()->setHeading( + hbTrId("txt_applib_subtitle_installed").arg( + mModel->rowCount())); +} + +/*! Menu softkey back action slot */ #ifdef COVERAGE_MEASUREMENT @@ -284,8 +297,12 @@ */ void HsInstalledAppsState::launchDetails(const QModelIndex &index) { - machine()->postEvent(HsMenuEventFactory::createAppDetailsViewEvent( - index.data(CaItemModel::IdRole).toInt())); + QSharedPointer entry = mModel->entry(index); + if (!entry.isNull() && !(entry->flags() & UninstallEntryFlag)) { + + machine()->postEvent(HsMenuEventFactory::createAppDetailsViewEvent( + index.data(CaItemModel::IdRole).toInt())); + } } #ifdef COVERAGE_MEASUREMENT diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hslistviewitem.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hslistviewitem.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hslistviewitem.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -18,7 +18,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -106,6 +107,7 @@ void HsListViewItem::updateChildItems() { + HSMENUTEST_FUNC_ENTRY("HsListViewItem::updateChildItems"); HbListViewItem::updateChildItems(); EntryFlags flags = modelIndex().data( @@ -128,10 +130,18 @@ // TODO, consider moving this logic to model foreach (QGraphicsItem * item, this->childItems()) { if (HbStyle::itemName(item) == "text-1") { - HbTextItem* text = (HbTextItem*)item; - text->setText( - HbParameterLengthLimiter("txt_applib_dblist_uninstalling_1") - .arg(text->text())); + if (textFormat() == Qt::RichText) { + HbRichTextItem * text = (HbRichTextItem *)item; + text->setText( + HbParameterLengthLimiter("txt_applib_dblist_uninstalling_1") + .arg(text->text())); + } + else { + HbTextItem* text = (HbTextItem*)item; + text->setText( + HbParameterLengthLimiter("txt_applib_dblist_uninstalling_1") + .arg(text->text())); + } break; } } @@ -148,6 +158,7 @@ break; } } + HSMENUTEST_FUNC_EXIT("HsListViewItem::updateChildItems"); } HbAbstractViewItem* HsListViewItem::createItem() @@ -158,6 +169,7 @@ void HsListViewItem::polish(HbStyleParameters& params) { + HSMENUTEST_FUNC_ENTRY("HsListViewItem::polish"); if (isProgress) { HbStyleLoader::registerFilePath(":/layout/hslistviewitem.widgetml"); } @@ -166,5 +178,6 @@ if (isProgress) { HbStyleLoader::unregisterFilePath(":/layout/hslistviewitem.widgetml"); } + HSMENUTEST_FUNC_EXIT("HsListViewItem::polish"); } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmainwindow.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmainwindow.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmainwindow.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -56,6 +56,7 @@ */ void HsMainWindow::setCurrentView(HbView *view) { + HSMENUTEST_FUNC_ENTRY("HsMainWindow::setCurrentView"); HbMainWindow *const hbW( HbInstance::instance()->allMainWindows().value(0)); @@ -88,5 +89,6 @@ p->wallpaper()->show(); p->visual()->show(); } - } + } + HSMENUTEST_FUNC_EXIT("HsMainWindow::setCurrentView"); } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -28,6 +28,7 @@ #include #include #include +#include #include "hsallappsstate.h" #include "hsallcollectionsstate.h" @@ -132,7 +133,7 @@ mListView->setItemPixmapCacheEnabled(true); // TODO: remove when enabled from default mListView->setModel(model, new HsListViewItem()); - + mListView->verticalScrollBar()->setInteractive(true); if (mListView->model()) { connect(mListView->model(), SIGNAL(scrollTo(int, QAbstractItemView::ScrollHint)), @@ -222,6 +223,23 @@ } /*! + Disable or enable ovi store action button. + \param disable If true action gets disabled. + */ +void HsMenuView::disableOviStore(bool disable) +{ + if (mBuilder.oviStoreAction()) { + mBuilder.oviStoreAction()->setDisabled(disable); + } + if (mBuilder.operatorAction()) { + mBuilder.operatorAction()->setDisabled(disable); + } + if (mBuilder.toolBarExtensionAction()) { + mBuilder.toolBarExtensionAction()->setDisabled(disable); + } +} + +/*! Scrolls list item view to requested row. \param row The row which is to get at the position pointed by \a hint. \param hint Position in the view the row should be scrolled to. diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -33,13 +33,10 @@ #include "hsmenustates_global.h" static const char* DOCUMENT_BASE_NAME_MAP - [InvalidStateContext][InvalidOperationalContext] = + [InvalidOperationalContext] = /*HsItemViewContext, HsEmptyLabelContext*/ { -/*HsAllAppsContext*/ {"listview", "listview"}, -/*HsAllCollectionsContext*/ {"listview", "listview"}, -/*HsInstalledAppsContext*/ {"labeledlistview", "emptylabeledview"}, -/*HsCollectionContext*/ {"labeledlistview", "emptylabeledview"} + "labeledlistview", "emptylabeledview" }; static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/")); @@ -187,6 +184,16 @@ } /*! + \return Pointer to the toolbar extension action. + The pointer is valid until the HsMenuViewBuilder instance is destroyed. + Memory ownership is not changed. + */ +HbAction *HsMenuViewBuilder::toolBarExtensionAction() const +{ + return mToolBarExtensionAction; +} + +/*! \return Action group for \a allAppsState and \a allCollectionsState action. */ QActionGroup *HsMenuViewBuilder::toolBarActionGroup() const @@ -229,6 +236,9 @@ mToolBar->addAction(allAppsAction()); mToolBar->addAction(allCollectionsAction()); mToolBar->addAction(searchAction()); + mToolBarExtensionAction = mToolBar->addExtension(mToolBarExtension); + mToolBarExtensionAction->setIcon(HbIcon("qtg_mono_store")); + mToolBarExtensionAction->setVisible(false); mToolBarActionGroup = new QActionGroup(allAppsAction()); @@ -306,7 +316,7 @@ QSharedPointer HsMenuViewBuilder::readContextConfiguration() { const QLatin1String documentName( - DOCUMENT_BASE_NAME_MAP[mStateContext][mOperationalContext]); + DOCUMENT_BASE_NAME_MAP[mOperationalContext]); QSharedPointer loader = parseDocument(QString(documentName)); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/src/hssearchview.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hssearchview.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hssearchview.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include @@ -139,15 +141,25 @@ if (mBuilder.currentViewLabel()) { mSearchViewBuilder.searchViewLabel()->setHeading( mBuilder.currentViewLabel()->heading()); - mSearchViewBuilder.setSearchLabledContext(); } - + + if (mStateContext == HsCollectionContext){ + mSearchViewBuilder.setSearchLabledContext(); + } + mSearchView->hideItems(Hb::AllItems); HsListViewItem *item = new HsListViewItem(); item->setTextFormat(Qt::RichText); mSearchListView->setModel(mProxyModel, item); - + mSearchListView->verticalScrollBar()->setInteractive(true); + if (mStateContext == HsAllAppsContext) { + HbIndexFeedback *indexFeedback = new HbIndexFeedback(mSearchListView); + indexFeedback->setIndexFeedbackPolicy( + HbIndexFeedback::IndexFeedbackSingleCharacter); + indexFeedback->setItemView(mSearchListView); + } + mMainWindow.setCurrentView(mSearchView); openVkb(); @@ -414,3 +426,4 @@ } + diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hsaddtohomescreenmockstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hsaddtohomescreenmockstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hsaddtohomescreenmockstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -23,7 +23,6 @@ #include "caentry.h" #include "caitemmodel.h" - class AddToHomeScreenMockState: public QState { Q_OBJECT diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hscontentservice.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hscontentservice.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hscontentservice.h Wed Oct 06 16:06:24 2010 +0300 @@ -14,6 +14,7 @@ * Description: * */ + #ifndef T_HSCONTENTSERVICE_H #define T_HSCONTENTSERVICE_H @@ -30,7 +31,7 @@ HsContentService(QObject *parent = 0); ~HsContentService(); - bool widgets(const QString &uri, const QVariantHash &preferences, int &count); + bool widgets(const QString &uri, const QVariantHash &preferences, int &count); static HsContentService *instance(); signals: bool widgetAdded(const QString &, const QVariantHash &); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hsproxymodeltestmockmodel.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hsproxymodeltestmockmodel.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/inc/t_hsproxymodeltestmockmodel.h Wed Oct 06 16:06:24 2010 +0300 @@ -32,13 +32,13 @@ virtual QModelIndex index(int, int, const QModelIndex &parent = QModelIndex()) const { - Q_UNUSED(parent); + Q_UNUSED(parent); return QModelIndex(); } virtual QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const { - Q_UNUSED(role); - return QVariant(mEntryId); + Q_UNUSED(role); + return QVariant(mEntryId); } const CaEntry *entry(const QModelIndex &index) const; @@ -48,5 +48,4 @@ int mEntryId; }; - #endif diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/src/t_hsaddtohomescreenmockstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/src/t_hsaddtohomescreenmockstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/src/t_hsaddtohomescreenmockstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -25,6 +25,7 @@ Q_UNUSED(e); mEntered = true; } + bool AddToHomeScreenMockState::enteredValue() const { return mEntered; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/inc/t_allappsstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/inc/t_allappsstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/inc/t_allappsstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -67,6 +67,4 @@ static const char TEST_PARAM_VALUE[17]; }; - - #endif // T_ALLAPPSSTATE_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/src/t_allappsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/src/t_allappsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/src/t_allappsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -31,6 +31,7 @@ #include "hsallappsstate.h" #include "hsmenueventtransition.h" #include "hsmainwindow.h" +#include "hsscene.h" #include "t_hsaddtohomescreenmockstate.h" #include "t_hsmockmodel.h" @@ -260,8 +261,6 @@ QScopedPointer machine(new QStateMachine(0)); QState *parent = new QState(machine.data()); - QScopedPointer window(new HbMainWindow); - HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; HsMainWindowMock mainWindow; @@ -318,11 +317,12 @@ { QScopedPointer machine(new QStateMachine(0)); - QScopedPointer window(new HbMainWindow); + //QScopedPointer window(new HbMainWindow); + //HsScene::setInstance( new HsScene(window.data()) ); HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; - HsMainWindow mainWindow; + HsMainWindowMock mainWindow; QScopedPointer allAppsState(new HsAllAppsState( builder, menuMode, mainWindow, machine.data())); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/t_allappsstate.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/t_allappsstate.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allappsstate/t_allappsstate.pro Wed Oct 06 16:06:24 2010 +0300 @@ -66,8 +66,6 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } @@ -75,3 +73,6 @@ include(t_allappsstate.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/inc/t_allcollectionsstate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/inc/t_allcollectionsstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/inc/t_allcollectionsstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -20,7 +20,6 @@ #include - class HbMainWindow; class HbAbstractViewItem; class QStateMachine; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/src/t_allcollectionsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/src/t_allcollectionsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/src/t_allcollectionsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -33,33 +33,54 @@ #include "hsallcollectionsstate.h" #include "hsmenueventtransition.h" #include "hsmainwindow.h" +#include "hsscene.h" #include "t_hsaddtohomescreenmockstate.h" #include "t_hsmockmodel.h" #include "t_allcollectionsstate.h" +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class HsMainWindowMock : public HsMainWindow { virtual void setCurrentView(HbView *view); }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsMainWindowMock::setCurrentView(HbView *view) { Q_UNUSED(view); // do nothing } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::initTestCase() { // mWindow = NULL; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::init() { // mWindow = new HbMainWindow; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); @@ -68,6 +89,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::construction() @@ -105,9 +127,9 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // - void MenuStatesTest::addModeEnteredExited() { #ifdef Q_OS_SYMBIAN @@ -140,9 +162,9 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // - void MenuStatesTest::normalModeEnteredExited() { #ifdef Q_OS_SYMBIAN @@ -176,6 +198,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::createNewCollection() @@ -226,8 +249,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::createArrangeCollection() @@ -279,6 +302,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::listItemActivated() @@ -321,8 +345,9 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- - +// void MenuStatesTest::listItemLongPressed() { #ifdef Q_OS_SYMBIAN @@ -332,8 +357,6 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN { - QScopedPointer wind(new HbMainWindow); - HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; HsMainWindowMock mainWindow; @@ -382,6 +405,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::contextMenuAction() @@ -395,11 +419,12 @@ { QScopedPointer machine(new QStateMachine(0)); - QScopedPointer window(new HbMainWindow); + //QScopedPointer window(new HbMainWindow); + //HsScene::setInstance( new HsScene(window.data()) ); HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; - HsMainWindow mainWindow; + HsMainWindowMock mainWindow; QScopedPointer allCollectionsState (new HsAllCollectionsState( builder, menuMode, mainWindow, machine.data())); @@ -456,8 +481,9 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- - +// void MenuStatesTest::addModeSlots() { #ifdef Q_OS_SYMBIAN @@ -496,10 +522,9 @@ allCollectionsState->scrollToBeginning(); allCollectionsState->stateEntered(); - machine->start(); qApp->sendPostedEvents(); - + allCollectionsState->addActivated(allCollectionsState->mModel->index(0,0)); qApp->sendPostedEvents(); @@ -517,6 +542,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // #ifdef Q_OS_SYMBIAN diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/t_allcollectionsstate.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/t_allcollectionsstate.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_allcollectionsstate/t_allcollectionsstate.pro Wed Oct 06 16:06:24 2010 +0300 @@ -65,12 +65,12 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } RESOURCES += ../../$$qrcFile include(t_allcollectionsstate.pri) - \ No newline at end of file + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/inc/t_applibrarystate.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/inc/t_applibrarystate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/inc/t_applibrarystate.h Wed Oct 06 16:06:24 2010 +0300 @@ -20,7 +20,6 @@ #include - class HbMainWindow; class HbAbstractViewItem; class QStateMachine; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/src/t_applibrarystate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/src/t_applibrarystate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/src/t_applibrarystate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -37,6 +37,7 @@ #include "hsoperatorhandler_p.h" #include "hsoperatorhandler.h" #include "hsmenuservice.h" +#include "hsscene.h" #include "t_hsaddtohomescreenmockstate.h" #include "t_hsmockmodel.h" @@ -52,6 +53,11 @@ //const char *operatorStoreIconPath // = "z:/private/20022F35/customsvg/operatorstore.svg"; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::OperatorHandler_storesPresent() { HsOperatorHandler oviHandler; @@ -67,6 +73,10 @@ } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::OperatorHandler_first() { HsOperatorHandler oviHandler; @@ -77,6 +87,10 @@ QCOMPARE(oviHandler.operatorStoreFirst(), value); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::OperatorHandler_type() { HsOperatorHandler oviHandler; @@ -89,6 +103,10 @@ || value == HsOperatorHandlerPrivate::NoneType); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::OperatorHandler_createAction() { HsOperatorHandler oviHandler; @@ -102,24 +120,37 @@ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class HsMainWindowMock : public HsMainWindow { virtual void setCurrentView(HbView *view); }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsMainWindowMock::setCurrentView(HbView *view) { Q_UNUSED(view); // do nothing } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ApplicationLibraryState_construction() @@ -148,6 +179,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ApplicationLibraryState_historySlots() @@ -194,8 +226,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ApplicationLibraryState_backSteppingAction() @@ -207,7 +239,11 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN { + + QFAIL("! Due to bug in hb wk36 we are forced to skip this test !"); + QScopedPointer wind(new HbMainWindow); + HsScene::setInstance( new HsScene(wind.data()) ); //create statemachine to perform transitions QScopedPointer machine(new QStateMachine(0)); @@ -238,6 +274,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ApplicationLibraryState_clearToolbarLatch() @@ -263,6 +300,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // #ifdef QT_EXTENSIONS @@ -282,6 +320,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::OperatorHandler_icon() @@ -303,6 +342,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::OperatorHandler_text() @@ -325,6 +365,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::OperatorHandler_action() @@ -348,6 +389,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::OperatorHandler_entry() @@ -380,6 +422,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::OperatorHandler_noCrWriteAccess() @@ -403,8 +446,8 @@ } #endif//QT_EXTENSIONS - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsBaseViewState_createApplicationLaunchFailMessage() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/t_applibrarystate.pri --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/t_applibrarystate.pri Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/t_applibrarystate.pri Wed Oct 06 16:06:24 2010 +0300 @@ -20,5 +20,5 @@ #Source files SOURCES += ./src/*.cpp \ - ../src/*.cpp \ + ../src/*.cpp \ ../../src/*.cpp diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/t_applibrarystate.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/t_applibrarystate.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/t_applibrarystate.pro Wed Oct 06 16:06:24 2010 +0300 @@ -65,8 +65,6 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } @@ -74,3 +72,6 @@ include(t_applibrarystate.pri) + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_collectionsstate/src/t_collectionsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_collectionsstate/src/t_collectionsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_collectionsstate/src/t_collectionsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -35,6 +35,7 @@ #include "hsmenueventtransition.h" #include "hscollectionstate.h" #include "hsmainwindow.h" +#include "hsscene.h" #include "t_hsaddtohomescreenmockstate.h" #include "t_hsmockmodel.h" @@ -43,29 +44,45 @@ Q_DECLARE_METATYPE(Hs::HsSortAttribute) +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class HsMainWindowMock : public HsMainWindow { virtual void setCurrentView(HbView *view); }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsMainWindowMock::setCurrentView(HbView *view) { Q_UNUSED(view); // do nothing } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::init() { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::construction() @@ -102,6 +119,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::listItemActivated() @@ -165,6 +183,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::listItemLongPressed() @@ -176,11 +195,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN { - QScopedPointer wind(new HbMainWindow); - HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; - HsMainWindow mainWindow; + HsMainWindowMock mainWindow; QScopedPointer machine(new QStateMachine(0)); @@ -192,6 +209,7 @@ const int collectionId = HsMenuService::createCollection(collectionName); HsMenuItemModel *appsModel = HsMenuService::getAllApplicationsModel(); + QVERIFY(appsModel!=NULL); QList list; list << appsModel->data(appsModel->index(0),CaItemModel::IdRole).toInt(); HsMenuService::addApplicationsToCollection(list,collectionId); @@ -199,6 +217,7 @@ HsCollectionState *collectionState = new HsCollectionState(builder, menuMode, mainWindow, parent); + QVERIFY(collectionState!=NULL); collectionState->mCollectionId = collectionId; collectionState->mCollectionType = "collection"; @@ -244,8 +263,6 @@ } } HsMenuService::removeCollection(collectionId); - wind->removeView(builder.currentView()); - } #ifdef Q_OS_SYMBIAN #ifdef UT_MEMORY_CHECK @@ -254,8 +271,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::contextMenuAction() @@ -267,6 +284,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN { + //QScopedPointer window(new HbMainWindow); + //HsScene::setInstance( new HsScene(window.data()) ); + HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; HsMainWindowMock mainWindow; @@ -336,9 +356,8 @@ #endif//Q_OS_SYMBIAN } - - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::contextMenuConstruct() @@ -386,8 +405,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::contextMenuConstructNonEmptyCollection() @@ -437,7 +456,10 @@ #endif//Q_OS_SYMBIAN } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::addAppsAction() { #ifdef Q_OS_SYMBIAN @@ -498,6 +520,10 @@ #endif//Q_OS_SYMBIAN } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::renameAction() { #ifdef Q_OS_SYMBIAN @@ -557,7 +583,10 @@ #endif//Q_OS_SYMBIAN } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::deleteAppsAction() { #ifdef Q_OS_SYMBIAN @@ -616,6 +645,10 @@ #endif//Q_OS_SYMBIAN } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::updateLabel() { #ifdef Q_OS_SYMBIAN @@ -650,10 +683,7 @@ HsMenuService::getCollectionModel(collectionState->mCollectionId, collectionState->mSortAttribute)); - const QString label1 = collectionState->mModel->root().data( - Qt::DisplayRole).toString(); - - const QString newName(label1 + + const QString newName(collectionName + QDateTime::currentDateTime(). toString("ddmmyyyy_hh_mm_ss_zzz")); @@ -666,11 +696,12 @@ collectionState->updateLabel(); - const QString label2 = builder.currentViewLabel()->heading(); + const QString label = builder.currentViewLabel()->heading(); - QCOMPARE(label2, newName); + //now label is different than collection name but should contain this name + QVERIFY(label.contains(newName)); - QVERIFY(HsMenuService::renameCollection(collectionState->mCollectionId, label1)); + QVERIFY(HsMenuService::renameCollection(collectionState->mCollectionId, collectionName)); // cleanup HsMenuService::removeCollection(collectionId); @@ -681,6 +712,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::addElementToHomeScreen() @@ -760,6 +792,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::addCollectionShortcutToHomeScreenAction() @@ -822,6 +855,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::latestOnTopMenuAction() @@ -878,6 +912,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::oldestOnTopMenuAction() @@ -937,6 +972,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::createArrangeCollection() @@ -992,6 +1028,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // #ifdef Q_OS_SYMBIAN @@ -1021,8 +1058,8 @@ } #endif//Q_OS_SYMBIAN - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::disableSearchAction() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_collectionsstate/t_collectionsstate.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_collectionsstate/t_collectionsstate.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_collectionsstate/t_collectionsstate.pro Wed Oct 06 16:06:24 2010 +0300 @@ -67,12 +67,12 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } RESOURCES += ../../$$qrcFile include(t_collectionsstate.pri) - \ No newline at end of file + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_installedappsstate/src/t_installedappsstate.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_installedappsstate/src/t_installedappsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_installedappsstate/src/t_installedappsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -36,32 +36,44 @@ #include "hsinstalledappsstate.h" #include "hsmainwindow.h" #include "hsmenuitemmodel.h" +#include "hsscene.h" #include "hsmenueventtransition.h" - #include "t_installedappsstate.h" - #include "t_hsaddtohomescreenmockstate.h" +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class HsMainWindowMock : public HsMainWindow { virtual void setCurrentView(HbView *view); }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsMainWindowMock::setCurrentView(HbView *view) { Q_UNUSED(view); // do nothing } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::construction() @@ -92,6 +104,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // #ifdef Q_OS_SYMBIAN @@ -122,8 +135,8 @@ } #endif//Q_OS_SYMBIAN - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // #ifdef Q_OS_SYMBIAN @@ -175,8 +188,8 @@ } #endif//Q_OS_SYMBIAN - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::stateEnteredExited() @@ -229,7 +242,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::emptyLabelVisibility() @@ -274,6 +289,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::listItemLongPressed() @@ -285,9 +301,11 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN { - QScopedPointer window(new HbMainWindow); + //QScopedPointer window(new HbMainWindow); + //HsScene::setInstance( new HsScene(window.data()) ); + HsMenuViewBuilder builder; - HsMainWindow mainWindow; + HsMainWindowMock mainWindow; QScopedPointer parent(new QState); @@ -337,7 +355,6 @@ installedAppsState->stateExited(); - window->removeView(builder.currentView()); qApp->processEvents(); } @@ -349,6 +366,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::latestOldestOnTopMenuAction() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_installedappsstate/t_installedappsstate.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_installedappsstate/t_installedappsstate.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_installedappsstate/t_installedappsstate.pro Wed Oct 06 16:06:24 2010 +0300 @@ -66,12 +66,12 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } RESOURCES += ../../$$qrcFile include(t_installedappsstate.pri) - \ No newline at end of file + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/inc/t_menuviewbuilder.h --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/inc/t_menuviewbuilder.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/inc/t_menuviewbuilder.h Wed Oct 06 16:06:24 2010 +0300 @@ -75,7 +75,5 @@ QModelIndex mIndex; QPointF mPoint; - - }; #endif // T_MENUVIEWBUILDER_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/src/t_menuviewbuilder.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/src/t_menuviewbuilder.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/src/t_menuviewbuilder.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -39,30 +39,46 @@ #include "hsapplibrarystate.h" #include "hsallappsstate.h" #include "hslistviewitem.h" +#include "hsscene.h" #include "t_hsaddtohomescreenmockstate.h" #include "t_hsmockmodel.h" #include "t_menuviewbuilder.h" - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class HsMainWindowMock : public HsMainWindow { virtual void setCurrentView(HbView *view); }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsMainWindowMock::setCurrentView(HbView *view) { Q_UNUSED(view); // do nothing } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class HsMainWindowSpy: public HsMainWindow { public: @@ -76,6 +92,10 @@ HsMainWindowSpy(): mSwitchedToView(NULL) {}; }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_construction() { const HsMenuViewBuilder builder; @@ -83,6 +103,7 @@ expectedActionList << builder.allAppsAction(); expectedActionList << builder.allCollectionsAction(); expectedActionList << builder.searchAction(); + expectedActionList << builder.toolBarExtensionAction(); QList actualActionList(builder.toolBar()->actions()); @@ -90,6 +111,10 @@ } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_view() { HsMenuViewBuilder builder; @@ -114,6 +139,10 @@ QCOMPARE(title, hbTrId("txt_applib_title_applications")); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_listView() { HsMenuViewBuilder builder; @@ -129,13 +158,17 @@ QVERIFY(visible); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_label() { HsMenuViewBuilder builder; const HbGroupBox *const allAppsLabel = builder.currentViewLabel(); - QVERIFY(allAppsLabel == NULL || !allAppsLabel->isVisible()); + QVERIFY(allAppsLabel != NULL); builder.setStateContext(HsInstalledAppsContext); @@ -147,6 +180,10 @@ QCOMPARE(collectionLabel->marqueeHeading(), true); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_allAppsAction() { const HsMenuViewBuilder builder; @@ -158,6 +195,10 @@ } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_allCollectionsAction() { const HsMenuViewBuilder builder; @@ -168,6 +209,10 @@ QString("qtg_mono_applications_collections")); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_searchAction() { const HsMenuViewBuilder builder; @@ -178,6 +223,10 @@ QString("qtg_mono_search")); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_oviStoreAction() { const HsMenuViewBuilder builder; @@ -188,6 +237,10 @@ QString("qtg_mono_ovistore")); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_operatorAction() { const HsMenuViewBuilder builder; @@ -199,6 +252,10 @@ // QString("qtg_mono_store")); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_toolBar() { HsMenuViewBuilder builder; @@ -209,7 +266,7 @@ const QList actions = toolBar->actions(); - QCOMPARE(actions.count(), 3); + QCOMPARE(actions.count(), 4); QCOMPARE(actions.at(0), static_cast(builder.allAppsAction())); QCOMPARE(actions.at(1), @@ -219,6 +276,10 @@ QCOMPARE(toolBar, builder.currentView()->toolBar()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsMenuViewBuilder_toolBarExtension() { HsMenuViewBuilder builder; @@ -227,10 +288,8 @@ QVERIFY(toolBarExtension); } - - - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::MenuView_slots() @@ -282,8 +341,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsMenuView_scrolling() @@ -294,7 +353,10 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN { - QScopedPointer wind(new HbMainWindow); + QFAIL("! Due to bug in hb wk36 we are forced to skip this test !"); + QScopedPointer window(new HbMainWindow); + HsScene::setInstance( new HsScene(window.data()) ); + HsMenuViewBuilder builder; HsMenuModeWrapper menuMode; HsMainWindow mainWindow; @@ -305,7 +367,7 @@ HsAllAppsState *allAppsState = new HsAllAppsState(builder, menuMode, mainWindow, parent.data()); - wind->addView(builder.currentView()); + window->addView(builder.currentView()); QVERIFY(allAppsState->mModel != 0); @@ -342,7 +404,7 @@ QCOMPARE(actualRow, expectedRow); qApp->processEvents(); - allAppsState->stateExited(); + allAppsState->stateExited(); qApp->processEvents(); } @@ -353,8 +415,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::MenuView_toolBarExtension() @@ -378,6 +440,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::MenuView_reset() @@ -422,13 +485,16 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::testslot_activated(const QModelIndex &aIndex) { mIndex = aIndex; } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::testslot_longpressed(HbAbstractViewItem *item, @@ -439,6 +505,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsListViewItem_updateChildItems() @@ -456,7 +523,7 @@ QScopedPointer allAppsState(new HsAllAppsState( builder, menuMode, mainWindow, 0)); - HsMenuItemModel *model = allAppsState->mModel; + HsMenuItemModel *model = allAppsState->mModel; QVERIFY(model != static_cast(0)); QVERIFY(model->rowCount() > 0); @@ -479,7 +546,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsListViewItem_createItem() @@ -504,7 +573,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsListViewItem_polish() @@ -543,6 +614,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsProgressBar_timerEvent() @@ -571,6 +643,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsProgressBar_setTargetProgressValue() @@ -596,6 +669,10 @@ #endif//Q_OS_SYMBIAN } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::MenuView_showHideSearchPanel() { HsMenuViewBuilder builder; @@ -607,7 +684,6 @@ QVERIFY(window.mSwitchedToView != originatingView); menuView.hideSearchPanel(); QVERIFY(window.mSwitchedToView == originatingView); - } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/t_menuviewbuilder.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/t_menuviewbuilder.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/t_menuviewbuilder.pro Wed Oct 06 16:06:24 2010 +0300 @@ -66,12 +66,12 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } RESOURCES += ../../$$qrcFile include(t_menuviewbuilder.pri) - \ No newline at end of file + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_searchviewbuilder/src/t_searchviewbuilder.cpp --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_searchviewbuilder/src/t_searchviewbuilder.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_searchviewbuilder/src/t_searchviewbuilder.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -39,23 +39,38 @@ } }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::testSlot() { mSlotActivated = true; } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_construction() { HsSearchViewBuilder builder; QVERIFY(builder.mLoadedObjects.count()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_uiObjects() { HsSearchViewBuilder builder; @@ -65,6 +80,10 @@ QVERIFY(builder.searchViewLabel()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_setSearchLabledContext() { HsSearchViewBuilder builder; @@ -72,6 +91,10 @@ QVERIFY(builder.mLabledContext); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_loadViewEmptySection() { HsSearchViewBuilder builder; @@ -80,6 +103,10 @@ QCOMPARE(firstCount, builder.mLoadedObjects.count()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_loadViewListSection() { HsSearchViewBuilder builder; @@ -88,6 +115,10 @@ QCOMPARE(firstCount, builder.mLoadedObjects.count()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_searchViewConstruction() { HsMenuViewBuilder builder; @@ -100,6 +131,10 @@ QCOMPARE(search.mProxyModel->sortRole(), int(CaItemModel::TextRole)); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_activatedProxySlot() { HsMenuViewBuilder builder; @@ -115,6 +150,10 @@ QCOMPARE(mSlotActivated, true); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_longPressedProxySlot() { HsMenuViewBuilder builder; @@ -132,6 +171,10 @@ QCOMPARE(mSlotActivated, true); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_showHide() { HsMenuViewBuilder builder; @@ -146,17 +189,20 @@ } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// class MockInputContext: public QInputContext { public: QEvent::Type mEventType; MockInputContext(): mEventType(QEvent::None) {} - QString identifierName() { return qApp->inputContext()->identifierName();} - bool isComposing() const { return qApp->inputContext()->isComposing();} - QString language() { return qApp->inputContext()->language();} - void reset() {;} - void setFocusWidget(QWidget* widget) {QInputContext::setFocusWidget(widget);} + QString identifierName() { return qApp->inputContext()->identifierName();} + bool isComposing() const { return qApp->inputContext()->isComposing();} + QString language() { return qApp->inputContext()->language();} + void reset() {;} + void setFocusWidget(QWidget* widget) {QInputContext::setFocusWidget(widget);} bool filterEvent(const QEvent* event) { mEventType = event->type(); @@ -164,6 +210,10 @@ } }; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsSearchViewBuilder_hideVkb() { HsMenuViewBuilder builder; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_searchviewbuilder/t_searchviewbuilder.pro --- a/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_searchviewbuilder/t_searchviewbuilder.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_searchviewbuilder/t_searchviewbuilder.pro Wed Oct 06 16:06:24 2010 +0300 @@ -66,12 +66,12 @@ coverage: CONFIG -= symbian_test exists($${EPOCROOT}epoc32/include/platform/mw/XQSettingsManager) { LIBS += -lxqsettingsmanager - - MMP_RULES += SMPSAFE } } RESOURCES += ../../$$qrcFile include(t_searchviewbuilder.pri) - \ No newline at end of file + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlestate.cpp --- a/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlestate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hshomescreenstateplugin/src/hsidlestate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -82,7 +82,7 @@ const char hsLocTextId_ContextMenu_ChangeWallpaper[] = "txt_homescreen_list_change_wallpaper"; //Home screen canvas menu item for opening Application library - const char hsLocTextId_ContextMenu_AddContent[] = "txt_homescreen_list_add_content"; + const char hsLocTextId_ContextMenu_AddContent[] = "txt_homescreen_opt_add_content"; //Home screen options menu item for opening Task switcher const char hsLocTextId_OptionsMenu_TaskSwitcher[] = "txt_homescreen_opt_task_switcher"; @@ -657,6 +657,12 @@ void HsIdleState::onWidgetMoveUpdated(const QPointF &scenePos, HsWidgetHost *widget) { + /* If move was interrupted by a popup and and we plan to move second widget. + * Then the erroneous first widget instance is received here, as there is no cancel gesture + -> we need to use active widget that was saved during TapAndHold. + */ + widget = HsScene::instance()->activeWidget(); + QRectF widgetRect = widget->visual()->geometry(); // Move widget to updated position. diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hshomescreenstateplugin/tsrc/t_hshomescreenstateplugin/src/t_hsidlestate.cpp --- a/homescreenapp/stateplugins/hshomescreenstateplugin/tsrc/t_hshomescreenstateplugin/src/t_hsidlestate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hshomescreenstateplugin/tsrc/t_hshomescreenstateplugin/src/t_hsidlestate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -519,7 +519,7 @@ QSignalSpy waitInputSpy(is, SIGNAL(event_waitInput())); scene->setActiveWidget(0); is->onWidgetMoveFinished(QPointF(150, 150), widget); - QCOMPARE(waitInputSpy.count(), 2); + QCOMPARE(waitInputSpy.count(), 1); QCOMPARE(waitDeleteSpy.count(), 1); is->pageChangeAnimationFinished(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/hsmenuworkerstateplugin.pro --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/hsmenuworkerstateplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/hsmenuworkerstateplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -44,8 +44,6 @@ LIBS += -lhal } for(docmlFile, docmlFiles): DOCML+=$$docmlFile - - MMP_RULES += SMPSAFE } RESOURCES += $$qrcFile @@ -55,3 +53,6 @@ + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsdialogcontroller.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsdialogcontroller.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsdialogcontroller.h Wed Oct 06 16:06:24 2010 +0300 @@ -14,6 +14,7 @@ * Description: * */ + #ifndef HS_DIALOG_CONTROLLER_H #define HS_DIALOG_CONTROLLER_H @@ -21,13 +22,13 @@ #include #include +#include "hsmenudialogfactory.h" +#include "hsmenuentryremovedhandler.h" + class QAction; class QString; class HbDialog; -#include "hsmenudialogfactory.h" -#include "hsmenuentryremovedhandler.h" - class HsDialogController: public QObject { Q_OBJECT diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsmenustates_global.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsmenustates_global.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsmenustates_global.h Wed Oct 06 16:06:24 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include "hsmenuservice_global.h" #ifndef MENUSTATES_UNITTEST #define HS_STATES_TEST_CLASS(className) @@ -70,96 +71,4 @@ static const char *const HS_COLLECTION_DIALOG_CREATE_NEW_ACTION="qtl_dialog_softkey_2_left"; static const char *const HS_COLLECTION_DIALOG_CANCEL_ACTION="qtl_dialog_softkey_2_right"; - -/*! - To enable logging of function entry and exit use the following flag for qmake: - -config nft - To include in logs extra information about RAM and heap usage, define an additional constant e.g. in ProductVariant.hrh: - #define NFT_RAM - */ - -#ifdef NFT -#ifdef Q_OS_SYMBIAN -#include -#include -#endif -#endif - -#ifdef NFT - -#define HSMENUTEST(aText) qDebug() << QString(aText) - -#ifdef Q_OS_SYMBIAN -#ifdef NFT_RAM -#define HSMENUTEST_FREERAM_ENTRY(function) \ - TInt HSMENUTEST_ENTRY_RAM(0); \ - TInt HSMENUTEST_ENTRY_HEAP(0); \ - TInt HSMENUTEST_ENTRY_HEAP_SIZE(0); \ - { \ - TInt allRAM(0); \ - HAL::Get(HAL::EMemoryRAM, allRAM); \ - HAL::Get(HAL::EMemoryRAMFree, HSMENUTEST_ENTRY_RAM); \ - RHeap &heap = User::Heap(); \ - TInt biggestBlock(0); \ - HSMENUTEST_ENTRY_HEAP = heap.Available(biggestBlock); \ - HSMENUTEST_ENTRY_HEAP_SIZE = heap.Size(); \ - qDebug("(nft) " function " - Memory (kB) - Free RAM: %d, Heap size: %d, Free heap: %d", \ - HSMENUTEST_ENTRY_RAM >> 10, HSMENUTEST_ENTRY_HEAP_SIZE >> 10, \ - HSMENUTEST_ENTRY_HEAP >> 10); \ - } - -#define HSMENUTEST_FREERAM_EXIT(function) \ - { \ - TInt allRAM(0); \ - TInt freeRAM(0); \ - HAL::Get(HAL::EMemoryRAM, allRAM); \ - HAL::Get(HAL::EMemoryRAMFree, freeRAM); \ - RHeap &heap = User::Heap(); \ - TInt biggestBlock(0); \ - TInt heapFree = heap.Available(biggestBlock); \ - TInt heapSize = heap.Size(); \ - qDebug("(nft) " function " - Memory (kB) - Free RAM: %d, Heap size: %d, Free heap: %d", \ - freeRAM >> 10, heapSize >> 10, heapFree >> 10); \ - qDebug("(nft) " function " - Memory (kB) - RAM diff: %d, Heap size diff: %d, Free heap diff: %d", \ - (freeRAM-HSMENUTEST_ENTRY_RAM) >> 10, (heapSize-HSMENUTEST_ENTRY_HEAP_SIZE) >> 10, \ - (heapFree-HSMENUTEST_ENTRY_HEAP) >> 10); \ - } - -#else - -#define HSMENUTEST_FREERAM_ENTRY(function) -#define HSMENUTEST_FREERAM_EXIT(function) - -#endif - -#define HSMENUTESTTIME_ENTRY(function) \ - TInt64 HSMENUTEST_ENTRY_TIME(0); \ - { \ - TTime t; \ - t.UniversalTime(); \ - qDebug("\n" function " entry:%20lld", t.Int64()); \ - HSMENUTEST_ENTRY_TIME = t.Int64(); \ - } - -#define HSMENUTESTTIME_EXIT(function) { \ - TTime t; \ - t.UniversalTime(); \ - qDebug("\n" function " entry:%20lld\n" function " difference:%20lld", t.Int64(), \ - t.Int64()-HSMENUTEST_ENTRY_TIME); \ - } - -#define HSMENUTEST_FUNC_ENTRY(function) HSMENUTEST_FREERAM_ENTRY(function) \ - HSMENUTESTTIME_ENTRY(function) -#define HSMENUTEST_FUNC_EXIT(function) HSMENUTESTTIME_EXIT(function) \ - HSMENUTEST_FREERAM_EXIT(function) - -#else //Q_OS_SYMBIAN -#define HSMENUTEST_FUNC_ENTRY(function) qDebug()<< function << " entry"; -#define HSMENUTEST_FUNC_EXIT(function) qDebug()<< function << " exit"; -#endif //Q_OS_SYMBIAN -#else //NFT -#define HSMENUTEST_FUNC_ENTRY(function) -#define HSMENUTEST_FUNC_EXIT(function) -#endif //NFT - #endif //HSMENUSTATES_GLOBAL_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hspreviewhswidgetstate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hspreviewhswidgetstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hspreviewhswidgetstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -74,6 +74,4 @@ QString mUri; }; - - #endif //HSPREVIEWHSWIDGETSTATE_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsuinstallfailedstate.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsuinstallfailedstate.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsuinstallfailedstate.h Wed Oct 06 16:06:24 2010 +0300 @@ -52,7 +52,6 @@ void construct(); - }; #endif /* HSUINSTALLFAILEDSTATE_H_ */ diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddappstocollectionstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddappstocollectionstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddappstocollectionstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -447,6 +448,7 @@ mModel = standardItemModel(mCollectionId); mModel->setParent(mListDialog); listView->setModel(mModel); + listView->verticalScrollBar()->setInteractive(true); connect(listView, SIGNAL(activated(const QModelIndex &)), this, SLOT(collectionSelected(const QModelIndex &))); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsappschecklist.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsappschecklist.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsappschecklist.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -15,11 +15,13 @@ * */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -166,7 +168,12 @@ LIST_VIEW_WIDGET)); mModel->setParent(mAppsSelectDialog); mListView->setModel(mModel); - + mListView->verticalScrollBar()->setInteractive(true); + HbIndexFeedback *indexFeedback = new HbIndexFeedback(mListView); + indexFeedback->setIndexFeedbackPolicy( + HbIndexFeedback::IndexFeedbackSingleCharacter); + indexFeedback->setItemView(mListView); + connect(mListView,SIGNAL(activated(const QModelIndex&) ),this ,SLOT(selectedItemsChanged())); connect(mModel,SIGNAL(rowsRemoved(const QModelIndex&, int,int)), diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamedialog.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamedialog.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamedialog.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "hscollectionnamedialog.h" @@ -133,31 +134,26 @@ QString newName(name); + QChar leadingCharacter('0'); + static const int fieldWidth(2); + static const int base(10); unsigned int numToAppend(1); - bool defaultCollection = false; - if (newName == hbTrId("txt_applib_dialog_entry_collection")) { - defaultCollection = true; - } - if (defaultCollection) { + + if (newName == HbParameterLengthLimiter( + "txt_applib_dialog_entry_collection")) { while (mOtherCollectionsNames.contains(newName)) { - newName = hbTrId("txt_applib_dialog_entry_collectionl1").arg( - numToAppend); + newName = HbParameterLengthLimiter( + "txt_applib_dialog_entry_collectionl1").arg( + numToAppend, fieldWidth, base, leadingCharacter); numToAppend++; } } else { - QString textMap = hbTrId( - "txt_applib_dialog_collection_name_entry_1_l1"); - // TODO: Temporary workaround. - // The "if" instruction below can be removed when - // a text map "txt_applib_dialog_collection_name_entry_1_l1" - // is available in the platform. - if (textMap == "txt_applib_dialog_collection_name_entry_1_l1") { - textMap = "%2 (%L1)"; - } while (mOtherCollectionsNames.contains(newName)) { - newName = textMap.arg(numToAppend).arg(name); + newName = HbParameterLengthLimiter( + "txt_applib_dialog_collection_name_entry_1_l1").arg( + numToAppend, fieldWidth, base, leadingCharacter).arg(name); numToAppend++; } } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -93,7 +93,7 @@ } QScopedPointer dialogController( - new HsDialogController(message)); + new HsDialogController(message, HsMenuDialogFactory::DeleteCancel)); connect(dialogController.data(), SIGNAL(acceptActionTriggered(QAction*)), diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hspreviewhswidgetstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -128,7 +128,7 @@ SLOT(addToHomeScreen())); connect(dialogController.data(), - SIGNAL(dialogCompleted()), + SIGNAL(rejectActionTriggered(QAction*)), this, SIGNAL(exit())); @@ -169,6 +169,7 @@ notificationDialog->setAttribute(Qt::WA_DeleteOnClose); notificationDialog->setTitle(hbTrId("txt_applib_dpophead_added_to_homescreen")); notificationDialog->show(); + emit exit(); } else { showMessageWidgetCorrupted(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hscontentservice.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hscontentservice.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hscontentservice.h Wed Oct 06 16:06:24 2010 +0300 @@ -14,6 +14,7 @@ * Description: * */ + #ifndef T_HSCONTENTSERVICE_H #define T_HSCONTENTSERVICE_H diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hsmenuworkerstateplugin.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hsmenuworkerstateplugin.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hsmenuworkerstateplugin.h Wed Oct 06 16:06:24 2010 +0300 @@ -24,6 +24,7 @@ #include #include #include + #include "t_hsshortcutservice.h" #ifdef Q_OS_SYMBIAN @@ -91,7 +92,7 @@ void HsUninstallItemState_construction(); void HsUninstallItemState_onEntry(); #ifdef Q_OS_SYMBIAN - void HsUninstallItemState_getApplicationsNames(); + void HsUninstallItemState_getApplicationsNames(); #endif // Q_OS_SYMBIAN // HsAddAppsToCollectionState @@ -106,8 +107,8 @@ void AddAppsToCollectionState_listDialogFinished(); void AddAppsToCollectionState_newCollection(); void AddAppsToCollectionState_editorDialogFinished(); - void AddAppsToCollectionState_appsCheckListState(); - void AddAppsToCollectionState_selectApplicationsDone(); + void AddAppsToCollectionState_appsCheckListState(); + void AddAppsToCollectionState_selectApplicationsDone(); void AddAppsToCollectionState_collectionSelected(); void AppsCheckList_showAppsCheckboxList(); @@ -173,10 +174,10 @@ */ void testCommitSlot(const QList &appList); - /** + /** * test slot for AddAppsToCollectionState_appsCheckListState test */ - void testTransitToStateSlot(); + void testTransitToStateSlot(); private: void checkDialogController(); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hsshortcutservice.h --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hsshortcutservice.h Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/inc/t_hsshortcutservice.h Wed Oct 06 16:06:24 2010 +0300 @@ -14,8 +14,10 @@ * Description: * */ + #ifndef T_HSSHORTCUTSERVICE_H #define T_HSSHORTCUTSERVICE_H + #include #include #include diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsbackuprestoreobserver_mock.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsbackuprestoreobserver_mock.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsbackuprestoreobserver_mock.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -15,7 +15,6 @@ * */ - #include "hsdatabase.h" #include "hsbackuprestoreobserver.h" @@ -52,8 +51,8 @@ */ void HsBackupRestoreObserver::backupRestoreStarted() { - mBUROngoing = true; - emit event_backupRestoreStarted(); + mBUROngoing = true; + emit event_backupRestoreStarted(); } /*! @@ -61,8 +60,8 @@ */ void HsBackupRestoreObserver::backupRestoreCompleted() { - mBUROngoing = false; - emit event_backupRestoreCompleted(); + mBUROngoing = false; + emit event_backupRestoreCompleted(); } /*! @@ -77,9 +76,9 @@ */ bool HsBackupRestoreObserver::checkBUR() { - if (mBUROngoing) { - return true; - } + if (mBUROngoing) { + return true; + } return false; } /*! diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsgui_mock.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsgui_mock.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsgui_mock.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -49,8 +49,6 @@ HsPropertyAnimationWrapper *mPageCrawlingAnimation; }; - - HsGui::~HsGui() { if (mImpl->mNavigationAction) { diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hspage_mock.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hspage_mock.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hspage_mock.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -228,7 +228,7 @@ */ bool HsPage::deleteFromDatabase() { - //Not used in mock + //Not used in mock return true; } @@ -551,5 +551,5 @@ HsPageVisual *HsPage::visual()const { - return 0; + return 0; } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsscene_mock.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsscene_mock.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hsscene_mock.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -23,17 +23,30 @@ #include "hswallpaper.h" #include "hsconfiguration.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsScene::~HsScene() { delete mWallpaper; qDeleteAll(mPages); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// int HsScene::databaseId() const { return mDatabaseId; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsScene::load() { int pageCount = property("pageCount").toInt(); @@ -58,16 +71,28 @@ return true; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsWallpaper *HsScene::wallpaper() const { return mWallpaper; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QList HsScene::pages() const { return mPages; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsScene::addPage(HsPage *page) { if (!page) { @@ -82,6 +107,10 @@ return true; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsScene::removePage(HsPage *page) { if (!page) { @@ -90,6 +119,10 @@ return mPages.removeOne(page); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsScene::setActivePage(HsPage *page) { if (!page) { @@ -104,6 +137,10 @@ return true; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsScene::setActivePageIndex(int index) { if (index < 0 || mPages.count() <= index) { @@ -112,26 +149,46 @@ return setActivePage(mPages[index]); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsPage *HsScene::activePage() const { return mActivePage; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// int HsScene::activePageIndex() const { return mPages.indexOf(mActivePage); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsScene::setActiveWidget(HsWidgetHost *widget) { mActiveWidget = widget; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsWidgetHost *HsScene::activeWidget() const { return mActiveWidget; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsScene::setOnline(bool online) { mIsOnline = online; @@ -140,14 +197,19 @@ } } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsScene::isOnline()const { return mIsOnline; } -/*! - Singleton. -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsScene *HsScene::instance() { if (!mInstance) { @@ -156,13 +218,21 @@ return mInstance; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsScene *HsScene::takeInstance() { HsScene *instance = mInstance; mInstance = 0; return instance; } - + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsScene::setInstance(HsScene *instance) { if (mInstance != instance) { @@ -171,24 +241,29 @@ } } -/*! - Listens for application background/foreground changes. -*/ +// --------------------------------------------------------------------------- +// Listens for application background/foreground changes. +// --------------------------------------------------------------------------- +// bool HsScene::eventFilter(QObject *watched, QEvent *event) { - switch (event->type()) { + switch (event->type()) { case QEvent::ApplicationActivate: mActivePage->showWidgets(); break; - case QEvent::ApplicationDeactivate: + case QEvent::ApplicationDeactivate: mActivePage->hideWidgets(); break; default: break; - } + } return QObject::eventFilter(watched, event); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsScene::HsScene(QObject *parent) : QObject(parent), mDatabaseId(-1), diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hswallpaper_mock.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hswallpaper_mock.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hswallpaper_mock.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -19,7 +19,6 @@ #include #include #include - #include #include @@ -29,13 +28,11 @@ #include "hswallpaperloader.h" #include "hsconfiguration.h" #include "hsgui.h" -/*! -*/ - -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsWallpaper::HsWallpaper(QGraphicsItem *parent) : HbWidget(parent), mIsDefaultImage(false), @@ -62,21 +59,27 @@ SLOT(updateIconItem(Qt::Orientation))); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsWallpaper::~HsWallpaper() { } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::setImage(const QString &path) { Q_UNUSED(path); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::setImages(const QString &portraitFileName, const QString &landscapeFileName) { Q_UNUSED(portraitFileName) @@ -84,9 +87,10 @@ emit imageSet(); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::setDefaultImage() { if (mIsDefaultImage) { @@ -109,9 +113,10 @@ updateIconItem(HsGui::instance()->orientation()); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::remove() { if (mIsDefaultImage) { @@ -124,9 +129,10 @@ mLandscapeImagePath.clear(); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsWallpaper::setExistingImage() { QDir dir(wallpaperDirectory()); @@ -164,9 +170,10 @@ return directory; } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::onLoaderFinished() { if (mIsDefaultImage) { @@ -183,9 +190,10 @@ emit imageSet(); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::onLoaderFailed() { foreach (QString path, mLoader->targets().keys()) { @@ -194,9 +202,10 @@ emit imageSetFailed(); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsWallpaper::updateIconItem(Qt::Orientation orientation) { if (orientation == Qt::Vertical) { @@ -206,9 +215,10 @@ } } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsSceneWallpaper::HsSceneWallpaper(HsScene *scene, QGraphicsItem *parent) : HsWallpaper(parent), mScene(0) @@ -216,16 +226,18 @@ setScene(scene); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsSceneWallpaper::~HsSceneWallpaper() { } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsSceneWallpaper::setScene(HsScene *scene) { if (!scene) { @@ -239,17 +251,19 @@ } } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QString HsSceneWallpaper::wallpaperDirectory() const { return QDir::toNativeSeparators(rootDirectory() + "scene/"); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QVariantHash HsSceneWallpaper::createTargets(const QString &sourcePath) { QVariantHash targets; @@ -264,9 +278,10 @@ return targets; } -/*! - PAGE -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsPageWallpaper::HsPageWallpaper(HsPage *page, QGraphicsItem *parent) : HsWallpaper(parent), mPage(0) @@ -274,16 +289,18 @@ setPage(page); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsPageWallpaper::~HsPageWallpaper() { } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsPageWallpaper::setPage(HsPage *page) { if (!page) { @@ -297,17 +314,19 @@ } } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QString HsPageWallpaper::wallpaperDirectory() const { return QDir::toNativeSeparators(rootDirectory() + "page/"); } -/*! - -*/ +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QVariantHash HsPageWallpaper::createTargets(const QString &sourcePath) { QVariantHash targets; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hswidgethost_mock.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hswidgethost_mock.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/hswidgethost_mock.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -26,11 +26,9 @@ #include #include #include - #include #include #include - #include #include "hsdatabase.h" @@ -146,8 +144,6 @@ return true; } - - void HsWidgetHost::startWidget(bool show) { if (show) { @@ -366,7 +362,7 @@ } void HsWidgetHost::action_connectComponent() -{ +{ } void HsWidgetHost::action_disconnectComponent() @@ -389,7 +385,7 @@ setMethod("onUninitialize()", mOnUninitializeMethod); setProperty("isOnline", mIsOnlineProperty); - setProperty("rootPath", mRootPathProperty); + setProperty("rootPath", mRootPathProperty); if (hasSignal("setPreferences(const QStringList&)")) { connect(mWidget, SIGNAL(setPreferences(QStringList)), @@ -428,7 +424,7 @@ mOnHideMethod = QMetaMethod(); mOnUninitializeMethod = QMetaMethod(); mIsOnlineProperty = QMetaProperty(); - mRootPathProperty = QMetaProperty(); + mRootPathProperty = QMetaProperty(); } void HsWidgetHost::action_initialize() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsaddappstocollectionstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsaddappstocollectionstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsaddappstocollectionstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -26,12 +26,11 @@ #include "hsmenuworkerstate.h" #include "hsaddtohomescreenstate.h" #include "hsappschecklist.h" - #include "hscollectionnamedialog.h" #include "hsapp_defs.h" - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_construction() @@ -56,7 +55,9 @@ #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_save() @@ -83,7 +84,9 @@ #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_cleanData() @@ -111,6 +114,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_setCollectionName() @@ -137,6 +141,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_setCollectionId() @@ -163,6 +168,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_setAppList() @@ -191,6 +197,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_showMessageAppsAdded() @@ -218,6 +225,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_selectCollection() @@ -252,8 +260,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_listDialogFinished() @@ -285,6 +293,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_newCollection() @@ -321,6 +330,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_editorDialogFinished() @@ -348,6 +358,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_collectionSelected() @@ -382,6 +393,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_appsCheckListState() @@ -413,6 +425,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddAppsToCollectionState_selectApplicationsDone() @@ -454,6 +467,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AppsCheckList_showAppsCheckboxList() @@ -486,7 +500,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::testCommitSlot(const QList &appList) @@ -499,6 +515,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AppsCheckList_getItemsList() @@ -548,7 +565,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AppsCheckList_setSortOrder() @@ -570,7 +589,9 @@ #endif//UT_MEMORY_CHECK #endif//Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AppsCheckList_selectedItemsChanged() @@ -604,6 +625,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::testTransitToStateSlot() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsaddtohomescreenstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsaddtohomescreenstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsaddtohomescreenstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -37,6 +37,7 @@ // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddToHomeScreenState_construction() @@ -64,8 +65,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddToHomeScreenState_onEntry() @@ -103,7 +104,7 @@ CaItemModel::IdRole).toInt(); } } - QVERIFY(clockId != 0); + QVERIFY(clockId != 0); const QString clockWidgetUri("hsclockwidgetplugin"); QVariantMap eventAttributes; @@ -149,6 +150,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddToHomeScreenState_onEntry_2() @@ -203,6 +205,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddToHomeScreenState_onEntry_3() @@ -263,6 +266,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::AddToHomeScreenState_onEntry_4() @@ -324,9 +328,9 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // - void MenuStatesTest::AddToHomeScreenState_showMessageWidgetCorrupted() { #ifdef Q_OS_SYMBIAN @@ -367,8 +371,3 @@ #endif//Q_OS_SYMBIAN } - - - - - diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsarrangestate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsarrangestate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsarrangestate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -27,7 +27,9 @@ #include "hsarrangestate.h" #include "hsmenuitemmodel.h" + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ArrangeState_FulfillEntriesList() @@ -64,6 +66,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ArrangeState_Save() @@ -125,6 +128,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ArrangeState_onEntry() @@ -166,6 +170,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ArrangeState_arrangeDialogFinished() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscollectionnamedialog.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscollectionnamedialog.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscollectionnamedialog.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -22,7 +22,9 @@ #include "hscollectionnamedialog.h" #include "t_hsmenuworkerstateplugin.h" + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsCollectionNameDialog_ConstructWithNoParams() @@ -67,6 +69,10 @@ #endif//Q_OS_SYMBIAN } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsCollectionNameDialog_ConstructWithId() { #ifdef Q_OS_SYMBIAN @@ -95,6 +101,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsCollectionNameDialog_uniqueCollectionName() @@ -135,8 +142,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsCollectionNameDialog_closeEvent() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscollectionnamestate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscollectionnamestate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscollectionnamestate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -18,11 +18,12 @@ #include #include "hscollectionnamedialog.h" #include "hscollectionnamestate.h" - #include "hsmenuevent.h" #include "t_hsmenuworkerstateplugin.h" + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::CollectionNameState_construction1() @@ -48,8 +49,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::CollectionNameState_onEntry() @@ -89,8 +90,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::CollectionNameState_dialogFinished() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscontentservice.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscontentservice.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hscontentservice.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -14,22 +14,48 @@ * Description: * */ + #include "t_hscontentservice.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsContentService::HsContentService(QObject *parent): QObject(parent) {} + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsContentService::~HsContentService() {} -HsContentService *HsContentService::instance() { + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +HsContentService *HsContentService::instance() +{ static HsContentService service; return &service; } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsContentService::createWidget(const QVariantHash ¶ms) { mParams = params; return true; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsWidgetHost *HsContentService::createWidgetForPreview(const QVariantHash ¶ms) { Q_UNUSED(params); diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionitemstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionitemstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionitemstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -28,7 +28,9 @@ #include "hsmenuitemmodel.h" #include "hsdialogcontroller.h" + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::DeleteCollectionItemState_construction() @@ -54,8 +56,10 @@ #endif//Q_OS_SYMBIAN } - - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::DeleteCollectionItemState_onEntry() { #ifdef Q_OS_SYMBIAN diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsdeletecollectionstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -27,6 +27,7 @@ #include "hsmenuevent.h" // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::DeleteCollectionState_construction1() @@ -52,7 +53,10 @@ #endif//Q_OS_SYMBIAN } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::DeleteCollectionState_onEntry() { #ifdef Q_OS_SYMBIAN @@ -83,6 +87,10 @@ #endif//Q_OS_SYMBIAN } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::DeleteCollectionState_deleteCollection() { #ifdef Q_OS_SYMBIAN diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsinstallationlogstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsinstallationlogstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsinstallationlogstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -28,6 +28,7 @@ #include "hsmenuevent.h" // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsInstallationLogState_construction() @@ -52,7 +53,10 @@ #endif//Q_OS_SYMBIAN } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsInstallationLogState_onEntry() { #ifdef Q_OS_SYMBIAN diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenustates.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenustates.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenustates.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -27,6 +27,10 @@ #include "hsshortcutservice.h" #include "hsdialogcontroller.h" +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::initTestCase() { #ifdef Q_OS_SYMBIAN @@ -38,7 +42,9 @@ (HsShortcutService::instance(mStateMachine/*,0*/)); mWindow = new HbMainWindow(); } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::cleanupTestCase() @@ -47,18 +53,25 @@ stopThread(); #endif //Q_OS_SYMBIAN delete mStateMachine; - delete mWindow; - mWindow = NULL; + //QWARN ( "Due to bug in hb wk36 we are we have to avoid deleting " + // "HbMainWindow, remove comment when fixed" ) +/* delete mWindow; + mWindow = NULL;*/ } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::cleanup() { qApp->processEvents(); } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- +// int threadFunction(void *params) { Q_UNUSED(params); @@ -72,6 +85,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::startThread() @@ -87,7 +101,9 @@ iThread.Resume(); #endif //Q_OS_SYMBIAN } + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::stopThread() @@ -99,6 +115,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::testSlot(HbAction* finished) @@ -108,6 +125,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // int MenuStatesTest::testExitSlot() @@ -116,6 +134,10 @@ return 0; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::checkDialogController() { diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenuworkerstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenuworkerstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenuworkerstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -16,9 +16,7 @@ */ #include "t_hsmenuworkerstateplugin.h" - #include "hsaddtohomescreenstate.h" - #include "hsmenuworkerstate.h" #include "hsmenuevent.h" #include "hsmenueventfactory.h" @@ -26,6 +24,7 @@ // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::MenuWorkerState_construction() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hspreviewhswidgetstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hspreviewhswidgetstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hspreviewhswidgetstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -15,7 +15,6 @@ * */ - #include "t_hsmenuworkerstateplugin.h" #include @@ -39,6 +38,7 @@ #include "HsWidgetHost.h" // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsPreviewHSWidgetState_construction() @@ -66,8 +66,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsPreviewHSWidgetState_showMessageWidgetCorrupted() @@ -92,8 +92,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsPreviewHSWidgetState_onEntry() @@ -139,6 +139,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsPreviewHSWidgetState_buildPreviewDialog() @@ -174,6 +175,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsPreviewHSWidgetState_addToHomeScreen() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsshortcutservice.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsshortcutservice.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsshortcutservice.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -14,27 +14,48 @@ * Description: * */ + #include "t_hsshortcutservice.h" +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsShortcutService::~HsShortcutService() { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QSharedPointer HsShortcutService::instance(QStateMachine *machine) { return QSharedPointer(new HsShortcutService(machine)); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void HsShortcutService::executeCollectionAction(int, QString) { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// bool HsShortcutService::isItemShortcutWidget(int) { return false; } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// HsShortcutService::HsShortcutService(QStateMachine *, QObject *) { } diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsuinstallfailedstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsuinstallfailedstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsuinstallfailedstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -26,6 +26,7 @@ #include "hsmenuitemmodel.h" // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsUninstallFailedState_construction() @@ -51,6 +52,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsUninstallFailedState_onEntry() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsuninstallitemstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsuninstallitemstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsuninstallitemstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -32,6 +32,7 @@ #include "hsmenuitemmodel.h" // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::HsUninstallItemState_construction() @@ -56,7 +57,10 @@ #endif//Q_OS_SYMBIAN } - +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsUninstallItemState_onEntry() { #ifdef Q_OS_SYMBIAN @@ -97,6 +101,11 @@ } #ifdef Q_OS_SYMBIAN + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void MenuStatesTest::HsUninstallItemState_getApplicationsNames() { #ifdef UT_MEMORY_CHECK diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappdetailsstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappdetailsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappdetailsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -25,7 +25,9 @@ #include #include "t_hsmenuworkerstateplugin.h" + // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ViewAppDetails_construction() @@ -51,6 +53,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ViewAppDetails_onEntry() @@ -99,5 +102,3 @@ #endif//Q_OS_SYMBIAN } - - diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappsettingsstate.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappsettingsstate.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappsettingsstate.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -23,6 +23,7 @@ #include "t_hsmenuworkerstateplugin.h" // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ViewAppSettings_construction() @@ -48,6 +49,7 @@ } // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ViewAppSettings_onEntry() @@ -92,8 +94,8 @@ #endif//Q_OS_SYMBIAN } - // --------------------------------------------------------------------------- +// // --------------------------------------------------------------------------- // void MenuStatesTest::ViewAppSettings_onExit() diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/testwidget.cpp --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/testwidget.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/testwidget.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -18,28 +18,52 @@ #include #include "testwidget.h" +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// TestWidget::TestWidget(QGraphicsItem *parent, Qt::WindowFlags flags) : HbWidget(parent, flags) { setPreferredSize(100, 100); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// TestWidget::~TestWidget() { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void TestWidget::onInitialize() { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void TestWidget::onShow() { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void TestWidget::onHide() { } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void TestWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option) @@ -47,11 +71,19 @@ painter->drawRect(rect()); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QRectF TestWidget::boundingRect() const { return rect(); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// QPainterPath TestWidget::shape() const { QPainterPath path; diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/t_hsmenuworkerstateplugin.pro --- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/t_hsmenuworkerstateplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/t_hsmenuworkerstateplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -93,8 +93,6 @@ CONFIG += symbian_test coverage: CONFIG -= symbian_test - - MMP_RULES += SMPSAFE } @@ -105,3 +103,6 @@ + + +symbian:MMP_RULES += SMPSAFE diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/widgetplugins/hsclockwidgetplugin/hsclockwidgetplugin.pro --- a/homescreenapp/widgetplugins/hsclockwidgetplugin/hsclockwidgetplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/widgetplugins/hsclockwidgetplugin/hsclockwidgetplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -46,3 +46,4 @@ RESOURCES = hsclockwidgetplugin.qrc exportResources(./resource/*.manifest, $$WIDGET_SUBDIR) +exportResources(./resource/*.svg, $$WIDGET_SUBDIR) diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/widgetplugins/hsclockwidgetplugin/resource/hsclockwidgetplugin.manifest --- a/homescreenapp/widgetplugins/hsclockwidgetplugin/resource/hsclockwidgetplugin.manifest Mon Sep 27 11:52:00 2010 +0300 +++ b/homescreenapp/widgetplugins/hsclockwidgetplugin/resource/hsclockwidgetplugin.manifest Wed Oct 06 16:06:24 2010 +0300 @@ -4,7 +4,7 @@ Clock Themable clock widget. qtg_large_clock - qtg_large_clock + qtg_graf_hswidget_preview_clock.svg false hsclockwidgetplugin.xml diff -r 32e56106abf2 -r 66b5fe3c07fd homescreenapp/widgetplugins/hsclockwidgetplugin/resource/qtg_graf_hswidget_preview_clock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreenapp/widgetplugins/hsclockwidgetplugin/resource/qtg_graf_hswidget_preview_clock.svg Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/bwins/snsrutilsu.def --- a/screensaver/bwins/snsrutilsu.def Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/bwins/snsrutilsu.def Wed Oct 06 16:06:24 2010 +0300 @@ -2,16 +2,17 @@ ?qt_metacall@SnsrLabel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int SnsrLabel::qt_metacall(enum QMetaObject::Call, int, void * *) ??0SnsrLabel@@QAE@PAVQGraphicsItem@@@Z @ 2 NONAME ; SnsrLabel::SnsrLabel(class QGraphicsItem *) ?tr@SnsrLabel@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString SnsrLabel::tr(char const *, char const *, int) - ?tr@SnsrLabel@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString SnsrLabel::tr(char const *, char const *) - ?getStaticMetaObject@SnsrLabel@@SAABUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const & SnsrLabel::getStaticMetaObject(void) - ?changeEvent@SnsrLabel@@MAEXPAVQEvent@@@Z @ 6 NONAME ; void SnsrLabel::changeEvent(class QEvent *) - ?staticMetaObject@SnsrLabel@@2UQMetaObject@@B @ 7 NONAME ; struct QMetaObject const SnsrLabel::staticMetaObject - ??1SnsrLabel@@UAE@XZ @ 8 NONAME ; SnsrLabel::~SnsrLabel(void) - ?trUtf8@SnsrLabel@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString SnsrLabel::trUtf8(char const *, char const *) - ?metaObject@SnsrLabel@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * SnsrLabel::metaObject(void) const - ??0SnsrLabel@@QAE@ABVQString@@PAVQGraphicsItem@@@Z @ 11 NONAME ; SnsrLabel::SnsrLabel(class QString const &, class QGraphicsItem *) - ?setThemedTextColor@SnsrLabel@@AAEXXZ @ 12 NONAME ; void SnsrLabel::setThemedTextColor(void) - ?trUtf8@SnsrLabel@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString SnsrLabel::trUtf8(char const *, char const *, int) - ?qt_metacast@SnsrLabel@@UAEPAXPBD@Z @ 14 NONAME ; void * SnsrLabel::qt_metacast(char const *) - ??_ESnsrLabel@@UAE@I@Z @ 15 NONAME ; SnsrLabel::~SnsrLabel(unsigned int) + ?setTextColorType@SnsrLabel@@QAEXABW4TextColorType@1@@Z @ 4 NONAME ; void SnsrLabel::setTextColorType(enum SnsrLabel::TextColorType const &) + ?tr@SnsrLabel@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString SnsrLabel::tr(char const *, char const *) + ?getStaticMetaObject@SnsrLabel@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & SnsrLabel::getStaticMetaObject(void) + ?changeEvent@SnsrLabel@@MAEXPAVQEvent@@@Z @ 7 NONAME ; void SnsrLabel::changeEvent(class QEvent *) + ?staticMetaObject@SnsrLabel@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const SnsrLabel::staticMetaObject + ??1SnsrLabel@@UAE@XZ @ 9 NONAME ; SnsrLabel::~SnsrLabel(void) + ?trUtf8@SnsrLabel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString SnsrLabel::trUtf8(char const *, char const *) + ?metaObject@SnsrLabel@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * SnsrLabel::metaObject(void) const + ??0SnsrLabel@@QAE@ABVQString@@PAVQGraphicsItem@@@Z @ 12 NONAME ; SnsrLabel::SnsrLabel(class QString const &, class QGraphicsItem *) + ?setThemedTextColor@SnsrLabel@@AAEXXZ @ 13 NONAME ; void SnsrLabel::setThemedTextColor(void) + ?trUtf8@SnsrLabel@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString SnsrLabel::trUtf8(char const *, char const *, int) + ?qt_metacast@SnsrLabel@@UAEPAXPBD@Z @ 15 NONAME ; void * SnsrLabel::qt_metacast(char const *) + ??_ESnsrLabel@@UAE@I@Z @ 16 NONAME ; SnsrLabel::~SnsrLabel(unsigned int) diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/common.pri --- a/screensaver/common.pri Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/common.pri Wed Oct 06 16:06:24 2010 +0300 @@ -129,8 +129,8 @@ } } -!symbian { - DEFINES += NO_QT_EXTENSIONS +symbian { + DEFINES += QT_EXTENSIONS } # support for NFT diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/devicedialogplugins/snsrdevicedialogplugin/conf/screensaver.confml Binary file screensaver/devicedialogplugins/snsrdevicedialogplugin/conf/screensaver.confml has changed diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/devicedialogplugins/snsrdevicedialogplugin/snsrdevicedialogplugin.pro --- a/screensaver/devicedialogplugins/snsrdevicedialogplugin/snsrdevicedialogplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/devicedialogplugins/snsrdevicedialogplugin/snsrdevicedialogplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -21,17 +21,16 @@ include (../../common.pri) include (snsrdevicedialogplugin.pri) -LIBS += -lxqsettingsmanager LIBS += -lscreensavermodel symbian: { LIBS += -lsnsrdisplaycontrolclient + LIBS += -lxqsettingsmanager TARGET.UID3 = 0x2002704E TARGET.CAPABILITY = CAP_ECOM_PLUGIN include(snsrdevicedialogplugin_exports_to_rom.pri) - LIBS += -lxqsettingsmanager pluginstub.sources = snsrdevicedialogplugin.dll pluginstub.path = /resource/plugins/devicedialogs diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialog.cpp --- a/screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialog.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialog.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -23,12 +23,16 @@ #include #include #include +#ifdef Q_OS_SYMBIAN #include +#include +#endif //Q_OS_SYMBIAN #include #include +#include #include -#include + #include "snsrdevicedialog.h" #include "snsrdevicedialogdisplaycontrol.h" @@ -93,7 +97,15 @@ setDismissPolicy(HbPopup::NoDismiss); setTimeout(HbPopup::NoTimeout); - mainWindow()->setAutomaticOrientationEffectEnabled(false); + // Disable all the effects for the screensaver dialog. Otherwise, the + // automatic fade effect would be applied to the screensaver when screen + // orientation changes, revealing the UI beneath (because device dialog + // application server has a transparent background). This both looks ugly + // and poses a potential security risk, as in the device locked case + // screensaver is used as a layer to hide any confidential information. + // Screensaver containers can still implement custom effects for orientation + // swithc etc. + HbEffect::disable(this); setDeviceDialogParameters( parameters ); @@ -141,7 +153,8 @@ return false; } } - + +#ifdef Q_OS_SYMBIAN // Check initial view from repository if (viewType == ViewTypeInitial ) { XQSettingsManager::Error error; @@ -155,7 +168,12 @@ viewType = startupView; } } - +#else + if (viewType == ViewTypeInitial ) { + viewType = ViewTypeStandby; + } +#endif //Q_OS_SYMBIAN + switch (viewType) { case SnsrDeviceDialog::ViewTypeActive: mScreensaver->foreground(); diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialogplugin.cpp --- a/screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialogplugin.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialogplugin.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -43,9 +43,9 @@ const char *lBigClockSnsrPluginUri = #ifdef Q_OS_SYMBIAN - "z:/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.xml"; + "z:/snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.xml"; #else - "snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.xml"; + "snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.xml"; #endif const char *lViewType("view_type"); diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/eabi/snsrutilsu.def --- a/screensaver/eabi/snsrutilsu.def Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/eabi/snsrutilsu.def Wed Oct 06 16:06:24 2010 +0300 @@ -2,21 +2,22 @@ _ZN9SnsrLabel11changeEventEP6QEvent @ 1 NONAME _ZN9SnsrLabel11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME _ZN9SnsrLabel11qt_metacastEPKc @ 3 NONAME - _ZN9SnsrLabel16staticMetaObjectE @ 4 NONAME DATA 16 - _ZN9SnsrLabel18setThemedTextColorEv @ 5 NONAME - _ZN9SnsrLabel19getStaticMetaObjectEv @ 6 NONAME - _ZN9SnsrLabelC1EP13QGraphicsItem @ 7 NONAME - _ZN9SnsrLabelC1ERK7QStringP13QGraphicsItem @ 8 NONAME - _ZN9SnsrLabelC2EP13QGraphicsItem @ 9 NONAME - _ZN9SnsrLabelC2ERK7QStringP13QGraphicsItem @ 10 NONAME - _ZN9SnsrLabelD0Ev @ 11 NONAME - _ZN9SnsrLabelD1Ev @ 12 NONAME - _ZN9SnsrLabelD2Ev @ 13 NONAME - _ZNK9SnsrLabel10metaObjectEv @ 14 NONAME - _ZTI9SnsrLabel @ 15 NONAME - _ZTV9SnsrLabel @ 16 NONAME - _ZThn16_N9SnsrLabelD0Ev @ 17 NONAME - _ZThn16_N9SnsrLabelD1Ev @ 18 NONAME - _ZThn8_N9SnsrLabelD0Ev @ 19 NONAME - _ZThn8_N9SnsrLabelD1Ev @ 20 NONAME + _ZN9SnsrLabel16setTextColorTypeERKNS_13TextColorTypeE @ 4 NONAME + _ZN9SnsrLabel16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN9SnsrLabel18setThemedTextColorEv @ 6 NONAME + _ZN9SnsrLabel19getStaticMetaObjectEv @ 7 NONAME + _ZN9SnsrLabelC1EP13QGraphicsItem @ 8 NONAME + _ZN9SnsrLabelC1ERK7QStringP13QGraphicsItem @ 9 NONAME + _ZN9SnsrLabelC2EP13QGraphicsItem @ 10 NONAME + _ZN9SnsrLabelC2ERK7QStringP13QGraphicsItem @ 11 NONAME + _ZN9SnsrLabelD0Ev @ 12 NONAME + _ZN9SnsrLabelD1Ev @ 13 NONAME + _ZN9SnsrLabelD2Ev @ 14 NONAME + _ZNK9SnsrLabel10metaObjectEv @ 15 NONAME + _ZTI9SnsrLabel @ 16 NONAME + _ZTV9SnsrLabel @ 17 NONAME + _ZThn16_N9SnsrLabelD0Ev @ 18 NONAME + _ZThn16_N9SnsrLabelD1Ev @ 19 NONAME + _ZThn8_N9SnsrLabelD0Ev @ 20 NONAME + _ZThn8_N9SnsrLabelD1Ev @ 21 NONAME diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/inc/snsrcolors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/inc/snsrcolors.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,36 @@ +/* +* 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: Colors used in screensaver. +* +*/ + +#ifndef SNSRCOLORS_H +#define SNSRCOLORS_H + +#include +#include + +namespace SnsrColors +{ +// in active mode icons and text should take the color from the theme using these roles +static const QLatin1String WidgetColorRole("qtc_screensaver"); + +// in power save mode icons and texts should be always white +static const QColor PowerSaveModeWidgetColor(Qt::white); + +// background should always be black +static const QColor BackgroundColor(Qt::black); +} + +#endif /* SNSRCOLORS_H */ diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/rom/screensaver.iby --- a/screensaver/rom/screensaver.iby Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/rom/screensaver.iby Wed Oct 06 16:06:24 2010 +0300 @@ -30,8 +30,8 @@ // -------- snsrbigclockscreensaverplugin file=ABI_DIR\BUILD_DIR\snsrbigclockscreensaverplugin.dll SHARED_LIB_DIR\snsrbigclockscreensaverplugin.dll data=DATAZ_\QT_TRANSLATIONS_DIR\snsrbigclockscreensaverplugin.qm QT_TRANSLATIONS_DIR\snsrbigclockscreensaverplugin.qm -data=\epoc32\data\z\snsrresources\plugins\screensaverplugins\snsrbigclockscreensaverplugin.qtplugin snsrresources\plugins\screensaverplugins\snsrbigclockscreensaverplugin.qtplugin -data=\epoc32\data\z\snsrresources\plugins\screensaverplugins\snsrbigclockscreensaverplugin.xml snsrresources\plugins\screensaverplugins\snsrbigclockscreensaverplugin.xml +data=\epoc32\data\z\snsrresources\plugins\snsrplugins\snsrbigclockscreensaverplugin.qtplugin snsrresources\plugins\snsrplugins\snsrbigclockscreensaverplugin.qtplugin +data=\epoc32\data\z\snsrresources\plugins\snsrplugins\snsrbigclockscreensaverplugin.xml snsrresources\plugins\snsrplugins\snsrbigclockscreensaverplugin.xml // ---- snsrutils -------------------------------------------- diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaver.pro --- a/screensaver/screensaver.pro Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/screensaver.pro Wed Oct 06 16:06:24 2010 +0300 @@ -17,8 +17,8 @@ TEMPLATE = subdirs SUBDIRS = screensavermodel \ - screensaverplugins \ snsrutils \ + snsrplugins \ devicedialogplugins CONFIG += ordered diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/screensaverplugins.pro --- a/screensaver/screensaverplugins/screensaverplugins.pro Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: screensaverplugins.pro -# - -TEMPLATE = subdirs - -SUBDIRS += snsrbigclockscreensaverplugin - -CONFIG += ordered \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsranalogclockcontainer.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsranalogclockcontainer.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2009-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: Container for analog clock. -* -*/ - -#ifndef SNSRANALOGCLOCKCONTAINER_H -#define SNSRANALOGCLOCKCONTAINER_H - -#include "snsrbigclockcontainer.h" - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class SnsrLabel; -class SnsrAnalogClockWidget; -class SnsrSwipeWidget; - -class SnsrAnalogClockContainer : public SnsrBigClockContainer -{ - Q_OBJECT - -public: - - SnsrAnalogClockContainer(); - ~SnsrAnalogClockContainer(); - -public slots: - - virtual void update(); - -public: // from base classes - - virtual int updateIntervalInMilliseconds(); - -protected: // from base classes - - virtual void loadWidgets(); - -private: // data - - SnsrLabel *mDateLabel; - SnsrAnalogClockWidget *mAnalogClockWidget; - SnsrSwipeWidget *mSwipeWidget; - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) -}; - -#endif // SNSRANALOGCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockcontainer.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockcontainer.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Base class container. -* -*/ - -#ifndef SNSRBIGCLOCKCONTAINER_H -#define SNSRBIGCLOCKCONTAINER_H - -#include - -#include "snsrtest_global.h" -#include "snsrdocumentloader.h" -#include "screensaver.h" - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class QGraphicsLinearLayout; -class HbIndicatorInterface; -class SnsrIndicatorModel; -class SnsrIndicatorWidget; - -class SnsrBigClockContainer : public HbWidget -{ - Q_OBJECT - -public: - - SnsrBigClockContainer(); - ~SnsrBigClockContainer(); - -public slots: - - virtual void update() = 0; - virtual void changeLayout(Qt::Orientation orientation); - -public: - - void setIndicatorModel(SnsrIndicatorModel &model); - virtual Screensaver::ScreenPowerMode displayPowerMode(); - virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); - virtual bool isOrientationLocked(); - virtual int updateIntervalInMilliseconds() = 0; - -protected: - - virtual void loadWidgets() = 0; - virtual void changeEvent(QEvent * event); - QPointF randomPosition(const QRectF &rect); - QPointF nextRandomPosition(const QPointF &curPos, QPointF &destPos, const QRectF &containerRect); - void initIndicatorWidget(); - void resetIndicatorConnections(); - -private: - - void setBackgroundColor(); - void paint( - QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget = 0 - ); - -signals: - - void unlockRequested(); - void activeAreaMoved(); - -protected: - - SnsrDocumentLoader mDocumentLoader; - QObjectList mDocumentObjects; - - QGraphicsLinearLayout *mBackgroundContainerLayout; - QGraphicsWidget *mMainView; - QGraphicsWidget *mMainContainer; - - SnsrIndicatorModel *mIndicatorModel; // not owned - SnsrIndicatorWidget *mIndicatorWidget; - - int mCurrentOrientation; - -private: - - QColor mBackgroundColor; - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) -}; - -#endif // SNSRBIGCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaver.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaver.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Big clock Screensaver. -* -*/ - -#ifndef SNSRBIGCLOCKSCREENSAVER_H -#define SNSRBIGCLOCKSCREENSAVER_H - -#include - -#include -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class HbMainWindow; -class SnsrBigClockContainer; -class SnsrIndicatorModel; -class XQSettingsManager; - -class SnsrBigClockScreensaver : public Screensaver -{ - Q_OBJECT - -public: - - enum ClockFormat - { - ClockFormatUndefined, - ClockFormatAnalog, - ClockFormatDigital - }; - - SnsrBigClockScreensaver(); - ~SnsrBigClockScreensaver(); - -private: - - ClockFormat clockFormat(); - void removeCurrentContainer(); - void setCurrentContainer( SnsrBigClockContainer* newContainer ); - - virtual bool onInitialize(); - virtual bool onForeground(); - virtual bool onPartialForeground(); - virtual bool onBackground(); - virtual bool onPowerSave(); - virtual bool onClose(); - virtual void onHandleActiveIndicators(const QList &activeIndicators); - virtual void onHandleActivatedIndicator(HbIndicatorInterface *activatedIndicator); - virtual void onHandleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator); - virtual Screensaver::ScreenPowerMode currentPowerMode(); - virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); - virtual void updateLayout(); - -private slots: - - void updateTime(); - -private: - - QTimer mTimer; - HbMainWindow *mMainWindow; - SnsrBigClockContainer *mCurrentContainer; - SnsrIndicatorModel *mIndicatorModel; - XQSettingsManager *m_setManager; - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) - -}; - -#endif // SNSRBIGCLOCKSCREENSAVER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaverplugin.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaverplugin.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Big clock Screensaver provider. -* -*/ - -#ifndef SNSRBIGCLOCKSCREENSAVERPLUGIN_H -#define SNSRBIGCLOCKSCREENSAVERPLUGIN_H - -#include -#include - -QTM_USE_NAMESPACE - -class SnsrBigClockScreensaverPlugin : public QObject, - public QServicePluginInterface -{ - Q_OBJECT - Q_INTERFACES(QtMobility::QServicePluginInterface) - -public: - QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, - QServiceContext *context, - QAbstractSecuritySession *session); - -private: - void LoadTranslator(); - -}; - -#endif // SNSRBIGCLOCKSCREENSAVERPLUGIN_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrblankcontainer.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrblankcontainer.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* 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: Container for blank screen. -* -*/ - -#ifndef SNSRBLANKCONTAINER_H -#define SNSRBLANKCONTAINER_H - -#include "snsrbigclockcontainer.h" - -//SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class SnsrBlankContainer : public SnsrBigClockContainer -{ - Q_OBJECT - -public: - - SnsrBlankContainer(); - ~SnsrBlankContainer(); - -public slots: - - virtual void update(); - -public: // from base classes - - virtual Screensaver::ScreenPowerMode displayPowerMode(); - virtual int updateIntervalInMilliseconds(); - -protected: // from base classes - - virtual void loadWidgets(); - -private: - -// SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) -}; - -#endif // SNSRBLANKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrdigitalclockcontainer.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrdigitalclockcontainer.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2009-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: Container for digital clock. -* -*/ - -#ifndef SNSRDIGITALCLOCKCONTAINER_H -#define SNSRDIGITALCLOCKCONTAINER_H - -#include "snsrbigclockcontainer.h" - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class SnsrLabel; -class SnsrSwipeWidget; - -class SnsrDigitalClockContainer : public SnsrBigClockContainer -{ - Q_OBJECT - -public: - - SnsrDigitalClockContainer(); - ~SnsrDigitalClockContainer(); - -public slots: - - virtual void update(); - -public: // from base classes - - virtual int updateIntervalInMilliseconds(); - -protected: // from base classes - - virtual void loadWidgets(); - -private: // data - - SnsrLabel *mTimeLabel; - SnsrLabel *mAmPmLabel; - SnsrLabel *mDateLabel; - SnsrSwipeWidget *mSwipeWidget; - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) -}; - -#endif // SNSRDIGITALCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrdocumentloader.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsrdocumentloader.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Screensaver custom document loader. -* -*/ - -#ifndef SNSRDOCUMENTLOADER_H -#define SNSRDOCUMENTLOADER_H - -#include - -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class SnsrDocumentLoader : public HbDocumentLoader -{ - -private: - - virtual QObject *createObject(const QString &type, const QString &name); - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) - -}; - -#endif // SNSRDOCUMENTLOADER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsroledanalogclockcontainer.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsroledanalogclockcontainer.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Container for oled analog clock. -* -*/ - -#ifndef SNSROLEDANALOGCLOCKCONTAINER_H -#define SNSROLEDANALOGCLOCKCONTAINER_H - -#include "snsrbigclockcontainer.h" - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class SnsrOledClockWidget; -class SnsrLabel; - -class SnsrOledAnalogClockContainer : public SnsrBigClockContainer -{ - Q_OBJECT - -public: - - SnsrOledAnalogClockContainer(); - ~SnsrOledAnalogClockContainer(); - -public slots: - - virtual void update(); - void updatePosition(); - -public: // from base classes - - virtual int updateIntervalInMilliseconds(); - virtual Screensaver::ScreenPowerMode displayPowerMode(); - virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); - virtual bool isOrientationLocked(); - -protected: // from base classes - - virtual void loadWidgets(); - -private: - - QGraphicsWidget *mClockContainer; - - SnsrOledClockWidget *mOledClockWidget; - SnsrLabel *mDateLabel; - - QPointF mDestPosition; - bool mInitialize; - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) -}; - -#endif // SNSROLEDANALOGCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsroleddigitalclockcontainer.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/inc/snsroleddigitalclockcontainer.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Container for oled digital clock. -* -*/ - -#ifndef SNSROLEDDIGITALCLOCKCONTAINER_H -#define SNSROLEDDIGITALCLOCKCONTAINER_H - -#include "snsrbigclockcontainer.h" - - -SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) - -class SnsrLabel; -class SnsrOledTimeLabel; - -class SnsrOledDigitalClockContainer : public SnsrBigClockContainer -{ - Q_OBJECT - -public: - - SnsrOledDigitalClockContainer(); - ~SnsrOledDigitalClockContainer(); - -public slots: - - virtual void update(); - void updatePosition(); - -public: // from base classes - - virtual int updateIntervalInMilliseconds(); - virtual Screensaver::ScreenPowerMode displayPowerMode(); - virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); - virtual bool isOrientationLocked(); - -protected: // from base classes - - virtual void loadWidgets(); - -private: - - QGraphicsWidget *mClockContainer; - - SnsrLabel *mAmPmLabel; - SnsrOledTimeLabel *mTimeLabel; - SnsrLabel *mDateLabel; - - QPointF mDestPosition; - bool mInitialize; - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) -}; - -#endif // SNSROLEDDIGITALCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveranalog.docml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveranalog.docml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - -
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverdigital.docml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverdigital.docml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - -
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroledanalog.docml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroledanalog.docml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - -
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroleddigital.docml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroleddigital.docml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - -
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.s60xml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.s60xml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - snsrbigclockscreensaverplugin - z:/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.qtplugin - ScreenSaver Big Clock Plugin - - com.nokia.screensaver.ISnsrBigClockScreensaver - 1.0 - Default implementation for screensaver big clock - - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.xml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.xml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - snsrbigclockscreensaverplugin - snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin - ScreenSaver Big Clock Plugin - - com.nokia.screensaver.ISnsrBigClockScreensaver - 1.0 - Default implementation for screensaver big clock - - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaver.qrc --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaver.qrc Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ - - - resource/snsrbigclockscreensaverdigital.docml - resource/snsrbigclockscreensaveranalog.docml - resource/snsrbigclockscreensaveroledanalog.docml - resource/snsrbigclockscreensaveroleddigital.docml - snsrswipewidget/resource/animate_portrait.fxml - - - snsrclockwidgets/resource/snsroledclockwidget.css - snsrclockwidgets/resource/snsroledclockwidget.widgetml - snsrclockwidgets/resource/snsranalogclockwidget.css - snsrclockwidgets/resource/snsranalogclockwidget.widgetml - snsrindicatorwidget/resource/snsrindicatorwidget.css - snsrindicatorwidget/resource/snsrindicatorwidget.widgetml - snsrindicatorwidget/resource/snsrindicatorwidget_color.css - snsrswipewidget/resource/snsrswipewidget.css - snsrswipewidget/resource/snsrswipewidget.widgetml - snsrswipewidget/resource/snsrswipewidget_color.css - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pri --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pri Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -# -# Copyright (c) 2009-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: snsrbigclockscreensaverplugin.pri -# - -HEADERS += ./inc/*.h \ - ./snsrclockwidgets/inc/*.h \ - ./snsrindicatorwidget/inc/*.h \ - ./snsrswipewidget/inc/*.h - -SOURCES += ./src/*.cpp \ - ./snsrclockwidgets/src/*.cpp \ - ./snsrindicatorwidget/src/*.cpp \ - ./snsrswipewidget/src/*.cpp - -DEPENDPATH += ./inc \ - ./src \ - ./resource - -INCLUDEPATH += ./inc \ - ./snsrclockwidgets/inc \ - ./snsrindicatorwidget/inc \ - ./snsrswipewidget/inc diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pro --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pro Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -# -# Copyright (c) 2009 - 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: snsrbigclockscreensaverplugin.pro -# - -TEMPLATE = lib -CONFIG += plugin hb mobility - -MOBILITY = serviceframework -MOBILITY += systeminfo - -PLUGIN_SUBDIR = /snsrresources/plugins/screensaverplugins - -#TRANSLATIONS = snsrbigclockscreensaverplugin.ts - -include (../../common.pri) - -LIBS += -lscreensavermodel \ - -lsnsrutils \ - -lxqsettingsmanager - -INCLUDEPATH += ../../snsrutils/inc - -symbian: { - TARGET.UID3 = 0x20027052 - MMP_RULES += SMPSAFE -} - -include(snsrbigclockscreensaverplugin.pri) - -RESOURCES = snsrbigclockscreensaver.qrc - -exportResources(./snsrbigclockscreensaverplugin.qm, resource/qt/translations) - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.qm Binary file screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.qm has changed diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.ts --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.ts Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - - - Swipe in screensaver - Swipe to unlock - Swipe to unlock - - screensaver_001 - - sc - False - - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsranalogclockwidget.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsranalogclockwidget.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2009-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: Analog Clock Widget. -* -*/ - -#ifndef SNSRANALOGCLOCKWIDGET_H -#define SNSRANALOGCLOCKWIDGET_H - -#include -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrClockWidgets) - -class HbIconItem; - -class SnsrAnalogClockWidget: public HbWidget -{ - Q_OBJECT - -public: - - explicit SnsrAnalogClockWidget(QGraphicsItem *parent = 0); - virtual ~SnsrAnalogClockWidget(); - -public slots: - - void tick(); - -private: - - void resizeEvent (QGraphicsSceneResizeEvent *event); - void createPrimitives(); - void updatePrimitives(); - void polish( HbStyleParameters& params ); - -private: - - HbIconItem *mClockBackground; - HbIconItem *mClockHourHand; - HbIconItem *mClockMinuteHand; - HbIconItem *mClockSecondHand; - - Q_DISABLE_COPY(SnsrAnalogClockWidget) - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrClockWidgets) - -}; - -#endif // SNSRANALOGCLOCKWIDGET_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledclockwidget.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledclockwidget.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2009-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: Oled Clock Widget. -* -*/ - -#ifndef SNSROLEDCLOCKWIDGET_H -#define SNSROLEDCLOCKWIDGET_H - -#include -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrClockWidgets) - -class HbIconItem; -class HbTextItem; -//class SnsrLabel; - -class SnsrOledClockWidget: public HbWidget -{ - Q_OBJECT - -public: - - explicit SnsrOledClockWidget(QGraphicsItem *parent = 0); - virtual ~SnsrOledClockWidget(); - -public slots: - - void tick(); - -private: - - void resizeEvent (QGraphicsSceneResizeEvent *event); - void createPrimitives(); - void updatePrimitives(); - void polish( HbStyleParameters& params ); - -private: - - HbIconItem *mClockBackground; - HbIconItem *mClockHourHand; - HbIconItem *mClockMinuteHand; - // TODO: not known yet what label (or any) is shown in clock face (day or am/pm or none) - // If some label will be put onto the clock face, then it's color must come - // from theme and is most propably different than SnsrLabel uses (=text/icon color - // used in screensaver in general - //HbIconItem *mClockDateFrame; - //SnsrLabel *mClockDateLabel; - - Q_DISABLE_COPY(SnsrOledClockWidget) - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrClockWidgets) - -}; - -#endif // SNSROLEDCLOCKWIDGET_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledtimelabel.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledtimelabel.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* 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: Time label for oled digital clock. -* -*/ - -#ifndef SNSROLEDTIMELABEL_H -#define SNSROLEDTIMELABEL_H - -#include -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrClockWidgets) - -class SnsrOledTimeLabel : public HbTextItem -{ - Q_OBJECT - - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) - -public: - - SnsrOledTimeLabel(QGraphicsItem *parent = 0); - ~SnsrOledTimeLabel(); - - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - -private: - - Q_DISABLE_COPY(SnsrOledTimeLabel) - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrClockWidgets) -}; - -#endif // SNSROLEDTIMELABEL_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.css --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.css Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -HbWidget { - margin-left: 0un; - margin-top: 0un; -} - -SnsrAnalogClockWidget { - layout: layout_1; -} - -SnsrAnalogClockWidget::analog_clock_background { - pref-width: 32.8un; - pref-height: 32.8un; - zvalue: 0; -} - -SnsrAnalogClockWidget::analog_clock_hour_hand { - pref-height: 32.8un; - pref-width: 32.8un; - zvalue: 3; -} - -SnsrAnalogClockWidget::analog_clock_minute_hand { - pref-height: 32.8un; - pref-width: 32.8un; - zvalue: 2; -} - -SnsrAnalogClockWidget::analog_clock_second_hand { - pref-height: 32.8un; - pref-width: 32.8un; - zvalue: 1; -} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.widgetml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.widgetml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.css --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.css Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -HbWidget { - margin-left: 0un; - margin-top: 0un; -} - -SnsrOledClockWidget { - layout: layout_1; -} - -SnsrOledClockWidget::oled_clock_background { - pref-height: 32.8un; - pref-width: 32.8un; - zvalue: 0; -} - -SnsrOledClockWidget::oled_clock_hour_hand { - pref-height: 32.8un; - pref-width: 32.8un; - zvalue: 4; -} - -SnsrOledClockWidget::oled_clock_minute_hand { - pref-height: 32.8un; - pref-width: 32.8un; - zvalue: 3; -} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.widgetml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.widgetml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - - - - - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsranalogclockwidget.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsranalogclockwidget.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2009-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: Analog Clock Widget. -* -*/ - -#include "snsranalogclockwidget.h" - -#include -#include -#include - -#include -#include - - -const char *gClockCssFilePath =":/style/snsranalogclockwidget.css"; -const char *gClockWidgetMLFilePath = ":/style/snsranalogclockwidget.widgetml"; - -/*! - \class SnsrAnalogClockWidget - \ingroup group_snsrbigclockscreensaverprovider - \brief Screensaver analog clock widget. - */ - -/*! - Constructs a new SnsrAnalogClockWidget. - \param parent Parent object. - */ -SnsrAnalogClockWidget::SnsrAnalogClockWidget(QGraphicsItem* parent): - HbWidget(parent), - mClockBackground(0), mClockHourHand(0), - mClockMinuteHand(0), mClockSecondHand(0) -{ - HbStyleLoader::registerFilePath(gClockCssFilePath); - HbStyleLoader::registerFilePath(gClockWidgetMLFilePath); - - createPrimitives(); - updatePrimitives(); -} - -/*! - Destructs the class. - */ -SnsrAnalogClockWidget::~SnsrAnalogClockWidget() -{ - HbStyleLoader::unregisterFilePath( gClockCssFilePath ); - HbStyleLoader::unregisterFilePath( gClockWidgetMLFilePath ); - -} - -void SnsrAnalogClockWidget::polish( HbStyleParameters& params ) -{ - // TODO: updatePrimitives might not be needed to be called from here anymore (hb changes)? - HbWidget::polish(params); - updatePrimitives(); -} - -/*! - @copydoc HbWidget::resizeEvent() - */ -void SnsrAnalogClockWidget::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - HbWidget::resizeEvent(event); - updatePrimitives(); -} - -/*! - Creates all widget primitives. - */ -void SnsrAnalogClockWidget::createPrimitives() -{ - // TODO: when final graphics are available in platform (qtg_graf_screensaver_clock_xxx) - // use them instead. Also am/pm label should be added into the clock face. - if (!mClockBackground) { - mClockBackground = new HbIconItem(QLatin1String("qtg_graf_clock_day_bg"), this); - HbStyle::setItemName(mClockBackground, QLatin1String("analog_clock_background")); - } - if (!mClockHourHand) { - mClockHourHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_hour"), this); - HbStyle::setItemName(mClockHourHand, QLatin1String("analog_clock_hour_hand")); - } - if (!mClockMinuteHand) { - mClockMinuteHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_min"), this); - HbStyle::setItemName(mClockMinuteHand, QLatin1String("analog_clock_minute_hand")); - } - if (!mClockSecondHand) { - mClockSecondHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_sec"), this); - HbStyle::setItemName(mClockSecondHand, QLatin1String("analog_clock_second_hand")); - } -} - -/*! - @copydoc HbWidget::updatePrimitives() - */ -void SnsrAnalogClockWidget::updatePrimitives() -{ - if (!mClockHourHand || !mClockMinuteHand || !mClockSecondHand) { - createPrimitives(); - } - - // Calculate angles for clock hands. - QTime time = QTime::currentTime(); - qreal s = 6 * time.second(); - qreal m = 6 * (time.minute() + s/360); - qreal h = 30 * ((time.hour() % 12) + m/360); - - int x = mClockHourHand->preferredSize().width()/2; - int y = mClockHourHand->preferredSize().height()/2; - mClockHourHand->setTransform(QTransform().translate(x, y).rotate(h).translate(-x, -y)); - - x = mClockMinuteHand->preferredSize().width()/2; - y = mClockMinuteHand->preferredSize().height()/2; - mClockMinuteHand->setTransform(QTransform().translate(x, y).rotate(m).translate(-x, -y)); - - x = mClockSecondHand->preferredSize().width()/2; - y = mClockSecondHand->preferredSize().height()/2; - mClockSecondHand->setTransform(QTransform().translate(x, y).rotate(s).translate(-x, -y)); - -} - -/*! - Updates primitives when time change. - */ -void SnsrAnalogClockWidget::tick() -{ - updatePrimitives(); -} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledclockwidget.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledclockwidget.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Oled Clock Widget. -* -*/ - -#include "snsroledclockwidget.h" -#include "snsrlabel.h" - -#include -#include -#include -#include - -#include -#include -#include - - -const char *gOledClockCssFilePath = ":/style/snsroledclockwidget.css"; -const char *gOledClockWidgetMLFilePath = ":/style/snsroledclockwidget.widgetml"; -const char *gDateFormatStr = "ddd d"; // this is Qt format string, not Hb format like the others - -/*! - \class SnsrOledClockWidget - \ingroup group_snsrbigclockscreensaverprovider - \brief Screensaver oled clock widget. - */ - -/*! - Constructs a new SnsrOledClockWidget. - \param parent Parent object. - */ -SnsrOledClockWidget::SnsrOledClockWidget(QGraphicsItem* parent): - HbWidget(parent), - mClockBackground(0), mClockHourHand(0), mClockMinuteHand(0) - //,mClockDateFrame(0), mClockDateLabel(0) -{ - HbStyleLoader::registerFilePath(gOledClockCssFilePath); - HbStyleLoader::registerFilePath(gOledClockWidgetMLFilePath); - - createPrimitives(); - updatePrimitives(); -} - -void SnsrOledClockWidget::polish( HbStyleParameters& params ) -{ - // TODO: updatePrimitives might not be needed to be called from here anymore (hb changes)? - HbWidget::polish(params); - updatePrimitives(); -} - -/*! - Destructs the class. - */ -SnsrOledClockWidget::~SnsrOledClockWidget() -{ - // TODO: deleted by parent? - /* delete mClockBackground; - delete mClockHourHand; - delete mClockMinuteHand; - delete mClockDateFrame; - delete mClockDateLabel;*/ - - HbStyleLoader::unregisterFilePath( gOledClockCssFilePath ); - HbStyleLoader::unregisterFilePath( gOledClockWidgetMLFilePath ); - -} - -/*! - @copydoc HbWidget::resizeEvent() - */ -void SnsrOledClockWidget::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - HbWidget::resizeEvent(event); - updatePrimitives(); -} - -/*! - Creates all widget primitives. - */ -void SnsrOledClockWidget::createPrimitives() -{ - // TODO: final graphics will be named qtg_graf_screensaver_clock_oled_xxx. - // not available in platform yet - // Also am/pm label should be added into the clock face and date label - // be removed (=replace date with am/pm) ? - - if (!mClockBackground) { - mClockBackground = new HbIconItem(QLatin1String("qtg_graf_clock_night_bg"), this); - HbStyle::setItemName(mClockBackground, QLatin1String("oled_clock_background")); - } - if (!mClockHourHand) { - mClockHourHand = new HbIconItem(QLatin1String("qtg_graf_clock_night_hour"), this); - HbStyle::setItemName(mClockHourHand, QLatin1String("oled_clock_hour_hand")); - } - if (!mClockMinuteHand) { - mClockMinuteHand = new HbIconItem(QLatin1String("qtg_graf_clock_night_min"), this); - HbStyle::setItemName(mClockMinuteHand, QLatin1String("oled_clock_minute_hand")); - } - /* - if (!mClockDateFrame) { - mClockDateFrame = new HbIconItem(QLatin1String("oled-clock-date-frame"), this); - HbStyle::setItemName(mClockDateFrame, QLatin1String("oled_clock_date_frame")); - } - if (!mClockDateLabel) { - mClockDateLabel = new SnsrLabel(this); - HbStyle::setItemName(mClockDateLabel, QLatin1String("oled_clock_date_label")); - }*/ -} - -/*! - @copydoc HbWidget::updatePrimitives() - */ -void SnsrOledClockWidget::updatePrimitives() -{ - if (!mClockHourHand || !mClockMinuteHand /*|| !mClockDateLabel*/) { - createPrimitives(); - } - Q_ASSERT( mClockHourHand && mClockMinuteHand /*&& mClockDateLabel */); - - // Calculate angles for clock hands. - // Use granularity of one minute so that minute hand is always exactly - // on some minute and not between minutes. OLED clock is not updated more - // frequently than once per minute and using finer granularity would cause - // the minute hand to be always between even minutes. - QTime time = QTime::currentTime(); - qreal m = 6 * time.minute(); - qreal h = 30 * ((time.hour() % 12) + m/360); - - int x = mClockHourHand->preferredSize().width()/2; - int y = mClockHourHand->preferredSize().height()/2; - mClockHourHand->setTransform(QTransform().translate(x, y).rotate(h).translate(-x, -y)); - - x = mClockMinuteHand->preferredSize().width()/2; - y = mClockMinuteHand->preferredSize().height()/2; - mClockMinuteHand->setTransform(QTransform().translate(x, y).rotate(m).translate(-x, -y)); - - // QString dateString = QLocale().toString(QDate::currentDate(), gDateFormatStr); - // mClockDateLabel->setPlainText(dateString); -} - -/*! - Updates primitives when time change. - */ -void SnsrOledClockWidget::tick() -{ - updatePrimitives(); -} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledtimelabel.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledtimelabel.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* 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: Time label for oled digital clock. -* -*/ - -#include "snsroledtimelabel.h" - -#include -#include - - - -/*! - \class SnsrOledTimeLabel - \ingroup group_snsrbigclockscreensaverprovider - \brief Screensaver oled digital clock's time label - */ - -/*! - Constructs a new SnsrOledTimeLabel. - \param parent Parent object. - */ - -SnsrOledTimeLabel::SnsrOledTimeLabel(QGraphicsItem *parent) - : HbTextItem(parent) -{ - setTextColor(Qt::white); - - setMinimumLines( 1 ); - setMaximumLines( 1 ); - setAlignment(Qt::AlignCenter); - - // as we do own painting, must disable the flag that is enabled - // by default due to performance optimatizations. - setFlag(QGraphicsItem::ItemHasNoContents,false); -} - -SnsrOledTimeLabel::~SnsrOledTimeLabel() -{ -} - -/*! - \reimp - We want to draw only the outlines of the time label text and thus - text is drawn here with QPainterPath and pen (no brush) which seems to be the - only way to accomplish this. - Base class's Paint method must not be called! - We use base class only to get the bounding rect inside which to draw the text - (boundingRect has been adjusted to current text, font, alignment etc.) - */ -void SnsrOledTimeLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - // TODO: changes needed for mirrored layout and/or other than latin digits?? - - painter->save(); //saves the painter state. - - QPainterPath path; - - QRectF boundingRect = this->boundingRect(); - QString timeText = this->text(); - QFont font = this->font(); - - // As painterPath takes the left end of the text's baseline as - // a parameter we must calculate that point from boundingRect's bottom left - // so that font's descent (and baseline (=1)) are taken into account. - // We want to center the text horizontally too. The logic - // is basically the same as used inside the base class for drawing the text - // within boundingRect. - QPointF leftEndOfBaseline(0,0); // for painterPath - QFontMetrics fontMetrics(font); - int descent = fontMetrics.descent(); - int width = fontMetrics.width(timeText); - leftEndOfBaseline.setY(boundingRect.bottomLeft().y() - descent -1); - leftEndOfBaseline.setX((boundingRect.width() - width) / 2 ); // centerH - - path.addText(leftEndOfBaseline, font, timeText); - - painter->setFont(font); - - QPen newPen = painter->pen(); - newPen.setWidth( 1 ); // TODO: is this width ok? - newPen.setColor(this->textColor()); - painter->setPen(newPen); - - painter->setBrush(QBrush(Qt::NoBrush)); - - // painter->setLayoutDirection ( layoutDirection() ); // TODO: needed or not? - - painter->setRenderHint(QPainter::Antialiasing, true); // TODO: use or not? - - painter->drawPath(path); - - // Must restore the painter or the whole UI will be messed up! - painter->restore(); - -} - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/inc/snsrindicatorinfo.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/inc/snsrindicatorinfo.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* 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: Indicator information. -* -*/ - -#ifndef SNSRINDICATORINFO_H -#define SNSRINDICATORINFO_H - -// INCLUDES -#include -#include - -/*! - \class SnsrIndicatorInfo - \ingroup group_snsrbigclockscreensaverplugin - \brief Data structure used within big clock to handle indicator data. - */ - -struct SnsrIndicatorInfo { - - inline SnsrIndicatorInfo() : - type(QString()), - iconPath(QString()), - category(HbIndicatorInterface::NotificationCategory) {} - - inline SnsrIndicatorInfo(const QString &type, - const QString &iconPath, - HbIndicatorInterface::Category category) : - type(type), - iconPath(iconPath), - category(category){} - - inline SnsrIndicatorInfo(const SnsrIndicatorInfo ©Source) : - type(copySource.type), - iconPath(copySource.iconPath), - category(copySource.category){} - - inline bool isIconPathEmpty() const { - return !iconPath.isEmpty(); - } - - // Indicator type string that is defined by the indicator provider - QString type; - // Should be fetched by using HbIndicatorInterface::MonoDecorationNameRole - QString iconPath; - HbIndicatorInterface::Category category; - -}; - -#endif // SNSRINDICATORINFO_H - -// End of File diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/inc/snsrindicatormodel.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/inc/snsrindicatormodel.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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: Model for handling indicator data. -* -*/ - -#ifndef SNSRINDICATORMODEL_H -#define SNSRINDICATORMODEL_H - -#include -#include -#include "snsrindicatorinfo.h" -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrIndicatorWidget) - -class HbIndicatorInterface; - -class SnsrIndicatorModel : public QObject -{ - Q_OBJECT - -public: - - SnsrIndicatorModel(QObject *parent = 0); - virtual ~SnsrIndicatorModel(); - -public slots: - - void handleActiveIndicators(const QList &activeIndicators); - void handleActivatedIndicator(HbIndicatorInterface *activatedIndicator); - void handleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator); - - void handleUpdatedIndicator(); - - void initializeIndicatorWidget(); - - /* - * Provides notification of changes in online/offline mode - */ - void offlineValueChanged( const XQSettingsKey &key, const QVariant &value); - -signals: - - void indicatorsUpdated(const QList &activeIndicators); - void allIndicatorsDeactivated(); - -private: - - bool addIndicator(const SnsrIndicatorInfo &indicatorInfo); - bool isIndicatorAlreadyAdded(const SnsrIndicatorInfo &indicatorInfo) const; - - bool findAndRemoveIndicator(const SnsrIndicatorInfo &indicatorInfo); - - bool showIndicatorInScreensaver(const HbIndicatorInterface &indicatorInterface, - SnsrIndicatorInfo &indicatorInfo); - - void connectToIndicatorsUpdateSignal(const HbIndicatorInterface &indicatorInterface); - - bool anyActiveIndicators() const; - - void emitChangeSignal(); - void updateIndicatorsToShowList(); - - void initializeOfflineModeIndication(); - void getCurrentOfflineState(); - -private: - - bool mOfflineStateOn; - SnsrIndicatorInfo mOfflineIndicatorInfo; - XQSettingsKey *mOfflineKey; - XQSettingsManager *mSettingsManager; - - // Save universal indicator statuses into these 2 lists. - // Active notification indicators in reversed chronological order: - // the first item is the most recent. - QList mNotificationIndicators; - // Screensaver should show only silent indicator from this category. - QList mSettingIndicators; - - // This is a combined ordered list of all indicators that should - // be shown in UI: offline + notification indicators + - // settings indicators - QList mIndicatorsToShow; - - Q_DISABLE_COPY(SnsrIndicatorModel) - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrIndicatorWidget) -}; - -#endif // SNSRINDICATORMODEL_H - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/inc/snsrindicatorwidget.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/inc/snsrindicatorwidget.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* 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: Indicator Widget. -* -*/ - -#ifndef SNSRINDICATORWIDGET_H -#define SNSRINDICATORWIDGET_H - -#include -#include "snsrtest_global.h" - -SCREENSAVER_TEST_CLASS(T_SnsrIndicatorWidget) - -class HbIconItem; -class SnsrIndicatorInfo; - - -class SnsrIndicatorWidget: public HbWidget -{ - Q_OBJECT - - Q_ENUMS(IndicatorLayoutType) - Q_PROPERTY(IndicatorLayoutType layoutType READ layoutType WRITE setLayoutType) - -public: - - enum IndicatorLayoutType - { - IndicatorsAlignedLeft, - IndicatorsCentered - }; - -public: - - explicit SnsrIndicatorWidget(QGraphicsItem *parent = 0); - virtual ~SnsrIndicatorWidget(); - - IndicatorLayoutType layoutType() const; - void setLayoutType(IndicatorLayoutType type); - - void setPowerSaveModeColor(bool savemode); - -public slots: - - void showIndicators(const QList &indicators); - void removeAllIndicators(); - -private: - - virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; - void createPrimitives(); - -private: - - QList mIcons; - IndicatorLayoutType mLayoutType; - bool mPowerSaveModeColor; - - Q_DISABLE_COPY(SnsrIndicatorWidget) - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrIndicatorWidget) -}; - -#endif // SNSRINDICATORWIDGET_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/resource/snsrindicatorwidget.css --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/resource/snsrindicatorwidget.css Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -SnsrIndicatorWidget { - layout: indicatorlayout; -} - -SnsrIndicatorWidget::icon1 { - fixed-width: 2.4un; - fixed-height: 2.4un; -} - -SnsrIndicatorWidget::icon2 { - fixed-width: 2.4un; - fixed-height: 2.4un; -} - -SnsrIndicatorWidget::icon3 { - fixed-width: 2.4un; - fixed-height: 2.4un; -} - -SnsrIndicatorWidget::icon4 { - fixed-width: 2.4un; - fixed-height: 2.4un; -} - -SnsrIndicatorWidget::icon5 { - fixed-width: 2.4un; - fixed-height: 2.4un; -} - -SnsrIndicatorWidget::icon6 { - fixed-width: 2.4un; - fixed-height: 2.4un; -} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/resource/snsrindicatorwidget.widgetml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/resource/snsrindicatorwidget.widgetml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/resource/snsrindicatorwidget_color.css --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/resource/snsrindicatorwidget_color.css Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -SnsrIndicatorWidget::icon1 -{ - color:var(qtc_screensaver); -} - -SnsrIndicatorWidget::icon2 -{ - color:var(qtc_screensaver); -} - -SnsrIndicatorWidget::icon3 -{ - color:var(qtc_screensaver); -} - -SnsrIndicatorWidget::icon4 -{ - color:var(qtc_screensaver); -} - -SnsrIndicatorWidget::icon5 -{ - color:var(qtc_screensaver); -} - -SnsrIndicatorWidget::icon6 -{ - color:var(qtc_screensaver); -} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/src/snsrindicatormodel.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/src/snsrindicatormodel.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,433 +0,0 @@ -/* -* 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: Model for handling indicator data. -* -*/ - -#include -#include -#include -//#include //TODO? these don't work in wk30.. - -#include "snsrindicatormodel.h" -#include "snsrindicatorinfo.h" - -/*! - \class SnsrIndicatorModel - \ingroup group_snsrbigclockscreensaverplugin - \brief Model for handling indicator data. - */ - -// TODO: what is the final type string of silent indicator? couldn't -// find it in wk22 -> workaround solution: assume that it contains -// substring "silence" like in their demo app. -const char *gSilentIndicatorTypeString = "silence"; -const char *gOfflineIndicatorTypeString = "offline"; - - -/*! - Constructs a new SnsrIndicatorModel - \param parent Parent object. - */ -SnsrIndicatorModel::SnsrIndicatorModel(QObject *parent): QObject(parent), - mOfflineStateOn(false) -{ - initializeOfflineModeIndication(); -} - -/*! - Destructs the class. - */ -SnsrIndicatorModel::~SnsrIndicatorModel() -{ - mNotificationIndicators.clear(); - mSettingIndicators.clear(); - mIndicatorsToShow.clear(); - delete mSettingsManager; - delete mOfflineKey; -} - -/*! - If there are already some active indicators when screensaver is - launched, then this method is called. - Indicators that are gonna be shown by the screensaver are - added to the model. - \param activeIndicators Active universal indicators in - chronological order according to their arrival time. - */ -void SnsrIndicatorModel::handleActiveIndicators( - const QList &activeIndicators) -{ - mNotificationIndicators.clear(); - mSettingIndicators.clear(); - - bool addedAny(false); - - for (int i = 0; i < activeIndicators.size(); ++i) { - HbIndicatorInterface* activatedIndicator = activeIndicators.at(i); - SnsrIndicatorInfo indicatorInfo; - if (activatedIndicator - && showIndicatorInScreensaver(*activatedIndicator,indicatorInfo)) { - addIndicator(indicatorInfo); - connectToIndicatorsUpdateSignal(*activatedIndicator); - addedAny = true; - } - } - - // Send signal only once if there were any such indicators that - // screensaver is supposed to show (=added to the model). - if (addedAny) { - emitChangeSignal(); - } -} - -/*! - Called when some universal indicator gets activated. - \param activatedIndicator Activated universal indicator - */ -void SnsrIndicatorModel::handleActivatedIndicator( - HbIndicatorInterface *activatedIndicator) -{ - SnsrIndicatorInfo indicatorInfo; - if (activatedIndicator - && showIndicatorInScreensaver(*activatedIndicator,indicatorInfo)) { - if (addIndicator(indicatorInfo)) { - connectToIndicatorsUpdateSignal(*activatedIndicator); - emitChangeSignal(); - } - } -} - -/*! - Called when some universal indicator gets deactivated. - \param deactivatedIndicator Deactivated universal indicator - */ -void SnsrIndicatorModel::handleDeactivatedIndicator( - HbIndicatorInterface *deactivatedIndicator) -{ - if (deactivatedIndicator) { - SnsrIndicatorInfo indicatorInfo( - deactivatedIndicator->indicatorType(), - deactivatedIndicator->indicatorData(HbIndicatorInterface::MonoDecorationNameRole).toString(), - deactivatedIndicator->category()); - - if (findAndRemoveIndicator(indicatorInfo)) { - emitChangeSignal(); - } - } -} - -/*! - Called when some universal indicator updates its data by - emitting dataChanged signal. - We listen to this signal because at least the silent indicator plugin demo - uses this method to inform the clients when it gets deactivated/activated - once it has been activated once by setting its icon path to empty/valid string. - Don't know if this is going to be the final solution as it's unconventional (?) - but let's be prepared also to this kind of approach. - */ -void SnsrIndicatorModel::handleUpdatedIndicator() -{ - HbIndicatorInterface* indicator = - qobject_cast(sender()); - if (!indicator) { - return; - } - - // If indicator's icon path was set to empty string, then treat it - // like it were deactivated. And if not empty, then it's active again. - if (indicator->indicatorData( - HbIndicatorInterface::MonoDecorationNameRole).toString().isEmpty()) { - handleDeactivatedIndicator(indicator); - } - else { - handleActivatedIndicator(indicator); - } - -} - -/*! - Sends a signal with a list of all currently active indicators. - No signal is sent if there are no active indicators currently. - */ -void SnsrIndicatorModel::initializeIndicatorWidget() -{ - getCurrentOfflineState(); // update status to be on the safe side - - if ( anyActiveIndicators() ) { - emitChangeSignal(); - } -} - -/*! - listens airplane repository key. Not sure if the state can even be changed at the moment. - TODO: do we really need this? - */ -void SnsrIndicatorModel::offlineValueChanged( const XQSettingsKey &key, const QVariant &value ) -{ - bool previousState(mOfflineStateOn); - switch ( key.key() ) { - case KCoreAppUIsNetworkConnectionAllowed: - if(value.toInt() == ECoreAppUIsNetworkConnectionNotAllowed && - value.isValid()) - { - mOfflineStateOn = true; - } - else - { - mOfflineStateOn = false; - } - if (previousState != mOfflineStateOn) { - emitChangeSignal(); - } - break; - default: - break; - - } -} - -/*! - Add the indicator into this model. Handle here the order in which - indicators are shown in screensaver: notification indicators should be - shown in the same order as shown in statusbar, that is in reversed - chronological order. Silent indicator should always be the right-most one. - /retval true if indicator was added (not found already in the listings) - */ -bool SnsrIndicatorModel::addIndicator(const SnsrIndicatorInfo &indicatorInfo) -{ - // To be on the safe side, check that the indicator doesn't already - // exists in the active indicator listings. - bool added(false); - - // Use prepend to keep the list in reversed chronological order - if (indicatorInfo.category == HbIndicatorInterface::NotificationCategory - && !isIndicatorAlreadyAdded(indicatorInfo)) { - mNotificationIndicators.prepend(indicatorInfo); - added = true; - } - else if (indicatorInfo.category == HbIndicatorInterface::SettingCategory - && !isIndicatorAlreadyAdded(indicatorInfo)) { - mSettingIndicators.append(indicatorInfo); - added = true; - } - - return added; -} - -/*! - Check whether the indicator is already added in the active - indicator listing. - /retval true if indicator is already added; false if not. - */ -bool SnsrIndicatorModel::isIndicatorAlreadyAdded(const SnsrIndicatorInfo &indicatorInfo) const -{ - bool alreadyExits(false); - - const QList &indicatorList = - indicatorInfo.category == HbIndicatorInterface::NotificationCategory - ? mNotificationIndicators : mSettingIndicators; - - for (int i = 0; i < indicatorList.size(); ++i) { - if (indicatorList.at(i).type == indicatorInfo.type) { - alreadyExits = true; - break; - } - } - return alreadyExits; -} - -/*! - Remove indicator if it can be found. - /retval true if the indicator was removed - */ -bool SnsrIndicatorModel::findAndRemoveIndicator(const SnsrIndicatorInfo &indicatorInfo) -{ - bool removed(false); - int index(-1); - QList &indicatorList = - indicatorInfo.category == HbIndicatorInterface::NotificationCategory - ? mNotificationIndicators : mSettingIndicators; - - for (int i = 0; i < indicatorList.size(); ++i) { - if (indicatorList.at(i).type == indicatorInfo.type) { - index = i; - break; - } - } - if (index >= 0) { - indicatorList.removeAt(index); - removed = true; - } - return removed; -} - -/*! - Check whether to show the indicator in screensaver or not. - Icon path is asked with HbIndicatorInterface::MonoDecorationNameRole - which refers to the indicator icons shown also in the statusbar: - only 4 Notification indicators has premission to publish data with - that role. As those 4 are the ones wanted also by screensaver, no - extra checks are needed. - From the Setting category one should show only Silent indicator. - No indicators are shown from the Progress category. - If indicator should be shown by screensaver, indicator info is - packaged and returned within the parameter. - - /retval true if the indicator should be shown in screensaver - */ -bool SnsrIndicatorModel::showIndicatorInScreensaver( - const HbIndicatorInterface &indicatorInterface, SnsrIndicatorInfo &indicatorInfo) -{ - bool show(false); - // all indicators shown by screensaver must have valid status bar icon path - QString iconPath = - indicatorInterface.indicatorData(HbIndicatorInterface::MonoDecorationNameRole).toString(); - QString typeString = indicatorInterface.indicatorType(); - HbIndicatorInterface::Category category = indicatorInterface.category(); - - if (category == HbIndicatorInterface::NotificationCategory - && !iconPath.isEmpty()) { - // only 4 indicators of this category has permission to publish status bar - // icon path->we should show all of them->no additional checks are neeeded. - show = true; - } - else if (category == HbIndicatorInterface::SettingCategory - && !iconPath.isEmpty() - // TODO: what is the type string of silent indicator? couldn't - // find it in wk22 -> workaround solution: assume that it contains - // substring "silence" like in their demo app. - // && type == gSilentIndicatorTypeString ) { - && typeString.contains(gSilentIndicatorTypeString, Qt::CaseInsensitive)) { - show = true; - } - else { // e.g. no Progress category indicators are shown - show = false; - } - - // package indicator data into indicatorInfo parameter - indicatorInfo.type = typeString; - indicatorInfo.iconPath = iconPath; - indicatorInfo.category = category; - - return show; -} - -/*! - Start listening to indicator's dataChanged signals. - /parameter indicator whose dataChanged signal we want to listen - */ -void SnsrIndicatorModel::connectToIndicatorsUpdateSignal(const HbIndicatorInterface &indicatorInterface) -{ - // Connect to silent indicator's dataChanged signal as it seems to - // use unconventional method (demo at least) to inform when - // it's get deactivated/activated: dataChanged signal is emitted and - // icon path is set to empty string/valid string. - // It's assumed that we don't need to listen to other indicators - // as we are not interested e.g. when primary/secondary texts change etc. - - // NOTE: do NOT disconnect the indicator signal anywhere explicitly here - // or we won't get activation/deactivation messages. - if (indicatorInterface.indicatorType().contains(gSilentIndicatorTypeString, Qt::CaseInsensitive)) { - QObject::connect( &indicatorInterface, SIGNAL(dataChanged()), - this, SLOT(handleUpdatedIndicator())); - } -} - -/*! - Check whether there is any active indicator currently. - /retval true if there is at least one indicator to show - */ -bool SnsrIndicatorModel::anyActiveIndicators() const -{ - bool any(false); - if ( mNotificationIndicators.size() != 0 - || mSettingIndicators.size() != 0 - || mOfflineStateOn ) { - any = true; - } - return any; -} - -/*! - Send appropriate signal so that UI widget can update itself. - */ -void SnsrIndicatorModel::emitChangeSignal() -{ - if (anyActiveIndicators()) { - updateIndicatorsToShowList(); - emit indicatorsUpdated(mIndicatorsToShow); - } - else { - mIndicatorsToShow.clear(); - emit allIndicatorsDeactivated(); - } -} - -/*! - Updates the list that contains all the indicators that - should be shown in UI. List should contain active indicators - in this order: - offline + notification indicators + settings indicators. - This is the list that will be sent to the widget. - */ -void SnsrIndicatorModel::updateIndicatorsToShowList() -{ - mIndicatorsToShow.clear(); - - if (mOfflineStateOn) { - mIndicatorsToShow.append(mOfflineIndicatorInfo); - } - mIndicatorsToShow.append(mNotificationIndicators); - mIndicatorsToShow.append(mSettingIndicators); -} - -/*! - * Reads the airplanemode repository value and starts monitoring it. - * if the value is 1, offline indicator is shown. - */ -void SnsrIndicatorModel::initializeOfflineModeIndication() -{ - mOfflineIndicatorInfo = SnsrIndicatorInfo( - gOfflineIndicatorTypeString, - QLatin1String("qtg_mono_offline"), - HbIndicatorInterface::NotificationCategory); - - mSettingsManager = new XQSettingsManager(this); - //connect to offlineValueChanged slot so we get information if the value is changed while screensaver is on - connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), - this, SLOT(offlineValueChanged( const XQSettingsKey, const QVariant))); - mOfflineKey = new XQSettingsKey(XQSettingsKey::TargetCentralRepository, - KCRUidCoreApplicationUIs.iUid, - KCoreAppUIsNetworkConnectionAllowed); - if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == ECoreAppUIsNetworkConnectionNotAllowed) - { - mOfflineStateOn = true; - } - mSettingsManager->startMonitoring(*mOfflineKey); -} - -/*! - Get current offline status. - */ -void SnsrIndicatorModel::getCurrentOfflineState() -{ - if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == ECoreAppUIsNetworkConnectionNotAllowed) { - mOfflineStateOn = true; - } - else { - mOfflineStateOn = false; - } -} - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/src/snsrindicatorwidget.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrindicatorwidget/src/snsrindicatorwidget.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -/* -* 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: Indicator Widget. -* -*/ - -#include "snsrindicatorwidget.h" -#include "snsrindicatorinfo.h" - -#include -#include -#include -#include -#include -#include - - -const char *gIndicatorCssFilePath =":/style/snsrindicatorwidget.css"; -const char *gIndicatorWidgetMLFilePath = ":/style/snsrindicatorwidget.widgetml"; -const char *gIndicatorColorCssFilePath = ":/style/snsrindicatorwidget_color.css"; - -const int gNumberOfIcons(6); - -/*! - \class SnsrIndicatorWidget - \ingroup group_snsrbigclockscreensaverprovider - \brief Screensaver indicator widget. - */ - -/*! - Constructs a new SnsrIndicatorWidget. - \param parent Parent object. - */ -SnsrIndicatorWidget::SnsrIndicatorWidget(QGraphicsItem* parent): - HbWidget(parent), mLayoutType(IndicatorsCentered), mPowerSaveModeColor(false) -{ - HbStyleLoader::registerFilePath(gIndicatorCssFilePath); - HbStyleLoader::registerFilePath(gIndicatorWidgetMLFilePath); - - // TODO: will some color variables be added into hbcolorgroup.css so - // that one don't need to use hard-coded values? If not, then - // changes needed in this widget. - HbStyleLoader::registerFilePath(gIndicatorColorCssFilePath); - - setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); - - createPrimitives(); -} - -/*! - Destructs the class. - */ -SnsrIndicatorWidget::~SnsrIndicatorWidget() -{ - // icons within the list are deleted by parent - mIcons.clear(); - - HbStyleLoader::unregisterFilePath( gIndicatorCssFilePath ); - HbStyleLoader::unregisterFilePath( gIndicatorWidgetMLFilePath ); - HbStyleLoader::unregisterFilePath(gIndicatorColorCssFilePath); -} - - -SnsrIndicatorWidget::IndicatorLayoutType SnsrIndicatorWidget::layoutType() const -{ - return mLayoutType; -} - -/*! - Sets the name of layout definition \a layoutName for selecting - the layout of view items of this view from css/xml files. - - This layout is accessible from css file as layout property - of the view item. - - */ -void SnsrIndicatorWidget::setLayoutType(IndicatorLayoutType type) -{ - if (mLayoutType != type ) { - mLayoutType = type; - QSizePolicy::Policy hSizePolicy(QSizePolicy::Expanding); - if ( mLayoutType == IndicatorsAlignedLeft ) { - hSizePolicy = QSizePolicy::Preferred; - } - setSizePolicy(hSizePolicy,QSizePolicy::Preferred); - } -} - -/*! - Set powersave mode status. If save mode is true then we use - by default Qt::white as color. Otherwise we use themed color. - */ -void SnsrIndicatorWidget::setPowerSaveModeColor(bool savemode) -{ - mPowerSaveModeColor = savemode; -} - - -/*! - This is called whenever indicators' status changes: parameter list - tells which indicators should be shown at the given moment. All - previously shown indicators should be hidden and show only these - indicators passed as a parameter. - */ -void SnsrIndicatorWidget::showIndicators(const QList &indicators) -{ - // Update icon paths so that shown iconItems have - // valid icon path and rest have empty path (->invisible) - - int indicatorAmount = indicators.size(); - - removeAllIndicators(); - - // TODO: after wk18 color is lost after icon name is set again - bug or what? - // workaround: ask color from theme and set it again here - // If this must be left here, then change back-up color to white? - QColor iconColor = HbColorScheme::color("qtc_screensaver"); - if (iconColor.spec() == QColor::Invalid ) { - iconColor = Qt::white; - } - - if ( mPowerSaveModeColor ) { - iconColor = Qt::white; - } - - // update icon paths for items that are gonna be shown - for (int i=0; i < indicatorAmount && i < mIcons.size(); ++i) { - mIcons.at(i)->setIconName(indicators.at(i).iconPath); - mIcons.at(i)->setFlags(HbIcon::Colorized); - mIcons.at(i)->setColor(iconColor); - } - - // To recalculate layouts - updateGeometry(); - if ( parentLayoutItem() ) { - parentLayoutItem()->updateGeometry(); // clear the cache of the parent - } -} - -/*! - Remove all indicators from UI. - */ -void SnsrIndicatorWidget::removeAllIndicators() -{ - for (int i=0; i < mIcons.size(); ++i) { - mIcons.at(i)->setIconName(QString()); - } -} - -/*! - If indicator pane is going to be centered, then calculate width so that it's - exactly the same as visible icons are taking space (+spacers between them). - If indicator pane is left aligned, then actual width doesn't matter. - Assumption is that icons are fixed sized. - \reimp -*/ -QSizeF SnsrIndicatorWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const -{ - QSizeF hint = HbWidget::sizeHint(which, constraint); - - // TODO: seems to work if icons are fixed-sized (units) - // TODO: even though size policy is preferred, should we give also - // minimum and maximum sizes? - if (which == Qt::PreferredSize && layoutType() == IndicatorsCentered ) { - qreal width(0); - qreal itemWidth(0); - qreal iconSpace(0); - int visibleIconCount(0); - - // TODO: use geometry or size? - for (int i=0; i < mIcons.size(); ++i) { - if (!mIcons.at(i)->iconName().isEmpty() ) { - visibleIconCount++; - itemWidth = mIcons.at(i)->iconItemSize().width(); - width = width + itemWidth; - } - } - if (visibleIconCount > 1) { - style()->parameter("hb-param-margin-gene-middle-horizontal", iconSpace); - width = width + ((visibleIconCount-1)*iconSpace); - } - - hint.setWidth(width); - } - - return hint; -} - -/*! - Creates all widget primitives. - Coloring is handled via CSS. - */ -void SnsrIndicatorWidget::createPrimitives() -{ - if (!mIcons.isEmpty()) { - return; - } - - HbIconItem *icon(0); - QLatin1String itemNameBase("icon"); - int itemNameEnd(1); - QString itemName(""); - - while (mIcons.count() < gNumberOfIcons) { - // When created, icon names are left empty -> nothing shown in UI. - icon = new HbIconItem(this); - icon->setFlags(HbIcon::Colorized); - icon->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - - // Create items that are named icon1..icon6. - itemName.clear(); - itemName.append(itemNameBase); - itemName.append(QString::number(itemNameEnd)); - HbStyle::setItemName(icon, itemName); - ++itemNameEnd; - - mIcons.append(icon); - } -} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/inc/snsrswipewidget.h --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/inc/snsrswipewidget.h Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* 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: Swipe widget. -* -*/ - -#ifndef SNSRSWIPEWIDGET_H -#define SNSRSWIPEWIDGET_H - -#include - -#include -#include -#include -#include "snsrtest_global.h" - -// TODO: SCREENSAVER_TEST_CLASS -SCREENSAVER_TEST_CLASS(T_SnsrSwipeWidgets) - -class HbAction; -class HbPushButton; -class HbLabel; - -class SnsrSwipeWidget : public HbWidget - { - Q_OBJECT - -public: - - explicit SnsrSwipeWidget(QGraphicsItem *parent = 0); - virtual ~SnsrSwipeWidget(); - -public slots: - - void start(); - -protected: - - void reset(); - -private slots: - - void animationComplete(const HbEffect::EffectStatus &status); - void createPrimitives(); - -protected: // from base classes - - virtual void gestureEvent(QGestureEvent *event); - -signals: - void swipeDownDetected(); - -private: // data - - HbLabel *mSlideLabel; - HbLabel *mSlideIcon; - - Q_DISABLE_COPY(SnsrSwipeWidget) - - SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrSwipeWidgets) - -}; - -#endif // SNSRSWIPEWIDGET_H - -// EOF diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/animate_portrait.fxml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/animate_portrait.fxml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - - 1.5 - 400.0 - 600.0 - - - - - 1.5 - 1.0 - 0.1 - - - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.css --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.css Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -HbWidget { - margin-left: 0un; - margin-top: 0un; -} - -SnsrSwipeWidget { - layout:layout-portrait; -} - -SnsrSwipeWidget::slideLabel { - text-align: AlignVCenter|AlignHCenter; - pref-width: 224.0px; - pref-height: hb-param-text-height-tiny; - zvalue: 0; -} - - -SnsrSwipeWidget::slideIcon { - text-align: AlignVCenter|AlignHCenter; - pref-height: 25.0un; - size-policy-vertical: fixed; - pref-width: 25.0un; - zvalue: 1; -} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.widgetml --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.widgetml Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget_color.css --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget_color.css Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -SnsrSwipeWidget::slideLabel -{ - color:var(qtc_screensaver); -} - -SnsrSwipeWidget::slideIcon -{ - color:var(qtc_screensaver); -} - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/src/snsrswipewidget.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/snsrswipewidget/src/snsrswipewidget.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* 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: Swipe Widget. -* -*/ - -#include -#include -#include -#include - -#include "snsrbigclockcontainer.h" -#include "snsranalogclockcontainer.h" -#include "snsrswipewidget.h" - -const char *gSwipeCssFilePath =":/style/snsrswipewidget.css"; -const char *gSwipeWidgetMLFilePath = ":/style/snsrswipewidget.widgetml"; -const char *gSwipeColorCssFilePath = ":/style/snsrswipewidget_color.css"; - -const qreal gSwipeDownAngle = 270; -const qreal gSwipeAngleTolerance = 25; - -/*! - \class SnsrSwipeWidget - \ingroup group_snsrbigclockscreensaverplugins - \brief Screensaver swipe widget. - */ - -/*! - Constructs a new SnsrSwipeWidget. - \param parent Parent object. - */ -SnsrSwipeWidget::SnsrSwipeWidget(QGraphicsItem* parent): - HbWidget(parent), - mSlideLabel(0), mSlideIcon(0) -{ - HbStyleLoader::registerFilePath(gSwipeCssFilePath); - HbStyleLoader::registerFilePath(gSwipeWidgetMLFilePath); - HbStyleLoader::registerFilePath(gSwipeColorCssFilePath); - - setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); - - createPrimitives(); - - HbEffect::add(mSlideIcon, - ":/xml/animate_portrait.fxml", - "slideDownPortrait"); - - reset(); - grabGesture(Qt::SwipeGesture); - -} - -/*! - Destructs the class. - */ -SnsrSwipeWidget::~SnsrSwipeWidget() -{ - HbStyleLoader::unregisterFilePath( gSwipeCssFilePath ); - HbStyleLoader::unregisterFilePath( gSwipeWidgetMLFilePath ); - HbStyleLoader::unregisterFilePath( gSwipeColorCssFilePath ); - - HbEffect::remove(mSlideIcon); -} - -void SnsrSwipeWidget::start() -{ - // Start animation - HbEffect::start(mSlideIcon, "slideDownPortrait", this, "animationComplete"); -} - -void SnsrSwipeWidget::reset() -{ - // Cancel animation and disable callback - HbEffect::cancel(mSlideIcon, "slideDownPortrait", false, false); -} - -void SnsrSwipeWidget::animationComplete(const HbEffect::EffectStatus &status) -{ - Q_UNUSED(status); - HbEffect::start(mSlideIcon, "slideDownPortrait", this, "animationComplete"); -} - - -/*! - Creates all widget primitives. - */ -void SnsrSwipeWidget::createPrimitives() -{ - if (!mSlideLabel) { - mSlideLabel = new HbLabel(this); - mSlideLabel->setPlainText(hbTrId("txt_screensaver_swipe")); - mSlideLabel->setAlignment(Qt::AlignCenter); - mSlideLabel->setPreferredHeight(50.0); - mSlideLabel->setPreferredWidth(224.0); - HbStyle::setItemName(mSlideLabel, QLatin1String("slideLabel")); - } - if (!mSlideIcon) { - mSlideIcon = new HbLabel(QLatin1String("slider"), this); - mSlideIcon->setIcon(HbIcon(":/slider")); - mSlideIcon->setAspectRatioMode(Qt::KeepAspectRatioByExpanding); - mSlideIcon->setAlignment(Qt::AlignCenter); - mSlideIcon->setPreferredHeight(50.0); - mSlideIcon->setPreferredWidth(100.0); - HbStyle::setItemName(mSlideIcon, QLatin1String("slideIcon")); - } -} - -/*! - \reimp - */ - -void SnsrSwipeWidget::gestureEvent(QGestureEvent *event) -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrSwipeWidget::gestureEvent") - - QGesture *gesture = event->gesture(Qt::SwipeGesture); - QSwipeGesture *swipe = static_cast(gesture); - - if ( swipe && swipe->state() == Qt::GestureStarted ) { - start(); - event->accept(Qt::SwipeGesture); - } - else if ( swipe && swipe->state() == Qt::GestureFinished ) { - // TODO: Remove following, currently shows some debug data on screen - mSlideLabel->setPlainText( QString("angle=%1, horD=%2, verD=%3 ") - .arg(swipe->swipeAngle()) - .arg(swipe->horizontalDirection()) - .arg(swipe->verticalDirection()) ); - - // unclock with downward swipe - qreal swipeAngle = swipe->swipeAngle(); - if ( abs(swipeAngle - gSwipeDownAngle) < gSwipeAngleTolerance ) { - - emit swipeDownDetected(); - event->accept(Qt::SwipeGesture); - } - } - else { event->ignore(Qt::SwipeGesture); } - - SCREENSAVER_TEST_FUNC_EXIT("SnsrSwipeWidget::gestureEvent") -} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsranalogclockcontainer.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsranalogclockcontainer.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2009-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: Container for analog clock. -* -*/ - -#include "snsranalogclockcontainer.h" - -#include -#include -#include - -#include -#include - -#include "snsranalogclockwidget.h" -#include "snsrindicatorwidget.h" -#include "snsrswipewidget.h" -#include "snsrlabel.h" - -/*! - \class SnsrAnalogClockContainer - \ingroup group_snsrbigclockscreensaverplugin - \brief Container used for preparing layout for analog clock. - */ - -const char *gAnalogLayoutDocml = ":/xml/snsrbigclockscreensaveranalog.docml"; - -const char *gPortraitSectionName = "portrait"; -const char *gLandscapeSectionName = "landscape"; - -const char *gMainViewName = "view"; -const char *gMainContainerName = "mainContainer"; -const char *gClockContainerName = "clockContainer"; - -const char *gDateLabelName = "dateLabel"; -const char *gAnalogClockWidgetName = "analogClockWidget"; -const char *gIndicatorWidgetName = "indicatorWidget"; - -const char *gSwipeWidgetName = "swipeWidget"; - -const char *gDateFormatVerticalStr = r_qtn_date_usual_with_zero; //"%E%,% %*D%*N%/0%4%/1%5"; -const char *gDateFormatHorizontalStr = r_qtn_date_usual_with_zero; //"%E%,% %*D%N%/0%4%/1%5"; - - -/*! - Constructs a new SnsrAnalogClockContainer. - */ -SnsrAnalogClockContainer::SnsrAnalogClockContainer() : - SnsrBigClockContainer(), - mDateLabel(0), - mAnalogClockWidget(0)/*, - mSwipeWidget(0)*/ -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrAnalogClockContainer::SnsrAnalogClockContainer") - SCREENSAVER_TEST_FUNC_EXIT("SnsrAnalogClockContainer::SnsrAnalogClockContainer") -} - -/*! - Destructs the class. - */ -SnsrAnalogClockContainer::~SnsrAnalogClockContainer() -{ - resetIndicatorConnections(); - //mDateLabel, mAnalogClockWidget - deleted by the parent -} - -/*! - Updates displayed time and date. - */ -void SnsrAnalogClockContainer::update() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrAnalogClockContainer::update") - - // time - mAnalogClockWidget->tick(); - - // date - const char *dateFormat = (mCurrentOrientation == Qt::Vertical) ? - gDateFormatVerticalStr : gDateFormatHorizontalStr; - QString dateText = HbExtendedLocale().format( QDate::currentDate(), dateFormat ); - mDateLabel->setPlainText( dateText ); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrAnalogClockContainer::update") -} - -/*! - @copydoc SnsrBigClockContainer::updateIntervalInMilliseconds() - */ -int SnsrAnalogClockContainer::updateIntervalInMilliseconds() -{ - return 1000; -} - -/*! - @copydoc SnsrBigClockContainer::loadWidgets() - */ -void SnsrAnalogClockContainer::loadWidgets() -{ - bool ok(true); - - // reset widget pointers, any previous widgets are already deleted by now - mMainView = 0; - mDateLabel = 0; - mAnalogClockWidget = 0; - mIndicatorWidget = 0; - - // load widgets from docml - qDebug() << gAnalogLayoutDocml; - mDocumentObjects = mDocumentLoader.load(gAnalogLayoutDocml, &ok); - Q_ASSERT_X(ok, gAnalogLayoutDocml, "Invalid DocML file."); - if (ok) { - mMainView = mDocumentLoader.findWidget(gMainViewName); - mDateLabel = qobject_cast( - mDocumentLoader.findWidget(gDateLabelName)); - mAnalogClockWidget = qobject_cast( - mDocumentLoader.findWidget(gAnalogClockWidgetName)); - mIndicatorWidget = qobject_cast( - mDocumentLoader.findWidget(gIndicatorWidgetName)); - //We don't implement swipe widget at this poin - /*mSwipeWidget = qobject_cast( - mDocumentLoader.findWidget(gSwipeWidgetName));*/ - - Q_ASSERT_X( - mMainView && mDateLabel && mAnalogClockWidget && - mIndicatorWidget /*&& mSwipeWidget*/, - gAnalogLayoutDocml, "Objects not found in DocML file." - ); - - // In case of landscape layout, read also the landscape delta section - if ( mCurrentOrientation == Qt::Horizontal ) { - qDebug() << "loading: " << gAnalogLayoutDocml << ", section: " << gLandscapeSectionName; - mDocumentLoader.load(gAnalogLayoutDocml, gLandscapeSectionName, &ok); - Q_ASSERT_X(ok, gAnalogLayoutDocml, "Invalid section in DocML file."); - } - - mIndicatorWidget->setLayoutType(SnsrIndicatorWidget::IndicatorsCentered); - mIndicatorWidget->setPowerSaveModeColor(false); - initIndicatorWidget(); - - mBackgroundContainerLayout->addItem(mMainView); - - //connect( mSwipeWidget, SIGNAL(swipeDownDetected()), SIGNAL(unlockRequested()) ); - //mSwipeWidget->start(); - } -} - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrbigclockcontainer.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrbigclockcontainer.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +0,0 @@ -/* -* Copyright (c) 2009-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: Base class container. -* -*/ - -#include "snsrbigclockcontainer.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include "snsrbigclockcontainer.h" -#include "snsrindicatorwidget.h" -#include "snsrindicatormodel.h" - -/*! - \class SnsrBigClockContainer - \ingroup group_snsrbigclockscreensaverplugin - \brief Base class. Container used for drawing background and for preparing layout. - */ - - - -const int gStep(5); - - -/*! - Constructs a new SnsrBigClockContainer. - */ -SnsrBigClockContainer::SnsrBigClockContainer() : - mBackgroundContainerLayout(0), - mMainView(0), - mMainContainer(0), - mIndicatorModel(0), - mIndicatorWidget(0), - mCurrentOrientation(-1) -{ - setBackgroundColor(); - mBackgroundContainerLayout = new QGraphicsLinearLayout(Qt::Vertical, this); - setLayout(mBackgroundContainerLayout); - qsrand(QTime::currentTime().msec()); -} - -/*! - Destructs the class. - */ -SnsrBigClockContainer::~SnsrBigClockContainer() -{ - // e.g. mIndicatorWidget gets deleted during these calls - mDocumentLoader.reset(); - qDeleteAll(mDocumentObjects); - mDocumentObjects.clear(); - - //mMainContainer,mBackgroundContainerLayout - deleted by the parent - mIndicatorModel=0; // not owned -} - -/*! - \fn virtual void update() = 0; - - Slot for members update in container e.g. when time or date changed. - */ - -/*! - Changes screensaver layout based on orientation changes. - \param orientation Current orientation. - */ -void SnsrBigClockContainer::changeLayout(Qt::Orientation orientation) -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockContainer::changeLayout") - - if (mCurrentOrientation != orientation) { - mCurrentOrientation = orientation; - - // delete any old widgets - if ( mBackgroundContainerLayout->count() ) { - mBackgroundContainerLayout->removeAt(0); - } - mDocumentLoader.reset(); - qDeleteAll(mDocumentObjects); - mDocumentObjects.clear(); - - // reload widgets from docml - loadWidgets(); - } - mBackgroundContainerLayout->setGeometry( mainWindow()->layoutRect() ); - update(); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockContainer::changeLayout") -} - -/*! - Set used indicator model that is owned by the screensaver class. - Model's life cycle must be the same as screensaver's so that indicators' - status data can be kept in memory and one can receive updates. - This method should be called when the current container is set. - */ -void SnsrBigClockContainer::setIndicatorModel(SnsrIndicatorModel &model) -{ - mIndicatorModel = &model; -} - -/*! - @copydoc Screensaver::currentPowerMode() - */ -Screensaver::ScreenPowerMode SnsrBigClockContainer::displayPowerMode() -{ - // The default implementation returns full power mode. Inherited classes - // must override this if low power or display off mode are required. - return Screensaver::ScreenModeFullPower; -} - -/*! - @copydoc Screensaver::getActiveScreenRows() - */ -void SnsrBigClockContainer::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) -{ - // This default implementation return the whole area of the - // container. Inherited low power mode containers can and should - // return smaller area which just barely encloses all the content. - if ( mMainContainer ) { - QRect mainRect = mMainContainer->rect().toRect(); - if ( mCurrentOrientation == Qt::Vertical ) { - *firstActiveRow = mainRect.top(); - *lastActiveRow = mainRect.bottom(); - } - else { - *firstActiveRow = mainRect.left(); - *lastActiveRow = mainRect.right(); - } - } -} - -/*! - Tell if this container wants to lock the screen orientation. - Default implementation in not locked but inherited classes may - override this. - */ -bool SnsrBigClockContainer::isOrientationLocked() -{ - return false; -} - -/*! - \fn virtual int updateIntervalInMilliseconds() = 0; - - Concrete inherited container classes must implement this to return - the desired update interval for that clock mode. - */ - -/*! - \fn virtual int loadWidgets() = 0; - - Concrete inherited container classes must implement this to instantiate - all the widgets shown in the container. The base class calls this - method when screen layuot is changed. The old widgets are already - deleted by the base class before this is called. Also changing the visible - container is treated as a layout change, and results in call to this method. - Thus, inherited containers don't have to load their widgets yet in their - constructors. - */ - -/*! - \reimp - */ -void SnsrBigClockContainer::changeEvent(QEvent *event) -{ - if (event->type() == HbEvent::ThemeChanged) { - setBackgroundColor(); - } - return QGraphicsWidget::changeEvent(event); -} - -/*! - Returns random point for given range. - \param rect Area within which the generated point will be. - */ -QPointF SnsrBigClockContainer::randomPosition(const QRectF &rect) -{ - int width( rect.width() ); - int height( rect.height() ); - if ( width > 0 && height > 0 ) { - return rect.topLeft() + QPointF( qrand()%width, qrand()%height ); - } - else { - return QPointF(); - } - -} - -/*! - Returns new position between curRect position and destPos position. - \param curPos Current position. - \param destPos Destination position. When current position is near this - position or outside of the container, a new value is generated. - \param containerRect The container within which the destination position will always - be after a call. - */ -QPointF SnsrBigClockContainer::nextRandomPosition(const QPointF &curPos, QPointF &destPos, const QRectF &containerRect) -{ - const int delta(gStep+2); - const int minCntDimension(3*delta); - - // The random movement logic can work only if the container has enough space to move the - // clock around. If the container is too small, just return the middle point of the container. - if ( containerRect.width() < minCntDimension && containerRect.height() < minCntDimension ) { - return containerRect.center(); - } - - int xDistance = abs( destPos.x() - curPos.x() ); - int yDistance = abs( destPos.y() - curPos.y() ); - - // Generate new destination position when current widget position is close to - // destination random position or when current destination position is out of bounds. - // It is possible that the new random position is very close to the current position, - // in which case the random position is generated again. - // It is paramount that container is large enough when next loop is entered - // to prevent infinite looping. - while ( (xDistance < delta && yDistance < delta) - || !containerRect.contains(destPos) ) { - destPos = randomPosition( containerRect ); - xDistance = abs( destPos.x() - curPos.x() ); - yDistance = abs( destPos.y() - curPos.y() ); - } - - // If, for some reason, the current position is out-of-bounds, then there's no - // point to slowly move towards the destination. In that case, move immediately - // to destination point. - if ( !containerRect.contains(curPos) ) { - return destPos; - } - // Otherwise, this is normal case and we will calculate a point which is just - // a bit closer to the destination. - - // Version 1: - // o-----o---------------------------o - // p1 p2 p3 - // - // Version 2: - // o---------------------------o-----o - // p3 p2 p1 - // - // p1 - current widget position - // p2 - next position to compute - // p3 - destination random position - QPointF p1(curPos); - QPointF p2(0,0); - QPointF p3(destPos); - - // Computes point p2 - new position between p1 and p3 - - // Move the coordinate which is further away from the destination - // and calculate the other coordinate from that so that the - // result point p2 lies on the straigth line between p1 and p3. - if ( yDistance > xDistance ) { - if (p3.y() > p1.y()) { - p2.setY(p1.y()+gStep); - } - else { - p2.setY(p1.y()-gStep); - } - p2.setX((((p2.y()-p1.y())*(p3.x()-p1.x())) / (p3.y()-p1.y())) + p1.x()); // x2 = (((y2-y1)*(x3-x1)) / (y3-y1)) + x1 - } - else { - if (p3.x() > p1.x()) { - p2.setX(p1.x()+gStep); - } - else { - p2.setX(p1.x()-gStep); - } - p2.setY((((p3.y()-p1.y())*(p2.x()-p1.x())) / (p3.x()-p1.x())) + p1.y()); // y2 = (((y3-y1)*(x2-x1)) / (x3-x1)) + y1 - } - - // Return new position between points p1 and p3. - return p2; -} - -/*! - Do necessary initializations to show currently active indicators. - Should be called after the indicator widget is created. - */ -void SnsrBigClockContainer::initIndicatorWidget() -{ - Q_ASSERT(mIndicatorModel && mIndicatorWidget); - - connect(mIndicatorModel, SIGNAL(indicatorsUpdated(QList)), - mIndicatorWidget, SLOT(showIndicators(QList))); - - connect(mIndicatorModel, SIGNAL(allIndicatorsDeactivated()), - mIndicatorWidget, SLOT(removeAllIndicators())); - - mIndicatorModel->initializeIndicatorWidget(); -} - -/*! - Disconnect connections between indicator model and widget. - Should be called before deleting the indicator widget. - */ -void SnsrBigClockContainer::resetIndicatorConnections() -{ - if (mIndicatorWidget && mIndicatorModel) { - disconnect(mIndicatorModel, SIGNAL(indicatorsUpdated(QList)), - mIndicatorWidget, SLOT(showIndicators(QList))); - - disconnect(mIndicatorModel, SIGNAL(allIndicatorsDeactivated()), - mIndicatorWidget, SLOT(removeAllIndicators())); - } -} - -/*! - Set background color. - */ -void SnsrBigClockContainer::setBackgroundColor() -{ - mBackgroundColor = Qt::black; -} - -/*! - Paints the contents of an item in local coordinates. - */ -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT -void SnsrBigClockContainer::paint( - QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget - ) -{ - Q_UNUSED(option) - Q_UNUSED(widget) - - painter->fillRect(rect(), mBackgroundColor); -} -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaver.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaver.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Big clock Screensaver. -* -*/ - -#include "snsrbigclockscreensaver.h" - -#ifdef Q_OS_SYMBIAN -#include -#endif // Q_OS_SYMBIAN - -#include -#include -#include -#include -#include -#include - -#include -#include "snsranalogclockcontainer.h" -#include "snsrdigitalclockcontainer.h" -#include "snsroledanalogclockcontainer.h" -#include "snsroleddigitalclockcontainer.h" -#include "snsrblankcontainer.h" -#include "snsrindicatormodel.h" - -/*! - \class SnsrBigClockScreensaver - \ingroup group_snsrbigclockscreensaverplugin - \brief Screensaver with big digital clock. - */ - -/*! - Constructs a new SnsrBigClockScreensaver. - */ -SnsrBigClockScreensaver::SnsrBigClockScreensaver() : - mMainWindow(0), - mCurrentContainer(0), - mIndicatorModel(0), - m_setManager(0) -{ - mMainWindow = HbInstance::instance()->allMainWindows().at(0); - // for nice looking clock hand transformations - mMainWindow->setRenderHint(QPainter::SmoothPixmapTransform); - - // This model holds indicator status information and must exist as - // long as screensaver does. - mIndicatorModel = new SnsrIndicatorModel(this); -} - -/*! - Destructs the class. - */ -SnsrBigClockScreensaver::~SnsrBigClockScreensaver() -{ - mMainWindow->unsetOrientation( /*animate*/false ); - // mCurrentContainer, mIndicatorModel - deleted by the parent -} - -/*! - @copydoc Screensaver::onInitialize() -*/ -bool SnsrBigClockScreensaver::onInitialize() -{ - qDebug() << "SnsrBigClockScreensaver::onInitialize()"; - return true; -} - -/*! - @copydoc Screensaver::onForeground() - */ -bool SnsrBigClockScreensaver::onForeground() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onForeground") - qDebug() << "SnsrBigClockScreensaver::onForeground()"; - - removeCurrentContainer(); - - SnsrBigClockContainer* newContainer( 0 ); - if (clockFormat() == ClockFormatAnalog) { - newContainer = new SnsrAnalogClockContainer(); - } - else { - newContainer = new SnsrDigitalClockContainer(); - } - - setCurrentContainer( newContainer ); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onForeground") - return true; -} - -/*! - @copydoc Screensaver::onPartialForeground() - */ -bool SnsrBigClockScreensaver::onPartialForeground() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onPartialForeground") - qDebug() << "SnsrBigClockScreensaver::onPartialForeground()"; - - removeCurrentContainer(); - - SnsrBigClockContainer* newContainer( 0 ); - - // Check ScreensaverStatus from repository - XQSettingsManager::Error error; - int screensaverOn = 1; - XQCentralRepositorySettingsKey settingsKey( - KCRUidScreensaverSettings.iUid, KScreensaverStatus ); // TUid as same repository used in control panel via Symbian APIs - m_setManager = new XQSettingsManager(this); - if (m_setManager) { - screensaverOn = m_setManager->readItemValue(settingsKey, XQSettingsManager::TypeInt).toInt(); - error = m_setManager->error(); - if (error != XQSettingsManager::NoError) { - qDebug("Error reading value from XQSettingsManager.. error = %d", error); - } - delete m_setManager; - } - - if (screensaverOn) { - if (clockFormat() == ClockFormatAnalog) { - newContainer = new SnsrOledAnalogClockContainer(); - } - else { - newContainer = new SnsrOledDigitalClockContainer(); - } - } - else { - newContainer = new SnsrBlankContainer(); - } - - setCurrentContainer( newContainer ); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onPartialForeground") - return true; -} - -/*! - @copydoc Screensaver::onBackground() - */ -bool SnsrBigClockScreensaver::onBackground() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onBackground") - qDebug() << "SnsrBigClockScreensaver::onBackground()"; - - removeCurrentContainer(); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onBackground") - return true; -} - -/*! - @copydoc Screensaver::onPowerSave() - */ -bool SnsrBigClockScreensaver::onPowerSave() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onPowerSave") - qDebug() << "SnsrBigClockScreensaver::onPowerSave()"; - - SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onPowerSave") - return false; -} - -/*! - @copydoc Screensaver::onClose() - */ -bool SnsrBigClockScreensaver::onClose() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onClose") - qDebug() << "SnsrBigClockScreensaver::onClose()"; - - bool ret(false); - if (onBackground()) { - delete mCurrentContainer; - mCurrentContainer = 0; - ret = true; - } - - SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onClose") - return ret; -} - -/*! - @copydoc Screensaver::onHandleActiveIndicators - */ -void SnsrBigClockScreensaver::onHandleActiveIndicators( - const QList &activeIndicators) -{ - mIndicatorModel->handleActiveIndicators(activeIndicators); -} - -/*! - @copydoc Screensaver::onHandleActivatedIndicator - */ -void SnsrBigClockScreensaver::onHandleActivatedIndicator( - HbIndicatorInterface *activatedIndicator) -{ - mIndicatorModel->handleActivatedIndicator(activatedIndicator); -} - -/*! - @copydoc Screensaver::onHandleDeactivatedIndicator - */ -void SnsrBigClockScreensaver::onHandleDeactivatedIndicator( - HbIndicatorInterface *deactivatedIndicator) -{ - mIndicatorModel->handleDeactivatedIndicator(deactivatedIndicator); -} - -/*! - @copydoc Screensaver::currentPowerMode - */ -Screensaver::ScreenPowerMode SnsrBigClockScreensaver::currentPowerMode() -{ - Screensaver::ScreenPowerMode mode( Screensaver::ScreenModeFullPower ); - if ( mCurrentContainer ) { - mode = mCurrentContainer->displayPowerMode(); - } - else { - qWarning() << "No current container when current power mode queried."; - } - return mode; -} - -/*! - @copydoc Screensaver::getActiveScreenRows - */ -void SnsrBigClockScreensaver::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) -{ - if ( mCurrentContainer ) { - mCurrentContainer->getActiveScreenRows( firstActiveRow, lastActiveRow ); - } - else { - qWarning() << "No current container when active rows queried."; - } -} - -/*! - @copydoc Screensaver::updateLayout - */ -void SnsrBigClockScreensaver::updateLayout() -{ - if ( mCurrentContainer ) { - if ( mCurrentContainer->isOrientationLocked() ) { - mMainWindow->setOrientation( mMainWindow->orientation(), /*animate*/false ); - } - else { - mMainWindow->unsetOrientation( /*animate*/false ); - } - mCurrentContainer->changeLayout( mMainWindow->orientation() ); - } - else { - qWarning() << "No current container when updateLayout called."; - } -} - -/*! - Update clock time when timer is triggered - */ -void SnsrBigClockScreensaver::updateTime() -{ - if ( mCurrentContainer ) { - mCurrentContainer->update(); - - // Move the active area of display device if current container uses the power save mode. - if ( mCurrentContainer->displayPowerMode() == Screensaver::ScreenModeLowPower ) { - emit activeAreaMoved(); - } - } -} - -/*! - Determines the curent clock format settings. - \retval ClockFormat. - */ -SnsrBigClockScreensaver::ClockFormat SnsrBigClockScreensaver::clockFormat() -{ -#ifdef Q_OS_SYMBIAN - if (TLocale().ClockFormat() == EClockAnalog) { - return ClockFormatAnalog; - } else { - return ClockFormatDigital; - } -#else - // windows build - change the format every 30 seconds for testing purposes - if (QTime::currentTime().second() < 30) { - return ClockFormatAnalog; - } else { - return ClockFormatDigital; - } -#endif // Q_OS_SYMBIAN -} - -void SnsrBigClockScreensaver::removeCurrentContainer() -{ - if ( mCurrentContainer ) { - disconnect( - &mTimer, SIGNAL(timeout()), - this, SLOT(updateTime()) - ); - disconnect( - mCurrentContainer, SIGNAL(unlockRequested()), - this, SIGNAL(unlockRequested()) ); - if (mTimer.timerId()!= -1) { - mTimer.stop(); - } - emit viewChanged(0); - - delete mCurrentContainer; - mCurrentContainer = 0; - } - - mMainWindow->unsetOrientation( /*animate*/false ); -} - -void SnsrBigClockScreensaver::setCurrentContainer( SnsrBigClockContainer* newContainer ) -{ - mCurrentContainer = newContainer; - mCurrentContainer->setParent(this); - connect( &mTimer, SIGNAL(timeout()), SLOT(updateTime()) ); - connect( mCurrentContainer, SIGNAL(unlockRequested()), SIGNAL(unlockRequested()) ); - - mCurrentContainer->setIndicatorModel(*mIndicatorModel); - - int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); - // blankcontainer is empty one, don't start timer with -1 return value - if ( updateInterval != -1) { - mTimer.start(updateInterval); - } - - emit viewChanged(mCurrentContainer); -} - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaverplugin.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaverplugin.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Big clock Screensaver plugin. -* -*/ - -#include -#include -#include - -#include -#include -#include - -#include "snsrbigclockscreensaverplugin.h" -#include "snsrbigclockscreensaver.h" - -const char *gBigClockInterfaceName = "com.nokia.screensaver.ISnsrBigClockScreensaver"; - -/*! - \class SnsrBigClockScreensaverPlugin - \ingroup group_snsrbigclockscreensaverplugin - \brief Screensaver big clock screensaver plugin collects ready-made screensaver clock. - */ - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT - -/*! - \reimp - */ -QObject *SnsrBigClockScreensaverPlugin::createInstance( - const QServiceInterfaceDescriptor &descriptor, - QServiceContext *context, - QAbstractSecuritySession *session) -{ - Q_UNUSED(context); - Q_UNUSED(session); - - if (descriptor.interfaceName() == QLatin1String(gBigClockInterfaceName)) { - LoadTranslator(); - return new SnsrBigClockScreensaver(); - } - return 0; -} - - -/*! - Loads a translator. - */ -void SnsrBigClockScreensaverPlugin::LoadTranslator() -{ - QString locale = QLocale::system().name(); - QString filename = QString("snsrbigclockscreensaverplugin_%1").arg(locale); - QTranslator *translator = new QTranslator(this); -#ifdef Q_OS_SYMBIAN - bool loaded(false); - // TRAP is must here, otherwise it crashes - TRAP_IGNORE( - loaded = translator->load(filename, - QString("z:/resource/qt/translations")); - if (!loaded) { - loaded = translator->load(filename, - QString("c:/resource/qt/translations")); - } - ); -#else - translator->load(filename, QString("resource/qt/translations") ); -#endif //Q_OS_SYMBIAN - - qApp->installTranslator(translator); -} - -Q_EXPORT_PLUGIN2(snsrbigclockscreensaverplugin, SnsrBigClockScreensaverPlugin) - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrblankcontainer.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrblankcontainer.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* 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: Container for blank screen. -* -*/ - -#include "snsrblankcontainer.h" - -/*! - \class SnsrBlankContainer - \ingroup group_snsrbigclockscreensaverplugin - \brief Container used for preparing layout for blank screen. - */ - -/*! - Constructs a new SnsrBlankContainer. - */ -SnsrBlankContainer::SnsrBlankContainer() : - SnsrBigClockContainer() -{ -} - -/*! - Destructs the class. - */ -SnsrBlankContainer::~SnsrBlankContainer() -{ -} - -/*! - @copydoc SnsrBigClockContainer::update() - */ -void SnsrBlankContainer::update() -{ - // nothing to do -} - -/*! - @copydoc SnsrBigClockContainer::displayPowerMode() - */ -Screensaver::ScreenPowerMode SnsrBlankContainer::displayPowerMode() -{ - return Screensaver::ScreenModeOff; -} - -/*! - @copydoc SnsrBigClockContainer::updateIntervalInMilliseconds() - */ -int SnsrBlankContainer::updateIntervalInMilliseconds() -{ - // don't start timer - return -1; -} - -/*! - @copydoc SnsrBigClockContainer::loadWidgets() - */ -void SnsrBlankContainer::loadWidgets() -{ - // nothing to do as we have no visual components -} - -// end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdigitalclockcontainer.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdigitalclockcontainer.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* Copyright (c) 2009-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: Container for digital clock. -* -*/ - -#include "snsrdigitalclockcontainer.h" - -#include -#include -#include - -#include -#include - -#include "snsrswipewidget.h" -#include "snsrindicatorwidget.h" -#include "snsrlabel.h" - -/*! - \class SnsrDigitalClockContainer - \ingroup group_snsrbigclockscreensaverplugin - \brief Container used for preparing layout for digital clock. - */ - -const char *gDigitalLayoutDocml = ":/xml/snsrbigclockscreensaverdigital.docml"; -extern const char *gPortraitSectionName; -extern const char *gLandscapeSectionName; - -extern const char *gMainViewName; - -const char *gTimeLabelName = "timeLabel"; -const char *gAmPmLabelName = "amPmLabel"; -extern const char *gDateLabelName; - -extern const char *gDateFormatVerticalStr; -extern const char *gDateFormatHorizontalStr; - -// This is same as r_qtn_time_usual_with_zero defined in -// hbi18ndef.h expect am/pm place holders are removed. -const char *gTimeFormatStr = "%:0%J%:1%T%:3"; -const char *gAmPmFormatStr = "%B"; - -extern const char *gIndicatorWidgetName; -extern const char *gSwipeWidgetName; - - -/*! - Constructs a new SnsrDigitalClockContainer. - */ -SnsrDigitalClockContainer::SnsrDigitalClockContainer() : - SnsrBigClockContainer(), - mTimeLabel(0), - mAmPmLabel(0), - mDateLabel(0)/*, - mSwipeWidget(0)*/ -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrDigitalClockContainer::SnsrDigitalClockContainer") - SCREENSAVER_TEST_FUNC_EXIT("SnsrDigitalClockContainer::SnsrDigitalClockContainer") -} - -/*! - Destructs the class. - */ -SnsrDigitalClockContainer::~SnsrDigitalClockContainer() -{ - resetIndicatorConnections(); - //mTimeLabel, mAmPmLabel, mDateLabel - deleted by the parent -} - -/*! - Updates displayed time and date. - */ -void SnsrDigitalClockContainer::update() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrDigitalClockContainer::update") - - // time - // Even though the format string (hh:mm) contain the leading zero, it's - // removed always when clock type is 12h -> h:mm. - - // TODO: within this method call, you find a comment in code that - // it's intentional to remove leading zero always with 12h type clock. - // However it seems to be recommended to use hbExtendedLocale to get - // proper time formatting for all locales and settings.. - mTimeLabel->setPlainText( - HbExtendedLocale().format(QTime::currentTime(), gTimeFormatStr) - ); - - // if clock type is 24h, this will return an empty string. - mAmPmLabel->setPlainText( - HbExtendedLocale().format(QTime::currentTime(), gAmPmFormatStr) - ); - - // date - const char *dateFormat = (mCurrentOrientation == Qt::Vertical) ? - gDateFormatVerticalStr : gDateFormatHorizontalStr; - QString dateText = HbExtendedLocale().format( QDate::currentDate(), dateFormat ); - mDateLabel->setPlainText( dateText ); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrDigitalClockContainer::update") -} - -/*! - @copydoc SnsrBigClockContainer::updateIntervalInMilliseconds() - */ -int SnsrDigitalClockContainer::updateIntervalInMilliseconds() -{ - return 1000; -} - -/*! - @copydoc SnsrBigClockContainer::loadWidgets() - */ -void SnsrDigitalClockContainer::loadWidgets() -{ - // reset widget pointers, any previous widgets are already deleted by now - mMainView = 0; - mDateLabel = 0; - mTimeLabel = 0; - mAmPmLabel = 0; - mIndicatorWidget = 0; - - // load widgets from docml - bool ok(false); - qDebug() << gDigitalLayoutDocml; - mDocumentObjects = mDocumentLoader.load(gDigitalLayoutDocml, &ok); - Q_ASSERT_X(ok, gDigitalLayoutDocml, "Invalid DocML file."); - - if (ok) { - mMainView = mDocumentLoader.findWidget(gMainViewName); - mDateLabel = qobject_cast( - mDocumentLoader.findWidget(gDateLabelName)); - mTimeLabel = qobject_cast( - mDocumentLoader.findWidget(gTimeLabelName)); - mAmPmLabel = qobject_cast( - mDocumentLoader.findWidget(gAmPmLabelName)); - mIndicatorWidget = qobject_cast( - mDocumentLoader.findWidget(gIndicatorWidgetName)); - // implement swipewidget later on - /*mSwipeWidget = qobject_cast( - mDocumentLoader.findWidget(gSwipeWidgetName));*/ - - Q_ASSERT_X( - mMainView && mDateLabel && mTimeLabel && mAmPmLabel && - mIndicatorWidget /*&& mSwipeWidget*/, - gDigitalLayoutDocml, "Objects not found in DocML file." - ); - - // In case of landscape layout, read also the landscape delta section - if ( mCurrentOrientation == Qt::Horizontal ) { - qDebug() << "loading: " << gDigitalLayoutDocml << ", section: " << gLandscapeSectionName; - mDocumentLoader.load(gDigitalLayoutDocml, gLandscapeSectionName, &ok); - Q_ASSERT_X(ok, gDigitalLayoutDocml, "Invalid section in DocML file."); - } - - mIndicatorWidget->setLayoutType(SnsrIndicatorWidget::IndicatorsCentered); - mIndicatorWidget->setPowerSaveModeColor(false); - initIndicatorWidget(); - - mBackgroundContainerLayout->addItem(mMainView); - - //connect( mSwipeWidget, SIGNAL(swipeDownDetected()), SIGNAL(unlockRequested()) ); - //mSwipeWidget->start(); - } -} - diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 2009-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: Screensaver custom document loader. -* -*/ - -#include "snsrdocumentloader.h" - -#include "snsranalogclockwidget.h" -#include "snsroledclockwidget.h" -#include "snsrlabel.h" -#include "snsrindicatorwidget.h" -#include "snsroledtimelabel.h" -#include "snsrswipewidget.h" - -/*! - \class SnsrDocumentLoader - \ingroup group_snsrbigclockscreensaverplugin - \brief Custom screensaver docml layout loader. - - Used to create the widgets from docml. - */ - -/*! - Creates the requested widget. - \param type Static type name. - \param name Object name. - \retval Created object. - */ -QObject *SnsrDocumentLoader::createObject(const QString &type, const QString &name) -{ - if (type == SnsrAnalogClockWidget::staticMetaObject.className()) { - QObject *object = new SnsrAnalogClockWidget(); - object->setObjectName(name); - return object; - } - - if (type == SnsrOledClockWidget::staticMetaObject.className()) { - QObject *object = new SnsrOledClockWidget(); - object->setObjectName(name); - return object; - } - - if (type == SnsrLabel::staticMetaObject.className()) { - QObject *object = new SnsrLabel(); - object->setObjectName(name); - return object; - } - - if (type == SnsrIndicatorWidget::staticMetaObject.className()) { - QObject *object = new SnsrIndicatorWidget(); - object->setObjectName(name); - return object; - } - - if (type == SnsrOledTimeLabel::staticMetaObject.className()) { - QObject *object = new SnsrOledTimeLabel(); - object->setObjectName(name); - return object; - } - - /* Add swipeWidget implementation later on - - if (type == SnsrSwipeWidget::staticMetaObject.className()) { - QObject *object = new SnsrSwipeWidget(); - object->setObjectName(name); - return object; - }*/ - - return HbDocumentLoader::createObject(type, name); -} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsroledanalogclockcontainer.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsroledanalogclockcontainer.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Container for oled analog clock. -* -*/ - -#include "snsroledanalogclockcontainer.h" - -#include -#include -#include -#include -#include -#include - -#include "snsroledclockwidget.h" -#include "snsrindicatorwidget.h" -#include "snsrlabel.h" - -/*! - \class SnsrOledAnalogClockContainer - \ingroup group_snsrbigclockscreensaverplugin - \brief Container used for preparing layout for oled analog clock. - */ - -const char *gOledAnalogLayoutDocml = ":/xml/snsrbigclockscreensaveroledanalog.docml"; -extern const char *gPortraitSectionName; -extern const char *gLandscapeSectionName; - -extern const char *gMainViewName; -extern const char *gMainContainerName; -extern const char *gClockContainerName; -extern const char *gIndicatorWidgetName; - -extern const char *gDateLabelName; -extern const char *gDateFormatVerticalStr; -extern const char *gDateFormatHorizontalStr; - -const char *gOledAnalogClockWidgetName = "oledAnalogClockWidget"; - - -/*! - Constructs a new SnsrOledAnalogClockContainer. - */ -SnsrOledAnalogClockContainer::SnsrOledAnalogClockContainer() : - SnsrBigClockContainer(), mClockContainer(0), mOledClockWidget(0), - mDateLabel(0), mDestPosition(QPointF()), mInitialize(false) -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledAnalogClockContainer::SnsrOledAnalogClockContainer") - SCREENSAVER_TEST_FUNC_EXIT("SnsrOledAnalogClockContainer::SnsrOledAnalogClockContainer") -} - -/*! - Destructs the class. - */ -SnsrOledAnalogClockContainer::~SnsrOledAnalogClockContainer() -{ - resetIndicatorConnections(); - //mOledClockWidget etc - deleted by the parent -} - -/*! - Updates OLED analog clock widget position. - */ -void SnsrOledAnalogClockContainer::updatePosition() -{ - QSizeF containerSize = mMainContainer->size(); - - // Container must have a valid size to enable calculating the - // destination position for the clock. - if ( containerSize.width() > 0 && containerSize.height() > 0 ) { - containerSize -= mClockContainer->size(); - QRectF containerRect( mMainContainer->pos(), containerSize ); - if ( mInitialize ) { - // disconnect container from parent layout, - // connected container resets its position to the one defined in docml - // after label text updates - mClockContainer->setParentLayoutItem(0); - - QPointF clockPos = nextRandomPosition( mClockContainer->pos(), mDestPosition, containerRect ); - mClockContainer->setPos( clockPos ); - } - else { - mDestPosition = randomPosition( containerRect ); - mInitialize = true; - } - } -} - -/*! - Updates displayed time. - */ -void SnsrOledAnalogClockContainer::update() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledAnalogClockContainer::update") - - // time - mOledClockWidget->tick(); - - // date - const char *dateFormat = (mCurrentOrientation == Qt::Vertical) ? - gDateFormatVerticalStr : gDateFormatHorizontalStr; - QString dateText = HbExtendedLocale().format( QDate::currentDate(), dateFormat ); - mDateLabel->setPlainText( dateText ); - - // position - updatePosition(); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrOledAnalogClockContainer::update") -} - -int SnsrOledAnalogClockContainer::updateIntervalInMilliseconds() -{ - return 60*1000; -} - -/*! - @copydoc Screensaver::DisplayPowerMode() - */ -Screensaver::ScreenPowerMode SnsrOledAnalogClockContainer::displayPowerMode() -{ - return Screensaver::ScreenModeLowPower; -} - -/*! - @copydoc SnsrBigClockContainer::getActiveScreenRows() - */ -void SnsrOledAnalogClockContainer::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) -{ - if ( mClockContainer ) { - QRect clockRect( mClockContainer->pos().toPoint(), - mClockContainer->size().toSize() ); - if ( mCurrentOrientation == Qt::Vertical ) { - *firstActiveRow = clockRect.top(); - *lastActiveRow = clockRect.bottom() + 1; - } - else { - *firstActiveRow = clockRect.left(); - *lastActiveRow = clockRect.right() + 1; - } - } -} - -/*! - Orientation is locked in power save mode as sensors are off anyway, - at least after some timeout. - */ -bool SnsrOledAnalogClockContainer::isOrientationLocked() -{ - return true; -} - -void SnsrOledAnalogClockContainer::loadWidgets() -{ - bool ok(true); - - // reset widget pointers, any previous widgets are already deleted by now - mMainView = 0; - mMainContainer = 0; - mClockContainer = 0; - mOledClockWidget = 0; - mDateLabel = 0; - mIndicatorWidget = 0; - mInitialize = false; - - // load widgets from docml - qDebug() << gOledAnalogLayoutDocml; - mDocumentObjects = mDocumentLoader.load(gOledAnalogLayoutDocml, &ok); - Q_ASSERT_X(ok, gOledAnalogLayoutDocml, "Invalid DocML file."); - if (ok) { - mMainView = mDocumentLoader.findWidget(gMainViewName); - mMainContainer = mDocumentLoader.findWidget(gMainContainerName); - mClockContainer = mDocumentLoader.findWidget(gClockContainerName); - mOledClockWidget = qobject_cast( - mDocumentLoader.findWidget(gOledAnalogClockWidgetName)); - mDateLabel = qobject_cast( - mDocumentLoader.findWidget(gDateLabelName)); - mIndicatorWidget = qobject_cast( - mDocumentLoader.findWidget(gIndicatorWidgetName)); - Q_ASSERT_X( - mMainView && mMainContainer && mClockContainer - && mOledClockWidget && mDateLabel && mIndicatorWidget, - gOledAnalogLayoutDocml, "Objects not found in DocML file." - ); - - // In case of landscape layout, read also the landscape delta section - if ( mCurrentOrientation == Qt::Horizontal ) { - qDebug() << "loading: " << gOledAnalogLayoutDocml << ", section: " << gLandscapeSectionName; - mDocumentLoader.load(gOledAnalogLayoutDocml, gLandscapeSectionName, &ok); - Q_ASSERT_X(ok, gOledAnalogLayoutDocml, "Invalid section in DocML file."); - } - - mIndicatorWidget->setLayoutType(SnsrIndicatorWidget::IndicatorsCentered); - mIndicatorWidget->setPowerSaveModeColor(true); - initIndicatorWidget(); - - // powersave mode color - mDateLabel->setTextColor(Qt::white); - - mBackgroundContainerLayout->addItem(mMainView); - } -} - -// end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsroleddigitalclockcontainer.cpp --- a/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsroleddigitalclockcontainer.cpp Mon Sep 27 11:52:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2009 - 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: Container for oled digital clock. -* -*/ - -#include "snsroleddigitalclockcontainer.h" - -#include -#include -#include -#include - - -#include -#include - -#include "snsrlabel.h" -#include "snsrindicatorwidget.h" -#include "snsroledtimelabel.h" - - -/*! - \class SnsrOledDigitalClockContainer - \ingroup group_snsrbigclockscreensaverplugin - \brief Container used for preparing layout for oled digital clock. - */ - -const char *gOledDigitalLayoutDocml = ":/xml/snsrbigclockscreensaveroleddigital.docml"; -extern const char *gPortraitSectionName; -extern const char *gLandscapeSectionName; - -extern const char *gMainViewName; -extern const char *gMainContainerName; -extern const char *gClockContainerName; - -extern const char *gOledTimeLabelName = "oledTimeLabel"; -extern const char *gAmPmLabelName; -extern const char *gDateLabelName; - -extern const char *gDateFormatVerticalStr; -extern const char *gDateFormatHorizontalStr; - -extern const char *gTimeFormatStr; -extern const char *gAmPmFormatStr; - -extern const char *gIndicatorWidgetName; - - - -/*! - Constructs a new SnsrOledDigitalClockContainer. - */ -SnsrOledDigitalClockContainer::SnsrOledDigitalClockContainer() : - SnsrBigClockContainer(), mClockContainer(0), mAmPmLabel(0), - mTimeLabel(0), mDateLabel(0), mDestPosition(QPointF()), - mInitialize(false) -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledDigitalClockContainer::SnsrOledDigitalClockContainer") - SCREENSAVER_TEST_FUNC_EXIT("SnsrOledDigitalClockContainer::SnsrOledDigitalClockContainer") -} - -/*! - Destructs the class. - */ -SnsrOledDigitalClockContainer::~SnsrOledDigitalClockContainer() -{ - resetIndicatorConnections(); - //mTimeLabel, mAmPmLabel, mDateLabel, mMoveTimer - deleted by the parent -} - -/*! - Updates OLED digital clock widget position. - */ -void SnsrOledDigitalClockContainer::updatePosition() -{ - QSizeF containerSize = mMainContainer->size(); - - // Container must have a valid size to enable calculating the - // destination position for the clock. - if ( containerSize.width() > 0 && containerSize.height() > 0 ) { - containerSize -= mClockContainer->boundingRect().size(); - QRectF containerRect( mMainContainer->pos(), containerSize ); - if ( mInitialize ) { - // disconnect container from parent layout, - // connected container resets its position to the one defined in docml - // after label text updates - mClockContainer->setParentLayoutItem(0); - - QPointF clockPos = nextRandomPosition( mClockContainer->pos(), mDestPosition, containerRect ); - mClockContainer->setPos( clockPos ); - } - else { - mDestPosition = randomPosition( containerRect ); - mInitialize = true; - } - } -} - -/*! - Updates displayed time and date. - */ -void SnsrOledDigitalClockContainer::update() -{ - SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledDigitalClockContainer::update") - - // time - mTimeLabel->setText( - HbExtendedLocale().format(QTime::currentTime(), gTimeFormatStr) - ); - - // if clock type is 24h, this will return an empty string. - mAmPmLabel->setPlainText( - HbExtendedLocale().format(QTime::currentTime(), gAmPmFormatStr) - ); - - // date - const char *dateFormat = (mCurrentOrientation == Qt::Vertical) ? - gDateFormatVerticalStr : gDateFormatHorizontalStr; - QString dateText = HbExtendedLocale().format( QDate::currentDate(), dateFormat ); - mDateLabel->setPlainText( dateText ); - - updatePosition(); - - SCREENSAVER_TEST_FUNC_EXIT("SnsrOledDigitalClockContainer::update") -} - -int SnsrOledDigitalClockContainer::updateIntervalInMilliseconds() -{ - return 60*1000; -} - -/*! - @copydoc Screensaver::DisplayPowerMode() - */ -Screensaver::ScreenPowerMode SnsrOledDigitalClockContainer::displayPowerMode() -{ - return Screensaver::ScreenModeLowPower; -} - -/*! - @copydoc SnsrBigClockContainer::getActiveScreenRows() - */ -void SnsrOledDigitalClockContainer::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) -{ - if ( mClockContainer ) { - QRect clockRect( mClockContainer->pos().toPoint(), - mClockContainer->size().toSize() ); - if ( mCurrentOrientation == Qt::Vertical ) { - *firstActiveRow = clockRect.top(); - *lastActiveRow = clockRect.bottom() + 1; - } - else { - *firstActiveRow = clockRect.left(); - *lastActiveRow = clockRect.right() + 1; - } - } -} - -/*! - Orientation is locked in power save mode as sensors are off anyway, - at least after some timeout. - */ -bool SnsrOledDigitalClockContainer::isOrientationLocked() -{ - return true; -} - -void SnsrOledDigitalClockContainer::loadWidgets() -{ - // reset widget pointers, any previous widgets are already deleted by now - mMainView = 0; - mMainContainer = 0; - mClockContainer = 0; - mDateLabel = 0; - mTimeLabel = 0; - mAmPmLabel = 0; - mIndicatorWidget = 0; - mInitialize = false; - - // load widgets from docml - bool ok(false); - qDebug() << gOledDigitalLayoutDocml; - mDocumentObjects = mDocumentLoader.load(gOledDigitalLayoutDocml, &ok); - Q_ASSERT_X(ok, gOledDigitalLayoutDocml, "Invalid DocML file."); - - if (ok) { - mMainView = mDocumentLoader.findWidget(gMainViewName); - mMainContainer = mDocumentLoader.findWidget(gMainContainerName); - mClockContainer = mDocumentLoader.findWidget(gClockContainerName); - mDateLabel = qobject_cast( - mDocumentLoader.findWidget(gDateLabelName)); - mTimeLabel = qobject_cast( - mDocumentLoader.findWidget(gOledTimeLabelName)); - mAmPmLabel = qobject_cast( - mDocumentLoader.findWidget(gAmPmLabelName)); - mIndicatorWidget = qobject_cast( - mDocumentLoader.findWidget(gIndicatorWidgetName)); - Q_ASSERT_X( - mMainView && mMainContainer && mClockContainer - && mDateLabel && mTimeLabel && mAmPmLabel - && mIndicatorWidget, - gOledDigitalLayoutDocml, "Objects not found in DocML file." - ); - - // In case of landscape layout, read also the landscape delta section - if ( mCurrentOrientation == Qt::Horizontal ) { - qDebug() << "loading: " << gOledDigitalLayoutDocml << ", section: " << gLandscapeSectionName; - mDocumentLoader.load(gOledDigitalLayoutDocml, gLandscapeSectionName, &ok); - Q_ASSERT_X(ok, gOledDigitalLayoutDocml, "Invalid section in DocML file."); - } - - mIndicatorWidget->setLayoutType(SnsrIndicatorWidget::IndicatorsCentered); - mIndicatorWidget->setPowerSaveModeColor(true); - initIndicatorWidget(); - - // powersave mode color - mDateLabel->setTextColor(Qt::white); - mAmPmLabel->setTextColor(Qt::white); - - mBackgroundContainerLayout->addItem(mMainView); - } -} - -// end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/sis/screensaverapp.pkg --- a/screensaver/sis/screensaverapp.pkg Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/sis/screensaverapp.pkg Wed Oct 06 16:06:24 2010 +0300 @@ -1,5 +1,5 @@ ; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; Copyright (c) 2009 - 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" @@ -30,17 +30,17 @@ [0x1028315F], 0, 0, 0, {"S60ProductID"} -// ---- devicedialogplugin -------------------------------------------- +; ---- devicedialogplugin -------------------------------------------- "/epoc32/release/armv5/urel/snsrdevicedialogplugin.dll" - "c:/sys/bin/snsrdevicedialogplugin.dll" -"/epoc32/data/z/resource/plugins/devicedialogs/snsrdevicedialogplugin.qtplugin" - "c:/resource/plugins/devicedialogs/snsrdevicedialogplugin.qtplugin +"/epoc32/data/z/resource/plugins/devicedialogs/snsrdevicedialogplugin.qtplugin" - "c:/resource/plugins/devicedialogs/snsrdevicedialogplugin.qtplugin" ; ---- screensaverplugins -------------------------------------------- ; -------- snsrbigclockscreensaverplugin "/epoc32/release/armv5/urel/snsrbigclockscreensaverplugin.dll" - "c:/sys/bin/snsrbigclockscreensaverplugin.dll" "/epoc32/data/z/resource/qt/translations/snsrbigclockscreensaverplugin.qm" - "c:/resource/qt/translations/snsrbigclockscreensaverplugin.qm" -"/epoc32/data/z/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.qtplugin" - "c:/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.qtplugin" -"/epoc32/data/z/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.xml" - "c:/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.xml" +"/epoc32/data/z/snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.qtplugin" - "c:/snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.qtplugin" +"/epoc32/data/z/snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.xml" - "c:/snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.xml" ; ---- snsrutils -------------------------------------------- diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrdisplaycontrol_s60/inc/snsrdisplaycontrolcommon.h --- a/screensaver/snsrdisplaycontrol_s60/inc/snsrdisplaycontrolcommon.h Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/snsrdisplaycontrol_s60/inc/snsrdisplaycontrolcommon.h Wed Oct 06 16:06:24 2010 +0300 @@ -20,6 +20,7 @@ #define SNSRDISPLAYCONTROLCOMMON_H #include +#include _LIT( KSnsrDispCtrlSrvName, "SnsrDisplayControlServer" ); @@ -35,4 +36,12 @@ const TInt KSnsrDispCtrlSrvVerMinor = 0; const TInt KSnsrDispCtrlSrvVerBuild = 0; +#if defined(_DEBUG) +#define RDEBUG( x ) RDebug::Printf( "%s %s (%u) %s", __FILE__, __PRETTY_FUNCTION__, __LINE__, x ); +#define RDEBUG1( x, y ) RDebug::Printf( "%s %s (%u) %s=%d", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else +#define RDEBUG( x ) +#define RDEBUG1( x, y ) +#endif + #endif /* SNSRDISPLAYCONTROLCOMMON_H */ diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrdisplaycontrol_s60/src/snsrdisplaycontrolsession.cpp --- a/screensaver/snsrdisplaycontrol_s60/src/snsrdisplaycontrolsession.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/snsrdisplaycontrol_s60/src/snsrdisplaycontrolsession.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -18,16 +18,11 @@ #include #include -#include -#include #include "snsrdisplaycontrolsession.h" #include "snsrdisplaycontrolcommon.h" -// ======== LOCAL FUNCTIONS ======== - - // ======== MEMBER FUNCTIONS ======== @@ -91,6 +86,8 @@ void CSnsrDisplayControlSession::ServiceL( const RMessage2& aMessage ) { TInt func = aMessage.Function(); + RDEBUG1( "func", func ) + TInt err( KErrNone ); @@ -98,38 +95,64 @@ { case ESnsrDispCtrlSrvDisplayOff: { + RDEBUG( "Switching display off" ) + // Disable touch - HAL::Set( HALData::EPenState, 0 ); + TInt err1 = HAL::Set( HALData::EPenState, 0 ); + RDEBUG1( "disable touch err", err1 ) - // Lights off - err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, 0); + // Display off + TInt err2 = HAL::Set( HALData::EDisplayState, 0 ); + RDEBUG1( "display off err", err2 ) + + err = err1 || err2; break; } case ESnsrDispCtrlSrvDisplayLowPower: { + RDEBUG( "Switching display to low power mode" ) + // Disable touch - HAL::Set( HALData::EPenState, 0 ); + TInt err1 = HAL::Set( HALData::EPenState, 0 ); + RDEBUG1( "disable touch err", err1 ) - // Set display mode + // Enable low power mode TInt startRow = aMessage.Int0(); TInt endRow = aMessage.Int1(); + RDEBUG1( "first active row", startRow ) + RDEBUG1( "last active row", endRow ) + // TODO: for now, we pass a zero-filled pixel buffer to power save API. // This works fine with our reference hardware but some types of displays // might require passing the actual screen contents in this buffer. TUint16* ptr = const_cast( iPowerSavePixelBuffer->Ptr() ); - err = iPowerSave->Set(startRow, endRow, ptr); + TInt err2 = iPowerSave->Set(startRow, endRow, ptr); + RDEBUG1( "enable low power err", err2 ) + + // Display on + TInt err3 = HAL::Set( HALData::EDisplayState, 1 ); + RDEBUG1( "display on err", err3 ); + + err = err1 || err2 || err3; break; } case ESnsrDispCtrlSrvDisplayFullPower: { + RDEBUG( "Switching display to full power mode" ) + // Enable touch - HAL::Set( HALData::EPenState, 1 ); + TInt err1 = HAL::Set( HALData::EPenState, 1 ); + RDEBUG1( "enable touch err", err1 ) - // Set display mode - err = iPowerSave->Exit(); + // Low power off + TInt err2 = iPowerSave->Exit(); + RDEBUG1( "disable low power err", err2 ); - // Lights on - err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, 30) || err; + // Display on + TInt err3 = HAL::Set( HALData::EDisplayState, 1 ); + RDEBUG1( "display on err", err3 ) + + err = err1 || err2 || err3; break; } default: diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsranalogclockcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsranalogclockcontainer.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009-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: Container for analog clock. +* +*/ + +#ifndef SNSRANALOGCLOCKCONTAINER_H +#define SNSRANALOGCLOCKCONTAINER_H + +#include "snsrbigclockcontainer.h" + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class SnsrLabel; +class SnsrAnalogClockWidget; +class SnsrSwipeWidget; + +class SnsrAnalogClockContainer : public SnsrBigClockContainer +{ + Q_OBJECT + +public: + + SnsrAnalogClockContainer(); + ~SnsrAnalogClockContainer(); + +public slots: + + virtual void update(); + +public: // from base classes + + virtual int updateIntervalInMilliseconds(); + +protected: // from base classes + + virtual void loadWidgets(); + void loadWidgets(const char* docmlName); + +private: // data + + SnsrLabel *mDateLabel; + SnsrAnalogClockWidget *mAnalogClockWidget; + SnsrSwipeWidget *mSwipeWidget; + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) +}; + +#endif // SNSRANALOGCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockcontainer.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2009 - 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: Base class container. +* +*/ + +#ifndef SNSRBIGCLOCKCONTAINER_H +#define SNSRBIGCLOCKCONTAINER_H + +#include + +#include "snsrtest_global.h" +#include "snsrdocumentloader.h" +#include "screensaver.h" + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class QGraphicsLinearLayout; +class HbIndicatorInterface; +class SnsrIndicatorModel; +class SnsrIndicatorWidget; + +class SnsrBigClockContainer : public HbWidget +{ + Q_OBJECT + +public: + + SnsrBigClockContainer(); + ~SnsrBigClockContainer(); + +public slots: + + virtual void update() = 0; + virtual void changeLayout(Qt::Orientation orientation); + +public: + + void setIndicatorModel(SnsrIndicatorModel &model); + virtual Screensaver::ScreenPowerMode displayPowerMode(); + virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); + virtual bool isOrientationLocked(); + virtual int updateIntervalInMilliseconds() = 0; + +protected: + + virtual void loadWidgets() = 0; + virtual void changeEvent(QEvent * event); + virtual bool swipeToUnlockSupported(); + QPointF randomPosition(const QRectF &rect); + QPointF nextRandomPosition(const QPointF &curPos, QPointF &destPos, const QRectF &containerRect); + void connectIndicatorWidgetToModel(); + void resetIndicatorConnections(); + +private: + + void resetWidgets(); + void setBackgroundColor(); + void paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget = 0 + ); + +private slots: + + void fadeOutView(); + +signals: + + void unlockRequested(); + void activeAreaMoved(); + +protected: + + SnsrDocumentLoader mDocumentLoader; + QObjectList mDocumentObjects; + + QGraphicsLinearLayout *mBackgroundContainerLayout; + QGraphicsWidget *mMainView; + QGraphicsWidget *mMainContainer; + + SnsrIndicatorModel *mIndicatorModel; // not owned + SnsrIndicatorWidget *mIndicatorWidget; + + int mCurrentOrientation; + +private: + + QColor mBackgroundColor; + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) +}; + +#endif // SNSRBIGCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaver.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2009 - 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: Big clock Screensaver. +* +*/ + +#ifndef SNSRBIGCLOCKSCREENSAVER_H +#define SNSRBIGCLOCKSCREENSAVER_H + +#include + +#include +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class HbMainWindow; +class SnsrBigClockContainer; +class SnsrIndicatorModel; + +class SnsrBigClockScreensaver : public Screensaver +{ + Q_OBJECT + +public: + + enum ClockFormat + { + ClockFormatUndefined, + ClockFormatAnalog, + ClockFormatDigital + }; + + SnsrBigClockScreensaver(); + ~SnsrBigClockScreensaver(); + +private: + + ClockFormat clockFormat(); + void removeCurrentContainer(); + void setCurrentContainer( SnsrBigClockContainer* newContainer ); + + virtual bool onInitialize(); + virtual bool onForeground(); + virtual bool onPartialForeground(); + virtual bool onBackground(); + virtual bool onPowerSave(); + virtual bool onClose(); + virtual void onHandleActiveIndicators(const QList &activeIndicators); + virtual void onHandleActivatedIndicator(HbIndicatorInterface *activatedIndicator); + virtual void onHandleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator); + virtual Screensaver::ScreenPowerMode currentPowerMode(); + virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); + virtual void updateLayout(); + +private slots: + + void updateTime(); + +private: + + QTimer mTimer; + HbMainWindow *mMainWindow; + SnsrBigClockContainer *mCurrentContainer; + SnsrIndicatorModel *mIndicatorModel; + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) + +}; + +#endif // SNSRBIGCLOCKSCREENSAVER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaverplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrbigclockscreensaverplugin.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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: Big clock Screensaver provider. +* +*/ + +#ifndef SNSRBIGCLOCKSCREENSAVERPLUGIN_H +#define SNSRBIGCLOCKSCREENSAVERPLUGIN_H + +#include +#include + +QTM_USE_NAMESPACE + +class SnsrBigClockScreensaverPlugin : public QObject, + public QServicePluginInterface +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QServicePluginInterface) + +public: + QObject *createInstance(const QServiceInterfaceDescriptor &descriptor, + QServiceContext *context, + QAbstractSecuritySession *session); + +private: + void LoadTranslator(); + +}; + +#endif // SNSRBIGCLOCKSCREENSAVERPLUGIN_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrblankcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrblankcontainer.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,52 @@ +/* +* 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: Container for blank screen. +* +*/ + +#ifndef SNSRBLANKCONTAINER_H +#define SNSRBLANKCONTAINER_H + +#include "snsrbigclockcontainer.h" + +//SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class SnsrBlankContainer : public SnsrBigClockContainer +{ + Q_OBJECT + +public: + + SnsrBlankContainer(); + ~SnsrBlankContainer(); + +public slots: + + virtual void update(); + +public: // from base classes + + virtual Screensaver::ScreenPowerMode displayPowerMode(); + virtual int updateIntervalInMilliseconds(); + +protected: // from base classes + + virtual void loadWidgets(); + +private: + +// SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) +}; + +#endif // SNSRBLANKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrdigitalclockcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrdigitalclockcontainer.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009-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: Container for digital clock. +* +*/ + +#ifndef SNSRDIGITALCLOCKCONTAINER_H +#define SNSRDIGITALCLOCKCONTAINER_H + +#include "snsrbigclockcontainer.h" + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class SnsrLabel; +class SnsrSwipeWidget; + +class SnsrDigitalClockContainer : public SnsrBigClockContainer +{ + Q_OBJECT + +public: + + SnsrDigitalClockContainer(); + ~SnsrDigitalClockContainer(); + +public slots: + + virtual void update(); + +public: // from base classes + + virtual int updateIntervalInMilliseconds(); + +protected: // from base classes + + virtual void loadWidgets(); + void loadWidgets(const char* docmlName); + +private: // data + + SnsrLabel *mTimeLabel; + SnsrLabel *mAmPmLabel; + SnsrLabel *mDateLabel; + SnsrSwipeWidget *mSwipeWidget; + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) +}; + +#endif // SNSRDIGITALCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrdocumentloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsrdocumentloader.h Wed Oct 06 16:06:24 2010 +0300 @@ -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: Screensaver custom document loader. +* +*/ + +#ifndef SNSRDOCUMENTLOADER_H +#define SNSRDOCUMENTLOADER_H + +#include + +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class SnsrDocumentLoader : public HbDocumentLoader +{ + +private: + + virtual QObject *createObject(const QString &type, const QString &name); + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) + +}; + +#endif // SNSRDOCUMENTLOADER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsroledanalogclockcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsroledanalogclockcontainer.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 - 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: Container for oled analog clock. +* +*/ + +#ifndef SNSROLEDANALOGCLOCKCONTAINER_H +#define SNSROLEDANALOGCLOCKCONTAINER_H + +#include "snsrbigclockcontainer.h" + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class SnsrOledClockWidget; +class SnsrLabel; + +class SnsrOledAnalogClockContainer : public SnsrBigClockContainer +{ + Q_OBJECT + +public: + + SnsrOledAnalogClockContainer(); + ~SnsrOledAnalogClockContainer(); + +public slots: + + virtual void update(); + void updatePosition(); + +public: // from base classes + + virtual int updateIntervalInMilliseconds(); + virtual Screensaver::ScreenPowerMode displayPowerMode(); + virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); + virtual bool isOrientationLocked(); + +protected: // from base classes + + virtual void loadWidgets(); + +private: + + QGraphicsWidget *mClockContainer; + + SnsrOledClockWidget *mOledClockWidget; + SnsrLabel *mDateLabel; + + QPointF mDestPosition; + bool mInitialize; + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) +}; + +#endif // SNSROLEDANALOGCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsroleddigitalclockcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/inc/snsroleddigitalclockcontainer.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2009 - 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: Container for oled digital clock. +* +*/ + +#ifndef SNSROLEDDIGITALCLOCKCONTAINER_H +#define SNSROLEDDIGITALCLOCKCONTAINER_H + +#include "snsrbigclockcontainer.h" + + +SCREENSAVER_TEST_CLASS(T_SnsrBigClockScreensaverPlugin) + +class SnsrLabel; +class SnsrOledTimeLabel; + +class SnsrOledDigitalClockContainer : public SnsrBigClockContainer +{ + Q_OBJECT + +public: + + SnsrOledDigitalClockContainer(); + ~SnsrOledDigitalClockContainer(); + +public slots: + + virtual void update(); + void updatePosition(); + +public: // from base classes + + virtual int updateIntervalInMilliseconds(); + virtual Screensaver::ScreenPowerMode displayPowerMode(); + virtual void getActiveScreenRows(int *firstActiveRow, int *lastActiveRow); + virtual bool isOrientationLocked(); + +protected: // from base classes + + virtual void loadWidgets(); + +private: + + QGraphicsWidget *mClockContainer; + + SnsrLabel *mAmPmLabel; + SnsrOledTimeLabel *mTimeLabel; + SnsrLabel *mDateLabel; + + QPointF mDestPosition; + bool mInitialize; + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrBigClockScreensaverPlugin) +}; + +#endif // SNSROLEDDIGITALCLOCKCONTAINER_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveranalog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveranalog.docml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + +
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveranalogswipe.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveranalogswipe.docml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + +
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverdigital.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverdigital.docml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + +
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverdigitalswipe.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverdigitalswipe.docml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + +
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroledanalog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroledanalog.docml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + +
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroleddigital.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaveroleddigital.docml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + +
diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.s60xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.s60xml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,12 @@ + + + snsrbigclockscreensaverplugin + z:/snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin.qtplugin + ScreenSaver Big Clock Plugin + + com.nokia.screensaver.ISnsrBigClockScreensaver + 1.0 + Default implementation for screensaver big clock + + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/resource/snsrbigclockscreensaverplugin.xml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,12 @@ + + + snsrbigclockscreensaverplugin + snsrresources/plugins/snsrplugins/snsrbigclockscreensaverplugin + ScreenSaver Big Clock Plugin + + com.nokia.screensaver.ISnsrBigClockScreensaver + 1.0 + Default implementation for screensaver big clock + + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaver.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaver.qrc Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,22 @@ + + + resource/snsrbigclockscreensaverdigital.docml + resource/snsrbigclockscreensaveranalog.docml + resource/snsrbigclockscreensaveroledanalog.docml + resource/snsrbigclockscreensaveroleddigital.docml + resource/snsrbigclockscreensaveranalogswipe.docml + resource/snsrbigclockscreensaverdigitalswipe.docml + snsrswipewidget/resource/qtg_anim_swipe.axml + + + snsrclockwidgets/resource/snsroledclockwidget.css + snsrclockwidgets/resource/snsroledclockwidget.widgetml + snsrclockwidgets/resource/snsranalogclockwidget.css + snsrclockwidgets/resource/snsranalogclockwidget.widgetml + snsrindicators/resource/snsrindicatorwidget.css + snsrindicators/resource/snsrindicatorwidget.widgetml + snsrswipewidget/resource/snsrswipewidget.css + snsrswipewidget/resource/snsrswipewidget.widgetml + snsrswipewidget/resource/snsrswipewidget_color.css + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pri Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,34 @@ +# +# Copyright (c) 2009-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: snsrbigclockscreensaverplugin.pri +# + +HEADERS += ./inc/*.h \ + ./snsrclockwidgets/inc/*.h \ + ./snsrindicators/inc/*.h \ + ./snsrswipewidget/inc/*.h + +SOURCES += ./src/*.cpp \ + ./snsrclockwidgets/src/*.cpp \ + ./snsrindicators/src/*.cpp \ + ./snsrswipewidget/src/*.cpp + +DEPENDPATH += ./inc \ + ./src \ + ./resource + +INCLUDEPATH += ./inc \ + ./snsrclockwidgets/inc \ + ./snsrindicators/inc \ + ./snsrswipewidget/inc diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.pro Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,45 @@ +# +# Copyright (c) 2009 - 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: snsrbigclockscreensaverplugin.pro +# + +TEMPLATE = lib +CONFIG += plugin hb mobility + +MOBILITY = serviceframework +MOBILITY += systeminfo + +PLUGIN_SUBDIR = /snsrresources/plugins/snsrplugins + +#TRANSLATIONS = snsrbigclockscreensaverplugin.ts + +include (../../common.pri) + +LIBS += -lscreensavermodel \ + -lsnsrutils + +INCLUDEPATH += ../../snsrutils/inc + +symbian: { + TARGET.UID3 = 0x20027052 + MMP_RULES += SMPSAFE + LIBS += -lxqsettingsmanager +} + +include(snsrbigclockscreensaverplugin.pri) + +RESOURCES = snsrbigclockscreensaver.qrc + +exportResources(./snsrbigclockscreensaverplugin.qm, resource/qt/translations) + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.qm Binary file screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.qm has changed diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrbigclockscreensaverplugin.ts Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,16 @@ + + + + + + Swipe in screensaver + Swipe to unlock + Swipe to unlock + + screensaver_001 + + sc + False + + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsranalogclockwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsranalogclockwidget.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009-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: Analog Clock Widget. +* +*/ + +#ifndef SNSRANALOGCLOCKWIDGET_H +#define SNSRANALOGCLOCKWIDGET_H + +#include +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrClockWidgets) + +class HbIconItem; +class HbTextItem; + +class SnsrAnalogClockWidget: public HbWidget +{ + Q_OBJECT + +public: + + explicit SnsrAnalogClockWidget(QGraphicsItem *parent = 0); + virtual ~SnsrAnalogClockWidget(); + +public slots: + + void tick(); + +protected: + + virtual void changeEvent(QEvent *event); + +private: + + void resizeEvent (QGraphicsSceneResizeEvent *event); + void createPrimitives(); + void updatePrimitives(); + void polish( HbStyleParameters& params ); + +private: + + HbIconItem *mClockBackground; + HbIconItem *mClockHourHand; + HbIconItem *mClockMinuteHand; + HbIconItem *mClockSecondHand; + HbTextItem *mClockAmPmLabel; + + Q_DISABLE_COPY(SnsrAnalogClockWidget) + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrClockWidgets) + +}; + +#endif // SNSRANALOGCLOCKWIDGET_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledclockwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledclockwidget.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2009-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: Oled Clock Widget. +* +*/ + +#ifndef SNSROLEDCLOCKWIDGET_H +#define SNSROLEDCLOCKWIDGET_H + +#include +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrClockWidgets) + +class HbIconItem; +class HbTextItem; + + +class SnsrOledClockWidget: public HbWidget +{ + Q_OBJECT + +public: + + explicit SnsrOledClockWidget(QGraphicsItem *parent = 0); + virtual ~SnsrOledClockWidget(); + +public slots: + + void tick(); + +private: + + void resizeEvent (QGraphicsSceneResizeEvent *event); + void createPrimitives(); + void updatePrimitives(); + void polish( HbStyleParameters& params ); + +private: + + HbIconItem *mClockBackground; + HbIconItem *mClockHourHand; + HbIconItem *mClockMinuteHand; + HbTextItem *mClockAmPmLabel; + + Q_DISABLE_COPY(SnsrOledClockWidget) + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrClockWidgets) + +}; + +#endif // SNSROLEDCLOCKWIDGET_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledtimelabel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/inc/snsroledtimelabel.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,45 @@ +/* +* 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: Time label for oled digital clock. +* +*/ + +#ifndef SNSROLEDTIMELABEL_H +#define SNSROLEDTIMELABEL_H + +#include +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrClockWidgets) + +class SnsrOledTimeLabel : public HbTextItem +{ + Q_OBJECT + + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + +public: + + SnsrOledTimeLabel(QGraphicsItem *parent = 0); + ~SnsrOledTimeLabel(); + + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + +private: + + Q_DISABLE_COPY(SnsrOledTimeLabel) + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrClockWidgets) +}; + +#endif // SNSROLEDTIMELABEL_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.css Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,37 @@ +HbWidget { + margin-left: 0un; + margin-top: 0un; +} + +SnsrAnalogClockWidget { + layout: layout_1; +} + +SnsrAnalogClockWidget::analog_clock_background { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 0; +} + +SnsrAnalogClockWidget::analog_clock_hour_hand { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 4; +} + +SnsrAnalogClockWidget::analog_clock_minute_hand { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 3; +} + +SnsrAnalogClockWidget::analog_clock_second_hand { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 2; +} + +SnsrAnalogClockWidget::analog_clock_am_pm_label { + /* font spec etc are set in code as setting them here didn't seem to work properly */ + zvalue: 1; +} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsranalogclockwidget.widgetml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.css Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,31 @@ +HbWidget { + margin-left: 0un; + margin-top: 0un; +} + +SnsrOledClockWidget { + layout: layout_1; +} + +SnsrOledClockWidget::oled_clock_background { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 0; +} + +SnsrOledClockWidget::oled_clock_hour_hand { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 3; +} + +SnsrOledClockWidget::oled_clock_minute_hand { + pref-height: 32.8un; + pref-width: 32.8un; + zvalue: 2; +} + +SnsrOledAnalogClockWidget::oled_clock_am_pm_label { + /* font spec etc are set in code as setting them here didn't seem to work properly */ + zvalue: 1; +} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/resource/snsroledclockwidget.widgetml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsranalogclockwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsranalogclockwidget.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2009-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: Analog Clock Widget. +* +*/ + +#include "snsranalogclockwidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +const char *gClockCssFilePath =":/style/snsranalogclockwidget.css"; +const char *gClockWidgetMLFilePath = ":/style/snsranalogclockwidget.widgetml"; + +const QString amPmLabelTextColorRole("qtc_screensaver_analog_clock"); + +/*! + \class SnsrAnalogClockWidget + \ingroup group_snsrbigclockscreensaverprovider + \brief Screensaver analog clock widget. + */ + +/*! + Constructs a new SnsrAnalogClockWidget. + \param parent Parent object. + */ +SnsrAnalogClockWidget::SnsrAnalogClockWidget(QGraphicsItem* parent): + HbWidget(parent), + mClockBackground(0), mClockHourHand(0), + mClockMinuteHand(0), mClockSecondHand(0), + mClockAmPmLabel(0) +{ + HbStyleLoader::registerFilePath(gClockCssFilePath); + HbStyleLoader::registerFilePath(gClockWidgetMLFilePath); + + createPrimitives(); + updatePrimitives(); +} + +/*! + Destructs the class. + */ +SnsrAnalogClockWidget::~SnsrAnalogClockWidget() +{ + HbStyleLoader::unregisterFilePath( gClockCssFilePath ); + HbStyleLoader::unregisterFilePath( gClockWidgetMLFilePath ); + +} + +void SnsrAnalogClockWidget::polish( HbStyleParameters& params ) +{ + // TODO: updatePrimitives might not be needed to be called from here anymore (hb changes)? + HbWidget::polish(params); + updatePrimitives(); +} + +/*! + @copydoc HbWidget::resizeEvent() + */ +void SnsrAnalogClockWidget::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + HbWidget::resizeEvent(event); + updatePrimitives(); +} + +/*! + Creates all widget primitives. + */ +void SnsrAnalogClockWidget::createPrimitives() +{ + // TODO: when final graphics are available in platform (qtg_graf_screensaver_clock_xxx) + // use them instead. + if (!mClockBackground) { + mClockBackground = new HbIconItem(QLatin1String("qtg_graf_clock_day_bg"), this); + HbStyle::setItemName(mClockBackground, QLatin1String("analog_clock_background")); + } + if (!mClockHourHand) { + mClockHourHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_hour"), this); + HbStyle::setItemName(mClockHourHand, QLatin1String("analog_clock_hour_hand")); + } + if (!mClockMinuteHand) { + mClockMinuteHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_min"), this); + HbStyle::setItemName(mClockMinuteHand, QLatin1String("analog_clock_minute_hand")); + } + if (!mClockSecondHand) { + mClockSecondHand = new HbIconItem(QLatin1String("qtg_graf_clock_day_sec"), this); + HbStyle::setItemName(mClockSecondHand, QLatin1String("analog_clock_second_hand")); + } + if (!mClockAmPmLabel) { + mClockAmPmLabel = new HbTextItem(this); + HbStyle::setItemName(mClockAmPmLabel, QLatin1String("analog_clock_am_pm_label")); + mClockAmPmLabel->setTextColor(HbColorScheme::color(amPmLabelTextColorRole)); + mClockAmPmLabel->setMinimumLines(1); + mClockAmPmLabel->setMaximumLines(1); + mClockAmPmLabel->setTextWrapping(Hb::TextNoWrap); + HbFontSpec textFont(HbFontSpec::Primary); + qreal textHeight = 0; + style()->parameter(QLatin1String("hb-param-text-height-tiny"), textHeight); + textFont.setTextHeight(textHeight); + mClockAmPmLabel->setFontSpec(textFont); + } +} + +/*! + @copydoc HbWidget::updatePrimitives() + */ +void SnsrAnalogClockWidget::updatePrimitives() +{ + if (!mClockHourHand || !mClockMinuteHand || !mClockSecondHand || !mClockAmPmLabel) { + createPrimitives(); + } + + // Calculate angles for clock hands. + QTime time = QTime::currentTime(); + qreal s = 6 * time.second(); + qreal m = 6 * (time.minute() + s/360); + qreal h = 30 * ((time.hour() % 12) + m/360); + + int x = mClockHourHand->preferredSize().width()/2; + int y = mClockHourHand->preferredSize().height()/2; + mClockHourHand->setTransform(QTransform().translate(x, y).rotate(h).translate(-x, -y)); + + x = mClockMinuteHand->preferredSize().width()/2; + y = mClockMinuteHand->preferredSize().height()/2; + mClockMinuteHand->setTransform(QTransform().translate(x, y).rotate(m).translate(-x, -y)); + + x = mClockSecondHand->preferredSize().width()/2; + y = mClockSecondHand->preferredSize().height()/2; + mClockSecondHand->setTransform(QTransform().translate(x, y).rotate(s).translate(-x, -y)); + + QString amPmString = (time.hour()<12) ? HbExtendedLocale().amText() : HbExtendedLocale().pmText(); + mClockAmPmLabel->setText( amPmString ); +} + +/*! + Updates primitives when time change. + */ +void SnsrAnalogClockWidget::tick() +{ + updatePrimitives(); +} + +/*! + \reimp + */ +void SnsrAnalogClockWidget::changeEvent(QEvent * event) +{ + if (event->type() == HbEvent::ThemeChanged) { + mClockAmPmLabel->setTextColor(HbColorScheme::color(amPmLabelTextColorRole)); + } + return HbWidget::changeEvent(event); +} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledclockwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledclockwidget.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2009 - 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: Oled Clock Widget. +* +*/ + +#include "snsroledclockwidget.h" +#include "snsrlabel.h" +#include "snsrcolors.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +const char *gOledClockCssFilePath = ":/style/snsroledclockwidget.css"; +const char *gOledClockWidgetMLFilePath = ":/style/snsroledclockwidget.widgetml"; + +/*! + \class SnsrOledClockWidget + \ingroup group_snsrbigclockscreensaverprovider + \brief Screensaver oled clock widget. + */ + +/*! + Constructs a new SnsrOledClockWidget. + \param parent Parent object. + */ +SnsrOledClockWidget::SnsrOledClockWidget(QGraphicsItem* parent): + HbWidget(parent), + mClockBackground(0), mClockHourHand(0), mClockMinuteHand(0), + mClockAmPmLabel(0) +{ + HbStyleLoader::registerFilePath(gOledClockCssFilePath); + HbStyleLoader::registerFilePath(gOledClockWidgetMLFilePath); + + createPrimitives(); + updatePrimitives(); +} + +void SnsrOledClockWidget::polish( HbStyleParameters& params ) +{ + // TODO: updatePrimitives might not be needed to be called from here anymore (hb changes)? + HbWidget::polish(params); + updatePrimitives(); +} + +/*! + Destructs the class. + */ +SnsrOledClockWidget::~SnsrOledClockWidget() +{ + HbStyleLoader::unregisterFilePath( gOledClockCssFilePath ); + HbStyleLoader::unregisterFilePath( gOledClockWidgetMLFilePath ); + +} + +/*! + @copydoc HbWidget::resizeEvent() + */ +void SnsrOledClockWidget::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + HbWidget::resizeEvent(event); + updatePrimitives(); +} + +/*! + Creates all widget primitives. + */ +void SnsrOledClockWidget::createPrimitives() +{ + // TODO: final graphics will be named qtg_graf_screensaver_clock_oled_xxx. + // not available in platform yet + + if (!mClockBackground) { + mClockBackground = new HbIconItem(QLatin1String("qtg_graf_clock_night_bg"), this); + HbStyle::setItemName(mClockBackground, QLatin1String("oled_clock_background")); + } + if (!mClockHourHand) { + mClockHourHand = new HbIconItem(QLatin1String("qtg_graf_clock_night_hour"), this); + HbStyle::setItemName(mClockHourHand, QLatin1String("oled_clock_hour_hand")); + } + if (!mClockMinuteHand) { + mClockMinuteHand = new HbIconItem(QLatin1String("qtg_graf_clock_night_min"), this); + HbStyle::setItemName(mClockMinuteHand, QLatin1String("oled_clock_minute_hand")); + } + if (!mClockAmPmLabel) { + mClockAmPmLabel = new HbTextItem(this); + HbStyle::setItemName(mClockAmPmLabel, QLatin1String("oled_clock_am_pm_label")); + mClockAmPmLabel->setTextColor(SnsrColors::PowerSaveModeWidgetColor); + mClockAmPmLabel->setMinimumLines(1); + mClockAmPmLabel->setMaximumLines(1); + mClockAmPmLabel->setTextWrapping(Hb::TextNoWrap); + HbFontSpec textFont(HbFontSpec::Primary); + qreal textHeight = 0; + style()->parameter(QLatin1String("hb-param-text-height-tiny"), textHeight); + textFont.setTextHeight(textHeight); + mClockAmPmLabel->setFontSpec(textFont); + } +} + +/*! + @copydoc HbWidget::updatePrimitives() + */ +void SnsrOledClockWidget::updatePrimitives() +{ + if (!mClockHourHand || !mClockMinuteHand || !mClockAmPmLabel) { + createPrimitives(); + } + Q_ASSERT( mClockHourHand && mClockMinuteHand && mClockAmPmLabel ); + + // Calculate angles for clock hands. + // Use granularity of one minute so that minute hand is always exactly + // on some minute and not between minutes. OLED clock is not updated more + // frequently than once per minute and using finer granularity would cause + // the minute hand to be always between even minutes. + QTime time = QTime::currentTime(); + qreal m = 6 * time.minute(); + qreal h = 30 * ((time.hour() % 12) + m/360); + + int x = mClockHourHand->preferredSize().width()/2; + int y = mClockHourHand->preferredSize().height()/2; + mClockHourHand->setTransform(QTransform().translate(x, y).rotate(h).translate(-x, -y)); + + x = mClockMinuteHand->preferredSize().width()/2; + y = mClockMinuteHand->preferredSize().height()/2; + mClockMinuteHand->setTransform(QTransform().translate(x, y).rotate(m).translate(-x, -y)); + + QString amPmString = (time.hour()<12) ? HbExtendedLocale().amText() : HbExtendedLocale().pmText(); + mClockAmPmLabel->setText( amPmString ); +} + +/*! + Updates primitives when time change. + */ +void SnsrOledClockWidget::tick() +{ + updatePrimitives(); +} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledtimelabel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrclockwidgets/src/snsroledtimelabel.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,113 @@ +/* +* 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: Time label for oled digital clock. +* +*/ + +#include "snsroledtimelabel.h" +#include "snsrcolors.h" + +#include +#include + + + +/*! + \class SnsrOledTimeLabel + \ingroup group_snsrbigclockscreensaverprovider + \brief Screensaver oled digital clock's time label + */ + +/*! + Constructs a new SnsrOledTimeLabel. + \param parent Parent object. + */ + +SnsrOledTimeLabel::SnsrOledTimeLabel(QGraphicsItem *parent) + : HbTextItem(parent) +{ + setTextColor(SnsrColors::PowerSaveModeWidgetColor); + + setMinimumLines( 1 ); + setMaximumLines( 1 ); + setAlignment(Qt::AlignCenter); + + // as we do own painting, must disable the flag that is enabled + // by default due to performance optimatizations. + setFlag(QGraphicsItem::ItemHasNoContents,false); +} + +SnsrOledTimeLabel::~SnsrOledTimeLabel() +{ +} + +/*! + \reimp + We want to draw only the outlines of the time label text and thus + text is drawn here with QPainterPath and pen (no brush) which seems to be the + only way to accomplish this. + Base class's Paint method must not be called! + We use base class only to get the bounding rect inside which to draw the text + (boundingRect has been adjusted to current text, font, alignment etc.) + */ +void SnsrOledTimeLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + // TODO: changes needed for mirrored layout and/or other than latin digits?? + + painter->save(); //saves the painter state. + + QPainterPath path; + + QRectF boundingRect = this->boundingRect(); + QString timeText = this->text(); + QFont font = this->font(); + + // As painterPath takes the left end of the text's baseline as + // a parameter we must calculate that point from boundingRect's bottom left + // so that font's descent (and baseline (=1)) are taken into account. + // We want to center the text horizontally too. The logic + // is basically the same as used inside the base class for drawing the text + // within boundingRect. + QPointF leftEndOfBaseline(0,0); // for painterPath + QFontMetrics fontMetrics(font); + int descent = fontMetrics.descent(); + int width = fontMetrics.width(timeText); + leftEndOfBaseline.setY(boundingRect.bottomLeft().y() - descent -1); + leftEndOfBaseline.setX((boundingRect.width() - width) / 2 ); // centerH + + path.addText(leftEndOfBaseline, font, timeText); + + painter->setFont(font); + + QPen newPen = painter->pen(); + newPen.setWidth( 1 ); // TODO: is this width ok? + newPen.setColor(this->textColor()); + painter->setPen(newPen); + + painter->setBrush(QBrush(Qt::NoBrush)); + + // painter->setLayoutDirection ( layoutDirection() ); // TODO: needed or not? + + painter->setRenderHint(QPainter::Antialiasing, true); // TODO: use or not? + + painter->drawPath(path); + + // Must restore the painter or the whole UI will be messed up! + painter->restore(); + +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/inc/snsrindicatorinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/inc/snsrindicatorinfo.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,64 @@ +/* +* 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: Indicator information. +* +*/ + +#ifndef SNSRINDICATORINFO_H +#define SNSRINDICATORINFO_H + +// INCLUDES +#include +#include + +/*! + \class SnsrIndicatorInfo + \ingroup group_snsrbigclockscreensaverplugin + \brief Data structure used within big clock to handle indicator data. + */ + +struct SnsrIndicatorInfo { + + inline SnsrIndicatorInfo() : + type(QString()), + iconPath(QString()), + category(HbIndicatorInterface::NotificationCategory) {} + + inline SnsrIndicatorInfo(const QString &type, + const QString &iconPath, + HbIndicatorInterface::Category category) : + type(type), + iconPath(iconPath), + category(category){} + + inline SnsrIndicatorInfo(const SnsrIndicatorInfo ©Source) : + type(copySource.type), + iconPath(copySource.iconPath), + category(copySource.category){} + + inline bool isIconPathEmpty() const { + return !iconPath.isEmpty(); + } + + // Indicator type string that is defined by the indicator provider + QString type; + // Should be fetched by using HbIndicatorInterface::MonoDecorationNameRole + QString iconPath; + HbIndicatorInterface::Category category; + +}; + +#endif // SNSRINDICATORINFO_H + +// End of File diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/inc/snsrindicatormodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/inc/snsrindicatormodel.h Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,107 @@ +/* +* 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: Model for handling indicator data. +* +*/ + +#ifndef SNSRINDICATORMODEL_H +#define SNSRINDICATORMODEL_H + +#include +#include "snsrindicatorinfo.h" +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrIndicators) + +class HbIndicatorInterface; +#ifdef Q_OS_SYMBIAN +class XQSettingsManager; +class XQSettingsKey; +#endif //Q_OS_SYMBIAN + +class SnsrIndicatorModel : public QObject +{ + Q_OBJECT + +public: + + SnsrIndicatorModel(QObject *parent = 0); + virtual ~SnsrIndicatorModel(); + +public slots: + + void handleActiveIndicators(const QList &activeIndicators); + void handleActivatedIndicator(HbIndicatorInterface *activatedIndicator); + void handleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator); + + void handleUpdatedIndicator(); + + void initializeIndicatorWidget(); + +#ifdef Q_OS_SYMBIAN + void offlineValueChanged( const XQSettingsKey &key, const QVariant &value); +#endif // Q_OS_SYMBIAN + +signals: + + void indicatorsUpdated(const QList &activeIndicators); + void allIndicatorsDeactivated(); + +private: + + bool addIndicator(const SnsrIndicatorInfo &indicatorInfo); + bool isIndicatorAlreadyAdded(const SnsrIndicatorInfo &indicatorInfo) const; + + bool findAndRemoveIndicator(const SnsrIndicatorInfo &indicatorInfo); + + bool showIndicatorInScreensaver(const HbIndicatorInterface &indicatorInterface, + SnsrIndicatorInfo &indicatorInfo); + + void connectToIndicatorsUpdateSignal(const HbIndicatorInterface &indicatorInterface); + + bool anyActiveIndicators() const; + + void emitChangeSignal(); + void updateIndicatorsToShowList(); + + void initializeOfflineModeIndication(); + void getCurrentOfflineState(); + +private: + + bool mOfflineStateOn; + SnsrIndicatorInfo mOfflineIndicatorInfo; +#ifdef Q_OS_SYMBIAN + XQSettingsKey *mOfflineKey; + XQSettingsManager *mSettingsManager; +#endif //Q_OS_SYMBIAN + + // Save universal indicator statuses into these 2 lists. + // Active notification indicators in reversed chronological order: + // the first item is the most recent. + QList mNotificationIndicators; + // Screensaver should show only silent indicator from this category. + QList mSettingIndicators; + + // This is a combined ordered list of all indicators that should + // be shown in UI: offline + notification indicators + + // settings indicators + QList mIndicatorsToShow; + + Q_DISABLE_COPY(SnsrIndicatorModel) + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrIndicators) +}; + +#endif // SNSRINDICATORMODEL_H + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/inc/snsrindicatorwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/inc/snsrindicatorwidget.h Wed Oct 06 16:06:24 2010 +0300 @@ -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: Indicator Widget. +* +*/ + +#ifndef SNSRINDICATORWIDGET_H +#define SNSRINDICATORWIDGET_H + +#include +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrIndicators) + +class HbIconItem; +class SnsrIndicatorInfo; + + +class SnsrIndicatorWidget: public HbWidget +{ + Q_OBJECT + + Q_ENUMS(IndicatorLayoutType) + Q_PROPERTY(IndicatorLayoutType layoutType READ layoutType WRITE setLayoutType) + +public: + + enum IndicatorLayoutType + { + IndicatorsAlignedLeft, + IndicatorsCentered + }; + + enum IconColorType + { + ThemedColorForActiveMode, + FixedColorForPowerSaveMode + }; + +public: + + explicit SnsrIndicatorWidget(QGraphicsItem *parent = 0); + virtual ~SnsrIndicatorWidget(); + + IndicatorLayoutType layoutType() const; + void setLayoutType(IndicatorLayoutType type); + + void setIconColorType(const IconColorType &colorType); + +public slots: + + void showIndicators(const QList &indicators); + void removeAllIndicators(); + +protected: + + virtual void changeEvent(QEvent *event); + +private: + + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + void createPrimitives(); + +private: + + QList mIcons; + IndicatorLayoutType mLayoutType; + IconColorType mIconColorType; + QColor mIconColor; + + Q_DISABLE_COPY(SnsrIndicatorWidget) + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrIndicators) +}; + +#endif // SNSRINDICATORWIDGET_H diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/resource/snsrindicatorwidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/resource/snsrindicatorwidget.css Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,33 @@ +SnsrIndicatorWidget { + layout: indicatorlayout; +} + +SnsrIndicatorWidget::icon1 { + fixed-width: 2.4un; + fixed-height: 2.4un; +} + +SnsrIndicatorWidget::icon2 { + fixed-width: 2.4un; + fixed-height: 2.4un; +} + +SnsrIndicatorWidget::icon3 { + fixed-width: 2.4un; + fixed-height: 2.4un; +} + +SnsrIndicatorWidget::icon4 { + fixed-width: 2.4un; + fixed-height: 2.4un; +} + +SnsrIndicatorWidget::icon5 { + fixed-width: 2.4un; + fixed-height: 2.4un; +} + +SnsrIndicatorWidget::icon6 { + fixed-width: 2.4un; + fixed-height: 2.4un; +} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/resource/snsrindicatorwidget.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/resource/snsrindicatorwidget.widgetml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/resource/snsrindicatorwidget_color.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/resource/snsrindicatorwidget_color.css Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,29 @@ +SnsrIndicatorWidget::icon1 +{ + color:var(qtc_screensaver); +} + +SnsrIndicatorWidget::icon2 +{ + color:var(qtc_screensaver); +} + +SnsrIndicatorWidget::icon3 +{ + color:var(qtc_screensaver); +} + +SnsrIndicatorWidget::icon4 +{ + color:var(qtc_screensaver); +} + +SnsrIndicatorWidget::icon5 +{ + color:var(qtc_screensaver); +} + +SnsrIndicatorWidget::icon6 +{ + color:var(qtc_screensaver); +} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/src/snsrindicatormodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/src/snsrindicatormodel.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,448 @@ +/* +* 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: Model for handling indicator data. +* +*/ + +#include +#ifdef Q_OS_SYMBIAN +#include +#include +#include +#endif //Q_OS_SYMBIAN + +#include "snsrindicatormodel.h" +#include "snsrindicatorinfo.h" + +/*! + \class SnsrIndicatorModel + \ingroup group_snsrbigclockscreensaverplugin + \brief Model for handling indicator data. + */ + +// TODO: what is the final type string of silent indicator? +// workaround solution: assume that it contains +// substring "silence" like in the demo app provided by the team. +const char *gSilentIndicatorTypeString = "silence"; +const char *gOfflineIndicatorTypeString = "offline"; + + +/*! + Constructs a new SnsrIndicatorModel + \param parent Parent object. + */ +SnsrIndicatorModel::SnsrIndicatorModel(QObject *parent): QObject(parent), + mOfflineStateOn(false) +{ + initializeOfflineModeIndication(); +} + +/*! + Destructs the class. + */ +SnsrIndicatorModel::~SnsrIndicatorModel() +{ + mNotificationIndicators.clear(); + mSettingIndicators.clear(); + mIndicatorsToShow.clear(); +#ifdef Q_OS_SYMBIAN + if (mSettingsManager && mOfflineKey) { + mSettingsManager->stopMonitoring(*mOfflineKey); + } + delete mOfflineKey; +#endif //Q_OS_SYMBIAN +} + +/*! + If there are already some active indicators when screensaver is + launched, then this method is called. + Indicators that are gonna be shown by the screensaver are + added to the model. + \param activeIndicators Active universal indicators in + chronological order according to their arrival time. + */ +void SnsrIndicatorModel::handleActiveIndicators( + const QList &activeIndicators) +{ + mNotificationIndicators.clear(); + mSettingIndicators.clear(); + + bool addedAny(false); + + for (int i = 0; i < activeIndicators.size(); ++i) { + HbIndicatorInterface* activatedIndicator = activeIndicators.at(i); + SnsrIndicatorInfo indicatorInfo; + if (activatedIndicator + && showIndicatorInScreensaver(*activatedIndicator,indicatorInfo)) { + addIndicator(indicatorInfo); + connectToIndicatorsUpdateSignal(*activatedIndicator); + addedAny = true; + } + } + + // Send signal only once if there were any such indicators that + // screensaver is supposed to show (=added to the model). + if (addedAny) { + emitChangeSignal(); + } +} + +/*! + Called when some universal indicator gets activated. + \param activatedIndicator Activated universal indicator + */ +void SnsrIndicatorModel::handleActivatedIndicator( + HbIndicatorInterface *activatedIndicator) +{ + SnsrIndicatorInfo indicatorInfo; + if (activatedIndicator + && showIndicatorInScreensaver(*activatedIndicator,indicatorInfo)) { + if (addIndicator(indicatorInfo)) { + connectToIndicatorsUpdateSignal(*activatedIndicator); + emitChangeSignal(); + } + } +} + +/*! + Called when some universal indicator gets deactivated. + \param deactivatedIndicator Deactivated universal indicator + */ +void SnsrIndicatorModel::handleDeactivatedIndicator( + HbIndicatorInterface *deactivatedIndicator) +{ + if (deactivatedIndicator) { + SnsrIndicatorInfo indicatorInfo( + deactivatedIndicator->indicatorType(), + deactivatedIndicator->indicatorData(HbIndicatorInterface::MonoDecorationNameRole).toString(), + deactivatedIndicator->category()); + + if (findAndRemoveIndicator(indicatorInfo)) { + emitChangeSignal(); + } + } +} + +/*! + Called when some universal indicator updates its data by + emitting dataChanged signal. + We listen to this signal because at least the silent indicator plugin demo + uses this method to inform the clients when it gets deactivated/activated + once it has been activated once by setting its icon path to empty/valid string. + Don't know if this is going to be the final solution as it's unconventional (?) + but let's be prepared also to this kind of approach. + */ +void SnsrIndicatorModel::handleUpdatedIndicator() +{ + HbIndicatorInterface* indicator = + qobject_cast(sender()); + if (!indicator) { + return; + } + + // If indicator's icon path was set to empty string, then treat it + // like it were deactivated. And if not empty, then it's active again. + if (indicator->indicatorData( + HbIndicatorInterface::MonoDecorationNameRole).toString().isEmpty()) { + handleDeactivatedIndicator(indicator); + } + else { + handleActivatedIndicator(indicator); + } + +} + +/*! + Sends a signal with a list of all currently active indicators. + No signal is sent if there are no active indicators currently. + */ +void SnsrIndicatorModel::initializeIndicatorWidget() +{ + getCurrentOfflineState(); // update status to be on the safe side + + if ( anyActiveIndicators() ) { + emitChangeSignal(); + } +} + +#ifdef Q_OS_SYMBIAN +/*! + listens airplane repository key. + */ +void SnsrIndicatorModel::offlineValueChanged( const XQSettingsKey &key, const QVariant &value ) +{ + bool previousState(mOfflineStateOn); + switch ( key.key() ) { + case KCoreAppUIsNetworkConnectionAllowed: + if(value.toInt() == ECoreAppUIsNetworkConnectionNotAllowed && + value.isValid()) + { + mOfflineStateOn = true; + } + else + { + mOfflineStateOn = false; + } + if (previousState != mOfflineStateOn) { + emitChangeSignal(); + } + break; + default: + break; + + } +} +#endif //Q_OS_SYMBIAN + +/*! + Add the indicator into this model. Handle here the order in which + indicators are shown in screensaver: notification indicators should be + shown in the same order as shown in statusbar, that is in reversed + chronological order. Silent indicator should always be the right-most one. + /retval true if indicator was added (not found already in the listings) + */ +bool SnsrIndicatorModel::addIndicator(const SnsrIndicatorInfo &indicatorInfo) +{ + // To be on the safe side, check that the indicator doesn't already + // exists in the active indicator listings. + bool added(false); + + // Use prepend to keep the list in reversed chronological order + if (indicatorInfo.category == HbIndicatorInterface::NotificationCategory + && !isIndicatorAlreadyAdded(indicatorInfo)) { + mNotificationIndicators.prepend(indicatorInfo); + added = true; + } + else if (indicatorInfo.category == HbIndicatorInterface::SettingCategory + && !isIndicatorAlreadyAdded(indicatorInfo)) { + mSettingIndicators.append(indicatorInfo); + added = true; + } + + return added; +} + +/*! + Check whether the indicator is already added in the active + indicator listing. + /retval true if indicator is already added; false if not. + */ +bool SnsrIndicatorModel::isIndicatorAlreadyAdded(const SnsrIndicatorInfo &indicatorInfo) const +{ + bool alreadyExits(false); + + const QList &indicatorList = + indicatorInfo.category == HbIndicatorInterface::NotificationCategory + ? mNotificationIndicators : mSettingIndicators; + + for (int i = 0; i < indicatorList.size(); ++i) { + if (indicatorList.at(i).type == indicatorInfo.type) { + alreadyExits = true; + break; + } + } + return alreadyExits; +} + +/*! + Remove indicator if it can be found. + /retval true if the indicator was removed + */ +bool SnsrIndicatorModel::findAndRemoveIndicator(const SnsrIndicatorInfo &indicatorInfo) +{ + bool removed(false); + int index(-1); + QList &indicatorList = + indicatorInfo.category == HbIndicatorInterface::NotificationCategory + ? mNotificationIndicators : mSettingIndicators; + + for (int i = 0; i < indicatorList.size(); ++i) { + if (indicatorList.at(i).type == indicatorInfo.type) { + index = i; + break; + } + } + if (index >= 0) { + indicatorList.removeAt(index); + removed = true; + } + return removed; +} + +/*! + Check whether to show the indicator in screensaver or not. + Icon path is asked with HbIndicatorInterface::MonoDecorationNameRole + which refers to the indicator icons shown also in the statusbar: + only 4 Notification indicators has premission to publish data with + that role. As those 4 are the ones wanted also by screensaver, no + extra checks are needed. + From the Setting category one should show only Silent indicator. + No indicators are shown from the Progress category. + If indicator should be shown by screensaver, indicator info is + packaged and returned within the parameter. + + /retval true if the indicator should be shown in screensaver + */ +bool SnsrIndicatorModel::showIndicatorInScreensaver( + const HbIndicatorInterface &indicatorInterface, SnsrIndicatorInfo &indicatorInfo) +{ + bool show(false); + // all indicators shown by screensaver must have valid status bar icon path + QString iconPath = + indicatorInterface.indicatorData(HbIndicatorInterface::MonoDecorationNameRole).toString(); + QString typeString = indicatorInterface.indicatorType(); + HbIndicatorInterface::Category category = indicatorInterface.category(); + + if (category == HbIndicatorInterface::NotificationCategory + && !iconPath.isEmpty()) { + // only 4 indicators of this category has permission to publish status bar + // icon path->we should show all of them->no additional checks are neeeded. + show = true; + } + else if (category == HbIndicatorInterface::SettingCategory + && !iconPath.isEmpty() + // TODO: what is the type string of silent indicator? + // workaround solution: assume that it contains + // substring "silence" like in the demo app. + // && type == gSilentIndicatorTypeString ) { + && typeString.contains(gSilentIndicatorTypeString, Qt::CaseInsensitive)) { + show = true; + } + else { // e.g. no Progress category indicators are shown + show = false; + } + + // package indicator data into indicatorInfo parameter + indicatorInfo.type = typeString; + indicatorInfo.iconPath = iconPath; + indicatorInfo.category = category; + + return show; +} + +/*! + Start listening to indicator's dataChanged signals. + /parameter indicator whose dataChanged signal we want to listen + */ +void SnsrIndicatorModel::connectToIndicatorsUpdateSignal(const HbIndicatorInterface &indicatorInterface) +{ + // Connect to silent indicator's dataChanged signal as it seems to + // use unconventional method (demo at least) to inform when + // it's get deactivated/activated: dataChanged signal is emitted and + // icon path is set to empty string/valid string. + // It's assumed that we don't need to listen to other indicators + // as we are not interested e.g. when primary/secondary texts change etc. + + // NOTE: do NOT disconnect the indicator signal anywhere explicitly here + // or we won't get activation/deactivation messages. + if (indicatorInterface.indicatorType().contains(gSilentIndicatorTypeString, Qt::CaseInsensitive)) { + QObject::connect( &indicatorInterface, SIGNAL(dataChanged()), + this, SLOT(handleUpdatedIndicator())); + } +} + +/*! + Check whether there is any active indicator currently. + /retval true if there is at least one indicator to show + */ +bool SnsrIndicatorModel::anyActiveIndicators() const +{ + bool any(false); + if ( mNotificationIndicators.size() != 0 + || mSettingIndicators.size() != 0 + || mOfflineStateOn ) { + any = true; + } + return any; +} + +/*! + Send appropriate signal so that UI widget can update itself. + */ +void SnsrIndicatorModel::emitChangeSignal() +{ + if (anyActiveIndicators()) { + updateIndicatorsToShowList(); + emit indicatorsUpdated(mIndicatorsToShow); + } + else { + mIndicatorsToShow.clear(); + emit allIndicatorsDeactivated(); + } +} + +/*! + Updates the list that contains all the indicators that + should be shown in UI. List should contain active indicators + in this order: + offline + notification indicators + settings indicators. + This is the list that will be sent to the widget. + */ +void SnsrIndicatorModel::updateIndicatorsToShowList() +{ + mIndicatorsToShow.clear(); + + if (mOfflineStateOn) { + mIndicatorsToShow.append(mOfflineIndicatorInfo); + } + mIndicatorsToShow.append(mNotificationIndicators); + mIndicatorsToShow.append(mSettingIndicators); +} + +/*! + * Reads the airplanemode repository value and starts monitoring it. + * if the value is 1, offline indicator is shown. + */ +void SnsrIndicatorModel::initializeOfflineModeIndication() +{ +#ifdef Q_OS_SYMBIAN + mOfflineIndicatorInfo = SnsrIndicatorInfo( + gOfflineIndicatorTypeString, + QLatin1String("qtg_mono_offline"), + HbIndicatorInterface::NotificationCategory); + + mSettingsManager = new XQSettingsManager(this); + //connect to offlineValueChanged slot so we get information if the value is changed while screensaver is on + connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, SLOT(offlineValueChanged( const XQSettingsKey, const QVariant))); + mOfflineKey = new XQSettingsKey(XQSettingsKey::TargetCentralRepository, + KCRUidCoreApplicationUIs.iUid, + KCoreAppUIsNetworkConnectionAllowed); + if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == ECoreAppUIsNetworkConnectionNotAllowed) + { + mOfflineStateOn = true; + } + mSettingsManager->startMonitoring(*mOfflineKey); +#else + mOfflineStateOn = false; +#endif //Q_OS_SYMBIAN +} + +/*! + Get current offline status. + */ +void SnsrIndicatorModel::getCurrentOfflineState() +{ +#ifdef Q_OS_SYMBIAN + if(mSettingsManager->readItemValue(*mOfflineKey).toInt() == ECoreAppUIsNetworkConnectionNotAllowed) { + mOfflineStateOn = true; + } + else { + mOfflineStateOn = false; + } +#else + mOfflineStateOn = false; +#endif //Q_OS_SYMBIAN +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/src/snsrindicatorwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrindicators/src/snsrindicatorwidget.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,233 @@ +/* +* 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: Indicator Widget. +* +*/ + +#include "snsrindicatorwidget.h" +#include "snsrindicatorinfo.h" +#include "snsrcolors.h" + +#include +#include +#include +#include +#include +#include +#include + + +const char *gIndicatorCssFilePath =":/style/snsrindicatorwidget.css"; +const char *gIndicatorWidgetMLFilePath = ":/style/snsrindicatorwidget.widgetml"; + +const int gNumberOfIcons(6); + + +/*! + \class SnsrIndicatorWidget + \ingroup group_snsrbigclockscreensaverprovider + \brief Screensaver indicator widget. + */ + +/*! + Constructs a new SnsrIndicatorWidget. + \param parent Parent object. + */ +SnsrIndicatorWidget::SnsrIndicatorWidget(QGraphicsItem* parent): + HbWidget(parent), mLayoutType(IndicatorsCentered), + mIconColorType(ThemedColorForActiveMode), + mIconColor(HbColorScheme::color(SnsrColors::WidgetColorRole.latin1())) +{ + HbStyleLoader::registerFilePath(gIndicatorCssFilePath); + HbStyleLoader::registerFilePath(gIndicatorWidgetMLFilePath); + + setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); + + createPrimitives(); +} + +/*! + Destructs the class. + */ +SnsrIndicatorWidget::~SnsrIndicatorWidget() +{ + // icons within the list are deleted by parent + mIcons.clear(); + + HbStyleLoader::unregisterFilePath( gIndicatorCssFilePath ); + HbStyleLoader::unregisterFilePath( gIndicatorWidgetMLFilePath ); +} + + +SnsrIndicatorWidget::IndicatorLayoutType SnsrIndicatorWidget::layoutType() const +{ + return mLayoutType; +} + +/*! + Sets the name of layout definition \a layoutName for selecting + the layout of view items of this view from css/xml files. + + This layout is accessible from css file as layout property + of the view item. + + */ +void SnsrIndicatorWidget::setLayoutType(IndicatorLayoutType type) +{ + if (mLayoutType != type ) { + mLayoutType = type; + QSizePolicy::Policy hSizePolicy(QSizePolicy::Expanding); + if ( mLayoutType == IndicatorsAlignedLeft ) { + hSizePolicy = QSizePolicy::Preferred; + } + setSizePolicy(hSizePolicy,QSizePolicy::Preferred); + } +} + +/*! + Set the coloring scheme to be used: fixed color for power save mode (white) or + themed color for active mode. + */ +void SnsrIndicatorWidget::setIconColorType(const IconColorType &colorType) +{ + mIconColorType = colorType; + if (mIconColorType==FixedColorForPowerSaveMode) { + mIconColor=SnsrColors::PowerSaveModeWidgetColor; + } + else { + mIconColor=HbColorScheme::color(SnsrColors::WidgetColorRole.latin1()); + } +} + + +/*! + This is called whenever indicators' status changes: parameter list + tells which indicators should be shown at the given moment. All + previously shown indicators should be hidden and show only these + indicators passed as a parameter. + */ +void SnsrIndicatorWidget::showIndicators(const QList &indicators) +{ + // Update icon paths so that shown iconItems have + // valid icon path and rest have empty path (->invisible) + + int indicatorAmount = indicators.size(); + + removeAllIndicators(); + + // update icon paths for items that are gonna be shown + for (int i=0; i < indicatorAmount && i < mIcons.size(); ++i) { + mIcons.at(i)->setIconName(indicators.at(i).iconPath); + mIcons.at(i)->setFlags(HbIcon::Colorized); + mIcons.at(i)->setColor(mIconColor); + } + + // To recalculate layouts + updateGeometry(); + if ( parentLayoutItem() ) { + parentLayoutItem()->updateGeometry(); // clear the cache of the parent + } +} + +/*! + Remove all indicators from UI. + */ +void SnsrIndicatorWidget::removeAllIndicators() +{ + for (int i=0; i < mIcons.size(); ++i) { + mIcons.at(i)->setIconName(QString()); + } +} + +/*! + \reimp + */ +void SnsrIndicatorWidget::changeEvent(QEvent * event) +{ + if (event->type() == HbEvent::ThemeChanged && + mIconColorType == ThemedColorForActiveMode) { + mIconColor = HbColorScheme::color(SnsrColors::WidgetColorRole.latin1()); + for (int i=0; i < mIcons.size(); ++i) { + mIcons.at(i)->setColor(mIconColor); + } + } + return HbWidget::changeEvent(event); +} + +/*! + If indicator pane is going to be centered, then calculate width so that it's + exactly the same as visible icons are taking space (+spacers between them). + If indicator pane is left aligned, then actual width doesn't matter. + Assumption is that icons are fixed sized. + \reimp +*/ +QSizeF SnsrIndicatorWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ + QSizeF hint = HbWidget::sizeHint(which, constraint); + + if (which == Qt::PreferredSize && layoutType() == IndicatorsCentered ) { + qreal width(0); + qreal itemWidth(0); + qreal iconSpace(0); + int visibleIconCount(0); + + for (int i=0; i < mIcons.size(); ++i) { + if (!mIcons.at(i)->iconName().isEmpty() ) { + visibleIconCount++; + itemWidth = mIcons.at(i)->iconItemSize().width(); + width = width + itemWidth; + } + } + if (visibleIconCount > 1) { + style()->parameter("hb-param-margin-gene-middle-horizontal", iconSpace); + width = width + ((visibleIconCount-1)*iconSpace); + } + + hint.setWidth(width); + } + + return hint; +} + +/*! + Creates all widget primitives. + Coloring is handled via CSS. + */ +void SnsrIndicatorWidget::createPrimitives() +{ + if (!mIcons.isEmpty()) { + return; + } + + HbIconItem *icon(0); + QLatin1String itemNameBase("icon"); + int itemNameEnd(1); + QString itemName(""); + + while (mIcons.count() < gNumberOfIcons) { + // When created, icon names are left empty -> nothing shown in UI. + icon = new HbIconItem(this); + icon->setFlags(HbIcon::Colorized); + icon->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + + // Create items that are named icon1..icon6. + itemName.clear(); + itemName.append(itemNameBase); + itemName.append(QString::number(itemNameEnd)); + HbStyle::setItemName(icon, itemName); + ++itemNameEnd; + + mIcons.append(icon); + } +} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/inc/snsrswipewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/inc/snsrswipewidget.h Wed Oct 06 16:06:24 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: Swipe widget. +* +*/ + +#ifndef SNSRSWIPEWIDGET_H +#define SNSRSWIPEWIDGET_H + +#include + +#include +#include +#include +#include "snsrtest_global.h" + +SCREENSAVER_TEST_CLASS(T_SnsrSwipeWidget) + +class HbAction; +class HbPushButton; +class HbLabel; +class HbIconItem; + +class SnsrSwipeWidget : public HbWidget + { + Q_OBJECT + +public: + + explicit SnsrSwipeWidget(QGraphicsItem *parent = 0); + virtual ~SnsrSwipeWidget(); + + void setCurrentOrientation(int orientation); + +private slots: + + void createPrimitives(); + +protected: // from base classes + + virtual void gestureEvent(QGestureEvent *event); + +signals: + void swipeDownDetected(); + +private: // data + + HbLabel *mSlideLabel; + HbIconItem* mIconItem; + //for swipe direction we need to know if the device is in landscapemode + int mCurrentOrientation; + + Q_DISABLE_COPY(SnsrSwipeWidget) + + SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrSwipeWidget) + +}; + +#endif // SNSRSWIPEWIDGET_H + +// EOF diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/qtg_anim_swipe.axml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/qtg_anim_swipe.axml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,20 @@ + + + qtg_anim_screenlock_swipe_1 + qtg_anim_screenlock_swipe_2 + qtg_anim_screenlock_swipe_3 + qtg_anim_screenlock_swipe_4 + qtg_anim_screenlock_swipe_5 + qtg_anim_screenlock_swipe_6 + qtg_anim_screenlock_swipe_7 + qtg_anim_screenlock_swipe_8 + qtg_anim_screenlock_swipe_9 + qtg_anim_screenlock_swipe_10 + qtg_anim_screenlock_swipe_11 + qtg_anim_screenlock_swipe_12 + qtg_anim_screenlock_swipe_13 + qtg_anim_screenlock_swipe_14 + qtg_anim_screenlock_swipe_15 + qtg_anim_screenlock_swipe_16 + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.css Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,17 @@ +SnsrSwipeWidget { + layout:layout-portrait; + margin-left: 0un; + margin-top: 0un; +} + +SnsrSwipeWidget::slideLabel { + pref-height: expr(var(hb-param-text-height-tiny)+0.1un); + zvalue: 0; +} + + +SnsrSwipeWidget::slideIcon { + pref-height:10.6un; + pref-width:35un; + zvalue: 1; +} \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget.widgetml Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget_color.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/resource/snsrswipewidget_color.css Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,10 @@ +SnsrSwipeWidget::slideLabel +{ + color:var(qtc_screensaver); +} + +SnsrSwipeWidget::slideIcon +{ + color:var(qtc_screensaver); +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/src/snsrswipewidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/snsrswipewidget/src/snsrswipewidget.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,134 @@ +/* +* 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: Swipe Widget. +* +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "snsrbigclockcontainer.h" +#include "snsranalogclockcontainer.h" +#include "snsrswipewidget.h" + +const char *gSwipeCssFilePath =":/style/snsrswipewidget.css"; +const char *gSwipeWidgetMLFilePath = ":/style/snsrswipewidget.widgetml"; +const char *gSwipeColorCssFilePath = ":/style/snsrswipewidget_color.css"; +const char *gSwipeIcon = ":/xml/qtg_anim_swipe.axml"; +const qreal gSwipeDownAngle = 270; +const qreal gLandscapeSwipeDownAngle = 180; +const qreal gSwipeAngleTolerance = 25; + +/*! + \class SnsrSwipeWidget + \ingroup group_snsrbigclockscreensaverplugins + \brief Screensaver swipe widget. + */ + +/*! + Constructs a new SnsrSwipeWidget. + \param parent Parent object. + */ +SnsrSwipeWidget::SnsrSwipeWidget(QGraphicsItem* parent): + HbWidget(parent), + mSlideLabel(0), mIconItem(0),mCurrentOrientation(-1) +{ + HbStyleLoader::registerFilePath(gSwipeCssFilePath); + HbStyleLoader::registerFilePath(gSwipeWidgetMLFilePath); + HbStyleLoader::registerFilePath(gSwipeColorCssFilePath); + + setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); + + createPrimitives(); + + grabGesture(Qt::SwipeGesture); +} + +/*! + Destructs the class. + */ +SnsrSwipeWidget::~SnsrSwipeWidget() +{ + HbStyleLoader::unregisterFilePath( gSwipeCssFilePath ); + HbStyleLoader::unregisterFilePath( gSwipeWidgetMLFilePath ); + HbStyleLoader::unregisterFilePath( gSwipeColorCssFilePath ); + +} + +/*! + Creates all widget primitives. + */ +void SnsrSwipeWidget::createPrimitives() +{ + if (!mSlideLabel) { + mSlideLabel = new HbLabel(this); + mSlideLabel->setPlainText(hbTrId("txt_screensaver_swipe")); + mSlideLabel->setAlignment(Qt::AlignCenter); + HbStyle::setItemName(mSlideLabel, QLatin1String("slideLabel")); + } + if (!mIconItem) { + HbIconAnimationManager::global()->addDefinitionFile(gSwipeIcon); + mIconItem = new HbIconItem(QString("qtg_anim_swipe"),this); + HbStyle::setItemName(mIconItem, QLatin1String("slideIcon")); + mIconItem->show(); + mIconItem->animator().startAnimation(); + mIconItem->setAlignment(Qt::AlignCenter); + } +} + +/*! + \reimp + */ + +void SnsrSwipeWidget::gestureEvent(QGestureEvent *event) +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrSwipeWidget::gestureEvent") + + QGesture *gesture = event->gesture(Qt::SwipeGesture); + QSwipeGesture *swipe = static_cast(gesture); + + if ( swipe && swipe->state() == Qt::GestureStarted ) { + event->accept(Qt::SwipeGesture); + mIconItem->animator().startAnimation(); + } + else if ( swipe && swipe->state() == Qt::GestureFinished ) { + // unclock with downward swipe + qreal downAngle = (mCurrentOrientation == Qt::Vertical) ? + gSwipeDownAngle : gLandscapeSwipeDownAngle; + qreal swipeAngle = swipe->swipeAngle(); + if ( abs(swipeAngle - downAngle) < gSwipeAngleTolerance ) { + emit swipeDownDetected(); + event->accept(Qt::SwipeGesture); + } + } + else { + event->ignore(Qt::SwipeGesture); + } + + SCREENSAVER_TEST_FUNC_EXIT("SnsrSwipeWidget::gestureEvent") +} + +void SnsrSwipeWidget::setCurrentOrientation(int orientation) +{ + mCurrentOrientation = orientation; +} + + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsranalogclockcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsranalogclockcontainer.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2009-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: Container for analog clock. +* +*/ + +#include "snsranalogclockcontainer.h" + +#include +#include +#include + +#include +#include + +#include "snsranalogclockwidget.h" +#include "snsrindicatorwidget.h" +#include "snsrswipewidget.h" +#include "snsrlabel.h" + +/*! + \class SnsrAnalogClockContainer + \ingroup group_snsrbigclockscreensaverplugin + \brief Container used for preparing layout for analog clock. + */ + +const char *gAnalogLayoutDocml = ":/xml/snsrbigclockscreensaveranalog.docml"; +const char *gSwipeAnalogLayoutDocml = ":/xml/snsrbigclockscreensaveranalogswipe.docml"; + + +const char *gPortraitSectionName = "portrait"; +const char *gLandscapeSectionName = "landscape"; + +const char *gMainViewName = "view"; +const char *gMainContainerName = "mainContainer"; +const char *gClockContainerName = "clockContainer"; + +const char *gDateLabelName = "dateLabel"; +const char *gAnalogClockWidgetName = "analogClockWidget"; +const char *gIndicatorWidgetName = "indicatorWidget"; + +const char *gSwipeWidgetName = "swipeWidget"; + +const char *gDateFormatStr = r_qtn_date_usual_with_zero; //"%E%,% %*D%*N%/0%4%/1%5"; + + +/*! + Constructs a new SnsrAnalogClockContainer. + */ +SnsrAnalogClockContainer::SnsrAnalogClockContainer() : + SnsrBigClockContainer(), + mDateLabel(0), + mAnalogClockWidget(0), + mSwipeWidget(0) +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrAnalogClockContainer::SnsrAnalogClockContainer") + SCREENSAVER_TEST_FUNC_EXIT("SnsrAnalogClockContainer::SnsrAnalogClockContainer") +} + +/*! + Destructs the class. + */ +SnsrAnalogClockContainer::~SnsrAnalogClockContainer() +{ + resetIndicatorConnections(); + //mDateLabel, mAnalogClockWidget - deleted by the parent +} + +/*! + Updates displayed time and date. + */ +void SnsrAnalogClockContainer::update() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrAnalogClockContainer::update") + + // time + mAnalogClockWidget->tick(); + + // date + mDateLabel->setPlainText( + HbExtendedLocale().format(QDate::currentDate(), gDateFormatStr) + ); + + if (mSwipeWidget) { + mSwipeWidget->setCurrentOrientation(mCurrentOrientation); + } + + SCREENSAVER_TEST_FUNC_EXIT("SnsrAnalogClockContainer::update") +} + +/*! + @copydoc SnsrBigClockContainer::updateIntervalInMilliseconds() + */ +int SnsrAnalogClockContainer::updateIntervalInMilliseconds() +{ + return 1000; +} + +/*! + @copydoc SnsrBigClockContainer::loadWidgets() + */ +void SnsrAnalogClockContainer::loadWidgets() +{ + //if swipe is used we load the docml file containing it + if ( swipeToUnlockSupported() ) { + loadWidgets(gSwipeAnalogLayoutDocml); + Q_ASSERT_X( mSwipeWidget, gSwipeAnalogLayoutDocml, "Swipe widget not found in DocML file."); + connect( mSwipeWidget, SIGNAL(swipeDownDetected()), SIGNAL(unlockRequested()) ); + } + else { + loadWidgets(gAnalogLayoutDocml); + } +} + +/*! + Instantiate widgets from the given docml file + */ +void SnsrAnalogClockContainer::loadWidgets(const char* docmlName) +{ + bool ok(true); + + // reset widget pointers, any previous widgets are already deleted by now + mMainView = 0; + mDateLabel = 0; + mAnalogClockWidget = 0; + mIndicatorWidget = 0; + mSwipeWidget = 0; + // load widgets from docml + qDebug() << docmlName; + mDocumentObjects = mDocumentLoader.load(docmlName, &ok); + Q_ASSERT_X(ok, docmlName, "Invalid DocML file."); + if (ok) { + mMainView = mDocumentLoader.findWidget(gMainViewName); + mDateLabel = qobject_cast( + mDocumentLoader.findWidget(gDateLabelName)); + mAnalogClockWidget = qobject_cast( + mDocumentLoader.findWidget(gAnalogClockWidgetName)); + mIndicatorWidget = qobject_cast( + mDocumentLoader.findWidget(gIndicatorWidgetName)); + mSwipeWidget = qobject_cast( + mDocumentLoader.findWidget(gSwipeWidgetName)); + + Q_ASSERT_X( + mMainView && mDateLabel && mAnalogClockWidget && + mIndicatorWidget, + docmlName, "Objects not found in DocML file." + ); + + // In case of landscape layout, read also the landscape delta section + if ( mCurrentOrientation == Qt::Horizontal ) { + qDebug() << "loading: " << docmlName << ", section: " << gLandscapeSectionName; + mDocumentLoader.load(docmlName, gLandscapeSectionName, &ok); + Q_ASSERT_X(ok, docmlName, "Invalid section in DocML file."); + } + + mIndicatorWidget->setIconColorType(SnsrIndicatorWidget::ThemedColorForActiveMode); + connectIndicatorWidgetToModel(); + + mDateLabel->setTextColorType(SnsrLabel::ThemedColorForActiveMode); + + mBackgroundContainerLayout->addItem(mMainView); + } +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockcontainer.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,422 @@ +/* +* Copyright (c) 2009-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: Base class container. +* +*/ + +#include "snsrbigclockcontainer.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef Q_OS_SYMBIAN +#include +#include +#endif //Q_OS_SYMBIAN + +#include "snsrbigclockcontainer.h" +#include "snsrindicatorwidget.h" +#include "snsrindicatormodel.h" +#include "snsrcolors.h" + +/*! + \class SnsrBigClockContainer + \ingroup group_snsrbigclockscreensaverplugin + \brief Base class. Container used for drawing background and for preparing layout. + */ + + + +const int gStep(5); + + +/*! + Constructs a new SnsrBigClockContainer. + */ +SnsrBigClockContainer::SnsrBigClockContainer() : + mBackgroundContainerLayout(0), + mMainView(0), + mMainContainer(0), + mIndicatorModel(0), + mIndicatorWidget(0), + mCurrentOrientation(-1) +{ + setBackgroundColor(); + mBackgroundContainerLayout = new QGraphicsLinearLayout(Qt::Vertical, this); + setLayout(mBackgroundContainerLayout); + qsrand(QTime::currentTime().msec()); + connect( mainWindow(), SIGNAL(aboutToChangeOrientation()), SLOT(fadeOutView()) ); +} + +/*! + Destructs the class. + */ +SnsrBigClockContainer::~SnsrBigClockContainer() +{ + // e.g. mIndicatorWidget gets deleted during this call + resetWidgets(); + + //mBackgroundContainerLayout - deleted by the parent + mIndicatorModel = 0; // not owned +} + +/*! + \fn virtual void update() = 0; + + Slot for members update in container e.g. when time or date changed. + */ + +/*! + Changes screensaver layout based on orientation changes. + \param orientation Current orientation. + */ +void SnsrBigClockContainer::changeLayout(Qt::Orientation orientation) +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockContainer::changeLayout") + + if (mCurrentOrientation != orientation) { + mCurrentOrientation = orientation; + + // delete any old widgets + if ( mBackgroundContainerLayout->count() ) { + mBackgroundContainerLayout->removeAt(0); + } + resetWidgets(); + + // reload widgets from docml + loadWidgets(); + + // register orientation effects for the newly loaded main view + HbEffect::add( mMainView, "notificationdialog_appear", "appear" ); + HbEffect::add( mMainView, "notificationdialog_disappear", "disappear" ); + } + mBackgroundContainerLayout->setGeometry( mainWindow()->layoutRect() ); + update(); + + // Run the fade-in effect, except if this container is a low-power one. + // In low-power mode, animations don't look good because of reduced + // color-depth and refresh rate. + if ( displayPowerMode() == Screensaver::ScreenModeFullPower ) { + HbEffect::start( mMainView, "appear" ); + } + + SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockContainer::changeLayout") +} + +/*! + Set used indicator model that is owned by the screensaver class. + Model's life cycle must be the same as screensaver's so that indicators' + status data can be kept in memory and one can receive updates. + This method should be called when the current container is set. + */ +void SnsrBigClockContainer::setIndicatorModel(SnsrIndicatorModel &model) +{ + mIndicatorModel = &model; +} + +/*! + @copydoc Screensaver::currentPowerMode() + */ +Screensaver::ScreenPowerMode SnsrBigClockContainer::displayPowerMode() +{ + // The default implementation returns full power mode. Inherited classes + // must override this if low power or display off mode are required. + return Screensaver::ScreenModeFullPower; +} + +/*! + @copydoc Screensaver::getActiveScreenRows() + */ +void SnsrBigClockContainer::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) +{ + // This default implementation return the whole area of the + // container. Inherited low power mode containers can and should + // return smaller area which just barely encloses all the content. + if ( mMainContainer ) { + QRect mainRect = mMainContainer->rect().toRect(); + if ( mCurrentOrientation == Qt::Vertical ) { + *firstActiveRow = mainRect.top(); + *lastActiveRow = mainRect.bottom(); + } + else { + *firstActiveRow = mainRect.left(); + *lastActiveRow = mainRect.right(); + } + } +} + +/*! + Tell if this container wants to lock the screen orientation. + Default implementation in not locked but inherited classes may + override this. + */ +bool SnsrBigClockContainer::isOrientationLocked() +{ + return false; +} + +/*! + \fn virtual int updateIntervalInMilliseconds() = 0; + + Concrete inherited container classes must implement this to return + the desired update interval for that clock mode. + */ + +/*! + \fn virtual int loadWidgets() = 0; + + Concrete inherited container classes must implement this to instantiate + all the widgets shown in the container. The base class calls this + method when screen layuot is changed. The old widgets are already + deleted by the base class before this is called. Also changing the visible + container is treated as a layout change, and results in call to this method. + Thus, inherited containers don't have to load their widgets yet in their + constructors. + */ + +/*! + \reimp + */ +void SnsrBigClockContainer::changeEvent(QEvent *event) +{ + if (event->type() == HbEvent::ThemeChanged) { + setBackgroundColor(); + } + return QGraphicsWidget::changeEvent(event); +} + +/*! + Returns random point for given range. + \param rect Area within which the generated point will be. + */ +QPointF SnsrBigClockContainer::randomPosition(const QRectF &rect) +{ + int width( rect.width() ); + int height( rect.height() ); + if ( width > 0 && height > 0 ) { + return rect.topLeft() + QPointF( qrand()%width, qrand()%height ); + } + else { + return QPointF(); + } + +} + +/*! + Returns new position between curRect position and destPos position. + \param curPos Current position. + \param destPos Destination position. When current position is near this + position or outside of the container, a new value is generated. + \param containerRect The container within which the destination position will always + be after a call. + */ +QPointF SnsrBigClockContainer::nextRandomPosition(const QPointF &curPos, QPointF &destPos, const QRectF &containerRect) +{ + const int delta(gStep+2); + const int minCntDimension(3*delta); + + // The random movement logic can work only if the container has enough space to move the + // clock around. If the container is too small, just return the middle point of the container. + if ( containerRect.width() < minCntDimension && containerRect.height() < minCntDimension ) { + return containerRect.center(); + } + + int xDistance = abs( destPos.x() - curPos.x() ); + int yDistance = abs( destPos.y() - curPos.y() ); + + // Generate new destination position when current widget position is close to + // destination random position or when current destination position is out of bounds. + // It is possible that the new random position is very close to the current position, + // in which case the random position is generated again. + // It is paramount that container is large enough when next loop is entered + // to prevent infinite looping. + while ( (xDistance < delta && yDistance < delta) + || !containerRect.contains(destPos) ) { + destPos = randomPosition( containerRect ); + xDistance = abs( destPos.x() - curPos.x() ); + yDistance = abs( destPos.y() - curPos.y() ); + } + + // If, for some reason, the current position is out-of-bounds, then there's no + // point to slowly move towards the destination. In that case, move immediately + // to destination point. + if ( !containerRect.contains(curPos) ) { + return destPos; + } + // Otherwise, this is normal case and we will calculate a point which is just + // a bit closer to the destination. + + // Version 1: + // o-----o---------------------------o + // p1 p2 p3 + // + // Version 2: + // o---------------------------o-----o + // p3 p2 p1 + // + // p1 - current widget position + // p2 - next position to compute + // p3 - destination random position + QPointF p1(curPos); + QPointF p2(0,0); + QPointF p3(destPos); + + // Computes point p2 - new position between p1 and p3 + + // Move the coordinate which is further away from the destination + // and calculate the other coordinate from that so that the + // result point p2 lies on the straigth line between p1 and p3. + if ( yDistance > xDistance ) { + if (p3.y() > p1.y()) { + p2.setY(p1.y()+gStep); + } + else { + p2.setY(p1.y()-gStep); + } + p2.setX((((p2.y()-p1.y())*(p3.x()-p1.x())) / (p3.y()-p1.y())) + p1.x()); // x2 = (((y2-y1)*(x3-x1)) / (y3-y1)) + x1 + } + else { + if (p3.x() > p1.x()) { + p2.setX(p1.x()+gStep); + } + else { + p2.setX(p1.x()-gStep); + } + p2.setY((((p3.y()-p1.y())*(p2.x()-p1.x())) / (p3.x()-p1.x())) + p1.y()); // y2 = (((y3-y1)*(x2-x1)) / (x3-x1)) + y1 + } + + // Return new position between points p1 and p3. + return p2; +} + +/*! + Do necessary initializations to show currently active indicators. + Should be called after the indicator widget is created. + */ +void SnsrBigClockContainer::connectIndicatorWidgetToModel() +{ + Q_ASSERT(mIndicatorModel && mIndicatorWidget); + + connect(mIndicatorModel, SIGNAL(indicatorsUpdated(QList)), + mIndicatorWidget, SLOT(showIndicators(QList))); + + connect(mIndicatorModel, SIGNAL(allIndicatorsDeactivated()), + mIndicatorWidget, SLOT(removeAllIndicators())); + + mIndicatorModel->initializeIndicatorWidget(); +} + +/*! + Disconnect connections between indicator model and widget. + Should be called before deleting the indicator widget. + */ +void SnsrBigClockContainer::resetIndicatorConnections() +{ + if (mIndicatorWidget && mIndicatorModel) { + disconnect(mIndicatorModel, SIGNAL(indicatorsUpdated(QList)), + mIndicatorWidget, SLOT(showIndicators(QList))); + + disconnect(mIndicatorModel, SIGNAL(allIndicatorsDeactivated()), + mIndicatorWidget, SLOT(removeAllIndicators())); + } +} + +/*! + Destroy all the contained widgets + */ +void SnsrBigClockContainer::resetWidgets() +{ + // deregister effects + if ( mMainView ) { + HbEffect::remove( mMainView ); + } + + mDocumentLoader.reset(); + qDeleteAll(mDocumentObjects); + mDocumentObjects.clear(); +} + +/*! + Set background color. + */ +void SnsrBigClockContainer::setBackgroundColor() +{ + mBackgroundColor = SnsrColors::BackgroundColor; +} + + +/* + * Returns true if swipe widget is used, + * false if swipe is not used. + */ +bool SnsrBigClockContainer::swipeToUnlockSupported() +{ +#ifdef Q_OS_SYMBIAN + XQSettingsManager::Error error; + int swipeWidget = 0; + XQCentralRepositorySettingsKey settingsKey( + KCRUidScreensaverSettings.iUid, KScreensaverSwipeToOpen ); + XQSettingsManager settingsManager; + swipeWidget = settingsManager.readItemValue(settingsKey, XQSettingsManager::TypeInt).toInt(); + error = settingsManager.error(); + if (error == XQSettingsManager::NoError && swipeWidget == 1) { + return true; + } + else { + return false; + } +#else + return true; +#endif //Q_OS_SYMBIAN +} + +/*! + Paints the contents of an item in local coordinates. + */ +#ifdef COVERAGE_MEASUREMENT +#pragma CTC SKIP +#endif //COVERAGE_MEASUREMENT +void SnsrBigClockContainer::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget + ) +{ + Q_UNUSED(option) + Q_UNUSED(widget) + + painter->fillRect(rect(), mBackgroundColor); +} +#ifdef COVERAGE_MEASUREMENT +#pragma CTC ENDSKIP +#endif //COVERAGE_MEASUREMENT + +/*! + Run the fade-out transition effect. + */ +void SnsrBigClockContainer::fadeOutView() +{ + // there's no point in animating the fade-out in the low-power mode + if ( mMainView && displayPowerMode() == Screensaver::ScreenModeFullPower ) { + HbEffect::start( mMainView, "disappear" ); + } +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaver.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,362 @@ +/* +* Copyright (c) 2009 - 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: Big clock Screensaver. +* +*/ + +#include "snsrbigclockscreensaver.h" + +#ifdef Q_OS_SYMBIAN +#include +#include +#include +#endif // Q_OS_SYMBIAN + +#include +#include +#include +#include +#include + +#include "snsranalogclockcontainer.h" +#include "snsrdigitalclockcontainer.h" +#include "snsroledanalogclockcontainer.h" +#include "snsroleddigitalclockcontainer.h" +#include "snsrblankcontainer.h" +#include "snsrindicatormodel.h" + +/*! + \class SnsrBigClockScreensaver + \ingroup group_snsrbigclockscreensaverplugin + \brief Screensaver with big digital clock. + */ + +/*! + Constructs a new SnsrBigClockScreensaver. + */ +SnsrBigClockScreensaver::SnsrBigClockScreensaver() : + mMainWindow(0), + mCurrentContainer(0), + mIndicatorModel(0) +{ + mMainWindow = HbInstance::instance()->allMainWindows().at(0); + // for nice looking clock hand transformations + mMainWindow->setRenderHint(QPainter::SmoothPixmapTransform); + + // This model holds indicator status information and must exist as + // long as screensaver does. + mIndicatorModel = new SnsrIndicatorModel(this); +} + +/*! + Destructs the class. + */ +SnsrBigClockScreensaver::~SnsrBigClockScreensaver() +{ + // TODO: unlock orientation once the locking mechanism is available and used + // mCurrentContainer, mIndicatorModel - deleted by the parent +} + +/*! + @copydoc Screensaver::onInitialize() +*/ +bool SnsrBigClockScreensaver::onInitialize() +{ + qDebug() << "SnsrBigClockScreensaver::onInitialize()"; + return true; +} + +/*! + @copydoc Screensaver::onForeground() + */ +bool SnsrBigClockScreensaver::onForeground() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onForeground") + qDebug() << "SnsrBigClockScreensaver::onForeground()"; + + removeCurrentContainer(); + + SnsrBigClockContainer* newContainer( 0 ); + if (clockFormat() == ClockFormatAnalog) { + newContainer = new SnsrAnalogClockContainer(); + } + else { + newContainer = new SnsrDigitalClockContainer(); + } + + setCurrentContainer( newContainer ); + + SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onForeground") + return true; +} + +/*! + @copydoc Screensaver::onPartialForeground() + */ +bool SnsrBigClockScreensaver::onPartialForeground() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onPartialForeground") + qDebug() << "SnsrBigClockScreensaver::onPartialForeground()"; + + removeCurrentContainer(); + + SnsrBigClockContainer* newContainer( 0 ); + +#ifdef Q_OS_SYMBIAN + // Check ScreensaverStatus from repository + XQSettingsManager::Error error; + XQCentralRepositorySettingsKey settingsKey( + KCRUidScreensaverSettings.iUid, KScreensaverStatus ); // TUid as same repository used in control panel via Symbian APIs + XQSettingsManager setManager; + int screensaverOn = setManager.readItemValue(settingsKey, XQSettingsManager::TypeInt).toInt(); + error = setManager.error(); + if (error != XQSettingsManager::NoError) { + qDebug("Error reading value from XQSettingsManager.. error = %d", error); + } +#else + int screensaverOn = 1; +#endif // Q_OS_SYMBIAN + + if (screensaverOn) { + if (clockFormat() == ClockFormatAnalog) { + newContainer = new SnsrOledAnalogClockContainer(); + } + else { + newContainer = new SnsrOledDigitalClockContainer(); + } + } + else { + newContainer = new SnsrBlankContainer(); + } + + setCurrentContainer( newContainer ); + + SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onPartialForeground") + return true; +} + +/*! + @copydoc Screensaver::onBackground() + */ +bool SnsrBigClockScreensaver::onBackground() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onBackground") + qDebug() << "SnsrBigClockScreensaver::onBackground()"; + + removeCurrentContainer(); + + SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onBackground") + return true; +} + +/*! + @copydoc Screensaver::onPowerSave() + */ +bool SnsrBigClockScreensaver::onPowerSave() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onPowerSave") + qDebug() << "SnsrBigClockScreensaver::onPowerSave()"; + + SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onPowerSave") + return false; +} + +/*! + @copydoc Screensaver::onClose() + */ +bool SnsrBigClockScreensaver::onClose() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onClose") + qDebug() << "SnsrBigClockScreensaver::onClose()"; + + bool ret(false); + if (onBackground()) { + delete mCurrentContainer; + mCurrentContainer = 0; + ret = true; + } + + SCREENSAVER_TEST_FUNC_EXIT("SnsrBigClockScreensaver::onClose") + return ret; +} + +/*! + @copydoc Screensaver::onHandleActiveIndicators + */ +void SnsrBigClockScreensaver::onHandleActiveIndicators( + const QList &activeIndicators) +{ + mIndicatorModel->handleActiveIndicators(activeIndicators); +} + +/*! + @copydoc Screensaver::onHandleActivatedIndicator + */ +void SnsrBigClockScreensaver::onHandleActivatedIndicator( + HbIndicatorInterface *activatedIndicator) +{ + mIndicatorModel->handleActivatedIndicator(activatedIndicator); +} + +/*! + @copydoc Screensaver::onHandleDeactivatedIndicator + */ +void SnsrBigClockScreensaver::onHandleDeactivatedIndicator( + HbIndicatorInterface *deactivatedIndicator) +{ + mIndicatorModel->handleDeactivatedIndicator(deactivatedIndicator); +} + +/*! + @copydoc Screensaver::currentPowerMode + */ +Screensaver::ScreenPowerMode SnsrBigClockScreensaver::currentPowerMode() +{ + Screensaver::ScreenPowerMode mode( Screensaver::ScreenModeFullPower ); + if ( mCurrentContainer ) { + mode = mCurrentContainer->displayPowerMode(); + } + else { + qWarning() << "No current container when current power mode queried."; + } + return mode; +} + +/*! + @copydoc Screensaver::getActiveScreenRows + */ +void SnsrBigClockScreensaver::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) +{ + if ( mCurrentContainer ) { + mCurrentContainer->getActiveScreenRows( firstActiveRow, lastActiveRow ); + } + else { + qWarning() << "No current container when active rows queried."; + } +} + +/*! + @copydoc Screensaver::updateLayout + */ +void SnsrBigClockScreensaver::updateLayout() +{ + if ( mCurrentContainer ) { + if ( mCurrentContainer->isOrientationLocked() ) { + // TODO: There is currently no way for device dialog to lock the display orientation. + // Orbit team has a backlog item about "global orientation lock" which could be + // used here when it is available. + } + else { + // TODO: There is currently no way for device dialog to lock the display orientation. + // Orbit team has a backlog item about "global orientation lock" which could be + // used here when it is available. + } + mCurrentContainer->changeLayout( mMainWindow->orientation() ); + } + else { + qWarning() << "No current container when updateLayout called."; + } +} + +/*! + Update clock time when timer is triggered + */ +void SnsrBigClockScreensaver::updateTime() +{ + if ( mCurrentContainer ) { + mCurrentContainer->update(); + + // Move the active area of display device if current container uses the power save mode. + if ( mCurrentContainer->displayPowerMode() == Screensaver::ScreenModeLowPower ) { + emit activeAreaMoved(); + } + + // Ensure correct update interval is used. First timed update may be done + // with timeout differing from the normal update rate. + int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); + if ( updateInterval > 0 ) { + mTimer.setInterval( updateInterval ); + } + } +} + +/*! + Determines the curent clock format settings. + \retval ClockFormat. + */ +SnsrBigClockScreensaver::ClockFormat SnsrBigClockScreensaver::clockFormat() +{ +#ifdef Q_OS_SYMBIAN + if (TLocale().ClockFormat() == EClockAnalog) { + return ClockFormatAnalog; + } else { + return ClockFormatDigital; + } +#else + // windows build - change the format every 30 seconds for testing purposes + if (QTime::currentTime().second() < 30) { + return ClockFormatAnalog; + } else { + return ClockFormatDigital; + } +#endif // Q_OS_SYMBIAN +} + +void SnsrBigClockScreensaver::removeCurrentContainer() +{ + if ( mCurrentContainer ) { + disconnect( + &mTimer, SIGNAL(timeout()), + this, SLOT(updateTime()) + ); + disconnect( + mCurrentContainer, SIGNAL(unlockRequested()), + this, SIGNAL(unlockRequested()) ); + if (mTimer.timerId()!= -1) { + mTimer.stop(); + } + emit viewChanged(0); + + delete mCurrentContainer; + mCurrentContainer = 0; + } +} + +void SnsrBigClockScreensaver::setCurrentContainer( SnsrBigClockContainer* newContainer ) +{ + mCurrentContainer = newContainer; + mCurrentContainer->setParent(this); + connect( &mTimer, SIGNAL(timeout()), SLOT(updateTime()) ); + connect( mCurrentContainer, SIGNAL(unlockRequested()), SIGNAL(unlockRequested()) ); + + mCurrentContainer->setIndicatorModel(*mIndicatorModel); + + int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); + + // In case the container needs an update seldomly (at maximum once per minute), + // align these updates with the even minutes by doing the first update on the + // next even minute. + const int minute = 60*1000; + if ( updateInterval >= minute ) { + updateInterval = minute - QTime::currentTime().second()*1000; + } + // container can use negative updateInteval value to indicate that no recurring + // updates are needed + if ( updateInterval > 0 ) { + mTimer.start(updateInterval); + } + + emit viewChanged(mCurrentContainer); +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaverplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaverplugin.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,90 @@ +/* +* 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: Big clock Screensaver plugin. +* +*/ + +#include +#include +#include + +#include +#include +#include + +#include "snsrbigclockscreensaverplugin.h" +#include "snsrbigclockscreensaver.h" + +const char *gBigClockInterfaceName = "com.nokia.screensaver.ISnsrBigClockScreensaver"; + +/*! + \class SnsrBigClockScreensaverPlugin + \ingroup group_snsrbigclockscreensaverplugin + \brief Screensaver big clock screensaver plugin collects ready-made screensaver clock. + */ + +#ifdef COVERAGE_MEASUREMENT +#pragma CTC SKIP +#endif //COVERAGE_MEASUREMENT + +/*! + \reimp + */ +QObject *SnsrBigClockScreensaverPlugin::createInstance( + const QServiceInterfaceDescriptor &descriptor, + QServiceContext *context, + QAbstractSecuritySession *session) +{ + Q_UNUSED(context); + Q_UNUSED(session); + + if (descriptor.interfaceName() == QLatin1String(gBigClockInterfaceName)) { + LoadTranslator(); + return new SnsrBigClockScreensaver(); + } + return 0; +} + + +/*! + Loads a translator. + */ +void SnsrBigClockScreensaverPlugin::LoadTranslator() +{ + QString locale = QLocale::system().name(); + QString filename = QString("snsrbigclockscreensaverplugin_%1").arg(locale); + QTranslator *translator = new QTranslator(this); +#ifdef Q_OS_SYMBIAN + bool loaded(false); + // TRAP is must here, otherwise it crashes + TRAP_IGNORE( + loaded = translator->load(filename, + QString("z:/resource/qt/translations")); + if (!loaded) { + loaded = translator->load(filename, + QString("c:/resource/qt/translations")); + } + ); +#else + translator->load(filename, QString("resource/qt/translations") ); +#endif //Q_OS_SYMBIAN + + qApp->installTranslator(translator); +} + +Q_EXPORT_PLUGIN2(snsrbigclockscreensaverplugin, SnsrBigClockScreensaverPlugin) + +#ifdef COVERAGE_MEASUREMENT +#pragma CTC ENDSKIP +#endif //COVERAGE_MEASUREMENT diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrblankcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrblankcontainer.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Container for blank screen. +* +*/ + +#include "snsrblankcontainer.h" + +/*! + \class SnsrBlankContainer + \ingroup group_snsrbigclockscreensaverplugin + \brief Container used for preparing layout for blank screen. + */ + +/*! + Constructs a new SnsrBlankContainer. + */ +SnsrBlankContainer::SnsrBlankContainer() : + SnsrBigClockContainer() +{ +} + +/*! + Destructs the class. + */ +SnsrBlankContainer::~SnsrBlankContainer() +{ +} + +/*! + @copydoc SnsrBigClockContainer::update() + */ +void SnsrBlankContainer::update() +{ + // nothing to do +} + +/*! + @copydoc SnsrBigClockContainer::displayPowerMode() + */ +Screensaver::ScreenPowerMode SnsrBlankContainer::displayPowerMode() +{ + return Screensaver::ScreenModeOff; +} + +/*! + @copydoc SnsrBigClockContainer::updateIntervalInMilliseconds() + */ +int SnsrBlankContainer::updateIntervalInMilliseconds() +{ + // don't start timer + return -1; +} + +/*! + @copydoc SnsrBigClockContainer::loadWidgets() + */ +void SnsrBlankContainer::loadWidgets() +{ + // nothing to do as we have no visual components +} + +// end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrdigitalclockcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrdigitalclockcontainer.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2009-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: Container for digital clock. +* +*/ + +#include "snsrdigitalclockcontainer.h" + +#include +#include +#include + +#include +#include + +#include "snsrswipewidget.h" +#include "snsrindicatorwidget.h" +#include "snsrlabel.h" + +/*! + \class SnsrDigitalClockContainer + \ingroup group_snsrbigclockscreensaverplugin + \brief Container used for preparing layout for digital clock. + */ + +const char *gDigitalLayoutDocml = ":/xml/snsrbigclockscreensaverdigital.docml"; +const char *gSwipeDigitalLayoutDocml = ":/xml/snsrbigclockscreensaverdigitalswipe.docml"; + +extern const char *gPortraitSectionName; +extern const char *gLandscapeSectionName; + +extern const char *gMainViewName; + +const char *gTimeLabelName = "timeLabel"; +const char *gAmPmLabelName = "amPmLabel"; +extern const char *gDateLabelName; + +extern const char *gDateFormatStr; + +// This is same as r_qtn_time_usual_with_zero defined in +// hbi18ndef.h expect am/pm place holders are removed. +const char *gTimeFormatStr = "%:0%J%:1%T%:3"; + +extern const char *gIndicatorWidgetName; +extern const char *gSwipeWidgetName; + + +/*! + Constructs a new SnsrDigitalClockContainer. + */ +SnsrDigitalClockContainer::SnsrDigitalClockContainer() : + SnsrBigClockContainer(), + mTimeLabel(0), + mAmPmLabel(0), + mDateLabel(0), + mSwipeWidget(0) +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrDigitalClockContainer::SnsrDigitalClockContainer") + SCREENSAVER_TEST_FUNC_EXIT("SnsrDigitalClockContainer::SnsrDigitalClockContainer") +} + +/*! + Destructs the class. + */ +SnsrDigitalClockContainer::~SnsrDigitalClockContainer() +{ + resetIndicatorConnections(); + //mTimeLabel, mAmPmLabel, mDateLabel - deleted by the parent +} + +/*! + Updates displayed time and date. + */ +void SnsrDigitalClockContainer::update() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrDigitalClockContainer::update") + + HbExtendedLocale locale = HbExtendedLocale::system(); + + // time + // Even though the format string (hh:mm) contain the leading zero, it's + // removed always when clock type is 12h -> h:mm. + + // TODO: within this method call, you find a comment in code that + // it's intentional to remove leading zero always with 12h type clock. + // However it seems to be recommended to use hbExtendedLocale to get + // proper time formatting for all locales and settings.. + mTimeLabel->setPlainText( + locale.format(QTime::currentTime(), gTimeFormatStr) + ); + + QString amPmString(""); + if (locale.timeStyle() == HbExtendedLocale::Time12 ) { + amPmString = (QTime::currentTime().hour()<12) ? locale.amText() : locale.pmText(); + } + mAmPmLabel->setPlainText( amPmString ); + + // date + mDateLabel->setPlainText( + locale.format(QDate::currentDate(), gDateFormatStr) + ); + + if (mSwipeWidget) { + mSwipeWidget->setCurrentOrientation(mCurrentOrientation); + } + + SCREENSAVER_TEST_FUNC_EXIT("SnsrDigitalClockContainer::update") +} + +/*! + @copydoc SnsrBigClockContainer::updateIntervalInMilliseconds() + */ +int SnsrDigitalClockContainer::updateIntervalInMilliseconds() +{ + return 1000; +} + +/*! + @copydoc SnsrBigClockContainer::loadWidgets() + */ +void SnsrDigitalClockContainer::loadWidgets() +{ + //if swipe is used we load the docml file containing it + if ( swipeToUnlockSupported() ) { + loadWidgets(gSwipeDigitalLayoutDocml); + Q_ASSERT_X( mSwipeWidget, gSwipeDigitalLayoutDocml, "Swipe widget not found in DocML file."); + connect( mSwipeWidget, SIGNAL(swipeDownDetected()), SIGNAL(unlockRequested()) ); + } + else { + loadWidgets(gDigitalLayoutDocml); + } +} + +/*! + Instantiate widgets from the given docml file + */ +void SnsrDigitalClockContainer::loadWidgets(const char* docmlName) +{ + bool ok(true); + + // reset widget pointers, any previous widgets are already deleted by now + mMainView = 0; + mDateLabel = 0; + mTimeLabel = 0; + mAmPmLabel = 0; + mIndicatorWidget = 0; + mSwipeWidget = 0; + // load widgets from docml + qDebug() << docmlName; + mDocumentObjects = mDocumentLoader.load(docmlName, &ok); + Q_ASSERT_X(ok, docmlName, "Invalid DocML file."); + if (ok) { + mMainView = mDocumentLoader.findWidget(gMainViewName); + mDateLabel = qobject_cast( + mDocumentLoader.findWidget(gDateLabelName)); + mTimeLabel = qobject_cast( + mDocumentLoader.findWidget(gTimeLabelName)); + mAmPmLabel = qobject_cast( + mDocumentLoader.findWidget(gAmPmLabelName)); + mIndicatorWidget = qobject_cast( + mDocumentLoader.findWidget(gIndicatorWidgetName)); + mSwipeWidget = qobject_cast( + mDocumentLoader.findWidget(gSwipeWidgetName)); + + Q_ASSERT_X( + mMainView && mDateLabel && mTimeLabel && mAmPmLabel && + mIndicatorWidget, + docmlName, "Objects not found in DocML file." + ); + + // In case of landscape layout, read also the landscape delta section + if ( mCurrentOrientation == Qt::Horizontal ) { + qDebug() << "loading: " << docmlName << ", section: " << gLandscapeSectionName; + mDocumentLoader.load(docmlName, gLandscapeSectionName, &ok); + Q_ASSERT_X(ok, docmlName, "Invalid section in DocML file."); + } + + mIndicatorWidget->setIconColorType(SnsrIndicatorWidget::ThemedColorForActiveMode); + connectIndicatorWidgetToModel(); + + mDateLabel->setTextColorType(SnsrLabel::ThemedColorForActiveMode); + mTimeLabel->setTextColorType(SnsrLabel::ThemedColorForActiveMode); + mAmPmLabel->setTextColorType(SnsrLabel::ThemedColorForActiveMode); + + mBackgroundContainerLayout->addItem(mMainView); + } +} + diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2009-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: Screensaver custom document loader. +* +*/ + +#include "snsrdocumentloader.h" + +#include "snsranalogclockwidget.h" +#include "snsroledclockwidget.h" +#include "snsrlabel.h" +#include "snsrindicatorwidget.h" +#include "snsroledtimelabel.h" +#include "snsrswipewidget.h" + +/*! + \class SnsrDocumentLoader + \ingroup group_snsrbigclockscreensaverplugin + \brief Custom screensaver docml layout loader. + + Used to create the widgets from docml. + */ + +/*! + Creates the requested widget. + \param type Static type name. + \param name Object name. + \retval Created object. + */ +QObject *SnsrDocumentLoader::createObject(const QString &type, const QString &name) +{ + if (type == SnsrAnalogClockWidget::staticMetaObject.className()) { + QObject *object = new SnsrAnalogClockWidget(); + object->setObjectName(name); + return object; + } + + if (type == SnsrOledClockWidget::staticMetaObject.className()) { + QObject *object = new SnsrOledClockWidget(); + object->setObjectName(name); + return object; + } + + if (type == SnsrLabel::staticMetaObject.className()) { + QObject *object = new SnsrLabel(); + object->setObjectName(name); + return object; + } + + if (type == SnsrIndicatorWidget::staticMetaObject.className()) { + QObject *object = new SnsrIndicatorWidget(); + object->setObjectName(name); + return object; + } + + if (type == SnsrOledTimeLabel::staticMetaObject.className()) { + QObject *object = new SnsrOledTimeLabel(); + object->setObjectName(name); + return object; + } + + if (type == SnsrSwipeWidget::staticMetaObject.className()) { + QObject *object = new SnsrSwipeWidget(); + object->setObjectName(name); + return object; + } + + return HbDocumentLoader::createObject(type, name); +} diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsroledanalogclockcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsroledanalogclockcontainer.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2009 - 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: Container for oled analog clock. +* +*/ + +#include "snsroledanalogclockcontainer.h" + +#include +#include +#include +#include +#include +#include + +#include "snsroledclockwidget.h" +#include "snsrindicatorwidget.h" +#include "snsrlabel.h" + +/*! + \class SnsrOledAnalogClockContainer + \ingroup group_snsrbigclockscreensaverplugin + \brief Container used for preparing layout for oled analog clock. + */ + +const char *gOledAnalogLayoutDocml = ":/xml/snsrbigclockscreensaveroledanalog.docml"; +extern const char *gPortraitSectionName; +extern const char *gLandscapeSectionName; + +extern const char *gMainViewName; +extern const char *gMainContainerName; +extern const char *gClockContainerName; +extern const char *gIndicatorWidgetName; + +extern const char *gDateLabelName; +extern const char *gDateFormatStr; + +const char *gOledAnalogClockWidgetName = "oledAnalogClockWidget"; + + +/*! + Constructs a new SnsrOledAnalogClockContainer. + */ +SnsrOledAnalogClockContainer::SnsrOledAnalogClockContainer() : + SnsrBigClockContainer(), mClockContainer(0), mOledClockWidget(0), + mDateLabel(0), mDestPosition(QPointF()), mInitialize(false) +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledAnalogClockContainer::SnsrOledAnalogClockContainer") + SCREENSAVER_TEST_FUNC_EXIT("SnsrOledAnalogClockContainer::SnsrOledAnalogClockContainer") +} + +/*! + Destructs the class. + */ +SnsrOledAnalogClockContainer::~SnsrOledAnalogClockContainer() +{ + resetIndicatorConnections(); + //mOledClockWidget etc - deleted by the parent +} + +/*! + Updates OLED analog clock widget position. + */ +void SnsrOledAnalogClockContainer::updatePosition() +{ + QSizeF containerSize = mMainContainer->size(); + + // Container must have a valid size to enable calculating the + // destination position for the clock. + if ( containerSize.width() > 0 && containerSize.height() > 0 ) { + containerSize -= mClockContainer->size(); + QRectF containerRect( mMainContainer->pos(), containerSize ); + if ( mInitialize ) { + // disconnect container from parent layout, + // connected container resets its position to the one defined in docml + // after label text updates + mClockContainer->setParentLayoutItem(0); + + QPointF clockPos = nextRandomPosition( mClockContainer->pos(), mDestPosition, containerRect ); + mClockContainer->setPos( clockPos ); + } + else { + mDestPosition = randomPosition( containerRect ); + mInitialize = true; + } + } +} + +/*! + Updates displayed time. + */ +void SnsrOledAnalogClockContainer::update() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledAnalogClockContainer::update") + + // time + mOledClockWidget->tick(); + + // date + mDateLabel->setPlainText( + HbExtendedLocale().format(QDate::currentDate(), gDateFormatStr) + ); + + // position + updatePosition(); + + SCREENSAVER_TEST_FUNC_EXIT("SnsrOledAnalogClockContainer::update") +} + +int SnsrOledAnalogClockContainer::updateIntervalInMilliseconds() +{ + return 60*1000; +} + +/*! + @copydoc Screensaver::DisplayPowerMode() + */ +Screensaver::ScreenPowerMode SnsrOledAnalogClockContainer::displayPowerMode() +{ + return Screensaver::ScreenModeLowPower; +} + +/*! + @copydoc SnsrBigClockContainer::getActiveScreenRows() + */ +void SnsrOledAnalogClockContainer::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) +{ + if ( mClockContainer ) { + QRect clockRect( mClockContainer->pos().toPoint(), + mClockContainer->size().toSize() ); + if ( mCurrentOrientation == Qt::Vertical ) { + *firstActiveRow = clockRect.top(); + *lastActiveRow = clockRect.bottom() + 1; + } + else { + *firstActiveRow = clockRect.left(); + *lastActiveRow = clockRect.right() + 1; + } + } +} + +/*! + Orientation is locked in power save mode as sensors are off anyway, + at least after some timeout. + */ +bool SnsrOledAnalogClockContainer::isOrientationLocked() +{ + return true; +} + +void SnsrOledAnalogClockContainer::loadWidgets() +{ + bool ok(true); + + // reset widget pointers, any previous widgets are already deleted by now + mMainView = 0; + mMainContainer = 0; + mClockContainer = 0; + mOledClockWidget = 0; + mDateLabel = 0; + mIndicatorWidget = 0; + mInitialize = false; + + // load widgets from docml + qDebug() << gOledAnalogLayoutDocml; + mDocumentObjects = mDocumentLoader.load(gOledAnalogLayoutDocml, &ok); + Q_ASSERT_X(ok, gOledAnalogLayoutDocml, "Invalid DocML file."); + if (ok) { + mMainView = mDocumentLoader.findWidget(gMainViewName); + mMainContainer = mDocumentLoader.findWidget(gMainContainerName); + mClockContainer = mDocumentLoader.findWidget(gClockContainerName); + mOledClockWidget = qobject_cast( + mDocumentLoader.findWidget(gOledAnalogClockWidgetName)); + mDateLabel = qobject_cast( + mDocumentLoader.findWidget(gDateLabelName)); + mIndicatorWidget = qobject_cast( + mDocumentLoader.findWidget(gIndicatorWidgetName)); + Q_ASSERT_X( + mMainView && mMainContainer && mClockContainer + && mOledClockWidget && mDateLabel && mIndicatorWidget, + gOledAnalogLayoutDocml, "Objects not found in DocML file." + ); + + // In case of landscape layout, read also the landscape delta section + if ( mCurrentOrientation == Qt::Horizontal ) { + qDebug() << "loading: " << gOledAnalogLayoutDocml << ", section: " << gLandscapeSectionName; + mDocumentLoader.load(gOledAnalogLayoutDocml, gLandscapeSectionName, &ok); + Q_ASSERT_X(ok, gOledAnalogLayoutDocml, "Invalid section in DocML file."); + } + + mIndicatorWidget->setIconColorType(SnsrIndicatorWidget::FixedColorForPowerSaveMode); + connectIndicatorWidgetToModel(); + + mDateLabel->setTextColorType(SnsrLabel::FixedColorForPowerSaveMode); + + mBackgroundContainerLayout->addItem(mMainView); + } +} + +// end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsroleddigitalclockcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsroleddigitalclockcontainer.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2009 - 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: Container for oled digital clock. +* +*/ + +#include "snsroleddigitalclockcontainer.h" + +#include +#include +#include +#include +#include +#include + +#include "snsrlabel.h" +#include "snsrindicatorwidget.h" +#include "snsroledtimelabel.h" + + +/*! + \class SnsrOledDigitalClockContainer + \ingroup group_snsrbigclockscreensaverplugin + \brief Container used for preparing layout for oled digital clock. + */ + +const char *gOledDigitalLayoutDocml = ":/xml/snsrbigclockscreensaveroleddigital.docml"; +extern const char *gPortraitSectionName; +extern const char *gLandscapeSectionName; + +extern const char *gMainViewName; +extern const char *gMainContainerName; +extern const char *gClockContainerName; + +extern const char *gOledTimeLabelName = "oledTimeLabel"; +extern const char *gAmPmLabelName; +extern const char *gDateLabelName; + +extern const char *gDateFormatStr; + +extern const char *gTimeFormatStr; + +extern const char *gIndicatorWidgetName; + + + +/*! + Constructs a new SnsrOledDigitalClockContainer. + */ +SnsrOledDigitalClockContainer::SnsrOledDigitalClockContainer() : + SnsrBigClockContainer(), mClockContainer(0), mAmPmLabel(0), + mTimeLabel(0), mDateLabel(0), mDestPosition(QPointF()), + mInitialize(false) +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledDigitalClockContainer::SnsrOledDigitalClockContainer") + SCREENSAVER_TEST_FUNC_EXIT("SnsrOledDigitalClockContainer::SnsrOledDigitalClockContainer") +} + +/*! + Destructs the class. + */ +SnsrOledDigitalClockContainer::~SnsrOledDigitalClockContainer() +{ + resetIndicatorConnections(); + //mTimeLabel, mAmPmLabel, mDateLabel, mMoveTimer - deleted by the parent +} + +/*! + Updates OLED digital clock widget position. + */ +void SnsrOledDigitalClockContainer::updatePosition() +{ + QSizeF containerSize = mMainContainer->size(); + + // Container must have a valid size to enable calculating the + // destination position for the clock. + if ( containerSize.width() > 0 && containerSize.height() > 0 ) { + containerSize -= mClockContainer->boundingRect().size(); + QRectF containerRect( mMainContainer->pos(), containerSize ); + if ( mInitialize ) { + // disconnect container from parent layout, + // connected container resets its position to the one defined in docml + // after label text updates + mClockContainer->setParentLayoutItem(0); + + QPointF clockPos = nextRandomPosition( mClockContainer->pos(), mDestPosition, containerRect ); + mClockContainer->setPos( clockPos ); + } + else { + mDestPosition = randomPosition( containerRect ); + mInitialize = true; + } + } +} + +/*! + Updates displayed time and date. + */ +void SnsrOledDigitalClockContainer::update() +{ + SCREENSAVER_TEST_FUNC_ENTRY("SnsrOledDigitalClockContainer::update") + + HbExtendedLocale locale = HbExtendedLocale::system(); + + // time + mTimeLabel->setText( + locale.format(QTime::currentTime(), gTimeFormatStr) + ); + + // don't use %B here as some extra space might be added if it's used as an + // isolated format string + QString amPmString(""); + if (locale.timeStyle() == HbExtendedLocale::Time12 ) { + amPmString = (QTime::currentTime().hour()<12) ? locale.amText() : locale.pmText(); + } + mAmPmLabel->setPlainText( amPmString ); + + // date + mDateLabel->setPlainText( + locale.format(QDate::currentDate(), gDateFormatStr) + ); + + updatePosition(); + + SCREENSAVER_TEST_FUNC_EXIT("SnsrOledDigitalClockContainer::update") +} + +int SnsrOledDigitalClockContainer::updateIntervalInMilliseconds() +{ + return 60*1000; +} + +/*! + @copydoc Screensaver::DisplayPowerMode() + */ +Screensaver::ScreenPowerMode SnsrOledDigitalClockContainer::displayPowerMode() +{ + return Screensaver::ScreenModeLowPower; +} + +/*! + @copydoc SnsrBigClockContainer::getActiveScreenRows() + */ +void SnsrOledDigitalClockContainer::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) +{ + if ( mClockContainer ) { + QRect clockRect( mClockContainer->pos().toPoint(), + mClockContainer->size().toSize() ); + if ( mCurrentOrientation == Qt::Vertical ) { + *firstActiveRow = clockRect.top(); + *lastActiveRow = clockRect.bottom() + 1; + } + else { + *firstActiveRow = clockRect.left(); + *lastActiveRow = clockRect.right() + 1; + } + } +} + +/*! + Orientation is locked in power save mode as sensors are off anyway, + at least after some timeout. + */ +bool SnsrOledDigitalClockContainer::isOrientationLocked() +{ + return true; +} + +void SnsrOledDigitalClockContainer::loadWidgets() +{ + // reset widget pointers, any previous widgets are already deleted by now + mMainView = 0; + mMainContainer = 0; + mClockContainer = 0; + mDateLabel = 0; + mTimeLabel = 0; + mAmPmLabel = 0; + mIndicatorWidget = 0; + mInitialize = false; + + // load widgets from docml + bool ok(false); + qDebug() << gOledDigitalLayoutDocml; + mDocumentObjects = mDocumentLoader.load(gOledDigitalLayoutDocml, &ok); + Q_ASSERT_X(ok, gOledDigitalLayoutDocml, "Invalid DocML file."); + + if (ok) { + mMainView = mDocumentLoader.findWidget(gMainViewName); + mMainContainer = mDocumentLoader.findWidget(gMainContainerName); + mClockContainer = mDocumentLoader.findWidget(gClockContainerName); + mDateLabel = qobject_cast( + mDocumentLoader.findWidget(gDateLabelName)); + mTimeLabel = qobject_cast( + mDocumentLoader.findWidget(gOledTimeLabelName)); + mAmPmLabel = qobject_cast( + mDocumentLoader.findWidget(gAmPmLabelName)); + mIndicatorWidget = qobject_cast( + mDocumentLoader.findWidget(gIndicatorWidgetName)); + Q_ASSERT_X( + mMainView && mMainContainer && mClockContainer + && mDateLabel && mTimeLabel && mAmPmLabel + && mIndicatorWidget, + gOledDigitalLayoutDocml, "Objects not found in DocML file." + ); + + // In case of landscape layout, read also the landscape delta section + if ( mCurrentOrientation == Qt::Horizontal ) { + qDebug() << "loading: " << gOledDigitalLayoutDocml << ", section: " << gLandscapeSectionName; + mDocumentLoader.load(gOledDigitalLayoutDocml, gLandscapeSectionName, &ok); + Q_ASSERT_X(ok, gOledDigitalLayoutDocml, "Invalid section in DocML file."); + } + + mIndicatorWidget->setIconColorType(SnsrIndicatorWidget::FixedColorForPowerSaveMode); + connectIndicatorWidgetToModel(); + + mDateLabel->setTextColorType(SnsrLabel::FixedColorForPowerSaveMode); + mAmPmLabel->setTextColorType(SnsrLabel::FixedColorForPowerSaveMode); + + mBackgroundContainerLayout->addItem(mMainView); + } +} + +// end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrplugins/snsrplugins.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/screensaver/snsrplugins/snsrplugins.pro Wed Oct 06 16:06:24 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 2009 - 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: snsrplugins.pro +# + +TEMPLATE = subdirs + +SUBDIRS += snsrbigclockscreensaverplugin + +CONFIG += ordered \ No newline at end of file diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrutils/inc/snsrlabel.h --- a/screensaver/snsrutils/inc/snsrlabel.h Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/snsrutils/inc/snsrlabel.h Wed Oct 06 16:06:24 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 - 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" @@ -32,10 +32,22 @@ public: + enum TextColorType + { + ThemedColorForActiveMode, + FixedColorForPowerSaveMode // = Qt::white + }; + +public: + SnsrLabel(QGraphicsItem *parent = 0); SnsrLabel(const QString &displayText, QGraphicsItem *parent = 0); ~SnsrLabel(); +public: + + void setTextColorType(const TextColorType &colorType); + protected: virtual void changeEvent(QEvent *event); @@ -43,6 +55,10 @@ private: void setThemedTextColor(); + +private: + + TextColorType mTextColorType; SCREENSAVER_TEST_FRIEND_CLASS(T_SnsrUtils) diff -r 32e56106abf2 -r 66b5fe3c07fd screensaver/snsrutils/src/snsrlabel.cpp --- a/screensaver/snsrutils/src/snsrlabel.cpp Mon Sep 27 11:52:00 2010 +0300 +++ b/screensaver/snsrutils/src/snsrlabel.cpp Wed Oct 06 16:06:24 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 - 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" @@ -16,11 +16,11 @@ */ #include "snsrlabel.h" +#include "snsrcolors.h" #include #include -const QString snsrForegroundColorRole("qtc_screensaver"); /*! \class SnsrLabel @@ -33,7 +33,7 @@ \param parent Graphics parent item. */ SnsrLabel::SnsrLabel(QGraphicsItem *parent) - : HbLabel(parent) + : HbLabel(parent), mTextColorType(ThemedColorForActiveMode) { setThemedTextColor(); } @@ -44,7 +44,8 @@ \param parent Graphics parent item. */ SnsrLabel::SnsrLabel(const QString &displayText, QGraphicsItem *parent) - : HbLabel(displayText, parent) + : HbLabel(displayText, parent), + mTextColorType(ThemedColorForActiveMode) { setThemedTextColor(); } @@ -57,11 +58,27 @@ } /*! + Set the coloring scheme to be used: fixed color for power save mode (white) or + themed color for active mode. + */ +void SnsrLabel::setTextColorType(const TextColorType &colorType) +{ + mTextColorType = colorType; + if (mTextColorType==FixedColorForPowerSaveMode) { + setTextColor(SnsrColors::PowerSaveModeWidgetColor); + } + else { + setThemedTextColor(); + } +} + +/*! \reimp */ void SnsrLabel::changeEvent(QEvent * event) { - if (event->type() == HbEvent::ThemeChanged) { + if (event->type() == HbEvent::ThemeChanged && + mTextColorType == ThemedColorForActiveMode) { setThemedTextColor(); } return HbLabel::changeEvent(event); @@ -72,7 +89,7 @@ */ void SnsrLabel::setThemedTextColor() { - QColor textColor(HbColorScheme::color(snsrForegroundColorRole)); + QColor textColor(HbColorScheme::color(SnsrColors::WidgetColorRole.latin1())); if (textColor.isValid()) { setTextColor(textColor); } else {