# HG changeset patch # User hgs # Date 1282618592 -28800 # Node ID 0cfa53de576f1a4b53d45817bf593aa6cd7ad0a0 # Parent 313976a11e23865ce7b1494744e4a18fc4843eb5 201033 diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemechanger.h --- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Tue Aug 24 10:56:32 2010 +0800 @@ -44,7 +44,7 @@ signals: void themeChangeFinished(); -public slots: +private slots: void changeFinished(); private: diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -17,12 +17,9 @@ /*! \class CpThemeControl - \brief CpThemeControl creates and controls two views for Theme Changer plugin and handles + \brief CpThemeControl creates and controls views for Theme Changer plugin and handles user interaction to preview and change the themes. - It creates a list view of the themes. When a list item is selected, it creates a preview - of the theme icon using a CpThemePreview class. - This class also connects to the theme server using the HbThemeChanger and sets the theme based on user interaction with the views. @@ -43,7 +40,6 @@ #include "cpthemecontrol.h" #include "cpthemelistview.h" -#include "cpthemepreview.h" #include "cpthemeinfo.h" #include "cpthemelistmodel.h" @@ -56,7 +52,6 @@ /*! Helper function to fetch the main window. */ - static HbMainWindow *mainWindow() { QList< HbMainWindow* > mainWindows = hbInstance->allMainWindows(); @@ -70,7 +65,6 @@ constructor. */ CpThemeControl::CpThemeControl(): mThemeListView(0), - mThemePreview(0), mThemeChanger(0), mListModel(0), mThemeChangeFinished(false), @@ -90,7 +84,7 @@ /*! - destorys the list view, preview and theme changer objects. + destorys the list view and theme changer objects. */ CpThemeControl::~CpThemeControl() { @@ -100,16 +94,12 @@ delete mThemeChanger; mThemeChanger = 0; - delete mThemePreview; - mThemePreview = 0; - delete mWaitDialog; mWaitDialog = 0; } /*! - Creates the theme list view. Gets the themes, creates a model based on - theme names, icons, and icon paths and sets the list model. + Creates the theme list view. Gets the themes, creates a model and sets the list model. */ void CpThemeControl::createThemeList() { @@ -122,14 +112,14 @@ // Set the model for theme list. mThemeListView->setModel(mListModel); - mThemeListView->themeList()->setSelectionMode(HbAbstractItemView::SingleSelection); 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()), @@ -190,95 +180,35 @@ //theme even though another list item is selected. setActiveThemeIndex(); - // Figure out whether this is a URI and appropriately delegate - data = index.data(CpThemeListModel::ItemTypeRole); - if(data.isValid() && data.canConvert()) { - - CpThemeInfo::ThemeListItemType type = data.value(); - - switch (type) { - case CpThemeInfo::ThemeListItemType_URL: - //get the URL - data = index.data(CpThemeListModel::ItemDataRole); - if(data.isValid()) { - QString url = data.toString(); - // Launch the URL in the browser and - // continue to Preview if not successful - if (QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode))) { - return; - } - } - break; - - case CpThemeInfo::ThemeListItemType_APP: - break; - - default: - // do nothing - qt_noop(); - } - } - //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()); } - //get theme icon. - data = index.data(Qt::DecorationRole); - if(data.isValid()) { - themeInfo.setIcon(data.value()); - } - - data = index.data(CpThemeListModel::PortraitPreviewRole); - if(data.isValid()) { - themeInfo.setPortraitPreviewIcon(data.value()); - } - - data = index.data(CpThemeListModel::LandscapePreviewRole); - if(data.isValid()) { - themeInfo.setLandscapePreviewIcon(data.value()); - } - - -#ifdef CP_THEME_PREVIEW_DEFINED - - //Set up the theme preview and set it to - //the current view of main window. + applyTheme(themeInfo); + +} - HbMainWindow* mWindow = ::mainWindow(); - - if(!mThemePreview){ - mThemePreview = new CpThemePreview(themeInfo); - mWindow->addView(mThemePreview); - - connect(mThemePreview,SIGNAL(aboutToClose()), - this, SLOT(previewClosed())); - - connect(mThemePreview, SIGNAL(applyTheme(CpThemeInfo)), - this, SLOT(themeApplied(CpThemeInfo))); - } else { - mThemePreview->setThemeInfo(themeInfo); - } - mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel")); - - mWindow->setCurrentView(mThemePreview); -#else - themeApplied(themeInfo); -#endif - +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::themeApplied(const CpThemeInfo& theme) +void CpThemeControl::applyTheme(const CpThemeInfo& theme) { QThread::currentThread()->setPriority(QThread::HighPriority); @@ -292,38 +222,12 @@ mThemeChangeFinished = false; } else { //theme change failed, go back to control panel. -#ifdef CP_THEME_PREVIEW_DEFINED - previewClosed(); - triggerThemeListClose(); -#else setActiveThemeIndex(); -#endif - } } /*! - Slot called when the theme preview view is closed. -*/ -void CpThemeControl::previewClosed() -{ - //The theme preview closed, go back - //to theme list view. - HbMainWindow* mainWindow = ::mainWindow(); - if(mThemePreview){ - mainWindow->removeView(mThemePreview); - mThemePreview->deleteLater(); - mThemePreview = 0; - } - - //reset the current index to active theme, so that the selection remains on current - //theme even though another list item is selected. - setActiveThemeIndex(); - mainWindow->setCurrentView(mThemeListView); -} - -/*! 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. @@ -331,9 +235,6 @@ void CpThemeControl::themeListClosed() { mThemeListView = 0; - - delete mThemePreview; - mThemePreview = 0; } /*! @@ -352,19 +253,7 @@ if(mWaitDialog && mWaitDialog->isVisible()) { mWaitDialog->hide(); } - -#ifdef CP_THEME_PREVIEW_DEFINED - previewClosed(); - //ask the themelistview to close. Control Panel will - //take care of removing it from window. - triggerThemeListClose(); -#else - setActiveThemeIndex(); - -#endif - - - + setActiveThemeIndex(); QThread::currentThread()->setPriority(QThread::NormalPriority); } diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemecontrol.h --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Tue Aug 24 10:56:32 2010 +0800 @@ -32,7 +32,6 @@ class HbDialog; class CpThemeListView; -class CpThemePreview; class CpBaseSettingView; class CpThemeListModel; @@ -51,14 +50,14 @@ signals: void themeUpdated(const QString& themeName, const HbIcon& icon); -public slots: +private slots: void newThemeSelected(const QModelIndex& index); - void previewClosed(); - void themeApplied(const CpThemeInfo& theme); + void applyTheme(const CpThemeInfo& theme); void themeListClosed(); void themeChangeTimeout(); void themeWaitTimeout(); void themeChangeFinished(); + void getOviTheme(); private: void createThemeList(); @@ -67,7 +66,6 @@ private: CpThemeListView* mThemeListView; - CpThemePreview* mThemePreview; CpThemeChanger* mThemeChanger; QAbstractItemModel* mListModel; bool mThemeChangeFinished; diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp --- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -53,14 +53,7 @@ connect(mFileWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(themeListChanged())); - - // data for the list which appears after the themes: - CpThemeInfo fetchFromStore; - fetchFromStore.setName(hbTrId("txt_cp_list_get_more_tones")); - fetchFromStore.setItemType(CpThemeInfo::ThemeListItemType_URL); - fetchFromStore.setItemData(QString("http://lr.ovi.mobi/store/themes")); - fetchFromStore.setIcon(HbIcon("qtg_large_ovistore")); - mBottomThemeList.append(fetchFromStore); + } /* @@ -113,19 +106,7 @@ case Qt::DisplayRole: retVal = list->at(row).name(); break; -#ifdef CP_THEME_PREVIEW_DEFINED - case Qt::DecorationRole: - retVal = list->at(row).icon(); - break; - case PortraitPreviewRole: - retVal = list->at(row).portraitPreviewIcon(); - break; - - case LandscapePreviewRole: - retVal = list->at(row).landscapePreviewIcon(); - break; -#endif case Qt::SizeHintRole: retVal = list->at(row).icon().size(); break; diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemelistmodel.h --- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Tue Aug 24 10:56:32 2010 +0800 @@ -32,11 +32,9 @@ public: enum ThemeListUserRole { - PortraitPreviewRole = Qt::UserRole, - LandscapePreviewRole, - ItemTypeRole, - ItemDataRole - }; + ItemTypeRole = Qt::UserRole, + ItemDataRole + }; explicit CpThemeListModel(QObject *parent = 0); virtual ~CpThemeListModel(); diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemelistview.cpp --- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -22,13 +22,16 @@ #include #include #include -#include +#include +#include +#include + #include "cpthemelistview.h" /*! \class CpThemeListView - \brief CpThemeListView displays a heading (Select theme) and a list of themes with + \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 @@ -42,21 +45,16 @@ mThemeList(new HbListView(this)) { - - //Create a layout with a heading "Select theme" at top and the list below it. + //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. - //Using an empty dataform as heading because the heading should - //look like an HbDataForm headiing. - HbDataForm *form = new HbDataForm(contentWidget); - form->setHeading(hbTrId("txt_cp_title_select_theme")); - - layout->addItem(form); - //Fixed vertical policy so that the heading doesn't expand. - form->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed, QSizePolicy::DefaultType); + HbGroupBox *simpleLabel = new HbGroupBox(); + simpleLabel->setHeading(hbTrId("txt_cp_title_select_theme")); + + layout->addItem(simpleLabel); connect(mThemeList, SIGNAL(activated(QModelIndex)), this, SIGNAL(newThemeSelected(QModelIndex))); @@ -64,15 +62,28 @@ //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); - layout->addStretch(); - + //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); + } /*! diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemelistview.h --- a/controlpanelplugins/themeplugin/src/cpthemelistview.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.h Tue Aug 24 10:56:32 2010 +0800 @@ -41,6 +41,7 @@ signals: void newThemeSelected(const QModelIndex& index); + void oviClicked(); private: HbListView* mThemeList; diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemepreview.h --- a/controlpanelplugins/themeplugin/src/cpthemepreview.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Tue Aug 24 10:56:32 2010 +0800 @@ -48,10 +48,10 @@ void applyTheme(const CpThemeInfo&); void aboutToClose(); -public slots: +private slots: void themeSelected(); void previewOrientationChanged(Qt::Orientation orientation); - + private: CpThemeInfo mTheme; HbAction* mSoftKeyBackAction; diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemeutil.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -45,18 +45,11 @@ 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 KPreviewPrtNVG = "/scalable/qtg_graf_theme_preview_prt.nvg"; - static const QString KPreviewLscNVG = "/scalable/qtg_graf_theme_preview_lsc.nvg"; - static const QString KPreviewPrtSVG = "/scalable/qtg_graf_theme_preview_prt.svg"; - static const QString KPreviewLscSVG = "/scalable/qtg_graf_theme_preview_lsc.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"; - static const QString KBackgroundPrtPNG = "/pixmap/qtg_graf_screen_bg_prt.png"; - static const QString KBackgroundLscPNG = "/pixmap/qtg_graf_screen_bg_lsc.png"; @@ -71,8 +64,6 @@ CpThemeInfo *themeInfo = new CpThemeInfo(); QString iconPath; - QString previewPathPrt; - QString previewPathLsc; QString name = themeName; QString hidden = ""; @@ -84,8 +75,6 @@ name = iniSetting.value("Name").toString(); hidden = iniSetting.value("Hidden").toString(); iconPath = iniSetting.value("PreviewThumbnailPath").toString(); - previewPathPrt = iniSetting.value("PreviewIconPath_prt").toString(); - previewPathLsc = iniSetting.value("PreviewIconPath_lsc").toString(); iniSetting.endGroup(); } @@ -105,78 +94,50 @@ * 3. If no icon exist (background or preview),use default theme icon. */ if(iconPath.isEmpty() || !QFileInfo(themePath + iconPath).exists()){ - //Set thumbnail - if(QFileInfo(themePath + KPreviewThumbnailNVG).exists()){ - themeInfo->setIcon(HbIcon(themePath + KPreviewThumbnailNVG)); - }else if(QFileInfo(themePath + KPreviewThumbnailSVG).exists()){ - themeInfo->setIcon(HbIcon(themePath + KPreviewThumbnailSVG)); - }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){ - themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtNVG)); - } else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){ - themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtSVG)); - } else if(QFileInfo(themePath + KBackgroundPrtPNG).exists()){ - themeInfo->setIcon(HbIcon(themePath + KBackgroundPrtPNG)); - }else{ - themeInfo->setIcon(HbIcon(defaultTheme()->icon())); + //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)); } - //Portrait preview - - if(previewPathPrt.isEmpty() || !QFileInfo(themePath + previewPathPrt).exists()) { - - if(QFileInfo(themePath + KPreviewPrtNVG).exists()){ - themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KPreviewPrtNVG)); - }else if(QFileInfo(themePath + KPreviewPrtSVG).exists()){ - themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KPreviewPrtSVG)); - }else if(QFileInfo(themePath + KBackgroundPrtNVG).exists()){ - themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtNVG)); - } else if(QFileInfo(themePath + KBackgroundPrtSVG).exists()){ - themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtSVG)); - } else if(QFileInfo(themePath + KBackgroundPrtPNG).exists()){ - themeInfo->setPortraitPreviewIcon(HbIcon(themePath + KBackgroundPrtPNG)); - } else{ - themeInfo->setPortraitPreviewIcon(HbIcon(defaultTheme()->icon())); - } - } - else { - themeInfo->setPortraitPreviewIcon(HbIcon(themePath + previewPathPrt)); - } - - //Landscape preview - - if(previewPathLsc.isEmpty() || !QFileInfo(themePath + previewPathLsc).exists()) { - if(QFileInfo(themePath + KPreviewLscNVG).exists()){ - themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KPreviewLscNVG)); - }else if(QFileInfo(themePath + KPreviewLscSVG).exists()){ - themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KPreviewLscSVG)); - }else if(QFileInfo(themePath + KBackgroundLscNVG).exists()){ - themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscNVG)); - } else if(QFileInfo(themePath + KBackgroundLscSVG).exists()){ - themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscSVG)); - } else if(QFileInfo(themePath + KBackgroundLscPNG).exists()){ - themeInfo->setLandscapePreviewIcon(HbIcon(themePath + KBackgroundLscPNG)); - } else{ - themeInfo->setLandscapePreviewIcon(HbIcon(defaultTheme()->icon())); - } - } - else { - themeInfo->setLandscapePreviewIcon(HbIcon(themePath + previewPathLsc)); - } 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) { @@ -198,17 +159,14 @@ } /*! - * Returns the default theme information. + * Returns the default theme path. */ -CpThemeInfo* CpThemeUtil::defaultTheme() +QString CpThemeUtil::defaultTheme() { //static because default theme doesn't change. - static CpThemeInfo *defaultTheme = 0; - if(!defaultTheme) { - defaultTheme = new CpThemeInfo(); - } - QString defaultThemePath; - if(defaultTheme->name().isEmpty()) { + static QString defaultThemePath(""); + + if(defaultThemePath.isEmpty()) { #ifdef Q_OS_SYMBIAN @@ -225,10 +183,9 @@ } #endif - defaultTheme = buildThemeInfo(defaultThemePath); - + } - return defaultTheme; + return defaultThemePath; } diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/src/cpthemeutil.h --- a/controlpanelplugins/themeplugin/src/cpthemeutil.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/src/cpthemeutil.h Tue Aug 24 10:56:32 2010 +0800 @@ -23,15 +23,19 @@ class QStringList; class CpThemeInfo; +class HbIcon; class CpThemeUtil { public: static QList buildThemeList(); static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName = QString()); - static CpThemeInfo* defaultTheme(); + static QString defaultTheme(); static const QList< QPair< QString, QString > > availableThemes(); static const QStringList themeDirectories(const QList &themeInfoList); + +private: + static HbIcon getPreviewIcon(const QString& themePath); }; diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/themeplugin.pri --- a/controlpanelplugins/themeplugin/themeplugin.pri Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/themeplugin.pri Tue Aug 24 10:56:32 2010 +0800 @@ -9,8 +9,7 @@ # Contributors: # Description: cpthemeplugin source files # Input -HEADERS += src/cpthemepreview.h \ - src/cpthemecontrol.h \ +HEADERS += src/cpthemecontrol.h \ src/cpthemeplugin.h \ src/cpthemelistview.h \ src/cpthemelistmodel.h \ @@ -18,8 +17,7 @@ src/cpthemepluginentryitemdata.h \ src/cpthemeutil.h \ src/cpthemeinfo.h -SOURCES += src/cpthemepreview.cpp \ - src/cpthemecontrol.cpp \ +SOURCES += src/cpthemecontrol.cpp \ src/cpthemeplugin.cpp \ src/cpthemelistview.cpp \ src/cpthemelistmodel.cpp \ diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/themeplugin.pro --- a/controlpanelplugins/themeplugin/themeplugin.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/themeplugin.pro Tue Aug 24 10:56:32 2010 +0800 @@ -27,7 +27,7 @@ #comment this out if theme plugin should have #a preview view. -DEFINES += CP_THEME_PREVIEW_DEFINED +#DEFINES += CP_THEME_PREVIEW_DEFINED include (themeplugin.pri) include (rom/themeplugin_rom.pri) diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/themeplugin.ts --- a/controlpanelplugins/themeplugin/themeplugin.ts Thu Aug 05 11:28:29 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ - - - - - - Select theme view title - Select theme - Select theme - - CP_04 - subtitle - CP - False - - - This is the view title, shown in all Control Panel views. - Control Panel - Control Panel - qtl_chrome_title - CP_01 - title - CP - False - - - List item, opens Theme selector view - Theme - Theme - qtl_list_pri_large_graphic - CP_01 - list - CP - False - - - Theme preview view title, where %1 is the name of the theme that is previewed - Preview: %1 - Preview: %1 - - CP_05 - subtitle - CP - False - - - diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/tsrc.pro --- a/controlpanelplugins/themeplugin/tsrc/tsrc.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/tsrc.pro Tue Aug 24 10:56:32 2010 +0800 @@ -19,6 +19,8 @@ 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 diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/common.pri --- a/controlpanelplugins/themeplugin/tsrc/unit/common.pri Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/common.pri Tue Aug 24 10:56:32 2010 +0800 @@ -42,6 +42,7 @@ symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE INCLUDEPATH += $$MOC_DIR + LIBS += -lcentralrepository TARGET.CAPABILITY = ALL -TCB TARGET.EPOCALLOWDLLDATA = 1 } diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -16,45 +16,32 @@ */ #include -#include #include +#include +#include + #include "cpthemechanger.h" #include "cpthemecontrol.h" -#include "cpthemechanger.h" +#include "cpthemeinfo.h" +#include "cpthemeutil.h" class TestCpThemeControl : public QObject { Q_OBJECT private slots: - void init(); void testConstructor(); void testThemeListView(); void testCurrentThemeName(); void testCurrentThemeIcon(); - void testNewThemeSelected(); - void testPreviewClosed(); - void testThemeApplied(); - void testUpdateThemeList(); - - void cleanup(); - + private: CpThemeChanger* mThemeChanger; }; -// setup and cleanup -void TestCpThemeControl::init() -{ - mThemeChanger = new CpThemeChanger(); -} -void TestCpThemeControl::cleanup() -{ - delete mThemeChanger; -} // verify that the constructor works and that the // defaults are sane. @@ -64,7 +51,7 @@ QVERIFY(control !=0 ); QVERIFY(!control->currentThemeName().isEmpty()); - QVERIFY(!control->currentThemeIcon().isEmpty()); + QVERIFY(!control->currentThemeIcon().iconName().isEmpty()); delete control; } @@ -82,8 +69,8 @@ { CpThemeControl control; - QVERIFY((control.currentThemeName() == mThemeChanger->currentTheme()) - || (control.currentThemeName() == QString("hbdefault"))); + QVERIFY( (control.currentThemeName() == hbInstance->theme()->name()) + || (control.currentThemeName() == QString("hbdefault"))); } // test that we get a non-empty string for current theme icon @@ -91,56 +78,10 @@ { CpThemeControl control; - QVERIFY(!control.currentThemeIcon().isEmpty()); -} - -// NULL test there's no way to externally get the model the QModelIndex is based on -void TestCpThemeControl::testNewThemeSelected() -{ - CpThemeControl control; - - control.newThemeSelected(QModelIndex()); - + QVERIFY(!control.currentThemeIcon().isNull() && !control.currentThemeIcon().iconName().isEmpty()); } -// NULL test - basically verifies that it doesn't burst into flames. -void TestCpThemeControl::testPreviewClosed() -{ - CpThemeControl control; - - control.previewClosed(); - -} -void TestCpThemeControl::testThemeApplied() -{ - CpThemeControl control; - QList themeList = mThemeChanger->themes(); - QSignalSpy spy(&control, SIGNAL(themeUpdated(const QString&, const QString&))); - int expectedSignalCount = 0; - - for (int i = 0; i < themeList.size(); ++i) { - CpThemeChanger::ThemeInfo info = themeList.at(i); - QString name = info.themeName; - - if (control.currentThemeName() == mThemeChanger->currentTheme()) { - ++expectedSignalCount; - } - - control.themeApplied(name); - QCOMPARE(control.currentThemeName(), mThemeChanger->currentTheme()); - - QCOMPARE(spy.count(),expectedSignalCount); - } -} - -// NULL test - basically verifies that it doesn't burst into flames. -void TestCpThemeControl::testUpdateThemeList() -{ - CpThemeControl control; - - control.updateThemeList(); -} diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemecontrol/unittest_cpthemecontrol.pro Tue Aug 24 10:56:32 2010 +0800 @@ -37,18 +37,14 @@ HEADERS += ../../../src/cpthemecontrol.h HEADERS += ../../../src/cpthemechanger.h -HEADERS += ../../../src/cpthemechanger_p.h -HEADERS += ../../../src/cpthemeclient_p.h -symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h -win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h HEADERS += ../../../src/cpthemelistview.h -HEADERS += ../../../src/cpthemepreview.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/cpthemechanger_p.cpp -SOURCES += ../../../src/cpthemeclient_p.cpp -symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp -win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemelistmodel.cpp SOURCES += ../../../src/cpthemelistview.cpp -SOURCES += ../../../src/cpthemepreview.cpp diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,30 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0". +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: 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 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemelistview/unittest_cpthemelistview.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -62,13 +62,13 @@ delete listView; } -// no getter so this is basically a NULL test. 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. @@ -88,4 +88,4 @@ QTEST_MAIN(TestCpThemeListView) -#include "unittest_cpthemelistview.moc" \ No newline at end of file +#include "unittest_cpthemelistview.moc" diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -42,11 +42,11 @@ CpThemePlugin *obj = new CpThemePlugin(); CpItemDataHelper helper; - QVERIFY(obj->createSettingFormItemData(helper) != 0); + QVERIFY(obj->createSettingFormItemData(helper).at(0) != 0); delete obj; } QTEST_MAIN(TestCpThemePlugin) -#include "unittest_cpthemeplugin.moc" \ No newline at end of file +#include "unittest_cpthemeplugin.moc" diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemeplugin/unittest_cpthemeplugin.pro Tue Aug 24 10:56:32 2010 +0800 @@ -35,23 +35,21 @@ # Input HEADERS += ../../../src/cpthemecontrol.h -HEADERS += ../../../src/cpthemeclient_p.h -win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h -symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h -HEADERS += ../../../src/cpthemepreview.h HEADERS += ../../../src/cpthemechanger.h -HEADERS += ../../../src/cpthemechanger_p.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/cpthemeclient_p.cpp -win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp -symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp -SOURCES += ../../../src/cpthemepreview.cpp SOURCES += ../../../src/cpthemechanger.cpp -SOURCES += ../../../src/cpthemechanger_p.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 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -35,7 +35,7 @@ CpItemDataHelper helper; CpThemePluginEntryItemData *obj = new CpThemePluginEntryItemData(helper); - + QVERIFY(obj != NULL); delete obj; diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepluginentryitemdata/unittest_cpthemepluginentryitemdata.pro Tue Aug 24 10:56:32 2010 +0800 @@ -34,23 +34,19 @@ # 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/cpthemepreview.h -HEADERS += ../../../src/cpthemechanger_p.h -HEADERS += ../../../src/cpthemeclient_p.h -win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h -symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h HEADERS += ../../../src/cpthemepluginentryitemdata.h SOURCES += unittest_cpthemepluginentryitemdata.cpp SOURCES += ../../../src/cpthemepluginentryitemdata.cpp SOURCES += ../../../src/cpthemelistview.cpp SOURCES += ../../../src/cpthemecontrol.cpp -SOURCES += ../../../src/cpthemepreview.cpp SOURCES += ../../../src/cpthemechanger.cpp -SOURCES += ../../../src/cpthemechanger_p.cpp -SOURCES += ../../../src/cpthemeclient_p.cpp -win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp -symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp +SOURCES += ../../../src/cpthemelistmodel.cpp diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -19,116 +19,54 @@ #include "cpthemepreview.h" #include "cpthemechanger.h" +#include "cpthemeutil.h" class TestCpThemePreview : public QObject { Q_OBJECT private slots: - void init(); - - void testConstructor(); - void testConstructor2(); - void testSetThemeName(); - void testSetPreviewIcon(); - void testThemeSelected(); - - void cleanup(); - -private: - CpThemeChanger *mThemeChanger; + + void testAll(); + }; -void TestCpThemePreview::init() -{ - mThemeChanger = new CpThemeChanger(); -} - -void TestCpThemePreview::cleanup() +void TestCpThemePreview::testAll() { - delete mThemeChanger; -} + 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()); -void TestCpThemePreview::testConstructor() -{ - CpThemePreview *obj = new CpThemePreview(); - - QVERIFY( obj != 0 ); + 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; -} -void TestCpThemePreview::testConstructor2() -{ - QList themeInfo = mThemeChanger->themes(); - - for (int i = 0; i < themeInfo.size(); ++i) { - QString name = themeInfo.at(i).themeName; - QString icon = themeInfo.at(i).iconPath; - - CpThemePreview *obj = new CpThemePreview(name, icon); - QVERIFY (obj != 0 ); - QCOMPARE(obj->themeName(), name); - - delete obj; - } - - // try with gibberish for the name and/or icon - QString name = QString("alzihgiaureh"); - QString icon = QString("ahilwvihln"); - CpThemePreview *obj = new CpThemePreview(name); - QVERIFY(obj != 0); - delete obj; - - obj = new CpThemePreview(name,icon); - QVERIFY(obj != 0); - delete obj; } -void TestCpThemePreview::testSetThemeName() -{ - CpThemePreview *obj = new CpThemePreview(); - QList themeInfo = mThemeChanger->themes(); - - for (int i = 0; i < themeInfo.size(); ++i) { - QString name = themeInfo.at(i).themeName; - - obj->setThemeName(name); - QCOMPARE(obj->themeName(), name); - } - - delete obj; -} - -// NULL TEST -void TestCpThemePreview::testSetPreviewIcon() -{ - CpThemePreview *obj = new CpThemePreview(); - QList themeInfo = mThemeChanger->themes(); - - for (int i = 0; i < themeInfo.size(); ++i) { - QString name = themeInfo.at(i).themeName; - - obj->setThemeName(name); - QCOMPARE(obj->themeName(), name); - } - - delete obj; -} - -void TestCpThemePreview::testThemeSelected() -{ - CpThemePreview *obj = new CpThemePreview(); - QSignalSpy spy(obj,SIGNAL(applyTheme(const QString&))); - - obj->themeSelected(); - - QCOMPARE(spy.count(), 1); - - delete obj; -} - - QTEST_MAIN(TestCpThemePreview) #include "unittest_cpthemepreview.moc" diff -r 313976a11e23 -r 0cfa53de576f controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro --- a/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.pro Tue Aug 24 10:56:32 2010 +0800 @@ -35,15 +35,11 @@ # Input HEADERS += ../../../src/cpthemepreview.h -HEADERS += ../../../src/cpthemeclient_p.h -win32::HEADERS += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.h -symbian::HEADERS += ../../../src/cpthemeclientsymbian_p.h +HEADERS += ../../../src/cpthemeinfo.h +HEADERS += ../../../src/cpthemeutil.h HEADERS += ../../../src/cpthemechanger.h -HEADERS += ../../../src/cpthemechanger_p.h SOURCES += unittest_cpthemepreview.cpp SOURCES += ../../../src/cpthemepreview.cpp +SOURCES += ../../../src/cpthemeinfo.cpp +SOURCES += ../../../src/cpthemeutil.cpp SOURCES += ../../../src/cpthemechanger.cpp -SOURCES += ../../../src/cpthemeclient_p.cpp -win32::SOURCES += ../../../src/cpplugins/themeplugin/src/cpthemeclientqt_p.cpp -symbian::SOURCES += ../../../src/cpthemeclientsymbian_p.cpp -SOURCES += ../../../src/cpthemechanger_p.cpp diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpapplication/cpapplication.pro --- a/controlpanelui/src/cpapplication/cpapplication.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpapplication/cpapplication.pro Tue Aug 24 10:56:32 2010 +0800 @@ -26,14 +26,14 @@ RESOURCES += cpapplication.qrc -LIBS += -lcpframework -lcpcategorymodel +LIBS += -lcplogger -lcpframework -lcpcategorymodel TRANSLATIONS = control_panel.ts symbian: { - SKINICON = qtg_large_settings - TARGET.UID3 = 0x20025FD9 - TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 + SKINICON = qtg_large_settings + TARGET.UID3 = 0x20025FD9 + TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 deploy.path = C: headers.sources += data/mainview.cpcfg diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpapplication/src/cpmainview.cpp --- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -22,16 +22,28 @@ #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) + mMainWindow(mainWindow), + mActivityManager(0) { //delay loading - connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel())); + //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() @@ -56,9 +68,92 @@ mMainModel = new CpMainModel; mMainModel->initialize(*mItemDataHelper); form->setModel(mMainModel); + connect(form, SIGNAL(activated(QModelIndex)), this, SLOT(onDataFormItemActivated(QModelIndex))); - 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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpapplication/src/cpmainview.h --- a/controlpanelui/src/cpapplication/src/cpmainview.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpapplication/src/cpmainview.h Tue Aug 24 10:56:32 2010 +0800 @@ -24,6 +24,7 @@ class HbDataFormModelItem; class CpItemDataHelper; class HbMainWindow; +class HbActivityManager; class CpMainView : public CpBaseSettingView { @@ -32,14 +33,23 @@ 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 diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpapplication/src/cpmainwindow.cpp --- a/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -30,7 +30,11 @@ CpMainWindow::~CpMainWindow() { - + CpMainView *mainView = qobject_cast(views().first()); + if(mainView) + { + mainView->saveActivity(); + } } bool CpMainWindow::event(QEvent *e) diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpapplication/src/main.cpp --- a/controlpanelui/src/cpapplication/src/main.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpapplication/src/main.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,23 +35,18 @@ QCoreApplication::setApplicationName("ControlPanel"); #ifdef ENABLE_CPFW_LOG - Logger::instance(CPFW_LOGGER_NAME)->configure( - CP_LOGGER_CONFIG_PATH,QSettings::IniFormat); + INIT_LOGGER(CPFW_LOGGER_NAME,CP_LOGGER_CONFIG_PATH) #endif #ifdef ENABLE_CPPERF_LOG - Logger::instance(CPPERF_LOGGER_NAME)->configure( - CP_LOGGER_CONFIG_PATH,QSettings::IniFormat); + INIT_LOGGER(CPPERF_LOGGER_NAME,CP_LOGGER_CONFIG_PATH) #endif CPFW_LOG("Entering ControlPanel.exe..."); CPPERF_LOG("Entering ControlPanel.exe..."); - - QTranslator translator; - if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations")) - { - qApp->installTranslator(&translator); - } + + HbTranslator translator("control_panel"); + translator.loadCommon(); HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); @@ -70,8 +65,6 @@ CPFW_LOG("Exiting ControlPanel.exe."); - Logger::closeAll(); - return ret; } diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/cpcategorymodel.pro --- a/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/cpcategorymodel.pro Tue Aug 24 10:56:32 2010 +0800 @@ -24,7 +24,7 @@ CONFIG += Hb xml DEFINES += BUILD_CPCATEGORY_GLOBAL -LIBS += -lcpframework +LIBS += -lcplogger -lcpframework symbian: { TARGET.UID3 = 0X20028736 diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Utility class for cpcategorymodel. * */ #include "cpcategorymodelutility.h" @@ -181,11 +181,11 @@ if (itemData) { //append the new created setting form item to its parent item. parent->insertChild(startPosition++,itemData); - - if (CpCategorySettingFormItemData *categoryItemData + //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); diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -11,13 +11,16 @@ * * Contributors: * -* Description: +* 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: @@ -36,7 +39,9 @@ QString mConfigFile; }; - +/* + * Constructor + */ CpCategorySettingFormItemData::CpCategorySettingFormItemData( HbDataFormModelItem::DataItemType type, const QString &label, @@ -47,6 +52,9 @@ { } +/* + * Overloaded constructor + */ CpCategorySettingFormItemData::CpCategorySettingFormItemData( const QString &configFile /*= QString()*/, const HbDataFormModelItem *parent /*= 0*/) : @@ -55,11 +63,17 @@ { } +/* + * Desctructor + */ CpCategorySettingFormItemData::~CpCategorySettingFormItemData() { delete d; } +/* + * Initialize + */ void CpCategorySettingFormItemData::initialize(CpItemDataHelper &itemDataHelper) { //avoid to be called twice @@ -82,12 +96,17 @@ } } - +/* + * 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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -11,16 +11,18 @@ * * Contributors: * -* Description: +* 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: @@ -39,16 +41,25 @@ 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 @@ -70,11 +81,18 @@ } } - +/* + * 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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Placeholder for plugin configured in cpcfg file but the target is missing. * */ @@ -64,3 +64,6 @@ { return 0; } + +//End of File + diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h --- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Placeholder for plugin configured in cpcfg file but the target is missing. * */ @@ -36,5 +36,6 @@ virtual CpBaseSettingView *createSettingView() const; }; +#endif //CPPLACEHOLDERITEMDATA_H -#endif //CPPLACEHOLDERITEMDATA_H +//End of File diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp --- a/controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfig.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: An entry for a plugin defined in cpcfg file. * */ diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cppluginconfig.h --- a/controlpanelui/src/cpcategorymodel/src/cppluginconfig.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfig.h Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: An entry for a controlpanel plugin defined in cpcfg file. * */ @@ -26,9 +26,9 @@ CpPluginConfig(); void dump(); public: - int mUid; + int mUid; //UID3 for the plugin QString mDisplayName; - QString mPluginFile; + QString mPluginFile; QString mDescription; }; diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp --- a/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: This class reads cpcfg files. * */ @@ -27,19 +27,30 @@ 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 (); @@ -47,11 +58,13 @@ 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)); @@ -69,6 +82,9 @@ return cpPluginConfigList; } +/* + * Read a list of CpPluginConfig from a xml stream. + */ void CpPluginConfigReader::readCpPluginConfigs(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) { xmlReader.readNext(); @@ -76,6 +92,7 @@ while (!xmlReader.atEnd()) { if (xmlReader.isStartElement()) { + // Read node if (xmlReader.name() == CHILD_PLUGINS_TAG) { readChildPluginsElement(xmlReader, cpPluginConfigList); } @@ -90,6 +107,9 @@ } } +/* + * Read node. + */ void CpPluginConfigReader::readChildPluginsElement(QXmlStreamReader &xmlReader,QList &cpPluginConfigList) { xmlReader.readNext(); @@ -102,9 +122,11 @@ } if (xmlReader.isStartElement()) { + // Read node if (xmlReader.name() == PLUGIN_TAG) { readPluginElement(xmlReader, cpPluginConfigList); } + // Skip invalid node else { skipUnknownElement(xmlReader); } @@ -116,34 +138,46 @@ } } +/* + * 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(); @@ -156,12 +190,17 @@ } 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 { @@ -170,6 +209,9 @@ } } +/* + * ignore invalid node. + */ void CpPluginConfigReader::skipUnknownElement(QXmlStreamReader &xmlReader) { xmlReader.readNext(); diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h --- a/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpcategorymodel/src/cppluginconfigreader.h Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: This class reads cpcfg files. * */ diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/emptypluginfortest.cpcfg diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpcategorymodel/tsrc/ut_cppluginconfigreader/data/testdataputhere.dat diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro --- a/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Tue Aug 24 10:56:32 2010 +0800 @@ -19,8 +19,6 @@ CONFIG += hb plugin - - include ( ../cpplugincommon.pri ) include ( communicationplugin.pri ) diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/cpplugincommon.pri --- a/controlpanelui/src/cpplugins/cpplugincommon.pri Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/cpplugincommon.pri Tue Aug 24 10:56:32 2010 +0800 @@ -15,8 +15,7 @@ # include (../common.pri) - -LIBS += -lcpframework -lcpcategorymodel +LIBS += -lcplogger -lcpframework -lcpcategorymodel symbian: plugin { # copy qtstub and manifest diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/cpplugins.pro --- a/controlpanelui/src/cpplugins/cpplugins.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/cpplugins.pro Tue Aug 24 10:56:32 2010 +0800 @@ -19,11 +19,10 @@ deviceplugin \ privacyplugin \ personalizationplugin \ - lookfeelplugin \ - profileactivatorplugin \ - volumeplugin \ - ringtoneplugin \ - keytouchfdbkplugin + profileactivatorplugin \ + volumeplugin \ + ringtoneplugin \ + keytouchfdbkplugin #displayplugin \ #applicationsettingsplugin \ #accountsplugin diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- a/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Tue Aug 24 10:56:32 2010 +0800 @@ -3,7 +3,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -32,7 +32,7 @@ CpSettingFormEntryItemData::ListEntryItem, // item type itemDataHelper, hbTrId("txt_cp_list_keys_screen"), // text - QString(" "), // description + QString(""), // description "qtg_large_key_screen"); // icon name return QList() << itemData; } diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -215,197 +215,7 @@ } -/* -void CpProfileSettingForm::initGeneralTonesGroup() -{ - CpProfileSettings profileSettings; - mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); - - //HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup( - // hbTrId("txt_cp_subhead_tones"),mGeneralPage); - QFileInfo ringToneFileInfo( profileSettings.mRingTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mGeneralPage); - - QFileInfo messageToneFileInfo( profileSettings.mMessageTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ) ), mGeneralPage); - - QFileInfo emailToneFileInfo( profileSettings.mEmailTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ) ), mGeneralPage); - - QFileInfo reminderToneFileInfo( profileSettings.mReminderTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ) ), mGeneralPage); - - HbDataFormModelItem *notificationTones = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),mGeneralPage); - notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones")); - notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 ); - - mGeneralKeysAndScreenToneSlider = - mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mGeneralPage); - - //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") ); - //elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); - //mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "elementIcons" ), elements ); - - //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 - mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 ); - mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 ); - mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone ); - - - mGeneralSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), mGeneralPage ); - //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 - mGeneralSreenVibra->setContentWidgetData( QString( "minimum" ), 0 ); - mGeneralSreenVibra->setContentWidgetData( QString( "maximum" ), 5 ); - mGeneralSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); - - addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int ))); - addConnection( mGeneralKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int ))); - addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int ))); -} -*/ -/*void CpProfileSettingForm::initGeneralVibraGroup() -{ - CpProfileSettings profileSettings; - mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); - - HbDataFormModelItem *vibraGroup = mModel->appendDataFormGroup( - hbTrId( "txt_cp_subhead_vibra" ), mGeneralPage ); - HbDataFormModelItem *ringVibar = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - ringVibar->setContentWidgetData( "text", hbTrId( "txt_cp_list_ring_alet" ) ); - ringVibar->setContentWidgetData( "checkState", profileSettings.mRingAlertVibra?2:0 ); - - HbDataFormModelItem *messageVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - messageVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_message" ) ); - messageVibra->setContentWidgetData( "checkState", profileSettings.mMessageVibra?2:0 ); - - HbDataFormModelItem *emailVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - emailVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_email" ) ); - emailVibra->setContentWidgetData( "checkState", profileSettings.mEmailVibra?2:0 ); - - HbDataFormModelItem *reminderVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - reminderVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_reminder_alert" )); - reminderVibra->setContentWidgetData( "checkState", profileSettings.mReminderAlertVibra?2:0 ); - - HbDataFormModelItem *notificationVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - notificationVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_notification" ) ); - notificationVibra->setContentWidgetData( "checkState", profileSettings.mNotificationVibra?2:0 ); - - mGeneralSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), vibraGroup ); - //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 - mGeneralSreenVibra->setContentWidgetData( QString( "minimum" ), 0 ); - mGeneralSreenVibra->setContentWidgetData( QString( "maximum" ), 5 ); - mGeneralSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); - - addConnection( ringVibar, SIGNAL( stateChanged( int )), this, SLOT( on_general_ringVibar_stateChanged( int ))); - addConnection( messageVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_messageVibra_stateChanged( int ))); - addConnection( emailVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_emailVibra_stateChanged( int ))); - addConnection( reminderVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_reminderVibra_stateChanged( int ))); - addConnection( notificationVibra, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationVibra_stateChanged( int ))); - - addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int ))); -}*/ - -//////////////////////////////////////////////////////////// -/*void CpProfileSettingForm::initMeetingTonesGroup() -{ - CpProfileSettings profileSettings; - mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); - - //HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup( - // hbTrId("txt_cp_subhead_tones"),mMeetingPage); - QFileInfo ringToneFileInfo( profileSettings.mRingTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mMeetingPage); - - QFileInfo messageToneFileInfo( profileSettings.mMessageTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ) ), mMeetingPage); - - QFileInfo emailToneFileInfo( profileSettings.mEmailTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ) ), mMeetingPage); - - QFileInfo reminderToneFileInfo( profileSettings.mReminderTone ); - mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper, - hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ) ), mMeetingPage); - - HbDataFormModelItem *notificationTones = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),mMeetingPage); - notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones")); - notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 ); - - mMeetingKeysAndScreenToneSlider = - mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mMeetingPage); - - //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") ); - //elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); - //mMeetingkeysAndScreenSlider->setContentWidgetData( QString( "elementIcons" ), elements ); - - //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 - mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 ); - mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 ); - mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone ); - - mMeetingSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), mMeetingPage ); - //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 - mMeetingSreenVibra->setContentWidgetData( QString( "minimum" ), 0 ); - mMeetingSreenVibra->setContentWidgetData( QString( "maximum" ), 5 ); - mMeetingSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); - - addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int ))); - addConnection( mMeetingKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenSlider_ValueChanged( int ))); - addConnection( mMeetingSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int ))); -} -*/ -/*void CpProfileSettingForm::initMeetingVibraGroup() -{ - CpProfileSettings profileSettings; - mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); - - HbDataFormModelItem *vibraGroup = mModel->appendDataFormGroup( - hbTrId( "txt_cp_subhead_vibra" ), mMeetingPage ); - HbDataFormModelItem *ringVibar = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - ringVibar->setContentWidgetData( "text", hbTrId( "txt_cp_list_ring_alet" ) ); - ringVibar->setContentWidgetData( "checkState", profileSettings.mRingAlertVibra?2:0 ); - - HbDataFormModelItem *messageVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - messageVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_message" ) ); - messageVibra->setContentWidgetData( "checkState", profileSettings.mMessageVibra?2:0 ); - - HbDataFormModelItem *emailVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - emailVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_received_email" ) ); - emailVibra->setContentWidgetData( "checkState", profileSettings.mEmailVibra?2:0 ); - - HbDataFormModelItem *reminderVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - reminderVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_reminder_alert" )); - reminderVibra->setContentWidgetData( "checkState", profileSettings.mReminderAlertVibra?2:0 ); - - HbDataFormModelItem *notificationVibra = mModel->appendDataFormItem( HbDataFormModelItem::CheckBoxItem, QString(), vibraGroup ); - notificationVibra->setContentWidgetData( "text", hbTrId( "txt_cp_list_notification" ) ); - notificationVibra->setContentWidgetData( "checkState", profileSettings.mNotificationVibra?2:0 ); - - mMeetingSreenVibra = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), vibraGroup ); - //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 - mMeetingSreenVibra->setContentWidgetData( QString( "minimum" ), 0 ); - mMeetingSreenVibra->setContentWidgetData( QString( "maximum" ), 5 ); - mMeetingSreenVibra->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); - - addConnection( ringVibar, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_ringVibar_stateChanged( int ))); - addConnection( messageVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_messageVibra_stateChanged( int ))); - addConnection( emailVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_emailVibra_stateChanged( int ))); - addConnection( reminderVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_reminderVibra_stateChanged( int ))); - addConnection( notificationVibra, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationVibra_stateChanged( int ))); - - addConnection( mMeetingSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int ))); -}*/ //////////////////////////////////////////////////// //general tones @@ -426,26 +236,6 @@ //general vibra -void CpProfileSettingForm::on_general_ringVibar_stateChanged( int state ) -{ - mProfileModel->setRingAlertVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_general_messageVibra_stateChanged( int state ) -{ - mProfileModel->setMessageVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_general_emailVibra_stateChanged( int state ) -{ - mProfileModel->setEmailVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_general_reminderVibra_stateChanged( int state ) -{ - mProfileModel->setReminderVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_general_notificationVibra_stateChanged( int state ) -{ - mProfileModel->setNotificationVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) ); -} void CpProfileSettingForm::on_general_screenVibra_ValueChanged( int value ) { mProfileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, value ); @@ -475,28 +265,6 @@ } } - -//meeting vibra -void CpProfileSettingForm::on_meeting_ringVibar_stateChanged( int state ) -{ - mProfileModel->setRingAlertVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_meeting_messageVibra_stateChanged( int state ) -{ - mProfileModel->setMessageVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_meeting_emailVibra_stateChanged( int state ) -{ - mProfileModel->setEmailVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_meeting_reminderVibra_stateChanged( int state ) -{ - mProfileModel->setReminderVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); -} -void CpProfileSettingForm::on_meeting_notificationVibra_stateChanged( int state ) -{ - mProfileModel->setNotificationVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); -} void CpProfileSettingForm::on_meeting_screenVibra_ValueChanged( int value ) { mProfileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, value ); diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Tue Aug 24 10:56:32 2010 +0800 @@ -53,13 +53,7 @@ //general tones void on_general_notificationTones_stateChanged(int state); void on_general_keysAndScreenToneSlider_ValueChanged( int value ); - //general vibra - void on_general_ringVibar_stateChanged( int state ); - void on_general_messageVibra_stateChanged( int state ); - void on_general_emailVibra_stateChanged( int state ); - void on_general_reminderVibra_stateChanged( int state ); - void on_general_notificationVibra_stateChanged( int state ); void on_general_screenVibra_ValueChanged( int value ); //meeting tones @@ -67,11 +61,6 @@ void on_meeting_keysAndScreenToneSlider_ValueChanged( int value ); //meeting vibar - void on_meeting_ringVibar_stateChanged( int state ); - void on_meeting_messageVibra_stateChanged( int state ); - void on_meeting_emailVibra_stateChanged( int state ); - void on_meeting_reminderVibra_stateChanged( int state ); - void on_meeting_notificationVibra_stateChanged( int state ); void on_meeting_screenVibra_ValueChanged( int value ); void settingValueChanged(const XQSettingsKey &key, const QVariant &value); diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -78,13 +78,6 @@ // the best choice is no need to convert the index to id mProfileModel.activateProfile(mProfileIds.at(currentIndex)); - // ret should be remove from here - // no invalid profile exsit - QString profileName = mProfileModel.profileName(mProfileModel.activeProfileId()); - //change the descripton of entry item - if (CpSettingFormEntryItemData *entryItem = qobject_cast(mProfileActivator)) { - entryItem->setDescription(profileName); - } } void CpProfileActivatorDialog::cancelProfileSelection() { diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -20,7 +20,7 @@ #include #include #include -#include "cpprofilemonitor.h" +#include CpProfileActivatorEntryItem::CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper, const QString &text, diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.cpp Thu Aug 05 11:28:29 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "cpprofilemonitor.h" - -#include - -CpProfileMonitor::CpProfileMonitor(QObject *parent) - :QObject(parent),mProfileNotifier(0) -{ - mProfileNotifier = CProfileChangeNotifyHandler::NewL(this); -} - -CpProfileMonitor::~CpProfileMonitor() -{ - delete mProfileNotifier; -} - -void CpProfileMonitor::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId) -{ - if (EProfileNewActiveProfile == aProfileEvent) { - emit profileActivated(aProfileId); - } -} diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.h --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.h Thu Aug 05 11:28:29 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef CPPROFILEMONITOR_H_ -#define CPPROFILEMONITOR_H_ - -#include -#include - -class CProfileChangeNotifyHandler; - -class CpProfileMonitor: public QObject,public MProfileChangeObserver -{ - Q_OBJECT -public: - explicit CpProfileMonitor(QObject *parent = 0); - ~CpProfileMonitor(); -signals: - void profileActivated(int activeProfileId); -private: - virtual void HandleActiveProfileEventL( - TProfileEvent aProfileEvent, TInt aProfileId ); - -private: - CProfileChangeNotifyHandler* mProfileNotifier; -}; - -#endif /* CPPROFILEMONITOR_H_ */ diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp --- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -47,7 +47,7 @@ if( mProfileModel ) { QString strRing = loadStringValue(); - if( strRing.contains( "No_Sound.wav", Qt::CaseInsensitive) ) + if( QFileInfo(strRing) == QFileInfo(g_strNoTone) ) { setDescription( hbTrId("txt_cp_list_no_tone" ) ); //sepcial handling about NoTone } @@ -62,18 +62,43 @@ } 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 ) { - Q_UNUSED(key); - setEnabled( !value.toInt() ); + 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() @@ -116,6 +141,7 @@ default: if( m_profileID <0 ) { + strRing = mProfileModel->ringTone(); } else diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def --- a/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/bwins/cpprofilewrapperu.def Tue Aug 24 10:56:32 2010 +0800 @@ -1,57 +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) - ?setReminderVibra@CpProfileModel@@QAEXH_N@Z @ 3 NONAME ; void CpProfileModel::setReminderVibra(int, bool) - ?offLineMode@CpProfileModel@@QBE_NXZ @ 4 NONAME ; bool CpProfileModel::offLineMode(void) const - ?masterVibra@CpProfileModel@@QBE_NXZ @ 5 NONAME ; bool CpProfileModel::masterVibra(void) const - ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 6 NONAME ; class QString CpProfileModel::ringTone(void) const - ?qt_metacast@CpProfileModel@@UAEPAXPBD@Z @ 7 NONAME ; void * CpProfileModel::qt_metacast(char const *) - ?setRingTone@CpProfileModel@@QAEXABVQString@@@Z @ 8 NONAME ; void CpProfileModel::setRingTone(class QString const &) - ?setReminderTone@CpProfileModel@@QAEXHABVQString@@@Z @ 9 NONAME ; void CpProfileModel::setReminderTone(int, class QString const &) - ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *) - ?silenceMode@CpProfileModel@@QBE_NXZ @ 11 NONAME ; bool CpProfileModel::silenceMode(void) const - ?reminderVibra@CpProfileModel@@QBE_NH@Z @ 12 NONAME ; bool CpProfileModel::reminderVibra(int) const - ?setEmailTone@CpProfileModel@@QAEXHABVQString@@@Z @ 13 NONAME ; void CpProfileModel::setEmailTone(int, class QString const &) - ?ringAlertVibra@CpProfileModel@@QBE_NH@Z @ 14 NONAME ; bool CpProfileModel::ringAlertVibra(int) const - ?emailTone@CpProfileModel@@QBE?AVQString@@H@Z @ 15 NONAME ; class QString CpProfileModel::emailTone(int) const - ?activeProfileId@CpProfileModel@@QBEHXZ @ 16 NONAME ; int CpProfileModel::activeProfileId(void) const - ?masterVolume@CpProfileModel@@QBEHXZ @ 17 NONAME ; int CpProfileModel::masterVolume(void) const - ?notificationTone@CpProfileModel@@QBE_NH@Z @ 18 NONAME ; bool CpProfileModel::notificationTone(int) const - ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 19 NONAME ; class QString CpProfileModel::tr(char const *, char const *) - ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void) - ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 21 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const - ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 22 NONAME ; void CpProfileModel::setRingTone(int, class QString const &) - ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 23 NONAME ; class QString CpProfileModel::reminderTone(int) const - ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 24 NONAME ; class QString CpProfileModel::profileName(int) const - ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 25 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int) - ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 26 NONAME ; void CpProfileModel::setMasterVolume(int) - ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject - ?activateProfile@CpProfileModel@@QAEHH@Z @ 28 NONAME ; int CpProfileModel::activateProfile(int) - ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 29 NONAME ; class QStringList CpProfileModel::profileNames(void) const - ?setNotificationVibra@CpProfileModel@@QAEXH_N@Z @ 30 NONAME ; void CpProfileModel::setNotificationVibra(int, bool) - ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 31 NONAME ; void CpProfileModel::setNotificationTone(int, bool) - ?metaObject@CpProfileModel@@UBEPBUQMetaObject@@XZ @ 32 NONAME ; struct QMetaObject const * CpProfileModel::metaObject(void) const - ?setRingAlertVibra@CpProfileModel@@QAEXH_N@Z @ 33 NONAME ; void CpProfileModel::setRingAlertVibra(int, bool) - ??0CpProfileModel@@QAE@PAVQObject@@@Z @ 34 NONAME ; CpProfileModel::CpProfileModel(class QObject *) - ?emailVibra@CpProfileModel@@QBE_NH@Z @ 35 NONAME ; bool CpProfileModel::emailVibra(int) const - ?setProfileSettings@CpProfileModel@@QAEHHAAVCpProfileSettings@@@Z @ 36 NONAME ; int CpProfileModel::setProfileSettings(int, class CpProfileSettings &) - ?setEmailVibra@CpProfileModel@@QAEXH_N@Z @ 37 NONAME ; void CpProfileModel::setEmailVibra(int, bool) - ?setOffLineMode@CpProfileModel@@QAEX_N@Z @ 38 NONAME ; void CpProfileModel::setOffLineMode(bool) - ??1CpProfileModel@@UAE@XZ @ 39 NONAME ; CpProfileModel::~CpProfileModel(void) - ?notificationVibra@CpProfileModel@@QBE_NH@Z @ 40 NONAME ; bool CpProfileModel::notificationVibra(int) const - ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 41 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 42 NONAME ; class QString CpProfileModel::messageTone(int) const - ?profileSettings@CpProfileModel@@QAEXHAAVCpProfileSettings@@@Z @ 43 NONAME ; void CpProfileModel::profileSettings(int, class CpProfileSettings &) - ?d_func@CpProfileModel@@ABEPBVCpProfileModelPrivate@@XZ @ 44 NONAME ; class CpProfileModelPrivate const * CpProfileModel::d_func(void) const - ?setSilenceMode@CpProfileModel@@QAEX_N@Z @ 45 NONAME ; void CpProfileModel::setSilenceMode(bool) - ?setMessageVibra@CpProfileModel@@QAEXH_N@Z @ 46 NONAME ; void CpProfileModel::setMessageVibra(int, bool) - ?keyTouchScreenVibra@CpProfileModel@@QBEHH@Z @ 47 NONAME ; int CpProfileModel::keyTouchScreenVibra(int) const - ?d_func@CpProfileModel@@AAEPAVCpProfileModelPrivate@@XZ @ 48 NONAME ; class CpProfileModelPrivate * CpProfileModel::d_func(void) - ?initiationFlag@CpProfileModel@@QAEHXZ @ 49 NONAME ; int CpProfileModel::initiationFlag(void) - ?messageVibra@CpProfileModel@@QBE_NH@Z @ 50 NONAME ; bool CpProfileModel::messageVibra(int) const - ??_ECpProfileModel@@UAE@I@Z @ 51 NONAME ; CpProfileModel::~CpProfileModel(unsigned int) - ?ringTone@CpProfileModel@@QBE?AVQString@@H@Z @ 52 NONAME ; class QString CpProfileModel::ringTone(int) const - ?trUtf8@CpProfileModel@@SA?AVQString@@PBD0H@Z @ 53 NONAME ; class QString CpProfileModel::trUtf8(char const *, char const *, int) - ?setMessageTone@CpProfileModel@@QAEXHABVQString@@@Z @ 54 NONAME ; void CpProfileModel::setMessageTone(int, class QString const &) - ?setMasterVibra@CpProfileModel@@QAEX_N@Z @ 55 NONAME ; void CpProfileModel::setMasterVibra(bool) + ?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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro --- a/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/cpprofilewrapper.pro Tue Aug 24 10:56:32 2010 +0800 @@ -50,8 +50,11 @@ HEADERS += ../inc/cpprofilemodel.h \ ../inc/cpprofilewrappermacro.h \ - src/cpprofilemodel_p.h -SOURCES += src/cpprofilemodel.cpp + ../inc/cpprofilemonitor.h \ + src/cpprofilemodel_p.h \ + src/cpprofilemonitor_p.h +SOURCES += src/cpprofilemodel.cpp \ + src/cpprofilemonitor.cpp CONFIG += hb win32 { INCLUDEPATH += $$PWD/src @@ -65,12 +68,14 @@ $$MOC_DIR INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) - SOURCES += src/cpprofilemodel_p.cpp + SOURCES += src/cpprofilemodel_p.cpp \ + src/cpprofilemonitor_p.cpp LIBS += -lprofileeng \ -lcentralrepository \ -lcharconv \ - -lcpframework # For cplogger + -lcplogger \ # For cplogger + -lxqutils TARGET.CAPABILITY = All -TCB TARGET.EPOCALLOWDLLDATA = 1 TARGET.UID3 = 0x20025FE6 diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def --- a/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/eabi/cpprofilewrapperu.def Tue Aug 24 10:56:32 2010 +0800 @@ -4,52 +4,53 @@ _ZN14CpProfileModel11setRingToneERK7QString @ 3 NONAME _ZN14CpProfileModel11setRingToneEiRK7QString @ 4 NONAME _ZN14CpProfileModel12setEmailToneEiRK7QString @ 5 NONAME - _ZN14CpProfileModel13setEmailVibraEib @ 6 NONAME - _ZN14CpProfileModel14initiationFlagEv @ 7 NONAME - _ZN14CpProfileModel14setMasterVibraEb @ 8 NONAME - _ZN14CpProfileModel14setMessageToneEiRK7QString @ 9 NONAME - _ZN14CpProfileModel14setOffLineModeEb @ 10 NONAME - _ZN14CpProfileModel14setSilenceModeEb @ 11 NONAME - _ZN14CpProfileModel15activateProfileEi @ 12 NONAME - _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 13 NONAME - _ZN14CpProfileModel15setMasterVolumeEi @ 14 NONAME - _ZN14CpProfileModel15setMessageVibraEib @ 15 NONAME - _ZN14CpProfileModel15setReminderToneEiRK7QString @ 16 NONAME - _ZN14CpProfileModel16setReminderVibraEib @ 17 NONAME - _ZN14CpProfileModel16staticMetaObjectE @ 18 NONAME DATA 16 - _ZN14CpProfileModel17setRingAlertVibraEib @ 19 NONAME - _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 20 NONAME - _ZN14CpProfileModel19getStaticMetaObjectEv @ 21 NONAME - _ZN14CpProfileModel19setNotificationToneEib @ 22 NONAME - _ZN14CpProfileModel20setNotificationVibraEib @ 23 NONAME - _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 24 NONAME - _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 25 NONAME - _ZN14CpProfileModelC1EP7QObject @ 26 NONAME - _ZN14CpProfileModelC2EP7QObject @ 27 NONAME - _ZN14CpProfileModelD0Ev @ 28 NONAME - _ZN14CpProfileModelD1Ev @ 29 NONAME - _ZN14CpProfileModelD2Ev @ 30 NONAME - _ZNK14CpProfileModel10emailVibraEi @ 31 NONAME - _ZNK14CpProfileModel10metaObjectEv @ 32 NONAME - _ZNK14CpProfileModel11masterVibraEv @ 33 NONAME - _ZNK14CpProfileModel11messageToneEi @ 34 NONAME - _ZNK14CpProfileModel11offLineModeEv @ 35 NONAME - _ZNK14CpProfileModel11profileNameEi @ 36 NONAME - _ZNK14CpProfileModel11silenceModeEv @ 37 NONAME - _ZNK14CpProfileModel12masterVolumeEv @ 38 NONAME - _ZNK14CpProfileModel12messageVibraEi @ 39 NONAME - _ZNK14CpProfileModel12profileNamesEv @ 40 NONAME - _ZNK14CpProfileModel12reminderToneEi @ 41 NONAME - _ZNK14CpProfileModel13reminderVibraEi @ 42 NONAME - _ZNK14CpProfileModel14ringAlertVibraEi @ 43 NONAME - _ZNK14CpProfileModel15activeProfileIdEv @ 44 NONAME - _ZNK14CpProfileModel16notificationToneEi @ 45 NONAME - _ZNK14CpProfileModel17notificationVibraEi @ 46 NONAME - _ZNK14CpProfileModel18keyTouchScreenToneEi @ 47 NONAME - _ZNK14CpProfileModel19keyTouchScreenVibraEi @ 48 NONAME - _ZNK14CpProfileModel8ringToneEi @ 49 NONAME - _ZNK14CpProfileModel8ringToneEv @ 50 NONAME - _ZNK14CpProfileModel9emailToneEi @ 51 NONAME - _ZTI14CpProfileModel @ 52 NONAME - _ZTV14CpProfileModel @ 53 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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -19,49 +19,47 @@ #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 the result of the initiation - */ -int CpProfileModel::initiationFlag() -{ - return d_ptr->initiationFlag(); -} - -/* - * Get profile name with its id +/*! + Get profile name with its id */ QString CpProfileModel::profileName(int profileId) const { return d_ptr->profileName(profileId); } /*! - * get profile name list + get profile name list */ QStringList CpProfileModel::profileNames()const { return d_ptr->profileNames(); } -/* - * Activate a profile with its id, return the operation code. +/*! + 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 +/*! + Get active profile's id */ int CpProfileModel::activeProfileId() const { @@ -79,14 +77,13 @@ /*! Set profile settings from center repository keys */ -int CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings ) +void CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings ) { return d_ptr->setProfileSettings(profileId, profileSettings); } /*! - Get ring tone of profiles, if the general profile's ring tone is different with - meeting ring tone, it returns the general profile's ring tone + Get ring tone of active profile */ QString CpProfileModel::ringTone() const { @@ -102,7 +99,7 @@ } /*! - Return master volume for device + Return ringing volume of device */ int CpProfileModel::masterVolume() const { @@ -110,7 +107,7 @@ } /*! - Set device's master volume + Set device's ringing volume */ void CpProfileModel::setMasterVolume(int volume) { @@ -126,9 +123,7 @@ } /*! - Set the master vibra's status of device, if the master vibra is on, - the vibra settings in profiles are valid, if the master is off, the - vibra settings in profiles are invalid. + Set the master vibra's status of device */ void CpProfileModel::setMasterVibra(bool isVibra) { @@ -136,8 +131,7 @@ } /*! - Return the silence mode of device, silence mode will kill all outgoing - audio. + Return the silence mode of device */ bool CpProfileModel::silenceMode() const { @@ -153,346 +147,137 @@ } /*! - Return the status of off line mode (air plane mode) of device + Get profile's ring tone, if the profile id is invalid, always return an empty string + \param profileId profile's id */ -bool CpProfileModel::offLineMode() const -{ - return d_ptr->offLineMode(); -} - -/*! - Set off line mode of device - */ -void CpProfileModel::setOffLineMode(bool isOffLine) -{ - d_ptr->setOffLineMode(isOffLine); -} - 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); } -bool CpProfileModel::ringAlertVibra(int profileId) const -{ - return d_ptr->ringAlertVibra(profileId); -} - -void CpProfileModel::setRingAlertVibra(int profileId, bool isActive) -{ - d_ptr->setRingAlertVibra(profileId,isActive); -} - -bool CpProfileModel::messageVibra(int profileId) const +/*! + 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->messageVibra(profileId); -} - -void CpProfileModel::setMessageVibra(int profileId, bool isActive) -{ - return d_ptr->setMessageVibra(profileId,isActive); -} - -bool CpProfileModel::emailVibra(int profileId) const -{ - return d_ptr->emailVibra(profileId); + return d_ptr->keyTouchScreenVibra(profileId); } -void CpProfileModel::setEmailVibra(int profileId, bool isActive) -{ - d_ptr->setEmailVibra(profileId,isActive); -} - -bool CpProfileModel::reminderVibra(int profileId) const -{ - return d_ptr->reminderVibra(profileId); -} - -void CpProfileModel::setReminderVibra(int profileId, bool isActive) -{ - d_ptr->setReminderVibra(profileId,isActive); -} - -bool CpProfileModel::notificationVibra(int profileId) const -{ - return d_ptr->notificationVibra(profileId); -} - -void CpProfileModel::setNotificationVibra(int profileId, bool isActive) -{ - d_ptr->setNotificationVibra(profileId,isActive); -} - -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); } -///* -// * Set a profile as current editing profile -// */ -//int CpProfileModel::setEditingProfile(int profileId) -//{ -// return d_ptr->setEditingProfile(profileId); -//} -// -///* -// * Get path and file name of ring tone file -// */ -//QString CpProfileModel::ringTone() -//{ -// return d_ptr->ringTone(); -//} -// -///* -// * Set path and file to ring tone -// */ -//int CpProfileModel::setRingTone(const QString& filePath) -//{ -// int err = d_ptr->setRingTone(filePath); -// return err; -//} -// -///* -// * Get path and file name of message tone file -// */ -//QString CpProfileModel::messageTone() -//{ -// return d_ptr->messageTone(); -//} -// -///* -// * Set path and file to message tone -// */ -//int CpProfileModel::setMessageTone(const QString& filePath) -//{ -// int err = d_ptr->setMessageTone(filePath); -// return err; -//} -// -///* -// * Get path and file name of email tone file -// */ -//QString CpProfileModel::emailTone() -//{ -// return d_ptr->emailTone(); -//} -// -///* -// * Set path and file to email tone -// */ -//int CpProfileModel::setEmailTone(const QString& filePath) -//{ -// int err = d_ptr->setEmailTone(filePath); -// return err; -//} -// -///* -// * Get path and file name of calendar event tone file -// */ -//QString CpProfileModel::calendarTone() -//{ -// return d_ptr->calendarTone(); -//} -// -///* -// * Set path and file to calendar event tone -// */ -//void CpProfileModel::setCalendarTone(const QString& filePath) -//{ -// d_ptr->setCalendarTone(filePath); -//} -// -///* -// * Get path and file name of clock alarm tone file -// */ -//QString CpProfileModel::alarmTone() -//{ -// return d_ptr->alarmTone(); -//} -// -///* -// * Set path and file to clock alarm tone -// */ -//void CpProfileModel::setAlarmTone(const QString& filePath) -//{ -// d_ptr->setAlarmTone(filePath); -//} -// -///* -// * Get the value of master volume -// */ -//int CpProfileModel::ringVolume() -//{ -// return d_ptr->ringVolume(); -//} -// -///* -// * Set master volume, the value should be between 1-10 -// */ -//void CpProfileModel::setRingVolume(int volume) -//{ -// d_ptr->setRingVolume(volume); -//} -// -///* -// * Activate master volume to beep -// */ -//void CpProfileModel::activateBeep() -//{ -// d_ptr->activateBeep(); -//} -// -///* -// * Get beep status in master volume -// */ -//bool CpProfileModel::isBeep() -//{ -// return d_ptr->isBeep(); -//} -// -///* -// * Activate master volume to silent -// */ -//void CpProfileModel::activateSilent() -//{ -// d_ptr->activateSilent(); -//} -// -///* -// * Get silent status in master volume -// */ -//bool CpProfileModel::isSilent() -//{ -// return d_ptr->isSilent(); -//} -// -///* -// * Get master vibra's status -// */ -//bool CpProfileModel::vibraStatus() -//{ -// return d_ptr->vibraStatus(); -//} -// -///* -// * Set master vibra's status -// */ -//void CpProfileModel::setVibraStatus(bool status) -//{ -// d_ptr->setVibraStatus(status); -//} -// -///* -// * Get keypad' volume -// */ -//int CpProfileModel::keyVolume() -//{ -// return d_ptr->keyVolume(); -//} -// -///* -// * Set keypad's volume, -// * the value of the volume should be between 0-3 -// */ -//void CpProfileModel::setKeyVolume(int volume) -//{ -// d_ptr->setKeyVolume(volume); -//} -// -///* -// * Get screen tone's volume -// */ -//int CpProfileModel::screenVolume() -//{ -// return d_ptr->screenVolume(); -//} -// -///* -// * Set screen tone's volume, -// * the value of the volume should be between 0-3 -// */ -//void CpProfileModel::setScreenVolume(int volume) -//{ -// d_ptr->setScreenVolume(volume); -//} -// -///* -// * Get screen vibra's level -// */ -//int CpProfileModel::screenVibra() -//{ -// return d_ptr->screenVibra(); -//} -// -///* -// * Set screen vibra's level, -// * the value of the level should be between 0-3 -// */ -//void CpProfileModel::setScreenVibra(int volume) -//{ -// d_ptr->setScreenVibra(volume); -//} - // End of file diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -44,80 +44,60 @@ #include #include #include - - -QString stringFromDescriptor(const TDesC& dsp) -{ - return QString::fromUtf16(dsp.Ptr(), dsp.Length()); -} - -HBufC* descriptorFromString(const QString& str) -{ - TPtrC ptr(reinterpret_cast(str.utf16())); - return ptr.Alloc(); -} - +#include +#include +/* + * Constructor + */ CpProfileModelPrivate::CpProfileModelPrivate() : mEngine(0), - mInitErrFlag(0), - mOffLineCenRep(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."); - TRAPD( err, - mEngine = CreateProfileEngineExtended2L(); - mOffLineCenRep = CRepository::NewL( KCRUidCommunicationSettings ); - - /* - * 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.insert(0, mEngine->Profile2L(0)); // general id - mProfileList.insert(2, mEngine->Profile2L(2)); + 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);*/ ); - - // currently, reserve a error code for deal with low memory ... leave - // as known, qt in symbian exception safety's development is ongoing. - // we will follow the official way to deal with symbian leave or exception - mInitErrFlag = err; - CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END, err is." + QString(err) ); + 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(); } - foreach(MProfileExtended2* profile, mProfileList) - { - if (profile!=0 ) { - profile->Release(); - } + if (mProfileNames) { + delete mProfileNames; } - mProfileList.clear(); - delete mOffLineCenRep; -} - -/* - * Get the result of the initiation - */ -int CpProfileModelPrivate::initiationFlag() -{ - return mInitErrFlag; + mProfileList.clear(); } /* @@ -126,49 +106,55 @@ 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; +} -// MProfileName* name = 0; -// TRAPD( err, *name = mEngine->ProfileL(profileId)->ProfileName(); ); -// -// if ( !err && name){ -// CPFW_LOG("CpProfileModelPrivate::profileName(), have name, END."); -// return stringFromDescriptor( name->Name() ); -// } else { -// CPFW_LOG("CpProfileModelPrivate::profileName(), no name, END."); -// return ""; -// } - // should return qt localized profile name - // engine return symbian localized name, that is a wrong way to got it - // so hard code here, wait for engine's correcting. - switch (profileId) { - case EProfileWrapperGeneralId: - return hbTrId("txt_cp_list_general"); - case EProfileWrapperMeetingId: - return hbTrId("txt_cp_list_meeting"); - default: - return QString(""); - } -} +/* + * Get available profiles' name list. + */ QStringList CpProfileModelPrivate::profileNames() const { - //hard code, until engine part support qt localized name + CPFW_LOG("CpProfileModelPrivate::profileNames(), START."); QStringList nameList; - nameList<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 operation code. + * 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 ); - //UpdateProfileSettingsL( profileId ); ); CPFW_LOG("CpProfileModelPrivate::activateProfile(), END."); return err; @@ -182,540 +168,534 @@ return mEngine->ActiveProfileId(); } +/* + * Return all profile settings according to profile's id + */ void CpProfileModelPrivate::profileSettings(int profileId, CpProfileSettings& profileSettings) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - 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 = stringFromDescriptor(setTones.RingingTone1()); - profileSettings.mMessageTone = stringFromDescriptor(setTones.MessageAlertTone()); - profileSettings.mEmailTone = stringFromDescriptor(extTones.EmailAlertTone()); - profileSettings.mReminderTone = stringFromDescriptor(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.mRingAlertVibra = vibraSettings.RingAlertVibra(); - profileSettings.mMessageVibra = vibraSettings.MessageAlertVibra(); - profileSettings.mEmailVibra = vibraSettings.EmailAlertVibra(); - profileSettings.mReminderAlertVibra = vibraSettings.ReminderAlarmVibra(); - profileSettings.mNotificationVibra = vibraSettings.InformationVibra(); - profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); - + 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 - \param profileId identify the profile - \param profileSettings value of profile options +/* + * set profile settings */ -int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) +void CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TProfileToneSettings &toneSettings = setTones.SetToneSettings(); - MProfileSetExtraTones2 &setExtTones = - profileExtend->ProfileSetExtraTones2(); - MProfileSetVibraSettings &setVibraSettings = - profileExtend->ProfileSetVibraSettings(); - MProfileSetExtraSettings &extraSettings = - profileExtend->ProfileSetExtraSettings(); - MProfileSetFeedbackSettings &setFeedbackSettings = - extraSettings.ProfileSetFeedbackSettings(); + if (!isValidProfile(profileId)) { + return; + } - TRAP_IGNORE( - setTones.SetRingingTone1L(*descriptorFromString( - profileSettings.mRingTone)); - setTones.SetMessageAlertToneL(*descriptorFromString( - profileSettings.mMessageTone)); - setExtTones.SetEmailAlertToneL(*descriptorFromString( - profileSettings.mEmailTone)); - setExtTones.SetReminderToneL(*descriptorFromString( - 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)); - - setVibraSettings.SetRingAlertVibra(profileSettings.mRingAlertVibra); - setVibraSettings.SetMessageAlertVibra(profileSettings.mMessageVibra); - setVibraSettings.SetEmailAlertVibra(profileSettings.mEmailVibra); - setVibraSettings.SetReminderAlarmVibra( - profileSettings.mReminderAlertVibra); - setVibraSettings.SetInformationVibra( - profileSettings.mNotificationVibra); - setFeedbackSettings.SetTactileFeedback( - static_cast (profileSettings.mKeyTouchScreenVibra)); + 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)); - TRAPD(err, - mEngine->CommitChangeL(*profileExtend); + 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 ) - return err; } +/* + * Get the active profile's ring tone name + */ QString CpProfileModelPrivate::ringTone() const { - MProfileExtended2 *profileExtend = mProfileList.value(EProfileWrapperGeneralId); - QString ringTone = stringFromDescriptor( - profileExtend->ProfileTones().RingingTone1()); + // 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) -{ - int ids[] = {EProfileWrapperGeneralId,EProfileWrapperMeetingId}; - - for (TInt i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i) { - MProfileExtended2 *profileExtend = mProfileList.value(ids[i]); - - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TRAP_IGNORE( - setTones.SetRingingTone1L( *descriptorFromString(filePath) ); - mEngine ->CommitChangeL(*profileExtend); - ) - // ERROR SHOULD BE DEAL HERE OR RETURN A ERROR CODE +{ + 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; - TRAP_IGNORE(masterVolume = mEngine->MasterVolumeL();) + QT_TRAP_THROWING(masterVolume = mEngine->MasterVolumeL();) return masterVolume; } +/* + * Set the ringing volume + */ void CpProfileModelPrivate::setMasterVolume(int volume) { - TRAP_IGNORE(mEngine->SetMasterVolumeL( 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; - TRAP_IGNORE(masterVibra = mEngine->MasterVibraL();) + QT_TRAP_THROWING(masterVibra = mEngine->MasterVibraL();) return masterVibra; } + +/* + * Set master vibra's status + */ void CpProfileModelPrivate::setMasterVibra(bool isVibra) { - TRAP_IGNORE(mEngine->SetMasterVibraL( isVibra );) + QT_TRAP_THROWING(mEngine->SetMasterVibraL( isVibra );) } +/* + * Get the status of silence mode. + */ bool CpProfileModelPrivate::silenceMode() const { bool isSlience = false; - TRAP_IGNORE(isSlience = mEngine->SilenceModeL();) + QT_TRAP_THROWING(isSlience = mEngine->SilenceModeL();) return isSlience; } + +/* + * Set the status of silence mode + */ void CpProfileModelPrivate::setSilenceMode(bool isSilence) { - TRAP_IGNORE(mEngine->SetSilenceModeL( isSilence );) + QT_TRAP_THROWING(mEngine->SetSilenceModeL( isSilence );) } -bool CpProfileModelPrivate::offLineMode() const -{ - int offLineMode = 0; - // What we should do if we can't set offline mode - mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode ); - - return offLineMode; -} -void CpProfileModelPrivate::setOffLineMode(bool isOffLine) -{ - mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine); -} - +/* + * Return the ring tone of a profile, if the profile id is invalid, always + * return an empty string + */ QString CpProfileModelPrivate::ringTone(int profileId) const { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - const MProfileTones &setTones = profileExtend->ProfileTones(); - - QString ringTone = stringFromDescriptor(setTones.RingingTone1()); + 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) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TRAP_IGNORE( - setTones.SetRingingTone1L(*descriptorFromString(filePath)); - mEngine->CommitChangeL(*profileExtend); - ) + 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 { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); + 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(); + ) - const MProfileTones &setTones = profileExtend->ProfileTones(); - - QString messageTone = stringFromDescriptor(setTones.MessageAlertTone()); - 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) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetTones &setTones = + if(!isValidProfile(profileId)) { + return; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TRAP_IGNORE( - setTones.SetMessageAlertToneL(*descriptorFromString(filePath)); + 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 { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - const MProfileExtraTones2 &extTones = - profileExtend->ProfileExtraTones2(); + QString emailTone; + + if(!isValidProfile(profileId)) { + return emailTone; + } + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); + const MProfileExtraTones2 &extTones = + profileExtend->ProfileExtraTones2(); - QString emailTone = stringFromDescriptor(extTones.EmailAlertTone()); - return emailTone; + 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) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetExtraTones2 &setExtTones = - profileExtend->ProfileSetExtraTones2(); - TRAP_IGNORE ( - setExtTones.SetEmailAlertToneL(*descriptorFromString(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 { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); - - QString reminderTone = stringFromDescriptor(extTones.ReminderTone()); + 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) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); - - TRAP_IGNORE( - setExtTones.SetReminderToneL( *descriptorFromString(filePath) ); - mEngine->CommitChangeL(*profileExtend); + 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 { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - const MProfileTones &setTones = profileExtend->ProfileTones(); - const TProfileToneSettings &toneSettings = setTones.ToneSettings(); - - bool notificationTone = toneSettings.iWarningAndGameTones; - return notificationTone; + 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) { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TProfileToneSettings &toneSettings = setTones.SetToneSettings(); + 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; - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) + toneSettings.iWarningAndGameTones = isActive; + + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) } -/*! - return key & touch screen tone's value - \sa setKeyTouchScreenTone +/* + * Get key & touch screen tone's value, if the profile id + * is invalid, always return 0 */ int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const { - MProfileExtended2 *profileExtend = mProfileList.value(profileId); + int level = 0; + if(!isValidProfile(profileId)) { + return level; + } - const MProfileTones &setTones = profileExtend->ProfileTones(); - const TProfileToneSettings &toneSettings = setTones.ToneSettings(); + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); - int keyTouchScreenTone = toneSettings.iKeypadVolume; - return keyTouchScreenTone; + 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 - \param profileId identify the profile - \param level 0-5 - \sa keyTouchScreenTone +/* + * set key & touch screen tone, if the profile id + * is invalid, nothing happens */ void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) -{ - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetTones &setTones = - profileExtend->ProfileSetTones(); - TProfileToneSettings &toneSettings = - setTones.SetToneSettings(); +{ + if(!isValidProfile(profileId)) { + return ; + } + QT_TRAP_THROWING( - MProfileSetExtraSettings &extraSettings = - profileExtend->ProfileSetExtraSettings(); - MProfileSetFeedbackSettings &setFeedbackSettings = - extraSettings.ProfileSetFeedbackSettings(); - - toneSettings.iKeypadVolume - = static_cast (level); - - setFeedbackSettings.SetAudioFeedback( - static_cast (level)); - TRAP_IGNORE ( - mEngine->CommitChangeL(*profileExtend); + 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(); ) } -bool CpProfileModelPrivate::ringAlertVibra(int profileId) const -{ - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return false; - } - CleanupReleasePushL(*profileExtend); - const MProfileVibraSettings &vibraSettings = - profileExtend->ProfileVibraSettings(); - - - bool ringAlertVibra = vibraSettings.RingAlertVibra(); - CleanupStack::PopAndDestroy(profileExtend); - return ringAlertVibra; - -} - -void CpProfileModelPrivate::setRingAlertVibra(int profileId, bool isActive) -{ - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); - - setVibraSettings.SetRingAlertVibra(isActive); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } -} - -bool CpProfileModelPrivate::messageVibra(int profileId) const +/* + * Get key touch screen vibra's value of a profile, return 0 if the + * profile id is invalid + */ +int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return false; - } - CleanupReleasePushL(*profileExtend); - const MProfileVibraSettings &vibraSettings = - profileExtend->ProfileVibraSettings(); - - - bool messageVibra = vibraSettings.MessageAlertVibra(); - CleanupStack::PopAndDestroy(profileExtend); - return messageVibra; - -} + 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(); -void CpProfileModelPrivate::setMessageVibra(int profileId, bool isActive) -{ - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); - - setVibraSettings.SetMessageAlertVibra(isActive); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } -} - -bool CpProfileModelPrivate::emailVibra(int profileId) const -{ - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return false; - } - CleanupReleasePushL(*profileExtend); - const MProfileVibraSettings &vibraSettings = - profileExtend->ProfileVibraSettings(); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) - - bool emailVibra = vibraSettings.EmailAlertVibra(); - - CleanupStack::PopAndDestroy(profileExtend); - return emailVibra; - + return level; } -void CpProfileModelPrivate::setEmailVibra(int profileId, bool isActive) +/* + * Set key & touch screen vibra for a profile, + * if the profile id is invalid, nothing happens + */ +void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); - - setVibraSettings.SetEmailAlertVibra ( isActive ); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } -} - -bool CpProfileModelPrivate::reminderVibra(int profileId) const -{ - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return false; + if(!isValidProfile(profileId)) { + return ; } - CleanupReleasePushL(*profileExtend); - const MProfileVibraSettings &vibraSettings = - profileExtend->ProfileVibraSettings(); - - - bool reminderAlarmVibra = vibraSettings.ReminderAlarmVibra(); - - CleanupStack::PopAndDestroy(profileExtend); - return reminderAlarmVibra; - -} + QT_TRAP_THROWING( + MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); + CleanupStack::PushL(profileExtend); -void CpProfileModelPrivate::setReminderVibra(int profileId, bool isActive) -{ - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); - - setVibraSettings.SetReminderAlarmVibra ( isActive ); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + setFeedbackSettings.SetTactileFeedback( + static_cast (level)); + mEngine->CommitChangeL(*profileExtend); + CleanupStack::Pop(); // profileExtend + profileExtend->Release(); + ) } -bool CpProfileModelPrivate::notificationVibra(int profileId) const -{ - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return false; - } - CleanupReleasePushL(*profileExtend); - const MProfileVibraSettings &vibraSettings = - profileExtend->ProfileVibraSettings(); - - - bool notificationVibra = vibraSettings.InformationVibra(); - - CleanupStack::PopAndDestroy(profileExtend); - return notificationVibra; - -} +/* + * Judge the profile is valid or not + */ -void CpProfileModelPrivate::setNotificationVibra(int profileId, bool isActive) +bool CpProfileModelPrivate::isValidProfile(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); - - setVibraSettings.SetInformationVibra( isActive ); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } -} - -int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const -{ - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - - const MProfileExtraSettings &extraSettings = - profileExtend->ProfileExtraSettings(); - const MProfileFeedbackSettings &feedbackSettings = - extraSettings.ProfileFeedbackSettings(); - - int keyTouchScreenVibra = feedbackSettings.TactileFeedback(); - return keyTouchScreenVibra; -} - -void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) -{ - MProfileExtended2 *profileExtend = mProfileList.value(profileId); - MProfileSetExtraSettings &extraSettings = - profileExtend->ProfileSetExtraSettings(); - MProfileSetFeedbackSettings &setFeedbackSettings = - extraSettings.ProfileSetFeedbackSettings(); - setFeedbackSettings.SetTactileFeedback( - static_cast (level)); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) + return mProfileList.contains(profileId); } // End of file diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Tue Aug 24 10:56:32 2010 +0800 @@ -19,7 +19,7 @@ #define CPPROFILEMODEL_P_H #include -#include +#include class CpProfileModel; class CpProfileSettings; class MProfileEngineExtended2; @@ -28,8 +28,8 @@ class MProfileSetFeedbackSettings; class CRepository; class QStringList; -struct TProfileToneSettings; - +class MProfilesNamesArray; +struct TProfileToneSettings; class CpProfileModelPrivate { Q_DECLARE_PUBLIC(CpProfileModel) @@ -38,17 +38,13 @@ ~CpProfileModelPrivate(); void initialize(CpProfileModel *parent); public: - int initiationFlag(); - QString profileName(int profileId)const; + QString profileName(int profileId) const; QStringList profileNames() const; int activateProfile(int profileId); int activeProfileId() const; void profileSettings(int profileId, CpProfileSettings& profileSettings); - int setProfileSettings(int profileId, CpProfileSettings& profileSettings); + void setProfileSettings(int profileId, CpProfileSettings& profileSettings); - /*! - * set ring tone in personalization group in control panel's homeview - */ QString ringTone() const; void setRingTone(const QString& filePath); @@ -61,9 +57,6 @@ bool silenceMode() const; void setSilenceMode(bool isSlience); - bool offLineMode() const; - void setOffLineMode(bool isOffLine); - QString ringTone(int profileId)const; void setRingTone(int profileId, const QString& filePath); QString messageTone(int profileId) const; @@ -79,66 +72,21 @@ int keyTouchScreenTone(int profileId) const; void setKeyTouchScreenTone(int profileId, int level); - bool ringAlertVibra(int profileId) const; - void setRingAlertVibra(int profileId, bool isActive); - - bool messageVibra(int profileId) const; - void setMessageVibra(int profileId, bool isActive); - - bool emailVibra(int profileId) const; - void setEmailVibra(int profileId, bool isActive); - - bool reminderVibra(int profileId) const; - void setReminderVibra(int profileId, bool isActive) ; - - bool notificationVibra(int profileId) const; - void setNotificationVibra(int profileId, bool isActive); - int keyTouchScreenVibra(int profileId)const; void setKeyTouchScreenVibra(int profileId, int level); - /* int setEditingProfile(int profileId); - QString ringTone(); - int setRingTone(const QString& filePath); - QString messageTone(); - int setMessageTone(const QString& filePath); - QString emailTone(); - int setEmailTone(const QString& filePath); - QString calendarTone(); - void setCalendarTone(const QString& filePath); - QString alarmTone(); - void setAlarmTone(const QString& filePath); - int ringVolume(); - void setRingVolume(int volume); - void activateBeep(); - bool isBeep(); - void activateSilent(); - bool isSilent(); - bool vibraStatus(); - void setVibraStatus(bool status); - int keyVolume(); - void setKeyVolume(int volume); - int screenVolume(); - void setScreenVolume(int volume); - int screenVibra(); - void setScreenVibra(int volume); - */ -#ifdef Q_OS_SYMBIAN -private: - //void UpdateProfileSettingsL(int profileId); - //int commitChange(); private: + bool isValidProfile(int profileId) const; + +private: +#ifdef Q_OS_SYMBIAN MProfileEngineExtended2 *mEngine; - QMap mProfileList; - //MProfileExtended2 *mProfileExt; - //TProfileToneSettings *mToneSettings; - //const MProfileFeedbackSettings *mFeedbackSettings; - //MProfileSetFeedbackSettings *mSetFeedbackSettings; - //CRepository *mVibraCenRep; - int mInitErrFlag; - CRepository *mOffLineCenRep; + // Valid profile id list + QList mProfileList; + MProfilesNamesArray *mProfileNames; + +#endif // Q_OS_SYMBIAN CpProfileModel *q_ptr; -#endif // Q_OS_SYMBIAN }; #endif diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound.aac Binary file controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound.aac has changed diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound2.aac Binary file controlpanelui/src/cpprofilewrapper/tsrc/ut_cpprofilemodel/data/testsound2.aac has changed diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpringtoneview/cpringtoneview.pro --- a/controlpanelui/src/cpringtoneview/cpringtoneview.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpringtoneview/cpringtoneview.pro Tue Aug 24 10:56:32 2010 +0800 @@ -21,7 +21,7 @@ CONFIG += hb DEFINES += CPRINGTONEVIEW_LIBRARY symbian { - LIBS += -lcpprofilewrapper -lcpframework -lxqservice -lxqserviceutil + LIBS += -lcpprofilewrapper -lcplogger -lcpframework -lxqservice -lxqserviceutil TARGET.UID3 = 0X2002873A TARGET.CAPABILITY = All -TCB TARGET.EPOCALLOWDLLDATA = 1 diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpserviceprovider/cpserviceprovider.pro --- a/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Tue Aug 24 10:56:32 2010 +0800 @@ -14,8 +14,8 @@ # Description: cpserviceprovider project - qmake settings # -TEMPLATE=app -TARGET=cpserviceprovider +TEMPLATE = app +TARGET = cpserviceprovider CONFIG += hb service symbian:TARGET.UID3 = 0x2002873F @@ -23,12 +23,11 @@ include( ../common.pri ) include( cpserviceprovider.pri ) -LIBS+=-lxqservice -lxqserviceutil -lcpframework +# DEFINES += ENABLE_CPSP_LOG +RESOURCES += cpserviceprovider.qrc + +LIBS += -lxqservice -lxqserviceutil -lcplogger -lcpframework SERVICE.FILE = service_conf.xml SERVICE.OPTIONS = embeddable SERVICE.OPTIONS += hidden - -libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" -DEPLOYMENT += libFiles diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpserviceprovider/cpserviceprovider.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.qrc Tue Aug 24 10:56:32 2010 +0800 @@ -0,0 +1,5 @@ + + + data/cpserviceproviderlog.conf + + \ No newline at end of file diff -r 313976a11e23 -r 0cfa53de576f 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 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp --- a/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -29,20 +29,24 @@ mAsyncRequestIndex(-1), mReturnValue(false) { - CPSP_LOG("CpLauncherService Constructing..."); + CPSP_LOG_FUNC_ENTRY("CpLauncherService::CpLauncherService") + publishAll(); connect(this,SIGNAL(clientDisconnected()),this,SLOT(handleClientDisconnected())); } CpLauncherService::~CpLauncherService() { - CPSP_LOG("CpLauncherService Destructing..."); + 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()) ); + mAsyncRequestIndex).arg(mReturnValue.toBool()) ) + bool ret = completeRequest(mAsyncRequestIndex, mReturnValue); mAsyncRequestIndex = -1; return ret; @@ -50,12 +54,14 @@ 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("Entering CpLauncherService::launchSettingView"); + CPSP_LOG_FUNC_ENTRY("CpLauncherService::launchSettingView"); mAsyncRequestIndex = setCurrentRequestAsync(); @@ -83,14 +89,14 @@ qApp->quit(); //quit application if loading plugin failed or creating setting view failed. } } - - CPSP_LOG("Leaving CpLauncherService::launchSettingView"); return succeed; } void CpLauncherService::handleClientDisconnected() { + CPSP_LOG_FUNC_ENTRY("CpLauncherService::handleClientDisconnected") + qApp->quit(); } diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp --- a/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -24,17 +24,20 @@ CpServiceMainWindow::CpServiceMainWindow(QWidget *parent /* = 0*/) : HbMainWindow(parent), mLauncherService(0), mPreviousView(0) { - CPSP_LOG("CpServiceMainWindow Constructing..."); + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::CpServiceMainWindow") + mLauncherService = new CpLauncherService(this); } CpServiceMainWindow::~CpServiceMainWindow() { - CPSP_LOG("CpServiceMainWindow Destructing..."); + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::~CpServiceMainWindow") } void CpServiceMainWindow::setSettingView(CpBaseSettingView *settingView) { + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::setSettingView") + mSettingViewPointer = settingView; mPreviousView = currentView(); @@ -46,7 +49,7 @@ void CpServiceMainWindow::quit() { - CPSP_LOG("CpServiceMainWindow::quit()"); + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::quit"); closeSettingView(); @@ -65,6 +68,8 @@ void CpServiceMainWindow::closeSettingView() { + CPSP_LOG_FUNC_ENTRY("CpServiceMainWindow::closeSettingView") + if (mSettingViewPointer) { removeView(mSettingViewPointer); mSettingViewPointer->deleteLater(); diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpserviceprovider/src/cpsplogger.h --- a/controlpanelui/src/cpserviceprovider/src/cpsplogger.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/cpsplogger.h Tue Aug 24 10:56:32 2010 +0800 @@ -21,18 +21,16 @@ #include #include -#define CPSP_LOGGER_NAME QLatin1String("CpServiceProvider") +#ifdef ENABLE_CPSP_LOG + #define CPSP_LOGGER_NAME QLatin1String("CpServiceProvider") + #define CPSP_LOGGER_CONFIG_PATH QLatin1String(":/logconf/cpserviceproviderlog.conf") -#if defined (Q_OS_SYMBIAN) - #define CPSP_LOGGER_CONFIG_PATH QLatin1String("C:/data/.config/cpserviceproviderlog.conf") -#elif defined (Q_WS_WIN) - #ifdef _DEBUG - #define CPSP_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/debug/bin/cpserviceproviderlog.conf") - #else - #define CPSP_LOGGER_CONFIG_PATH QLatin1String("C:/controlpanel/release/bin/cpserviceproviderlog.conf") - #endif + #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 -#define CPSP_LOG(str) Logger::instance(CPSP_LOGGER_NAME)->log(str); #endif diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/cpserviceprovider/src/main.cpp --- a/controlpanelui/src/cpserviceprovider/src/main.cpp Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/cpserviceprovider/src/main.cpp Tue Aug 24 10:56:32 2010 +0800 @@ -16,8 +16,7 @@ */ #include #include -#include -#include +#include #include #include "cpservicemainwindow.h" #include "cpsplogger.h" @@ -25,29 +24,29 @@ int main(int argc, char **argv) { HbApplication app(argc,argv ); + +#ifdef ENABLE_CPSP_LOG + INIT_LOGGER(CPSP_LOGGER_NAME,CPSP_LOGGER_CONFIG_PATH) +#endif - Logger::instance(CPSP_LOGGER_NAME)->configure( - CPSP_LOGGER_CONFIG_PATH,QSettings::IniFormat); CPSP_LOG("Entering CpServiceProvider.exe..."); - QTranslator translator; - if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations")) - { - qApp->installTranslator(&translator); - } + HbTranslator translator("control_panel"); + translator.loadCommon(); HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css"); HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css"); HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml"); CpServiceMainWindow wnd; - wnd.show(); + /* + 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."); - - Logger::closeAll(); return ret; } diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/inc/cpcategorysettingformitemdata.h --- a/controlpanelui/src/inc/cpcategorysettingformitemdata.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/inc/cpcategorysettingformitemdata.h Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: An extension to CpSettingFormItemData, can be filled with model items comes from controlpanel plugins. * */ #ifndef CPCATEGORYSETTINGFORMITEMDATA_H @@ -44,3 +44,5 @@ }; #endif + +//End of File diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/inc/cpcategorysettingformmodel.h --- a/controlpanelui/src/inc/cpcategorysettingformmodel.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/inc/cpcategorysettingformmodel.h Tue Aug 24 10:56:32 2010 +0800 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: An extension to HbDataFormModel, can be filled with model items comes from controlpanel plugins. * */ #ifndef CPCATEGORYSETTINGFORMMODEL_H @@ -37,5 +37,7 @@ CpCategorySettingFormModelPrivate *d; }; +#endif -#endif +//End of File + diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/inc/cpprofilemodel.h --- a/controlpanelui/src/inc/cpprofilemodel.h Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/inc/cpprofilemodel.h Tue Aug 24 10:56:32 2010 +0800 @@ -44,11 +44,6 @@ bool mNotificationTone; int mKeyTouchScreenTone; // 0-5 - bool mRingAlertVibra; - bool mMessageVibra; - bool mEmailVibra; - bool mReminderAlertVibra; - bool mNotificationVibra; int mKeyTouchScreenVibra; //0-5 }; class PROFILE_WRAPPER_EXPORT CpProfileModel : QObject @@ -59,23 +54,17 @@ ~CpProfileModel(); public: - int initiationFlag(); QString profileName(int profileId)const; QStringList profileNames()const; int activateProfile(int profileId); int activeProfileId() const; - void profileSettings(int profileId, CpProfileSettings& profileSettings); - int setProfileSettings(int profileId, CpProfileSettings& profileSettings ); - /*! - * set ring tone in personalization group in control panel's homeview - */ + void profileSettings(int profileId, CpProfileSettings& profileSettings); + void setProfileSettings(int profileId, CpProfileSettings& profileSettings ); + QString ringTone() const; void setRingTone(const QString& filePath); - /* QString alarmTone(); - void setAlarmTone(const QString& filePath);*/ - int masterVolume() const; void setMasterVolume(int volume); @@ -86,9 +75,6 @@ bool silenceMode() const; void setSilenceMode(bool isSlience); - bool offLineMode() const; - void setOffLineMode(bool isOffLine); - /*! * For profile settings */ @@ -108,21 +94,6 @@ int keyTouchScreenTone(int profileId) const; void setKeyTouchScreenTone(int profileId, int level); - bool ringAlertVibra(int profileId) const; - void setRingAlertVibra(int profileId, bool isActive); - - bool messageVibra(int profileId) const; - void setMessageVibra(int profileId, bool isActive); - - bool emailVibra(int profileId) const; - void setEmailVibra(int profileId, bool isActive); - - bool reminderVibra(int profileId) const; - void setReminderVibra(int profileId, bool isActive); - - bool notificationVibra(int profileId) const; - void setNotificationVibra(int profileId, bool isActive); - int keyTouchScreenVibra(int profileId)const; void setKeyTouchScreenVibra(int profileId, int level); diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/src/inc/cpprofilemonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpprofilemonitor.h Tue Aug 24 10:56:32 2010 +0800 @@ -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 313976a11e23 -r 0cfa53de576f controlpanelui/src/tonefetcher/tonefetcher.pro --- a/controlpanelui/src/tonefetcher/tonefetcher.pro Thu Aug 05 11:28:29 2010 +0800 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Tue Aug 24 10:56:32 2010 +0800 @@ -22,6 +22,7 @@ include( tonefetcher.pri ) LIBS += -lxqservice \ -lxqserviceutil \ + -lcplogger \ -lcpframework \ -lxqutils symbian { diff -r 313976a11e23 -r 0cfa53de576f controlpanelui/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/tsrc/tsrc.pro Tue Aug 24 10:56:32 2010 +0800 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +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 +