--- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -93,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);
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -128,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()),
@@ -225,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()) {
@@ -241,6 +246,8 @@
themeInfo.setLandscapePreviewIcon(data.value<HbIcon>());
}
+
+
//Set up the theme preview and set it to
//the current view of main window.
@@ -253,8 +260,8 @@
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);
}
@@ -267,7 +274,7 @@
/*!
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);
@@ -393,6 +400,9 @@
//set current index.
mThemeListView->themeList()->setCurrentIndex(sourceIndex, QItemSelectionModel::SelectCurrent);
}
+ else {
+ mThemeListView->themeList()->setCurrentIndex(QModelIndex(), QItemSelectionModel::Clear);
+ }
}
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeinfo.h Fri Jul 23 11:04:51 2010 +0800
@@ -26,7 +26,6 @@
public:
- Q_ENUMS(ThemeListItemType)
enum ThemeListItemType {
ThemeListItemType_default = 0,
--- a/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -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"));
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -58,8 +58,8 @@
//Fixed vertical policy so that the heading doesn't expand.
form->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed, QSizePolicy::DefaultType);
- connect(mThemeList, SIGNAL(activated(const QModelIndex&)),
- this, SIGNAL(newThemeSelected(const QModelIndex&)));
+ connect(mThemeList, SIGNAL(activated(QModelIndex)),
+ this, SIGNAL(newThemeSelected(QModelIndex)));
//set list item icons to be large.
HbListViewItem* listViewItem = mThemeList->listItemPrototype();
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.h Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.h Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -48,8 +48,8 @@
//create a cpthemepluginentryitemdata with default values and return it.
CpSettingFormEntryItemData *entryItem = new CpThemePluginEntryItemData(
itemDataHelper,
- tr("Theme"),
- tr("Theme Name"),
+ hbTrId("txt_cp_dblist_theme"),
+ QString(),
HbIcon());
return QList<CpSettingFormItemData*>() << entryItem;
}
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -15,6 +15,7 @@
*
*/
+#include <QObject>
#include <QString>
#include <QGraphicsPixmapItem>
#include <QGraphicsLinearLayout>
@@ -81,10 +82,13 @@
}
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 to ignore aspect ratio so the layout would rezise the icon correctly.
- mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio);
+ // set an object name for preview icon to make it testable for automation testing
+ mPreviewIcon->setObjectName(QString("themePreviewIcon"));
+
bottomLayout->addItem(mPreviewIcon);
containerLayout->addItem(bottomLayout);
@@ -158,7 +162,7 @@
*/
void CpThemePreview::themeSelected()
{
- emit applyTheme(mTheme.name());
+ emit applyTheme(mTheme);
}
/*!
@@ -181,9 +185,12 @@
if(orientation == Qt::Horizontal) {
mPreviewIcon->setIcon(mTheme.landscapePreviewIcon());
+ mPreviewIcon->setAspectRatioMode(Qt::KeepAspectRatio);
+
}
else {
mPreviewIcon->setIcon(mTheme.portraitPreviewIcon());
+ mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio);
}
previewLayout->addItem(mPreviewIcon);
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.h Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Fri Jul 23 11:04:51 2010 +0800
@@ -45,7 +45,7 @@
const HbIcon themeIcon() const;
signals:
- void applyTheme(const QString&);
+ void applyTheme(const CpThemeInfo&);
void aboutToClose();
public slots:
--- a/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeutil.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeutil.h Fri Jul 23 11:04:51 2010 +0800
@@ -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/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Fri Jul 23 11:04:51 2010 +0800
@@ -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/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Fri Jul 23 11:04:51 2010 +0800
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -74,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);
--- a/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Fri Jul 23 11:04:51 2010 +0800
@@ -34,7 +34,7 @@
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");
@@ -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 Wed Jul 14 07:09:46 2010 +0800
+++ b/controlpanelui/src/inc/cpringtoneview.h Fri Jul 23 11:04:51 2010 +0800
@@ -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 );
};