# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1283256928 -10800 # Node ID 90fe62538f66dab73f2558964d027439a264e950 # Parent 3fec62e6e7fcaa44c424083a77dc343bb1a9d773 Revision: 201029 Kit: 201035 diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/image/themePreview.nvg Binary file controlpanelplugins/themeplugin/image/themePreview.nvg has changed diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/rom/themeplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/rom/themeplugin.iby Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __THEMEPLUGIN_IBY__ +#define __THEMEPLUGIN_IBY__ + +#include +#include + +file=ABI_DIR\BUILD_DIR\cpthemeplugin.dll SHARED_LIB_DIR\cpthemeplugin.dll + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpthemeplugin.qtplugin resource\qt\plugins\controlpanel\cpthemeplugin.qtplugin + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/rom/themeplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/rom/themeplugin_rom.pri Tue Aug 31 15:15:28 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: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/themeplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(themeplugin.iby)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemechanger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include + +#include "cpthemechanger.h" +#include "cpthemeutil.h" +#include "cpthemeinfo.h" + +#include +#include + +/*! + \class CpThemeChanger + + \brief CpThemeChanger provides an interface for changing the current + theme. + This API is only for use with the control panel and its theme + changing plugin. +*/ + +/*! + Constructor. +*/ +CpThemeChanger::CpThemeChanger(QObject* p) : + QObject(p), + mCurrentTheme(0) +{ + if(hbInstance->theme()) { + connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished())); + } + + setCurrentTheme(); +} + +/*! + Returns a ThemeInfo object containing the current theme name and + corresponding icons. + + If no repersentative icons exist, the HbIcon returned will be + uninitialized. +*/ +const CpThemeInfo* CpThemeChanger::currentTheme() const +{ + return mCurrentTheme; +} + +/*! + * Private helper function that gets the current theme from hbinstance and s + * ets class' current theme. + */ +void CpThemeChanger::setCurrentTheme() +{ + QString themeName = ""; + if (HbInstance::instance()) { + HbTheme *hbTheme = HbInstance::instance()->theme(); + if(hbTheme) { + themeName = hbTheme->name(); + } + + } + + if(mCurrentTheme && mCurrentTheme->name() == themeName) { + return; + } else { + //buildThemeInfo creates new theme info. + CpThemeInfo* tmpTheme = CpThemeUtil::buildThemeInfo(HbThemeServices::themePath(), themeName); + + //delete old value. set the new value. + if(tmpTheme) { + if(mCurrentTheme){ + delete mCurrentTheme; + } + mCurrentTheme = tmpTheme; + } + } +} + + +/*! + Change a theme. Returns true on success, false otherwise. + */ +bool CpThemeChanger::changeTheme(const CpThemeInfo& newTheme) +{ + bool result = false; + // Skip doing this if the request is for the current theme + if (newTheme.name().isEmpty() || (mCurrentTheme && newTheme.name() == mCurrentTheme->name())) { + return result; + } + + QString themePath = newTheme.itemData(); + + if(!themePath.isEmpty()) { + HbThemeServices::setTheme(themePath); + result = true; + } + return result; +} + +/*! + Destructor + */ +CpThemeChanger::~CpThemeChanger() +{ + delete mCurrentTheme; + mCurrentTheme = 0; +} + +/*! + * Slot to handle notification from theme server that theme change + * is done. Notify the owner. + */ +void CpThemeChanger::changeFinished() +{ + setCurrentTheme(); + emit themeChangeFinished(); +} + +// End of file + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemechanger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMECHANGER_H +#define CPTHEMECHANGER_H + +#include + +#include +#include + +class CpThemeChangerPrivate; +class CpThemeInfo; + +QT_BEGIN_NAMESPACE +class QAbstractItemModel; +QT_END_NAMESPACE + +class CpThemeChanger : public QObject +{ + Q_OBJECT + +public: + explicit CpThemeChanger(QObject* parent=0); + ~CpThemeChanger(); + + const CpThemeInfo* currentTheme() const; + bool changeTheme(const CpThemeInfo& newtheme); + +signals: + void themeChangeFinished(); + +private slots: + void changeFinished(); + +private: + void setCurrentTheme(); + + CpThemeInfo* mCurrentTheme; +}; + + +#endif /* CPTHEMECHANGER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,317 @@ +/* + * 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: + * + */ + +/*! + \class CpThemeControl + \brief CpThemeControl creates and controls views for Theme Changer plugin and handles + user interaction to preview and change the themes. + + This class also connects to the theme server using the HbThemeChanger and sets the theme + based on user interaction with the views. + + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "cpthemechanger.h" + +#include "cpthemecontrol.h" +#include "cpthemelistview.h" +#include "cpthemeinfo.h" +#include "cpthemelistmodel.h" + +#include +#include + +//time out time before showing a processing dialog. +static const int KThemeChangeTimeOutMilliSeconds = 2000; + +/*! + Helper function to fetch the main window. +*/ +static HbMainWindow *mainWindow() +{ + QList< HbMainWindow* > mainWindows = hbInstance->allMainWindows(); + if (!mainWindows.isEmpty()) { + return mainWindows.front(); + } + return 0; +} + +/*! + constructor. +*/ +CpThemeControl::CpThemeControl(): mThemeListView(0), + mThemeChanger(0), + mListModel(0), + mThemeChangeFinished(false), + mWaitDialog(0) +{ + mThemeChanger = new CpThemeChanger(); + + QTranslator *translator = new QTranslator(this); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + translator->load("control_panel_" + lang, path); + qApp->installTranslator(translator); + + connect(mThemeChanger,SIGNAL(themeChangeFinished()), this, SLOT(themeChangeFinished())); + +} + + +/*! + destorys the list view and theme changer objects. +*/ +CpThemeControl::~CpThemeControl() +{ + delete mThemeListView; + mThemeListView = 0; + + delete mThemeChanger; + mThemeChanger = 0; + + delete mWaitDialog; + mWaitDialog = 0; +} + +/*! + Creates the theme list view. Gets the themes, creates a model and sets the list model. +*/ +void CpThemeControl::createThemeList() +{ + + mThemeListView = new CpThemeListView(); + + if(!mListModel) { + mListModel = new CpThemeListModel(this); + } + + // Set the model for theme list. + mThemeListView->setModel(mListModel); + + setActiveThemeIndex(); + + //connect to signal for selecting a list item. + connect(mThemeListView,SIGNAL(newThemeSelected(QModelIndex)), + this,SLOT(newThemeSelected(QModelIndex))); + + connect(mThemeListView, SIGNAL(oviClicked()), this, SLOT(getOviTheme())); + + //handle signal for list view closing. (e.g Back softkey pressed) + connect(mThemeListView,SIGNAL(aboutToClose()), + this,SLOT(themeListClosed())); +} + +/*! + returns the instance of themelist view. Used by control panel to set + the view. +*/ +CpBaseSettingView* CpThemeControl::themeListView() +{ + //If the view was removed before by control panel app, create it again. + if(!mThemeListView) { + createThemeList(); + } + + return mThemeListView; +} + +/*! + returns the name of the current theme. +*/ +QString CpThemeControl::currentThemeName() const +{ + QString name = ""; + if(mThemeChanger->currentTheme()) { + name = mThemeChanger->currentTheme()->name(); + } + return name; +} + +/*! + returns the repersenatative icon of the current theme. +*/ +HbIcon CpThemeControl::currentThemeIcon() const +{ + HbIcon icon; + if(mThemeChanger->currentTheme()) { + icon = mThemeChanger->currentTheme()->icon(); + } + return icon; +} + +/*! + Slot called when a list item of the theme list is selected. +*/ +void CpThemeControl::newThemeSelected(const QModelIndex& index) +{ + if(!index.isValid()) { + return; + } + + CpThemeInfo themeInfo; + QVariant data; + + //reset the current index to active theme, so that the selection remains on current + //theme even though another list item is selected. + setActiveThemeIndex(); + + //get the theme name. + data = index.data(Qt::DisplayRole); + if(data.isValid()) { + themeInfo.setName(data.toString()); + } + + //get theme path + data = index.data(CpThemeListModel::ItemDataRole); + if(data.isValid()) { + themeInfo.setItemData(data.toString()); + } + + applyTheme(themeInfo); + +} + +void CpThemeControl::getOviTheme() +{ + QString url = QString("http://lr.ovi.mobi/store/themes"); + // Launch the URL in the browser and + // continue to Preview if not successful + QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode)); + +} + +/*! + Slot called when a Select key is pressed in theme preview view. +*/ +void CpThemeControl::applyTheme(const CpThemeInfo& theme) +{ + QThread::currentThread()->setPriority(QThread::HighPriority); + + if(mThemeChanger->changeTheme(theme)) { + + //Start a timer. If theme change takes more than 1 seconds, + //we will show a dialog (mWaitDialog) until theme change + //is done (themeChangeFinished is called). + QTimer::singleShot(KThemeChangeTimeOutMilliSeconds, this, SLOT(themeWaitTimeout())); + + mThemeChangeFinished = false; + } else { + //theme change failed, go back to control panel. + setActiveThemeIndex(); + } + +} + +/*! + Slot for when the theme list view is closed. Ownership of the theme list was given to + control panel, so the class won't delete it. + +*/ +void CpThemeControl::themeListClosed() +{ + mThemeListView = 0; +} + +/*! + asks the theme list view to close. +*/ +void CpThemeControl::triggerThemeListClose() +{ + mThemeListView->closeView(); +} + +void CpThemeControl::themeChangeTimeout() +{ + //Theme change is finished and idle timer has timed out, + //so revert back the application priority to normal + //and go back to control panel view. + if(mWaitDialog && mWaitDialog->isVisible()) { + mWaitDialog->hide(); + } + setActiveThemeIndex(); + QThread::currentThread()->setPriority(QThread::NormalPriority); +} + +void CpThemeControl::themeWaitTimeout() +{ + //If after this timeOut, theme change is still in progress, + //show a processing dialog. + if(!mThemeChangeFinished){ + if(!mWaitDialog) { + mWaitDialog = new HbDialog(); + mWaitDialog->setDismissPolicy(HbPopup::NoDismiss); + mWaitDialog->setModal(false); + mWaitDialog->setTimeout(HbPopup::NoTimeout); + // Create and set HbLabel as content widget. + QString processingText = hbTrId("txt_common_info_processing") + QString("..."); + HbLabel *label = new HbLabel(processingText); + label->setAlignment(Qt::AlignCenter); + mWaitDialog->setContentWidget(label); + } + // as we do not need any signals, calling show() instead of open() + mWaitDialog->show(); + } +} + +void CpThemeControl::themeChangeFinished() +{ + //Theme change is done. Start an idle timer to let the UI + //finish remaining tasks. + QTimer::singleShot(0, this, SLOT(themeChangeTimeout())); + mThemeChangeFinished = true; + + if(mThemeChanger->currentTheme()) { + emit themeUpdated(mThemeChanger->currentTheme()->name(), mThemeChanger->currentTheme()->icon()); + } + +} + +/*! + * Private function that sets the current index of theme list view to indicate + * the active theme. + */ +void CpThemeControl::setActiveThemeIndex() +{ + //Get the index of current theme. + CpThemeListModel* themeListModel = dynamic_cast(mListModel); + const CpThemeInfo* currentTheme = mThemeChanger->currentTheme(); + if(themeListModel && currentTheme) { + QModelIndex sourceIndex = mListModel->index(themeListModel->indexOf(*currentTheme),0); + //set current index. + mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent); + } + else { + mThemeListView->themeList()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear); + } +} + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMECONTROL_H +#define CPTHEMECONTROL_H + +#include +#include + +#include "cpthemechanger.h" +#include + +QT_BEGIN_NAMESPACE +class QModelIndex; +class QString; +class QSortFilterProxyModel; +QT_END_NAMESPACE + +class HbDialog; +class CpThemeListView; +class CpBaseSettingView; +class CpThemeListModel; + + +class CpThemeControl : public QObject +{ + Q_OBJECT + +public: + CpThemeControl(); + ~CpThemeControl(); + CpBaseSettingView* themeListView(); + QString currentThemeName() const; + HbIcon currentThemeIcon() const; + +signals: + void themeUpdated(const QString& themeName, const HbIcon& icon); + +private slots: + void newThemeSelected(const QModelIndex& index); + void applyTheme(const CpThemeInfo& theme); + void themeListClosed(); + void themeChangeTimeout(); + void themeWaitTimeout(); + void themeChangeFinished(); + void getOviTheme(); + +private: + void createThemeList(); + void triggerThemeListClose(); + void setActiveThemeIndex(); + +private: + CpThemeListView* mThemeListView; + CpThemeChanger* mThemeChanger; + QAbstractItemModel* mListModel; + bool mThemeChangeFinished; + HbDialog* mWaitDialog; +}; + +#endif //CPTHEMECONTROL_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemeinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,102 @@ +/* + * 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: + * + */ + +/*! + * A simple class to represent theme information. This information includes: + * 1. Theme Name + * 2. Theme Preview Thumbnail + * 3. Theme Preview landscape and portrait icon + * 4. Theme list type: either an item representing a theme, or a link (e.g OviStore). + * 5. Item type data. Represents additional information (e.g for link type, the URL). + */ +#include + +#include "cpthemeinfo.h" + + CpThemeInfo::CpThemeInfo() +{ +} + + + CpThemeInfo::~CpThemeInfo() +{ +} + +QString CpThemeInfo::name() const +{ + return mName; +} + +void CpThemeInfo::setName(const QString& newName) +{ + mName = newName; +} + +CpThemeInfo::ThemeListItemType CpThemeInfo::itemType() const +{ + return mItemType; +} + +void CpThemeInfo::setItemType(CpThemeInfo::ThemeListItemType type) +{ + mItemType = type; +} + + +QString CpThemeInfo::itemData() const +{ + return mItemData; +} + +void CpThemeInfo::setItemData(const QString& data) +{ + mItemData = data; +} + + +HbIcon CpThemeInfo::icon() const +{ + return mIcon; +} + +void CpThemeInfo::setIcon(const HbIcon& newIcon) +{ + mIcon = newIcon; +} + + +HbIcon CpThemeInfo::portraitPreviewIcon() const +{ + return mPortraitPreviewIcon; +} + +void CpThemeInfo::setPortraitPreviewIcon(const HbIcon& newIcon) +{ + mPortraitPreviewIcon = newIcon; +} + + +HbIcon CpThemeInfo::landscapePreviewIcon() const +{ + return mLandscapePreviewIcon; +} + +void CpThemeInfo::setLandscapePreviewIcon(const HbIcon& newIcon) +{ + mLandscapePreviewIcon = newIcon; +} + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemeinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPTHEMEINFO_H_ +#define CPTHEMEINFO_H_ + + +#include + +#include + +class CpThemeInfo { + +public: + + + enum ThemeListItemType { + ThemeListItemType_default = 0, + ThemeListItemType_URL, + ThemeListItemType_APP + }; + + CpThemeInfo(); + ~CpThemeInfo(); + + QString name() const; + void setName(const QString& newName); + + ThemeListItemType itemType() const; + void setItemType(ThemeListItemType type); + + QString itemData() const; + void setItemData(const QString& data); + + HbIcon icon() const; + void setIcon(const HbIcon& newIcon); + + HbIcon portraitPreviewIcon() const; + void setPortraitPreviewIcon(const HbIcon& newIcon); + + HbIcon landscapePreviewIcon() const; + void setLandscapePreviewIcon(const HbIcon& newIcon); + + bool operator < (const CpThemeInfo &other) const { + return mName.toCaseFolded().localeAwareCompare(other.mName.toCaseFolded()) < 0; + } + bool operator == (const CpThemeInfo &other) const { + return mName.localeAwareCompare(other.mName) == 0; + } + +private: + CpThemeInfo::ThemeListItemType mItemType; + QString mItemData; + QString mName; + HbIcon mIcon; + HbIcon mPortraitPreviewIcon; + HbIcon mLandscapePreviewIcon; + +}; +Q_DECLARE_METATYPE(CpThemeInfo::ThemeListItemType) + + +#endif /* CPTHEMEINFO_H_ */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include + +#include + +#include "cpthemelistmodel.h" +#include "cpthemeinfo.h" +#include "cpthemeutil.h" + +/* + CpThemeChangerModel provides an interface to the data contained in the + theme list using QAbstractListModel. +*/ + +/* + Constructor +*/ +CpThemeListModel::CpThemeListModel(QObject* parent) + : QAbstractListModel(parent) + , mTopThemeList() + , mThemeList() + , mBottomThemeList() + , mFileWatcher(new QFileSystemWatcher(this)) +{ + //Build theme list + mThemeList = CpThemeUtil::buildThemeList(); + + //Look into theme paths and add a file watcher for it + //to get notified when themes are added. + QStringList themePaths = CpThemeUtil::themeDirectories(mThemeList); + if(!themePaths.empty()) { + mFileWatcher->addPaths(themePaths); + } + + connect(mFileWatcher, SIGNAL(directoryChanged(QString)), + this, SLOT(themeListChanged())); + +} + +/* + Destructor +*/ +CpThemeListModel::~CpThemeListModel() +{ + delete mFileWatcher; + mFileWatcher = 0; + +} + +/* + Reimplemented from QAbstractListModel. +*/ +int CpThemeListModel::rowCount(const QModelIndex&) const +{ + return mTopThemeList.size() + + mThemeList.size() + + mBottomThemeList.size(); +} + +/* + Reimplemented from QAbstractListModel. +*/ +QVariant CpThemeListModel::data(const QModelIndex& index, int role) const +{ + QVariant retVal = QVariant(); + + if (index.isValid()) { + // figure out which list we're in and do the appropriate mapping + int row = index.row(); + const QList *list = 0; + if (row < mTopThemeList.size()) { + list = &mTopThemeList; + } else { + row -= mTopThemeList.size(); + if ( row < mThemeList.size() ) { + list = &mThemeList; + } else { + row -= mThemeList.size(); + if ( row < mBottomThemeList.size() ) { + list = &mBottomThemeList; + } + } + } + + if (list) { + switch (role) { + case Qt::DisplayRole: + retVal = list->at(row).name(); + break; + + case Qt::SizeHintRole: + retVal = list->at(row).icon().size(); + break; + + case ItemDataRole: + retVal = list->at(row).itemData(); + break; + + case ItemTypeRole: + retVal = QVariant::fromValue(list->at(row).itemType()); + break; + + default: + // do nothing + qt_noop(); + } + } + } + + return retVal; +} + +/* + Responds appropriately when the underlying data in the theme changer is modified. + + Unfortunately the directory watcher from QFileWatcher only says when something changed + not what changed. Therefore the model is considered reset rather than having rows + with dataChanged. +*/ +void CpThemeListModel::themeListChanged() +{ + beginResetModel(); + if(!mThemeList.empty()) { + mThemeList.clear(); + } + mThemeList = CpThemeUtil::buildThemeList(); + + endResetModel(); +} +/*! + * Returns index of theme infor within the theme list. + */ +int CpThemeListModel::indexOf(const CpThemeInfo& theme) const +{ + return mThemeList.indexOf(theme); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemelistmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CP_THEME_LIST_MODEL_P_H +#define CP_THEME_LIST_MODEL_P_H + +#include +#include +#include +#include "cpthemeutil.h" + +class QFileSystemWatcher; + +class CpThemeListModel : public QAbstractListModel +{ + Q_OBJECT + +public: + + enum ThemeListUserRole { + ItemTypeRole = Qt::UserRole, + ItemDataRole + }; + + explicit CpThemeListModel(QObject *parent = 0); + virtual ~CpThemeListModel(); + + virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + int indexOf(const CpThemeInfo& theme) const; + +public slots: + void themeListChanged(); + +private: + QList mTopThemeList; + QList mThemeList; + QList mBottomThemeList; + QFileSystemWatcher *mFileWatcher; +}; + +#endif //CP_THEME_LIST_MODEL_P_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemelistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + + +#include +#include + +#include +#include +#include +#include +#include +#include + + +#include "cpthemelistview.h" + +/*! + \class CpThemeListView + \brief CpThemeListView displays a heading (e.g Theme) and a list of themes with + corresponding icons. + + Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel + framework. + */ + +/*! + constructor. Creates the heading label and the list and adds it to layout. +*/ +CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), + mThemeList(new HbListView(this)) +{ + + //Create a layout with a heading at top and the list below it. + HbWidget* contentWidget = new HbWidget(this); + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + layout->setContentsMargins(0,0,0,0); + + //setup the heading. + HbGroupBox *simpleLabel = new HbGroupBox(); + simpleLabel->setHeading(hbTrId("txt_cp_title_select_theme")); + + layout->addItem(simpleLabel); + + connect(mThemeList, SIGNAL(activated(QModelIndex)), + this, SIGNAL(newThemeSelected(QModelIndex))); + + //set list item icons to be large. + HbListViewItem* listViewItem = mThemeList->listItemPrototype(); + listViewItem->setGraphicsSize(HbListViewItem::LargeIcon); + //set singleSelection to enable showing an indicator (e.g check mark) next to active theme. + mThemeList->setSelectionMode(HbAbstractItemView::SingleSelection); + + //add the list to layout. + layout->addItem(mThemeList); + + //Create the toolbar for Ovi Store. + HbToolBar* toolBar = new HbToolBar(this); + + HbAction* oviAction = new HbAction(HbIcon("qtg_large_ovistore"), hbTrId("txt_cp_list_get_more_tones")); + QObject::connect( oviAction, SIGNAL(triggered()), + this, SIGNAL(oviClicked())); + + //Add Action to the toolbar and show toolbar + toolBar->addAction(oviAction); + + setToolBar(toolBar); + + contentWidget->setLayout(layout); + + setWidget(contentWidget); + +} + +/*! + destructor. +*/ +CpThemeListView::~CpThemeListView() +{ +} + +/*! + returns the listview instance (list of themes). +*/ +HbListView* CpThemeListView::themeList() const +{ + return mThemeList; +} + +/*! + Sets the model of its listView. +*/ +void CpThemeListView::setModel(QAbstractItemModel* model) +{ + mThemeList->setModel(model); +} + +/*! + sets the widget. Reimplementation from HbView. +*/ +void CpThemeListView::setWidget(QGraphicsWidget *widget) +{ + HbView::setWidget(widget); +} + +/*! + emits aboutToClose() signal. +*/ +void CpThemeListView::closeView() +{ + emit aboutToClose(); +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemelistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPTHEMELISTVIEW_H +#define CPTHEMELISTVIEW_H + +#include + +#include +#include + +#include + + +class CpThemeSelectionList; + +class CpThemeListView : public CpBaseSettingView +{ + Q_OBJECT + +public: + explicit CpThemeListView(QGraphicsItem *parent = 0); + ~CpThemeListView(); + void setWidget(QGraphicsWidget *widget); + HbListView* themeList() const; + void setModel(QAbstractItemModel* model); + void closeView(); + +signals: + void newThemeSelected(const QModelIndex& index); + void oviClicked(); + +private: + HbListView* mThemeList; + +}; + +#endif //CPTHEMELISTVIEW_H + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpthemeplugin.h" +#include "cpthemepluginentryitemdata.h" + +/*! + \class CpThemePlugin + \brief CpThemePlugin is a control panel plugin that allows a user to view available themes and + change the current theme of the phone. + +*/ + +/*! + constructor. +*/ +CpThemePlugin::CpThemePlugin() +{ +} + +/*! + destructor. +*/ +CpThemePlugin::~CpThemePlugin() +{ +} + +/*! + create the control panel entry item data for Theme settins. +*/ + +QList CpThemePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + + //create a cpthemepluginentryitemdata with default values and return it. + CpSettingFormEntryItemData *entryItem = new CpThemePluginEntryItemData( + itemDataHelper, + hbTrId("txt_cp_dblist_theme"), + QString(), + HbIcon()); + return QList() << entryItem; +} + +Q_EXPORT_PLUGIN2(cpthemeplugin, CpThemePlugin); + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemeplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMEPLUGIN_H +#define CPTHEMEPLUGIN_H + +#include +#include + +class CpThemePlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpThemePlugin(); + virtual ~CpThemePlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPTHEMEPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.cpp Tue Aug 31 15:15:28 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: + * + */ + +#include +#include + +#include +#include "cpthemecontrol.h" +#include "cpthemepluginentryitemdata.h" +#include + +/*! + \class CpThemePluginEntryItemData + \brief CpThemePluginEntryItemData is the entry item view for Theme Changer plugin. It displays a title "Theme", + the name of current theme and the preview icon of the current theme. + +*/ + +/*! + constructor. +*/ +CpThemePluginEntryItemData::CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text, + const QString &description, + const HbIcon &icon, + const HbDataFormModelItem *parent) : + CpSettingFormEntryItemData(itemDataHelper, + text, + description, + icon, + parent) +{ + //Create a CpThemeControl. the themeControl takes care of displaying the themes + //and letting user select a theme and apply a theme change. + mThemeControl = new CpThemeControl(); + + setEntryItemIcon(mThemeControl->currentThemeIcon()); + setDescription(mThemeControl->currentThemeName()); + + //connect to signal to update the current theme name and icon whenever the theme changes. + QObject::connect(mThemeControl, SIGNAL(themeUpdated(const QString&, const HbIcon&)), this, + SLOT(themeUpdated(const QString&, const HbIcon&))); +} + +/*! + destructor. +*/ +CpThemePluginEntryItemData::~CpThemePluginEntryItemData() +{ + delete mThemeControl; + mThemeControl = 0; +} + +/*! + Slot used for updating entry item's description and icon with current theme name and its + preview icon. + */ +void CpThemePluginEntryItemData::themeUpdated(const QString& themeName, const HbIcon& icon) +{ + setEntryItemIcon(icon); + setDescription(themeName); +} + +/*! + Return the theme changer UI view. Returns 0 if it can't create + the view. +*/ +CpBaseSettingView *CpThemePluginEntryItemData::createSettingView() const +{ + if(mThemeControl) { + CpBaseSettingView *view = mThemeControl->themeListView(); + return view; + } + + return 0; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepluginentryitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMEPLUGINENTRYITEMDATA_H +#define CPTHEMEPLUGINENTRYITEMDATA_H + +#include +#include + +class CpThemeControl; + +class CpThemePluginEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT + +public: + explicit CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const HbIcon &icon = HbIcon(), + const HbDataFormModelItem *parent = 0); + virtual ~CpThemePluginEntryItemData(); + +private slots: + void themeUpdated(const QString& themeName, const HbIcon& icon); +private: + CpThemeControl* mThemeControl; + virtual CpBaseSettingView *createSettingView() const; + +}; + +#endif //CPTHEMEPLUGINENTRYITEMDATA_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemepreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cpthemepreview.h" +#include "cpthemeinfo.h" + +/*! + \class CpThemePreview + \brief CpThemePreview shows a preview of a selected theme with a heading displaying the name of the theme as well as + a toolbar with Select and Cancel buttons. This view is used for the user to either select the theme and apply + the theme change or press Cancel and go back to theme list view. +*/ + + +/*! + constructor. +*/ +CpThemePreview::CpThemePreview(const CpThemeInfo& theme, QGraphicsItem *parent) : + HbView(parent), + mTheme(theme), + mSoftKeyBackAction(0), + mPreviewIcon(0) +{ + QGraphicsLinearLayout* containerLayout = new QGraphicsLinearLayout(Qt::Vertical); + QGraphicsLinearLayout* bottomLayout = new QGraphicsLinearLayout(Qt::Vertical); + + //Preview icon margins. + qreal leftMargin = 0.0; + qreal rightMargin = 0.0; + qreal topMargin = 0.0; + qreal bottomMargin = 0.0; + + style()->parameter(QString("hb-param-margin-gene-left"), leftMargin); + style()->parameter("hb-param-margin-gene-right", rightMargin); + style()->parameter("hb-param-margin-gene-top", topMargin); + style()->parameter("hb-param-margin-gene-bottom", bottomMargin); + + containerLayout->setContentsMargins(0,0,0,0); + bottomLayout->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin); + + //Using an empty dataform as heading because the heading should + //look like an HbDataForm headiing. + HbDataForm* heading = new HbDataForm(this); + QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name()); + heading->setHeading(themeHeading); + + containerLayout->addItem(heading); + //Fixed vertical policy so that the heading doesn't expand. + heading->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType); + + if(mainWindow()->orientation() == Qt::Horizontal) { + mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this); + } + else { + mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this); + //set to ignore aspect ratio so the layout would rezise the icon correctly. + + } + mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio); + + // set an object name for preview icon to make it testable for automation testing + mPreviewIcon->setObjectName(QString("themePreviewIcon")); + + + bottomLayout->addItem(mPreviewIcon); + containerLayout->addItem(bottomLayout); + + setLayout(containerLayout); + + //Create the toolbar and "Select" and "Cancel" actions. + HbToolBar* mToolBar = new HbToolBar(this); + + HbAction* selectAction = new HbAction(hbTrId("txt_common_button_select")); + + //Add Action to the toolbar and show toolbar + mToolBar->addAction( selectAction ); + + HbAction* cancelAction = new HbAction(hbTrId("txt_common_button_cancel")); + mToolBar->addAction( cancelAction ); + + QObject::connect( selectAction, SIGNAL(triggered()), + this, SLOT(themeSelected())); + + QObject::connect( cancelAction, SIGNAL(triggered()), + this, SIGNAL(aboutToClose())); + QObject::connect( mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(previewOrientationChanged(Qt::Orientation))); + + + setToolBar(mToolBar); + //Setup the Back button action and set softkey. Back button + //takes the user to the theme list view. + mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); + QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()), + this, SIGNAL(aboutToClose()) ); + + setNavigationAction(mSoftKeyBackAction); + +} + +/*! + destructor. +*/ +CpThemePreview::~CpThemePreview() +{ +} + +/*! + sets the theme to \a theme. +*/ +void CpThemePreview::setThemeInfo(const CpThemeInfo& theme) +{ + mTheme = theme; +} + +/*! + returns the themeName. +*/ +const QString CpThemePreview::themeName() const +{ + return mTheme.name(); +} + +/*! + returns the repersentative themeIcon of the current theme. +*/ +const HbIcon CpThemePreview::themeIcon() const +{ + return mTheme.icon(); +} + +/*! + Slot to handle when the user selects a theme. +*/ +void CpThemePreview::themeSelected() +{ + emit applyTheme(mTheme); +} + +/*! + * Slot to handle landscape/portrait orientation change to use the + * right graphics. + */ +void CpThemePreview::previewOrientationChanged(Qt::Orientation orientation) +{ + + QGraphicsLinearLayout* containerLayout = dynamic_cast(layout()); + QGraphicsLinearLayout* previewLayout = 0; + if(containerLayout) { + //get the layout that preview icon belongs to. + previewLayout = dynamic_cast(containerLayout->itemAt(1)); + } + + if(previewLayout && mPreviewIcon && mPreviewIcon == dynamic_cast(previewLayout->itemAt(0)) ) { + //Remove preview icon. + previewLayout->removeAt(0); + + if(orientation == Qt::Horizontal) { + mPreviewIcon->setIcon(mTheme.landscapePreviewIcon()); + + } + else { + mPreviewIcon->setIcon(mTheme.portraitPreviewIcon()); + } + + previewLayout->addItem(mPreviewIcon); + } + +} + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemepreview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMEPREVIEW_H +#define CPTHEMEPREVIEW_H + +#include +#include +#include +#include "cpthemechanger.h" +#include "cpthemeinfo.h" + + +QT_BEGIN_NAMESPACE +class QString; +QT_END_NAMESPACE + +class HbAction; +class HbMainWindow; +class HbIconItem; + +class CpThemePreview : public HbView +{ + Q_OBJECT + +public: + explicit CpThemePreview(const CpThemeInfo &theme, QGraphicsItem *parent = 0); + ~CpThemePreview(); + void setThemeInfo(const CpThemeInfo& theme); + const QString themeName() const; + const HbIcon themeIcon() const; + +signals: + void applyTheme(const CpThemeInfo&); + void aboutToClose(); + +private slots: + void themeSelected(); + void previewOrientationChanged(Qt::Orientation orientation); + +private: + CpThemeInfo mTheme; + HbAction* mSoftKeyBackAction; + HbIconItem* mPreviewIcon; + +}; + +#endif //CPTHEMEPREVIEW_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemeutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpthemeinfo.h" +#include "cpthemeutil.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +/*! + * This class provides utility function to get Theme information. + */ + +#if defined(Q_OS_SYMBIAN) +#include +#include + static const TUid KServerUid3={0x20022E82}; + static const TUint32 KDefaultThemeNameKey = 0x2; + +#endif + + + //Location of theme preview and background icons. + static const QString KPreviewThumbnailNVG = "/scalable/qtg_graf_theme_preview_thumbnail.nvg"; + static const QString KPreviewThumbnailSVG = "/scalable/qtg_graf_theme_preview_thumbnail.svg"; + + static const QString KBackgroundPrtNVG = "/scalable/qtg_graf_screen_bg_prt.nvg"; + static const QString KBackgroundLscNVG = "/scalable/qtg_graf_screen_bg_lsc.nvg"; + static const QString KBackgroundPrtSVG = "/scalable/qtg_graf_screen_bg_prt.svg"; + static const QString KBackgroundLscSVG = "/scalable/qtg_graf_screen_bg_lsc.svg"; + + + + + +/* + * Builds a CpThemeInfo object given theme path and theme name. It creates the name and + * preview icons for the object. Creates a new CpThemeInfo objects. Caller takes ownership. + * Returns NULL if can't build the object. + */ +CpThemeInfo* CpThemeUtil::buildThemeInfo(const QString& themePath, const QString& themeName) +{ + CpThemeInfo *themeInfo = new CpThemeInfo(); + QString iconPath; + + QString name = themeName; + QString hidden = ""; + + //first look into the index.theme file to get theme information. + + if(QFileInfo(themePath + "/index.theme").exists()) { + QSettings iniSetting(themePath + "/index.theme", QSettings::IniFormat); + iniSetting.beginGroup("Icon Theme"); + name = iniSetting.value("Name").toString(); + hidden = iniSetting.value("Hidden").toString(); + iconPath = iniSetting.value("PreviewThumbnailPath").toString(); + iniSetting.endGroup(); + + } + + if(name.isEmpty() || (hidden == "true") ||( hidden == "")) { + return NULL; + } + + themeInfo->setName(name); + themeInfo->setItemType(CpThemeInfo::ThemeListItemType_default); + themeInfo->setItemData(themePath); + + //Get the icons. Logic is as follow: + /* 1. If the icon path is in index.theme and the icon exist, use it. + * 2. Otherwise look for the icon in the theme folder. + * 2. If preview icon doesn't exist, use background icon. + * 3. If no icon exist (background or preview),use default theme icon. + */ + if(iconPath.isEmpty() || !QFileInfo(themePath + iconPath).exists()){ + //Set thumbnail + HbIcon themeIcon = getPreviewIcon(themePath); + if(themeIcon.isNull()){ + QString defaultThemePath = defaultTheme(); + if(!defaultThemePath.isEmpty()) { + themeIcon = getPreviewIcon(defaultThemePath); + } + } + themeInfo->setIcon(themeIcon); + } else { + themeInfo->setIcon(HbIcon(themePath + iconPath)); + } + + return themeInfo; + +} + +/*! + * given a path to the theme, returns the preview icon or just a Null icon + * if it doesn't exist. + */ +HbIcon CpThemeUtil::getPreviewIcon(const QString& themePath) +{ + HbIcon themeIcon; + if(QFileInfo(themePath + KPreviewThumbnailNVG).exists()){ + themeIcon = HbIcon(themePath + KPreviewThumbnailNVG); + }else if(QFileInfo(themePath + KPreviewThumbnailSVG).exists()){ + themeIcon = HbIcon(themePath + KPreviewThumbnailSVG); + }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){ + themeIcon = HbIcon(themePath + KBackgroundPrtNVG); + }else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){ + themeIcon = HbIcon(themePath + KBackgroundPrtSVG); + } + return themeIcon; + +} + +/*! Creates a list of CpThemeInfo objects representing theme information. + * + */ +QList CpThemeUtil::buildThemeList() +{ + QList themeList; + + QList > mThemesPathList = availableThemes(); + QPairpair; + foreach (pair, mThemesPathList) { + QDir themeDir; + QString name = pair.first; + QString path = pair.second; + themeDir.setPath( path ) ; + CpThemeInfo* themeInfo; + if(themeDir.exists("index.theme") && + (themeDir.exists("scalable") || themeDir.exists("pixmap") )) { + themeInfo = buildThemeInfo(path, name); + if(themeInfo && !themeInfo->name().isEmpty()) { + themeList.append(*themeInfo); + } + } + } + qSort( themeList ); + return themeList; +} + +/*! + * Returns the default theme path. + */ +QString CpThemeUtil::defaultTheme() +{ + //static because default theme doesn't change. + static QString defaultThemePath(""); + + if(defaultThemePath.isEmpty()) { + + +#ifdef Q_OS_SYMBIAN + CRepository *repository = 0; + TRAP_IGNORE(repository = CRepository::NewL(KServerUid3)); + if (repository) { + TBuf<256> value; + if (KErrNone == repository->Get((TUint32)KDefaultThemeNameKey, value)) { + QString qvalue((QChar*)value.Ptr(), value.Length()); + defaultThemePath = qvalue.trimmed(); + } + value.Zero(); + delete repository; + } + +#endif + + } + return defaultThemePath; +} + + +const QStringList CpThemeUtil::themeDirectories(const QList& themeInfoList) +{ + QStringList themeDirs; + + foreach(const CpThemeInfo& themeInfo, themeInfoList) { + QDir themePath(themeInfo.itemData()); + QString topDir; + if(themePath.cdUp()) { + topDir = themePath.path(); + if(!themeDirs.contains(topDir)) { + themeDirs.append(topDir); + } + } + } + return themeDirs; +} + +const QList< QPair< QString, QString > > CpThemeUtil::availableThemes( ) +{ + + QList > result = HbThemeServices::availableThemes(); + return result; + +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/src/cpthemeutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMEUTIL_H_ +#define CPTHEMEUTIL_H_ + +#include +#include + +class QStringList; +class CpThemeInfo; +class HbIcon; + +class CpThemeUtil { + +public: + static QList buildThemeList(); + static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName = QString()); + static QString defaultTheme(); + static const QList< QPair< QString, QString > > availableThemes(); + static const QStringList themeDirectories(const QList &themeInfoList); + +private: + static HbIcon getPreviewIcon(const QString& themePath); + + +}; + +#endif /* CPTHEMEUTIL_H_ */ + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/themeplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,27 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: +# Description: cpthemeplugin source files +# Input +HEADERS += src/cpthemecontrol.h \ + src/cpthemeplugin.h \ + src/cpthemelistview.h \ + src/cpthemelistmodel.h \ + src/cpthemechanger.h \ + src/cpthemepluginentryitemdata.h \ + src/cpthemeutil.h \ + src/cpthemeinfo.h +SOURCES += src/cpthemecontrol.cpp \ + src/cpthemeplugin.cpp \ + src/cpthemelistview.cpp \ + src/cpthemelistmodel.cpp \ + src/cpthemepluginentryitemdata.cpp \ + src/cpthemechanger.cpp \ + src/cpthemeutil.cpp \ + src/cpthemeinfo.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/themeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,101 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpthemeplugin + +CONFIG += hb plugin + +LIBS += -lcpframework +TRANSLATIONS = control_panel.ts + +CONFIG += debug_and_release +RESOURCES += themeplugin.qrc + +#comment this out if theme plugin should have +#a preview view. +#DEFINES += CP_THEME_PREVIEW_DEFINED + +include (themeplugin.pri) +include (rom/themeplugin_rom.pri) + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin + OBJECTS_DIR = $$PWD/$$SUBDIRPART/tmp/$$TARGET + # add platfrom API for windows + INCLUDEPATH += $$PWD/../../../controlpanel_plat/inc +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + + + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + LIBS += -lcentralrepository + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0X2002C2F3 +} + + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} + +#symbian: INCLUDEPATH += /sf/mw/hb/include/hbservices \ +# /sf/mw/hb/include/hbservices/private \ +# /sf/mw/hb/include/hbcore \ +# /sf/mw/hb/include/hbcore/private +# + +# End of file --Don't remove this. diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/themeplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/themeplugin.qrc Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,5 @@ + + + image/themePreview.nvg + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/tsrc.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS += unit/unittest_cpthemecontrol +SUBDIRS += unit/unittest_cpthemelistview +SUBDIRS += unit/unittest_cpthemeplugin +SUBDIRS += unit/unittest_cpthemepluginentryitemdata +SUBDIRS += unit/unittest_cpthemelistmodel +SUBDIRS += unit/unittest_cpthemeutil + +CONFIG += ordered +test.depends = first +test.CONFIG += recursive +autotest.depends = first +autotest.CONFIG += recursive +QMAKE_EXTRA_TARGETS += test autotest diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/common.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: Stuff for all unit tests +# + +QT += testlib +CONFIG += qtestlib hb + + +win32 { + INCLUDEPATH += . + INCLUDEPATH += ../../../src/inc + INCLUDEPATH += ../../../src/cpframework/src + INCLUDEPATH += ../../../controlpanel_plat/inc +} + +unix { + test.commands = ./$(TARGET) + autotest.commands = ./$(TARGET) -xml -o ../$(QMAKE_TARGET).xml +} else:win32 { + test.CONFIG += recursive + autotest.CONFIG += recursive + build_pass { + test.commands =/epoc32/RELEASE/WINSCW/udeb/$(QMAKE_TARGET).exe + autotest.commands =/epoc32/RELEASE/WINSCW/udeb/$(QMAKE_TARGET).exe -xml -o c:/$(QMAKE_TARGET).xml + } +} + +QMAKE_EXTRA_TARGETS += test autotest + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + LIBS += -lcentralrepository + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemeControl class from themeplugin +* +*/ + +#include +#include + +#include +#include + +#include "cpthemechanger.h" +#include "cpthemecontrol.h" +#include "cpthemeinfo.h" +#include "cpthemeutil.h" + +class TestCpThemeControl : public QObject +{ + Q_OBJECT + +private slots: + + void testConstructor(); + void testThemeListView(); + void testCurrentThemeName(); + void testCurrentThemeIcon(); + +private: + CpThemeChanger* mThemeChanger; +}; + + + +// verify that the constructor works and that the +// defaults are sane. +void TestCpThemeControl::testConstructor() +{ + CpThemeControl * control = new CpThemeControl(); + + QVERIFY(control !=0 ); + QVERIFY(!control->currentThemeName().isEmpty()); + QVERIFY(!control->currentThemeIcon().iconName().isEmpty()); + + delete control; +} + +// verify that the themeListView doesn't return NULL (or crash) +void TestCpThemeControl::testThemeListView() +{ + CpThemeControl control; + + QVERIFY(control.themeListView() != 0); +} + +// test that we get back a non-empty QString +void TestCpThemeControl::testCurrentThemeName() +{ + CpThemeControl control; + + QVERIFY( (control.currentThemeName() == hbInstance->theme()->name()) + || (control.currentThemeName() == QString("hbdefault"))); +} + +// test that we get a non-empty string for current theme icon +void TestCpThemeControl::testCurrentThemeIcon() +{ + CpThemeControl control; + + QVERIFY(!control.currentThemeIcon().isNull() && !control.currentThemeIcon().iconName().isEmpty()); +} + + + + + +QTEST_MAIN(TestCpThemeControl) +#include "unittest_cpthemecontrol.moc" diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: unit tests for the cpthemecontrol class in the themeplugin. +# +# + +include(../common.pri) + + +TEMPLATE = app +TARGET = unittest_cpthemecontrol +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2A + + +# Input + +HEADERS += ../../../src/cpthemecontrol.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemelistview.h +HEADERS += ../../../src/cpthemeutil.h +HEADERS += ../../../src/cpthemeinfo.h +HEADERS += ../../../src/cpthemelistmodel.h +SOURCES += unittest_cpthemecontrol.cpp +SOURCES += ../../../src/cpthemecontrol.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemelistmodel.cpp +SOURCES += ../../../src/cpthemelistview.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistmodel/unittest_cpthemelistmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistmodel/unittest_cpthemelistmodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemeListModel class from themeplugin +* +*/ + +#include + +#include "cpthemelistmodel.h" + +class TestCpThemeListModel : public QObject +{ + Q_OBJECT + +private slots: + + void testConstructor(); + void testRowCount(); + void testData(); + void testIndexOf(); +}; + + +void TestCpThemeListModel::testConstructor() +{ + + CpThemeListModel *obj = new CpThemeListModel(); + + + QVERIFY (obj != 0 ); + QVERIFY (obj->rowCount() > 0); + + delete obj; + +} + +void TestCpThemeListModel::testRowCount() +{ + CpThemeListModel *themeModel = new CpThemeListModel(); + QList > allThemes = CpThemeUtil::availableThemes(); + QVERIFY(themeModel->rowCount() >= allThemes.size()); +} + +void TestCpThemeListModel::testData() +{ + CpThemeListModel *themeModel = new CpThemeListModel(); + QList > allThemes = CpThemeUtil::availableThemes(); + + QModelIndex index = themeModel->index(0,0, QModelIndex()); + + //Check theme name (first) and theme path (second). Skipping icons for now. + QCOMPARE(themeModel->data(index, Qt::DisplayRole).toString(), allThemes.at(0).first); + QCOMPARE(themeModel->data(index, CpThemeListModel::ItemDataRole).toString(), allThemes.at(0).second); + + +} + +void TestCpThemeListModel::testIndexOf() +{ + CpThemeListModel *themeModel = new CpThemeListModel(); + QList > allThemes = CpThemeUtil::availableThemes(); + + CpThemeInfo *themeInfo = CpThemeUtil::buildThemeInfo(allThemes.at(1).second, allThemes.at(1).first); + + int index = themeModel->indexOf(*themeInfo); + + QVERIFY(index == 1); + +} +QTEST_MAIN(TestCpThemeListModel) +#include "unittest_cpthemelistmodel.moc" + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistmodel/unittest_cpthemelistmodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistmodel/unittest_cpthemelistmodel.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,30 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: XENT-MV +# Description: unit tests for the cpthemelistmodel class in the themeplugin. +include(../common.pri) +TEMPLATE = app +TARGET = unittest_cpthemelistmodel +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin +symbian::TARGET.UID3 = 0x20031DAD + +# Input +HEADERS += ../../../src/cpthemelistmodel.h +HEADERS += ../../../src/cpthemeinfo.h +HEADERS += ../../../src/cpthemeutil.h +SOURCES += unittest_cpthemelistmodel.cpp +SOURCES += ../../../src/cpthemelistmodel.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemeControl class from themeplugin +* +*/ + +#include +#include +#include + +#include "cpthemelistview.h" + +class TestCpThemeListView : public QObject +{ + Q_OBJECT + +private slots: + void testConstructor(); + void testSetWidget(); + void testThemeList(); + void testSetModel(); + void testCloseView(); +}; + +void TestCpThemeListView::testConstructor() +{ + CpThemeListView* obj = new CpThemeListView(); + QVERIFY( obj != 0 ); + delete obj; +} + +void TestCpThemeListView::testSetWidget() +{ + CpThemeListView *listView = new CpThemeListView(); + QGraphicsWidget *testWidget = new QGraphicsWidget(); + + listView->setWidget(testWidget); + + QVERIFY( listView->widget() == testWidget); + + delete testWidget; + delete listView; +} + +void TestCpThemeListView::testThemeList() +{ + CpThemeListView *listView = new CpThemeListView(); + + QVERIFY( listView->themeList() != 0 ); + + delete listView; +} + +void TestCpThemeListView::testSetModel() +{ + CpThemeListView *listView = new CpThemeListView(); + QStandardItemModel *model = new QStandardItemModel(this); + + listView->setModel(model); + QVERIFY(listView->themeList()->model() == model); + + // model shouldn't be deleted because it is a QObject with a parent. + + delete listView; +} + +// null test +void TestCpThemeListView::testCloseView() +{ + CpThemeListView *listView = new CpThemeListView(); + + listView->closeView(); + + delete listView; +} + + + +QTEST_MAIN(TestCpThemeListView) +#include "unittest_cpthemelistview.moc" diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,39 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: unit tests for the cpthemelistview class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemelistview +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2C + + +# Input + +HEADERS += ../../../src/cpthemelistview.h +SOURCES += unittest_cpthemelistview.cpp +SOURCES += ../../../src/cpthemelistview.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemeControl class from themeplugin +* +*/ + +#include + +#include "cpthemeplugin.h" +#include +#include + +class TestCpThemePlugin : public QObject +{ + Q_OBJECT + +private slots: + void testConstructor(); + void testCreateSettingFormItemData(); +}; + +void TestCpThemePlugin::testConstructor() +{ + CpThemePlugin *obj = new CpThemePlugin(); + + delete obj; +} + +void TestCpThemePlugin::testCreateSettingFormItemData() +{ + CpThemePlugin *obj = new CpThemePlugin(); + CpItemDataHelper helper; + + QVERIFY(obj->createSettingFormItemData(helper).at(0) != 0); + + delete obj; +} + + +QTEST_MAIN(TestCpThemePlugin) +#include "unittest_cpthemeplugin.moc" diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,55 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: unit tests for the cpthemeplugin class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemeplugin +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2D + + +# Input + +HEADERS += ../../../src/cpthemecontrol.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemelistview.h +HEADERS += ../../../src/cpthemeplugin.h +HEADERS += ../../../src/cpthemepluginentryitemdata.h +HEADERS += ../../../src/cpthemeinfo.h +HEADERS += ../../../src/cpthemeutil.h +HEADERS += ../../../src/cpthemelistmodel.h +SOURCES += unittest_cpthemeplugin.cpp +SOURCES += ../../../src/cpthemecontrol.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemelistview.cpp +SOURCES += ../../../src/cpthemeplugin.cpp +SOURCES += ../../../src/cpthemepluginentryitemdata.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemelistmodel.cpp + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemePluginEntryItemData class from themeplugin +* +*/ + +#include +#include + +#include + +#include "cpthemepluginentryitemdata.h" + +class TestCpThemePluginEntryItemData : public QObject +{ + Q_OBJECT + +private slots: + void testConstructor(); +}; + +void TestCpThemePluginEntryItemData::testConstructor() +{ + CpItemDataHelper helper; + + CpThemePluginEntryItemData *obj = new CpThemePluginEntryItemData(helper); + + QVERIFY(obj != NULL); + + delete obj; +} + + +QTEST_MAIN(TestCpThemePluginEntryItemData) +#include "unittest_cpthemepluginentryitemdata.moc" + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,52 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: unit tests for the cpthemepluginentryitemdata class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemepluginentryitemdata +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DD2E + + +# Input + +HEADERS += ../../../src/cpthemeinfo.h +HEADERS += ../../../src/cpthemeutil.h +HEADERS += ../../../src/cpthemelistmodel.h +HEADERS += ../../../src/cpthemecontrol.h +HEADERS += ../../../src/cpthemelistview.h +HEADERS += ../../../src/cpthemechanger.h +HEADERS += ../../../src/cpthemepluginentryitemdata.h +SOURCES += unittest_cpthemepluginentryitemdata.cpp +SOURCES += ../../../src/cpthemepluginentryitemdata.cpp +SOURCES += ../../../src/cpthemelistview.cpp +SOURCES += ../../../src/cpthemecontrol.cpp +SOURCES += ../../../src/cpthemechanger.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemelistmodel.cpp + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemePreview class from themeplugin +* +*/ + +#include + +#include "cpthemepreview.h" +#include "cpthemechanger.h" +#include "cpthemeutil.h" + +class TestCpThemePreview : public QObject +{ + Q_OBJECT + +private slots: + + void testAll(); + +}; + +void TestCpThemePreview::testAll() +{ + QList > themes = CpThemeUtil::availableThemes(); + + QPair pair; + + pair = themes.at(0); + + QString name = pair.first; + QString themePath = pair.second; + CpThemeInfo* themeInfo = CpThemeUtil::buildThemeInfo(themePath, name); + + CpThemePreview *obj = new CpThemePreview(*themeInfo); + + + QVERIFY (obj != 0 ); + QCOMPARE(obj->themeName(), name); + QCOMPARE(obj->themeIcon(), themeInfo->icon()); + + delete themeInfo; + + pair = themes.at(1); + name = pair.first; + themePath = pair.second; + themeInfo = CpThemeUtil::buildThemeInfo(themePath, name); + + obj->setThemeInfo(*themeInfo); + + QCOMPARE(obj->themeName(), name); + QCOMPARE(obj->themeIcon(), themeInfo->icon()); + + + delete obj; + +} + +QTEST_MAIN(TestCpThemePreview) +#include "unittest_cpthemepreview.moc" + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: unit tests for the cpthemepreview class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemepreview +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x2002DDEF + + +# Input + +HEADERS += ../../../src/cpthemepreview.h +HEADERS += ../../../src/cpthemeinfo.h +HEADERS += ../../../src/cpthemeutil.h +HEADERS += ../../../src/cpthemechanger.h +SOURCES += unittest_cpthemepreview.cpp +SOURCES += ../../../src/cpthemepreview.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemechanger.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeutil/unittest_cpthemeutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeutil/unittest_cpthemeutil.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: XENT-MV +* +* Description: unit tests for the CpThemePreview class from themeplugin +* +*/ + +#include + +#include +#include +#include +#include +#include "cpthemeutil.h" +#include "cpthemeinfo.h" + +class TestCpThemeUtil : public QObject +{ + Q_OBJECT + +private slots: + + void testMultiple(); + void testAvailableThemes(); + void testThemeDirectories(); + +}; + +void TestCpThemeUtil::testMultiple() +{ + QList > themes = HbThemeServices::availableThemes(); + + QPair pair; + + pair = themes.at(0); + + QString name = pair.first; + QString themePath = pair.second; + + QList themeList = CpThemeUtil::buildThemeList(); + + QCOMPARE(name, themeList.at(0).name()); + QCOMPARE(themePath, themeList.at(0).itemData()); + + CpThemeInfo *themeInfo = CpThemeUtil::buildThemeInfo(themePath, name); + QCOMPARE(name, themeInfo->name()); + QCOMPARE(themePath, themeInfo->itemData()); + + + //null test, making sure no crash happens. + QString defaultThemePath = CpThemeUtil::defaultTheme(); + + delete themeInfo; + themeInfo = 0; + +} +void TestCpThemeUtil::testAvailableThemes() +{ + QList > themes = HbThemeServices::availableThemes(); + QList > utilThemes = CpThemeUtil::availableThemes(); + + for(int i = 0; i < themes.size(); i++) { + QPairpair1; + QPairpair2; + + pair1 = themes.at(i); + pair2 = utilThemes.at(i); + QCOMPARE(pair1.first, pair2.first); + QCOMPARE(pair1.second, pair2.second); + } +} + +void TestCpThemeUtil::testThemeDirectories() +{ + QList themeList = CpThemeUtil::buildThemeList(); + QStringList themeDirs = CpThemeUtil::themeDirectories(themeList); + QVERIFY(themeList.size() > 0 && themeDirs.size() > 0); +} + +QTEST_MAIN(TestCpThemeUtil) +#include "unittest_cpthemeutil.moc" + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeutil/unittest_cpthemeutil.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeutil/unittest_cpthemeutil.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,41 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: XENT-MV +# +# Description: unit tests for the cpthemeutil class in the themeplugin. +# +# + +include(../common.pri) + +TEMPLATE = app +TARGET = unittest_cpthemeutil +DEPENDPATH += . +win32::DEPENDPATH += c:/ControlPanel/debug/bin + +INCLUDEPATH += . +INCLUDEPATH += src/ +INCLUDEPATH += ../../../src + +LIBS += -lcpframework +win32::LIBS += -LC:/ControlPanel/debug/bin + +symbian::TARGET.UID3=0x20031DAE + + +# Input + +HEADERS += ../../../src/cpthemeutil.h +HEADERS += ../../../src/cpthemeinfo.h +SOURCES += unittest_cpthemeutil.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemeinfo.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/controlpanelui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/controlpanelui.pro Tue Aug 31 15:15:28 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 = src +CONFIG += ordered + +include(rom/cpui_rom.pri) \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/cpcfg_win.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/cpcfg_win.pl Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,61 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Copy all cpcfg files to destination directory when building control panel in window envionment +# usage: go to control panel source directory, +# run cpcfg_win.pl if you want to build control panel in debug mode or cpcfg_win -R in release mode. + +use File::Path qw (mkpath); + +#default debug dir +$config_dir = "C:\\ControlPanel\\debug\\bin\\config"; +if ($ARGV[0] =~ m/^-R$/i) { #release dir + $config_dir = "C:\\ControlPanel\\release\\bin\\config"; +} + +sub go_through_dir { + my @arr, $j = 0; + for ($i=0;$i<=$#_;$i++) { + if (-d $_[$i]) { + if (opendir($handle, $_[$i])) { + while ($entry = readdir($handle)) { + if (!($entry =~ m/^\.$/) and !($entry =~ m/^(\.\.)$/)) { + if (-d $_[$i]."\\$entry") { # is a directory, push to @arr + $arr[$j++] = $_[$i]."\\$entry"; + } + else { # is a file + if ($entry =~ m/\.cpcfg$/i) { # is a .cpcfg file, copy it + $cmd = "copy "; + $cmd .= $_[$i]."\\$entry "; + $cmd .= $config_dir."\\$entry"; + print ("$cmd\n"); + system($cmd); + } + } + } + } + closedir($handle); + } + } + } + if ($j>0) { + go_through_dir (@arr); + } +} + +# create target directory if it doesn't exist +print ("Creating direcotry... $config_dir \n"); +mkpath $config_dir; + +# go through source directories recrusively +go_through_dir ".\\src\\cpapplication",".\\src\\cpplugins"; \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/example_common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/example_common.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: controlpanel project - common qmake settings +# + +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin + OBJECTS_DIR = $$PWD/../$$SUBDIRPART/tmp/$$TARGET +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +win32 { + # add platfrom API for windows + INCLUDEPATH += $$PWD/../controlpanel_plat/inc +} + +CONFIG += hb plugin +LIBS += -lcpframework + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/examples.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/examples.pro Tue Aug 31 15:15:28 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: +# + +TEMPLATE = subdirs +SUBDIRS = groupplugin/groupplugin.pro \ + viewplugin/viewplugin.pro \ + pluginlauncherclient/pluginlauncherclient.pro +CONFIG += ordered + +include (rom/rom.pri) \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/groupplugin/groupplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/groupplugin/groupplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: controlpanel project - common qmake settings +# + +HEADERS += src/cpsamplegroup.h \ + src/cpgroupplugin.h +SOURCES += src/cpsamplegroup.cpp \ + src/cpgroupplugin.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/groupplugin/groupplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/groupplugin/groupplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,28 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpgroupplugin + +include (../example_common.pri) +include (groupplugin.pri) + +# Input +symbian: { + TARGET.UID3 = 0x20025FE3 +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/groupplugin/src/cpgroupplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/groupplugin/src/cpgroupplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpgroupplugin.h" +#include "cpsamplegroup.h" + +CpGroupPlugin::CpGroupPlugin() +{ +} + +CpGroupPlugin::~CpGroupPlugin() +{ +} + +QList CpGroupPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + return QList() << new CpSampleGroup(itemDataHelper); +} + +Q_EXPORT_PLUGIN2(CpGroupPlugin, CpGroupPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/groupplugin/src/cpgroupplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/groupplugin/src/cpgroupplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPGROUPPLUGIN_H +#define CPGROUPPLUGIN_H + +#include +#include + +class CpGroupPlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpGroupPlugin(); + virtual ~CpGroupPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; +#endif // CPGROUPPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/groupplugin/src/cpsamplegroup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/groupplugin/src/cpsamplegroup.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpsamplegroup.h" +#include +#include +#include + +CpSampleGroup::CpSampleGroup(CpItemDataHelper &itemDataHelper) : + CpSettingFormItemData(HbDataFormModelItem::GroupItem,QString("Sample Group")), + mSliderItem(0), + mCheckBoxItem(0) +{ + mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, + QString("Sample Slider")); + itemDataHelper.addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int))); + this->appendChild(mSliderItem); + + mCheckBoxItem = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem, + QString("Sample Check Box")); + itemDataHelper.addConnection(mCheckBoxItem,SIGNAL(stateChanged (int)),this,SLOT(checkBoxStateChanged(int))); + this->appendChild(mCheckBoxItem); + +} +CpSampleGroup::~CpSampleGroup() +{ + //TODO: release resource when necessary +} +void CpSampleGroup::sliderValueChanged(int value) +{ + //TODO: store your changes + // HbMessageBox::message(QString("slider value changed to:%1").arg(value)); +} +void CpSampleGroup::checkBoxStateChanged(int state) +{ + //TODO: store your changes + QString str = (state ? "checked" : "un-checked"); + // HbMessageBox::message(str); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/groupplugin/src/cpsamplegroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/groupplugin/src/cpsamplegroup.h Tue Aug 31 15:15:28 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: + * + */ +#ifndef CPSAMPLEGROUP_H +#define CPSAMPLEGROUP_H + +#include + +class CpSettingFormItemData; +class CpItemDataHelper; + +class CpSampleGroup : public CpSettingFormItemData +{ + Q_OBJECT +public: + explicit CpSampleGroup(CpItemDataHelper &itemDataHelper); + ~CpSampleGroup(); + +private slots: + //need handling your member's value change + void sliderValueChanged(int value); + void checkBoxStateChanged(int state); + +private: + CpSettingFormItemData *mSliderItem; + CpSettingFormItemData *mCheckBoxItem; +}; + +#endif // CPSAMPLEGROUP_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,18 @@ +# +# 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: cpframework source files +# + +HEADERS += src/*.h +SOURCES += src/*.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro Tue Aug 31 15:15:28 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: cpframework source files +# + +TEMPLATE = app +TARGET = CpPluginLauncherClient +DEPENDPATH += . +INCLUDEPATH += . + +include (pluginlauncherclient.pri) + +CONFIG += hb + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +LIBS += -lxqservice -lcpframework +symbian::TARGET::UID3 = 0X2002873A diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/pluginlauncherclient/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/src/main.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include "mainview.h" + +int main(int argc, char **argv) +{ + HbApplication app(argc, argv); + + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); + + HbMainWindow mainWindow; + MainView *mainView = new MainView(); + mainWindow.addView(mainView); + mainWindow.show(); + + return app.exec(); +} + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/pluginlauncherclient/src/mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/src/mainview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "mainview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MainView::MainView(QGraphicsItem *parent/* = 0*/) +: HbView(parent),mRequest(0) +{ + init(); +} + +MainView::~MainView() +{ + delete mRequest; +} + +void MainView::init() +{ + setTitle(tr("CpPlugin Launcher")); + + HbMenu *menu = new HbMenu(); + setMenu(menu); + + HbAction *action = menu->addAction(tr("Launch View(in process)")); + connect(action, SIGNAL(triggered()), this, SLOT(launchInProcessProfileView())); + + action = menu->addAction(tr("Launch View(QtHighway)")); + connect(action, SIGNAL(triggered()), this, SLOT(launchQtHighwayProfileView())); +} + +void MainView::launchInProcessProfileView() +{ + CpBaseSettingView *settingView = CpPluginLauncher::launchSettingView("cppersonalizationplugin.dll","profile_view"); + if (settingView) { + connect(settingView,SIGNAL(returnValueDelivered(QVariant)),this,SLOT(handleReturnValue(QVariant))); + } +} + +void MainView::launchQtHighwayProfileView() +{ + if (mRequest) { + delete mRequest; + mRequest = 0; + } + + mRequest = mAppMgr.create("com.nokia.symbian.ICpPluginLauncher", "launchSettingView(QString,QVariant)", true); + + if (!mRequest) + { + return; + } + else + { + connect(mRequest, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); + connect(mRequest, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); + } + + + // Set arguments for request + QList args; + args << QVariant( "cppersonalizationplugin.dll" ); + args << QVariant ( "profile_view" ); + mRequest->setArguments(args); + + mRequest->setSynchronous(false); + + QTimer::singleShot(20* 1000, this, SLOT(closeSettingView())); + + // Make the request + if (!mRequest->send()) + { + //report error + } + +} + +void MainView::handleReturnValue(const QVariant &returnValue) +{ + HbMessageBox::information( QString("Return value:") + returnValue.toString()); +} + +void MainView::handleError(int errorCode,const QString &errorMessage) +{ + HbMessageBox::information( QString("handle error:") + errorMessage); +} + +void MainView::closeSettingView() +{ + if (mRequest) { + delete mRequest; + mRequest = 0; + } +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/pluginlauncherclient/src/mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/src/mainview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef MAINVIEW_H +#define MAINVIEW_H + +#include +#include + +class MainView : public HbView +{ + Q_OBJECT +public: + explicit MainView(QGraphicsItem *parent = 0); + virtual ~MainView(); +private: + void init(); +private slots: + void launchInProcessProfileView(); + + void launchQtHighwayProfileView(); + + void handleReturnValue(const QVariant &returnValue); + void handleError(int errorCode,const QString &errorMessage); + + void closeSettingView(); + +private: + Q_DISABLE_COPY(MainView) +private: + XQApplicationManager mAppMgr; + XQAiwRequest *mRequest; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/rom/controlpanel_examples.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/rom/controlpanel_examples.iby Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,27 @@ + +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +file=ABI_DIR\BUILD_DIR\CpPluginLauncherClient.exe SHARED_LIB_DIR\CpPluginLauncherClient.exe +CP_UPGRADABLE_APP_REG_RSC(CpPluginLauncherClient) +S60_APP_RESOURCE(CpPluginLauncherClient) + +file=ABI_DIR\BUILD_DIR\cpgroupplugin.dll SHARED_LIB_DIR\cpgroupplugin.dll +file=ABI_DIR\BUILD_DIR\cpviewplugin.dll SHARED_LIB_DIR\cpviewplugin.dll + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpgroupplugin.qtplugin resource\qt\plugins\controlpanel\cpgroupplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpviewplugin.qtplugin resource\qt\plugins\controlpanel\cpviewplugin.qtplugin diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/rom/rom.pri Tue Aug 31 15:15:28 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: +# + +symbian: { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/controlpanel_examples.iby CORE_MW_LAYER_IBY_EXPORT_PATH(controlpanel_examples.iby)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/themeplugin/src/cpthemeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/themeplugin/src/cpthemeplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpthemeplugin.h" +#include "cpthemepluginentryitemdata.h" + +CpThemePlugin::CpThemePlugin() +{ +} + +CpThemePlugin::~CpThemePlugin() +{ +} + +QList CpThemePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + CpSettingFormEntryItemData *entryItem = new CpThemePluginEntryItemData( + itemDataHelper,tr("Theme"),tr("Name of the Theme"),HbIcon(":/image/qgn_menu_note.svg")); + return QList() << entryItem; +} + +Q_EXPORT_PLUGIN2(cpthemeplugin, CpThemePlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/themeplugin/src/cpthemeplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/themeplugin/src/cpthemeplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMEPLUGIN_H +#define CPTHEMEPLUGIN_H + +#include +#include + +class CpThemePlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpThemePlugin(); + virtual ~CpThemePlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPTHEMEPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/themeplugin/src/cpthemepluginentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/themeplugin/src/cpthemepluginentryitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpthemepluginentryitemdata.h" +#include +#include +#include +#include + +CpThemePluginEntryItemData::CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text /*= QString()*/, + const QString &description /*= QString()*/, + const HbIcon &icon /*= HbIcon()*/, + const HbDataFormModelItem *parent /*= 0*/) + : CpSettingFormEntryItemData(itemDataHelper, + text, + description, + icon, + parent) +{ +} + +CpThemePluginEntryItemData::~CpThemePluginEntryItemData() +{ +} + +void CpThemePluginEntryItemData::onLaunchView() +{ + HbFileDialog *dlg = new HbFileDialog(); + dlg->setDirectory(QString("C:/ControlPanel/resource")); + dlg->setTitle("Select file:"); + dlg->setPrimaryActionText(QString("Done")); + dlg->setSecondaryActionText(QString("Close")); + QString filePath = dlg->getFileName(); + if (!filePath.isEmpty()) { + setDescription(QFileInfo(filePath).baseName()); + setEntryItemIcon(HbIcon(filePath)); + } + delete dlg; +} + +CpBaseSettingView *CpThemePluginEntryItemData::createSettingView() const +{ + return 0; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/themeplugin/src/cpthemepluginentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/themeplugin/src/cpthemepluginentryitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPTHEMEPLUGINENTRYITEMDATA_H +#define CPTHEMEPLUGINENTRYITEMDATA_H + +#include + +class CpThemePluginEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT +public: + explicit CpThemePluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const HbIcon &icon = HbIcon(), + const HbDataFormModelItem *parent = 0); + virtual ~CpThemePluginEntryItemData(); +private slots: + void onLaunchView(); +private: + virtual CpBaseSettingView *createSettingView() const; +}; + +#endif //CPTHEMEPLUGINENTRYITEMDATA_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/themeplugin/themeplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/themeplugin/themeplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +# +# 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: cpthemeplugin source files +# + +# Input +HEADERS += src/*.h +SOURCES += src/*.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/themeplugin/themeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/themeplugin/themeplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpthemeplugin + +CONFIG += hb plugin + +LIBS += -lcpframework + +include ( ../example_common.pri ) +include ( themeplugin.pri ) + +symbian { + TARGET.UID3 = 0X20025FDB +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/viewplugin/src/cpsampleview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/viewplugin/src/cpsampleview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpsampleview.h" +#include +#include +#include +#include +#include +#include + +CpSampleView::CpSampleView(QGraphicsItem *parent) : + CpBaseSettingView(0,parent), + mGroupItem(0), + mSliderItem(0), + mCheckBoxItem(0) + +{ + HbDataForm *form = qobject_cast(widget()); + if (form) { + HbDataFormModel *model = new HbDataFormModel; + + form->setHeading(tr("View from sample plugin")); + mGroupItem = new HbDataFormModelItem(HbDataFormModelItem::GroupItem, QString("Group")); + + model->appendDataFormItem(mGroupItem); + + mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, + QString("Sample Slider")); + form->addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int))); + mGroupItem->appendChild(mSliderItem); + + mCheckBoxItem = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem, + QString("Sample Check Box")); + form->addConnection(mCheckBoxItem,SIGNAL(stateChanged (int)),this,SLOT(checkBoxStateChanged(int))); + mGroupItem->appendChild(mCheckBoxItem); + + form->setModel(model); + } + + +} +CpSampleView::~CpSampleView() +{ +} + +void CpSampleView::sliderValueChanged(int value) +{ + //TODO: store your changes + // HbMessageBox::message(QString("slider value changed to:%1").arg(value)); +} +void CpSampleView::checkBoxStateChanged(int state) +{ + //TODO: store your changes + QString str = (state ? "checked" : "un-checked"); + // HbMessageBox::message(str); +} + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/viewplugin/src/cpsampleview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/viewplugin/src/cpsampleview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPSAMPLEVIEW_H +#define CPSAMPLEVIEW_H + +#include + +class HbDataFormModelItem; +class CpSettingFormItemData; + +class CpSampleView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpSampleView(QGraphicsItem *parent = 0); + virtual ~CpSampleView(); +private slots: + //need handling your member's value change + void sliderValueChanged(int value); + void checkBoxStateChanged(int state); +private: + HbDataFormModelItem *mGroupItem; + CpSettingFormItemData *mSliderItem; + CpSettingFormItemData *mCheckBoxItem; +}; +#endif// CPSAMPLEVIEW_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/viewplugin/src/cpviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/viewplugin/src/cpviewplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpviewplugin.h" +#include "cpsampleview.h" +#include + +CpViewPlugin::CpViewPlugin() +{ +} + +CpViewPlugin::~CpViewPlugin() +{ +} +QList CpViewPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + return QList() + << new CpSettingFormEntryItemDataImpl( + itemDataHelper, + tr("Entry item from sample view plugin"), + tr("view plugin descriptions")); +} + +Q_EXPORT_PLUGIN2(cpviewplugin, CpViewPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/viewplugin/src/cpviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/viewplugin/src/cpviewplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPVIEWPLUGIN_H +#define CPVIEWPLUGIN_H + +#include +#include + +class CpViewPlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpViewPlugin(); + virtual ~CpViewPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPVIEWPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/viewplugin/viewplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/viewplugin/viewplugin.pri Tue Aug 31 15:15:28 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: +# + +# Input +HEADERS += src/cpviewplugin.h \ + src/cpsampleview.h + +SOURCES += src/cpviewplugin.cpp \ + src/cpsampleview.cpp + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/examples/viewplugin/viewplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/viewplugin/viewplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpviewplugin + +include (../example_common.pri) +include (viewplugin.pri) + +symbian: { + TARGET.UID3 = 0x20025FE2 +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/rom/controlpanelui.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/rom/controlpanelui.iby Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __CONTROLPANELUI_IBY__ +#define __CONTROLPANELUI_IBY__ + +#include +#include + +#define CP_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\controlpanel.exe SHARED_LIB_DIR\controlpanel.exe +data = ZRESOURCE\apps\controlpanel.mif APP_RESOURCE_DIR\controlpanel.mif +CP_UPGRADABLE_APP_REG_RSC(controlpanel) + + +file=ABI_DIR\BUILD_DIR\cpserviceprovider.exe SHARED_LIB_DIR\cpserviceprovider.exe +CP_UPGRADABLE_APP_REG_RSC(cpserviceprovider) + +file=ABI_DIR\BUILD_DIR\cpcategorymodel.dll SHARED_LIB_DIR\cpcategorymodel.dll +file=ABI_DIR\BUILD_DIR\cpprofilewrapper.dll SHARED_LIB_DIR\cpprofilewrapper.dll +file=ABI_DIR\BUILD_DIR\cpringtoneview.dll SHARED_LIB_DIR\cpringtoneview.dll + + +file=ABI_DIR\BUILD_DIR\cppersonalizationplugin.dll SHARED_LIB_DIR\cppersonalizationplugin.dll +file=ABI_DIR\BUILD_DIR\cpcommunicationplugin.dll SHARED_LIB_DIR\cpcommunicationplugin.dll +file=ABI_DIR\BUILD_DIR\cpdeviceplugin.dll SHARED_LIB_DIR\cpdeviceplugin.dll +file=ABI_DIR\BUILD_DIR\cpprivacyplugin.dll SHARED_LIB_DIR\cpprivacyplugin.dll +file=ABI_DIR\BUILD_DIR\cplookfeelplugin.dll SHARED_LIB_DIR\cplookfeelplugin.dll +file=ABI_DIR\BUILD_DIR\cpkeytouchfdbkplugin.dll SHARED_LIB_DIR\cpkeytouchfdbkplugin.dll +file=ABI_DIR\BUILD_DIR\cpprofileactivator.dll SHARED_LIB_DIR\cpprofileactivator.dll +file=ABI_DIR\BUILD_DIR\cpvolumeplugin.dll SHARED_LIB_DIR\cpvolumeplugin.dll +file=ABI_DIR\BUILD_DIR\cpringtoneplugin.dll SHARED_LIB_DIR\cpringtoneplugin.dll + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\mainview.cpcfg resource\qt\plugins\controlpanel\config\mainview.cpcfg +data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cppersonalizationplugin.cpcfg resource\qt\plugins\controlpanel\config\cppersonalizationplugin.cpcfg +data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cpcommunicationplugin.cpcfg resource\qt\plugins\controlpanel\config\cpcommunicationplugin.cpcfg +data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cpdeviceplugin.cpcfg resource\qt\plugins\controlpanel\config\cpdeviceplugin.cpcfg +data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cpprivacyplugin.cpcfg resource\qt\plugins\controlpanel\config\cpprivacyplugin.cpcfg +data=\epoc32\data\c\resource\qt\plugins\controlpanel\config\cplookfeelplugin.cpcfg resource\qt\plugins\controlpanel\config\cplookfeelplugin.cpcfg + + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cppersonalizationplugin.qtplugin resource\qt\plugins\controlpanel\cppersonalizationplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpcommunicationplugin.qtplugin resource\qt\plugins\controlpanel\cpcommunicationplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpdeviceplugin.qtplugin resource\qt\plugins\controlpanel\cpdeviceplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpringtoneplugin.qtplugin resource\qt\plugins\controlpanel\cpringtoneplugin.qtplugin + + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/rom/controlpanelui_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/rom/controlpanelui_resources.iby Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CONTROLPANELUI_RESOURCES +#define CONTROLPANELUI_RESOURCES + + +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\control_panel.qm QT_TRANSLATIONS_DIR\control_panel.qm +data=DATAZ_\APP_RESOURCE_DIR\ControlPanel.RSC APP_RESOURCE_DIR\ControlPanel.rsc + +data=DATAZ_\APP_RESOURCE_DIR\cpserviceprovider.RSC APP_RESOURCE_DIR\cpserviceprovider.rsc + +#endif // CONTROLPANELUI_RESOURCES \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/rom/cpui_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/rom/cpui_rom.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/controlpanelui.iby CORE_APP_LAYER_IBY_EXPORT_PATH(controlpanelui.iby)" + + + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/controlpanelui_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(controlpanelui_resources.iby)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/common.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,66 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: controlpanel project - common qmake settings +# + +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin + OBJECTS_DIR = $$PWD/../$$SUBDIRPART/tmp/$$TARGET +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +INCLUDEPATH += $$PWD/inc +win32 { + # add platfrom API for windows + INCLUDEPATH += $$PWD/../../controlpanel/controlpanel_plat/inc +} + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/cpapplication.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/cpapplication.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,24 @@ +# +# 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: cpapplication source files +# + +HEADERS += src/cpmainview.h \ + src/cpmainwindow.h \ + src/cpmainmodel.h + +SOURCES += src/main.cpp \ + src/cpmainview.cpp \ + src/cpmainwindow.cpp \ + src/cpmainmodel.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/cpapplication.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/cpapplication.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,44 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = ControlPanel + +ICON = resources/qtg_large_settings.svg + +include ( ../common.pri ) +include ( cpapplication.pri ) + +CONFIG += hb + +RESOURCES += cpapplication.qrc + +LIBS += -lcplogger -lcpframework -lcpcategorymodel + +TRANSLATIONS = control_panel.ts + +symbian: { + SKINICON = qtg_large_settings + TARGET.UID3 = 0x20025FD9 + TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 + + deploy.path = C: + headers.sources += data/mainview.cpcfg + headers.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += exportheaders + + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/cpapplication.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/cpapplication.qrc Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,5 @@ + + + data/controlpanellog.conf + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/data/controlpanellog.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/data/controlpanellog.conf Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,14 @@ +[CpFramework] +logdatetime = 1 +logloggername = 1 +datetimeformat = hh:mm:ss:zzz +output = debugoutput fileoutput +fileoutput/logfile = C:/data/logs/cpframework.log +fileoutput/truncate = 1 + +[CpPerformance] +logdatetime = 1 +datetimeformat = hh:mm:ss:zzz +output = fileoutput +fileoutput/logfile = C:/data/logs/cpperformance.log +fileoutput/truncate = 1 \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/data/mainview.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/data/mainview.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/resources/qtg_large_settings.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/resources/qtg_large_settings.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/cpmainmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainmodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpmainmodel.h" +#include + +CpMainModel::CpMainModel() : + CpCategorySettingFormModel(QString("mainview.cpcfg")) + +{ +} + +CpMainModel::~CpMainModel() +{ +} + +//End of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/cpmainmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainmodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef CP_MAIN_MODEL_H +#define CP_MAIN_MODEL_H + +#include + +class CpMainModel : public CpCategorySettingFormModel +{ + Q_OBJECT +public: + CpMainModel(); + virtual ~CpMainModel(); +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/cpmainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpmainview.h" +#include "cpmainmodel.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cpcategorysettingformitemdata.h" + +//CpMainView implementation +CpMainView::CpMainView(HbMainWindow *mainWindow/*= 0*/) +: CpBaseSettingView(0,0), + mMainModel(0), + mItemDataHelper(0), + mMainWindow(mainWindow), + mActivityManager(0) +{ + //delay loading + //connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel())); + // AUTO SAVE ACTIVITY OF CONTROLPANEL + HbApplication *app= qobject_cast(qApp); + mActivityManager = app->activityManager(); + initializeMainModel(); + connect(this, SIGNAL(aboutToClose()),this, SLOT(saveActivity())); +} + +CpMainView::~CpMainView() +{ + delete mMainModel; + delete mItemDataHelper; +} + +bool CpMainView::event(QEvent *e) +{ + if (e->type() == QEvent::Show || e->type() == QEvent::ShowToParent) { + CPPERF_LOG("CpMainView shown."); + } + return CpBaseSettingView::event(e); +} + +void CpMainView::initializeMainModel() +{ + if (HbDataForm *form = qobject_cast(widget())) { + if (!mMainModel) { + mItemDataHelper = new CpItemDataHelper(form); + mMainModel = new CpMainModel; + mMainModel->initialize(*mItemDataHelper); + form->setModel(mMainModel); + connect(form, SIGNAL(activated(QModelIndex)), this, SLOT(onDataFormItemActivated(QModelIndex))); + + connect(mMainWindow, SIGNAL(aboutToChangeView(HbView *, HbView *)), this, SLOT(onAboutToChangeView(HbView *, HbView *))); + } + } + loadActivity(); +} + +void CpMainView::loadActivity() +{ + if (mMainModel == 0) { + return; + } + QVariant data = mActivityManager->activityData(QString("ControlPanelView")); + if (data.canConvert >()) + { + QList isExpanded = qvariant_cast >(data); + HbDataFormModelItem *root = mMainModel->invisibleRootItem(); + int groupCount = 0; + + if (root) { + groupCount = root->childCount(); + } + + if (groupCount == isExpanded.count()) { + for (int i = 0; i < groupCount; i++) { + HbDataFormModelItem *groupItem = root->childAt(i); + QModelIndex index = mMainModel->indexFromItem(groupItem); + HbDataForm *form = qobject_cast(widget()); + if (form) { + if (isExpanded.at(i).toBool()) { + onDataFormItemActivated(index); + } + form->setExpanded(index,isExpanded.at(i).toBool()); + } + } + } + + mActivityManager->removeActivity("ControlPanelView"); + } +} + +void CpMainView::saveActivity() +{ + HbDataFormModelItem *root = mMainModel->invisibleRootItem(); + int groupCount = 0; + QList isExpanded; + if (root) { + groupCount = root->childCount(); + } + for (int i = 0; i < groupCount; i++) { + HbDataFormModelItem *groupItem = root->childAt(i); + QModelIndex index = mMainModel->indexFromItem(groupItem); + HbDataForm *form = qobject_cast(widget()); + isExpanded << form->isExpanded(index); + } + + HbMainWindow *mainWindow = hbInstance->allMainWindows().first(); + HbView *view = mainWindow->currentView(); + if(this == view) + { + mScreenshot = QPixmap::grabWidget(mainWindow, mainWindow->rect()); + } + + QVariantHash metadata; + metadata.insert("screenshot", mScreenshot); + QVariant data(isExpanded); + + mActivityManager->addActivity("ControlPanelView", data, metadata); +} + +void CpMainView::onDataFormItemActivated(const QModelIndex &index) +{ + CPFW_LOG("CpMainView::onDataFormItemActivated"); + CpSettingFormItemData *itemData = static_cast(mMainModel->itemFromIndex(index)); + + if (CpCategorySettingFormItemData *categoryItemData = qobject_cast(itemData)) { + categoryItemData->initialize(*mItemDataHelper); + } +} +void CpMainView::onAboutToChangeView(HbView * oldView, HbView *newView) +{ + Q_UNUSED(newView); + if (this == oldView) { + mScreenshot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); + } + } + +// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/cpmainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef CPMAINVIEW_H +#define CPMAINVIEW_H + +#include + +class CpMainModel; +class HbAbstractViewItem; +class HbDataFormModelItem; +class CpItemDataHelper; +class HbMainWindow; +class HbActivityManager; + +class CpMainView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpMainView(HbMainWindow *mainWindow = 0); + virtual ~CpMainView(); + bool event(QEvent *e); +public slots: + void loadActivity(); + void saveActivity(); +private slots: + void initializeMainModel(); + void onAboutToChangeView(HbView * oldView, HbView *newView); + void onDataFormItemActivated(const QModelIndex &index); +private: + Q_DISABLE_COPY(CpMainView) +private: + CpMainModel *mMainModel; + CpItemDataHelper *mItemDataHelper; + HbMainWindow *mMainWindow; + // not own + HbActivityManager *mActivityManager; + + QPixmap mScreenshot; +}; + +#endif +//End of file + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/cpmainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpmainwindow.h" +#include "cpmainview.h" +#include +#include +#include +#include + +//CpMainWindow implementation +CpMainWindow::CpMainWindow(QWidget *parent /*= 0*/, Hb::WindowFlags windowFlags /*= Hb::WindowFlagNone*/) +: HbMainWindow(parent,windowFlags) +{ +} + +CpMainWindow::~CpMainWindow() +{ + CpMainView *mainView = qobject_cast(views().first()); + if(mainView) + { + mainView->saveActivity(); + } +} + +bool CpMainWindow::event(QEvent *e) +{ + if (e->type() == (QEvent::Type)(CpCreatePluginItemDataEvent::CreatePluginItemData)) { + CpCreatePluginItemDataEvent *event = static_cast(e); + ::createCpPluginItemData(event); + e->accept(); + } + return HbMainWindow::event(e); +} + +//End of File + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/cpmainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPMAINWINDOW_H +#define CPMAINWINDOW_H + +#include + +class CpMainWindow : public HbMainWindow +{ + Q_OBJECT +public: + explicit CpMainWindow(QWidget *parent = 0, Hb::WindowFlags windowFlags = Hb::WindowFlagNone); + ~CpMainWindow(); +public: + virtual bool event(QEvent *e); +}; + +#endif // CPMAINWINDOW_H + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpapplication/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/main.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + HbApplication app(argc, argv); + + //used by QSettings + QCoreApplication::setOrganizationName("nokia"); + QCoreApplication::setOrganizationDomain("Orbit"); + QCoreApplication::setApplicationName("ControlPanel"); + +#ifdef ENABLE_CPFW_LOG + INIT_LOGGER(CPFW_LOGGER_NAME,CP_LOGGER_CONFIG_PATH) +#endif + +#ifdef ENABLE_CPPERF_LOG + INIT_LOGGER(CPPERF_LOGGER_NAME,CP_LOGGER_CONFIG_PATH) +#endif + + CPFW_LOG("Entering ControlPanel.exe..."); + CPPERF_LOG("Entering ControlPanel.exe..."); + + HbTranslator translator("control_panel"); + translator.loadCommon(); + + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); + + CpMainWindow mainWindow; + + CpMainView *mainView = new CpMainView(&mainWindow); + QObject::connect(mainView,SIGNAL(aboutToClose()),qApp,SLOT(quit())); + mainWindow.addView(mainView); + mainWindow.setCurrentView(mainView); + + mainWindow.show(); + + int ret = app.exec(); + + CPFW_LOG("Exiting ControlPanel.exe."); + + return ret; +} + +// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/bwins/cpcategorymodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/bwins/cpcategorymodelu.def Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,53 @@ +EXPORTS + ?stop@CpTaskExecutor@@QAEXXZ @ 1 NONAME ; void CpTaskExecutor::stop(void) + ?tr@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *) + ?getStaticMetaObject@CpTaskExecutor@@SAABUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const & CpTaskExecutor::getStaticMetaObject(void) + ??1CpCategorySettingFormModel@@UAE@XZ @ 4 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(void) + ?beforeLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 5 NONAME ; void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(class CpItemDataHelper &) + ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *, int) + ??0CpCategorySettingFormModel@@QAE@ABVQString@@@Z @ 7 NONAME ; CpCategorySettingFormModel::CpCategorySettingFormModel(class QString const &) + ?staticMetaObject@CpTaskExecutor@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const CpTaskExecutor::staticMetaObject + ??_ECpTaskExecutor@@UAE@I@Z @ 9 NONAME ; CpTaskExecutor::~CpTaskExecutor(unsigned int) + ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *, int) + ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *) + ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *) + ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *) + ?getStaticMetaObject@CpCategorySettingFormModel@@SAABUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const & CpCategorySettingFormModel::getStaticMetaObject(void) + ?destroyGlobalInstance@CpTaskExecutor@@SAXXZ @ 15 NONAME ; void CpTaskExecutor::destroyGlobalInstance(void) + ?initialize@CpCategorySettingFormModel@@UAEXAAVCpItemDataHelper@@@Z @ 16 NONAME ; void CpCategorySettingFormModel::initialize(class CpItemDataHelper &) + ?initialize@CpCategorySettingFormItemData@@QAEXAAVCpItemDataHelper@@@Z @ 17 NONAME ; void CpCategorySettingFormItemData::initialize(class CpItemDataHelper &) + ?tr@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *, int) + ??0CpTaskExecutor@@QAE@PAVQObject@@@Z @ 19 NONAME ; CpTaskExecutor::CpTaskExecutor(class QObject *) + ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *, int) + ?qt_metacast@CpTaskExecutor@@UAEPAXPBD@Z @ 21 NONAME ; void * CpTaskExecutor::qt_metacast(char const *) + ??1CpCategorySettingFormItemData@@UAE@XZ @ 22 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(void) + ?beforeLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 23 NONAME ; void CpCategorySettingFormModel::beforeLoadingConfigPlugins(class CpItemDataHelper &) + ??1CpTaskExecutor@@UAE@XZ @ 24 NONAME ; CpTaskExecutor::~CpTaskExecutor(void) + ?createCpPluginItemData@@YAHPAVCpCreatePluginItemDataEvent@@@Z @ 25 NONAME ; int createCpPluginItemData(class CpCreatePluginItemDataEvent *) + ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 26 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *) + ?staticMetaObject@CpCategorySettingFormModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpCategorySettingFormModel::staticMetaObject + ?qt_metacall@CpTaskExecutor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 28 NONAME ; int CpTaskExecutor::qt_metacall(enum QMetaObject::Call, int, void * *) + ??0CpCategorySettingFormItemData@@QAE@ABVQString@@PBVHbDataFormModelItem@@@Z @ 29 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(class QString const &, class HbDataFormModelItem const *) + ?qt_metacast@CpCategorySettingFormItemData@@UAEPAXPBD@Z @ 30 NONAME ; void * CpCategorySettingFormItemData::qt_metacast(char const *) + ?toFront@CpTaskExecutor@@QAE_NPAVCpTask@@@Z @ 31 NONAME ; bool CpTaskExecutor::toFront(class CpTask *) + ?qt_metacall@CpCategorySettingFormModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 32 NONAME ; int CpCategorySettingFormModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?removeTasks@CpTaskExecutor@@AAEXXZ @ 33 NONAME ; void CpTaskExecutor::removeTasks(void) + ?qt_metacall@CpCategorySettingFormItemData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 34 NONAME ; int CpCategorySettingFormItemData::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@CpCategorySettingFormModel@@UAEPAXPBD@Z @ 35 NONAME ; void * CpCategorySettingFormModel::qt_metacast(char const *) + ?afterLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 36 NONAME ; void CpCategorySettingFormModel::afterLoadingConfigPlugins(class CpItemDataHelper &) + ?getStaticMetaObject@CpCategorySettingFormItemData@@SAABUQMetaObject@@XZ @ 37 NONAME ; struct QMetaObject const & CpCategorySettingFormItemData::getStaticMetaObject(void) + ?metaObject@CpTaskExecutor@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * CpTaskExecutor::metaObject(void) const + ??0CpCategorySettingFormItemData@@QAE@W4DataItemType@HbDataFormModelItem@@ABVQString@@1PBV2@@Z @ 39 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(enum HbDataFormModelItem::DataItemType, class QString const &, class QString const &, class HbDataFormModelItem const *) + ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *, int) + ?runTask@CpTaskExecutor@@QAE_NPAVCpTask@@_N@Z @ 41 NONAME ; bool CpTaskExecutor::runTask(class CpTask *, bool) + ?afterLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 42 NONAME ; void CpCategorySettingFormItemData::afterLoadingConfigPlugins(class CpItemDataHelper &) + ?metaObject@CpCategorySettingFormModel@@UBEPBUQMetaObject@@XZ @ 43 NONAME ; struct QMetaObject const * CpCategorySettingFormModel::metaObject(void) const + ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *, int) + ?staticMetaObject@CpCategorySettingFormItemData@@2UQMetaObject@@B @ 45 NONAME ; struct QMetaObject const CpCategorySettingFormItemData::staticMetaObject + ?run@CpTaskExecutor@@MAEXXZ @ 46 NONAME ; void CpTaskExecutor::run(void) + ?metaObject@CpCategorySettingFormItemData@@UBEPBUQMetaObject@@XZ @ 47 NONAME ; struct QMetaObject const * CpCategorySettingFormItemData::metaObject(void) const + ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *) + ??_ECpCategorySettingFormItemData@@UAE@I@Z @ 49 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(unsigned int) + ??_ECpCategorySettingFormModel@@UAE@I@Z @ 50 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(unsigned int) + ?globalInstance@CpTaskExecutor@@SAPAV1@XZ @ 51 NONAME ; class CpTaskExecutor * CpTaskExecutor::globalInstance(void) + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/cpcategorymodel.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/cpcategorymodel.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,28 @@ +# +# 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: cpframework source files +# + +HEADERS += $$PWD/src/cpplaceholderitemdata.h \ + $$PWD/src/cppluginconfigreader.h \ + $$PWD/src/cpcategorymodelutility.h + +SOURCES += $$PWD/src/cpcategorysettingformitemdata.cpp \ + $$PWD/src/cpcategorysettingformmodel.cpp \ + $$PWD/src/cpplaceholderitemdata.cpp \ + $$PWD/src/cppluginconfig.cpp \ + $$PWD/src/cppluginconfigreader.cpp \ + $$PWD/src/cpcategorymodelutility.cpp \ + $$PWD/src/cptaskexecutor.cpp + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/cpcategorymodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpcategorymodel + +include ( ../common.pri ) +include ( ../inc/inc.pri ) +include ( ./cpcategorymodel.pri ) + +CONFIG += Hb xml +DEFINES += BUILD_CPCATEGORY_GLOBAL + +LIBS += -lcplogger -lcpframework + +symbian: { + TARGET.UID3 = 0X20028736 +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/eabi/cpcategorymodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/eabi/cpcategorymodelu.def Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,56 @@ +EXPORTS + _Z22createCpPluginItemDataP27CpCreatePluginItemDataEvent @ 1 NONAME + _ZN14CpTaskExecutor11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN14CpTaskExecutor11qt_metacastEPKc @ 3 NONAME + _ZN14CpTaskExecutor11removeTasksEv @ 4 NONAME + _ZN14CpTaskExecutor14globalInstanceEv @ 5 NONAME + _ZN14CpTaskExecutor16staticMetaObjectE @ 6 NONAME DATA 16 + _ZN14CpTaskExecutor19getStaticMetaObjectEv @ 7 NONAME + _ZN14CpTaskExecutor21destroyGlobalInstanceEv @ 8 NONAME + _ZN14CpTaskExecutor3runEv @ 9 NONAME + _ZN14CpTaskExecutor4stopEv @ 10 NONAME + _ZN14CpTaskExecutor7runTaskEP6CpTaskb @ 11 NONAME + _ZN14CpTaskExecutor7toFrontEP6CpTask @ 12 NONAME + _ZN14CpTaskExecutorC1EP7QObject @ 13 NONAME + _ZN14CpTaskExecutorC2EP7QObject @ 14 NONAME + _ZN14CpTaskExecutorD0Ev @ 15 NONAME + _ZN14CpTaskExecutorD1Ev @ 16 NONAME + _ZN14CpTaskExecutorD2Ev @ 17 NONAME + _ZN26CpCategorySettingFormModel10initializeER16CpItemDataHelper @ 18 NONAME + _ZN26CpCategorySettingFormModel11qt_metacallEN11QMetaObject4CallEiPPv @ 19 NONAME + _ZN26CpCategorySettingFormModel11qt_metacastEPKc @ 20 NONAME + _ZN26CpCategorySettingFormModel16staticMetaObjectE @ 21 NONAME DATA 16 + _ZN26CpCategorySettingFormModel19getStaticMetaObjectEv @ 22 NONAME + _ZN26CpCategorySettingFormModel25afterLoadingConfigPluginsER16CpItemDataHelper @ 23 NONAME + _ZN26CpCategorySettingFormModel26beforeLoadingConfigPluginsER16CpItemDataHelper @ 24 NONAME + _ZN26CpCategorySettingFormModelC1ERK7QString @ 25 NONAME + _ZN26CpCategorySettingFormModelC2ERK7QString @ 26 NONAME + _ZN26CpCategorySettingFormModelD0Ev @ 27 NONAME + _ZN26CpCategorySettingFormModelD1Ev @ 28 NONAME + _ZN26CpCategorySettingFormModelD2Ev @ 29 NONAME + _ZN29CpCategorySettingFormItemData10initializeER16CpItemDataHelper @ 30 NONAME + _ZN29CpCategorySettingFormItemData11qt_metacallEN11QMetaObject4CallEiPPv @ 31 NONAME + _ZN29CpCategorySettingFormItemData11qt_metacastEPKc @ 32 NONAME + _ZN29CpCategorySettingFormItemData16staticMetaObjectE @ 33 NONAME DATA 16 + _ZN29CpCategorySettingFormItemData19getStaticMetaObjectEv @ 34 NONAME + _ZN29CpCategorySettingFormItemData25afterLoadingConfigPluginsER16CpItemDataHelper @ 35 NONAME + _ZN29CpCategorySettingFormItemData26beforeLoadingConfigPluginsER16CpItemDataHelper @ 36 NONAME + _ZN29CpCategorySettingFormItemDataC1EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 37 NONAME + _ZN29CpCategorySettingFormItemDataC1ERK7QStringPK19HbDataFormModelItem @ 38 NONAME + _ZN29CpCategorySettingFormItemDataC2EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 39 NONAME + _ZN29CpCategorySettingFormItemDataC2ERK7QStringPK19HbDataFormModelItem @ 40 NONAME + _ZN29CpCategorySettingFormItemDataD0Ev @ 41 NONAME + _ZN29CpCategorySettingFormItemDataD1Ev @ 42 NONAME + _ZN29CpCategorySettingFormItemDataD2Ev @ 43 NONAME + _ZNK14CpTaskExecutor10metaObjectEv @ 44 NONAME + _ZNK26CpCategorySettingFormModel10metaObjectEv @ 45 NONAME + _ZNK29CpCategorySettingFormItemData10metaObjectEv @ 46 NONAME + _ZTI14CpTaskExecutor @ 47 NONAME + _ZTI26CpCategorySettingFormModel @ 48 NONAME + _ZTI29CpCategorySettingFormItemData @ 49 NONAME + _ZTV14CpTaskExecutor @ 50 NONAME + _ZTV26CpCategorySettingFormModel @ 51 NONAME + _ZTV29CpCategorySettingFormItemData @ 52 NONAME + _ZThn8_N29CpCategorySettingFormItemDataD0Ev @ 53 NONAME + _ZThn8_N29CpCategorySettingFormItemDataD1Ev @ 54 NONAME + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,322 @@ +/* +* 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: Utility class for cpcategorymodel. +* +*/ +#include "cpcategorymodelutility.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cpcategorysettingformitemdata.h" +#include "cppluginconfigreader.h" +#include "cpplaceholderitemdata.h" + +static HbMainWindow *mainWindow() +{ + QList< HbMainWindow* > mainWindows = hbInstance->allMainWindows(); + if (!mainWindows.isEmpty()) { + return mainWindows.front(); + } + return 0; +} + + +//#define ASYNC_LOAD_CPPLUGIN + +class CpLoadConfigPluginsTask : public CpTask +{ +public: + CpLoadConfigPluginsTask(HbDataFormModelItem *parentItem, + const QString &configFile, + CpItemDataHelper *itemDataHelper, + int startPosition) : + mParentItem(parentItem), + mConfigFile(configFile), + mItemDataHelper(itemDataHelper), + mStartPosition(startPosition) + { + + } + + virtual ~CpLoadConfigPluginsTask() + { + + } + + virtual void execute(volatile bool *stopped) + { + if (!mParentItem) { + return; + } + + QString configPath(mConfigFile); + QFileInfo fi(mConfigFile); + //if it is a relative path, search the config file from device drives. + if (!fi.isAbsolute()) { + QStringList dirs = CpCategoryModelUtility::configFileDirectories(); + foreach(const QString &dir,dirs) { + configPath = dir + fi.fileName(); + if (QFileInfo(configPath).exists()) { + CPFW_LOG(configPath + " has been found."); + break; + } + } + } + + QList pluginConfigs = CpPluginConfigReader(configPath).readCpPluginConfigs(); + + int position = mStartPosition; + foreach(const CpPluginConfig &pluginConfig, pluginConfigs) { + if (stopped && *stopped) { + break; + } + + CPFW_LOG(QLatin1String("Load plugin: ") + pluginConfig.mPluginFile + " from " + configPath); + + CpCreatePluginItemDataEvent *event = new CpCreatePluginItemDataEvent; + + event->mParentItem = mParentItem; + + if (mStartPosition < 0) { + event->mItemPosition = mStartPosition; //append + } + else { + event->mItemPosition = position++; + } + + event->mItemDataHelper = mItemDataHelper; + + event->mDisplayName = pluginConfig.mDisplayName; + event->mDescription = pluginConfig.mDescription; + event->mPluginFile = pluginConfig.mPluginFile; + + //firstly, handle CpPluginInterface + if (CpPluginInterface *plugin = CpPluginLoader::loadCpPluginInterface(pluginConfig.mPluginFile)) { + CPFW_LOG("Load root component CpPluginInterface succeed."); + event->mPluginInterface = plugin; + } + + //post event to main window in main thread + QCoreApplication::postEvent(mainWindow(),event); + + } //end foreach + + } +private: + HbDataFormModelItem *mParentItem; + QString mConfigFile; + CpItemDataHelper *mItemDataHelper; + int mStartPosition; +}; + +void CpCategoryModelUtility::buildConfigPluginItems(HbDataFormModelItem *parent, + const QString &configFile, + CpItemDataHelper &itemDataHelper, + int startPosition) +{ +#ifdef ASYNC_LOAD_CPPLUGIN + CpTaskExecutor::globalInstance()->runTask + ( new CpLoadConfigPluginsTask(parent,configFile,&itemDataHelper,startPosition) ); + +#else + if (!parent) { + return; + } + + QString configPath(configFile); + QFileInfo fi(configFile); + //if it is a relative path, search the config file from device drives. + if (!fi.isAbsolute()) { + QStringList dirs = CpCategoryModelUtility::configFileDirectories(); + foreach(const QString &dir,dirs) { + configPath = dir + fi.fileName(); + if (QFileInfo(configPath).exists()) { + CPFW_LOG(configPath + " has been found."); + break; + } + } + } + + QList pluginConfigs = CpPluginConfigReader(configPath).readCpPluginConfigs(); + + foreach(const CpPluginConfig &pluginConfig, pluginConfigs) { + CPFW_LOG(QLatin1String("Load plugin: ") + pluginConfig.mPluginFile + " from " + configPath); + + QList itemDataList; + + //firstly, handle CpPluginInterface + if (CpPluginInterface *plugin = CpPluginLoader::loadCpPluginInterface(pluginConfig.mPluginFile)) { + CPFW_LOG("Load root component CpPluginInterface succeed."); + itemDataList = plugin->createSettingFormItemData(itemDataHelper); + } + + else { + CPFW_LOG(QLatin1String("Load plugin:") + pluginConfig.mPluginFile + QLatin1String(" failed.")); + #ifdef _DEBUG + CPFW_LOG(QLatin1String("***Add a placeholder.")); + itemDataList.append(new CpPlaceHolderItemData(itemDataHelper,pluginConfig)); + #endif + } + + foreach(CpSettingFormItemData *itemData,itemDataList) { + if (itemData) { + //append the new created setting form item to its parent item. + parent->insertChild(startPosition++,itemData); + //commented this for only loading group plugin when startup + /*if (CpCategorySettingFormItemData *categoryItemData + = qobject_cast(itemData)) { + categoryItemData->initialize(itemDataHelper); + }*/ + + //set the text and description from config if it is empty. + setEntryItemContentIfEmpty(itemData,pluginConfig.mDisplayName,pluginConfig.mDescription); + } + } //end foreach + + } //end foreach +#endif + +} + +bool CpCategoryModelUtility::setEntryItemContentIfEmpty(CpSettingFormItemData *itemData, + const QString &displayName, + const QString &description) +{ + CpSettingFormEntryItemData *entryItemData = qobject_cast< CpSettingFormEntryItemData* > (itemData); + if (!entryItemData) { + return false; + } + + if (entryItemData->text().isEmpty()) { + entryItemData->setText(displayName); + } + if (entryItemData->description().isEmpty()) { + entryItemData->setDescription(description); + } + if (entryItemData->iconName().isEmpty()) { + entryItemData->setIconName( + QLatin1String(":/icon/qgn_prop_set_default_sub.svg") ); + } + + return true; +} + +QStringList CpCategoryModelUtility::drives() +{ + static QStringList drives; + + if (drives.empty()) { + CPFW_LOG("device drives:"); +#ifdef WIN32 + drives.append("C:"); + CPFW_LOG("C:"); +#else + QFileInfoList fileInfoList = QDir::drives(); + foreach(const QFileInfo &fileInfo,fileInfoList) { + QString str = fileInfo.filePath(); + if (str.length() > 2) { + str = str.left(2); + } + drives.append(str); + CPFW_LOG(str); + } +#endif + } + + return drives; +} + +static QStringList directoriesFromAllDrives(const QString &baseDir) +{ + QStringList dirs; + + QStringList drives = CpCategoryModelUtility::drives(); + foreach(const QString &drive,drives) { + QString dir = drive + baseDir + QDir::separator(); + if (QFileInfo(dir).exists()) { + dirs.append(dir); + CPFW_LOG(dir); + } + } + + return dirs; +} + +QStringList CpCategoryModelUtility::pluginDirectories() +{ + static QStringList dirs; + if (dirs.empty()) { + CPFW_LOG("ControlPanel plugin derectories:") + dirs = directoriesFromAllDrives(CP_PLUGIN_PATH); + } + return dirs; +} + +QStringList CpCategoryModelUtility::configFileDirectories() +{ + static QStringList dirs; + if (dirs.empty()) { + CPFW_LOG("ControlPanel configuration file derectories:"); + dirs = directoriesFromAllDrives(CP_PLUGIN_CONFIG_PATH); + } + return dirs; +} + +CP_CATEGORY_EXPORT int createCpPluginItemData(CpCreatePluginItemDataEvent *event) +{ + QList itemDataList; + + if (event->mPluginInterface) { + itemDataList = event->mPluginInterface->createSettingFormItemData(*(event->mItemDataHelper)); + } + + else { + #ifdef _DEBUG + itemDataList.append(new CpPlaceHolderItemData(*(event->mItemDataHelper),event->mDisplayName,event->mPluginFile)); + #endif + } + + foreach(CpSettingFormItemData *itemData,itemDataList) { + if (itemData) { + //append the new created setting form item to its parent item. + if (event->mItemPosition < 0) { + event->mParentItem->appendChild(itemData); + } + else { + event->mParentItem->insertChild(event->mItemPosition,itemData); + } + + if (CpCategorySettingFormItemData *categoryItemData + = qobject_cast(itemData)) { + categoryItemData->initialize(*(event->mItemDataHelper)); + } + + //set the text and description from config if it is empty. + CpCategoryModelUtility::setEntryItemContentIfEmpty(itemData,event->mDisplayName,event->mDescription); + } + } //end foreach + + return itemDataList.count(); +} + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef CPCATEGORYMODELUTILITY_H +#define CPCATEGORYMODELUTILITY_H + +#include + +class HbDataFormModelItem; +class CpItemDataHelper; +class CpSettingFormItemData; + +class CpCategoryModelUtility +{ +public: + /* + load all controlpanel plugins from configuration file, + and create model items form the loaded plugins + and append model items to given parent + */ + static void buildConfigPluginItems( + HbDataFormModelItem *parent, + const QString &configFile, + CpItemDataHelper &itemDataHelper, + int startPosition); + + /* + setEntryItemContentIfEmpty + */ + static bool setEntryItemContentIfEmpty( + CpSettingFormItemData *itemData, + const QString &displayName, + const QString &description); + + /* + get all physical drives of the devices + */ + static QStringList drives(); + + /* + get all controlpanel plugin directories of the device + */ + static QStringList pluginDirectories(); + + /* + get all config directories of the device + */ + static QStringList configFileDirectories(); + +}; + +#endif // CPCATEGORYMODELUTILITY_H + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,112 @@ +/* +* 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: An extension to CpSettingFormItemData, can be filled with model items comes from controlpanel plugins. +* +*/ +#include "cpcategorysettingformitemdata.h" +#include +#include "cpcategorymodelutility.h" + +/* + * Private implementation + */ +class CpCategorySettingFormItemDataPrivate +{ +public: + CpCategorySettingFormItemDataPrivate(const QString &configFile) : + mInitialized(false), + mConfigFile(configFile) + { + } + + ~CpCategorySettingFormItemDataPrivate() + { + } + +public: + bool mInitialized; + QString mConfigFile; +}; + +/* + * Constructor + */ +CpCategorySettingFormItemData::CpCategorySettingFormItemData( + HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile, + const HbDataFormModelItem *parent /*= 0*/) : + CpSettingFormItemData(type,label,parent), + d(new CpCategorySettingFormItemDataPrivate(configFile)) +{ +} + +/* + * Overloaded constructor + */ +CpCategorySettingFormItemData::CpCategorySettingFormItemData( + const QString &configFile /*= QString()*/, + const HbDataFormModelItem *parent /*= 0*/) : + CpSettingFormItemData(parent), + d(new CpCategorySettingFormItemDataPrivate(configFile)) +{ +} + +/* + * Desctructor + */ +CpCategorySettingFormItemData::~CpCategorySettingFormItemData() +{ + delete d; +} + +/* + * Initialize + */ +void CpCategorySettingFormItemData::initialize(CpItemDataHelper &itemDataHelper) +{ + //avoid to be called twice + if (!d->mInitialized) { + //give derived class a chance do their special things before loading config plugins + beforeLoadingConfigPlugins(itemDataHelper); + + int pluginItemStartPosition = childCount(); + //give derived class a chance do their special things after loading config plugins + afterLoadingConfigPlugins(itemDataHelper); + + //load plugins which are configured + CpCategoryModelUtility::buildConfigPluginItems( + this, + d->mConfigFile, + itemDataHelper, + pluginItemStartPosition); + + d->mInitialized = true; + } +} + +/* + * Derived class can override this function to do some specific work before loading config plugins + */ +void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/) +{ +} +/* + * Derived class can override this function to do some specific work before loading config plugins + */ +void CpCategorySettingFormItemData::afterLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/) +{ +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,98 @@ +/* +* 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: An extension to HbDataFormModel, can be filled with model items comes from controlpanel plugins. +* +*/ + +#include "cpcategorysettingformmodel.h" +#include +#include "cpcategorymodelutility.h" +#include + +/* + * Private implementation + */ +class CpCategorySettingFormModelPrivate +{ +public: + CpCategorySettingFormModelPrivate(const QString &configFile) : + mInitialized(false), + mConfigFile(configFile) + { + } + + ~CpCategorySettingFormModelPrivate() + { + } + +public: + bool mInitialized; + QString mConfigFile; +}; + +/* + * Constructor + */ +CpCategorySettingFormModel::CpCategorySettingFormModel(const QString &configFile) : + d (new CpCategorySettingFormModelPrivate(configFile)) +{ +} + +/* + * Destructor + */ +CpCategorySettingFormModel::~CpCategorySettingFormModel() +{ + delete d; +} + +/* + * Initialize + */ +void CpCategorySettingFormModel::initialize(CpItemDataHelper &itemDataHelper) +{ + //avoid to be called twice + if (!d->mInitialized) { + //give derived class a change do their special things before loading config plugins + beforeLoadingConfigPlugins(itemDataHelper); + + int pluginItemStartPosition = invisibleRootItem()->childCount(); + //give derived class a change do their special things after loading config plugins + afterLoadingConfigPlugins(itemDataHelper); + + //load plugins which are configured + CpCategoryModelUtility::buildConfigPluginItems(invisibleRootItem(), + d->mConfigFile, + itemDataHelper, + pluginItemStartPosition); + + d->mInitialized = true; + } +} + +/* + * Derived class can override this function to do some specific work before loading config plugins + */ +void CpCategorySettingFormModel::beforeLoadingConfigPlugins(CpItemDataHelper&/*itemDataHelper*/) +{ +} + +/* + * Derived class can override this function to do some specific work after loading config plugins + */ +void CpCategorySettingFormModel::afterLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/) +{ +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,69 @@ +/* +* 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: Placeholder for plugin configured in cpcfg file but the target is missing. +* +*/ + +#include "cpplaceholderitemdata.h" +#include +#include +#include "cppluginconfig.h" + +CpPlaceHolderItemData::CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper, + const CpPluginConfig &pluginConfig) + : CpSettingFormEntryItemData( + itemDataHelper, + pluginConfig.mDisplayName, + pluginConfig.mPluginFile) +{ +} + +CpPlaceHolderItemData::CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper, + const QString &displayName, + const QString &pluginFile) + : CpSettingFormEntryItemData ( + itemDataHelper, + displayName, + pluginFile) +{ + +} + +CpPlaceHolderItemData::~CpPlaceHolderItemData() +{ +} + +void CpPlaceHolderItemData::onLaunchView() +{ + QString message; + QTextStream stream(&message); + stream << "Load plugin:" + << description() + << " faild." + << "Please check:\n" + << "1. if the dll name is correct in configuration file.\n" + << "2 if the dll has been generated.\n" + << "3. if the plugin stub file is in place.\n" + << "4. if the dll is valid Qt plugin."; + + HbMessageBox::warning(message); +} + +CpBaseSettingView *CpPlaceHolderItemData::createSettingView() const +{ + return 0; +} + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Placeholder for plugin configured in cpcfg file but the target is missing. +* +*/ + +#ifndef CPPLACEHOLDERITEMDATA_H +#define CPPLACEHOLDERITEMDATA_H + +#include + +class CpPluginConfig; +class CpItemDataHelper; + +class CpPlaceHolderItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT +public: + CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper,const CpPluginConfig &pluginConfig); + CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper,const QString &displayName,const QString &pluginFile); + virtual ~CpPlaceHolderItemData(); +private slots: + virtual void onLaunchView(); +private: + virtual CpBaseSettingView *createSettingView() const; +}; + +#endif //CPPLACEHOLDERITEMDATA_H + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,36 @@ +/* +* 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: An entry for a plugin defined in cpcfg file. +* +*/ + +#include "cppluginconfig.h" +#include + +CpPluginConfig::CpPluginConfig() : + mUid(0), + mDisplayName(QString()), + mPluginFile(QString()), + mDescription(QString()) +{ + +} + +void CpPluginConfig::dump() +{ + CPFW_LOG(QLatin1String("id = ") + QString("0x%1").arg(mUid,0,16)); + CPFW_LOG(QLatin1String("diplayname = ") + mDisplayName); + CPFW_LOG(QLatin1String("dll = ") + mPluginFile); + CPFW_LOG(QLatin1String("desc = ") + mDescription); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cppluginconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfig.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An entry for a controlpanel plugin defined in cpcfg file. +* +*/ + +#ifndef CPPLUGINCONFIG_H +#define CPPLUGINCONFIG_H + +#include + +class CpPluginConfig +{ +public: + CpPluginConfig(); + void dump(); +public: + int mUid; //UID3 for the plugin + QString mDisplayName; + QString mPluginFile; + QString mDescription; +}; + +#endif /* CPPLUGINCONFIG_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,233 @@ +/* +* 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: This class reads cpcfg files. +* +*/ + +#include "cppluginconfigreader.h" +#include +#include +#include + +const QString CHILD_PLUGINS_TAG = "childplugins"; +const QString PLUGIN_TAG = "plugin"; +const QString PLUGIN_ID_ATTR = "id"; +const QString PLUGIN_DLL_ATTR = "dll"; +const QString PLUGIN_DISPALYNAME_ATTR = "displayname"; +const QString DESC_TAG = "desc"; + +/* + * Constructor. + * @configPath : the full path of the config file. + */ +CpPluginConfigReader::CpPluginConfigReader(const QString &configPath) +: mConfigPath (configPath) +{ +} + +/* + * Desctructor + */ +CpPluginConfigReader::~CpPluginConfigReader() +{ +} + +/* + * Reads a cpcfg file, returns a list of CpPluginConfig. + */ +QList CpPluginConfigReader::readCpPluginConfigs() +{ + CPFW_LOG(QLatin1String("reading cpcfg file:") + mConfigPath); + + // Empty config file + if (mConfigPath.isNull() || mConfigPath.isEmpty()) { + CPFW_LOG("CpPluginConfigReader::readCpPluginConfigs() mConfigPath is empty."); + return QList (); + } + + QFile file(mConfigPath); + + // Config file doesn't exist + if (!file.exists()) { + CPFW_LOG( mConfigPath + " does not exist."); + return QList (); + } + + // Open config file failed + if (!file.open(QFile::ReadOnly | QFile::Text)) { + CPFW_LOG(QString("CpPluginConfigReader::readCpPluginConfigs() open file failed. Error:%1") + .arg(static_cast(file.error()),0,10)); + return QList (); + } + + QXmlStreamReader reader(&file); + + QList cpPluginConfigList; + + readCpPluginConfigs(reader, cpPluginConfigList); + + file.close(); + + return cpPluginConfigList; +} + +/* + * Read a list of CpPluginConfig from a xml stream. + */ +void CpPluginConfigReader::readCpPluginConfigs(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) +{ + xmlReader.readNext(); + + while (!xmlReader.atEnd()) { + + if (xmlReader.isStartElement()) { + // Read node + if (xmlReader.name() == CHILD_PLUGINS_TAG) { + readChildPluginsElement(xmlReader, cpPluginConfigList); + } + else { + xmlReader.raiseError("Not a valid file with the right format."); + } + } + + else { + xmlReader.readNext(); + } + } +} + +/* + * Read node. + */ +void CpPluginConfigReader::readChildPluginsElement(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) +{ + xmlReader.readNext(); + + while (!xmlReader.atEnd()) { + + if (xmlReader.isEndElement()) { + xmlReader.readNext(); + break; + } + + if (xmlReader.isStartElement()) { + // Read node + if (xmlReader.name() == PLUGIN_TAG) { + readPluginElement(xmlReader, cpPluginConfigList); + } + // Skip invalid node + else { + skipUnknownElement(xmlReader); + } + } + + else { + xmlReader.readNext(); + } + } +} + +/* + * Read node. + */ +void CpPluginConfigReader::readPluginElement(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) +{ + CpPluginConfig cpPluginConfig; + + QXmlStreamAttributes xmlAttributes = xmlReader.attributes(); + + // Read attribute + if (xmlAttributes.hasAttribute(PLUGIN_ID_ATTR)) { + cpPluginConfig.mUid + = (xmlAttributes.value(PLUGIN_ID_ATTR)).toString().toUInt(0,16); + } + + // Read attribute + if (xmlAttributes.hasAttribute(PLUGIN_DLL_ATTR)) { + cpPluginConfig.mPluginFile + = (xmlAttributes.value(PLUGIN_DLL_ATTR)).toString(); + } + + // Read attribute + if (xmlAttributes.hasAttribute(PLUGIN_DISPALYNAME_ATTR)) { + cpPluginConfig.mDisplayName + = (xmlAttributes.value(PLUGIN_DISPALYNAME_ATTR)).toString(); + } + + // Read node + readDescElement(xmlReader,cpPluginConfig); + +#ifdef ENABLE_CPFW_LOG + cpPluginConfig.dump(); +#endif + + cpPluginConfigList.append(cpPluginConfig); +} + +/* + * Read node. + */ +void CpPluginConfigReader::readDescElement(QXmlStreamReader &xmlReader,CpPluginConfig &cpPluginConfig) +{ + xmlReader.readNext(); + + while (!xmlReader.atEnd()) { + + if (xmlReader.isEndElement()) { + xmlReader.readNext(); + break; + } + + if (xmlReader.isStartElement()) { + // valid description node + if (xmlReader.name() == DESC_TAG) { + cpPluginConfig.mDescription = xmlReader.readElementText(); + if (xmlReader.isEndElement()) { + xmlReader.readNext(); + } + } + // invalid node, skip it + else { + skipUnknownElement(xmlReader); + } + } + + else { + xmlReader.readNext(); + } + } +} + +/* + * ignore invalid node. + */ +void CpPluginConfigReader::skipUnknownElement(QXmlStreamReader &xmlReader) +{ + xmlReader.readNext(); + + while (!xmlReader.atEnd()) { + + if (xmlReader.isEndElement()) { + xmlReader.readNext(); + break; + } + + if (xmlReader.isStartElement()) { + skipUnknownElement(xmlReader); + } + else { + xmlReader.readNext(); + } + } +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,80 @@ +/* +* 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: This class reads cpcfg files. +* +*/ + +/* configuration format: + + + + This is Personalization + + + This is Communication + + + This is Application settings + + + This is Device + + +*/ + +/* Usage: + + const QString file("\\resource\\qt\\plugins\\controlpanel\\config\\applicationsettingsplugin.cpcfg"); + + CpPluginConfigReader cfgReader(file); + QList cfgList = cfgReader.readCpPluginConfigs(); + + foreach (CpPluginConfig cfg, cfgList) + { + cfg.dump(); + } +*/ + +#ifndef CPPLUGINCONFIGREADER_H +#define CPPLUGINCONFIGREADER_H + +#include +#include +#include "cppluginconfig.h" + +class QXmlStreamReader; + +class CpPluginConfigReader +{ +public: + explicit CpPluginConfigReader(const QString &configPath); + ~CpPluginConfigReader(); + + QList readCpPluginConfigs(); + +private: + void readCpPluginConfigs(QXmlStreamReader &xmlReader, + QList &cpPluginConfigList); + void readChildPluginsElement(QXmlStreamReader &xmlReader, + QList &cpPluginConfigList); + void readPluginElement(QXmlStreamReader &xmlReader, + QList &cpPluginConfigList); + void readDescElement(QXmlStreamReader &xmlReader, + CpPluginConfig &cpPluginConfig); + void skipUnknownElement(QXmlStreamReader &xmlReader); +private: + QString mConfigPath; +}; + +#endif /* CPPLUGINCONFIGREADER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/src/cptaskexecutor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cptaskexecutor.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "cptaskexecutor.h" +#include +#include +#include +#include + +static QPointer g_instance; + +CpTaskExecutor *CpTaskExecutor::globalInstance() +{ + if (!g_instance) { + g_instance = new CpTaskExecutor(); + } + return g_instance.data(); +} + +void CpTaskExecutor::destroyGlobalInstance() +{ + delete g_instance.data(); +} + +CpTaskExecutor::CpTaskExecutor(QObject *parent /*=0*/) +: QThread(parent), mStopped(false) +{ +} + +CpTaskExecutor::~CpTaskExecutor() +{ + stop(); +} + +bool CpTaskExecutor::runTask(CpTask *task,bool append /*= false*/) +{ + if (mStopped) { + if (isRunning()) { + qDebug() << "thread in stopping process...can not run task.\r\n"; + return false; + } + mStopped = false; + } + + if (task) { + { + QMutexLocker locker(&mMutex); + if (append) { + mTasks.append(task); + } + else { + mTasks.insert(0,task); + } + } + + if (!isRunning()) { + qDebug() << "isRunning() == false, call start()\r\n"; + start(); + } + } + + return true; +} + +void CpTaskExecutor::stop() +{ + if (!mStopped && isRunning() ) { + mStopped = true; + removeTasks(); + wait(); //wait for finished + } +} + +void CpTaskExecutor::removeTasks() +{ + QMutexLocker locker(&mMutex); + + QList::const_iterator begin(mTasks.begin()); + QList::const_iterator end(mTasks.end()); + for (; begin != end; ++begin) { + if ((*begin)->autoDelete()) { + delete (*begin); + } + } + + mTasks.clear(); +} + +void CpTaskExecutor::run() +{ + while (!mStopped) { + CpTask *task = 0; + { + QMutexLocker locker(&mMutex); + if (mTasks.isEmpty()) { + break; + } + task = mTasks.takeFirst(); + } + try { + task->execute(&mStopped); + task->complete(&mStopped); + }catch(...) { + qDebug() << "excetion occur when running task\r\n"; + } + + if (task->autoDelete()) { + delete task; + } + } +} + +bool CpTaskExecutor::toFront(CpTask *task) +{ + QMutexLocker locker(&mMutex); + QList::iterator foundIterator = ::qFind(mTasks.begin(),mTasks.end(),task); + if (foundIterator == mTasks.end()) { + return false; + } + + mTasks.erase(foundIterator); + mTasks.insert(0,task); + + return true; +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/firstpluginforcpcategorymodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/firstpluginforcpcategorymodel.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,55 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = firstpluginforcpcategorymodel + +MOC_DIR = moc +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +CONFIG += hb plugin +LIBS += -lcpframework +CONFIG += symbian_test + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} + +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += src/firstpluginforcpcategorymodel.h \ + src/firstpluginviewforcpcategorymodel.h + +SOURCES += src/firstpluginforcpcategorymodel.cpp \ + src/firstpluginviewforcpcategorymodel.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginforcpcategorymodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginforcpcategorymodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,26 @@ +#include "firstpluginforcpcategorymodel.h" +#include "firstpluginviewforcpcategorymodel.h" +#include + +FirstPluginForCpCategoryModel::FirstPluginForCpCategoryModel() +{ +} + +FirstPluginForCpCategoryModel::~FirstPluginForCpCategoryModel() +{ +} +QList FirstPluginForCpCategoryModel::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + return QList() + << new CpSettingFormEntryItemDataImpl( + itemDataHelper, + tr("The plugin for test"), + tr("TestPlugin.")); +} + +CpBaseSettingView *FirstPluginForCpCategoryModel::createSettingView(const QVariant &hint) const +{ + return 0; +} + +Q_EXPORT_PLUGIN2(FirstPluginForCpCategoryModel, FirstPluginForCpCategoryModel); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginforcpcategorymodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginforcpcategorymodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +#ifndef FIRSTPLUGINFORCPCATEGORYMODEL_H +#define FIRSTPLUGINFORCPCATEGORYMODEL_H + +#include +#include +#include + +class FirstPluginForCpCategoryModel : public QObject, public CpPluginInterface, public CpLauncherInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) + Q_INTERFACES(CpLauncherInterface) +public: + FirstPluginForCpCategoryModel(); + virtual ~FirstPluginForCpCategoryModel(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + virtual CpBaseSettingView *createSettingView(const QVariant &hint) const; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginviewforcpcategorymodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginviewforcpcategorymodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +#include "firstpluginviewforcpcategorymodel.h" + +#include +#include +#include +#include +#include +#include + +FirstPluginViewForCategoryModel::FirstPluginViewForCategoryModel(QGraphicsItem *parent) + : CpBaseSettingView(0,parent), + mGroupItem(0), + mSliderItem(0) +{ + HbDataForm *form = qobject_cast(widget()); + if (form) { + HbDataFormModel *model = new HbDataFormModel; + + form->setHeading(tr("View from test plugin")); + mGroupItem = new HbDataFormModelItem(HbDataFormModelItem::GroupItem, QString("Group")); + + model->appendDataFormItem(mGroupItem); + + mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, + QString("New Slider")); + mSliderItem->setContentWidgetData("iconEnabled","FALSE"); + form->addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int))); + mGroupItem->appendChild(mSliderItem); + + form->setModel(model); + } +} +FirstPluginViewForCategoryModel::~FirstPluginViewForCategoryModel() +{ +} + +void FirstPluginViewForCategoryModel::testClose() +{ + close(); +} +void FirstPluginViewForCategoryModel::sliderValueChanged(int value) +{ + //Disable the slider alert. + HbMessageBox::information(QString("slider value changed to:%1").arg(value)); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginviewforcpcategorymodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/src/firstpluginviewforcpcategorymodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,25 @@ +#ifndef FIRSTPLUGINVIEWFORCPCATEGORYMODEL_H +#define FIRSTPLUGINVIEWFORCPCATEGORYMODEL_H + +#include +#include + +class HbDataFormModelItem; +class CpSettingFormItemData; + +class FirstPluginViewForCategoryModel : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit FirstPluginViewForCategoryModel(QGraphicsItem *parent = 0); + virtual ~FirstPluginViewForCategoryModel(); +public: + void testClose(); +private slots: + void sliderValueChanged(int value); + +private: + HbDataFormModelItem *mGroupItem; + CpSettingFormItemData *mSliderItem; +}; +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/secondpluginforcpcategorymodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/secondpluginforcpcategorymodel.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,55 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = secondpluginforcpcategorymodel + +MOC_DIR = moc +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +CONFIG += hb plugin +LIBS += -lcpframework +CONFIG += symbian_test + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} + +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += src/secondpluginforcpcategorymodel.h \ + src/secondpluginviewforcpcategorymodel.h +SOURCES += src/secondpluginforcpcategorymodel.cpp \ + src/secondpluginviewforcpcategorymodel.cpp + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginforcpcategorymodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginforcpcategorymodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,26 @@ +#include "secondpluginforcpcategorymodel.h" +#include "secondpluginviewforcpcategorymodel.h" +#include + +SecondPluginForCpCategoryModel::SecondPluginForCpCategoryModel() +{ +} + +SecondPluginForCpCategoryModel::~SecondPluginForCpCategoryModel() +{ +} +QList SecondPluginForCpCategoryModel::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + return QList() + << new CpSettingFormEntryItemDataImpl( + itemDataHelper, + tr("The plugin for test"), + tr("TestPlugin.")); +} + +CpBaseSettingView *SecondPluginForCpCategoryModel::createSettingView(const QVariant &hint) const +{ + return 0; +} + +Q_EXPORT_PLUGIN2(SecondPluginForCpCategoryModel, SecondPluginForCpCategoryModel); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginforcpcategorymodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginforcpcategorymodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +#ifndef SECONDPLUGINFORCPCATEGORYMODEL_H +#define SECONDPLUGINFORCPCATEGORYMODEL_H + +#include +#include +#include + +class SecondPluginForCpCategoryModel : public QObject, public CpPluginInterface, public CpLauncherInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) + Q_INTERFACES(CpLauncherInterface) +public: + SecondPluginForCpCategoryModel(); + virtual ~SecondPluginForCpCategoryModel(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + virtual CpBaseSettingView *createSettingView(const QVariant &hint) const; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginviewforcpcategorymodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginviewforcpcategorymodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +#include "secondpluginviewforcpcategorymodel.h" + +#include +#include +#include +#include +#include +#include + +SecondPluginViewForCategoryModel::SecondPluginViewForCategoryModel(QGraphicsItem *parent) + : CpBaseSettingView(0,parent), + mGroupItem(0), + mSliderItem(0) +{ + HbDataForm *form = qobject_cast(widget()); + if (form) { + HbDataFormModel *model = new HbDataFormModel; + + form->setHeading(tr("View from test plugin")); + mGroupItem = new HbDataFormModelItem(HbDataFormModelItem::GroupItem, QString("Group")); + + model->appendDataFormItem(mGroupItem); + + mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, + QString("New Slider")); + mSliderItem->setContentWidgetData("iconEnabled","FALSE"); + form->addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int))); + mGroupItem->appendChild(mSliderItem); + + form->setModel(model); + } +} +SecondPluginViewForCategoryModel::~SecondPluginViewForCategoryModel() +{ +} + +void SecondPluginViewForCategoryModel::testClose() +{ + close(); +} +void SecondPluginViewForCategoryModel::sliderValueChanged(int value) +{ + //Disable the slider alert. + HbMessageBox::information(QString("slider value changed to:%1").arg(value)); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginviewforcpcategorymodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/src/secondpluginviewforcpcategorymodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,25 @@ +#ifndef SECONDPLUGINVIEWFORCPCATEGORYMODEL_H +#define SECONDPLUGINVIEWFORCPCATEGORYMODEL_H + +#include +#include + +class HbDataFormModelItem; +class CpSettingFormItemData; + +class SecondPluginViewForCategoryModel : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit SecondPluginViewForCategoryModel(QGraphicsItem *parent = 0); + virtual ~SecondPluginViewForCategoryModel(); +public: + void testClose(); +private slots: + void sliderValueChanged(int value); + +private: + HbDataFormModelItem *mGroupItem; + CpSettingFormItemData *mSliderItem; +}; +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/unit_common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/unit_common.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +QT += testlib +CONFIG += hb qtestlib + +QMAKE_EXTRA_TARGETS += test autotest + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + TARGET.CAPABILITY = ALL -TCB +} + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/data/pluginfileformodelitemdata.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/data/pluginfileformodelitemdata.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/runtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/runtest.bat Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +\epoc32\RELEASE\WINSCW\udeb\ut_categorymodelitemdata.exe -xml -o c:\ut_categorymodelitemdata.xml +copy \epoc32\winscw\c\ut_categorymodelitemdata.xml +del \epoc32\winscw\c\ut_categorymodelitemdata.xml \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/src/ut_categorymodelitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/src/ut_categorymodelitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test application for qt cpcategorymodel functions. +*/ + +#include "ut_categorymodelitemdata.h" +#include "cpcategorysettingformitemdata.h" +#include +#include +#include +#include +#include + +/*! + \class TestCpCategorySettingFormItem \n + \brief class name: TestCpCategorySettingFormItem \n + type of test case: unit test \n + test cases' number totally: 3 \n + */ + +void TestCpCategorySettingFormItem::initTestCase() +{ + // initialize public test data here +} + +/*! + Test Case Description: \n + 1. Fucntion Name: \n    + CpCategorySettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile, + const HbDataFormModelItem *parent = 0) \n + 2. Case Descrition: Test the first constructor function. \n + 3. Input Parameters: \n    + (1) type = HbDataFormModelItem::DataItemType, + label = QString("XX"), + configFile = QString("XX"), + parent = new HbDataFormModelItem() \n    + (2) type = HbDataFormModelItem::DataItemType, + label = QString(), + configFile = QString(), + parent = new HbDataFormModelItem()\n    + 4. Expected result: \n    + (1) no crash\n    + (2) no crash \n + */ +void TestCpCategorySettingFormItem::testFirstConstructor() +{ + HbDataFormModelItem::DataItemType aType = HbDataFormModelItem::CheckBoxItem; + QString aLabel = "testLabel"; + QString configFile = "testFile"; + HbDataFormModelItem *pParent = new HbDataFormModelItem(); + + CpCategorySettingFormItemData *pCategoryItemData = new CpCategorySettingFormItemData(aType, aLabel, configFile, pParent); + QVERIFY(pCategoryItemData != 0 ); + QVERIFY(pCategoryItemData->type()== aType); + delete pParent; + + pCategoryItemData = new CpCategorySettingFormItemData(aType, QString(), QString(), 0); + QVERIFY(pCategoryItemData != 0 ); + QVERIFY(pCategoryItemData->type()== aType); + delete pCategoryItemData; +} + +/*! + Test Case Description: \n + 1. Fucntion Name: \n    + explicit CpCategorySettingFormItemData(const QString &configFile = QString(), const HbDataFormModelItem *parent = 0); + 2. Case Descrition: \n    + Test the second constructor function. \n + 3. Input Parameters: \n    + (1) configFile = QString("XX"), *parent = new HbDataFormModelItem()\n    + (2) configFile = QString(""), *parent = new HbDataFormModelItem() \n + 4. Expected result: \n    + (1) no crash \n    + (2) no crash + */ +void TestCpCategorySettingFormItem::testSecondConstructor() +{ + QString configFile = "testFile"; + HbDataFormModelItem *pParent = new HbDataFormModelItem(); + CpCategorySettingFormItemData *pCategoryItemData = new CpCategorySettingFormItemData(configFile, pParent); + delete pParent; + + pCategoryItemData = new CpCategorySettingFormItemData(QString(), 0); + QVERIFY(pCategoryItemData != 0 ); + delete pCategoryItemData; + pCategoryItemData = 0; + + pCategoryItemData = new CpCategorySettingFormItemData(); + QVERIFY(pCategoryItemData != 0 ); + delete pCategoryItemData; +} + +/*! + Test Case Description: \n + 1. Fucntion Name: void initialize(CpItemDataHelper &itemDataHelper); \n + 2. Case Descrition: Test the initialize() function. \n + 3. Input Parameters: (1) itemDataHelper = new itemDataHelper() \n + 4. Expected result: (1) no crash \n + */ +void TestCpCategorySettingFormItem::testInit() +{ + CpItemDataHelper *itemDataHelper = new CpItemDataHelper(); + QString configFile = "pluginfileformodelitemdata.cpcfg"; + HbDataFormModelItem *pParent = new HbDataFormModelItem(); + CpCategorySettingFormItemData *pCategoryItemData = new CpCategorySettingFormItemData(configFile, pParent); + QVERIFY(pCategoryItemData != 0 ); + // mInitialized = FALSE + pCategoryItemData->initialize(*itemDataHelper); + // call initialize() again in order to test another branch (mInitialized = TRUE) + pCategoryItemData->initialize(*itemDataHelper); + delete itemDataHelper; + delete pParent; +} + +void TestCpCategorySettingFormItem::cleanupTestCase() +{ + // release all test data + QCoreApplication::processEvents(); +} + +QTEST_MAIN(TestCpCategorySettingFormItem) +//QTEST_APPLESS_MAIN(TestCpCategorySettingFormItem) diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/src/ut_categorymodelitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/src/ut_categorymodelitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cpcategorysettingformmodel class +*/ + +#ifndef UT_CATEGORYMODELITEMDATA_H_ +#define UT_CATEGORYMODELITEMDATA_H_ + +#include +class TestCpCategorySettingFormItem :public QObject +{ + Q_OBJECT +private slots: + + void initTestCase(); + + void testFirstConstructor(); // test the constructor + void testSecondConstructor(); // test the constructor + void testInit(); // test the initialize function + + void cleanupTestCase(); +}; +#endif /* UT_CATEGORYMODELITEMDATA_H_ */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/ut_categorymodelitemdata.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelitemdata/ut_categorymodelitemdata.pro Tue Aug 31 15:15:28 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: +# + +TEMPLATE = app +TARGET = ut_categorymodelitemdata +QT += testlib +CONFIG += hb qtestlib +CONFIG += symbian_test + +QMAKE_EXTRA_TARGETS += test autotest + +DEPENDPATH += . + +INCLUDEPATH += ../../src \ + ../../../inc + +LIBS += -lcpframework +LIBS += -lcpcategorymodel + +# Input +HEADERS += src/ut_categorymodelitemdata.h +SOURCES += src/ut_categorymodelitemdata.cpp + +symbian*: { + TARGET.CAPABILITY = CAP_APPLICATION + LIBS += -lfirstpluginforcpcategorymodel + + deploy.path = C: + testdll.sources += firstpluginforcpcategorymodel.dll + testdll.path = /sys/bin + + testqtplugin.sources += ../testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/qmakepluginstubs/firstpluginforcpcategorymodel.qtplugin + testqtplugin.path = /resource/qt/plugins/controlpanel + + testqtcfgfile.sources += data/pluginfileformodelitemdata.cpcfg + testqtcfgfile.path = /resource/qt/plugins/controlpanel/config + + DEPLOYMENT += testdll \ + testqtplugin \ + testqtcfgfile +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/data/configfiletestformodelutility.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/data/configfiletestformodelutility.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/runtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/runtest.bat Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +\epoc32\RELEASE\WINSCW\udeb\ut_categorymodelutility.exe -xml -o c:\ut_categorymodelutility.xml +copy \epoc32\winscw\c\ut_categorymodelutility.xml +del \epoc32\winscw\c\ut_categorymodelutility.xml \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/cptestpluginentryitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/cptestpluginentryitem.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,34 @@ +#include "CpTestPluginEntryItem.h" + +#include +#include +#include +CpTestPluginEntryItemData::CpTestPluginEntryItemData(const HbDataFormModelItem *parent /* = 0*/) +{ + +} +CpTestPluginEntryItemData::CpTestPluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text /*= QString()*/, + const QString &description /*= QString()*/, + const HbIcon &icon /*= HbIcon()*/, + const HbDataFormModelItem *parent /*= 0*/) + : CpSettingFormEntryItemData(itemDataHelper, + text, + description, + icon, + parent) +{ +} + +CpTestPluginEntryItemData::~CpTestPluginEntryItemData() +{ +} + +void CpTestPluginEntryItemData::testOnLaunchView() +{ + onLaunchView(); +} +CpBaseSettingView *CpTestPluginEntryItemData::createSettingView() const +{ + return 0; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/cptestpluginentryitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/cptestpluginentryitem.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,21 @@ +#ifndef CPTESTPLUGINENTRYITEM_H +#define CPTESTPLUGINENTRYITEM_H +#include + +class CpTestPluginEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT +public: + explicit CpTestPluginEntryItemData(const HbDataFormModelItem *parent /* = 0*/); + explicit CpTestPluginEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const HbIcon &icon = HbIcon(), + const HbDataFormModelItem *parent = 0); + virtual ~CpTestPluginEntryItemData(); +public slots: + void testOnLaunchView(); +private: + virtual CpBaseSettingView *createSettingView() const; +}; +#endif // CPTESTPLUGINENTRYITEM_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test application for qt cpcategorymodel functions. +*/ + +#include "ut_categorymodelutility.h" +#include "cptestpluginentryitem.h" +#include +#include "cpcategorysettingformitemdata.h" +#include "cpcategorysettingformmodel.h" +#include "cppluginconfig.h" +#include "cpcategorymodelutility.h" +#include +//#include +#include +#include +//#include +//#include + + +//the class for test +#include "cpcategorymodelutility.h" +/*! + \class TestCpCategoryModelUtility \n + \brief class name: TestCpCategoryModelUtility \n + type of test case: unit test \n + test cases' number totally: 7 \n + */ + +void TestCpCategoryModelUtility::initTestCase() +{ + // initialize public test data here + +} + +/*! + Test Case Description: \n + 1. Fucntion Name: \n    + static bool setEntryItemContentIfEmpty(CpSettingFormItemData *itemData, + const QString &displayName, + const QString &description) \n + 2. Case Descrition: \n    + Test the function when setting itemData as 0. \n + 3. Input Parameters:\n    + <1> itemData = 0, QString(), QString() \n + 4. Expected result: \n    + <1> bSetResult = false \n + */ +void TestCpCategoryModelUtility::testSetEntryItemReturnFalse() +{ + bool bSetResult = CpCategoryModelUtility::setEntryItemContentIfEmpty(0, QString(), QString()); + QVERIFY(bSetResult == false); +} + +/*! + Test Case Description: \n + 1. Fucntion Name: \n    + static bool setEntryItemContentIfEmpty(CpSettingFormItemData *itemData, + const QString &displayName, + const QString &description) \n + 2. Case Descrition: \n    + setEntryItemContentIfEmpty \n + 3. Input Parameters:\n    + new a subclass from CpSettingFormEntryItemData firstly. \n    + <1> itemData = new CpTestPluginEntryItemData(CpItemDataHelper, QString(XX), QString(XX),HbIcon(QString(XX))), \n    + newText = QString(XX), \n    + newDes = QString(XX),\n    + newIconName = QString(XX).\n    + <2> itemData = new CpTestPluginEntryItemData(CpItemDataHelper, QString(),QString(), HbIcon())\n    + newText = QString(XX),\n    + newDes = QString(XX) \n + 4. Expected result: \n    + <1> bSetResult = true,\n    + <2> bSetResult = true, \n + */ +void TestCpCategoryModelUtility::testSetEntryItemContent() +{ + CpItemDataHelper *pHelper = new CpItemDataHelper(); + QString textNotEmpty = "TextNotEmpty"; + QString description = "descriptionNotEmpty"; + QString iconName = "iconNameNotEmpty"; + HbIcon icon = HbIcon(iconName); + CpTestPluginEntryItemData *itemData1 = new CpTestPluginEntryItemData(*pHelper, textNotEmpty, description,icon); + QString newText = "newSetText"; + QString newDes = "newSetdescription"; + bool bSetResult1 = CpCategoryModelUtility::setEntryItemContentIfEmpty(itemData1, newText, newDes); + QVERIFY(bSetResult1 == true); + // verify the text, description and icon name cannot be set when they are not empty. + QVERIFY( itemData1->text() == textNotEmpty ); + QVERIFY( itemData1->description() == description ); + QVERIFY( itemData1->iconName() == iconName ); + delete itemData1; + + CpTestPluginEntryItemData *itemData2 = new CpTestPluginEntryItemData(*pHelper, QString(), QString(),HbIcon()); + bool bSetResult2 = CpCategoryModelUtility::setEntryItemContentIfEmpty(itemData2, newText, newDes); + QVERIFY(bSetResult2 == true); + // verify the text, description and icon name are set as default when they are empty. + QVERIFY(itemData2->text() == newText); + QVERIFY( itemData2->description() == newDes ); + QString temp = itemData2->iconName(); + QString newIconName = QLatin1String(":/icon/qgn_prop_set_default_sub.svg"); + QVERIFY( itemData2->iconName() == newIconName ); + delete itemData2; + delete pHelper; +} + +/*! + Test Case Description: \n    + 1. Fucntion Name: drives()\n + 2. Case Descrition: \n    + Verify that it can get all physical drives of the devices \n + 3. Input Parameters: none \n + 4. Expected result: dirs.count() != 0 \n + */ +void TestCpCategoryModelUtility::testDrives() +{ + QStringList dirs = CpCategoryModelUtility::drives(); + // verify the drives "C:, D:, Z:" are contained in the string list. + QVERIFY( dirs.contains( "C:", Qt::CaseSensitive ) ); + QVERIFY( dirs.contains( "D:", Qt::CaseSensitive ) ); + QVERIFY( dirs.contains( "Z:", Qt::CaseSensitive ) ); +} + +/*! + Test Case Description: \n + 1. Fucntion Name: configFileDirectories() \n + 2. Case Descrition: \n + Verify that it can get all config directories of the device \n + 3. Input Parameters: none \n + 4. Expected result: dirs.count() != 0 \n + */ +void TestCpCategoryModelUtility::testPluginDirectories() +{ + QStringList dirs = CpCategoryModelUtility::pluginDirectories(); + qDebug() << dirs; + // Verify the right plugin directory path is returned. + QVERIFY( dirs.contains( QString( "C:/resource/qt/plugins/controlpanel" ) + QDir::separator(), Qt::CaseSensitive ) ); +} + +/*! + Test Case Description: \n + 1. Fucntion Name: configFileDirectories() \n + 2. Case Descrition: Verify that it can get all config directories of the device. \n + 3. Input Parameters: none \n + 4. Expected result: dirs.count() != 0 \n + */ +void TestCpCategoryModelUtility::testConfigFileDirectories() +{ + QStringList dirs = CpCategoryModelUtility::configFileDirectories(); + qDebug() << dirs; + // Verify the right config file directory path is returned. + QVERIFY( dirs.contains( QString( "C:/resource/qt/plugins/controlpanel/config" ) + QDir::separator(), Qt::CaseSensitive ) ); +} + +/*! + Test Case Description: \n    + 1. Fucntion Name: buildConfigPluginItems()\n    + 2. Case Descrition: Verify that it can load the plugins via the plugin config file and create item data of the corresponding plugin succesfully.\n + 3. Input Parameters:\n    + <1> parent = HbDataFormModelItem(), configFile = QString(XX), pHelper = new CpItemDataHelper(), startPosition = -10\n    + <2> parent = HbDataFormModelItem(), configFile = QString(), pHelper = new CpItemDataHelper(), startPosition = 1\n + + 4. Expected result: \n    + <1> parent->childCount() == 2 \n + <2> parent->childCount() == 2 \n + */ +void TestCpCategoryModelUtility::testBuildConfigPluginItems() +{ +// HbDataFormModelItem *parent = new HbDataFormModelItem(); +// QString configFile = "configfiletestformodelutility.cpcfg"; +// int startPosition = 1; +// +// CpItemDataHelper helper; +// CpCategoryModelUtility::buildConfigPluginItems(parent, configFile, helper, startPosition); +// int childCount = parent->childCount(); +// // the configfiletestformodelutility.cpcfg contains two control panel plugins. +// QVERIFY( parent->childCount() == 2 ); +// +// CpCategoryModelUtility::buildConfigPluginItems(parent, configFile, helper, -10); +// QVERIFY( parent->childCount() == 2 ); +// +// delete parent; +} + +/*! + Test Case Description: \n + 1. Fucntion Name: CreateCpPluginItemData() \n + 2. Case Descrition: \n + + 3. Input Parameters: \n + + 4. Expected result: \n + + */ +void TestCpCategoryModelUtility::testCreateCpPluginItemData() +{ + // +} + +/*! + Descrition of what you will do in this function + */ +void TestCpCategoryModelUtility::cleanupTestCase() +{ + // release all test data + QCoreApplication::processEvents(); +} + +QTEST_MAIN(TestCpCategoryModelUtility) diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/src/ut_categorymodelutility.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cpcategorysettingformmodel class +*/ + +#ifndef UT_CATEGORYMODELUTILITY_H_ +#define UT_CATEGORYMODELUTILITY_H_ + +#include + +class TestCpCategoryModelUtility :public QObject +{ + Q_OBJECT +private slots: + + void initTestCase(); + + void testSetEntryItemReturnFalse(); // test the setEntryItemContentIfEmpty() function can return false + void testSetEntryItemContent(); // + void testDrives(); // test the drives() function + void testPluginDirectories(); // test the pluginDirectories() function + void testConfigFileDirectories(); // test the configFileDirectories() function + void testBuildConfigPluginItems(); // test the buildConfigPluginItems() function + void testCreateCpPluginItemData(); + void cleanupTestCase(); +}; +#endif /* UT_CATEGORYMODELUTILITY_H_ */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/ut_categorymodelutility.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_categorymodelutility/ut_categorymodelutility.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,60 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = ut_categorymodelutility + +QT += testlib +CONFIG += hb qtestlib +CONFIG += symbian_test + +DEPENDPATH += . + +QMAKE_EXTRA_TARGETS += test autotest + +include ( ../../../common.pri ) +include (../unit_common.pri) +include(../../../inc/inc.pri) +include(../../cpcategorymodel.pri) + +LIBS += -lcpframework -lcplogger + +CONFIG += Hb xml +DEFINES += BUILD_CPCATEGORY_GLOBAL + +symbian*: { + TARGET.CAPABILITY = CAP_APPLICATION + LIBS += -lfirstpluginforcpcategorymodel \ + -lsecondpluginforcpcategorymodel + + deploy.path = C: + testdlls.sources += firstpluginforcpcategorymodel.dll \ + secondpluginforcpcategorymodel.dll + testdlls.path = /sys/bin + + testqtplugins.sources += ../testpluginsforcpcategorymodel/firstpluginforcpcategorymodel/qmakepluginstubs/firstpluginforcpcategorymodel.qtplugin \ + ../testpluginsforcpcategorymodel/secondpluginforcpcategorymodel/qmakepluginstubs/secondpluginforcpcategorymodel.qtplugin + testqtplugins.path = /resource/qt/plugins/controlpanel + + testqtcfgfile.sources += data/configfiletestformodelutility.cpcfg + testqtcfgfile.path = /resource/qt/plugins/controlpanel/config + + DEPLOYMENT += testdlls \ + testqtplugins \ + testqtcfgfile +} +HEADERS += src/*.h +SOURCES += src/*.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/data/pluginfileforformmodel.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/data/pluginfileforformmodel.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/runtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/runtest.bat Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +\epoc32\RELEASE\WINSCW\udeb\ut_cpcategorysettingformmodel.exe -xml -o c:\ut_cpcategorysettingformmodel.xml +copy \epoc32\winscw\c\ut_cpcategorysettingformmodel.xml +del \epoc32\winscw\c\ut_cpcategorysettingformmodel.xml \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/src/ut_cpcategorysettingformmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/src/ut_cpcategorysettingformmodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test application for qt cpcategorymodel functions. +*/ + +#include "ut_cpcategorysettingformmodel.h" + +#include +#include +#include +#include +#include +//the class for test +#include "cpcategorysettingformmodel.h" +/*! + \class TestCpCategorySettingFormModel + \brief describe the test case's goal, like: \n + class name: cpcategorysettingformmodel \n + class's description \n + type of test case: unit test \n + test cases' number totally: 2\n + */ + +void TestCpCategorySettingFormModel::initTestCase() +{ + // initialize public test data here +} + +/*! + Test Case Description:\n + 1. Fucntion Name: explicit CpCategorySettingFormModel(const QString &configFile);\n + 2. Case Descrition: test the constructor function. \n + 3. Input Parameters: \n    + (1) configFile = QString("pluginfileforformmodel.cpcfg")\n    + (2) configFile = QString()\n + (3) conFile = QString("invaildConfigFile")\n +4. Expected result: \n    + (1) no crash\n    + (2) no crash\n    + (3) no crash \n + */ +void TestCpCategorySettingFormModel::testConstructor() +{ + CpCategorySettingFormModel *testCategoryModel = new CpCategorySettingFormModel(QString("pluginfileforformmodel.cpcfg")); + QVERIFY(testCategoryModel!=0); + delete testCategoryModel; + testCategoryModel = 0; + testCategoryModel = new CpCategorySettingFormModel(QString()); + QVERIFY(testCategoryModel!=0); + delete testCategoryModel; + testCategoryModel = 0; + testCategoryModel = new CpCategorySettingFormModel(QString("invaildConfigFile")); + QVERIFY(testCategoryModel!=0); + delete testCategoryModel; + testCategoryModel = 0; +} + +/*! + Test Case Description: \n + 1. Fucntion Name: virtual void initialize(CpItemDataHelper &itemDataHelper)\n + 2. Case Descrition: Verify that it can initialize the new categoryformmodel. \n + 3. Input Parameters: (1) itemDataHelper = CpItemDataHelper\n + 4. Expected result: (1) no crash\n + */ +void TestCpCategorySettingFormModel::testInit() +{ + CpCategorySettingFormModel *testCategoryModel = new CpCategorySettingFormModel(QString("pluginfileforformmodel.cpcfg")); + CpItemDataHelper *pHelper = new CpItemDataHelper(); + testCategoryModel->initialize(*pHelper); + // set mInitialized = TRUE + testCategoryModel->initialize(*pHelper); + delete testCategoryModel; + testCategoryModel = 0; + delete pHelper; + pHelper = 0; +} + +/*! + Release all the test data. + */ +void TestCpCategorySettingFormModel::cleanupTestCase() +{ + // release all test data + QCoreApplication::processEvents(); +} + +QTEST_MAIN(TestCpCategorySettingFormModel) +//QTEST_APPLESS_MAIN(TestCpCategorySettingFormModel) diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/src/ut_cpcategorysettingformmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/src/ut_cpcategorysettingformmodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cpcategorysettingformmodel class +*/ + +#ifndef UT_CPCATEGORYSETTINGFORMMODEL_H_ +#define UT_CPCATEGORYSETTINGFORMMODEL_H_ + +#include +class TestCpCategorySettingFormModel :public QObject +{ + Q_OBJECT +private slots: + + void initTestCase(); + + void testConstructor(); // test the constructor + void testInit(); // test the initialize() funtion + + void cleanupTestCase(); +}; +#endif /* UT_CPCATEGORYSETTINGFORMMODEL_H_ */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/ut_cpcategorysettingformmodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel/ut_cpcategorysettingformmodel.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,55 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = ut_cpcategorysettingformmodel +QT += testlib +CONFIG += hb qtestlib +CONFIG += symbian_test + + +QMAKE_EXTRA_TARGETS += test autotest + +DEPENDPATH += . + +INCLUDEPATH += ../../src \ + ../../../inc + +LIBS += -lcpframework +LIBS += -lcpcategorymodel + +# Input +HEADERS += src/ut_cpcategorysettingformmodel.h +SOURCES += src/ut_cpcategorysettingformmodel.cpp + +symbian*: { + TARGET.CAPABILITY = CAP_APPLICATION + LIBS += -lfirstpluginforcpcategorymodel + + deploy.path = C: + testdll.sources += firstpluginforcpcategorymodel.dll + testdll.path = /sys/bin + + testqtplugin.sources += data/firstpluginforcpcategorymodel.qtplugin + testqtplugin.path = /resource/qt/plugins/controlpanel + + testqtcfgfile.sources += data/pluginfileforformmodel.cpcfg + testqtcfgfile.path = /resource/qt/plugins/controlpanel/config + + DEPLOYMENT += testdll \ + testqtplugin \ + testqtcfgfile +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/emptypluginfortest.cpcfg diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithemptychildelement.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithemptychildelement.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithoutattrs.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithoutattrs.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongchildtag.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongchildtag.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongplugintag.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfilewithwrongplugintag.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfortest.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/pluginfortest.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/testdataputhere.dat diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/runtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/runtest.bat Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +\epoc32\RELEASE\WINSCW\udeb\ut_cppluginconfigreader.exe -xml -o c:\ut_cppluginconfigreader.xml +copy \epoc32\winscw\c\ut_cppluginconfigreader.xml +del \epoc32\winscw\c\ut_cppluginconfigreader.xml \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/src/ut_cppluginconfigreader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/src/ut_cppluginconfigreader.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cppluginconfigreader class +*/ + +#include "ut_cppluginconfigreader.h" +#include +#include +#include +#include + +/*! + class name: cppluginconfigreader + class's description: + type of test case: unit test + test cases' number totally: \n +*/ + +/*! + Description of test data \n + */ +void TestCppluginConfigReader::initTestCase() +{ + // initialize public test data here +} + +void TestCppluginConfigReader::testConstructor() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "mainview.cpcfg"); + QVERIFY(pReader!=0); + delete pReader; +} + +/*! + Test Case Description: \n + 1. Function Name: \n + QList readCpPluginConfigs();\n + 2. Case Descrition: \n + Verify that the valid config file can be read correctly. \n + 3. Input Parameters:\n + <1> valid configfiles: pluginfortest.cpcfg \n + 4. Expected result: \n + <1> return the correct plugin number \n + */ +void TestCppluginConfigReader::testReadValidConfigFile() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfortest.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY(mCorrectConfig.count() == 4 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + QList readCpPluginConfigs(); \n + 2. Case Descrition: \n + Verify the empty config file path can be dealed without any crash. \n + 3. Input Parameters: \n + <1> empty config plugin path \n + <2> config plugin path = null \n + 4. Expected result: \n + <1> no crash \n + <2> no crash \n + */ +void TestCppluginConfigReader::testReadEmptyConfigFilePath() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(""); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY(mCorrectConfig.count() == 0 ); + delete pReader; + pReader = 0; + pReader = new CpPluginConfigReader(0); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY(mCorrectConfig.count() == 0 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + QList readCpPluginConfigs(); \n + 2. Case Descrition: \n + Verify that the empty config file could be read. \n + 3. Input Parameters: \n + <1> empty config file "emptypluginfortest.cpcfg" \n + 4. Expected result: \n + <1> no crash \n + */ +void TestCppluginConfigReader::testReadEmptyConfigFile() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "emptypluginfortest.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY(mCorrectConfig.count() == 0 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + void readCpPluginConfigs(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) \n + 2. Case Descrition: \n + Verify that the function can work without crash when reading the plugin files with wrong tag. \n + 3. Input Parameters: \n + <1> config file with wrong child plugin tag: "pluginfilewithwrongchildtag.cpcfg" \n + 4. Expected result: \n + <1> no crash \n + */ +void TestCppluginConfigReader::testReaderWithWrongChildPluginTag() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithwrongchildtag.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY( mCorrectConfig.count() == 0 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + void readChildPluginsElement(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) \n + 2. Case Descrition: \n + Verify that the function can work without crash when reading the plugin files with empty child plugin element. \n + 3. Input Parameters: \n + <1> config file with empty child plugin element: "pluginfilewithemptychildelement.cpcfg" \n + 4. Expected result: \n + <1> no crash \n + */ +void TestCppluginConfigReader::testReaderWithEmptyChildElement() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithemptychildelement.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY( mCorrectConfig.count() == 0 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + void readChildPluginsElement(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) \n + 2. Case Descrition: \n + Verify that the function can work without crash when reading plugin files with wrong tags. \n + 3. Input Parameters: \n + <1> config file with wrong plugin tag: "pluginfilewithwrongplugintag.cpcfg" \n + 4. Expected result: \n + <1> no crash \n + */ +void TestCppluginConfigReader::testReaderWithWrongPluginTag() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithwrongplugintag.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY( mCorrectConfig.count() == 0 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + void readPluginElement(QXmlStreamReader &xmlReader,QList &cpPluginConfigList); \n + 2. Case Descrition: \n + Verify that the function can work without crash when reading the plugin files having no attrs. \n + 3. Input Parameters: \n + <1> plugin element has no plugin attrs: "pluginfilewithoutattrs.cpcfg" \n + <2> plugin element has wrong plugin attrs. \n + 4. Expected result: \n + <1> no crash \n + <2> no crash \n + */ +void TestCppluginConfigReader::testReaderWithoutAttrs() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithoutattrs.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + QVERIFY( mCorrectConfig.count() == 1 ); + delete pReader; + pReader = 0; +} +/*! + Test Case Description: \n + 1. Function Name: \n + void readDescElement(QXmlStreamReader &xmlReader,CpPluginConfig &cpPluginConfig) \n + 2. Case Descrition: \n + Verify that the function can work without crash when reading the plugin files with wrong tag. \n + 3. Input Parameters: \n + <1> plugin element has no desc tag: "pluginfilewithwrongdesctag.cpcfg" \n + <2> plugin element has wrong desc tag \n + 4. Expected result: \n + <1> no crash \n + <2> no crash \n + */ +void TestCppluginConfigReader::testReaderWithWrongDescTag() +{ + CpPluginConfigReader * pReader = new CpPluginConfigReader(CP_PLUGIN_CONFIG_PATH + QDir::separator() + "pluginfilewithwrongdesctag.cpcfg"); + QVERIFY(pReader!=0); + mCorrectConfig = pReader->readCpPluginConfigs(); + delete pReader; + pReader = 0; +} +/*! + Descrition of what you will do in this function + */ +void TestCppluginConfigReader::cleanupTestCase() +{ + // release all test data + QCoreApplication::processEvents(); +} + +QTEST_APPLESS_MAIN(TestCppluginConfigReader) diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/src/ut_cppluginconfigreader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/src/ut_cppluginconfigreader.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cppluginconfigreader class +*/ + +#ifndef UT_CPPLUGINCONFIGREADER_H +#define UT_CPPLUGINCONFIGREADER_H + + +#include "cppluginconfig.h" + +#include +#include + +class TestCppluginConfigReader :public QObject +{ + Q_OBJECT +private slots: + + void initTestCase(); + void testConstructor(); + void testReadValidConfigFile(); // test with a valid config file. + void testReadEmptyConfigFilePath(); // test testReadEmptyConfigFilePath() with empty path. + void testReadEmptyConfigFile(); // test with empty config file. + void testReaderWithWrongChildPluginTag(); // test with wrong child plugin tags. + void testReaderWithEmptyChildElement(); // test with empty child plugin element. + void testReaderWithWrongPluginTag(); // test with wrong plugin tag. + void testReaderWithoutAttrs(); // test without any plugin attrs. + void testReaderWithWrongDescTag(); // test with wrong desc tag. + void cleanupTestCase(); +private: + QList mCorrectConfig; +}; +#endif /* UT_CPPLUGINCONFIGREADER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pri Tue Aug 31 15:15:28 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: +# + +HEADERS += src/*.h +SOURCES += src/*.cpp + +include(../../../inc/inc.pri) +include(../../cpcategorymodel.pri) diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/ut_cppluginconfigreader.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,55 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +QT += testlib +CONFIG += hb qtestlib +CONFIG += symbian_test + +TEMPLATE = app +TARGET = ut_cppluginconfigreader +QMAKE_EXTRA_TARGETS += test autotest + +DEPENDPATH += . +INCLUDEPATH += . ../../src\ + ../../../inc + +include (../unit_common.pri) +include(../../../inc/inc.pri) +include(../../cpcategorymodel.pri) + +LIBS += -lcpframework +LIBS += -lcpcategorymodel +DEFINES += BUILD_CPCATEGORY_GLOBAL + +symbian { + + deploy.path = C: + configfiles.sources += data/pluginfortest.cpcfg \ + data/emptypluginfortest.cpcfg \ + data/pluginfilewithwrongchildtag.cpcfg \ + data/pluginfilewithemptychildelement.cpcfg \ + data/pluginfilewithwrongplugintag.cpcfg \ + data/pluginfilewithoutattrs.cpcfg \ + data/pluginfilewithwrongdesctag.cpcfg + configfiles.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += configfiles + + # This is for new exporting system coming in garden + for(configfile, configfiles.sources):BLD_INF_RULES.prj_exports += "./$$configfile $$deploy.path$$configfiles.path/$$basename(configfile)" +} + +HEADERS += src/*.h +SOURCES += src/*.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpcommunicationplugin source files +# + +# Input +HEADERS += src/cpcommunicationplugin.h \ + src/cpcommunicationgroupitemdata.h + +SOURCES += src/cpcommunicationplugin.cpp \ + src/cpcommunicationgroupitemdata.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Tue Aug 31 15:15:28 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: +# + +TEMPLATE = lib +TARGET = cpcommunicationplugin + +CONFIG += hb plugin + +include ( ../cpplugincommon.pri ) +include ( communicationplugin.pri ) + +symbian { + TARGET.UID3 = 0x20025FDF + LIBS += -lxqsettingsmanager +} + +symbian { + deploy.path = C: + headers.sources = data/cpcommunicationplugin.cpcfg + headers.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += exportheaders + + # This is for new exporting system coming in garden + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/data/cpcommunicationplugin.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/data/cpcommunicationplugin.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,22 @@ + + + + + Operator, status + + + WLAN status + + + Status text + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpcommunicationgroupitemdata.h" +#include +#include +#include +#include +#include + +CpCommunicationGroupItemData::CpCommunicationGroupItemData(const QString &configFile, + const HbDataFormModelItem *parent): + CpCategorySettingFormItemData(configFile,parent), + mAirplaneModeItem(0), + mSettingManager(new XQSettingsManager()) +{ + +} + +CpCommunicationGroupItemData::CpCommunicationGroupItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile, + const HbDataFormModelItem *parent): + CpCategorySettingFormItemData(type, label, configFile, parent), + mAirplaneModeItem(0), + mSettingManager(new XQSettingsManager()) +{ + +} + +CpCommunicationGroupItemData::~CpCommunicationGroupItemData() +{ + delete mSettingManager; +} + +void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper) +{ + mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); + mAirplaneModeItem->setContentWidgetData("text", hbTrId("txt_cp_button_offline")); + mAirplaneModeItem->setContentWidgetData("additionalText", hbTrId("txt_cp_button_offline")); + mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica")); + mAirplaneModeItem->setContentWidgetData("objectName", "airplaneModeToggle"); + mAirplaneModeItem->setContentWidgetData("checkable", true); + itemDataHelper.addConnection(mAirplaneModeItem, + SIGNAL(toggled(bool)), + this, + SLOT(toggleAirplaneMode(bool))); + + XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed); + QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt); + settingValueChanged(key,airplaneMode); + + mSettingManager->startMonitoring(key,XQSettingsManager::TypeInt); + connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); + + this->appendChild(mAirplaneModeItem); + +} + +void CpCommunicationGroupItemData::toggleAirplaneMode(bool toggled) +{ + XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed); + //toggled = true means ECoreAppUIsNetworkConnectionNotAllowed + //toggled = false means ECoreAppUIsNetworkConnectionAllowed + QVariant airplaneMode(static_cast(!toggled)); + mSettingManager->writeItemValue(key, airplaneMode); +} + +void CpCommunicationGroupItemData::settingValueChanged(const XQSettingsKey &key, const QVariant &value) +{ + if (mAirplaneModeItem + && key.uid() == KCRUidCoreApplicationUIs.iUid + && key.key() == KCoreAppUIsNetworkConnectionAllowed + && value.isValid()) { + //value.toBool() returns + //true(1) if value equals ECoreAppUIsNetworkConnectionAllowed, that means offline mode off. + //false(0) if value equals ECoreAppUIsNetworkConnectionNotAllowed, that means offline mode on. + mAirplaneModeItem->setContentWidgetData("checked", !value.toBool()); + } +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPCOMMUNICATIONGROUPITEMDATA_H +#define CPCOMMUNICATIONGROUPITEMDATA_H + +#include +class CpItemDataHelper; +class XQSettingsManager; +class XQSettingsKey; + +class CpCommunicationGroupItemData: public CpCategorySettingFormItemData +{ + Q_OBJECT +public: + explicit CpCommunicationGroupItemData(const QString &configFile = QString(), + const HbDataFormModelItem *parent = 0); + + CpCommunicationGroupItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile = QString(), + const HbDataFormModelItem *parent = 0); + + ~CpCommunicationGroupItemData(); +private slots: + void toggleAirplaneMode(bool toggled); + void settingValueChanged(const XQSettingsKey &key, const QVariant &value); +private: + virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); +private: + HbDataFormModelItem *mAirplaneModeItem; + XQSettingsManager *mSettingManager; +}; +#endif /* CPCOMMUNICATIONGROUPITEMDATA_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpcommunicationplugin.h" +#include "cpcommunicationgroupitemdata.h" +#include + +CpCommunicationPlugin::CpCommunicationPlugin() +{ +} + +CpCommunicationPlugin::~CpCommunicationPlugin() +{ +} + +QList CpCommunicationPlugin::createSettingFormItemData(CpItemDataHelper &/*itemDataHelper*/) const +{ + CpCategorySettingFormItemData *itemData = + new CpCommunicationGroupItemData( + HbDataFormModelItem::GroupItem, + hbTrId("txt_cp_subhead_connectivity"), + QString("cpcommunicationplugin.cpcfg") ); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpcommunicationplugin, CpCommunicationPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPCOMMUNICATIONPLUGIN_H +#define CPCOMMUNICATIONPLUGIN_H + + +#include +#include + +class CpCommunicationPlugin + : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpCommunicationPlugin(); + virtual ~CpCommunicationPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + + +#endif /* CPCOMMUNICATIONPLUGIN_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/cpplugincommon.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/cpplugincommon.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: controlpanel plugin project qmake common settings +# +include (../common.pri) + +LIBS += -lcplogger -lcpframework -lcpcategorymodel + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/cpplugins.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/cpplugins.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS = communicationplugin \ + deviceplugin \ + privacyplugin \ + personalizationplugin \ + profileactivatorplugin \ + volumeplugin \ + ringtoneplugin \ + keytouchfdbkplugin + #displayplugin \ + #applicationsettingsplugin \ + #accountsplugin + +CONFIG += ordered \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + power save mode + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpdeviceplugin source files +# + + +# Input +HEADERS += src/cpdeviceplugin.h +SOURCES += src/cpdeviceplugin.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/deviceplugin/deviceplugin.pro Tue Aug 31 15:15:28 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: +# + +TEMPLATE = lib +TARGET = cpdeviceplugin + +CONFIG += hb plugin + + +include ( ../cpplugincommon.pri ) +include ( deviceplugin.pri ) + +symbian { + TARGET.UID3 = 0X20025FE7 +} + +symbian { + deploy.path = C: + headers.sources = data/cpdeviceplugin.cpcfg + headers.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += exportheaders + + # This is for new exporting system coming in garden + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpdeviceplugin.h" +#include "cpcategorysettingformitemdata.h" +#include + +CpDevicePlugin::CpDevicePlugin() +{ +} + +CpDevicePlugin::~CpDevicePlugin() +{ +} + +QList CpDevicePlugin::createSettingFormItemData(CpItemDataHelper &/*itemDataHelper*/) const +{ + CpCategorySettingFormItemData *itemData = + new CpCategorySettingFormItemData( + HbDataFormModelItem::GroupItem, + hbTrId("txt_cp_subhead_device"), + QString("cpdeviceplugin.cpcfg") ); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpdeviceplugin, CpDevicePlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPDEVICEPLUGIN_H +#define CPDEVICEPLUGIN_H + + +#include +#include + +class CpDevicePlugin : public QObject, + public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpDevicePlugin(); + virtual ~CpDevicePlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + + +#endif /* CPDEVICEPLUGIN_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: keytouchfeedback plugin source files +# + +# Input +HEADERS += src/cpkeyscreenplugin.h \ + src/cpkeyscreenview.h \ + src/cpkeyscreenmodel.h \ + src/cpkeyscreenconstants.h + +SOURCES += src/cpkeyscreenplugin.cpp \ + src/cpkeyscreenview.cpp \ + src/cpkeyscreenmodel.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Tue Aug 31 15:15:28 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: +# + +TEMPLATE = lib +TARGET = cpkeytouchfdbkplugin + +CONFIG += hb plugin + +LIBS += -lcpprofilewrapper + +include ( ../cpplugincommon.pri ) +include ( keytouchfdbkplugin.pri ) + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$MOC_DIR + HEADERS += src/cpkeyscreenmodel_p.h + SOURCES += src/cpkeyscreenmodel_p.cpp + + LIBS += -lcentralrepository \ + -lfeatmgr + TARGET.UID3 = 0X20025FDE + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPKEYSCREENCONSTANTS_H +#define CPKEYSCREENCONSTANTS_H + +const int KCpKeyscreenLock15s = 15; +const int KCpKeyscreenLock30s = 30; +const int KCpKeyscreenLock45s = 45; +const int KCpKeyscreenLock60s = 60; +const int KCpKeyscreenLock120s = 120; + +const int KCpKeyscreenLockDefault30s = 30; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + + +#include "cpkeyscreenmodel.h" +#include + +#ifdef Q_OS_SYMBIAN +#include "cpkeyscreenmodel_p.h" +#endif + + +CpKeyScreenModel::CpKeyScreenModel() +{ +#ifdef Q_OS_SYMBIAN + ptr = new CpKeyScreenModelPrivate(); +#endif +} + +CpKeyScreenModel::~CpKeyScreenModel() +{ +#ifdef Q_OS_SYMBIAN + delete ptr; + ptr = 0; +#endif +} + +bool CpKeyScreenModel::isKeyguardSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isKeyguardSupported(); +#else + return 0; +#endif +} + +int CpKeyScreenModel::keyguard() +{ +#ifdef Q_OS_SYMBIAN + return ptr->keyguard(); +#else + return 0; +#endif +} + +void CpKeyScreenModel::setKeyguard(int value) +{ +#ifdef Q_OS_SYMBIAN + ptr->setKeyguard(value); +#else + Q_UNUSED(value); +#endif +} + +bool CpKeyScreenModel::isRotateSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isRotateSupported(); +#else + return false; +#endif +} + +bool CpKeyScreenModel::rotate() +{ +#ifdef Q_OS_SYMBIAN + return ptr->rotate(); +#else + return 0; +#endif +} + +void CpKeyScreenModel::setRotate(bool value) +{ +#ifdef Q_OS_SYMBIAN + ptr->setRotate(value); +#else + Q_UNUSED(value); +#endif +} + +bool CpKeyScreenModel::isBrightnessSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isBrightnessSupported(); +#else + return false; +#endif +} + +int CpKeyScreenModel::brightness() +{ +#ifdef Q_OS_SYMBIAN + return ptr->brightness(); +#else + return 0; +#endif +} + +void CpKeyScreenModel::setBrightness(int value) +{ +#ifdef Q_OS_SYMBIAN + ptr->setBrightness(value); +#else + Q_UNUSED(value); +#endif +} + +bool CpKeyScreenModel::isCallibrationSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isCallibrationSupported(); +#else + return true; +#endif +} + +// End of the file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPKEYSCREENMODEL_H +#define CPKEYSCREENMODEL_H + +class CpKeyScreenModelPrivate; + +class CpKeyScreenModel + { +public: + CpKeyScreenModel(); + ~CpKeyScreenModel(); + +public: + bool isKeyguardSupported(); + int keyguard(); + void setKeyguard(int value); + bool isRotateSupported(); + bool rotate(); + void setRotate(bool value); + bool isBrightnessSupported(); + int brightness(); + void setBrightness(int value); + bool isCallibrationSupported(); + +private: + CpKeyScreenModelPrivate* ptr; + }; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpkeyscreenmodel_p.h" +#include "cpkeyscreenconstants.h" +#include +#include +#include +#include +#include +#include // KCRUidSecuritySettings +#include // KCRUidLightSettings +#include + +CpKeyScreenModelPrivate::CpKeyScreenModelPrivate() +{ + TRAP_IGNORE( + mLightCenRep = CRepository::NewL( KCRUidLightSettings ); + mSecurityCenRep = CRepository::NewL( KCRUidSecuritySettings ); + mRotateSensor = CRepository::NewL(KHbSensorCenrepUid);); +} + +CpKeyScreenModelPrivate::~CpKeyScreenModelPrivate() +{ + delete mLightCenRep; + delete mSecurityCenRep; + delete mRotateSensor; +} + +bool CpKeyScreenModelPrivate::isKeyguardSupported() +{ + return true; +} + +int CpKeyScreenModelPrivate::keyguard() +{ + int period = KCpKeyscreenLockDefault30s; + mSecurityCenRep->Get( KSettingsAutomaticKeyguardTime, period ); + return period; +} + +void CpKeyScreenModelPrivate::setKeyguard(int value) +{ + if ( (KCpKeyscreenLock15s == value) || (KCpKeyscreenLock30s == value) + || (KCpKeyscreenLock45s == value) || (KCpKeyscreenLock60s == value) + || (KCpKeyscreenLock120s == value) ){ + mSecurityCenRep->Set( KSettingsAutomaticKeyguardTime, value ); + mLightCenRep->Set( KDisplayLightsTimeout, value ); + } +} + +bool CpKeyScreenModelPrivate::isRotateSupported() +{ + return true; +} + +bool CpKeyScreenModelPrivate::rotate() +{ + int rotate = 0; + mRotateSensor->Get(KHbSensorCenrepKey, rotate); + return rotate; +} + +void CpKeyScreenModelPrivate::setRotate(bool value) +{ + mRotateSensor->Set(KHbSensorCenrepKey, value); +} + +bool CpKeyScreenModelPrivate::isBrightnessSupported() +{ + if ( FeatureManager::FeatureSupported( KFeatureIdBrightnessControl ) ){ + return true; + } else { + return false; + } +} + +int CpKeyScreenModelPrivate::brightness() +{ + int time = 0; + mLightCenRep->Get( KLightIntensity, time ); + return time/20; +} + +void CpKeyScreenModelPrivate::setBrightness(int value) +{ + mLightCenRep->Set( KLightIntensity, value * 20 ); +} + +bool CpKeyScreenModelPrivate::isCallibrationSupported() +{ + return true; +} + +// End of the file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPKEYSCREENMODEL_P_H +#define CPKEYSCREENMODEL_P_H + +class CRepository; + +class CpKeyScreenModelPrivate + { +public: + CpKeyScreenModelPrivate(); + ~CpKeyScreenModelPrivate(); + +public: + bool isKeyguardSupported(); + int keyguard(); + void setKeyguard(int value); + bool isRotateSupported(); + bool rotate(); + void setRotate(bool value); + bool isBrightnessSupported(); + int brightness(); + void setBrightness(int value); + bool isCallibrationSupported(); + +private: + CRepository* mLightCenRep; + CRepository* mSecurityCenRep; + CRepository* mRotateSensor; + }; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpkeyscreenplugin.h" +#include "cpkeyscreenview.h" +#include + +CpKeyScreenPlugin::CpKeyScreenPlugin() +{ +} + +CpKeyScreenPlugin::~CpKeyScreenPlugin() +{ +} + +QList CpKeyScreenPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + CpSettingFormItemData* itemData = new CpSettingFormEntryItemDataImpl( + CpSettingFormEntryItemData::ListEntryItem, // item type + itemDataHelper, + hbTrId("txt_cp_list_keys_screen"), // text + QString(""), // description + "qtg_large_key_screen"); // icon name + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpkeyscreenplugin, CpKeyScreenPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPKEYSCREENPLUGIN_H +#define CPKEYSCREENPLUGIN_H + +#include +#include + +class CpKeyScreenPlugin : public QObject, public CpPluginInterface +{ +Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpKeyScreenPlugin(); + virtual ~CpKeyScreenPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPKEYSCREENPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpkeyscreenview.h" +#include "cpkeyscreenmodel.h" +#include "cpkeyscreenconstants.h" +#include +#include +#include +#include +#include +#include +#include +#include + + +CpKeyScreenView::CpKeyScreenView(QGraphicsItem *parent) : + CpBaseSettingView(0,parent), + mScreenComboButton(0), + mRotateCheckbox(0), + mBrightSliderItem(0), + mCallibItem(0), + mModel(0) +{ + HbDataForm *form = qobject_cast ( widget() ); + if (form) { + // Valid range is: + // 15 secs, 30 secs, 45 secs, 1 min, 2 mins + mScreenLockValues.insert(KCpKeyscreenLock15s,hbTrId("txt_cp_setlabel_keys_screen_val_15_seconds")); + mScreenLockValues.insert(KCpKeyscreenLock30s,hbTrId("txt_cp_setlabel_keys_screen_val_30_seconds")); + mScreenLockValues.insert(KCpKeyscreenLock45s,hbTrId("txt_cp_setlabel_keys_screen_val_45_seconds")); + mScreenLockValues.insert(KCpKeyscreenLock60s,hbTrId("txt_cp_setlabel_keys_screen_val_1_minute")); + mScreenLockValues.insert(KCpKeyscreenLock120s,hbTrId("txt_cp_setlabel_keys_screen_val_2_minutes")); + + form->setHeading(hbTrId("txt_cp_subhead_keys_screen")); + mModel = new CpKeyScreenModel(); + HbDataFormModel *model = new HbDataFormModel; + + if ( mModel->isKeyguardSupported() ) { + makeScreenItem(*model); + } + + if ( mModel->isRotateSupported() ) { + makeRotateItem(*model); + } + + makeBrightnessItem(*model); + + /* if ( mModel->isCallibrationSupported() ) { + makeCallibrationItem(*model); + }*/ + + form->setModel(model); + } +} + +void CpKeyScreenView::makeScreenItem(HbDataFormModel& model) +{ + mScreenComboButton = new CpSettingFormItemData(HbDataFormModelItem::ComboBoxItem, + hbTrId("txt_cp_setlabel_keys_screen_locked_after")); + + qobject_cast ( widget() )->addConnection( + mScreenComboButton,SIGNAL(currentIndexChanged(QString)), + this,SLOT(screenValueChanged(QString))); + + model.appendDataFormItem(mScreenComboButton, model.invisibleRootItem()); + + int period = mModel->keyguard(); + + int selectedIndex(-1); + + QMap::iterator it = mScreenLockValues.find(period); + if (it == mScreenLockValues.end()) { + mModel->setKeyguard(KCpKeyscreenLockDefault30s); // Set keyguard and backlight period to default + selectedIndex = 1; + } + else { + for (it = mScreenLockValues.begin();it != mScreenLockValues.end();++it) { + selectedIndex++; + if (it.key() == period) { + break; + } + } + } + + QStringList items = mScreenLockValues.values(); + mScreenComboButton->setContentWidgetData( QString("items"), items ); + mScreenComboButton->setContentWidgetData( QString("currentIndex"), selectedIndex); + mScreenComboButton->setContentWidgetData("objectName", "screenComboButton"); +} + +void CpKeyScreenView::makeRotateItem(HbDataFormModel& model) +{ + mRotateCheckbox = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem, QString()); + qobject_cast ( widget() )->addConnection(mRotateCheckbox,SIGNAL(stateChanged(int)),this,SLOT(rotateValueChanged(int))); + model.appendDataFormItem(mRotateCheckbox, model.invisibleRootItem()); + + mRotateCheckbox->setContentWidgetData( QString("text"), QVariant(hbTrId("txt_cp_list_autorotate_display")) ); + mRotateCheckbox->setData(HbDataFormModelItem::DescriptionRole, QString( hbTrId("txt_cp_info_rotate_the_display_content_automatical") )); + Qt::CheckState state; + if ( mModel->rotate() ){ + state = Qt::Checked; + } else { + state = Qt::Unchecked; + } + mRotateCheckbox->setContentWidgetData( QString("checkState"), state ); + mRotateCheckbox->setContentWidgetData("objectName", "rotateCheckbox"); +} + +void CpKeyScreenView::makeBrightnessItem(HbDataFormModel& model) +{ + mBrightSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, hbTrId("txt_cp_setlabel_brightness")); + qobject_cast ( widget() )->addConnection(mBrightSliderItem,SIGNAL(valueChanged(int)),this,SLOT(brightValueChanged(int))); + model.appendDataFormItem(mBrightSliderItem, model.invisibleRootItem()); + + QList sliderElements; + sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) + << QVariant(HbSlider::DecreaseElement); + mBrightSliderItem->setContentWidgetData("sliderElements",sliderElements); + mBrightSliderItem->setContentWidgetData( QString("value"), mModel->brightness() ); + mBrightSliderItem->setContentWidgetData( QString("minimum"), 1 ); + mBrightSliderItem->setContentWidgetData( QString("maximum"), 5 ); + QMap< QString, QVariant > iconElements; + iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); + iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); + mBrightSliderItem->setContentWidgetData( QString( "elementIcons" ), iconElements ); + mRotateCheckbox->setContentWidgetData("objectName", "brightSliderItem"); +} + +void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model) +{ + mCallibItem = new CpSettingFormItemData(HbDataFormModelItem::ToggleValueItem, + QString()); + qobject_cast ( widget() )->addConnection(mCallibItem,SIGNAL(pressed()),this,SLOT(launchCallib())); + model.appendDataFormItem(mCallibItem, model.invisibleRootItem()); + mCallibItem->setContentWidgetData( QString("text"), hbTrId("txt_cp_button_touch_screen_calibration")); +} + +CpKeyScreenView::~CpKeyScreenView() +{ + delete mModel; + mModel = 0; +} + +void CpKeyScreenView::screenValueChanged(const QString &value) +{ + for (QMap::iterator it = mScreenLockValues.begin(); + it != mScreenLockValues.end();++it) { + if (it.value() == value) { + mModel->setKeyguard(it.key()); + break; + } + } +} + +void CpKeyScreenView::rotateValueChanged(int value) +{ + mModel->setRotate( value ); +} + +void CpKeyScreenView::brightValueChanged(int value) +{ + mModel->setBrightness(value); +} + +void CpKeyScreenView::launchCallib() +{ +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPKEYSCREENVIEW_H +#define CPKEYSCREENVIEW_H + +#include +#include +#include + +class HbDataFormModelItem; +class HbDataFormModel; +class CpSettingFormItemData; +class CpKeyScreenModel; +class QPersistentModelIndex; +class QVariant; + +class CpKeyScreenView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpKeyScreenView(QGraphicsItem *parent = 0); + virtual ~CpKeyScreenView(); + +private: + void makeScreenItem(HbDataFormModel& model); + void makeRotateItem(HbDataFormModel& model); + void makeBrightnessItem(HbDataFormModel& model); + void makeCallibrationItem(HbDataFormModel& model); + +private slots: + void screenValueChanged(const QString&); + void rotateValueChanged(int value); + void brightValueChanged(int value); + void launchCallib(); + +private: + CpSettingFormItemData *mScreenComboButton; + CpSettingFormItemData *mRotateCheckbox; + CpSettingFormItemData *mBrightSliderItem; + CpSettingFormItemData *mCallibItem; + CpKeyScreenModel* mModel; + + QMap mScreenLockValues; +}; +#endif// CPKEYSCREENVIEW_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/lookfeelplugin/data/cplookfeelplugin.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/lookfeelplugin/data/cplookfeelplugin.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,15 @@ + + + + + + + Name of the WallPaper + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpdeviceplugin source files +# + + +# Input +HEADERS += src/cplookfeelplugin.h +SOURCES += src/cplookfeelplugin.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/lookfeelplugin/lookfeelplugin.pro Tue Aug 31 15:15:28 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: +# + +TEMPLATE = lib +TARGET = cplookfeelplugin + +CONFIG += hb plugin + + +include ( ../cpplugincommon.pri ) +include ( lookfeelplugin.pri ) + +symbian { + TARGET.UID3 = 0X20025FE0 +} + +symbian { + deploy.path = C: + headers.sources = data/cplookfeelplugin.cpcfg + headers.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += exportheaders + + # This is for new exporting system coming in garden + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cplookfeelplugin.h" +#include "cpcategorysettingformitemdata.h" + +CpLookFeelPlugin::CpLookFeelPlugin() +{ +} + +CpLookFeelPlugin::~CpLookFeelPlugin() +{ +} + +QList CpLookFeelPlugin::createSettingFormItemData(CpItemDataHelper &/*itemDataHelper*/) const +{ + CpCategorySettingFormItemData *itemData = + new CpCategorySettingFormItemData( + HbDataFormModelItem::GroupItem, + tr("Look&Feel"), + QString("cplookfeelplugin.cpcfg") ); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cplookfeelplugin, CpLookFeelPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/lookfeelplugin/src/cplookfeelplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPLOOKFEELPLUGIN_H +#define CPLOOKFEELPLUGIN_H + + +#include +#include + +class CpLookFeelPlugin : public QObject, + public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpLookFeelPlugin(); + virtual ~CpLookFeelPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + + +#endif /* CPLOOKFEELPLUGIN_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/data/cppersonalizationplugin.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/data/cppersonalizationplugin.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement_pressed.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_decrement_pressed.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment_pressed.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_increment_pressed.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_muted.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_muted.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_unmuted.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/icon/hb_vol_slider_unmuted.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cppersonalizationplugin source files +# + +# Input +HEADERS += src/cppersonalizationplugin.h \ + src/cppersonalizationgroupitemdata.h\ + src/cpprofilesettingform.h \ + ../ringtoneplugin/src/cppersonalizationentryitemdata.h \ + src/cppersonalizationadvanceview.h \ + src/cpprofilenameeditdialog.h \ + +SOURCES += src/cppersonalizationplugin.cpp \ + src/cppersonalizationgroupitemdata.cpp \ + src/cpprofilesettingform.cpp \ + ../ringtoneplugin/src/cppersonalizationentryitemdata.cpp \ + src/cppersonalizationadvanceview.cpp \ + src/cpprofilenameeditdialog.cpp \ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,41 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cppersonalizationplugin + +CONFIG += hb plugin +RESOURCES += personalizationplugin.qrc + +LIBS += -lcpprofilewrapper +LIBS += -lxqsettingsmanager -lcpringtoneview + +include ( ../cpplugincommon.pri ) +include ( personalizationplugin.pri ) + +symbian: { + TARGET.UID3 = 0X20025FE5 +} + +symbian: { + deploy.path = C: + headers.sources = data/cppersonalizationplugin.cpcfg + headers.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += exportheaders + + # This is for new exporting system coming in garden + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.qrc Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,10 @@ + + + icon/hb_vol_slider_decrement.svg + icon/hb_vol_slider_decrement_pressed.svg + icon/hb_vol_slider_increment.svg + icon/hb_vol_slider_increment_pressed.svg + icon/hb_vol_slider_muted.svg + icon/hb_vol_slider_unmuted.svg + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cppersonalizationadvanceview.h" +#include +#include +/*#include +#include +#include +#include +*/ +#include "cpprofilesettingform.h" +#include "cpprofilenameeditdialog.h" + +#include +#include +#include +CpPersonalizationAdvanceView::CpPersonalizationAdvanceView(QGraphicsItem *parent /*=0*/): + CpBaseSettingView(0,parent) +{ + // 1.init the dataform for advance settings here + // 2.please modify the cpprofilesettingform.h/ cpp according to current ui spec + // 3.NOTICE! you can get controlpanel's text map from the controlpanel ui wiki, use current text id for strings + // 4.use cppersonalizationentryitemdata class to create ringtone, message tone... + // 5.ignore cpmastervolumeslider class, please use default slideritem to create keyandscreen slider, new property added in slider, if any question, please contact me. + // 6. don't forget the cfg file in data folder, you can try to add the profile activator plugin and ringtone plugin here + HbDataForm *form = new CpProfileSettingForm(); + setWidget( form ); + CpPluginUtility::addCpItemPrototype(form); + initMenu(); +} +CpPersonalizationAdvanceView::~CpPersonalizationAdvanceView() +{ + +} + +void CpPersonalizationAdvanceView::initMenu() +{ + HbAction *editNameAction = new HbAction( this ); + editNameAction->setObjectName( "editNameAction" ); + editNameAction->setText( hbTrId( "txt_cp_list_edit_name" ) ); + + menu()->addAction( editNameAction ); + connect( editNameAction, SIGNAL( triggered() ), this, SLOT( on_editNameAction_triggered() )); +} + +void CpPersonalizationAdvanceView::on_editNameAction_triggered() +{ + QString string = QString( "general" ); + bool ret = CpProfileNameEditDialog::launchProfileNameEditDialog( string ); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPERSONALIZATIONADVANCEVIEW_H +#define CPPERSONALIZATIONADVANCEVIEW_H + +#include +class CpItemDataHelper; + +class CpPersonalizationAdvanceView: public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpPersonalizationAdvanceView(QGraphicsItem *parent = 0); + ~CpPersonalizationAdvanceView(); + +private slots: + void on_editNameAction_triggered(); + +private: + void initMenu(); +}; +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cppersonalizationgroupitemdata.h" +#include +#include +#include +#include +#include +#include +#include +#include "cppersonalizationadvanceview.h" +#include "cppersonalizationentryitemdata.h" + + +CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile, + const HbDataFormModelItem *parent): + CpCategorySettingFormItemData(type, label, configFile, parent) + +{ + CPFW_LOG("CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(), START"); + CPFW_LOG("CpPersonalizationGroupItemData::CpPersonalizationGroupItemData(), END"); +} + +CpPersonalizationGroupItemData::~CpPersonalizationGroupItemData() +{ +} + +void CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper) +{ + + // keep this interface for development in the futrue + CPFW_LOG("CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(), START"); + + CPFW_LOG("CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(), END"); +} + +void CpPersonalizationGroupItemData::afterLoadingConfigPlugins(CpItemDataHelper &itemDataHelper) +{ + CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), START"); + CpSettingFormEntryItemData *advanceSettingItem = + new CpSettingFormEntryItemDataImpl(CpSettingFormEntryItemData::ButtonEntryItem, + itemDataHelper, hbTrId("txt_cp_button_advanced_settings")); + + advanceSettingItem->setContentWidgetData("textAlignment", QVariant( Qt::AlignHCenter | Qt::AlignVCenter) ); + advanceSettingItem->setContentWidgetData("objectName", "advanceSettingButton" ); + appendChild(advanceSettingItem); + CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END"); +} + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPPERSONALIZATIONGROUPITEMDATA_H +#define CPPERSONALIZATIONGROUPITEMDATA_H + +#include +#include + +class CpProfileModel; +class CpItemDataHelper; +class CpSettingFormEntryItemData; +class CpMasterVolumeValueController; + +class CpPersonalizationGroupItemData: public CpCategorySettingFormItemData +{ + Q_OBJECT +public: + CpPersonalizationGroupItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile = QString(), + const HbDataFormModelItem *parent = 0); + + ~CpPersonalizationGroupItemData(); +//private slots: + //void masterVolumeValueChanged(int value); +// void onVibraValueChange(int isVibra); +private: + virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); + virtual void afterLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); +}; + +#endif /* CPPERSONALIZATIONGROUPITEMDATA_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Tue Aug 31 15:15:28 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: + * + */ + +#include "cppersonalizationplugin.h" +#include "cppersonalizationgroupitemdata.h" +#include +#include +#include "cppersonalizationadvanceview.h" + +CpPersonalizationPlugin::CpPersonalizationPlugin() +{ +} + +CpPersonalizationPlugin::~CpPersonalizationPlugin() +{ +} + +QList CpPersonalizationPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + + CpPersonalizationGroupItemData *personalItemData = + new CpPersonalizationGroupItemData( + HbDataFormModelItem::GroupItem, + hbTrId("txt_cp_subhead_personalization"), + QString("cppersonalizationplugin.cpcfg") ); + + return QList() << personalItemData; +} + +CpBaseSettingView *CpPersonalizationPlugin::createSettingView(const QVariant &hint) const +{ + if (hint.toString().compare("profile_view",Qt::CaseInsensitive) == 0) { + return new CpPersonalizationAdvanceView; + } + return 0; +} + +Q_EXPORT_PLUGIN2(cppersonalizationplugin, CpPersonalizationPlugin); + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPERSONALIZATIONPLUGIN_H +#define CPPERSONALIZATIONPLUGIN_H + +#include +#include +#include + +class CpBaseSettingView; +class QVariant; + +class CpPersonalizationPlugin + : public QObject, + public CpPluginInterface, + public CpLauncherInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) + Q_INTERFACES(CpLauncherInterface) +public: + CpPersonalizationPlugin(); + virtual ~CpPersonalizationPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + virtual CpBaseSettingView *createSettingView(const QVariant &hint) const; +}; + +#endif /* CPPERSONALIZATIONPLUGIN_H */ + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpprofilenameeditdialog.h" + +#include +#include +#include + +#include +#include + +CpProfileNameEditDialog::CpProfileNameEditDialog( QGraphicsItem *parent ) + :HbDialog( parent ) +{ + init(); +} + +CpProfileNameEditDialog::~CpProfileNameEditDialog() +{ +} + +void CpProfileNameEditDialog::init() +{ + setDismissPolicy( HbPopup::NoDismiss ); + setHeadingWidget( new HbLabel( hbTrId( "txt_cp_title_edit_name" ), this )); + + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); + vLayout->setOrientation( Qt::Vertical ); + HbWidget *contentWidget = new HbWidget( this ); + mTextEdit = new HbLineEdit( this ); + mTextEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + vLayout->addItem( mTextEdit ); + contentWidget->setLayout( vLayout ); + setContentWidget( contentWidget ); + + connect( mTextEdit, SIGNAL( contentsChanged() ), this, SLOT( checkPrimaryAction() ) ); + + addAction( new HbAction( hbTrId( "txt_common_button_ok" ), this )); + addAction( new HbAction( hbTrId( "txt_common_button_cancel" ), this ) ); + + setTimeout( NoTimeout ); +} + +void CpProfileNameEditDialog::setLineEditText( const QString &text ) +{ + mTextEdit->setText( text ); + mTextEdit->setSelection( 0, text.length() ); +} + +QString CpProfileNameEditDialog::getLineEditText() +{ + QString text = mTextEdit->text(); + return text; +} + +bool CpProfileNameEditDialog::launchProfileNameEditDialog( QString &profileName ) +{ + CpProfileNameEditDialog *profileEditNameDialog = new CpProfileNameEditDialog(); + + profileEditNameDialog->setLineEditText( profileName ); + profileEditNameDialog->checkPrimaryAction(); + profileEditNameDialog->show(); + return false; +} + +void CpProfileNameEditDialog::checkPrimaryAction() +{ + HbAction *const primaryAction = qobject_cast + (actions().at(0)); + if (primaryAction) { + if ( !mTextEdit->text().isEmpty() ) { + primaryAction->setEnabled(true); + } else { + primaryAction->setEnabled(false); + } + } +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPROFILENAMEEDITDIALOG_H +#define CPPROFILENAMEEDITDIALOG_H + +#include + +class HbWidget; +class HbLineEdit; + +class CpProfileNameEditDialog : public HbDialog +{ + Q_OBJECT + +public: + CpProfileNameEditDialog( QGraphicsItem *parent = 0 ); + virtual ~CpProfileNameEditDialog(); + + static bool launchProfileNameEditDialog( QString &profileName ); + +private slots: + void checkPrimaryAction(); + +private: + void init(); + void setLineEditText( const QString &text ); + QString getLineEditText(); + +private: + HbWidget *mContentWidget; + HbLineEdit *mTextEdit; +}; + +#endif /* CPPROFILENAMEEDITDIALOG_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,351 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpprofilesettingform.h" +#include "cppersonalizationentryitemdata.h" +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +CpProfileSettingForm::CpProfileSettingForm() + : mModel(0), mItemDataHelper(new CpItemDataHelper( this )), + mProfileModel(new CpProfileModel()), mFileIconProvider(new QFileIconProvider), + mGeneralPage(0),mMeetingPage(0),mCurrentPage( 0 ), mSettingManager(0) +{ + this->setHeading(hbTrId("txt_cp_button_advanced_settings")); + this->setDescription(hbTrId("txt_cp_info_select_tones_that_play_when_you_select")); + + initModel(); +} + +CpProfileSettingForm::~CpProfileSettingForm() +{ + delete mModel; + delete mProfileModel; + delete mFileIconProvider; + delete mSettingManager; +} + +void CpProfileSettingForm::initModel() +{ + mModel = new HbDataFormModel(); + + QString generalString( mProfileModel->profileName( EProfileWrapperGeneralId ) ); + if( generalString.isEmpty() ) { + qDebug( "warning: general profile name is empty"); + generalString = hbTrId("txt_cp_list_general"); + } + QString meetingString( mProfileModel->profileName( EProfileWrapperMeetingId ) ); + if( meetingString.isEmpty() ) { + qDebug( "warning: meeting profile name is empty"); + meetingString = hbTrId("txt_cp_list_meeting"); + } + + mSettingManager = new XQSettingsManager(); + + XQCentralRepositorySettingsKey key(KCRUidProfileEngine.iUid,KProEngSilenceMode); + + QVariant silenceMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt); + + mSettingManager->startMonitoring(key,XQSettingsManager::TypeInt); + connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); + + mGeneralPage = mModel->appendDataFormPage( generalString ); + initProfileItems(EProfileWrapperGeneralId,mGeneralPage); + + //initGeneralTonesGroup(); + + //initGeneralVibraGroup(); + + mMeetingPage = mModel->appendDataFormPage( meetingString ); + initProfileItems(EProfileWrapperMeetingId,mMeetingPage); + //initMeetingTonesGroup(); + //initMeetingVibraGroup(); + setModel(mModel); + settingValueChanged(key,silenceMode); +} + +void CpProfileSettingForm::initProfileItems(int profileId,HbDataFormModelItem *parent) +{ + CpProfileSettings profileSettings; + mProfileModel->profileSettings( profileId, profileSettings ); + + QHash modelItems; + + //ring tone item + QFileInfo ringToneFileInfo( profileSettings.mRingTone ); + HbDataFormModelItem *modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), "qtg_large_ring_tone", + CpPersonalizationEntryItemData::TONE_Ring, profileId ); + mModel->appendDataFormItem(modelItem, parent); + modelItems.insert(ProfileItemRingTone,modelItem); + + //message tone item + QFileInfo messageToneFileInfo( profileSettings.mMessageTone ); + modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), "qtg_large_message", + CpPersonalizationEntryItemData::TONE_Message, + profileId ); + mModel->appendDataFormItem(modelItem , parent); + modelItems.insert(ProfileItemMessageTone,modelItem); + + //email tone item + QFileInfo emailToneFileInfo( profileSettings.mEmailTone ); + modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), "qtg_large_email", + CpPersonalizationEntryItemData::TONE_Email, + profileId ); + mModel->appendDataFormItem(modelItem , parent); + modelItems.insert(ProfileItemEmailTone,modelItem); + + //reminder tone item + QFileInfo reminderToneFileInfo( profileSettings.mReminderTone ); + modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), "qtg_large_calendar", + CpPersonalizationEntryItemData::TONE_Reminder, + profileId ); + mModel->appendDataFormItem(modelItem , parent); + modelItems.insert(ProfileItemReminderTone,modelItem); + + //notification tones item + modelItem= mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),parent); + modelItem->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones")); + modelItem->setContentWidgetData("checkState", profileSettings.mNotificationTone ? 2 : 0); + modelItem->setContentWidgetData("objectName", "notificationTonesCheckBox" + QString::number(profileId)); + if (profileId == EProfileWrapperGeneralId) { + addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int ))); + } + else if (profileId == EProfileWrapperMeetingId) { + addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int ))); + } + modelItems.insert(ProfileItemNotificationTones,modelItem); + + + //Key and Touch Screen Tones item + modelItem = + mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),parent); + + QList sliderElements; + sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) + << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement) + << QVariant(HbSlider::TextElement); + modelItem->setContentWidgetData("sliderElements",sliderElements); + modelItem->setContentWidgetData("objectName", "keyTonesSlider" + QString::number(profileId)); + + + //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 + modelItem->setContentWidgetData( QString( "minimum" ), 0 ); + modelItem->setContentWidgetData( QString( "maximum" ), 5 ); + modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone ); + QMap< QString, QVariant > elements; + elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); + elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); + if (profileSettings.mKeyTouchScreenTone != 0) { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); + } + else { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); + } + + modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); + + if (profileId == EProfileWrapperGeneralId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int ))); + } + else if (profileId == EProfileWrapperMeetingId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenToneSlider_ValueChanged( int ))); + } + + modelItems.insert(ProfileItemKeyandTouchScreenTones,modelItem); + + + //Touch Screen Vibra item + modelItem = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), parent ); + //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 + sliderElements.clear(); + sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) + << QVariant(HbSlider::DecreaseElement); + modelItem->setContentWidgetData("sliderElements",sliderElements); + modelItem->setContentWidgetData("objectName", "vibrationSlider" + QString::number(profileId)); + modelItem->setContentWidgetData( QString( "minimum" ), 0 ); + modelItem->setContentWidgetData( QString( "maximum" ), 5 ); + modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); + QMap< QString, QVariant > iconElements; + iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); + iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); + modelItem->setContentWidgetData( QString( "elementIcons" ), iconElements ); + + if (profileId == EProfileWrapperGeneralId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int ))); + } + else if (profileId == EProfileWrapperMeetingId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int ))); + } + + modelItems.insert(ProfileItemTouchScreenVibra,modelItem); + + mProfileModelItems.insert(profileId,modelItems); + +} + + + +//////////////////////////////////////////////////// +//general tones +void CpProfileSettingForm::on_general_notificationTones_stateChanged(int state) +{ + mProfileModel->setNotificationTone( EProfileWrapperGeneralId, checkBoxStateToBool( state ) ); +} + +void CpProfileSettingForm::on_general_keysAndScreenToneSlider_ValueChanged( int value ) +{ + mProfileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, value ); + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemKeyandTouchScreenTones); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + setMuteIcon(modelItem, (value == 0) ); + } +} + + +//general vibra +void CpProfileSettingForm::on_general_screenVibra_ValueChanged( int value ) +{ + mProfileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, value ); + + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemTouchScreenVibra); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + } + +} + +//////////////////////////////////////////////////// +//meeting Tones +void CpProfileSettingForm::on_meeting_notificationTones_stateChanged(int state) +{ + mProfileModel->setNotificationTone( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); +} + +void CpProfileSettingForm::on_meeting_keysAndScreenToneSlider_ValueChanged( int value ) +{ + mProfileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, value ); + + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemKeyandTouchScreenTones); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + setMuteIcon(modelItem, (value == 0) ); + } +} + +void CpProfileSettingForm::on_meeting_screenVibra_ValueChanged( int value ) +{ + mProfileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, value ); + + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemTouchScreenVibra); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + } +} + +bool CpProfileSettingForm::checkBoxStateToBool( int state ) +{ + if( state == Qt::Checked ) { + return true; + } else { + return false; + } +} + + +void CpProfileSettingForm::settingValueChanged(const XQSettingsKey &key, const QVariant &value) +{ + if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode && value.isValid()) { + + static const int silenceSensitiveModelItemIds[] = + { + CpProfileSettingForm::ProfileItemRingTone, + CpProfileSettingForm::ProfileItemMessageTone, + CpProfileSettingForm::ProfileItemEmailTone, + CpProfileSettingForm::ProfileItemReminderTone, + CpProfileSettingForm::ProfileItemNotificationTones, + CpProfileSettingForm::ProfileItemKeyandTouchScreenTones + }; + + QHash< int,QHash >::const_iterator it (mProfileModelItems.begin()); + for(; it != mProfileModelItems.end(); ++it ) { + for (int i = 0; i < sizeof(silenceSensitiveModelItemIds)/sizeof(silenceSensitiveModelItemIds[0]);++i) { + QHash::const_iterator found = it.value().find(silenceSensitiveModelItemIds[i]); + if (found != it.value().end()) { + if (found.key() == CpProfileSettingForm::ProfileItemKeyandTouchScreenTones) { + int currentValue = found.value()->contentWidgetData("value").toInt(); + // change the mute icon when the silence mode is changed + bool isMute = value.toBool() || (currentValue == 0); + setMuteIcon(found.value(), isMute); + } + found.value()->setEnabled(!value.toBool()); + } + } + } + } +} + +HbDataFormModelItem *CpProfileSettingForm::profileItem(int profileId,int profileItemId) +{ + return mProfileModelItems.value(profileId).value(profileItemId); +} + +/*! + * Set the slider icon to mute or unmute + * @param isMute: identified the icon of slider, mute or unmute + * @param profileId: identified which slider should be changed + */ + +void CpProfileSettingForm::setMuteIcon(HbDataFormModelItem *sliderItem, bool isMute) +{ + if (sliderItem == 0) { + return; + } + //VolumeSliderItem will be depreacted, so ignore the assert about it + if (sliderItem->type() != HbDataFormModelItem::SliderItem) { + return; + } + + QMap elements = sliderItem->contentWidgetData("elementIcons").toMap(); + + if (isMute) { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + } + else { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); + } + sliderItem->setContentWidgetData( QString( "elementIcons" ), elements ); +} +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPROFILESETTINGFORM_H +#define CPPROFILESETTINGFORM_H + +#include +#include + +class HbDataFormModel; +class HbDataFormModelItem; +class CpItemDataHelper; +class CpProfileModel; +class QFileIconProvider; +class XQSettingsManager; +class XQSettingsKey; +class QVariant; + +class CpProfileSettingForm : public HbDataForm +{ + Q_OBJECT +public: + + enum ProfileItemId { + ProfileItemRingTone, + ProfileItemMessageTone, + ProfileItemEmailTone, + ProfileItemReminderTone, + ProfileItemNotificationTones, + ProfileItemKeyandTouchScreenTones, + ProfileItemTouchScreenVibra + }; + + CpProfileSettingForm(); + virtual ~CpProfileSettingForm(); + +private slots: + + //general tones + void on_general_notificationTones_stateChanged(int state); + void on_general_keysAndScreenToneSlider_ValueChanged( int value ); + //general vibra + void on_general_screenVibra_ValueChanged( int value ); + + //meeting tones + void on_meeting_notificationTones_stateChanged(int state); + void on_meeting_keysAndScreenToneSlider_ValueChanged( int value ); + + //meeting vibar + void on_meeting_screenVibra_ValueChanged( int value ); + + void settingValueChanged(const XQSettingsKey &key, const QVariant &value); +private: + void initModel(); + void initGeneralTonesGroup(); + //void initGeneralVibraGroup(); + void initMeetingTonesGroup(); + //void initMeetingVibraGroup(); + bool checkBoxStateToBool( int state ); + // void initRingToneGroup(HbDataFormModelItem *parent); + // void initMessageToneGroup(HbDataFormModelItem *parent); + // void initAlertToneGroup(HbDataFormModelItem *parent); + // void initKeyAndScreenToneGroup(HbDataFormModelItem *parent); + + void initProfileItems(int profileId,HbDataFormModelItem *parent); + HbDataFormModelItem *profileItem(int profileId,int profileItemId); + void setMuteIcon(HbDataFormModelItem *silderItem, bool isMute); +private: + HbDataFormModel *mModel; + CpItemDataHelper *mItemDataHelper; + CpProfileModel *mProfileModel; + QFileIconProvider *mFileIconProvider; + + HbDataFormModelItem *mGeneralPage; + HbDataFormModelItem *mMeetingPage; + + HbDataFormModelItem *mCurrentPage; + + // HbDataFormModelItem *mGeneralKeysAndScreenToneSlider; + // HbDataFormModelItem *mGeneralSreenVibra; + // HbDataFormModelItem *mMeetingKeysAndScreenToneSlider; + // HbDataFormModelItem *mMeetingSreenVibra; + + XQSettingsManager *mSettingManager; + + QHash< int,QHash > mProfileModelItems; +}; + + +#endif //CPPROFILESETTINGFORM_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +# +# 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: cpprivacyplugin source files +# + +# Input +HEADERS += src/cpprivacyplugin.h +SOURCES += src/cpprivacyplugin.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/privacyplugin/privacyplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +TEMPLATE = lib +TARGET = cpprivacyplugin + +CONFIG += hb plugin + +LIBS += -lcpframework + +include ( ../cpplugincommon.pri ) +include ( privacyplugin.pri ) + +symbian: { + TARGET.UID3 = 0x20025FE1 +} + +symbian { + deploy.path = C: + headers.sources = data/cpprivacyplugin.cpcfg + headers.path = /resource/qt/plugins/controlpanel/config + DEPLOYMENT += exportheaders + + # This is for new exporting system coming in garden + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp Tue Aug 31 15:15:28 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: + * + */ + +#include "cpprivacyplugin.h" +#include +#include + +CpPrivacyPlugin::CpPrivacyPlugin() +{ + +} + +CpPrivacyPlugin::~CpPrivacyPlugin() +{ + +} + +QList CpPrivacyPlugin::createSettingFormItemData(CpItemDataHelper &/*itemDataHelper*/) const +{ + CpCategorySettingFormItemData *itemData = + new CpCategorySettingFormItemData( + HbDataFormModelItem::GroupItem, + hbTrId("txt_cp_subhead_security"), + QString("cpprivacyplugin.cpcfg") ); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpprivacyplugin, CpPrivacyPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPRIVACYPLUGIN_H +#define CPPRIVACYPLUGIN_H + +#include +#include + +class CpPrivacyPlugin: public QObject,public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpPrivacyPlugin(); + virtual ~CpPrivacyPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif /* CPPRIVACYPLUGIN_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +# +# 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: display plugin source files +# + +# Input +HEADERS += src/*.h + +SOURCES += src/*.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,31 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpprofileactivator + +CONFIG += hb plugin + + +include ( ../cpplugincommon.pri ) +include ( profileactivatorplugin.pri ) +LIBS += -lcpprofilewrapper +symbian { + TARGET.UID3 = 0X20028739 + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 + LIBS += -lprofileeng +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpprofileactivatordialog.h" + +#include +#include +#include +#include +#include +#include "cpprofileactivatorentryitem.h" +#include +#include + +CpProfileActivatorDialog::CpProfileActivatorDialog(CpSettingFormItemData *profileActivator, + CpProfileModel &profileModel, + QGraphicsItem *parent):HbDialog(parent), + mProfileModel(profileModel), + mProfileList(0), + mProfileActivator(profileActivator) +{ + mTitleLabel = new HbLabel(this); + mTitleLabel->setPlainText(hbTrId("txt_cp_title_profile")); + mContentWidget = new QGraphicsWidget(this); + setContentWidget(mContentWidget); + mLayout = new QGraphicsLinearLayout(); + mLayout->setOrientation( Qt::Vertical ); + mProfileIds << EProfileWrapperGeneralId + << EProfileWrapperMeetingId; + mProfileList = new HbRadioButtonList(); + mProfileList->setItems(profileModel.profileNames()); + mLayout->addItem(mTitleLabel); + mLayout->addItem(mProfileList); + + int currentId = mProfileModel.activeProfileId(); + mProfileList->setSelected(mProfileIds.indexOf(static_cast(currentId))); + + + + mConfirmProfile = new HbAction(hbTrId("txt_common_button_ok")); + mCancelProfile = new HbAction(hbTrId("txt_common_button_cancel")); + + connect(mConfirmProfile, SIGNAL(triggered(bool)), this, SLOT(confirmProfileSelection())); + connect(mCancelProfile, SIGNAL(triggered(bool)), this, SLOT(cancelProfileSelection())); + + + this->addAction(mConfirmProfile); + this->addAction(mCancelProfile); + this->setModal(true); + this->setDismissPolicy(HbPopup::NoDismiss); + this->setTimeout(HbPopup::NoTimeout); + mContentWidget->setLayout( mLayout ); +} + +CpProfileActivatorDialog::~CpProfileActivatorDialog() +{ + +} +void CpProfileActivatorDialog::confirmProfileSelection() +{ + int currentIndex = mProfileList->selected(); + if (currentIndex == -1) { + return; + } + + // the best choice is no need to convert the index to id + mProfileModel.activateProfile(mProfileIds.at(currentIndex)); +} +void CpProfileActivatorDialog::cancelProfileSelection() +{ + +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Tue Aug 31 15:15:28 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: + * + */ +#ifndef CPPROFILEACTIVATORDIALOG_H +#define CPPROFILEACTIVATORDIALOG_H + +#include +#include +#include +class HbRadioButtonList; +class HbDataFormModelItem; +class CpProfileActivatorEntryItem; +class CpSettingFormItemData; +class QGraphicsLinearLayout; +class QGraphicsWidget; +class HbLabel; + +class CpProfileActivatorDialog: public HbDialog +{ + Q_OBJECT +public: + explicit CpProfileActivatorDialog(CpSettingFormItemData *profileActivator, + CpProfileModel &profileModel, + QGraphicsItem *parent = 0); + ~CpProfileActivatorDialog(); + +private slots: + void confirmProfileSelection(); + void cancelProfileSelection(); +private: + CpProfileModel &mProfileModel; + HbRadioButtonList *mProfileList; + CpSettingFormItemData *mProfileActivator; + QPointer mConfirmProfile; + QPointer mCancelProfile; + QList mProfileIds; + QGraphicsLinearLayout *mLayout; + QGraphicsWidget *mContentWidget; + HbLabel *mTitleLabel; +}; +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpprofileactivatorentryitem.h" + +#include "cpprofileactivatordialog.h" +#include +#include +#include +#include + +CpProfileActivatorEntryItem::CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper, + const QString &text, + const QString &description, + const QString &icon, + const HbDataFormModelItem *parent) + :CpSettingFormEntryItemData(CpSettingFormEntryItemData::ListEntryItem, itemDataHelper,text,description, + icon,parent),mProfileModel(0),mProfileMonitor(0) +{ + mProfileMonitor = new CpProfileMonitor(); + mProfileModel = new CpProfileModel(); + + int currentId = mProfileModel->activeProfileId(); + QString currentName = mProfileModel->profileName(currentId); + this->setDescription(currentName); + connect(mProfileMonitor, SIGNAL(profileActivated(int)), this, SLOT(onProfileChanged(int))); +} + +CpProfileActivatorEntryItem::~CpProfileActivatorEntryItem() +{ + delete mProfileModel; + delete mProfileMonitor; +} + +void CpProfileActivatorEntryItem::onLaunchView() +{ + CpProfileActivatorDialog *dialog = + new CpProfileActivatorDialog(this, *mProfileModel); + dialog->setAttribute(Qt::WA_DeleteOnClose); + // dialog->open(this, SLOT(ultimateDialogSlot(HbAction*))); + dialog->show(); + +} + +void CpProfileActivatorEntryItem::onProfileChanged(int activeProfileId) +{ + QString profileName = mProfileModel->profileName(activeProfileId); + this->setDescription(profileName); +} +/*void CpPersonalizationEntryItemData::handleOk(const QVariant &result) +{ + if (!result.canConvert()) + { + setDescription( "Corrupt result" ); + } + else + { + setDescription( result.value() ); + } +} +void CpPersonalizationEntryItemData::handleError(int errorCode, const QString& errorMessage) +{ + // + Q_UNUSED(errorCode); + Q_UNUSED(errorMessage); + setDescription("Error"); +}*/ + +CpBaseSettingView *CpProfileActivatorEntryItem::createSettingView() const +{ + return 0; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPPROFILEACTIVATORENTRYITEM_H +#define CPPROFILEACTIVATORENTRYITEM_H + +#include + +class CpProfileModel; +class CpProfileMonitor; + +class CpProfileActivatorEntryItem : public CpSettingFormEntryItemData +{ +Q_OBJECT +public: + explicit CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), const QString &description = + QString(), const QString &icon = QString(), + const HbDataFormModelItem *parent = 0); + virtual ~CpProfileActivatorEntryItem(); +private slots: + void onLaunchView(); + void onProfileChanged(int activeProfileId); + //void handleOk(const QVariant &result); + //void handleError(int errorCode, const QString& errorMessage); +private: + virtual CpBaseSettingView *createSettingView() const; +private: + CpProfileModel *mProfileModel; + CpProfileMonitor *mProfileMonitor; +}; + +#endif // CPPROFILEACTIVATORENTRYITEM_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpprofileactivatorplugin.h" +#include "cpprofileactivatorentryitem.h" + +CpProfileActivatorPlugin::CpProfileActivatorPlugin() +{ +} + +CpProfileActivatorPlugin::~CpProfileActivatorPlugin() +{ +} + +QList CpProfileActivatorPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + CpSettingFormItemData* itemData = new CpProfileActivatorEntryItem( + itemDataHelper, + hbTrId("txt_cp_dblist_profile"), + " ", + "qtg_large_profiles"); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpprofileactivatorplugin, CpProfileActivatorPlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPPROFILEACTIVATOR_H +#define CPPROFILEACTIVATOR_H + +#include +#include + +class CpProfileActivatorPlugin : public QObject, public CpPluginInterface +{ +Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpProfileActivatorPlugin(); + virtual ~CpProfileActivatorPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPPROFILEACTIVATOR_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +# +# 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: display plugin source files +# + +# Input +HEADERS += src/*.h + +SOURCES += src/*.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpringtoneplugin +CONFIG += hb plugin + +include ( ../cpplugincommon.pri ) +include ( ringtoneplugin.pri ) + +symbian { + LIBS += -lcpprofilewrapper -lxqservice -lxqserviceutil -lcpringtoneview -lxqsettingsmanager + TARGET.UID3 = 0X20028738 + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cppersonalizationentryitemdata.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cpringtoneview.h" + + +const QString g_strNoTone("Z:\\resource\\No_Sound.wav"); +CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text, + const QString &description, + const QString &icon, + Profile_Tone_Types toneType, + int profileId, + const HbDataFormModelItem *parent) + :CpSettingFormEntryItemData(CpSettingFormEntryItemData::ListEntryItem, itemDataHelper,text,description,icon,parent), + mProfileModel(0), + m_profileID(profileId), + mToneType(toneType), + mSettingManager(0) +{ + Q_UNUSED(itemDataHelper); //reserve for future + CPFW_LOG("CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(), START"); + mProfileModel = new CpProfileModel(); + if( mProfileModel ) + { + QString strRing = loadStringValue(); + if( QFileInfo(strRing) == QFileInfo(g_strNoTone) ) + { + setDescription( hbTrId("txt_cp_list_no_tone" ) ); //sepcial handling about NoTone + } + else + { + setDescription( QFileInfo(strRing).baseName() ); + } + } + else + { + CPFW_LOG("CpPersonalizationEntryItemData::mProfileModel:NULL!"); + } + mSettingManager = new XQSettingsManager(); + XQCentralRepositorySettingsKey key(KCRUidProfileEngine.iUid,KProEngSilenceMode); + + //Monitoring the active ring tone + XQCentralRepositorySettingsKey keyForActiveRingTone(KCRUidProfileEngine.iUid,KProEngActiveRingTone); + + QVariant silenceMode = mSettingManager->readItemValue( key,XQSettingsManager::TypeInt ); + setEnabled( !silenceMode.toInt() ); + mSettingManager->startMonitoring( key,XQSettingsManager::TypeInt ); + mSettingManager->startMonitoring(keyForActiveRingTone, XQSettingsManager::TypeString); + connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); + +} +void CpPersonalizationEntryItemData::settingValueChanged( const XQSettingsKey& key, const QVariant& value ) +{ + switch (key.key()) { + case KProEngActiveRingTone: + { + QString strRing = loadStringValue(); + if( QFileInfo(strRing) == QFileInfo(g_strNoTone) ) + { + setDescription( hbTrId("txt_cp_list_no_tone" ) ); //sepcial handling about NoTone + } + else + { + setDescription( QFileInfo(strRing).baseName() ); + } + break; + } + case KProEngSilenceMode: + { + setEnabled( !value.toInt() ); + break; + + } + default: + break; + } +} + +CpPersonalizationEntryItemData::~CpPersonalizationEntryItemData() +{ + if( mProfileModel ) + { + delete mProfileModel; + mProfileModel = 0; + } + if( mSettingManager ) + { + delete mSettingManager; + } +} + +QString CpPersonalizationEntryItemData::loadStringValue() const +{ + QString strRing; + switch( mToneType ) + { + case TONE_Message: + if( m_profileID>=0 ) + { + strRing = mProfileModel->messageTone( m_profileID ); + } + break; + case TONE_Email: + if( m_profileID >=0 ) + { + strRing = mProfileModel->emailTone( m_profileID ); + } + break; + case TONE_Reminder: + if( m_profileID >=0 ) + { + strRing = mProfileModel->reminderTone( m_profileID ); + } + break; + case TONE_Ring: + default: + if( m_profileID <0 ) + { + + strRing = mProfileModel->ringTone(); + } + else + { + strRing = mProfileModel->ringTone( m_profileID ); + } + break; + } + + return strRing; +} +void CpPersonalizationEntryItemData::storeStringValue( const QString &strValue ) const +{ + QString strInput = strValue; + if( strInput.length() == 0 ) + { + strInput = g_strNoTone; + } + switch( mToneType ) + { + case TONE_Message: + if( m_profileID >=0 ) + { + mProfileModel->setMessageTone( m_profileID, strInput ); + } + break; + case TONE_Email: + if( m_profileID >=0 ) + { + mProfileModel->setEmailTone( m_profileID, strInput ); + } + break; + case TONE_Reminder: + if( m_profileID >=0 ) + { + mProfileModel->setReminderTone( m_profileID, strInput ); + } + break; + case TONE_Ring: + default: + if( m_profileID <0 ) + { + mProfileModel->setRingTone( strInput ); + } + else + { + mProfileModel->setRingTone( m_profileID, strInput ); + } + break; + } +} + +void CpPersonalizationEntryItemData::handleOk(const QString &strFname) +{ + if(strFname.length()) + { + //lower level services(tone fetcher or music fetcher) + //will guarantee strFname is a valid absolute file path. + setDescription(QFileInfo(strFname).baseName()); + } + else + { + setDescription( hbTrId("txt_cp_list_no_tone" ) ); + } + storeStringValue(strFname); +} + + +void CpPersonalizationEntryItemData::handleError(int errorCode, const QString& errorMessage) +{ + Q_UNUSED(errorCode); + Q_UNUSED(errorMessage); +} + +CpBaseSettingView *CpPersonalizationEntryItemData::createSettingView() const +{ + CpRingToneView *pView = new CpRingToneView( ); + connect( pView, SIGNAL( selOK( const QString&)),SLOT(handleOk(const QString &)) ); + connect( pView, SIGNAL( selError( int, const QString& ) ), SLOT( handleOk(const QString &)) ); + return pView; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPPERSONALIZATIONENTRYITEMDATA_H +#define CPPERSONALIZATIONENTRYITEMDATA_H + +#include +#include + +class CpProfileModel; +class XQSettingsManager; + +class CpPersonalizationEntryItemData : public CpSettingFormEntryItemData +{ + Q_OBJECT +public: + typedef enum + { + TONE_Ring = 0, + TONE_Message, + TONE_Email, + TONE_Reminder + }Profile_Tone_Types; + + explicit CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, + const QString &text = QString(), + const QString &description = QString(), + const QString &icon = QString(), + Profile_Tone_Types toneType = TONE_Ring, + int profileId = -1, + const HbDataFormModelItem *parent = 0); + virtual ~CpPersonalizationEntryItemData(); +private slots: + void handleOk(const QString &strFname); + void handleError( int errorCode, const QString& errorMessage ); + void settingValueChanged( const XQSettingsKey& key, const QVariant& value ); +private: + virtual CpBaseSettingView *createSettingView() const; + QString loadStringValue() const; + void storeStringValue( const QString &strvalue ) const; +private: + CpProfileModel *mProfileModel; + int m_profileID; + Profile_Tone_Types mToneType; + XQSettingsManager *mSettingManager; +}; + +#endif // CPPERSONALIZATIONENTRYITEMDATA_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpringtoneplugin.h" +#include "cppersonalizationentryitemdata.h" + +CpRingTonePlugin::CpRingTonePlugin() +{ +} + +CpRingTonePlugin::~CpRingTonePlugin() +{ +} + +QList CpRingTonePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + CpPersonalizationEntryItemData *itemData + = new CpPersonalizationEntryItemData( + itemDataHelper, + hbTrId("txt_cp_dblist_ringtone"), + QString(""), + "qtg_large_ring_tone"); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpringtoneplugin, CpRingTonePlugin); diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cpringtoneplugin.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPRINGTONEPLUGIN_H +#define CPRINGTONEPLUGIN_H + +#include +#include + +class CpRingTonePlugin : public QObject, public CpPluginInterface +{ +Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpRingTonePlugin(); + virtual ~CpRingTonePlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPRINGTONEPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement_pressed.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_decrement_pressed.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment_pressed.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_increment_pressed.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,6 @@ + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_muted.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_muted.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_unmuted.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/icon/hb_vol_slider_unmuted.svg Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cppersonalizationcustomviewitem.h" +#include +#include +#include +#include +#include + +CpPersonalizationCustomViewItem::CpPersonalizationCustomViewItem(QGraphicsItem *parent ) + : HbDataFormViewItem(parent), + mWidget(0) +{ +} +CpPersonalizationCustomViewItem::~CpPersonalizationCustomViewItem() +{ +} +HbAbstractViewItem* CpPersonalizationCustomViewItem::createItem() +{ + return new CpPersonalizationCustomViewItem(*this); +} +bool CpPersonalizationCustomViewItem::canSetModelIndex(const QModelIndex &index) const +{ + CpVolumeCustomItemType type = static_cast(index.data(HbDataFormModelItem::ItemTypeRole).toInt()); + /*if (type == MasterVolumeSliderItem) { + return true; + } + else*/ if (type == SilenceIndicatorItem) { + return true; + } + else { + return false; + } +} + +HbWidget *CpPersonalizationCustomViewItem::createCustomWidget() +{ + CpVolumeCustomItemType type = static_cast + (modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + /*if (type == MasterVolumeSliderItem) { + CpMasterVolumeSlider *masterVolumeSlider = new CpMasterVolumeSlider(); + connect(masterVolumeSlider, SIGNAL(valueChanged(int)), this, SLOT(store())); + mWidgetMap.insert(type,masterVolumeSlider); + return masterVolumeSlider; + } else*/ if (type == SilenceIndicatorItem ) { + HbPushButton *slienceIndicator = new HbPushButton(); + slienceIndicator->setCheckable(true); + connect(slienceIndicator, SIGNAL(toggled(bool)),this,SLOT(store())); + mWidget = slienceIndicator; + return slienceIndicator; + } + else { + return 0; + } +} + +void CpPersonalizationCustomViewItem::load() +{ + //HbDataFormViewItem::load(); + + CpVolumeCustomItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + + if(itemType == SilenceIndicatorItem) { + + QModelIndex itemIndex = modelIndex(); + HbDataFormModel *model = static_cast(itemView()->model());; + HbDataFormModelItem *modelItem = static_cast( + model->itemFromIndex(itemIndex)); + + + if (mWidget != 0) { + const QMetaObject *metaObj = mWidget->metaObject(); + int count = metaObj->propertyCount(); + for (int i = 0; i < count; i++) { + QMetaProperty metaProperty = metaObj->property(i); + if (metaProperty.isValid() && metaProperty.isWritable()) { + metaProperty.write(mWidget,modelItem->contentWidgetData(metaProperty.name())); + } + } + } + } +} + +void CpPersonalizationCustomViewItem::restore() +{ + HbDataFormViewItem::restore(); + + CpVolumeCustomItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + + if(itemType == SilenceIndicatorItem) { + + QModelIndex itemIndex = modelIndex(); + HbDataFormModel *model = static_cast(itemView()->model());; + HbDataFormModelItem *modelItem = static_cast( + model->itemFromIndex(itemIndex)); + + + if (mWidget != 0) { + const QMetaObject *metaObj = mWidget->metaObject(); + int count = metaObj->propertyCount(); + for (int i = 0; i < count; i++) { + QMetaProperty metaProperty = metaObj->property(i); + if (metaProperty.isValid() && metaProperty.isWritable()) { + metaProperty.write(mWidget,modelItem->contentWidgetData(metaProperty.name())); + } + } + } + } +} + + +void CpPersonalizationCustomViewItem::store() +{ + //HbDataFormViewItem::store(); + + CpVolumeCustomItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + + if(itemType == SilenceIndicatorItem) { + + QModelIndex itemIndex = modelIndex(); + HbDataFormModel *model = static_cast(itemView()->model()); + HbDataFormModelItem *modelItem = static_cast( + model->itemFromIndex(itemIndex)); + + + /*if (CpMasterVolumeSlider *slider = qobject_cast(widget)) { + modelItem->setContentWidgetData("value",slider->value()); + }*/ + if (HbPushButton *silenceIndicator = qobject_cast(mWidget)) { + modelItem->setContentWidgetData("checked",silenceIndicator->isChecked()); + } + } +} + +/*void CpPersonalizationCustomViewItem::onValueChanged(int value) +{ + HbDataFormModelItem::DataItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + + if(itemType == MasterVolumeSliderItem) { + + QModelIndex itemIndex = modelIndex(); + HbDataFormModel *model = static_cast(itemView()->model());; + HbDataFormModelItem *modelItem = static_cast( + model->itemFromIndex(itemIndex)); + modelItem->setContentWidgetData("value",value); + } +}*/ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CP_PERSONALIZATION_CUSTOMVIEWITEM_H +#define CP_PERSONALIZATION_CUSTOMVIEWITEM_H + +#include +#include +#include + +class HbWidget; + +enum CpVolumeCustomItemType { + MasterVolumeSliderItem = HbDataFormModelItem::CustomItemBase+21, + SilenceIndicatorItem = HbDataFormModelItem::CustomItemBase+22 +}; + +class CpPersonalizationCustomViewItem: public HbDataFormViewItem +{ + Q_OBJECT +public: + explicit CpPersonalizationCustomViewItem(QGraphicsItem *parent = 0); + ~CpPersonalizationCustomViewItem(); + virtual HbAbstractViewItem* createItem(); + virtual bool canSetModelIndex(const QModelIndex &index) const; +public slots: + virtual void load(); + virtual void store(); + virtual void restore(); +/*private slots: + void onValueChanged(int value);*/ +protected: + virtual HbWidget* createCustomWidget(); +private: + //QMap mWidgetMap; + HbWidget *mWidget; +}; +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,184 @@ + +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpvolumecontroller.h" +#include +#include +#include +#include "cpvolumegroupitemdata.h" +#ifdef Q_OS_SYMBIAN + #include +#endif +//#include +//#include + +#include +#include +#include + +CpVolumeController::CpVolumeController(CpProfileModel *profileModel, + const QList &itemList, + CpItemDataHelper &itemDataHelper) : + mProfileModel(profileModel), + mItemList(itemList), + mSettingManager(0) + +{ + //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(beepActivated()),this,SLOT(onBeepActivated())); + //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(silentActivated()),this,SLOT(onSilentActivated())); + //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(normalValueChanged(int)),this,SLOT(onNormalValueChanged(int))); + //updateMasterVolumeValue(); + + + itemDataHelper.addConnection( + mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem), SIGNAL(toggled(bool)), + this, SLOT(silenceModeChange(bool)) + ); + + + itemDataHelper.addConnection( + mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem), SIGNAL(valueChanged(int)), + this, SLOT(masterVolumeChange(int)) + ); + itemDataHelper.addConnection( + mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem), SIGNAL(stateChanged(int)), + this, SLOT(masterVibraChange(int)) + ); + updateUi(); + + mSettingManager = new XQSettingsManager(); + + XQCentralRepositorySettingsKey silenceKey(KCRUidProfileEngine.iUid,KProEngSilenceMode); + mSettingManager->startMonitoring(silenceKey,XQSettingsManager::TypeInt); + + XQCentralRepositorySettingsKey masterVolumeKey + (KCRUidProfileEngine.iUid,KProEngMasterVolume); + mSettingManager->startMonitoring(masterVolumeKey,XQSettingsManager::TypeInt); + + XQCentralRepositorySettingsKey masterVibraKey + (KCRUidProfileEngine.iUid,KProEngMasterVibra); + mSettingManager->startMonitoring(masterVibraKey,XQSettingsManager::TypeInt); + + connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); +} + +CpVolumeController::~CpVolumeController() +{ + delete mSettingManager; +} + +void CpVolumeController::silenceModeChange(bool isSilence) +{ +#ifdef Q_OS_SYMBIAN + mProfileModel->setSilenceMode(isSilence); +#endif +} + + +void CpVolumeController::masterVolumeChange(int value) +{ +#ifdef Q_OS_SYMBIAN + mProfileModel->setMasterVolume(value); + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + masterVolume->setContentWidgetData("value",value); +#endif +} + +void CpVolumeController::masterVibraChange(int state) +{ +#ifdef Q_OS_SYMBIAN + mProfileModel->setMasterVibra(state); +#endif +} + +void CpVolumeController::updateUi() +{ +#ifdef Q_OS_SYMBIAN + bool isSilenceMode = mProfileModel->silenceMode(); + HbDataFormModelItem *silenceIndicator = mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem); + if(silenceIndicator) { + silenceIndicator->setContentWidgetData("checked",isSilenceMode); + } + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + if (masterVolume) { + CPFW_LOG("::updateMasterVolumeValue(), Start using profile model."); + QMap iconMaps; + if (isSilenceMode) { + CPFW_LOG("::updateMasterVolumeValue(), Got silent state."); + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + } + else { + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); + } + masterVolume->setContentWidgetData("elementIcons", iconMaps); + masterVolume->setEnabled(!isSilenceMode); + //masterVolume->setContentWidgetData("enabled",!isSilenceMode); + masterVolume->setContentWidgetData("value",mProfileModel->masterVolume()); + } + HbDataFormModelItem *masterVibra = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem); + if (masterVibra) { + masterVibra->setContentWidgetData("checkState",(mProfileModel->masterVibra()?2:0)); + } + +#endif +} + +void CpVolumeController::settingValueChanged(const XQSettingsKey &key, const QVariant &value) +{ + if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode) { + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + if (masterVolume) { + QMap iconMaps; + if (value.toBool()) { + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + } + else { + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); + } + masterVolume->setContentWidgetData("elementIcons", iconMaps); + masterVolume->setEnabled(!value.toBool()); + } + HbDataFormModelItem *silenceMode = mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem); + if (silenceMode) { + silenceMode->setContentWidgetData("checked",value.toInt() != 0); + } + } + else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVolume) { + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + if (masterVolume) { + masterVolume->setContentWidgetData("value",value.toInt()); + } + } + else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVibra) { + HbDataFormModelItem *masterVibra = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem); + if (masterVibra) { + masterVibra->setContentWidgetData("checkState",(value.toInt() ? 2 : 0)); + } + } +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Tue Aug 31 15:15:28 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: + * + */ +#ifndef CPVOLUMECONTROLLER_H +#define CPVOLUMECONTROLLER_H + +#include + +class CpProfileModel; +class HbDataFormModelItem; +class CpItemDataHelper; +class XQSettingsManager; +class XQSettingsKey; +class QVariant; + +class CpVolumeController : public QObject +{ + Q_OBJECT +public: + CpVolumeController(CpProfileModel *profileModel, + const QList &itemList, + CpItemDataHelper &itemDataHelper); + virtual ~CpVolumeController(); + +private slots: + void silenceModeChange(bool isSilence); + void masterVolumeChange(int value); + void masterVibraChange(int state); + + void settingValueChanged(const XQSettingsKey &key, const QVariant &value); + +private: + void updateUi(); + +private: + CpProfileModel *mProfileModel; + QList mItemList; + XQSettingsManager *mSettingManager; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpvolumegroupitemdata.h" +#include +#include +#include +#include +#include +#include +#include +//#include "cpmastervolumevaluecontroller.h" +#include "cpvolumecontroller.h" +#include "cppersonalizationcustomviewitem.h" +#include + +CpVolumeGroupItemData::CpVolumeGroupItemData(CpItemDataHelper &itemDataHelper) +: CpSettingFormItemData(HbDataFormModelItem::GroupItem,hbTrId("txt_cp_subhead_volume")),//mSilenceIndicator(0), + //mMasterVolume(0), + //mMasterVibra(0), + mVolumeController(0), + mProfileModel(0) +{ + initItems(itemDataHelper); +} + +CpVolumeGroupItemData::~CpVolumeGroupItemData() +{ + delete mProfileModel; + delete mVolumeController; +} + +void CpVolumeGroupItemData::initItems(CpItemDataHelper &itemDataHelper) +{ + mProfileModel = new CpProfileModel(); + + itemDataHelper.addItemPrototype(new CpPersonalizationCustomViewItem); + CPFW_LOG("CpVolumeGroupItemData::initItems(), get active profile id"); + CPFW_LOG("CpVolumeGroupItemData::initItems(), succeed in getting id"); + + HbDataFormModelItem *silenceIndicator = new HbDataFormModelItem(static_cast(SilenceIndicatorItem)); + mItemList.insert(CpVolumeGroupItemData::EVolumeSilenceItem, silenceIndicator); + silenceIndicator->setContentWidgetData("text",hbTrId("txt_cp_button_silence")); + silenceIndicator->setContentWidgetData("objectName", "silenceIndicatorButton"); + this->appendChild(silenceIndicator); + + HbDataFormModelItem *masterVolume = new HbDataFormModelItem(HbDataFormModelItem::SliderItem, + hbTrId("txt_cp_setlabel_ringing_volume")); + mItemList.insert(CpVolumeGroupItemData::EVolumeMasterVolumeItem, masterVolume); + QList elements; + elements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) + << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement) + << QVariant(HbSlider::TextElement); + masterVolume->setContentWidgetData("sliderElements",elements); + masterVolume->setContentWidgetData("objectName","masterVolumeSlider"); + + QMap iconMaps; + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + //iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + + masterVolume->setContentWidgetData("elementIcons", iconMaps); + masterVolume->setContentWidgetData("minimum", 1); + masterVolume->setContentWidgetData("maximum", 10); + masterVolume->setContentWidgetData("majorTickInterval",1); + masterVolume->setContentWidgetData("tickPosition",Hb::SliderTicksBelow); + + /*QStringList tickLabels; + tickLabels<setContentWidgetData("majorTickLabels",tickLabels);*/ + + masterVolume->setContentWidgetData("iconCheckable",false); + this->appendChild(masterVolume); + + HbDataFormModelItem *masterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem); + mItemList.insert(CpVolumeGroupItemData::EVolumeMasterVibraItem, masterVibra); + masterVibra->setContentWidgetData("text",hbTrId("txt_cp_list_vibrate")); + masterVibra->setContentWidgetData("objectName","masterVibraCheckBox"); + + this->appendChild(masterVibra); + + mVolumeController = new CpVolumeController(mProfileModel, mItemList, itemDataHelper); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPVOLUMEGROUPITEMDATA_H +#define CPVOLUMEGROUPITEMDATA_H + +#include +#include + +class CpProfileModel; +class CpItemDataHelper; +class CpVolumeController; +class CpVolumeGroupItemData : public CpSettingFormItemData +{ + Q_OBJECT +public: + enum VolumeGroupModelItem { + EVolumeSilenceItem, + EVolumeMasterVolumeItem, + EVolumeMasterVibraItem, + EVolumeItemEnd + }; +public: + explicit CpVolumeGroupItemData(CpItemDataHelper &itemDataHelper); + virtual ~CpVolumeGroupItemData(); +private: + Q_DISABLE_COPY(CpVolumeGroupItemData) + void initItems(CpItemDataHelper &itemDataHelper); + QList mItemList; + CpVolumeController *mVolumeController; + CpProfileModel *mProfileModel; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumeplugin.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpvolumeplugin.h" +#include "cpvolumegroupitemdata.h" +#include + +CpVolumePlugin::CpVolumePlugin() +{ +} + +CpVolumePlugin::~CpVolumePlugin() +{ +} + +QList CpVolumePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + + CpVolumeGroupItemData *volumeGroupItem = new CpVolumeGroupItemData(itemDataHelper); + + return QList() << volumeGroupItem ; +} + +Q_EXPORT_PLUGIN2(cpvolumeplugin, CpVolumePlugin); + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumeplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumeplugin.h Tue Aug 31 15:15:28 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: + * + */ + +#ifndef CPVOLUMEPLUGIN_H +#define CPVOLUMEPLUGIN_H + +#include +#include + +class CpVolumePlugin + : public QObject, + public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpVolumePlugin(); + virtual ~CpVolumePlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif /* CPVOLUMEPLUGIN_H */ + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pri Tue Aug 31 15:15:28 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: controlpanel project - common qmake settings +# + +HEADERS += src/*.h +SOURCES += src/*.cpp + + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpvolumeplugin + +CONFIG += hb plugin +RESOURCES += volumeplugin.qrc +LIBS += -lcpprofilewrapper -lxqsettingsmanager + +include ( ../cpplugincommon.pri ) +include ( volumeplugin.pri ) + +symbian { + TARGET.UID3 = 0X20028737 +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.qrc Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,10 @@ + + + icon/hb_vol_slider_decrement.svg + icon/hb_vol_slider_decrement_pressed.svg + icon/hb_vol_slider_increment.svg + icon/hb_vol_slider_increment_pressed.svg + icon/hb_vol_slider_muted.svg + icon/hb_vol_slider_unmuted.svg + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,60 @@ +EXPORTS + ?setKeyTouchScreenVibra@CpProfileModel@@QAEXHH@Z @ 1 NONAME ; void CpProfileModel::setKeyTouchScreenVibra(int, int) + ?tr@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString CpProfileModel::tr(char const *, char const *, int) + ?masterVibra@CpProfileModel@@QBE_NXZ @ 3 NONAME ; bool CpProfileModel::masterVibra(void) const + ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 4 NONAME ; class QString CpProfileModel::ringTone(void) const + ?setProfileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 5 NONAME ; void CpProfileModel::setProfileSettings(int, class CpProfileSettings &) + ?qt_metacast@CpProfileModel@@UAEPAXPBD@Z @ 6 NONAME ; void * CpProfileModel::qt_metacast(char const *) + ?setRingTone@CpProfileModel@@QAEXABVQString@@@Z @ 7 NONAME ; void CpProfileModel::setRingTone(class QString const &) + ?setReminderTone@CpProfileModel@@QAEXHABVQString@@@Z @ 8 NONAME ; void CpProfileModel::setReminderTone(int, class QString const &) + ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *) + ?silenceMode@CpProfileModel@@QBE_NXZ @ 10 NONAME ; bool CpProfileModel::silenceMode(void) const + ?setEmailTone@CpProfileModel@@QAEXHABVQString@@@Z @ 11 NONAME ; void CpProfileModel::setEmailTone(int, class QString const &) + ?emailTone@CpProfileModel@@QBE?AVQString@@H@Z @ 12 NONAME ; class QString CpProfileModel::emailTone(int) const + ?activeProfileId@CpProfileModel@@QBEHXZ @ 13 NONAME ; int CpProfileModel::activeProfileId(void) const + ?masterVolume@CpProfileModel@@QBEHXZ @ 14 NONAME ; int CpProfileModel::masterVolume(void) const + ?notificationTone@CpProfileModel@@QBE_NH@Z @ 15 NONAME ; bool CpProfileModel::notificationTone(int) const + ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpProfileModel::tr(char const *, char const *) + ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void) + ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 18 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const + ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 19 NONAME ; class QString CpProfileModel::reminderTone(int) const + ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 20 NONAME ; class QString CpProfileModel::profileName(int) const + ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 21 NONAME ; void CpProfileModel::setRingTone(int, class QString const &) + ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 22 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int) + ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 23 NONAME ; void CpProfileModel::setMasterVolume(int) + ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 24 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject + ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 25 NONAME ; class QStringList CpProfileModel::profileNames(void) const + ?activateProfile@CpProfileModel@@QAEHH@Z @ 26 NONAME ; int CpProfileModel::activateProfile(int) + ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 27 NONAME ; void CpProfileModel::setNotificationTone(int, bool) + ?metaObject@CpProfileModel@@UBEPBUQMetaObject@@XZ @ 28 NONAME ; struct QMetaObject const * CpProfileModel::metaObject(void) const + ??0CpProfileModel@@QAE@PAVQObject@@@Z @ 29 NONAME ; CpProfileModel::CpProfileModel(class QObject *) + ??1CpProfileModel@@UAE@XZ @ 30 NONAME ; CpProfileModel::~CpProfileModel(void) + ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 31 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?profileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 32 NONAME ; void CpProfileModel::profileSettings(int, class CpProfileSettings &) + ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 33 NONAME ; class QString CpProfileModel::messageTone(int) const + ?d_func@CpProfileModel@@ABEPBVCpProfileModelPrivate@@XZ @ 34 NONAME ; class CpProfileModelPrivate const * CpProfileModel::d_func(void) const + ?setSilenceMode@CpProfileModel@@QAEX_N@Z @ 35 NONAME ; void CpProfileModel::setSilenceMode(bool) + ?keyTouchScreenVibra@CpProfileModel@@QBEHH@Z @ 36 NONAME ; int CpProfileModel::keyTouchScreenVibra(int) const + ?d_func@CpProfileModel@@AAEPAVCpProfileModelPrivate@@XZ @ 37 NONAME ; class CpProfileModelPrivate * CpProfileModel::d_func(void) + ??_ECpProfileModel@@UAE@I@Z @ 38 NONAME ; CpProfileModel::~CpProfileModel(unsigned int) + ?ringTone@CpProfileModel@@QBE?AVQString@@H@Z @ 39 NONAME ; class QString CpProfileModel::ringTone(int) const + ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *, int) + ?setMessageTone@CpProfileModel@@QAEXHABVQString@@@Z @ 41 NONAME ; void CpProfileModel::setMessageTone(int, class QString const &) + ?setMasterVibra@CpProfileModel@@QAEX_N@Z @ 42 NONAME ; void CpProfileModel::setMasterVibra(bool) + ?trUtf8@CpProfileMonitor@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString CpProfileMonitor::trUtf8(char const *, char const *, int) + ??_ECpProfileMonitor@@UAE@I@Z @ 44 NONAME ; CpProfileMonitor::~CpProfileMonitor(unsigned int) + ?activeProfileModified@CpProfileMonitor@@IAEXH@Z @ 45 NONAME ; void CpProfileMonitor::activeProfileModified(int) + ?tr@CpProfileMonitor@@SA?AVQString@@PBD0H@Z @ 46 NONAME ; class QString CpProfileMonitor::tr(char const *, char const *, int) + ?trUtf8@CpProfileMonitor@@SA?AVQString@@PBD0@Z @ 47 NONAME ; class QString CpProfileMonitor::trUtf8(char const *, char const *) + ?staticMetaObject@CpProfileMonitor@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const CpProfileMonitor::staticMetaObject + ??0CpProfileMonitor@@QAE@PAVQObject@@@Z @ 49 NONAME ; CpProfileMonitor::CpProfileMonitor(class QObject *) + ?metaObject@CpProfileMonitor@@UBEPBUQMetaObject@@XZ @ 50 NONAME ; struct QMetaObject const * CpProfileMonitor::metaObject(void) const + ?d_func@CpProfileMonitor@@ABEPBVCpProfileMonitorPrivate@@XZ @ 51 NONAME ; class CpProfileMonitorPrivate const * CpProfileMonitor::d_func(void) const + ?d_func@CpProfileMonitor@@AAEPAVCpProfileMonitorPrivate@@XZ @ 52 NONAME ; class CpProfileMonitorPrivate * CpProfileMonitor::d_func(void) + ?profileActivated@CpProfileMonitor@@IAEXH@Z @ 53 NONAME ; void CpProfileMonitor::profileActivated(int) + ?tr@CpProfileMonitor@@SA?AVQString@@PBD0@Z @ 54 NONAME ; class QString CpProfileMonitor::tr(char const *, char const *) + ?getStaticMetaObject@CpProfileMonitor@@SAABUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const & CpProfileMonitor::getStaticMetaObject(void) + ?qt_metacast@CpProfileMonitor@@UAEPAXPBD@Z @ 56 NONAME ; void * CpProfileMonitor::qt_metacast(char const *) + ??1CpProfileMonitor@@UAE@XZ @ 57 NONAME ; CpProfileMonitor::~CpProfileMonitor(void) + ?qt_metacall@CpProfileMonitor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 58 NONAME ; int CpProfileMonitor::qt_metacall(enum QMetaObject::Call, int, void * *) + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,84 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = cpprofilewrapper + +CONFIG += debug_and_release + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin + OBJECTS_DIR = $$PWD/../$$SUBDIRPART/tmp/$$TARGET +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +DEFINES += PROFILEWRAPPER_FREEZE + + +HEADERS += ../inc/cpprofilemodel.h \ + ../inc/cpprofilewrappermacro.h \ + ../inc/cpprofilemonitor.h \ + src/cpprofilemodel_p.h \ + src/cpprofilemonitor_p.h +SOURCES += src/cpprofilemodel.cpp \ + src/cpprofilemonitor.cpp +CONFIG += hb +win32 { + INCLUDEPATH += $$PWD/src + INCLUDEPATH += ../inc + SOURCES += src/cpprofilemodel_win_p.cpp +} + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$APP_LAYER_SYSTEMINCLUDE \ + $$MOC_DIR + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + + SOURCES += src/cpprofilemodel_p.cpp \ + src/cpprofilemonitor_p.cpp + + LIBS += -lprofileeng \ + -lcentralrepository \ + -lcharconv \ + -lcplogger \ # For cplogger + -lxqutils + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.UID3 = 0x20025FE6 +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,56 @@ +EXPORTS + _ZN14CpProfileModel11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN14CpProfileModel11qt_metacastEPKc @ 2 NONAME + _ZN14CpProfileModel11setRingToneERK7QString @ 3 NONAME + _ZN14CpProfileModel11setRingToneEiRK7QString @ 4 NONAME + _ZN14CpProfileModel12setEmailToneEiRK7QString @ 5 NONAME + _ZN14CpProfileModel14setMasterVibraEb @ 6 NONAME + _ZN14CpProfileModel14setMessageToneEiRK7QString @ 7 NONAME + _ZN14CpProfileModel14setSilenceModeEb @ 8 NONAME + _ZN14CpProfileModel15activateProfileEi @ 9 NONAME + _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 10 NONAME + _ZN14CpProfileModel15setMasterVolumeEi @ 11 NONAME + _ZN14CpProfileModel15setReminderToneEiRK7QString @ 12 NONAME + _ZN14CpProfileModel16staticMetaObjectE @ 13 NONAME DATA 16 + _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 14 NONAME + _ZN14CpProfileModel19getStaticMetaObjectEv @ 15 NONAME + _ZN14CpProfileModel19setNotificationToneEib @ 16 NONAME + _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 17 NONAME + _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 18 NONAME + _ZN14CpProfileModelC1EP7QObject @ 19 NONAME + _ZN14CpProfileModelC2EP7QObject @ 20 NONAME + _ZN14CpProfileModelD0Ev @ 21 NONAME + _ZN14CpProfileModelD1Ev @ 22 NONAME + _ZN14CpProfileModelD2Ev @ 23 NONAME + _ZNK14CpProfileModel10metaObjectEv @ 24 NONAME + _ZNK14CpProfileModel11masterVibraEv @ 25 NONAME + _ZNK14CpProfileModel11messageToneEi @ 26 NONAME + _ZNK14CpProfileModel11profileNameEi @ 27 NONAME + _ZNK14CpProfileModel11silenceModeEv @ 28 NONAME + _ZNK14CpProfileModel12masterVolumeEv @ 29 NONAME + _ZNK14CpProfileModel12profileNamesEv @ 30 NONAME + _ZNK14CpProfileModel12reminderToneEi @ 31 NONAME + _ZNK14CpProfileModel15activeProfileIdEv @ 32 NONAME + _ZNK14CpProfileModel16notificationToneEi @ 33 NONAME + _ZNK14CpProfileModel18keyTouchScreenToneEi @ 34 NONAME + _ZNK14CpProfileModel19keyTouchScreenVibraEi @ 35 NONAME + _ZNK14CpProfileModel8ringToneEi @ 36 NONAME + _ZNK14CpProfileModel8ringToneEv @ 37 NONAME + _ZNK14CpProfileModel9emailToneEi @ 38 NONAME + _ZTI14CpProfileModel @ 39 NONAME + _ZTV14CpProfileModel @ 40 NONAME + _ZN16CpProfileMonitor11qt_metacallEN11QMetaObject4CallEiPPv @ 41 NONAME + _ZN16CpProfileMonitor11qt_metacastEPKc @ 42 NONAME + _ZN16CpProfileMonitor16profileActivatedEi @ 43 NONAME + _ZN16CpProfileMonitor16staticMetaObjectE @ 44 NONAME DATA 16 + _ZN16CpProfileMonitor19getStaticMetaObjectEv @ 45 NONAME + _ZN16CpProfileMonitor21activeProfileModifiedEi @ 46 NONAME + _ZN16CpProfileMonitorC1EP7QObject @ 47 NONAME + _ZN16CpProfileMonitorC2EP7QObject @ 48 NONAME + _ZN16CpProfileMonitorD0Ev @ 49 NONAME + _ZN16CpProfileMonitorD1Ev @ 50 NONAME + _ZN16CpProfileMonitorD2Ev @ 51 NONAME + _ZNK16CpProfileMonitor10metaObjectEv @ 52 NONAME + _ZTI16CpProfileMonitor @ 53 NONAME + _ZTV16CpProfileMonitor @ 54 NONAME + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,283 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpprofilemodel.h" +#include "cpprofilemodel_p.h" +#include + +/*! + Contructor + */ +CpProfileModel::CpProfileModel(QObject *parent /*=0*/):QObject(parent), + d_ptr(new CpProfileModelPrivate()) +{ + d_ptr->initialize(this); +} + +/*! + Destrutor + */ +CpProfileModel::~CpProfileModel() +{ + delete d_ptr; +} + +/*! + Get profile name with its id + */ +QString CpProfileModel::profileName(int profileId) const +{ + return d_ptr->profileName(profileId); +} +/*! + get profile name list + */ +QStringList CpProfileModel::profileNames()const +{ + return d_ptr->profileNames(); +} +/*! + Activate a profile with its id, return the result code. + */ +int CpProfileModel::activateProfile(int profileId) +{ + return d_ptr->activateProfile(profileId); +} + +/*! + Get active profile's id + */ +int CpProfileModel::activeProfileId() const +{ + return d_ptr->activeProfileId(); +} + +/*! + Get profile settings, store in center repository keys + */ +void CpProfileModel::profileSettings(int profileId, CpProfileSettings& profileSettings) +{ + d_ptr->profileSettings(profileId, profileSettings); +} + +/*! + Set profile settings from center repository keys + */ +void CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings ) +{ + return d_ptr->setProfileSettings(profileId, profileSettings); +} + +/*! + Get ring tone of active profile + */ +QString CpProfileModel::ringTone() const +{ + return d_ptr->ringTone(); +} + +/*! + Set ring tone for all profiles + */ +void CpProfileModel::setRingTone(const QString& filePath) +{ + d_ptr->setRingTone(filePath); +} + +/*! + Return ringing volume of device + */ +int CpProfileModel::masterVolume() const +{ + return d_ptr->masterVolume(); +} + +/*! + Set device's ringing volume + */ +void CpProfileModel::setMasterVolume(int volume) +{ + return d_ptr->setMasterVolume(volume); +} + +/*! + Return the master vibra's status of device + */ +bool CpProfileModel::masterVibra() const +{ + return d_ptr->masterVibra(); +} + +/*! + Set the master vibra's status of device + */ +void CpProfileModel::setMasterVibra(bool isVibra) +{ + d_ptr->setMasterVibra(isVibra); +} + +/*! + Return the silence mode of device + */ +bool CpProfileModel::silenceMode() const +{ + return d_ptr->silenceMode(); +} + +/*! + Set silence mode for deivce + */ +void CpProfileModel::setSilenceMode(bool isSilence) +{ + d_ptr->setSilenceMode(isSilence); +} + +/*! + Get profile's ring tone, if the profile id is invalid, always return an empty string + \param profileId profile's id + */ +QString CpProfileModel::ringTone(int profileId)const +{ + return d_ptr->ringTone(profileId); +} + +/*! + Set ring tone for a profile, if the profile id is invalid, nothing happens + \param profileId profile's id + \param filePath ring tone's path + */ +void CpProfileModel::setRingTone(int profileId, const QString& filePath) +{ + d_ptr->setRingTone(profileId, filePath); +} + +/*! + Get message tone's name, if the profile id is invalid, always return an empty string + \param profileId profile's id + */ +QString CpProfileModel::messageTone(int profileId) const +{ + return d_ptr->messageTone(profileId); +} + +/*! + Set message tone for a profile, if the profile id is invalid, nothing happens + \param profileId profile's id + \param filePath message tone's path + */ +void CpProfileModel::setMessageTone(int profileId, const QString& filePath) +{ + d_ptr->setMessageTone(profileId, filePath); +} + +/*! + Get email tone's name, if the profile id is invalid, always return an empty string + \param profileId profile's id + */ +QString CpProfileModel::emailTone(int profileId) const +{ + return d_ptr->emailTone(profileId); +} + +/*! + Set email tone for a profile, if the profile id is invalid, nothing happens + \param profileId profile's id + \param filePath message tone's path + */ +void CpProfileModel::setEmailTone(int profileId, const QString& filePath) +{ + d_ptr->setEmailTone(profileId,filePath); +} + +/*! + Get reminder tone's name, if the profile id is invalid, always return an empty string + \param profileId profile's id + */ +QString CpProfileModel::reminderTone(int profileId) const +{ + return d_ptr->reminderTone(profileId); +} + +/*! + Set reminder tone for a profile, if the profile id is invalid, nothing happens + \param profileId profile's id + \param filePath reminder tone's path + */ +void CpProfileModel::setReminderTone(int profileId, const QString& filePath) +{ + d_ptr->setReminderTone(profileId,filePath); +} + +/*! + Get notification tone's status, if the profile id is invalid, always return false + \param profileId profile's id + \return return the status of notification tone, true value stands for the tone being on + */ +bool CpProfileModel::notificationTone(int profileId) const +{ + return d_ptr->notificationTone(profileId); +} + +/*! + Set notification tone's status for a profile, if the profile id is invalid, nothing happens + \param profileId profile's id + \return isActive the status of notification tone + */ +void CpProfileModel::setNotificationTone(int profileId, bool isActive) +{ + d_ptr->setNotificationTone(profileId, isActive); +} + +/*! + Get key & touch screen tone's value, if the profile id is invalid, always return 0 + */ +int CpProfileModel::keyTouchScreenTone(int profileId) const +{ + return d_ptr->keyTouchScreenTone(profileId); +} + +/*! + set key & touch screen tone, if the profile id is invalid, nothing happens + \param profileId identify the profile + \param level 0-5 + */ +void CpProfileModel::setKeyTouchScreenTone(int profileId, int level) +{ + d_ptr->setKeyTouchScreenTone(profileId,level); +} + +/*! + Get key & touch screen vibra's value, if the profile id is invalid, always return 0 + \param profileId identify the profile + */ +int CpProfileModel::keyTouchScreenVibra(int profileId) const +{ + return d_ptr->keyTouchScreenVibra(profileId); +} + +/*! + Set key touch screen vibar for a profile, if the profile id is invalid, nothing happens + \param profileId identify the profile + \param level 0-5 + */ +void CpProfileModel::setKeyTouchScreenVibra(int profileId, int level) +{ + d_ptr->setKeyTouchScreenVibra(profileId,level); +} + +// End of file + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,703 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpprofilemodel_p.h" +#include "cpprofilemodel.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* + * Constructor + */ +CpProfileModelPrivate::CpProfileModelPrivate() + : mEngine(0), + mProfileNames(0), + q_ptr(0) +{ + +} + +/* + * Initialize the profile engine and available profile list for profile wrapper. + */ +void CpProfileModelPrivate::initialize(CpProfileModel *parent) +{ + q_ptr = parent; + CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START."); + TRAP_IGNORE( + mEngine = CreateProfileEngineExtended2L(); + mProfileNames = mEngine->ProfilesNamesArrayLC(); + CleanupStack::Pop(); // pop the pointer of mProfileNames + /* + * Currently, engine part will return all previous version of profile + * so some invalid profile will be added in the new list, to avoid this + * use hard code to get the right list of profile. + */ + /*MProfilesNamesArray* nameList = mEngine->ProfilesNamesArrayLC(); + int profileCount = nameList->MdcaCount(); + for (int i = 0; iProfileName(i); + mProfileList.insert(profileName->Id(), mEngine->Profile2L(profileName->Id())); + } + CleanupStack::PopAndDestroy(*nameList);*/ + ); + mProfileList.append(static_cast(EProfileWrapperGeneralId)); // general id + mProfileList.append(static_cast(EProfileWrapperMeetingId)); // meeting id + CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END"); +} + +/* + * Destructor + */ +CpProfileModelPrivate::~CpProfileModelPrivate() +{ + if (mEngine!=0) { + mEngine->Release(); + } + if (mProfileNames) { + delete mProfileNames; + } + mProfileList.clear(); +} + +/* + * Get profile name with its id + */ +QString CpProfileModelPrivate::profileName(int profileId) const +{ + CPFW_LOG("CpProfileModelPrivate::profileName(), START."); + // Return an empty string if id is not valid. + if (!isValidProfile(profileId)) { + return QString(); + } + + const MProfileName* name = mProfileNames->ProfileName(profileId); + QString profileName; + if (name != 0) { + profileName = XQConversions::s60DescToQString(name->Name()); + } + CPFW_LOG("CpProfileModelPrivate::profileName(), END."); + return profileName; +} + +/* + * Get available profiles' name list. + */ +QStringList CpProfileModelPrivate::profileNames() const +{ + CPFW_LOG("CpProfileModelPrivate::profileNames(), START."); + QStringList nameList; + + foreach(int profileId, mProfileList) { + const MProfileName *name = mProfileNames->ProfileName(profileId); + if (name != 0) { + nameList.append(XQConversions::s60DescToQString(name->Name())); + } + } + + CPFW_LOG("CpProfileModelPrivate::profileNames(), END."); + return nameList; +} + + +/* + * Activate a profile with its id, return the result. + */ +int CpProfileModelPrivate::activateProfile(int profileId) +{ + CPFW_LOG("CpProfileModelPrivate::activateProfile(), START."); + // currently, only two profile remains: general and meeting, + // But profile engine also support the old profile like: + // silence, out ... + // so filter the invalid profile id first. + if (!isValidProfile(profileId)) { + return KErrNotFound; + } + TRAPD( err, + mEngine->SetActiveProfileL( profileId ); + ); + CPFW_LOG("CpProfileModelPrivate::activateProfile(), END."); + return err; +} + +/* + * Get active profile's id + */ +int CpProfileModelPrivate::activeProfileId() const +{ + return mEngine->ActiveProfileId(); +} + +/* + * Return all profile settings according to profile's id + */ +void CpProfileModelPrivate::profileSettings(int profileId, + CpProfileSettings& profileSettings) +{ + if (!isValidProfile(profileId)) { + return; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + const MProfileTones &setTones = profileExtend->ProfileTones(); + const TProfileToneSettings &toneSettings = setTones.ToneSettings(); + const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); + const MProfileVibraSettings &vibraSettings = + profileExtend->ProfileVibraSettings(); + const MProfileExtraSettings &extraSettings = + profileExtend->ProfileExtraSettings(); + const MProfileFeedbackSettings &feedbackSettings = + extraSettings.ProfileFeedbackSettings(); + + profileSettings.mRingTone = XQConversions::s60DescToQString(setTones.RingingTone1()); + profileSettings.mMessageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone()); + profileSettings.mEmailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone()); + profileSettings.mReminderTone = XQConversions::s60DescToQString(extTones.ReminderTone()); + profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones; + + // only use Keypad Volume as a base value for display in key & touch screen setting option + profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume; + profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ); +} +/* + * set profile settings + */ +void CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) +{ + if (!isValidProfile(profileId)) { + return; + } + + QT_TRAP_THROWING ( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); + TProfileToneSettings &toneSettings = setTones.SetToneSettings(); + MProfileSetExtraTones2 &setExtTones = + profileExtend->ProfileSetExtraTones2(); + MProfileSetVibraSettings &setVibraSettings = + profileExtend->ProfileSetVibraSettings(); + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + + + setTones.SetRingingTone1L(*XQConversions::qStringToS60Desc( + profileSettings.mRingTone)); + setTones.SetMessageAlertToneL(*XQConversions::qStringToS60Desc( + profileSettings.mMessageTone)); + setExtTones.SetEmailAlertToneL(*XQConversions::qStringToS60Desc( + profileSettings.mEmailTone)); + setExtTones.SetReminderToneL(*XQConversions::qStringToS60Desc( + profileSettings.mReminderTone)); + + toneSettings.iWarningAndGameTones + = profileSettings.mNotificationTone; + // Change the keypad volume and touch screen tone together + toneSettings.iKeypadVolume + = static_cast (profileSettings.mKeyTouchScreenTone); + setFeedbackSettings.SetAudioFeedback( + static_cast (profileSettings.mKeyTouchScreenTone)); + setFeedbackSettings.SetTactileFeedback( + static_cast (profileSettings.mKeyTouchScreenVibra)); + + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + ) +} + +/* + * Get the active profile's ring tone name + */ +QString CpProfileModelPrivate::ringTone() const +{ + // return empty string when active profile id is invalid, + // some old application still set the profile which is not available now, + // this check can be removed when every application use a correct profile id + + QString ringTone; + if (!isValidProfile(activeProfileId())) { + return ringTone; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(activeProfileId()); + CleanupStack::PushL(profileExtend); + const MProfileTones &setTones = profileExtend->ProfileTones(); + + ringTone = XQConversions::s60DescToQString(setTones.RingingTone1()); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + + return ringTone; +} + +/* + * Set the ring tone for all profiles + */ +void CpProfileModelPrivate::setRingTone(const QString& filePath) +{ + for (TInt i = 0; i < mProfileList.count(); ++i) { + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(mProfileList.at(i)); + CleanupStack::PushL(profileExtend); + + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); + + setTones.SetRingingTone1L( *XQConversions::qStringToS60Desc(filePath) ); + mEngine ->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + } +} + +/* + * Get the ringing volume value + */ +int CpProfileModelPrivate::masterVolume() const +{ + int masterVolume = 0; + QT_TRAP_THROWING(masterVolume = mEngine->MasterVolumeL();) + return masterVolume; +} + +/* + * Set the ringing volume + */ +void CpProfileModelPrivate::setMasterVolume(int volume) +{ + // the volume range 1-10 + if (volume >= EProfileRingingVolumeLevel1 && volume <= EProfileRingingVolumeLevel10) { + QT_TRAP_THROWING(mEngine->SetMasterVolumeL( volume );) + } +} +/* + * Get the master vibra's status + */ +bool CpProfileModelPrivate::masterVibra() const +{ + bool masterVibra = false; + QT_TRAP_THROWING(masterVibra = mEngine->MasterVibraL();) + return masterVibra; +} + +/* + * Set master vibra's status + */ +void CpProfileModelPrivate::setMasterVibra(bool isVibra) +{ + QT_TRAP_THROWING(mEngine->SetMasterVibraL( isVibra );) +} + +/* + * Get the status of silence mode. + */ +bool CpProfileModelPrivate::silenceMode() const +{ + bool isSlience = false; + QT_TRAP_THROWING(isSlience = mEngine->SilenceModeL();) + return isSlience; +} + +/* + * Set the status of silence mode + */ +void CpProfileModelPrivate::setSilenceMode(bool isSilence) +{ + QT_TRAP_THROWING(mEngine->SetSilenceModeL( isSilence );) +} + +/* + * Return the ring tone of a profile, if the profile id is invalid, always + * return an empty string + */ +QString CpProfileModelPrivate::ringTone(int profileId) const +{ + QString ringTone; + if(!isValidProfile(profileId)) { + return ringTone; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + const MProfileTones &setTones = profileExtend->ProfileTones(); + + ringTone = XQConversions::s60DescToQString(setTones.RingingTone1()); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + return ringTone; +} + +/* + * Set the ring tone for a profile, if the profile id is invalid, nothing happens + */ +void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) +{ + if(!isValidProfile(profileId)) { + return; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); + + setTones.SetRingingTone1L(*XQConversions::qStringToS60Desc(filePath)); + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} + +/* + * Get the message tone of a profile, if the profile id is invalid, always return + * an empty string + */ +QString CpProfileModelPrivate::messageTone(int profileId) const +{ + QString messageTone; + if(!isValidProfile(profileId)) { + return messageTone; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + const MProfileTones &setTones = profileExtend->ProfileTones(); + + messageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone()); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + + return messageTone; +} + +/* + * Set the message tone of a profile, if the profile id is invalid, nothing happens + */ +void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) +{ + if(!isValidProfile(profileId)) { + return; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + MProfileSetTones &setTones = + profileExtend->ProfileSetTones(); + setTones.SetMessageAlertToneL(*XQConversions::qStringToS60Desc(filePath)); + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} + +/* + * Get the email tone of a profile, if profile id is invalid, return an empty string + */ +QString CpProfileModelPrivate::emailTone(int profileId) const +{ + QString emailTone; + + if(!isValidProfile(profileId)) { + return emailTone; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + const MProfileExtraTones2 &extTones = + profileExtend->ProfileExtraTones2(); + + emailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone()); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + return emailTone; +} + +/* + * Set the email tone for a profile, if the profile id is invalid, nothing happens + */ +void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) +{ + if(!isValidProfile(profileId)) { + return ; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + MProfileSetExtraTones2 &setExtTones = + profileExtend->ProfileSetExtraTones2(); + setExtTones.SetEmailAlertToneL(*XQConversions::qStringToS60Desc(filePath)); + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} + +/* + * Get a reminder tone for a profile, if the profile id is invalid, + * always return an emtpy string + */ +QString CpProfileModelPrivate::reminderTone(int profileId) const +{ + QString reminderTone; + if(!isValidProfile(profileId)) { + return reminderTone; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); + + reminderTone = XQConversions::s60DescToQString(extTones.ReminderTone()); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + return reminderTone; +} + +/* + * Set a reminder tone for a profile, if the profile id is invalid, + * nothing happens + */ +void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) +{ + if(!isValidProfile(profileId)) { + return; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); + setExtTones.SetReminderToneL( *XQConversions::qStringToS60Desc(filePath) ); + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} + +/* + * Get the status of notification tone, if the profile id is invalid, + * always return false + */ +bool CpProfileModelPrivate::notificationTone(int profileId) const +{ + bool ret = false; + if(!isValidProfile(profileId)) { + return false; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + const MProfileTones &setTones = profileExtend->ProfileTones(); + const TProfileToneSettings &toneSettings = setTones.ToneSettings(); + ret = toneSettings.iWarningAndGameTones; + + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + return ret; +} + +/* + * Set the status of notification tone, if the profile id is + * invalid, nothing happens + */ +void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) +{ + if(!isValidProfile(profileId)) { + return ; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); + TProfileToneSettings &toneSettings = setTones.SetToneSettings(); + + toneSettings.iWarningAndGameTones = isActive; + + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} +/* + * Get key & touch screen tone's value, if the profile id + * is invalid, always return 0 + */ +int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const +{ + int level = 0; + if(!isValidProfile(profileId)) { + return level; + } + + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + const MProfileTones &setTones = profileExtend->ProfileTones(); + const TProfileToneSettings &toneSettings = setTones.ToneSettings(); + + // Return only keypad volume, but touch tone volume will be synchronized in + // SetKeyTouchScreenTone(), these two settings also have the same default value + // in cenrep key + level = toneSettings.iKeypadVolume; + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + return level; +} +/* + * set key & touch screen tone, if the profile id + * is invalid, nothing happens + */ +void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) +{ + if(!isValidProfile(profileId)) { + return ; + } + QT_TRAP_THROWING( + + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + MProfileSetTones &setTones = + profileExtend->ProfileSetTones(); + TProfileToneSettings &toneSettings = + setTones.SetToneSettings(); + + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + + // Update the key pad volume and touch tone volume together + toneSettings.iKeypadVolume + = static_cast (level); + + setFeedbackSettings.SetAudioFeedback( + static_cast (level)); + + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} + +/* + * Get key touch screen vibra's value of a profile, return 0 if the + * profile id is invalid + */ +int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const +{ + int level = 0; + if(!isValidProfile(profileId)) { + return level; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + const MProfileExtraSettings &extraSettings = + profileExtend->ProfileExtraSettings(); + const MProfileFeedbackSettings &feedbackSettings = + extraSettings.ProfileFeedbackSettings(); + level = feedbackSettings.TactileFeedback(); + + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) + + return level; +} + +/* + * Set key & touch screen vibra for a profile, + * if the profile id is invalid, nothing happens + */ +void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) +{ + if(!isValidProfile(profileId)) { + return ; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + setFeedbackSettings.SetTactileFeedback( + static_cast (level)); + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) +} + +/* + * Judge the profile is valid or not + */ + +bool CpProfileModelPrivate::isValidProfile(int profileId) const +{ + return mProfileList.contains(profileId); +} + +// End of file + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPROFILEMODEL_P_H +#define CPPROFILEMODEL_P_H + +#include +#include +class CpProfileModel; +class CpProfileSettings; +class MProfileEngineExtended2; +class MProfileExtended2; +class MProfileFeedbackSettings; +class MProfileSetFeedbackSettings; +class CRepository; +class QStringList; +class MProfilesNamesArray; +struct TProfileToneSettings; +class CpProfileModelPrivate +{ + Q_DECLARE_PUBLIC(CpProfileModel) +public: + CpProfileModelPrivate(); + ~CpProfileModelPrivate(); + void initialize(CpProfileModel *parent); +public: + QString profileName(int profileId) const; + QStringList profileNames() const; + int activateProfile(int profileId); + int activeProfileId() const; + void profileSettings(int profileId, CpProfileSettings& profileSettings); + void setProfileSettings(int profileId, CpProfileSettings& profileSettings); + + QString ringTone() const; + void setRingTone(const QString& filePath); + + int masterVolume() const; + void setMasterVolume(int volume); + + bool masterVibra() const; + void setMasterVibra(bool isVibra); + + bool silenceMode() const; + void setSilenceMode(bool isSlience); + + QString ringTone(int profileId)const; + void setRingTone(int profileId, const QString& filePath); + QString messageTone(int profileId) const; + void setMessageTone(int profileId, const QString& filePath); + QString emailTone(int profileId) const; + void setEmailTone(int profileId, const QString& filePath); + QString reminderTone(int profileId) const; + void setReminderTone(int profileId, const QString& filePath); + + bool notificationTone(int profileId) const; + void setNotificationTone(int profileId, bool isActive); + + int keyTouchScreenTone(int profileId) const; + void setKeyTouchScreenTone(int profileId, int level); + + int keyTouchScreenVibra(int profileId)const; + void setKeyTouchScreenVibra(int profileId, int level); + +private: + bool isValidProfile(int profileId) const; + +private: +#ifdef Q_OS_SYMBIAN + MProfileEngineExtended2 *mEngine; + // Valid profile id list + QList mProfileList; + MProfilesNamesArray *mProfileNames; + +#endif // Q_OS_SYMBIAN + CpProfileModel *q_ptr; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,261 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "cpprofilemodel_p.h" +#include + +CpProfileModelPrivate::CpProfileModelPrivate() +{ +} + +CpProfileModelPrivate::~CpProfileModelPrivate() +{ +} + +/* + * Get the result of the initiation + */ +int CpProfileModelPrivate::initiationFlag() +{ + return -1; +} + +/* + * Get profile name with its id + */ +QString CpProfileModelPrivate::profileName(int profileId) +{ + Q_UNUSED(profileId); + return ""; +} + +/* + * Activate a profile with its id, return the operation code. + */ +int CpProfileModelPrivate::activateProfile(int profileId) +{ + Q_UNUSED(profileId); + return -1; +} + +/* + * Get active profile's id + */ +int CpProfileModelPrivate::activeProfileId() +{ + return -1; +} + +/* + * Get path and file name of ring tone file + */ +QString CpProfileModelPrivate::ringTone() +{ + return ""; +} + +/* + * Set path and file to ring tone + */ +int CpProfileModelPrivate::setRingTone(const QString& filePath) +{ + Q_UNUSED(filePath); + return -1; +} + +/* + * Get path and file name of message tone file + */ +QString CpProfileModelPrivate::messageTone() +{ + return ""; +} + +/* + * Set path and file to message tone + */ +int CpProfileModelPrivate::setMessageTone(const QString& filePath) +{ + Q_UNUSED(filePath); + return -1; +} + +/* + * Get path and file name of email tone file + */ +QString CpProfileModelPrivate::emailTone() +{ + return ""; +} + +/* + * Set path and file to email tone + */ +int CpProfileModelPrivate::setEmailTone(const QString& filePath) +{ + Q_UNUSED(filePath); + return -1; +} + +/* + * Get path and file name of calendar event tone file + */ +QString CpProfileModelPrivate::calendarTone() +{ + return ""; +} + +/* + * Set path and file to calendar event tone + */ +void CpProfileModelPrivate::setCalendarTone(const QString& filePath) +{ + Q_UNUSED(filePath); +} + +/* + * Get path and file name of clock alarm tone file + */ +QString CpProfileModelPrivate::alarmTone() +{ + return ""; +} + +/* + * Set path and file to clock alarm tone + */ +void CpProfileModelPrivate::setAlarmTone(const QString& filePath) +{ + Q_UNUSED(filePath); +} + +/* + * Get the value of master volume + */ +int CpProfileModelPrivate::ringVolume() +{ + return -1; +} + +/* + * Set master volume, the value should be between 1-10 + */ +void CpProfileModelPrivate::setRingVolume(int volume) +{ + Q_UNUSED(volume); +} + +/* + * Activate master volume to beep + */ +void CpProfileModelPrivate::activateBeep() +{; +} + +/* + * Get beep status in master volume + */ +bool CpProfileModelPrivate::isBeep() +{ + return false; +} + +/* + * Activate master volume to silent + */ +void CpProfileModelPrivate::activateSilent() +{ +} + +/* + * Get silent status in master volume + */ +bool CpProfileModelPrivate::isSilent() +{ + return false; +} + +/* + * Get master vibra's status + */ +bool CpProfileModelPrivate::vibraStatus() +{ + return false; +} + +/* + * Set master vibra's status + */ +void CpProfileModelPrivate::setVibraStatus(bool status) +{ + Q_UNUSED(status); +} + +/* + * Get keypad' volume + */ +int CpProfileModelPrivate::keyVolume() +{ + return -1; +} + +/* + * Set keypad's volume, + * the value of the volume should be between 0-3 + */ +void CpProfileModelPrivate::setKeyVolume(int volume) +{ + Q_UNUSED(volume); +} + +/* + * Get screen tone's volume + */ +int CpProfileModelPrivate::screenVolume() +{ + return -1; +} + +/* + * Set screen tone's volume, + * the value of the volume should be between 0-3 + */ +void CpProfileModelPrivate::setScreenVolume(int volume) +{ + Q_UNUSED(volume); +} + +/* + * Get screen vibra's level + */ +int CpProfileModelPrivate::screenVibra() +{ + return -1; +} + +/* + * Set screen vibra's level, + * the value of the level should be between 0-3 + */ +void CpProfileModelPrivate::setScreenVibra(int volume) +{ + Q_UNUSED(volume); +} + + +// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpprofilemonitor.h" +#include "cpprofilemonitor_p.h" + +/*! + \class CpProfileMonitor + \brief This class will observe the profile change or modification, and emit related signals. + */ +/*! + \fn void profileActivated(int activeProfileId) + This signal will emmit when a new profile activated + */ +/*! + \fn void activeProfileModified(int activeProfileId) + This signal will emmit when active profile's settings are modified + */ +/*! + Constructor + */ +CpProfileMonitor::CpProfileMonitor(QObject *parent) + :QObject(parent),d_ptr(new CpProfileMonitorPrivate()) +{ + d_ptr->initialize(this); +} + +/*! + Descontructor + */ +CpProfileMonitor::~CpProfileMonitor() +{ + delete d_ptr; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpprofilemonitor_p.h" +#include "cpprofilemonitor.h" + +#include + +/* + * Construtor + */ +CpProfileMonitorPrivate::CpProfileMonitorPrivate(): + mProfileNotifier(0) +{ + +} + +/* + * Desconstructor + */ +CpProfileMonitorPrivate::~CpProfileMonitorPrivate() +{ + delete mProfileNotifier; +} + +/* + * Initializing for the monitoring profile event + */ +void CpProfileMonitorPrivate::initialize(CpProfileMonitor *parent) +{ + q_ptr = parent; + TRAP_IGNORE(mProfileNotifier = CProfileChangeNotifyHandler::NewL(this)); +} + +/* + * From MProfileChangeObserver, monitor the profile event + */ +void CpProfileMonitorPrivate::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId) +{ + switch (aProfileEvent) { + case EProfileNewActiveProfile: + { + q_ptr->profileActivated(aProfileId); + break; + } + case EProfileActiveProfileModified: + { + q_ptr->activeProfileModified(aProfileId); + break; + } + default: + break; + } +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemonitor_p.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPPROFILEMONITORPRIVATE_H +#define CPPROFILEMONITORPRIVATE_H + +#include +#include + +class CProfileChangeNotifyHandler; +class CpProfileMonitor; + +class CpProfileMonitorPrivate:public MProfileChangeObserver +{ + Q_DECLARE_PUBLIC(CpProfileMonitor) +public: + CpProfileMonitorPrivate(); + ~CpProfileMonitorPrivate(); + void initialize(CpProfileMonitor *parent); + +#ifdef Q_OS_SYMBIAN +private: + void HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId); +private: + CProfileChangeNotifyHandler *mProfileNotifier; +#endif +private: + CpProfileMonitor *q_ptr; +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/unit_common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/unit_common.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +QT += testlib +CONFIG += hb qtestlib + +unix { + test.commands = /epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe + autotest.commands = /epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe -xml -o c:/$${TARGET}.xml +} else:win32 { + test.CONFIG += recursive + autotest.CONFIG += recursive + build_pass { + test.commands =/epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe + autotest.commands =/epoc32/RELEASE/WINSCW/udeb/$${TARGET}.exe -xml -o c:/$${TARGET}.xml + } +} +QMAKE_EXTRA_TARGETS += test autotest + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + TARGET.CAPABILITY = ALL -TCB +} + + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound.aac Binary file controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound.aac has changed diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound2.aac Binary file controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound2.aac has changed diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/runtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/runtest.bat Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +\epoc32\RELEASE\WINSCW\udeb\ut_cprofilemodel.exe -xml -o c:\ut_cprofilemodel.xml +copy \epoc32\winscw\c\ut_cprofilemodel.xml +del \epoc32\winscw\c\ut_cprofilemodel.xml \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,1305 @@ +/* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cpprofilemodel class +*/ + +#include "ut_cpprofilemodel.h" + + +#include + +#include +#include +#include +#include +#include + +/*! + \class TestCpProfileModel \n + \brief describe the test case's goal, like: \n + class name: cpprofilemodel \n + class's description: \n + type of test case: unit test\n + test cases' number totally: \n + */ + +void TestCpProfileModel::initTestCase() +{ + //translate the hbTrId text in control panel. + HbTranslator translator("control_panel"); + translator.loadCommon(); + ringTonePath1 = QString("C:") + QDir::separator() + QString("resource") + QDir::separator() + QString("cptestdata") + QDir::separator() + QString("sounds") + QDir::separator() + QString("testsound.aac"); + ringTonePath2 = QString("C:") + QDir::separator() + QString("resource") + QDir::separator() + QString("cptestdata") + QDir::separator() + QString("sounds") + QDir::separator() + QString("testsound2.aac"); +} +/*! + Test Case Description:\n + 1. Fucntion Name: CpProfileModel(QObject *parent = 0); \n + 2. Case Descrition: verify the constructor can work correctly. \n + 3. Input Parameters: \n   + <1> parent = 0; \n   + <2> parent = new QObject(); \n + 4. Expected result: \n   + no crash \n + */ +void TestCpProfileModel::testConstructor() +{ + QObject *pObject = new QObject(); + + //test constructor without parent. + CpProfileModel *profileModel = new CpProfileModel(0); + QVERIFY( profileModel != 0 ); + delete profileModel; + profileModel = 0; + // test constructor with parent. + profileModel = new CpProfileModel(pObject); + QVERIFY( profileModel != 0 ); + + delete pObject; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString profileName(int profileId)const; \n + 2. Case Descrition: verify that it can return the corresponding profile name when using valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId,\n    + <2> profileId = EProfileWrapperMeetingId,\n + 4. Expected result: \n  \n    + <1> return QString( "General" ) \n    + <2> return QString( "Meeting" ) \n + */ +void TestCpProfileModel::testProfileNameWithValidProfileID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QString profileName1 = profileModel->profileName(EProfileWrapperGeneralId); + QVERIFY( profileName1 == QString( "General" ) ); + + QString profileName2 = profileModel->profileName(EProfileWrapperMeetingId); + QVERIFY( profileName2 == QString("Meeting") ); + + delete profileModel; +} +/*! + Test Case Description:\n + 1. Fucntion Name: QString profileName(int profileId)const; \n + 2. Case Descrition: verify that it doesn't crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -80, \n    + <3> profileId = 888, \n    + 4. Expected result: \n  \n    + <1> return QString() \n    + <2> return QString() \n    + <3> return QString() \n    + <4> return QString() \n    + */ +void TestCpProfileModel::testProfileNameWithInvalidProfileID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QString profileName1 = profileModel->profileName(EProfileWapperStart); + QVERIFY( profileName1 == QString() ); + + QString profileName2 = profileModel->profileName(EPRofileWrapperEnd); + QVERIFY( profileName2 == QString() ); + + QString profileName3 = profileModel->profileName( -80 ); + QVERIFY( profileName3 == QString() ); + + QString profileName4 = profileModel->profileName( 888 ); + QVERIFY( profileName4 == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QStringList profileNames()const; \n + 2. Case Descrition: Verify that the profile name list can be get correctly with this function \n + 3. Input Parameters: \n   + none \n + 4. Expected result: \n    + \n + */ +void TestCpProfileModel::testProfileNames() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QStringList profilesNames = profileModel->profileNames(); + + // Verify the right profile names are returned. + QVERIFY ( profilesNames.count() == 2 ); + QVERIFY( profilesNames.contains("General", Qt::CaseInsensitive)); + QVERIFY( profilesNames.contains("Meeting", Qt::CaseInsensitive)); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: int activateProfile(int profileId); \n + 2. Case Descrition: Verify that the profile cannot be actived with the invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -6 \n    + <4> profileId = 356 \n + 4. Expected result: \n    + <1> return KErrNotFound \n    + <2> return KErrNotFound \n    + <3> return KErrNotFound \n    + <4> return KErrNotFound \n + */ +void TestCpProfileModel::testActivateProfileWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + int retErr1 = profileModel->activateProfile(EProfileWapperStart); + QVERIFY( retErr1 == KErrNotFound ); + + int retErr2 = profileModel->activateProfile(EPRofileWrapperEnd); + QVERIFY( retErr2 == KErrNotFound ); + + int retErr3 = profileModel->activateProfile( -6 ); + QVERIFY( retErr3 == KErrNotFound ); + + int retErr4 = profileModel->activateProfile( 356 ); + QVERIFY( retErr4 == KErrNotFound ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: int activateProfile(int profileId); \n + 2. Case Descrition: Verify that the profile can be actived with the valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId,\n    + <2> profileId = EProfileWrapperMeetingId,\n + 4. Expected result: \n    + <1> the current active profile ID is EProfileWrapperGeneralId \n    + <2> the current active profile ID is EProfileWrapperMeetingId \n + */ +void TestCpProfileModel::testActivateProfileWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->activateProfile(EProfileWrapperGeneralId); + QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId ); + + profileModel->activateProfile(EProfileWrapperMeetingId); + QVERIFY( profileModel->activeProfileId() == EProfileWrapperMeetingId ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: int activeProfileId() const;\n + 2. Case Descrition: Verify that it can return the right profile ID or Error code. \n + 3. Input Parameters: \n   + <1> set an active valid profile \n    + <2> set an active invaild profile \n + 4. Expected result: \n    + <1> return the right ID \n    + <2> no crash \n + */ +void TestCpProfileModel::testActiveProfileId() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->activateProfile(EProfileWrapperGeneralId); + QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId ); + + profileModel->activateProfile(-8); + // set profile failed, so the active profileID is still the previous ID, EProfileWrapperGeneralId. + QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId ); + + delete profileModel; +} +/*! + Test Case Description:\n + 1. Fucntion Name: void profileSettings(int profileId, CpProfileSettings& profileSettings);\n + 2. Case Descrition: get profile settings,\n + 3. Input Parameters: \n   + <1> profileID = EProfileWrapperGeneralId, profileSettings = CpProfileSettings; \n    + <2> profileID = EProfileWrapperMeetingId, profileSettings = CpProfileSettings; \n    + <3> profileID = EProfileWapperStart, profileSettings = CpProfileSettings; \n    + <4> profileID = EPRofileWrapperEnd, profileSettings = CpProfileSettings; \n    + <5> profileID = int, profileSettings = CpProfileSettings; \n    + 4. Expected result: \n    + no crash \n + */ +void TestCpProfileModel::testProfileSettings() +{ + CpProfileSettings profileSettings; + CpProfileModel *profileModel = new CpProfileModel(); + profileSettings.mKeyTouchScreenVibra = 0; + profileSettings.mKeyTouchScreenTone = 2; + // test with valid profile ID. + profileModel->setProfileSettings( EProfileWrapperGeneralId, profileSettings ); + profileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); + QVERIFY( profileSettings.mKeyTouchScreenTone == 2); + + profileModel->setProfileSettings( EProfileWrapperMeetingId, profileSettings ); + profileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); + QVERIFY( profileSettings.mKeyTouchScreenVibra == 0); + // test with invalid profile ID. + profileModel->profileSettings( EProfileWapperStart, profileSettings ); + + profileModel->profileSettings( EPRofileWrapperEnd, profileSettings ); + + profileModel->profileSettings( 98, profileSettings ); + + delete profileModel; +} +/*! + Test Case Description:\n + 1. Fucntion Name: int setProfileSettings(int profileId, CpProfileSettings& profileSettings );\n + 2. Case Descrition: Set profile settings from center repository keys \n + 3. Input Parameters: \n    + <1> profileID = EProfileWrapperGeneralId, profileSettings = CpProfileSettings; \n    + <2> profileID = EProfileWrapperMeetingId, profileSettings = CpProfileSettings; \n    + <3> profileID = EProfileWapperStart, profileSettings = CpProfileSettings; \n    + <4> profileID = EPRofileWrapperEnd, profileSettings = CpProfileSettings; \n    + <5> profileID = 98, profileSettings = CpProfileSettings; \n    + 4. Expected result: \n    + no crash \n + */ +void TestCpProfileModel::testSetProfileSettings() +{ + CpProfileSettings profileSettings; + profileSettings.mKeyTouchScreenVibra = 4; + profileSettings.mKeyTouchScreenTone = 3; + CpProfileModel *profileModel = new CpProfileModel(); + // test with valid profile ID. + profileModel->setProfileSettings( EProfileWrapperGeneralId, profileSettings ); + profileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); + QVERIFY( profileSettings.mKeyTouchScreenTone == 3); + + profileModel->setProfileSettings( EProfileWrapperMeetingId, profileSettings ); + profileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); + QVERIFY( profileSettings.mKeyTouchScreenVibra == 4); + + // test with invalid profile ID. + profileModel->setProfileSettings( EProfileWapperStart, profileSettings ); + profileModel->setProfileSettings( EPRofileWrapperEnd, profileSettings ); + profileModel->setProfileSettings( 98, profileSettings ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString ringTone() const;\n + 2. Case Descrition: Verify that it return the right active ring tone path. \n + 3. Input Parameters: \n    + <1> set ringtone for profiles. \n    + <2> no ringtone is set. \n + 4. Expected result: \n    + <1> return the right path \n    + <2> return QString() \n + */ +void TestCpProfileModel::testRingToneOfActive() +{ + CpProfileModel *profileModel = new CpProfileModel(); + // set a ringtone for profiles. + profileModel->setRingTone(ringTonePath1); + QString retRingTonePath1 = profileModel->ringTone(); + QVERIFY( retRingTonePath1 == ringTonePath1 ); + // no ringtone is set. + profileModel->setRingTone(QString()); + QString retRingTonePath2 = profileModel->ringTone(); + QVERIFY( retRingTonePath2 == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setRingTone(const QString& filePath);\n + 2. Case Descrition: Verify that it can set ring tone successfully with valid sound path. \n + 3. Input Parameters: \n    + <1> soundPath = QString(), \n    + 4. Expected result: \n    + <1> profileModel->ringTone() == soundPath \n + */ +void TestCpProfileModel::testSetRingToneAllWithValidPath() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setRingTone(ringTonePath1); + QVERIFY( profileModel->ringTone() == ringTonePath1 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setRingTone(const QString& filePath);\n + 2. Case Descrition: Verify that no crash when setting ring tone with invalid sound path. \n + 3. Input Parameters: \n    + <1> path = QString(), \n    + <2> path = QString(XX), XX is an invalid path \n    + 4. Expected result: \n    + <1> profileModel->ringTone() == QString() \n    + <2> profileModel->ringTone() == path \n    + */ +void TestCpProfileModel::testSetRingToneAllWithInvalidPath() +{ + QString inValidPath = "Z:/InvalidSoundPath"; + CpProfileModel *profileModel = new CpProfileModel(); + // using empty path. + profileModel->setRingTone( QString() ); + QVERIFY( profileModel->ringTone() == QString() ); + // using an invalid path. + profileModel->setRingTone( QString( inValidPath ) ); + QString retStr = profileModel->ringTone(); + QVERIFY( profileModel->ringTone() == inValidPath ); + + delete profileModel; +} +/*! + Test Case Description:\n + 1. Fucntion Name: int void setMasterVolume(int volume);\n + 2. Case Descrition: Verify that the valid volume can be set correctly \n + 3. Input Parameters: \n    + <1> volume = int X, X = {1,2,3,4,5,6,7,8,9,10} \n + 4. Expected result: \n    + <1> profileModel->masterVolume() == X. \n + */ +void TestCpProfileModel::testSetMasterWithValidVolume() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + for( int i = EProfileRingingVolumeLevel1; i <= EProfileRingingVolumeLevel10; i++ ) + { + profileModel->setMasterVolume(i); + QVERIFY( profileModel->masterVolume() == i ); + } + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: int void setMasterVolume(int volume);\n + 2. Case Descrition: Verify that no crash when using \n + 3. Input Parameters: \n    + <1> volume = -8 \n    + <2> volume = 230 \n + 4. Expected result: \n    + <1> no crash and the master volume is not changed. \n    + <2> no crash and the master volume is not changed. \n + */ +void TestCpProfileModel::testSetMasterWithInvalidVolume() +{ + CpProfileModel *profileModel = new CpProfileModel(); + int oldVolume = profileModel->masterVolume(); + + profileModel->setMasterVolume( -8 ); + QVERIFY( profileModel->masterVolume() == oldVolume ); + + profileModel->setMasterVolume( 230 ); + QVERIFY( profileModel->masterVolume() == oldVolume ); + + delete profileModel; +} +/*! + Test Case Description:\n + 1. Fucntion Name: int masterVolume() const;\n + 2. Case Descrition: Verify that it returns the right master volume for device. \n + 3. Input Parameters: \n    + <1> setMasterVolume( EProfileRingingVolumeLevel3 ) \n + 4. Expected result: \n    + <1> returnMasterVolume == EProfileRingingVolumeLevel3 \n + */ +void TestCpProfileModel::testMasterVolume() +{ + CpProfileModel *profileModel = new CpProfileModel(); + profileModel->setMasterVolume( EProfileRingingVolumeLevel3 ); + + int returnMasterVolume = profileModel->masterVolume(); + QVERIFY( returnMasterVolume == EProfileRingingVolumeLevel3 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + void setMasterVibra(bool isVibra);\n + 2. Case Descrition: Verify that the master vibra's status can be set successfully. \n + 3. Input Parameters: \n    + <1> isVibra = true; \n    + <2> isVibra = false; \n + 4. Expected result: \n    + <1> profileModel->masterVibra() == true. \n    + <1> profileModel->masterVibra() == false. \n + */ +void TestCpProfileModel::testSetMasterVibra() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setMasterVibra(true); + QVERIFY( profileModel->masterVibra() == true ); + + profileModel->setMasterVibra(false); + QVERIFY( profileModel->masterVibra() == false ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + bool masterVibra() const;\n + 2. Case Descrition: Verify that it returns the correct master vibra's status. \n + 3. Input Parameters: \n    + <1> isVibra = true; \n    + <2> isVibra = false; \n + 4. Expected result: \n    + <1> profileModel->masterVibra() == true. \n    + <1> profileModel->masterVibra() == false. \n + */ +void TestCpProfileModel::testMasterVibra() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setMasterVibra(true); + QVERIFY( profileModel->masterVibra() == true ); + + profileModel->setMasterVibra(false); + QVERIFY( profileModel->masterVibra() == false ); + + delete profileModel; +} +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + void setSilenceMode(bool isSlience);\n + 2. Case Descrition: Verify the right slicence mode can be set. \n + 3. Input Parameters: \n    + <1> isSlience = true; \n    + <2> isSlience = false; \n + 4. Expected result: \n    + <1> profileModel->silenceMode() == true. \n    + <1> profileModel->silenceMode() == false. \n + */ +void TestCpProfileModel::testSetSilenceMode() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setSilenceMode(true); + QVERIFY( profileModel->silenceMode() == true ); + + profileModel->setSilenceMode(false); + QVERIFY( profileModel->silenceMode() == false ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + bool silenceMode() const;\n    + void setSilenceMode(bool isSlience);\n + 2. Case Descrition: Verify it get the correct silence mode of device. \n + 3. Input Parameters: \n    + <1> isSlience = true; \n    + <2> isSlience = false; \n + 4. Expected result: \n    + <1> profileModel->silenceMode() == true. \n    + <1> profileModel->silenceMode() == false. \n + */ +void TestCpProfileModel::testSilenceMode() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setSilenceMode(true); + QVERIFY( profileModel->silenceMode() == true ); + + profileModel->setSilenceMode(false); + QVERIFY( profileModel->silenceMode() == false ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString ringTone(int profileId)const; \n + 2. Case Descrition: Verify that it can return the right ringtone when using valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, set ringtone with ringTonePath1 \n    + <2> profileId = EProfileWrapperMeetingId, set ringtone with ringTonePath2 \n + 4. Expected result: \n   + <1> profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath1 \n    + <2> profileModel->ringTone(EProfileWrapperMeetingId) == ringTonePath2 \n + */ +void TestCpProfileModel::testRingToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setRingTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath1 ); + + profileModel->setRingTone( EProfileWrapperMeetingId, ringTonePath2 ); + QVERIFY( profileModel->ringTone(EProfileWrapperMeetingId) == ringTonePath2 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString ringTone(int profileId)const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 100,\n    + 4. Expected result: \n   + <1> no crash and return QString() \n    + <2> no crash and return QString() \n    + <3> no crash and return QString() \n    + <4> no crash and return QString() \n + */ +void TestCpProfileModel::testRingToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + // set ring tone for all profile + profileModel->setRingTone(ringTonePath1); + + QVERIFY( profileModel->ringTone( EProfileWapperStart ) == QString() ); + QVERIFY( profileModel->ringTone( EPRofileWrapperEnd ) == QString() ); + QVERIFY( profileModel->ringTone( -9 ) == QString() ); + QVERIFY( profileModel->ringTone( 100 ) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setRingTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it can set the profile ringtone successfully with valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, filePath = QString(ringTonePath) \n    + <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n + 4. Expected result: \n   + <1> profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath \n    + <2> profileModel->ringTone(EProfileWrapperMeetingId) == QString() \n + */ +void TestCpProfileModel::testSetRingToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setRingTone(EProfileWrapperGeneralId, ringTonePath2); + QVERIFY( profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath2 ); + + profileModel->setRingTone(EProfileWrapperMeetingId, QString()); + QVERIFY( profileModel->ringTone(EProfileWrapperMeetingId) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setRingTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -19,\n    + <4> profileId = 101,\n + 4. Expected result: \n   + <1> no crash \n    + <2> no crash \n    + <3> no crash \n    + <4> no crash \n + */ +void TestCpProfileModel::testSetRingToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setRingTone(EProfileWapperStart, ringTonePath2); + + profileModel->setRingTone(EPRofileWrapperEnd, ringTonePath2); + + profileModel->setRingTone(-19, ringTonePath2); + + profileModel->setRingTone(101, ringTonePath2); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString messageTone(int profileId) const; \n + 2. Case Descrition: Verify that it can return the right message tone when using valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n    + <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n + 4. Expected result: \n   + <1> profileModel->messageTone(EProfileWrapperGeneralId) == soundPath1 \n    + <2> profileModel->messageTone(EProfileWrapperMeetingId) == soundPath2 \n + */ +void TestCpProfileModel::testMessageToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setMessageTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath1 ); + + profileModel->setMessageTone( EProfileWrapperMeetingId, ringTonePath2 ); + QVERIFY( profileModel->messageTone(EProfileWrapperMeetingId) == ringTonePath2 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString messageTone(int profileId) const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 59,\n + 4. Expected result: \n   + <1> no crash and return QString() \n    + <2> no crash and return QString() \n    + <3> no crash and return QString() \n    + <4> no crash and return QString() \n + */ +void TestCpProfileModel::testMessageToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QVERIFY( profileModel->messageTone( EProfileWapperStart ) == QString() ); + QVERIFY( profileModel->messageTone( EPRofileWrapperEnd ) == QString() ); + QVERIFY( profileModel->messageTone( -9 ) == QString() ); + QVERIFY( profileModel->messageTone( 59 ) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setMessageTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it can set the message tone successfully with valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n    + <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n + 4. Expected result: \n  \n    + <1> profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath \n    + <2> profileModel->messageTone(EProfileWrapperMeetingId) == QString() \n + */ +void TestCpProfileModel::testSetMessageToneWithValidID() +{ + QString soundPath2 = QString("C:/unavailable path"); + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setMessageTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath1 ); + // set an unavailable path. + profileModel->setMessageTone( EProfileWrapperGeneralId, soundPath2 ); + QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == soundPath2 ); + + profileModel->setMessageTone( EProfileWrapperMeetingId, QString() ); + QVERIFY( profileModel->messageTone(EProfileWrapperMeetingId) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setMessageTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -100,\n    + <4> profileId = 100,\n + 4. Expected result: \n  \n    + <1> no crash \n    + <2> no crash \n    + <3> no crash \n    + <4> no crash \n + */ +void TestCpProfileModel::testSetMessageToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setMessageTone( EProfileWapperStart, ringTonePath1 ); +// QVERIFY( profileModel->messageTone(EProfileWapperStart) == QString() ); + + profileModel->setMessageTone( EPRofileWrapperEnd, QString() ); +// QVERIFY( profileModel->messageTone(EPRofileWrapperEnd) == QString() ); + + profileModel->setMessageTone( -100, ringTonePath1 ); +// QVERIFY( profileModel->messageTone(-100) == QString() ); + + profileModel->setMessageTone( 100, QString() ); +// QVERIFY( profileModel->messageTone(100) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString emailTone(int profileId) const; \n + 2. Case Descrition: Verify that it can return the right email tone when using valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n    + <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n + 4. Expected result: \n   + <1> profileModel->emailTone(EProfileWrapperGeneralId) == soundPath1 \n    + <2> profileModel->emailTone(EProfileWrapperMeetingId) == soundPath2 \n + */ +void TestCpProfileModel::testEmailToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setEmailTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == ringTonePath1 ); + + profileModel->setEmailTone( EProfileWrapperMeetingId, ringTonePath2 ); + QVERIFY( profileModel->emailTone(EProfileWrapperMeetingId) == ringTonePath2 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString emailTone(int profileId) const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 59,\n + 4. Expected result: \n   + <1> no crash and return QString() \n    + <2> no crash and return QString() \n    + <3> no crash and return QString() \n    + <4> no crash and return QString() \n + */ +void TestCpProfileModel::testEmailToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QVERIFY( profileModel->emailTone( EProfileWapperStart ) == QString() ); + QVERIFY( profileModel->emailTone( EPRofileWrapperEnd ) == QString() ); + QVERIFY( profileModel->emailTone( -9 ) == QString() ); + QVERIFY( profileModel->emailTone( 59 ) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setEmailTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it can set the email tone successfully with valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n    + <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n + 4. Expected result: \n  \n    + <1> profileModel->emailTone(EProfileWrapperGeneralId) == soundPath \n    + <2> profileModel->emailTone(EProfileWrapperMeetingId) == QString() \n + */ +void TestCpProfileModel::testSetEmailToneWithValidID() +{ + QString soundPath2 = QString("C:/unavailable path"); + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setEmailTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == ringTonePath1 ); + // set an unavailable path. + profileModel->setEmailTone( EProfileWrapperGeneralId, soundPath2 ); + QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == soundPath2 ); + + profileModel->setEmailTone( EProfileWrapperMeetingId, QString() ); + QVERIFY( profileModel->emailTone(EProfileWrapperMeetingId) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setEmailTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -100,\n    + <4> profileId = 100,\n + 4. Expected result: \n  \n    + <1> no crash \n    + <2> no crash \n    + <3> no crash \n    + <4> no crash \n + */ +void TestCpProfileModel::testSetEmailToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setEmailTone( EProfileWapperStart, ringTonePath1 ); +// QVERIFY( profileModel->emailTone(EProfileWapperStart) == QString() ); + + profileModel->setEmailTone( EPRofileWrapperEnd, QString() ); +// QVERIFY( profileModel->emailTone(EPRofileWrapperEnd) == QString() ); + + profileModel->setEmailTone( -100, ringTonePath1 ); +// QVERIFY( profileModel->emailTone(-100) == QString() ); + + profileModel->setEmailTone( 100, QString() ); +// QVERIFY( profileModel->emailTone(100) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString reminderTone(int profileId) const; \n + 2. Case Descrition: Verify that it can return the right reminder tone when using valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n    + <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n + 4. Expected result: \n   + <1> profileModel->reminderTone(EProfileWrapperGeneralId) == soundPath1 \n    + <2> profileModel->reminderTone(EProfileWrapperMeetingId) == soundPath2 \n + */ +void TestCpProfileModel::testReminderToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath1 ); + + profileModel->setReminderTone( EProfileWrapperMeetingId, ringTonePath2 ); + QVERIFY( profileModel->reminderTone(EProfileWrapperMeetingId) == ringTonePath2 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString reminderTone(int profileId) const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 59,\n + 4. Expected result: \n   + <1> no crash and return QString() \n    + <2> no crash and return QString() \n    + <3> no crash and return QString() \n    + <4> no crash and return QString() \n + */ +void TestCpProfileModel::testReminderToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QVERIFY( profileModel->reminderTone( EProfileWapperStart ) == QString() ); + QVERIFY( profileModel->reminderTone( EPRofileWrapperEnd ) == QString() ); + QVERIFY( profileModel->reminderTone( -9 ) == QString() ); + QVERIFY( profileModel->reminderTone( 59 ) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setReminderTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it can set the reminder tone successfully with valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n    + <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n + 4. Expected result: \n  \n    + <1> profileModel->reminderTone(EProfileWrapperGeneralId) == soundPath \n    + <2> profileModel->reminderTone(EProfileWrapperMeetingId) == QString() \n + */ +void TestCpProfileModel::testSetReminderToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath1 ); + QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath1 ); + // set an unavailable path. + profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath2 ); + QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath2 ); + + profileModel->setReminderTone( EProfileWrapperMeetingId, QString() ); + QVERIFY( profileModel->reminderTone(EProfileWrapperMeetingId) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setReminderTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -100,\n    + <4> profileId = 100,\n + 4. Expected result: \n   + <1> no crash \n    + <2> no crash \n    + <3> no crash \n    + <4> no crash \n + */ +void TestCpProfileModel::testSetReminderToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setReminderTone( EProfileWapperStart, ringTonePath1 ); +// QVERIFY( profileModel->reminderTone(EProfileWapperStart) == QString() ); + + profileModel->setReminderTone( EPRofileWrapperEnd, QString() ); +// QVERIFY( profileModel->reminderTone(EPRofileWrapperEnd) == QString() ); + + profileModel->setReminderTone( -100, ringTonePath1 ); +// QVERIFY( profileModel->reminderTone(-100) == QString() ); + + profileModel->setReminderTone( 100, QString() ); +// QVERIFY( profileModel->reminderTone(100) == QString() ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString notificationTone(int profileId) const; \n + 2. Case Descrition: Verify that it can return the right notification tone when using valid profile ID. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWrapperGeneralId, isActive = true \n    + <2> profileId = EProfileWrapperMeetingId, isActive = false \n + 4. Expected result: \n    + <1> profileModel->notificationTone(EProfileWrapperGeneralId) == true \n    + <2> profileModel->notificationTone(EProfileWrapperMeetingId) == false \n + */ +void TestCpProfileModel::testNotificationToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setNotificationTone( EProfileWrapperGeneralId, true ); + QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == true ); + + profileModel->setNotificationTone( EProfileWrapperMeetingId, false ); + QVERIFY( profileModel->notificationTone(EProfileWrapperMeetingId) == false ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: QString notificationTone(int profileId) const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 59,\n + 4. Expected result: \n   + <1> no crash and return QString() \n    + <2> no crash and return QString() \n    + <3> no crash and return QString() \n    + <4> no crash and return QString() \n + */ +void TestCpProfileModel::testNotificationToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QVERIFY( profileModel->notificationTone( EProfileWapperStart ) == false ); + QVERIFY( profileModel->notificationTone( EPRofileWrapperEnd ) == false ); + QVERIFY( profileModel->notificationTone( -9 ) == false ); + QVERIFY( profileModel->notificationTone( 59 ) == false ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: void setNotificationTone(int profileId, const QString& filePath); \n + 2. Case Descrition: Verify that it can set the notification tone successfully with valid profile ID. \n + 3. Input Parameters: \n   + <1> profileId = EProfileWrapperGeneralId, isActive = true \n    + <2> profileId = EProfileWrapperMeetingId, isActive = false \n + 4. Expected result: \n  \n    + <1> profileModel->notificationTone(EProfileWrapperGeneralId) == true \n    + <2> profileModel->notificationTone(EProfileWrapperMeetingId) == false \n + */ +void TestCpProfileModel::testSetNotificationTone() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setNotificationTone( EProfileWrapperGeneralId, true ); + QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == true ); + + profileModel->setNotificationTone( EProfileWrapperGeneralId, false ); + QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == false ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + void setKeyTouchScreenTone(int profileId, int level);\n + 2. Case Descrition: Verify that the tone of the valid profile can be set with valid level value. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWrapperGeneralId, level = int X (X = 0,1,2,3,4,5); \n    + <2> profileId = EProfileWrapperMeetingId, level = int X; \n + 4. Expected result: \n    + <1> profileModel->keyTouchScreenTone(EProfileWrapperGeneralId) == X. \n    + <2> profileModel->keyTouchScreenTone(EProfileWrapperMeetingId) == X. \n + */ +void TestCpProfileModel::testSetKeyTouchScreenToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + int i = 0; + for ( ; i <= 5; i++ ) { + profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, i ); + QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ) == i ); + + profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, i ); + QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ) == i ); + } + + profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, 12 ); + int b = profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ); + + profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, -12 ); + int c = profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + void setKeyTouchScreenTone(int profileId, int level);\n + 2. Case Descrition: Verify that it does not crash with invalid level value. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWapperStart, level = int X \n    + <2> profileId = EPRofileWrapperEnd, level = int X \n    + <3> profileId = -8, level = int X \n    + <4> profileId = 99, level = int X \n + 4. Expected result: \n    + <1> no crash \n    + <2> no crash \n    + <3> no crash \n    + <4> no crash \n + */ +void TestCpProfileModel::testSetKeyTouchScreenToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setKeyTouchScreenTone( EProfileWapperStart, 4 ); + + profileModel->setKeyTouchScreenTone( EPRofileWrapperEnd, 2 ); + + profileModel->setKeyTouchScreenTone( -8, 4 ); + + profileModel->setKeyTouchScreenTone( 99, 3 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + int keyTouchScreenTone(int profileId) const; \n + 2. Case Descrition: Verify that the tone can be get with valid profile ID. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWrapperGeneralId \n    + <2> profileId = EProfileWrapperMeetingId \n + 4. Expected result: \n    + <1> return the right tone level. \n    + <2> return the right tone level. \n + */ +void TestCpProfileModel::testKeyTouchScreenToneWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, 4 ); + QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ) == 4); + + profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, 5 ); + QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ) == 5); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + int keyTouchScreenTone(int profileId) const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 100,\n + 4. Expected result: \n    + <1> no crash and return 0 \n    + <2> no crash and return 0 \n    + <3> no crash and return 0 \n    + <4> no crash and return 0 \n + */ +void TestCpProfileModel::testKeyTouchScreenToneWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QVERIFY( profileModel->keyTouchScreenTone( EProfileWapperStart ) == 0); + QVERIFY( profileModel->keyTouchScreenTone( EPRofileWrapperEnd ) == 0); + QVERIFY( profileModel->keyTouchScreenTone( -9 ) == 0); + QVERIFY( profileModel->keyTouchScreenTone( 100 ) == 0); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + void setKeyTouchScreenVibra(int profileId, int level);\n + 2. Case Descrition: Verify that the vibra mode of the valid profile can be set with valid level value. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWrapperGeneralId, level = int X (X = 0,1,2,3,4,5); \n    + <2> profileId = EProfileWrapperMeetingId, level = int X; \n + 4. Expected result: \n    + <1> profileModel->keyTouchScreenVibra(EProfileWrapperGeneralId) == X. \n    + <2> profileModel->keyTouchScreenVibra(EProfileWrapperMeetingId) == X. \n + */ +void TestCpProfileModel::testSetKeyTouchScreenVibraWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + int i = 0; + for ( ; i <= 5; i++ ) { + profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, i ); + QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ) == i ); + + profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, i ); + QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ) == i ); + } + + profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, 12 ); + int b = profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ); + + profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, -12 ); + int c = profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + void setKeyTouchScreenVibra(int profileId, int level);\n + 2. Case Descrition: Verify that it does not crash with the invalid level value. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWapperStart, level = int X \n    + <2> profileId = EPRofileWrapperEnd, level = int X \n    + <3> profileId = -8, level = int X \n    + <4> profileId = 99, level = int X \n + 4. Expected result: \n    + <1> no crash \n    + <2> no crash \n    + <3> no crash \n    + <4> no crash \n + */ +void TestCpProfileModel::testSetKeyTouchScreenVibraWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setKeyTouchScreenVibra( EProfileWapperStart, 4 ); + + profileModel->setKeyTouchScreenVibra( EPRofileWrapperEnd, 2 ); + + profileModel->setKeyTouchScreenVibra( -8, 4 ); + + profileModel->setKeyTouchScreenVibra( 99, 3 ); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + int keyTouchScreenVibra(int profileId) const; \n + 2. Case Descrition: Verify that the vibra value can be get with valid profile ID. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWrapperGeneralId \n    + <2> profileId = EProfileWrapperMeetingId \n + 4. Expected result: \n    + <1> return the right key touch screen vibra's value. \n    + <2> return the right key touch screen vibra's value. \n + */ +void TestCpProfileModel::testKeyTouchScreenVibraWithValidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, 4 ); + QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ) == 4); + + profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, 5 ); + QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ) == 5); + + delete profileModel; +} + +/*! + Test Case Description:\n + 1. Fucntion Name: \n    + int keyTouchScreenVibra(int profileId) const; \n + 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n + 3. Input Parameters: \n    + <1> profileId = EProfileWapperStart,\n    + <2> profileId = EPRofileWrapperEnd,\n    + <3> profileId = -9,\n    + <4> profileId = 100,\n + 4. Expected result: \n    + <1> no crash and return 0 \n    + <2> no crash and return 0 \n    + <3> no crash and return 0 \n    + <4> no crash and return 0 \n + */ +void TestCpProfileModel::testKeyTouchScreenVibraWithInvalidID() +{ + CpProfileModel *profileModel = new CpProfileModel(); + + QVERIFY( profileModel->keyTouchScreenVibra( EProfileWapperStart ) == 0); + QVERIFY( profileModel->keyTouchScreenVibra( EPRofileWrapperEnd ) == 0); + QVERIFY( profileModel->keyTouchScreenVibra( -9 ) == 0); + QVERIFY( profileModel->keyTouchScreenVibra( 100 ) == 0); + + delete profileModel; +} + +/*! + Descrition of what you will do in this function + */ +void TestCpProfileModel::cleanupTestCase() +{ + // release all test data + QCoreApplication::processEvents(); +} + +QTEST_MAIN(TestCpProfileModel) diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/src/ut_cpprofilemodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* test the functions in cppluginconfigreader class +*/ + +#ifndef UT_CPPROFILEMODEL_H_ +#define UT_CPPROFILEMODEL_H_ + +class CpPluginConfig; +#include + +class TestCpProfileModel :public QObject +{ + Q_OBJECT +private slots: + // init function + void initTestCase(); + + void testConstructor(); // test the constructor. + + void testProfileNameWithValidProfileID(); // test the profileName() function with valid profile ID. + void testProfileNameWithInvalidProfileID(); // test the profileName() function with invalid profile ID. + void testProfileNames(); // test the profileNames() function. + + void testActivateProfileWithInvalidID(); //test the activateProfile() function with invalid profile ID. + void testActivateProfileWithValidID(); // test the activateProfile() function with valid profile ID. + void testActiveProfileId(); // test the activeProfileId() function. + + void testProfileSettings(); // test the profileSettings() function. + void testSetProfileSettings(); // test the setProfileSettings() function. + + void testRingToneOfActive(); // test the ringTone() function. + void testSetRingToneAllWithValidPath(); // test the setRingTone() function with valid sound path. + void testSetRingToneAllWithInvalidPath(); // test the setRingTone() function with invalid sound path. + + void testSetMasterWithValidVolume(); // test the setMasterVolume() function with valid volume value. + void testSetMasterWithInvalidVolume(); // test the setMasterVolume() function with invalid volume value. + void testMasterVolume(); // test the masterVolume() function. + + void testSetMasterVibra(); // test the setMasterVibra() functions. + void testMasterVibra(); // test the masterVibra() functions. + + void testSetSilenceMode(); // test the setSilenceMode() functions. + void testSilenceMode(); // test the silenceMode() functions. + + void testRingToneWithValidID(); // test the ringTone(int profileId) function with valid profile ID. + void testRingToneWithInvalidID(); // test the ringTone(int profileId) function with invalid profile ID. + void testSetRingToneWithValidID(); // test the setRingTone(int profileId, const QString& filePath) function with valid profile ID. + void testSetRingToneWithInvalidID(); // test the setRingTone(int profileId, const QString& filePath) function with invalid profile ID. + + void testMessageToneWithValidID(); // test MessageTone() function with valid profile ID. + void testMessageToneWithInvalidID(); // test MessageTone() function with valid profile ID. + void testSetMessageToneWithValidID(); // test the setMessageTone() function with valid profile ID. + void testSetMessageToneWithInvalidID(); // test the setMessageTone() function with invalid profile ID. + + void testEmailToneWithValidID(); // test emailTone() function with valid profile ID. + void testEmailToneWithInvalidID(); // test emailTone() function with valid profile ID. + void testSetEmailToneWithValidID(); // test the setEmailTone() function with valid profile ID. + void testSetEmailToneWithInvalidID(); // test the setEmailTone() function with invalid profile ID. + + void testReminderToneWithValidID(); // test reminderTone() function with valid profile ID. + void testReminderToneWithInvalidID(); // test reminderTone() function with valid profile ID. + void testSetReminderToneWithValidID(); // test the setReminderTone() function with valid profile ID. + void testSetReminderToneWithInvalidID(); // test the setReminderTone() function with invalid profile ID. + + void testNotificationToneWithValidID(); // test notificationTone() function with valid profile ID. + void testNotificationToneWithInvalidID(); // test notificationTone() function with valid profile ID. + void testSetNotificationTone(); // test the setNotificationTone() function with valid profile ID. + + void testSetKeyTouchScreenToneWithValidID(); // test the setKeyTouchScreenTone()function with valid profile ID. + void testSetKeyTouchScreenToneWithInvalidID(); // test the setKeyTouchScreenTone()function with invalid profile ID. + void testKeyTouchScreenToneWithValidID(); // test the keyTouchScreenTone()function with valid profile ID. + void testKeyTouchScreenToneWithInvalidID(); // test the keyTouchScreenTone()function with invalid profile ID. + + void testSetKeyTouchScreenVibraWithValidID(); // test the setKeyTouchScreenVibra()function with valid profile ID. + void testSetKeyTouchScreenVibraWithInvalidID(); // test the setKeyTouchScreenVibra()function with invalid profile ID. + void testKeyTouchScreenVibraWithValidID(); // test the keyTouchScreenVibra()function with valid profile ID. + void testKeyTouchScreenVibraWithInvalidID(); // test the keyTouchScreenVibra()function with invalid profile ID. + + void cleanupTestCase(); +private: + QString ringTonePath1; + QString ringTonePath2; +}; +#endif /* UT_CPPROFILEMODEL_H_ */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/ut_cpprofilemodel.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/ut_cpprofilemodel.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,50 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = ut_cpprofilemodel + +QT += testlib +CONFIG += hb qtestlib +CONFIG += symbian_test + +include (../unit_common.pri) + +HEADERS += src/*.h +SOURCES += src/*.cpp + +QMAKE_EXTRA_TARGETS += test autotest + +DEPENDPATH += . + +INCLUDEPATH += . ../../src\ + ../../../inc + +LIBS += -lcpframework +LIBS += -lcpprofilewrapper \ + -lprofileeng \ + -lcentralrepository \ + -lcharconv +symbian { + deploy.path = C: + soundfiles.sources += data/testsound.aac \ + data/testsound2.aac + soundfiles.path = /resource/cptestdata/sounds + DEPLOYMENT += soundfiles + + # This is for new exporting system coming in garden + for(soundfile, soundfiles.sources):BLD_INF_RULES.prj_exports += "./$$soundfile $$deploy.path$$soundfiles.path/$$basename(soundfile)" +} \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/bwins/cpringtoneviewu.def Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +EXPORTS + ?tr@CpRingToneView@@SA?AVQString@@PBD0@Z @ 1 NONAME ; class QString CpRingToneView::tr(char const *, char const *) + ?selOK@CpRingToneView@@IAEXABVQString@@@Z @ 2 NONAME ; void CpRingToneView::selOK(class QString const &) + ??1CpRingToneView@@UAE@XZ @ 3 NONAME ; CpRingToneView::~CpRingToneView(void) + ?getStaticMetaObject@CpRingToneView@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & CpRingToneView::getStaticMetaObject(void) + ?handleError@CpRingToneView@@AAEXHABVQString@@@Z @ 5 NONAME ; void CpRingToneView::handleError(int, class QString const &) + ?launchMediaFetcher@CpRingToneView@@AAEXABVQString@@0@Z @ 6 NONAME ; void CpRingToneView::launchMediaFetcher(class QString const &, class QString const &) + ?selError@CpRingToneView@@IAEXHABVQString@@@Z @ 7 NONAME ; void CpRingToneView::selError(int, class QString const &) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 8 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *, int) + ?qt_metacall@CpRingToneView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int CpRingToneView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?staticMetaObject@CpRingToneView@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const CpRingToneView::staticMetaObject + ?metaObject@CpRingToneView@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * CpRingToneView::metaObject(void) const + ?tr@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString CpRingToneView::tr(char const *, char const *, int) + ??0CpRingToneView@@QAE@PAVQGraphicsItem@@@Z @ 13 NONAME ; CpRingToneView::CpRingToneView(class QGraphicsItem *) + ?itemActivated@CpRingToneView@@AAEXABVQModelIndex@@@Z @ 14 NONAME ; void CpRingToneView::itemActivated(class QModelIndex const &) + ??_ECpRingToneView@@UAE@I@Z @ 15 NONAME ; CpRingToneView::~CpRingToneView(unsigned int) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *) + ?handleOk@CpRingToneView@@AAEXABVQVariant@@@Z @ 17 NONAME ; void CpRingToneView::handleOk(class QVariant const &) + ?qt_metacast@CpRingToneView@@UAEPAXPBD@Z @ 18 NONAME ; void * CpRingToneView::qt_metacast(char const *) + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpringtoneview/cpringtoneview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/cpringtoneview.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,28 @@ +# +# 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: display plugin source files +# +include (../common.pri) +include (ringtoneview.pri) +TARGET = cpringtoneview +TEMPLATE = lib + +CONFIG += hb +DEFINES += CPRINGTONEVIEW_LIBRARY +symbian { + LIBS += -lcpprofilewrapper -lcplogger -lcpframework -lxqservice -lxqserviceutil + TARGET.UID3 = 0X2002873A + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/eabi/cpringtoneviewu.def Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,24 @@ +EXPORTS + _ZN14CpRingToneView11handleErrorEiRK7QString @ 1 NONAME + _ZN14CpRingToneView11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN14CpRingToneView11qt_metacastEPKc @ 3 NONAME + _ZN14CpRingToneView13itemActivatedERK11QModelIndex @ 4 NONAME + _ZN14CpRingToneView16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN14CpRingToneView18launchMediaFetcherERK7QStringS2_ @ 6 NONAME + _ZN14CpRingToneView19getStaticMetaObjectEv @ 7 NONAME + _ZN14CpRingToneView5selOKERK7QString @ 8 NONAME + _ZN14CpRingToneView8handleOkERK8QVariant @ 9 NONAME + _ZN14CpRingToneView8selErrorEiRK7QString @ 10 NONAME + _ZN14CpRingToneViewC1EP13QGraphicsItem @ 11 NONAME + _ZN14CpRingToneViewC2EP13QGraphicsItem @ 12 NONAME + _ZN14CpRingToneViewD0Ev @ 13 NONAME + _ZN14CpRingToneViewD1Ev @ 14 NONAME + _ZN14CpRingToneViewD2Ev @ 15 NONAME + _ZNK14CpRingToneView10metaObjectEv @ 16 NONAME + _ZTI14CpRingToneView @ 17 NONAME + _ZTV14CpRingToneView @ 18 NONAME + _ZThn16_N14CpRingToneViewD0Ev @ 19 NONAME + _ZThn16_N14CpRingToneViewD1Ev @ 20 NONAME + _ZThn8_N14CpRingToneViewD0Ev @ 21 NONAME + _ZThn8_N14CpRingToneViewD1Ev @ 22 NONAME + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpringtoneview/ringtoneview.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/ringtoneview.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,20 @@ +# +# 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: display plugin source files +# + +# Input +HEADERS += ../inc/cpringtoneview.h + +SOURCES += src/cpringtoneview.cpp diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpringtoneview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CpRingToneView::CpRingToneView( QGraphicsItem *parent ): + CpBaseSettingView(0, parent), + mToneTypeList( new HbListWidget(this) ), + mReq(0), mProcessing(false) +{ + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); + + HbDataForm *form = qobject_cast ( widget() ); + form->setHeading(hbTrId("txt_cp_subhead_select_tone_type")); + + HbDataFormModel *model = new HbDataFormModel(); + QList< QPair > tonesTypeList; + tonesTypeList << qMakePair( QString("qtg_large_tone_off"), hbTrId("txt_cp_list_no_tone") ) + << qMakePair( QString("qtg_large_tone"), hbTrId("txt_cp_list_tone") ) + << qMakePair( QString("qtg_large_music"), hbTrId("txt_cp_list_music") ) + << qMakePair( QString("qtg_large_ovistore"), hbTrId("txt_cp_list_get_more_tones") ); + + for (int i = 0; i < tonesTypeList.count(); ++i) { + HbDataFormModelItem *itemData = new HbDataFormModelItem(); + itemData->setType ( static_cast (CpSettingFormEntryItemData::ListEntryItem) ); + itemData->setLabel(tonesTypeList.at(i).second); + itemData->setIcon(tonesTypeList.at(i).first); + model->appendDataFormItem(itemData, model->invisibleRootItem()); + } + connect(form, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); + form->setModel(model); +} +CpRingToneView::~CpRingToneView() +{ + if (mReq) { + delete mReq; + } +} + +void CpRingToneView::itemActivated( const QModelIndex &index ) +{ + //avoid responding to the second or later consecutive click + if (mProcessing) { + return; + } + mProcessing = true; + int nRow = index.row(); + + switch(nRow) { + case 0: //no tone, set default no sound + emit selOK(QString("")); + emit aboutToClose(); + break; + case 1: //tone + launchMediaFetcher( "com.nokia.symbian.IToneFetch", "fetch()" ); + break; + case 2: //music + launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()" ); + break; + case 3: //get more tones + default: + break; + } +} +void CpRingToneView::handleOk(const QVariant &result) +{ + mProcessing = false; + CPFW_LOG( "CpRingToneView::handleOk" ); + if (!result.canConvert() || result.toString().length() == 0 ) //error result + { + return; + } + hide(); + emit selOK( result.value() ); + emit aboutToClose(); +} + + +void CpRingToneView::handleError(int errorCode, const QString& errorMessage) +{ + mProcessing = false; + emit(selError( errorCode, errorMessage )); +} + +void CpRingToneView::launchMediaFetcher( const QString &strService, const QString &strItface ) +{ + CPFW_LOG("CpRingToneView::launchMediaFetcher, START"); + if(mReq) + { + delete mReq; + mReq = 0; + } + //launch media fetcher + mReq = mAppMgr.create(strService, strItface, true); + mReq->setSynchronous(false); + if (!mReq) + { + CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher start failed"); + return; + } + else + { //use QueuedConnection so that requestError will not be emitted when selecting one tone + connect(mReq, SIGNAL(requestOk(QVariant)), SLOT( handleOk(QVariant)), Qt::QueuedConnection); + connect(mReq, SIGNAL(requestError(int, QString)), SLOT(handleError(int, QString))); + } + + QList args; + args << QVariant(QString("")); + mReq->setArguments(args); + // Make the request + if (!mReq->send()) + { + CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher calling failed"); + } + CPFW_LOG("CpRingToneView::launchMediaFetcher, END"); +} + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/cpserviceprovider.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpserviceprovider project - included files +# + +HEADERS += src/cpservicemainwindow.h \ + src/cplauncherservice.h + +SOURCES += src/cpservicemainwindow.cpp \ + src/cplauncherservice.cpp \ + src/main.cpp \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/cpserviceprovider.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpserviceprovider project - qmake settings +# + +TEMPLATE = app +TARGET = cpserviceprovider + +CONFIG += hb service +symbian:TARGET.UID3 = 0x2002873F + +include( ../common.pri ) +include( cpserviceprovider.pri ) + +# DEFINES += ENABLE_CPSP_LOG +RESOURCES += cpserviceprovider.qrc + +LIBS += -lxqservice -lxqserviceutil -lcplogger -lcpframework + +SERVICE.FILE = service_conf.xml +SERVICE.OPTIONS = embeddable +SERVICE.OPTIONS += hidden diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/cpserviceprovider.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.qrc Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,5 @@ + + + data/cpserviceproviderlog.conf + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/data/cpserviceproviderlog.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/data/cpserviceproviderlog.conf Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,7 @@ +[CpServiceProvider] +logdatetime = 1 +logloggername = 1 +datetimeformat = hh:mm:ss +output = debugoutput fileoutput +fileoutput/logfile = C:/data/logs/cpserviceprovider.log +fileoutput/truncate = 1 diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/service_conf.xml Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,11 @@ + + + cpserviceprovider + ="must-not-be-empty" + ControlPanel service + + com.nokia.symbian.ICpPluginLauncher + 1.0 + Launch a setting view which comes from a controlpanel plugin + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cplauncherservice.h" +#include +#include +#include +#include +#include +#include "cpsplogger.h" + +CpLauncherService::CpLauncherService(HbMainWindow *mainWindow /* = 0*/) +: XQServiceProvider("cpserviceprovider.com.nokia.symbian.ICpPluginLauncher",mainWindow), + mMainWindow(mainWindow), + mAsyncRequestIndex(-1), + mReturnValue(false) +{ + CPSP_LOG_FUNC_ENTRY("CpLauncherService::CpLauncherService") + + publishAll(); + connect(this,SIGNAL(clientDisconnected()),this,SLOT(handleClientDisconnected())); +} + +CpLauncherService::~CpLauncherService() +{ + CPSP_LOG_FUNC_ENTRY("CpLauncherService::~CpLauncherService") +} + +bool CpLauncherService::complete() +{ + CPSP_LOG_FUNC_ENTRY("CpLauncherService::complete") + + CPSP_LOG( QString("CpLauncherService::complete() mAsyncRequestIndex = %1, mReturnValue = %2").arg( + mAsyncRequestIndex).arg(mReturnValue.toBool()) ) + + bool ret = completeRequest(mAsyncRequestIndex, mReturnValue); + mAsyncRequestIndex = -1; + return ret; +} + +void CpLauncherService::setReturnValue(const QVariant &returnValue) +{ + CPSP_LOG_FUNC_ENTRY("CpLauncherService::setReturnValue") + + mReturnValue = returnValue; +} + +bool CpLauncherService::launchSettingView(const QString &pluginFile,const QVariant &hint) +{ + CPSP_LOG_FUNC_ENTRY("CpLauncherService::launchSettingView"); + + mAsyncRequestIndex = setCurrentRequestAsync(); + + bool succeed = false; + + if (mMainWindow) { + mMainWindow->show(); + CpLauncherInterface *plugin = CpPluginLoader::loadCpLauncherInterface(pluginFile); + if (plugin) { + CpBaseSettingView *settingView = plugin->createSettingView(hint); + if (settingView) { + connect(settingView, SIGNAL(returnValueDelivered(QVariant)),this,SLOT(setReturnValue(QVariant))); + (static_cast(mMainWindow))->setSettingView(settingView); + succeed = true; + } + else { + CPSP_LOG("Create setting view failed."); + } + } + else { + CPSP_LOG(QLatin1String("Load plugin interface(CpLauncherInterface) failed: ") + pluginFile); + } + + if (!succeed) { + qApp->quit(); //quit application if loading plugin failed or creating setting view failed. + } + } + + return succeed; +} + +void CpLauncherService::handleClientDisconnected() +{ + CPSP_LOG_FUNC_ENTRY("CpLauncherService::handleClientDisconnected") + + qApp->quit(); +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/src/cplauncherservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPLAUNCHERSERVICE_H +#define CPLAUNCHERSERVICE_H + +#include + +class HbMainWindow; + +class CpLauncherService : public XQServiceProvider +{ + Q_OBJECT +public: + explicit CpLauncherService(HbMainWindow *mainWindow = 0); + virtual ~CpLauncherService(); + bool complete(); +public slots: + bool launchSettingView(const QString &pluginFile,const QVariant &hint); +private slots: + void setReturnValue(const QVariant &returnValue); + void handleClientDisconnected(); +private: + HbMainWindow *mMainWindow; + int mAsyncRequestIndex; + QVariant mReturnValue; +}; + +#endif //CPLAUNCHERSERVICE_H + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpservicemainwindow.h" +#include +#include +#include "cplauncherservice.h" +#include "cpsplogger.h" + +CpServiceMainWindow::CpServiceMainWindow(QWidget *parent /* = 0*/) +: HbMainWindow(parent), mLauncherService(0), mPreviousView(0) +{ + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::CpServiceMainWindow") + + mLauncherService = new CpLauncherService(this); +} + +CpServiceMainWindow::~CpServiceMainWindow() +{ + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::~CpServiceMainWindow") +} + +void CpServiceMainWindow::setSettingView(CpBaseSettingView *settingView) +{ + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::setSettingView") + + mSettingViewPointer = settingView; + + mPreviousView = currentView(); + + connect(settingView, SIGNAL(aboutToClose()), this, SLOT(quit())); + addView(settingView); + setCurrentView(settingView); +} + +void CpServiceMainWindow::quit() +{ + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::quit"); + + closeSettingView(); + + connect(mLauncherService, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + mLauncherService->complete(); + + /* + hide(); + mLauncherService->complete(); + if (mSettingViewPointer) { + removeView(mSettingViewPointer); + mSettingViewPointer->deleteLater(); + } + */ +} + +void CpServiceMainWindow::closeSettingView() +{ + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::closeSettingView") + + if (mSettingViewPointer) { + removeView(mSettingViewPointer); + mSettingViewPointer->deleteLater(); + } + + setCurrentView(mPreviousView); +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h Tue Aug 31 15:15:28 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: +* +*/ + +#ifndef CPSERVICEMAINWINDOW_H +#define CPSERVICEMAINWINDOW_H + +#include +#include + +class CpLauncherService; +class CpBaseSettingView; + +class CpServiceMainWindow : public HbMainWindow +{ + Q_OBJECT +public: + explicit CpServiceMainWindow(QWidget *parent = 0); + virtual ~CpServiceMainWindow(); + + /* + * set the setting view as current view + */ + void setSettingView(CpBaseSettingView *settingView); + + /* + * close current setting view + */ + void closeSettingView(); + +public slots: + void quit(); +private: + CpLauncherService *mLauncherService; + HbView *mPreviousView; + QPointer mSettingViewPointer; +}; + +#endif // CPSERVICEMAINWINDOW_H + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/src/cpsplogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/src/cpsplogger.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPSPLOGGER_H +#define CPSPLOGGER_H + +#include +#include + +#ifdef ENABLE_CPSP_LOG + #define CPSP_LOGGER_NAME QLatin1String("CpServiceProvider") + #define CPSP_LOGGER_CONFIG_PATH QLatin1String(":/logconf/cpserviceproviderlog.conf") + + #define CPSP_LOG(str) Logger::instance(CPSP_LOGGER_NAME)->log(str); + #define CPSP_LOG_FUNC_ENTRY(func) LogFunctionEntryHelper ___cpsp_log_func_entry_helper(CPSP_LOGGER_NAME,func); +#else + #define CPSP_LOG(str) + #define CPSP_LOG_FUNC_ENTRY(func) +#endif + + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/cpserviceprovider/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/src/main.cpp Tue Aug 31 15:15:28 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: main.cpp +* +*/ +#include +#include +#include +#include +#include "cpservicemainwindow.h" +#include "cpsplogger.h" + +int main(int argc, char **argv) +{ + HbApplication app(argc,argv ); + +#ifdef ENABLE_CPSP_LOG + INIT_LOGGER(CPSP_LOGGER_NAME,CPSP_LOGGER_CONFIG_PATH) +#endif + + CPSP_LOG("Entering CpServiceProvider.exe..."); + + HbTranslator translator("control_panel"); + translator.loadCommon(); + + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); + HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); + + CpServiceMainWindow wnd; + /* + DON'T call wnd.show(), + it will cause deadlock problem if cpserviceprovider is launched from an indicator plugin. + */ + + int ret = app.exec(); + + CPSP_LOG("Exiting CpServiceProvider.exe."); + + return ret; +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpcategoryglobal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpcategoryglobal.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CP_CATEGORY_GLOBAL_H +#define CP_CATEGORY_GLOBAL_H + +#include + +#ifdef BUILD_CPCATEGORY_GLOBAL + #define CP_CATEGORY_EXPORT Q_DECL_EXPORT +#else + #define CP_CATEGORY_EXPORT Q_DECL_IMPORT +#endif + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpcategorysettingformitemdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpcategorysettingformitemdata.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An extension to CpSettingFormItemData, can be filled with model items comes from controlpanel plugins. +* +*/ +#ifndef CPCATEGORYSETTINGFORMITEMDATA_H +#define CPCATEGORYSETTINGFORMITEMDATA_H + +#include +#include + +class CpCategorySettingFormItemDataPrivate; +class CP_CATEGORY_EXPORT CpCategorySettingFormItemData : public CpSettingFormItemData +{ + Q_OBJECT +public: + CpCategorySettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const QString &configFile, + const HbDataFormModelItem *parent = 0); + + explicit CpCategorySettingFormItemData(const QString &configFile = QString(), + const HbDataFormModelItem *parent = 0); + + virtual ~CpCategorySettingFormItemData(); + + void initialize(CpItemDataHelper &itemDataHelper); +private: + virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); + virtual void afterLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); +private: + CpCategorySettingFormItemDataPrivate *d; +}; + +#endif + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpcategorysettingformmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpcategorysettingformmodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An extension to HbDataFormModel, can be filled with model items comes from controlpanel plugins. +* +*/ +#ifndef CPCATEGORYSETTINGFORMMODEL_H +#define CPCATEGORYSETTINGFORMMODEL_H + +#include +#include + +class CpItemDataHelper; +class CpCategorySettingFormModelPrivate; + +class CP_CATEGORY_EXPORT CpCategorySettingFormModel : public HbDataFormModel +{ + Q_OBJECT +public: + explicit CpCategorySettingFormModel(const QString &configFile); + virtual ~CpCategorySettingFormModel(); + virtual void initialize(CpItemDataHelper &itemDataHelper); +private: + virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); + virtual void afterLoadingConfigPlugins(CpItemDataHelper &itemDataHelper); +private: + CpCategorySettingFormModelPrivate *d; +}; + +#endif + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpevent.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPEVENT_H +#define CPEVENT_H + +#include +#include +#include + +class CpPluginInterface; +class HbDataFormModelItem; +class CpItemDataHelper; + +class CpCreatePluginItemDataEvent : public QEvent +{ +public: + enum { CreatePluginItemData = QEvent::User + 1 }; + + CpCreatePluginItemDataEvent() : + QEvent ( static_cast(CreatePluginItemData) ), + mPluginInterface(0), + mParentItem(0), + mItemDataHelper(0), + mItemPosition(-1) + { + } + + CpPluginInterface *mPluginInterface; + + HbDataFormModelItem *mParentItem; + int mItemPosition; + + CpItemDataHelper *mItemDataHelper; + + QString mDisplayName; + QString mDescription; + QString mPluginFile; +}; + +CP_CATEGORY_EXPORT int createCpPluginItemData(CpCreatePluginItemDataEvent *event); + +#endif //CPEVENT_H + +//End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpprofilemodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpprofilemodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPPROFILEMODEL_H +#define CPPROFILEMODEL_H + +#include "cpprofilewrappermacro.h" +#include +#include +#include +class CpProfileModelPrivate; + +/*! + Profile id is defined in profile engine + */ +enum ProfileWrapperProfileId +{ + EProfileWapperStart = -1, + EProfileWrapperGeneralId = 0, + EProfileWrapperMeetingId = 2, + EPRofileWrapperEnd +}; +class CpProfileSettings +{ +public: + QString mRingTone; + QString mMessageTone; + QString mEmailTone; + QString mReminderTone; + bool mNotificationTone; + int mKeyTouchScreenTone; // 0-5 + + int mKeyTouchScreenVibra; //0-5 +}; +class PROFILE_WRAPPER_EXPORT CpProfileModel : QObject +{ + Q_OBJECT +public: + CpProfileModel(QObject *parent = 0); + ~CpProfileModel(); + +public: + QString profileName(int profileId)const; + QStringList profileNames()const; + int activateProfile(int profileId); + int activeProfileId() const; + + void profileSettings(int profileId, CpProfileSettings& profileSettings); + void setProfileSettings(int profileId, CpProfileSettings& profileSettings ); + + QString ringTone() const; + void setRingTone(const QString& filePath); + + int masterVolume() const; + void setMasterVolume(int volume); + + + bool masterVibra() const; + void setMasterVibra(bool isVibra); + + bool silenceMode() const; + void setSilenceMode(bool isSlience); + + /*! + * For profile settings + */ + + QString ringTone(int profileId)const; + void setRingTone(int profileId, const QString& filePath); + QString messageTone(int profileId) const; + void setMessageTone(int profileId, const QString& filePath); + QString emailTone(int profileId) const; + void setEmailTone(int profileId, const QString& filePath); + QString reminderTone(int profileId) const; + void setReminderTone(int profileId, const QString& filePath); + + bool notificationTone(int profileId) const; + void setNotificationTone(int profileId, bool isActive); + + int keyTouchScreenTone(int profileId) const; + void setKeyTouchScreenTone(int profileId, int level); + + int keyTouchScreenVibra(int profileId)const; + void setKeyTouchScreenVibra(int profileId, int level); + +private: + CpProfileModelPrivate *const d_ptr; + +private: + Q_DISABLE_COPY(CpProfileModel) + Q_DECLARE_PRIVATE_D(d_ptr,CpProfileModel) +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpprofilemonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpprofilemonitor.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPPROFILEMONITOR_H +#define CPPROFILEMONITOR_H + +#include +#include + +class CpProfileMonitorPrivate; + +class PROFILE_WRAPPER_EXPORT CpProfileMonitor: public QObject +{ + Q_OBJECT +public: + explicit CpProfileMonitor(QObject *parent = 0); + ~CpProfileMonitor(); +signals: + void profileActivated(int activeProfileId); + void activeProfileModified(int activeProfileId); +private: + CpProfileMonitorPrivate *const d_ptr; + +private: + Q_DISABLE_COPY(CpProfileMonitor) + Q_DECLARE_PRIVATE_D(d_ptr,CpProfileMonitor) +}; + +#endif /* CPPROFILEMONITOR_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpprofilewrappermacro.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpprofilewrappermacro.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CP_PROFILEWRAPPER_MACRO_H +#define CP_PROFILEWRAPPER_MACRO_H + +#include + +#ifdef PROFILEWRAPPER_FREEZE + #define PROFILE_WRAPPER_EXPORT Q_DECL_EXPORT +#else + #define PROFILE_WRAPPER_EXPORT Q_DECL_IMPORT +#endif + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpringtoneview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpringtoneview.h Tue Aug 31 15:15:28 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: + * + */ +#ifndef CPRINGTONEVIEW_H +#define CPRINGTONEVIEW_H + +#include "ringtoneviewdef.h" +#include +#include + +class HbListWidget; +class HbListWidgetItem; +class XQAiwRequest; + +class CPRINGTONEVIEW_EXPORT CpRingToneView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpRingToneView( QGraphicsItem *parent = 0 ); + ~CpRingToneView(); +signals: + void selOK( const QString &strFname); + void selError( int errorCode, const QString& errorMessage ); + +private slots: + void itemActivated( const QModelIndex &index ); + void handleOk(const QVariant &result); + void handleError(int errorCode, const QString& errorMessage); + +private: + HbListWidget* mToneTypeList; + XQAiwRequest* mReq; + XQApplicationManager mAppMgr; + //used to mark if there is a request being processed + bool mProcessing; + +private: + void launchMediaFetcher( const QString &strService, const QString &strItface ); +}; + +#endif // CPRINGTONEVIEW_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cptaskexecutor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cptaskexecutor.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef CPTASKEXECUTOR_H +#define CPTASKEXECUTOR_H + +#include +#include +#include +#include + +class CpTask +{ +public: + explicit CpTask(bool autoDelete = true) + : mAutoDelete(autoDelete) + { + } + + virtual ~CpTask() + { + } + + bool autoDelete() const + { + return mAutoDelete; + } + + virtual void execute(volatile bool *stopped) + { + Q_UNUSED(stopped); + } + + virtual void complete(volatile bool *stopped) + { + Q_UNUSED(stopped); + } + +private: + bool mAutoDelete; +}; + +class CP_CATEGORY_EXPORT CpTaskExecutor : public QThread +{ + Q_OBJECT +public: + explicit CpTaskExecutor(QObject *parent = 0); + + virtual ~CpTaskExecutor(); + + /* + return the gloabl instance + */ + static CpTaskExecutor *globalInstance(); + + /* + destroy the global instance + */ + static void destroyGlobalInstance(); + + /* + add the task to running queue + @task the task + @append ture -- append to tail false -- preappend to head + */ + + bool runTask(CpTask *task,bool append = false); + + /* + stop the thread and remove all not running tasks + */ + void stop(); + + /* + move a task to front of the queue + */ + bool toFront(CpTask *task); + + /* + move a task to front of the queue + */ + template bool toFront(Predicate pred); + +protected: + /* + From QThread, run tasks + */ + virtual void run(); +private: + /* + remove not running tasks + */ + void removeTasks(); +private: + QList mTasks; + QMutex mMutex; + volatile bool mStopped; +}; + + +template +bool CpTaskExecutor::toFront(Predicate pred) +{ + QMutexLocker locker(&mMutex); + + QList::iterator workIterator = mTasks.begin(); + QList::iterator endIterator(mTasks.end()); + + for(;workIterator != endIterator;++workIterator) + { + if (pred(*workIterator)) { + break; + } + } + + if (workIterator == endIterator) { + return false; + } + + CpTask *task = *workIterator; + mTasks.erase(workIterator); + mTasks.insert(0,task); + + return true; +} + +#endif //CPTASKECECUTOR_H + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/cpuids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpuids.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Contains all QT comtrol pannel related formal uids +* +*/ +#ifndef QCPUIDS_H +#define QCPUIDS_H + +#define QUID_CONTROLPANNEL_UI 0X20025FD9 +#define QUID_CPFRAMEWORK_DLL 0X20025FDA +#define QUID_CPPLUGIN_APPSETTINGS 0X20025FDC +#define QUID_CPPLUGIN_PLACEHOLDER_NOICON 0X20025FDD +#define QUID_CPPLUGIN_KEYTOUCH 0X20025FDE +#define QUID_CPPLUGIN_COMMUNICATION 0X20025FDF +#define QUID_CPPPLUGIN_LOOKFEEL 0X20025FE0 +#define QUID_CPPLUGIN_SAMPLEVIEW 0X20025FE2 +#define QUID_CPPLUGIN_SAMPLEGROUP 0X20025FE3 +#define QUID_CPPLUGIN_PRIVACY 0X20025FE1 +#define QUID_CPPLUGIN_THEME 0X20025FDB +#define QUID_CPPLUGIN_TONES 0X20025FE4 +#define QUID_CPPLUGIN_PERSONALIZATION 0X20025FE5 +#define QUID_CPPROFILEENGWRAPPER 0X20025FE6 +#define QUID_CPPLUGIN_DEVICE 0X20025FE7 +#define QUID_CPPLUGIN_PLACEHOLDER 0X20025FE8 + +#define QUID_CPPLUGIN_PINCODE 0X20028731 +#define QUID_CPPLUGIN_DEVICELOCK 0X20028732 +#define QUID_SECCODEUI 0X20028733 +#define QUID_LOGGER 0X20028734 +#define QUID_CPPLUGIN_DISPLAY 0X20028735 + + +#define QUID_CPCATEGORYMODEL_DLL 0X20028736 +#define QUID_CPVOLUME 0X20028737 +#define QUID_RINGTONE 0X20028738 +#define QUID_PROFILEACTIVATOR 0X20028739 +#define QUID_RINGTONESELVIEW 0X2002873A +#define QUID_CPPLUGIN_ABOUT 0X2002873B +#define QUID_CPPLUGIN_LANGUAGE 0X2002873C +#define QUID_RESERVED10 0X2002873D +#define QUID_RESERVED11 0X2002873E +#define QUID_CPSERVICEPROVIDER 0X2002873F +#define QUID_DE_GSPLUGIN 0X20028740 //reserved by 9.2 + +#endif //QCPUIDS_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/inc.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/inc.pri Tue Aug 31 15:15:28 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: +# + +INTERNAL_HEADERS += $$PWD/cpcategorysettingformmodel.h \ + $$PWD/cpcategorysettingformitemdata.h \ + $$PWD/cpcategoryglobal.h \ + $$PWD/cptaskexecutor.h \ + $$PWD/cpevent.h + +HEADERS += $$INTERNAL_HEADERS diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/inc/ringtoneviewdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/ringtoneviewdef.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef RINGTONEVIEWDEF_H +#define RINGTONEVIEWDEF_H + +#include + +#ifdef CPRINGTONEVIEW_LIBRARY +# define CPRINGTONEVIEW_EXPORT Q_DECL_EXPORT +#else +# define CPRINGTONEVIEW_EXPORT Q_DECL_IMPORT +#endif + +#endif //RINGTONEVIEWDEF_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/src.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/src.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,19 @@ +# +# 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 = cpprofilewrapper cpcategorymodel cpringtoneview cpapplication cpserviceprovider tonefetcher cpplugins +CONFIG += ordered \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/common.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,43 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: +# Description: controlpanel project - common qmake settings +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. +win32|mac:!contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release \ + debug \ + release + contains(QT_CONFIG,debug):CONFIG += debug + contains(QT_CONFIG,release):CONFIG += release +} +CONFIG(debug, debug|release):SUBDIRPART = debug +else:SUBDIRPART = release + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +# For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL \ + -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} +INCLUDEPATH += $$PWD/inc + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/inc/tonefetcherlog.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherlog.conf Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,7 @@ +[ToneFetcher] +logdatetime = 1 +logloggername = 1 +datetimeformat = hh:mm:ss:zzz +output = debugoutput fileoutput +fileoutput/logfile = C:/data/logs/tonefetcher.log +fileoutput/truncate = 1 \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone fetcher logger. + * + */ + +#ifndef TONEFETCHERLOGGER_H +#define TONEFETCHERLOGGER_H + +#include +#include + +/* + make LOG work +*/ + +//#define ENABLE_TONEFETCHER_LOG + +#define TONEFETCHER_LOGGER_NAME QLatin1String("ToneFetcher") + +#if defined (Q_OS_SYMBIAN) + #define TF_LOGGER_CONFIG_PATH QLatin1String("C:/data/.config/tonefetcherlog.conf") +#elif defined (Q_WS_WIN) + #ifdef _DEBUG + #define TF_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/debug/bin/tonefetcherlog.conf") + #else + #define TF_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/release/bin/tonefetcherlog.conf") + #endif +#endif + +#ifdef ENABLE_TONEFETCHER_LOG + #define TF_LOG(str) Logger::instance(TONEFETCHER_LOGGER_NAME)->log(str); +#else + #define TF_LOG(str) +#endif + +#endif /* TONEFETCHERLOGGER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher utilities. + * + */ + +#include "tonefetcherutils.h" +#include +#include + +QString ToneFetcherUtils::normalizeSeperator(const QString &path) +{ + QString standardpath( path ); + QChar c('/'); + QChar c1('\\'); + if (standardpath.contains(c, Qt::CaseSensitive)) { + standardpath.replace(c, QDir::separator()); + } + if (standardpath.contains(c1, Qt::CaseSensitive)) { + standardpath.replace(c1, QDir::separator()); + } + return standardpath; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/inc/tonefetcherutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherutils.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,31 @@ +/* + * 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: + * The header file for tone fetcher utilities. + * + */ + +#ifndef TONEFETCHERUTILS_H +#define TONEFETCHERUTILS_H + +#include + +class ToneFetcherUtils +{ +public: + //replace '/' and '\' with QDir::separator() + static QString normalizeSeperator(const QString &path); +}; + +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/rom/rom.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# Rom exports for tone fetcher +# + +symbian { + TONESERVICEPROVIDER_IBY_DIR = $$section(PWD, ":", 1) + + exists(/epoc32/include/platform_paths.hrh) { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } else { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } + + BLD_INF_RULES.prj_exports += "$$TONESERVICEPROVIDER_IBY_DIR/tonefetcher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tonefetcher.iby)" + +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/rom/tonefetcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/rom/tonefetcher.iby Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __TONEFETCHER_IBY__ +#define __TONEFETCHER_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\tonefetcher.exe SHARED_LIB_DIR\tonefetcher.exe +HB_UPGRADABLE_APP_REG_RSC(tonefetcher) +S60_APP_RESOURCE(tonefetcher) + + +data=DATAZ_\private\2002BCCA\service_conf.xml private\2002BCCA\service_conf.xml + +#endif + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/service_conf.xml Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,11 @@ + + + tonefetcher + No path + tone service + + com.nokia.symbian.IToneFetch + 1.0 + Launch a tone selection view + + \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/main.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The main function for Tone Fetcher + */ + +#include "tonefetcher.h" +#include "tonefetchermainwindow.h" +#include +#include + +int main(int argc, char *argv[]) +{ + HbApplication a(argc, argv); + +#ifdef ENABLE_TONEFETCHER_LOG + Logger::instance(TONEFETCHER_LOGGER_NAME)->configure( + TF_LOGGER_CONFIG_PATH,QSettings::IniFormat); +#endif + TF_LOG("Entering tonefetcher.exe..."); + ToneFetcherMainWindow w; + w.show(); + int ret = a.exec(); + TF_LOG("Leaving tonefetcher.exe..."); +#ifdef ENABLE_TONEFETCHER_LOG + Logger::closeAll(); +#endif + return ret; +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcher.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,72 @@ +/* + * 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: + * The source file for tone fetcher. + * + */ +#include "tonefetcher.h" +#include +#include "tonefetcherview.h" +#include "tonefetchermainwindow.h" +#include "tonefetcherutils.h" +#include +#include +#include + +ToneFetcher::ToneFetcher(HbMainWindow *mainWindow) + : XQServiceProvider(QString("tonefetcher.com.nokia.symbian.IToneFetch"), mainWindow), + mMainWindow(mainWindow), + mAsyncRequestIndex(-1), + mReturnValue(0) +{ + //publish tone service + publishAll(); +} + +ToneFetcher::~ToneFetcher() +{ + +} + +void ToneFetcher::fetch() +{ + mAsyncRequestIndex = setCurrentRequestAsync(); + if (mMainWindow) { + mMainWindow->show(); + ToneFetcherView *toneView = new ToneFetcherView(this); + if (toneView) { + connect(toneView, SIGNAL(itemSelected(QString)), this, SLOT(setSelectedPath(QString))); + mMainWindow->addView(toneView); + mMainWindow->setCurrentView(toneView); + } else { + TF_LOG("ToneFetcher::fetch: ToneFetcherView failed to be created"); + } + } +} + +void ToneFetcher::complete() +{ + completeRequest(mAsyncRequestIndex, mReturnValue); +} + +bool ToneFetcher::isActive() +{ + return mAsyncRequestIndex > 0; +} + +void ToneFetcher::setSelectedPath(const QString & tonePath) +{ + mReturnValue.setValue(ToneFetcherUtils::normalizeSeperator(tonePath)); +} +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcher.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,59 @@ +/* + * 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: + * The header file for tone fetcher. + * + */ +#ifndef TONEFETCHER_H +#define TONEFETCHER_H + +#include + +class HbMainWindow; +class ToneFetcher : public XQServiceProvider +{ + + Q_OBJECT + +public: + explicit ToneFetcher(HbMainWindow *mainWindow = 0); + ~ToneFetcher(); + /* + * return the tone's absolution path to the service requestor. + */ + void complete(); + /* + * currently only one request is allowed. + */ + bool isActive(); + +public slots: + /* + * tone fetcher service's operation + */ + void fetch(); + +private slots: + /* + * set the selected tone's path to be the return value + */ + void setSelectedPath(const QString &tonePath); + +private: + HbMainWindow *mMainWindow; + int mAsyncRequestIndex; + QVariant mReturnValue; +}; + +#endif // TONEFETCHER_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The main window function for Tone Fetcher + */ + +#include "tonefetchermainwindow.h" +#include + +ToneFetcherMainWindow::ToneFetcherMainWindow(QWidget *parent) + : HbMainWindow(parent) +{ + mToneFetcher = new ToneFetcher(this); + +} + +ToneFetcherMainWindow::~ToneFetcherMainWindow() +{ + delete mToneFetcher; +} +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h Tue Aug 31 15:15:28 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: + * The header file of Tone Fetcher Mainwindow + */ +#ifndef TONEFETCHERMAINWINDOW_H +#define TONEFETCHERMAINWINDOW_H + +#include +#include "tonefetcher.h" +#include + +class ToneFetcherMainWindow : public HbMainWindow +{ + Q_OBJECT + +public: + explicit ToneFetcherMainWindow(QWidget *parent = 0); + virtual ~ToneFetcherMainWindow(); + +private: + ToneFetcher *mToneFetcher; +}; + +#endif // TONEFETCHERWINDOW_H +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,65 @@ +/* + * 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: + * The source file for tone list model + */ +#include "tonefetchermodel.h" +#include +#include + +ToneFetcherModel::ToneFetcherModel(QObject *parent) + : QStringListModel(parent) +{ +} + +ToneFetcherModel::~ToneFetcherModel() +{ +} + +QVariant ToneFetcherModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + return QFileInfo(QStringListModel::data(index, role).toString()).baseName(); + } else { + return QStringListModel::data(index, role); + } +} + +QString ToneFetcherModel::getPath(const QModelIndex &index) const +{ + return QStringListModel::data(index, Qt::DisplayRole).toString(); +} + +void ToneFetcherModel::sort() +{ + QStringList list = stringList(); + qStableSort(list.begin(), list.end(), caseSensitiveLessThan); + removeRows(0, rowCount()); + setStringList(list); +} +void ToneFetcherModel::layoutToBeChanged() +{ + emit layoutAboutToBeChanged(); +} + +void ToneFetcherModel::layoutHasChanged() +{ + emit layoutChanged(); +} + +bool ToneFetcherModel::caseSensitiveLessThan(const QString &s1, const QString &s2) +{ + return QFileInfo(s1).baseName().toLower() < QFileInfo(s2).baseName().toLower(); +} +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetchermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone list model + * + */ + +#ifndef TONEFETCHERMODEL_H +#define TONEFETCHERMODEL_H + +#include +#include + +// CLASS DECLARATION +/** + * This class is used for storing tone list items. + * inherited from QStringListModel so that many existing functions could be used. + * + */ +class ToneFetcherModel : public QStringListModel +{ +public: + explicit ToneFetcherModel( QObject *parent ); + virtual ~ToneFetcherModel(); + //from QStringListModel + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QString getPath(const QModelIndex &index) const; + //sort the list + void sort(); + //sort method + bool static caseSensitiveLessThan(const QString &s1, const QString &s2); + //emit the signal of layoutToBeChanged(); + void layoutToBeChanged(); + //emit the signal of layoutChanged(); + void layoutHasChanged(); +}; + +#endif /* TONEFETCHERMODEL_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetcherview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher view. + * + */ +#include "tonefetcherview.h" +#include "tonefetcherwidget.h" +#include +#include +#include "tonefetcher.h" +#include + +ToneFetcherView::ToneFetcherView(ToneFetcher *service) : mServiceProvider(service) +{ + setTitle(hbTrId("Tone Selection"));//need change according to ps file + initToolBar(); + initMainWidget(); + QMetaObject::connectSlotsByName(this); + +} + +ToneFetcherView::~ToneFetcherView() +{ + removeToolBarAction(); +} + +void ToneFetcherView::initMainWidget() +{ + mWidget = new ToneFetcherWidget(this, this); + Q_ASSERT(mWidget); + setWidget(mWidget); + //mWidget->setCurrentToolBarType( ToneServiceWidget::GeneralTone ); + connect(mWidget, SIGNAL(triggerToolBar(bool)), this, SLOT(enableToolBar(bool))); +} + +void ToneFetcherView::quit() +{ + connect(mServiceProvider, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + mServiceProvider->complete(); +} + +void ToneFetcherView::initToolBar() +{ + mToolBarLeftAction = new HbAction(this); + mToolBarLeftAction->setObjectName("leftAction"); + mToolBarLeftAction->setText(hbTrId("Play/Pause"));//need change according to ps file + toolBar()->addAction(mToolBarLeftAction); + mToolBarLeftAction->setEnabled(false); + + mToolBarRightAction = new HbAction(this); + mToolBarRightAction->setObjectName("rightAction"); + mToolBarRightAction->setText(hbTrId("Select"));//need change according to ps file + mToolBarRightAction->setEnabled(false); + toolBar()->addAction(mToolBarRightAction); + + toolBar()->setOrientation(Qt::Horizontal); + toolBar()->setEnabled(false); + +} + +void ToneFetcherView::on_leftAction_triggered() +{ + mWidget->playOrPause(); + +} + +void ToneFetcherView::on_rightAction_triggered() +{ + emit itemSelected(mWidget->getCurrentItemPath()); + quit(); + /*QDir dir("c:\\data\\Sounds\\Simple\\"); + dir.remove("def.aac"); + dir.remove("abc.aac"); */ +} + +void ToneFetcherView::enableToolBar(bool enable) +{ + mToolBarRightAction->setEnabled(enable); + mToolBarLeftAction->setEnabled(enable); + toolBar()->setEnabled(enable); +} + +void ToneFetcherView::removeToolBarAction() +{ + toolBar()->removeAction(mToolBarRightAction); + toolBar()->removeAction(mToolBarLeftAction); +} +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetcherview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,60 @@ +/* + * 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: + * The header file for tone fetcher view. + * + */ + +#ifndef TONEFETCHERVIEW_H +#define TONEFETCHERVIEW_H + +#include +#include +class ToneFetcherWidget; +class HbAction; +class ToneFetcher; + +class ToneFetcherView : public HbView +{ + Q_OBJECT + +public: + explicit ToneFetcherView(ToneFetcher *service); + ~ToneFetcherView(); + void quit(); + +signals: + void itemSelected(const QString &path); + +private: + void initMainWidget(); + void initToolBar(); + /* + * tool bar actions must to be removed in case the app crashes. + */ + void removeToolBarAction(); + +private slots: + void on_leftAction_triggered(); + void on_rightAction_triggered(); + void enableToolBar(bool enable); + +private: + ToneFetcherWidget *mWidget; + ToneFetcher *mServiceProvider; //not own + HbAction *mToolBarLeftAction; + HbAction *mToolBarRightAction; + }; + +#endif /* TONEFETCHERVIEW_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,240 @@ +/* + * 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: + * The source file for tone fetcher widget. + * + */ +#include "tonefetcherwidget.h" +#include "hbabstractviewitem.h" +#include "hbstyle.h" +#include "hbabstractitemview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tonefetcherview.h" +#include "tonefetchermodel.h" +#include +#include + +ToneFetcherWidget::ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView) + : HbWidget(parent), + mLabel(0), + mListView(0), + mLayout(0), + mToneModel(0), + mServiceView(serviceView), + mServiceEngine(0), + mWaitNote(0) + +{ + init(); + connect(mServiceEngine, SIGNAL(mdeSessionOpened()), + this, SLOT(mdeSessionOpened())); + connect(mServiceEngine, SIGNAL(mdeSessionError(int)), + this, SLOT(mdeSessionError(int))); + connect(mServiceEngine, SIGNAL(queryComplete(QStringList)), + this, SLOT(queryComplete(QStringList))); + connect(mServiceEngine, SIGNAL(queryError(int)), + this, SLOT(queryError(int))); + connect(mServiceEngine, + SIGNAL(notifyPreviewEvent(int)), + this, SLOT(previewEvent(int))); + connect( mServiceEngine, SIGNAL(notifyObjectChanged()), + this, SLOT(onObjectChanged())); +} + +ToneFetcherWidget::~ToneFetcherWidget() +{ + delete mToneModel; + mToneModel = 0; + delete mWaitNote; + mWaitNote = 0; +} + +void ToneFetcherWidget::on_list_activated(const QModelIndex &index) +{ + //stop previewing when clicking another item. + if (mServiceEngine->isPlaying()) { + mServiceEngine->stopPlaying(); + } + /* + * when one item is selected, reselecting it will deselect it. selecting another + * will also deselect it, while the other is selected. + */ + QItemSelectionModel *selectionModel = mListView->selectionModel(); + if (mOldSeletedItem == index) { + selectionModel->select(index,QItemSelectionModel::Toggle); + } + + QModelIndexList modelIndexList = selectionModel->selectedIndexes(); + if (modelIndexList.isEmpty()) { + mOldSeletedItem = QModelIndex(); + } + else { + mOldSeletedItem = modelIndexList.front(); + } + emit triggerToolBar(selectionModel->hasSelection()); + + +} + +void ToneFetcherWidget::init() +{ + mLayout = new QGraphicsLinearLayout(this); + mLayout->setOrientation(Qt::Vertical); + setLayout(mLayout); + + mLabel = new HbLabel(this); + mLabel->setPlainText(hbTrId("Select tone")); + mLayout->addItem(mLabel); + + mListView = new HbListView(this); + mListView->setObjectName("list"); + mLayout->addItem(mListView); + mListView->setSelectionMode(HbAbstractItemView::SingleSelection); + + mServiceEngine = new ToneFetcherEngine(this); + mToneModel = new ToneFetcherModel(this); + + initRomSoundList(); + + connect(mListView, SIGNAL(activated(QModelIndex)), + this, SLOT(on_list_activated(QModelIndex ))); + if( !mWaitNote ){ + mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog ); + mWaitNote->setText( hbTrId( "Refreshing..." ) ); + QAction *action = mWaitNote->actions().at(0);//disable Cancel buttion. + action->setEnabled(false); + } +} + +void ToneFetcherWidget::mdeSessionOpened() +{ + mServiceEngine->getTones(); +} + +void ToneFetcherWidget::queryComplete(const QStringList &uriList) +{ + addFilesFromMDE(uriList); + addFilesFromRom(); + mToneModel->sort(); + mToneModel->layoutHasChanged(); + if (!mListView->model()) { + mListView->setModel(mToneModel); + } + refreshFinish(); +} + +void ToneFetcherWidget::queryError(int error) +{ + Q_UNUSED(error); + +} + +void ToneFetcherWidget::mdeSessionError(int error) +{ + Q_UNUSED(error); +} + +QString ToneFetcherWidget::getCurrentItemPath() +{ + QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); + if (modelIndexList.count() > 0) { + QModelIndex index = modelIndexList.front(); + QString path = mToneModel->getPath(index); + return path; + } + return QString(); +} + +void ToneFetcherWidget::playOrPause() +{ + if(mServiceEngine->isPlaying()) { + mServiceEngine->stopPlaying(); + } else { + mServiceEngine->play(getCurrentItemPath()); + } + +} + +void ToneFetcherWidget::previewEvent(int event) +{ + if (event == 0) { + //preview successful, reserved + } else { + HbMessageBox::information(QString(hbTrId("Preview Error"))); + } +} + +void ToneFetcherWidget::onObjectChanged() +{ + refreshStart(); + if (mServiceEngine->isPlaying()) { + mServiceEngine->stopPlaying(); + } + mToneModel->layoutToBeChanged(); + emit triggerToolBar(false); + mToneModel->removeRows(0, mToneModel->rowCount()); + mServiceEngine->getTones(); +} + +void ToneFetcherWidget::addFilesFromRom() +{ + int currentCount = mToneModel->rowCount(); + mToneModel->insertRows(currentCount, mRomSoundList.size()); + for (int i = 0; i < mRomSoundList.size(); ++i) { + mToneModel->setData(mToneModel->index(i + currentCount), + QFileInfo(mRomSoundList.at(i)).absoluteFilePath()); + } +} + +void ToneFetcherWidget::addFilesFromMDE(const QStringList &uriList) +{ + int currentCount = mToneModel->rowCount(); + mToneModel->insertRows(currentCount, uriList.size()); + for (int i = 0; i < uriList.size(); ++i) { + mToneModel->setData(mToneModel->index(i + currentCount), QFileInfo(uriList.at(i)).absoluteFilePath()); + } +} + +void ToneFetcherWidget::refreshFinish() +{ + if (mWaitNote) { + mWaitNote->close(); + } +} + +void ToneFetcherWidget::refreshStart() +{ + if (mWaitNote) { + mWaitNote->open(); + } +} + +void ToneFetcherWidget::initRomSoundList() +{ + QDir digitalSoundPath(XQUtils::romRootPath() + XQUtils::digitalSoundsPath()); + QDir simpleSoundPath(XQUtils::romRootPath() + XQUtils::simpleSoundsPath()); + mRomSoundList = digitalSoundPath.entryInfoList() + simpleSoundPath.entryInfoList(); +} +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/src/tonefetcherwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,82 @@ +/* + * 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: + * The header file for tone fetcher widget. + * + */ +#ifndef TONEFETCHERWIDGET_H +#define TONEFETCHERWIDGET_H + +#include +#include +#include +#include +#include "tonefetcherengine.h" + +class QDirModel; +class HbListView; +class QGraphicsLinearLayout; +class QStandardItemModel; +class HbAbstractViewItem; +class ToneFetcherView; +class ToneFetcherModel; +class HbLabel; +class HbProgressDialog; + +class ToneFetcherWidget : public HbWidget +{ + Q_OBJECT + +public: + explicit ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView); + ~ToneFetcherWidget(); + QString getCurrentItemPath(); + void playOrPause(); + +signals: + void itemClicked(const QString &item); + void triggerToolBar(bool enable); + + +private: + void init(); + void addFilesFromRom(); + void initRomSoundList(); + void addFilesFromMDE(const QStringList &uriList); + +private slots: + void on_list_activated(const QModelIndex &index); + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(const QStringList &uriList); + void queryError(int error ); + void previewEvent(int event); + void onObjectChanged(); + void refreshFinish(); + void refreshStart(); + +private: + HbLabel *mLabel; + HbListView *mListView; + QGraphicsLinearLayout *mLayout; + ToneFetcherModel *mToneModel; + + ToneFetcherView *mServiceView; + ToneFetcherEngine *mServiceEngine; + + QFileInfoList mRomSoundList; + QModelIndex mOldSeletedItem; + HbProgressDialog *mWaitNote; +}; +#endif /* TONEFETCHERWIDGET_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcher.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,51 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +HEADERS += src/tonefetchermainwindow.h \ + src/tonefetcher.h \ + src/tonefetcherview.h \ + src/tonefetcherwidget.h \ + src/tonefetchermodel.h \ + tonefetcherengine/tonefetcherengine.h \ + inc/tonefetcherutils.h + +SOURCES += src/tonefetchermainwindow.cpp \ + src/tonefetcher.cpp \ + src/tonefetcherview.cpp \ + src/tonefetcherwidget.cpp \ + src/tonefetchermodel.cpp \ + tonefetcherengine/tonefetcherengine.cpp \ + inc/tonefetcherutils.cpp \ + src/main.cpp + +symbian { + HEADERS += tonefetcherengine/private/CTonePlayer.h \ + tonefetcherengine/private/CToneSelection.h \ + tonefetcherengine/private/MTonePlayingWatcher.h \ + tonefetcherengine/private/MToneSelectionWatcher.h \ + tonefetcherengine/private/tonefetcherengine_symbian.h + + + + SOURCES += tonefetcherengine/private/CTonePlayer.cpp \ + tonefetcherengine/private/CToneSelection.cpp \ + tonefetcherengine/private/tonefetcherengine_symbian.cpp +} else { + HEADERS += tonefetcherengine/private/tonefetcherengine_stub.h + SOURCES += tonefetcherengine/private/tonefetcherengine_stub.cpp +} + + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,62 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = tonefetcher +CONFIG += hb service + +include( common.pri ) +include( tonefetcher.pri ) +LIBS += -lxqservice \ + -lxqserviceutil \ + -lcplogger \ + -lcpframework \ + -lxqutils +symbian { + LIBS += -lcafutils \ + -lcaf \ + -lmdeclient \ + -lcentralrepository \ + -lProfileEng \ + -lpeninputClient \ + -lmediaclientaudio \ + -lDrmAudioPlayUtility \ + -lmediaclientvideo \ + -lDRMCommon \ + -lDrmRights \ + -lDrmHelper \ + -ldrmutility \ + -lapmime \ + -lecom \ + -lcone \ + -lapgrfx + + TARGET.UID3 = 0x2002BCCA + TARGET.CAPABILITY = ALL -TCB + TARGET.VID = VID_DEFAULT + BLD_INF_RULES.prj_exports += "./service_conf.xml z:/private/2002BCCA/service_conf.xml" +} +symbian { + include(rom/rom.pri) +} + + +SERVICE.FILE = service_conf.xml +SERVICE.OPTIONS = embeddable +SERVICE.OPTIONS += hidden +libFiles.sources = xqservice.dll +libFiles.path = "!:\sys\bin" +DEPLOYMENT += libFiles diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,626 @@ +/* + * 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: + * The source file for tone playing. + * + */ +#include "CTonePlayer.h" +#include "tonefetcherutils.h" +#include // KAudioPriorityPreview +#include // C3DRingingToneInterface +#include // for phone call states +#include +#include +#include +#include "TProfileToneSettings.h" +#include +#include +#include +#include // KProEngDefaultRingingTone +#include "MTonePlayingWatcher.h" + + +CMFPreviewHandlerBase::CMFPreviewHandlerBase() + { + iMediaType = KErrNotFound; + iRingingVolume = KErrNotFound; + iRingingType = KErrNotFound; + iVibra = KErrNotFound; + i3DEffect = KErrNotFound; + i3DEcho = KErrNotFound; + iFileSize = KErrNotFound; + iFullName = 0; + iActiveProfileRead = EFalse; + iPlayerStatus = EPlayerNotCreated; + + } + +void CMFPreviewHandlerBase::ConstructL() + { + // To allow/not allow screensaver + // Errors ignored, no actions needed if API is not available + //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver ); + TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) ); + + TRAP_IGNORE( ReadDefaultToneL() ); + // To keep backlight on while a video is being previewed + iBacklightTimer = CPeriodic::NewL( EPriorityLow ); + } + +CMFPreviewHandlerBase::~CMFPreviewHandlerBase() + { + delete iFullName; + iProperty.Close(); + + iApaSession.Close(); + } + +void CMFPreviewHandlerBase::SetAttrL( const TDesC& aFileName ) + { + if ( aFileName.Length() ) + { + delete iFullName; + iFullName = 0; + iFullName = aFileName.AllocL(); + } + } + +TInt CMFPreviewHandlerBase::RingingVolume() + { + const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels + + if ( iRingingVolume != KErrNotFound ) + { + return iRingingVolume; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingVolume; + } + + return KDefaultVolumeLevel; + } + +TInt CMFPreviewHandlerBase::RingingType() + { + if ( iRingingType != KErrNotFound ) + { + return iRingingType; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingType; + } + + return ERingingTypeRinging; + } + +TInt CMFPreviewHandlerBase::Vibra() + { + if ( iVibra != KErrNotFound ) + { + return iVibra; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileVibra; + } + + return 0; // in case of error vibra is off + } + +TInt CMFPreviewHandlerBase::Echo3D() + { + if ( i3DEcho != KErrNotFound ) + { + return i3DEcho; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEcho; + } + + return EProfile3DEchoOff; // from ProfileInternal.hrh + } + +TInt CMFPreviewHandlerBase::Effect3D() + { + if ( i3DEffect != KErrNotFound ) + { + return i3DEffect; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEffect; + } + + return EProfile3DEffectOff; + } + +TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume ) + { + const TInt KMinVolumeLevel = 1; + const TInt KMaxVolumeLevel = 10; + + TInt result = aMaxVolume * aVolume / KMaxVolumeLevel; + + // if user has selected minimum volume level set HW volume 1 + if ( aVolume == KMinVolumeLevel && result == 0 ) + { + result = 1; + } + + return result; + } + +void CMFPreviewHandlerBase::ReadActiveProfileL() + { + iActiveProfileRead = EFalse; + + MProfileEngine* profileEngine = CreateProfileEngineL(); + CleanupReleasePushL( *profileEngine ); + + MProfile* activeProfile = profileEngine->ActiveProfileL(); + CleanupReleasePushL( *activeProfile ); + + const MProfileTones& profileTones = activeProfile->ProfileTones(); + + const TProfileToneSettings& toneSettings = profileTones.ToneSettings(); + iActiveProfileVibra = toneSettings.iVibratingAlert; + iActiveProfileRingingVolume = toneSettings.iRingingVolume; + iActiveProfileRingingType = toneSettings.iRingingType; + + const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings(); + const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); + + iActiveProfile3DEffect = threeD.Effect(); + iActiveProfile3DEcho = threeD.Echo(); + + CleanupStack::PopAndDestroy( activeProfile ); + CleanupStack::PopAndDestroy( profileEngine ); + + iActiveProfileRead = ETrue; + } + +void CMFPreviewHandlerBase::ReadDefaultToneL() + { + CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine ); + + User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) ); + CleanupStack::PopAndDestroy( cenrep ); + } + +TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType ) + { + TUid dummyUid( KNullUid ); + return iApaSession.AppForDocument( aFileName, dummyUid, aDataType ); + } + +TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ ) + { + User::ResetInactivityTime(); + return KErrNone; + } + +void CMFPreviewHandlerBase::DisableBackLight() + { + const TInt KResetInactivityTimerDelay = 2000000; + iBacklightTimer->Cancel(); // Just in case + // Disable backlight turn off during video preview + iBacklightTimer->Start( KResetInactivityTimerDelay, + KResetInactivityTimerDelay, + TCallBack( DoResetInactivityTimer, 0 ) ); + + } + +CTonePlayer* CTonePlayer::NewL( MTonePlayingWatcher *aWatcher ) + { + CTonePlayer* self = CTonePlayer::NewLC( aWatcher ); + CleanupStack::Pop(); + return self; + } + +CTonePlayer* CTonePlayer::NewLC( MTonePlayingWatcher *aWatcher ) + { + CTonePlayer* self = new ( ELeave ) CTonePlayer( aWatcher ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +void CTonePlayer::ConstructL() + { + iAudioPlayerStatus = EPlayerNotCreated; + CMFPreviewHandlerBase::ConstructL(); + iTonePlayerStatus = EPlayerNotCreated; + CCoeEnv* coeEnv = CCoeEnv::Static(); + coeEnv->AddForegroundObserverL( *this ); + } + +CTonePlayer::CTonePlayer( MTonePlayingWatcher *aWatcher ) : iTonePlayWatcher( aWatcher ) + { + } + +CTonePlayer::~CTonePlayer() + { + Cancel(); + + delete iAudioPlayer; + delete iTonePlayer; + delete i3dRingingTonePlugin; + } + +TBool CTonePlayer::IsPlaying() + { + if ( iAudioPlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + if ( iTonePlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + return EFalse; + } + +void CTonePlayer::PlayL() + { + //sequence for playing a beep once sound + _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\ + \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); + + // rng mime type + _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" ); + + Cancel(); // stop previous play + + if ( !iFullName || iFullName->Des().Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + + TRAP_IGNORE( ReadActiveProfileL() ); + + TPtrC fileName( iFullName->Des() ); + TDataType dataType; + TInt err = GetDataType( fileName, dataType ); + if ( err == KErrNotFound ) + { + fileName.Set( iDefaultTone ); + if ( fileName.Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + } + else if ( err != KErrNone ) + { + User::Leave( err ); + } + + TBool mimeTypeRng = EFalse; + + if ( err == KErrNone ) + { + if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 ) + { + mimeTypeRng = ETrue; + } + } + + TInt ringingType = RingingType(); + if ( ringingType == ERingingTypeBeepOnce ) + { + // Active profile ringing tone is set to Beep Once + // Don't initialize a FileSequence but use DesSequence instead + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + if( mimeTypeRng ) + { + //Ringingtone is a RNG-file + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayFileSequence( fileName ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + delete iAudioPlayer; + iAudioPlayer = 0; + + iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL( + fileName, *this, KAudioPriorityRingingTonePreview, + ( TMdaPriorityPreference )KAudioPrefRingFilePreview ); + + iAudioPlayerStatus = EPlayerInitializing; + } + } + DisableBackLight(); + } + +void CTonePlayer::Stop() + { + Cancel(); + } + +TInt CTonePlayer::ConvertVolume( TInt aVolume ) + { + TInt result = 0; + if ( iAudioPlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() ); + } + else if ( iTonePlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() ); + } + + //if user has selected silent ringing type, set volume off + TInt ringingType = RingingType(); + if( ringingType == ERingingTypeSilent ) + { + result = 0; + } + + return result; + } + +void CTonePlayer::SetToneRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iTonePlayer ) + { + return; + } + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + case ERingingTypeBeepOnce: + { + iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + default: + { + break; + } + } + } + +void CTonePlayer::SetAudioRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iAudioPlayer ) + { + return; + } + + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + { + iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + + default: + { + break; + } + } + } + +void CTonePlayer::Cancel() + { + TBool isPlaying = EFalse; + + if ( iAudioPlayer ) + { + isPlaying = ETrue; + if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect ) + { + i3dRingingTonePlugin->Stop(); + // plugin calls AudioPlayer->Stop() + iAudioPlayer->Close(); + } + if ( iAudioPlayerStatus == EPlayerPlaying ) + { + iAudioPlayer->Stop(); + iAudioPlayer->Close(); + } + + delete iAudioPlayer; + iAudioPlayer = 0; + iAudioPlayerStatus = EPlayerNotCreated; + } + + if ( iTonePlayer ) + { + isPlaying = ETrue; + if ( iTonePlayerStatus == EPlayerPlaying ) + { + iTonePlayer->CancelPlay(); + } + + delete iTonePlayer; + iTonePlayer = 0; + iTonePlayerStatus = EPlayerNotCreated; + } + + + if ( isPlaying ) + { + //User::InfoPrint(_L("cancel")); +// EnableScreenSaver( ETrue ); + iBacklightTimer->Cancel(); + } + } + +void CTonePlayer::MatoPlayComplete( TInt aError ) + { + Cancel(); + iTonePlayWatcher->HandlePreviewEvent( aError ); + } + +void CTonePlayer::MatoPrepareComplete( TInt aError ) + { + if ( aError != KErrNone ) + { + Cancel(); + + iTonePlayWatcher->HandlePreviewEvent( aError ); + return; + } + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + + iTonePlayerStatus = EPlayerInitialized; + SetToneRingingType( ringingType ); + iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iTonePlayer->SetPriority( KAudioPriorityPreview, pref ); + + iTonePlayer->Play(); + iTonePlayerStatus = EPlayerPlaying; + } + +void CTonePlayer::MdapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& /* aDuration */ ) + { + if ( aError != KErrNone ) + { + Cancel(); + iTonePlayWatcher->HandlePreviewEvent( aError ); + return; + } + + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + TInt echo3D = Echo3D(); + TInt effect3D = Effect3D(); + + + + iAudioPlayerStatus = EPlayerInitialized; + SetAudioRingingType( ringingType ); + iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iAudioPlayer->SetPriority( KAudioPriorityPreview, pref ); + + iAudioPlayerStatus = EPlayerPlaying; + + if ( effect3D == EProfile3DEffectOff ) + { + iAudioPlayer->Play(); // 3D not used + return; + } + + if ( !i3dRingingTonePlugin ) + { + TUid emptyUid = { 0 }; + TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) ); + if ( err != KErrNone || !i3dRingingTonePlugin ) + { + iAudioPlayer->Play(); + return; + } + } + + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer ); + TRAP_IGNORE( i3dRingingTonePlugin->PlayL() ); + + iAudioPlayerStatus = EPlayerPlayingWith3DEffect; + } + +void CTonePlayer::MdapcPlayComplete( TInt aError ) + { + Cancel(); + iTonePlayWatcher->HandlePreviewEvent( aError ); + } + +void CTonePlayer::HandleLosingForeground() + { + if ( IsPlaying() ) + { + Stop(); + } + } +void CTonePlayer::HandleGainingForeground() + { + + } diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CTonePlayer.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,202 @@ +/* + * 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: + * The header file for tone playing. + * + */ + +#ifndef CTONEPLAYER_H +#define CTONEPLAYER_H + +#include +#include +#include +#include +#include +#include +#include // for RApaLsSession +#include + +class C3DRingingToneInterface; +class RWindow; +class MTonePlayingWatcher; +/** +* CMFPreviewHandlerBase +* +* Base class for CMFAudioPreviewHandler. + */ +class CMFPreviewHandlerBase : public CBase + + { + public: + enum TMediaFileType + { + EMediaFileTypeAudio = 0, + EMediaFileTypeVideo + }; + enum TPlayerStatus + { + EPlayerNotCreated, + EPlayerInitializing, + EPlayerReady, + EPlayerPlaying, + EPlayerInitialized, + EPlayerPlayingWith3DEffect + }; + + // these must match with the ones in Profile Engine + enum TRingingTypes + { + ERingingTypeRinging = 0, + ERingingTypeAscending, + ERingingTypeRingOnce, + ERingingTypeBeepOnce, + ERingingTypeSilent + }; + + enum TFLAllowScreenSaver + { + EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed + }; + public: + void SetAttrL(const TDesC& aFileName); + TInt Attr(TInt aAttr); + virtual void PlayL() = 0; + virtual void Stop() = 0; + virtual TBool IsPlaying() = 0; + + protected: + virtual ~CMFPreviewHandlerBase(); + + protected: + /** + * C++ default constructor. + */ + CMFPreviewHandlerBase( ); + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + protected: + TInt ConvertVolume(TInt aVolume); + void ReadActiveProfileL(); + TInt GetDataType(const TDesC& aFileName, TDataType& aDataType); + void ReadDefaultToneL(); + void DisableBackLight(); + static TInt DoResetInactivityTimer(TAny* aObject); + TInt RingingVolume(); + TInt RingingType(); + TInt Vibra(); + TInt Echo3D(); + TInt Effect3D(); + static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume); + + protected: + TInt iRingingVolume; + TInt iRingingType; + TInt iVibra; + TInt i3DEffect; + TInt i3DEcho; + TInt iMediaType; + TInt iFileSize; + HBufC* iFullName; + TBool iActiveProfileRead; + TInt iActiveProfileRingingVolume; + TInt iActiveProfileRingingType; + TInt iActiveProfileVibra; + TInt iActiveProfile3DEffect; + TInt iActiveProfile3DEcho; + TInt iPlayerStatus; + // handle to window + RWindow* iWindow; // does not own + // for getting file MIME types + RApaLsSession iApaSession; + // for setting screensaver on/off + RProperty iProperty; + // default ringing tone + TFileName iDefaultTone; + /** + * Timer for resetting the user inactivity timeout + */ + CPeriodic* iBacklightTimer; + }; + +// CLASS DECLARATION +/** + * This class is used for playing the tones. + * + */ + +class CTonePlayer : public CMFPreviewHandlerBase, + public MDrmAudioPlayerCallback, + public MMdaAudioToneObserver, + public MCoeForegroundObserver + { + public: + static CTonePlayer* NewL( MTonePlayingWatcher *aWatcher ); + static CTonePlayer* NewLC( MTonePlayingWatcher *aWatcher ); + virtual ~CTonePlayer(); + + + public: + void PlayL(); + void Stop(); + TBool IsPlaying(); + + private: + CTonePlayer( MTonePlayingWatcher *aWatcher ); + void ConstructL(); + void Cancel(); + void SetAudioRingingType( TInt aRingingType ); + void SetToneRingingType( TInt aRingingType ); + TInt ConvertVolume( TInt aVolume ); + + private: + // from MMdaAudioToneObserver + virtual void MatoPrepareComplete( TInt aError ); + virtual void MatoPlayComplete(TInt aError); + + private: + // from MDrmAudioPlayerCallback + void MdapcInitComplete(TInt aError, + const TTimeIntervalMicroSeconds& aDuration); + void MdapcPlayComplete(TInt aError); + + // from MCoeForegroundObserver + void HandleLosingForeground(); + void HandleGainingForeground(); + + private: + //wacher of the playing process + MTonePlayingWatcher* iTonePlayWatcher; + + // audio player + CDrmPlayerUtility* iAudioPlayer; + + /// Audioplayer status + TPlayerStatus iAudioPlayerStatus; + + /// toneplayer + CMdaAudioToneUtility* iTonePlayer; + + /// Toneplayer status + TPlayerStatus iTonePlayerStatus; + + // plugin for playing 3D effects + C3DRingingToneInterface* i3dRingingTonePlugin; + + }; + +#endif /* CTONEPLAYER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,408 @@ +/* + * 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: + * The source file for mde tone fetcher. + * + */ +#include "CToneSelection.h" +#include +#include +#include "tonefetcherengine.h" +#include "MToneSelectionWatcher.h" +#include +#include +#include +#include + +//refresh interval, 2 seconds. +const TInt KTimerInterval = 2 * 1000 * 1000; +const TInt KObserverCallStep = 100; +const TInt KOneKiloByte = 1024; +// CONSTANTS +_LIT( KMimeMp3, "mp3" ); + +CMFActiveCaller* CMFActiveCaller::NewL( CToneSelection* aObserver ) + { + CMFActiveCaller* self = new (ELeave) CMFActiveCaller( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +CMFActiveCaller::~CMFActiveCaller() + { + Cancel(); + iTimer.Close(); + } + +CMFActiveCaller::CMFActiveCaller(CToneSelection* aObserver) : CActive(CActive::EPriorityStandard) + { + iObserver = aObserver; + } + +void CMFActiveCaller::ConstructL() + { + User::LeaveIfError( iTimer.CreateLocal() ); + CActiveScheduler::Add( this ); + } + +void CMFActiveCaller::DoCancel() + { + iTimer.Cancel(); + } + +void CMFActiveCaller::RunL() + { + iObserver->ChangeObject(); + } + +void CMFActiveCaller::Request() + { + Cancel(); + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + +void CMFActiveCaller::Start( TInt aMilliseconds ) + { + Cancel(); + + if ( aMilliseconds <= 0 ) + { + Request(); // no delay - complete asap + } + else + { + iTimer.After( iStatus, aMilliseconds ); + SetActive(); + } + } + +void CMFActiveCaller::Stop() + { + Cancel(); + } + +CToneSelection* CToneSelection::NewL( MToneSelectionWatcher *aWatcher ) + { + CToneSelection* self = CToneSelection::NewLC(aWatcher); + CleanupStack::Pop( self ); + return self; + } + +CToneSelection* CToneSelection::NewLC( MToneSelectionWatcher *aWatcher ) + { + CToneSelection* self = new ( ELeave ) CToneSelection( aWatcher ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +void CToneSelection::ConstructL() + { + iSession = CMdESession::NewL( *this ); + iObjectNotificationCaller = CMFActiveCaller::NewL( this ); + } + +CToneSelection::CToneSelection( MToneSelectionWatcher *aWatcher ) : iToneSelectionWatcher( aWatcher ) + { + iMediaFileCounter = 0; + iIsQuerying = EFalse; + } + +CToneSelection::~CToneSelection() + { + iResultArray.ResetAndDestroy(); + delete iQuery; + delete iSession; + delete iObjectNotificationCaller; + } + +void CToneSelection::HandleSessionOpened( CMdESession& /*aSession*/, TInt aError ) + { + if ( aError != KErrNone ) + { + iDefNS = 0; + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + iToneSelectionWatcher->HandleMdeSessionError( aError ); + } + else + { + iDefNS = &iSession->GetDefaultNamespaceDefL(); + iSessionOpen = ETrue; + TRAP_IGNORE( AddObjectObserverL() ); + iToneSelectionWatcher->HandleMdeSessionOpened(); + } + } + + + +void CToneSelection::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) + { + if ( aError == KErrNone ) + { + return; + } + + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + iToneSelectionWatcher->HandleMdeSessionError( aError ); + } + +void CToneSelection::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/ ) + { + } + +void CToneSelection::HandleObjectNotification( CMdESession& /*aSession*/, + TObserverNotificationType /*aType*/, + const RArray& /*aObjectIdArray*/ ) + { + /*if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) ) + { + QString str("CToneSelection::HandleObjectNotification " + QString::number(aObjectIdArray.Count()) + " " + QString::number(aType)); + TF_LOG(str); + iMediaFileCounter = iMediaFileCounter + aObjectIdArray.Count(); + if ( iMediaFileCounter >= KObserverCallStep ) + { + iMediaFileCounter = 0; + iToneSelectionWatcher->HandleObjectChanged(); + } + else + { + iObjectNotificationCaller->Start(KTimerInterval); + } + }*/ + } + +void CToneSelection::AddObjectObserverL() + { + if ( iSessionOpen ) + { + TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; + iSession->AddObjectObserverL( *this, 0, notificationType, iDefNS ); + + iSession->AddObjectPresentObserverL( *this ); + } + } + +void CToneSelection::HandleObjectPresentNotification( CMdESession& /*aSession*/, + TBool /*aPresent*/, const RArray& aObjectIdArray ) + { + + if( aObjectIdArray.Count() > 0 ) + { + //if query is executing, we do not allow the fresh of contents + if ( iIsQuerying ) + { + iMediaFileCounter = 0; + return; + } + QString str("CToneSelection::HandleObjectPresentNotification " + QString::number(aObjectIdArray.Count())); + TF_LOG(str); + iMediaFileCounter = iMediaFileCounter + aObjectIdArray.Count(); + if ( iMediaFileCounter > KObserverCallStep ) + { + iMediaFileCounter = 0; + iToneSelectionWatcher->HandleObjectChanged(); + } + else + { + iObjectNotificationCaller->Start(KTimerInterval); + } + } + } + +void CToneSelection::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + { + iIsQuerying = EFalse; + iResultArray.ResetAndDestroy(); + if ( aError == KErrCancel ) + { + iToneSelectionWatcher->HandleQueryError( aError ); + return; + } + else + { + CMdEObjectQuery* query = static_cast (&aQuery); + TInt count = query->Count(); + for (TInt i = 0; i < count; ++i) + { + CMdEObject* object = + (CMdEObject*) query->TakeOwnershipOfResult(i); + CleanupStack::PushL(object); + CMdEPropertyDef& propDef = + CToneSelection::PropertyDefL( iSession, CToneSelection::EAttrSongName ); + + CMdEProperty* property = 0; + TInt err = object->Property( propDef, property, 0 ); + if ( err != KErrNotFound && property ) + { + HBufC* songUri = HBufC::NewL( object->Uri().Length() ); + TPtr ptr = songUri->Des(); + ptr.Copy( object->Uri() ); + iResultArray.AppendL( songUri ); + } + CleanupStack::PopAndDestroy( object ); + } + iToneSelectionWatcher->HandleQueryComplete( iResultArray ); + } + } + +void CToneSelection::QueryTonesL() + { + LeaveIfSessionClosedL(); + delete iQuery; + iQuery = 0; + CMdEObjectDef& musicObjectDef = + iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject ); + iQuery = iSession->NewObjectQueryL( *iDefNS, musicObjectDef, this ); + + // set attributes that are included in query result + CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); + iQuery->AddPropertyFilterL( &namePropertyDef ); + + iQuery->SetResultMode( EQueryResultModeItem ); + + CMdELogicCondition& conditions = iQuery->Conditions(); + ExcludeMusicPropertiesL( conditions ); + iIsQuerying = ETrue; + iQuery->FindL(); + } + +void CToneSelection::LeaveIfSessionClosedL() + { + if ( !iSession || !iSessionOpen ) + { + User::Leave( KErrDisconnected ); + } + } + +CMdEPropertyDef& CToneSelection::PropertyDefL( TInt aAttr ) + { + return PropertyDefL( iSession, aAttr ); + } + +CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* /*aSession*/, TInt aAttr ) + { + CMdEObjectDef& objectDef = + iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject ); + + if ( aAttr == EAttrFileSize ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + } + else if ( aAttr == EAttrMediaType ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + } + else if ( aAttr == EAttrSongName || aAttr == EAttrFileName ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + } + else if ( aAttr == EAttrArtist ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); + } + else if ( aAttr == EAttrAlbum ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); + } + else if ( aAttr == EAttrGenre ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); + } + else if ( aAttr == EAttrComposer ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); + } + else + { + User::Leave( KErrNotSupported ); + } + //avoid critical warning + return objectDef.GetPropertyDefL( MdeConstants::Audio::KAudioObject ); + } + +void CToneSelection::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition ) + { + TInt sizeLimitKB = 0; + CRepository* cenrep = CRepository::NewL( KCRUidProfileEngine ); + CleanupStack::PushL( cenrep ); + User::LeaveIfError( cenrep->Get( KProEngRingingToneMaxSize, sizeLimitKB ) ); + CleanupStack::PopAndDestroy(); // cenrep + + SetAttr( CToneSelection::EAttrFileSize, sizeLimitKB ); + CMdEPropertyDef& sizeTypeDef = PropertyDefL( EAttrFileSize ); + CMdEPropertyDef& mimeTypeDef = PropertyDefL( EAttrMediaType ); + CMdEPropertyDef& artistTypeDef = PropertyDefL( EAttrArtist ); + CMdEPropertyDef& albumTypeDef = PropertyDefL( EAttrAlbum ); + CMdEPropertyDef& genreTypeDef = PropertyDefL( EAttrGenre ); + CMdEPropertyDef& composerTypeDef = PropertyDefL( EAttrComposer ); + + CMdELogicCondition& condition = + aCondition.AddLogicConditionL( ELogicConditionOperatorAnd ); + condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize * KOneKiloByte, EMdERangeTypeNotBetween) ); + condition.AddPropertyConditionL( mimeTypeDef, + ETextPropertyConditionCompareContains, KMimeMp3 ); + condition.AddPropertyConditionL( artistTypeDef ); + condition.AddPropertyConditionL( albumTypeDef ); + condition.AddPropertyConditionL( genreTypeDef ); + condition.AddPropertyConditionL( composerTypeDef ); + + condition.SetNegate( ETrue ); + } + +void CToneSelection::SetAttr( int attr, int value ) +{ + switch ( attr ) + { + case CToneSelection::EAttrFileSize: + { + iMaxFileSize = value; + break; + } + default: + { + break; + } + } +} + +void CToneSelection::ChangeObject() + { + if ( QueryReady() ) + { + iToneSelectionWatcher->HandleObjectChanged(); + } + } + +TBool CToneSelection::QueryReady() + { + if ( iQuery ) + { + return iQuery->IsComplete(); + } + + return ETrue; + } +// End of File + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for mde tone fetcher. + * + */ + +#ifndef CTONESELECTION_H +#define CTONESELECTION_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class MToneSelectionWatcher; +class CToneSelection; + +/** +* CMFActiveCaller +* +* CMFActiveCaller is used for generating a call from active scheduler. +* Typical use is to start some operation after a short delay. +*/ +NONSHARABLE_CLASS (CMFActiveCaller) : public CActive + { + public: + static CMFActiveCaller* NewL( CToneSelection* aObserver ); + virtual ~CMFActiveCaller(); + + private: + CMFActiveCaller( CToneSelection* aObserver ); + void ConstructL(); + + public: + void Start( TInt aMilliseconds ); + void Stop(); + void Request(); + + private: + void RunL(); + void DoCancel(); + + private: + // timer + RTimer iTimer; + + // observer that gets called + CToneSelection* iObserver; + }; + +// CLASS DECLARATION +/** + * This class is used for quering tones from mde. + * + */ +class CToneSelection : public CBase, + public MMdESessionObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver + { + public: + enum TStorageType + { + EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard + }; + + enum TQueryAttribute + { + EAttrMediaType = 20, // integer + EAttrFileSize, // integer + EAttrStorageType, // integer + EAttrMediaFileId, // integer + EAttrFileName, // string + EAttrFullName, // string + EAttrSongName, // string + EAttrArtist, // string + EAttrAlbum, // string + EAttrGenre, // string + EAttrComposer + }; + + public: + static CToneSelection* NewL( MToneSelectionWatcher *aWatcher ); + static CToneSelection* NewLC( MToneSelectionWatcher *aWatcher ); + + virtual ~CToneSelection(); + //iTimer's callback function. + void ChangeObject(); + void QueryTonesL(); + void SetAttr( int attr, int value ); + TBool QueryReady(); + + private: + CToneSelection( MToneSelectionWatcher *aWatcher ); + void ConstructL(); + void ExcludeMusicPropertiesL( CMdELogicCondition& aCondition ); + void LeaveIfSessionClosedL(); + CMdEPropertyDef& PropertyDefL(TInt aAttr); + CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr); + + private: + // from MMdESessionObserver + void HandleSessionOpened( CMdESession& aSession, TInt aError ); + void HandleSessionError( CMdESession& aSession, TInt aError ); + + private: + // from MMdEQueryObserver (mdequery.h) + void HandleQueryNewResults( CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount ); + void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); + private: + // from MMdEObjectObserver + void HandleObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray ); + + private: + // from MMdEObjectPresentObserver + void HandleObjectPresentNotification( CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + void AddObjectObserverL(); + void HandleObjectChanged(); + private: + + MToneSelectionWatcher* iToneSelectionWatcher; + + // session to metadata engine + CMdESession* iSession; + + CMdENamespaceDef* iDefNS; + + // metadata query + CMdEObjectQuery* iQuery; + TBool iIsQuerying; + + // used for saving the quering result. + RPointerArray iResultArray; + + // is metadata session open + TBool iSessionOpen; + + // max audio file file size + TInt iMaxFileSize; + + TInt iMediaFileCounter; + // for generating active object calls + CMFActiveCaller* iObjectNotificationCaller; + + }; +#endif /* CTONESELECTION_H */ + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/MTonePlayingWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/MTonePlayingWatcher.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * + */ + +#ifndef MTONEPLAYINGWATCHER_H +#define MTONEPLAYINGWATCHER_H + +#include + +/* + * this class is used to watch tone playing event, inherited by ToneFetcherEnginePrivate + */ +class MTonePlayingWatcher + { + public: + // handle preview event + virtual void HandlePreviewEvent( TInt event ) = 0; + }; + +#endif /* MTONEPLAYINGWATCHER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/MToneSelectionWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/MToneSelectionWatcher.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * + */ + +#ifndef MTONESELECTIONWATCHER_H +#define MTONESELECTIONWATCHER_H + +#include +#include + +/* + * this class is used to watch MDE system change, inherited by ToneFetcherEnginePrivate + */ +class MToneSelectionWatcher + { + public: + // handle mde session error event + virtual void HandleMdeSessionError( TInt aError ) = 0; + + // handle mde session open event + virtual void HandleMdeSessionOpened() = 0; + + // handle query error event + virtual void HandleQueryError( TInt aError ) = 0; + + // handle query complete event + virtual void HandleQueryComplete( RPointerArray& ) = 0; + + // handle object changed event + virtual void HandleObjectChanged() = 0; + }; + +#endif /* MTONESELECTIONWATCHER_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher engine private class of other platforms. + * + */ + +#include "tonefetcherengine_stub.h" + +ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() + { + + } + +virtual ~ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() + { + + } + +void ToneFetcherEnginePrivate::getTones() + { + + } + +void ToneFetcherEnginePrivate::play( const QString & ) + { + + } + +bool ToneFetcherEnginePrivate::isPlaying() + { + return false; + } + +void ToneFetcherEnginePrivate::stopPlaying() + { + + } diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_stub.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,37 @@ +/* + * 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: + * The header file for tone fetcher engine private class of other platforms. + * + */ + +#ifndef TONEFETCHERENGINE_STUB_H +#define TONEFETCHERENGINE_STUB_H + +#include + +class ToneFetcherEnginePrivate : public QObject +{ + Q_OBJECT + +public: + ToneFetcherEnginePrivate(); + virtual ~ToneFetcherEnginePrivate(); + void getTones(); + void play( const QString & ); + bool isPlaying(); + void stopPlaying(); +}; + +#endif /* TONEFETCHERENGINE_STUB */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,94 @@ +/* + * 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: + * The source file for tone fetcher engine private class. + * + */ + + +#include "tonefetcherengine_symbian.h" +#include "CToneSelection.h" +#include "CTonePlayer.h" +#include "tonefetcherutils.h" +#include + +ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() + { + TRAP_IGNORE( mToneSelection = CToneSelection::NewL( this ) ); + TRAP_IGNORE( mTonePlayer = CTonePlayer::NewL( this ) ); + } + +ToneFetcherEnginePrivate::~ToneFetcherEnginePrivate() + { + mResultList.clear(); + delete mToneSelection; + delete mTonePlayer; + } + +void ToneFetcherEnginePrivate::getTones() + { + QT_TRAP_THROWING( mToneSelection->QueryTonesL() ); + } + +void ToneFetcherEnginePrivate::play(const QString &file) + { + QT_TRAP_THROWING( mTonePlayer->SetAttrL( XQConversions::qStringToS60Desc( ToneFetcherUtils::normalizeSeperator(file) )->Des() ) ); + QT_TRAP_THROWING( mTonePlayer->PlayL() ); + } + +bool ToneFetcherEnginePrivate::isPlaying() + { + return mTonePlayer->IsPlaying(); + } + +void ToneFetcherEnginePrivate::stopPlaying() + { + mTonePlayer->Stop(); + } + +void ToneFetcherEnginePrivate::HandleMdeSessionError( TInt aError ) + { + emit mdeSessionError( aError ); + } + +void ToneFetcherEnginePrivate::HandleMdeSessionOpened() + { + emit mdeSessionOpened(); + } + +void ToneFetcherEnginePrivate::HandleQueryError( TInt aError ) + { + emit queryError(aError); + } + +void ToneFetcherEnginePrivate::HandleQueryComplete( RPointerArray& aResultArray ) + { + mResultList.clear(); + for ( int i = 0; i < aResultArray.Count(); ++i ) + { + mResultList.append( XQConversions::s60DescToQString( *(aResultArray[i]) ) ); + } + aResultArray.ResetAndDestroy(); + emit queryComplete(mResultList); + } + +void ToneFetcherEnginePrivate::HandleObjectChanged() + { + emit notifyObjectChanged(); + } + +void ToneFetcherEnginePrivate::HandlePreviewEvent( TInt event ) + { + emit notifyPreviewEvent(event); + } diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone fetcher engine private class of symbian platform. + * + */ + +#ifndef TONEFETCHERENGINEPRIVATE_H +#define TONEFETCHERENGINEPRIVATE_H + +//#include +#include "MToneSelectionWatcher.h" +#include "MTonePlayingWatcher.h" +#include +#include + +class CToneSelection; +class CTonePlayer; + +class ToneFetcherEnginePrivate : public QObject, + public MToneSelectionWatcher, + public MTonePlayingWatcher +{ + Q_OBJECT + +public: + ToneFetcherEnginePrivate(); + virtual ~ToneFetcherEnginePrivate(); + void getTones(); + void play( const QString &file ); + bool isPlaying(); + void stopPlaying(); + +public: + //from MToneSelectionWatcher + void HandleMdeSessionError( TInt aError ); + void HandleMdeSessionOpened(); + void HandleQueryError( TInt aError ); + void HandleQueryComplete( RPointerArray& aResultArray ); + void HandleObjectChanged(); + //from MTonePlayingWatcher + void HandlePreviewEvent( TInt event ); + +signals: + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(const QStringList& uriList); + void queryError(int error); + void notifyObjectChanged(); + void notifyPreviewEvent(int event); + +private: + QStringList mResultList; + CToneSelection* mToneSelection; + CTonePlayer* mTonePlayer; +}; +#endif /* TONEFETCHERENGINEPRIVATE_H */ diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,69 @@ +/* + * 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: + * The source file for tone fetcher engine. + * + */ +#include "tonefetcherengine.h" +#ifdef Q_OS_SYMBIAN +#include "tonefetcherengine_symbian.h" +#else +#include "tonefetcherengine_stub.h" +#endif + +ToneFetcherEngine::ToneFetcherEngine(QObject* parent) : QObject(parent) +{ + d = new ToneFetcherEnginePrivate(); + Q_ASSERT(d); + + connect(d, SIGNAL(mdeSessionOpened()), + this, SIGNAL(mdeSessionOpened())); + connect(d, SIGNAL(mdeSessionError(int)), + this, SIGNAL(mdeSessionError(int))); + connect(d, SIGNAL(queryComplete(QStringList)), + this, SIGNAL(queryComplete(QStringList))); + connect(d, SIGNAL(queryError(int)), + this, SIGNAL(queryError(int))); + connect(d, SIGNAL(notifyObjectChanged()), + this, SIGNAL(notifyObjectChanged())); + connect(d, SIGNAL(notifyPreviewEvent(int)), + this, SIGNAL(notifyPreviewEvent(int))); +} + +ToneFetcherEngine::~ToneFetcherEngine() +{ + delete d; +} + +void ToneFetcherEngine::getTones() +{ + d->getTones(); +} + +void ToneFetcherEngine::play(const QString &file) +{ + d->play(file); +} + +bool ToneFetcherEngine::isPlaying() +{ + return d->isPlaying(); +} + +void ToneFetcherEngine::stopPlaying() +{ + d->stopPlaying(); +} + +//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,69 @@ +/* + * 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: + * The header file for tone fetcher engine. + * + */ + +#ifndef TONEFETCHERENGINE_H +#define TONEFETCHERENGINE_H +#include +#include + +class ToneFetcherEnginePrivate; + +// CLASS DECLARATION +/** + * This class is used for interacting with platform based codes + * including fetching tones from MDE (Metadata Engine) and playing tones + * using platform-dependant interface. + * + */ +class ToneFetcherEngine : public QObject +{ + Q_OBJECT + +public: + explicit ToneFetcherEngine( QObject* parent = 0 ); + ~ToneFetcherEngine(); + /* + * search the tone using MDE, not including rom files. + */ + void getTones(); + + /* + * preview the tone + * @param file the absolute path of the file. + */ + void play(const QString &file); + + bool isPlaying(); + + /* + * stop playing + */ + void stopPlaying(); + +signals: + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(const QStringList &uriList); + void queryError(int error); + void notifyPreviewEvent(int event); + void notifyObjectChanged(); + +private: + ToneFetcherEnginePrivate *d; +}; +#endif diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tsrc/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/main.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The main window file for tone service test + * + */ +#include "tonetestapp.h" + +#include +#include + +int main(int argc, char *argv[]) +{ + + QCoreApplication::setOrganizationName("Nokia"); + QCoreApplication::setApplicationName("ToneTestApp"); + + HbApplication app(argc, argv); + HbMainWindow mainWindow; + ToneTestApp *mainView = new ToneTestApp; + mainWindow.addView(mainView); + mainWindow.show(); + return app.exec(); +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tsrc/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/rom/rom.pri Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,29 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# Rom exports for tonetestapp +# + +symbian { + TONETESTAPP_IBY_DIR = $$section(PWD, ":", 1) + + exists(/epoc32/include/platform_paths.hrh) { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } else { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } + + BLD_INF_RULES.prj_exports += "$$TONETESTAPP_IBY_DIR/tonetestapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tonetestapp.iby)" + +} diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tsrc/rom/tonetestapp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/rom/tonetestapp.iby Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __TONETESTAPP_IBY__ +#define __TONETESTAPP_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\tonetestapp.exe SHARED_LIB_DIR\tonetestapp.exe +HB_UPGRADABLE_APP_REG_RSC(tonetestapp) +S60_APP_RESOURCE(tonetestapp) + +#endif + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tsrc/tonetestapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.cpp Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,174 @@ +/* + * 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: + * The source file for tone service test. + * + */ +#include "tonetestapp.h" +#include +#include +#include +#include +#include +#include +#include + +ToneTestApp::ToneTestApp(QGraphicsItem *parent) : + HbView(parent), + mReq(0), + mResultEdit(0), + mErrorCodeEdit(0), + mErrorEdit(0) +{ + qDebug() << "ToneTestApp::ToneTestApp("; + createLayout(); +} + +ToneTestApp::~ToneTestApp() +{ + qDebug() << "ToneTestApp::~ToneTestApp"; + delete mReq; +} + +void ToneTestApp::handleOk(const QVariant &result) +{ + qDebug() << "ToneTestApp::handleOk"; + + if (!result.canConvert()) + { + mErrorEdit->setText("Corrupt result"); + } + else + { + mResultEdit->setText(result.value()); + qDebug() << "ToneTestApp::handleOk" << ": result=" << result.value(); + } + +} + +void ToneTestApp::handleError(int errorCode, const QString& errorMessage) +{ + qDebug() << "ToneTestApp::handleError" << ": errorCode=" << errorCode << ", msg:" << errorMessage; + mErrorEdit->setText(errorMessage); + mErrorCodeEdit->setText(QString::number(errorCode)); +} + +void ToneTestApp::createLayout() +{ + qDebug() << "ToneTestApp::createLayout"; + + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + + if (layout) + { + QGraphicsLinearLayout *topLayout = new QGraphicsLinearLayout(Qt::Vertical); + + if (topLayout) + { + topLayout->addStretch(5); + + mResultEdit = new HbLineEdit; + HbLabel* label = new HbLabel("Result:"); + if (mResultEdit && label) + { + topLayout->addItem(label); + mResultEdit->setMaxRows(5); + topLayout->addItem(mResultEdit); + } + + mErrorCodeEdit = new HbLineEdit; + label = new HbLabel("Error code:"); + if (mErrorCodeEdit && label) + { + topLayout->addItem(label); + topLayout->addItem(mErrorCodeEdit); + } + + mErrorEdit = new HbLineEdit; + label = new HbLabel("Error description:"); + if (mErrorEdit && label) + { + topLayout->addItem(label); + mErrorEdit->setMaxRows(5); + topLayout->addItem(mErrorEdit); + } + + layout->addItem(topLayout); + layout->setStretchFactor(topLayout, 5); + } + + QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout(Qt::Vertical); + + if (bottomLayout) + { + bottomLayout->addStretch(); + HbPushButton* button = new HbPushButton("Fetch tone"); + if (button) + { + connect(button, SIGNAL(clicked()), this, SLOT(fetchTone())); + bottomLayout->addItem(button); + } + layout->addItem(bottomLayout); + } + + setLayout(layout); // Takes ownership of layout + } +} + +void ToneTestApp::fetchTone() +{ + qDebug() << "ToneTestApp::fetchSong START"; + + mResultEdit->setText(""); + mErrorEdit->setText(""); + mErrorCodeEdit->setText(""); + + if (!mReq) + { + mReq = mAppMgr.create("com.nokia.symbian.IToneFetch", "fetch()", true); + // XQServiceRequest snd("com.nokia.services.toneserviceprovider.tone", "queryTone()", true); + // QVariant retValue; + + /* bool res = snd.send(retValue); + if (!res) + { + int returnvalue = snd.latestError(); + mErrorEdit->setText(QString::number(returnvalue)); + // mRetValue->setText("send fail!"); + }*/ + + if (!mReq) + { + mErrorEdit->setText("Failed to create REQ"); + return; + } + else + { + connect(mReq, SIGNAL(requestOk(const QVariant&)), SLOT(handleOk(const QVariant&))); + connect(mReq, SIGNAL(requestError(int,const QString&)), SLOT(handleError(int,const QString&))); + } + } + + // Set arguments for request (application title) + QList args; + args << QVariant(QString("")); + mReq->setArguments(args); + + // Make the request + if (!mReq->send()) + { + mErrorEdit->setText("Failed to send REQ"); + } +} + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tsrc/tonetestapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.h Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone service test. + * + */ +#ifndef TONETESTAPP_H +#define TONETESTAPP_H + +#include +#include + +class XQApplicationManager; +class XQAiwRequest; +class HbLineEdit; + +class ToneTestApp : public HbView +{ + Q_OBJECT + +public: + ToneTestApp(QGraphicsItem *parent=0); + virtual ~ToneTestApp(); + +private slots: + void handleOk(const QVariant &result); + void handleError(int errorCode, const QString& errorMessage); + + void fetchTone(); + +private: + void createLayout(); + +private: + XQApplicationManager mAppMgr; + XQAiwRequest* mReq; + HbLineEdit* mResultEdit; + HbLineEdit* mErrorCodeEdit; + HbLineEdit* mErrorEdit; +}; + +#endif // TONETESTAPP_H diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,35 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = tonetestapp + +CONFIG += hb +LIBS += -lxqservice -lxqserviceutil + + +HEADERS += tonetestapp.h +SOURCES += tonetestapp_reg.rss \ + main.cpp \ + tonetestapp.cpp +RESOURCES += +symbian { + include(rom/rom.pri) + TARGET.UID3 = 0x2002BCC9 + TARGET.CAPABILITY = ALL -TCB + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +} + diff -r 3fec62e6e7fc -r 90fe62538f66 controlpanelui/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/tsrc/tsrc.pro Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS = ../src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/firstpluginforcpcategorymodel \ + ../src/cpcategorymodel/tsrc/testpluginsforcpcategorymodel/secondpluginforcpcategorymodel \ + ../src/cpcategorymodel/tsrc/ut_cppluginconfigreader \ + ../src/cpcategorymodel/tsrc/ut_categorymodelitemdata \ + ../src/cpcategorymodel/tsrc/ut_categorymodelutility \ + ../src/cpcategorymodel/tsrc/ut_cpcategorysettingformmodel \ + ../src/cpprofilewrapper/tsrc/ut_cpprofilemodel + +CONFIG += ordered + diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/group/bld.inf --- a/defaultapplicationsettings/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Build information file for project DefaultApplicationSettings -* -*/ - - -#include - -#include "../services_db/group/bld.inf" -#include "../server/group/bld.inf" -#include "../service/group/bld.inf" -#include "../gsplugin/group/bld.inf" - -PRJ_EXPORTS - -../rom/DefaultApplicationSettings.iby CORE_APP_LAYER_IBY_EXPORT_PATH(defaultapplicationsettings.iby) -../rom/DefaultApplicationSettingsResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(defaultapplicationsettingsresources.iby) - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/data/10281BA0.rss --- a/defaultapplicationsettings/gsplugin/data/10281BA0.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: ECOM Interface definition for project General Settings Plugin -* -*/ - - -#include - -/** -* How to use the resource definition: -* -* IMPLEMENTATION_INFO -* { -* implementation_uid = ; -* version_no = 1; -* display_name = ""; -* default_data = ""; -* opaque_data = ""; -* } -* -* For example plugins wishing to use Apps Plugin as a parent use -* KGSAppsPluginUid (defined in GSFWViewUIDs.h): -* -* default_data = "0x10207239"; - -// Use this UID if plugin belongs to Main view: -const TUid KGSMainViewUid = { 0x1020723B }; - - -// No item is selected in the container's listbox -const TUid KGSNoneSelected = { 0x00000000 }; - -// UIDs used by the sub-view plugins: - -// Use this UID if plugin belongs to General view: -const TUid KGSGenPluginUid = { 0x10207237 }; - -// Use this UID if plugin belongs to Telephony view: -const TUid KGSTelPluginUid = { 0x1020723D }; - -// Use this UID if plugin belongs to Connection view: -const TUid KGSConPluginUid = { 0x10207250 }; - -// Use this UID if plugin belongs to Applications view: -const TUid KGSAppsPluginUid = { 0x10207239 }; - -// Use this UID if plugin belongs to Personalisation view: -const TUid KGSPrslnPluginUid = { 0x10207252 }; - -// Use this UID if plugin belongs to Security view: -const TUid KGSSecurityPluginUid = { 0x1020743A }; - -// Use this UID if plugin belongs to Standby view: -const TUid KGSStandbyPluginUid = { 0x1020743F }; - -* -* Note that position of the plugin is supported only for internally provided -* plugins. Others, such as 3rd party plugins, are sorted according to their -* name and plugin provider category. -* -* Plugin position must follow the postition defined in UI specification. -* Position starts from 0. Use -1 if position is not to be used in sorting. -* -*/ -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x10281BA0; // Plugin dll UID - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10207236; // UID for CGSPluginInterface - do not change. - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10281BA1; // Plugin UID - version_no = 1; - display_name = "DefaultAppSettings Plugin"; - default_data = "0x10207239"; - opaque_data = "0"; // Order number. We are the first - } - }; - } - }; - } - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/data/gsdasplugin_rsc.rss --- a/defaultapplicationsettings/gsplugin/data/gsdasplugin_rsc.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Resource file for project General Settings Plugin -* -*/ - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// RESOURCE IDENTIFIER -NAME DAGS -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf=""; } - -// RESOURCE DEFINITIONS - -//---------------------------------------------------- -// -// r_gs_menubar_change_exit -// Options menu with 'Exit' item. -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_gs_menubar_change_exit - { - titles = - { - MENU_TITLE - { - menu_pane = r_gs_menu_item_exit; - } - }; - } - -//---------------------------------------------------- -// -// r_gs_menu_item_exit -// Options menu item 'Exit'. -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_gs_menu_item_exit - { - items = - { - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - -//---------------------------------------------------- -// -// r_gs_example_view_title -// Packet data view's title. -// -//---------------------------------------------------- -// -RESOURCE TBUF r_gs_defaultapp_caption - { - buf = qtn_da_gsp_caption; - } - -//---------------------------------------------------- -// -// r_gs_defaultapp_view -// Default App plugin view. -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_gs_defaultapp_view - { - menubar = r_gs_menubar_change_exit; - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT; - } - -//End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/group/GSDasPluginIcons.mk --- a/defaultapplicationsettings/gsplugin/group/GSDasPluginIcons.mk Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -# -# Copyright (c) 2005 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: Icons makefile for project Default Application settings -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- -# : Configure these -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\resource\apps -HEADERDIR=\epoc32\include -ICONTARGETFILENAME=$(TARGETDIR)\gsdasplugin.mif -HEADERFILENAME=$(HEADERDIR)\gsdasplugin.mbg - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- -# : Configure these. -# -# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by -# MifConv if the mask detph is defined. -# -# NOTE 2: Usually, source paths should not be included in the bitmap -# definitions. MifConv searches for the icons in all icon directories in a -# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. -# The directory \s60\icons is included in the search only if the feature flag -# __SCALABLE_ICONS is defined. -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 qgn_prop_cp_dev_def.svg - - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/group/bld.inf --- a/defaultapplicationsettings/gsplugin/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2005-2008 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: Build information file for project General Settings Plugin -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// export loc file -../loc/gs_das.loc APP_LAYER_LOC_EXPORT_PATH( gs_das.loc ) - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE gsdasplugin.mif - OPTION HEADERFILE gsdasplugin.mbg - OPTION SOURCES -c8,8 qgn_prop_cp_dev_def -END - - -PRJ_MMPFILES -gsdasplugin.mmp - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/group/gsdasplugin.mmp --- a/defaultapplicationsettings/gsplugin/group/gsdasplugin.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Project definition file for project General Settings Plugin -* -*/ - - -#include -#include - -CAPABILITY CAP_ECOM_PLUGIN -TARGET gsdasplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10281BA0 -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE gs_das_implementationtable.cpp -SOURCE gs_das.cpp -SOURCE gs_das_emptycontainer.cpp - -USERINCLUDE ../inc -USERINCLUDE ../data - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -SOURCEPATH ../data -//ECOM resource definition -START RESOURCE 10281BA0.rss -TARGET gsdasplugin.rsc -END // ECOM resource definition - -//Default App GS plugin resources -START RESOURCE gsdasplugin_rsc.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END // Default App GS plugin resources - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY egul.lib -LIBRARY aknskins.lib -LIBRARY efsrv.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY commonengine.lib//For RConeResourceLoader -LIBRARY gsframework.lib -LIBRARY gsecomplugin.lib -LIBRARY defaultappclient.lib - -LIBRARY apparc.lib -LIBRARY apgrfx.lib - -// End of File - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/inc/gs_das.h --- a/defaultapplicationsettings/gsplugin/inc/gs_das.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements a (minimal) GS Plugin -* -*/ - - - -#ifndef GS_DAS_H -#define GS_DAS_H - -// Includes -#include -#include -#include -#include - -#include -#include "gs_das_emptycontainer.h" -// Classes referenced -class CDefaultAppClient; - -// Constants -/** This is the name of the plugin's resource file */ -_LIT( KDefaultAppGSPluginResourceFileName, "z:gsdasplugin_rsc.rsc" ); - -/** This is the plugin's UID */ -const TUid KDefaultAppGSPluginUid = { 0x10281BA1 }; - -// CLASS DECLARATION - -/** - * This class implements a GS plugin. - * - * This class inplements a GS plugin that acts as a client for the Default App Server, so that it can be - * accessed from the GS application. - * - * @since S60 5.0 - */ -class CDefaultAppGSPlugin : public CGSPluginInterface, public MAknServerAppExitObserver - { - -public: // Constructors and destructor - - /** - * Symbian OS two-phased constructor - * @return - */ - - static CDefaultAppGSPlugin* NewL( TAny* aInitParams ); - - /** - * Destructor. - */ - ~CDefaultAppGSPlugin(); - -public: // From CAknView - - /** - * From CAknView - * Returns the UID of the Plugin (see base class) - * - * @since S60 5.0 - */ - TUid Id() const; - - /** - * From CAknView - * Activates the plugin (see base class) - * - * @since S60 5.0 - * @param aPrevViewId see base class - * @param aCustomMessageId see base class - * @param aCustomMessage see base class - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * Deactivates the Plugin (see base class) - * - * @since S60 5.0 - */ - void DoDeactivate(); - - /** - * From CAknView - * Handles a menu command (see base class) - * - * @since S60 5.0 - * @param aCommand the command to handle - */ - void HandleCommandL( TInt aCommand ); - -public: // From CGSPluginInterface - - /** - * From CGSPluginInterface - * Returns the Plugin Caption (see base class) - * - * @since S60 5.0 - * @param aCaption placeholder for the caption - */ - void GetCaptionL( TDes& aCaption ) const; - - /** - * From CGSPluginInterface - * Returns the plugin's icon (see CGSPluginInterface header file) - * - * @since S60 5.0 - * @param aIconType icon type - */ - CGulIcon* CreateIconL( const TUid aIconType ); - -private: // From MAknServerAppExitObserver - - /** - * From MAknServerAppExitObserver - * Handles server exits - * - * @since S60 5.0 - * @param aReason for the server exit - */ - void HandleServerAppExit ( TInt aReason ); - -private: - - /** - * C++ default constructor. - */ - CDefaultAppGSPlugin(); - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - -private: // Data - - /** - * The Resource Loader - */ - RConeResourceLoader iResources; // Resouce loader. - - /** - * The id of the previous View, to be activated when user pushes Back - */ - TVwsViewId iPrevViewId; - - /** - * Pointer to the Default App Client API class - * Own. - */ - CDefaultAppClient* iClient; - - /** - * Empty Container, used to avoid screen flickering - * Own. - */ - CCEmptyContainer* iEmptyContainer; - }; - -#endif // GS_DAS_H -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/inc/gs_das_emptycontainer.h --- a/defaultapplicationsettings/gsplugin/inc/gs_das_emptycontainer.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements a empty container for gsplugin -* -*/ - - -#ifndef CEMPTYCONTAINER_H -#define CEMPTYCONTAINER_H - -// INCLUDES -#include -#include -#include - -// CLASS DECLARATION - -/** - * CCEmptyContainer - * - */ -class CCEmptyContainer : public CCoeControl - { -public: - // Constructors and destructor - - /** - * Destructor. - */ - ~CCEmptyContainer(); - - /** - * Two-phased constructor. - */ - static CCEmptyContainer* NewL ( const TRect& aRect, const CCoeControl* aParent ); - - /** - * Two-phased constructor. - */ - static CCEmptyContainer* NewLC ( const TRect& aRect, const CCoeControl* aParent ); - -public: - // from base class CCoeControl - TInt CountComponentControls() const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - -private: - - /** - * Constructor for performing 1st stage construction - */ - CCEmptyContainer(); - - /** - * EPOC default constructor for performing 2nd stage construction - */ - void ConstructL ( const TRect& aRect, const CCoeControl* aParent ); - - }; - -#endif // CEMPTYCONTAINER_H diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/loc/gs_das.loc --- a/defaultapplicationsettings/gsplugin/loc/gs_das.loc Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Localization strings for project General Settings Plugin -* -*/ - - -// d:Text of a list item in General Settings application -// d:Item opens the Default Applications settings -// l:list_single_large_graphic_pane_t1 -// r:5.0 -// -#define qtn_da_gsp_caption "Default Applications" - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/src/gs_das.cpp --- a/defaultapplicationsettings/gsplugin/src/gs_das.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements a (minimal) GS Plugin -* -*/ - - -// Includes -#include -#include -#include - -#include // Plugin's own UI resources -#include - -#include "gs_das.h" - -#include - - -// Constants - -#ifdef __SCALABLE_ICONS - // svg file - _LIT( KGSDasPluginIconFileName, "\\resource\\apps\\GSDasPlugin.mif"); -#else - // bitmap - _LIT( KGSDasPluginIconFileName, "\\resource\\apps\\GSDasPlugin.mbm"); -#endif // __SCALABLE_ICONS - - -// ========================= MEMBER FUNCTIONS ================================ - - -// --------------------------------------------------------------------------- -// CDefaultAppGSPlugin::CDefaultAppGSPlugin() -// Constructor -// -// --------------------------------------------------------------------------- -// -CDefaultAppGSPlugin::CDefaultAppGSPlugin( ) - : iResources( *iCoeEnv ), iClient(NULL) - { - - } - -// --------------------------------------------------------------------------- -// CDefaultAppGSPlugin::~CDefaultAppGSPlugin() -// Destructor -// -// --------------------------------------------------------------------------- -// -CDefaultAppGSPlugin::~CDefaultAppGSPlugin() - { - iResources.Close(); - if(iClient) - delete iClient; - if( iEmptyContainer ) - { - AppUi()->RemoveFromViewStack( *this, iEmptyContainer ); - delete iEmptyContainer; - }; - } - -// --------------------------------------------------------------------------- -// CDefaultAppGSPlugin::ConstructL() -// Symbian OS two-phased constructor -// -// --------------------------------------------------------------------------- -// -void CDefaultAppGSPlugin::ConstructL() - { - // Find the resource file: - TParse parse; - parse.Set( KDefaultAppGSPluginResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); - TFileName fileName( parse.FullName() ); - - // Get language of resource file: - BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), fileName ); - - // Open resource file: - iResources.OpenL( fileName ); - - //We can call this after opening the resource file ... - BaseConstructL( R_GS_DEFAULTAPP_VIEW ); - } - -// --------------------------------------------------------------------------- -// CDefaultAppGSPlugin::NewL() -// Static constructor -// -// --------------------------------------------------------------------------- -// -CDefaultAppGSPlugin* CDefaultAppGSPlugin::NewL( TAny* /*aInitParams*/ ) - { - CDefaultAppGSPlugin* self = new( ELeave ) CDefaultAppGSPlugin( ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// ========================= From CAknView ================== - - -// --------------------------------------------------------------------------- -// From class CAknView. -// Returns the UID of the plugin (see base class) -// --------------------------------------------------------------------------- -// -TUid CDefaultAppGSPlugin::Id() const - { - return KDefaultAppGSPluginUid; - } - - -// --------------------------------------------------------------------------- -// From class CAknView. -// Activates the plugin (see base class) -// See das_servmimeapps.h for possible values of the flags (useful for R&D) -// -0x00010000 : -// --------------------------------------------------------------------------- -// -void CDefaultAppGSPlugin::DoActivateL( const TVwsViewId& aPrevViewId, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - iPrevViewId = aPrevViewId; - - TInt flags(0); //See das_servmimeapps.h for possible values of the flags (useful for R&D) - - if( !iClient ) - { - iClient=CDefaultAppClient::NewL(this); - } - - iClient->ChangeDefaultsL( flags ); - - //construct an empty control, so we avoid the screen flickering - if( !iEmptyContainer ) - { - iEmptyContainer = CCEmptyContainer::NewL( ClientRect(),NULL ); - iEmptyContainer->SetMopParent(this); - AppUi()->AddToStackL(*this, iEmptyContainer); - }; - } - - -// --------------------------------------------------------------------------- -// From class CAknView. -// Deactivates the Plugin (see base class) -// --------------------------------------------------------------------------- -// -void CDefaultAppGSPlugin::DoDeactivate() - { - if(iEmptyContainer) - { - AppUi()->RemoveFromViewStack(*this, iEmptyContainer); - delete iEmptyContainer; - iEmptyContainer=NULL; - }; - } - - -// --------------------------------------------------------------------------- -// From class CAknView. -// Handles a menu command (see base class) -// --------------------------------------------------------------------------- -// -void CDefaultAppGSPlugin::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - case EAknSoftkeyBack: - AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); - break; - case EAknCmdExit: - case EEikCmdExit: - AppUi()->RunAppShutter(); - break; - default: - AppUi()->HandleCommandL( aCommand ); //also handles EAknCmdExit - break; - } - } -// ========================= From CGSPluginInterface ================== - - - -// --------------------------------------------------------------------------- -// From class CGSPluginInterface. -// Returns the Plugin Caption (see base class) -// --------------------------------------------------------------------------- -// -void CDefaultAppGSPlugin::GetCaptionL( TDes& aCaption ) const - { - HBufC* result = StringLoader::LoadL( R_GS_DEFAULTAPP_CAPTION ); - aCaption.Copy( *result ); - delete result; - } - -// --------------------------------------------------------------------------- -// From class CGSPluginInterface. -// Return the icon, if has one. -// --------------------------------------------------------------------------- -// -CGulIcon* CDefaultAppGSPlugin::CreateIconL( const TUid aIconType ) - { - //EMbm - CGulIcon* icon; - - if( aIconType == KGSIconTypeLbxItem ) - { - icon = AknsUtils::CreateGulIconL( - AknsUtils::SkinInstance(), - KAknsIIDQgnPropCpDevDef, - KGSDasPluginIconFileName, - EMbmGsdaspluginQgn_prop_cp_dev_def, - EMbmGsdaspluginQgn_prop_cp_dev_def_mask ); - } - else - { - icon = CGSPluginInterface::CreateIconL( aIconType ); - }; - - return icon; - } - -// ========================= From MAknServerAppExitObserver ================== - -// --------------------------------------------------------------------------- -// From class MAknServerAppExitObserver. -// Handles server exits -// --------------------------------------------------------------------------- -// -void CDefaultAppGSPlugin::HandleServerAppExit( TInt aReason) - { - delete iClient; - iClient=NULL; - TRAP_IGNORE(HandleCommandL(aReason));//do not care why it leaved - } - -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/src/gs_das_emptycontainer.cpp --- a/defaultapplicationsettings/gsplugin/src/gs_das_emptycontainer.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements a (minimal) GS Plugin -* -*/ - - -#include "gs_das_emptycontainer.h" - -CCEmptyContainer::CCEmptyContainer() - { - // No implementation required - } - -CCEmptyContainer::~CCEmptyContainer() - { - } - -CCEmptyContainer* CCEmptyContainer::NewLC ( const TRect& aRect, - const CCoeControl* aParent ) - { - CCEmptyContainer* self = new (ELeave) CCEmptyContainer(); - CleanupStack::PushL ( self ); - self->ConstructL( aRect, aParent ); - return self; - } - -CCEmptyContainer* CCEmptyContainer::NewL ( const TRect& aRect, - const CCoeControl* aParent ) - { - CCEmptyContainer* self = CCEmptyContainer::NewLC ( aRect, aParent ); - CleanupStack::Pop(); // self; - return self; - } - -void CCEmptyContainer::ConstructL( const TRect& aRect,const CCoeControl* aParent ) - { - if ( aParent == NULL ) - { - CreateWindowL(); - } - else - { - SetContainerWindowL( *aParent ); - } - SetRect( aRect ); - ActivateL(); - } - -TInt CCEmptyContainer::CountComponentControls() const - { - return 0; - } - -CCoeControl* CCEmptyContainer::ComponentControl ( TInt aIndex ) const - { - switch( aIndex ) - { - - } - return NULL; - } diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/gsplugin/src/gs_das_implementationtable.cpp --- a/defaultapplicationsettings/gsplugin/src/gs_das_implementationtable.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation table -* -*/ - - -// System includes -#include -#include - -// User includes -#include "gs_das.h" -#include - -// Constants -const TImplementationProxy KDASGSPluginImplementationTable[] = - { - // Uid for plugin implementation: - IMPLEMENTATION_PROXY_ENTRY( 0x10281BA1, CDefaultAppGSPlugin::NewL ) - }; - - -// --------------------------------------------------------------------------- -// ImplementationGroupProxy -// Gate/factory function -// -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - TInt error; - if( !CDefaultAppClient::ServiceAvailable(error) ) - { - //there was an error, service not found. - aTableCount=0; - } - else //service was found - aTableCount = sizeof( KDASGSPluginImplementationTable ) - / sizeof( TImplementationProxy ); - - return KDASGSPluginImplementationTable; - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/rom/DefaultApplicationSettings.iby --- a/defaultapplicationsettings/rom/DefaultApplicationSettings.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Image description file for project DefaultApplicationSettings -* -*/ - - - -#ifndef DEFAULTAPPLICATIONSETTINGS_IBY -#define DEFAULTAPPLICATIONSETTINGS_IBY - -#include - -#ifdef RD_DEFAULT_APPLICATION_SETTINGS - -S60_APP_EXE(DefaultAppServer) -S60_APP_AIF_RSC(DefaultAppServer) - -//services_db -file=ABI_DIR\BUILD_DIR\servicesdb.dll SHARED_LIB_DIR\servicesdb.dll - -//client lib -file=ABI_DIR\BUILD_DIR\defaultappclient.dll SHARED_LIB_DIR\defaultappclient.dll - -//gs plugin -ECOM_PLUGIN( gsdasplugin.dll, 10281BA0.rsc ) -data=DATAZ_\BITMAP_DIR\GSDasPlugin.mif BITMAP_DIR\GSDasPlugin.mif - -#endif // RD_DEFAULT_APPLICATION_SETTINGS - -#endif // DEFAULTAPPLICATIONSETTINGS_IBY - -// End of File \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/rom/DefaultApplicationSettingsResources.iby --- a/defaultapplicationsettings/rom/DefaultApplicationSettingsResources.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Image description file for project DefaultApplicationSettings -* -*/ - - - -#ifndef DEFAULTAPPLICATIONSETTINGSRESOURCES_IBY -#define DEFAULTAPPLICATIONSETTINGSRESOURCES_IBY - -#include - -#ifdef RD_DEFAULT_APPLICATION_SETTINGS - -//server -data=DATAZ_\APP_RESOURCE_DIR\defaultappserver.rsc APP_RESOURCE_DIR\defaultappserver.rsc - -//gs plugin -data=DATAZ_\RESOURCE_FILES_DIR\gsdasplugin_rsc.rsc RESOURCE_FILES_DIR\gsdasplugin_rsc.rsc - -#endif // RD_DEFAULT_APPLICATION_SETTINGS - -#endif // DEFAULTAPPLICATIONSETTINGSRESOURCES_IBY - -// End of File \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/data/defaultappserver.rss --- a/defaultapplicationsettings/server/data/defaultappserver.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,460 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Resource definitions for project DefaultApp Server -* -*/ - - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include - -#include //localisable app info -#include - -#include -#include "das_gsentries.rh" -#include "das.hrh" -#include -#include - -NAME DFAP -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf=""; } - - - -// --------------------------------------------------------- -// Define default menu and CBA key. -// --------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - menubar=r_das_menubar; - cba = r_das_softkeys_options_back__change;//R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -// --------------------------------------------------------- -// r_das_menubar -// Menubar for Default App Server -// --------------------------------------------------------- -// -RESOURCE MENU_BAR r_das_menubar - { - titles= - { - MENU_TITLE - { - menu_pane = r_das_menu; - } - }; - } - -// --------------------------------------------------------------------------- -// r_das_menu -// Menu for Options -// --------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_das_menu - { - items= - { - MENU_ITEM - { - flags = EEikMenuItemAction; - command = EAknCmdOpen; - txt = qtn_options_change; - }, - MENU_ITEM - { - command = EAknCmdFindPopupActivated; - txt = qtn_options_find; - }, - MENU_ITEM - { - command = EDasCmdAdvanced; - txt = qtn_options_advanced; - }, - MENU_ITEM - { - cascade = r_das_menu_original_settings; - txt = qtn_da_options_reset; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - -// --------------------------------------------------------------------------- -// r_das_menu_factory_settings -// Sub-menu for Factory settings -// This contains one item, but additional items will be added to it -// --------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_das_menu_original_settings - { - items = - { - MENU_ITEM - { - command = EDasCmdResetSelected; - txt = qtn_da_options_reset_selected; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EDasCmdResetAll; - txt = qtn_da_options_reset_all; - } - }; - } - -// --------------------------------------------------------------------------- -// r_das_servicesmimes_listbox -// Listbox for the Services & MIMEs -// --------------------------------------------------------------------------- -// -RESOURCE LISTBOX r_das_servicesmimes_listbox - { - flags = EAknListBoxSelectionList; - } - -// --------------------------------------------------------------------------- -// r_da_title_app -// Application title -// --------------------------------------------------------------------------- -// -RESOURCE TBUF r_da_title_app - { - buf = qtn_da_title_app; - } - -// --------------------------------------------------------------------------- -// r_da_title_main -// Main view title -// --------------------------------------------------------------------------- -// -RESOURCE TBUF r_da_title_main - { - buf = qtn_da_title_main; - } - -// --------------------------------------------------------------------------- -// r_da_title_popup_adv -// Advanced settings -// --------------------------------------------------------------------------- -// -RESOURCE TBUF r_da_title_advanced - { - buf = qtn_da_title_advanced; - } - - - - -// resources for the simplified view - - -// --------------------------------------------------------------------------- -// r_da_tasks -// This is the list of tasks. For each task, there are 3 items: -// -the task name (this will be shown in the list) -// -the MIME label (the selected default application for the task will be set as default for Open and this MIME) -// -a list of Services & MIMEs that belong to the task: all applications that can handle at least one Service & MIME -// from the list, may become defaults for the task (however, only for the Services & MIMEs the application supports). -// --------------------------------------------------------------------------- -// -RESOURCE DAS_GS_TASKS r_da_tasks - { - tasks= - { - DAS_GS_TASK_ENTRY - { - task_name = qtn_da_main_browse; - //USE_TASK_TITLE - task_title = qtn_da_title_popup_browse; - - mime_label = "application/x-web-browse"; - service_mimes = - { - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "text/html"; } - }; - }, //browse web task - DAS_GS_TASK_ENTRY - { - task_name = qtn_da_main_play_music; - // - task_title = qtn_da_title_popup_music; - - mime_label = "application/x-audio-play"; - service_mimes = - { - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/mp3"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/mpeg"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-mp3"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/mpegurl"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-mpegurl"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/3gpp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/3gpp2"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/mp4"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/aac"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/basic"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/amr"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/amr-wb"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/awb"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-amr"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-epoc-wve"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-sibo-wve"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/wav"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-wav"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-au"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/au"; }, - // SERIES 60 MIDI - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-midi"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/midi"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/sp-midi"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-beatnik-rmf"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-rmf"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/rmf"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/mobile-xmf"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/vnd.nokia.mobile-xmf"; }, - //qcelp - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/qcelp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/vnd.qcelp"; }, - //wma - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-ms-wma"; } - //real audio (probably with system priority in the system) - /* - * Real Audio is commented out because leaving it here would be confusing for users: - * If Real Audio is uncommented below, both Music Player and RealPlayer will be listed - * as handling music. However, the Music Player can not handle the Real Audio MIMEs - * (it can handle most of the MIMEs above this comment). The RealPlayer can only handle - * the RealAudio MIMEs (commented here). So there is no overlapping between the 2 players. - * This would mean that whatever the client choses as the default player between these 2, - * they will still continue to play media as before. E.g. all mp3s, WMAs, AACs will be - * played with the MediaPlayer even if RealPlayer is chosed as default audio player. - * - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/vnd.rn-realaudio"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-pn-realaudio-plugin"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "audio/x-pn-realaudio"; } - */ - }; - }, //play music task - DAS_GS_TASK_ENTRY - { - task_name = qtn_da_main_play_videos; - //USE_TASK_TITLE - task_title = qtn_da_title_popup_video; - - mime_label = "application/x-video-play"; - service_mimes = - { - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "video/3gpp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "video/3gpp2"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "video/mpeg4"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "video/mp4"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "application/sdp"; }, - //following MIMEs are probably system priority in the platform player - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "video/vnd.rn-realvideo"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "application/vnd.rn-realmedia"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "application/x-pn-realmedia"; } - }; - }, //play videos task - DAS_GS_TASK_ENTRY - { - task_name = qtn_da_main_view_images; - //USE_TASK_TITLE - task_title = qtn_da_title_popup_image; - - mime_label = "application/x-image-view"; - service_mimes = - { - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/jpeg"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/jpg"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/jp2"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/tiff"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-wmf"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/ico"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/gif"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/bmp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-bmp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-bitmap"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-xbitmap"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-win-bitmap"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-windows-bmp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/ms-bmp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-ms-bmp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/vnd.wap.wbmp"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/png"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-epoc-mbm"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/vnd.nokia.ota-bitmap"; }, - DAS_SERVICE_MIME - { service_uid = 0x10208DCA; mime = "image/x-ota-bitmap"; } - }; - } //view images task - }; //tasks - } - - -// --------------------------------------------------------------------------- -// r_defaultappserver_localisable_app_info -// Localisable app info -// --------------------------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_defaultappserver_localisable_app_info - { - short_caption = qtn_da_title_app; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_da_title_app; - }; - } - -RESOURCE CBA r_das_softkeys_options_back__change - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;}, - CBA_BUTTON {id=EAknCmdOpen; txt=qtn_msk_change;} - }; - } - -RESOURCE DIALOG r_das_dlg - { - flags = EAknDialogSelectionList | EEikDialogFlagNotifyEsc; - - buttons = r_das_softkeys_options_back__change; - items = - { - DLG_LINE - { - type = EAknCtDoubleListBox; - - id = ESelectionListControl; - control = LISTBOX - { - flags = EAknListBoxSelectionList; - }; - }, - DLG_LINE - { - itemflags = EEikDlgItemNonFocusing; - id = EFindControl; - type = EAknCtSelectionListPopupFind; - } - }; - } - -// --------------------------------------------------------------------------- -// r_da_services_mime -// This resource stores localized strings for the supported services, identified -// by their Uid and generic name. -// This resource is defined in the services_db.rh file -// --------------------------------------------------------------------------- -// -RESOURCE DAS_SERVICES r_da_service_mime - { - services = - { - DAS_SERVICE_ENTRY - { - service_uid = 0x10208DCA; //KOpenServiceUid - service_name = "Open"; - service_localized_name = qtn_da_service_open; - } - }; - } - - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/data/defaultappserver_reg.rss --- a/defaultapplicationsettings/server/data/defaultappserver_reg.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Registration resource file for Default App Server -* -*/ - - - -// INCLUDES - -#include -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x10281B9C //server app UID - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// APP_REGISTRATION_INFO -// Registration resource for Default App Server -// -// ----------------------------------------------------------------------------- -// -RESOURCE APP_REGISTRATION_INFO - { - app_file = "defaultappserver"; - embeddability = KAppEmbeddable; - hidden = KAppIsHidden; - newfile=KAppDoesNotSupportNewFile; - localisable_resource_file = APP_RESOURCE_DIR"\\defaultappserver"; - localisable_resource_id = R_DEFAULTAPPSERVER_LOCALISABLE_APP_INFO; - service_list = - { - SERVICE_INFO { uid = 0x10281B9D; } - }; - } -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/group/bld.inf --- a/defaultapplicationsettings/server/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Build information file for project Default App Server -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// export loc file -../loc/defaultappserver.loc APP_LAYER_LOC_EXPORT_PATH( defaultappserver.loc ) -../loc/services_db.loc APP_LAYER_LOC_EXPORT_PATH( services_db.loc ) - -PRJ_MMPFILES -das_server.mmp - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/group/das_server.mmp --- a/defaultapplicationsettings/server/group/das_server.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Project definition file for project Default App Server -* -*/ - - - -#include -#include - -TARGET defaultappserver.exe -TARGETTYPE EXE -UID 0 0x10281B9C - -CAPABILITY WriteDeviceData SwEvent -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE das.cpp //entry point -SOURCE das_app.cpp //Application class -SOURCE das_doc.cpp //Document class -SOURCE das_appui.cpp //AppUi class -SOURCE das_srvmime_dlg.cpp //dlg class: services & MIMEs -SOURCE das_view.cpp //standard view class, rather empty -SOURCE das_server.cpp //server class -SOURCE das_service.cpp //service class -SOURCE das_servmimeapps.cpp //engine class - -USERINCLUDE ../inc - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE - -START RESOURCE ../data/defaultappserver.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END // RESOURCE - -START RESOURCE ../data/defaultappserver_reg.rss -DEPENDS defaultappserver.rsg -TARGETPATH /private/10003a3f/apps -END - - - - -LIBRARY euser.lib -LIBRARY apparc.lib //is this needed?? -LIBRARY apgrfx.lib -LIBRARY apmime.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY eikdlg.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib //StringLoader -LIBRARY serviceregistry.lib - -LIBRARY aknskins.lib -LIBRARY egul.lib -LIBRARY aknlayout2scalable.lib -LIBRARY aknicon.lib -LIBRARY hlplch.lib // for "Help" options menu -LIBRARY featmgr.lib - -LIBRARY servicesdb.lib diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das.hlp.hrh --- a/defaultapplicationsettings/server/inc/das.hlp.hrh Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Help IDs for project Default App Server -* -*/ - - -#ifndef DAS_HLP_HRH -#define DAS_HLP_HRH - - -_LIT(KDA_HLP_MAIN,"DA_HLP_MAIN"); //GS client, simplified view -_LIT(KDA_HLP_ADVANCED,"DA_HLP_ADVANCED"); //GS client, advanced view -_LIT(KDA_HLP_APPLICATION,"DA_HLP_APPLICATION"); //other client - -#endif // DAS_HLP_HRH - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das.hrh --- a/defaultapplicationsettings/server/inc/das.hrh Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Resource headers for project Default App Server -* -*/ - - -#ifndef DAS_HRH -#define DAS_HRH - -// DefaultApp enumerate command codes -enum TDefaultAppCommands - { - EDasCmdAdvanced=100, - EDasCmdResetAll, - EDasCmdResetSelected - }; - -#endif // DAS_HRH diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_app.h --- a/defaultapplicationsettings/server/inc/das_app.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This class implements the application. -* -*/ - - - -#ifndef C_DEFAULTAPPAPPLICATION_H -#define C_DEFAULTAPPAPPLICATION_H - -#include - -class CDefaultAppDocument; -class CDefaultAppServer; - -/** UID for the application; this should correspond to the uid defined in the mmp file */ -const TUid KUidDefaultAppServer = { 0x10281B9C }; - -/** - * This class implements the application. - * - * @since Series 60 v5.0 - */ -class CDefaultAppApplication : public CAknApplication - { -private: // Functions from base classes - - /** - * From CApaApplication. - * Returns application's UID (KUidDefaultAppServer). - * - * @since S60 v5.0 - * @return The value of KUidDefaultAppServer. - */ - TUid AppDllUid() const; - - /** - * From CApaApplication. - * Creates CDefaultAppDocument document object. - * - * @since S60 v5.0 - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication. - * Creates a new server object (CDefaultAppServer). - * - * @since S60 v5.0 - * @param aAppServer pointer to the newly created server object - */ - void NewAppServerL(CApaAppServer*& aAppServer); - -public: - /** - * C++ default constructor. - */ - CDefaultAppApplication(void); - -public: //data - /** - * Pointer to the documet class - * Not owned. - */ - CDefaultAppDocument* iDocument; //not owned - - /** - * Pointer to the server class - * Not owned. - */ - CDefaultAppServer* iServer; //not owned - }; - -#endif // C_DEFAULTAPPAPPLICATION_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_appui.h --- a/defaultapplicationsettings/server/inc/das_appui.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This class implements the AppUi -* -*/ - - - -#ifndef C_DEFAULTAPPAPPUI_H -#define C_DEFAULTAPPAPPUI_H - - -#include -#include - -class CDefaultAppSrvMimeDlg; -class CDefaultAppView; -class CDefaultAppServMimeApps; - - - -/** - * This class implements the AppUi. - * - * @since Series 60 v5.0 - */ -class CDefaultAppAppUi : public CAknAppUi - { -public: - - /** - * Destructor. - */ - virtual ~CDefaultAppAppUi(); - - /** - * C++ default constructor. - */ - CDefaultAppAppUi(); - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - - /** - * This function completes the construction of the AppUi. This function is called after the client - * has connected to this server instance, and all the necessary data for this construction step is - * available. - * - * @since S60 v5.0 - * @param aClientUid The Uid of the client - * @param aServiceFlags various flags that may alter what data is displayed to the user - */ - void ConstructSrvMimeDlgL(TUid aClientUid, TInt aServiceFlags); - - /* - * This functino is used to record the exist of the dialog; - */ - void SetDialogExist( TBool aExist ); - -public: // from CAknAppUi - - /** - * From CAknAppUi. - * Handles commands from the menu (see base class) - * - * @since S60 v5.0 - * @param aCommand the command being handled - */ - void HandleCommandL(TInt aCommand); - - /** - * From CAknAppUi. - * Handles layout changes (e.g. from portrait to landscape) - * - * @since S60 v5.0 - * @param aType The type of resources that have changed - */ - void HandleResourceChangeL(TInt aType); - - /** - * Handles Window Server events (we are interested in catching the end key event - * and exiting the application - * - * @since S60 v5.0 - * @param aEvent The event that occurred - * @param aDestination The control associated with the event - */ - void HandleWsEventL(const TWsEvent & aEvent, CCoeControl * aDestination); - - -private: - - /** - * Imports and displays the icon of the client application. - * - * @since S60 v5.0 - */ - void SetClientIconL(TUid aClietAppUid); - -public: - - /** - * Pointer to the View - * Own. - */ - CDefaultAppView *iView; - - /** - * Pointer to the dialog - * Own. - */ - CDefaultAppSrvMimeDlg *iDlg; - - /** - * Pointer to the "engine". The engine is a place where application data is retrieved and stored. - * Own. - */ - CDefaultAppServMimeApps *iServMimeApps; - - /** - * variable used to remember the list selection position when reloading the dialog - * for the simplified view - * Own. - */ - TInt iSelectedItemSimple; - - /** - * variable used to remember the list selection position when reloading the dialog - * for the advanced view - * Own. - */ - TInt iSelectedItemAdvanced; - - /** - * variable used to remember dialog type (simple/advanced) when reloading the dialog - * Own. - */ - TBool iReloadDlgAdvanced; - - /** - * variable used to specify if the dialog is reloaded - * Own. - */ - TBool iReloadDlg; - - /** - * specifies if the dialog is dismissed or reloaded - * Own. - */ - TBool iExitBack; - - TUid iClientUid; - -private: - // This is used to record the exist of the dialogue. - TBool iDialogExist; - }; -#endif // C_DEFAULTAPPAPPUI_H - -//end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_doc.h --- a/defaultapplicationsettings/server/inc/das_doc.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This class implements the application document. -* -*/ - - - -#ifndef C_DEFAULTAPPDOC_H -#define C_DEFAULTAPPDOC_H - -#include - -class CDefaultAppAppUi; - -/** - * This class implements the application document. - * - * @since Series 60 v5.0 - */ -class CDefaultAppDocument : public CAknDocument - { -public: - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppDocument* NewL(CEikApplication& aApp); - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppDocument* NewLC(CEikApplication& aApp); - -// from base class CAknDocument - /** - * From CAknDocument. - * Function to create the AppUi. - * - * @since S60 v5.0 - * @return the created AppUi instance - */ - CEikAppUi* CreateAppUiL(); - -private: - - /** - * C++ default constructor. - */ - CDefaultAppDocument(CEikApplication& aApp); -public: - /** - * Pointer to the AppUi - * Not owned - */ - CDefaultAppAppUi* iDefaultAppUi; //not owned - }; - -#endif // C_DEFAULTAPPDOC_H - -// End of File \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_gsentries.rh --- a/defaultapplicationsettings/server/inc/das_gsentries.rh Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Resource headers for project das_server -* -*/ - - -#ifndef DAS_GSENTRIES_RH -#define DAS_GSENTRIES_RH - -// --------------------------------------------------------------------------- -// New structure to describe a Service & MIME pair -// --------------------------------------------------------------------------- -// -STRUCT DAS_SERVICE_MIME - { - LONG service_uid; - LTEXT8 mime; - } - -// --------------------------------------------------------------------------- -// New structure to describe a Task. -// A Task has a name, a MIME label and a list of associated Service & MIMEs pairs. -// --------------------------------------------------------------------------- -// -STRUCT DAS_GS_TASK_ENTRY - { - LTEXT task_name; - - //task title - LTEXT task_title; - - // The main service and MIME give the default application for the task. - // The default application for the task is registered as default for the main MIME and Service - // The default application for the task does not necessarily have to support the main MIME and Service - // () - LTEXT8 mime_label; - - //other pairs that - STRUCT service_mimes[]; //Type is DAS_SERVICE_MIME - } - -// --------------------------------------------------------------------------- -// New structure to describe a list of Tasks -// --------------------------------------------------------------------------- -// -STRUCT DAS_GS_TASKS - { - STRUCT tasks[]; //Type is DAS_GS_TASK_ENTRY - } - -#endif // DAS_GSENTRIES_RH diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_server.h --- a/defaultapplicationsettings/server/inc/das_server.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: The Default Application server class -* -*/ - - - -#ifndef C_DEFAULTAPPSERVER_H -#define C_DEFAULTAPPSERVER_H - -#include - -class CDefaultAppApplication; - -/** - * This is the main implemetation of DefaultApp server. - * - * @since Series 60 v5.0 - */ -class CDefaultAppServer: public CAknAppServer - { -public: // Constructors and destructor - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppServer* NewL(CDefaultAppApplication *aApp); - -// from base class CAknAppServer - - /** - * From CAknAppServer - * Creates a service for the specified service Uid - * - * @since S60 v5.0 - * @param aServiceType the service type Uid - * @return the created service - */ - CApaAppServiceBase* CreateServiceL(TUid aServiceType) const; - -private: - - /** - * C++ default constructor. - */ - CDefaultAppServer(CDefaultAppApplication *aApp); - -public: - /** - * pointer to the application. After the client connects, the server side needs to announce the AppUi class, to - * continue the construction - * Not owned. - */ - CDefaultAppApplication* iApp; //Not owned - }; - -#endif // C_DEFAULTAPPSERVER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_service.h --- a/defaultapplicationsettings/server/inc/das_service.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: The Default App Service implementation (server-side) -* -*/ - - - -#ifndef C_DEFAULTAPPSERVICE_H -#define C_DEFAULTAPPSERVICE_H - -#include - -class CDefaultAppServer; - -/** - * This class implements the Default Application server-side service. - * - * @since Series 60 v5.0 - */ -class CDefaultAppService : public CAknAppServiceBase - { -public: - enum TIpcMessageIds - { - ESetDefaultAll = RApaAppServiceBase::KServiceCmdBase - }; - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppService* NewL(const CDefaultAppServer* aServer); - - /** - * Destructor. - */ - virtual ~CDefaultAppService(); - -public: // from base class CAknAppServiceBase - - /** - * From CAknAppServiceBase. - * function called when a new message is received - * - * @since S60 v5.0 - * @param aMessage the received service message - */ - void ServiceL(const RMessage2& aMessage); - - /** - * From CAknAppServiceBase. - * function called to check client credentials. Used to retrieve client app UID - * - * @since S60 v5.0 - * @param aMsg the message being received - */ - CPolicyServer::TCustomResult SecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing); - -private: //construction - - /** - * C++ constructor. - */ - CDefaultAppService(const CDefaultAppServer* aServer); - - /** - * Sets default for all the Service & MIME pairs supported by the client - * - * @since S60 v5.0 - * @param aMessage the received service message - */ - void HandleSetDefaultAllL(const RMessage2& aMessage); - - /** - * Function where most of the processing happens. - * We use it so that the service request from the client returns immediately - * - * @since S60 v5.0 - * @param aInstance a pointer to the calling CDefaultAppService instance - */ - static TInt IdleWorker(TAny *aInstance); - -public: - /** - * The Uid of the client application - */ - TUid iClientUid; - - /** - * Service flags requested by the client - */ - TInt iServiceFlags; - - /** - * pointer to the server - * Not owned. - */ - const CDefaultAppServer* iDefaultAppServer; //not owned - - /** - * Active Object where most of the processing happens. We use it so that the service - * call returns immediately. - * Owned. - */ - CIdle *iIdle; - }; - -#endif // C_DEFAULTAPPSERVICE_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_servmimeapps.h --- a/defaultapplicationsettings/server/inc/das_servmimeapps.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,533 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Keeps info about Services, MIMEs and Applications -* -*/ - - - -#ifndef C_DEFAULTAPPSERVMIMEAPPS_H -#define C_DEFAULTAPPSERVMIMEAPPS_H - -class CApaMaskedBitmap; -class CDefaultAppServMimeApps; -class CServicesDB; -class RApaLsSession; - -/** The UID of the General Settings Application */ -const TUid KUidGS = { 0x100058EC }; //we define this here because we use it in several places - -/** - * Helper class: stores an Application name, its UID and some other info (how many - * service&MIMEs pair it supports, is it platform application or not) - * This helper class is used to sort the list of Applications that support a Service&MIME pair - * - * @since S60 v5.0 - */ -class CAppHelper : public CBase - { -public: - /** flags used with the app helper. */ - enum - { - EFlagPlatformApp =0x0001, - EFlagNameNotOwned =0x0002 - }; -public: - - /** - * Destructor. - */ - ~CAppHelper(); - - /** - * Symbian OS two-phased constructor - * @return - */ - static CAppHelper* NewLC(const TDesC& aName, const TInt aUid); - - /** - * Symbian OS two-phased constructor - * @return - */ - static CAppHelper* NewLC(const CAppHelper& aApp); - - /** - * This function is used for ordering an array of CAppHelper objects - * - * @since S60 v5.0 - * @param a1 CAppHelper object - * @param a2 CAppHelper object - */ - static TInt OrderApplications(const CAppHelper& a1, const CAppHelper& a2); -private: - - /** - * C++ constructor - */ - CAppHelper(const TInt aUid, const TInt aScore, const TInt aFlags=0); -public: - - /** - * the App name - * Owned or Not Owned, depending on flags (iFlag&EFlagNameNotOwned). - */ - HBufC* iName; - - /** - * the UID of the application - */ - TInt iUid; - - /** - * the application score (how many Services & MIMEs it supports) - */ - TInt iScore; - - /** - * Object flags - */ - TInt iFlags; - }; - -/** - * Helper class: stores a Service & Mime Pair - * - * This class stores data specific to a Service & MIME pair: - * -the Service + MIME string - * -the Service Uid - * -the MIME - * -a list of applications (CAppHelper) that support this Service & MIME pair - * -the list index and Uid of the default application for this Service & MIME pair - * - * @since S60 v5.0 - */ -class CServiceMime : public CBase - { - friend class CDefaultAppServMimeApps; -public: - - /** - * C++ constructor - */ - CServiceMime(); - - /** - * Destructor. - */ - ~CServiceMime(); - - /** - * This function is used for ordering an array of CServiceMime objects - * - * @since S60 v5.0 - * @param a1 CServiceMime object - * @param a2 CServiceMime object - */ - static TInt OrderServiceMimes(const CServiceMime& a1, const CServiceMime& a2); - -private: - /** - * String that contains the localized Service + MIME name - * Owned. - */ - HBufC *iServiceMime; - - /** - * The Uid of the service - */ - TUid iServiceUid; - - /** - * the MIME string - * Owned. - */ - HBufC8 *iMime; - - /** - * list of applications that support this Service & MIME pair - * Owned (members of the array). - */ - RPointerArray iApplications; - - /** - * the UID of the default application for this Service & MIME - */ - TUid iDefaultAppUid; - - /** - * the list index for the default application - * this has the following special values: - * -1 : the default is (yet) unknown - * -2 : there is a single app in the list, its priority is System - * (this means: do not add other apps unless they have system priority) - * -3 : there are more than one applications in the list, ALL have the System priority - * (this also means: do not add other apps unless they have system priority) - */ - TInt iDefaultApp; - - /** - * indicates if the Service & MIME pair instance is used by a task or not - */ - TBool iUsedByTasks; - }; - - -/** - * Helper class: stores a Task - * - * This class stores data specific to a Task: - * -the task caption/title (list layout and title layout) - * -the lists of Service (UIDs) & MIMEs associated with this task - * -the MIME label - * -a list of Services & MIMEs objects (and their associated application list) that correspond to the list - * of Services & MIMEs associated with the task - * -a list of applications (CAppHelper) that are associated with this task - * -the UID and list index of the default application for the task, in the list(s) above. - * - * How this works: - * The Service & MIME pairs associated with the task are those pairs for which changing the default application for the - * task will have an impact: the new default becomes the default application for all these pairs, if applicable. - * The list of candidate default applications is build from the Service & MIME pairs associated with the task: any - * application that can handle at least one pair, is added to the list. The score corresponds to the number of pairs an - * application is able to handle (the better the score, the more suitable the application is for the task). - * When a new application is made default, it is also made default for Open + the MIME label. This way we can retrieve - * the default application for the task, to display it to the user. - * The list of Services & MIME objects are instances of CServiceMime that correspond to the list of Services & MIMEs that - * are associated with the task (the associated Services & MIMEs is a "theoretical" list, while the CServiceMime list - * is a list of Services & MIMEs that were found in the system. The Services & MIMEs in this object list is a subset of - * the associated Services & MIMEs. The reunion of all Applications lists associated with each CServiceMime object in the - * list is going to be same as the list of Applications that are associated with the Task. - * When a new default application is selected for the task, this new default is saved in 2 ways: - * -the new default application is made default for the Open service and the MIME label. This way, we can retrieve next - * time the default application for the task. There is no danger to launch this default for opening the MIME label, since - * no application is supposed to support the MIME label. - * -the new default application is made default for all the Services & MIMEs associated with the task: for each instance - * of CServiceMime in the list, the default is looked in the application list of the object: if it is found (which means - * that the new default application supports that Service & MIME), then the new task default is made default for the - * current Service & MIME too. - * - * @since S60 v5.0 - */ -class CMediaTask : public CBase - { - friend class CDefaultAppServMimeApps; -public: - - /** - * Symbian OS two-phased constructor - * @return - */ - static CMediaTask* NewLC( TResourceReader& aReader ); - - /** - * Destructor. - */ - ~CMediaTask(); -private: - - /** - * C++ constructor - */ - CMediaTask(); - - /** - * Symbian constructor - */ - void ConstructL( TResourceReader& aReader ); -private: - /** - * Task caption, list layout - * Owned. - */ - HBufC *iTaskList; - - /** - * Task caption, title layout - * Owned. - */ - HBufC *iTaskTitle; - - /** - * List of MIMEs associated with the task - * Owned (members of the array). - */ - RPointerArray iMimes; - - /** - * List of services associated with the task (1 to 1 correspondence with iMimes, they form pairs together) - */ - RArray iServicesUids; - - /** - * the MIME label - * Owned. - */ - HBufC8 *iMimeLabel; - - /** - * the list of real/discovered CServiceMime associated with the task - * Not Owned (members of the array). - */ - RPointerArray iSMs; //not owned - - /** - * Application captions for the applications associated with the task - * Owned (members of the array). - * Application names NOT owned (names are owned by CServiceMime objects) - */ - RPointerArray iApplications; - - /** - * The UID of the default application for the task - */ - TUid iDefaultAppUid; //the Uid for the default application - - /** - * the index (in the application list) of the default application for the task - */ - TInt iDefaultApp; //index - - }; - - -/** - * Engine class for the application - * - * This class stores a list of Services and MIMEs and it may store a list of Tasks. All data handling operations - * are implemented in this class. - * There are 2 types of clients for the Default App Server: - * 1. General Settings Application (using a plugin). For this type of client we have to display first a list of tasks, - * and if the user switches to the advanced view, we have to display a list of all Services & MIMEs in the system - * for which the user can change the default application. - * 2. Normal applications may also be clients for the Default APp Server. For normal applications, only a list of Services - * and MIMEs for which the cliet application is a default candidate is displayed. The task list is not constructed. - * When the class is instantiated, it looks in the system (AppArc) and it builds all the data structures it needs. After - * that, it can populate various lists for displaying them to the user, and can also change the default application, as - * instructed by the user (AppUi calls the functions). - * - * @since S60 v5.0 - */ -class CDefaultAppServMimeApps : public CBase - { -public: - /** flags used with the Set Default service. They influence what data is stored in the data structures. */ - enum - { - EFlagNoObserver=1, - //R&D values - EFlagShowAllServicesAndMimes = 0x00010000, - EFlagGsClient = 0x00020000, - }; - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppServMimeApps* NewL(const TUid& aAppUid, TInt aServiceFlags); - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppServMimeApps* NewLC(const TUid& aAppUid, TInt aServiceFlags); - - /** - * Destructor. - */ - virtual ~CDefaultAppServMimeApps(); - - /** - * This function fills with entries a data structure used by a List Box to display Services & MIMEs or Tasks - * - * @since S60 v5.0 - * @param aServicesAndMimes the container for the list entries - */ - void GetServicesAndMimesListL(CDesCArray& aServicesAndMimesArray); - - /** - * This function fills a Popup-list data structure with applications specific to the selected Service & MIME or Task - * - * @since S60 v5.0 - * @param aIndex the index of the selected Service & MIME pair or Task - * @param aApplicationsArray the container for the list entries - * @param aTitle a container for the title of the list (also filled by the function) - */ - void GetApplicationsListL(TInt aIndex, CDesCArray& aApplicationsArray, HBufC*& aTitle); - - /** - * This function sets a new default, for a Service & MIME pair or for a Task. - * The function also updates the list of Services & MIMEs (or Tasks), to display the new default application - * - * @since S60 v5.0 - * @param aServiceAndMimeIndex the index of the selected Service or Mime (or Task) - * @param aDefaultAppIndex the index of the new default application - * @param aServicesAndMimesArray the container for the list entries (to be updated) - */ - void UpdateDefaultL(TInt aServiceAndMimeIndex, TInt aDefaultAppIndex, CDesCArray *aServicesAndMimesArray); - - /** - * This function resets (removes) the defaults associated with a certain task, - * or it can remove all the defaults - * - * @since S60 v5.0 - * @param aCathegory specifies the task index for which the function should reset - * the default, or -1 if all defaults should be reset - * @return 0 or error code (KErrArgument -> aCathegory has an invalid value) - */ - TInt RestoreFactorySettingsL(TInt aCathegory); - -private: //construction - - /** - * C++ constructor - */ - CDefaultAppServMimeApps(); - - /** - * This function builds the info database behind this class. - * For all available services in the resources it creats the corresponding - * Services & MIMEs (or Tasks) instances. - * - * @since S60 v5.0 - * @param aAppUid the Uid of the client application - * @param aServiceFlags different service flags requested by the client - */ - void ConstructL(TUid aAppUid, TInt aServiceFlags); - - /** - * This function builds part the info database behind this class. - * It creates the Services & MIMEs (or Tasks) instances for the given service - * - * @since S60 v5.0 - * @param aServiceUid the Uid of the current service - * @param aServiceIndex the index of the current service - * @param aServiceFlags different service flags requested by the client - * @param aServicesDb pointer to an instance that holds localized service names - */ - void AddMIMEsForServiceL(TUid aServiceUid, TInt aServiceIndex, TInt aServiceFlags, CServicesDB* aServicesDb); - - /** - * This function sorts the Services & MIMEs and their applications. - * It also sorts the Serivces & MIMEs associated with tasks - * - * @since S60 v5.0 - */ - void BeautifyAndSortServMimeApps(void); - - /** - * This function reads from the resource file the list of tasks (and associated data). - * This function is used during construction - * - * @since S60 v5.0 - * @param aResourceId the resource id corresponding to the tasks resource - */ - void GetTaskListL( TInt aResourceId ); - - /** - * This function adds a new Application to a list of an Service & Mime object. - * - * @since S60 v5.0 - * @param aServMime the Service & Mime object - * @param aAppUid the uid of the inserted application - * @param aPrio the priority of the inserted application for the Service & MIME of the host object - * @param aLs pointer to a RApaLsSession object (so we do not need to create a new connection) - */ - void InsertApplicationL(CServiceMime& aServMime, const TUid& aAppUid, const TDataTypePriority& aPrio, const RApaLsSession *aLs); - - /** - * This function takes a task and a Service & MIME object. It checks all the applications that support the given - * Service & MIME object (from its list). If an application is not in the task's application list, this function adds - * it there, with a score of 1. If the application is already in the list, then its score is incremented. - * The Service & MIME object is also marked as being used by a task. - * - * @since S60 v5.0 - * @param aTask the selected task - * @param aServMime the selected Service & MIME object - */ - void PopulateTaskWithApplicationsL(CMediaTask& aTask, CServiceMime* aServMime); - - /** - * This function creates a string that will become en element of a list box. To create the string, the function - * concatenates several sub-strings. - * - * @since S60 v5.0 - * @param aServMime the selected Service & MIME object - * @param aInsertDefaultApp if TRUE, creates an object that also contains the name of the default application for the - * Service & MIME pair - * @return the created string - */ - HBufC* GetServiceAndMimeStringLC(CServiceMime& aServMime, TBool aInsertDefaultApp) const; - - /** - * This function creates a string that will become en element of a list box. To create the string, the function - * concatenates several sub-strings. - * - * @since S60 v5.0 - * @param aMediaTask the selected Task object - * @param aInsertDefaultApp if TRUE, creates an object that also contains the name of the default application for the - * Service & MIME pair - * @return the created string - */ - HBufC* GetMediaTaskStringLC(CMediaTask& aMediaTask, TBool aInsertDefaultApp) const; - -private: //data - - /** - * The list of Services & MIMEs - * Owned (members of the array). - */ - RPointerArray iServMimes; - - /** - * The list of Tasks - * Owned (members of the array). - */ - RPointerArray iTasks; - - /** - * The list of Services & MIMEs that are used by tasks (but otherwise would have been deleted, since they are not - * displayed to the user, because there is no more than one default candidate for each Service & MIME in this list) - * Owned (members of the array). - */ - RPointerArray iTaskServMimes; //ServMimes with a single application, used in tasks - -public: - - /** - * the list of elements, ar required by the dialog - */ - CDesCArraySeg iList; - - /** - * the UID of the client application - */ - TUid iAppUid; - - /** - * TRUE if the current view is the GS simplified view (if this var is TRUE, it also implies that GS is our client) - */ - TBool iSimplifiedView; - - /** - * if TRUE, the client application does not observe our exit. In this case do not display "Exit" in the menu, since - * the client application will not exit when the server exits. - */ - TBool iFlagNoObserver; - }; - - -#endif // C_DEFAULTAPPSRVMIMEVIEW_H - -// end of file \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_srvmime_dlg.h --- a/defaultapplicationsettings/server/inc/das_srvmime_dlg.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: The Service & MIME list dlg -* -*/ - - -#ifndef C_DEFAULTAPPSRVMIMEDLG_H -#define C_DEFAULTAPPSRVMIMEDLG_H - - -#include // CDesCArray -#include // CCoeControl -#include // MEikListBoxObserver - - -#include -#include - -// FORWARD DECLARATIONS -class CAknDoubleStyleListBox; -class CDefaultAppAppUi; -//class CDefaultAppServMimeApps; - -/** - * This is the Dialog class of the application - * - * This dialog displays a double list box and it can also display a pop-up list on top of it. - * The elements of the lists are created by the engine (CDefaultAppServMimeApps class) - * - * @since S60 v5.0 - */ -class CDefaultAppSrvMimeDlg : public CAknSelectionListDialog, - public MListBoxItemChangeObserver - { -public: - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDefaultAppSrvMimeDlg* NewL(CDefaultAppAppUi* aAppUi); - - /** - * Destructor. - */ - virtual ~CDefaultAppSrvMimeDlg(); - -public: //from CAknSelectionListDialog - - /** - * From CAknSelectionListDialog. - * This function is called when buttons/softkeys are pressed, to check if the dlg should exit. - * We always return EFalse, since this is a modeless & nonwaiting dialog. - * - * @since S60 v5.0 - * @param aButtonId the list box for which the event happened - */ - virtual TBool OkToExitL(TInt aButtonId); - - /** - * From CAknSelectionListDialog. - * This function is called when a command is issued by the user. - * - * @since S60 v5.0 - * @param aCommandId the list box for which the event happened - */ - virtual void ProcessCommandL(TInt aCommand); - - /** - * From CAknSelectionListDialog. - * This function is called during the construction of the dialog. - * We build the list of elements here. - * - * @since S60 v5.0 - */ - virtual void PreLayoutDynInitL(); - - -public: //from CAknDialog - - /** - * From CAknDialog. - * This function is called to complete the menu construction. - * - * @since S60 v5.0 - * @param aResourceId the resource id - * @param aMenuPane the menu class instance - */ - virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - -public: //from CCoeControl - - /** - * From CCoeControl. - * This function is called to get the help context - * - * @since S60 v5.0 - * @param aContext recipient for the help context - */ - virtual void GetHelpContext(TCoeHelpContext& aContext) const; - - /** - * From CCoeControl. - * Called by the framework when the view size is changed - * - * @since S60 v5.0 - */ - virtual void SizeChanged(); - - /** - * From CCoeControl. - * Called by the framework to process the key event - * - * @since S60 v5.0 - */ - virtual TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); - - -public: //own functions - - /** - * Enables marquee for the list elements. - * - * @since S60 v5.0 - */ - void EnableMarqueeL(); - - - /** - * Part of the popup menu construction process: - * gets 2 icons, the selected (ticked) and empty icon - * - * @since S60 v5.0 - * @return an array with the 2 icons - */ - CArrayPtr* GetPopupListIconsL() const; - - /** - * Creates a pop-up list for a selected item of the list-box. - * - * @since S60 v5.0 - * @param aSelectedIndex the selected element (used to get the content of the pop-up list) - */ - void OpenMenuForSelectedServiceAndMimeL(TInt aSelectedIndex); -public: - //from MListBoxItemChangeObserver - void ListBoxItemsChanged(CEikListBox* aListBox); - -private: //construction - - /** - * C++ default constructor. - */ - CDefaultAppSrvMimeDlg(CDefaultAppAppUi* aAppUi, TInt *aSelected); - -private: //data - /** - * Pointer to the AppUi - * Not Owned. - */ - CDefaultAppAppUi* iDefaultAppUi; - - /** - * The index of the selected element in the list. This is pointer to AppUI's index - * Not owned. - */ - TInt *iSelected; - - /** - * Flag allowing to exit the dialog - */ - TBool iOkToExit; - - /** - * Pointer refer to CAknPopupList - */ - CAknPopupList* iPopupList; - }; - - -#endif // C_DEFAULTAPPSRVMIMEDLG_H - -// end of file - - \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/inc/das_view.h --- a/defaultapplicationsettings/server/inc/das_view.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Standard View -* -*/ - - -#ifndef C_DEFAULTAPPVIEW_H -#define C_DEFAULTAPPVIEW_H - -#include // CCoeControl - - -// FORWARD DECLARATIONS -class CDefaultAppAppUi; - - -class CDefaultAppView : public CCoeControl - { - public: // New methods - - /** - * NewL. - * Two-phased constructor. - * Create a CDefaultAppView object, which will draw itself to aRect. - * @param aRect The rectangle this view will be drawn to. - * @return a pointer to the created instance of CDefaultAppView. - */ - static CDefaultAppView* NewL( const TRect& aRect ); - - /** - * NewLC. - * Two-phased constructor. - * Create a CDefaultAppView object, which will draw itself - * to aRect. - * @param aRect Rectangle this view will be drawn to. - * @return A pointer to the created instance of CDefaultAppView. - */ - static CDefaultAppView* NewLC( const TRect& aRect ); - - /** - * CDefaultAppView - * Virtual Destructor. - */ - virtual ~CDefaultAppView(); - - public: // Functions from base classes - - /** - * From CCoeControl, Draw - * Draw this CDefaultAppView to the screen. - * @param aRect the rectangle of this view that needs updating - */ - void Draw( const TRect& aRect ) const; - - /** - * From CoeControl, SizeChanged. - * Called by framework when the view size is changed. - */ - virtual void SizeChanged(); - - private: // Constructors - - /** - * ConstructL - * @param aRect The rectangle this view will be drawn to. - */ - void ConstructL(const TRect& aRect); - - /** - * C++ default constructor. - */ - CDefaultAppView(); - - }; - -#endif // C_DEFAULTAPPVIEW_H - -// end of file - - \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/loc/defaultappserver.loc --- a/defaultapplicationsettings/server/loc/defaultappserver.loc Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Localization strings for project Default App Server -* -*/ - - -/************* All views *********************/ - -// d:Menu string (cascade), resets settings defaults to original/factory values -// l:list_single_pane_t1_cp2/opt3 -// r:5.0 -// -#define qtn_da_options_reset "Original settings" - -// d:Sub-menu string, resets selected item to original/factory value -// l:list_single_popup_submenu_pane_t1 -// r:5.0 -// -#define qtn_da_options_reset_selected "Restore default application" - -// d:Sub-menu string, resets all defaults to original/factory values -// l:list_single_popup_submenu_pane_t1 -// r:5.0 -// -#define qtn_da_options_reset_all "For all items" - - -/************* Simplified view *********************/ - -// d:The title for this view -// d:It describes a list of applications that are launched by default when the user performs a task that is -// d:defined in general terms by the list items (see these items next). Examples of such tasks are: -// d:"Play Music", "Play Videos", "View Images", "Browse web". -// l:title_pane_t2/opt9 -// r:5.0 -// -#define qtn_da_title_main "Default Applications" - -// d:Item in a list of tasks -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:list_double_pane_t1_cp2 -// r:5.0 -// -#define qtn_da_main_view_images "View images" - -// d:Same string as before, as a title for a pop-up menu list -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:heading_pane_t1 -// r:5.0 -// -#define qtn_da_title_popup_image "View images" - -// d:Item in a list of tasks -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:list_double_pane_t1_cp2 -// r:5.0 -// -#define qtn_da_main_play_videos "Play videos" - -// d:Same string as before, as a title for a pop-up menu list -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:heading_pane_t1 -// r:5.0 -// -#define qtn_da_title_popup_video "Play videos" - -// d:Item in a list of tasks -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:list_double_pane_t1_cp2 -// r:5.0 -// -#define qtn_da_main_play_music "Play music" - -// d:Same string as before, as a title for a pop-up menu list -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:heading_pane_t1 -// r:5.0 -// -#define qtn_da_title_popup_music "Play music" - -// d:Item in a list of tasks -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:list_double_pane_t1_cp2 -// r:5.0 -// -#define qtn_da_main_browse "Browse web" - -// d:Same string as before, as a title for a pop-up menu list -// d:It describes a task (in general terms) that will be performed by a selected application. -// l:heading_pane_t1 -// r:5.0 -// -#define qtn_da_title_popup_browse "Browse web" - - -/************* Advanced view *********************/ - -// d:The title for this view -// d:It describes a list of applications that are launched by default when the user performs a task -// d:that is defined quite clear (in engineering terms :-). The task is defined by the Service performed -// d:on a file that has a certain MIME. Examples of such tasks are: -// d:"Open audio/mp3", "Print image/jpeg", "Open application/html", "Edit application/text". -// d:The service name (Open, Print, Edit in the above examples) is localized, the MIME is not. -// l:title_pane_t2/opt9 -// r:5.0 -// -#define qtn_da_title_advanced "Advanced settings" - - - - -/************* Application specific settings view *********************/ -// NOTE: This view is very similar with the "Advanced view", just the title is changed - -// d:The title for this view (the view is very similar with the "Advanced view", the only difference is that -// d:in this view, the list is filtered so only the task specific to the client application are displayed). -// d:The view describes a list of applications that are launched by default when the user performs a task -// d:that is defined quite clear (in engineering terms :-). The task is defined by the Service performed -// d:on a file that has a certain MIME. Examples of such tasks are: -// d:"Open audio/mp3", "Print image/jpeg", "Open application/html", "Edit application/text". -// d:The service name (Open, Print, Edit in the above examples) is localized, the MIME is not. - -// l:title_pane_t2/opt9 -// r:5.0 -// -#define qtn_da_title_app "Default Applications" - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/loc/services_db.loc --- a/defaultapplicationsettings/server/loc/services_db.loc Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Localization strings for project Services DB -* -*/ - - - -/************* Service + MIMEs *********************/ - -/* Examples of MIMEs: - -audio/mpeg - -video/3gpp - -image/jpeg - */ - - - -// d:This is the name of a Service (it should be short) -// d:The parameter is a MIME (non-localizable text). String is scrollable. -// d:This is the default service, it opens a file with an application -// l:None -// r:5.0 -// -#define qtn_da_service_open "Open %U" - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das.cpp --- a/defaultapplicationsettings/server/src/das.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Executable module to start the process and load the DefaultAppServer. -* -*/ - - -#include -#include "das_app.h" -#include - -// --------------------------------------------------------------------------- -// NewApplication() -// constructs CDefaultAppApplication -// Returns: CApaDocument*: created application object -// -// --------------------------------------------------------------------------- -LOCAL_C CApaApplication* NewApplication() - { - return new CDefaultAppApplication; - } - -// --------------------------------------------------------------------------- -// E32Main() -// -// --------------------------------------------------------------------------- -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_app.cpp --- a/defaultapplicationsettings/server/src/das_app.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This is the main application implementation of default app server. -* -*/ - - -#include "das_app.h" -#include "das_doc.h" -#include "das_server.h" - -// --------------------------------------------------------------------------- -// Return the UID for the CSoundApplication application -// --------------------------------------------------------------------------- -// -TUid CDefaultAppApplication::AppDllUid() const - { - return KUidDefaultAppServer; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CDefaultAppApplication::CDefaultAppApplication(void) : iDocument(NULL), iServer(NULL) - {} - -// --------------------------------------------------------------------------- -// Create an CDefaultAppDocument document, and return a pointer to it -// --------------------------------------------------------------------------- -// -CApaDocument* CDefaultAppApplication::CreateDocumentL() - { - iDocument = CDefaultAppDocument::NewL(*this); - return (static_cast(iDocument)); - } - -// --------------------------------------------------------------------------- -// Simple function to return a server object -// --------------------------------------------------------------------------- -// -void CDefaultAppApplication::NewAppServerL(CApaAppServer*& aAppServer) - { - aAppServer = iServer = CDefaultAppServer::NewL(this); - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_appui.cpp --- a/defaultapplicationsettings/server/src/das_appui.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This is the app ui implementation of default application server. -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include "das_appui.h" -#include "das_view.h" -#include "das_srvmime_dlg.h" -#include "das_servmimeapps.h" -#include "das.hrh" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CDefaultAppAppUi::~CDefaultAppAppUi() - { - if(iView) - delete iView; - if(iServMimeApps) - delete iServMimeApps; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CDefaultAppAppUi::CDefaultAppAppUi() : iView(NULL), iDlg(NULL), iExitBack(EFalse) - { - // No implementation required - } - -// --------------------------------------------------------------------------- -// Symbian constructor -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::ConstructL() -{ - BaseConstructL(EAknEnableSkin|EAknEnableMSK|EAknSingleClickCompatible); - // Create view object - iView = CDefaultAppView::NewL( ClientRect() ); -} - -// --------------------------------------------------------------------------- -// Continues the construction, after the client connects to the server and some data is known -// (client UID and service flags) -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::ConstructSrvMimeDlgL(TUid aClientUid, TInt aServiceFlags) -{ - SetClientIconL(aClientUid); - iClientUid = aClientUid; - iSelectedItemSimple=-1; - iSelectedItemAdvanced=-1; - iReloadDlgAdvanced=(aClientUid==KUidGS?EFalse:ETrue); - iReloadDlg=ETrue; - do - { - if(!iServMimeApps) - iServMimeApps=CDefaultAppServMimeApps::NewL(aClientUid, aServiceFlags); - - if(iReloadDlgAdvanced) - { - //some settings for the advanced view - iServMimeApps->iSimplifiedView=EFalse; - } - else - { - //some settings for the simple view - iServMimeApps->iSimplifiedView=ETrue; - }; - iServMimeApps->GetServicesAndMimesListL(iServMimeApps->iList); - - iDlg=CDefaultAppSrvMimeDlg::NewL(this); - SetDialogExist( ETrue ); - iDlg->SetMopParent(this); - iDlg->ExecuteLD(R_DAS_DLG); - iDlg=NULL; - } - while(iReloadDlg); - - - //exit the server - if(iExitBack) - { - //if we exit by "Back" button, notify the client app, so that it does not exit. - CEikAppServer* server = iEikonEnv->AppServer(); //if we do not do this, the client exits when backkey is pressed - if ( server ) - { - server->NotifyServerExit( EAknSoftkeyBack ); - } - }; - //exit this application - RunAppShutter(); -} - -// --------------------------------------------------------------------------- -// From class CAknAppUi. -// handle menu command -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::HandleCommandL(TInt aCommand) - { - switch (aCommand) - { - case EAknSoftkeyExit: - __ASSERT_ALWAYS(0,User::Leave(KErrGeneral)); - break; - case EEikCmdExit: - - Exit(); - break; - //no need for default. We may also have other commands that we do not handle here. - } - } - - -// --------------------------------------------------------------------------- -// imports and displays the icon of the client application. -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::SetClientIconL(TUid aClietAppUid) - { - CEikStatusPane *statusPane=StatusPane(); - TUid contextPaneUid=TUid::Uid(EEikStatusPaneUidContext); - if(statusPane && statusPane->PaneCapabilities(contextPaneUid).IsPresent()) - { - CAknContextPane *contextPane=(CAknContextPane*)(statusPane->ControlL(contextPaneUid)); //we don't get the ownership - MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); //we don't get the ownership - - CFbsBitmap* iconBmp = NULL; - CFbsBitmap* iconBmpMask = NULL; - - AknsUtils::CreateAppIconLC(skinInstance,aClietAppUid,EAknsAppIconTypeContext, - iconBmp,iconBmpMask); - CleanupStack::Pop(2);//the 2 icons - - contextPane->SetPicture(iconBmp,iconBmpMask);// ownership transfer for the 2 pictures - } - } - -// --------------------------------------------------------------------------- -// Handles layout changes (e.g. from portrait to landscape) -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::HandleResourceChangeL(TInt aType) - { - CAknAppUi::HandleResourceChangeL( aType ); - - if(iView) - iView->HandleResourceChange(aType); - if( iDlg && iDialogExist ) - iDlg->HandleResourceChange(aType); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - if( iView ) - iView->SetRect(ClientRect()); - if( iDlg && iDialogExist ) - iDlg->SetRect(ClientRect()); - } - } - -// --------------------------------------------------------------------------- -// Handles Window Server events (we are interested in catching the end key event -// and exiting the application -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::HandleWsEventL(const TWsEvent & aEvent, CCoeControl * aDestination) - { - CAknAppUi::HandleWsEventL(aEvent,aDestination); - } - -// --------------------------------------------------------------------------- -// This functino is used to record the exist of the dialog; -// and exiting the application -// --------------------------------------------------------------------------- -// -void CDefaultAppAppUi::SetDialogExist( TBool aExist ) - { - iDialogExist = aExist; - } diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_doc.cpp --- a/defaultapplicationsettings/server/src/das_doc.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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: Implementation of the document class -* -*/ - - - -#include "das_doc.h" -#include "das_appui.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CDefaultAppDocument* CDefaultAppDocument::NewL(CEikApplication& aApp) - { - CDefaultAppDocument* self = NewLC(aApp); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CDefaultAppDocument* CDefaultAppDocument::NewLC(CEikApplication& aApp) - { - CDefaultAppDocument* self = new (ELeave) CDefaultAppDocument(aApp); - CleanupStack::PushL(self); - return self; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CDefaultAppDocument::CDefaultAppDocument(CEikApplication& aApp) : CAknDocument(aApp), iDefaultAppUi(NULL) - { - // No implementation required - } - -// --------------------------------------------------------------------------- -// Instantiates CDefaultAppAppUi -// --------------------------------------------------------------------------- -// -CEikAppUi* CDefaultAppDocument::CreateAppUiL() - { - iAppUi = iDefaultAppUi = new (ELeave) CDefaultAppAppUi; - return (static_cast(iAppUi)); - } - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_server.cpp --- a/defaultapplicationsettings/server/src/das_server.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation of the server class -* -*/ - - - -#include //for RDebug - -#include "das_server.h" -#include "das_service.h" -#include "das_app.h" - -const TUid KDefaultAppServiceUid = { 0x10281B9D }; - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CDefaultAppServer* CDefaultAppServer::NewL(CDefaultAppApplication* aApp) - { - CDefaultAppServer* self = new (ELeave) CDefaultAppServer(aApp); - return self; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CDefaultAppServer::CDefaultAppServer(CDefaultAppApplication* aApp) : iApp(aApp) - { - } - -// --------------------------------------------------------------------------- -// From class CAknAppServer. -// Creates a service for the specified service Uid -// --------------------------------------------------------------------------- -// -CApaAppServiceBase* CDefaultAppServer::CreateServiceL(TUid aServiceType) const - { - RDebug::Print(_L("CDefaultAppServer::CreateServiceL")); - if (aServiceType == KDefaultAppServiceUid) - return CDefaultAppService::NewL(this); - else - return CAknAppServer::CreateServiceL(aServiceType); - } - - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_service.cpp --- a/defaultapplicationsettings/server/src/das_service.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation of the DefaultApp service -* -*/ - - -//#include //for RDebug -#include "das_server.h" -#include "das_service.h" -#include "das_app.h" -#include "das_doc.h" -#include "das_appui.h" -#include "das_servmimeapps.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CDefaultAppService::CDefaultAppService(const CDefaultAppServer* aServer) : iDefaultAppServer(aServer) - { - iClientUid=TUid::Uid(0); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CDefaultAppService::~CDefaultAppService() - { - delete iIdle; - } -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CDefaultAppService* CDefaultAppService::NewL(const CDefaultAppServer* aServer) - { - CDefaultAppService* self = new (ELeave) CDefaultAppService(aServer); - return self; - } - -// --------------------------------------------------------------------------- -// From class CAknAppServiceBase. -// function called when a new message is received -// --------------------------------------------------------------------------- -// -void CDefaultAppService::ServiceL(const RMessage2& aMessage) - { - switch (aMessage.Function()) - { - case ESetDefaultAll : - HandleSetDefaultAllL(aMessage); - break; - default: - CAknAppServiceBase::ServiceL(aMessage); - } - } - -// --------------------------------------------------------------------------- -// From class CAknAppServiceBase. -// function called to check client credentials. Used to retrieve client app UID -// --------------------------------------------------------------------------- -// -CPolicyServer::TCustomResult CDefaultAppService::SecurityCheckL(const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/) - { - iClientUid=aMsg.SecureId(); - return CPolicyServer::EPass; - } - -// --------------------------------------------------------------------------- -// Sets default for all the Service & MIME pairs supported by the client -// --------------------------------------------------------------------------- -// -void CDefaultAppService::HandleSetDefaultAllL(const RMessage2& aMessage) - { - //Get flags - //TInt serviceFlags=aMessage.Int0(); - iServiceFlags=aMessage.Int0(); - aMessage.Complete(KErrNone); - - if(!iIdle) - { - iIdle=CIdle::NewL(CActive::EPriorityStandard); - TCallBack cb(&IdleWorker,this); - iIdle->Start(cb); - }; - } - -// --------------------------------------------------------------------------- -// Function where most of the processing happens. -// We use it so that the service request from the client returns immediately -// --------------------------------------------------------------------------- -// -TInt CDefaultAppService::IdleWorker(TAny *aInstance) - { - CDefaultAppService *service=(CDefaultAppService*)aInstance; - //construct the view - if ( service->iDefaultAppServer && - service->iDefaultAppServer->iApp && - service->iDefaultAppServer->iApp->iDocument && - service->iDefaultAppServer->iApp->iDocument->iDefaultAppUi) - { - service->iDefaultAppServer->iApp->iDocument->iDefaultAppUi->ConstructSrvMimeDlgL(service->iClientUid,service->iServiceFlags); - }; - return 0; //no more work to do - } - - - - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_servmimeapps.cpp --- a/defaultapplicationsettings/server/src/das_servmimeapps.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1073 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Keeps info about Services, MIMEs and Applications -* -*/ - - -// System includes -#include // STATIC_CAST -#include // R_DAS_SERVICESMIMES_LISTBOX -#include // StringLoader -#include //TResourceRead -#include //CEikonEnv -#include -#include // CApaMaskedBitmap - -#include - -#include "das_servmimeapps.h" -#include "das_app.h" // KUidDefaultAppServer -#include - -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#include // KDataTypePrioritySystem -#endif - -const TInt KStringMargin = 10; //10 is a sufficiently large margin - -// ======== MEMBER FUNCTIONS ======== CAppHelper - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CAppHelper* CAppHelper::NewLC(const TDesC& aName, const TInt aUid) - { - CAppHelper* self = new (ELeave) CAppHelper(aUid,0); - CleanupStack::PushL(self); - //construct iName, copy it - self->iName = HBufC::NewL(aName.Size()); - TPtr* ptr=new (ELeave) TPtr(self->iName->Des()); - ptr->Copy(aName); - delete ptr; - - return self; - } - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CAppHelper* CAppHelper::NewLC(const CAppHelper& aApp) - { - CAppHelper* self = new (ELeave) CAppHelper(aApp.iUid,1,aApp.iFlags); - CleanupStack::PushL(self); - //construct iName, get pointer and flag it - self->iName = aApp.iName; - self->iFlags |= EFlagNameNotOwned; - return self; - } - -// --------------------------------------------------------------------------- -// C++ Constructor -// --------------------------------------------------------------------------- -// -CAppHelper::CAppHelper(const TInt aUid, const TInt aScore, const TInt aFlags): - iName(NULL), iUid(aUid), iScore(aScore), iFlags(aFlags) - { - //no implementation needed - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CAppHelper::~CAppHelper(void) - { - if(!( iFlags&EFlagNameNotOwned )) - delete iName; - iName = NULL; - } -// --------------------------------------------------------------------------- -// This function is used to order Applications -// --------------------------------------------------------------------------- -// -TInt CAppHelper::OrderApplications(const CAppHelper& a1, const CAppHelper& a2) - { - //if a1 *a2.iName) return 1; - //if we are here, strings were equal - return 0; - } - - -// ======== MEMBER FUNCTIONS ======== CServiceMime - -// --------------------------------------------------------------------------- -// C++ Constructor -// --------------------------------------------------------------------------- -// -CServiceMime::CServiceMime() : iServiceMime(NULL), iMime(NULL) - { - iDefaultAppUid=TUid::Uid(0); - iDefaultApp=-1;//currently we do not know the default index - iUsedByTasks=EFalse; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CServiceMime::~CServiceMime() - { - if (iServiceMime) delete iServiceMime; - if (iMime) delete iMime; - for (TInt i=0 ; i*a2.iMime)return 1; - //if we are here, MIMEs are the same - if(*a1.iServiceMime<*a2.iServiceMime)return -1; - if(*a1.iServiceMime>*a2.iServiceMime)return 1; - //if we are here, strings were equal - return 0; - } - -// ======== MEMBER FUNCTIONS ======== CMediaTask - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CMediaTask* CMediaTask::NewLC( TResourceReader& aReader ) - { - CMediaTask* self = new (ELeave) CMediaTask(); - CleanupStack::PushL(self); - self->ConstructL(aReader); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CMediaTask::~CMediaTask() - { - - if(iTaskList)delete iTaskList; - if(iTaskTitle)delete iTaskTitle; - - if(iMimeLabel)delete iMimeLabel; - - iMimes.ResetAndDestroy(); - iServicesUids.Close(); - - iSMs.Close();//elements not owned - - iApplications.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// C++ Constructor -// --------------------------------------------------------------------------- -// -CMediaTask::CMediaTask() : iMimeLabel(NULL), iDefaultApp(-1) - { - } - -// --------------------------------------------------------------------------- -// The construction means reading the task details from the resource file -// --------------------------------------------------------------------------- -// -void CMediaTask::ConstructL( TResourceReader& aReader ) - { - TInt i,count; - //read the task name - iTaskList = aReader.ReadHBufCL(); - if( !iTaskList )User::Leave(KErrArgument); - - //read the task title - iTaskTitle = aReader.ReadHBufCL(); - if( !iTaskTitle )User::Leave(KErrArgument); - - //read the mime label - iMimeLabel = aReader.ReadHBufC8L(); - if( !iMimeLabel )User::Leave(KErrArgument); - - //read the service mimes entries - count = aReader.ReadInt16(); - for (i=0; iConstructL(aAppUid, aServiceFlags); - return self; - } - -// --------------------------------------------------------------------------- -// This function builds the data structures for the dialog: -// It reads the considered services from the resource files, then it builds the -// task list and the associated list of Services& MIMEs and applications. -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::ConstructL(TUid aAppUid, TInt aServiceFlags) - { - //set the client app uid - /* Uncomment this for testing the General Settings (Control Pannel) specific view from another application (R&D purpose) - * - TBool flagGsClient = aServiceFlags & EFlagGsClient; - if(flagGsClient)aAppUid=KUidGS; //we mimic the GS Client. - */ - iAppUid = aAppUid; - - //for all the available services, launch the AddMIMEsForServiceL function - TResourceReader reader; - CEikonEnv::Static()->CreateResourceReaderLC( reader, R_DA_SERVICE_MIME ); - CServicesDB* sdb = CServicesDB::NewLC(&reader); - TInt i; - TUid uid; - for(i=0; iCount(); i++) - { - uid = sdb->ServiceUidL(i); - AddMIMEsForServiceL(uid,i,aServiceFlags,sdb); - }; - CleanupStack::PopAndDestroy(sdb); - CleanupStack::PopAndDestroy( ); // reader - //change MIMEs & sort - BeautifyAndSortServMimeApps(); - } - -// --------------------------------------------------------------------------- -// this is by far the most complicated function in the entire subsystem -// some more comments are needed, but after this function will be split in 2 -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::AddMIMEsForServiceL(TUid aServiceUid, TInt aServiceIndex, TInt aServiceFlags, CServicesDB* aServicesDb) - { - CServiceMime *sm = NULL; - TUid uid; - - RApaLsSession ls; - TApaAppInfo info; - CApaAppServiceInfoArray* serv=NULL; - CServiceRegistry *sr=NULL; - TInt i,j,k; - TInt it,jt;//indexes for iterating inside tasks - TInt lowerMarker, upperMarker; - //flags - TBool flagShowAll = EFalse; - /* - * Uncomment the line below to show all the Services & MIMEs in views, and not only those for which default app can be changed. - * This can be used for R&D, to see all the MIMEs&Services in the system. - flagShowAll = aServiceFlags & EFlagShowAllServicesAndMimes; - */ - iFlagNoObserver = aServiceFlags & EFlagNoObserver; - - //check who is connecting, so that we can set the view - if(iAppUid == KUidGS) - { - iSimplifiedView=ETrue; //at least in the beginning. - //For this function, this is also a flag that says if we have GS as client or not - GetTaskListL(R_DA_TASKS); - } - else iSimplifiedView=EFalse; - - //connect - User::LeaveIfError( ls.Connect() ); - CleanupClosePushL( ls ); - - //Get all the apps and MIMEs for the current service - ls.GetAppInfo(info,iAppUid); - serv=ls.GetServiceImplementationsLC(aServiceUid); - lowerMarker = upperMarker = iServMimes.Count(); - //create entries for the MIMEs supported by the client application - for (i=0; iArray().Count(); i++) - { - uid=serv->Array()[i].Uid(); - if( iSimplifiedView || uid == iAppUid) //this means that for app clients, we first skip all the other applications - { - //if iSimplifiedView is true, then we have GS as a client - for(j=0; jArray()[i].DataTypes().Count(); j++) - { - TBool createSM=ETrue; - if(iSimplifiedView) - { - //check if we already have an entry for this service & MIME - for(k=lowerMarker; kiMime->Des() == serv->Array()[i].DataTypes()[j].iDataType.Des8()) - { - //we found it! - sm=iServMimes[k]; - createSM=EFalse; - break;//we found the sm, no need to search for it any more - } - //if we don't find it, we will create an entry ... - } - - if(createSM) - { - //we have to create sm, we did not found it previously (or we were not looking for it) - sm=new (ELeave) CServiceMime; - CleanupStack::PushL(sm); - sm->iMime = HBufC8::NewL(serv->Array()[i].DataTypes()[j].iDataType.Des8().Size()); - *(sm->iMime) = serv->Array()[i].DataTypes()[j].iDataType.Des8(); - //transform the MIME from audio/mpeg to audio mpeg - HBufC *transformedMime=HBufC::NewLC(serv->Array()[i].DataTypes()[j].iDataType.Des().Size()); - TPtr *ptr=new (ELeave) TPtr(transformedMime->Des()); - CleanupStack::PushL(ptr); - ptr->Copy(serv->Array()[i].DataTypes()[j].iDataType.Des()); - TInt location=ptr->Locate('/'); - if(location>0)ptr->Replace(location,1,_L(" ")); - //transforming done - //sm->iServiceMime = aServicesDb->ServiceStringLC(aServiceIndex, serv->Array()[i].DataTypes()[j].iDataType.Des()); - sm->iServiceMime = aServicesDb->ServiceStringLC(aServiceIndex, transformedMime->Des()); - CleanupStack::Pop(sm->iServiceMime); - CleanupStack::PopAndDestroy(ptr); - CleanupStack::PopAndDestroy(transformedMime); - //StringLoader::LoadL( R_DA_SERVICE_OPEN, serv->Array()[i].DataTypes()[j].iDataType.Des()); - sm->iServiceUid=aServiceUid; - } - - //insert the client application - InsertApplicationL(*sm, uid, serv->Array()[i].DataTypes()[j].iPriority, &ls); - - //get the Uid of the default application for this service and MIME - ls.AppForDataType(serv->Array()[i].DataTypes()[j].iDataType,sm->iDefaultAppUid); - - if(createSM) - { - //sm was created this iteration, ad it. - iServMimes.AppendL(sm);//takes ownership of sm - upperMarker++; - CleanupStack::Pop(sm); - - } - }//for - /* - * If a service that has no MIME will be considered, some code must be added (probably in this place) - */ - }//if ( - - } - __ASSERT_DEBUG(upperMarker == iServMimes.Count(), User::Panic( _L("upperMarker bad value"), 1)); - - if(sr) - { - //we do not need it any more - delete sr; - sr=NULL; - } - if(lowerMarker == upperMarker) - { - //current app does not support any MIME for the current service, clean and get out of here - CleanupStack::PopAndDestroy(serv); - CleanupStack::PopAndDestroy(); // closes RApaLsSession - return; - } - - if(!iSimplifiedView) - { - //if we are here, we have MIMEs for the current service - //iterate once more and add applications for MIMEs already in the list - for (i=0; iArray().Count(); i++) - { - uid=serv->Array()[i].Uid(); - if( uid == iAppUid) continue; //we don't add our client application once more in the list (it is already there) - for(j=0; jArray()[i].DataTypes().Count(); j++) - for(k=lowerMarker; kiMime->Des() == serv->Array()[i].DataTypes()[j].iDataType.Des8()) - { - InsertApplicationL(*(iServMimes[k]), serv->Array()[i].Uid(), serv->Array()[i].DataTypes()[j].iPriority, &ls); - }//if same MIME - } - } - - //before deleting some of the entries ... - if(iSimplifiedView) - { - //check the service & MIMEs against the task list... - //first, check the service against task services - for(it=0; itiServicesUids.Count(); jt++) - if(aServiceUid.iUid == iTasks[it]->iServicesUids[jt]) - { - //lets check if the MIME matches too... - for(k=lowerMarker; kiMime == *iTasks[it]->iMimes[jt]) - { - //this entry matches an entry in the task list - //add the applications to the list - PopulateTaskWithApplicationsL(*iTasks[it],iServMimes[k]); - //link the sm, if it has more than 1 application - break;//sm found, no need to search for it further - } - } - } - - - - //iterate from the newly added entries and set the index - for(k=lowerMarker; kiApplications.Count() <2 && !flagShowAll) - { - //this entry has a single element (that should not be shown) - //we either delete it, or move it - if(iServMimes[k]->iUsedByTasks) - { - //the sm is used by tasks, we move it - iTaskServMimes.AppendL(iServMimes[k]);//takes ownership of sm - } - else - { - //the sm is not used by tasks, we delete it. - delete iServMimes[k]; - } - - //we remove the entry from the iServMimes (so that it is not shown) - iServMimes.Remove(k); - k--; - upperMarker--; - smSetOrRemoved=ETrue; - } - - //set the index - if(!smSetOrRemoved) - { - for(i=0 ; i< iServMimes[k]->iApplications.Count() ; i++) - { - if(iServMimes[k]->iApplications[i]->iUid == iServMimes[k]->iDefaultAppUid.iUid) - iServMimes[k]->iDefaultApp=i; - } - } - }; - - if(iSimplifiedView) - for(it=0; itiDefaultAppUid.iUid == 0 && iTasks[it]->iApplications.Count()>0) - { - //there is no uid, look for the platform App and make it the default - for(jt=0; jtiApplications.Count(); jt++) - if(iTasks[it]->iApplications[jt]->iFlags & CAppHelper::EFlagPlatformApp) - { - iTasks[it]->iDefaultAppUid.iUid = iTasks[it]->iApplications[jt]->iUid; - iTasks[it]->iDefaultApp=jt; - break;//app found, no need to search for it any longer - }; - - //if no app found, mark the first one as default - if(iTasks[it]->iDefaultAppUid.iUid == 0) - { - iTasks[it]->iDefaultAppUid.iUid = iTasks[it]->iApplications[0]->iUid; - iTasks[it]->iDefaultApp = 0;//the index - }; - } - else - for(jt=0; jtiApplications.Count(); jt++) - if(iTasks[it]->iApplications[jt]->iUid == iTasks[it]->iDefaultAppUid.iUid) - { - iTasks[it]->iDefaultApp=jt; - break;//app found, no need to search for it any longer - } - - //done, destroy serv - CleanupStack::PopAndDestroy(serv); - CleanupStack::PopAndDestroy( ); // closes RApaLsSession - } - -// --------------------------------------------------------------------------- -// C++ Constructor -// --------------------------------------------------------------------------- -// -CDefaultAppServMimeApps::CDefaultAppServMimeApps(): iList(4) - { - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CDefaultAppServMimeApps::~CDefaultAppServMimeApps() - { - iServMimes.ResetAndDestroy(); - iTasks.ResetAndDestroy(); - iTaskServMimes.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// This function sorts the Services & MIMEs and their applications. -// It also sorts the Serivces & MIMEs associated with tasks -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::BeautifyAndSortServMimeApps(void) - { - //first, go through the Services & MIMEs localized names and sort them - TLinearOrder order(&CServiceMime::OrderServiceMimes); - iServMimes.Sort(order); - - //go through applications and sort them - TInt i,j; - for(i=0; i order2(&CAppHelper::OrderApplications); - iServMimes[i]->iApplications.Sort(order2); - //get our app index - for(j=0; jiApplications.Count(); j++) - if(iServMimes[i]->iApplications[j]->iUid == iServMimes[i]->iDefaultAppUid.iUid) - iServMimes[i]->iDefaultApp = j; - }; - //if we have tasks, we sort their apps too - for(i=0; i order2(&CAppHelper::OrderApplications); - iTasks[i]->iApplications.Sort(order2); - //get our app index - for(j=0; jiApplications.Count(); j++) - if(iTasks[i]->iApplications[j]->iUid == iTasks[i]->iDefaultAppUid.iUid) - iTasks[i]->iDefaultApp = j; - }; - } - - -// --------------------------------------------------------------------------- -// This function reads from the resource file the list of tasks (and associated data). -// This function is used during construction -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::GetTaskListL( TInt aResourceId ) - { - TResourceReader reader; - TInt i; - CServiceRegistry* sr=CServiceRegistry::NewL(); - CleanupStack::PushL(sr); - - // Read tasks - - CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId ); - - TInt count = reader.ReadInt16(); - for ( i = 0; i < count; i++ ) - { - CMediaTask* task=CMediaTask::NewLC(reader); - // Read the default application for this task ... - sr->GetDefault(KOpenServiceUid, *task->iMimeLabel, task->iDefaultAppUid); - - //add the task to the list - iTasks.Append(task); - CleanupStack::Pop(task); - } - - CleanupStack::PopAndDestroy(); // reader - CleanupStack::PopAndDestroy(sr); - } - -// --------------------------------------------------------------------------- -// This function adds a new Application to a list of an Service & Mime object. -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::InsertApplicationL(CServiceMime& aServMime, const TUid& aAppUid, const TDataTypePriority& aPrio, const RApaLsSession *aLs) - { - TBool addIt = ETrue; - - if(aPrio == KDataTypePrioritySystem) - { - // the application to be inserted has system priority - if(aServMime.iDefaultApp == -1) - { - //we have non-system applications in the list - //delete them ... - aServMime.iApplications.ResetAndDestroy(); - - //... and make the default -2 ... (it means single app with system priority) - aServMime.iDefaultApp = -2; - //... and add our application (after exiting from the "if") - } - else - { - //do not delete the applications, but just add our application - //...and make the default -3 (it means multiple apps with system priority) - aServMime.iDefaultApp = -3; - //... and add our application (after exiting from the "if") - } - } - else - { - // the application to be inserted does NOT have system priority - if(aServMime.iDefaultApp < -1) - { - // there are only System apps in the list, do not add ours - addIt = EFalse; - } - // else there are normal applications in the list, insert ours, as well - } - //add the application to the list - if(addIt) - { - TApaAppInfo info; - aLs->GetAppInfo(info,aAppUid); - //find the best name for the application - CAppHelper *app = NULL; - if(info.iCaption.Size() != 0) - { - //this is for now, the preferred name - app = CAppHelper::NewLC(info.iCaption, aAppUid.iUid); - } - else - { - //fall-back name - app = CAppHelper::NewLC(info.iShortCaption, aAppUid.iUid); - }; - //is the app platform application?? - if (info.iFullName.Left(1) == _L("Z") || - info.iFullName.Left(1) == _L("z")) - app->iFlags |= CAppHelper::EFlagPlatformApp; - //append the name - aServMime.iApplications.AppendL(app); - CleanupStack::Pop(app); - } - } - -// --------------------------------------------------------------------------- -// This function takes a task and a Service & MIME object. It checks all the applications that support the given -// Service & MIME object (from its list). If an application is not in the task's application list, this function adds -// it there, with a score of 1. If the application is already in the list, then its score is incremented. -// The Service & MIME object is also marked as being used by a task. -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::PopulateTaskWithApplicationsL(CMediaTask& aTask,CServiceMime* aServMime) - { - TInt i,j; - TBool found; - //add the applications to the list - for(i=0; iiApplications.Count(); i++) - { - found=EFalse; - for(j=0; jiApplications[i]->iUid == aTask.iApplications[j]->iUid) - { - //we found this application... - found=ETrue; - //... increase its score - aTask.iApplications[j]->iScore++; - //... and get to the next application - break; //application found, no need to search for it any more - } - //if the application was not found, we have to add it! - if(!found) - { - CAppHelper *app = CAppHelper::NewLC(*aServMime->iApplications[i]); - aTask.iApplications.AppendL(app); - CleanupStack::Pop(app); - } - } - //mark the sm - aServMime->iUsedByTasks=ETrue; - //link the sm - aTask.iSMs.Append(aServMime); - } - -// --------------------------------------------------------------------------- -// This function fills with entries a data structure used by a List Box to display Services & MIMEs or Tasks -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::GetServicesAndMimesListL(CDesCArray& aServicesAndMimesArray) - { - TInt i; - aServicesAndMimesArray.Reset(); - if(iSimplifiedView) - { - for ( i=0 ; i *apps=NULL; - - //get the proper list - if(iSimplifiedView) - apps = &(iTasks[aIndex]->iApplications); - else - apps = &(iServMimes[aIndex]->iApplications); - - for ( i=0 ; iCount() ; i++ ) - { - len=(*apps)[i]->iName->Size() + KStringMargin ; - if(len>bufLen) - { - newString=string->ReAllocL(len); - if(newString != string) - { - CleanupStack::Pop(string);//already destroyed - string=newString; - CleanupStack::PushL(string); - } - bufLen=len; - newString=NULL; - } - //copy the application into the string buffer - TPtr ptr=string->Des(); - TBool isDefault=EFalse; - - if( iSimplifiedView && iTasks[aIndex]->iDefaultApp==i) isDefault=ETrue; - if( !iSimplifiedView && iServMimes[aIndex]->iDefaultApp==i) isDefault=ETrue; - - if( isDefault ) ptr.Copy(KStringAppsDefault); - else ptr.Copy(KStringAppsNonDefault); - ptr.Append(*(*apps)[i]->iName); - - aApplicationsArray.AppendL (ptr); - } - - CleanupStack::PopAndDestroy(string); //data in ptr is out of scope - - //get the title now - if ( iSimplifiedView ) - aTitle = GetMediaTaskStringLC(*iTasks[aIndex], EFalse); - else - aTitle = GetServiceAndMimeStringLC(*iServMimes[aIndex], EFalse); - CleanupStack::Pop(aTitle); - } - -// --------------------------------------------------------------------------- -// This function sets a new default, for a Service & MIME pair or for a Task. -// The function also updates the list of Services & MIMEs (or Tasks), to display the new default application -// --------------------------------------------------------------------------- -// -void CDefaultAppServMimeApps::UpdateDefaultL(TInt aServiceAndMimeIndex, TInt aDefaultAppIndex, CDesCArray *aServicesAndMimesArray) - { - //check for correct parameters - if (aServiceAndMimeIndex <0 || aDefaultAppIndex <0) User::Leave(KErrArgument); - if(iSimplifiedView) - { - if( aServiceAndMimeIndex >= iTasks.Count() || - aDefaultAppIndex >= iTasks[aServiceAndMimeIndex]->iApplications.Count()) - User::Leave(KErrArgument); - } - else - { - if( aServiceAndMimeIndex >= iServMimes.Count() || - aDefaultAppIndex >= iServMimes[aServiceAndMimeIndex]->iApplications.Count()) - User::Leave(KErrArgument); - } - - //if we are here, parameters are within their range - TBool doUpdate=ETrue; - TUid defaultAppUid; - CServiceRegistry *sr=CServiceRegistry::NewL(); - CleanupStack::PushL(sr); - - //update the default in the Service Registry - if(iSimplifiedView) - { - TInt i,j; - TUid serviceUid; - //set the default for the generic MIME (and our server application) - TDataType dt(*iTasks[aServiceAndMimeIndex]->iMimeLabel); - defaultAppUid=TUid::Uid(iTasks[aServiceAndMimeIndex]->iApplications[aDefaultAppIndex]->iUid); - if(sr->SetDefault(KOpenServiceUid, dt,defaultAppUid)) - { - //if we are here, SetDefault returned an error. - //so we do not update the default... - doUpdate=EFalse; - } - //set the selected default for all the Services & MIME that it supports - if(doUpdate) - { - for(i=0; iiSMs.Count(); i++) - for(j=0; jiSMs[i]->iApplications.Count(); j++) - if(defaultAppUid.iUid == iTasks[aServiceAndMimeIndex]->iSMs[i]->iApplications[j]->iUid ) - { - //the selected application supports this Service & MIME pair. - //make the app default for the pair. - dt=*iTasks[aServiceAndMimeIndex]->iSMs[i]->iMime; - serviceUid=iTasks[aServiceAndMimeIndex]->iSMs[i]->iServiceUid; - sr->SetDefault(serviceUid, dt,defaultAppUid); - //update the sm so that it reflects the new default - iTasks[aServiceAndMimeIndex]->iSMs[i]->iDefaultAppUid=defaultAppUid; - iTasks[aServiceAndMimeIndex]->iSMs[i]->iDefaultApp=j; - break; //application found in sm's list, do not need to search for it any more - } - //update the default entries - iTasks[aServiceAndMimeIndex]->iDefaultApp=aDefaultAppIndex; - iTasks[aServiceAndMimeIndex]->iDefaultAppUid=defaultAppUid; - } - - } - else - { - TDataType dt(*iServMimes[aServiceAndMimeIndex]->iMime); - defaultAppUid=TUid::Uid(iServMimes[aServiceAndMimeIndex]->iApplications[aDefaultAppIndex]->iUid); - if(sr->SetDefault(iServMimes[aServiceAndMimeIndex]->iServiceUid, dt,defaultAppUid)) - { - //if we are here, SetDefault returned an error. - //so we do not update the default... - doUpdate=EFalse; - } - //update the default entries - if(doUpdate) - { - iServMimes[aServiceAndMimeIndex]->iDefaultApp=aDefaultAppIndex; - iServMimes[aServiceAndMimeIndex]->iDefaultAppUid=defaultAppUid; - } - } - CleanupStack::PopAndDestroy(sr); - - //check if setting the default failed - if(!doUpdate) - { - //### if updating the default failed, here would be the place to put an error note to the user - return; // or leave - }; - - //update the item in the list - if (aServicesAndMimesArray) - { - //get the string - TDesC* string; - if(iSimplifiedView) - string = GetMediaTaskStringLC(*iTasks[aServiceAndMimeIndex], ETrue); - else - string = GetServiceAndMimeStringLC(*iServMimes[aServiceAndMimeIndex], ETrue); - aServicesAndMimesArray->Delete(aServiceAndMimeIndex); - aServicesAndMimesArray->InsertL(aServiceAndMimeIndex,*string); - CleanupStack::PopAndDestroy(string); - } - } - -// --------------------------------------------------------------------------- -// This function creates a string that will become en element of a list box. To create the string, the function -// concatenates several sub-strings. -// --------------------------------------------------------------------------- -// -HBufC* CDefaultAppServMimeApps::GetServiceAndMimeStringLC(CServiceMime& aServMime, TBool aInsertDefaultApp) const - { - HBufC *string=NULL; - TPtr *ptr=NULL; - TInt len; - _LIT(KTab,"\t"); - - if(aInsertDefaultApp && aServMime.iDefaultApp >= 0) //it may be that we do not have a default ... - len=aServMime.iApplications[aServMime.iDefaultApp]->iName->Size(); - else - len=0; - len+= aServMime.iServiceMime->Size(); - len+= KStringMargin ; - - string=HBufC::NewLC(len); - - //build the string, add the tabs before and after - ptr=new (ELeave) TPtr(string->Des()); - CleanupStack::PushL(ptr); - - ptr->Copy(*aServMime.iServiceMime); - - if(aInsertDefaultApp) - { - ptr->Insert(0,KTab); - ptr->Append(KTab); - - //add default app - if(aServMime.iDefaultApp >= 0) //it may be that we do not have a default ... - ptr->Append(*aServMime.iApplications[aServMime.iDefaultApp]->iName); - } - - CleanupStack::PopAndDestroy(ptr); - - return string; //pass ownership, string also on the stack - - } - -// --------------------------------------------------------------------------- -// This function creates a string that will become en element of a list box. To create the string, the function -// concatenates several sub-strings. -// --------------------------------------------------------------------------- -// -HBufC* CDefaultAppServMimeApps::GetMediaTaskStringLC(CMediaTask& aMediaTask, TBool aInsertDefaultApp) const - { - TPtr *ptr=NULL; - TInt len = KStringMargin; - _LIT(KTab,"\t"); - HBufC *taskName=NULL; //not owned, not deleted at the end of function - - //compute the string length - if(aInsertDefaultApp) - { - //we insert the task list name - taskName = aMediaTask.iTaskList; - //we also insert the length od the default app (if we have it) - if(aMediaTask.iDefaultApp >= 0)//it may be that we do not have a default ... - len += aMediaTask.iApplications[aMediaTask.iDefaultApp]->iName->Size(); - } - else - { - //we should insert the task title, if we have it - taskName = aMediaTask.iTaskTitle; - //taskName = aMediaTask.iTaskList; - }; - len += taskName->Size(); - - //allocate the string - HBufC *string=HBufC::NewLC(len); - - //add the title - ptr=new (ELeave) TPtr(string->Des()); - CleanupStack::PushL(ptr); - ptr->Copy(*taskName); - - //add other stuff - if(aInsertDefaultApp) - { - ptr->Insert(0,KTab); - ptr->Append(KTab); - //add default app - if(aMediaTask.iDefaultApp >= 0) //it may be that we do not have a default ... - ptr->Append(*aMediaTask.iApplications[aMediaTask.iDefaultApp]->iName); - } - - CleanupStack::PopAndDestroy(ptr); - - return string; //pass ownership, string also on the stack - } - -// --------------------------------------------------------------------------- -// This function resets (removes) the defaults associated with a certain task, -// or it can remove all the defaults -// --------------------------------------------------------------------------- -// -TInt CDefaultAppServMimeApps::RestoreFactorySettingsL(TInt aCathegory) - { - TInt i, j; - CServiceRegistry *sr=NULL; - - if(aCathegory == -1) - { - sr=CServiceRegistry::NewL(); - - if ( iSimplifiedView ) - { - for(i=0; iiMimes.Count(); j++) - { - sr->RemoveEntry(TUid::Uid(iTasks[i]->iServicesUids[j]), TDataType(*iTasks[i]->iMimes[j])); - } - //remove the entry that identifies the default app for the task - sr->RemoveEntry(KOpenServiceUid, TDataType(*iTasks[i]->iMimeLabel)); - } - } - else - { - //we reset the defaults for all the services & MIME - for(i=0; iRemoveEntry(iServMimes[i]->iServiceUid, TDataType(*iServMimes[i]->iMime)); - //remove the entry that identifies the default app for the task - for(i=0; iRemoveEntry(KOpenServiceUid, TDataType(*iTasks[i]->iMimeLabel)); - } - } - else if(iSimplifiedView && aCathegory >= 0 && aCathegory < iTasks.Count()) - { - //we are in simplified view, restore defaults for a single task - sr=CServiceRegistry::NewL(); - for(i=0; iiMimes.Count(); i++) - sr->RemoveEntry(TUid::Uid(iTasks[aCathegory]->iServicesUids[i]), TDataType(*iTasks[aCathegory]->iMimes[i])); - //remove the entry that identifies the default app for the task - sr->RemoveEntry(KOpenServiceUid, TDataType(*iTasks[aCathegory]->iMimeLabel)); - } - else if(!iSimplifiedView && aCathegory >= 0 && aCathegory < iServMimes.Count()) - { - //we are in the advanced view, restore defaults for a single Service & MIME pair - sr=CServiceRegistry::NewL(); - sr->RemoveEntry(iServMimes[aCathegory]->iServiceUid, TDataType(*iServMimes[aCathegory]->iMime)); - } - else return -1; //wrong aCathegory range - - if(sr) delete sr; - return 0; - } diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_srvmime_dlg.cpp --- a/defaultapplicationsettings/server/src/das_srvmime_dlg.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,530 +0,0 @@ -/* -* Copyright (c) 2005-2008 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: Implementation of the Services & MIME view class -* -*/ - - - -// System includes -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "das_srvmime_dlg.h" -#include "das_servmimeapps.h" -#include "das_appui.h" -#include "das_app.h" -#include "das.hrh" -#include "das.hlp.hrh" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Symbian 2-phased constructor -// --------------------------------------------------------------------------- -// -CDefaultAppSrvMimeDlg* CDefaultAppSrvMimeDlg::NewL(CDefaultAppAppUi* aAppUi) - { - //we first need to create a CDefaultAppServMimeApps instance - TInt *selected; - if(aAppUi->iReloadDlgAdvanced) - { - //some settings for the advanced view - selected=&(aAppUi->iSelectedItemAdvanced); - } - else - { - //some settings for the simple view - selected=&(aAppUi->iSelectedItemSimple); - }; - - //create the dialog instance (ownership of servMimeApps is passed to the dialog - CDefaultAppSrvMimeDlg *dialog=new(ELeave)CDefaultAppSrvMimeDlg(aAppUi, selected); - CleanupStack::PushL(dialog); - dialog->ConstructL(R_DAS_MENUBAR); - CleanupStack::Pop(dialog); - return dialog; - } - -// --------------------------------------------------------------------------- -// C++ Constructor -// --------------------------------------------------------------------------- -// -CDefaultAppSrvMimeDlg::CDefaultAppSrvMimeDlg(CDefaultAppAppUi* aAppUi, TInt *aSelected) : - CAknSelectionListDialog(*aSelected, &aAppUi->iServMimeApps->iList, NULL), - iDefaultAppUi(aAppUi), iSelected(aSelected), iOkToExit(EFalse) - { - //no implementation necessary - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CDefaultAppSrvMimeDlg::~CDefaultAppSrvMimeDlg() - { - if ( iDefaultAppUi ) - { - iDefaultAppUi->SetDialogExist( EFalse ); - } - - if ( iPopupList ) - { - iPopupList->CancelPopup(); - iPopupList = NULL; - } - } - - -// --------------------------------------------------------------------------- -// From class From CAknSelectionListDialog -// This function is called when buttons/softkeys are pressed, to check if the dlg should exit. -// We make the checkings and return the result. -// --------------------------------------------------------------------------- -// -TBool CDefaultAppSrvMimeDlg::OkToExitL(TInt aButtonId) - { - CAknSelectionListDialog::OkToExitL(aButtonId); - if ( aButtonId == EAknSoftkeyOptions && iPopupList ) - { - iPopupList->CancelPopup(); - iPopupList = NULL; - } - if(aButtonId == EAknSoftkeyBack || aButtonId == EAknCmdOpen || aButtonId == EAknSoftkeyOk) - { - ProcessCommandL(aButtonId); - }; - if(aButtonId==EAknCmdEnd || aButtonId==EAknSoftkeyCancel) - { - iOkToExit=ETrue; - iDefaultAppUi->iReloadDlg=EFalse; - } - return iOkToExit; - } - -// --------------------------------------------------------------------------- -// From class From CAknSelectionListDialog -// This function is called when a command is issued by the user. -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::ProcessCommandL(TInt aCommand) - { - CAknSelectionListDialog::ProcessCommandL(aCommand); //this hides the menu and takes care of find - iEnterKeyPressed=EFalse; - - - *iSelected = ListBox()->CurrentItemIndex(); - if (FindBox() && *iSelected != -1) - *iSelected = STATIC_CAST(CAknFilteredTextListBoxModel*,ListBox()->Model())->Filter()->FilteredItemIndex(*iSelected); - // ATTENTION: If *iSelected is -1 it means that the list is empty! - - - switch(aCommand) - { - case EDasCmdAdvanced: - //SwitchViewL(); - - //make the dialog reload - iDefaultAppUi->iReloadDlgAdvanced=ETrue; - iOkToExit=ETrue; - //force our exit - TryExitL(0); - - break; - case EAknCmdHelp: - HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), iDefaultAppUi->AppHelpContextL()); - break; - case EDasCmdResetAll: - case EDasCmdResetSelected: - if(aCommand==EDasCmdResetSelected) - { - if(*iSelected!=-1) - iDefaultAppUi->iServMimeApps->RestoreFactorySettingsL(*iSelected); - } - else - iDefaultAppUi->iServMimeApps->RestoreFactorySettingsL(-1); - - //common code: - //reload the dialog - if(!iDefaultAppUi->iServMimeApps->iSimplifiedView) - iDefaultAppUi->iReloadDlgAdvanced=ETrue; - iOkToExit=ETrue; - //delete the iServMimeApps so that it will be reloaded next time - delete iDefaultAppUi->iServMimeApps; - iDefaultAppUi->iServMimeApps=NULL; - //force our exit - TryExitL(0); - break; - case EAknCmdExit: - //exit the server - iOkToExit=ETrue; - iDefaultAppUi->iReloadDlg=EFalse; - //force our exit - TryExitL(0); - break; - case EAknSoftkeyBack: - //we have 2 cases here: - //if we are in the advanced view, we switch back to the simple view. - //if we are in the simple view, then we exit the server - if(iDefaultAppUi->iServMimeApps->iAppUid == KUidGS && !iDefaultAppUi->iServMimeApps->iSimplifiedView) - { - //switch back to simple view - //make the dialog reload - iDefaultAppUi->iReloadDlgAdvanced=EFalse; - iOkToExit=ETrue; - // no need to force our exit, we are comming from a TryExitL() - } - else - { - //exit the server - iOkToExit=ETrue; - iDefaultAppUi->iReloadDlg=EFalse; - //tell AppUi that the exit is due a "Back" command - iDefaultAppUi->iExitBack=ETrue; - } - break; - case EAknCmdOpen: - case EAknSoftkeyOk: - //we have the index of the selected item in *iSelected - OpenMenuForSelectedServiceAndMimeL(*iSelected); - break; - } - } - -// --------------------------------------------------------------------------- -// From class From CAknSelectionListDialog -// Called during the construction of the dialog. We build the list of elements here. -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::PreLayoutDynInitL() - { - CAknSelectionListDialog::PreLayoutDynInitL(); - - CEikSettingsListBox* listbox=(CEikSettingsListBox*)ListBox(); - // Ownership retained by us - listbox->CreateScrollBarFrameL( ETrue ); - listbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); - listbox->UpdateScrollBarsL(); - - //enable marquee - EnableMarqueeL(); - - //restore the selected item - if(*iSelected >= 0) - { - listbox->SetCurrentItemIndex(*iSelected); - }; - - //change the title - CEikStatusPane *statusPane=iDefaultAppUi->StatusPane(); - if(statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent()) - { - CAknTitlePane *titlePane=(CAknTitlePane*)(statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle))); - HBufC* titleString; - //load the correct title string - if(iDefaultAppUi->iReloadDlgAdvanced) - { - if(iDefaultAppUi->iClientUid == KUidGS) - //User activated advanced view in Control Panel - titleString=StringLoader::LoadLC(R_DA_TITLE_ADVANCED); - else //Client is some application other than Control Panel; load app specific view. - titleString=StringLoader::LoadLC(R_DA_TITLE_APP); - } - else //Simple view in Control Panel - titleString=StringLoader::LoadLC(R_DA_TITLE_MAIN); - titlePane->SetTextL(*titleString); - CleanupStack::PopAndDestroy(titleString); - }; - - ListBox()->AddItemChangeObserverL( this ); - } - -// --------------------------------------------------------------------------- -// From class CAknDialog. -// Called when the menu is initialized. -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - if (aResourceId != R_DAS_MENU) return; - __ASSERT_ALWAYS(iDefaultAppUi->iServMimeApps,User::Leave(KErrGeneral)); - - // for !iSimplifiedView dim the EDasCmdAdvanced - if(!iDefaultAppUi->iServMimeApps->iSimplifiedView) - aMenuPane->SetItemDimmed(EDasCmdAdvanced, ETrue); - - // if the Client is not observing when we are exiting, then dim the Exit - if(iDefaultAppUi->iServMimeApps->iFlagNoObserver) - aMenuPane->SetItemDimmed(EAknCmdExit, ETrue); - - // Help should be displayed only if the feature is supported - // according to Feature Manager - if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) - { - aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); - } - //if the findbox already exists, dim the find menu item. - if ( FindBox()->IsVisible() ) - { - aMenuPane->SetItemDimmed(EAknCmdFindPopupActivated, ETrue); - } - - CTextListBoxModel* modelSm = ( ( CEikSettingsListBox* )ListBox() )->Model(); // not taking ownership - TInt itemCount = modelSm->NumberOfItems(); - //if the listbox is empty, dim the change menu item. - if (itemCount == 0) - { - aMenuPane->SetItemDimmed(EAknCmdOpen, ETrue); - } - - } - -// --------------------------------------------------------------------------- -// From class CCoeControl. -// Called to get the help context. -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::GetHelpContext(TCoeHelpContext& aContext) const - { - aContext.iMajor = KUidDefaultAppServer; - - //check if we have proper values - if(!iDefaultAppUi->iServMimeApps) - aContext.iContext = KDA_HLP_MAIN; - else - { - //check for GS client - if (iDefaultAppUi->iServMimeApps->iAppUid == KUidGS) - { - //the client is GS. Check for simplified or advanced view - if (iDefaultAppUi->iServMimeApps->iSimplifiedView) - aContext.iContext = KDA_HLP_MAIN; - else - aContext.iContext = KDA_HLP_ADVANCED; - } - else - { - //this is not GS client - aContext.iContext = KDA_HLP_APPLICATION; - }; - }; - } - -// --------------------------------------------------------------------------- -// From class CCoeControl. -// Called to get the help context. -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::SizeChanged() - { - CAknSelectionListDialog::SizeChanged(); - } - - -// --------------------------------------------------------------------------- -// Enables marquee for the list elements. -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::EnableMarqueeL() - { - CFormattedCellListBoxData *tmp=((CEikSettingsListBox*)(ListBox()))->ItemDrawer()->FormattedCellData(); - - tmp->SetMarqueeParams(KMaxTInt, 6, 2000000, 10000); // Magic: loop forever - tmp->EnableMarqueeL(ETrue); - } - - -// --------------------------------------------------------------------------- -// Loads icons from a file and sets them in the drawer for iSavedGamesList -// --------------------------------------------------------------------------- -// -CArrayPtr* CDefaultAppSrvMimeDlg::GetPopupListIconsL() const - { - // CGulIcon class packages two bitmaps: icon image and its mask - // CAknIconArray inherits from CArrayPtrFlat - CArrayPtr* iconList = new (ELeave) - CAknIconArray(2); - CleanupStack::PushL(iconList); - - TFileName iconFile( AknIconUtils::AvkonIconFileName() ); - MAknsSkinInstance* skinInstance; - CFbsBitmap* newIconBmp = NULL; - CFbsBitmap* newIconBmpMask = NULL; - CGulIcon* newIcon = NULL; - - skinInstance = AknsUtils::SkinInstance(); - - //creating blank icon - AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropEmpty, - newIconBmp,newIconBmpMask,iconFile, - EMbmAvkonQgn_prop_empty, - EMbmAvkonQgn_prop_empty_mask); - - newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask); - - CleanupStack::Pop(2);//newIconBmp & newIconBmpMask - CleanupStack::PushL(newIcon); - iconList->AppendL(newIcon); - - CleanupStack::Pop(newIcon); - - //creating TICK mark icon - AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropSubCurrent, - newIconBmp,newIconBmpMask,iconFile, - EMbmAvkonQgn_prop_sub_current, - EMbmAvkonQgn_prop_sub_current_mask); - - newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask); - - CleanupStack::Pop(2);//newIconBmp & newIconBmpMask - CleanupStack::PushL(newIcon); - iconList->AppendL(newIcon); - - CleanupStack::Pop(newIcon); - - CleanupStack::Pop(iconList); - - newIconBmp = NULL; - newIconBmpMask = NULL; - newIcon = NULL; - - return iconList; - } - - -// --------------------------------------------------------------------------- -// Pops-up a menu list with the Applications for the selected Service & MIME item -// --------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::OpenMenuForSelectedServiceAndMimeL(TInt aSelectedIndex) - { - if(!iDefaultAppUi->iServMimeApps)User::Leave(KErrNotFound); - if(aSelectedIndex<0)return; //there is no selected item (list is empty) - - CAknSingleGraphicPopupMenuStyleListBox *selectedServiceAndMime = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox; - CleanupStack::PushL(selectedServiceAndMime); - - if ( iPopupList != NULL ) - { - iPopupList->CancelPopup(); - iPopupList = NULL; - } - - iPopupList = CAknPopupList::NewL(selectedServiceAndMime, R_AVKON_SOFTKEYS_OK_CANCEL); - selectedServiceAndMime->ConstructL(iPopupList,EAknListBoxMenuList); - selectedServiceAndMime->CreateScrollBarFrameL (ETrue); - selectedServiceAndMime->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); - - //construct icons - CArrayPtr* icons=GetPopupListIconsL(); - selectedServiceAndMime->ItemDrawer()->ColumnData()->SetIconArray(icons); // passing ownership of icons - - - //populate the applications list - CTextListBoxModel* modelApps = selectedServiceAndMime->Model(); // not taking ownership - modelApps->SetOwnershipType (ELbmOwnsItemArray); - CDesCArray* applications = STATIC_CAST(CDesCArray*, modelApps->ItemTextArray()); - HBufC* listTitle=NULL; - iDefaultAppUi->iServMimeApps->GetApplicationsListL(aSelectedIndex, *applications, listTitle); - - - //set the title of the list - CleanupStack::PushL(listTitle); - iPopupList->SetTitleL(*listTitle); - CleanupStack::PopAndDestroy(listTitle); - // - TInt popupOk = iPopupList->ExecuteLD(); - iPopupList = NULL; - - if(popupOk) - { - TInt selected = selectedServiceAndMime->CurrentItemIndex(); - - //update the default in the array & list - //get the list array first - CTextListBoxModel* modelSm = ((CEikSettingsListBox*)ListBox())->Model(); // not taking ownership - //modelSm->SetOwnershipType (ELbmOwnsItemArray); - CDesCArray* servicesAndMimesArray = STATIC_CAST(CDesCArray*, modelSm->ItemTextArray()); - //do the update - iDefaultAppUi->iServMimeApps->UpdateDefaultL(aSelectedIndex,selected,servicesAndMimesArray); - //redraw the list - DrawNow(); - } - CleanupStack::PopAndDestroy(selectedServiceAndMime); - } - -// --------------------------------------------------------------------------- -// OfferKeyEventL from ccoecontrol -// --------------------------------------------------------------------------- -// -TKeyResponse CDefaultAppSrvMimeDlg::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) - { - if ( aKeyEvent.iCode == EKeyBackspace ) - { - if ( FindBox()->TextLength() >0 ) - { - return FindBox()->OfferKeyEventL( aKeyEvent, aType ); - } - } - return CAknSelectionListDialog::OfferKeyEventL( aKeyEvent ,aType ); - } - -// ----------------------------------------------------------------------------- -// CDefaultAppSrvMimeDlg::ListBoxItemsChanged (from MListBoxItemChangeObserver) -// -// ----------------------------------------------------------------------------- -// -void CDefaultAppSrvMimeDlg::ListBoxItemsChanged( CEikListBox* aListBox ) - { - if ( aListBox ) - { - CEikButtonGroupContainer& cba = ButtonGroupContainer(); - CTextListBoxModel* modelSm = ((CEikSettingsListBox*)aListBox)->Model(); // not taking ownership - TInt itemCount = modelSm->NumberOfItems(); - if (itemCount == 0) - { - cba.MakeCommandVisible(EAknCmdOpen, EFalse); - } - else - { - cba.MakeCommandVisible(EAknCmdOpen, ETrue); - } - } - } - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/server/src/das_view.cpp --- a/defaultapplicationsettings/server/src/das_view.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation of the view class -* -*/ - - - -// System includes - -#include "das_view.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CDefaultAppView::NewL() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CDefaultAppView* CDefaultAppView::NewL( const TRect& aRect ) - { - CDefaultAppView* self = CDefaultAppView::NewLC( aRect ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CDefaultAppView::NewLC() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CDefaultAppView* CDefaultAppView::NewLC( const TRect& aRect ) - { - CDefaultAppView* self = new ( ELeave ) CDefaultAppView; - CleanupStack::PushL( self ); - self->ConstructL( aRect ); - return self; - } - -// ----------------------------------------------------------------------------- -// CDefaultAppView::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CDefaultAppView::ConstructL( const TRect& aRect ) - { - // Create a window for this application view - CreateWindowL(); - - // Set the windows size - SetRect( aRect ); - - // Activate the window, which makes it ready to be drawn - ActivateL(); - } - -// ----------------------------------------------------------------------------- -// CDefaultAppView::CDefaultAppView() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CDefaultAppView::CDefaultAppView() - { - // No implementation required - } - - -// ----------------------------------------------------------------------------- -// CDefaultAppView::~CDefaultAppView() -// Destructor. -// ----------------------------------------------------------------------------- -// -CDefaultAppView::~CDefaultAppView() - { - // No implementation required - } - - -// ----------------------------------------------------------------------------- -// CDefaultAppView::Draw() -// Draws the display. -// ----------------------------------------------------------------------------- -// -void CDefaultAppView::Draw( const TRect& /*aRect*/ ) const - { - // Get the standard graphics context - CWindowGc& gc = SystemGc(); - - // Gets the control's extent - TRect drawRect( Rect()); - - - } - -// ----------------------------------------------------------------------------- -// CDefaultAppView::SizeChanged() -// Called by framework when the view size is changed. -// ----------------------------------------------------------------------------- -// -void CDefaultAppView::SizeChanged() - { - DrawNow(); - } diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/BWINS/defaultappclientU.DEF --- a/defaultapplicationsettings/service/BWINS/defaultappclientU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - ??1CDefaultAppClient@@UAE@XZ @ 1 NONAME ; CDefaultAppClient::~CDefaultAppClient(void) - ?ChangeDefaultsL@CDefaultAppClient@@QAEXH@Z @ 2 NONAME ; void CDefaultAppClient::ChangeDefaultsL(int) - ?NewL@CDefaultAppClient@@SAPAV1@PAVMAknServerAppExitObserver@@@Z @ 3 NONAME ; class CDefaultAppClient * CDefaultAppClient::NewL(class MAknServerAppExitObserver *) - ?NewLC@CDefaultAppClient@@SAPAV1@PAVMAknServerAppExitObserver@@@Z @ 4 NONAME ; class CDefaultAppClient * CDefaultAppClient::NewLC(class MAknServerAppExitObserver *) - ?PairsToDisplayL@CDefaultAppClient@@QAEHXZ @ 5 NONAME ; int CDefaultAppClient::PairsToDisplayL(void) - ?ServiceAvailable@CDefaultAppClient@@SAHAAH@Z @ 6 NONAME ; int CDefaultAppClient::ServiceAvailable(int &) - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/EABI/defaultappclientU.DEF --- a/defaultapplicationsettings/service/EABI/defaultappclientU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -EXPORTS - _ZN17CDefaultAppClient15ChangeDefaultsLEi @ 1 NONAME - _ZN17CDefaultAppClient15PairsToDisplayLEv @ 2 NONAME - _ZN17CDefaultAppClient16ServiceAvailableERi @ 3 NONAME - _ZN17CDefaultAppClient4NewLEP25MAknServerAppExitObserver @ 4 NONAME - _ZN17CDefaultAppClient5NewLCEP25MAknServerAppExitObserver @ 5 NONAME - _ZN17CDefaultAppClientD0Ev @ 6 NONAME - _ZN17CDefaultAppClientD1Ev @ 7 NONAME - _ZN17CDefaultAppClientD2Ev @ 8 NONAME - _ZTI17CDefaultAppClient @ 9 NONAME ; ## - _ZTI18RDefaultAppService @ 10 NONAME ; ## - _ZTV17CDefaultAppClient @ 11 NONAME ; ## - _ZTV18RDefaultAppService @ 12 NONAME ; ## - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/group/bld.inf --- a/defaultapplicationsettings/service/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Build information file for project DefaultAppServer - Service -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES -das_service.mmp - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/group/das_service.mmp --- a/defaultapplicationsettings/service/group/das_service.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Project definition file for project DefaultAppServer - Service -* -*/ - - - -#include -#include - -TARGET defaultappclient.dll -TARGETTYPE DLL -UID 0x1000008d 0x10281B9E - -CAPABILITY CAP_GENERAL_DLL DRM -VENDORID VID_DEFAULT - -// Define directories for the .def-files of WINSCW build. -// IMPORTANT NOTICE: The lines in the example that end with a backslash -// must have one space after the backslash. -#if defined(ARMCC) -deffile ../EABI/ -#elif defined( WINSCW ) -deffile ../BWINS/ -#endif - -SOURCEPATH ../src -SOURCE das_service.cpp -SOURCE das_client.cpp - -USERINCLUDE ../inc - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY apgrfx.lib -LIBRARY avkon.lib -LIBRARY eikcore.lib -LIBRARY apparc.lib - -//EXPORTUNFROZEN diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/inc/das_service.h --- a/defaultapplicationsettings/service/inc/das_service.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This class defines the service used to change the default app. -* -*/ - - - -#ifndef R_DEFAULTAPPSERVICE_H -#define R_DEFAULTAPPSERVICE_H - -#include - -/** - * Definition for the default app service - * - * This class defines the client side of the default app service. - * - * @lib defaultappclient.dll - * @since S60 v5.0 - */ -class RDefaultAppService : public RAknAppServiceBase - { - -private: - - /** messages used */ - enum TIpcMessageIds - { - ESetDefaultAll = RApaAppServiceBase::KServiceCmdBase - }; -public: - - /** - * Sends SetDefault message to the server - * - * @since S60 v5.0 - * @param aFlags service class (value is transparent for this class/function) - * @return 0 for success, negative value on failure - */ - TInt SetDefault( TInt aFlags ); - -private: // From RApaAppServiceBase - - /** - * From RApaAppServiceBase. - * Returns the uid of the service - * - * @since S60 v5.0 - * @return the Uid of the provided service (Default App Service) - */ - TUid ServiceUid() const; - }; - - -#endif // R_DEFAULTAPPSERVICE_H - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/src/das_client.cpp --- a/defaultapplicationsettings/service/src/das_client.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This class implemets the Default App Client API -* -*/ - - -#include -#include - - -#include -#include "das_service.h" - -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#include // new file introduced by xSymbian -#endif - -const TUid KDefaultAppServiceUid = { 0x10281B9D }; - - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CDefaultAppClient::NewL() -// -// -// --------------------------------------------------------------------------- -// -EXPORT_C CDefaultAppClient* CDefaultAppClient::NewL( MAknServerAppExitObserver* aObserver ) - { - CDefaultAppClient* self = CDefaultAppClient::NewLC( aObserver ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CDefaultAppClient::NewLC() -// -// -// --------------------------------------------------------------------------- -// -EXPORT_C CDefaultAppClient* CDefaultAppClient::NewLC( MAknServerAppExitObserver* aObserver ) - { - CDefaultAppClient* self = new ( ELeave ) CDefaultAppClient; - CleanupStack::PushL( self ); - self->ConstructL( aObserver ); - return self; - } - -// --------------------------------------------------------------------------- -// CDefaultAppClient::CDefaultAppClient() -// Default constructor -// -// --------------------------------------------------------------------------- -// -CDefaultAppClient::CDefaultAppClient() - { - iServerAppUid.iUid = 0; - } - -// --------------------------------------------------------------------------- -// CDefaultAppClient::ConstructL() -// -// -// --------------------------------------------------------------------------- -// -void CDefaultAppClient::ConstructL( MAknServerAppExitObserver* aObserver ) - { - iObserver=aObserver; - iService = new (ELeave) RDefaultAppService; - } - -// --------------------------------------------------------------------------- -// CDefaultAppClient::~CDefaultAppClient -// -// -// --------------------------------------------------------------------------- -// -EXPORT_C CDefaultAppClient::~CDefaultAppClient() - { - if(iMonitor) - { - iMonitor->Cancel(); - delete iMonitor; - }; - if(iService) - { - iService->Close(); - delete iService; - }; - - - - // iObserver is not owned - } - - -// --------------------------------------------------------------------------- -// Function to check if a server is present in the system. If the -// server is present, the subsequent functions should not fail due -// to server unavailability. -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CDefaultAppClient::ServiceAvailable(TInt& aErrorCode) - { - TRAP(aErrorCode,GetServiceParamsL(NULL)); - if(aErrorCode != KErrNone) return EFalse; - return ETrue; - } - -// --------------------------------------------------------------------------- -// Function to check the number of Service & MIME pairs the server would display if the -// ChangeDefaultsL() would be called. The purpose of this function -// is to allow the client application not to display an entry for starting the server, in the -// Options menu, in case the Server's list of Service & MIME pairs is empty. -// -// Please note that the function may return a higher number than the actual number -// of pairs, because it does not check for MIMEs with System priority (that would not be -// displayed). -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CDefaultAppClient::PairsToDisplayL() - { - RApaLsSession ls; - TInt i,j; - TInt pairs=0; - - //Get own UID - TUid clientAppUid = User::Identity(); - - //connect - User::LeaveIfError(ls.Connect()); - - //we are connected, so some initialization - CleanupClosePushL( ls ); - User::LeaveIfError(ls.GetAllApps()); - - //get all services & MIMEs supported by our application - CApaAppServiceInfoArray* servicesAndDataTypes=ls.GetAppServicesLC(clientAppUid); - - for(i=0; iArray().Count(); i++ ) - { - const TApaAppServiceInfo currentServiceInfo = servicesAndDataTypes->Array()[i]; - for ( j = 0 ; j < currentServiceInfo.DataTypes().Count() ; j++ ) - { - //check if there are more than one applications supporting this Service & MIME pair - CApaAppServiceInfoArray* apps=ls.GetServiceImplementationsLC(currentServiceInfo.Uid(),currentServiceInfo.DataTypes()[j].iDataType); - - if(apps->Array().Count()>1) - { - //more that one app handles this Service & MIME - pairs++; - }; - - CleanupStack::PopAndDestroy(apps); - }; - }; - - //clean - CleanupStack::PopAndDestroy(servicesAndDataTypes); - CleanupStack::PopAndDestroy(); // closes RApaLsSession - - return pairs; - } - -// --------------------------------------------------------------------------- -// This function launches the server, as a chained application. The client application will not be -// available to the user until the server does not exit. -// When the server exits, the client application gains control again. The observer (if specified -// during instantiation (NewL) is notified that the server has exited. -// --------------------------------------------------------------------------- -// -EXPORT_C void CDefaultAppClient::ChangeDefaultsL( TInt aFlags ) - { - if(iServerAppUid.iUid == 0) - GetServiceParamsL( &iServerAppUid ); - - iService->ConnectChainedAppL(iServerAppUid); - - if(iObserver) - iMonitor = CApaServerAppExitMonitor::NewL(*iService, *iObserver, CActive::EPriorityStandard); - else - aFlags|=EFlagNoObserver; - - iService->SetDefault(aFlags); - } - - - -// --------------------------------------------------------------------------- -// This function finds out the uid of the Default Application Server -// (the application registered to handle the DefaultApp service) -// --------------------------------------------------------------------------- -// -void CDefaultAppClient::GetServiceParamsL( TUid *aServerAppUid) - { - CApaAppServiceInfoArray* services = NULL; - RApaLsSession ls; - TInt count = 0; //number of services found so far. - - User::LeaveIfError(ls.Connect()); - CleanupClosePushL( ls ); - - User::LeaveIfError(ls.GetServerApps( KDefaultAppServiceUid )); - - services = ls.GetServiceImplementationsLC( KDefaultAppServiceUid ); - - if( services ) - { - count = services->Array().Count(); - // get the server's Uid - if( aServerAppUid ) - aServerAppUid->iUid = services->Array()[0].Uid().iUid; - }; - CleanupStack::PopAndDestroy( 2 ); // destroys services + closes RApaLsSession - - if ( count == 0) User::Leave(KErrNotFound); - if ( count > 1) User::Leave(KErrNotSupported); - - // if we are here, it means that we have a single server handling the defaults - } - - - - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/service/src/das_service.cpp --- a/defaultapplicationsettings/service/src/das_service.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: This class defines the service used to change the default app. -* -*/ - - -#include "das_service.h" - - -// ======== MEMBER FUNCTIONS ======== - - -const TUid KDefaultAppServiceUid = { 0x10281B9D }; - -// --------------------------------------------------------------------------- -// Sends SetDefault message to the server -// --------------------------------------------------------------------------- -// -TInt RDefaultAppService::SetDefault( TInt aFlags ) - { - return SendReceive( ESetDefaultAll, TIpcArgs( aFlags ) ); - } - -// --------------------------------------------------------------------------- -// From class RApaAppServiceBase. -// Returns the uid of the service -// --------------------------------------------------------------------------- -// -TUid RDefaultAppService::ServiceUid() const - { - return KDefaultAppServiceUid; - } diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/services_db/BWINS/servicesdbU.DEF --- a/defaultapplicationsettings/services_db/BWINS/servicesdbU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - ??1CServicesDB@@UAE@XZ @ 1 NONAME ; CServicesDB::~CServicesDB(void) - ?Count@CServicesDB@@QBEHXZ @ 2 NONAME ; int CServicesDB::Count(void) const - ?NewL@CServicesDB@@SAPAV1@PAVTResourceReader@@@Z @ 3 NONAME ; class CServicesDB * CServicesDB::NewL(class TResourceReader *) - ?NewLC@CServicesDB@@SAPAV1@PAVTResourceReader@@@Z @ 4 NONAME ; class CServicesDB * CServicesDB::NewLC(class TResourceReader *) - ?ServiceNameLC@CServicesDB@@QBEPAVHBufC16@@H@Z @ 5 NONAME ; class HBufC16 * CServicesDB::ServiceNameLC(int) const - ?ServiceNameLC@CServicesDB@@QBEPAVHBufC16@@VTUid@@@Z @ 6 NONAME ; class HBufC16 * CServicesDB::ServiceNameLC(class TUid) const - ?ServiceStringLC@CServicesDB@@QBEPAVHBufC16@@HABVTDes16@@@Z @ 7 NONAME ; class HBufC16 * CServicesDB::ServiceStringLC(int, class TDes16 const &) const - ?ServiceStringLC@CServicesDB@@QBEPAVHBufC16@@VTUid@@ABVTDes16@@@Z @ 8 NONAME ; class HBufC16 * CServicesDB::ServiceStringLC(class TUid, class TDes16 const &) const - ?ServiceUidL@CServicesDB@@QBE?AVTUid@@H@Z @ 9 NONAME ; class TUid CServicesDB::ServiceUidL(int) const - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/services_db/Eabi/servicesdbU.DEF --- a/defaultapplicationsettings/services_db/Eabi/servicesdbU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -EXPORTS - _ZN11CServicesDB4NewLEP15TResourceReader @ 1 NONAME - _ZN11CServicesDB5NewLCEP15TResourceReader @ 2 NONAME - _ZN11CServicesDBD0Ev @ 3 NONAME - _ZN11CServicesDBD1Ev @ 4 NONAME - _ZN11CServicesDBD2Ev @ 5 NONAME - _ZNK11CServicesDB11ServiceUidLEi @ 6 NONAME - _ZNK11CServicesDB13ServiceNameLCE4TUid @ 7 NONAME - _ZNK11CServicesDB13ServiceNameLCEi @ 8 NONAME - _ZNK11CServicesDB15ServiceStringLCE4TUidRK6TDes16 @ 9 NONAME - _ZNK11CServicesDB15ServiceStringLCEiRK6TDes16 @ 10 NONAME - _ZNK11CServicesDB5CountEv @ 11 NONAME - _ZTI11CServicesDB @ 12 NONAME DATA 12 ; ## - _ZTV11CServicesDB @ 13 NONAME DATA 20 ; ## - diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/services_db/group/bld.inf --- a/defaultapplicationsettings/services_db/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Build information file for project Service DB -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - - -PRJ_MMPFILES -services_db.mmp - -PRJ_TESTMMPFILES - - -PRJ_TESTEXPORTS diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/services_db/group/services_db.mmp --- a/defaultapplicationsettings/services_db/group/services_db.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Project definition file for Services DB -* -*/ - - - -#include -#include - -TARGET servicesdb.dll -TARGETTYPE DLL -UID 0x1000008d 0x10281B9F - -CAPABILITY CAP_GENERAL_DLL DRM -VENDORID VID_DEFAULT - -// Define directories for the .def-files of WINSCW build. -// IMPORTANT NOTICE: The lines in the example that end with a backslash -// must have one space after the backslash. -#if defined(ARMCC) -deffile ../Eabi/ -#elif defined( WINSCW ) -deffile ../BWINS/ -#endif - - -SOURCEPATH ../src -SOURCE services_db.cpp - -USERINCLUDE ../inc - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY commonengine.lib -LIBRARY bafl.lib //TResourceReader - -//EXPORTUNFROZEN diff -r 3fec62e6e7fc -r 90fe62538f66 defaultapplicationsettings/services_db/src/services_db.cpp --- a/defaultapplicationsettings/services_db/src/services_db.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements the Services DB API -* -*/ - - -#include -#include -#include - -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CServicesDB::NewLC() -// -// -// --------------------------------------------------------------------------- -// -EXPORT_C CServicesDB* CServicesDB::NewLC( TResourceReader* aResReader ) - { - CServicesDB* self = new (ELeave) CServicesDB(); - CleanupStack::PushL(self); - self->ConstructL(aResReader); - return self; - } - -// --------------------------------------------------------------------------- -// CServicesDB::NewL() -// -// -// --------------------------------------------------------------------------- -// -EXPORT_C CServicesDB* CServicesDB::NewL( TResourceReader* aResReader ) - { - CServicesDB* self = CServicesDB::NewLC(aResReader); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// CServicesDB::CServicesDB() -// -// -// --------------------------------------------------------------------------- -// -CServicesDB::CServicesDB() - { - //no implementation necessary - } - -// --------------------------------------------------------------------------- -// CServicesDB::~CServicesDB() -// -// -// --------------------------------------------------------------------------- -// -EXPORT_C CServicesDB::~CServicesDB() - { - iServiceUids.Close(); - iServiceNames.ResetAndDestroy(); - iServiceLoc.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// The class is constructed by reading the data from the specified resource id into memory -// --------------------------------------------------------------------------- -// -void CServicesDB::ConstructL( TResourceReader* aResReader ) - { - TInt i; - TInt count = aResReader->ReadInt16(); - for ( i = 0; i < count; i++ ) - { - //read the service uid - TInt uid=aResReader->ReadInt32(); - if(uid == 0)User::Leave(KErrArgument); - //read the service name - HBufC* service=aResReader->ReadHBufCL(); - if(!service)User::Leave(KErrArgument); - //read the localized string - HBufC* serviceLoc=aResReader->ReadHBufCL(); - if(!serviceLoc)User::Leave(KErrArgument); - - //append things - iServiceUids.Append(uid); - iServiceNames.Append(service);//takes ownership - iServiceLoc.Append(serviceLoc);//takes ownership - } - //done - } - -// --------------------------------------------------------------------------- -// Returns the number of available services -// (the number of services read from the resource during construction) -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CServicesDB::Count() const - { - return iServiceUids.Count(); - } - -// --------------------------------------------------------------------------- -// Function to return the Uid of a service (by index). -// --------------------------------------------------------------------------- -// -EXPORT_C TUid CServicesDB::ServiceUidL(TInt aIndex) const - { - if(aIndex<0 || aIndex>=iServiceUids.Count()) - User::Leave(KErrArgument); - return TUid::Uid(iServiceUids[aIndex]); - } - - -// --------------------------------------------------------------------------- -// Function to return the localized name associated with a service. If the returned -// strings accepts a parameter, this can be specified as aParam -// --------------------------------------------------------------------------- -// -EXPORT_C HBufC* CServicesDB::ServiceStringLC(TInt aIndex, const TDes& aParam) const - { - TInt size=aParam.Size(); - HBufC *string=NULL; - - //check parameters - if(aIndex<0 || aIndex>=iServiceUids.Count()) - User::Leave(KErrArgument); - - //get the size of the new string - size+=iServiceLoc[aIndex]->Size(); - //allocate the string - string = HBufC::NewLC(size); - //create string content - TPtr ptr=string->Des(); - if(aParam.Size()) - { - //we have something in aParam - //ptr.Format(*iServiceLoc[aIndex],&aParam); - StringLoader::Format(ptr,*iServiceLoc[aIndex],-1,aParam); - } - else - { - //nothing in aParam, just copy the localized string to string - ptr.Copy(*iServiceLoc[aIndex]); - } - //done, return - return string; //string is on the stack, too - } - -// --------------------------------------------------------------------------- -// Function to return the localized name associated with a service. If the returned -// strings accepts a parameter, this can be specified as aParam -// --------------------------------------------------------------------------- -// -EXPORT_C HBufC* CServicesDB::ServiceStringLC(TUid aServiceUid, const TDes& aParam) const - { - HBufC* string=NULL; - TInt i; - - //look for the service UIDs - for(i=0; i=iServiceUids.Count()) - User::Leave(KErrArgument); - - //get the size of the new string - size=iServiceNames[aIndex]->Size(); - //allocate the string - string = HBufC::NewLC(size); - //create string content - TPtr ptr=string->Des(); - ptr.Copy(*iServiceNames[aIndex]); - return string; - } - -// --------------------------------------------------------------------------- -// Function to return the generic name of a service. -// --------------------------------------------------------------------------- -// -EXPORT_C HBufC* CServicesDB::ServiceNameLC(TUid aServiceUid) const - { - HBufC* string=NULL; - TInt i; - - //loc for the service UIDs - for(i=0; i - - Default App Client API - API for launching the Default App Server and allow the user to change the default app for Services & MIMEs - c++ - DefaultApplicationSettings - - - - - - - - - no - no - - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/group/bld.inf --- a/devmngt_plat/default_app_client_api/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006 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: File that exports the files belonging to -: Default App Client API -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/das_client.h APP_LAYER_PLATFORM_EXPORT_PATH(das_client.h) diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/inc/das_client.h --- a/devmngt_plat/default_app_client_api/inc/das_client.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Client interface to ask for setting the default application -* -*/ - - - -#ifndef C_DEFAULTAPPCLIENT_H -#define C_DEFAULTAPPCLIENT_H - -#include -#include -#include - -class RDefaultAppService; - - -/** - * Client API for setting the default application. - * - * This class defines the API that applications should use to trigger the launch of the - * Default Application Server, that asks the user to select default applications for those - * Service & MIME pairs for which the client application is a candidate. - * - * A client application should first instantiate the service, using eithe NewL() or NewLC() - * The client application can check first if the sercive is available in the system (by using - * the ServiceAvailable() function. The client application may also check if there is - * anything to display (if there is any Service & MIME that the client application supports for - * which there is at least another application supporting the pair). If there is no such pair, - * then launching the server would display an empty list). This checking is performed using the - * PairsToDisplayL() function. - * - * After the above checkings are done, the client application can ask the server to change - * defaults by calling the ChangeDefaultsL() function. - * - * - * @lib defaultappclient.dll - * @since S60 v5.0 - */ -class CDefaultAppClient : public CBase - { - -public: - - /** flags used to modify the service behaviour */ - enum TFlags - { - EFlagNoObserver=1, - EFlagReserved1=2, - EFlagReserved2=4 - }; - - /** - * Symbian OS two-phased constructor - * @return - */ - IMPORT_C static CDefaultAppClient* NewL(MAknServerAppExitObserver* aObserver); - - /** - * Symbian OS two-phased constructor - * @return - */ - IMPORT_C static CDefaultAppClient* NewLC(MAknServerAppExitObserver* aObserver); - - /** - * Destructor. - */ - IMPORT_C virtual ~CDefaultAppClient(); - - /** - * Function to check if a server is present in the system. If the - * server is present, the subsequent functions should not fail due - * to server unavailability. - * - * @since S60 v5.0 - * @return ETrue or EFalse, depending service/server availability - */ - IMPORT_C static TBool ServiceAvailable( TInt& aErrorCode ); - - /** - * Function to check the number of Service & MIME pairs the server would display if the - * ChangeDefaultsL() would be called. The purpose of this function - * is to allow the client application not to display an entry for starting the server, in the - * Options menu, in case the Server's list of Service & MIME pairs is empty. - * - * Please note that the function may return a higher number than the actual number - * of pairs, because it does not check for MIMEs with System priority (that would not be - * displayed). - * - * @since S60 v5.0 - * @return the number of Service & MIME pairs the server would display - */ - IMPORT_C TInt PairsToDisplayL(); - - /** - * This function launches the server, as a chained application. The client application will not be - * available to the user until the server does not exit. - * When the server exits, the client application gains control again. The observer (if specified - * during instantiation (NewL) is notified that the server has exited. - * - * @since S60 v5.0 - * @param aFlags service flags - */ - IMPORT_C void ChangeDefaultsL( TInt aFlags = 0 ); - - -private: - - /** - * C++ default constructor. - */ - CDefaultAppClient(); - - /** - * Symbian constructor. - */ - void ConstructL( MAknServerAppExitObserver* aObserver ); - - /** - * This function finds out the uid of the Default Application Server - * (the application registered to handle the DefaultApp service) - * - * @since S60 v5.0 - * @param aServerAppUid If parameter is non-NULL, it returns the Uid of the server there - */ - static void GetServiceParamsL( TUid* aServerAppUid); - -private: // data - - /** - * The UID of the server application (we discover the server) - */ - TUid iServerAppUid; - - /** - * Pointer to the service class. - * Own. - */ - RDefaultAppService *iService; - - /** - * Pointer to the Observer to call after the operation initiated by - * ChangeDefaultsAsyncL() has finished. - * Not Owned. - */ - MAknServerAppExitObserver* iObserver; - - /** - * Monitor object that calls the iObserver when the server has exited. - * Owned. - */ - CApaServerAppExitMonitor* iMonitor; - - }; - -#endif // C_DEFAULTAPPCLIENT_H diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/bwins/DasClientApiTestU.DEF --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/bwins/DasClientApiTestU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/eabi/DasClientApiTestU.def --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/eabi/DasClientApiTestU.def Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.bat --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.bat Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -copy C:\TestFramework\testframework_DasClientApiTest.ini C:\TestFramework\TestFramework.ini -md e:\bctest -md e:\bctest\Results - -ATSINTERFACE.EXE -testmodule testcombiner -config C:\TestFramework\uiDasClientApiTest.cfg -copy c:\Logs\TestFramework\TestReport.txt e:\bctest\results\DAS_TEST.txt \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.iby --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2002-2005 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: Personalisation application localised resource IBY -* -*/ - - -/* ------------------------------------------------------------------------------ - - DESCRIPTION - - stiftestframework_DasClientApiTest.iby file specifies needed test components for - ROM image - ------------------------------------------------------------------------------ -*/ - -#ifndef DasClientApiTest__IBY -#define DasClientApiTest__IBY - -file=ABI_DIR\BUILD_DIR\DasClientApiTest.DLL SHARED_LIB_DIR\DasClientApiTest.DLL - -data=\epoc32\data\z\system\data\testframework_DasClientApiTest.ini testframework\testframework_DasClientApiTest.ini - -data=\epoc32\data\z\system\data\tcDasClientApiTest.cfg testframework\tcDasClientApiTest.cfg - -data=\epoc32\data\z\system\data\ui_DasClientApiTest.cfg testframework\ui_DasClientApiTest.cfg - -#endif // DasClientApiTest__IBY \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.mmp --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Project specification file of DasClientApiTest -* -*/ - - -#include -#include - -TARGET DasClientApiTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB - -DEFFILE DasClientApiTest.def - -//START RESOURCE ../data/DasClientApiTest_reg.rss -// TARGETPATH /private/10003a3f/apps -//END - -#ifdef SBSV2 -USERINCLUDE ../inc - - MW_LAYER_SYSTEMINCLUDE - -#else // SBSV2 not defined -USERINCLUDE ../inc -APP_LAYER_SYSTEMINCLUDE - - -SOURCEPATH ../src -#endif // SBSV2 - -SOURCE DasClientApiTest.cpp -SOURCE DasClientApiTestblocks.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY defaultappclient.lib//default application client -LIBRARY avkon.lib//MAknServerAppExitObserver -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eiksrv.lib - -LANG SC - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.pkg --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/DasClientApiTest.pkg Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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: Installation file for STIF -; -; -; -; -; Installation file for STIF -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\urel\DasClientApiTest.dll" - "!:\Sys\Bin\DasClientApiTest.dll" - -"\Epoc32\winscw\c\testframework\testframework_DasClientApiTest.ini"-"!:\TestFramework\testframework_DasClientApiTest.ini" -"\Epoc32\winscw\c\testframework\tcDasClientApiTest.cfg"-"!:\TestFramework\tcDasClientApiTest.cfg" -"\Epoc32\winscw\c\testframework\ui_DasClientApiTest.cfg"-"!:\TestFramework\ui_DasClientApiTest.cfg" -"\epoc32\winscw\c\DasClientApiTest.bat"-"!:\DASTest.bat" -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/bld.inf --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Build information file for project DasClientApiTest -* -*/ - - - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these -DEFAULT - -#ifdef SBSV2 - PRJ_TESTEXPORTS - DasClientApiTest.iby /epoc32/rom/include/DasClientApiTest.iby - - ../init/testframework_DasClientApiTest.ini /epoc32/data/z/system/data/testframework.ini - - ../conf/ui_DasClientApiTest.cfg /epoc32/winscw/c/TestFramework/ui_DasClientApiTest.cfg - - ../conf/tcDasClientApiTest.cfg /epoc32/wins/c/TestFramework/tcDasClientApiTest.cfg - -#else // SBSV2 not defined - PRJ_TESTEXPORTS - - ../init/testframework_DasClientApiTest.ini /epoc32/wins/c/TestFramework/testframework.ini - ../init/testframework_DasClientApiTest.ini /epoc32/winscw/c/TestFramework/testframework.ini - - ../conf/ui_DasClientApiTest.cfg /epoc32/wins/c/TestFramework/ui_DasClientApiTest.cfg - ../conf/ui_DasClientApiTest.cfg /epoc32/data/z/system/data/ui_DasClientApiTest.cfg - - ../conf/tcDasClientApiTest.cfg /epoc32/winscw/c/TestFramework/tcDasClientApiTest.cfg - ../conf/tcDasClientApiTest.cfg /epoc32/data/z/system/data/tcDasClientApiTest.cfg - -#endif // SBSV2 - -DasClientApiTest.iby /epoc32/rom/include/DasClientApiTest.iby -../init/testframework_DasClientApiTest.ini /epoc32/data/z/system/data/testframework.ini -../init/testframework_DasClientApiTest.ini /epoc32/winscw/c/testframework/testframework_DasClientApiTest.ini -../conf/ui_DasClientApiTest.cfg /epoc32/winscw/c/TestFramework/ui_DasClientApiTest.cfg -../conf/tcDasClientApiTest.cfg /epoc32/wins/c/TestFramework/tcDasClientApiTest.cfg - -PRJ_EXPORTS - -DasClientApiTest.bat /epoc32/winscw/c/DasClientApiTest.bat - -//testframework_DasClientApiTest.ini /epoc32/winscw/c/testframework/testframework_DasClientApiTest.ini -//tcDasClientApiTest.cfg /epoc32/winscw/c/testframework/tcDasClientApiTest.cfg -//ui_DasClientApiTest.cfg /epoc32/winscw/c/testframework/ui_DasClientApiTest.cfg - -PRJ_TESTMMPFILES -DasClientApiTest.mmp - -PRJ_MMPFILES - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/CClientLauncher.h --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/CClientLauncher.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: CCClientLauncher declaration. -* -*/ - -#ifndef CCLIENTLAUNCHER_H -#define CCLIENTLAUNCHER_H - -// INCLUDES -#include -#include -#include -#include - -// CLASS DECLARATION - -/** - * CCClientLauncher - * - */ -class CCClientLauncher : public CAknAppUi,public MAknServerAppExitObserver - { -public: - // Constructors and destructor - - /** - * Destructor. - */ - ~CCClientLauncher(); - - /** - * Two-phased constructor. - */ - static CCClientLauncher* NewL(); - - /** - * Two-phased constructor. - */ - static CCClientLauncher* NewLC(); - -public: - //function from CAknAppUi - void ProcessCommandL (TInt aCommand); - -private: - //function from MAknServerAppExitObserver - //handle the exit of the server. - void HandleServerAppExit(TInt aReason); - -private: - - /** - * Constructor for performing 1st stage construction - */ - CCClientLauncher(); - - /** - * EPOC default constructor for performing 2nd stage construction - */ - void ConstructL(); - - }; - -#endif // CCLIENTLAUNCHER_H diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/DasClientApiTest.h --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/inc/DasClientApiTest.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation of class CDasClientApiTest -* -*/ - - -#ifndef C_DASCLIENTAPITEST_H -#define C_DASCLIENTAPITEST_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -// -#include -// MACROS -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 -// User MACROS -#define KErrGeneral -2 -#define KFirstOption 1 -#define KSecondtOption 2 - -//define client flags -#define KFlagNoObserver 1 -#define KFlagReserved1 2 -#define KFlagReserved2 4 -// Logging path -_LIT( KDasClientApiTestLogPath, "\\logs\\testframework\\DasClientApiTest\\" ); -// Log file -_LIT( KDasClientApiTestLogFile, "DasClientApiTest.txt" ); -_LIT( KDasClientApiTestLogFileWithTitle, "DasClientApiTest_[%S].txt" ); - -// -/** -* CDasClientApiTest test class for STIF Test Framework TestScripter. -* @since S60 5.0 -*/ - -NONSHARABLE_CLASS(CDasClientApiTest) : public CScriptBase/*,public MAknServerAppExitObserver*/ - { -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CDasClientApiTest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CDasClientApiTest(); - -/*private: - //function from MAknServerAppExitObserver. is used to handle the exit of the server. - - void HandleServerAppExit(TInt aReason);*/ - -public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since S60 5.0 - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - -private: - - /** - * C++ default constructor. - */ - CDasClientApiTest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Frees all resources allocated from test methods. - * @since S60 5.0 - */ - void Delete(); - - /** - * Test method. - * @since S60 5.0 - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - virtual TInt InitialClientL(const TInt aOption ); - - virtual TInt CallClientNewLL( CStifItemParser& aItem ); - - virtual TInt CallClientNewLCL( CStifItemParser& aItem ); - - virtual TInt CallServiceAvailableL( CStifItemParser& aItem ); - -// virtual TInt CallPairsToDisplayLL( CStifItemParser& aItem ); - - virtual TInt CallChangeDefaultsLL( CStifItemParser& aItem ); - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - /** - * Turn off ScreenSaver - * @since S60 5.0 - * @return Symbian OS error code. - */ - void TurnOffScreenSaver(); - - /** - * Restore ScreenSaver - * @since S60 5.0 - * @return Symbian OS error code. - */ - void RestoreScreenSaver(); - - - /** - * In this method NewLC is called. - * @since ?Series60_version - * @param aResReader Resource reader to get information from Resource file - * @return Symbian OS error code. - */ - void CallNewlcL( MAknServerAppExitObserver* aObserver ); - - -private: // Data - - /** - * ScreenSaver Property - */ - TInt iOldScreenSaverProperty; - - /** - * ?description_of_pointer_member - * Not own. - */ - //?type* ?member_name; - CDefaultAppClient* iClient; - - // - CCClientLauncher* iLauncher; - - }; - -#endif // C_DASCLIENTAPITEST_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTest.cpp --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTest.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation of class CDasClientApiTest -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include - -#include "DasClientApiTest.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CDasClientApiTest::CDasClientApiTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CDasClientApiTest::CDasClientApiTest( CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CDasClientApiTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CDasClientApiTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings(loggerSettings); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if(loggerSettings.iAddTestCaseTitle) - { - TName title; - TestModuleIf().GetTestCaseTitleL(title); - logFileName.Format(KDasClientApiTestLogFileWithTitle, &title); - } - else - { - logFileName.Copy(KDasClientApiTestLogFile); - } - - iLog = CStifLogger::NewL( KDasClientApiTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - - TurnOffScreenSaver(); - } - -// ----------------------------------------------------------------------------- -// CDasClientApiTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CDasClientApiTest* CDasClientApiTest::NewL( CTestModuleIf& aTestModuleIf ) - { - CDasClientApiTest* self = new( ELeave ) CDasClientApiTest( aTestModuleIf ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -CDasClientApiTest::~CDasClientApiTest() - { - - // Delete resources allocated from test methods - Delete(); - - // Delete logger - delete iLog; - - } - -//----------------------------------------------------------------------------- -// CDasClientApiTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CDasClientApiTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L( "DasClientApiTest.dll" ); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, - newVersionOfMethod ); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - return ( CScriptBase* ) CDasClientApiTest::NewL( aTestModuleIf ); - } - -// ----------------------------------------------------------------------------- -// Turn off ScreenSaver -// ----------------------------------------------------------------------------- -// -void CDasClientApiTest::TurnOffScreenSaver() - { - //TInt Get(TUid aCategory, TUint aKey, TInt &aValue); - TInt err1 = RProperty::Get( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, - iOldScreenSaverProperty ); - TInt err2 = RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, - KScreenSaverAllowScreenSaver ); - RDebug::Printf( "screensaver property=%d err1=%d err2=%d\n", - iOldScreenSaverProperty, err1, err2 ); - } - -// ----------------------------------------------------------------------------- -// Restore ScreenSaver -// ----------------------------------------------------------------------------- -// -void CDasClientApiTest::RestoreScreenSaver() - { - RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, - iOldScreenSaverProperty ); - User::ResetInactivityTime(); - } - - -// End of File - - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTestblocks.cpp --- a/devmngt_plat/default_app_client_api/tsrc/DasClientApiTest/src/DasClientApiTestblocks.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +0,0 @@ -/* -/* -* Copyright (c) 2002 - 2007 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: This cpp file has the functions to test Das Client API. -* -*/ - - -// [INCLUDE FILES] -#include -#include -#include -#include "DasClientApiTest.h" - - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CDasClientApiTest::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void CDasClientApiTest::Delete() - { - if( iLauncher ) - { - delete iLauncher; - iLauncher = NULL; - } - - if( iClient ) - { - delete iClient; - iClient = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CDasClientApiTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt CDasClientApiTest::RunMethodL( - CStifItemParser& aItem ) - { - - static TStifFunctionInfo const KFunctions[] = - { - // First string is the function name used in TestScripter script file. - // Second is the actual implementation member function. - ENTRY( "CallClientNewLL", CDasClientApiTest::CallClientNewLL ), - ENTRY( "CallClientNewLCL", CDasClientApiTest::CallClientNewLCL ), - ENTRY( "CallServiceAvailableL", CDasClientApiTest::CallServiceAvailableL ), - ENTRY( "CallChangeDefaultsLL", CDasClientApiTest::CallChangeDefaultsLL ), - // [test cases entries] - - }; - - const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); - - return RunInternalL( KFunctions, count, aItem ); - - } - -// ----------------------------------------------------------------------------- -// CDasClientApiTest::CallNewlcL -// This function is used because we can not TRAP CServicesDB::NewLC -// ----------------------------------------------------------------------------- -// -void CDasClientApiTest::CallNewlcL( MAknServerAppExitObserver* aObserver ) -{ - iClient = CDefaultAppClient::NewLC( aObserver ); - CleanupStack::Pop( iClient ); -} - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::InitialClientL -// This function is used to create CDefaultAppClient object. This function is used -// to call CDefaultAppClient::NewL and CDefaultAppClient::NewLC functions. -// ----------------------------------------------------------------------------- -// -TInt CDasClientApiTest::InitialClientL( TInt aOption ) - { - //launcher of the client; - if( aOption == KFirstOption ) - { - TRAPD( error, iClient = CDefaultAppClient::NewL( NULL ) ); - if( KErrNone != error ) - { - iLog->Log( _L( "=>CDefaultAppClient::NewL leaves" ) ); - return error; - } - } - else - { - TRAPD( error1, CallNewlcL( NULL ) ); - if( KErrNone != error1 ) - { - iLog->Log( _L( "=>CDefaultAppClient::NewLC leaves" ) ); - return error1; - } - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallClientNewLL -// Is used to test CDefaultAppClient::NewL -// ----------------------------------------------------------------------------- -TInt CDasClientApiTest::CallClientNewLL( CStifItemParser& /*aItem*/ ) - { - TInt result; - - TRAPD( error, result = InitialClientL( KFirstOption ) ); - if( KErrNone != error ) - { - iLog->Log( _L( "CDefaultAppClient object not created with NewL." ) ); - return error; - } - else - { - if( KErrNone != result ) - { - iLog->Log( _L( "CDefaultAppClient object not created with NewL." ) ); - return result; - } - else - { - iLog->Log( _L( "CDefaultAppClient object created with NewL." ) ); - } - }; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallClientNewLCL -// Is used to test CDefaultAppClient::NewLC -// ----------------------------------------------------------------------------- -TInt CDasClientApiTest::CallClientNewLCL( CStifItemParser& /*aItem*/ ) - { - TInt result; - TRAPD( error, result = InitialClientL( KSecondtOption ) ); - if( KErrNone != error ) - { - return error; - } - else - { - if( KErrNone != result ) - { - return result; - } - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallServiceAvailableL -// Is used to test CDefaultAppClient::ServiceAvailableL -// ----------------------------------------------------------------------------- -TInt CDasClientApiTest::CallServiceAvailableL( CStifItemParser& /*aItem*/ ) - { - //Initial the iClient - TInt result; - TRAPD( error, result = InitialClientL( KFirstOption ) ); - if( KErrNone != error ) - { - return error; - } - else - { - if( KErrNone != result ) - { - return result; - } - }; - //call the function - - TInt errcode; - TBool returnvalue; - TRAPD( callerror, returnvalue = CDefaultAppClient::ServiceAvailable( errcode ) ); - if( KErrNone != callerror ) - { - iLog->Log(_L( "Call function ServiceAvailable failed.The function leaves,the leace code is %d"), callerror ); - return callerror; - } - else - { - if( returnvalue != KErrNone ) - { - iLog->Log( _L( "The function returned sucessfully,But the service is not available. The error code is %d" ), errcode ); - return errcode; - } - else - { - iLog->Log( _L( "The function ServiceAvailable called success, and the service is available! " ) ); - } - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallChangeDefaultsLL -// Is used to test CDefaultAppClient::ChangeDefaultsL -// ----------------------------------------------------------------------------- -TInt CDasClientApiTest::CallChangeDefaultsLL( CStifItemParser& /*aItem*/ ) - { - // - TInt result; - TRAPD( error, result = InitialClientL( KFirstOption ) ); - if(KErrNone != error) - { - iLog->Log( _L( "Initial the iClient failed,the failed code is %d" ), error ); - return error; - } - else - { - if( KErrNone != result ) - { - return result; - } - }; - TRAPD( errorCall, iClient->ChangeDefaultsL() ); - if( errorCall != KErrNone ) - { - iLog->Log( _L( "Function ChangeDefaultsL is called failed. The failed code is %d" ), errorCall ); - return errorCall; - } - else - { - iLog->Log( _L( "The Function is called successfully." ) ); - } - return KErrNone; - } - -// -// [End of File] diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/group/bld.inf --- a/devmngt_plat/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2006 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: Includes all the Domain API specific bld.inf files, which -* export files. -* -*/ - - - -#include "../default_app_client_api/group/bld.inf" -#include "../services_db_api/group/bld.inf" - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/group/bld.inf --- a/devmngt_plat/services_db_api/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2006 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: File that exports the files belonging to -: Services DB API -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/services_db.rh APP_LAYER_PLATFORM_EXPORT_PATH(services_db.rh) -../inc/services_db.h APP_LAYER_PLATFORM_EXPORT_PATH(services_db.h) diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/inc/services_db.h --- a/devmngt_plat/services_db_api/inc/services_db.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implementation of class CServicesDB -* -*/ - - - -#ifndef SERVICES_DB_H -#define SERVICES_DB_H - -#include -#include - -class TResourceReader; - -/** - * API for retrieving various localized strings associated with services. - * - * This class receives a resource ID during construction (resource type is DAS_SERVICES) - * and retrieves various info defined in this resource. - * - * @lib defaultappclient.dll - * @since S60 v5.0 - */ -class CServicesDB : public CBase - { - -public: - /** - * Symbian OS two-phased constructor - * @return - */ - IMPORT_C static CServicesDB* NewL( TResourceReader* aResReader ); - - /** - * Symbian OS two-phased constructor - * @return - */ - IMPORT_C static CServicesDB* NewLC( TResourceReader* aResReader ); - - /** - * Destructor. - */ - IMPORT_C ~CServicesDB(); - -public: - - /** - * Returns the number of available services - * (the number of services read from the resource during construction) - * - * @since S60 v5.0 - * @return number of available services/elements - */ - IMPORT_C TInt Count() const; - - /** - * Function to return the Uid of a service (by index). - * - * @since S60 v5.0 - * @return the uid of the service (it leaves if aIndex is not a valid index) - */ - IMPORT_C TUid ServiceUidL(TInt aIndex) const; - - /** - * Function to return the localized name associated with a service. If the returned - * strings accepts a parameter, this can be specified as aParam - * - * @since S60 v5.0 - * @param aIndex the index of the service - * @param aParam parameter for the localized string - * @return the localized name (it leaves if aIndex is not a valid index) - */ - IMPORT_C HBufC* ServiceStringLC(TInt aIndex, const TDes& aParam) const; - - /** - * Function to return the localized name associated with a service. If the returned - * strings accepts a parameter, this can be specified as aParam - * - * @since S60 v5.0 - * @param aServiceUid the Uid of the service - * @param aParam parameter for the localized string - * @return the localized name (NULL, if the service is not found) - */ - IMPORT_C HBufC* ServiceStringLC(TUid aServiceUid, const TDes& aParam) const; - - /** - * Function to return the generic name of a service. - * - * @since S60 v5.0 - * @param aIndex the index of the service - * @return the generic name of the service (it leaves if aIndex is not a valid index) - */ - IMPORT_C HBufC* ServiceNameLC(TInt aIndex) const; - - /** - * Function to return the generic name of a service. - * - * @since S60 v5.0 - * @param aServiceUid the Uid of the service - * @return the generic name of the service (NULL, if the service is not found) - */ - IMPORT_C HBufC* ServiceNameLC(TUid aServiceUid) const; - -private: - - /** - * C++ default constructor. - */ - CServicesDB(); - - /** - * Symbian constructor. - */ - void ConstructL( TResourceReader* aResReader ); - -private: - /** - * array of service Uids - */ - RArray iServiceUids; - - /** - * array of service names - */ - RPointerArray iServiceNames; - - /** - * array of service localized names - */ - RPointerArray iServiceLoc; - }; - -#endif // SERVICES_DB_H diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/inc/services_db.rh --- a/devmngt_plat/services_db_api/inc/services_db.rh Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Resource headers for project Services DB -* -*/ - - -#ifndef SERVICES_DB_RH -#define SERVICES_DB_RH - - -// --------------------------------------------------------------------------- -// This structure defines a service entry: it holds the service uid, -// service generic name, and service localized string -// --------------------------------------------------------------------------- -// -STRUCT DAS_SERVICE_ENTRY - { - LONG service_uid; - LTEXT service_name; - LTEXT service_localized_name; - } - -// --------------------------------------------------------------------------- -// This structure defines a list of service entries -// --------------------------------------------------------------------------- -// -STRUCT DAS_SERVICES - { - STRUCT services[]; //Type is DAS_SERVICE_ENTRY - } - -#endif // SERVICES_DB_RH diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/services_db_api.metaxml --- a/devmngt_plat/services_db_api/services_db_api.metaxml Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - Services DB API - API for retrieving information about services: UID, generic name (in engineering English), localized name. - c++ - DefaultApplicationSettings - - - - - - - - - no - no - - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bmarm/ServicesDbApiTestU.DEF --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bmarm/ServicesDbApiTestU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bwins/ServicesDbApiTestU.DEF --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/Bwins/ServicesDbApiTestU.DEF Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/EABI/ServicesDbApiTestU.def --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/EABI/ServicesDbApiTestU.def Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/conf/ui_ServicesDbApiTest.cfg --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/conf/ui_ServicesDbApiTest.cfg Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -################################################################################### -# -# This cfg file has tests for Services DB API -# The resource file - ServicesDbApiTest.rss defined to test this api has the following services. -# The tests listed below are based on this resource file services -# -# RESOURCE DAS_SERVICES r_da_service_mime -# { -# services = -# { -# DAS_SERVICE_ENTRY -# { -# service_uid = 0x101; // NOT A REAL UID - 257 -# service_name = "Open"; -# service_localized_name = "Open Localized"; -# }, -# DAS_SERVICE_ENTRY -# { -# service_uid = 0x102; // NOT A REAL UID - 258 -# service_name = "Upload"; -# service_localized_name = "Upload Localized"; -# }, -# DAS_SERVICE_ENTRY -# { -# service_uid = 0x103; // NOT A REAL UID - 259 -# service_name = "Print"; -# service_localized_name = "Print Localized %U"; -# } -# }; -# -################################################################################### - - -[Define] -KFirstServiceIndex 0 -KSecondServiceIndex 1 -KThirdServiceIndex 2 -KNotAServiceInResourceIndex 10 -KFirstServiceUid 257 -KSecondServiceUid 258 -KThirdServiceUid 259 -KNotAServiceInResourceUid 260 -KErrGeneral -2 -KErrArgument -6 -[Enddefine] - - -# This test case is for NewL -# 1 -[Test] -title Initialize Services DB -create ServicesDbApiTest foobar -foobar InitializeSeviceDB -delete foobar -[Endtest] - -# This test case is for NewLC -# 2 -[Test] -title Initialize on stack -create ServicesDbApiTest foobar -foobar InitializeonStackSeviceDB -delete foobar -[Endtest] - -# Testing Count function -# 3 -[Test] -title CountSeviceDB -create ServicesDbApiTest foobar -foobar CountSeviceDB -delete foobar -[Endtest] - -###################################################################### -# Testing ServiceUidL function with different INDEX parameters -###################################################################### -# 4 -[Test] -title Test ServiceUidL - No parameter -create ServicesDbApiTest foobar -allownextresult KErrGeneral -foobar ServiceUidLSeviceDB -delete foobar -[Endtest] - -#5 -[Test] -title Test ServiceUidL 0 INDEX -create ServicesDbApiTest foobar -foobar ServiceUidLSeviceDB KFirstServiceIndex -delete foobar -[Endtest] - -#6 -[Test] -title Test ServiceUidL 1 INDEX -create ServicesDbApiTest foobar -foobar ServiceUidLSeviceDB KSecondServiceIndex -delete foobar -[Endtest] - -#7 -[Test] -title Test ServiceUidL 2 INDEX -create ServicesDbApiTest foobar -foobar ServiceUidLSeviceDB KThirdServiceIndex -delete foobar -[Endtest] - -#8 -[Test] -title Test ServiceUidL Wrong INDEX -create ServicesDbApiTest foobar -allownextresult KErrArgument -foobar ServiceUidLSeviceDB KNotAServiceInResourceIndex -delete foobar -[Endtest] - -#--------------------------------------------------------------------# - -###################################################################### -# Testing ServiceStringLC function with different INDEX parameters -###################################################################### -#9 -[Test] -title Test ServiceStringLC with No Index -create ServicesDbApiTest foobar -allownextresult KErrGeneral -foobar ServiceStringLCSeviceDB -delete foobar -[Endtest] - -#10 -[Test] -title Test ServiceStringLC with 0 Index -create ServicesDbApiTest foobar -foobar ServiceStringLCSeviceDB KFirstServiceIndex -delete foobar -[Endtest] - -#11 -[Test] -title Test ServiceStringLC with 1 Index -create ServicesDbApiTest foobar -foobar ServiceStringLCSeviceDB KSecondServiceIndex -delete foobar -[Endtest] - -#12 -[Test] -title Test ServiceStringLC with 2 Index -create ServicesDbApiTest foobar -foobar ServiceStringLCSeviceDB KThirdServiceIndex -delete foobar -[Endtest] - -#13 -[Test] -title Test ServiceStringLC with wrong Index -create ServicesDbApiTest foobar -allownextresult KErrArgument -foobar ServiceStringLCSeviceDB KNotAServiceInResourceIndex -delete foobar -[Endtest] - -#--------------------------------------------------------------------# - -###################################################################### -# Testing ServiceStringLC function with different UID as parameters -###################################################################### -#14 -[Test] -title Test ServiceStringLC with No UID -create ServicesDbApiTest foobar -allownextresult KErrGeneral -foobar ServiceStringLCUIDSeviceDB -delete foobar -[Endtest] - -#15 -[Test] -title Test ServiceStringLC with 257 UID (0x101) -create ServicesDbApiTest foobar -foobar ServiceStringLCUIDSeviceDB KFirstServiceUid -delete foobar -[Endtest] - -#16 -[Test] -title Test ServiceStringLC with 258 UID (0x102) -create ServicesDbApiTest foobar -foobar ServiceStringLCUIDSeviceDB KSecondServiceUid -delete foobar -[Endtest] - -#17 -[Test] -title Test ServiceStringLC with 258 UID (0x103) -create ServicesDbApiTest foobar -foobar ServiceStringLCUIDSeviceDB KThirdServiceUid -delete foobar -[Endtest] - -#18 -[Test] -title Test ServiceStringLC with Wrong UID -create ServicesDbApiTest foobar -foobar ServiceStringLCUIDSeviceDB KNotAServiceInResourceUid -delete foobar -[Endtest] - -#--------------------------------------------------------------------# - -###################################################################### -# Testing ServiceNameLC function with different INDEX as parameters -###################################################################### -#19 -[Test] -title test ServiceNameLC with No parameter -allownextresult KErrGeneral -create ServicesDbApiTest foobar -foobar ServiceNameLCSeviceDB -delete foobar -[Endtest] - -#20 -[Test] -title test ServiceNameLC with 0 index -create ServicesDbApiTest foobar -foobar ServiceNameLCSeviceDB KFirstServiceIndex -delete foobar -[Endtest] - -#21 -[Test] -title test ServiceNameLC with 1 index -create ServicesDbApiTest foobar -foobar ServiceNameLCSeviceDB KSecondServiceIndex -delete foobar -[Endtest] - -#22 -[Test] -title test ServiceNameLC with 2 index -create ServicesDbApiTest foobar -foobar ServiceNameLCSeviceDB KThirdServiceIndex -delete foobar -[Endtest] - -#23 -[Test] -title test ServiceNameLC with incorrect index -create ServicesDbApiTest foobar -allownextresult KErrArgument -foobar ServiceNameLCSeviceDB KNotAServiceInResourceIndex -delete foobar -[Endtest] - -#--------------------------------------------------------------------# - -###################################################################### -# Testing ServiceNameLC function with different UID as parameters -###################################################################### -#24 -[Test] -title test ServiceNameLC with No Parameter -allownextresult KErrGeneral -create ServicesDbApiTest foobar -foobar ServiceNameLCuidSeviceDB -delete foobar -[Endtest] - -#25 -[Test] -title test ServiceNameLC with 257 UID (0x101) -create ServicesDbApiTest foobar -foobar ServiceNameLCuidSeviceDB KFirstServiceUid -delete foobar -[Endtest] - -#26 -[Test] -title test ServiceNameLC with 258 UID (0x102) -create ServicesDbApiTest foobar -foobar ServiceNameLCuidSeviceDB KSecondServiceUid -delete foobar -[Endtest] - -#27 -[Test] -title test ServiceNameLC with 259 UID (0x103) -create ServicesDbApiTest foobar -foobar ServiceNameLCuidSeviceDB KThirdServiceUid -delete foobar -[Endtest] - -#28 -[Test] -title test ServiceNameLC with 260 UID -create ServicesDbApiTest foobar -foobar ServiceNameLCuidSeviceDB KNotAServiceInResourceUid -delete foobar -[Endtest] diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/data/ServicesDbApiTest.rsc Binary file devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/data/ServicesDbApiTest.rsc has changed diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.iby --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2002-2005 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: Personalisation application localised resource IBY -* -*/ - - -#ifndef SERVICESDBAPITEST_IBY -#define SERVICESDBAPITEST_IBY - - -file=ABI_DIR/BUILD_DIR/ServicesDbApiTest.dll SHARED_LIB_DIR/ServicesDbApiTest.dll -data=DATAZ_/RESOURCE_FILES_DIR/ServicesDbApiTest.rsc RESOURCE_FILES_DIR/ServicesDbApiTest.rsc - -#endif // SERVICESDBAPITEST_IBY \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.mmp --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Project specification file of ServicesDbApiTest -* -*/ - - -#include -#include - -TARGET ServicesDbApiTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB - -VENDORID VID_DEFAULT - - -//TARGETPATH ?target_path -DEFFILE ServicesDbApiTest.def - - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../inc - -SOURCEPATH ../src - -SOURCE ServicesDbApiTest.cpp -SOURCE ServicesDbApiTestBlocks.cpp - -START RESOURCE ServicesDbApiTest.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -END // RESOURCE - - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY eikcore.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY servicesdb.lib -LIBRARY commonengine.lib - -LANG SC - -epocallowdlldata -/* -START WINS -?wins_specific_information -END - -START MARM -?marm_specific_information -END -*/ -// Other possible keywords: - -// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) -/* -START BITMAP ?target -TARGETPATH ?emulated_path_on_target_machine -HEADER -SOURCE ?color_depth ?source_bitmap -END -*/ -// DEFFILE ?filename -// AIF ?filename - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.pkg --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest.pkg Thu Aug 19 09:55:50 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: Installation file for STIF -; -; -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/urel/ServicesDbApiTest.dll" - "c:/Sys/Bin/ServicesDbApiTest.dll" -"/epoc32/data/z/resource/ServicesDbApiTest.rsc" - "c:/resource/ServicesDbApiTest.rsc" -;.cfg & .ini files -"..\init\TestFramework_SDB.ini" - "!:\TestFramework\TestFramework_SDB.ini" -"..\conf\ui_ServicesDbApiTest.cfg" - "!:\TestFramework\ui_ServicesDbApiTest.cfg" -;"proeng_c.bat" - "!:\proeng.bat" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_DoxyFile.txt --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_DoxyFile.txt Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -# Doxyfile 1.4.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = ServicesDbApiTest -PROJECT_NUMBER = -OUTPUT_DIRECTORY = P:\ServicesDbApiTest\ -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = NO -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = YES -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = NO -GENERATE_TESTLIST = NO -GENERATE_BUGLIST = NO -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = P:\ServicesDbApiTest\ -FILE_PATTERNS = *.h \ - *.rh \ - *.hrh -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = NO -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = YES -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = YES -TOC_EXPAND = YES -DISABLE_INDEX = YES -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = YES -RTF_OUTPUT = Doc -COMPACT_RTF = YES -RTF_HYPERLINKS = YES -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = NONSHARABLE_CLASS -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_nrm.mmp --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/ServicesDbApiTest_nrm.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Project specification file of ServicesDbApiTest -* -*/ - - -#include -#include - -TARGET ServicesDbApiTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB - -VENDORID VID_DEFAULT - - -//TARGETPATH ?target_path -DEFFILE ServicesDbApiTest.def - - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../inc - -SOURCEPATH ../src - -SOURCE ServicesDbApiTest.cpp -SOURCE ServicesDbApiTestBlocks.cpp - -START RESOURCE ServicesDbApiTest.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -END // RESOURCE - - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY eikcore.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY servicesdb.lib -LIBRARY commonengine.lib - -LANG SC - -epocallowdlldata -/* -START WINS -?wins_specific_information -END - -START MARM -?marm_specific_information -END -*/ -// Other possible keywords: - -// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) -/* -START BITMAP ?target -TARGETPATH ?emulated_path_on_target_machine -HEADER -SOURCE ?color_depth ?source_bitmap -END -*/ -// DEFFILE ?filename -// AIF ?filename - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/bld.inf --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Build information file for project ServicesDbApiTest -* -*/ - - - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these -DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include -// Example: -/* -/agnmodel/inc/AGMCOMON.H -*/ -//IBY file - - -PRJ_TESTMMPFILES -ServicesDbApiTest.mmp - -PRJ_MMPFILES -ServicesDbApiTest_nrm.mmp - -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. -// Example: -/* -/agnmodel/group/agnmodel.mmp -#if defined(MARM) -/agnmodel/group/agsvexe.mmp -#endif -*/ - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_c.bat --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_c.bat Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0"" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Copy file batch -rem - -copy C:\TestFramework\testframework_ProEngWrapAPI.ini C:\TestFramework\TestFramework.ini -md e:\BCTest -md e:\BCTest\Results - -ATSINTERFACE.EXE -testmodule testscripter -config C:\TestFramework\ProEngWrapAPI.cfg -copy c:\Logs\TestFramework\TestReport.txt e:\BCTest\results\SP_ProEngWrapAPI.txt - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_z.bat --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/group/proeng_z.bat Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0"" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Copy file batch -rem - -copy z:\TestFramework\testframework_ProEngWrapAPI.ini C:\TestFramework\TestFramework.ini -md e:\BCTest -md e:\BCTest\Results - -ATSINTERFACE.EXE -testmodule testscripter -config C:\TestFramework\ProEngWrapAPI.cfg -copy c:\Logs\TestFramework\TestReport.txt e:\BCTest\results\SP_ProEngWrapAPI.txt - - - diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/inc/ServicesDbApiTest.h --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/inc/ServicesDbApiTest.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Implementation of class CServicesDbApiTest -* -*/ - - - -#ifndef SERVICESDBAPITEST_H -#define SERVICESDBAPITEST_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -// MACROS -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Logging path -_LIT( KServicesDbApiTestLogPath, "\\logs\\testframework\\ServicesDbApiTest\\" ); -// Log file -_LIT( KServicesDbApiTestLogFile, "ServicesDbApiTest.txt" ); -_LIT( KServicesDbApiTestLogFileWithTitle, "ServicesDbApiTest_[%S].txt" ); - -_LIT(KEmptyString,""); - -// FORWARD DECLARATIONS -class CServicesDbApiTest; - - -//Constants -const TInt KNoOfServices = 3; // This is the number of services listed in resource file. -const TInt KFirstOption = 0; -const TInt KSecondOption = 1; -const TInt KFirstServiceIndex = 0; -const TInt KSecondServiceIndex = 1; -const TInt KThirdServiceIndex=2; -const TInt KFirstServiceUid = 257; -const TInt KSecondServiceUid = 258; -const TInt KThirdServiceUid = 259; -const TInt KBufSize = 128; - -// CLASS DECLARATION - -/** -* CServicesDbApiTest test class for STIF Test Framework TestScripter. -* This class is written to test Services DB API. -* -* @lib ServicesDbApiTest.lib -* @since ?Series60_version -*/ -NONSHARABLE_CLASS(CServicesDbApiTest) : public CScriptBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CServicesDbApiTest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CServicesDbApiTest(); - - - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - - private: - - /** - * C++ default constructor. - */ - CServicesDbApiTest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void Delete(); - - /** - * Test methods are listed below. - */ - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - //[TestMethods] - - /** - * Creates CServicesDB object - * @since ?Series60_version - * @param aOption Option to create CServicesDB object using NewL or NewLC - * @return Symbian OS error code. - */ - TInt CreateSeviceDBL(TInt aOption); - - /** - * In this method NewLC is called. - * @since ?Series60_version - * @param aResReader Resource reader to get information from Resource file - * @return Symbian OS error code. - */ - void CallNewlcL( TResourceReader aResReader ); - - /** - * This method is used to test CServicesDB::NewL - * @since ?Series60_version - * @param No parameters required - * @return Symbian OS error code. - */ - TInt InitializeSeviceDB( ); - - /** - * This method is used to test CServicesDB::NewLC - * @since ?Series60_version - * @param No parameters required - * @return Symbian OS error code. - */ - TInt InitializeonStackSeviceDB( ); - - /** - * This method is used to test CServicesDB::Count - * @since ?Series60_version - * @param No parameters required - * @return Symbian OS error code. - */ - TInt CountSeviceDB(); - - /** - * This method is used to test CServicesDB::ServiceUidL - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - TInt ServiceUidLSeviceDB( CStifItemParser& aItem ); - - /** - * This method is used to test CServicesDB::ServiceStringLC - * with Index as parameter. - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - TInt ServiceStringLCSeviceDB( CStifItemParser& aItem ); - - /** - * This method is used to test CServicesDB::ServiceStringLC - * with UID as parameter - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - TInt ServiceStringLCuidSeviceDB( CStifItemParser& aItem ); - - /** - * This method is used to test CServicesDB::ServiceNameLC - * with Index as parameter - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - TInt ServiceNameLCSeviceDB( CStifItemParser& aItem ); - - /** - * This method is used to test CServicesDB::ServiceNameLC - * with UID as parameter - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - TInt ServiceNameLCuidSeviceDB( CStifItemParser& aItem ); - - /** - * This is method encapsulates ServiceStringLC. - * This method can be TRAPD and used to help in testing ServiceStringLC - * @since ?Series60_version - * @param aIndex the index of the service - * @param aParam parameter for the localized string - * @return Symbian OS error code. - */ - TInt CallServiceStringLCSeviceDBL(TInt aIndex,const TDes& aParam ); - - /** - * This is method encapsulates ServiceStringLC. - * This method can be TRAPD and used to help in testing ServiceStringLC - * @since ?Series60_version - * @param aServiceUid the Uid of the service - * @param aParam parameter for the localized string - * @return Symbian OS error code. - */ - TInt CallServiceStringLCuidSeviceDBL( TUid aServiceUid, const TDes& aParam); - - /** - * This is method encapsulates ServiceNameLC. - * This method can be TRAPD and used to help in testing ServiceNameLC - * @since ?Series60_version - * @param aIndex the index of the service - * @return Symbian OS error code. - */ - TInt CallServiceNameLCSeviceDBL(TInt aIndex); - - /** - * This is method encapsulates ServiceNameLC. - * This method can be TRAPD and used to help in testing ServiceNameLC - * @since ?Series60_version - * @param aServiceUid the Uid of the service - * @return Symbian OS error code. - */ - TInt CallServiceNameLCuidSeviceDBL( TUid aServiceUid ); - - - private: // Data - - // This is the pointer to object of the class being tested - // Through this pointer all the Exported methods are tested. - CServicesDB *iServicesDB; - - - }; - -#endif // SERVICESDBAPITEST_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/init/TestFramework_SDB.ini --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/init/TestFramework_SDB.ini Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= C:\LOGS\TestFramework\ -TestReportFileName= TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= XXXXXXXXX -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= c:\testframework\ui_ServicesDbApiTest.cfg -[End_Module] - - -# Load testmoduleXXX, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleXXX used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleXXX used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.cpp --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: Implementation of class CServicesDbApiTest -* -*/ - - - -// INCLUDE FILES -#include -#include "ServicesDbApiTest.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CServicesDbApiTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CServicesDbApiTest::CServicesDbApiTest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CServicesDbApiTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings(loggerSettings); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if(loggerSettings.iAddTestCaseTitle) - { - TName title; - TestModuleIf().GetTestCaseTitleL(title); - logFileName.Format(KServicesDbApiTestLogFileWithTitle, &title); - } - else - { - logFileName.Copy(KServicesDbApiTestLogFile); - } - - iLog = CStifLogger::NewL( KServicesDbApiTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CServicesDbApiTest* CServicesDbApiTest::NewL( - CTestModuleIf& aTestModuleIf ) - { - CServicesDbApiTest* self = new (ELeave) CServicesDbApiTest( aTestModuleIf ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -CServicesDbApiTest::~CServicesDbApiTest() - { - - // Delete resources allocated from test methods - Delete(); - - // Delete logger - delete iLog; - delete iServicesDB; - - } - -//----------------------------------------------------------------------------- -// CServicesDbApiTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CServicesDbApiTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("ServicesDbApiTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CServicesDbApiTest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.rss --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTest.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +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: Resource definitions for project ServicesDbApiTest -* -*/ -// --------------------------------------------------------------------------- -// r_da_services_mime -// This resource stores localized strings for the supported services, identified -// by their Uid and generic name. -// This resource is defined in the services_db.rh file -// --------------------------------------------------------------------------- -// -#include -#include -//#include -//#include -//#include -#include -//#include -//#include -//#include -#include -// RESOURCE IDENTIFIER -NAME SDBT // 4 letter ID -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf=""; } - -RESOURCE DAS_SERVICES r_da_service_mime - { - services = - { - DAS_SERVICE_ENTRY - { - service_uid = 0x101; // NOT A REAL UID - service_name = "Open"; - service_localized_name = "Open Localized"; - }, - DAS_SERVICE_ENTRY - { - service_uid = 0x102; // NOT A REAL UID - service_name = "Upload"; - service_localized_name = "Upload Localized"; - }, - DAS_SERVICE_ENTRY - { - service_uid = 0x103; // NOT A REAL UID - service_name = "Print"; - service_localized_name = "Print Localized %U"; - } - }; - } diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTestBlocks.cpp --- a/devmngt_plat/services_db_api/tsrc/ServicesDbApiTest/src/ServicesDbApiTestBlocks.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,590 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 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: This cpp file has the functions to test Services DB API. -* -*/ - - - -// [INCLUDE FILES] -#include -#include -#include -#include "ServicesDbApiTest.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void CServicesDbApiTest::Delete() - { - - } - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::RunMethodL( - CStifItemParser& aItem ) - { - - static TStifFunctionInfo const KFunctions[] = - { - ENTRY( "InitializeSeviceDB", CServicesDbApiTest::InitializeSeviceDB ), - ENTRY( "InitializeonStackSeviceDB", CServicesDbApiTest::InitializeonStackSeviceDB ), - ENTRY( "CountSeviceDB", CServicesDbApiTest::CountSeviceDB), - ENTRY( "ServiceUidLSeviceDB", CServicesDbApiTest::ServiceUidLSeviceDB), - ENTRY( "ServiceStringLCSeviceDB", CServicesDbApiTest::ServiceStringLCSeviceDB), - ENTRY( "ServiceStringLCUIDSeviceDB", CServicesDbApiTest::ServiceStringLCuidSeviceDB), - ENTRY( "ServiceNameLCSeviceDB", CServicesDbApiTest::ServiceNameLCSeviceDB), - ENTRY( "ServiceNameLCuidSeviceDB", CServicesDbApiTest::ServiceNameLCuidSeviceDB), - }; - - const TInt count = sizeof( KFunctions ) / - sizeof( TStifFunctionInfo ); - - return RunInternalL( KFunctions, count, aItem ); - - } - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CreateSeviceDBL -// This function is used to create CServicesDB object. This function is used -// to call CServicesDB::NewL and CServicesDB::NewLC functions. -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::CreateSeviceDBL( TInt aOption ) -{ - - // Get CCoeEnv instance - CEikonEnv* eikEnv = CEikonEnv::Static(); - // Initialize loader - //open our resource file - RConeResourceLoader resources(*eikEnv); - - TParse parse; - parse.Set(_L("c:ServicesDbApiTest.rsc"), &KDC_RESOURCE_FILES_DIR, NULL ); - - TFileName fileName( parse.FullName() ); - iLog->Log(_L("Opened Resource file named :: ")); iLog->Log(fileName); - - TRAPD( error, resources.OpenL(fileName) ); //Open resource file - if ( KErrNone != error ) - { - iLog->Log(_L("Error in opening resource file. ERROR = %d "),error); //return( error ); - //Check on Z drive if not found on C drive - parse.Set(_L("z:ServicesDbApiTest.rsc"), &KDC_RESOURCE_FILES_DIR, NULL ); - TFileName fileName1( parse.FullName() ); - iLog->Log(_L("Opening Resource file named :: ")); iLog->Log(fileName1); - - TRAPD( error1 , resources.OpenL(fileName1) ); - if ( KErrNone != error1 ) - { - iLog->Log(_L("Error in opening resource file. ERROR = %d "),error1); - return( error1 ); - } - } - - TResourceReader reader; - eikEnv->CreateResourceReaderLC( reader, R_DA_SERVICE_MIME ); - - if ( KFirstOption == aOption ) - { - TRAPD( errorinNewL, iServicesDB=CServicesDB::NewL(&reader) ); - if ( KErrNone != errorinNewL ) - { - iLog->Log(_L("=>CServicesDB::NewL leaves")); - } - CleanupStack::PopAndDestroy(); //reader's resource - resources.Close(); - return ( errorinNewL ); - } - else - { - TRAPD( errorinNewLC, CallNewlcL(reader) ); - if( KErrNone != errorinNewLC ) - { - iLog->Log(_L("=>CServicesDB::NewLC leaves")); - } - CleanupStack::PopAndDestroy(); - resources.Close(); - return ( errorinNewLC ); - } -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallNewlcL -// This function is used because we can not TRAP CServicesDB::NewLC -// ----------------------------------------------------------------------------- -// -void CServicesDbApiTest::CallNewlcL( TResourceReader aResReader ) -{ - iServicesDB = CServicesDB::NewLC( &aResReader ); - CleanupStack::Pop(); -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::InitializeSeviceDB -// Is used to test CServicesDB::NewL -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::InitializeSeviceDB( ) -{ - TInt result; - TRAPD( error , result = CreateSeviceDBL( KFirstOption ) ); - if ( KErrNone != error ) - { iLog->Log(_L("Services DB object not created with NewL.")); return ( error ); } - else - { - if ( KErrNone != result ) - { - iLog->Log(_L("Services DB object not created with NewL.")); return ( result ); - } - else - { - iLog->Log(_L("Services DB object created with NewL.")); - } - } - return ( result ); -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::InitializeonStackSeviceDB -// Is used to test CServicesDB::NewLC -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::InitializeonStackSeviceDB( ) -{ - TInt result; - TRAPD( error, result = CreateSeviceDBL( KSecondOption ) ); - if ( KErrNone != error ) - { iLog->Log(_L("Services DB object not created with NewLC.")); return ( error ); } - else - { - if ( KErrNone != result ) - { - iLog->Log(_L("Services DB object not created with NewLC.")); return ( result ); - } - else - { - iLog->Log(_L("Services DB object created with NewLC.")); - } - } - return ( result ); -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CountSeviceDB -// Testing - IMPORT_C TInt Count() const; -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::CountSeviceDB() -{ - TInt result = InitializeSeviceDB(); - if ( KErrNone != result ) - { - return ( result ); - } - TInt nrServices=iServicesDB->Count(); - iLog->Log(_L("Number of Services listed in resource file = %d"),nrServices); - if ( KNoOfServices != nrServices ) - { - iLog->Log(_L("The number of services returned by CServicesDB::COUNT is incorrect")); - return ( KErrGeneral ); - } - return ( KErrNone ); -} - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceUidLSeviceDB -// Testing - IMPORT_C TUid ServiceUidL(TInt aIndex) const; -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::ServiceUidLSeviceDB( CStifItemParser& aItem ) -{ - TInt result = InitializeSeviceDB(); - if ( KErrNone != result ) - { - return ( result ); - } - TUid serviceUid; - TInt index; - - if( aItem.GetNextInt(index) != KErrNone ) - { - iLog->Log(_L("NO Index number provided, index is required parameter for testing ServiceUid ")); - return ( KErrGeneral ); - } - - TRAPD( error, serviceUid = iServicesDB->ServiceUidL(index) ); - if ( KErrNone != error ) - { - iLog->Log(_L("Incorrect Index. There is no service matching the Index Number.")); - iLog->Log(_L("=> ServiceUidL leaves when index is incorrect.")); - return (error); - } - - iLog->Log(_L("UID of the Service[%d]=%d"),index,serviceUid.iUid); - - switch (index) - { - case KFirstServiceIndex: if (serviceUid.iUid == 0x101) - { iLog->Log(_L("Service UID is correct")); } - else - { iLog->Log(_L("Service UID is incorrect")); return ( KErrGeneral ); } - break; - case KSecondServiceIndex: if (serviceUid.iUid == 0x102) - { iLog->Log(_L("Service UID is correct")); } - else - { iLog->Log(_L("Service UID is incorrect")); return ( KErrGeneral ); } - break; - case KThirdServiceIndex: if (serviceUid.iUid == 0x103) - { iLog->Log(_L("Service UID is correct")); } - else - { iLog->Log(_L("Service UID is incorrect")); return ( KErrGeneral ); } - break; - default : break; - }; - - return ( KErrNone ); -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceStringLCSeviceDB -// Testing - IMPORT_C HBufC* ServiceStringLC(TInt aIndex, const TDes& aParam) const; -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::ServiceStringLCSeviceDB( CStifItemParser& aItem ) -{ - TInt result = InitializeSeviceDB(); - if ( KErrNone != result ) - { - return ( result ); - } - TInt index; - TBuf format(KEmptyString); - - if( aItem.GetNextInt(index) != KErrNone ) - { - iLog->Log(_L("NO Index number provided, index is required parameter for testing ServiceUid ")); - return ( KErrGeneral ); - } - TInt res; - TRAPD( error, res = CallServiceStringLCSeviceDBL(index,format )); - if ( KErrNone != error ) - { - iLog->Log(_L("Incorrect Index. There is no service matching the Index Number.")); - iLog->Log(_L("=> ServiceStringLC leaves when index is incorrect.")); - return (error); - } - - return ( res ); -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallServiceStringLCSeviceDBL -// This function is used because we can not trap ServiceStringLC -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::CallServiceStringLCSeviceDBL(TInt aIndex,const TDes& aParam ) -{ - HBufC *string; - string=iServicesDB->ServiceStringLC(aIndex,aParam); - iLog->Log(_L("LOCALIZED name of the Service[%d] = "),aIndex); - iLog->Log(*string); - - switch (aIndex) - { - case KFirstServiceIndex: if(!(string->Des().Compare(_L("Open Localized")))) - { iLog->Log(_L("LOCALIZED name is correct")); } - else - { iLog->Log(_L("LOCALIZED name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KSecondServiceIndex: if(!(string->Des().Compare(_L("Upload Localized")))) - { iLog->Log(_L("LOCALIZED name is correct")); } - else - { iLog->Log(_L("LOCALIZED name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KThirdServiceIndex: if(!(string->Des().Compare(_L("Print Localized %U")))) - { iLog->Log(_L("LOCALIZED name is correct")); } - else - { iLog->Log(_L("LOCALIZED name is incorrect")); - CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } - break; - default : break; - }; - - CleanupStack::PopAndDestroy(string); - return ( KErrNone ); - -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceStringLCuidSeviceDB -// Testing - IMPORT_C HBufC* ServiceStringLC(TUid aServiceUid, const TDes& aParam) const; -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::ServiceStringLCuidSeviceDB( CStifItemParser& aItem ) -{ - TInt result = InitializeSeviceDB(); - if ( KErrNone != result ) - { - return ( result ); - } - TBuf format(KEmptyString); - TInt uid; - - if( aItem.GetNextInt(uid) != KErrNone ) - { - iLog->Log(_L("NO UID number provided, UID is required parameter for testing ServiceStringLC ")); - return ( KErrGeneral ); - } - TUid serviceUID= TUid::Uid(uid); - iLog->Log(_L("serviceUID = %d"),serviceUID.iUid); - TInt res ; - TRAPD(error, res = CallServiceStringLCuidSeviceDBL(serviceUID,format)); - if ( KErrNone != error ) - { - iLog->Log(_L("=> ServiceStringLC leaves. Error code = %d"),error); - return (error); - } - return ( res ); - -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::CallServiceStringLCuidSeviceDBL -// This function is used because we can not trap ServiceStringLC -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::CallServiceStringLCuidSeviceDBL( TUid aServiceUid, const TDes& aParam ) -{ - HBufC *string; - string=iServicesDB->ServiceStringLC(aServiceUid,aParam); - if ( NULL != string ) - { - iLog->Log(_L("LOCALIZED name of the Service with UID(%d) = "),aServiceUid.iUid); - iLog->Log(*string); - } - else - { - iLog->Log(_L("No matching service found, Service UID provided is incorrect")); - } - - switch (aServiceUid.iUid) - { - case KFirstServiceUid: if(!(string->Des().Compare(_L("Open Localized")))) - { iLog->Log(_L("LOCALIZED name is correct")); } - else - { iLog->Log(_L("LOCALIZED name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KSecondServiceUid: if(!(string->Des().Compare(_L("Upload Localized")))) - { iLog->Log(_L("LOCALIZED name is correct")); } - else - { iLog->Log(_L("LOCALIZED name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KThirdServiceUid: if(!(string->Des().Compare(_L("Print Localized %U")))) - { iLog->Log(_L("LOCALIZED name is correct")); } - else - { iLog->Log(_L("LOCALIZED name is incorrect")); - CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } - break; - default : break; - }; - - CleanupStack::PopAndDestroy(string); - return ( KErrNone ); -} - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceNameLCSeviceDB -// Testing - IMPORT_C HBufC* ServiceNameLC(TInt aIndex) const; -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::ServiceNameLCSeviceDB( CStifItemParser& aItem ) -{ - TInt result = InitializeSeviceDB(); - if ( KErrNone != result ) - { - return ( result ); - } - TInt index; - TBuf format(KEmptyString); - - if( aItem.GetNextInt(index) != KErrNone ) - { - iLog->Log(_L("NO Index number provided, index is required parameter for testing ServiceNameLC ")); - return ( KErrGeneral ); - } - iLog->Log(_L("checked till here")); - iLog->Log(_L("index = %d"),index); - - TRAPD(error,TInt res = CallServiceNameLCSeviceDBL(index)); - if ( KErrNone != error ) - { - iLog->Log(_L("Incorrect Index. There is no service matching the Index Number.")); - iLog->Log(_L("=> ServiceNameLC leaves when index is incorrect.")); - return (error); - } - return ( KErrNone ); - -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceNameLCSeviceDB -// This function is used because we can not trap ServiceNameLC -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::CallServiceNameLCSeviceDBL(TInt aIndex) -{ - HBufC *string; - string=iServicesDB->ServiceNameLC(aIndex); - iLog->Log(_L("GENERIC name of the Service[%d] = "),aIndex); - iLog->Log(*string); - - switch (aIndex) - { - case KFirstServiceIndex: if(!(string->Des().Compare(_L("Open")))) - { iLog->Log(_L("GENERIC name is correct")); } - else - { iLog->Log(_L("GENERIC name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KSecondServiceIndex: if(!(string->Des().Compare(_L("Upload")))) - { iLog->Log(_L("GENERIC name is correct")); } - else - { iLog->Log(_L("GENERIC name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KThirdServiceIndex: if(!(string->Des().Compare(_L("Print")))) - { iLog->Log(_L("GENERIC name is correct")); } - else - { iLog->Log(_L("GENERIC name is incorrect")); - CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } - break; - default : break; - }; - - CleanupStack::PopAndDestroy(string); - return ( KErrNone ); - -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceNameLCuidSeviceDB -// Testing - IMPORT_C HBufC* ServiceNameLC(TUid aServiceUid) const; -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::ServiceNameLCuidSeviceDB( CStifItemParser& aItem ) -{ - - TInt result = InitializeSeviceDB(); - if ( KErrNone != result ) - { - return ( result ); - } - TBuf format(KEmptyString); - TInt uid; - - if( aItem.GetNextInt(uid) != KErrNone ) - { - iLog->Log(_L("NO UID number provided, UID is required parameter for testing ServiceStringLC ")); - return ( KErrGeneral ); - } - iLog->Log(_L("checked till here")); - - TUid serviceUID= TUid::Uid(uid); - iLog->Log(_L("serviceUID = %d"),serviceUID.iUid); - - TRAPD(error,TInt res = CallServiceNameLCuidSeviceDBL(serviceUID)); - if ( KErrNone != error ) - { - iLog->Log(_L("=> ServiceNameLC leaves."),error); - return (error); - } - return ( KErrNone ); -} - - -// ----------------------------------------------------------------------------- -// CServicesDbApiTest::ServiceNameLCuidSeviceDB -// This function is used because we can not trap ServiceNameLC -// ----------------------------------------------------------------------------- -// -TInt CServicesDbApiTest::CallServiceNameLCuidSeviceDBL( TUid aServiceUid ) -{ - HBufC *string; - string=iServicesDB->ServiceNameLC(aServiceUid); - if ( NULL != string ) - { - iLog->Log(_L("GENERIC name of the Service with UID(%d) = "),aServiceUid.iUid); - iLog->Log(*string); - } - else - { - iLog->Log(_L("No matching service found, Service UID provided is incorrect")); - } - - switch (aServiceUid.iUid) - { - case KFirstServiceUid: if(!(string->Des().Compare(_L("Open")))) - { iLog->Log(_L("GENERIC name is correct")); } - else - { iLog->Log(_L("GENERIC name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KSecondServiceUid: if(!(string->Des().Compare(_L("Upload")))) - { iLog->Log(_L("GENERIC name is correct")); } - else - { iLog->Log(_L("GENERIC name is incorrect")); - CleanupStack::PopAndDestroy(string); return ( KErrGeneral ); } - break; - case KThirdServiceUid: if(!(string->Des().Compare(_L("Print")))) - { iLog->Log(_L("GENERIC name is correct")); } - else - { iLog->Log(_L("GENERIC name is incorrect")); - CleanupStack::PopAndDestroy(string);return ( KErrGeneral ); } - break; - default : break; - }; - - CleanupStack::PopAndDestroy(string); - return ( KErrNone ); -} - - -// [End of File] - Do not remove diff -r 3fec62e6e7fc -r 90fe62538f66 devmngt_pub/group/bld.inf --- a/devmngt_pub/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -/* -* Copyright (c) 2006 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: Includes all the SDK API specific bld.inf files, which -* export files. -* -*/ - - - - - diff -r 3fec62e6e7fc -r 90fe62538f66 group/bld.inf --- a/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2008 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: Build information file for project settingsuis -* -*/ - - -// mw layer -// Device management ADO - -//Components: - -//devmngt_plat -#include "../devmngt_plat/group/bld.inf" - -//devmngt_pub -#include "../devmngt_pub/group/bld.inf" - -#include "../defaultapplicationsettings/group/bld.inf" - -//systemswuis -#include "../systemswuis/group/bld.inf" - diff -r 3fec62e6e7fc -r 90fe62538f66 layers.sysdef.xml --- a/layers.sysdef.xml Thu Aug 19 09:55:50 2010 +0300 +++ b/layers.sysdef.xml Tue Aug 31 15:15:28 2010 +0300 @@ -1,22 +1,17 @@ - - ]> - + - - + + + + + - - - - - - - diff -r 3fec62e6e7fc -r 90fe62538f66 sysdef_1_4_0.dtd --- a/sysdef_1_4_0.dtd Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 3fec62e6e7fc -r 90fe62538f66 sysdef_1_5_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_5_1.dtd Tue Aug 31 15:15:28 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/group/bld.inf --- a/systemswuis/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* -* Copyright (c) 2008 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: Build information file for project systemswuis -* -*/ - - -#include "../touchscreencalib/group/bld.inf" diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/PubSub/touchscprivatepskeys.h --- a/systemswuis/touchscreencalib/PubSub/touchscprivatepskeys.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2008 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: Private Publish&Subscribe definitions of the -* Security UIs subsystem -* -*/ - - -#ifndef TOUCHSCPRIVATEPSKEYS_H -#define TOUCHSCPRIVATEPSKEYS_H - -// INCLUDES - -//CONSTANTS - -// ============================================================================= -// Touch Screen Calibration API -// ============================================================================= - -/** -* Touchscreen calibration P&S UID -*/ -const TUid KPSUidTouchScreenCalibration = { 0x102828BC }; - -/** -* Wait a touchscreen calibration -*/ -const TUint32 KPSTouchScreenCalibration = 0x00000000; -enum TPSTouchScreenCalibration - { - ETouchScreenCalibrationWait, - ETouchScreenCalibrationOk - }; - -#endif//TOUCHSCPRIVATEPSKEYS_H diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/aif/TouchScreenCalibaif.rss --- a/systemswuis/touchscreencalib/aif/TouchScreenCalibaif.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2006 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: RSS for creating the aif file for TouchScreenCalib. -* -*/ - - -// INCLUDES -#include - -RESOURCE AIF_DATA -{ - app_uid = 0x102828BC; - hidden = KAppIsHidden; - num_icons = 0; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; -} - -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/data/TouchScreenCalib.rss --- a/systemswuis/touchscreencalib/data/TouchScreenCalib.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2006 - 2008 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: -* This file contains all the resources for the module. -* -*/ - - -// RESOURCE IDENTIFIER -NAME TSCA // 4 letter ID - -// INCLUDES -#include -#include -#include -#include "touchscreencalib.loc" - -// CONSTANTS -// -none - -// MACROS -// -none - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf="touch_screen_calib"; } - -RESOURCE EIK_APP_INFO - { - status_pane = r_status_pane; - } - -RESOURCE STATUS_PANE_APP_MODEL r_status_pane - { - layout= R_AVKON_STATUS_PANE_LAYOUT_EMPTY; - } - -RESOURCE TBUF r_qtn_touch_screen_cali_instr_can { buf = qtn_touch_screen_cali_instr_can; } -RESOURCE TBUF r_qtn_touch_screen_cali_instr_res { buf = qtn_touch_screen_cali_instr_res; } -RESOURCE TBUF r_qtn_touch_screen_cali_instr_gen { buf = qtn_touch_screen_cali_instr_gen; } -RESOURCE TBUF r_qtn_touch_screen_cali_cancel { buf = qtn_touch_screen_cali_cancel; } -RESOURCE TBUF r_qtn_touch_screen_cali_done { buf = qtn_touch_screen_cali_done; } diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/data/TouchScreenCalib_anim.rss --- a/systemswuis/touchscreencalib/data/TouchScreenCalib_anim.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2006 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: It contains resources for Touch Screen Calibration tap target -* animation -* -*/ - - -// RESOURCE IDENTIFIER -NAME TSAN - -// INCLUDES -#include -#include -#include - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -STRUCT ANIM_DURATION - { - WORD time; - } - -RESOURCE ANIM_DURATION r_anim_duration - { - time = 0; //milliseconds - } - -RESOURCE BMPANIM_DATA r_shutdown_anim - { - frameinterval = 200; - - playmode = EAknBitmapAnimationPlayModeCycle; - - bmpfile = "z:\\resource\\apps\\touchscreencalib.mbm"; - - frames = r_target_frames; - } - -RESOURCE ARRAY r_target_frames - { - items = - { - BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_1; - maskid = EMbmTouchscreencalibQgn_graf_screencalib_1_mask; }, - BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_2; - maskid = EMbmTouchscreencalibQgn_graf_screencalib_2_mask; }, - BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_3; - maskid = EMbmTouchscreencalibQgn_graf_screencalib_3_mask; }, - BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_4; - maskid = EMbmTouchscreencalibQgn_graf_screencalib_4_mask; }, - BMPANIM_FRAME { bmpid = EMbmTouchscreencalibQgn_graf_screencalib_5; - maskid = EMbmTouchscreencalibQgn_graf_screencalib_5_mask; } - }; - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/data/TouchScreenCalib_reg.rss --- a/systemswuis/touchscreencalib/data/TouchScreenCalib_reg.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006 - 2007 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: RSS for creating the registration file for TouchScreenCalib. -* -*/ - - -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x102828BC // application UID -RESOURCE APP_REGISTRATION_INFO - { - app_file="TouchScreenCalib"; // filename of application binary (minus extension) - hidden = KAppIsHidden; - } diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/group/TouchScreenCalib.mmp --- a/systemswuis/touchscreencalib/group/TouchScreenCalib.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 2006 - 2008 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: -* This is project specification file for the TouchScreenCalib. -* -*/ - - -#include -#include - -TARGET touchscreencalib.exe -TARGETTYPE exe -UID 0x0 0x102828BC -EPOCSTACKSIZE 0x5000 - -VENDORID VID_DEFAULT -CAPABILITY CAP_APPLICATION - -SOURCEPATH ../src - -SOURCE TouchScreenCalibApplication.cpp -SOURCE TouchScreenCalibAppUi.cpp -SOURCE TouchScreenCalibDocument.cpp -SOURCE TouchScreenCalibView.cpp -SOURCE TouchScreenCalibPubSubObserver.cpp -SOURCE TouchScreenCalibSubscriber.cpp - -START RESOURCE ../data/TouchScreenCalib.rss -TARGETPATH APP_RESOURCE_DIR -HEADER -LANGUAGE_IDS -END // RESOURCE - -START RESOURCE ../data/TouchScreenCalib_anim.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -END // RESOURCE - -START RESOURCE ../data/TouchScreenCalib_reg.rss -HEADER -TARGETPATH /private/10003a3f/apps -END - -USERINCLUDE . ../inc ../data -USERINCLUDE ../../inc -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY avkon.lib -LIBRARY eikdlg.lib -LIBRARY eikcore.lib -LIBRARY efsrv.lib -LIBRARY fbscli.lib -LIBRARY commonengine.lib //use of SharedData -LIBRARY ws32.lib -LIBRARY aknnotify.lib //AknGlobalNote -LIBRARY apgrfx.lib // -LIBRARY egul.lib //DrawUtils -LIBRARY bafl.lib -LIBRARY aknskins.lib //for skin background -LIBRARY cdlengine.lib //for scalable ui -LIBRARY gdi.lib -LIBRARY aknlayout2scalable.lib -LIBRARY aknicon.lib -LIBRARY centralrepository.lib -LIBRARY starterclient.lib //use of Starter to remove splash screen -LIBRARY touchfeedback.lib - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/group/bld.inf --- a/systemswuis/touchscreencalib/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2006 - 2008 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: This file provides the information required for building the -* whole of a TouchScreenCalib. -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../loc/touchscreencalib.loc APP_LAYER_LOC_EXPORT_PATH(touchscreencalib.loc) -../rom/TouchScreenCalib.iby CORE_APP_LAYER_IBY_EXPORT_PATH(touchscreencalib.iby) -../rom/TouchScreenCalib_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(touchscreencalib_variant.iby) -../rom/TouchScreenCalibResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(touchscreencalibresources.iby) -../PubSub/touchscprivatepskeys.h |../../inc/touchscprivatepskeys.h - -PRJ_MMPFILES - -TouchScreenCalib.mmp -../tscstartupextensionplugin/group/tscstartupextensionplugin.mmp -../tsccustcmds/group/tsccustcmds.mmp - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE touchscreencalib.mif -OPTION HEADERFILE touchscreencalib.mbg -OPTION SOURCES -c16,8 Qgn_graf_screencalib \ - -c16,8 Qgn_graf_screencalib_1 \ - -c16,8 Qgn_graf_screencalib_2 \ - -c16,8 Qgn_graf_screencalib_3 \ - -c16,8 Qgn_graf_screencalib_4 \ - -c16,8 Qgn_graf_screencalib_5 -END diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/group/touchscreencalib_icons.mk --- a/systemswuis/touchscreencalib/group/touchscreencalib_icons.mk Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -# -# Copyright (c) 2006 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: Icons makefile for project touchscreencalib -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- -# : Configure these -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\resource\apps -HEADERDIR=\epoc32\include -ICONTARGETFILENAME=$(TARGETDIR)\touchscreencalib.mif -HEADERFILENAME=$(HEADERDIR)\touchscreencalib.mbg - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- -# : Configure these. -# -# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by -# MifConv if the mask detph is defined. -# -# NOTE 2: Usually, source paths should not be included in the bitmap -# definitions. MifConv searches for the icons in all icon directories in a -# predefined order, which is currently \s60\icons, \s60\bitmaps2. -# The directory \s60\icons is included in the search only if the feature flag -# __SCALABLE_ICONS is defined. -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c16,8 Qgn_graf_screencalib \ - /c16,8 Qgn_graf_screencalib_1 \ - /c16,8 Qgn_graf_screencalib_2 \ - /c16,8 Qgn_graf_screencalib_3 \ - /c16,8 Qgn_graf_screencalib_4 \ - /c16,8 Qgn_graf_screencalib_5 - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/MTouchScreenCalibPropertyResponder.h --- a/systemswuis/touchscreencalib/inc/MTouchScreenCalibPropertyResponder.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2007 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: Interface of Touch screen calibration property change obsever -* -*/ - - -#ifndef MTOUCHSCREENCALIBPROPERTYRESPONDER_H -#define MTOUCHSCREENCALIBPROPERTYRESPONDER_H - -// INCLUDES -#include - -class MTouchScreenCalibPropertyResponder - { -public: - virtual void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) = 0; - }; -#endif //MTOUCHSCREENCALIBPROPERTYRESPONDER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibAppUi.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibAppUi.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2006 - 2007 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: AppUi class of the application. -* -*/ - - -#ifndef TOUCHSCREENCALIBAPPUI_H -#define TOUCHSCREENCALIBAPPUI_H - -// SYSTEM INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -// CONSTANTS -const TInt KConvertGetCase = 0; -const TInt KConvertSaveCase = 1; - -const TInt KUnknownOrientation = 0; -const TInt KPortraitOrientation = 1; -const TInt KLandscapeOrientation = 2; - -// FORWARD DECLARATIONS -class TTouchScreenCalibLayout - { -public: - TAknLayoutRect iAnimImageLayout1; - TAknLayoutRect iAnimImageLayout2; - TAknLayoutRect iAnimImageLayout3; - TAknLayoutRect iAnimImageLayout4; - }; - -class CTouchScreenCalibView; -class CTouchScreenCalibPubSubObserver; -/** -* 'AppUi' class. -* -*/ -class CTouchScreenCalibAppUi : public CAknAppUi, CCoeControl -{ - public: // Constructors and destructor - - /** - * C++ default constructor. - */ - CTouchScreenCalibAppUi(); - - /** - * Destructor. - */ - ~CTouchScreenCalibAppUi(); - - // from CCoeAppUiBase - void PrepareToExit(); - - /** - * Handles key events - * @param TKeyEvent key event - * @param TEventCode event code - * @since S60 3.2 - */ - void HandleKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * Handles pointer events - * @param TPoint co-ordinates - * @since S60 3.2 - */ - void HandlePointerL( TPoint aPos ); - - /** - * Check current point number - * @since S60 3.2 - * @return TInt, point number - */ - TInt GetCalibrationStep(); - - /** - * Get rect of current tap animation or image - * @since S60 3.2 - * @param TInt, point number - * @return TRect, animation or image rect. - */ - TRect GetAnimImageRect(TInt aPointNumber = 0); - - /** - * From CAknAppUi, called when screen layout changes - */ - void HandleScreenDeviceChangedL(); - - /** - * Check if first boot is going on - * @since S60 3.2 - * @return. ETrue if first boot, otherwise EFalse - */ - TBool FirstBoot(); - - protected: - /* - * Handles changes to the application when it - * switches to or from the foreground. - */ - virtual void HandleForegroundEventL(TBool aForeground); - - private: - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Update display - * @since S60 3.2 - */ - void UpdateL(); - - /** - * Checks layout orientation - * @since S60 3.2 - * @return TBool. ETrue if orientation same in driver native level and window level - */ - TBool IsCorrectOrientation(TRect aRect); - - /** - * Convert calibration or tapped points to different layout orientation - * @since S60 3.2 - * @param Points - * @param Convert case. - * @return Calibration points. KConvertGetCase or KConvertSaveCase. - */ - TDigitizerCalibration ConvertToCorrectOrientation(TDigitizerCalibration aPoints, - TInt aConvertCase); - /** - * Get calibration points - * @since S60 3.2 - * @return Calibration points - */ - TDigitizerCalibration CalibrationPoints(); - - /** - * Change to next calibration point - * @since S60 3.2 - */ - void NextCalibrationStepL(); - - /** - * Saves calibration - * @since S60 3.2 - */ - void SaveCalibration(); - - /** - * Restart calibration at first point - * @since S60 3.2 - */ - void ResetCalibrationStepsL(); - - /** - * Sets tap points to 0 values - * @since S60 3.2 - */ - void ResetTapPoints(); - - TDigitizerCalibration ChangeOrientation(TDigitizerCalibration aSourcePoints, - TPoint aDestReso); - - - void SetOrientation(); - - private: //Data - CTouchScreenCalibView* iTouchScreenCalibView; //owns - CTouchScreenCalibPubSubObserver* iTouchScreenCalibPubSubObserver; //owns - TDigitizerCalibration iCalibrationPoints; - TDigitizerCalibration iTapPoints; - TInt iCurrentCalibrationStep; - TBool iExitting; - TTouchScreenCalibLayout iTouchScreenCalibLayout; - TBool iCalibrationDone; - TInt iNativeOrientation; - TBool iCalibrationCancel; -}; - -#endif // TOUCHSCREENCALIBAPPUI_H - -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibApplication.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibApplication.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2006 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: Application class of the module. -* -*/ - - - -#ifndef TOUCHSCREENCALIBAPPLICATION_H -#define TOUCHSCREENCALIBAPPLICATION_H - -// SYSTEM INCLUDES -#include - -// CONSTANTS -const TUid KUidTouchScreenCalib = { 0x102828BC }; - -// CLASS DECLARATION - -/** -* CTouchScreenCalibApp application class. -*/ -class CTouchScreenCalibApplication : public CAknApplication - { - private: // from CApaApplication - /** - * Create CTouchScreenCalibDocument document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * Return KUidTouchScreenCalib. - */ - TUid AppDllUid() const; - }; - -#endif // TOUCHSCREENCALIBAPPLICATION_H - -// End of file - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibDefines.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibDefines.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2006 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: Includes some common defines used in the TouchScreenCalib application -* -*/ - - -#ifndef TOUCHSCREENCALIBDEFINES_H -#define TOUCHSCREENCALIBDEFINES_H - -//CONSTANTS -_LIT( KTouchScreenCalibAppName, "TouchScreenCalib" ); - -// MACROS - -#define PANIC(aPanic) User::Panic( KTouchScreenCalibAppName, aPanic ) - -#define TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"TouchScreenCalibApp: \"" L##aText L"\"")) - -#ifdef _DEBUG -#define TRACES(aMsg) RDebug::Print( TRACE_ADDPREFIX(aMsg) ) -#define TRACES1(aFormat,aP1) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1) ) -#define TRACES2(aFormat,aP1,aP2) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) -#define TRACES3(aFormat,aP1,aP2,aP3) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) -#else -#define TRACES(aMsg) -#define TRACES1(aFormat,aP1) -#define TRACES2(aFormat,aP1,aP2) -#define TRACES3(aFormat,aP1,aP2,aP3) -#endif -#endif // TOUCHSCREENCALIBDEFINES_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibDocument.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibDocument.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2006 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: Document class of the module. -* -*/ - - - -#ifndef TOUCHSCREENCALIBDOCUMENT_H -#define TOUCHSCREENCALIBDOCUMENT_H - -// SYSTEM INCLUDES -#include - -// FORWARD DECLARATIONS -class CEikAppUi; - -// CLASS DECLARATION - -/** -* CTouchScreenCalibDocument application class. -*/ -class CTouchScreenCalibDocument : public CAknDocument -{ - public: - - /** - * C++ default constructor. - */ - CTouchScreenCalibDocument(CEikApplication& aApp): CAknDocument(aApp) { } - - /** - * Two-phased constructor. - */ - static CTouchScreenCalibDocument* NewL(CEikApplication& aApp); - - /** - * Destructor. - */ - virtual ~CTouchScreenCalibDocument(); - - private: - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * This method makes an application hidden so that it is not visible - * for example in Applications list and FastSwap window. - * @param CApaWindowGroupName* aWgName - * @return void - */ - void UpdateTaskNameL( CApaWindowGroupName* aWgName ); - - private:// from CEikDocument - - /** - * Create CTouchScreenCalibAppUi object. - */ - CEikAppUi* CreateAppUiL(); - - private:// data - -}; - -#endif - -//End of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibPubSubObserver.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibPubSubObserver.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2007 - 2008 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: -* This class the handles the received indications from the Public and -* Subscribe. -* -*/ - - -#ifndef TOUCHSCREENCALIBPUBSUBOBSERVER_H -#define TOUCHSCREENCALIBPUBSUBOBSERVER_H - -// INCLUDES -#include -#include "MTouchScreenCalibPropertyResponder.h" -#include "TouchScreenCalibAppUi.h" - -// CLASS DECLARATION -class CTouchScreenCalibAppUi; -class CTouchScreenCalibSubscriber; - -class CTouchScreenCalibPubSubObserver : public CBase, public MTouchScreenCalibPropertyResponder - { - public: // Constructors and destructor - - /** - * C++ constructor. - */ - CTouchScreenCalibPubSubObserver( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); - - /** - * Two-phased constructor. - */ - static CTouchScreenCalibPubSubObserver* NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); - - /** - * Destructor. - */ - ~CTouchScreenCalibPubSubObserver(); - - private: - - /** - * By default EPOC constructor is private. - */ - void ConstructL(); - - CTouchScreenCalibPubSubObserver(); - - protected: // From MTouchScreenCalibPropertyResponder - - void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ); - - private: // Data - //reference to application class - CTouchScreenCalibAppUi* iTouchScreenCalibAppUi; //uses - RProperty iProperty; - CTouchScreenCalibSubscriber* iGlobalSWStateSubscriber; - CTouchScreenCalibSubscriber* iTsyCallState; - }; - -#endif // TOUCHSCREENCALIBPUBSUBOBSERVER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibSubscriber.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibSubscriber.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2007 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: TouchScreenCalibSubscriber (Publish & Subscribe). -* -*/ - - -#ifndef TOUCHSCREENCALIBSUBSCRIBER_H -#define TOUCHSCREENCALIBSUBSCRIBER_H - -// INCLUDES -#include -#include -#include "MTouchScreenCalibPropertyResponder.h" - -// CLASS DECLARATION -/** -* CTouchScreenCalibSubscriber -* -* @lib -* @since 3.2 -*/ - -class CTouchScreenCalibSubscriber : public CActive -{ -public: - /** - * Two-phased constructor. - */ - static CTouchScreenCalibSubscriber* NewL( MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, - const TUid& aCategory, - TUint aKey ); - - /** - * Destructor. - */ - ~CTouchScreenCalibSubscriber(); - - void Subscribe(); - -private: - CTouchScreenCalibSubscriber( MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, - const TUid& aCategory, TUint - aKey ); - void ConstructL(); - -public: // from CActive - /** - * @param none - * @return none - */ - void RunL(); - - /** - * @param aError the error returned - * @return error - */ - TInt RunError( TInt aError ); - - /** - * @param none - * @return none - */ - void DoCancel(); - -private: // Methods not implemented - CTouchScreenCalibSubscriber( const CTouchScreenCalibSubscriber& ); // Copy constructor - CTouchScreenCalibSubscriber& operator=( const CTouchScreenCalibSubscriber& );// Assigment operator - -private: - - MTouchScreenCalibPropertyResponder& iTouchScreenCalibPropertyResponder; - RProperty iProperty; - TUid iCategory; - TUint iKey; -}; - -#endif // TOUCHSCREENCALIBSUBSCRIBER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/inc/TouchScreenCalibView.h --- a/systemswuis/touchscreencalib/inc/TouchScreenCalibView.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ -/* -* Copyright (c) 2006 - 2007 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: -* This class is the container class of the CTouchScreenCalibView. -* Is used to show tap target animation. -* -*/ - - - -#ifndef TOUCHSCREENCALIBVIEW_H -#define TOUCHSCREENCALIBVIEW_H - -// SYSTEM INCLUDES -#include -#include - -#include -// USER INCLUDES -#include "TouchScreenCalibAppUi.h" - -// CONSTANTS - -// FORWARD DECLARATIONS -class TCalibAnimImageRect - { -public: - TRect iAnimImageRect1; - TRect iAnimImageRect2; - TRect iAnimImageRect3; - TRect iAnimImageRect4; - }; - -class CTouchScreenCalibAppUi; -class CAknBitmapAnimation; - -// CLASS DECLARATION - -/** -* This class takes care of showing welcome animatio to the user. -*/ -class CTouchScreenCalibView : public CCoeControl , public MCoeControlObserver - { - public: // Constructors and destructor - - /** - * C++ default constructor. - */ - CTouchScreenCalibView( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); - - /** - * Two-phased constructor. - */ - static CTouchScreenCalibView* NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ); - - /** - * Destructor - */ - ~CTouchScreenCalibView(); - - /** - * This handles the key events in this control. - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); - - /** - * Update UI - */ - void UpdateL( TAknLayoutText aTextLayout ); - - /** - * Prepare to draw background for ending phase - */ - void DrawEndingBackground(); - - /** - * Prepare to draw background for notes - */ - void EndTargetAnimation(); - - /** - * This makes the animation module to stop showing animation. - */ - void EndAnimation(); - - /** - * - */ - void SetTextL(TAknLayoutText aTextLayout); - - /** - * - */ - void SetWinPriority(TInt aPriority); - - private: - - /** - * By default EPOC constructor is private. - */ - void ConstructL(); - - CTouchScreenCalibView(); - - /** - * Is called when size is changed. - */ - void SizeChanged(); - - /** - * Returns the count of the components in the container. - */ - TInt CountComponentControls() const; - - /** - * Returns the component specified by aIndex parameter. - */ - CCoeControl* ComponentControl(TInt aIndex) const; - - /** - * Handles the event of the control. - */ - void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); - - /** - * Handles key events. - * @param aKeyEvent Event to be handled - * @param aType Type of the key event - * @return TKeyResponse - */ - virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - - /** - * Handles pointer events - */ - virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); - - /** - * Checks tapped point's validity - * @param TPoint co-ordinates - * @since S60 3.2 - */ - TBool Validate(TPoint aPos); - - /** - * Draw white background - * @since S60 3.2 - */ - void DrawBackground() const; - - /** - * Draw texts - * @since S60 3.2 - */ - void DrawText() const; - - /** - * Draw inactive tap points - * @since S60 3.2 - */ - void ShowImage( TRect aRect ) const; - - private: // Functions from base classes - - /** - * From CCoeControl - */ - void Draw( const TRect& aRect ) const; - - protected: // Data - - //Used for showing animation - CAknBitmapAnimation *iAnim; //owns - - CFbsBitmap *iBitmap; - CFbsBitmap *iBitmapMask; - - CTouchScreenCalibAppUi* iTouchScreenCalibAppUi; //uses - - //used for telling when the animation is showing - TBool iAnimationShowing; - - //used for telling if animation is cancelled by user. - TBool iAnimationCancelled; - - const CFont* iFont; // not owned - - CArrayPtr* iText; - - - TCalibAnimImageRect iAnimImageRect; - - TPoint iTextTopLeft; - TSize iTextSize; - TInt iTextBaselineOffset; - TRgb iTextColor; - CGraphicsContext::TTextAlign iTextAlignment; - TBool iCalibrationCompleted; - MTouchFeedback* iTouchFeedback; - }; - -#endif // TOUCHSCREENCALIBVIEW_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/loc/touchscreencalib.loc --- a/systemswuis/touchscreencalib/loc/touchscreencalib.loc Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2008 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: Localization strings for TouchScreenCalib -* -*/ - - -// LOCALISATION STRINGS - -//d:Asks user to tap center of the target with stylus. -//l:main_touch_calib_pane_t1 -//w: -//r:3.2 -// -#define qtn_touch_screen_cali_instr_gen "Touch screen calibration step %N of 4: Use stylus to tap center of target." - -//d:Used to tell user that pressing Send key cancels calibration and exits application. -//d:This is used when TouchScreenCalib application is started from General Settings by user. -//l:main_touch_calib_pane_t2 -//w: -//r:3.2 -// -#define qtn_touch_screen_cali_instr_can "To cancel press Send key." - -//d:Used to tell user that pressing Send key resets calibration and calibration -//d:begins again from point 1. This is used when TouchScreenCalib application is -//d:started when the phone is starter for the first time. -//l:main_touch_calib_pane_t2 -//w: -//r:3.2 -// -#define qtn_touch_screen_cali_instr_res "To start again from point 1 press Send key." - -//d:This Information Note is displayed if user cancels calibration with Send key press. -//l:popup_note_window/opt2 -//w: -//r:5.0 -// -#define qtn_touch_screen_cali_cancel "Calibration cancelled." - -//d:This Confirmation Note is dipslayed when calibration is done succesfully. -//l:popup_note_window/opt2 -//w: -//r:3.2 -// -#define qtn_touch_screen_cali_done "Calibration successful!" - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/rom/TouchScreenCalib.iby --- a/systemswuis/touchscreencalib/rom/TouchScreenCalib.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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: -* This class is a part of the standard application framework. -* The application gets instantiated starting from this class. -* Provides a factory method for instantiating the document object. -* -*/ -#ifndef __TOUCHSCREENCALIB_IBY__ -#define __TOUCHSCREENCALIB_IBY__ - -#if defined (__PEN_SUPPORT) && defined(__PEN_SUPPORT_CALIBRATION) -S60_APP_EXE(TouchScreenCalib) -S60_APP_AIF_RSC(TouchScreenCalib) -#endif -#if ( defined FF_TOUCHSCREENCALIB_IN_STARTUP && defined __PEN_SUPPORT && defined __PEN_SUPPORT_CALIBRATION ) -ECOM_PLUGIN( tscstartupextensionplugin.dll, tscstartupextensionplugin.rsc ) -file=ABI_DIR\BUILD_DIR\tsccustcmds.dll SHARED_LIB_DIR\tsccustcmds.dll -#endif //FF_TOUCHSCREENCALIB_IN_STARTUP - -#endif diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/rom/TouchScreenCalibResources.iby --- a/systemswuis/touchscreencalib/rom/TouchScreenCalibResources.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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: -* This class is a part of the standard application framework. -* The application gets instantiated starting from this class. -* Provides a factory method for instantiating the document object. -* -*/ - -#ifndef __TOUCHSCREENCALIB_RESOURCES_IBY__ -#define __TOUCHSCREENCALIB_RESOURCES_IBY__ - -#if defined (RD_SCALABLE_UI_V2) && defined(__PEN_SUPPORT) && defined(__PEN_SUPPORT_CALIBRATION) -S60_APP_RESOURCE(TouchScreenCalib) -#endif - -#endif \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/rom/TouchScreenCalib_variant.iby --- a/systemswuis/touchscreencalib/rom/TouchScreenCalib_variant.iby Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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: -* This class is a part of the standard application framework. -* The application gets instantiated starting from this class. -* Provides a factory method for instantiating the document object. -* -*/ - -#ifndef __TOUCHSCREENCALIB_VARIANT_IBY__ -#define __TOUCHSCREENCALIB_VARIANT_IBY__ - -#if defined (RD_SCALABLE_UI_V2) && defined(__PEN_SUPPORT) && defined(__PEN_SUPPORT_CALIBRATION) -SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,TouchScreenCalib) -S60_APP_RESOURCE(TouchScreenCalib_anim) -#endif - -#endif \ No newline at end of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/src/TouchScreenCalibAppUi.cpp --- a/systemswuis/touchscreencalib/src/TouchScreenCalibAppUi.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,722 +0,0 @@ -/* -* Copyright (c) 2006 - 2008 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: AppUi class of the application. -* -*/ - - -// SYSTEM INCLUDES -#include -#include -#include -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION -#include "touchscprivatepskeys.h" -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION -#include -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION -#include -#include -#include -#include -#include //used for RemoveSplashScreen - -// USER INCLUDES -#include "TouchScreenCalibApplication.h" -#include "TouchScreenCalibAppUi.h" -#include "TouchScreenCalibDefines.h" -#include "TouchScreenCalibDocument.h" -#include "TouchScreenCalibView.h" -#include "TouchScreenCalibPubSubObserver.h" - -// CONSTANTS - -_LIT_SECURITY_POLICY_C1(KReadDeviceDataPolicy, ECapabilityReadDeviceData); -_LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData); - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------- -// CTouchScreenCalibAppUi::CTouchScreenCalibAppUi() -// ---------------------------------------------------- -CTouchScreenCalibAppUi::CTouchScreenCalibAppUi(): - iTouchScreenCalibPubSubObserver( NULL ), - iCurrentCalibrationStep( 0 ), - iExitting( EFalse ), - iCalibrationDone( EFalse ), - iCalibrationCancel( EFalse ) - { - TRACES("CTouchScreenCalibAppUi::CTouchScreenCalibAppUi"); - iNativeOrientation = KUnknownOrientation; - } - -// ---------------------------------------------------- -// CTouchScreenCalibAppUi::ConstructL() -// ---------------------------------------------------- -void CTouchScreenCalibAppUi::ConstructL() - { - TRACES("CTouchScreenCalibAppUi::ConstructL()"); - TInt flags = EStandardApp|EAknEnableSkin; - - BaseConstructL(flags); - -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Define(KPSUidTouchScreenCalibration, -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Define(KPSUidStartup, -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSTouchScreenCalibration, - RProperty::EInt, - KReadDeviceDataPolicy, - KWriteDeviceDataPolicy ); - - // Clearing the calibration before doing the actual calibration - TDigitizerCalibrationType caltype = EFactory; - UserHal::RestoreXYInputCalibration(caltype); - ResetTapPoints(); - -// SetOrientation(); - - iCalibrationPoints = CalibrationPoints(); - - // Set TSC application to be system application - CEikonEnv& eikEnv = *CEikonEnv::Static(); - eikEnv.SetSystem( ETrue ); - - iTouchScreenCalibLayout.iAnimImageLayout1.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g1().LayoutLine()); - iTouchScreenCalibLayout.iAnimImageLayout2.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g2().LayoutLine()); - iTouchScreenCalibLayout.iAnimImageLayout3.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g3().LayoutLine()); - iTouchScreenCalibLayout.iAnimImageLayout4.LayoutRect(Rect(),AknLayoutScalable_Apps::main_touch_calib_pane_g4().LayoutLine()); - - iTouchScreenCalibView = CTouchScreenCalibView::NewL( this ); - AddToStackL( iTouchScreenCalibView ); - - iTouchScreenCalibView->SetWinPriority(0); - // Disable priority changes of window server - eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); - - UpdateL(); - - iTouchScreenCalibPubSubObserver = CTouchScreenCalibPubSubObserver::NewL( this ); - - if (FirstBoot()) - { - TRACES("CTouchScreenCalibAppUi::ConstructL(): First boot ongoing"); - TRACES("CTouchScreenCalibAppUi::ConstructL(): Connect to Starter"); - RStarterSession startersession; - if( startersession.Connect() == KErrNone ) - { - TRACES("CTouchScreenCalibAppUi::ConstructL(): Connected to Starter"); - startersession.EndSplashScreen(); - TRACES("CTouchScreenCalibAppUi::ConstructL(): Splash screen removed"); - startersession.Close(); - } - } - NextCalibrationStepL(); - - TRACES("CTouchScreenCalibAppUi::ConstructL(): End"); - } - -// ---------------------------------------------------- -// CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi() -// ---------------------------------------------------- -CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi() - { - TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi()"); - if (iTouchScreenCalibView) - { - TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): delete iTouchScreenCalibView"); - RemoveFromStack( iTouchScreenCalibView ); - delete iTouchScreenCalibView; - } - if (iTouchScreenCalibPubSubObserver) - { - TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): delete iTouchScreenCalibPubSubObserver"); - delete iTouchScreenCalibPubSubObserver; - } - TRACES("CTouchScreenCalibAppUi::~CTouchScreenCalibAppUi(): End"); - } - -// ---------------------------------------------------- -// CTouchScreenCalibAppUi::NextCalibrationStepL() -// ---------------------------------------------------- -void CTouchScreenCalibAppUi::NextCalibrationStepL() - { - TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL()"); - TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint1: %d %d",iTapPoints.iTl.iX, iTapPoints.iTl.iY); - TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint2: %d %d",iTapPoints.iTr.iX, iTapPoints.iTr.iY); - TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint3: %d %d",iTapPoints.iBr.iX, iTapPoints.iBr.iY); - TRACES2("CTouchScreenCalibAppUi::NextCalibrationStepL(): TapPoint4: %d %d",iTapPoints.iBl.iX, iTapPoints.iBl.iY); - iCurrentCalibrationStep++; - TRACES1("CTouchScreenCalibAppUi::NextCalibrationStepL(): CurrentCalibrationStep: %d",iCurrentCalibrationStep); - - if (iCurrentCalibrationStep > 4) - { - TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Calibration succesfully completed. Save it and exit application."); - SaveCalibration(); - iCalibrationDone = ETrue; - - iTouchScreenCalibView->EndTargetAnimation(); - iTouchScreenCalibView->SetWinPriority(ECoeWinPriorityNormal); - TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Show 'Calibration Done' note"); - HBufC* noteText = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_DONE ); - CAknInformationNote* note = - new( ELeave ) CAknInformationNote( ETrue ); - note->ExecuteLD( *noteText ); - CleanupStack::PopAndDestroy( noteText ); - if ( FirstBoot() ) - { - iTouchScreenCalibView->DrawEndingBackground(); -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Set( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, ETouchScreenCalibrationOk ); -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Set( KPSUidStartup, KPSTouchScreenCalibration, ETouchScreenCalibrationOk ); -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - iTouchScreenCalibView->SetWinPriority(0); - } - else - { - PrepareToExit(); - } - } - else - { - TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): Update next step."); - UpdateL(); - } - TRACES("CTouchScreenCalibAppUi::NextCalibrationStepL(): End"); - } - -// ---------------------------------------------------- -// CTouchScreenCalibAppUi::SaveCalibration() -// ---------------------------------------------------- -void CTouchScreenCalibAppUi::SaveCalibration() - { - TRACES("CTouchScreenCalibAppUi::SaveCalibration()"); - - // Touch Screen driver supports only portrait orientation. If device is now in - // landscape mode, convert points to portrait. - TDigitizerCalibration tapPoints = ConvertToCorrectOrientation(iTapPoints, - KConvertSaveCase); - UserHal::SetXYInputCalibration(tapPoints); - TRACES("CTouchScreenCalibAppUi::SaveCalibration(): End"); - } - -// ---------------------------------------------------- -// CTouchScreenCalibAppUi::ResetCalibrationStepsL() -// ---------------------------------------------------- -void CTouchScreenCalibAppUi::ResetCalibrationStepsL() - { - iCurrentCalibrationStep = 0; - ResetTapPoints(); - NextCalibrationStepL(); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::HandleForegroundEventL(TBool aForeground) -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::HandleForegroundEventL( TBool aForeground ) - { - // call super-class first - CAknAppUi::HandleForegroundEventL( aForeground ); - TRACES1("CTouchScreenCalibAppUi::HandleForegroundEventL( %d )", aForeground); - if ( aForeground ) - { - // if we are coming to foreground - UpdateL(); - } - else - { - if (!FirstBoot()) - { - // Take old calibration in use - TDigitizerCalibrationType caltype = ESaved; - UserHal::RestoreXYInputCalibration(caltype); - PrepareToExit(); - } - } - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::HandleKeyL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::HandleKeyL( const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) - { - TRACES1("CTouchScreenCalibAppUi::HandleKeyL(): %d",aKeyEvent.iCode); - - if (aKeyEvent.iCode == EKeyYes) //Send key - { - TRACES("CTouchScreenCalibAppUi::HandleKeyL(): Send Key"); - if (FirstBoot()) // Restart calibration from step 1 - { - TRACES("CTouchScreenCalibAppUi::HandleKey(): Go to first calibration step"); - ResetCalibrationStepsL(); - } - else// Show "Calibration cancelled" Information note. - { - TRACES("CTouchScreenCalibAppUi::HandleKeyL(): Show cancel note"); - iCalibrationCancel = ETrue; - - iTouchScreenCalibView->EndAnimation(); - iTouchScreenCalibView->SetWinPriority(ECoeWinPriorityNormal); - HBufC* noteText = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_CANCEL ); - CAknInformationNote* note = - new( ELeave ) CAknInformationNote( ETrue ); - note->ExecuteLD( *noteText ); - CleanupStack::PopAndDestroy( noteText ); - - // Take old calibration in use - TDigitizerCalibrationType caltype = ESaved; - UserHal::RestoreXYInputCalibration(caltype); - PrepareToExit(); - } - } - else if ( aKeyEvent.iCode == EKeyNo || aKeyEvent.iCode == EKeyApplication0 - || ( aKeyEvent.iCode == EKeyNull && aKeyEvent.iScanCode == EStdKeyDevice7 )) - { - TRACES("CTouchScreenCalibAppUi::HandleKeyL(): End Key or App Key"); - if (!FirstBoot()) - { - // Take old calibration in use - TDigitizerCalibrationType caltype = ESaved; - UserHal::RestoreXYInputCalibration(caltype); - PrepareToExit(); - } - } - TRACES("CTouchScreenCalibAppUi::HandleKeyL(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::HandlePointerL() -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::HandlePointerL( TPoint aPos ) - { - TRACES("CTouchScreenCalibAppUi::HandlePointerL()"); - - switch(iCurrentCalibrationStep) - { - case 1: - TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 1"); - iTapPoints.iTl.iX = aPos.iX; - iTapPoints.iTl.iY = aPos.iY; - break; - case 2: - TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 2"); - iTapPoints.iTr.iX = aPos.iX; - iTapPoints.iTr.iY = aPos.iY; - break; - case 3: - TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 4"); - iTapPoints.iBr.iX = aPos.iX; - iTapPoints.iBr.iY = aPos.iY; - break; - case 4: - TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case 3"); - iTapPoints.iBl.iX = aPos.iX; - iTapPoints.iBl.iY = aPos.iY; - break; - default: - TRACES("CTouchScreenCalibAppUi::HandlePointerL(): case default"); - break; - } - TRACES("CTouchScreenCalibAppUi::HandlePointerL(): End: Continue calibration"); - NextCalibrationStepL(); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::PrepareToExit() -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::PrepareToExit() - { - TRACES("CTouchScreenCalibAppUi::PrepareToExit()"); - if (!iExitting) - { - iExitting = ETrue; - CEikAppUi::PrepareToExit(); - Exit(); - } - TRACES("CTouchScreenCalibAppUi::PrepareToExit(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::ResetTapPoints() -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::ResetTapPoints() - { - TRACES("CTouchScreenCalibAppUi::ResetTapPoints()"); - iTapPoints.iTl.iX = 0; - iTapPoints.iTl.iY = 0; - iTapPoints.iTr.iX = 0; - iTapPoints.iTr.iY = 0; - iTapPoints.iBr.iX = 0; - iTapPoints.iBr.iY = 0; - iTapPoints.iBl.iX = 0; - iTapPoints.iBl.iY = 0; - TRACES("CTouchScreenCalibAppUi::ResetTapPoints(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::UpdateL() -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::UpdateL() - { - TRACES("CTouchScreenCalibAppUi::UpdateL()"); - TRACES1("CTouchScreenCalibAppUi::UpdateL(): iCurrentCalibrationStep: %d",iCurrentCalibrationStep); - - TAknLayoutText textLayout; - textLayout.LayoutText(TRect(), AknLayoutScalable_Apps::main_touch_calib_pane_t1().LayoutLine()); - - TRACES2("CTouchScreenCalibAppUi::UpdateL(): Text rect top: X:%d Y:%d",textLayout.TextRect().iTl.iX, textLayout.TextRect().iTl.iY); - TRACES2("CTouchScreenCalibAppUi::UpdateL(): Text rect:bottom: X:%d Y:%d",textLayout.TextRect().iBr.iX, textLayout.TextRect().iBr.iY); - - iTouchScreenCalibView->UpdateL(textLayout); - - TRACES("CTouchScreenCalibAppUi::UpdateL(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::GetCalibrationStep() -// --------------------------------------------------------------------------- -TInt CTouchScreenCalibAppUi::GetCalibrationStep() - { - return iCurrentCalibrationStep; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::GetAnimImageRect() -// --------------------------------------------------------------------------- -TRect CTouchScreenCalibAppUi::GetAnimImageRect(TInt aPointNumber) - { - TRACES1("CTouchScreenCalibAppUi::GetAnimImageRect(%d)", aPointNumber); - TRect rect; - TInt width(0); - TInt height(0); - - // If aPointNumber is 0, return current calibration point. - if (aPointNumber == 0) - { - aPointNumber = GetCalibrationStep(); - } - - switch (aPointNumber) - { - case 1: - width = iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iBr.iX - - iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iTl.iX; - height= iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iBr.iY - - iTouchScreenCalibLayout.iAnimImageLayout1.Rect().iTl.iY; - - rect = TRect(TPoint( iCalibrationPoints.iTl.iX - (width/2), - iCalibrationPoints.iTl.iY - (height/2)), - TPoint( iCalibrationPoints.iTl.iX + (width/2), - iCalibrationPoints.iTl.iY + (height/2))); - break; - case 2: - width = iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iBr.iX - - iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iTl.iX; - height= iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iBr.iY - - iTouchScreenCalibLayout.iAnimImageLayout2.Rect().iTl.iY; - - rect = TRect(TPoint( iCalibrationPoints.iTr.iX - (width/2), - iCalibrationPoints.iTr.iY - (height/2)), - TPoint( iCalibrationPoints.iTr.iX + (width/2), - iCalibrationPoints.iTr.iY + (height/2))); - break; - case 3: - width = iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iBr.iX - - iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iTl.iX; - height= iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iBr.iY - - iTouchScreenCalibLayout.iAnimImageLayout3.Rect().iTl.iY; - - rect = TRect(TPoint( iCalibrationPoints.iBr.iX - (width/2), - iCalibrationPoints.iBr.iY - (height/2)), - TPoint( iCalibrationPoints.iBr.iX + (width/2), - iCalibrationPoints.iBr.iY + (height/2))); - break; - case 4: - width = iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iBr.iX - - iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iTl.iX; - height= iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iBr.iY - - iTouchScreenCalibLayout.iAnimImageLayout4.Rect().iTl.iY; - - rect = TRect(TPoint( iCalibrationPoints.iBl.iX - (width/2), - iCalibrationPoints.iBl.iY - (height/2)), - TPoint( iCalibrationPoints.iBl.iX + (width/2), - iCalibrationPoints.iBl.iY + (height/2))); - break; - default: - break; - } - TRACES("CTouchScreenCalibAppUi::GetAnimImageRect(): End"); - return rect; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::HandleResourceChange(...) -// --------------------------------------------------------------------------- -void CTouchScreenCalibAppUi::HandleScreenDeviceChangedL() - { - TRACES("CTouchScreenCalibAppUi::HandleResourceChange()"); - CAknAppUiBase::HandleScreenDeviceChangedL(); - - if (!iCalibrationDone && !iCalibrationCancel ) - { - TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): Restart calibration"); - iCalibrationPoints = CalibrationPoints(); - if (iTouchScreenCalibView) - { - RemoveFromStack( iTouchScreenCalibView ); - delete iTouchScreenCalibView; - iTouchScreenCalibView = NULL; - } - iTouchScreenCalibView = CTouchScreenCalibView::NewL( this ); - AddToStackL( iTouchScreenCalibView ); - ResetCalibrationStepsL(); - } - else - { - TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): Update ending background"); - iTouchScreenCalibView->DrawEndingBackground(); - } - TRACES("CTouchScreenCalibAppUi::HandleResourceChange(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::CalibrationPoints(); -// --------------------------------------------------------------------------- -TDigitizerCalibration CTouchScreenCalibAppUi::CalibrationPoints() - { - TRACES("CTouchScreenCalibAppUi::CalibrationPoints()"); - TDigitizerCalibration calibrationPoints; -#if defined(__WINS__) - // Dummy values for emulator for testing purposes - TRect rect = iAvkonAppUi->ApplicationRect(); - TRACES2("CTouchScreenCalibAppUi::CalibrationPoints(): Window resolution: (%d. %d)",rect.iBr.iX,rect.iBr.iY); - - calibrationPoints.iTl.iX = rect.iTl.iX+50; - calibrationPoints.iTl.iY = rect.iTl.iY+50; - calibrationPoints.iTr.iX = rect.iBr.iX-50; - calibrationPoints.iTr.iY = rect.iTl.iY+50; - calibrationPoints.iBr.iX = rect.iBr.iX-50; - calibrationPoints.iBr.iY = rect.iBr.iY-50; - calibrationPoints.iBl.iX = rect.iTl.iX+50; - calibrationPoints.iBl.iY = rect.iBr.iY-50; -#else - UserHal::CalibrationPoints(calibrationPoints); -#endif - - // Orientation in driver level could be different than window orientation. Convert - // points to correct orientation. - if (calibrationPoints.iBr.iX > calibrationPoints.iBr.iY ) - { - TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): Native orientation: landscape"); - iNativeOrientation = KLandscapeOrientation; - } - else - { - TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): Native orientation: portrait"); - iNativeOrientation = KPortraitOrientation; - } - calibrationPoints = ConvertToCorrectOrientation(calibrationPoints, KConvertGetCase); - - TRACES("CTouchScreenCalibAppUi::CalibrationPoints(): End"); - return calibrationPoints; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::ConvertToCorrectOrientation(TDigitizerCalibration aPoints); -// --------------------------------------------------------------------------- -TDigitizerCalibration CTouchScreenCalibAppUi::ConvertToCorrectOrientation(TDigitizerCalibration aPoints, - TInt aConvertCase) - { - TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation()"); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iTl.iX,aPoints.iTl.iY); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iTr.iX,aPoints.iTr.iY); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iBr.iX,aPoints.iBr.iY); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", aPoints.iBl.iX,aPoints.iBl.iY); - TDigitizerCalibration points; - TPoint destReso; - - TRect rect = iAvkonAppUi->ApplicationRect(); - - if (!IsCorrectOrientation(rect)) - { - TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Points are not for current layout."); - if (aConvertCase == KConvertGetCase) - { - destReso.iX = rect.iBr.iX; - destReso.iY = rect.iBr.iY; - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Destin reso: X:%d Y:%d", destReso.iX,destReso.iY); - points = ChangeOrientation(aPoints, destReso); - } - else - { - destReso.iX = rect.iBr.iY; - destReso.iY = rect.iBr.iX; - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): Destin reso: X:%d Y:%d", destReso.iX,destReso.iY); - points = ChangeOrientation(aPoints, destReso); - } - } - else - { - points = aPoints; - } - - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iTl.iX,points.iTl.iY); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iTr.iX,points.iTr.iY); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iBr.iX,points.iBr.iY); - TRACES2("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): X:%d Y:%d", points.iBl.iX,points.iBl.iY); - - TRACES("CTouchScreenCalibAppUi::ConvertToCorrectOrientation(): End"); - return points; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::IsCorrectOrientation(TRect aRect) -// --------------------------------------------------------------------------- -TBool CTouchScreenCalibAppUi::IsCorrectOrientation(TRect aRect) - { - TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation()"); - TBool ret(ETrue); - TBool nativePortrait(ETrue); - - if (iNativeOrientation == KLandscapeOrientation) - { - TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation(): Native orientation: landscape"); - nativePortrait = EFalse; - } - - TBool windowsPortrait(ETrue); - - if (aRect.iBr.iX > aRect.iBr.iY) - { - TRACES("CTouchScreenCalibAppUi::IsCorrectOrientation(): Window orientation: landscape"); - windowsPortrait = EFalse; - } - else - { - windowsPortrait = ETrue; - } - - if (nativePortrait != windowsPortrait) - { - ret = EFalse; - } - - TRACES1("CTouchScreenCalibAppUi::IsCorrectOrientation(): End: returns %d",ret); - return ret; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibAppUi::ChangeOrientation(TDigitizerCalibration aPoints); -// --------------------------------------------------------------------------- -TDigitizerCalibration CTouchScreenCalibAppUi::ChangeOrientation(TDigitizerCalibration aSourcePoints, - TPoint aDestReso) - { - TRACES("CTouchScreenCalibAppUi::ChangeOrientation()"); - TDigitizerCalibration destPoints; - - destPoints.iTl.iX = aSourcePoints.iTr.iY; - destPoints.iTl.iY = aDestReso.iY - aSourcePoints.iTr.iX; - destPoints.iTr.iX = aSourcePoints.iBr.iY; - destPoints.iTr.iY = aDestReso.iY - aSourcePoints.iBr.iX; - destPoints.iBr.iX = aSourcePoints.iBl.iY; - destPoints.iBr.iY = aDestReso.iY - aSourcePoints.iBl.iX; - destPoints.iBl.iX = aSourcePoints.iTl.iY; - destPoints.iBl.iY = aDestReso.iY - aSourcePoints.iTl.iX; - - - TRACES("CTouchScreenCalibAppUi::ChangeOrientation(): End"); - return destPoints; - } - -// --------------------------------------------------------- -// CTouchScreenCalibAppUi::FirstBoot() -// --------------------------------------------------------- -TBool CTouchScreenCalibAppUi::FirstBoot() - { - TRACES("CTouchScreenCalibAppUi::FirstBoot()"); - TInt value( 0 ); - - TRACES("CTouchScreenCalibAppUi::FirstBoot(): Read first boot info from Central Repository "); - CRepository* repository(NULL); - - TRAPD( err, repository = CRepository::NewL( KCRUidStartup ) ); - if ( err == KErrNone ) - { - err = repository->Get( KStartupFirstBoot, value ); - } - - delete repository; - - if (value) - { - TRACES("CTouchScreenCalibAppUi::FirstBoot(): End, return EFalse"); - return EFalse; - } - - else - { - TRACES("CTouchScreenCalibAppUi::FirstBoot(): End, return ETrue"); - return ETrue; - } - } - - -/* - * This funcntion is used to change the screen orientation to the - * same orientation with the factory given calibration data. But it - * is not used now. So just leave it here! - * */ - - -void CTouchScreenCalibAppUi::SetOrientation() - { -#ifndef __WINS__ - - TInt orientation = KUnknownOrientation; - TInt nativeOrientation = KUnknownOrientation; - TDigitizerCalibration Points; - UserHal::CalibrationPoints( Points ); - if ( Points.iBr.iX > Points.iBr.iY) - { - orientation = KLandscapeOrientation; - } - else - { - orientation = KPortraitOrientation; - } - TRect rect = iAvkonAppUi->ApplicationRect(); - if ( rect.iBr.iX > rect.iBr.iY ) - { - nativeOrientation = KLandscapeOrientation; - } - else - { - nativeOrientation = KPortraitOrientation; - } - - if (orientation != nativeOrientation ) - { - if ( orientation == KLandscapeOrientation ) - { - SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape ); - } - else - { - SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait ); - } - } -#endif - } -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/src/TouchScreenCalibApplication.cpp --- a/systemswuis/touchscreencalib/src/TouchScreenCalibApplication.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2006 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: -* This module implements the application core i.e. application -* class and standard exported functions -* -*/ - - -// INCLUDE FILES -#include "TouchScreenCalibApplication.h" -#include "TouchScreenCalibDocument.h" - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CTouchScreenCalibApplication::AppDllUid() -// Returns application UID -// --------------------------------------------------------------------------- -TUid CTouchScreenCalibApplication::AppDllUid() const - { - return KUidTouchScreenCalib; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibApplication::CreateDocumentL() -// Creates CTouchScreenCalibDocument object -// -// --------------------------------------------------------------------------- -CApaDocument* CTouchScreenCalibApplication::CreateDocumentL() - { - return CTouchScreenCalibDocument::NewL(*this); - } - -// ===================== OTHER EXPORTED FUNCTIONS ============================ -#include - -LOCAL_C CApaApplication* NewApplication() - { - return new CTouchScreenCalibApplication; - } - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/src/TouchScreenCalibDocument.cpp --- a/systemswuis/touchscreencalib/src/TouchScreenCalibDocument.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2006 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: Document class of the application. -* -*/ - - -// SYSTEM INCLUDES -#include - -// USER INCLUDES -#include "TouchScreenCalibDocument.h" -#include "TouchScreenCalibAppUi.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CTouchScreenCalibDocument::~CTouchScreenCalibDocument() -// --------------------------------------------------------- -CTouchScreenCalibDocument::~CTouchScreenCalibDocument() - { - } - -// --------------------------------------------------------- -// CTouchScreenCalibDocument::ConstructL() -// --------------------------------------------------------- -void CTouchScreenCalibDocument::ConstructL() - { - } - -// --------------------------------------------------------- -// CTouchScreenCalibDocument::NewL() -// --------------------------------------------------------- -CTouchScreenCalibDocument* CTouchScreenCalibDocument::NewL( - CEikApplication& aApp) // CTouchScreenCalibApp reference - { - CTouchScreenCalibDocument* self = new (ELeave) CTouchScreenCalibDocument(aApp); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// ---------------------------------------------------- -// CTouchScreenCalibDocument::CreateAppUiL() -// ---------------------------------------------------- -CEikAppUi* CTouchScreenCalibDocument::CreateAppUiL() - { - return new(ELeave) CTouchScreenCalibAppUi; - } - -// ---------------------------------------------------- -// CTouchScreenCalibDocument::UpdateTaskNameL() -// Makes TouchScreenCalib-application hidden in menu shell and fastswap window -// ---------------------------------------------------- -void CTouchScreenCalibDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) - { - CEikDocument::UpdateTaskNameL( aWgName ); - aWgName->SetHidden( ETrue ); - } - -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/src/TouchScreenCalibPubSubObserver.cpp --- a/systemswuis/touchscreencalib/src/TouchScreenCalibPubSubObserver.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2007 - 2008 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: -* This class the handles the received indications from the Public and -* Subscribe. -* -*/ - - -// SYSTEM INCLUDES -#include -#include - -// USER INCLUDES -#include "TouchScreenCalibPubSubObserver.h" -#include "TouchScreenCalibPubSubObserver.h" -#include "TouchScreenCalibSubscriber.h" -#include "TouchScreenCalibDefines.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ---------------------------------------------------- -// CTouchScreenCalibPubSubObserver::CTouchScreenCalibPubSubObserver( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) -// C++ default constructor can NOT contain any code, that -// might leave. -// ---------------------------------------------------- -CTouchScreenCalibPubSubObserver::CTouchScreenCalibPubSubObserver( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) : - iTouchScreenCalibAppUi( aTouchScreenCalibAppUi ) - { - } - -// ---------------------------------------------------- -// CTouchScreenCalibPubSubObserver::ConstructL() -// ---------------------------------------------------- -void CTouchScreenCalibPubSubObserver::ConstructL() - { - TRACES("CTouchScreenCalibPubSubObserver::ConstructL()"); - - iGlobalSWStateSubscriber = CTouchScreenCalibSubscriber::NewL( *this, - KPSUidStartup, - KPSGlobalSystemState ); - iGlobalSWStateSubscriber->Subscribe(); - - iTsyCallState = CTouchScreenCalibSubscriber::NewL( *this, - KPSUidCtsyCallInformation, - KCTsyCallState ); - iTsyCallState->Subscribe(); - - TRACES("CTouchScreenCalibPubSubObserver::ConstructL(): End"); - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibPubSubObserver::HandlePropertyChangedL() -// ---------------------------------------------------------------------------- -void CTouchScreenCalibPubSubObserver::HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) - { - TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL()"); - TRACES1("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey ); - - if (aCategory == KPSUidStartup && aKey == KPSGlobalSystemState) - { - TInt eventState; - User::LeaveIfError( RProperty::Get ( KPSUidStartup, KPSGlobalSystemState, eventState ) ); - - if( eventState == ESwStateCriticalPhaseOK || - eventState == ESwStateEmergencyCallsOnly || - eventState == ESwStateNormalRfOn || - eventState == ESwStateNormalRfOff || - eventState == ESwStateNormalBTSap ) - { - TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): Critical startup phase ready"); - iTouchScreenCalibAppUi->PrepareToExit(); - } - } - else if (aCategory == KPSUidCtsyCallInformation && aKey == KCTsyCallState) - { - TInt eventState; - User::LeaveIfError( RProperty::Get ( KPSUidCtsyCallInformation, KCTsyCallState, eventState ) ); - - if( eventState == EPSCTsyCallStateRinging || - eventState == EPSCTsyCallStateDisconnecting) - { - TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): Call detected"); - iTouchScreenCalibAppUi->PrepareToExit(); - } - } - TRACES("CTouchScreenCalibPubSubObserver::HandlePropertyChangedL(): End"); - } - -// ---------------------------------------------------- -// CTouchScreenCalibPubSubObserver* CTouchScreenCalibPubSubObserver::NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) -// ---------------------------------------------------- -CTouchScreenCalibPubSubObserver* CTouchScreenCalibPubSubObserver::NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) - { - TRACES("CTouchScreenCalibPubSubObserver::NewL()"); - CTouchScreenCalibPubSubObserver* self = new (ELeave) CTouchScreenCalibPubSubObserver( aTouchScreenCalibAppUi ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - - TRACES("CTouchScreenCalibPubSubObserver::NewL(): End"); - return self; - } - -// ---------------------------------------------------- -// CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver() -// ---------------------------------------------------- -CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver() - { - TRACES("CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver()"); - - delete iGlobalSWStateSubscriber; - delete iTsyCallState; - iProperty.Close(); - - TRACES("CTouchScreenCalibPubSubObserver::~CTouchScreenCalibPubSubObserver(): End"); - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/src/TouchScreenCalibSubscriber.cpp --- a/systemswuis/touchscreencalib/src/TouchScreenCalibSubscriber.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2007 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: CTouchScreenCalibSubscriber implementation. - * -*/ - - -// INCLUDES -#include -#include "TouchScreenCalibAppUi.h" -#include "TouchScreenCalibSubscriber.h" -#include "TouchScreenCalibDefines.h" - -// CONSTANTS - -// ============================= MEMBER FUNCTIONS ============================= - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::NewL() -// ---------------------------------------------------------------------------- -CTouchScreenCalibSubscriber* CTouchScreenCalibSubscriber::NewL( - MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, - const TUid& aCategory, - TUint aKey ) - { - CTouchScreenCalibSubscriber* self = new (ELeave) CTouchScreenCalibSubscriber( aTouchScreenCalibPropertyResponder, - aCategory, - aKey ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); //self - return self; - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::ConstructL() -// ---------------------------------------------------------------------------- -void CTouchScreenCalibSubscriber::ConstructL() - { - CActiveScheduler::Add( this ); - iProperty.Attach( iCategory, iKey ); - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::Subscribe() -// ---------------------------------------------------------------------------- -void CTouchScreenCalibSubscriber::Subscribe() - { - TRACES("CTouchScreenCalibSubscriber::Subscribe()"); - iProperty.Subscribe( iStatus ); - SetActive(); - TRACES("CTouchScreenCalibSubscriber::Subscribe(): End"); - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::CTouchScreenCalibSubscriber() -// ---------------------------------------------------------------------------- -CTouchScreenCalibSubscriber::CTouchScreenCalibSubscriber( MTouchScreenCalibPropertyResponder& aTouchScreenCalibPropertyResponder, - const TUid& aCategory, - TUint aKey ) : - CActive( EPriorityStandard ), - iTouchScreenCalibPropertyResponder( aTouchScreenCalibPropertyResponder ), - iCategory( aCategory), - iKey( aKey ) - { - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::RunL() -// ---------------------------------------------------------------------------- -void CTouchScreenCalibSubscriber::RunL() - { - TRACES("CTouchScreenCalibSubscriber::RunL()"); - Subscribe(); - iTouchScreenCalibPropertyResponder.HandlePropertyChangedL( iCategory, iKey ); - TRACES("CTouchScreenCalibSubscriber::RunL(): End"); - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::DoCancel() -// ---------------------------------------------------------------------------- -void CTouchScreenCalibSubscriber::DoCancel() - { - iProperty.Cancel(); - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::RunError() -// ---------------------------------------------------------------------------- -TInt CTouchScreenCalibSubscriber::RunError( TInt aError ) - { - return aError; - } - -// ---------------------------------------------------------------------------- -// CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber() -// ---------------------------------------------------------------------------- -CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber() - { - TRACES("CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber()"); - Cancel(); - iProperty.Close(); - TRACES("CTouchScreenCalibSubscriber::~CTouchScreenCalibSubscriber(): End"); - } - -// End of File - - - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/src/TouchScreenCalibView.cpp --- a/systemswuis/touchscreencalib/src/TouchScreenCalibView.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,569 +0,0 @@ -/* -* Copyright (c) 2006 - 2007 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: -* This class is the container class of the CTouchScreenCalibView. -* Is used to show tap target animation. -* -*/ - - -// SYSTEM INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// USER INCLUDES -#include "TouchScreenCalibView.h" -#include "TouchScreenCalibDefines.h" -#include "TouchScreenCalibAppUi.h" - -// CONSTANTS -_LIT( KTargetAnimationResource, "z:TouchScreenCalib_anim.rsc" ); - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::ConstructL() -// Symbian 2nd phase constructor can leave. -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::ConstructL() - { - TRACES("CTouchScreenCalibView::ConstructL()"); - - CreateWindowL(); - - iAnimImageRect.iAnimImageRect1 = iTouchScreenCalibAppUi->GetAnimImageRect(1); - iAnimImageRect.iAnimImageRect2 = iTouchScreenCalibAppUi->GetAnimImageRect(2); - iAnimImageRect.iAnimImageRect3 = iTouchScreenCalibAppUi->GetAnimImageRect(3); - iAnimImageRect.iAnimImageRect4 = iTouchScreenCalibAppUi->GetAnimImageRect(4); - - // Parse filename of bitmaps - _LIT( KDirAndFile, "z:TouchScreenCalib.mif" ); - TParse* fp1 = new(ELeave) TParse(); - fp1->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL); - TFileName fileName( fp1->FullName() ); - TRACES1("CTouchScreenCalibImage::CreateIconL(): Image: %S", &(fp1->FullName()) ); - delete fp1; - - AknIconUtils::CreateIconL( iBitmap, - iBitmapMask, - fileName, - EMbmTouchscreencalibQgn_graf_screencalib, - EMbmTouchscreencalibQgn_graf_screencalib_mask); - - iAvkonAppUi->StatusPane()->MakeVisible(EFalse); - - TRACES("CTouchScreenCalibView::ConstructL(): Animation loading started"); - iAnim = CAknBitmapAnimation::NewL(); - iAnim->SetContainerWindowL( *this ); - iAnim->SetScaleModeForAnimationFrames(EAspectRatioPreservedAndUnusedSpaceRemoved); - TResourceReader rr; - RConeResourceLoader loader( *iCoeEnv ); - - TParse* fp = new(ELeave) TParse(); - fp->Set(KTargetAnimationResource, &KDC_APP_RESOURCE_DIR, NULL); - TRACES1("CTouchScreenCalibView::ConstructL(): Animated target resource path: %S", &fp->FullName()); - TFileName name( fp->FullName() ); - delete fp; - TInt fileError = loader.Open( name ); - if ( fileError == KErrNone ) - { - CleanupClosePushL( loader ); - iCoeEnv->CreateResourceReaderLC(rr, R_SHUTDOWN_ANIM); - TRAPD(err, iAnim->ConstructFromResourceL( rr )); - if( err == KErrNone ) - { - TResourceReader timeReader; - iCoeEnv->CreateResourceReaderLC(timeReader, R_ANIM_DURATION); - CleanupStack::PopAndDestroy(); // pop timeReader - iAnim->SetPosition(TPoint(0,0)); - iAnim->SetSize(TSize(0,0)); - TRACES("CTouchScreenCalibView::ConstructL(): animation succesfully loaded"); - } - else - { - TRACES("CTouchScreenCalibView::ConstructL(): animation loading failed"); - } - CleanupStack::PopAndDestroy(); //pop rr - TRACES("CTouchScreenCalibView::ConstructL(): animation loading ended"); - CleanupStack::PopAndDestroy(); //pop loader - } - else - { - TRACES("CTouchScreenCalibView::ConstructL(): resource file loading failed"); - } - - SetRect(iAvkonAppUi->ApplicationRect()); - ActivateL(); - - iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); - iText = new( ELeave ) CArrayPtrFlat( 20 ); - - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.BringToForeground(); - - if (iTouchScreenCalibAppUi->FirstBoot()) - { - Window().SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 10000 ); - } - else - { - Window().SetOrdinalPosition( 0, ECoeWinPriorityHigh + 1 ); - } - iTouchFeedback = MTouchFeedback::Instance(); - - TRACES("CTouchScreenCalibView::ConstructL(): ConstructL ended"); - } - -// ----------------------------------------------------------------------------- -// CTouchScreenCalibView::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CTouchScreenCalibView* CTouchScreenCalibView::NewL( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) - { - TRACES("CTouchScreenCalibView::NewL()"); - CTouchScreenCalibView* self = new (ELeave) CTouchScreenCalibView( aTouchScreenCalibAppUi ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// --------------------------------------------------------- -// CTouchScreenCalibView::CTouchScreenCalibView() -// --------------------------------------------------------- -CTouchScreenCalibView::CTouchScreenCalibView( CTouchScreenCalibAppUi* aTouchScreenCalibAppUi ) : - iTouchScreenCalibAppUi( aTouchScreenCalibAppUi ), - iAnimationShowing( EFalse ), - iAnimationCancelled ( EFalse ), - iText( NULL ), - iCalibrationCompleted( EFalse ) - { - TRACES("CTouchScreenCalibView::CTouchScreenCalibView()"); - TRACES("CTouchScreenCalibView::CTouchScreenCalibView(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::UpdateL( TAknLayoutText aTextLayout ) -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::UpdateL( TAknLayoutText aTextLayout ) - { - TRACES("CTouchScreenCalibView::UpdateL()"); - - TRect rect = iTouchScreenCalibAppUi->GetAnimImageRect(); - - SetTextL(aTextLayout); - EndAnimation(); - DrawDeferred(); - - TPoint pos = TPoint(rect.iTl.iX, rect.iTl.iY); - TSize size = TSize(rect.iBr.iX-rect.iTl.iX, rect.iBr.iY-rect.iTl.iY); - iAnim->SetPosition(pos); - iAnim->SetSize(size); - - TRAPD(err, iAnim->StartAnimationL()); - if ( err != KErrNone ) - { - TRACES("CTouchScreenCalibView::UpdateL(): Starting animation failed"); - } - - TRACES("CTouchScreenCalibView::UpdateL(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::DrawEndingBackground() -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::DrawEndingBackground() - { - TRACES("CTouchScreenCalibView::DrawEndingBackground()"); - iCalibrationCompleted = ETrue; - SetRect( iAvkonAppUi->ApplicationRect() ); - EndAnimation(); - DrawNow(); - TRACES("CTouchScreenCalibView::DrawEndingBackground(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::EndTargetAnimation() -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::EndTargetAnimation() - { - TRACES("CTouchScreenCalibView::EndTargetAnimation()"); - EndAnimation(); - DrawNow(); - TRACES("CTouchScreenCalibView::EndTargetAnimation(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::~CTouchScreenCalibView() -// --------------------------------------------------------------------------- -CTouchScreenCalibView::~CTouchScreenCalibView() - { - TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() begin"); - - if( iAnim ) - { - if( iAnimationShowing ) - { - iAnim->CancelAnimation(); - TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() animation cancelled"); - } - } - delete iAnim; - TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() iAnim deleted"); - - if ( iText ) - { - iText->ResetAndDestroy(); - delete iText; - iText = NULL; - } - - delete iBitmap; - delete iBitmapMask; - - TRACES("CTouchScreenCalibView::~CTouchScreenCalibView() end"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::ComponentControl(TInt aIndex) -// --------------------------------------------------------------------------- -CCoeControl* CTouchScreenCalibView::ComponentControl(TInt aIndex) const - { - switch ( aIndex ) - { - case 0: - { - return iAnim; - } - default: - { - return NULL; - } - } - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::CountComponentControls() -// --------------------------------------------------------------------------- -TInt CTouchScreenCalibView::CountComponentControls() const - { - return iAnim ? 1 : 0; // return nbr of controls inside this container - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::Draw(const TRect& aRect) const -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::Draw(const TRect& ) const - { - TRACES("CTouchScreenCalibView::Draw()"); - DrawBackground(); - if (!iCalibrationCompleted) - { - DrawText(); - ShowImage(iAnimImageRect.iAnimImageRect1); - ShowImage(iAnimImageRect.iAnimImageRect2); - ShowImage(iAnimImageRect.iAnimImageRect3); - ShowImage(iAnimImageRect.iAnimImageRect4); - } - TRACES("CTouchScreenCalibView::Draw(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::SizeChanged() -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::SizeChanged() - { - if( iAnim ) - { - iAnim->SetRect(Rect()); - } - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::EndAnimation() -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::EndAnimation() - { - TRACES("CTouchScreenCalibView::EndAnimation()"); - iAnim->CancelAnimation(); - TRACES("CTouchScreenCalibView::EndAnimation(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::HandleControlEventL(...) -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::HandleControlEventL( - CCoeControl* , - TCoeEvent ) - { - //pure virtual from MCoeControlObserver - TRACES("CTouchScreenCalibView::HandleControlEventL()"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::OfferKeyEventL(...) -// --------------------------------------------------------------------------- -TKeyResponse CTouchScreenCalibView::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType) - { - TRACES("CTouchScreenCalibView::OfferKeyEventL()"); - iTouchScreenCalibAppUi->HandleKeyL( aKeyEvent, aType ); - TRACES("CTouchScreenCalibView::OfferKeyEventL(): End: return EKeyWasConsumed"); - return EKeyWasConsumed; - } - -// ---------------------------------------------------- -// CTouchScreenCalibView::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) -// ---------------------------------------------------- -TKeyResponse CTouchScreenCalibView::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TRACES("CTouchScreenCalibView::HandleKeyEventL()"); - iTouchScreenCalibAppUi->HandleKeyL( aKeyEvent, aType ); - TRACES("CTouchScreenCalibView::HandleKeyEventL(): End: return EKeyWasConsumed"); - return EKeyWasConsumed; - } - -// ---------------------------------------------------- -// CTouchScreenCalibView::HandlePointerEventL(const TPointerEvent& aPointerEvent) -// ---------------------------------------------------- -void CTouchScreenCalibView::HandlePointerEventL(const TPointerEvent& aPointerEvent) - { - TRACES("CTouchScreenCalibView::HandlePointerEventL()"); - if (aPointerEvent.iType == TPointerEvent::EButton1Up) - { - TRACES("CTouchScreenCalibView::HandlePointerEventL(): EButton1Up"); - TRACES1("CTouchScreenCalibView::HandlePointerEventL(): X = %d",aPointerEvent.iPosition.iX); - TRACES1("CTouchScreenCalibView::HandlePointerEventL(): Y = %d",aPointerEvent.iPosition.iY); - - TPoint pos; - - pos.iX = aPointerEvent.iPosition.iX; - pos.iY = aPointerEvent.iPosition.iY; - if (Validate(pos)) - { - iTouchFeedback->InstantFeedback( ETouchFeedbackBasic ); - iTouchScreenCalibAppUi->HandlePointerL( pos ); - } - } - TRACES("CTouchScreenCalibView::HandlePointerEventL(): End --------------- Waiting for next event -------------"); - } - -// ---------------------------------------------------- -// CTouchScreenCalibView::Validate(TPoint aPos) -// ---------------------------------------------------- -TBool CTouchScreenCalibView::Validate(TPoint aPos) - { - TRACES("CTouchScreenCalibView::Validate()"); - TInt retval( EFalse ); - - if ((aPos.iX > iTouchScreenCalibAppUi->GetAnimImageRect().iTl.iX) && - (aPos.iX < iTouchScreenCalibAppUi->GetAnimImageRect().iBr.iX) && - (aPos.iY > iTouchScreenCalibAppUi->GetAnimImageRect().iTl.iY) && - (aPos.iY < iTouchScreenCalibAppUi->GetAnimImageRect().iBr.iY)) - { - retval = ETrue; - } - TRACES1("CTouchScreenCalibView::Validate(): End: Return %d",retval); - return retval; - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::DrawBackground() const -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::DrawBackground() const - { - TRACES("CTouchScreenCalibView::DrawBackground()"); - CWindowGc& gc = SystemGc(); - TRect rect = iAvkonAppUi->ApplicationRect(); - gc.SetPenStyle(CGraphicsContext::ENullPen); - gc.SetBrushColor(KRgbWhite); - gc.SetBrushStyle(CGraphicsContext::ESolidBrush); - gc.DrawRect(rect); - ControlEnv()->WsSession().Flush(); // force draw of the context - TRACES("CTouchScreenCalibView::DrawBackground(): End"); - } - -// --------------------------------------------------------------------------- -// CTouchScreenCalibView::DrawText() -// --------------------------------------------------------------------------- -void CTouchScreenCalibView::DrawText() const - { - TRACES("CTouchScreenCalibView::DrawText()"); - - CWindowGc& gc = SystemGc(); - - gc.SetPenStyle(CGraphicsContext::ENullPen); - - gc.UseFont( iFont ); - - gc.SetBrushStyle(CGraphicsContext::ENullBrush); - - TPoint position( 0, 0 ); - TPoint topLeft; - position = iTextTopLeft; - - for ( TInt index = 0 ; - index < iText->Count(); - index++, position.iY += iTextBaselineOffset ) - { - HBufC* text = (*iText)[ index ]; - if ( text ) - { - topLeft = TPoint( position.iX, position.iY - iTextBaselineOffset ); - gc.SetPenColor(iTextColor); - TRACES2("CTouchScreenCalibView::DrawText(): TopLeft: %d, %d", topLeft.iX, topLeft.iY); - gc.DrawText( *text, - TRect( topLeft, iTextSize ), - iTextBaselineOffset, - iTextAlignment ); - } - } - ControlEnv()->WsSession().Flush(); // force draw of the context - gc.DiscardFont(); - TRACES("CTouchScreenCalibView::DrawText(): End"); - } - -// ----------------------------------------------------------------------------- -// CTouchScreenCalibView::SetTextL(TAknLayoutText aTextLayout) -// ----------------------------------------------------------------------------- -void CTouchScreenCalibView::SetTextL(TAknLayoutText aTextLayout) - { - TRACES("CTouchScreenCalibView::SetTextL()"); - - TInt textLineWidth; - - TRACES2("CTouchScreenCalibView::SetTextL(): Text rect top: X:%d Y:%d",aTextLayout.TextRect().iTl.iX, aTextLayout.TextRect().iTl.iY); - TRACES2("CTouchScreenCalibView::SetTextL(): Text rect:bot: X:%d Y:%d",aTextLayout.TextRect().iBr.iX, aTextLayout.TextRect().iBr.iY); - - textLineWidth = aTextLayout.TextRect().Width(); - - iTextTopLeft = TPoint(aTextLayout.TextRect().iTl.iX, aTextLayout.TextRect().iTl.iY); - - iTextBaselineOffset = iFont->HeightInPixels() * 4 / 3; - - iTextSize = TSize(textLineWidth, iTextBaselineOffset + iFont->DescentInPixels()); - - iTextColor = aTextLayout.Color(); - - iTextAlignment = CGraphicsContext::ECenter; - - HBufC* mainText1 = StringLoader::LoadLC(R_QTN_TOUCH_SCREEN_CALI_INSTR_GEN, - iTouchScreenCalibAppUi->GetCalibrationStep()); - - HBufC* mainText2; - if (iTouchScreenCalibAppUi->FirstBoot()) - { - mainText2 = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_INSTR_RES ); - } - else - { - mainText2 = CEikonEnv::Static()->AllocReadResourceLC(R_QTN_TOUCH_SCREEN_CALI_INSTR_CAN ); - } - - TBuf<256> text; - text.Copy( mainText1->Des() ); - _LIT(KLineChange, "\n"); - text.Append(KLineChange); - text.Append(mainText2->Des()); - - TRACES1("CTouchScreenCalibView::SetTextL(): text: %S",&text); - - CArrayFix* wrappedArray = - new( ELeave ) CArrayFixFlat( 10 ); - CleanupStack::PushL( wrappedArray ); - - HBufC* dataToDestroy = - AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( - text, textLineWidth, *iFont, *wrappedArray - ); - - TInt numLines( wrappedArray->Count() ); - TRACES1("CTouchScreenCalibView::SetTextL(): Number of lines: %d",numLines ); - - if ( iText ) - { - iText->ResetAndDestroy(); - delete iText; - iText = NULL; - } - iText = new( ELeave ) CArrayPtrFlat( 20 ); - - for ( TInt i = 0 ; i < numLines ; i++ ) - { - HBufC* line = (*wrappedArray)[i].AllocLC(); - TInt lineLength = line->Length(); - TRACES1("CTouchScreenCalibView::SetTextL(): lineLength: %d",lineLength); - if(!lineLength) - { - iText->AppendL( NULL ); - CleanupStack::PopAndDestroy(line); // line - } - else - { - iText->AppendL( line ); - CleanupStack::Pop(line); // line - } - } - iText->AppendL( NULL ); - - // If the last char was newline, add one extra, since - // wrapping automatically removes it. - if ( text[ text.Length() - 1 ] == '\n' ) - { - iText->AppendL( NULL ); - } - - CleanupStack::PopAndDestroy(wrappedArray); // wrappedArray - delete dataToDestroy; - - CleanupStack::PopAndDestroy(2); //mainText1, mainText2 - TRACES("CTouchScreenCalibView::SetTextL(); End"); - } - -// ----------------------------------------------------------------------------- -// CTouchScreenCalibView::ShowImage(TRect aRect) -// ----------------------------------------------------------------------------- -void CTouchScreenCalibView::ShowImage(TRect aRect) const - { - TRACES("CTouchScreenCalibView::ShowImage()"); - CWindowGc& gc = SystemGc(); - AknIconUtils::SetSize( iBitmap, aRect.Size(), EAspectRatioPreservedAndUnusedSpaceRemoved ); - gc.SetPenStyle(CGraphicsContext::ENullPen); - gc.SetBrushColor(KRgbRed); - gc.SetBrushStyle(CGraphicsContext::ESolidBrush); - gc.DrawRect(aRect); - gc.BitBlt( TPoint(aRect.iTl.iX, aRect.iTl.iY), iBitmap ); // CWindowGc member function - ControlEnv()->WsSession().Flush(); // force draw of the context - TRACES("CTouchScreenCalibView::ShowImage(): End"); - } - -// ----------------------------------------------------------------------------- -// CTouchScreenCalibView::SetWinPriority() -// ----------------------------------------------------------------------------- -void CTouchScreenCalibView::SetWinPriority(TInt aPriority) - { - TRACES("CTouchScreenCalibView::SetWinPriority()"); - Window().SetOrdinalPosition( 0, aPriority ); - TRACES("CTouchScreenCalibView::SetWinPriority(): End"); - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/bwins/tsccustcmdsu.def --- a/systemswuis/touchscreencalib/tsccustcmds/bwins/tsccustcmdsu.def Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CmdTSCStartupExtensionNewL@TSCCustCmdFactory@@SAPAVMSsmCustomCommand@@XZ @ 1 NONAME ; class MSsmCustomCommand * TSCCustCmdFactory::CmdTSCStartupExtensionNewL(void) - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/eabi/tsccustcmdsu.def --- a/systemswuis/touchscreencalib/tsccustcmds/eabi/tsccustcmdsu.def Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _ZN17TSCCustCmdFactory26CmdTSCStartupExtensionNewLEv @ 1 NONAME - _ZTI14CTSCSubscriber @ 2 NONAME ; ## - _ZTI18CTSCPubSubObserver @ 3 NONAME ; ## - _ZTV14CTSCSubscriber @ 4 NONAME ; ## - _ZTV18CTSCPubSubObserver @ 5 NONAME ; ## - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/group/tsccustcmds.mmp --- a/systemswuis/touchscreencalib/tsccustcmds/group/tsccustcmds.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2007 - 2008 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: Project definition file for project TSCCustCmd -* -*/ - -#include - -TARGET tsccustcmds.dll -TARGETTYPE DLL -UID 0x1000008D 0x10283123 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE tscstartupextension.cpp -SOURCE tsccustcmdfactory.cpp -SOURCE tscsubscriber.cpp -SOURCE tscpubsubobserver.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/inc/MTSCPropertyResponder.h --- a/systemswuis/touchscreencalib/tsccustcmds/inc/MTSCPropertyResponder.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2007 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: Interface of Touch screen calibration property change obsever -* -*/ - -#ifndef MTSCPROPERTYRESPONDER_H -#define MTSCPROPERTYRESPONDER_H - -// INCLUDES -#include - -class MTSCPropertyResponder - { -public: - virtual void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) = 0; - }; -#endif //MTSCPROPERTYRESPONDER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/inc/TSCPubSubObserver.h --- a/systemswuis/touchscreencalib/tsccustcmds/inc/TSCPubSubObserver.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2007 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: -* This class the handles the received indications from the Public and -* Subscribe. -* -*/ - -#ifndef TSCPUBSUBOBSERVER_H -#define TSCPUBSUBOBSERVER_H - -// INCLUDES -#include -#include "MTSCPropertyResponder.h" -#include "tscstartupextension.h" - - - -// CLASS DECLARATION -class CTSCStartupExtension; -class CTSCSubscriber; - -class CTSCPubSubObserver : public CBase, public MTSCPropertyResponder - { - public: // Constructors and destructor - - /** - * C++ constructor. - */ - CTSCPubSubObserver( CTSCStartupExtension* aTSCStartupExtension ); - - /** - * Two-phased constructor. - */ - static CTSCPubSubObserver* NewL( CTSCStartupExtension* aTSCStartupExtension ); - - /** - * Destructor. - */ - ~CTSCPubSubObserver(); - - private: - - /** - * By default EPOC constructor is private. - */ - void ConstructL(); - - CTSCPubSubObserver(); - - protected: // From MTSCPropertyResponder - - void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ); - - private: // Data - //reference to application class - CTSCStartupExtension * iTSCStartupExtension; //uses - - RProperty iProperty; - CTSCSubscriber* iTSCSyncSubscriber; - }; - -#endif // TSCPUBSUBOBSERVER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/inc/tsccustcmdfactory.h --- a/systemswuis/touchscreencalib/tsccustcmds/inc/tsccustcmdfactory.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2007 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: Custom command implementation factory. -* -*/ - -#ifndef TSCCUSTCMDFACTORY_H -#define TSCCUSTCMDFACTORY_H - -#include - -class MSsmCustomCommand; - -/** -* Creates custom command objects. -*/ -class TSCCustCmdFactory - { -public: - - IMPORT_C static MSsmCustomCommand* CmdTSCStartupExtensionNewL(); - }; - -#endif // TSCCUSTCMDFACTORY_H diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextension.h --- a/systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextension.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2006 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: Declaration of CTSCStartupExtension class. -* -*/ - -#ifndef TSCSTARTUPEXTENSION_H -#define TSCSTARTUPEXTENSION_H - -#include -#include - -// FORWARD DECLARATIONS -class CTSCPubSubObserver; - -/** -*/ -NONSHARABLE_CLASS( CTSCStartupExtension ) - : public CBase, - public MSsmCustomCommand - { -public: - - static CTSCStartupExtension * NewL(); - virtual ~CTSCStartupExtension (); - - void CalibrationDone(); - -private: // From MSsmCustomCommand - - TInt Initialize( CSsmCustomCommandEnv* aCmdEnv ); - void Execute( const TDesC8& aParams, TRequestStatus& aStatus ); - void ExecuteCancel(); - void Release(); - void Close(); - -private: - - /** - * First phase constructor. - */ - CTSCStartupExtension (); - -private: //data - - CTSCPubSubObserver* iTSCPubSubObserver; //owns - - TRequestStatus* iStatus; - TBool iRequestSent; - - }; - -#endif // TSCSTARTUPEXTENSION_H diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextensiondef.h --- a/systemswuis/touchscreencalib/tsccustcmds/inc/tscstartupextensiondef.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2007 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: Includes some common defines used in the TSCStartupExtension -* -*/ - -#ifndef TSCSTARTUPEXTENSIONDEF_H -#define TSCSTARTUPEXTENSIONDEF_H - -#include - -//CONSTANTS -_LIT( KTouchScreenCalibAppName, "TSCStartupExtension" ); - -// MACROS - -#define PANIC(aPanic) User::Panic( KTouchScreenCalibAppName, aPanic ) - -#define TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"TSCStartupExtension: \"" L##aText L"\"")) - -#ifdef _DEBUG -#define TRACES(aMsg) RDebug::Print( TRACE_ADDPREFIX(aMsg) ) -#define TRACES1(aFormat,aP1) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1) ) -#define TRACES2(aFormat,aP1,aP2) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) -#define TRACES3(aFormat,aP1,aP2,aP3) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) -#else -#define TRACES(aMsg) -#define TRACES1(aFormat,aP1) -#define TRACES2(aFormat,aP1,aP2) -#define TRACES3(aFormat,aP1,aP2,aP3) -#endif -#endif // TSCSTARTUPEXTENSIONDEF_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/inc/tscsubscriber.h --- a/systemswuis/touchscreencalib/tsccustcmds/inc/tscsubscriber.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2007 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: TSC Subscriber (Publish & Subscribe). -* -*/ - -#ifndef TSCPLUGINSUBSCRIBER_H -#define TSCPLUGINSUBSCRIBER_H - -// INCLUDES -#include -#include -#include "MTSCPropertyResponder.h" - -// CLASS DECLARATION -/** -* CTSCSubscriber -* -* @lib tscstartupextensionplugin -* @since 3.2 -*/ - -class CTSCSubscriber : public CActive -{ -public: - /** - * Two-phased constructor. - */ - static CTSCSubscriber* NewL( MTSCPropertyResponder& aTSCPropertyResponder, - const TUid& aCategory, - TUint aKey ); - - /** - * Destructor. - */ - ~CTSCSubscriber(); - - void Subscribe(); - -private: - CTSCSubscriber( MTSCPropertyResponder& aTSCPropertyResponder, - const TUid& aCategory, TUint - aKey ); - void ConstructL(); - -public: // from CActive - /** - * @param none - * @return none - */ - void RunL(); - - /** - * @param aError the error returned - * @return error - */ - TInt RunError( TInt aError ); - - /** - * @param none - * @return none - */ - void DoCancel(); - -private: // Methods not implemented - CTSCSubscriber( const CTSCSubscriber& ); // Copy constructor - CTSCSubscriber& operator=( const CTSCSubscriber& );// Assigment operator - -private: - - MTSCPropertyResponder& iTSCPropertyResponder; - RProperty iProperty; - TUid iCategory; - TUint iKey; -}; - - -#endif // TSCSUBSCRIBER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/src/tsccustcmdfactory.cpp --- a/systemswuis/touchscreencalib/tsccustcmds/src/tsccustcmdfactory.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2007 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: Custom command implementation factory. -* -*/ - -#include "tsccustcmdfactory.h" -#include "tscstartupextension.h" - -// ======== MEMBER FUNCTIONS ======== - -EXPORT_C MSsmCustomCommand* TSCCustCmdFactory::CmdTSCStartupExtensionNewL() - { - return CTSCStartupExtension::NewL(); - } diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/src/tscpubsubobserver.cpp --- a/systemswuis/touchscreencalib/tsccustcmds/src/tscpubsubobserver.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2007 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: -* This class the handles the received indications from the Public and -* Subscribe. -* -*/ - -// SYSTEM INCLUDES -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION -#include -#include -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION -#include -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - -// USER INCLUDES -#include "TSCPubSubObserver.h" -#include "tscsubscriber.h" -#include "tscstartupextensiondef.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ---------------------------------------------------- -// CTSCPubSubObserver::CTSCPubSubObserver( CTSCStartupExtension* aTSCStartupExtension ) -// C++ default constructor can NOT contain any code, that -// might leave. -// ---------------------------------------------------- -CTSCPubSubObserver::CTSCPubSubObserver( CTSCStartupExtension* aTSCStartupExtension ) : - iTSCStartupExtension( aTSCStartupExtension ) - { - } - -// ---------------------------------------------------- -// CTSCPubSubObserver::ConstructL() -// ---------------------------------------------------- -void CTSCPubSubObserver::ConstructL() - { - TRACES("CTSCPubSubObserver::ConstructL()"); - - iTSCSyncSubscriber = CTSCSubscriber::NewL( *this, -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSUidTouchScreenCalibration, -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSUidStartup, -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSTouchScreenCalibration ); - iTSCSyncSubscriber->Subscribe(); - - TInt touchScreenCalibrationState; -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, touchScreenCalibrationState ); -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, touchScreenCalibrationState ); -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - if ( touchScreenCalibrationState == ETouchScreenCalibrationOk ) - { - iTSCStartupExtension->CalibrationDone(); - } - - TRACES("CTSCPubSubObserver::ConstructL(): End"); - } - -// ---------------------------------------------------------------------------- -// CTSCPubSubObserver::HandlePropertyChangedL() -// ---------------------------------------------------------------------------- -void CTSCPubSubObserver::HandlePropertyChangedL( const TUid& /*aCategory*/, TUint aKey ) - { - TRACES("CTSCPubSubObserver::HandlePropertyChangedL()"); - TRACES1("CTSCPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey ); - - if (aKey == KPSTouchScreenCalibration) - { - TInt state; - -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, state ); -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, state ); -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - - if ( state == ETouchScreenCalibrationOk ) - { - iTSCStartupExtension->CalibrationDone(); - } - } - - TRACES("CTSCPubSubObserver::HandlePropertyChangedL(): End"); - } - -// ---------------------------------------------------- -// CTSCPubSubObserver::NewL( CTSCStartupExtension* aTSCStartupExtension ) -// ---------------------------------------------------- -CTSCPubSubObserver* CTSCPubSubObserver::NewL( CTSCStartupExtension* aTSCStartupExtension ) - { - TRACES("CTSCPubSubObserver::NewL()"); - CTSCPubSubObserver* self = new (ELeave) CTSCPubSubObserver( aTSCStartupExtension ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - - TRACES("CTSCPubSubObserver::NewL(): End"); - return self; - } - -// ---------------------------------------------------- -// CTSCPubSubObserver::~CTSCPubSubObserver() -// ---------------------------------------------------- -CTSCPubSubObserver::~CTSCPubSubObserver() - { - TRACES("CTSCPubSubObserver::~CTSCPubSubObserver()"); - - delete iTSCSyncSubscriber; - iProperty.Close(); - - TRACES("CTSCPubSubObserver::~CTSCPubSubObserver(): End"); - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/src/tscstartupextension.cpp --- a/systemswuis/touchscreencalib/tsccustcmds/src/tscstartupextension.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* Copyright (c) 2006 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: Declaration of CTSCStartupExtension class. -* -*/ - -#include "tscstartupextension.h" -#include "tscstartupextensiondef.h" -#include "TSCPubSubObserver.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CDiskSpaceReserve::NewL -// -// --------------------------------------------------------------------------- -// -CTSCStartupExtension * CTSCStartupExtension ::NewL() - { - TRACES("CTSCStartupExtension :: NewL ()"); - CTSCStartupExtension * self = new ( ELeave ) CTSCStartupExtension ; - - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// -// --------------------------------------------------------------------------- -// -CTSCStartupExtension::~CTSCStartupExtension () - { - TRACES("CTSCStartupExtension ::~CTSCStartupExtension ()"); - - TRACES("CTSCStartupExtension ::~CTSCStartupExtension () End"); - } - - - -// --------------------------------------------------------------------------- -// First phase constructor -// -// --------------------------------------------------------------------------- -// -CTSCStartupExtension::CTSCStartupExtension() - :iRequestSent(EFalse) - { - } - -// --------------------------------------------------------------------------- -// CTSCStartupExtension::Initialize -// -// --------------------------------------------------------------------------- -// -TInt CTSCStartupExtension::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ ) - { - TRACES("CTSCStartupExtension::Initialize()"); - iTSCPubSubObserver = CTSCPubSubObserver::NewL( this ); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CTSCStartupExtension::Execute -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtension::Execute( - const TDesC8& /*aParams*/, - TRequestStatus& aStatus ) - { - TRACES("CTSCStartupExtension::ExecuteL()"); - aStatus = KRequestPending; - iStatus = &aStatus; - TRACES("CTSCStartupExtension::ExecuteL(): End"); - } - - -// --------------------------------------------------------------------------- -// CTSCStartupExtension::ExecuteCancel -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtension::ExecuteCancel() - { - // Nothing to do. - } - - -// --------------------------------------------------------------------------- -// CTSCStartupExtension::Release -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtension::Release() - { - delete this; - } - - -// --------------------------------------------------------------------------- -// CTSCStartupExtension::Close -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtension::Close() - { - TRACES("CTSCStartupExtension :: Close()"); - if (iTSCPubSubObserver) - { - delete iTSCPubSubObserver; - iTSCPubSubObserver = NULL; - } - TRACES("CTSCStartupExtension :: Close() End"); - } - -// --------------------------------------------------------------------------- -// CTSCStartupExtension::CalibrationDone -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtension::CalibrationDone() - { - TRACES("CTSCStartupExtension::CalibrationDone()"); - if (!iRequestSent) - { - TRACES("CTSCStartupExtension::CalibrationDone(): Send complete request"); - TInt errorCode = KErrNone; - User::RequestComplete( iStatus, errorCode ); - iRequestSent = ETrue; - } - TRACES("CTSCStartupExtension::CalibrationDone(): End"); - } - - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tsccustcmds/src/tscsubscriber.cpp --- a/systemswuis/touchscreencalib/tsccustcmds/src/tscsubscriber.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2007 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: TSC Subscriber (Publish & Subscribe). -* -*/ - -// INCLUDES -#include -#include "tscstartupextension.h" -#include "tscsubscriber.h" -#include "tscstartupextensiondef.h" - -// CONSTANTS - -// ============================= MEMBER FUNCTIONS ============================= - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::NewL() -// ---------------------------------------------------------------------------- -CTSCSubscriber* CTSCSubscriber::NewL( - MTSCPropertyResponder& aTSCPropertyResponder, - const TUid& aCategory, - TUint aKey ) - { - CTSCSubscriber* self = new (ELeave) CTSCSubscriber( aTSCPropertyResponder, - aCategory, - aKey ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); //self - return self; - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::ConstructL() -// ---------------------------------------------------------------------------- -void CTSCSubscriber::ConstructL() - { - CActiveScheduler::Add( this ); - iProperty.Attach( iCategory, iKey ); - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::Subscribe() -// ---------------------------------------------------------------------------- -void CTSCSubscriber::Subscribe() - { - TRACES("CTSCSubscriber::Subscribe()"); - iProperty.Subscribe( iStatus ); - SetActive(); - TRACES("CTSCSubscriber::Subscribe(): End"); - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::CTSCSubscriber() -// ---------------------------------------------------------------------------- -CTSCSubscriber::CTSCSubscriber( MTSCPropertyResponder& aTSCPropertyResponder, - const TUid& aCategory, - TUint aKey ) : - CActive( EPriorityStandard ), - iTSCPropertyResponder( aTSCPropertyResponder ), - iCategory( aCategory), - iKey( aKey ) - { - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::RunL() -// ---------------------------------------------------------------------------- -void CTSCSubscriber::RunL() - { - TRACES("CTSCSubscriber::RunL()"); - Subscribe(); - iTSCPropertyResponder.HandlePropertyChangedL( iCategory, iKey ); - TRACES("CTSCSubscriber::RunL(): End"); - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::DoCancel() -// ---------------------------------------------------------------------------- -void CTSCSubscriber::DoCancel() - { - iProperty.Cancel(); - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::RunError() -// ---------------------------------------------------------------------------- -TInt CTSCSubscriber::RunError( TInt aError ) - { - return aError; - } - -// ---------------------------------------------------------------------------- -// CTSCSubscriber::~CTSCSubscriber() -// ---------------------------------------------------------------------------- -CTSCSubscriber::~CTSCSubscriber() - { - TRACES("CTSCSubscriber::~CTSCSubscriber()"); - Cancel(); - iProperty.Close(); - TRACES("CTSCSubscriber::~CTSCSubscriber(): End"); - } - -// End of File - - - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/data/10283123.rss --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/data/10283123.rss Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2007 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: Registry info resource file for TSCStartupExtensionPlugIn -* ECOM plugin. -* -*/ - - - -// INCLUDES -#include "registryinfov2.rh" - -// RESOURCE DEFINITIONS -// --------------------------------------------------------- -// -// tscstartupextensionplugin_registry_info -// Registry info resource. -// -// --------------------------------------------------------- -// -RESOURCE REGISTRY_INFO tscstartupextensionplugin_registry_info - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = 0x10283123; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10205067; // UID of System startup extension plug-in API - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10283124; - version_no = 1; - display_name = "TSCStartupExtensionPlugIn"; - default_data = ""; - opaque_data = ""; - rom_only = 1; - } - }; - } - }; - } - - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/group/tscstartupextensionplugin.mmp --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/group/tscstartupextensionplugin.mmp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2007 - 2008 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: Project definition file for project TSCStartupExtensionPlugIn -* -*/ - - -#include -#include - -TARGET tscstartupextensionplugin.dll -CAPABILITY CAP_ECOM_PLUGIN -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10283123 -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE tscstartupextensionplugin.cpp -SOURCE implementationfactory.cpp -SOURCE tscpluginsubscriber.cpp -SOURCE tscpluginpubsubobserver.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -SYSTEMINCLUDE /epoc32/include/ecom - - -START RESOURCE ../data/10283123.rss -TARGET tscstartupextensionplugin.rsc -END - - -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY ecom.lib diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/inc/MTSCPlugInPropertyResponder.h --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/MTSCPlugInPropertyResponder.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2007 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: Interface of Touch screen calibration property change obsever -* -*/ - - -#ifndef MTSCPLUGINPROPERTYRESPONDER_H -#define MTSCPLUGINPROPERTYRESPONDER_H - -// INCLUDES -#include - -class MTSCPlugInPropertyResponder - { -public: - virtual void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ) = 0; - }; -#endif //MTSCPLUGINPROPERTYRESPONDER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/inc/TSCPlugInPubSubObserver.h --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/TSCPlugInPubSubObserver.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2007 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: -* This class the handles the received indications from the Public and -* Subscribe. -* -*/ - - -#ifndef TSCPLUGINPUBSUBOBSERVER_H -#define TSCPLUGINPUBSUBOBSERVER_H - -// INCLUDES -#include -#include "MTSCPlugInPropertyResponder.h" -#include "tscstartupextensionplugin.h" - - - -// CLASS DECLARATION -class CTSCStartupExtensionPlugIn; -class CTSCPlugInSubscriber; - -class CTSCPlugInPubSubObserver : public CBase, public MTSCPlugInPropertyResponder - { - public: // Constructors and destructor - - /** - * C++ constructor. - */ - CTSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ); - - /** - * Two-phased constructor. - */ - static CTSCPlugInPubSubObserver* NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ); - - /** - * Destructor. - */ - ~CTSCPlugInPubSubObserver(); - - private: - - /** - * By default EPOC constructor is private. - */ - void ConstructL(); - - CTSCPlugInPubSubObserver(); - - protected: // From MTSCPlugInPropertyResponder - - void HandlePropertyChangedL( const TUid& aCategory, TUint aKey ); - - private: // Data - //reference to application class - CTSCStartupExtensionPlugIn* iTSCStartupExtensionPlugIn; //uses - - RProperty iProperty; - CTSCPlugInSubscriber* iTSCSyncSubscriber; - }; - -#endif // TSCPLUGINPUBSUBOBSERVER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscpluginsubscriber.h --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscpluginsubscriber.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2007 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: TSC Subscriber (Publish & Subscribe). -* -*/ - - -#ifndef TSCPLUGINSUBSCRIBER_H -#define TSCPLUGINSUBSCRIBER_H - -// INCLUDES -#include -#include -#include "MTSCPlugInPropertyResponder.h" - -// CLASS DECLARATION -/** -* CTSCPlugInSubscriber -* -* @lib tscstartupextensionplugin -* @since 3.2 -*/ - -class CTSCPlugInSubscriber : public CActive -{ -public: - /** - * Two-phased constructor. - */ - static CTSCPlugInSubscriber* NewL( MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, - const TUid& aCategory, - TUint aKey ); - - /** - * Destructor. - */ - ~CTSCPlugInSubscriber(); - - void Subscribe(); - -private: - CTSCPlugInSubscriber( MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, - const TUid& aCategory, TUint - aKey ); - void ConstructL(); - -public: // from CActive - /** - * @param none - * @return none - */ - void RunL(); - - /** - * @param aError the error returned - * @return error - */ - TInt RunError( TInt aError ); - - /** - * @param none - * @return none - */ - void DoCancel(); - -private: // Methods not implemented - CTSCPlugInSubscriber( const CTSCPlugInSubscriber& ); // Copy constructor - CTSCPlugInSubscriber& operator=( const CTSCPlugInSubscriber& );// Assigment operator - -private: - - MTSCPlugInPropertyResponder& iTSCPlugInPropertyResponder; - RProperty iProperty; - TUid iCategory; - TUint iKey; -}; - - -#endif // TSCPLUGINSUBSCRIBER_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugin.h --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugin.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2006 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: Declaration of CTSCStartupExtensionPlugIn class. -* -*/ - - -#ifndef TSCSTARTUPEXTENSIONPLUGIN_H -#define TSCSTARTUPEXTENSIONPLUGIN_H - -#include - -// FORWARD DECLARATIONS -class CTSCPlugInPubSubObserver; - -/** - * System Startup Extension plug-in for executing Touch Screen Calibration - * during system startup. - * - * @lib tscstartupextensionplugin.lib - * @since S60 3.2 - */ -NONSHARABLE_CLASS( CTSCStartupExtensionPlugIn ) - : public CSystemStartupExtension - { - -public: - - static CTSCStartupExtensionPlugIn* NewL( TAny* aConstructionParameters ); - - virtual ~CTSCStartupExtensionPlugIn(); - - /** - * Execute TSC operations depending on parameters. - * - * @since S60 3.2 - * @param aStatus The request status to complete after the task has been - * finished. - */ - virtual void ExecuteL( TRequestStatus& aStatus, const TDesC& aParams ); - - /** - * Cancel pending request. - * - * @since S60 3.2 - */ - virtual void Cancel(); - - /** - * - * @since S60 3.2 - * @param none - */ - void CalibrationDone(); - -private: - - CTSCStartupExtensionPlugIn( TAny* aConstructionParameters ); - - /** - * Second phase constructor. - * - */ - void ConstructL(); - -private: //data - - CTSCPlugInPubSubObserver* iTSCPlugInPubSubObserver; //owns - - TRequestStatus* iStatus; - TBool iRequestSent; - }; - -#endif // TSCSTARTUPEXTENSIONPLUGIN_H diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugindef.h --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/inc/tscstartupextensionplugindef.h Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007 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: Includes some common defines used in the TSCStartupExtensionPlugIn -* -*/ - - -#ifndef TSCSTARTUPEXTENSIONPLUGINDEF_H -#define TSCSTARTUPEXTENSIONPLUGINDEF_H - -#include - -//CONSTANTS -_LIT( KTouchScreenCalibAppName, "TSCStartupExtensionPlugIn" ); - -// MACROS - -#define PANIC(aPanic) User::Panic( KTouchScreenCalibAppName, aPanic ) - -#define TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"TSCStartupExtensionPlugIn: \"" L##aText L"\"")) - -#ifdef _DEBUG -#define TRACES(aMsg) RDebug::Print( TRACE_ADDPREFIX(aMsg) ) -#define TRACES1(aFormat,aP1) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1) ) -#define TRACES2(aFormat,aP1,aP2) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) -#define TRACES3(aFormat,aP1,aP2,aP3) RDebug::Print( TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) -#else -#define TRACES(aMsg) -#define TRACES1(aFormat,aP1) -#define TRACES2(aFormat,aP1,aP2) -#define TRACES3(aFormat,aP1,aP2,aP3) -#endif -#endif // TSCSTARTUPEXTENSIONPLUGINDEF_H - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/src/implementationfactory.cpp --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/src/implementationfactory.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2007 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: TSCStartupExtensionPlugIn ECOM implementation factory. -* -*/ - - -#include "tscstartupextensionplugin.h" - -#include - -// Define the interface UIDs. -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10283124, CTSCStartupExtensionPlugIn::NewL ) - }; - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ImplementationGroupProxy. -// -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); - return ImplementationTable; - } - - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginpubsubobserver.cpp --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginpubsubobserver.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2007 - 2008 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: -* This class the handles the received indications from the Public and -* Subscribe. -* -*/ - - -// SYSTEM INCLUDES -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION -#include -#include -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION -#include -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - -// USER INCLUDES -#include "TSCPlugInPubSubObserver.h" -#include "tscpluginsubscriber.h" -#include "tscstartupextensionplugindef.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ---------------------------------------------------- -// TSCPlugInPubSubObserver::TSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) -// C++ default constructor can NOT contain any code, that -// might leave. -// ---------------------------------------------------- -CTSCPlugInPubSubObserver::CTSCPlugInPubSubObserver( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) : - iTSCStartupExtensionPlugIn( aTSCStartupExtensionPlugIn ) - { - } - -// ---------------------------------------------------- -// CTSCPlugInPubSubObserver::ConstructL() -// ---------------------------------------------------- -void CTSCPlugInPubSubObserver::ConstructL() - { - TRACES("CTSCPlugInPubSubObserver::ConstructL()"); - - iTSCSyncSubscriber = CTSCPlugInSubscriber::NewL( *this, -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSUidTouchScreenCalibration, -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSUidStartup, -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - KPSTouchScreenCalibration ); - iTSCSyncSubscriber->Subscribe(); - - TInt touchScreenCalibrationState; -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, touchScreenCalibrationState ); -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, touchScreenCalibrationState ); -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - if ( touchScreenCalibrationState == ETouchScreenCalibrationOk ) - { - iTSCStartupExtensionPlugIn->CalibrationDone(); - } - - TRACES("CTSCPlugInPubSubObserver::ConstructL(): End"); - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInPubSubObserver::HandlePropertyChangedL() -// ---------------------------------------------------------------------------- -void CTSCPlugInPubSubObserver::HandlePropertyChangedL( const TUid& /*aCategory*/, TUint aKey ) - { - TRACES("CTSCPlugInPubSubObserver::HandlePropertyChangedL()"); - TRACES1("CTSCPlugInPubSubObserver::HandlePropertyChangedL(): aKey: %d",aKey ); - - if (aKey == KPSTouchScreenCalibration) - { - TInt state; - -#ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidTouchScreenCalibration, KPSTouchScreenCalibration, state ); -#else //RD_STARTUP_ANIMATION_CUSTOMIZATION - RProperty::Get( KPSUidStartup, KPSTouchScreenCalibration, state ); -#endif //RD_STARTUP_ANIMATION_CUSTOMIZATION - - if ( state == ETouchScreenCalibrationOk ) - { - iTSCStartupExtensionPlugIn->CalibrationDone(); - } - } - - TRACES("CTSCPlugInPubSubObserver::HandlePropertyChangedL(): End"); - } - -// ---------------------------------------------------- -// CTSCPlugInPubSubObserver::NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) -// ---------------------------------------------------- -CTSCPlugInPubSubObserver* CTSCPlugInPubSubObserver::NewL( CTSCStartupExtensionPlugIn* aTSCStartupExtensionPlugIn ) - { - TRACES("CTSCPlugInPubSubObserver::NewL()"); - CTSCPlugInPubSubObserver* self = new (ELeave) CTSCPlugInPubSubObserver( aTSCStartupExtensionPlugIn ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - - TRACES("CTSCPlugInPubSubObserver::NewL(): End"); - return self; - } - -// ---------------------------------------------------- -// CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver() -// ---------------------------------------------------- -CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver() - { - TRACES("CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver()"); - - delete iTSCSyncSubscriber; - iProperty.Close(); - - TRACES("CTSCPlugInPubSubObserver::~CTSCPlugInPubSubObserver(): End"); - } - -// End of File diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginsubscriber.cpp --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscpluginsubscriber.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2007 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: CTSCPlugInSubscriber implementation. - * -*/ - - -// INCLUDES -#include -#include "tscstartupextensionplugin.h" -#include "tscpluginsubscriber.h" -#include "tscstartupextensionplugindef.h" - -// CONSTANTS - -// ============================= MEMBER FUNCTIONS ============================= - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::NewL() -// ---------------------------------------------------------------------------- -CTSCPlugInSubscriber* CTSCPlugInSubscriber::NewL( - MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, - const TUid& aCategory, - TUint aKey ) - { - CTSCPlugInSubscriber* self = new (ELeave) CTSCPlugInSubscriber( aTSCPlugInPropertyResponder, - aCategory, - aKey ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); //self - return self; - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::ConstructL() -// ---------------------------------------------------------------------------- -void CTSCPlugInSubscriber::ConstructL() - { - CActiveScheduler::Add( this ); - iProperty.Attach( iCategory, iKey ); - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::Subscribe() -// ---------------------------------------------------------------------------- -void CTSCPlugInSubscriber::Subscribe() - { - TRACES("CTSCPlugInSubscriber::Subscribe()"); - iProperty.Subscribe( iStatus ); - SetActive(); - TRACES("CTSCPlugInSubscriber::Subscribe(): End"); - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::CTSCPlugInSubscriber() -// ---------------------------------------------------------------------------- -CTSCPlugInSubscriber::CTSCPlugInSubscriber( MTSCPlugInPropertyResponder& aTSCPlugInPropertyResponder, - const TUid& aCategory, - TUint aKey ) : - CActive( EPriorityStandard ), - iTSCPlugInPropertyResponder( aTSCPlugInPropertyResponder ), - iCategory( aCategory), - iKey( aKey ) - { - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::RunL() -// ---------------------------------------------------------------------------- -void CTSCPlugInSubscriber::RunL() - { - TRACES("CTSCPlugInSubscriber::RunL()"); - Subscribe(); - iTSCPlugInPropertyResponder.HandlePropertyChangedL( iCategory, iKey ); - TRACES("CTSCPlugInSubscriber::RunL(): End"); - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::DoCancel() -// ---------------------------------------------------------------------------- -void CTSCPlugInSubscriber::DoCancel() - { - iProperty.Cancel(); - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::RunError() -// ---------------------------------------------------------------------------- -TInt CTSCPlugInSubscriber::RunError( TInt aError ) - { - return aError; - } - -// ---------------------------------------------------------------------------- -// CTSCPlugInSubscriber::~CTSCPlugInSubscriber() -// ---------------------------------------------------------------------------- -CTSCPlugInSubscriber::~CTSCPlugInSubscriber() - { - TRACES("CTSCPlugInSubscriber::~CTSCPlugInSubscriber()"); - Cancel(); - iProperty.Close(); - TRACES("CTSCPlugInSubscriber::~CTSCPlugInSubscriber(): End"); - } - -// End of File - - - diff -r 3fec62e6e7fc -r 90fe62538f66 systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscstartupextensionplugin.cpp --- a/systemswuis/touchscreencalib/tscstartupextensionplugin/src/tscstartupextensionplugin.cpp Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2007 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: Implementation of CTSCStartupExtensionPlugIn class. -* -*/ - - -#include "tscstartupextensionplugin.h" -#include "tscstartupextensionplugindef.h" -#include "TSCPlugInPubSubObserver.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Constructor -// -// --------------------------------------------------------------------------- -// -CTSCStartupExtensionPlugIn* CTSCStartupExtensionPlugIn::NewL( - TAny* aConstructionParameters ) - { - CTSCStartupExtensionPlugIn* self = - new( ELeave ) CTSCStartupExtensionPlugIn( aConstructionParameters ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// -// --------------------------------------------------------------------------- -// -CTSCStartupExtensionPlugIn::~CTSCStartupExtensionPlugIn() - { - TRACES("CTSCStartupExtensionPlugIn::~CTSCStartupExtensionPlugIn()"); - if (iTSCPlugInPubSubObserver) - { - delete iTSCPlugInPubSubObserver; - } - TRACES("CTSCStartupExtensionPlugIn::~CTSCStartupExtensionPlugIn()"); - } - - -// --------------------------------------------------------------------------- -// First phase constructor -// -// --------------------------------------------------------------------------- -// -CTSCStartupExtensionPlugIn::CTSCStartupExtensionPlugIn( - TAny* aConstructionParameters ) - : CSystemStartupExtension( aConstructionParameters ), - iRequestSent(EFalse) - { - } - - -// --------------------------------------------------------------------------- -// CTSCStartupExtensionPlugIn::ConstructL -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtensionPlugIn::ConstructL() - { - TRACES("CTSCStartupExtensionPlugIn::ConstructL()"); - iTSCPlugInPubSubObserver = CTSCPlugInPubSubObserver::NewL( this ); - TRACES("CTSCStartupExtensionPlugIn::ConstructL(): End"); - } - -// --------------------------------------------------------------------------- -// CTSCStartupExtensionPlugIn::ExecuteL -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtensionPlugIn::ExecuteL( - TRequestStatus& aStatus, - const TDesC& /*aParams*/ ) - { - TRACES("CTSCStartupExtensionPlugIn::ExecuteL()"); - aStatus = KRequestPending; - iStatus = &aStatus; - TRACES("CTSCStartupExtensionPlugIn::ExecuteL(): End"); - } - -// --------------------------------------------------------------------------- -// CTSCStartupExtensionPlugIn::Cancel -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtensionPlugIn::Cancel() - { - // Nothing to do. - } - -// --------------------------------------------------------------------------- -// CTSCStartupExtensionPlugIn::CalibrationDone -// -// --------------------------------------------------------------------------- -// -void CTSCStartupExtensionPlugIn::CalibrationDone() - { - TRACES("CTSCStartupExtensionPlugIn::CalibrationDone()"); - if (!iRequestSent) - { - TRACES("CTSCStartupExtensionPlugIn::CalibrationDone(): Send complete request"); - TInt errorCode = KErrNone; - User::RequestComplete( iStatus, errorCode ); - iRequestSent = ETrue; - } - TRACES("CTSCStartupExtensionPlugIn::CalibrationDone(): End"); - } diff -r 3fec62e6e7fc -r 90fe62538f66 tsrc/group/bld.inf --- a/tsrc/group/bld.inf Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: Build information file -* -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES - -PRJ_TESTMMPFILES -//#include "../../devmngt_plat/settings_backgroundimage_api/tsrc/group/bld.inf" -//#include "../../devmngt_plat/settings_framework_api/tsrc/group/bld.inf" -//#include "../../devmngt_plat/settings_launch_api/tsrc/group/bld.inf" -//#include "../../devmngt_plat/settings_listbox_api/tsrc/group/bld.inf" -//#include "../../devmngt_plat/filelist_api/tsrc/group/bld.inf" -//#include "../../devmngt_plat/profiles_engine_api/tsrc/group/bld.inf" - -// End of file diff -r 3fec62e6e7fc -r 90fe62538f66 tsrc/group/copy_binaries_to_sys_dir.mk --- a/tsrc/group/copy_binaries_to_sys_dir.mk Thu Aug 19 09:55:50 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +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: Icons makefile for project settingsuis -# - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - del \epoc32\RELEASE\winscw\udeb\Z\sys\bin\MT_CGSLauncher.dll /f - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : do_nothing - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : do_nothing - -FINAL : - echo COPYING - copy \epoc32\RELEASE\winscw\udeb\MT_CGSLauncher.dll \epoc32\RELEASE\winscw\udeb\Z\sys\bin /y