Revision: 201031
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:49:35 +0300
changeset 31 e79ce701c376
parent 25 19394c261aa5
child 37 cb294e641644
Revision: 201031 Kit: 201033
controlpanelplugins/themeplugin/src/cpthemechanger.cpp
controlpanelplugins/themeplugin/src/cpthemechanger.h
controlpanelplugins/themeplugin/src/cpthemecontrol.cpp
controlpanelplugins/themeplugin/src/cpthemecontrol.h
controlpanelplugins/themeplugin/src/cpthemeinfo.h
controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp
controlpanelplugins/themeplugin/src/cpthemelistview.cpp
controlpanelplugins/themeplugin/src/cpthemelistview.h
controlpanelplugins/themeplugin/src/cpthemeplugin.cpp
controlpanelplugins/themeplugin/src/cpthemepreview.cpp
controlpanelplugins/themeplugin/src/cpthemepreview.h
controlpanelplugins/themeplugin/src/cpthemeutil.cpp
controlpanelplugins/themeplugin/src/cpthemeutil.h
controlpanelplugins/themeplugin/themeplugin.pro
controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp
controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp
controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h
controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp
controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp
controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp
controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp
controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp
controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp
controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h
controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp
controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp
controlpanelui/src/inc/cpringtoneview.h
controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h
controlpanelui/src/tonefetcher/src/main.cpp
controlpanelui/src/tonefetcher/src/tonefetcherview.cpp
controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp
controlpanelui/src/tonefetcher/src/tonefetcherwidget.h
controlpanelui/src/tonefetcher/tonefetcher.pro
controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp
controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -39,7 +39,9 @@
     QObject(p),
     mCurrentTheme(0)
 {
-    connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished()));
+    if(hbInstance->theme()) {
+        connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(changeFinished()));
+    }
        
     setCurrentTheme();
 }
@@ -73,8 +75,7 @@
        
     if(mCurrentTheme && mCurrentTheme->name() == themeName) {
         return;
-    }
-    else {
+    } else {
         //buildThemeInfo creates new theme info.
         CpThemeInfo* tmpTheme = CpThemeUtil::buildThemeInfo(HbThemeServices::themePath(), themeName);
          
@@ -92,15 +93,15 @@
 /*!
  Change a theme. Returns true on success, false otherwise.
  */
-bool CpThemeChanger::changeTheme(const QString& newTheme)
+bool CpThemeChanger::changeTheme(const CpThemeInfo& newTheme)
 {
     bool result = false;
     // Skip doing this if the request is for the current theme
-    if (newTheme.isEmpty() || newTheme == mCurrentTheme->name()) {
+    if (newTheme.name().isEmpty() || (mCurrentTheme && newTheme.name() == mCurrentTheme->name())) {
         return result;
     }
 
-    QString themePath = CpThemeUtil::themePath(newTheme);
+    QString themePath = newTheme.itemData();
     
     if(!themePath.isEmpty()) {
         HbThemeServices::setTheme(themePath);
@@ -124,9 +125,7 @@
  */
 void CpThemeChanger::changeFinished()
 {
-  
     setCurrentTheme();
-    
     emit themeChangeFinished();
 }
 
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h	Wed Aug 18 09:49:35 2010 +0300
@@ -39,7 +39,7 @@
     ~CpThemeChanger();
     
     const CpThemeInfo* currentTheme() const;
-    bool changeTheme(const QString& newtheme);
+    bool changeTheme(const CpThemeInfo& newtheme);
     
 signals:
     void themeChangeFinished();
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -50,6 +50,8 @@
 #include <hbdialog.h>
 #include <hblabel.h>
 
+//time out time before showing a processing dialog.
+static const int KThemeChangeTimeOutMilliSeconds = 2000;  
 
 /*!
 	Helper function to fetch the main window.
@@ -126,8 +128,8 @@
     
     
     //connect to signal for selecting a list item.
-    connect(mThemeListView,SIGNAL(newThemeSelected(const QModelIndex&)),
-            this,SLOT(newThemeSelected(const QModelIndex&)));
+    connect(mThemeListView,SIGNAL(newThemeSelected(QModelIndex)),
+            this,SLOT(newThemeSelected(QModelIndex)));
 
 	//handle signal for list view closing. (e.g Back softkey pressed)
     connect(mThemeListView,SIGNAL(aboutToClose()),
@@ -223,6 +225,11 @@
         themeInfo.setName(data.toString());
     }
     
+    data = index.data(CpThemeListModel::ItemDataRole);
+    if(data.isValid()) {
+        themeInfo.setItemData(data.toString());
+    }
+    
     //get theme icon.
     data = index.data(Qt::DecorationRole);
     if(data.isValid()) {
@@ -239,8 +246,12 @@
         themeInfo.setLandscapePreviewIcon(data.value<HbIcon>());
     }
     
+    
+#ifdef CP_THEME_PREVIEW_DEFINED    
+    
    //Set up the theme preview and set it to
     //the current view of main window.
+
     HbMainWindow*  mWindow = ::mainWindow();
    
     if(!mThemePreview){
@@ -250,21 +261,24 @@
         connect(mThemePreview,SIGNAL(aboutToClose()),
             this, SLOT(previewClosed()));
 
-        connect(mThemePreview, SIGNAL(applyTheme(const QString&)),
-                this, SLOT(themeApplied(const QString&)));
+        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
 
 }
 
 /*!
 	Slot called when a Select key is pressed in theme preview view.
 */
-void CpThemeControl::themeApplied(const QString& theme)
+void CpThemeControl::themeApplied(const CpThemeInfo& theme)
 {
     QThread::currentThread()->setPriority(QThread::HighPriority);  
     
@@ -273,13 +287,18 @@
         //Start a timer. If theme change takes more than 1 seconds,
         //we will show a dialog (mWaitDialog) until theme change
         //is done (themeChangeFinished is called).
-        QTimer::singleShot(1000, this, SLOT(themeWaitTimeout()));
+        QTimer::singleShot(KThemeChangeTimeOutMilliSeconds, this, SLOT(themeWaitTimeout()));
         
         mThemeChangeFinished = false;
     } else {
         //theme change failed, go back to control panel.
+#ifdef CP_THEME_PREVIEW_DEFINED
         previewClosed();
         triggerThemeListClose();
+#else
+        setActiveThemeIndex();
+#endif
+   
     }
    
 }
@@ -292,9 +311,11 @@
     //The theme preview closed, go back
     //to theme list view.
     HbMainWindow*  mainWindow = ::mainWindow();
-	mainWindow->removeView(mThemePreview);
-    mThemePreview->deleteLater();
-    mThemePreview = 0;
+    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.
@@ -331,12 +352,19 @@
     if(mWaitDialog && mWaitDialog->isVisible()) {
         mWaitDialog->hide();
     }
-    
-    previewClosed();
-    //ask the themelistview to close.  Control Panel will
-    //take care of removing it from window.
-    triggerThemeListClose();
-    
+   
+#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
+       
+
+  
     QThread::currentThread()->setPriority(QThread::NormalPriority); 
 }
 
@@ -344,16 +372,15 @@
 {
     //If after this timeOut, theme change is still in progress,
     //show a processing dialog.
-    if(!mThemeChangeFinished)
-    {
+    if(!mThemeChangeFinished){
         if(!mWaitDialog) {
             mWaitDialog = new HbDialog();
             mWaitDialog->setDismissPolicy(HbPopup::NoDismiss);
             mWaitDialog->setModal(false);
             mWaitDialog->setTimeout(HbPopup::NoTimeout);
-            //TODO: need localized text for Hb Dialog
             // Create and set HbLabel as content widget.
-            HbLabel *label = new HbLabel("Processing ...");
+            QString processingText = hbTrId("txt_common_info_processing") + QString("...");
+            HbLabel *label = new HbLabel(processingText);
             label->setAlignment(Qt::AlignCenter);
             mWaitDialog->setContentWidget(label);
         }
@@ -389,6 +416,9 @@
         //set current index.
         mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent);
     }
+    else {
+        mThemeListView->themeList()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear);
+    }
 }
     
 
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h	Wed Aug 18 09:49:35 2010 +0300
@@ -54,7 +54,7 @@
 public slots:
     void newThemeSelected(const QModelIndex& index);
     void previewClosed();
-    void themeApplied(const QString& theme);
+    void themeApplied(const CpThemeInfo& theme);
     void themeListClosed();
     void themeChangeTimeout();
     void themeWaitTimeout();
--- a/controlpanelplugins/themeplugin/src/cpthemeinfo.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.h	Wed Aug 18 09:49:35 2010 +0300
@@ -26,7 +26,6 @@
 
 public:
     
-    Q_ENUMS(ThemeListItemType)
     
     enum ThemeListItemType {
                  ThemeListItemType_default = 0,
--- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -18,6 +18,7 @@
 #include <QDir>
 #include <QStringList>
 #include <QFileSystemWatcher>
+#include <QPair>
 
 #include <HbIcon>
 
@@ -45,18 +46,14 @@
     
     //Look into theme paths and add a file watcher for it
     //to get notified when themes are added.
-    QStringList themesPathList = CpThemeUtil::themePathList();
-    foreach (const QString &path, themesPathList) {
-        QDir themeDir;
-        themeDir.setPath( path ) ;
-        QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
-        if(list.contains("themes", Qt::CaseSensitive )) {
-            mFileWatcher->addPath(themeDir.path() + "/themes/");
-        }
+    QStringList themePaths = CpThemeUtil::themeDirectories(mThemeList);
+    if(!themePaths.empty()) {
+        mFileWatcher->addPaths(themePaths);
     }
-    connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)),
+   
+    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"));
@@ -116,14 +113,10 @@
                 case Qt::DisplayRole:
                     retVal = list->at(row).name();
                     break;
-
+#ifdef CP_THEME_PREVIEW_DEFINED
                 case Qt::DecorationRole:
                     retVal = list->at(row).icon();
                     break;
-
-                case Qt::SizeHintRole:
-                    retVal = list->at(row).icon().size();
-                    break;
                     
                 case PortraitPreviewRole:
           	        retVal = list->at(row).portraitPreviewIcon();
@@ -132,7 +125,11 @@
                 case LandscapePreviewRole:
                     retVal = list->at(row).landscapePreviewIcon();
                     break;
-                    
+#endif                    
+                case Qt::SizeHintRole:
+                    retVal = list->at(row).icon().size();
+                    break;
+                                
                 case ItemDataRole:
                     retVal = list->at(row).itemData();
                     break;
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -20,9 +20,9 @@
 #include <QModelIndex>
 
 #include <hbview.h>
-#include <hblabel.h>
 #include <hblistview.h>
 #include <hblistviewitem.h>
+#include <hbdataform.h>
 
 #include "cpthemelistview.h"
 
@@ -32,8 +32,7 @@
     corresponding icons.
 
     Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel
-          framework.  However, it does not use HbDataForm as its widget and as its parent does, so
-          it uses SetWidget to set the listview to its widget instead of an HbDataForm.
+          framework.  
  */
 
 /*!
@@ -42,24 +41,35 @@
 CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent),
     mThemeList(new HbListView(this))
 {
-
+   
+    
     //Create a layout with a heading "Select theme" 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.
-    HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);//txt_cp_title_select_theme
-    layout->addItem(label);
-
-    connect(mThemeList, SIGNAL(activated(const QModelIndex&)),
-            this, SIGNAL(newThemeSelected(const QModelIndex&)));
+    //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);
+      
+    connect(mThemeList, SIGNAL(activated(QModelIndex)),
+            this, SIGNAL(newThemeSelected(QModelIndex)));
     
+    //set list item icons to be large.
     HbListViewItem* listViewItem = mThemeList->listItemPrototype();
     listViewItem->setGraphicsSize(HbListViewItem::LargeIcon);
    
     //add the list to layout.
     layout->addItem(mThemeList);
-
+    layout->addStretch();
+    
+    
     contentWidget->setLayout(layout);
    
     setWidget(contentWidget);
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.h	Wed Aug 18 09:49:35 2010 +0300
@@ -32,7 +32,7 @@
     Q_OBJECT
 
 public:
-    CpThemeListView(QGraphicsItem *parent = 0);
+    explicit CpThemeListView(QGraphicsItem *parent = 0);
     ~CpThemeListView();
     void setWidget(QGraphicsWidget *widget);
     HbListView* themeList() const;
--- a/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -48,9 +48,9 @@
     //create a cpthemepluginentryitemdata with default values and return it.
     CpSettingFormEntryItemData *entryItem = new CpThemePluginEntryItemData(
         itemDataHelper,
-        tr("Theme"),
-        tr("Theme Name"),
-        HbIcon(":/image/qgn_menu_note.svg"));
+        hbTrId("txt_cp_dblist_theme"),
+        QString(),
+        HbIcon());
         return QList<CpSettingFormItemData*>() << entryItem;
 }
 
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -15,6 +15,7 @@
  *   
  */
 
+#include <QObject>
 #include <QString>
 #include <QGraphicsPixmapItem>
 #include <QGraphicsLinearLayout>
@@ -27,6 +28,7 @@
 #include <hbiconitem.h>
 #include <hbmainwindow.h>
 #include <HbParameterLengthLimiter>
+#include <HbDataForm>
 
 #include "cpthemepreview.h"
 #include "cpthemeinfo.h"
@@ -38,6 +40,7 @@
            the theme change or press Cancel and go back to theme list view.
 */
 
+
 /*!
     constructor.
 */
@@ -47,20 +50,52 @@
      mSoftKeyBackAction(0),
      mPreviewIcon(0)
 {
+    QGraphicsLinearLayout* containerLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    QGraphicsLinearLayout* bottomLayout = new QGraphicsLinearLayout(Qt::Vertical);
+        
+    //Preview icon margins.
+    qreal leftMargin = 0.0;
+    qreal rightMargin = 0.0;
+    qreal topMargin = 0.0;
+    qreal bottomMargin = 0.0;
+        
+    style()->parameter(QString("hb-param-margin-gene-left"), leftMargin);
+    style()->parameter("hb-param-margin-gene-right", rightMargin);
+    style()->parameter("hb-param-margin-gene-top", topMargin);
+    style()->parameter("hb-param-margin-gene-bottom", bottomMargin);
+
+    containerLayout->setContentsMargins(0,0,0,0);
+    bottomLayout->setContentsMargins(leftMargin, topMargin, rightMargin, bottomMargin);
+       
+    //Using an empty dataform as heading because the heading should
+    //look like an HbDataForm headiing.
+    HbDataForm* heading = new HbDataForm(this);
+    QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name());   
+    heading->setHeading(themeHeading);
+       
+    containerLayout->addItem(heading);
+    //Fixed vertical policy so that the heading doesn't expand.
+    heading->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType);
     
-    //Create the layout and add heading and and preview icon to the layout.
-    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
+    if(mainWindow()->orientation() == Qt::Horizontal) {
+        mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this);
+    }
+    else {
+        mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this);
+        //set to ignore aspect ratio so the layout would rezise the icon correctly.
+          
+    }
+    mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio);
+  
+    // set an object name for preview icon to make it testable for automation testing
+    mPreviewIcon->setObjectName(QString("themePreviewIcon"));
 
     
-    //setup the heading.
-    QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name());   
-    HbLabel* label = new HbLabel(themeHeading, this);
-   
-    layout->addItem(label);
-    
-    layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
-    layout->itemAt(0)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed,QSizePolicy::DefaultType);
-    
+    bottomLayout->addItem(mPreviewIcon);
+    containerLayout->addItem(bottomLayout);
+
+    setLayout(containerLayout);
+        
     //Create the toolbar and "Select" and "Cancel" actions.
     HbToolBar* mToolBar = new HbToolBar(this);
 
@@ -77,24 +112,11 @@
 
     QObject::connect( cancelAction, SIGNAL(triggered()), 
                       this, SIGNAL(aboutToClose()));
-    
     QObject::connect( mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
                       this, SLOT(previewOrientationChanged(Qt::Orientation)));
        
-   
-    if(mainWindow()->orientation() == Qt::Horizontal) {
-        mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this);
-    }
-    else {
-        mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this);
-    }
-    layout->addItem(mPreviewIcon);
-    layout->itemAt(1)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,QSizePolicy::DefaultType);
         
- 
     setToolBar(mToolBar);
-    setLayout(layout);
-
     //Setup the Back button action and set softkey. Back button 
     //takes the user to the theme list view.
     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
@@ -102,6 +124,7 @@
             this, SIGNAL(aboutToClose()) );
 
     setNavigationAction(mSoftKeyBackAction);
+    
 }
 
 /*!
@@ -122,7 +145,7 @@
 /*!
     returns the themeName.
 */
-const QString& CpThemePreview::themeName() const
+const QString CpThemePreview::themeName() const
 {
     return mTheme.name();
 }
@@ -130,7 +153,7 @@
 /*!
     returns the repersentative themeIcon of the current theme.
 */
-const HbIcon& CpThemePreview::themeIcon() const
+const HbIcon CpThemePreview::themeIcon() const
 {
     return mTheme.icon();
 }
@@ -140,7 +163,7 @@
 */
 void CpThemePreview::themeSelected()
 {
-    emit applyTheme(mTheme.name());
+    emit applyTheme(mTheme);
 }
 
 /*! 
@@ -150,13 +173,20 @@
 void CpThemePreview::previewOrientationChanged(Qt::Orientation orientation)
 {
    
-    QGraphicsLinearLayout* previewLayout = dynamic_cast<QGraphicsLinearLayout*>(layout());
+    QGraphicsLinearLayout* containerLayout = dynamic_cast<QGraphicsLinearLayout*>(layout());
+    QGraphicsLinearLayout* previewLayout = 0;
+    if(containerLayout) {
+        //get the layout that preview icon belongs to.
+        previewLayout = dynamic_cast<QGraphicsLinearLayout*>(containerLayout->itemAt(1));
+    }
    
-    if(mPreviewIcon && mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(1)) ) {
-        previewLayout->removeAt(1);
+    if(previewLayout && mPreviewIcon && mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(0)) ) {
+        //Remove preview icon.
+        previewLayout->removeAt(0);
         
         if(orientation == Qt::Horizontal) {
             mPreviewIcon->setIcon(mTheme.landscapePreviewIcon());
+                    
         }
         else {
             mPreviewIcon->setIcon(mTheme.portraitPreviewIcon());
@@ -166,4 +196,6 @@
     }
     
 }
+
+
     
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h	Wed Aug 18 09:49:35 2010 +0300
@@ -41,11 +41,11 @@
     explicit CpThemePreview(const CpThemeInfo &theme, QGraphicsItem *parent = 0);
     ~CpThemePreview();
     void setThemeInfo(const CpThemeInfo& theme);
-    const QString& themeName() const;
-    const HbIcon& themeIcon() const;
+    const QString themeName() const;
+    const HbIcon themeIcon() const;
 	
 signals:
-    void applyTheme(const QString&);
+    void applyTheme(const CpThemeInfo&);
     void aboutToClose();
 
 public slots:
--- a/controlpanelplugins/themeplugin/src/cpthemeutil.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -26,6 +26,7 @@
 
 #include <hbicon.h>
 #include <hbinstance.h>
+#include <restricted/hbthemeservices_r.h>
 
 /*!
  * This class provides utility function to get Theme information.  
@@ -36,36 +37,9 @@
 #include <centralrepository.h>
         static const TUid KServerUid3={0x20022E82};
         static const TUint32 KDefaultThemeNameKey = 0x2;
-        static const TUint32 KDefaultThemeRootPathKey = 0x3;
-
+  
 #endif
 
-#if !defined(Q_OS_SYMBIAN)
-    #include <stdio.h>
-    static const char* KThemePathKey = "HB_THEMES_DIR";  //used for getting default theme.
-#endif
-    
-    
-#ifdef Q_OS_WIN
-    static char* _path = NULL;
-    static size_t _size = 0;
-    _dupenv_s(&_path, &_size, KThemePathKey);
-    static QString themeRootPath = QString(_path);
-    static QString themeRootPathPostfix = QString();
-    free(_path);
-#elif defined(Q_OS_SYMBIAN)
-    static QString themeRootPath = "c:\\resource\\hb";
-    static QString themeRootPathPostfix = "resource\\hb";
-#elif defined(Q_OS_MACX)
-    static QString themeRootPath = QDir::homePath() + '/' + "Library" + QString("hb");
-    static QString themeRootPathPostfix = QString();
-#elif defined(Q_OS_UNIX)
-    static QString themeRootPath = QString(getenv(KThemePathKey));
-    static QString themeRootPathPostfix = QString();
-#else
-    static QString themeRootPath = "c:\\resource\\hb";
-    static QString themeRootPathPostfix = QString();
-#endif
 
     //Location of theme preview and background icons.
     static const QString KPreviewThumbnailNVG = "/scalable/qtg_graf_theme_preview_thumbnail.nvg";
@@ -84,46 +58,9 @@
     static const QString KBackgroundPrtPNG    = "/pixmap/qtg_graf_screen_bg_prt.png";                     
     static const QString KBackgroundLscPNG    = "/pixmap/qtg_graf_screen_bg_lsc.png";
     
-/*!
- * Returns a list of paths where themes folder reside.  
- */
-QStringList CpThemeUtil::themePathList()
-{
-    static QStringList themesPathList;
-    
-    if(themesPathList.isEmpty()) {
+
 
-#if defined(Q_OS_SYMBIAN)
-        QFileInfoList driveInfoList = QDir::drives();
-        foreach (const QFileInfo &driveInfo, driveInfoList) {
-            const QString themePath = driveInfo.absolutePath() + themeRootPathPostfix;
-            if(QDir(themePath).exists())
-                themesPathList << themePath;
-        }
-#else
-        themesPathList << themeRootPath;
-#endif
-    }
-    return themesPathList;
-}
 
-/*!
- * Given the theme name, it returns the absolute path of the theme.
- */
-QString CpThemeUtil::themePath(const QString& themeName)
-{
-    QString themePath = "";
-    QStringList themesPathList = themePathList();
-    foreach (const QString &path, themesPathList) {
-       QString tmpPath = path + "/themes/icons/" + themeName;
-       if(QDir(tmpPath).exists()) {
-           themePath = tmpPath;
-           break;
-       }
-    }
-    return themePath;
-}
-  
 /*
  * Builds a CpThemeInfo object given theme path and theme name.  It creates the name and 
  * preview icons for the object.  Creates a new CpThemeInfo objects. Caller takes ownership.
@@ -159,6 +96,7 @@
    
     themeInfo->setName(name);
     themeInfo->setItemType(CpThemeInfo::ThemeListItemType_default);
+    themeInfo->setItemData(themePath);
           
     //Get the icons. Logic is as follow:
     /* 1. If the icon path is in index.theme and the icon exist, use it.
@@ -233,35 +171,25 @@
 }
 
 /*! Creates a list of CpThemeInfo objects representing theme information.
- *  Caller should take ownership of the list.
+ *  
  */
 QList<CpThemeInfo> CpThemeUtil::buildThemeList()
 {
     QList<CpThemeInfo> themeList; 
   
-    QStringList mThemesPathList = themePathList();
-    
-    foreach (const QString &path, mThemesPathList) {
+    QList<QPair<QString, QString> > mThemesPathList = availableThemes();
+    QPair<QString, QString>pair;
+    foreach (pair, mThemesPathList) {
         QDir themeDir;
+        QString name = pair.first;
+        QString path = pair.second;
         themeDir.setPath( path ) ;
-        QStringList iconthemeslist;
-        QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
         CpThemeInfo* themeInfo;
-
-        if(list.contains("themes", Qt::CaseSensitive )) {
-            QDir root(themeDir.path());
-            themeDir.setPath(root.path() + "/themes/icons/") ;
-            iconthemeslist = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
-            foreach(QString themefolder, iconthemeslist) {
-                QDir iconThemePath(root.path() + "/themes/icons/" + themefolder);
-                if(iconThemePath.exists("index.theme") &&
-                   (iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) {
-
-                    themeInfo = buildThemeInfo(iconThemePath.path(), themefolder);
-                    if(themeInfo && !themeInfo->name().isEmpty()) {
-                        themeList.append(*themeInfo);
-                    }
-                } 
+        if(themeDir.exists("index.theme") &&
+          (themeDir.exists("scalable") || themeDir.exists("pixmap") )) {
+            themeInfo = buildThemeInfo(path, name);
+            if(themeInfo && !themeInfo->name().isEmpty()) {
+                themeList.append(*themeInfo);
             }
         }
     }
@@ -275,9 +203,11 @@
 CpThemeInfo* CpThemeUtil::defaultTheme()
 {
     //static because default theme doesn't change.
-    static CpThemeInfo *defaultTheme = new CpThemeInfo();
-    QString defaultThemeName;
-    QString defaultThemeRootDir;
+    static CpThemeInfo *defaultTheme = 0;
+    if(!defaultTheme) {
+        defaultTheme = new CpThemeInfo();
+    }
+    QString defaultThemePath;
     if(defaultTheme->name().isEmpty()) {
        
 
@@ -288,24 +218,43 @@
             TBuf<256> value;
             if (KErrNone == repository->Get((TUint32)KDefaultThemeNameKey, value)) {
                 QString qvalue((QChar*)value.Ptr(), value.Length());
-                defaultThemeName = qvalue.trimmed();
+                defaultThemePath = qvalue.trimmed();
             }
             value.Zero();
-            if (KErrNone == repository->Get((TUint32)KDefaultThemeRootPathKey, value)) {
-                QString qvalue((QChar*)value.Ptr(), value.Length());
-                defaultThemeRootDir = qvalue.trimmed();
-            }
-            else {
-                defaultThemeRootDir = themePath(defaultThemeName);
-            }
-            value.Zero();
-            delete repository;
+           delete repository;
         }
           
 #endif
-        defaultTheme = buildThemeInfo(defaultThemeRootDir, defaultThemeName);
+        defaultTheme = buildThemeInfo(defaultThemePath);
 
     }
     return defaultTheme;
 }
 
+
+const QStringList CpThemeUtil::themeDirectories(const QList<CpThemeInfo>& themeInfoList)
+{
+    QStringList themeDirs;
+    
+    foreach(const CpThemeInfo& themeInfo, themeInfoList) {
+        QDir themePath(themeInfo.itemData());
+        QString topDir;
+        if(themePath.cdUp()) {
+            topDir = themePath.path();
+            if(!themeDirs.contains(topDir)) {
+                themeDirs.append(topDir);
+            }
+        }
+    }
+    return themeDirs;
+}
+
+const QList< QPair< QString, QString > > CpThemeUtil::availableThemes( )
+{
+    
+    QList<QPair<QString, QString> > result = HbThemeServices::availableThemes();
+    return result;
+    
+}
+
+
--- a/controlpanelplugins/themeplugin/src/cpthemeutil.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemeutil.h	Wed Aug 18 09:49:35 2010 +0300
@@ -19,6 +19,7 @@
 #define CPTHEMEUTIL_H_
 
 #include <QList>
+#include <QPair>
 
 class QStringList;
 class CpThemeInfo;
@@ -26,11 +27,13 @@
 class CpThemeUtil {
 
 public:
-    static QStringList themePathList();
     static QList<CpThemeInfo> buildThemeList();
-    static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName);
-    static QString themePath(const QString& themeName);
+    static CpThemeInfo* buildThemeInfo(const QString& themePath, const QString& themeName = QString());
     static CpThemeInfo* defaultTheme();
+    static const QList< QPair< QString, QString > > availableThemes(); 
+    static const QStringList themeDirectories(const QList<CpThemeInfo> &themeInfoList);
+
+        
 };
 
 #endif /* CPTHEMEUTIL_H_ */
--- a/controlpanelplugins/themeplugin/themeplugin.pro	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelplugins/themeplugin/themeplugin.pro	Wed Aug 18 09:49:35 2010 +0300
@@ -25,6 +25,10 @@
 CONFIG += debug_and_release 
 RESOURCES += themeplugin.qrc
 
+#comment this out if theme plugin should have
+#a preview view.
+DEFINES += CP_THEME_PREVIEW_DEFINED
+
 include (themeplugin.pri)
 include (rom/themeplugin_rom.pri)
 
@@ -61,6 +65,7 @@
 LIBS += -L$$DESTDIR
 
 
+
 #For some reason the default include path doesn't include MOC_DIR on symbian
 symbian {
     INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
--- a/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -110,7 +110,7 @@
             event->mPluginFile     = pluginConfig.mPluginFile;
                         
             //firstly, handle CpPluginInterface
-            if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) {
+            if (CpPluginInterface *plugin = CpPluginLoader::loadCpPluginInterface(pluginConfig.mPluginFile)) {
                 CPFW_LOG("Load  root component CpPluginInterface succeed.");
                 event->mPluginInterface = plugin;
             }
@@ -164,7 +164,7 @@
 		QList<CpSettingFormItemData*> itemDataList;
 		
         //firstly, handle CpPluginInterface
-		if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) {
+		if (CpPluginInterface *plugin = CpPluginLoader::loadCpPluginInterface(pluginConfig.mPluginFile)) {
             CPFW_LOG("Load  root component CpPluginInterface succeed.");
 			itemDataList = plugin->createSettingFormItemData(itemDataHelper);
 		}
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -48,13 +48,16 @@
 
 void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
 {
-    mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem);
+    mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem);    
+    mAirplaneModeItem->setContentWidgetData("text", hbTrId("txt_cp_button_offline"));
+	mAirplaneModeItem->setContentWidgetData("additionalText", hbTrId("txt_cp_button_offline"));
     mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica"));
-    
+    mAirplaneModeItem->setContentWidgetData("objectName", "airplaneModeToggle");
+    mAirplaneModeItem->setContentWidgetData("checkable", true);
     itemDataHelper.addConnection(mAirplaneModeItem,
-            SIGNAL(clicked()),
+            SIGNAL(toggled(bool)),
             this,
-            SLOT(toggleAirplaneMode()));
+            SLOT(toggleAirplaneMode(bool)));
     
     XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed);
     QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
@@ -68,14 +71,13 @@
     
 }
 
-void CpCommunicationGroupItemData::toggleAirplaneMode()
-{
+void CpCommunicationGroupItemData::toggleAirplaneMode(bool toggled)
+{    
     XQCentralRepositorySettingsKey key(KCRUidCoreApplicationUIs.iUid,KCoreAppUIsNetworkConnectionAllowed);
-    QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
-        
-    airplaneMode.setValue( static_cast<int> (!airplaneMode.toBool()) );
-
-    mSettingManager->writeItemValue(key,airplaneMode);
+    //toggled = true means ECoreAppUIsNetworkConnectionNotAllowed
+    //toggled = false means ECoreAppUIsNetworkConnectionAllowed
+    QVariant airplaneMode(static_cast<int>(!toggled));
+    mSettingManager->writeItemValue(key, airplaneMode);
 }
 
 void CpCommunicationGroupItemData::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
@@ -83,14 +85,11 @@
     if (mAirplaneModeItem 
         && key.uid() == KCRUidCoreApplicationUIs.iUid 
         && key.key() == KCoreAppUIsNetworkConnectionAllowed 
-        && value.isValid()) {
-        QString text = hbTrId("txt_cp_setlabel_offline_mode_val_on");
-        QString additionalText = hbTrId("txt_cp_setlabel_offline_mode_val_off");
-        if (ECoreAppUIsNetworkConnectionAllowed == value.toInt()) {
-            ::qSwap (text, additionalText);
-        }
-        mAirplaneModeItem->setContentWidgetData("text",text);
-        mAirplaneModeItem->setContentWidgetData("additionalText",additionalText);
+        && value.isValid()) {          
+        //value.toBool() returns 
+        //true(1) if value equals ECoreAppUIsNetworkConnectionAllowed, that means offline mode off.
+        //false(0) if value equals ECoreAppUIsNetworkConnectionNotAllowed, that means offline mode on.
+        mAirplaneModeItem->setContentWidgetData("checked", !value.toBool());
     }
 }
 
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h	Wed Aug 18 09:49:35 2010 +0300
@@ -36,7 +36,7 @@
 
     ~CpCommunicationGroupItemData();
 private slots:
-    void toggleAirplaneMode();
+    void toggleAirplaneMode(bool toggled);
     void settingValueChanged(const XQSettingsKey &key, const QVariant &value);
 private:
     virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper);
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -100,6 +100,7 @@
     QStringList items = mScreenLockValues.values();
     mScreenComboButton->setContentWidgetData( QString("items"), items );
     mScreenComboButton->setContentWidgetData( QString("currentIndex"), selectedIndex);
+    mScreenComboButton->setContentWidgetData("objectName", "screenComboButton");
 }
 
 void CpKeyScreenView::makeRotateItem(HbDataFormModel& model)
@@ -117,6 +118,7 @@
         state = Qt::Unchecked;
     }
     mRotateCheckbox->setContentWidgetData( QString("checkState"), state );
+    mRotateCheckbox->setContentWidgetData("objectName", "rotateCheckbox");
 }
 
 void CpKeyScreenView::makeBrightnessItem(HbDataFormModel& model)
@@ -136,6 +138,7 @@
     iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
     iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
     mBrightSliderItem->setContentWidgetData( QString( "elementIcons" ), iconElements );
+    mRotateCheckbox->setContentWidgetData("objectName", "brightSliderItem");
 }
 
 void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model)
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -58,7 +58,7 @@
             		itemDataHelper, hbTrId("txt_cp_button_advanced_settings"));
     
     advanceSettingItem->setContentWidgetData("textAlignment", QVariant( Qt::AlignHCenter | Qt::AlignVCenter) );
-    
+    advanceSettingItem->setContentWidgetData("objectName", "advanceSettingButton" );
     appendChild(advanceSettingItem);
     CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END");
 }
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -74,9 +74,6 @@
     
     profileEditNameDialog->setLineEditText( profileName );
     profileEditNameDialog->checkPrimaryAction();
-    
-    HbAction *secondAction = qobject_cast<HbAction *>
-                                 (profileEditNameDialog->actions().at(1));
     profileEditNameDialog->show();
     return false;
 }
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -137,7 +137,8 @@
     //notification tones item
     modelItem= mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),parent);
     modelItem->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
-    modelItem->setContentWidgetData( "checkState", profileSettings.mNotificationTone ? 2 : 0 );
+    modelItem->setContentWidgetData("checkState", profileSettings.mNotificationTone ? 2 : 0);
+    modelItem->setContentWidgetData("objectName", "notificationTonesCheckBox" + QString::number(profileId));
     if (profileId == EProfileWrapperGeneralId) {
         addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int )));
     }
@@ -156,7 +157,7 @@
             << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement)
             << QVariant(HbSlider::TextElement);
     modelItem->setContentWidgetData("sliderElements",sliderElements);
-    
+    modelItem->setContentWidgetData("objectName", "keyTonesSlider" + QString::number(profileId));
     
     
     //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
@@ -192,7 +193,7 @@
     sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
                 << QVariant(HbSlider::DecreaseElement);
     modelItem->setContentWidgetData("sliderElements",sliderElements);
-        
+    modelItem->setContentWidgetData("objectName", "vibrationSlider" + QString::number(profileId));
     modelItem->setContentWidgetData( QString( "minimum" ), 0 );
     modelItem->setContentWidgetData( QString( "maximum" ), 5 );
     modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
--- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -53,7 +53,7 @@
         }
         else
         {
-            setDescription( strRing.section(QDir::separator (),-1) );
+		    setDescription( QFileInfo(strRing).baseName() );
         }
     }
     else
@@ -171,8 +171,10 @@
 void CpPersonalizationEntryItemData::handleOk(const QString &strFname)
 {
     if(strFname.length())
-    {
-        setDescription( strFname.section(QDir::separator (),-1) );
+    {   
+        //lower level services(tone fetcher or music fetcher)
+        //will guarantee strFname is a valid absolute file path.
+        setDescription(QFileInfo(strFname).baseName());
     }
     else
     {
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -93,8 +93,8 @@
 
 void CpVolumeController::masterVolumeChange(int value)
 {
-#ifdef Q_OS_SYMBIAN
-	mProfileModel->setMasterVolume( volumeLevelToInt( (CpVolumeController::VolumeLevel)value ) );
+#ifdef Q_OS_SYMBIAN	
+    mProfileModel->setMasterVolume(value);
 	HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
 	masterVolume->setContentWidgetData("value",value);
 #endif
@@ -133,7 +133,7 @@
 	    masterVolume->setContentWidgetData("elementIcons", iconMaps);
 	    masterVolume->setEnabled(!isSilenceMode);
 	    //masterVolume->setContentWidgetData("enabled",!isSilenceMode);
-	    masterVolume->setContentWidgetData("value",intToVolumeLevel(mProfileModel->masterVolume()));
+	    masterVolume->setContentWidgetData("value",mProfileModel->masterVolume());
 	}
 	HbDataFormModelItem *masterVibra = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem);
 	if (masterVibra) {
@@ -143,30 +143,6 @@
 #endif
 }
 
-int CpVolumeController::volumeLevelToInt( CpVolumeController::VolumeLevel volumeLevel )
-{
-    switch( volumeLevel ){
-        case VolumenLevelSoft:
-            return EProfileMasterVolumeSoft;
-        case VolumeLevelMed:
-            return EProfileMasterVolumeMed;
-        case VolumeLevelLoud:
-            return EProfileMasterVolumeLoud;
-        default:
-        		return 1;            	
-    }
-}
-CpVolumeController::VolumeLevel CpVolumeController::intToVolumeLevel( int value )
-{
-    if( value < 4 ) {
-        return VolumenLevelSoft;
-    } else if( value < 8 )
-        return VolumeLevelMed;
-    else{
-        return VolumeLevelLoud;
-    }
-}
-
 void CpVolumeController::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
 {
     if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode) {
@@ -194,7 +170,7 @@
     else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVolume) {
         HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem);
         if (masterVolume) {
-            masterVolume->setContentWidgetData("value",intToVolumeLevel(value.toInt()));
+            masterVolume->setContentWidgetData("value",value.toInt());
         }
     }
     else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVibra) {
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h	Wed Aug 18 09:49:35 2010 +0300
@@ -34,12 +34,7 @@
 		const QList<HbDataFormModelItem *> &itemList,
 		CpItemDataHelper &itemDataHelper);
 	virtual ~CpVolumeController();
-private:
-    enum VolumeLevel{
-        VolumenLevelSoft = 1,
-        VolumeLevelMed = 2 ,
-        VolumeLevelLoud = 3
-    };
+
 private slots:
     void silenceModeChange(bool isSilence);
     void masterVolumeChange(int value);
@@ -48,9 +43,7 @@
     void settingValueChanged(const XQSettingsKey &key, const QVariant &value);
     
 private:
-	void updateUi();
-	int volumeLevelToInt( CpVolumeController::VolumeLevel volumeLevel );
-	CpVolumeController::VolumeLevel intToVolumeLevel( int value );
+	void updateUi();	
 	
 private:
 	CpProfileModel *mProfileModel;
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -54,6 +54,7 @@
     HbDataFormModelItem *silenceIndicator = new HbDataFormModelItem(static_cast<HbDataFormModelItem::DataItemType>(SilenceIndicatorItem));
     mItemList.insert(CpVolumeGroupItemData::EVolumeSilenceItem, silenceIndicator);
     silenceIndicator->setContentWidgetData("text",hbTrId("txt_cp_button_silence"));
+    silenceIndicator->setContentWidgetData("objectName", "silenceIndicatorButton");
     this->appendChild(silenceIndicator);
     
     HbDataFormModelItem *masterVolume = new HbDataFormModelItem(HbDataFormModelItem::SliderItem,
@@ -64,6 +65,7 @@
             << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement)
             << QVariant(HbSlider::TextElement);
     masterVolume->setContentWidgetData("sliderElements",elements);
+    masterVolume->setContentWidgetData("objectName","masterVolumeSlider");
     
     QMap<QString, QVariant> iconMaps;
     iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg"));
@@ -72,7 +74,7 @@
     
     masterVolume->setContentWidgetData("elementIcons", iconMaps);
     masterVolume->setContentWidgetData("minimum", 1);
-    masterVolume->setContentWidgetData("maximum", 3);
+    masterVolume->setContentWidgetData("maximum", 10);
     masterVolume->setContentWidgetData("majorTickInterval",1);
     masterVolume->setContentWidgetData("tickPosition",Hb::SliderTicksBelow);
 
@@ -88,6 +90,7 @@
     HbDataFormModelItem *masterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem);
     mItemList.insert(CpVolumeGroupItemData::EVolumeMasterVibraItem, masterVibra);
     masterVibra->setContentWidgetData("text",hbTrId("txt_cp_list_vibrate"));
+    masterVibra->setContentWidgetData("objectName","masterVibraCheckBox");
     
     this->appendChild(masterVibra);
     
--- a/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -34,14 +34,14 @@
 CpRingToneView::CpRingToneView( QGraphicsItem *parent ):
                               CpBaseSettingView(0, parent),
                               mToneTypeList( new HbListWidget(this) ),
-                              mReq(0)
+                              mReq(0), mProcessing(false)
 {
     HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.css");
     HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem_color.css");
     HbStyleLoader::registerFilePath(":/widgetml/cpdataformlistentryviewitem.widgetml");
     
     HbDataForm *form = qobject_cast<HbDataForm*> ( widget() );
-    form->setHeading("txt_cp_subhead_select_tone_type");   
+    form->setHeading(hbTrId("txt_cp_subhead_select_tone_type"));   
     
     HbDataFormModel *model = new HbDataFormModel();  
     QList< QPair<QString,QString> > tonesTypeList;
@@ -62,10 +62,18 @@
 }
 CpRingToneView::~CpRingToneView()
 {
-    if(mReq)    delete mReq;
+    if (mReq) {
+        delete mReq;
+    }    
 }
+
 void CpRingToneView::itemActivated( const QModelIndex &index )
 {
+    //avoid responding to the second or later consecutive click
+	if (mProcessing) {
+		return;
+	}
+	mProcessing = true;
     int nRow = index.row();
 
     switch(nRow) {
@@ -86,7 +94,8 @@
 }
 void CpRingToneView::handleOk(const QVariant &result)
 {
-    CPFW_LOG( "CpPersonalizationEntryItemData::handleOk" );
+    mProcessing = false;
+    CPFW_LOG( "CpRingToneView::handleOk" );
     if (!result.canConvert<QString>() || result.toString().length() == 0 )  //error result
     {
         return;
@@ -99,6 +108,7 @@
 
 void CpRingToneView::handleError(int errorCode, const QString& errorMessage)
 {
+    mProcessing = false;
     emit(selError( errorCode, errorMessage ));
 }
 
@@ -112,15 +122,16 @@
     }
         //launch media fetcher
     mReq = mAppMgr.create(strService, strItface, true);
+    mReq->setSynchronous(false);
     if (!mReq)
     {
       CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher start failed");
       return;
     }
     else
-    {
-        connect(mReq, SIGNAL( requestOk( const QVariant&)), SLOT( handleOk(const QVariant&)) );
-        connect(mReq, SIGNAL( requestError( int,const QString&)), SLOT(handleError(int,const QString&)) );
+    {   //use QueuedConnection so that requestError will not be emitted when selecting one tone
+        connect(mReq, SIGNAL(requestOk(QVariant)), SLOT( handleOk(QVariant)), Qt::QueuedConnection);
+        connect(mReq, SIGNAL(requestError(int, QString)), SLOT(handleError(int, QString)));
     }
     
     QList<QVariant> args;
--- a/controlpanelui/src/inc/cpringtoneview.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/inc/cpringtoneview.h	Wed Aug 18 09:49:35 2010 +0300
@@ -44,7 +44,9 @@
     HbListWidget* mToneTypeList;
     XQAiwRequest* mReq;
     XQApplicationManager mAppMgr;
-
+    //used to mark if there is a request being processed
+    bool mProcessing;
+    
 private:
     void launchMediaFetcher( const QString &strService, const QString &strItface );
 };
--- a/controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/inc/tonefetcherlogger.h	Wed Aug 18 09:49:35 2010 +0300
@@ -12,7 +12,7 @@
  * Contributors:
  * 
  * Description:
- *     The header file for tone fetcher utilities.
+ *     The header file for tone fetcher logger.
  *     
  */
 
@@ -22,6 +22,12 @@
 #include <QLatin1String>
 #include <logger.h>
 
+/*
+ make LOG work
+*/
+
+//#define ENABLE_TONEFETCHER_LOG
+
 #define TONEFETCHER_LOGGER_NAME       QLatin1String("ToneFetcher")
 
 #if defined (Q_OS_SYMBIAN)
@@ -34,6 +40,10 @@
     #endif
 #endif
 
-#define TF_LOG(str)   Logger::instance(TONEFETCHER_LOGGER_NAME)->log(str);
+#ifdef ENABLE_TONEFETCHER_LOG
+    #define TF_LOG(str)   Logger::instance(TONEFETCHER_LOGGER_NAME)->log(str);
+#else
+    #define TF_LOG(str)
+#endif
 
 #endif /* TONEFETCHERLOGGER_H */
--- a/controlpanelui/src/tonefetcher/src/main.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/src/main.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -25,12 +25,17 @@
 {
     HbApplication a(argc, argv);
     
-    
+#ifdef ENABLE_TONEFETCHER_LOG
     Logger::instance(TONEFETCHER_LOGGER_NAME)->configure(
             TF_LOGGER_CONFIG_PATH,QSettings::IniFormat);
-
+#endif
     TF_LOG("Entering tonefetcher.exe...");
     ToneFetcherMainWindow w;   
     w.show();
-    return a.exec();
+    int ret = a.exec();
+    TF_LOG("Leaving tonefetcher.exe...");
+#ifdef ENABLE_TONEFETCHER_LOG
+    Logger::closeAll();
+#endif
+    return ret;
 }
--- a/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -38,7 +38,7 @@
 
 void ToneFetcherView::initMainWidget()
 {
-    mWidget = new ToneFetcherWidget(this);
+    mWidget = new ToneFetcherWidget(this, this);
     Q_ASSERT(mWidget);
     setWidget(mWidget);
     //mWidget->setCurrentToolBarType( ToneServiceWidget::GeneralTone );
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -36,8 +36,8 @@
 #include <hbmessagebox.h>
 #include <hbprogressdialog.h>
 
-ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView  ) 
-    : HbWidget(this),
+ToneFetcherWidget::ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView)
+    : HbWidget(parent),
       mLabel(0),
       mListView(0),
       mLayout(0),
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h	Wed Aug 18 09:49:35 2010 +0300
@@ -39,7 +39,7 @@
     Q_OBJECT
     
 public:
-    explicit ToneFetcherWidget(ToneFetcherView *serviceView);
+    explicit ToneFetcherWidget(HbWidget *parent, ToneFetcherView *serviceView);
     ~ToneFetcherWidget();
     QString getCurrentItemPath();
     void playOrPause();
--- a/controlpanelui/src/tonefetcher/tonefetcher.pro	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/tonefetcher.pro	Wed Aug 18 09:49:35 2010 +0300
@@ -45,6 +45,7 @@
 
             TARGET.UID3 = 0x2002BCCA
             TARGET.CAPABILITY = ALL -TCB
+            TARGET.VID = VID_DEFAULT
             BLD_INF_RULES.prj_exports += "./service_conf.xml z:/private/2002BCCA/service_conf.xml"
 }
 symbian {
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -28,6 +28,7 @@
 //refresh interval, 2 seconds.
 const TInt KTimerInterval = 2 * 1000 * 1000;
 const TInt KObserverCallStep = 100;
+const TInt KOneKiloByte = 1024;
 // CONSTANTS
 _LIT( KMimeMp3, "mp3" );
 
@@ -172,8 +173,8 @@
     }
 
 void CToneSelection::HandleObjectNotification( CMdESession& /*aSession*/, 
-                                        TObserverNotificationType aType,
-                                        const RArray<TItemId>& aObjectIdArray )
+                                        TObserverNotificationType /*aType*/,
+                                        const RArray<TItemId>& /*aObjectIdArray*/ )
     {   
     /*if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) )
         {
@@ -300,7 +301,7 @@
     return PropertyDefL( iSession, aAttr );
     }
 
-CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* aSession, TInt aAttr )
+CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* /*aSession*/, TInt aAttr )
     {
     CMdEObjectDef& objectDef = 
             iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject );
@@ -337,6 +338,8 @@
         {
         User::Leave( KErrNotSupported );
         }
+	//avoid critical warning
+    return objectDef.GetPropertyDefL( MdeConstants::Audio::KAudioObject );
     }
 
 void CToneSelection::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition )
@@ -357,7 +360,7 @@
     
     CMdELogicCondition& condition = 
                         aCondition.AddLogicConditionL( ELogicConditionOperatorAnd );
-    condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize, EMdERangeTypeBetween) );
+    condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize * KOneKiloByte, EMdERangeTypeNotBetween) );
     condition.AddPropertyConditionL( mimeTypeDef, 
             ETextPropertyConditionCompareContains, KMimeMp3 );
     condition.AddPropertyConditionL( artistTypeDef );
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp	Tue Jul 06 14:17:10 2010 +0300
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/tonefetcherengine_symbian.cpp	Wed Aug 18 09:49:35 2010 +0300
@@ -25,8 +25,8 @@
 
 ToneFetcherEnginePrivate::ToneFetcherEnginePrivate()
     {
-    TRAPD( err, mToneSelection = CToneSelection::NewL( this ) ); 
-    TRAPD( error, mTonePlayer = CTonePlayer::NewL( this ) );    
+    TRAP_IGNORE( mToneSelection = CToneSelection::NewL( this ) ); 
+    TRAP_IGNORE( mTonePlayer = CTonePlayer::NewL( this ) );    
     }
 
 ToneFetcherEnginePrivate::~ToneFetcherEnginePrivate()