# HG changeset patch # User hgs # Date 1273814468 -28800 # Node ID 36aa4756ee826ee91166ab410ed26b7f19b1ea52 # Parent 624337f114fe1b2c3c8b0ec2ebfd7f04561af96e 201019 diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemechanger.cpp --- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the HbThemeChanger class + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "cpthemechanger.h" #include "cpthemechanger_p.h" @@ -47,19 +46,10 @@ QAbstractItemModel& CpThemeChanger::model() { Q_D(CpThemeChanger); - + return d->model; } -/*! - Provide a list of currently available themes. -*/ -const QList CpThemeChanger::themes() const -{ - Q_D(const CpThemeChanger); - - return d->themes(); -} /*! Creates a connection to the theme server for the purpose of diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemechanger.h --- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: HbThemeChanger class definition -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef CPTHEMECHANGER_H #define CPTHEMECHANGER_H @@ -56,7 +55,6 @@ LandscapePreviewRole }; - const QList themes() const; QAbstractItemModel& model(); const ThemeInfo& currentTheme() const; diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -1,25 +1,26 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Private implementation of the theme changer. + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "cpthemechanger.h" #include "cpthemechanger_p.h" #include #include #include +#include #include #include #include @@ -37,9 +38,7 @@ static const char* KThemePathKey = "HB_THEMES_DIR"; #endif - static const QString KDefaultTheme = "hbdefault"; - static const char* KSettingsCategory = "currenttheme"; - static const bool KDefaultPreviewAvailable = true; + static const QString KDefaultTheme = "hbdefault"; } CpThemeChangerPrivate::CpThemeChangerPrivate(CpThemeChanger* qq): @@ -76,8 +75,12 @@ #endif // Get our current state - QSettings settings(QLatin1String(ORGANIZATION), QLatin1String(THEME_COMPONENT)); - mCurrentTheme.name = settings.value(KSettingsCategory).toString(); + if (HbInstance::instance()) { + HbTheme *hbTheme = HbInstance::instance()->theme(); + if (hbTheme) { + mCurrentTheme.name = hbTheme->name(); + } + } updateThemeList(mCurrentTheme.name); // Watch for changes to the theme directory in flash. @@ -154,35 +157,32 @@ iniSetting.beginGroup("Icon Theme"); QString hidden = iniSetting.value("Hidden").toString(); QString name = iniSetting.value("Name").toString(); - QString iconPath = iniSetting.value("PreviewIconPath").toString(); + QString iconPath = iniSetting.value("PreviewThumbnailPath").toString(); + QString previewPathPrt = iniSetting.value("PreviewIconPath_prt").toString(); + QString previewPathLsc = iniSetting.value("PreviewIconPath_lsc").toString(); if (name.isEmpty()) { continue; } - if (!KDefaultPreviewAvailable && iconPath.isEmpty()) - { - continue; - } + QString fullPathToIcon(iconThemePath.path() + iconPath); - // Don't treat this as a theme unless it's got a preview. - if (!QFileInfo(fullPathToIcon).exists() && !KDefaultPreviewAvailable) { - continue; - } - if(iconPath.isEmpty()){ + + if(iconPath.isEmpty()|| !QFileInfo(fullPathToIcon).exists()){ - //if no preview graphics path specified,look for the background graphic. - //first look in /scalable folder. if not there, look in pixmap folder. - //Set thumbnail if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg").exists()){ nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg"); }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ - nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); - qreal width = nameIconPair.icon.width(); - nameIconPair.icon.setHeight(width); + QPixmap px(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); + QIcon scaledIcon(px.scaled(QSize(64, 64))); + nameIconPair.icon = HbIcon(scaledIcon); + nameIconPair.icon.setIconName(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); + } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ - nameIconPair.icon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); - qreal width = nameIconPair.icon.width(); - nameIconPair.icon.setHeight(width); + QPixmap px(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); + QIcon scaledIcon(px.scaled(QSize(64, 64))); + nameIconPair.icon = HbIcon(scaledIcon); + nameIconPair.icon.setIconName(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.png"); + } else{ nameIconPair.icon = HbIcon(":/image/themePreview.svg"); } @@ -190,26 +190,42 @@ nameIconPair.icon = HbIcon(fullPathToIcon); } - //set portrait preview - if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_prt.svg").exists()){ - nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_prt.svg"); - }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ - nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); - } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ - nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); - } else{ - nameIconPair.portraitPreviewIcon = HbIcon(":/image/themePreview.svg"); + //Portrait preview + QString fullPathToPreviewPrt = (iconThemePath.path() + previewPathPrt ); + + if(previewPathPrt.isEmpty() || !QFileInfo(fullPathToPreviewPrt).exists()) { + + if(QFileInfo(fullPathToPreviewPrt + "/scalable/qtg_graf_theme_preview_prt.svg").exists()){ + nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/scalable/qtg_graf_theme_preview_prt.svg"); + }else if(QFileInfo(fullPathToPreviewPrt + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ + nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/scalable/qtg_graf_screen_bg_prt.svg"); + } else if(QFileInfo(fullPathToPreviewPrt + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ + nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/pixmap/qtg_graf_screen_bg_prt.png"); + } else{ + nameIconPair.portraitPreviewIcon = HbIcon(":/image/themePreview.svg"); + } + } + else { + nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt); } - //set landscape preview - if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_lsc.svg").exists()){ - nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_lsc.svg"); - }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_lsc.svg").exists()){ - nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_lsc.svg"); - } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_lsc.png").exists()){ - nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_lsc.png"); - } else{ - nameIconPair.landscapePreviewIcon = HbIcon(":/image/themePreview.svg"); + //Landscape preview + QString fullPathToPreviewLsc = (iconThemePath.path() + previewPathLsc ); + + if(previewPathLsc.isEmpty() || !QFileInfo(fullPathToPreviewLsc).exists()) { + + if(QFileInfo(fullPathToPreviewLsc + "/scalable/qtg_graf_theme_preview_lsc.svg").exists()){ + nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/scalable/qtg_graf_theme_preview_lsc.svg"); + }else if(QFileInfo(fullPathToPreviewLsc + "/scalable/qtg_graf_screen_bg_lsc.svg").exists()){ + nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/scalable/qtg_graf_screen_bg_lsc.svg"); + } else if(QFileInfo(fullPathToPreviewLsc + "/pixmap/qtg_graf_screen_bg_lsc.png").exists()){ + nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/pixmap/qtg_graf_screen_bg_lsc.png"); + } else{ + nameIconPair.landscapePreviewIcon = HbIcon(":/image/themePreview.svg"); + } + } + else { + nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc); } nameIconPair.name = name; @@ -236,21 +252,23 @@ } } } - // Include default - CpThemeChanger::ThemeInfo def; - def.name = KDefaultTheme; - def.icon = HbIcon(":/image/themePreview.svg"); - themeList.append(def); + if (mCurrentTheme.name == KDefaultTheme) { - mCurrentTheme = def; + // Include default + CpThemeChanger::ThemeInfo def; + def.name = KDefaultTheme; + def.icon = HbIcon(":/image/themePreview.svg"); + themeList.append(def); + + mCurrentTheme = def; } } const QList& CpThemeChangerPrivate::themes() const { - return themeList; + return themeList; } bool CpThemeChangerPrivate::connectToServer() @@ -289,7 +307,7 @@ if (exists) { result = themeClient->changeTheme(newTheme); updateThemeList(newTheme); -} + } return result; } diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemechanger_p.h --- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: HbThemeChangerPrivate class definition -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 HBTHEMECHANGER_P_H #define HBTHEMECHANGER_P_H @@ -71,8 +70,6 @@ const QList& themes() const; void updateThemeList(const QString& currentThemeName = QString()); - const QStringList directories() const; - const CpThemeChanger::ThemeInfo& currentTheme() const; int indexOf(const CpThemeChanger::ThemeInfo& theme) const; diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "cpthemeclient_p.h" diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeclient_p.h --- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Fri May 14 13:21:08 2010 +0800 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 CPTHEMECLIENT_P_H #define CPTHEMECLIENT_P_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "cpthemeclientqt_p.h" #include @@ -25,11 +24,7 @@ #include #include -// TODO Do we need these? -//#include -//#include -//#include -//#include "hbthemecommon_p.h" + #define WAIT_TIME_TO_CONNECT_TO_SERVER 500 #define WAIT_TIME_TO_START_SERVER 5000 diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h --- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 CPTHEMECLIENTQT_P_H #define CPTHEMECLIENTQT_P_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -1,35 +1,29 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 "cpthemeclientsymbian_p.h" #include "cpthemesymbiancommon_p.h" +#include -#include -#include -#include - -const TUint KDefaultMessageSlots = 4; /** * constructor */ -CpThemeClientPrivate::CpThemeClientPrivate(): - clientConnected(false) +CpThemeClientPrivate::CpThemeClientPrivate() { } @@ -40,11 +34,7 @@ */ bool CpThemeClientPrivate::connectToServer() { - - TInt error; - - error = CreateSession(KThemeServerName, Version(), KDefaultMessageSlots); - return( clientConnected = (KErrNone == error ) ); + return true; } /** @@ -52,19 +42,7 @@ */ bool CpThemeClientPrivate::isConnected() { - return connected; -} - - - -/** -Returns the version number -*/ -TVersion CpThemeClientPrivate::Version(void) const -{ - return(TVersion(KThemeServerMajorVersionNumber, - KThemeServerMinorVersionNumber, - KThemeServerBuildVersionNumber)); + return true; } /** @@ -72,53 +50,6 @@ */ CpThemeClientPrivate::~CpThemeClientPrivate() { - RSessionBase::Close(); -} - -/** - * StartServer - */ -TInt CpThemeClientPrivate::StartServer() -{ - TFindServer findThemeServer(KThemeServerName); - TFullName name; - if ( KErrNone == findThemeServer.Next( name ) ) { - // Server already running - return KErrNone; - } - return CreateServerProcess(); -} - -/** - * CreateServerProcess - */ -TInt CpThemeClientPrivate::CreateServerProcess() -{ - TInt result; - const TUid KServerUid2={0x100039CE}; - const TUidType serverUid( KNullUid, KServerUid2, KServerUid3 ); - RProcess server; - _LIT(KThemeServerExe,"hbthemeserver.exe"); - - result = server.Create( KThemeServerExe, KNullDesC, EOwnerProcess ); - - if (KErrNone != result) { - return result; - } - else { - TRequestStatus status; - server.Rendezvous(status); - if (status!=KRequestPending) { - server.Kill(0); // abort startup - } - else { - server.Resume(); // logon OK - start the server - } - User::WaitForRequest(status);// wait for start or death - server.Close(); - connected == status.Int() == KErrNone ? true : false; - return status.Int(); // return the error - } } /** @@ -126,8 +57,16 @@ */ bool CpThemeClientPrivate::changeTheme(const QString& aString ) { - TPtrC themeName(reinterpret_cast(aString.constData())); - TIpcArgs args(&themeName); - TInt err = SendReceive(EThemeSelection, args); - return KErrNone == err; + TInt err = KErrGeneral; + RProperty themeRequestProp; + + User::LeaveIfError( themeRequestProp.Attach( KServerUid3, KNewThemeForThemeChanger ) ); + + TBuf<256> newThemenameChangeRequest; + _LIT(KThemeRequestFormatter, "%d:%S"); + TBuf<256> newThemename(aString.utf16()); + newThemenameChangeRequest.Format( KThemeRequestFormatter, EThemeSelection, &newThemename); + err = themeRequestProp.Set(newThemenameChangeRequest); + themeRequestProp.Close(); + return (err == KErrNone); } diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h --- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h Fri May 14 13:21:08 2010 +0800 @@ -1,61 +1,40 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 CPTHEMECLIENTSYMBIAN_P_H #define CPTHEMECLIENTSYMBIAN_P_H - -#include -// TODO Do we need this? -//#include "hbthemecommon_p.h" -//ToDo: replace this with forward declaration +#include #if !defined(__E32BASE_H__) #include #endif -class CThemeListenerPrivate; -class QSizeF; -class HbEffectFxmlData; -struct MeshItem; - -class CpThemeClientPrivate : public RSessionBase +class CpThemeClientPrivate { public: CpThemeClientPrivate(); bool connectToServer(); + + bool changeTheme(const QString& newtheme); + bool isConnected(); - bool changeTheme(const QString& newtheme); ~CpThemeClientPrivate(); - -public: - bool clientConnected; - -private: - TVersion Version() const; - TInt StartServer(); - TInt CreateServerProcess(); - -private: - CThemeListenerPrivate *themelistener; - QString themeName; - bool connected; }; #endif /* CPTHEMECLIENTSYMBIAN_P_H */ diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemecommon_p.h --- a/controlpanelplugins/themeplugin/src/cpthemecommon_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemecommon_p.h Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 HBTHEMECOMMON_P_H #define HBTHEMECOMMON_P_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemecontrol.cpp --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Fri May 14 13:21:08 2010 +0800 @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include @@ -65,7 +67,8 @@ mThemePreview(0), mThemeChanger(0), mListModel(0), - mSortModel(0) + mSortModel(0), + mIdleTimer(0) { mThemeChanger = new CpThemeChanger(); @@ -75,7 +78,11 @@ QString path = "Z:/resource/qt/translations/"; translator->load("control_panel_" + lang, path); qApp->installTranslator(translator); - + + mIdleTimer = new QTimer(this); + connect(mIdleTimer, SIGNAL(timeout()), this, SLOT(themeChangeTimeout())); + connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(themeChangeFinished())); + } @@ -229,6 +236,7 @@ success = mThemeChanger->connectToServer(); if (success) { + QThread::currentThread()->setPriority(QThread::HighPriority); mThemeChanger->changeTheme(theme); emit themeUpdated(mThemeChanger->currentTheme().name, mThemeChanger->currentTheme().icon); } @@ -279,6 +287,20 @@ mThemeListView->closeView(); } +void CpThemeControl::themeChangeTimeout() +{ + //qDebug() << "ThemeChangeTimeout " ; + mIdleTimer->stop(); + QThread::currentThread()->setPriority(QThread::NormalPriority); + +} + +void CpThemeControl::themeChangeFinished() +{ + //qDebug() << "ThemeChangeFinished " ; + mIdleTimer->start(0); +} + /*! * Private function that sets the current index of theme list view to indicate * the active theme. diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemecontrol.h --- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Fri May 14 13:21:08 2010 +0800 @@ -20,6 +20,7 @@ #include #include +#include #include "cpthemechanger.h" #include @@ -55,6 +56,8 @@ void previewClosed(); void themeApplied(const QString& theme); void themeListClosed(); + void themeChangeTimeout(); + void themeChangeFinished(); private: void createThemeList(); @@ -67,6 +70,7 @@ CpThemeChanger* mThemeChanger; QAbstractItemModel* mListModel; QSortFilterProxyModel* mSortModel; + QTimer* mIdleTimer; }; #endif //CPTHEMECONTROL_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemelistview.cpp --- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeplugin.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.cpp Fri May 14 13:21:08 2010 +0800 @@ -41,7 +41,8 @@ /*! create the control panel entry item data for Theme settins. */ -CpSettingFormItemData *CpThemePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const + +QList CpThemePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const { //create a cpthemepluginentryitemdata with default values and return it. @@ -50,7 +51,7 @@ tr("Theme"), tr("Theme Name"), HbIcon(":/image/qgn_menu_note.svg")); - return entryItem; + return QList() << entryItem; } Q_EXPORT_PLUGIN2(cpthemeplugin, CpThemePlugin); diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemeplugin.h --- a/controlpanelplugins/themeplugin/src/cpthemeplugin.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemeplugin.h Fri May 14 13:21:08 2010 +0800 @@ -19,16 +19,16 @@ #define CPTHEMEPLUGIN_H #include -#include +#include -class CpThemePlugin : public QObject, public CpPluginPlatInterface +class CpThemePlugin : public QObject, public CpPluginInterface { Q_OBJECT - Q_INTERFACES(CpPluginPlatInterface) + Q_INTERFACES(CpPluginInterface) public: CpThemePlugin(); virtual ~CpThemePlugin(); - virtual CpSettingFormItemData *createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; }; #endif //CPTHEMEPLUGIN_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemepreview.cpp --- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Fri May 14 13:21:08 2010 +0800 @@ -18,7 +18,7 @@ #include #include #include - +#include #include #include #include @@ -42,7 +42,8 @@ CpThemePreview::CpThemePreview(const CpThemeChanger::ThemeInfo& theme, QGraphicsItem *parent) : HbView(parent), mTheme(theme), - mSoftKeyBackAction(0) + mSoftKeyBackAction(0), + mPreviewIcon(0) { //Create the layout and add heading and and preview icon to the layout. @@ -77,16 +78,18 @@ QObject::connect( cancelAction, SIGNAL(triggered()), this, SIGNAL(aboutToClose())); - - HbIconItem* layoutItem; - //layout->addItem(&HbIconItem(mTheme.icon, this )); + + QObject::connect( mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(previewOrientationChanged(Qt::Orientation))); + + if(mainWindow()->orientation() == Qt::Horizontal) { - layoutItem = new HbIconItem(mTheme.landscapePreviewIcon, this); + mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this); } else { - layoutItem = new HbIconItem(mTheme.portraitPreviewIcon, this); + mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this); } - layout->addItem(layoutItem); + layout->addItem(mPreviewIcon); layout->setAlignment(layout->itemAt(0), Qt::AlignTop); setToolBar(mToolBar); @@ -94,7 +97,7 @@ //Setup the Back button action and set softkey. Back button //takes the user to the theme list view. - mSoftKeyBackAction = new HbAction(Hb::BackAction, this); + mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()), this, SIGNAL(aboutToClose()) ); @@ -140,3 +143,29 @@ emit applyTheme(mTheme.name); } +/*! + * Slot to handle landscape/portrait orientation change to use the + * right graphics. + */ +void CpThemePreview::previewOrientationChanged(Qt::Orientation orientation) +{ + + QGraphicsLinearLayout* previewLayout = dynamic_cast(layout()); + + if(mPreviewIcon == dynamic_cast(previewLayout->itemAt(1)) ) { + previewLayout->removeAt(1); + delete mPreviewIcon; + mPreviewIcon = 0; + + if(orientation == Qt::Horizontal) { + mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this); + } + else { + mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this); + } + + previewLayout->addItem(mPreviewIcon); + } + +} + diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemepreview.h --- a/controlpanelplugins/themeplugin/src/cpthemepreview.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemepreview.h Fri May 14 13:21:08 2010 +0800 @@ -48,10 +48,13 @@ public slots: void themeSelected(); + void previewOrientationChanged(Qt::Orientation orientation); private: CpThemeChanger::ThemeInfo mTheme; HbAction* mSoftKeyBackAction; + HbIconItem* mPreviewIcon; + }; #endif //CPTHEMEPREVIEW_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h --- a/controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelplugins/themeplugin/src/cpthemesymbiancommon_p.h Fri May 14 13:21:08 2010 +0800 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies 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 HBTHEMESYMBIANCOMMON_P_H #define HBTHEMESYMBIANCOMMON_P_H @@ -53,6 +52,8 @@ // server name _LIT(KThemeServerName,"hbthemeserver"); const TUid KServerUid3={0x20022E82}; +// Common unique ID for Pub/Sub +const TInt KNewThemeForThemeChanger = 9; // A version must be specifyed when creating a session with the server diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/examples.pro --- a/controlpanelui/examples/examples.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/examples/examples.pro Fri May 14 13:21:08 2010 +0800 @@ -15,7 +15,9 @@ # TEMPLATE = subdirs -SUBDIRS = groupplugin/groupplugin.pro viewplugin/viewplugin.pro themeplugin/themeplugin.pro +SUBDIRS = groupplugin/groupplugin.pro \ + viewplugin/viewplugin.pro \ + pluginlauncherclient/pluginlauncherclient.pro CONFIG += ordered include (rom/rom.pri) \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pri Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,18 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpframework source files +# + +HEADERS += src/*.h +SOURCES += src/*.cpp \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/pluginlauncherclient.pro Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,38 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: cpframework source files +# + +TEMPLATE = app +TARGET = CpPluginLauncherClient +DEPENDPATH += . +INCLUDEPATH += . + +include (pluginlauncherclient.pri) + +CONFIG += hb + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +LIBS += -lxqservice -lcpframework +symbian::TARGET::UID3 = 0X2002873A diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/pluginlauncherclient/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/src/main.cpp Fri May 14 13:21:08 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: +* +*/ + +#include +#include +#include +#include +#include +#include "mainview.h" + +int main(int argc, char **argv) +{ + HbApplication app(argc, argv); + + HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH); + + HbMainWindow mainWindow; + MainView *mainView = new MainView(); + mainWindow.addView(mainView); + mainWindow.show(); + + return app.exec(); +} + +//End of File + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/pluginlauncherclient/src/mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/src/mainview.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "mainview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MainView::MainView(QGraphicsItem *parent/* = 0*/) +: HbView(parent) +{ + init(); +} + +MainView::~MainView() +{ + +} + +void MainView::init() +{ + setTitle(tr("CpPlugin Launcher")); + + HbMenu *menu = new HbMenu(); + setMenu(menu); + + HbAction *action = menu->addAction(tr("Launch View(in process)")); + connect(action, SIGNAL(triggered()), this, SLOT(launchInProcessProfileView())); + + action = menu->addAction(tr("Launch View(QtHighway)")); + connect(action, SIGNAL(triggered()), this, SLOT(launchQtHighwayProfileView())); +} + +void MainView::launchInProcessProfileView() +{ + CpBaseSettingView *settingView = CpPluginLauncher::launchSettingView("cppersonalizationplugin.dll","profile_view"); + if (settingView) { + connect(settingView,SIGNAL(returnValueDelivered(QVariant)),this,SLOT(handleReturnValue(QVariant))); + } +} + +void MainView::launchQtHighwayProfileView() +{ + XQAiwRequest *request = mAppMgr.create("com.nokia.symbian.ICpPluginLauncher", "launchSettingView(QString,QVariant)", true); + + if (!request) + { + return; + } + else + { + connect(request, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); + connect(request, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); + } + + + // Set arguments for request + QList args; + args << QVariant( "cppersonalizationplugin.dll" ); + args << QVariant ( "profile_view" ); + request->setArguments(args); + + // Make the request + if (!request->send()) + { + //report error + } + + delete request; +} + +void MainView::handleReturnValue(const QVariant &returnValue) +{ + HbMessageBox::information( QString("Return value:") + returnValue.toString()); +} + +void MainView::handleError(int errorCode,const QString &errorMessage) +{ + HbMessageBox::information( QString("handle error:") + errorMessage); +} + +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/pluginlauncherclient/src/mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/examples/pluginlauncherclient/src/mainview.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef MAINVIEW_H +#define MAINVIEW_H + +#include +#include + +class MainView : public HbView +{ + Q_OBJECT +public: + explicit MainView(QGraphicsItem *parent = 0); + virtual ~MainView(); +private: + void init(); +private slots: + void launchInProcessProfileView(); + void launchQtHighwayProfileView(); + void handleReturnValue(const QVariant &returnValue); + void handleError(int errorCode,const QString &errorMessage); +private: + Q_DISABLE_COPY(MainView) +private: + XQApplicationManager mAppMgr; +}; + +#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/rom/controlpanel_examples.iby --- a/controlpanelui/examples/rom/controlpanel_examples.iby Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/examples/rom/controlpanel_examples.iby Fri May 14 13:21:08 2010 +0800 @@ -16,6 +16,10 @@ * */ +file=ABI_DIR\BUILD_DIR\CpPluginLauncherClient.exe SHARED_LIB_DIR\CpPluginLauncherClient.exe +CP_UPGRADABLE_APP_REG_RSC(CpPluginLauncherClient) +S60_APP_RESOURCE(CpPluginLauncherClient) + file=ABI_DIR\BUILD_DIR\cpgroupplugin.dll SHARED_LIB_DIR\cpgroupplugin.dll file=ABI_DIR\BUILD_DIR\cpviewplugin.dll SHARED_LIB_DIR\cpviewplugin.dll diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/examples/viewplugin/src/cpsampleview.cpp --- a/controlpanelui/examples/viewplugin/src/cpsampleview.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/examples/viewplugin/src/cpsampleview.cpp Fri May 14 13:21:08 2010 +0800 @@ -29,7 +29,7 @@ mCheckBoxItem(0) { - HbDataForm *form = settingForm(); + HbDataForm *form = qobject_cast(widget()); if (form) { HbDataFormModel *model = new HbDataFormModel; diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/rom/controlpanelui.iby --- a/controlpanelui/rom/controlpanelui.iby Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/rom/controlpanelui.iby Fri May 14 13:21:08 2010 +0800 @@ -25,12 +25,15 @@ file=ABI_DIR\BUILD_DIR\controlpanel.exe SHARED_LIB_DIR\controlpanel.exe CP_UPGRADABLE_APP_REG_RSC(controlpanel) -S60_APP_RESOURCE(controlpanel) +file=ABI_DIR\BUILD_DIR\cpserviceprovider.exe SHARED_LIB_DIR\cpserviceprovider.exe +CP_UPGRADABLE_APP_REG_RSC(cpserviceprovider) file=ABI_DIR\BUILD_DIR\cpcategorymodel.dll SHARED_LIB_DIR\cpcategorymodel.dll file=ABI_DIR\BUILD_DIR\seccodeui.dll SHARED_LIB_DIR\seccodeui.dll file=ABI_DIR\BUILD_DIR\cpprofilewrapper.dll SHARED_LIB_DIR\cpprofilewrapper.dll +file=ABI_DIR\BUILD_DIR\cpringtoneview.dll SHARED_LIB_DIR\cpringtoneview.dll + file=ABI_DIR\BUILD_DIR\cppersonalizationplugin.dll SHARED_LIB_DIR\cppersonalizationplugin.dll file=ABI_DIR\BUILD_DIR\cpcommunicationplugin.dll SHARED_LIB_DIR\cpcommunicationplugin.dll diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/rom/controlpanelui_resources.iby --- a/controlpanelui/rom/controlpanelui_resources.iby Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/rom/controlpanelui_resources.iby Fri May 14 13:21:08 2010 +0800 @@ -24,5 +24,6 @@ data=DATAZ_\QT_TRANSLATIONS_DIR\control_panel.qm QT_TRANSLATIONS_DIR\control_panel.qm data=DATAZ_\APP_RESOURCE_DIR\ControlPanel.RSC APP_RESOURCE_DIR\ControlPanel.rsc +data=DATAZ_\APP_RESOURCE_DIR\cpserviceprovider.RSC APP_RESOURCE_DIR\cpserviceprovider.rsc #endif // CONTROLPANELUI_RESOURCES \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/bwins/cpcategorymodelu.def --- a/controlpanelui/src/bwins/cpcategorymodelu.def Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/bwins/cpcategorymodelu.def Fri May 14 13:21:08 2010 +0800 @@ -1,33 +1,53 @@ EXPORTS - ?qt_metacall@CpCategorySettingFormModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int CpCategorySettingFormModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?qt_metacall@CpCategorySettingFormItemData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int CpCategorySettingFormItemData::qt_metacall(enum QMetaObject::Call, int, void * *) - ??1CpCategorySettingFormModel@@UAE@XZ @ 3 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(void) - ?qt_metacast@CpCategorySettingFormModel@@UAEPAXPBD@Z @ 4 NONAME ; void * CpCategorySettingFormModel::qt_metacast(char const *) + ?stop@CpTaskExecutor@@QAEXXZ @ 1 NONAME ; void CpTaskExecutor::stop(void) + ?tr@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *) + ?getStaticMetaObject@CpTaskExecutor@@SAABUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const & CpTaskExecutor::getStaticMetaObject(void) + ??1CpCategorySettingFormModel@@UAE@XZ @ 4 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(void) ?beforeLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 5 NONAME ; void CpCategorySettingFormItemData::beforeLoadingConfigPlugins(class CpItemDataHelper &) - ?afterLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 6 NONAME ; void CpCategorySettingFormModel::afterLoadingConfigPlugins(class CpItemDataHelper &) - ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *, int) - ??0CpCategorySettingFormModel@@QAE@ABVQString@@@Z @ 8 NONAME ; CpCategorySettingFormModel::CpCategorySettingFormModel(class QString const &) - ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *) - ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *) - ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *) - ?getStaticMetaObject@CpCategorySettingFormModel@@SAABUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const & CpCategorySettingFormModel::getStaticMetaObject(void) - ?getStaticMetaObject@CpCategorySettingFormItemData@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & CpCategorySettingFormItemData::getStaticMetaObject(void) - ?initialize@CpCategorySettingFormModel@@UAEXAAVCpItemDataHelper@@@Z @ 14 NONAME ; void CpCategorySettingFormModel::initialize(class CpItemDataHelper &) - ?initialize@CpCategorySettingFormItemData@@QAEXAAVCpItemDataHelper@@@Z @ 15 NONAME ; void CpCategorySettingFormItemData::initialize(class CpItemDataHelper &) - ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *, int) - ??0CpCategorySettingFormItemData@@QAE@W4DataItemType@HbDataFormModelItem@@ABVQString@@1PBV2@@Z @ 17 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(enum HbDataFormModelItem::DataItemType, class QString const &, class QString const &, class HbDataFormModelItem const *) - ??1CpCategorySettingFormItemData@@UAE@XZ @ 18 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(void) - ?beforeLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 19 NONAME ; void CpCategorySettingFormModel::beforeLoadingConfigPlugins(class CpItemDataHelper &) - ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *) - ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 21 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *, int) - ?staticMetaObject@CpCategorySettingFormModel@@2UQMetaObject@@B @ 22 NONAME ; struct QMetaObject const CpCategorySettingFormModel::staticMetaObject - ?afterLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 23 NONAME ; void CpCategorySettingFormItemData::afterLoadingConfigPlugins(class CpItemDataHelper &) - ?metaObject@CpCategorySettingFormModel@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * CpCategorySettingFormModel::metaObject(void) const - ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 25 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *, int) - ?staticMetaObject@CpCategorySettingFormItemData@@2UQMetaObject@@B @ 26 NONAME ; struct QMetaObject const CpCategorySettingFormItemData::staticMetaObject - ?metaObject@CpCategorySettingFormItemData@@UBEPBUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const * CpCategorySettingFormItemData::metaObject(void) const - ??0CpCategorySettingFormItemData@@QAE@ABVQString@@PBVHbDataFormModelItem@@@Z @ 28 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(class QString const &, class HbDataFormModelItem const *) - ??_ECpCategorySettingFormModel@@UAE@I@Z @ 29 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(unsigned int) - ??_ECpCategorySettingFormItemData@@UAE@I@Z @ 30 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(unsigned int) - ?qt_metacast@CpCategorySettingFormItemData@@UAEPAXPBD@Z @ 31 NONAME ; void * CpCategorySettingFormItemData::qt_metacast(char const *) + ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *, int) + ??0CpCategorySettingFormModel@@QAE@ABVQString@@@Z @ 7 NONAME ; CpCategorySettingFormModel::CpCategorySettingFormModel(class QString const &) + ?staticMetaObject@CpTaskExecutor@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const CpTaskExecutor::staticMetaObject + ??_ECpTaskExecutor@@UAE@I@Z @ 9 NONAME ; CpTaskExecutor::~CpTaskExecutor(unsigned int) + ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *, int) + ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *) + ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *) + ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *) + ?getStaticMetaObject@CpCategorySettingFormModel@@SAABUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const & CpCategorySettingFormModel::getStaticMetaObject(void) + ?destroyGlobalInstance@CpTaskExecutor@@SAXXZ @ 15 NONAME ; void CpTaskExecutor::destroyGlobalInstance(void) + ?initialize@CpCategorySettingFormModel@@UAEXAAVCpItemDataHelper@@@Z @ 16 NONAME ; void CpCategorySettingFormModel::initialize(class CpItemDataHelper &) + ?initialize@CpCategorySettingFormItemData@@QAEXAAVCpItemDataHelper@@@Z @ 17 NONAME ; void CpCategorySettingFormItemData::initialize(class CpItemDataHelper &) + ?tr@CpTaskExecutor@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString CpTaskExecutor::tr(char const *, char const *, int) + ??0CpTaskExecutor@@QAE@PAVQObject@@@Z @ 19 NONAME ; CpTaskExecutor::CpTaskExecutor(class QObject *) + ?tr@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString CpCategorySettingFormItemData::tr(char const *, char const *, int) + ?qt_metacast@CpTaskExecutor@@UAEPAXPBD@Z @ 21 NONAME ; void * CpTaskExecutor::qt_metacast(char const *) + ??1CpCategorySettingFormItemData@@UAE@XZ @ 22 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(void) + ?beforeLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 23 NONAME ; void CpCategorySettingFormModel::beforeLoadingConfigPlugins(class CpItemDataHelper &) + ??1CpTaskExecutor@@UAE@XZ @ 24 NONAME ; CpTaskExecutor::~CpTaskExecutor(void) + ?createCpPluginItemData@@YAHPAVCpCreatePluginItemDataEvent@@@Z @ 25 NONAME ; int createCpPluginItemData(class CpCreatePluginItemDataEvent *) + ?trUtf8@CpCategorySettingFormModel@@SA?AVQString@@PBD0@Z @ 26 NONAME ; class QString CpCategorySettingFormModel::trUtf8(char const *, char const *) + ?staticMetaObject@CpCategorySettingFormModel@@2UQMetaObject@@B @ 27 NONAME ; struct QMetaObject const CpCategorySettingFormModel::staticMetaObject + ?qt_metacall@CpTaskExecutor@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 28 NONAME ; int CpTaskExecutor::qt_metacall(enum QMetaObject::Call, int, void * *) + ??0CpCategorySettingFormItemData@@QAE@ABVQString@@PBVHbDataFormModelItem@@@Z @ 29 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(class QString const &, class HbDataFormModelItem const *) + ?qt_metacast@CpCategorySettingFormItemData@@UAEPAXPBD@Z @ 30 NONAME ; void * CpCategorySettingFormItemData::qt_metacast(char const *) + ?toFront@CpTaskExecutor@@QAE_NPAVCpTask@@@Z @ 31 NONAME ; bool CpTaskExecutor::toFront(class CpTask *) + ?qt_metacall@CpCategorySettingFormModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 32 NONAME ; int CpCategorySettingFormModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?removeTasks@CpTaskExecutor@@AAEXXZ @ 33 NONAME ; void CpTaskExecutor::removeTasks(void) + ?qt_metacall@CpCategorySettingFormItemData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 34 NONAME ; int CpCategorySettingFormItemData::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@CpCategorySettingFormModel@@UAEPAXPBD@Z @ 35 NONAME ; void * CpCategorySettingFormModel::qt_metacast(char const *) + ?afterLoadingConfigPlugins@CpCategorySettingFormModel@@EAEXAAVCpItemDataHelper@@@Z @ 36 NONAME ; void CpCategorySettingFormModel::afterLoadingConfigPlugins(class CpItemDataHelper &) + ?getStaticMetaObject@CpCategorySettingFormItemData@@SAABUQMetaObject@@XZ @ 37 NONAME ; struct QMetaObject const & CpCategorySettingFormItemData::getStaticMetaObject(void) + ?metaObject@CpTaskExecutor@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * CpTaskExecutor::metaObject(void) const + ??0CpCategorySettingFormItemData@@QAE@W4DataItemType@HbDataFormModelItem@@ABVQString@@1PBV2@@Z @ 39 NONAME ; CpCategorySettingFormItemData::CpCategorySettingFormItemData(enum HbDataFormModelItem::DataItemType, class QString const &, class QString const &, class HbDataFormModelItem const *) + ?trUtf8@CpCategorySettingFormItemData@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString CpCategorySettingFormItemData::trUtf8(char const *, char const *, int) + ?runTask@CpTaskExecutor@@QAE_NPAVCpTask@@_N@Z @ 41 NONAME ; bool CpTaskExecutor::runTask(class CpTask *, bool) + ?afterLoadingConfigPlugins@CpCategorySettingFormItemData@@EAEXAAVCpItemDataHelper@@@Z @ 42 NONAME ; void CpCategorySettingFormItemData::afterLoadingConfigPlugins(class CpItemDataHelper &) + ?metaObject@CpCategorySettingFormModel@@UBEPBUQMetaObject@@XZ @ 43 NONAME ; struct QMetaObject const * CpCategorySettingFormModel::metaObject(void) const + ?tr@CpCategorySettingFormModel@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString CpCategorySettingFormModel::tr(char const *, char const *, int) + ?staticMetaObject@CpCategorySettingFormItemData@@2UQMetaObject@@B @ 45 NONAME ; struct QMetaObject const CpCategorySettingFormItemData::staticMetaObject + ?run@CpTaskExecutor@@MAEXXZ @ 46 NONAME ; void CpTaskExecutor::run(void) + ?metaObject@CpCategorySettingFormItemData@@UBEPBUQMetaObject@@XZ @ 47 NONAME ; struct QMetaObject const * CpCategorySettingFormItemData::metaObject(void) const + ?trUtf8@CpTaskExecutor@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString CpTaskExecutor::trUtf8(char const *, char const *) + ??_ECpCategorySettingFormItemData@@UAE@I@Z @ 49 NONAME ; CpCategorySettingFormItemData::~CpCategorySettingFormItemData(unsigned int) + ??_ECpCategorySettingFormModel@@UAE@I@Z @ 50 NONAME ; CpCategorySettingFormModel::~CpCategorySettingFormModel(unsigned int) + ?globalInstance@CpTaskExecutor@@SAPAV1@XZ @ 51 NONAME ; class CpTaskExecutor * CpTaskExecutor::globalInstance(void) diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/bwins/cpprofilewrapperu.def --- a/controlpanelui/src/bwins/cpprofilewrapperu.def Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/bwins/cpprofilewrapperu.def Fri May 14 13:21:08 2010 +0800 @@ -2,34 +2,34 @@ ?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) - ?masterVibra@CpProfileModel@@QBE_NXZ @ 4 NONAME ; bool CpProfileModel::masterVibra(void) const - ?ringTone@CpProfileModel@@QBE?AVQString@@XZ @ 5 NONAME ; class QString CpProfileModel::ringTone(void) const - ?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 &) - ?activeProfileId@CpProfileModel@@QAEHXZ @ 9 NONAME ; int CpProfileModel::activeProfileId(void) + ?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 *) - ?profileSettings@CpProfileModel@@QAEHHAAVCpProfileSettings@@@Z @ 11 NONAME ; int CpProfileModel::profileSettings(int, class CpProfileSettings &) + ?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 - ?masterVolume@CpProfileModel@@QBEHXZ @ 16 NONAME ; int CpProfileModel::masterVolume(void) const - ?notificationTone@CpProfileModel@@QBE_NH@Z @ 17 NONAME ; bool CpProfileModel::notificationTone(int) const - ?tr@CpProfileModel@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString CpProfileModel::tr(char const *, char const *) - ?getStaticMetaObject@CpProfileModel@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & CpProfileModel::getStaticMetaObject(void) - ?keyTouchScreenTone@CpProfileModel@@QBEHH@Z @ 20 NONAME ; int CpProfileModel::keyTouchScreenTone(int) const - ?setRingTone@CpProfileModel@@QAEXHABVQString@@@Z @ 21 NONAME ; void CpProfileModel::setRingTone(int, class QString const &) - ?reminderTone@CpProfileModel@@QBE?AVQString@@H@Z @ 22 NONAME ; class QString CpProfileModel::reminderTone(int) const - ?profileName@CpProfileModel@@QBE?AVQString@@H@Z @ 23 NONAME ; class QString CpProfileModel::profileName(int) const - ?setKeyTouchScreenTone@CpProfileModel@@QAEXHH@Z @ 24 NONAME ; void CpProfileModel::setKeyTouchScreenTone(int, int) - ?setMasterVolume@CpProfileModel@@QAEXH@Z @ 25 NONAME ; void CpProfileModel::setMasterVolume(int) - ?staticMetaObject@CpProfileModel@@2UQMetaObject@@B @ 26 NONAME ; struct QMetaObject const CpProfileModel::staticMetaObject - ?profileNames@CpProfileModel@@QBE?AVQStringList@@XZ @ 27 NONAME ; class QStringList CpProfileModel::profileNames(void) 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) - ?setNotificationVibra@CpProfileModel@@QAEXH_N@Z @ 29 NONAME ; void CpProfileModel::setNotificationVibra(int, bool) - ?setNotificationTone@CpProfileModel@@QAEXH_N@Z @ 30 NONAME ; void CpProfileModel::setNotificationTone(int, bool) - ?isOffLineMode@CpProfileModel@@QBE_NXZ @ 31 NONAME ; bool CpProfileModel::isOffLineMode(void) const + ?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 *) @@ -38,17 +38,17 @@ ?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) - ?isSilenceMode@CpProfileModel@@QBE_NXZ @ 40 NONAME ; bool CpProfileModel::isSilenceMode(void) const - ?notificationVibra@CpProfileModel@@QBE_NH@Z @ 41 NONAME ; bool CpProfileModel::notificationVibra(int) const - ?qt_metacall@CpProfileModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 42 NONAME ; int CpProfileModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?messageTone@CpProfileModel@@QBE?AVQString@@H@Z @ 43 NONAME ; class QString CpProfileModel::messageTone(int) const + ?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) - ?messageVibra@CpProfileModel@@QBE_NH@Z @ 49 NONAME ; bool CpProfileModel::messageVibra(int) const - ?initiationFlag@CpProfileModel@@QAEHXZ @ 50 NONAME ; int CpProfileModel::initiationFlag(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) diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/bwins/cpringtoneviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/bwins/cpringtoneviewu.def Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,20 @@ +EXPORTS + ?tr@CpRingToneView@@SA?AVQString@@PBD0@Z @ 1 NONAME ; class QString CpRingToneView::tr(char const *, char const *) + ?selOK@CpRingToneView@@IAEXABVQString@@@Z @ 2 NONAME ; void CpRingToneView::selOK(class QString const &) + ??1CpRingToneView@@UAE@XZ @ 3 NONAME ; CpRingToneView::~CpRingToneView(void) + ?getStaticMetaObject@CpRingToneView@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & CpRingToneView::getStaticMetaObject(void) + ?handleError@CpRingToneView@@AAEXHABVQString@@@Z @ 5 NONAME ; void CpRingToneView::handleError(int, class QString const &) + ?launchMediaFetcher@CpRingToneView@@AAEXABVQString@@0@Z @ 6 NONAME ; void CpRingToneView::launchMediaFetcher(class QString const &, class QString const &) + ?onTypeSelected@CpRingToneView@@AAEXPAVHbListWidgetItem@@@Z @ 7 NONAME ; void CpRingToneView::onTypeSelected(class HbListWidgetItem *) + ?selError@CpRingToneView@@IAEXHABVQString@@@Z @ 8 NONAME ; void CpRingToneView::selError(int, class QString const &) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *, int) + ?qt_metacall@CpRingToneView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int CpRingToneView::qt_metacall(enum QMetaObject::Call, int, void * *) + ?staticMetaObject@CpRingToneView@@2UQMetaObject@@B @ 11 NONAME ; struct QMetaObject const CpRingToneView::staticMetaObject + ?metaObject@CpRingToneView@@UBEPBUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const * CpRingToneView::metaObject(void) const + ?tr@CpRingToneView@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString CpRingToneView::tr(char const *, char const *, int) + ??0CpRingToneView@@QAE@PAVQGraphicsItem@@@Z @ 14 NONAME ; CpRingToneView::CpRingToneView(class QGraphicsItem *) + ??_ECpRingToneView@@UAE@I@Z @ 15 NONAME ; CpRingToneView::~CpRingToneView(unsigned int) + ?trUtf8@CpRingToneView@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString CpRingToneView::trUtf8(char const *, char const *) + ?handleOk@CpRingToneView@@AAEXABVQVariant@@@Z @ 17 NONAME ; void CpRingToneView::handleOk(class QVariant const &) + ?qt_metacast@CpRingToneView@@UAEPAXPBD@Z @ 18 NONAME ; void * CpRingToneView::qt_metacast(char const *) + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/cpapplication.pri --- a/controlpanelui/src/cpapplication/cpapplication.pri Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpapplication/cpapplication.pri Fri May 14 13:21:08 2010 +0800 @@ -15,8 +15,10 @@ # HEADERS += src/cpmainview.h \ + src/cpmainwindow.h \ src/cpmainmodel.h SOURCES += src/main.cpp \ src/cpmainview.cpp \ + src/cpmainwindow.cpp \ src/cpmainmodel.cpp \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/data/mainview.cpcfg --- a/controlpanelui/src/cpapplication/data/mainview.cpcfg Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpapplication/data/mainview.cpcfg Fri May 14 13:21:08 2010 +0800 @@ -5,11 +5,7 @@ - - - - - + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/src/cpmainview.cpp --- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Fri May 14 13:21:08 2010 +0800 @@ -18,19 +18,21 @@ #include "cpmainview.h" #include "cpmainmodel.h" #include +#include #include #include #include -CpMainView::CpMainView(QGraphicsItem *parent /*= 0*/) -: CpBaseSettingView(0,parent), mMainModel(0), mItemDataHelper(0) -{ - if (HbDataForm *form = settingForm()) { - mItemDataHelper = new CpItemDataHelper(form); - mMainModel = new CpMainModel; - mMainModel->initialize(*mItemDataHelper); - form->setModel(mMainModel); - } +//CpMainView implementation +CpMainView::CpMainView(HbMainWindow *mainWindow/*= 0*/) +: CpBaseSettingView(0,0), + mMainModel(0), + mItemDataHelper(0), + mMainWindow(mainWindow) +{ + //delay loading + connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel())); + setTitle( QObject::tr("Control Panel") ); //should use qtTrId("txt_cp_title_control_panel") } @@ -48,4 +50,17 @@ return CpBaseSettingView::event(e); } +void CpMainView::initializeMainModel() +{ + if (HbDataForm *form = qobject_cast(widget())) { + if (!mMainModel) { + mItemDataHelper = new CpItemDataHelper(form); + mMainModel = new CpMainModel; + mMainModel->initialize(*mItemDataHelper); + form->setModel(mMainModel); + + connect(form,SIGNAL(activated(QModelIndex)),this,SLOT(onDataFormItemActivated(QModelIndex))); + } + } +} // End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/src/cpmainview.h --- a/controlpanelui/src/cpapplication/src/cpmainview.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpapplication/src/cpmainview.h Fri May 14 13:21:08 2010 +0800 @@ -23,19 +23,23 @@ class HbAbstractViewItem; class HbDataFormModelItem; class CpItemDataHelper; +class HbMainWindow; class CpMainView : public CpBaseSettingView { Q_OBJECT public: - explicit CpMainView(QGraphicsItem *parent = 0); + explicit CpMainView(HbMainWindow *mainWindow = 0); virtual ~CpMainView(); bool event(QEvent *e); +private slots: + void initializeMainModel(); private: Q_DISABLE_COPY(CpMainView) private: CpMainModel *mMainModel; CpItemDataHelper *mItemDataHelper; + HbMainWindow *mMainWindow; }; #endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/src/cpmainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cpmainwindow.h" +#include "cpmainview.h" +#include +#include +#include +#include +#include + +//CpMainWindow implementation +CpMainWindow::CpMainWindow(QWidget *parent /*= 0*/, Hb::WindowFlags windowFlags /*= Hb::WindowFlagNone*/) +: HbMainWindow(parent,windowFlags) +{ +} + +CpMainWindow::~CpMainWindow() +{ + +} + +bool CpMainWindow::event(QEvent *e) +{ + if (e->type() == (QEvent::Type)(CpCreatePluginItemDataEvent::CreatePluginItemData)) { + CpCreatePluginItemDataEvent *event = static_cast(e); + ::createCpPluginItemData(event); + e->accept(); + } + return HbMainWindow::event(e); +} + +//End of File + + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/src/cpmainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpapplication/src/cpmainwindow.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPMAINWINDOW_H +#define CPMAINWINDOW_H + +#include + +class CpMainWindow : public HbMainWindow +{ + Q_OBJECT +public: + explicit CpMainWindow(QWidget *parent = 0, Hb::WindowFlags windowFlags = Hb::WindowFlagNone); + ~CpMainWindow(); +public: + virtual bool event(QEvent *e); +}; + +#endif // CPMAINWINDOW_H + +//End of File + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpapplication/src/main.cpp --- a/controlpanelui/src/cpapplication/src/main.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpapplication/src/main.cpp Fri May 14 13:21:08 2010 +0800 @@ -16,14 +16,15 @@ */ #include -#include +#include +#include #include #include +#include #include #include #include #include -#include "cpmainview.h" int main(int argc, char **argv) { @@ -50,11 +51,13 @@ HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH); - HbMainWindow mainWindow; - CpMainView *mainView = new CpMainView(); - - QObject::connect(mainView,SIGNAL(aboutToClose()),&app, SLOT(quit())); + CpMainWindow mainWindow; + + CpMainView *mainView = new CpMainView(&mainWindow); + QObject::connect(mainView,SIGNAL(aboutToClose()),qApp,SLOT(quit())); mainWindow.addView(mainView); + mainWindow.setCurrentView(mainView); + mainWindow.show(); int ret = app.exec(); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/cpcategorymodel.pri --- a/controlpanelui/src/cpcategorymodel/cpcategorymodel.pri Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/cpcategorymodel.pri Fri May 14 13:21:08 2010 +0800 @@ -16,12 +16,13 @@ HEADERS += $$PWD/src/cpplaceholderitemdata.h \ $$PWD/src/cppluginconfigreader.h \ - $$PWD/src/cputility.h + $$PWD/src/cpcategorymodelutility.h SOURCES += $$PWD/src/cpcategorysettingformitemdata.cpp \ $$PWD/src/cpcategorysettingformmodel.cpp \ $$PWD/src/cpplaceholderitemdata.cpp \ $$PWD/src/cppluginconfig.cpp \ $$PWD/src/cppluginconfigreader.cpp \ - $$PWD/src/cputility.cpp + $$PWD/src/cpcategorymodelutility.cpp \ + $$PWD/src/cptaskexecutor.cpp \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,326 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 "cpcategorymodelutility.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cpcategorysettingformitemdata.h" +#include "cppluginconfigreader.h" +#include "cpplaceholderitemdata.h" + +static HbMainWindow *mainWindow() +{ + QList< HbMainWindow* > mainWindows = hbInstance->allMainWindows(); + if (!mainWindows.isEmpty()) { + return mainWindows.front(); + } + return 0; +} + + +//#define ASYNC_LOAD_CPPLUGIN + +class CpLoadConfigPluginsTask : public CpTask +{ +public: + CpLoadConfigPluginsTask(HbDataFormModelItem *parentItem, + const QString &configFile, + CpItemDataHelper *itemDataHelper, + int startPosition) : + mParentItem(parentItem), + mConfigFile(configFile), + mItemDataHelper(itemDataHelper), + mStartPosition(startPosition) + { + + } + + virtual ~CpLoadConfigPluginsTask() + { + + } + + virtual void execute(volatile bool *stopped) + { + if (!mParentItem) { + return; + } + + QString configPath(mConfigFile); + QFileInfo fi(mConfigFile); + //if it is a relative path, search the config file from device drives. + if (!fi.isAbsolute()) { + QStringList dirs = CpCategoryModelUtility::configFileDirectories(); + foreach(const QString &dir,dirs) { + configPath = dir + fi.fileName(); + if (QFileInfo(configPath).exists()) { + CPFW_LOG(configPath + " has been found."); + break; + } + } + } + + QList pluginConfigs = CpPluginConfigReader(configPath).readCpPluginConfigs(); + + int position = mStartPosition; + foreach(const CpPluginConfig &pluginConfig, pluginConfigs) { + if (stopped && *stopped) { + break; + } + + CPFW_LOG(QLatin1String("Load plugin: ") + pluginConfig.mPluginFile + " from " + configPath); + + CpCreatePluginItemDataEvent *event = new CpCreatePluginItemDataEvent; + + event->mParentItem = mParentItem; + + if (mStartPosition < 0) { + event->mItemPosition = mStartPosition; //append + } + else { + event->mItemPosition = position++; + } + + event->mItemDataHelper = mItemDataHelper; + + event->mDisplayName = pluginConfig.mDisplayName; + event->mDescription = pluginConfig.mDescription; + event->mPluginFile = pluginConfig.mPluginFile; + + //firstly, handle CpPluginInterface + if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) { + CPFW_LOG("Load root component CpPluginInterface succeed."); + event->mPluginInterface = plugin; + } + + //post event to main window in main thread + QCoreApplication::postEvent(mainWindow(),event); + + } //end foreach + + } +private: + HbDataFormModelItem *mParentItem; + QString mConfigFile; + CpItemDataHelper *mItemDataHelper; + int mStartPosition; +}; + +void CpCategoryModelUtility::buildConfigPluginItems(HbDataFormModelItem *parent, + const QString &configFile, + CpItemDataHelper &itemDataHelper, + int startPosition) +{ +#ifdef ASYNC_LOAD_CPPLUGIN + CpTaskExecutor::globalInstance()->runTask + ( new CpLoadConfigPluginsTask(parent,configFile,&itemDataHelper,startPosition) ); + +#else + if (!parent) { + return; + } + + QString configPath(configFile); + QFileInfo fi(configFile); + //if it is a relative path, search the config file from device drives. + if (!fi.isAbsolute()) { + QStringList dirs = CpCategoryModelUtility::configFileDirectories(); + foreach(const QString &dir,dirs) { + configPath = dir + fi.fileName(); + if (QFileInfo(configPath).exists()) { + CPFW_LOG(configPath + " has been found."); + break; + } + } + } + + QList pluginConfigs = CpPluginConfigReader(configPath).readCpPluginConfigs(); + + foreach(const CpPluginConfig &pluginConfig, pluginConfigs) { + CPFW_LOG(QLatin1String("Load plugin: ") + pluginConfig.mPluginFile + " from " + configPath); + + QList itemDataList; + + //firstly, handle CpPluginInterface + if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) { + CPFW_LOG("Load root component CpPluginInterface succeed."); + itemDataList = plugin->createSettingFormItemData(itemDataHelper); + } + + else { + CPFW_LOG(QLatin1String("Load plugin:") + pluginConfig.mPluginFile + QLatin1String(" failed.")); + #ifdef _DEBUG + CPFW_LOG(QLatin1String("***Add a placeholder.")); + itemDataList.append(new CpPlaceHolderItemData(itemDataHelper,pluginConfig)); + #endif + } + + foreach(CpSettingFormItemData *itemData,itemDataList) { + if (itemData) { + //append the new created setting form item to its parent item. + parent->insertChild(startPosition++,itemData); + + if (CpCategorySettingFormItemData *categoryItemData + = qobject_cast(itemData)) { + categoryItemData->initialize(itemDataHelper); + } + + //set the text and description from config if it is empty. + setEntryItemContentIfEmpty(itemData,pluginConfig.mDisplayName,pluginConfig.mDescription); + } + } //end foreach + + } //end foreach +#endif + +} + +bool CpCategoryModelUtility::setEntryItemContentIfEmpty(CpSettingFormItemData *itemData, + const QString &displayName, + const QString &description) +{ + CpSettingFormEntryItemData *entryItemData = qobject_cast< CpSettingFormEntryItemData* > (itemData); + if (!entryItemData) { + return false; + } + + if (entryItemData->text().isEmpty()) { + entryItemData->setText(displayName); + } + if (entryItemData->description().isEmpty()) { + entryItemData->setDescription(description); + } + if (entryItemData->iconName().isEmpty()) { + entryItemData->setIconName( + CP_RESOURCE_PATH + + QDir::separator() + + ICON_SUB_PATH + + QDir::separator() + + QLatin1String("qgn_prop_set_default_sub.svg") ); + } + + return true; +} + +QStringList CpCategoryModelUtility::drives() +{ + static QStringList drives; + + if (drives.empty()) { + CPFW_LOG("device drives:"); +#ifdef WIN32 + drives.append("C:"); + CPFW_LOG("C:"); +#else + QFileInfoList fileInfoList = QDir::drives(); + foreach(const QFileInfo &fileInfo,fileInfoList) { + QString str = fileInfo.filePath(); + if (str.length() > 2) { + str = str.left(2); + } + drives.append(str); + CPFW_LOG(str); + } +#endif + } + + return drives; +} + +static QStringList directoriesFromAllDrives(const QString &baseDir) +{ + QStringList dirs; + + QStringList drives = CpCategoryModelUtility::drives(); + foreach(const QString &drive,drives) { + QString dir = drive + baseDir + QDir::separator(); + if (QFileInfo(dir).exists()) { + dirs.append(dir); + CPFW_LOG(dir); + } + } + + return dirs; +} + +QStringList CpCategoryModelUtility::pluginDirectories() +{ + static QStringList dirs; + if (dirs.empty()) { + CPFW_LOG("ControlPanel plugin derectories:") + dirs = directoriesFromAllDrives(CP_PLUGIN_PATH); + } + return dirs; +} + +QStringList CpCategoryModelUtility::configFileDirectories() +{ + static QStringList dirs; + if (dirs.empty()) { + CPFW_LOG("ControlPanel configuration file derectories:"); + dirs = directoriesFromAllDrives(CP_PLUGIN_CONFIG_PATH); + } + return dirs; +} + +CP_CATEGORY_EXPORT int createCpPluginItemData(CpCreatePluginItemDataEvent *event) +{ + QList itemDataList; + + if (event->mPluginInterface) { + itemDataList = event->mPluginInterface->createSettingFormItemData(*(event->mItemDataHelper)); + } + + else { + #ifdef _DEBUG + itemDataList.append(new CpPlaceHolderItemData(*(event->mItemDataHelper),event->mDisplayName,event->mPluginFile)); + #endif + } + + foreach(CpSettingFormItemData *itemData,itemDataList) { + if (itemData) { + //append the new created setting form item to its parent item. + if (event->mItemPosition < 0) { + event->mParentItem->appendChild(itemData); + } + else { + event->mParentItem->insertChild(event->mItemPosition,itemData); + } + + if (CpCategorySettingFormItemData *categoryItemData + = qobject_cast(itemData)) { + categoryItemData->initialize(*(event->mItemDataHelper)); + } + + //set the text and description from config if it is empty. + CpCategoryModelUtility::setEntryItemContentIfEmpty(itemData,event->mDisplayName,event->mDescription); + } + } //end foreach + + return itemDataList.count(); +} + +//End of File + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorymodelutility.h Fri May 14 13:21:08 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: +* +*/ +#ifndef CPCATEGORYMODELUTILITY_H +#define CPCATEGORYMODELUTILITY_H + +#include + +class HbDataFormModelItem; +class CpItemDataHelper; +class CpSettingFormItemData; + +class CpCategoryModelUtility +{ +public: + /* + load all controlpanel plugins from configuration file, + and create model items form the loaded plugins + and append model items to given parent + */ + static void buildConfigPluginItems( + HbDataFormModelItem *parent, + const QString &configFile, + CpItemDataHelper &itemDataHelper, + int startPosition); + + /* + setEntryItemContentIfEmpty + */ + static bool setEntryItemContentIfEmpty( + CpSettingFormItemData *itemData, + const QString &displayName, + const QString &description); + + /* + get all physical drives of the devices + */ + static QStringList drives(); + + /* + get all controlpanel plugin directories of the device + */ + static QStringList pluginDirectories(); + + /* + get all config directories of the device + */ + static QStringList configFileDirectories(); + +}; + +#endif // CPCATEGORYMODELUTILITY_H + +//End of File + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformitemdata.cpp Fri May 14 13:21:08 2010 +0800 @@ -16,7 +16,7 @@ */ #include "cpcategorysettingformitemdata.h" #include -#include "cputility.h" +#include "cpcategorymodelutility.h" class CpCategorySettingFormItemDataPrivate { @@ -64,13 +64,20 @@ { //avoid to be called twice if (!d->mInitialized) { - //give derived class a change do their special things before loading config plugins + //give derived class a chance do their special things before loading config plugins beforeLoadingConfigPlugins(itemDataHelper); + + int pluginItemStartPosition = childCount(); + //give derived class a chance do their special things after loading config plugins + afterLoadingConfigPlugins(itemDataHelper); + //load plugins which are configured - CpUtility::buildConfigPluginItems(this,d->mConfigFile,itemDataHelper); - //give derived class a change do their special things after loading config plugins - afterLoadingConfigPlugins(itemDataHelper); - + CpCategoryModelUtility::buildConfigPluginItems( + this, + d->mConfigFile, + itemDataHelper, + pluginItemStartPosition); + d->mInitialized = true; } } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/src/cpcategorysettingformmodel.cpp Fri May 14 13:21:08 2010 +0800 @@ -18,7 +18,7 @@ #include "cpcategorysettingformmodel.h" #include -#include "cputility.h" +#include "cpcategorymodelutility.h" #include class CpCategorySettingFormModelPrivate @@ -55,10 +55,16 @@ if (!d->mInitialized) { //give derived class a change do their special things before loading config plugins beforeLoadingConfigPlugins(itemDataHelper); - //load plugins which are configured - CpUtility::buildConfigPluginItems(invisibleRootItem(),d->mConfigFile,itemDataHelper); + + int pluginItemStartPosition = invisibleRootItem()->childCount(); //give derived class a change do their special things after loading config plugins afterLoadingConfigPlugins(itemDataHelper); + + //load plugins which are configured + CpCategoryModelUtility::buildConfigPluginItems(invisibleRootItem(), + d->mConfigFile, + itemDataHelper, + pluginItemStartPosition); d->mInitialized = true; } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp --- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.cpp Fri May 14 13:21:08 2010 +0800 @@ -29,6 +29,17 @@ { } +CpPlaceHolderItemData::CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper, + const QString &displayName, + const QString &pluginFile) + : CpSettingFormEntryItemData ( + itemDataHelper, + displayName, + pluginFile) +{ + +} + CpPlaceHolderItemData::~CpPlaceHolderItemData() { } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h --- a/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpcategorymodel/src/cpplaceholderitemdata.h Fri May 14 13:21:08 2010 +0800 @@ -28,6 +28,7 @@ Q_OBJECT public: CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper,const CpPluginConfig &pluginConfig); + CpPlaceHolderItemData(CpItemDataHelper &itemDataHelper,const QString &displayName,const QString &pluginFile); virtual ~CpPlaceHolderItemData(); private slots: virtual void onLaunchView(); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cptaskexecutor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpcategorymodel/src/cptaskexecutor.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "cptaskexecutor.h" +#include +#include +#include +#include + +static QPointer g_instance; + +CpTaskExecutor *CpTaskExecutor::globalInstance() +{ + if (!g_instance) { + g_instance = new CpTaskExecutor(); + } + return g_instance.data(); +} + +void CpTaskExecutor::destroyGlobalInstance() +{ + delete g_instance.data(); +} + +CpTaskExecutor::CpTaskExecutor(QObject *parent /*=0*/) +: QThread(parent), mStopped(false) +{ +} + +CpTaskExecutor::~CpTaskExecutor() +{ + stop(); +} + +bool CpTaskExecutor::runTask(CpTask *task,bool append /*= false*/) +{ + if (mStopped) { + if (isRunning()) { + qDebug() << "thread in stopping process...can not run task.\r\n"; + return false; + } + mStopped = false; + } + + if (task) { + { + QMutexLocker locker(&mMutex); + if (append) { + mTasks.append(task); + } + else { + mTasks.insert(0,task); + } + } + + if (!isRunning()) { + qDebug() << "isRunning() == false, call start()\r\n"; + start(); + } + } + + return true; +} + +void CpTaskExecutor::stop() +{ + if (!mStopped && isRunning() ) { + mStopped = true; + removeTasks(); + wait(); //wait for finished + } +} + +void CpTaskExecutor::removeTasks() +{ + QMutexLocker locker(&mMutex); + + QList::const_iterator begin(mTasks.begin()); + QList::const_iterator end(mTasks.end()); + for (; begin != end; ++begin) { + if ((*begin)->autoDelete()) { + delete (*begin); + } + } + + mTasks.clear(); +} + +void CpTaskExecutor::run() +{ + while (!mStopped) { + CpTask *task = 0; + { + QMutexLocker locker(&mMutex); + if (mTasks.isEmpty()) { + break; + } + task = mTasks.takeFirst(); + } + try { + task->execute(&mStopped); + task->complete(&mStopped); + }catch(...) { + qDebug() << "excetion occur when running task\r\n"; + } + + if (task->autoDelete()) { + delete task; + } + } +} + +bool CpTaskExecutor::toFront(CpTask *task) +{ + QMutexLocker locker(&mMutex); + QList::iterator foundIterator = ::qFind(mTasks.begin(),mTasks.end(),task); + if (foundIterator == mTasks.end()) { + return false; + } + + mTasks.erase(foundIterator); + mTasks.insert(0,task); + + return true; +} + +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cputility.cpp --- a/controlpanelui/src/cpcategorymodel/src/cputility.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +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 "cputility.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cpcategorysettingformitemdata.h" -#include "cppluginconfigreader.h" -#include "cpplaceholderitemdata.h" - - -static bool setEntryItemContentIfEmpty(CpSettingFormItemData *itemData, - const CpPluginConfig &pluginConfig) -{ - CpSettingFormEntryItemData *entryItemData = qobject_cast< CpSettingFormEntryItemData* > (itemData); - if (!entryItemData) { - return false; - } - - if (entryItemData->text().isEmpty()) { - entryItemData->setText(pluginConfig.mDisplayName); - } - if (entryItemData->description().isEmpty()) { - entryItemData->setDescription(pluginConfig.mDescription); - } - if (entryItemData->iconName().isEmpty()) { - entryItemData->setIconName( - CP_RESOURCE_PATH - + QDir::separator() - + ICON_SUB_PATH - + QDir::separator() - + QLatin1String("qgn_prop_set_default_sub.svg") ); - } - - return true; -} - - -void CpUtility::buildConfigPluginItems(HbDataFormModelItem *parent, - const QString &configFile, - CpItemDataHelper &itemDataHelper) -{ - if (!parent) { - return; - } - - QString configPath(configFile); - QFileInfo fi(configFile); - //if it is a relative path, search the config file from device drives. - if (!fi.isAbsolute()) { - QStringList dirs = CpUtility::configFileDirectories(); - foreach(const QString &dir,dirs) { - configPath = dir + fi.fileName(); - if (QFileInfo(configPath).exists()) { - CPFW_LOG(configPath + " has been found."); - break; - } - } - } - - QList pluginConfigs = CpPluginConfigReader(configPath).readCpPluginConfigs(); - - foreach(const CpPluginConfig &pluginConfig, pluginConfigs) { - CPFW_LOG(QLatin1String("Load plugin: ") + pluginConfig.mPluginFile + " from " + configPath); - - QList itemDataList; - - //firstly, handle CpPluginInterface - if (CpPluginInterface *plugin = CpPluginLoader().loadCpPluginInterface(pluginConfig.mPluginFile)) { - CPFW_LOG("Load root component CpPluginInterface succeed."); - itemDataList = plugin->createSettingFormItemData(itemDataHelper); - } - //handle CpPluginPlatInterface - else if (CpPluginPlatInterface *plugin = CpPluginLoader().loadPlatCpPlugin(pluginConfig.mPluginFile)) { - CPFW_LOG("Load root component CpPluginPlatInterface succeed."); - CPFW_LOG("WARNING: CpPluginPlatInterface is deprecated. Please return CpPluginInterface from plugin."); - CpSettingFormItemData *itemData = plugin->createSettingFormItemData(itemDataHelper); - if (itemData) { - itemDataList.append(itemData); - } - } - - else { - CPFW_LOG(QLatin1String("Load plugin:") + pluginConfig.mPluginFile + QLatin1String(" failed.")); - #ifdef _DEBUG - CPFW_LOG(QLatin1String("***Add a placeholder.")); - itemDataList.append(new CpPlaceHolderItemData(itemDataHelper,pluginConfig)); - #endif - } - - if (itemDataList.count()) { - foreach(CpSettingFormItemData *itemData,itemDataList) { - if (itemData) { - //append the new created setting form item to its parent item. - parent->appendChild(itemData); - - if (CpCategorySettingFormItemData *categoryItemData - = qobject_cast(itemData)) { - categoryItemData->initialize(itemDataHelper); - } - - //set the text and description from config if it is empty. - setEntryItemContentIfEmpty(itemData,pluginConfig); - } - } //end foreach - } - - } //end foreach -} - -QStringList CpUtility::drives() -{ - static QStringList drives; - - if (drives.empty()) { - CPFW_LOG("device drives:"); -#ifdef WIN32 - drives.append("C:"); - CPFW_LOG("C:"); -#else - QFileInfoList fileInfoList = QDir::drives(); - foreach(const QFileInfo &fileInfo,fileInfoList) { - QString str = fileInfo.filePath(); - if (str.length() > 2) { - str = str.left(2); - } - drives.append(str); - CPFW_LOG(str); - } -#endif - } - - return drives; -} - -static QStringList directoriesFromAllDrives(const QString &baseDir) -{ - QStringList dirs; - - QStringList drives = CpUtility::drives(); - foreach(const QString &drive,drives) { - QString dir = drive + baseDir + QDir::separator(); - if (QFileInfo(dir).exists()) { - dirs.append(dir); - CPFW_LOG(dir); - } - } - - return dirs; -} - -QStringList CpUtility::pluginDirectories() -{ - static QStringList dirs; - if (dirs.empty()) { - CPFW_LOG("ControlPanel plugin derectories:") - dirs = directoriesFromAllDrives(CP_PLUGIN_PATH); - } - return dirs; -} - -QStringList CpUtility::configFileDirectories() -{ - static QStringList dirs; - if (dirs.empty()) { - CPFW_LOG("ControlPanel configuration file derectories:"); - dirs = directoriesFromAllDrives(CP_PLUGIN_CONFIG_PATH); - } - return dirs; -} - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpcategorymodel/src/cputility.h --- a/controlpanelui/src/cpcategorymodel/src/cputility.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 CP_UTILITY_H -#define CP_UTILITY_H - -#include - -class HbDataFormModelItem; -class CpItemDataHelper; - -class CpUtility -{ -public: - /* - load all controlpanel plugins from configuration file, - and create model items form the loaded plugins - and append model items to given parent - */ - static void buildConfigPluginItems(HbDataFormModelItem *parent, - const QString &configFile, - CpItemDataHelper &itemDataHelper); - - /* - get all physical drives of the devices - */ - static QStringList drives(); - - /* - get all controlpanel plugin directories of the device - */ - static QStringList pluginDirectories(); - - - /* - get all config directories of the device - */ - static QStringList configFileDirectories(); - - -}; - -#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/cpplugins.pro --- a/controlpanelui/src/cpplugins/cpplugins.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/cpplugins.pro Fri May 14 13:21:08 2010 +0800 @@ -20,16 +20,12 @@ privacyplugin \ personalizationplugin \ lookfeelplugin \ - pincodeplugin \ - devicelockplugin \ profileactivatorplugin \ volumeplugin \ - ringtoneplugin - #keytouchfdbkplugin \ + ringtoneplugin \ + keytouchfdbkplugin #displayplugin \ #applicationsettingsplugin \ #accountsplugin - #placeholdernoiconplugin \ - #placeholderplugin \ CONFIG += ordered \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/devicelockplugin.pri --- a/controlpanelui/src/cpplugins/devicelockplugin/devicelockplugin.pri Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +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: cpdevicelockplugin source files -# - -# Input -HEADERS += src/*.h -SOURCES += src/*.cpp \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/devicelockplugin.pro --- a/controlpanelui/src/cpplugins/devicelockplugin/devicelockplugin.pro Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = cpdevicelockplugin - -CONFIG += hb plugin - - -include ( ../cpplugincommon.pri ) -include ( devicelockplugin.pri ) - -symbian { - TARGET.UID3 = 0X20028732 -} \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockplugin.cpp --- a/controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockplugin.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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 "cpdevicelockplugin.h" -#include "cpdevicelockpluginview.h" -#include - -CpDeviceLockPlugin::CpDeviceLockPlugin() -{ -} - -CpDeviceLockPlugin::~CpDeviceLockPlugin() -{ -} - -QList CpDeviceLockPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const -{ - return QList() - << new CpSettingFormEntryItemDataImpl(itemDataHelper,tr("Device lock"), QString()); -} - -Q_EXPORT_PLUGIN2(cpdevicelockplugin, CpDeviceLockPlugin); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockplugin.h --- a/controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockplugin.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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 CPDEVICELOCKPLUGIN_H -#define CPDEVICELOCKPLUGIN_H - -#include -#include - -class CpDeviceLockPlugin : public QObject, public CpPluginInterface -{ - Q_OBJECT - Q_INTERFACES(CpPluginInterface) -public: - CpDeviceLockPlugin(); - virtual ~CpDeviceLockPlugin(); - virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; -}; - -#endif //CPDEVICELOCKPLUGIN_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockpluginview.cpp --- a/controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockpluginview.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 "cpdevicelockpluginview.h" -#include -#include -#include -#include -#include -#include "cpremotelockdataformviewitem.h" - -CpDeviceLockPluginView::CpDeviceLockPluginView(QGraphicsItem *parent /*= 0*/) -: CpBaseSettingView(0,parent) -{ - if (HbDataForm *form = settingForm()) { - - QList protoTypeList = form->itemPrototypes(); - protoTypeList.append(new CpRemoteLockDataFormViewItem()); - form->setItemPrototypes(protoTypeList); - - HbDataFormModel *formModel = new HbDataFormModel(); - - form->setHeading(tr("Device lock")); - - HbDataFormModelItem *deviceLockItem = new HbDataFormModelItem( - HbDataFormModelItem::ToggleValueItem,tr("Device lock")); - - deviceLockItem->setContentWidgetData("text",tr("On")); - deviceLockItem->setContentWidgetData("additionalText",tr("Off")); - - formModel->appendDataFormItem(deviceLockItem); - - HbDataFormModelItem *lockCodeItem = new HbDataFormModelItem( - HbDataFormModelItem::TextItem,tr("Lock code")); - lockCodeItem->setContentWidgetData("echoMode",HbLineEdit::Password); - lockCodeItem->setContentWidgetData("text","1111"); - lockCodeItem->setContentWidgetData("readOnly",true); - - formModel->appendDataFormItem(lockCodeItem); - - HbDataFormModelItem *deviceLockAfterItem = new HbDataFormModelItem( - HbDataFormModelItem::RadioButtonListItem,tr("Device will be locked automatically after:")); - - QStringList items; - items << tr("15 minutes") << tr("30 minutes") << tr("1 hour") << tr("4 hours") ; - deviceLockAfterItem->setContentWidgetData("items",items); - deviceLockAfterItem->setContentWidgetData("selected",0); - - formModel->appendDataFormItem(deviceLockAfterItem); - - HbDataFormModelItem *remoteLockItem = new HbDataFormModelItem( - static_cast(CpRemoteLockDataFormViewItem::CpRemoteLockItem), - tr("Remote locking")); - remoteLockItem->setContentWidgetData("plainText", - tr("Device can be locked remotely by sending lock code to the device as SMS.")); - remoteLockItem->setContentWidgetData("TextWrapping",Hb::TextWordWrap); - - formModel->appendDataFormItem(remoteLockItem); - - form->setModel(formModel); - } -} - -CpDeviceLockPluginView::~CpDeviceLockPluginView() -{ -} - - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockpluginview.h --- a/controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockpluginview.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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 CPDEVICELOCKPLUGINVIEW_H -#define CPDEVICELOCKPLUGINVIEW_H - -#include - -class CpDeviceLockPluginView : public CpBaseSettingView -{ - Q_OBJECT -public: - explicit CpDeviceLockPluginView(QGraphicsItem *parent = 0); - virtual ~CpDeviceLockPluginView(); -}; - - -#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp --- a/controlpanelui/src/cpplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +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 "cpremotelockdataformviewitem.h" -#include - -CpRemoteLockDataFormViewItem::CpRemoteLockDataFormViewItem(QGraphicsItem *parent ) -: HbDataFormViewItem(parent) -{ -} - -CpRemoteLockDataFormViewItem::~CpRemoteLockDataFormViewItem() -{ -} - -HbAbstractViewItem* CpRemoteLockDataFormViewItem::createItem() -{ - return new CpRemoteLockDataFormViewItem(*this); -} - -bool CpRemoteLockDataFormViewItem::canSetModelIndex(const QModelIndex &index) const -{ - int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt(); - return type == CpRemoteLockItem; -} - -HbWidget *CpRemoteLockDataFormViewItem::createCustomWidget() -{ - int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt(); - - if (type == CpRemoteLockItem) { - HbLabel *label = new HbLabel("Device can be locked remotely by sending lock code to the device as SMS."); - label->setElideMode (Qt::ElideNone ); - label->setTextWrapping(Hb::TextWordWrap); - return label; - } - - return 0; -} - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/devicelockplugin/src/cpremotelockdataformviewitem.h --- a/controlpanelui/src/cpplugins/devicelockplugin/src/cpremotelockdataformviewitem.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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 CPREMOTELOCKDATAFORMVIEWITEM_H -#define CPREMOTELOCKDATAFORMVIEWITEM_H - -#include -#include - -class CpRemoteLockDataFormViewItem : public HbDataFormViewItem -{ - Q_OBJECT -public: - enum { CpRemoteLockItem = HbDataFormModelItem::CustomItemBase + 10 }; - - explicit CpRemoteLockDataFormViewItem(QGraphicsItem *parent = 0); - virtual ~CpRemoteLockDataFormViewItem(); - virtual HbAbstractViewItem* createItem(); - virtual bool canSetModelIndex(const QModelIndex &index) const; -protected: - virtual HbWidget* createCustomWidget(); -}; - -#endif //CPREMOTELOCKDATAFORMVIEWITEM_H - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg --- a/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/deviceplugin/data/cpdeviceplugin.cpcfg Fri May 14 13:21:08 2010 +0800 @@ -3,16 +3,16 @@ - + - + - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pri --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pri Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pri Fri May 14 13:21:08 2010 +0800 @@ -15,5 +15,11 @@ # # Input -HEADERS += src/*.h -SOURCES += src/*.cpp \ No newline at end of file +HEADERS += src/cpkeyscreenplugin.h \ + src/cpkeyscreenview.h \ + src/cpkeyscreenmodel.h \ + src/cpkeyscreenconstants.h + +SOURCES += src/cpkeyscreenplugin.cpp \ + src/cpkeyscreenview.cpp \ + src/cpkeyscreenmodel.cpp \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/keytouchfdbkplugin.pro Fri May 14 13:21:08 2010 +0800 @@ -25,5 +25,14 @@ include ( keytouchfdbkplugin.pri ) symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + $$MOC_DIR + HEADERS += src/cpkeyscreenmodel_p.h + SOURCES += src/cpkeyscreenmodel_p.cpp + + LIBS += -lcentralrepository \ + -lfeatmgr TARGET.UID3 = 0X20025FDE + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h Fri May 14 13:21:08 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: + * + */ + +#ifndef CPKEYSCREENCONSTANTS_H +#define CPKEYSCREENCONSTANTS_H + +enum KeyscreenLockItems{ + EKeyScreenLockItem1, + EKeyScreenLockItem2, + EKeyScreenLockItem3, + EKeyScreenLockItem4, + EKeyScreenLockItem5 +}; + +const int KCpKeyscreenTimeCoeff = 15; + +const int KCpKeyscreenLock15s = 15; +const int KCpKeyscreenLock30s = 30; +const int KCpKeyscreenLock45s = 45; +const int KCpKeyscreenLock60s = 60; +const int KCpKeyscreenLock120s = 120; + +const int KCpKeyscreenLockDefault30s = 30; + +#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + + +#include "cpkeyscreenmodel.h" +#include + +#ifdef Q_OS_SYMBIAN +#include "cpkeyscreenmodel_p.h" +#endif + + +CpKeyScreenModel::CpKeyScreenModel() +{ +#ifdef Q_OS_SYMBIAN + ptr = new CpKeyScreenModelPrivate(); +#endif +} + +CpKeyScreenModel::~CpKeyScreenModel() +{ +#ifdef Q_OS_SYMBIAN + delete ptr; + ptr = 0; +#endif +} + +bool CpKeyScreenModel::isKeyguardSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isKeyguardSupported(); +#else + return 0; +#endif +} + +int CpKeyScreenModel::keyguard() +{ +#ifdef Q_OS_SYMBIAN + return ptr->keyguard(); +#else + return 0; +#endif +} + +void CpKeyScreenModel::setKeyguard(int value) +{ +#ifdef Q_OS_SYMBIAN + ptr->setKeyguard(value); +#else + Q_UNUSED(value); +#endif +} + +bool CpKeyScreenModel::isRotateSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isRotateSupported(); +#else + return false; +#endif +} + +bool CpKeyScreenModel::rotate() +{ +#ifdef Q_OS_SYMBIAN + return ptr->rotate(); +#else + return 0; +#endif +} + +void CpKeyScreenModel::setRotate(bool value) +{ +#ifdef Q_OS_SYMBIAN + ptr->setRotate(value); +#else + Q_UNUSED(value); +#endif +} + +bool CpKeyScreenModel::isBrightnessSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isBrightnessSupported(); +#else + return false; +#endif +} + +int CpKeyScreenModel::brightness() +{ +#ifdef Q_OS_SYMBIAN + return ptr->brightness(); +#else + return 0; +#endif +} + +void CpKeyScreenModel::setBrightness(int value) +{ +#ifdef Q_OS_SYMBIAN + ptr->setBrightness(value); +#else + Q_UNUSED(value); +#endif +} + +bool CpKeyScreenModel::isCallibrationSupported() +{ +#ifdef Q_OS_SYMBIAN + return ptr->isCallibrationSupported(); +#else + return true; +#endif +} + +// End of the file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPKEYSCREENMODEL_H +#define CPKEYSCREENMODEL_H + +class CpKeyScreenModelPrivate; + +class CpKeyScreenModel + { +public: + CpKeyScreenModel(); + ~CpKeyScreenModel(); + +public: + bool isKeyguardSupported(); + int keyguard(); + void setKeyguard(int value); + bool isRotateSupported(); + bool rotate(); + void setRotate(bool value); + bool isBrightnessSupported(); + int brightness(); + void setBrightness(int value); + bool isCallibrationSupported(); + +private: + CpKeyScreenModelPrivate* ptr; + }; + +#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpkeyscreenmodel_p.h" +#include "cpkeyscreenconstants.h" +#include +#include +#include +#include +#include +#include // KCRUidSecuritySettings +#include // KCRUidLightSettings +#include + +CpKeyScreenModelPrivate::CpKeyScreenModelPrivate() +{ + TRAP_IGNORE( + mLightCenRep = CRepository::NewL( KCRUidLightSettings ); + mSecurityCenRep = CRepository::NewL( KCRUidSecuritySettings ); + mRotateSensor = CRepository::NewL(KHbSensorCenrepUid);); +} + +CpKeyScreenModelPrivate::~CpKeyScreenModelPrivate() +{ + delete mLightCenRep; + delete mSecurityCenRep; + delete mRotateSensor; +} + +bool CpKeyScreenModelPrivate::isKeyguardSupported() +{ + return true; +} + +int CpKeyScreenModelPrivate::keyguard() +{ + int period = KCpKeyscreenLockDefault30s; + mSecurityCenRep->Get( KSettingsAutomaticKeyguardTime, period ); + return period; +} + +void CpKeyScreenModelPrivate::setKeyguard(int value) +{ + if ( (KCpKeyscreenLock15s == value) || (KCpKeyscreenLock30s == value) + || (KCpKeyscreenLock45s == value) || (KCpKeyscreenLock60s == value) + || (KCpKeyscreenLock120s == value) ){ + mSecurityCenRep->Set( KSettingsAutomaticKeyguardTime, value ); + mLightCenRep->Set( KDisplayLightsTimeout, value ); + } +} + +bool CpKeyScreenModelPrivate::isRotateSupported() +{ + return true; +} + +bool CpKeyScreenModelPrivate::rotate() +{ + int rotate = 0; + mRotateSensor->Get(KHbSensorCenrepKey, rotate); + return rotate; +} + +void CpKeyScreenModelPrivate::setRotate(bool value) +{ + mRotateSensor->Set(KHbSensorCenrepKey, value); +} + +bool CpKeyScreenModelPrivate::isBrightnessSupported() +{ + if ( FeatureManager::FeatureSupported( KFeatureIdBrightnessControl ) ){ + return true; + } else { + return false; + } +} + +int CpKeyScreenModelPrivate::brightness() +{ + int time = 0; + mLightCenRep->Get( KLightIntensity, time ); + return time/20; +} + +void CpKeyScreenModelPrivate::setBrightness(int value) +{ + mLightCenRep->Set( KLightIntensity, value * 20 ); +} + +bool CpKeyScreenModelPrivate::isCallibrationSupported() +{ + return true; +} + +// End of the file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenmodel_p.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CPKEYSCREENMODEL_P_H +#define CPKEYSCREENMODEL_P_H + +class CRepository; + +class CpKeyScreenModelPrivate + { +public: + CpKeyScreenModelPrivate(); + ~CpKeyScreenModelPrivate(); + +public: + bool isKeyguardSupported(); + int keyguard(); + void setKeyguard(int value); + bool isRotateSupported(); + bool rotate(); + void setRotate(bool value); + bool isBrightnessSupported(); + int brightness(); + void setBrightness(int value); + bool isCallibrationSupported(); + +private: + CRepository* mLightCenRep; + CRepository* mSecurityCenRep; + CRepository* mRotateSensor; + }; + +#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpkeyscreenplugin.h" +#include "cpkeyscreenview.h" +#include + +CpKeyScreenPlugin::CpKeyScreenPlugin() +{ +} + +CpKeyScreenPlugin::~CpKeyScreenPlugin() +{ +} + +QList CpKeyScreenPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + CpSettingFormItemData* itemData = new CpSettingFormEntryItemDataImpl( + itemDataHelper, + hbTrId("Keys & screen")); + return QList() << itemData; +} + +Q_EXPORT_PLUGIN2(cpkeyscreenplugin, CpKeyScreenPlugin); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPKEYSCREENPLUGIN_H +#define CPKEYSCREENPLUGIN_H + +#include +#include + +class CpKeyScreenPlugin : public QObject, public CpPluginInterface +{ +Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpKeyScreenPlugin(); + virtual ~CpKeyScreenPlugin(); + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPKEYSCREENPLUGIN_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cpkeyscreenview.h" +#include "cpkeyscreenmodel.h" +#include "cpkeyscreenconstants.h" +#include +#include +#include +#include +#include +#include +#include + + +CpKeyScreenView::CpKeyScreenView(QGraphicsItem *parent) : + CpBaseSettingView(0,parent), + mScreenRadioButton(0), + mRotateCheckbox(0), + mBrightSliderItem(0), + mCallibItem(0), + mModel(0) +{ + HbDataForm *form = qobject_cast ( widget() ); + if (form) { + form->setHeading(hbTrId("txt_cp_subhead_keys_screen")); + mModel = new CpKeyScreenModel(); + HbDataFormModel *model = new HbDataFormModel; + + if ( mModel->isKeyguardSupported() ) { + makeScreenItem(*model); + } + + if ( mModel->isRotateSupported() ) { + makeRotateItem(*model); + } + + makeBrightnessItem(*model); + + if ( mModel->isCallibrationSupported() ) { + makeCallibrationItem(*model); + } + + form->setModel(model); + } +} + +void CpKeyScreenView::makeScreenItem(HbDataFormModel& model) +{ + mScreenRadioButton = new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem, + hbTrId("txt_cp_setlabel_keys_screen_locked_after")); + qobject_cast ( widget() )->addConnection(mScreenRadioButton,SIGNAL(itemSelected(int)),this,SLOT(screenValueChanged(int))); + model.appendDataFormItem(mScreenRadioButton, model.invisibleRootItem()); + + // Valid range is: + // 15 secs, 30 secs, 45 secs, 1 min, 2 mins + QStringList sList; + sList<< hbTrId("txt_cp_setlabel_keys_screen_val_15_seconds")<< hbTrId("txt_cp_setlabel_keys_screen_val_30_seconds") + << hbTrId("txt_cp_setlabel_keys_screen_val_45_seconds")<< hbTrId("txt_cp_setlabel_keys_screen_val_1_minute") + << hbTrId("txt_cp_setlabel_keys_screen_val_2_minutes"); + int period = mModel->keyguard(); + int selectedIndex = period/KCpKeyscreenTimeCoeff - 1; + if ( KCpKeyscreenLock120s == period ){ // 2 minutes + selectedIndex = EKeyScreenLockItem5; + } + if ( (KCpKeyscreenLock15s != period) && (KCpKeyscreenLock30s != period) && + (KCpKeyscreenLock45s != period) && (KCpKeyscreenLock60s != period) && + (KCpKeyscreenLock120s != period) ){ + mModel->setKeyguard(KCpKeyscreenLockDefault30s); // Set keyguard and backlight period to default + selectedIndex = EKeyScreenLockItem2; + } + mScreenRadioButton->setContentWidgetData( QString("items"), sList ); + mScreenRadioButton->setContentWidgetData( QString("selected"), selectedIndex); +} + +void CpKeyScreenView::makeRotateItem(HbDataFormModel& model) +{ + mRotateCheckbox = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem, QString()); + qobject_cast ( widget() )->addConnection(mRotateCheckbox,SIGNAL(stateChanged(int)),this,SLOT(rotateValueChanged(int))); + model.appendDataFormItem(mRotateCheckbox, model.invisibleRootItem()); + + mRotateCheckbox->setContentWidgetData( QString("text"), QVariant(hbTrId("txt_cp_list_autorotate_display")) ); + mRotateCheckbox->setData(HbDataFormModelItem::DescriptionRole, QString( hbTrId("txt_cp_info_rotate_the_display_content_automatical") )); + Qt::CheckState state; + if ( mModel->rotate() ){ + state = Qt::Checked; + } else { + state = Qt::Unchecked; + } + mRotateCheckbox->setContentWidgetData( QString("checkState"), state ); +} + +void CpKeyScreenView::makeBrightnessItem(HbDataFormModel& model) +{ + mBrightSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, hbTrId("txt_cp_setlabel_brightness")); + qobject_cast ( widget() )->addConnection(mBrightSliderItem,SIGNAL(valueChanged(int)),this,SLOT(brightValueChanged(int))); + model.appendDataFormItem(mBrightSliderItem, model.invisibleRootItem()); + + mBrightSliderItem->setContentWidgetData( QString("value"), mModel->brightness() ); + mBrightSliderItem->setContentWidgetData( QString("minimum"), 1 ); + mBrightSliderItem->setContentWidgetData( QString("maximum"), 5 ); +} + +void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model) +{ + mCallibItem = new CpSettingFormItemData(HbDataFormModelItem::ToggleValueItem, + QString()); + qobject_cast ( widget() )->addConnection(mCallibItem,SIGNAL(pressed()),this,SLOT(launchCallib())); + model.appendDataFormItem(mCallibItem, model.invisibleRootItem()); + mCallibItem->setContentWidgetData( QString("text"), hbTrId("txt_cp_button_touch_screen_calibration")); +} + +CpKeyScreenView::~CpKeyScreenView() +{ + delete mModel; + mModel = 0; +} + +void CpKeyScreenView::screenValueChanged(int index) +{ + int period = (index + 1) * KCpKeyscreenTimeCoeff; + if (EKeyScreenLockItem5 == index){ + period = KCpKeyscreenLock120s; + } + mModel->setKeyguard(period); +} + +void CpKeyScreenView::rotateValueChanged(int value) +{ + mModel->setRotate( value ); +} + +void CpKeyScreenView::brightValueChanged(int value) +{ + mModel->setBrightness(value); +} + +void CpKeyScreenView::launchCallib() +{ +} + + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h Fri May 14 13:21:08 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: + * + */ +#ifndef CPKEYSCREENVIEW_H +#define CPKEYSCREENVIEW_H + +#include +#include + +class HbDataFormModelItem; +class HbDataFormModel; +class CpSettingFormItemData; +class CpKeyScreenModel; + +class CpKeyScreenView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpKeyScreenView(QGraphicsItem *parent = 0); + virtual ~CpKeyScreenView(); + +private: + void makeScreenItem(HbDataFormModel& model); + void makeRotateItem(HbDataFormModel& model); + void makeBrightnessItem(HbDataFormModel& model); + void makeCallibrationItem(HbDataFormModel& model); + +private slots: + //need handling your member's value change + void screenValueChanged(int index); + void rotateValueChanged(int value); + void brightValueChanged(int value); + void launchCallib(); + +private: + CpSettingFormItemData *mScreenRadioButton; + CpSettingFormItemData *mRotateCheckbox; + CpSettingFormItemData *mBrightSliderItem; + CpSettingFormItemData *mCallibItem; + CpKeyScreenModel* mModel; +}; +#endif// CPKEYSCREENVIEW_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeytouchfdbkplugin.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeytouchfdbkplugin.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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 "cpkeytouchfdbkplugin.h" -#include "cpktfdbkview.h" -#include - -CpKeytouchfdbkPlugin::CpKeytouchfdbkPlugin() -{ -} - -CpKeytouchfdbkPlugin::~CpKeytouchfdbkPlugin() -{ -} - -QList CpKeytouchfdbkPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const -{ - return QList() << new CpSettingFormEntryItemDataImpl( - itemDataHelper, - tr("Key & screen"), - ""); -} - -Q_EXPORT_PLUGIN2(cpkeytouchfdbkplugin, CpKeytouchfdbkPlugin); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeytouchfdbkplugin.h --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeytouchfdbkplugin.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ -#ifndef CPKEYTOUCHFDBKPLUGIN_H -#define CPKEYTOUCHFDBKPLUGIN_H - -#include -#include - -class CpKeytouchfdbkPlugin : public QObject, public CpPluginInterface -{ -Q_OBJECT - Q_INTERFACES(CpPluginInterface) -public: - CpKeytouchfdbkPlugin(); - virtual ~CpKeytouchfdbkPlugin(); - virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; -}; - -#endif //CPKEYTOUCHFDBKPLUGIN diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.cpp --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 "cpktfdbkview.h" -#include -#include -#include -#include -#include -#include -#include - - -CpKtfdbkView::CpKtfdbkView(QGraphicsItem *parent) : - CpBaseSettingView(0,parent), - mKTSliderItem(0), - mSTSliderItem(0), - mSVSliderItem(0), - mModel(0) - -{ - HbDataForm *form = settingForm(); - if (form) { - mModel = new CpProfileModel(); - HbDataFormModel *model = new HbDataFormModel; - - form->setHeading(tr("Key & touch screen feedback")); -// Key tones slider - mKTSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, - QString("Key tones")); - form->addConnection(mKTSliderItem,SIGNAL(valueChanged(int)),this,SLOT(KTsliderValueChanged(int))); - - model->appendDataFormItem(mKTSliderItem, model->invisibleRootItem()); -//Screen tones - mSTSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, - QString("Screen tones")); - form->addConnection(mSTSliderItem,SIGNAL(valueChanged(int)),this,SLOT(STsliderValueChanged(int))); - - model->appendDataFormItem(mSTSliderItem, model->invisibleRootItem()); -//Screen vibra - mSVSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem, - QString("Screen vibra")); - form->addConnection(mSVSliderItem,SIGNAL(valueChanged(int)),this,SLOT(SVsliderValueChanged(int))); - - model->appendDataFormItem(mSVSliderItem, model->invisibleRootItem()); -//initialize sliders - mKTSliderItem->setContentWidgetData( QString("value"), mModel->keyVolume() ); - mKTSliderItem->setContentWidgetData( QString("minimum"), 0 ); - mKTSliderItem->setContentWidgetData( QString("maximum"), 3 ); - - mSTSliderItem->setContentWidgetData( QString("value"), mModel->screenVolume() ); - mSTSliderItem->setContentWidgetData( QString("minimum"), 0 ); - mSTSliderItem->setContentWidgetData( QString("maximum"), 3 ); - - mSVSliderItem->setContentWidgetData( QString("value"), mModel->screenVibra() ); - mSVSliderItem->setContentWidgetData( QString("minimum"), 0 ); - mSVSliderItem->setContentWidgetData( QString("maximum"), 3 ); -// - form->setModel(model); -// - } - - -} -CpKtfdbkView::~CpKtfdbkView() -{ - if(mModel) delete mModel; - mModel = 0; -} - -void CpKtfdbkView::KTsliderValueChanged(int value) -{ - if(mModel) mModel->setKeyVolume( value ); -} - -void CpKtfdbkView::STsliderValueChanged(int value) -{ - if(mModel) mModel->setScreenVolume( value ); -} - -void CpKtfdbkView::SVsliderValueChanged(int value) -{ - if(mModel) mModel->setScreenVibra( value ); -} - - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.h --- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpktfdbkview.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ -#ifndef CPKTFDBKVIEW_H -#define CPKTFDBKVIEW_H - -#include - -class HbDataFormModelItem; -class CpSettingFormItemData; -class CpProfileModel; -class CpKtfdbkView : public CpBaseSettingView -{ - Q_OBJECT -public: - explicit CpKtfdbkView(QGraphicsItem *parent = 0); - virtual ~CpKtfdbkView(); -private slots: - //need handling your member's value change - void KTsliderValueChanged(int value); - void STsliderValueChanged(int value); - void SVsliderValueChanged(int value); -private: - CpProfileModel *mModel; - CpSettingFormItemData *mKTSliderItem; - CpSettingFormItemData *mSTSliderItem; - CpSettingFormItemData *mSVSliderItem; -}; -#endif// CPKTFDBKVIEW_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/data/cppersonalizationplugin.cpcfg --- a/controlpanelui/src/cpplugins/personalizationplugin/data/cppersonalizationplugin.cpcfg Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/data/cppersonalizationplugin.cpcfg Fri May 14 13:21:08 2010 +0800 @@ -2,8 +2,13 @@ + + + - + + + \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri --- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pri Fri May 14 13:21:08 2010 +0800 @@ -16,17 +16,15 @@ # Input HEADERS += src/cppersonalizationplugin.h \ - src/cppersonalizationgroupitemdata.h \ - src/cpmastervolumeslider.h \ + src/cppersonalizationgroupitemdata.h\ src/cpprofilesettingform.h \ - src/cppersonalizationentryitemdata.h \ + ../ringtoneplugin/src/cppersonalizationentryitemdata.h \ src/cppersonalizationadvanceview.h \ src/cpprofilenameeditdialog.h \ SOURCES += src/cppersonalizationplugin.cpp \ src/cppersonalizationgroupitemdata.cpp \ - src/cpmastervolumeslider.cpp \ src/cpprofilesettingform.cpp \ - src/cppersonalizationentryitemdata.cpp \ + ../ringtoneplugin/src/cppersonalizationentryitemdata.cpp \ src/cppersonalizationadvanceview.cpp \ src/cpprofilenameeditdialog.cpp \ diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro --- a/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/personalizationplugin.pro Fri May 14 13:21:08 2010 +0800 @@ -21,7 +21,7 @@ RESOURCES += personalizationplugin.qrc LIBS += -lcpprofilewrapper -LIBS += -lxqservice -lxqserviceutil +LIBS += -lxqsettingsmanager -lcpringtoneview include ( ../cpplugincommon.pri ) include ( personalizationplugin.pri ) @@ -38,4 +38,4 @@ # This is for new exporting system coming in garden for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$deploy.path$$headers.path/$$basename(header)" -} \ No newline at end of file +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +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 "cpmastervolumeslider.h" - -CpMasterVolumeSlider::CpMasterVolumeSlider(QGraphicsItem *parent /* =0 */) - :HbSlider(parent), - mPreviousValue(0) -{ - QList elements; - elements << HbSlider::IncreaseElement - << HbSlider::TrackElement - << HbSlider::DecreaseElement - << HbSlider::IconElement - << HbSlider::TextElement; - - setElements( elements ); - setOrientation(Qt::Horizontal); - setMaximum(10); - setMinimum(0); - - setIcon(HbSlider::DecreaseElement, HbIcon(":/icon/hb_vol_slider_decrement.svg")); - setIcon(HbSlider::IncreaseElement, HbIcon(":/icon/hb_vol_slider_increment.svg")); - setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_muted.svg")); - - setIconCheckable(true); - - // set tick and beep label - -#if 1 -// setMajorTickInterval(1); -// setTickPosition(Hb::SliderTicksBothSides); -// QStringList labelList; -// labelList<< tr("") -// << tr("Beep"); - -// this->setMajorTickLabels(labelList); -#endif - - connect(this, SIGNAL(iconToggled(bool)), - this, SLOT(onMuteIconToggled(bool))); - connect(this, SIGNAL(valueChanged(int)), - this, SLOT(onValueChanged(int))); -// onValueChanged(value()); -} - -CpMasterVolumeSlider::~CpMasterVolumeSlider() -{ -} - -/*bool CpMasterVolumeSlider::isBeepMode() -{ - if (value() == minimum()+1) { - return true; - } - else { - return false; - } -} - -void CpMasterVolumeSlider::setBeepMode(bool isBeepMode) -{ - if (isBeepMode == true) { - setValue(minimum()+1); - } - else { - setValue(mPreviousValue); - } -}*/ - -/*bool CpMasterVolumeSlider::isSilentMode() -{ - if (value() == minimum()) { - return true; - } - else { - return false; - } -} - -void CpMasterVolumeSlider::setSilentMode(bool isSilentMode) -{ - if (isSilentMode == true) { - setValue(minimum()); - } - else { - setValue(mPreviousValue); - } -} - -int CpMasterVolumeSlider::normalValue() -{ - return (value()-1); -} - -void CpMasterVolumeSlider::setNormalValue(int normalValue) -{ - setValue(normalValue+1); -} -*/ -void CpMasterVolumeSlider::onValueChanged(int value) -{ - if (this->minimum( ) == value) { - // volume is mute - this->setIconChecked( true ); - emit silentActivated(); - } - else { - // unmute volume - this->setIconEnabled( true ); - this->setIconCheckable(false); - this->setIconChecked( false ); - this->setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_unmuted.svg")); - this->setIconCheckable(true); - - - /*if (value == 1) { - emit beepActivated(); - }*/ - //else { - int valueMap = value; - emit normalValueChanged(valueMap); - //} - } -} - -/*void CpMasterVolumeSlider::onIncreaseIconClicked() -{ -} - -void CpMasterVolumeSlider::onDecreaseIconClicked() -{ -}*/ - -void CpMasterVolumeSlider::onMuteIconToggled(bool isToggled) -{ - if (isToggled) { - mPreviousValue = value(); - this->setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_muted.svg")); - setValue(minimum()); - } - else { - this->setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_unmuted.svg")); - if (mPreviousValue == minimum()||mPreviousValue == minimum()+1) { - setValue(minimum()+1); - } - else { - setValue(mPreviousValue); - } - mPreviousValue = 0; - } -} - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpmastervolumeslider.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 CP_MASTERVOLUMESLIDER_H -#define CP_MASTERVOLUMESLIDER_H - -#include -#include -class CpMasterVolumeSlider: public HbSlider -{ - Q_OBJECT - //Q_PROPERTY(bool beepMode READ isBeepMode WRITE setBeepMode) - //Q_PROPERTY(bool silentMode READ isSilentMode WRITE setSilentMode) - //Q_PROPERTY(int normalValue READ normalValue WRITE setNormalValue) - -public: - explicit CpMasterVolumeSlider(QGraphicsItem *parent = 0); - ~CpMasterVolumeSlider(); - -public: - //bool isBeepMode(); - //void setBeepMode(bool isBeepMode); - //bool isSilentMode(); - //void setSilentMode(bool isSilentMode); - //int normalValue(); - //void setNormalValue(int normalValue); - -signals: - //void beepActivated(); - void silentActivated(); - void normalValueChanged(int value); -private slots: - void onValueChanged(int value); - //void onIncreaseIconClicked(); - //void onDecreaseIconClicked(); - void onMuteIconToggled(bool isToggled); -private: - int mPreviousValue; -}; - -#endif - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationadvanceview.cpp Fri May 14 13:21:08 2010 +0800 @@ -25,6 +25,7 @@ #include "cpprofilesettingform.h" #include "cpprofilenameeditdialog.h" +#include #include #include CpPersonalizationAdvanceView::CpPersonalizationAdvanceView(QGraphicsItem *parent /*=0*/): @@ -36,7 +37,9 @@ // 4.use cppersonalizationentryitemdata class to create ringtone, message tone... // 5.ignore cpmastervolumeslider class, please use default slideritem to create keyandscreen slider, new property added in slider, if any question, please contact me. // 6. don't forget the cfg file in data folder, you can try to add the profile activator plugin and ringtone plugin here - setSettingForm( new CpProfileSettingForm() ); + HbDataForm *form = new CpProfileSettingForm(); + setWidget( form ); + CpPluginUtility::addCpItemPrototype(form); initMenu(); } CpPersonalizationAdvanceView::~CpPersonalizationAdvanceView() diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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 "cppersonalizationentryitemdata.h" -#include -#include - -CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, - const QString &text, - const QString &description, - const HbIcon &icon, - const HbDataFormModelItem *parent) - :CpSettingFormEntryItemData(itemDataHelper,text,description, - icon,parent),mReq(0) -{ -} -CpPersonalizationEntryItemData::~CpPersonalizationEntryItemData() -{ -} -void CpPersonalizationEntryItemData::onLaunchView() -{ - //launch media fetcher - if (!mReq) - { - mReq = mAppMgr.create("com.nokia.services.media.Music", "fetch(QString)", true); - - if (!mReq) - { - return; - } - else - { - connect(mReq, SIGNAL(requestOk(const QVariant&)), SLOT(handleOk(const QVariant&))); - connect(mReq, SIGNAL(requestError(int,const QString&)), SLOT(handleError(int,const QString&))); - } - } - - // Set arguments for request (music fetcher application title) - QList args; - args << QVariant( text() ); - mReq->setArguments(args); - - // Make the request - if (!mReq->send()) - { - //report error - return; - } -} -void CpPersonalizationEntryItemData::handleOk(const QVariant &result) -{ - if (!result.canConvert()) - { - setDescription( "Corrupt result" ); - } - else - { - setDescription( result.value() ); - } -} -void CpPersonalizationEntryItemData::handleError(int errorCode, const QString& errorMessage) -{ - // - Q_UNUSED(errorCode); - Q_UNUSED(errorMessage); - setDescription("Error"); -} - -CpBaseSettingView *CpPersonalizationEntryItemData::createSettingView() const -{ - return 0; -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationentryitemdata.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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 CPPERSONALIZATIONENTRYITEMDATA_H -#define CPPERSONALIZATIONENTRYITEMDATA_H - -#include -#include - - -class XQApplicationManager; -class XQAiwRequest; - - -class CpPersonalizationEntryItemData : public CpSettingFormEntryItemData -{ - Q_OBJECT -public: - explicit CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, - const QString &text = QString(), - const QString &description = QString(), - const HbIcon &icon = HbIcon(), - const HbDataFormModelItem *parent = 0); - virtual ~CpPersonalizationEntryItemData(); -private slots: - void onLaunchView(); - void handleOk(const QVariant &result); - void handleError(int errorCode, const QString& errorMessage); -private: - virtual CpBaseSettingView *createSettingView() const; -private: - XQApplicationManager mAppMgr; - XQAiwRequest* mReq; -}; - -#endif // CPPERSONALIZATIONENTRYITEMDATA_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationgroupitemdata.cpp Fri May 14 13:21:08 2010 +0800 @@ -49,11 +49,13 @@ CPFW_LOG("CpPersonalizationGroupItemData::beforeLoadingConfigPlugins(), END"); } + void CpPersonalizationGroupItemData::afterLoadingConfigPlugins(CpItemDataHelper &itemDataHelper) { CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), START"); CpSettingFormEntryItemData *advanceSettingItem = - new CpSettingFormEntryItemDataImpl(itemDataHelper, hbTrId("txt_cp_button_advanced_settings")); + new CpSettingFormEntryItemDataImpl(CpSettingFormEntryItemData::ButtonEntryItem, + itemDataHelper, hbTrId("txt_cp_button_advanced_settings")); appendChild(advanceSettingItem); CPFW_LOG("CpPersonalizationGroupItemData::afterLoadingConfigPlugins(), END"); } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.cpp Fri May 14 13:21:08 2010 +0800 @@ -19,6 +19,7 @@ #include "cppersonalizationgroupitemdata.h" #include #include +#include "cppersonalizationadvanceview.h" CpPersonalizationPlugin::CpPersonalizationPlugin() { @@ -40,6 +41,14 @@ return QList() << personalItemData; } +CpBaseSettingView *CpPersonalizationPlugin::createSettingView(const QVariant &hint) const +{ + if (hint.toString().compare("profile_view",Qt::CaseInsensitive) == 0) { + return new CpPersonalizationAdvanceView; + } + return 0; +} + Q_EXPORT_PLUGIN2(cppersonalizationplugin, CpPersonalizationPlugin); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cppersonalizationplugin.h Fri May 14 13:21:08 2010 +0800 @@ -20,17 +20,24 @@ #include #include +#include + +class CpBaseSettingView; +class QVariant; class CpPersonalizationPlugin : public QObject, - public CpPluginInterface + public CpPluginInterface, + public CpLauncherInterface { Q_OBJECT Q_INTERFACES(CpPluginInterface) + Q_INTERFACES(CpLauncherInterface) public: CpPersonalizationPlugin(); virtual ~CpPersonalizationPlugin(); virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + virtual CpBaseSettingView *createSettingView(const QVariant &hint) const; }; #endif /* CPPERSONALIZATIONPLUGIN_H */ diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilenameeditdialog.cpp Fri May 14 13:21:08 2010 +0800 @@ -22,6 +22,7 @@ #include #include +#include CpProfileNameEditDialog::CpProfileNameEditDialog( QGraphicsItem *parent ) :HbDialog( parent ) @@ -49,8 +50,8 @@ connect( mTextEdit, SIGNAL( contentsChanged() ), this, SLOT( checkPrimaryAction() ) ); - setPrimaryAction( new HbAction( hbTrId( "txt_common_button_ok" ), this )); - setSecondaryAction( new HbAction( hbTrId( "txt_common_button_cancel" ), this ) ); + addAction( new HbAction( hbTrId( "txt_common_button_ok" ), this )); + addAction( new HbAction( hbTrId( "txt_common_button_cancel" ), this ) ); setTimeout( NoTimeout ); } @@ -69,24 +70,26 @@ bool CpProfileNameEditDialog::launchProfileNameEditDialog( QString &profileName ) { - CpProfileNameEditDialog * profileEditNameDialog = new CpProfileNameEditDialog(); + CpProfileNameEditDialog *profileEditNameDialog = new CpProfileNameEditDialog(); + profileEditNameDialog->setLineEditText( profileName ); profileEditNameDialog->checkPrimaryAction(); - if( profileEditNameDialog->exec() == profileEditNameDialog->secondaryAction() ){ - return false; - } - else{ - profileName = profileEditNameDialog->getLineEditText(); - return true; - } + HbAction *secondAction = qobject_cast + (profileEditNameDialog->actions().at(1)); + profileEditNameDialog->show(); + return false; } void CpProfileNameEditDialog::checkPrimaryAction() { - if( !mTextEdit->text().isEmpty() ){ - primaryAction()->setEnabled( true ); - } else { - primaryAction()->setEnabled( false ); + HbAction *const primaryAction = qobject_cast + (actions().at(0)); + if (primaryAction) { + if ( !mTextEdit->text().isEmpty() ) { + primaryAction->setEnabled(true); + } else { + primaryAction->setEnabled(false); + } } } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Fri May 14 13:21:08 2010 +0800 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -29,10 +30,13 @@ #include #include +#include +#include + CpProfileSettingForm::CpProfileSettingForm() : mModel(0), mItemDataHelper(new CpItemDataHelper( this )), mProfileModel(new CpProfileModel()), mFileIconProvider(new QFileIconProvider), - mGeneralPage(0),mMeetingPage(0),mCurrentPage( 0 ) + mGeneralPage(0),mMeetingPage(0),mCurrentPage( 0 ), mSettingManager(0) { this->setHeading(hbTrId("txt_cp_button_advanced_settings")); this->setDescription(hbTrId("txt_cp_info_select_tones_that_play_when_you_select")); @@ -45,6 +49,7 @@ delete mModel; delete mProfileModel; delete mFileIconProvider; + delete mSettingManager; } void CpProfileSettingForm::initModel() @@ -62,24 +67,152 @@ meetingString = hbTrId("txt_cp_list_meeting"); } + mSettingManager = new XQSettingsManager(); + + XQCentralRepositorySettingsKey key(KCRUidProfileEngine.iUid,KProEngSilenceMode); + + QVariant silenceMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt); + + mSettingManager->startMonitoring(key,XQSettingsManager::TypeInt); + connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); + mGeneralPage = mModel->appendDataFormPage( generalString ); - initGeneralTonesGroup(); + initProfileItems(EProfileWrapperGeneralId,mGeneralPage); + + //initGeneralTonesGroup(); + //initGeneralVibraGroup(); mMeetingPage = mModel->appendDataFormPage( meetingString ); - initMeetingTonesGroup(); + initProfileItems(EProfileWrapperMeetingId,mMeetingPage); + //initMeetingTonesGroup(); //initMeetingVibraGroup(); - setModel(mModel); + settingValueChanged(key,silenceMode); } +void CpProfileSettingForm::initProfileItems(int profileId,HbDataFormModelItem *parent) +{ + CpProfileSettings profileSettings; + mProfileModel->profileSettings( profileId, profileSettings ); + + QHash modelItems; + + //ring tone item + QFileInfo ringToneFileInfo( profileSettings.mRingTone ); + HbDataFormModelItem *modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ), + CpPersonalizationEntryItemData::TONE_Ring, profileId ); + mModel->appendDataFormItem(modelItem, parent); + modelItems.insert(ProfileItemRingTone,modelItem); + + //message tone item + QFileInfo messageToneFileInfo( profileSettings.mMessageTone ); + modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ), + CpPersonalizationEntryItemData::TONE_Message, + profileId ); + mModel->appendDataFormItem(modelItem , parent); + modelItems.insert(ProfileItemMessageTone,modelItem); + + //email tone item + QFileInfo emailToneFileInfo( profileSettings.mEmailTone ); + modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_email_tone"), emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ), + CpPersonalizationEntryItemData::TONE_Email, + profileId ); + mModel->appendDataFormItem(modelItem , parent); + modelItems.insert(ProfileItemEmailTone,modelItem); + + //reminder tone item + QFileInfo reminderToneFileInfo( profileSettings.mReminderTone ); + modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper, + hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ), + CpPersonalizationEntryItemData::TONE_Reminder, + profileId ); + mModel->appendDataFormItem(modelItem , parent); + modelItems.insert(ProfileItemReminderTone,modelItem); + + //notification tones item + modelItem= mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),parent); + modelItem->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones")); + modelItem->setContentWidgetData( "checkState", profileSettings.mNotificationTone ? 2 : 0 ); + if (profileId == EProfileWrapperGeneralId) { + addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int ))); + } + else if (profileId == EProfileWrapperMeetingId) { + addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int ))); + } + modelItems.insert(ProfileItemNotificationTones,modelItem); + + + //Key and Touch Screen Tones item + modelItem = + mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),parent); + + QList sliderElements; + sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement) + << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement) + << QVariant(HbSlider::TextElement); + modelItem->setContentWidgetData("sliderElements",sliderElements); + + + + //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 + modelItem->setContentWidgetData( QString( "minimum" ), 0 ); + modelItem->setContentWidgetData( QString( "maximum" ), 5 ); + modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone ); + QMap< QString, QVariant > elements; + elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg")); + elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") ); + if (profileSettings.mKeyTouchScreenTone != 0) { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); + } + else { + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); + } + + modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); + + if (profileId == EProfileWrapperGeneralId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int ))); + } + else if (profileId == EProfileWrapperMeetingId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenToneSlider_ValueChanged( int ))); + } + + modelItems.insert(ProfileItemKeyandTouchScreenTones,modelItem); + + + //Touch Screen Vibra item + modelItem = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), parent ); + //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3 + modelItem->setContentWidgetData( QString( "minimum" ), 0 ); + modelItem->setContentWidgetData( QString( "maximum" ), 5 ); + modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra ); + + if (profileId == EProfileWrapperGeneralId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int ))); + } + else if (profileId == EProfileWrapperMeetingId) { + addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int ))); + } + + modelItems.insert(ProfileItemTouchScreenVibra,modelItem); + + mProfileModelItems.insert(profileId,modelItems); + +} + +/* void CpProfileSettingForm::initGeneralTonesGroup() { CpProfileSettings profileSettings; mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); - /*HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup( - hbTrId("txt_cp_subhead_tones"),mGeneralPage);*/ + //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); @@ -102,13 +235,13 @@ 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 ); - */ + + //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 ); @@ -125,6 +258,7 @@ 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() { @@ -169,13 +303,13 @@ }*/ //////////////////////////////////////////////////////////// -void CpProfileSettingForm::initMeetingTonesGroup() +/*void CpProfileSettingForm::initMeetingTonesGroup() { CpProfileSettings profileSettings; mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); - /* HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup( - hbTrId("txt_cp_subhead_tones"),mMeetingPage);*/ + //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); @@ -198,13 +332,13 @@ 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 ); - */ + + //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 ); @@ -220,7 +354,7 @@ 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; @@ -273,7 +407,22 @@ void CpProfileSettingForm::on_general_keysAndScreenToneSlider_ValueChanged( int value ) { mProfileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, value ); - mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString("value"), value ); + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemKeyandTouchScreenTones); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + QMap< QString, QVariant > elements; + if (value != 0) { + elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); + } + else { + elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); + } + modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); + } } @@ -301,7 +450,11 @@ void CpProfileSettingForm::on_general_screenVibra_ValueChanged( int value ) { mProfileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, value ); - mGeneralSreenVibra->setContentWidgetData( QString("value"), value ); + + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemTouchScreenVibra); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + } } @@ -312,10 +465,26 @@ mProfileModel->setNotificationTone( EProfileWrapperMeetingId, checkBoxStateToBool( state ) ); } -void CpProfileSettingForm::on_meeting_keysAndScreenSlider_ValueChanged( int value ) +void CpProfileSettingForm::on_meeting_keysAndScreenToneSlider_ValueChanged( int value ) { mProfileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, value ); - mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString("value"), value ); + + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemKeyandTouchScreenTones); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + QMap< QString, QVariant > elements; + if (value != 0) { + elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") ); + } + else { + elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") ); + } + modelItem->setContentWidgetData( QString( "elementIcons" ), elements ); + } } @@ -343,7 +512,11 @@ void CpProfileSettingForm::on_meeting_screenVibra_ValueChanged( int value ) { mProfileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, value ); - mMeetingSreenVibra->setContentWidgetData( QString("value"), value ); + + HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemTouchScreenVibra); + if (modelItem) { + modelItem->setContentWidgetData( QString("value"), value ); + } } bool CpProfileSettingForm::checkBoxStateToBool( int state ) @@ -354,3 +527,37 @@ return false; } } + + +void CpProfileSettingForm::settingValueChanged(const XQSettingsKey &key, const QVariant &value) +{ + if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode && value.isValid()) { + + static const int silenceSensitiveModelItemIds[] = + { + CpProfileSettingForm::ProfileItemRingTone, + CpProfileSettingForm::ProfileItemMessageTone, + CpProfileSettingForm::ProfileItemEmailTone, + CpProfileSettingForm::ProfileItemReminderTone, + CpProfileSettingForm::ProfileItemNotificationTones, + CpProfileSettingForm::ProfileItemKeyandTouchScreenTones + }; + + QHash< int,QHash >::const_iterator it (mProfileModelItems.begin()); + for(; it != mProfileModelItems.end(); ++it ) { + for (int i = 0; i < sizeof(silenceSensitiveModelItemIds)/sizeof(silenceSensitiveModelItemIds[0]);++i) { + QHash::const_iterator found = it.value().find(silenceSensitiveModelItemIds[i]); + if (found != it.value().end()) { + found.value()->setEnabled(!value.toBool()); + } + } + } + } +} + +HbDataFormModelItem *CpProfileSettingForm::profileItem(int profileId,int profileItemId) +{ + return mProfileModelItems.value(profileId).value(profileItemId); +} + +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h --- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.h Fri May 14 13:21:08 2010 +0800 @@ -19,17 +19,32 @@ #define CPPROFILESETTINGFORM_H #include +#include class HbDataFormModel; class HbDataFormModelItem; class CpItemDataHelper; class CpProfileModel; class QFileIconProvider; +class XQSettingsManager; +class XQSettingsKey; +class QVariant; class CpProfileSettingForm : public HbDataForm { Q_OBJECT public: + + enum ProfileItemId { + ProfileItemRingTone, + ProfileItemMessageTone, + ProfileItemEmailTone, + ProfileItemReminderTone, + ProfileItemNotificationTones, + ProfileItemKeyandTouchScreenTones, + ProfileItemTouchScreenVibra + }; + CpProfileSettingForm(); virtual ~CpProfileSettingForm(); @@ -49,7 +64,7 @@ //meeting tones void on_meeting_notificationTones_stateChanged(int state); - void on_meeting_keysAndScreenSlider_ValueChanged( int value ); + void on_meeting_keysAndScreenToneSlider_ValueChanged( int value ); //meeting vibar void on_meeting_ringVibar_stateChanged( int state ); @@ -58,6 +73,8 @@ 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); private: void initModel(); void initGeneralTonesGroup(); @@ -69,6 +86,9 @@ // void initMessageToneGroup(HbDataFormModelItem *parent); // void initAlertToneGroup(HbDataFormModelItem *parent); // void initKeyAndScreenToneGroup(HbDataFormModelItem *parent); + + void initProfileItems(int profileId,HbDataFormModelItem *parent); + HbDataFormModelItem *profileItem(int profileId,int profileItemId); private: HbDataFormModel *mModel; CpItemDataHelper *mItemDataHelper; @@ -80,10 +100,14 @@ HbDataFormModelItem *mCurrentPage; - HbDataFormModelItem *mGeneralKeysAndScreenToneSlider; - HbDataFormModelItem *mGeneralSreenVibra; - HbDataFormModelItem *mMeetingKeysAndScreenToneSlider; - HbDataFormModelItem *mMeetingSreenVibra; + // HbDataFormModelItem *mGeneralKeysAndScreenToneSlider; + // HbDataFormModelItem *mGeneralSreenVibra; + // HbDataFormModelItem *mMeetingKeysAndScreenToneSlider; + // HbDataFormModelItem *mMeetingSreenVibra; + + XQSettingsManager *mSettingManager; + + QHash< int,QHash > mProfileModelItems; }; diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/pincodeplugin/pincodeplugin.pri --- a/controlpanelui/src/cpplugins/pincodeplugin/pincodeplugin.pri Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: cppincodeplugin source files -# - -# Input -HEADERS += src/*.h -SOURCES += src/*.cpp - -INCLUDEPATH += ../../seccodeui/src \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/pincodeplugin/pincodeplugin.pro --- a/controlpanelui/src/cpplugins/pincodeplugin/pincodeplugin.pro Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = cppincodeplugin - -CONFIG += hb plugin - -LIBS += -lseccodeui - -include ( ../cpplugincommon.pri ) -include ( pincodeplugin.pri ) - -symbian { - TARGET.UID3 = 0X20028731 -} \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/pincodeplugin/src/cppincodeplugin.cpp --- a/controlpanelui/src/cpplugins/pincodeplugin/src/cppincodeplugin.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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 "cppincodeplugin.h" -#include "cppincodepluginview.h" -#include - -CpPinCodePlugin::CpPinCodePlugin() -{ -} - -CpPinCodePlugin::~CpPinCodePlugin() -{ -} - -QList CpPinCodePlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const -{ - return QList() << new CpSettingFormEntryItemDataImpl( - itemDataHelper,tr("PIN code"),QString()); -} - -Q_EXPORT_PLUGIN2(cppincodeplugin, CpPinCodePlugin); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/pincodeplugin/src/cppincodeplugin.h --- a/controlpanelui/src/cpplugins/pincodeplugin/src/cppincodeplugin.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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 CPPINCODEPLUGIN_H -#define CPPINCODEPLUGIN_H - -#include -#include - -class CpPinCodePlugin : public QObject, public CpPluginInterface -{ - Q_OBJECT - Q_INTERFACES(CpPluginInterface) -public: - CpPinCodePlugin(); - virtual ~CpPinCodePlugin(); - virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; -}; - -#endif //CPPINCODEPLUGIN_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/pincodeplugin/src/cppincodepluginview.cpp --- a/controlpanelui/src/cpplugins/pincodeplugin/src/cppincodepluginview.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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 "cppincodepluginview.h" -#include -#include -#include -#include -#include -#include - -CpPinCodePluginView::CpPinCodePluginView(QGraphicsItem *parent /*= 0*/) -: CpBaseSettingView(0,parent), mSecCodeSettings(new SecCodeSettings()) -{ - if (HbDataForm *form = settingForm()) { - - QList protoTypeList = form->itemPrototypes(); - protoTypeList.append(new SecCodeEditDataFormViewItem()); - form->setItemPrototypes(protoTypeList); - - form->setHeading(tr("PIN code")); - - HbDataFormModel *formModel = new HbDataFormModel(); - - HbDataFormModelItem *pinCodeRequestItem = new HbDataFormModelItem( - HbDataFormModelItem::ToggleValueItem,tr("PIN code requests")); - - pinCodeRequestItem->setContentWidgetData("text",tr("On")); - pinCodeRequestItem->setContentWidgetData("additionalText",tr("Off")); - - formModel->appendDataFormItem(pinCodeRequestItem); - - HbDataFormModelItem *pinCodeItem = new HbDataFormModelItem( - static_cast(SecCodeEditDataFormViewItem::SecCodeEditItem), - tr("PIN code")); - pinCodeItem->setContentWidgetData("echoMode",HbLineEdit::Password); - pinCodeItem->setContentWidgetData("text","1111"); - pinCodeItem->setContentWidgetData("readOnly",true); - form->addConnection(pinCodeItem,SIGNAL(clicked()),this,SLOT(onPinCodeClicked())); - - formModel->appendDataFormItem(pinCodeItem); - - HbDataFormModelItem *pin2CodeItem = new HbDataFormModelItem( - static_cast(SecCodeEditDataFormViewItem::SecCodeEditItem), - tr("PIN2 code")); - pin2CodeItem->setContentWidgetData("echoMode",HbLineEdit::Password); - pin2CodeItem->setContentWidgetData("text","1111"); - pin2CodeItem->setContentWidgetData("readOnly",true); - form->addConnection(pin2CodeItem,SIGNAL(clicked()),this,SLOT(onPin2CodeClicked())); - - formModel->appendDataFormItem(pin2CodeItem); - - form->setModel(formModel); - } -} - -CpPinCodePluginView::~CpPinCodePluginView() -{ - delete mSecCodeSettings; -} - -void CpPinCodePluginView::onPinCodeClicked() -{ - mSecCodeSettings->changePinCode(); -} - -void CpPinCodePluginView::onPin2CodeClicked() -{ - mSecCodeSettings->changePin2Code(); -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/pincodeplugin/src/cppincodepluginview.h --- a/controlpanelui/src/cpplugins/pincodeplugin/src/cppincodepluginview.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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 CPPINCODEPLUGINVIEW_H -#define CPPINCODEPLUGINVIEW_H - -#include - -class SecCodeSettings; -class CpPinCodePluginView : public CpBaseSettingView -{ - Q_OBJECT -public: - explicit CpPinCodePluginView(QGraphicsItem *parent = 0); - virtual ~CpPinCodePluginView(); -private slots: - void onPinCodeClicked(); - void onPin2CodeClicked(); -private: - SecCodeSettings *mSecCodeSettings; -}; - -#endif //CPPINCODEPLUGINVIEW_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg --- a/controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/privacyplugin/data/cpprivacyplugin.cpcfg Fri May 14 13:21:08 2010 +0800 @@ -7,7 +7,7 @@ - + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Fri May 14 13:21:08 2010 +0800 @@ -26,9 +26,7 @@ QGraphicsItem *parent):HbDialog(parent), mProfileModel(profileModel), mProfileList(0), - mProfileActivator(profileActivator), - mConfirmProfile(0), - mCancelProfile(0) + mProfileActivator(profileActivator) { mProfileIds << EProfileWrapperGeneralId << EProfileWrapperMeetingId; @@ -47,8 +45,8 @@ connect(mCancelProfile, SIGNAL(triggered(bool)), this, SLOT(cancelProfileSelection())); - this->setPrimaryAction(mConfirmProfile); - this->setSecondaryAction(mCancelProfile); + this->addAction(mConfirmProfile); + this->addAction(mCancelProfile); this->setContentWidget(mProfileList); this->setModal(true); @@ -58,8 +56,7 @@ CpProfileActivatorDialog::~CpProfileActivatorDialog() { - delete mConfirmProfile; - delete mCancelProfile; + } void CpProfileActivatorDialog::confirmProfileSelection() { diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Fri May 14 13:21:08 2010 +0800 @@ -19,6 +19,7 @@ #include #include +#include class HbRadioButtonList; class HbDataFormModelItem; class CpProfileActivatorEntryItem; @@ -40,8 +41,8 @@ CpProfileModel &mProfileModel; HbRadioButtonList *mProfileList; CpSettingFormItemData *mProfileActivator; - HbAction *mConfirmProfile; - HbAction *mCancelProfile; + QPointer mConfirmProfile; + QPointer mCancelProfile; QList mProfileIds; }; #endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Fri May 14 13:21:08 2010 +0800 @@ -39,36 +39,11 @@ } void CpProfileActivatorEntryItem::onLaunchView() { - QScopedPointer dialog - (new CpProfileActivatorDialog(this, *mProfileModel)); - dialog->exec(); -// //launch media fetcher -// if (!mReq) -// { -// mReq = mAppMgr.create("com.nokia.services.media.Music", "fetch(QString)", true); -// -// if (!mReq) -// { -// return; -// } -// else -// { -// connect(mReq, SIGNAL(requestOk(const QVariant&)), SLOT(handleOk(const QVariant&))); -// connect(mReq, SIGNAL(requestError(int,const QString&)), SLOT(handleError(int,const QString&))); -// } -// } -// -// // Set arguments for request (music fetcher application title) -// QList args; -// args << QVariant( text() ); -// mReq->setArguments(args); -// -// // Make the request -// if (!mReq->send()) -// { -// //report error -// return; -// } + CpProfileActivatorDialog *dialog = + new CpProfileActivatorDialog(this, *mProfileModel); + dialog->setAttribute(Qt::WA_DeleteOnClose); + // dialog->open(this, SLOT(ultimateDialogSlot(HbAction*))); + dialog->show(); } /*void CpPersonalizationEntryItemData::handleOk(const QVariant &result) diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h --- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Fri May 14 13:21:08 2010 +0800 @@ -14,8 +14,8 @@ * Description: * */ -#ifndef CPPERSONALIZATIONENTRYITEMDATA_H -#define CPPERSONALIZATIONENTRYITEMDATA_H +#ifndef CPPROFILEACTIVATORENTRYITEM_H +#define CPPROFILEACTIVATORENTRYITEM_H #include @@ -39,4 +39,4 @@ CpProfileModel *mProfileModel; }; -#endif // CPPERSONALIZATIONENTRYITEMDATA_H +#endif // CPPROFILEACTIVATORENTRYITEM_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro --- a/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/ringtoneplugin.pro Fri May 14 13:21:08 2010 +0800 @@ -16,17 +16,13 @@ TEMPLATE = lib TARGET = cpringtoneplugin - - CONFIG += hb plugin -LIBS += -lcpprofilewrapper -LIBS += -lxqservice -lxqserviceutil - include ( ../cpplugincommon.pri ) include ( ringtoneplugin.pri ) symbian { + LIBS += -lcpprofilewrapper -lxqservice -lxqserviceutil -lcpringtoneview -lxqsettingsmanager TARGET.UID3 = 0X20028738 TARGET.CAPABILITY = All -TCB TARGET.EPOCALLOWDLLDATA = 1 diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp --- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.cpp Fri May 14 13:21:08 2010 +0800 @@ -15,106 +15,183 @@ * */ #include "cppersonalizationentryitemdata.h" -#include #include #include #include #include +#include +#include +#include +#include +#include "cpringtoneview.h" + + +const QString g_strNoTone("Z:\\resource\\No_Sound.wav"); CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, const QString &text, const QString &description, const HbIcon &icon, + Profile_Tone_Types toneType, + int profileId, const HbDataFormModelItem *parent) - :CpSettingFormEntryItemData(itemDataHelper,text,description, - icon,parent),mReq(0),mProfileModel(0) + :CpSettingFormEntryItemData( itemDataHelper,text,description,icon,parent), + mProfileModel(0), + m_profileID(profileId), + mToneType(toneType), + mSettingManager(0) { + Q_UNUSED(itemDataHelper); //reserve for future CPFW_LOG("CpPersonalizationEntryItemData::CpPersonalizationEntryItemData(), START"); mProfileModel = new CpProfileModel(); - if(mProfileModel) + if( mProfileModel ) { - setDescription( mProfileModel->ringTone().section(QDir::separator (),-1) ); + QString strRing = loadStringValue(); + if( strRing.contains( "No_Sound.wav", Qt::CaseInsensitive) ) + { + setDescription( hbTrId("txt_cp_list_no_tone" ) ); //sepcial handling about NoTone + } + else + { + setDescription( strRing.section(QDir::separator (),-1) ); + } } else { CPFW_LOG("CpPersonalizationEntryItemData::mProfileModel:NULL!"); } + mSettingManager = new XQSettingsManager(); + XQCentralRepositorySettingsKey key(KCRUidProfileEngine.iUid,KProEngSilenceMode); + + QVariant silenceMode = mSettingManager->readItemValue( key,XQSettingsManager::TypeInt ); + setEnabled( !silenceMode.toInt() ); + mSettingManager->startMonitoring( key,XQSettingsManager::TypeInt ); + 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() ); +} + CpPersonalizationEntryItemData::~CpPersonalizationEntryItemData() { if( mProfileModel ) { delete mProfileModel; - mProfileModel = NULL; + mProfileModel = 0; + } + if( mSettingManager ) + { + delete mSettingManager; } } -void CpPersonalizationEntryItemData::onLaunchView() + +QString CpPersonalizationEntryItemData::loadStringValue() const { - CPFW_LOG("CpPersonalizationEntryItemData::onLaunchView, START"); - - //launch media fetcher - if (!mReq) + QString strRing; + switch( mToneType ) { - mReq = mAppMgr.create("com.nokia.services.media.Music", "fetch(QString)", true); - - if (!mReq) + case TONE_Message: + if( m_profileID>=0 ) + { + strRing = mProfileModel->messageTone( m_profileID ); + } + break; + case TONE_Email: + if( m_profileID >=0 ) { - CPFW_LOG("CpPersonalizationEntryItemData::onLaunchView, Mediafetcher start failed"); - return; + strRing = mProfileModel->emailTone( m_profileID ); + } + break; + case TONE_Reminder: + if( m_profileID >=0 ) + { + strRing = mProfileModel->reminderTone( m_profileID ); + } + break; + case TONE_Ring: + default: + if( m_profileID <0 ) + { + strRing = mProfileModel->ringTone(); } else { - connect(mReq, SIGNAL(requestOk(const QVariant&)), SLOT(handleOk(const QVariant&))); - connect(mReq, SIGNAL(requestError(int,const QString&)), SLOT(handleError(int,const QString&))); + strRing = mProfileModel->ringTone( m_profileID ); } + break; } - // Set arguments for request (music fetcher application title) - QList args; - args << QVariant( text() ); - mReq->setArguments(args); - - // Make the request - if (!mReq->send()) + return strRing; +} +void CpPersonalizationEntryItemData::storeStringValue( const QString &strValue ) const +{ + QString strInput = strValue; + if( strInput.length() == 0 ) + { + strInput = g_strNoTone; + } + switch( mToneType ) { - CPFW_LOG("CpPersonalizationEntryItemData::onLaunchView, Mediafetcher calling failed"); - //report error - return; + case TONE_Message: + if( m_profileID >=0 ) + { + mProfileModel->setMessageTone( m_profileID, strInput ); + } + break; + case TONE_Email: + if( m_profileID >=0 ) + { + mProfileModel->setEmailTone( m_profileID, strInput ); + } + break; + case TONE_Reminder: + if( m_profileID >=0 ) + { + mProfileModel->setReminderTone( m_profileID, strInput ); + } + break; + case TONE_Ring: + default: + if( m_profileID <0 ) + { + mProfileModel->setRingTone( strInput ); + } + else + { + mProfileModel->setRingTone( m_profileID, strInput ); + } + break; } - CPFW_LOG("CpPersonalizationEntryItemData::onLaunchView, successful END"); - } -void CpPersonalizationEntryItemData::handleOk(const QVariant &result) + +void CpPersonalizationEntryItemData::handleOk(const QString &strFname) { - CPFW_LOG("CpPersonalizationEntryItemData::handleOk"); - if (!result.canConvert()) + if(strFname.length()) { - setDescription( "Corrupt result" ); + setDescription( strFname.section(QDir::separator (),-1) ); } else { - QString strRet = result.value(); - if(strRet.length()) - { - setDescription( strRet.section(QDir::separator (),-1) ); - } - else - { - setDescription( "No tone" ); - } - mProfileModel->setRingTone( strRet ); + setDescription( hbTrId("txt_cp_list_no_tone" ) ); } + storeStringValue(strFname); } + + void CpPersonalizationEntryItemData::handleError(int errorCode, const QString& errorMessage) { - CPFW_LOG("CpPersonalizationEntryItemData::handleError"); - //handling error return Q_UNUSED(errorCode); Q_UNUSED(errorMessage); - setDescription("Error media fetcher"); } CpBaseSettingView *CpPersonalizationEntryItemData::createSettingView() const { - return NULL; + CpRingToneView *pView = new CpRingToneView( ); + connect( pView, SIGNAL( selOK( const QString&)),SLOT(handleOk(const QString &)) ); + connect( pView, SIGNAL( selError( int, const QString& ) ), SLOT( handleOk(const QString &)) ); + return pView; } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h --- a/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/ringtoneplugin/src/cppersonalizationentryitemdata.h Fri May 14 13:21:08 2010 +0800 @@ -18,33 +18,44 @@ #define CPPERSONALIZATIONENTRYITEMDATA_H #include -#include +#include class CpProfileModel; -class XQApplicationManager; -class XQAiwRequest; - +class XQSettingsManager; class CpPersonalizationEntryItemData : public CpSettingFormEntryItemData { - Q_OBJECT + Q_OBJECT public: - explicit CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, + typedef enum + { + TONE_Ring = 0, + TONE_Message, + TONE_Email, + TONE_Reminder + }Profile_Tone_Types; + + explicit CpPersonalizationEntryItemData(CpItemDataHelper &itemDataHelper, const QString &text = QString(), const QString &description = QString(), const HbIcon &icon = HbIcon(), + Profile_Tone_Types toneType = TONE_Ring, + int profileId = -1, const HbDataFormModelItem *parent = 0); virtual ~CpPersonalizationEntryItemData(); private slots: - void onLaunchView(); - void handleOk(const QVariant &result); - void handleError(int errorCode, const QString& errorMessage); + void handleOk(const QString &strFname); + void handleError( int errorCode, const QString& errorMessage ); + void settingValueChanged( const XQSettingsKey& key, const QVariant& value ); private: virtual CpBaseSettingView *createSettingView() const; + QString loadStringValue() const; + void storeStringValue( const QString &strvalue ) const; private: - XQApplicationManager mAppMgr; - XQAiwRequest* mReq; CpProfileModel *mProfileModel; + int m_profileID; + Profile_Tone_Types mToneType; + XQSettingsManager *mSettingManager; }; #endif // CPPERSONALIZATIONENTRYITEMDATA_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cpmastervolumeslider.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpmastervolumeslider.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +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 "cpmastervolumeslider.h" - -CpMasterVolumeSlider::CpMasterVolumeSlider(QGraphicsItem *parent /* =0 */) - :HbSlider(parent), - mPreviousValue(0) -{ -// QList elements; -// elements << HbSlider::IncreaseElement -// << HbSlider::TrackElement -// << HbSlider::DecreaseElement -// << HbSlider::IconElement -// << HbSlider::TextElement; -// -// setElements( elements ); -// setOrientation(Qt::Horizontal); -// setMaximum(10); -// setMinimum(1); -// -// setIcon(HbSlider::DecreaseElement, HbIcon(":/icon/hb_vol_slider_decrement.svg")); -// setIcon(HbSlider::IncreaseElement, HbIcon(":/icon/hb_vol_slider_increment.svg")); -// setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_muted.svg")); -// -// setIconCheckable(true); -// -// // set tick and beep label -// -//#if 1 -//// setMajorTickInterval(1); -//// setTickPosition(Hb::SliderTicksBothSides); -//// QStringList labelList; -//// labelList<< tr("") -//// << tr("Beep"); -// -//// this->setMajorTickLabels(labelList); -//#endif -// /* -// connect(this, SIGNAL(iconToggled(bool)), -// this, SLOT(onMuteIconToggled(bool)));*/ -// connect(this, SIGNAL(valueChanged(int)), -// this, SLOT(onValueChanged(int))); -//// onValueChanged(value()); -} - -CpMasterVolumeSlider::~CpMasterVolumeSlider() -{ -} - -/*bool CpMasterVolumeSlider::isBeepMode() -{ - if (value() == minimum()+1) { - return true; - } - else { - return false; - } -} - -void CpMasterVolumeSlider::setBeepMode(bool isBeepMode) -{ - if (isBeepMode == true) { - setValue(minimum()+1); - } - else { - setValue(mPreviousValue); - } -}*/ - -/*bool CpMasterVolumeSlider::isSilentMode() -{ - if (value() == minimum()) { - return true; - } - else { - return false; - } -} - -void CpMasterVolumeSlider::setSilentMode(bool isSilentMode) -{ - if (isSilentMode == true) { - setValue(minimum()); - } - else { - setValue(mPreviousValue); - } -} - -int CpMasterVolumeSlider::normalValue() -{ - return (value()-1); -} - -void CpMasterVolumeSlider::setNormalValue(int normalValue) -{ - setValue(normalValue+1); -} -*/ -void CpMasterVolumeSlider::onValueChanged(int value) -{ -// if (this->minimum( ) == value) { -// // volume is mute -// this->setIconChecked( true ); -// emit silentActivated(); -// } -// else { -// // unmute volume -// this->setIconEnabled( true ); -// //this->setIconCheckable(false); -// //this->setIconChecked( false ); -// this->setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_unmuted.svg")); -// this->setIconCheckable(true); -// -// -// /*if (value == 1) { -// emit beepActivated(); -// }*/ -// //else { -// int valueMap = value; -// emit normalValueChanged(valueMap); -// //} -// } -} - -/*void CpMasterVolumeSlider::onIncreaseIconClicked() -{ -} - -void CpMasterVolumeSlider::onDecreaseIconClicked() -{ -}*/ - -void CpMasterVolumeSlider::onMuteIconToggled(bool isToggled) -{ -// if (isToggled) { -// mPreviousValue = value(); -// this->setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_muted.svg")); -// setValue(minimum()); -// } -// else { -// this->setIcon(HbSlider::IconElement, HbIcon(":/icon/hb_vol_slider_unmuted.svg")); -// if (mPreviousValue == minimum()||mPreviousValue == minimum()+1) { -// setValue(minimum()+1); -// } -// else { -// setValue(mPreviousValue); -// } -// mPreviousValue = 0; -// } -} - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cpmastervolumeslider.h --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpmastervolumeslider.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 CP_MASTERVOLUMESLIDER_H -#define CP_MASTERVOLUMESLIDER_H - -#include -#include -class CpMasterVolumeSlider: public HbSlider -{ - Q_OBJECT - //Q_PROPERTY(bool beepMode READ isBeepMode WRITE setBeepMode) - //Q_PROPERTY(bool silentMode READ isSilentMode WRITE setSilentMode) - //Q_PROPERTY(int normalValue READ normalValue WRITE setNormalValue) - -public: - explicit CpMasterVolumeSlider(QGraphicsItem *parent = 0); - ~CpMasterVolumeSlider(); - -public: - //bool isBeepMode(); - //void setBeepMode(bool isBeepMode); - //bool isSilentMode(); - //void setSilentMode(bool isSilentMode); - //int normalValue(); - //void setNormalValue(int normalValue); - -signals: - //void beepActivated(); - void silentActivated(); - void normalValueChanged(int value); -private slots: - void onValueChanged(int value); - //void onIncreaseIconClicked(); - //void onDecreaseIconClicked(); - void onMuteIconToggled(bool isToggled); -private: - int mPreviousValue; -}; - -#endif - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.cpp Fri May 14 13:21:08 2010 +0800 @@ -16,7 +16,6 @@ */ #include "cppersonalizationcustomviewitem.h" -#include "cpmastervolumeslider.h" #include #include #include @@ -72,7 +71,7 @@ void CpPersonalizationCustomViewItem::load() { - HbDataFormViewItem::load(); + //HbDataFormViewItem::load(); CpVolumeCustomItemType itemType = static_cast( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); @@ -98,10 +97,38 @@ } } +void CpPersonalizationCustomViewItem::restore() +{ + HbDataFormViewItem::restore(); + + CpVolumeCustomItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + + if(itemType == SilenceIndicatorItem) { + + QModelIndex itemIndex = modelIndex(); + HbDataFormModel *model = static_cast(itemView()->model());; + HbDataFormModelItem *modelItem = static_cast( + model->itemFromIndex(itemIndex)); + + + if (mWidget != 0) { + const QMetaObject *metaObj = mWidget->metaObject(); + int count = metaObj->propertyCount(); + for (int i = 0; i < count; i++) { + QMetaProperty metaProperty = metaObj->property(i); + if (metaProperty.isValid() && metaProperty.isWritable()) { + metaProperty.write(mWidget,modelItem->contentWidgetData(metaProperty.name())); + } + } + } + } +} + void CpPersonalizationCustomViewItem::store() { - HbDataFormViewItem::store(); + //HbDataFormViewItem::store(); CpVolumeCustomItemType itemType = static_cast( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.h --- a/controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cppersonalizationcustomviewitem.h Fri May 14 13:21:08 2010 +0800 @@ -39,6 +39,7 @@ public slots: virtual void load(); virtual void store(); + virtual void restore(); /*private slots: void onValueChanged(int value);*/ protected: diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.cpp Fri May 14 13:21:08 2010 +0800 @@ -27,21 +27,30 @@ //#include //#include +#include +#include +#include + CpVolumeController::CpVolumeController(CpProfileModel *profileModel, const QList &itemList, - CpItemDataHelper &itemDataHelper): - mProfileModel(profileModel), - mItemList(itemList) + CpItemDataHelper &itemDataHelper) : + mProfileModel(profileModel), + mItemList(itemList), + mSettingManager(0) { //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(beepActivated()),this,SLOT(onBeepActivated())); //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(silentActivated()),this,SLOT(onSilentActivated())); //itemDataHelper.addConnection(mMasterVolumeItem,SIGNAL(normalValueChanged(int)),this,SLOT(onNormalValueChanged(int))); //updateMasterVolumeValue(); + + itemDataHelper.addConnection( mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem), SIGNAL(toggled(bool)), this, SLOT(silenceModeChange(bool)) ); + + itemDataHelper.addConnection( mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem), SIGNAL(valueChanged(int)), this, SLOT(masterVolumeChange(int)) @@ -50,30 +59,38 @@ mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem), SIGNAL(stateChanged(int)), this, SLOT(masterVibraChange(int)) ); - update(); + updateUi(); + + mSettingManager = new XQSettingsManager(); + + XQCentralRepositorySettingsKey silenceKey(KCRUidProfileEngine.iUid,KProEngSilenceMode); + mSettingManager->startMonitoring(silenceKey,XQSettingsManager::TypeInt); + + XQCentralRepositorySettingsKey masterVolumeKey + (KCRUidProfileEngine.iUid,KProEngMasterVolume); + mSettingManager->startMonitoring(masterVolumeKey,XQSettingsManager::TypeInt); + + XQCentralRepositorySettingsKey masterVibraKey + (KCRUidProfileEngine.iUid,KProEngMasterVibra); + mSettingManager->startMonitoring(masterVibraKey,XQSettingsManager::TypeInt); + + connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)), + this, SLOT(settingValueChanged(XQSettingsKey, QVariant))); } CpVolumeController::~CpVolumeController() { - + delete mSettingManager; } -/*void CpMasterVolumeValueController::onBeepActivated() -{ -#ifdef Q_OS_SYMBIAN - mProfileModel->activateBeep(); -#endif -}*/ - void CpVolumeController::silenceModeChange(bool isSilence) { #ifdef Q_OS_SYMBIAN mProfileModel->setSilenceMode(isSilence); - HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); - masterVolume->setEnabled(!isSilence); #endif } + void CpVolumeController::masterVolumeChange(int value) { #ifdef Q_OS_SYMBIAN @@ -90,23 +107,28 @@ #endif } -void CpVolumeController::update() +void CpVolumeController::updateUi() { #ifdef Q_OS_SYMBIAN - bool isSilenceMode = mProfileModel->isSilenceMode(); + bool isSilenceMode = mProfileModel->silenceMode(); HbDataFormModelItem *silenceIndicator = mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem); - silenceIndicator->setContentWidgetData("checked",isSilenceMode); + if(silenceIndicator) { + silenceIndicator->setContentWidgetData("checked",isSilenceMode); + } HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); if (masterVolume) { CPFW_LOG("::updateMasterVolumeValue(), Start using profile model."); QMap iconMaps; if (isSilenceMode) { CPFW_LOG("::updateMasterVolumeValue(), Got silent state."); + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); } else { + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); - CPFW_LOG("::updateMasterVolumeValue(), Got ring volume."); } masterVolume->setContentWidgetData("elementIcons", iconMaps); masterVolume->setEnabled(!isSilenceMode); @@ -125,11 +147,13 @@ { switch( volumeLevel ){ case VolumenLevelSoft: - return 1; + return EProfileMasterVolumeSoft; case VolumeLevelMed: - return 5; + return EProfileMasterVolumeMed; case VolumeLevelLoud: - return 10; + return EProfileMasterVolumeLoud; + default: + return 1; } } CpVolumeController::VolumeLevel CpVolumeController::intToVolumeLevel( int value ) @@ -142,3 +166,43 @@ return VolumeLevelLoud; } } + +void CpVolumeController::settingValueChanged(const XQSettingsKey &key, const QVariant &value) +{ + if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode) { + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + if (masterVolume) { + QMap iconMaps; + if (value.toBool()) { + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg")); + } + else { + iconMaps.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg")); + iconMaps.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg")); + iconMaps.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg")); + } + masterVolume->setContentWidgetData("elementIcons", iconMaps); + masterVolume->setEnabled(!value.toBool()); + } + HbDataFormModelItem *silenceMode = mItemList.at(CpVolumeGroupItemData::EVolumeSilenceItem); + if (silenceMode) { + silenceMode->setContentWidgetData("checked",value.toInt() != 0); + } + } + else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVolume) { + HbDataFormModelItem *masterVolume = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVolumeItem); + if (masterVolume) { + masterVolume->setContentWidgetData("value",intToVolumeLevel(value.toInt())); + } + } + else if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngMasterVibra) { + HbDataFormModelItem *masterVibra = mItemList.at(CpVolumeGroupItemData::EVolumeMasterVibraItem); + if (masterVibra) { + masterVibra->setContentWidgetData("checkState",(value.toInt() ? 2 : 0)); + } + } +} + +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumecontroller.h Fri May 14 13:21:08 2010 +0800 @@ -22,6 +22,9 @@ class CpProfileModel; class HbDataFormModelItem; class CpItemDataHelper; +class XQSettingsManager; +class XQSettingsKey; +class QVariant; class CpVolumeController : public QObject { @@ -41,14 +44,18 @@ void silenceModeChange(bool isSilence); void masterVolumeChange(int value); void masterVibraChange(int state); + + void settingValueChanged(const XQSettingsKey &key, const QVariant &value); + private: - void update(); + void updateUi(); int volumeLevelToInt( CpVolumeController::VolumeLevel volumeLevel ); CpVolumeController::VolumeLevel intToVolumeLevel( int value ); private: CpProfileModel *mProfileModel; QList mItemList; + XQSettingsManager *mSettingManager; }; #endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Fri May 14 13:21:08 2010 +0800 @@ -40,6 +40,7 @@ CpVolumeGroupItemData::~CpVolumeGroupItemData() { delete mProfileModel; + delete mVolumeController; } void CpVolumeGroupItemData::initItems(CpItemDataHelper &itemDataHelper) @@ -73,13 +74,15 @@ masterVolume->setContentWidgetData("minimum", 1); masterVolume->setContentWidgetData("maximum", 3); masterVolume->setContentWidgetData("majorTickInterval",1); - + masterVolume->setContentWidgetData("tickPosition",Hb::SliderTicksBelow); + QStringList tickLabels; - tickLabels<setContentWidgetData("majorTickLabels",tickLabels); + masterVolume->setContentWidgetData("iconCheckable",false); this->appendChild(masterVolume); HbDataFormModelItem *masterVibra = new HbDataFormModelItem(HbDataFormModelItem::CheckBoxItem); @@ -90,36 +93,3 @@ mVolumeController = new CpVolumeController(mProfileModel, mItemList, itemDataHelper); } -//void CpVolumeGroupItemData::activateProfile(int profileIndex) -//{ -// switch (profileIndex) { -// case 0: // general -// { -// mProfileModel->activateProfile(EProfileWrapperGeneralId); -// int volumeValue = mProfileModel->ringVolume(); -// // update the master volume when profile changed -// // should be used profileChangedObserver in the future; -// mMasterVolume->setContentWidgetData(/*"visible"*/"enabled",true); -// mMasterVolume->setContentWidgetData("value", volumeValue); -// break; -// } -// case 1: // meeting -// { -// mProfileModel->activateProfile(EProfileWrapperMeetingId); -// int volumeValue = mProfileModel->ringVolume(); -// mMasterVolume->setContentWidgetData(/*"visible"*/"enabled",true); -// mMasterVolume->setContentWidgetData("value", volumeValue); -// break; -// } -// case 2: // silent -// { -// mProfileModel->activateProfile(EProfileWrapperSilentId); -// mMasterVolume->setContentWidgetData("value", 0); -// mMasterVolume->setContentWidgetData(/*"visible"*/"enabled",false); -// break; -// } -// default: -// break; -// -// } -//} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.h --- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.h Fri May 14 13:21:08 2010 +0800 @@ -15,8 +15,8 @@ * */ -#ifndef CPPROFILESGROUPITEMDATA_H -#define CPPROFILESGROUPITEMDATA_H +#ifndef CPVOLUMEGROUPITEMDATA_H +#define CPVOLUMEGROUPITEMDATA_H #include #include diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro --- a/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpplugins/volumeplugin/volumeplugin.pro Fri May 14 13:21:08 2010 +0800 @@ -19,7 +19,7 @@ CONFIG += hb plugin RESOURCES += volumeplugin.qrc -LIBS += -lcpprofilewrapper +LIBS += -lcpprofilewrapper -lxqsettingsmanager include ( ../cpplugincommon.pri ) include ( volumeplugin.pri ) diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp Fri May 14 13:21:08 2010 +0800 @@ -63,7 +63,7 @@ /* * Get active profile's id */ -int CpProfileModel::activeProfileId() +int CpProfileModel::activeProfileId() const { return d_ptr->activeProfileId(); } @@ -71,9 +71,9 @@ /*! Get profile settings, store in center repository keys */ -int CpProfileModel::profileSettings(int profileId, CpProfileSettings& profileSettings) +void CpProfileModel::profileSettings(int profileId, CpProfileSettings& profileSettings) { - return d_ptr->profileSettings(profileId, profileSettings); + d_ptr->profileSettings(profileId, profileSettings); } /*! @@ -139,9 +139,9 @@ Return the silence mode of device, silence mode will kill all outgoing audio. */ -bool CpProfileModel::isSilenceMode() const +bool CpProfileModel::silenceMode() const { - return d_ptr->isSilenceMode(); + return d_ptr->silenceMode(); } /*! @@ -155,9 +155,9 @@ /*! Return the status of off line mode (air plane mode) of device */ -bool CpProfileModel::isOffLineMode() const +bool CpProfileModel::offLineMode() const { - return d_ptr->isOffLineMode(); + return d_ptr->offLineMode(); } /*! diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -32,14 +33,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include @@ -58,13 +59,7 @@ CpProfileModelPrivate::CpProfileModelPrivate() : mEngine(0), - //mProfileExt(0), - //mToneSettings(0), - //mFeedbackSettings(0), - //mSetFeedbackSettings(0), - //mVibraCenRep(0), - mEditingProfileId(0), - mInitErrFlag(false), + mInitErrFlag(0), mOffLineCenRep(0), q_ptr(0) { @@ -77,52 +72,43 @@ CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START."); TRAPD( err, mEngine = CreateProfileEngineExtended2L(); - //int proId = mEngine->ActiveProfileId(); - //UpdateProfileSettingsL( proId ); - //mVibraCenRep = CRepository::NewL( KCRUidVibraCtrl ); 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)); ); + + // 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) ); } -void CpProfileModelPrivate::UpdateProfileSettingsL(int profileId) -{ - CPFW_LOG("CpProfileModelPrivate::UpdateProfileSettingsL(), START. profile id is: " + QString(profileId)); - /*if ( profileId <= EProfileWrapperErrorId || profileId >= EProfileWrapperOverflowId ){ - CPFW_LOG("CpProfileModelPrivate::UpdateProfileSettingsL(), End with invalid profile id."); - //User::Leave(KErrNotFound); - return; - } -*/ -/* mProfileExt = mEngine->Profile2L( profileId ); - CPFW_LOG("CpProfileModelPrivate::UpdateProfileSettingsL(), Succeded in getting mProfileExt. "); - - // General tones - TProfileToneSettings& toneSettings = mProfileExt->ProfileSetTones().SetToneSettings(); - mToneSettings = &toneSettings; - - // Feedback settings, used to get screen tone - const MProfileFeedbackSettings& feedback = - mProfileExt->ProfileExtraSettings().ProfileFeedbackSettings(); - mFeedbackSettings = &feedback; - - // Feedback settings, used to set screen tone - MProfileSetFeedbackSettings& setFeedback = - mProfileExt->ProfileSetExtraSettings().ProfileSetFeedbackSettings(); - mSetFeedbackSettings = &setFeedback; - - mEditingProfileId = profileId; - CPFW_LOG("CpProfileModelPrivate::UpdateProfileSettingsL(), END.");*/ -} CpProfileModelPrivate::~CpProfileModelPrivate() { - //delete mEngine; if (mEngine!=0) { mEngine->Release(); } - //delete mVibraCenRep; - //mVibraCenRep = 0; + foreach(MProfileExtended2* profile, mProfileList) + { + if (profile!=0 ) { + profile->Release(); + } + } + mProfileList.clear(); delete mOffLineCenRep; } @@ -153,6 +139,7 @@ // } // 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_setlabel_active_profile_val_general"); @@ -190,23 +177,15 @@ /* * Get active profile's id */ -int CpProfileModelPrivate::activeProfileId() +int CpProfileModelPrivate::activeProfileId() const { return mEngine->ActiveProfileId(); } -int CpProfileModelPrivate::profileSettings(int profileId, +void CpProfileModelPrivate::profileSettings(int profileId, CpProfileSettings& profileSettings) { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); -// CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return err; - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); const MProfileTones &setTones = profileExtend->ProfileTones(); const TProfileToneSettings &toneSettings = setTones.ToneSettings(); const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); @@ -216,8 +195,7 @@ profileExtend->ProfileExtraSettings(); const MProfileFeedbackSettings &feedbackSettings = extraSettings.ProfileFeedbackSettings(); - - + profileSettings.mRingTone = stringFromDescriptor(setTones.RingingTone1()); profileSettings.mMessageTone = stringFromDescriptor(setTones.MessageAlertTone()); profileSettings.mEmailTone = stringFromDescriptor(extTones.EmailAlertTone()); @@ -231,105 +209,92 @@ profileSettings.mReminderAlertVibra = vibraSettings.ReminderAlarmVibra(); profileSettings.mNotificationVibra = vibraSettings.InformationVibra(); profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); - - CleanupStack::PopAndDestroy(profileExtend); - return err; + } int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - - ) - if (err!=KErrNone) { - return err; - } - CleanupReleasePushL(*profileExtend); + 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(); - + MProfileSetExtraTones2 &setExtTones = + profileExtend->ProfileSetExtraTones2(); + MProfileSetVibraSettings &setVibraSettings = + profileExtend->ProfileSetVibraSettings(); + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + // ignore here, wait for the exception deal framework of qt-symbian TRAP_IGNORE( - setTones.SetRingingTone1L( *descriptorFromString(profileSettings.mRingTone) ); - setTones.SetMessageAlertToneL( *descriptorFromString(profileSettings.mMessageTone) ); - setExtTones.SetEmailAlertToneL( *descriptorFromString(profileSettings.mEmailTone) ); - setExtTones.SetReminderToneL( *descriptorFromString(profileSettings.mReminderTone) ); + setTones.SetRingingTone1L(*descriptorFromString( + profileSettings.mRingTone)); + setTones.SetMessageAlertToneL(*descriptorFromString( + profileSettings.mMessageTone)); + setExtTones.SetEmailAlertToneL(*descriptorFromString( + profileSettings.mEmailTone)); + setExtTones.SetReminderToneL(*descriptorFromString( + profileSettings.mReminderTone)); ) + toneSettings.iWarningAndGameTones + = profileSettings.mNotificationTone; + toneSettings.iKeypadVolume + = 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)); - toneSettings.iWarningAndGameTones = profileSettings.mNotificationTone; - toneSettings.iKeypadVolume = 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)); - - TRAPD(err2, - mEngine->CommitChangeL(*profileExtend); - CleanupStack::PopAndDestroy(profileExtend); - ) - return err2; + TRAPD(err, + mEngine->CommitChangeL(*profileExtend); + ) + return err; } QString CpProfileModelPrivate::ringTone() const { - MProfileExtended2 *profileExtend = 0; - - TRAPD(err, - profileExtend = mEngine->Profile2L(EProfileWrapperGeneralId); - //CleanupReleasePushL(*profileExtend); - ) - if (err!=KErrNone) { - return QString(""); - } - CleanupReleasePushL(*profileExtend); - - QString ringTone = stringFromDescriptor(profileExtend->ProfileTones().RingingTone1()); - CleanupStack::PopAndDestroy(profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(EProfileWrapperGeneralId); + QString ringTone = stringFromDescriptor( + profileExtend->ProfileTones().RingingTone1()); return ringTone; - CPFW_LOG("CpProfileModelPrivate::ringTone(), END with invalid mProfileExt. "); - } void CpProfileModelPrivate::setRingTone(const QString& filePath) { - TInt ids[] = {EProfileGeneralId,EProfileMeetingId}; - - for (TInt i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i) - { - MProfileExtended2 *profileExtend = 0; + 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( - profileExtend = mEngine->Profile2L(ids[i]); + setTones.SetRingingTone1L( *descriptorFromString(filePath) ); + mEngine ->CommitChangeL(*profileExtend); ) - CleanupReleasePushL(*profileExtend); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - setTones.SetRingingTone1L( *descriptorFromString(filePath) ); - mEngine ->CommitChangeL(*profileExtend); - CleanupStack::PopAndDestroy(profileExtend); - } + // ERROR SHOULD BE DEAL HERE OR RETURN A ERROR CODE + } } int CpProfileModelPrivate::masterVolume() const { - //NEED L FUNCTION? - TInt masterVolume = mEngine->MasterVolumeL(); + int masterVolume = 0; + TRAP_IGNORE(masterVolume = mEngine->MasterVolumeL();) return masterVolume; } void CpProfileModelPrivate::setMasterVolume(int volume) { - //NEED L FUNCTION ? TRAP_IGNORE(mEngine->SetMasterVolumeL( volume );) } bool CpProfileModelPrivate::masterVibra() const { - bool masterVibra = mEngine->MasterVibraL(); + bool masterVibra = false; + TRAP_IGNORE(masterVibra = mEngine->MasterVibraL();) return masterVibra; } void CpProfileModelPrivate::setMasterVibra(bool isVibra) @@ -337,9 +302,10 @@ TRAP_IGNORE(mEngine->SetMasterVibraL( isVibra );) } -bool CpProfileModelPrivate::isSilenceMode() const +bool CpProfileModelPrivate::silenceMode() const { - bool isSlience = mEngine->SilenceModeL(); + bool isSlience = false; + TRAP_IGNORE(isSlience = mEngine->SilenceModeL();) return isSlience; } void CpProfileModelPrivate::setSilenceMode(bool isSilence) @@ -347,257 +313,147 @@ TRAP_IGNORE(mEngine->SetSilenceModeL( isSilence );) } -bool CpProfileModelPrivate::isOffLineMode() const +bool CpProfileModelPrivate::offLineMode() const { int offLineMode = 0; - User::LeaveIfError(mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode )); + // What we should do if we can't set offline mode + mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode ); return offLineMode; } void CpProfileModelPrivate::setOffLineMode(bool isOffLine) { - User::LeaveIfError(mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine)); + mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine); } QString CpProfileModelPrivate::ringTone(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return QString(""); - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); const MProfileTones &setTones = profileExtend->ProfileTones(); - - + QString ringTone = stringFromDescriptor(setTones.RingingTone1()); - CleanupStack::PopAndDestroy(profileExtend); return ringTone; } void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - - TRAP_IGNORE( - setTones.SetRingingTone1L( *descriptorFromString(filePath) ); - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); + TRAP_IGNORE( + setTones.SetRingingTone1L(*descriptorFromString(filePath)); + mEngine->CommitChangeL(*profileExtend); + ) } QString CpProfileModelPrivate::messageTone(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return QString(""); - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + const MProfileTones &setTones = profileExtend->ProfileTones(); - + QString messageTone = stringFromDescriptor(setTones.MessageAlertTone()); - - CleanupStack::PopAndDestroy(profileExtend); + return messageTone; - } void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - - TRAP_IGNORE( - setTones.SetMessageAlertToneL( *descriptorFromString(filePath) ); - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } - + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetTones &setTones = + profileExtend->ProfileSetTones(); + TRAP_IGNORE( + setTones.SetMessageAlertToneL(*descriptorFromString(filePath)); + mEngine->CommitChangeL(*profileExtend); + ) } QString CpProfileModelPrivate::emailTone(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return QString(""); - } - CleanupReleasePushL(*profileExtend); - const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); - - QString emailTone = stringFromDescriptor(extTones.EmailAlertTone()); - - CleanupStack::PopAndDestroy(profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + const MProfileExtraTones2 &extTones = + profileExtend->ProfileExtraTones2(); + + QString emailTone = stringFromDescriptor(extTones.EmailAlertTone()); return emailTone; - } void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); - - TRAP_IGNORE( - setExtTones.SetEmailAlertToneL( *descriptorFromString(filePath) ); - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetExtraTones2 &setExtTones = + profileExtend->ProfileSetExtraTones2(); + TRAP_IGNORE ( + setExtTones.SetEmailAlertToneL(*descriptorFromString(filePath)); + mEngine->CommitChangeL(*profileExtend); + ) } QString CpProfileModelPrivate::reminderTone(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return QString(""); - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); QString reminderTone = stringFromDescriptor(extTones.ReminderTone()); - - CleanupStack::PopAndDestroy(profileExtend); - return reminderTone; - + return reminderTone; } void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); - - TRAP_IGNORE( - setExtTones.SetReminderToneL( *descriptorFromString(filePath) ); - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); + + TRAP_IGNORE( + setExtTones.SetReminderToneL( *descriptorFromString(filePath) ); + mEngine->CommitChangeL(*profileExtend); + ) } bool CpProfileModelPrivate::notificationTone(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return false; // ?????? - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); const MProfileTones &setTones = profileExtend->ProfileTones(); const TProfileToneSettings &toneSettings = setTones.ToneSettings(); - + bool notificationTone = toneSettings.iWarningAndGameTones; - - CleanupStack::PopAndDestroy(profileExtend); - return notificationTone; + return notificationTone; } void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TProfileToneSettings &toneSettings = setTones.SetToneSettings(); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetTones &setTones = profileExtend->ProfileSetTones(); + TProfileToneSettings &toneSettings = setTones.SetToneSettings(); - - toneSettings.iWarningAndGameTones = isActive; - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } + toneSettings.iWarningAndGameTones = isActive; + TRAP_IGNORE( + mEngine->CommitChangeL(*profileExtend); + ) } int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return -1; - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + const MProfileTones &setTones = profileExtend->ProfileTones(); const TProfileToneSettings &toneSettings = setTones.ToneSettings(); - + int keyTouchScreenTone = toneSettings.iKeypadVolume; - - CleanupStack::PopAndDestroy(profileExtend); - return keyTouchScreenTone; - + return keyTouchScreenTone; } void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetTones &setTones = profileExtend->ProfileSetTones(); - TProfileToneSettings &toneSettings = setTones.SetToneSettings(); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetTones &setTones = + profileExtend->ProfileSetTones(); + TProfileToneSettings &toneSettings = + setTones.SetToneSettings(); - toneSettings.iKeypadVolume = static_cast(level); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) - CleanupStack::PopAndDestroy(profileExtend); - } - + toneSettings.iKeypadVolume + = static_cast (level); + TRAP_IGNORE ( + mEngine->CommitChangeL(*profileExtend); + ) } bool CpProfileModelPrivate::ringAlertVibra(int profileId) const @@ -810,411 +666,32 @@ int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const { - MProfileExtended2 *profileExtend = 0; - TRAPD(err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err != KErrNone) { - return -1; - } - CleanupReleasePushL(*profileExtend); + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + const MProfileExtraSettings &extraSettings = profileExtend->ProfileExtraSettings(); const MProfileFeedbackSettings &feedbackSettings = extraSettings.ProfileFeedbackSettings(); - - bool keyTouchScreenVibra = feedbackSettings.TactileFeedback(); - - CleanupStack::PopAndDestroy(profileExtend); - return keyTouchScreenVibra; - + int keyTouchScreenVibra = feedbackSettings.TactileFeedback(); + return keyTouchScreenVibra; } void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) { - MProfileExtended2 *profileExtend = 0; - TRAPD( err, - profileExtend = mEngine->Profile2L(profileId); - //CleanupReleasePushL(*profileExtend); - ) - if (err==KErrNone) { - CleanupReleasePushL(*profileExtend); - MProfileSetExtraSettings &extraSettings = profileExtend->ProfileSetExtraSettings(); - MProfileSetFeedbackSettings &setFeedbackSettings = extraSettings.ProfileSetFeedbackSettings(); - setFeedbackSettings.SetTactileFeedback(static_cast(level)); - - TRAP_IGNORE( - mEngine->CommitChangeL(*profileExtend); - ) + MProfileExtended2 *profileExtend = mProfileList.value(profileId); + MProfileSetExtraSettings &extraSettings = + profileExtend->ProfileSetExtraSettings(); + MProfileSetFeedbackSettings &setFeedbackSettings = + extraSettings.ProfileSetFeedbackSettings(); + setFeedbackSettings.SetTactileFeedback( + static_cast (level)); - CleanupStack::PopAndDestroy(profileExtend); - } -} -///* -// * Set a profile as current editing profile -// */ -//int CpProfileModelPrivate::setEditingProfile(int profileId) -//{ -// CPFW_LOG("CpProfileModelPrivate::setEditingProfile(), START."); -// TRAPD( err, UpdateProfileSettingsL( profileId );); -// CPFW_LOG("CpProfileModelPrivate::setEditingProfile(), END."); -// return err; -//} -// -///* -// * Get path and file name of ring tone file -// */ -//QString CpProfileModelPrivate::ringTone() -//{ -// if ( mProfileExt ){ -// return stringFromDescriptor( mProfileExt->ProfileTones().RingingTone1() ); -// } -// CPFW_LOG("CpProfileModelPrivate::ringTone(), END with invalid mProfileExt. "); -// return ""; -//} -// -///* -// * Set path and file to ring tone -// */ -//int CpProfileModelPrivate::setRingTone(const QString& filePath) -//{ -// if ( mProfileExt ){ -// TRAPD(err, mProfileExt->ProfileSetTones().SetRingingTone1L( *descriptorFromString(filePath) )); -// commitChange(); -// return err; -// } -// CPFW_LOG("CpProfileModelPrivate::setRingTone(), END with invalid mProfileExt."); -// return -1; -//} -// -///* -// * Get path and file name of message tone file -// */ -//QString CpProfileModelPrivate::messageTone() -//{ -// if ( mProfileExt ){ -// return stringFromDescriptor( mProfileExt->ProfileTones().MessageAlertTone() ); -// } -// CPFW_LOG("CpProfileModelPrivate::messageTone(), END with invalid mProfileExt."); -// return ""; -//} -// -///* -// * Set path and file to message tone -// */ -//int CpProfileModelPrivate::setMessageTone(const QString& filePath) -//{ -// if ( mProfileExt ){ -// TRAPD(err, mProfileExt->ProfileSetTones().SetMessageAlertToneL( *descriptorFromString(filePath) )); -// commitChange(); -// return err; -// } -// CPFW_LOG("CpProfileModelPrivate::setMessageTone(), END with invalid mProfileExt."); -// return -1; -//} -// -///* -// * Get path and file name of email tone file -// */ -//QString CpProfileModelPrivate::emailTone() -//{ -// if ( mProfileExt ){ -// return stringFromDescriptor( mProfileExt->ProfileExtraTones().EmailAlertTone() ); -// } -// CPFW_LOG("CpProfileModelPrivate::emailTone(), END with invalid mProfileExt."); -// return ""; -//} -// -///* -// * Set path and file to email tone -// */ -//int CpProfileModelPrivate::setEmailTone(const QString& filePath) -//{ -// if ( mProfileExt ){ -// TRAPD(err, mProfileExt->ProfileSetExtraTones().SetEmailAlertToneL( *descriptorFromString(filePath) )); -// commitChange(); -// return err; -// } -// CPFW_LOG("CpProfileModelPrivate::setEmailTone(), END with invalid mProfileExt."); -// return -1; -//} -// -///* -// * Get path and file name of calendar event tone file -// */ -//QString CpProfileModelPrivate::calendarTone() -//{ -// return ""; -//} -// -///* -// * Set path and file to calendar event tone -// */ -//void CpProfileModelPrivate::setCalendarTone(const QString& filePath) -//{ -// Q_UNUSED(filePath); -//} -// -///* -// * Get path and file name of clock alarm tone file -// */ -//QString CpProfileModelPrivate::alarmTone() -//{ -// return ""; -//} -// -///* -// * Set path and file to clock alarm tone -// */ -//void CpProfileModelPrivate::setAlarmTone(const QString& filePath) -//{ -// Q_UNUSED(filePath); -//} -// -///* -// * Get the value of master volume -// */ -//int CpProfileModelPrivate::ringVolume() -//{ -// CPFW_LOG("CpProfileModelPrivate::ringVolume(), START."); -// if ( mToneSettings ){ -// CPFW_LOG("CpProfileModelPrivate::ringVolume(), End."); -// return mToneSettings->iRingingVolume; -// } -// CPFW_LOG("CpProfileModelPrivate::ringVolume(), END with invalid mToneSettings."); -// return -1; -//} -// -///* -// * Set master volume, the value should be between 1-10 -// */ -//void CpProfileModelPrivate::setRingVolume(int volume) -//{ -// CPFW_LOG("CpProfileModelPrivate::setRingVolume(), START."); -// if ( !mToneSettings ) { -// CPFW_LOG("CpProfileModelPrivate::setRingVolume(), END with invalid mToneSettings."); -// return; -// } -// if ( EProfileWrapperSilentId == mEditingProfileId || volume < 0 || volume >10 ) -// { -// return; -// } -// -// mToneSettings->iRingingType = EProfileRingingTypeRinging; -// mToneSettings->iRingingVolume = volume; -// commitChange(); -// -// // General profile and meeting profile should have same ring tone volume -// int profileId = activeProfileId(); -// if ( EProfileWrapperMeetingId == profileId ){ -// profileId = EProfileWrapperGeneralId; -// } else if ( EProfileWrapperGeneralId == profileId ) { -// profileId = EProfileWrapperMeetingId; -// } -// MProfileExtended* profileExt = 0; -// TRAPD( err0, profileExt = mEngine->ProfileL( profileId );); -// Q_UNUSED(err0); -// TProfileToneSettings& toneSettings = profileExt->ProfileSetTones().SetToneSettings(); -// toneSettings.iRingingType = EProfileRingingTypeRinging; -// toneSettings.iRingingVolume = volume; -// TRAPD( err, mEngine->CommitChangeL(*profileExt) ); -// Q_UNUSED(err); -// CPFW_LOG("CpProfileModelPrivate::setRingVolume(), END."); -// // currently implementation: keep the two profiles same volume -//} -// -///* -// * Activate master volume to beep -// */ -//void CpProfileModelPrivate::activateBeep() -//{ -// if ( mToneSettings ){ -// mToneSettings->iRingingType = EProfileRingingTypeBeepOnce; -// commitChange(); -// } else { -// CPFW_LOG("CpProfileModelPrivate::activateBeep(), END with invalid mToneSettings."); -// } -//} -// -///* -// * Get beep status in master volume -// */ -//bool CpProfileModelPrivate::isBeep() -//{ -// if ( mToneSettings ){ -// return (EProfileRingingTypeBeepOnce == mToneSettings->iRingingType) ? true : false; -// } -// CPFW_LOG("CpProfileModelPrivate::isBeep(), END with invalid mToneSettings."); -// return false; -//} -// -///* -// * Activate master volume to silent -// */ -//void CpProfileModelPrivate::activateSilent() -//{ -// if ( mToneSettings ){ -// mToneSettings->iRingingType = EProfileRingingTypeSilent; -// commitChange(); -// } else { -// CPFW_LOG("CpProfileModelPrivate::vibraStatus(), END with invalid mToneSettings."); -// } -//} -// -///* -// * Get silent status in master volume -// */ -//bool CpProfileModelPrivate::isSilent() -//{ -// if ( mToneSettings ){ -// return (EProfileRingingTypeSilent == mToneSettings->iRingingType) ? true : false; -// } else { -// CPFW_LOG("CpProfileModelPrivate::vibraStatus(), END with invalid mToneSettings."); -// return false; -// } -//} -// -///* -// * Get master vibra's status -// */ -//bool CpProfileModelPrivate::vibraStatus() -//{ -// CPFW_LOG("CpProfileModelPrivate::vibraStatus(), Start."); -// if ( mToneSettings ){ -// CPFW_LOG("CpProfileModelPrivate::vibraStatus(), End."); -// return mToneSettings->iVibratingAlert; -// } -// CPFW_LOG("CpProfileModelPrivate::vibraStatus(), END with invalid mToneSettings."); -// return false; -//} -// -///* -// * Set master vibra's status -// */ -//void CpProfileModelPrivate::setVibraStatus(bool status) -//{ -// CPFW_LOG("CpProfileModelPrivate::setVibraStatus(), Start."); -// if ( mVibraCenRep ){ -// mVibraCenRep->Set(KVibraCtrlProfileVibraEnabled, status ); -// } -// -// if ( mToneSettings ){ -// mToneSettings->iVibratingAlert = status; -// commitChange(); -// } -// CPFW_LOG("CpProfileModelPrivate::setVibraStatus(), END."); -//} -// -///* -// * Get keypad' volume -// */ -//int CpProfileModelPrivate::keyVolume() -//{ -// CPFW_LOG("CpProfileModelPrivate::keyVolume(), Start."); -// if ( mToneSettings ){ -// CPFW_LOG("CpProfileModelPrivate::keyVolume(), END."); -// return mToneSettings->iKeypadVolume; -// } -// CPFW_LOG("CpProfileModelPrivate::keyVolume(), END with invalid mToneSettings."); -// return -1; -//} -// -///* -// * Set keypad's volume, -// * the value of the volume should be between 0-3 -// */ -//void CpProfileModelPrivate::setKeyVolume(int volume) -//{ -// CPFW_LOG("CpProfileModelPrivate::setKeyVolume(), Start."); -// if (volume < 0 || volume > 3) -// { -// CPFW_LOG("CpProfileModelPrivate::setKeyVolume(), End with invalid volume."); -// return; -// } -// -// if ( mToneSettings ){ -// mToneSettings->iKeypadVolume = (TProfileKeypadVolume)volume; -// commitChange(); -// } -// CPFW_LOG("CpProfileModelPrivate::setKeyVolume(), End."); -//} -// -///* -// * Get screen tone's volume -// */ -//int CpProfileModelPrivate::screenVolume() -//{ -// CPFW_LOG("CpProfileModelPrivate::screenVolume(), Start."); -// if ( mFeedbackSettings ){ -// CPFW_LOG("CpProfileModelPrivate::screenVolume(), End."); -// return mFeedbackSettings->AudioFeedback(); -// } -// CPFW_LOG("CpProfileModelPrivate::screenVolume(), End."); -// return -1; -//} -// -///* -// * Set screen tone's volume, -// * the value of the volume should be between 0-3 -// */ -//void CpProfileModelPrivate::setScreenVolume(int volume) -//{ -// CPFW_LOG("CpProfileModelPrivate::setScreenVolume(), Start."); -// if (volume < 0 || volume > 3) -// { -// CPFW_LOG("CpProfileModelPrivate::setScreenVolume(), End with invalid volume."); -// return; -// } -// -// if ( mSetFeedbackSettings ){ -// mSetFeedbackSettings->SetAudioFeedback( (TProfileAudioFeedback)volume ); -// commitChange(); -// } -// CPFW_LOG("CpProfileModelPrivate::setScreenVolume(), End."); -//} -// -///* -// * Get screen vibra's level -// */ -//int CpProfileModelPrivate::screenVibra() -//{ -// CPFW_LOG("CpProfileModelPrivate::screenVibra(), Start."); -// if ( mFeedbackSettings ){ -// CPFW_LOG("CpProfileModelPrivate::screenVibra(), End."); -// return mFeedbackSettings->TactileFeedback(); -// } -// CPFW_LOG("CpProfileModelPrivate::screenVibra(), End with invalid mFeedbackSettings."); -// return -1; -//} -// -///* -// * Set screen vibra's level, -// * the value of the level should be between 0-3 -// */ -//void CpProfileModelPrivate::setScreenVibra(int volume) -//{ -// if (volume < 0 || volume > 3) -// { -// return; -// } -// -// if ( mSetFeedbackSettings ){ -// mSetFeedbackSettings->SetTactileFeedback( (TProfileTactileFeedback)volume ); -// commitChange(); -// } -//} - -/* - * Commit changes when change settings value in profile. - */ -int CpProfileModelPrivate::commitChange() -{ - /* TRAPD( err, mEngine->CommitChangeL(*mProfileExt) ); - return err;*/ - return 0; + TRAP_IGNORE( + mEngine->CommitChangeL(*profileExtend); + ) } // End of file + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.h Fri May 14 13:21:08 2010 +0800 @@ -19,8 +19,9 @@ #define CPPROFILEMODEL_P_H #include +#include +class CpProfileModel; class CpProfileSettings; -class CpProfileModel; class MProfileEngineExtended2; class MProfileExtended2; class MProfileFeedbackSettings; @@ -41,9 +42,8 @@ QString profileName(int profileId)const; QStringList profileNames() const; int activateProfile(int profileId); - int activeProfileId(); - int setEditingProfile(int profileId); - int profileSettings(int profileId, CpProfileSettings& profileSettings); + int activeProfileId() const; + void profileSettings(int profileId, CpProfileSettings& profileSettings); int setProfileSettings(int profileId, CpProfileSettings& profileSettings); /*! @@ -58,10 +58,10 @@ bool masterVibra() const; void setMasterVibra(bool isVibra); - bool isSilenceMode() const; + bool silenceMode() const; void setSilenceMode(bool isSlience); - bool isOffLineMode() const; + bool offLineMode() const; void setOffLineMode(bool isOffLine); QString ringTone(int profileId)const; @@ -124,18 +124,18 @@ */ #ifdef Q_OS_SYMBIAN private: - void UpdateProfileSettingsL(int profileId); - int commitChange(); + //void UpdateProfileSettingsL(int profileId); + //int commitChange(); private: MProfileEngineExtended2 *mEngine; + QMap mProfileList; //MProfileExtended2 *mProfileExt; //TProfileToneSettings *mToneSettings; //const MProfileFeedbackSettings *mFeedbackSettings; //MProfileSetFeedbackSettings *mSetFeedbackSettings; //CRepository *mVibraCenRep; - int mEditingProfileId; - bool mInitErrFlag; + int mInitErrFlag; CRepository *mOffLineCenRep; CpProfileModel *q_ptr; #endif // Q_OS_SYMBIAN diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp --- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_win_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -62,15 +62,6 @@ } /* - * Set a profile as current editing profile - */ -int CpProfileModelPrivate::setEditingProfile(int profileId) -{ - Q_UNUSED(profileId); - return -1; -} - -/* * Get path and file name of ring tone file */ QString CpProfileModelPrivate::ringTone() diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpringtoneview/cpringtoneview.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/cpringtoneview.pro Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,28 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: display plugin source files +# +include (../common.pri) +include (ringtoneview.pri) +TARGET = cpringtoneview +TEMPLATE = lib + +CONFIG += hb +DEFINES += CPRINGTONEVIEW_LIBRARY +symbian { + LIBS += -lcpprofilewrapper -lcpframework -lxqservice -lxqserviceutil + TARGET.UID3 = 0X2002873A + TARGET.CAPABILITY = All -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpringtoneview/ringtoneview.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/ringtoneview.pri Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: display plugin source files +# + +# Input +HEADERS += ../inc/cpringtoneview.h + +SOURCES += src/cpringtoneview.cpp diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/cpringtoneview/src/cpringtoneview.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#include "cpringtoneview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CpRingToneView::CpRingToneView( QGraphicsItem *parent ): + CpBaseSettingView(0, parent), + mToneTypeList( new HbListWidget(this) ), + mReq(0) +{ + HbWidget* contentWidget = new HbWidget(this); + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + + //setup the heading. + HbLabel* label = new HbLabel( hbTrId("txt_cp_subhead_select_tone_type"), contentWidget ); + layout->addItem(label); + //handling user click + bool bret = connect(mToneTypeList, SIGNAL( activated(HbListWidgetItem *) ), + this, SLOT(onTypeSelected(HbListWidgetItem *))); + //initialize the list contents + QList tonesTypeList; + tonesTypeList << + hbTrId("txt_cp_list_no_tone")<< + hbTrId("txt_cp_list_tone")<< + hbTrId("txt_cp_list_music")<< + hbTrId("txt_cp_list_recording")<< + hbTrId("txt_cp_list_get_more_tones"); + for ( int i = 0; i < tonesTypeList.count(); i++ ) + { + mToneTypeList->addItem(tonesTypeList.at(i)); + } + //add the list to layout. + layout->addItem(mToneTypeList); + + contentWidget->setLayout(layout); + + setWidget(contentWidget); +} +CpRingToneView::~CpRingToneView() +{ + if(mReq) delete mReq; +} +void CpRingToneView::onTypeSelected(HbListWidgetItem *item) +{ + int nRow = mToneTypeList->row( item ); + switch(nRow) + { + case 0: //no tone, set default no sound + emit selOK(QString("")); + emit aboutToClose(); + break; + case 1: //tone + launchMediaFetcher( "com.nokia.symbian.IToneFetch", "fetch()" ); + break; + case 2: //music + launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()" ); + break; + case 3: //recording + case 4: //get more tones + default: + break; + } +} +void CpRingToneView::handleOk(const QVariant &result) +{ + CPFW_LOG( "CpPersonalizationEntryItemData::handleOk" ); + if (!result.canConvert() || result.toString().length() == 0 ) //error result + { + return; + } + hide(); + emit selOK( result.value() ); + emit aboutToClose(); +} + + +void CpRingToneView::handleError(int errorCode, const QString& errorMessage) +{ + emit(selError( errorCode, errorMessage )); +} + +void CpRingToneView::launchMediaFetcher( const QString &strService, const QString &strItface ) +{ + CPFW_LOG("CpRingToneView::launchMediaFetcher, START"); + if(mReq) + { + delete mReq; + mReq = 0; + } + //launch media fetcher + mReq = mAppMgr.create(strService, strItface, true); + 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&)) ); + } + + QList args; + args << QVariant(QString("")); + mReq->setArguments(args); + // Make the request + if (!mReq->send()) + { + CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher calling failed"); + } + CPFW_LOG("CpRingToneView::launchMediaFetcher, END"); +} + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpserviceprovider/service_conf.xml --- a/controlpanelui/src/cpserviceprovider/service_conf.xml Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/service_conf.xml Fri May 14 13:21:08 2010 +0800 @@ -1,11 +1,11 @@ - com.nokia.services.cpserviceprovider + cpserviceprovider ="must-not-be-empty" ControlPanel service - Launcher + com.nokia.symbian.ICpPluginLauncher 1.0 - Launch a setting view which comes from a specific plugin + Launch a setting view which comes from a controlpanel plugin \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp --- a/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.cpp Fri May 14 13:21:08 2010 +0800 @@ -16,6 +16,7 @@ */ #include "cplauncherservice.h" +#include #include #include #include @@ -23,7 +24,7 @@ #include "cpsplogger.h" CpLauncherService::CpLauncherService(HbMainWindow *mainWindow /* = 0*/) -: XQServiceProvider("com.nokia.services.cpserviceprovider.Launcher",mainWindow), +: XQServiceProvider("cpserviceprovider.com.nokia.symbian.ICpPluginLauncher",mainWindow), mMainWindow(mainWindow), mAsyncRequestIndex(-1), mReturnValue(false) @@ -44,25 +45,28 @@ completeRequest(mAsyncRequestIndex, mReturnValue); } +void CpLauncherService::setReturnValue(const QVariant &returnValue) +{ + mReturnValue = returnValue; +} bool CpLauncherService::launchSettingView(const QString &pluginFile,const QVariant &hint) { CPSP_LOG("Entering CpLauncherService::launchSettingView"); mAsyncRequestIndex = setCurrentRequestAsync(); - mReturnValue.setValue(false); + + bool succeed = false; if (mMainWindow) { mMainWindow->show(); CpLauncherInterface *plugin = CpPluginLoader::loadCpLauncherInterface(pluginFile); if (plugin) { - CpBaseSettingView *view = plugin->createSettingView(hint); - if (view) { - connect(view, SIGNAL(aboutToClose()), mMainWindow, SLOT(quit())); - mMainWindow->addView(view); - mMainWindow->setCurrentView(view); - - mReturnValue.setValue(true); + CpBaseSettingView *settingView = plugin->createSettingView(hint); + if (settingView) { + connect(settingView, SIGNAL(returnValueDelivered(QVariant)),this,SLOT(setReturnValue(QVariant))); + (static_cast(mMainWindow))->setSettingView(settingView); + succeed = true; } else { CPSP_LOG("Create setting view failed."); @@ -72,14 +76,14 @@ CPSP_LOG(QLatin1String("Load plugin interface(CpLauncherInterface) failed: ") + pluginFile); } - if (!mReturnValue.toBool()) { - qobject_cast(mMainWindow)->quit(); + if (!succeed) { + qApp->quit(); //quit application if loading plugin failed or creating setting view failed. } } CPSP_LOG("Leaving CpLauncherService::launchSettingView"); - return mReturnValue.toBool(); + return succeed; } //End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpserviceprovider/src/cplauncherservice.h --- a/controlpanelui/src/cpserviceprovider/src/cplauncherservice.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/src/cplauncherservice.h Fri May 14 13:21:08 2010 +0800 @@ -21,6 +21,7 @@ #include class HbMainWindow; + class CpLauncherService : public XQServiceProvider { Q_OBJECT @@ -30,6 +31,8 @@ void complete(); public slots: bool launchSettingView(const QString &pluginFile,const QVariant &hint); +private slots: + void setReturnValue(const QVariant &returnValue); private: HbMainWindow *mMainWindow; int mAsyncRequestIndex; diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp --- a/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.cpp Fri May 14 13:21:08 2010 +0800 @@ -17,7 +17,7 @@ #include "cpservicemainwindow.h" #include -#include +#include #include "cplauncherservice.h" #include "cpsplogger.h" @@ -33,22 +33,29 @@ CPSP_LOG("CpServiceMainWindow Destructing..."); } +void CpServiceMainWindow::setSettingView(CpBaseSettingView *settingView) +{ + mSettingViewPointer = settingView; + + connect(settingView, SIGNAL(aboutToClose()), this, SLOT(quit())); + addView(settingView); + setCurrentView(settingView); +} + void CpServiceMainWindow::quit() { CPSP_LOG("CpServiceMainWindow::quit()"); - + connect(mLauncherService, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); mLauncherService->complete(); - qApp->quit(); - + /* hide(); mLauncherService->complete(); - HbView *currView = currentView(); - if (currView) { - removeView(currView); - currView->deleteLater(); - } + if (mSettingViewPointer) { + removeView(mSettingViewPointer); + mSettingViewPointer->deleteLater(); + } */ } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h --- a/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/src/cpservicemainwindow.h Fri May 14 13:21:08 2010 +0800 @@ -19,8 +19,10 @@ #define CPSERVICEMAINWINDOW_H #include +#include class CpLauncherService; +class CpBaseSettingView; class CpServiceMainWindow : public HbMainWindow { @@ -28,10 +30,14 @@ public: explicit CpServiceMainWindow(QWidget *parent = 0); virtual ~CpServiceMainWindow(); + + void setSettingView(CpBaseSettingView *settingView); + public slots: void quit(); private: CpLauncherService *mLauncherService; + QPointer mSettingViewPointer; }; #endif // CPSERVICEMAINWINDOW_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/cpserviceprovider/src/main.cpp --- a/controlpanelui/src/cpserviceprovider/src/main.cpp Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/cpserviceprovider/src/main.cpp Fri May 14 13:21:08 2010 +0800 @@ -15,6 +15,9 @@ * */ #include +#include +#include +#include #include "cpservicemainwindow.h" #include "cpsplogger.h" @@ -26,6 +29,8 @@ CPSP_LOGGER_CONFIG_PATH,QSettings::IniFormat); CPSP_LOG("Entering CpServiceProvider.exe..."); + HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH); + CpServiceMainWindow wnd; wnd.show(); diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/eabi/cpcategorymodelu.def --- a/controlpanelui/src/eabi/cpcategorymodelu.def Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/eabi/cpcategorymodelu.def Fri May 14 13:21:08 2010 +0800 @@ -1,36 +1,56 @@ EXPORTS - _ZN26CpCategorySettingFormModel10initializeER16CpItemDataHelper @ 1 NONAME - _ZN26CpCategorySettingFormModel11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN26CpCategorySettingFormModel11qt_metacastEPKc @ 3 NONAME - _ZN26CpCategorySettingFormModel16staticMetaObjectE @ 4 NONAME DATA 16 - _ZN26CpCategorySettingFormModel19getStaticMetaObjectEv @ 5 NONAME - _ZN26CpCategorySettingFormModel25afterLoadingConfigPluginsER16CpItemDataHelper @ 6 NONAME - _ZN26CpCategorySettingFormModel26beforeLoadingConfigPluginsER16CpItemDataHelper @ 7 NONAME - _ZN26CpCategorySettingFormModelC1ERK7QString @ 8 NONAME - _ZN26CpCategorySettingFormModelC2ERK7QString @ 9 NONAME - _ZN26CpCategorySettingFormModelD0Ev @ 10 NONAME - _ZN26CpCategorySettingFormModelD1Ev @ 11 NONAME - _ZN26CpCategorySettingFormModelD2Ev @ 12 NONAME - _ZN29CpCategorySettingFormItemData10initializeER16CpItemDataHelper @ 13 NONAME - _ZN29CpCategorySettingFormItemData11qt_metacallEN11QMetaObject4CallEiPPv @ 14 NONAME - _ZN29CpCategorySettingFormItemData11qt_metacastEPKc @ 15 NONAME - _ZN29CpCategorySettingFormItemData16staticMetaObjectE @ 16 NONAME DATA 16 - _ZN29CpCategorySettingFormItemData19getStaticMetaObjectEv @ 17 NONAME - _ZN29CpCategorySettingFormItemData25afterLoadingConfigPluginsER16CpItemDataHelper @ 18 NONAME - _ZN29CpCategorySettingFormItemData26beforeLoadingConfigPluginsER16CpItemDataHelper @ 19 NONAME - _ZN29CpCategorySettingFormItemDataC1EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 20 NONAME - _ZN29CpCategorySettingFormItemDataC1ERK7QStringPK19HbDataFormModelItem @ 21 NONAME - _ZN29CpCategorySettingFormItemDataC2EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 22 NONAME - _ZN29CpCategorySettingFormItemDataC2ERK7QStringPK19HbDataFormModelItem @ 23 NONAME - _ZN29CpCategorySettingFormItemDataD0Ev @ 24 NONAME - _ZN29CpCategorySettingFormItemDataD1Ev @ 25 NONAME - _ZN29CpCategorySettingFormItemDataD2Ev @ 26 NONAME - _ZNK26CpCategorySettingFormModel10metaObjectEv @ 27 NONAME - _ZNK29CpCategorySettingFormItemData10metaObjectEv @ 28 NONAME - _ZTI26CpCategorySettingFormModel @ 29 NONAME - _ZTI29CpCategorySettingFormItemData @ 30 NONAME - _ZTV26CpCategorySettingFormModel @ 31 NONAME - _ZTV29CpCategorySettingFormItemData @ 32 NONAME - _ZThn8_N29CpCategorySettingFormItemDataD0Ev @ 33 NONAME - _ZThn8_N29CpCategorySettingFormItemDataD1Ev @ 34 NONAME + _Z22createCpPluginItemDataP27CpCreatePluginItemDataEvent @ 1 NONAME + _ZN14CpTaskExecutor11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN14CpTaskExecutor11qt_metacastEPKc @ 3 NONAME + _ZN14CpTaskExecutor11removeTasksEv @ 4 NONAME + _ZN14CpTaskExecutor14globalInstanceEv @ 5 NONAME + _ZN14CpTaskExecutor16staticMetaObjectE @ 6 NONAME DATA 16 + _ZN14CpTaskExecutor19getStaticMetaObjectEv @ 7 NONAME + _ZN14CpTaskExecutor21destroyGlobalInstanceEv @ 8 NONAME + _ZN14CpTaskExecutor3runEv @ 9 NONAME + _ZN14CpTaskExecutor4stopEv @ 10 NONAME + _ZN14CpTaskExecutor7runTaskEP6CpTaskb @ 11 NONAME + _ZN14CpTaskExecutor7toFrontEP6CpTask @ 12 NONAME + _ZN14CpTaskExecutorC1EP7QObject @ 13 NONAME + _ZN14CpTaskExecutorC2EP7QObject @ 14 NONAME + _ZN14CpTaskExecutorD0Ev @ 15 NONAME + _ZN14CpTaskExecutorD1Ev @ 16 NONAME + _ZN14CpTaskExecutorD2Ev @ 17 NONAME + _ZN26CpCategorySettingFormModel10initializeER16CpItemDataHelper @ 18 NONAME + _ZN26CpCategorySettingFormModel11qt_metacallEN11QMetaObject4CallEiPPv @ 19 NONAME + _ZN26CpCategorySettingFormModel11qt_metacastEPKc @ 20 NONAME + _ZN26CpCategorySettingFormModel16staticMetaObjectE @ 21 NONAME DATA 16 + _ZN26CpCategorySettingFormModel19getStaticMetaObjectEv @ 22 NONAME + _ZN26CpCategorySettingFormModel25afterLoadingConfigPluginsER16CpItemDataHelper @ 23 NONAME + _ZN26CpCategorySettingFormModel26beforeLoadingConfigPluginsER16CpItemDataHelper @ 24 NONAME + _ZN26CpCategorySettingFormModelC1ERK7QString @ 25 NONAME + _ZN26CpCategorySettingFormModelC2ERK7QString @ 26 NONAME + _ZN26CpCategorySettingFormModelD0Ev @ 27 NONAME + _ZN26CpCategorySettingFormModelD1Ev @ 28 NONAME + _ZN26CpCategorySettingFormModelD2Ev @ 29 NONAME + _ZN29CpCategorySettingFormItemData10initializeER16CpItemDataHelper @ 30 NONAME + _ZN29CpCategorySettingFormItemData11qt_metacallEN11QMetaObject4CallEiPPv @ 31 NONAME + _ZN29CpCategorySettingFormItemData11qt_metacastEPKc @ 32 NONAME + _ZN29CpCategorySettingFormItemData16staticMetaObjectE @ 33 NONAME DATA 16 + _ZN29CpCategorySettingFormItemData19getStaticMetaObjectEv @ 34 NONAME + _ZN29CpCategorySettingFormItemData25afterLoadingConfigPluginsER16CpItemDataHelper @ 35 NONAME + _ZN29CpCategorySettingFormItemData26beforeLoadingConfigPluginsER16CpItemDataHelper @ 36 NONAME + _ZN29CpCategorySettingFormItemDataC1EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 37 NONAME + _ZN29CpCategorySettingFormItemDataC1ERK7QStringPK19HbDataFormModelItem @ 38 NONAME + _ZN29CpCategorySettingFormItemDataC2EN19HbDataFormModelItem12DataItemTypeERK7QStringS4_PKS0_ @ 39 NONAME + _ZN29CpCategorySettingFormItemDataC2ERK7QStringPK19HbDataFormModelItem @ 40 NONAME + _ZN29CpCategorySettingFormItemDataD0Ev @ 41 NONAME + _ZN29CpCategorySettingFormItemDataD1Ev @ 42 NONAME + _ZN29CpCategorySettingFormItemDataD2Ev @ 43 NONAME + _ZNK14CpTaskExecutor10metaObjectEv @ 44 NONAME + _ZNK26CpCategorySettingFormModel10metaObjectEv @ 45 NONAME + _ZNK29CpCategorySettingFormItemData10metaObjectEv @ 46 NONAME + _ZTI14CpTaskExecutor @ 47 NONAME + _ZTI26CpCategorySettingFormModel @ 48 NONAME + _ZTI29CpCategorySettingFormItemData @ 49 NONAME + _ZTV14CpTaskExecutor @ 50 NONAME + _ZTV26CpCategorySettingFormModel @ 51 NONAME + _ZTV29CpCategorySettingFormItemData @ 52 NONAME + _ZThn8_N29CpCategorySettingFormItemDataD0Ev @ 53 NONAME + _ZThn8_N29CpCategorySettingFormItemDataD1Ev @ 54 NONAME diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/eabi/cpprofilewrapperu.def --- a/controlpanelui/src/eabi/cpprofilewrapperu.def Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/eabi/cpprofilewrapperu.def Fri May 14 13:21:08 2010 +0800 @@ -11,38 +11,38 @@ _ZN14CpProfileModel14setOffLineModeEb @ 10 NONAME _ZN14CpProfileModel14setSilenceModeEb @ 11 NONAME _ZN14CpProfileModel15activateProfileEi @ 12 NONAME - _ZN14CpProfileModel15activeProfileIdEv @ 13 NONAME - _ZN14CpProfileModel15profileSettingsEiR17CpProfileSettings @ 14 NONAME - _ZN14CpProfileModel15setMasterVolumeEi @ 15 NONAME - _ZN14CpProfileModel15setMessageVibraEib @ 16 NONAME - _ZN14CpProfileModel15setReminderToneEiRK7QString @ 17 NONAME - _ZN14CpProfileModel16setReminderVibraEib @ 18 NONAME - _ZN14CpProfileModel16staticMetaObjectE @ 19 NONAME DATA 16 - _ZN14CpProfileModel17setRingAlertVibraEib @ 20 NONAME - _ZN14CpProfileModel18setProfileSettingsEiR17CpProfileSettings @ 21 NONAME - _ZN14CpProfileModel19getStaticMetaObjectEv @ 22 NONAME - _ZN14CpProfileModel19setNotificationToneEib @ 23 NONAME - _ZN14CpProfileModel20setNotificationVibraEib @ 24 NONAME - _ZN14CpProfileModel21setKeyTouchScreenToneEii @ 25 NONAME - _ZN14CpProfileModel22setKeyTouchScreenVibraEii @ 26 NONAME - _ZN14CpProfileModelC1EP7QObject @ 27 NONAME - _ZN14CpProfileModelC2EP7QObject @ 28 NONAME - _ZN14CpProfileModelD0Ev @ 29 NONAME - _ZN14CpProfileModelD1Ev @ 30 NONAME - _ZN14CpProfileModelD2Ev @ 31 NONAME - _ZNK14CpProfileModel10emailVibraEi @ 32 NONAME - _ZNK14CpProfileModel10metaObjectEv @ 33 NONAME - _ZNK14CpProfileModel11masterVibraEv @ 34 NONAME - _ZNK14CpProfileModel11messageToneEi @ 35 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 - _ZNK14CpProfileModel12masterVolumeEv @ 37 NONAME - _ZNK14CpProfileModel12messageVibraEi @ 38 NONAME - _ZNK14CpProfileModel12profileNamesEv @ 39 NONAME - _ZNK14CpProfileModel12reminderToneEi @ 40 NONAME - _ZNK14CpProfileModel13isOffLineModeEv @ 41 NONAME - _ZNK14CpProfileModel13isSilenceModeEv @ 42 NONAME - _ZNK14CpProfileModel13reminderVibraEi @ 43 NONAME - _ZNK14CpProfileModel14ringAlertVibraEi @ 44 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 diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/eabi/cpringtoneviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/eabi/cpringtoneviewu.def Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,24 @@ +EXPORTS + _ZN14CpRingToneView11handleErrorEiRK7QString @ 1 NONAME + _ZN14CpRingToneView11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN14CpRingToneView11qt_metacastEPKc @ 3 NONAME + _ZN14CpRingToneView14onTypeSelectedEP16HbListWidgetItem @ 4 NONAME + _ZN14CpRingToneView16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN14CpRingToneView18launchMediaFetcherERK7QStringS2_ @ 6 NONAME + _ZN14CpRingToneView19getStaticMetaObjectEv @ 7 NONAME + _ZN14CpRingToneView5selOKERK7QString @ 8 NONAME + _ZN14CpRingToneView8handleOkERK8QVariant @ 9 NONAME + _ZN14CpRingToneView8selErrorEiRK7QString @ 10 NONAME + _ZN14CpRingToneViewC1EP13QGraphicsItem @ 11 NONAME + _ZN14CpRingToneViewC2EP13QGraphicsItem @ 12 NONAME + _ZN14CpRingToneViewD0Ev @ 13 NONAME + _ZN14CpRingToneViewD1Ev @ 14 NONAME + _ZN14CpRingToneViewD2Ev @ 15 NONAME + _ZNK14CpRingToneView10metaObjectEv @ 16 NONAME + _ZTI14CpRingToneView @ 17 NONAME + _ZTV14CpRingToneView @ 18 NONAME + _ZThn16_N14CpRingToneViewD0Ev @ 19 NONAME + _ZThn16_N14CpRingToneViewD1Ev @ 20 NONAME + _ZThn8_N14CpRingToneViewD0Ev @ 21 NONAME + _ZThn8_N14CpRingToneViewD1Ev @ 22 NONAME + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/cpevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpevent.h Fri May 14 13:21:08 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: +* +*/ + +#ifndef CPEVENT_H +#define CPEVENT_H + +#include +#include +#include + +class CpPluginInterface; +class HbDataFormModelItem; +class CpItemDataHelper; + +class CpCreatePluginItemDataEvent : public QEvent +{ +public: + enum { CreatePluginItemData = QEvent::User + 1 }; + + CpCreatePluginItemDataEvent() : + QEvent ( static_cast(CreatePluginItemData) ), + mPluginInterface(0), + mParentItem(0), + mItemDataHelper(0), + mItemPosition(-1) + { + } + + CpPluginInterface *mPluginInterface; + + HbDataFormModelItem *mParentItem; + int mItemPosition; + + CpItemDataHelper *mItemDataHelper; + + QString mDisplayName; + QString mDescription; + QString mPluginFile; +}; + +CP_CATEGORY_EXPORT int createCpPluginItemData(CpCreatePluginItemDataEvent *event); + +#endif //CPEVENT_H + +//End of File + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/cpprofilemodel.h --- a/controlpanelui/src/inc/cpprofilemodel.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/inc/cpprofilemodel.h Fri May 14 13:21:08 2010 +0800 @@ -63,9 +63,8 @@ QString profileName(int profileId)const; QStringList profileNames()const; int activateProfile(int profileId); - int activeProfileId(); - int setEditingProfile(int profileId); - int profileSettings(int profileId, CpProfileSettings& profileSettings); + int activeProfileId() const; + void profileSettings(int profileId, CpProfileSettings& profileSettings); int setProfileSettings(int profileId, CpProfileSettings& profileSettings ); /*! @@ -84,10 +83,10 @@ bool masterVibra() const; void setMasterVibra(bool isVibra); - bool isSilenceMode() const; + bool silenceMode() const; void setSilenceMode(bool isSlience); - bool isOffLineMode() const; + bool offLineMode() const; void setOffLineMode(bool isOffLine); /*! diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/cpringtoneview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cpringtoneview.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0"" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +#ifndef CPRINGTONEVIEW_H +#define CPRINGTONEVIEW_H + +#include "ringtoneviewdef.h" +#include +#include + +class HbListWidget; +class HbListWidgetItem; +class XQAiwRequest; + +class CPRINGTONEVIEW_EXPORT CpRingToneView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpRingToneView( QGraphicsItem *parent = 0 ); + ~CpRingToneView(); +signals: + void selOK( const QString &strFname); + void selError( int errorCode, const QString& errorMessage ); + +private slots: + void onTypeSelected( HbListWidgetItem *item ); + void handleOk(const QVariant &result); + void handleError(int errorCode, const QString& errorMessage); + +private: + HbListWidget* mToneTypeList; + XQAiwRequest* mReq; + XQApplicationManager mAppMgr; + +private: + void launchMediaFetcher( const QString &strService, const QString &strItface ); +}; + +#endif // CPRINGTONEVIEW_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/cptaskexecutor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/cptaskexecutor.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef CPTASKEXECUTOR_H +#define CPTASKEXECUTOR_H + +#include +#include +#include +#include + +class CpTask +{ +public: + explicit CpTask(bool autoDelete = true) + : mAutoDelete(autoDelete) + { + } + + virtual ~CpTask() + { + } + + bool autoDelete() const + { + return mAutoDelete; + } + + virtual void execute(volatile bool *stopped) + { + Q_UNUSED(stopped); + } + + virtual void complete(volatile bool *stopped) + { + Q_UNUSED(stopped); + } + +private: + bool mAutoDelete; +}; + +class CP_CATEGORY_EXPORT CpTaskExecutor : public QThread +{ + Q_OBJECT +public: + explicit CpTaskExecutor(QObject *parent = 0); + + virtual ~CpTaskExecutor(); + + /* + return the gloabl instance + */ + static CpTaskExecutor *globalInstance(); + + /* + destroy the global instance + */ + static void destroyGlobalInstance(); + + /* + add the task to running queue + @task the task + @append ture -- append to tail false -- preappend to head + */ + + bool runTask(CpTask *task,bool append = false); + + /* + stop the thread and remove all not running tasks + */ + void stop(); + + /* + move a task to front of the queue + */ + bool toFront(CpTask *task); + + /* + move a task to front of the queue + */ + template bool toFront(Predicate pred); + +protected: + /* + From QThread, run tasks + */ + virtual void run(); +private: + /* + remove not running tasks + */ + void removeTasks(); +private: + QList mTasks; + QMutex mMutex; + volatile bool mStopped; +}; + + +template +bool CpTaskExecutor::toFront(Predicate pred) +{ + QMutexLocker locker(&mMutex); + + QList::iterator workIterator = mTasks.begin(); + QList::iterator endIterator(mTasks.end()); + + for(;workIterator != endIterator;++workIterator) + { + if (pred(*workIterator)) { + break; + } + } + + if (workIterator == endIterator) { + return false; + } + + CpTask *task = *workIterator; + mTasks.erase(workIterator); + mTasks.insert(0,task); + + return true; +} + +#endif //CPTASKECECUTOR_H + +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/cpuids.h --- a/controlpanelui/src/inc/cpuids.h Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/inc/cpuids.h Fri May 14 13:21:08 2010 +0800 @@ -46,9 +46,9 @@ #define QUID_CPVOLUME 0X20028737 #define QUID_RINGTONE 0X20028738 #define QUID_PROFILEACTIVATOR 0X20028739 -#define QUID_RESERVED7 0X2002873A -#define QUID_RESERVED8 0X2002873B -#define QUID_RESERVED9 0X2002873C +#define QUID_RINGTONESELVIEW 0X2002873A +#define QUID_CPPLUGIN_ABOUT 0X2002873B +#define QUID_CPPLUGIN_LANGUAGE 0X2002873C #define QUID_RESERVED10 0X2002873D #define QUID_RESERVED11 0X2002873E #define QUID_CPSERVICEPROVIDER 0X2002873F diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/inc.pri --- a/controlpanelui/src/inc/inc.pri Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/inc/inc.pri Fri May 14 13:21:08 2010 +0800 @@ -16,6 +16,8 @@ INTERNAL_HEADERS += $$PWD/cpcategorysettingformmodel.h \ $$PWD/cpcategorysettingformitemdata.h \ - $$PWD/cpcategoryglobal.h + $$PWD/cpcategoryglobal.h \ + $$PWD/cptaskexecutor.h \ + $$PWD/cpevent.h HEADERS += $$INTERNAL_HEADERS diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/inc/ringtoneviewdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/inc/ringtoneviewdef.h Fri May 14 13:21:08 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: +* +*/ + +#ifndef RINGTONEVIEWDEF_H +#define RINGTONEVIEWDEF_H + +#include + +#ifdef CPRINGTONEVIEW_LIBRARY +# define CPRINGTONEVIEW_EXPORT Q_DECL_EXPORT +#else +# define CPRINGTONEVIEW_EXPORT Q_DECL_IMPORT +#endif + +#endif //RINGTONEVIEWDEF_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/seccodeui.pri --- a/controlpanelui/src/seccodeui/seccodeui.pri Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: seccodeui source files -# - -# Input -HEADERS += src/seccodesettings.h \ - src/seccodeuiutility.h \ - src/seccodeedit.h \ - src/seccodeeditdataformviewitem.h \ - src/seccodemodel.h \ - src/seccodemodel_p.h - - -SOURCES += src/seccodesettings.cpp \ - src/seccodeuiutility.cpp \ - src/seccodeedit.cpp \ - src/seccodeeditdataformviewitem.cpp \ - src/seccodemodel.cpp - -symbian : { - SOURCES += src/seccodemodel_symbian.cpp -} - -win32 : { - SOURCES += src/seccodemodel_win.cpp -} \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/seccodeui.pro --- a/controlpanelui/src/seccodeui/seccodeui.pro Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = seccodeui - -CONFIG += hb - -DEFINES += BUILD_SECCODEUI - -MOC_DIR = moc -OBJECT_DIR = obj -RCC_DIR = rcc - -include ( seccodeui.pri ) - -CONFIG(debug, debug|release) { - SUBDIRPART = debug -} else { - SUBDIRPART = release -} - -win32: { - DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin - OBJECTS_DIR = $$PWD/../$$SUBDIRPART/tmp/$$TARGET -} - -# Add the output dirs to the link path too -LIBS += -L$$DESTDIR - -symbian: { - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - INCLUDEPATH += $$MOC_DIR - TARGET.CAPABILITY = ALL -TCB - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0x20028733 -} - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeedit.cpp --- a/controlpanelui/src/seccodeui/src/seccodeedit.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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 "seccodeedit.h" -#include - -SecCodeEdit::SecCodeEdit(const QString &text, QGraphicsItem *parent /*= 0*/) -: HbLineEdit(text,parent) -{ -} - -SecCodeEdit::~SecCodeEdit() -{ -} - -void SecCodeEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->button() != Qt::LeftButton) { - event->ignore(); - return; - } - - if (rect().contains(event->pos())) { - emit clicked(); - event->accept(); - } - else { - event->ignore(); - } -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeedit.h --- a/controlpanelui/src/seccodeui/src/seccodeedit.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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 SECCODEEDIT_H -#define SECCODEEDIT_H - -#include - -class SecCodeEdit : public HbLineEdit -{ - Q_OBJECT -public: - explicit SecCodeEdit(const QString &text, QGraphicsItem *parent = 0); - virtual ~SecCodeEdit(); - void mousePressEvent(QGraphicsSceneMouseEvent *event); -signals: - void clicked(); -}; - -#endif //SECCODEEDIT_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeeditdataformviewitem.cpp --- a/controlpanelui/src/seccodeui/src/seccodeeditdataformviewitem.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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 "seccodeeditdataformviewitem.h" -#include "seccodeedit.h" - -SecCodeEditDataFormViewItem::SecCodeEditDataFormViewItem(QGraphicsItem *parent ) -: HbDataFormViewItem(parent) -{ -} - -SecCodeEditDataFormViewItem::~SecCodeEditDataFormViewItem() -{ -} - -HbAbstractViewItem* SecCodeEditDataFormViewItem::createItem() -{ - return new SecCodeEditDataFormViewItem(*this); -} - -bool SecCodeEditDataFormViewItem::canSetModelIndex(const QModelIndex &index) const -{ - int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt(); - return type == SecCodeEditItem; -} - -HbWidget *SecCodeEditDataFormViewItem::createCustomWidget() -{ - int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt(); - - if (type == SecCodeEditItem) { - SecCodeEdit *edit = new SecCodeEdit("1234"); - edit->setEchoMode(HbLineEdit::Password ); - edit->setReadOnly(true); - return edit; - } - - return 0; -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeeditdataformviewitem.h --- a/controlpanelui/src/seccodeui/src/seccodeeditdataformviewitem.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +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 SECCODEEDITDATAFORMVIEWITEM_H -#define SECCODEEDITDATAFORMVIEWITEM_H - -#include "seccodeuiglobal.h" -#include -#include - -class SECCODEUI_EXPORT SecCodeEditDataFormViewItem : public HbDataFormViewItem -{ - Q_OBJECT -public: - enum { SecCodeEditItem = HbDataFormModelItem::CustomItemBase + 1 }; - - explicit SecCodeEditDataFormViewItem(QGraphicsItem *parent = 0); - virtual ~SecCodeEditDataFormViewItem(); - virtual HbAbstractViewItem* createItem(); - virtual bool canSetModelIndex(const QModelIndex &index) const; -protected: - virtual HbWidget* createCustomWidget(); -}; - -#endif //SECCODEEDITDATAFORMVIEWITEM_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodemodel.cpp --- a/controlpanelui/src/seccodeui/src/seccodemodel.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "seccodemodel.h" -#include "seccodemodel_p.h" - -SecCodeModel::SecCodeModel(QObject * parent /*= 0*/) -: QObject(parent),d_ptr(new SecCodeModelPrivate()) -{ -} - -SecCodeModel::~SecCodeModel() -{ - delete d_ptr; -} - -bool SecCodeModel::simCardRemoved() -{ -// return d_ptr->simCardRemoved(); - return false; -} - - -int SecCodeModel::pinRemainingAttempts() -{ - // return d_ptr->pinRemainingAttempts(); - return 3; -} - -int SecCodeModel::pin2RemainingAttempts() -{ -// return d_ptr->pin2RemainingAttempts(); - return 3; -} - -int SecCodeModel::changePinCode(const QString &oldCode,const QString &newCode,const QString &verifyCode) -{ - Q_UNUSED(oldCode); - Q_UNUSED(newCode); - Q_UNUSED(verifyCode); - return 0; -} - -int SecCodeModel::changePin2Code(const QString &oldCode,const QString &newCode,const QString &verifyCode) -{ - Q_UNUSED(oldCode); - Q_UNUSED(newCode); - Q_UNUSED(verifyCode); - - return 0; -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodemodel.h --- a/controlpanelui/src/seccodeui/src/seccodemodel.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 SECCODEMODEL_H -#define SECCODEMODEL_H - -#include - -class SecCodeModelPrivate; -class SecCodeModel : public QObject -{ - Q_OBJECT -public: - SecCodeModel(QObject * parent = 0); - virtual ~SecCodeModel(); - - bool simCardRemoved(); - - int pinRemainingAttempts(); - - int changePinCode(const QString &oldCode,const QString &newCode,const QString &verifyCode); - - int pin2RemainingAttempts(); - - int changePin2Code(const QString &oldCode,const QString &newCode,const QString &verifyCode); - -private: - SecCodeModelPrivate *d_ptr; -}; - - -#endif //SECCODEMODEL_H - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodemodel_p.h --- a/controlpanelui/src/seccodeui/src/seccodemodel_p.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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 SECCODEMODEL_P_H -#define SECCODEMODEL_P_H - -class SecCodeModelPrivate -{ -public: - -}; - -#endif //SECCODEMODEL_P_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodemodel_symbian.cpp --- a/controlpanelui/src/seccodeui/src/seccodemodel_symbian.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 "seccodemodel_p.h" -#include "seccodeuiglobal.h" -#include -#include - -static int symbianErrtoQtErr(int err) -{ - switch (err) { - case KErrNone: - return SecCode::ErrNone; - case KErrGsm0707IncorrectPassword: - return SecCode::ErrGsm0707IncorrectPassword; - case KErrAccessDenied: - return SecCode::ErrAccessDenied; - case KErrGsmSSPasswordAttemptsViolation: - return SecCode::ErrGsmSSPasswordAttemptsViolation; - case KErrLocked: - return SecCode::ErrLocked; - case KErrGsm0707OperationNotAllowed: - return SecCode::ErrGsm0707OperationNotAllowed; - case KErrGsm0707SIMPuk2Required: - return SecCode::ErrGsm0707SIMPuk2Required; - case KErrAbort: - return SecCode::ErrAbort; - default: - break; - } - - return err; -} - diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodemodel_win.cpp --- a/controlpanelui/src/seccodeui/src/seccodemodel_win.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +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 "seccodemodel_p.h" diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodesettings.cpp --- a/controlpanelui/src/seccodeui/src/seccodesettings.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +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 "seccodesettings.h" -#include "seccodemodel.h" -#include "seccodeuiutility.h" - -class SecCodeSettingsPrivate -{ -public: - SecCodeSettingsPrivate() - { - mSecCodeModel = new SecCodeModel(); - } - - ~SecCodeSettingsPrivate() - { - delete mSecCodeModel; - } - - SecCodeModel *mSecCodeModel; -}; - -SecCodeSettings::SecCodeSettings(QObject * parent /*= 0*/) -: QObject(parent), d_ptr(new SecCodeSettingsPrivate()) -{ - -} - -SecCodeSettings::~SecCodeSettings() -{ - delete d_ptr; -} - -bool SecCodeSettings::pinCodeRequest() const -{ -// return d_ptr->mSecCodeModel->pinCodeRequest(); - return true; -} - -void SecCodeSettings::setPinCodeRequest(bool on) -{ - Q_UNUSED(on); -} - -void SecCodeSettings::changePinCode() -{ - if (d_ptr->mSecCodeModel->simCardRemoved()) { - SecCodeUiUtility::showErrorMessage(tr("SIM removed.")); - return; - } - - if (!pinCodeRequest()) { - SecCodeUiUtility::showErrorMessage(tr("Set PIN code request ON.")); - return; - } - - QString title = SecCodeUiUtility::getPinRemainingAttemptsMessage( - d_ptr->mSecCodeModel->pinRemainingAttempts()); - - QString oldPassword = SecCodeUiUtility::getPassword(title); - if (oldPassword.isEmpty()) { - return; - } - - QString newPassword; - QString verifyPassword; - bool firstTry (true); - - do { - if (firstTry) { - firstTry = false; - } - else { - newPassword.clear(); - verifyPassword.clear(); - SecCodeUiUtility::showErrorMessage(tr("PIN does not match.")); - } - - newPassword = SecCodeUiUtility::getPassword(tr("New PIN:")); - if (newPassword.isEmpty()) { - return; - } - - verifyPassword = SecCodeUiUtility::getPassword(tr("Verify PIN:"));; - if (verifyPassword.isEmpty()) { - return; - } - } while (verifyPassword != newPassword); - - int err = d_ptr->mSecCodeModel->changePinCode(oldPassword,newPassword,verifyPassword); - switch (err) { - case SecCode::ErrNone: - SecCodeUiUtility::showInformationMessage(tr("Code changed.")); - break; - default: - break; - } -} - - -void SecCodeSettings::changePin2Code() -{ - if (d_ptr->mSecCodeModel->simCardRemoved()) { - SecCodeUiUtility::showErrorMessage(tr("SIM removed.")); - return; - } - - if (!pinCodeRequest()) { - SecCodeUiUtility::showErrorMessage(tr("Set PIN code request ON.")); - return; - } - - QString title = SecCodeUiUtility::getPin2RemainingAttemptsMessage( - d_ptr->mSecCodeModel->pin2RemainingAttempts()); - - QString oldPassword = SecCodeUiUtility::getPassword(title); - if (oldPassword.isEmpty()) { - return; - } - - QString newPassword; - QString verifyPassword; - bool firstTry (true); - - do { - if (firstTry) { - firstTry = false; - } - else { - newPassword.clear(); - verifyPassword.clear(); - SecCodeUiUtility::showErrorMessage(tr("PIN2 does not match.")); - } - - newPassword = SecCodeUiUtility::getPassword(tr("New PIN2:")); - if (newPassword.isEmpty()) { - return; - } - - verifyPassword = SecCodeUiUtility::getPassword(tr("Verify PIN2:"));; - if (verifyPassword.isEmpty()) { - return; - } - } while (verifyPassword != newPassword); - - int err = d_ptr->mSecCodeModel->changePin2Code(oldPassword,newPassword,verifyPassword); - switch (err) { - case SecCode::ErrNone: - SecCodeUiUtility::showInformationMessage(tr("Code changed.")); - break; - default: - break; - } -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodesettings.h --- a/controlpanelui/src/seccodeui/src/seccodesettings.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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 SECCODESETTINGS_H -#define SECCODESETTINGS_H - -#include -#include "seccodeuiglobal.h" - -class SecCodeSettingsPrivate; - -class SECCODEUI_EXPORT SecCodeSettings : public QObject -{ - Q_OBJECT -public: - explicit SecCodeSettings(QObject *parent = 0); - virtual ~SecCodeSettings(); - - bool pinCodeRequest() const; - - void setPinCodeRequest(bool on); - - void changePinCode(); - - void changePin2Code(); - - bool deviceLock() const; - - void setDeviceLock(bool on); - - void changeLockCode(); - - int autoLockPeriod() const; - - void setAutoLockPeriod(int period); - - bool remoteLock() const; - - void setRemoteLock(bool on,const QString &lockCode); - -private: - SecCodeSettingsPrivate *d_ptr; -}; - -#endif //SECCODESETTINGS_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeuiglobal.h --- a/controlpanelui/src/seccodeui/src/seccodeuiglobal.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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 SECCODEUIGLOBAL_H -#define SECCODEUIGLOBAL_H - -#include - -#ifdef BUILD_SECCODEUI - #define SECCODEUI_EXPORT Q_DECL_EXPORT -#else - #define SECCODEUI_EXPORT Q_DECL_IMPORT -#endif - -namespace SecCode -{ - enum SecCodeErr - { - ErrNone = 0, - ErrGsm0707IncorrectPassword, - ErrAccessDenied, - ErrGsmSSPasswordAttemptsViolation, - ErrLocked, - ErrGsm0707OperationNotAllowed, - ErrGsm0707SIMPuk2Required, - ErrAbort, - }; -} - -#endif //SECCODEUIGLOBAL_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeuiutility.cpp --- a/controlpanelui/src/seccodeui/src/seccodeuiutility.cpp Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +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 "seccodeuiutility.h" -#include -#include -#include - -QString SecCodeUiUtility::getPassword(const QString &label,bool *ok /*= 0*/,QGraphicsItem *parent /*= 0*/) -{ - HbInputDialog *dlg = new HbInputDialog(parent); - dlg->setEchoMode(HbLineEdit::Password); - QString result; - dlg->setPromptText(label); - dlg->setInputMode(HbInputDialog::TextInput); - HbAction* action = dlg->exec(); - if(action == dlg->secondaryAction()) { //Cancel was pressed - if(ok) { - *ok = false; - } - } else { //OK was pressed - if(ok) { - *ok = true; - } - result = dlg->value().toString(); - } - delete dlg; - return result; -} - -void SecCodeUiUtility::showInformationMessage(const QString &message,QGraphicsItem *parent /*= 0*/ ) -{ - HbMessageBox::information(message,0,0,parent); -} - -void SecCodeUiUtility::showWarningMessage(const QString &message,QGraphicsItem *parent /*= 0*/) -{ - HbMessageBox::warning(message,0,0,parent); -} - -void SecCodeUiUtility::showErrorMessage(const QString &message,QGraphicsItem *parent /*= 0*/) -{ - HbMessageBox::information(message,0,0,parent); -} - -QString SecCodeUiUtility::getPinRemainingAttemptsMessage(int remainingAttempts) -{ - Q_UNUSED(remainingAttempts); - - return QString("PIN code:"); -} - -QString SecCodeUiUtility::getPin2RemainingAttemptsMessage(int remainingAttempts) -{ - Q_UNUSED(remainingAttempts); - - return QString("PIN2 code:"); -} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/seccodeui/src/seccodeuiutility.h --- a/controlpanelui/src/seccodeui/src/seccodeuiutility.h Mon May 03 12:32:06 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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 SECCODEUIUTILITY_H -#define SECCODEUIUTILITY_H - -class QString; -class QGraphicsItem; - -class SecCodeUiUtility -{ -public: - static QString getPassword(const QString &label,bool *ok = 0,QGraphicsItem *parent = 0); - static QString getPinRemainingAttemptsMessage(int remainingAttempts); - static QString getPin2RemainingAttemptsMessage(int remainingAttempts); - static void showInformationMessage(const QString &message, QGraphicsItem *parent = 0); - static void showWarningMessage(const QString &message, QGraphicsItem *parent = 0); - static void showErrorMessage(const QString &message, QGraphicsItem *parent = 0); -}; - -#endif //SECCODEUIUTILITY_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/src.pro --- a/controlpanelui/src/src.pro Mon May 03 12:32:06 2010 +0300 +++ b/controlpanelui/src/src.pro Fri May 14 13:21:08 2010 +0800 @@ -15,5 +15,5 @@ # TEMPLATE = subdirs -SUBDIRS = cpprofilewrapper cpcategorymodel cpapplication seccodeui cpplugins +SUBDIRS = cpprofilewrapper cpcategorymodel cpringtoneview cpapplication cpserviceprovider tonefetcher cpplugins CONFIG += ordered \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/common.pri Fri May 14 13:21:08 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: controlpanel project - common qmake settings +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. +win32|mac:!contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release \ + debug \ + release + contains(QT_CONFIG,debug):CONFIG += debug + contains(QT_CONFIG,release):CONFIG += release +} +CONFIG(debug, debug|release):SUBDIRPART = debug +else:SUBDIRPART = release + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +# For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL \ + -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} +INCLUDEPATH += $$PWD/inc + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherutils.cpp Fri May 14 13:21:08 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: + * The source file for tone fetcher utilities. + * + */ +#include "tonefetcherutils.h" +#include +#include + +QString ToneFetcherUtils::normalizeSeperator(const QString &path) +{ + QString standardpath( path ); + QChar c('/'); + QChar c1('\\'); + if (standardpath.contains(c, Qt::CaseSensitive)) { + standardpath.replace(c, QDir::separator()); + } + if (standardpath.contains(c1, Qt::CaseSensitive)) { + standardpath.replace(c1, QDir::separator()); + } + return standardpath; +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/inc/tonefetcherutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/inc/tonefetcherutils.h Fri May 14 13:21:08 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: + * + * Description: + * The header file for tone fetcher utilities. + * + */ +#ifndef TONEFETCHERUTILS_H +#define TONEFETCHERUTILS_H + +#include + +class ToneFetcherUtils +{ +public: + + static QString normalizeSeperator(const QString &path); +}; + +#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/rom/rom.pri Fri May 14 13:21:08 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: +# Rom exports for tone fetcher +# + +symbian { + TONESERVICEPROVIDER_IBY_DIR = $$section(PWD, ":", 1) + + exists(/epoc32/include/platform_paths.hrh) { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } else { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } + + BLD_INF_RULES.prj_exports += "$$TONESERVICEPROVIDER_IBY_DIR/tonefetcher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tonefetcher.iby)" + +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/rom/tonefetcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/rom/tonefetcher.iby Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __TONEFETCHER_IBY__ +#define __TONEFETCHER_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\tonefetcher.exe SHARED_LIB_DIR\tonefetcher.exe +HB_UPGRADABLE_APP_REG_RSC(tonefetcher) +S60_APP_RESOURCE(tonefetcher) + + +data=DATAZ_\private\2002BCCA\service_conf.xml private\2002BCCA\service_conf.xml + +#endif + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/service_conf.xml Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,11 @@ + + + tonefetcher + No path + tone service + + com.nokia.symbian.IToneFetch + 1.0 + Launch a tone selection view + + \ No newline at end of file diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/main.cpp Fri May 14 13:21:08 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: + * The main function for Tone Fetcher + */ + +#include "tonefetcher.h" +#include "tonefetchermainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + HbApplication a(argc, argv); + ToneFetcherMainWindow w; + w.show(); + return a.exec(); +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcher.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher. + * + */ +#include "tonefetcher.h" +#include +#include "tonefetcherview.h" +#include "tonefetchermainwindow.h" +#include "tonefetcherutils.h" +#include +#include +#include + +ToneFetcher::ToneFetcher(HbMainWindow *mainWindow) + : XQServiceProvider(QString("tonefetcher.com.nokia.symbian.IToneFetch"), mainWindow), + mMainWindow(mainWindow), + mAsyncRequestIndex(-1), + mReturnValue(0) +{ + //publish tone service + publishAll(); +} + +ToneFetcher::~ToneFetcher() +{ + +} + +void ToneFetcher::fetch() +{ + mAsyncRequestIndex = setCurrentRequestAsync(); + if (mMainWindow) { + mMainWindow->show(); + ToneFetcherView *toneView = new ToneFetcherView(this); + if (toneView) { + connect(toneView, SIGNAL(itemSelected(QString)), this, SLOT(setSelectedPath(QString))); + mMainWindow->addView(toneView); + mMainWindow->setCurrentView(toneView); + } else { + CPFW_LOG("ToneFetcher::fetch: ToneFetcherView failed to be created"); + } + } +} + +void ToneFetcher::complete() +{ + completeRequest(mAsyncRequestIndex, mReturnValue); +} + +bool ToneFetcher::isActive() +{ + return mAsyncRequestIndex > 0; +} + +void ToneFetcher::setSelectedPath(const QString & tonePath) +{ + QString path(ToneFetcherUtils::normalizeSeperator(tonePath)); + mReturnValue.setValue(path); +} +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcher.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone fetcher. + * + */ +#ifndef TONEFETCHER_H +#define TONEFETCHER_H + +#include + +class HbMainWindow; +class ToneFetcher : public XQServiceProvider +{ + + Q_OBJECT + +public: + explicit ToneFetcher(HbMainWindow *mainWindow = 0); + ~ToneFetcher(); + /* + * return the tone's absolution path to the service requestor. + */ + void complete(); + /* + * currently only one request is allowed. + */ + bool isActive(); + +public slots: + void fetch(); + +private slots: + void setSelectedPath(const QString &tonePath); + +private: + HbMainWindow *mMainWindow; + int mAsyncRequestIndex; + QVariant mReturnValue; +}; + +#endif // TONEFETCHER_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.cpp Fri May 14 13:21:08 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: + * The main window function for Tone Fetcher + */ + +#include "tonefetchermainwindow.h" +#include + +ToneFetcherMainWindow::ToneFetcherMainWindow(QWidget *parent) + : HbMainWindow(parent) +{ + mToneFetcher = new ToneFetcher(this); + +} + +ToneFetcherMainWindow::~ToneFetcherMainWindow() +{ + delete mToneFetcher; +} + +void ToneFetcherMainWindow::quit() +{ + connect(mToneFetcher, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + mToneFetcher->complete(); +} + +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermainwindow.h Fri May 14 13:21:08 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: + * The header file of Tone Fetcher Mainwindow + */ +#ifndef TONEFETCHERMAINWINDOW_H +#define TONEFETCHERMAINWINDOW_H + +#include +#include "tonefetcher.h" +#include + +class ToneFetcherMainWindow : public HbMainWindow +{ + Q_OBJECT + +public: + explicit ToneFetcherMainWindow(QWidget *parent = 0); + virtual ~ToneFetcherMainWindow(); + +public slots: + void quit(); +private: + ToneFetcher *mToneFetcher; +}; + +#endif // TONEFETCHERWINDOW_H +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone list model + */ +#include "tonefetchermodel.h" + +ToneFetcherModel::ToneFetcherModel(QObject *parent) + : QStandardItemModel(parent) +{ +} + +ToneFetcherModel::~ToneFetcherModel() +{ +} + +QVariant ToneFetcherModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::UserRole) { + return mUserDataLst.at(index.row()); + } else { + return QStandardItemModel::data(index, role); + } +} + +void ToneFetcherModel::insertInOrder(QStandardItem *fileName, QStandardItem *filePath, int role) +{ + QString name = fileName->text(); + QString path = filePath->text(); + int index = this->insertIndex(0, rowCount(), name); + + mUserDataLst.insert(index, path); + QStandardItemModel::insertRow(index, fileName); +} + +QString ToneFetcherModel::path(const QModelIndex &index) const +{ + QString str = data(index, Qt::UserRole).toString(); + return str; +} + +int ToneFetcherModel::insertIndex(int low, int high, QString value) +{ + if (low == high) { + return low; + } + int middle = (low + high - 1)/2; + QModelIndex lowItemIndex = ((QStandardItemModel *)this)->index(low, 0); + QModelIndex highItemIndex = ((QStandardItemModel *)this)->index(high - 1, 0); + QModelIndex middleItemIndex = (( QStandardItemModel *)this)->index(middle, 0); + QString lowString = data(lowItemIndex).toString(); + QString highString = data(highItemIndex).toString(); + QString middleString = data(middleItemIndex).toString(); + + if (value >= highString) { + return high; + } + if (value < lowString) { + return low; + } + high = high - 1; + while (low < high) { + middle = (low + high)/2; + middleItemIndex = ((QStandardItemModel *)this)->index(middle, 0); + middleString = data(middleItemIndex).toString(); + if (value >= middleString) { + low = middle + 1; + } else { + high = middle; + } + } + return low; +} + +void ToneFetcherModel::refresh() +{ + emit layoutChanged(); +} + +void ToneFetcherModel::clearAll() +{ + mUserDataLst.clear(); + QStandardItemModel::clear(); +} +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetchermodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone list model + * + */ + +#ifndef TONEFETCHERMODEL_H +#define TONEFETCHERMODEL_H + +#include +#include + +// CLASS DECLARATION +/** + * This class is used for storing tone list items. + * inherited from QStandardItemModel so that many existing functions could be used. + * + */ +class ToneFetcherModel : public QStandardItemModel +{ +public: + explicit ToneFetcherModel( QObject *parent ); + virtual ~ToneFetcherModel(); + //from QAbstractItemModel + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + void insertInOrder(QStandardItem *fileName, QStandardItem *filePath, int role = Qt::DisplayRole); + QString path(const QModelIndex &index) const; + void refresh(); + void clearAll(); +private: + /* + * binary search (ascendant) for the correct index to insert. + * @param low the start of search + * @param high the end of search. + * @return the correct index + */ + int insertIndex(int low, int high, QString variant); + + /* + * save the absolute path of the tone. + */ + QStringList mUserDataLst; + +}; + +#endif /* TONEFETCHERMODEL_H_ */ diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetcherview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher view. + * + */ +#include "tonefetcherview.h" +#include "tonefetcherwidget.h" +#include +#include +#include "tonefetcher.h" +#include + +ToneFetcherView::ToneFetcherView(ToneFetcher *service) : mServiceProvider(service) +{ + setTitle(hbTrId("Tone Selection"));//need change according to ps file + initToolBar(); + initMainWidget(); + QMetaObject::connectSlotsByName(this); + +} + +ToneFetcherView::~ToneFetcherView() +{ + removeToolBarAction(); +} + +void ToneFetcherView::initMainWidget() +{ + mWidget = new ToneFetcherWidget(this); + Q_ASSERT(mWidget); + setWidget(mWidget); + //mWidget->setCurrentToolBarType( ToneServiceWidget::GeneralTone ); + connect(mWidget, SIGNAL(triggerToolBar(bool)), this, SLOT(enableToolBar(bool))); +} + +void ToneFetcherView::quit() +{ + mServiceProvider->complete(); + connect(mServiceProvider, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); +} + +void ToneFetcherView::initToolBar() +{ + mToolBarLeftAction = new HbAction(this); + mToolBarLeftAction->setObjectName("leftAction"); + mToolBarLeftAction->setText(hbTrId("Play/Pause"));//need change according to ps file + toolBar()->addAction(mToolBarLeftAction); + mToolBarLeftAction->setEnabled(false); + + mToolBarRightAction = new HbAction(this); + mToolBarRightAction->setObjectName("rightAction"); + mToolBarRightAction->setText(hbTrId("Select"));//need change according to ps file + mToolBarRightAction->setEnabled(false); + toolBar()->addAction(mToolBarRightAction); + + toolBar()->setOrientation(Qt::Horizontal); + toolBar()->setEnabled(false); + +} + +void ToneFetcherView::on_leftAction_triggered() +{ + mWidget->playOrPause(); + +} + +void ToneFetcherView::on_rightAction_triggered() +{ + QString path(mWidget->getCurrentItemPath()); + emit itemSelected(path); + quit(); +} + +void ToneFetcherView::enableToolBar(bool enable) +{ + mToolBarRightAction->setEnabled(enable); + mToolBarLeftAction->setEnabled(enable); + toolBar()->setEnabled(enable); +} + +void ToneFetcherView::removeToolBarAction() +{ + toolBar()->removeAction(mToolBarRightAction); + toolBar()->removeAction(mToolBarLeftAction); +} +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetcherview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherview.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone fetcher view. + * + */ + +#ifndef TONEFETCHERVIEW_H +#define TONEFETCHERVIEW_H + +#include +#include +class ToneFetcherWidget; +class HbAction; +class ToneFetcher; + +class ToneFetcherView : public HbView +{ + Q_OBJECT + +public: + explicit ToneFetcherView(ToneFetcher *service); + ~ToneFetcherView(); + void quit(); +private: + void initMainWidget(); + void initToolBar(); + /* + * tool bar actions must to be removed in case the app crashes. + */ + void removeToolBarAction(); + +private slots: + void on_leftAction_triggered(); + void on_rightAction_triggered(); + void enableToolBar(bool enable); + +signals: + void itemSelected(const QString &path); + +private: + ToneFetcherWidget *mWidget; + ToneFetcher *mServiceProvider; //not own + HbAction *mToolBarLeftAction; + HbAction *mToolBarRightAction; + }; + +#endif /* TONEFETCHERVIEW_H_ */ diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher widget. + * + */ +#include "tonefetcherwidget.h" +#include "hbabstractviewitem.h" +#include "hbstyle.h" +#include "hbabstractitemview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tonefetcherview.h" +#include "tonefetchermodel.h" +#include + +ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView ) + : HbWidget(this), + mLabel(0), + mListView(0), + mLayout(0), + mToneModel(0), + mServiceView(serviceView), + mServiceEngine(0) + +{ + mSelected = false; + init(); + connect(mServiceEngine, SIGNAL(mdeSessionOpened()), + this, SLOT(mdeSessionOpened())); + connect(mServiceEngine, SIGNAL(mdeSessionError(int)), + this, SLOT(mdeSessionError(int))); + connect(mServiceEngine, SIGNAL(queryComplete(QStringList, QStringList)), + this, SLOT(queryComplete(QStringList, QStringList))); + connect(mServiceEngine, SIGNAL(queryError(int)), + this, SLOT(queryError(int))); + connect(mServiceEngine, + SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)), + this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int))); + connect( mServiceEngine, SIGNAL(notifyObjectChanged()), + this, SLOT(onObjectChanged())); +} + +ToneFetcherWidget::~ToneFetcherWidget() +{ + delete mToneModel; +} + +void ToneFetcherWidget::on_list_activated(const QModelIndex &index) +{ + QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); + + //stop previewing when clicking another item. + if (mServiceEngine->IsPlaying()) { + mServiceEngine->preview(getCurrentItemPath()); + } + /* + * when one item is selected, reselecting it will deselect it. selecting another + * will also deselect it, while the other is selected. + */ + if (mSelected){ + if(mOldSeletedItem != index) { + mListView->selectionModel()->select(index, QItemSelectionModel::Select); + mOldSeletedItem = index; + emit triggerToolBar(true); + } else { + mListView->selectionModel()->select(index, QItemSelectionModel::Deselect); + mSelected = false; + emit triggerToolBar(false); + } + return; + } + if (modelIndexList.count() > 0) { + for (QModelIndexList::const_iterator it = modelIndexList.begin(); it != modelIndexList.end(); ++it) { + if ((*it) == index) { + mSelected = true; + mOldSeletedItem = index; + emit triggerToolBar(true); + } + } + + } + +} + +void ToneFetcherWidget::init() +{ + mLayout = new QGraphicsLinearLayout(this); + mLayout->setOrientation(Qt::Vertical); + setLayout(mLayout); + + mLabel = new HbLabel(this); + mLabel->setPlainText(hbTrId("Select tone")); + mLayout->addItem(mLabel); + + mListView = new HbListView(this); + mListView->setObjectName("list"); + mLayout->addItem(mListView); + mListView->setSelectionMode(HbAbstractItemView::SingleSelection); + + mServiceEngine = new ToneFetcherEngine(this); + mToneModel = new ToneFetcherModel(this); + addRomFiles(); + + connect(mListView, SIGNAL(activated(QModelIndex)), + this, SLOT(on_list_activated(QModelIndex ))); +} + +void ToneFetcherWidget::mdeSessionOpened() +{ + mServiceEngine->getTone(); +} + +void ToneFetcherWidget::queryComplete(const QStringList &nameList, const QStringList &uriList) +{ + QStandardItem *fileName = 0; + QStandardItem *filePath = 0; + for (int i = 0; i < nameList.size(); ++i) { + QString tr1 = nameList.at(i); + tr1 = uriList.at(i); + fileName = new QStandardItem(nameList.at(i)); + filePath = new QStandardItem(uriList.at(i)); + mToneModel->insertInOrder(fileName, filePath); + } + mLabel->setPlainText(QString::number(mSimpleSoundList.size() + mDigitalSoundList.size() + nameList.size()) + " tones"); + mListView->setModel(mToneModel); + mToneModel->refresh(); +} + +void ToneFetcherWidget::queryError(int error) +{ + Q_UNUSED(error); + +} + +void ToneFetcherWidget::mdeSessionError(int error) +{ + Q_UNUSED(error); +} + +QString ToneFetcherWidget::getCurrentItemPath() +{ + QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes(); + if (modelIndexList.count() > 0) { + QModelIndex index = modelIndexList.at(0); + return mToneModel->data(index, Qt::UserRole).toString(); + } + return QString(); +} + +void ToneFetcherWidget::playOrPause() +{ + mServiceEngine->preview(getCurrentItemPath()); +} + +void ToneFetcherWidget::previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId) +{ + Q_UNUSED(errorId); + if (event == ToneFetcherEngine::EAudioPreviewComplete) { + //reserved + } else { + HbMessageBox::information(QString(hbTrId("Preview Error"))); + } +} + +void ToneFetcherWidget::onObjectChanged() +{ + mToneModel->clearAll(); + mDigitalSoundList.clear(); + mSimpleSoundList.clear(); + addRomFiles(); + mServiceEngine->getTone(); +} + +void ToneFetcherWidget::addRomFiles() +{ + QStandardItem *fileName = 0; + QStandardItem *filePath = 0; + QDir digitalSoundPath(XQUtils::romRootPath() + XQUtils::digitalSoundsPath()); + mDigitalSoundList = digitalSoundPath.entryInfoList(); + + QDir simpleSoundPath(XQUtils::romRootPath() + XQUtils::simpleSoundsPath()); + mSimpleSoundList = simpleSoundPath.entryInfoList(); + + for (int i = 0; i < mDigitalSoundList.size(); ++i) { + QFileInfo fileInfo = mDigitalSoundList.at(i); + fileName = new QStandardItem(fileInfo.fileName()); + filePath = new QStandardItem(fileInfo.absoluteFilePath()); + mToneModel->insertInOrder(fileName, filePath); + } + + for (int i = 0; i < mSimpleSoundList.size(); ++i) { + QFileInfo fileInfo = mSimpleSoundList.at(i); + fileName = new QStandardItem(fileInfo.fileName()); + filePath = new QStandardItem(fileInfo.absoluteFilePath()); + mToneModel->insertInOrder(fileName, filePath); + } +} +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/src/tonefetcherwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone fetcher widget. + * + */ +#ifndef TONEFETCHERWIDGET_H +#define TONEFETCHERWIDGET_H + +#include +#include +#include +#include +#include "tonefetcherengine.h" + +class QDirModel; +class HbListView; +class QGraphicsLinearLayout; +class QStandardItemModel; +class HbAbstractViewItem; +class ToneFetcherView; +class ToneFetcherModel; +class HbLabel; + +class ToneFetcherWidget : public HbWidget +{ + Q_OBJECT + +public: + explicit ToneFetcherWidget(ToneFetcherView *serviceView); + ~ToneFetcherWidget(); + QString getCurrentItemPath(); + void playOrPause(); + +signals: + void itemClicked(const QString &item); + void triggerToolBar(bool enable); + +private slots: + void on_list_activated(const QModelIndex &index); + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(const QStringList &nameList, const QStringList &uriList); + void queryError(int error ); + void previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId); + void onObjectChanged(); + +private: + void init(); + void addRomFiles(); + +private: + HbLabel *mLabel; + HbListView *mListView; + QGraphicsLinearLayout *mLayout; + ToneFetcherModel *mToneModel; + + ToneFetcherView *mServiceView; + ToneFetcherEngine *mServiceEngine; + + QFileInfoList mSimpleSoundList; + QFileInfoList mDigitalSoundList; + bool mSelected; + QModelIndex mOldSeletedItem; +}; +#endif /* TONEFETCHERWIDGET_H_ */ diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcher.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pri Fri May 14 13:21:08 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: +# + +HEADERS += src/tonefetchermainwindow.h \ + src/tonefetcher.h \ + src/tonefetcherview.h \ + src/tonefetcherwidget.h \ + src/tonefetchermodel.h \ + tonefetcherengine/tonefetcherengine.h \ + inc/tonefetcherutils.h + +SOURCES += src/tonefetchermainwindow.cpp \ + src/tonefetcher.cpp \ + src/tonefetcherview.cpp \ + src/tonefetcherwidget.cpp \ + src/tonefetchermodel.cpp \ + tonefetcherengine/tonefetcherengine.cpp \ + inc/tonefetcherutils.cpp \ + src/main.cpp + +symbian { + HEADERS += tonefetcherengine/private/symbian/toneselectionengine_p.h \ + tonefetcherengine/private/symbian/tonepreviewprivate.h + + + SOURCES += tonefetcherengine/private/symbian/toneselectionengine_p.cpp \ + tonefetcherengine/private/symbian/tonepreviewprivate.cpp +} + + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,57 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app +TARGET = tonefetcher +CONFIG += hb service + +include( common.pri ) +include( tonefetcher.pri ) +LIBS += -lxqservice \ + -lxqserviceutil \ + -lcpframework \ + -lxqutils +symbian { + LIBS += -lcafutils \ + -lcaf \ + -lmdeclient \ + -lcentralrepository \ + -lProfileEng \ + -lpeninputClient \ + -lmediaclientaudio \ + -lDrmAudioPlayUtility \ + -lmediaclientvideo \ + -lDRMCommon \ + -lDrmRights \ + -lDrmHelper \ + -ldrmutility \ + -lapmime \ + -lecom + TARGET.UID3 = 0x2002BCCA + TARGET.CAPABILITY = ALL -TCB + BLD_INF_RULES.prj_exports += "./service_conf.xml z:/private/2002BCCA/service_conf.xml" +} +symbian { + include(rom/rom.pri) +} + + +SERVICE.FILE = service_conf.xml +SERVICE.OPTIONS = embeddable +#SERVICE.OPTIONS += hidden +libFiles.sources = xqservice.dll +libFiles.path = "!:\sys\bin" +DEPLOYMENT += libFiles diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,603 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone previewing. + * + */ +#include "tonepreviewprivate.h" +#include "tonefetcherutils.h" +#include // KAudioPriorityPreview +#include // C3DRingingToneInterface +#include // for phone call states +#include +#include +#include +#include "TProfileToneSettings.h" +#include +#include +#include +#include // KProEngDefaultRingingTone +#include +#include + +CMFPreviewHandlerBase::CMFPreviewHandlerBase( QObject *parent ) : QObject( parent ) + { + iMediaType = KErrNotFound; + iRingingVolume = KErrNotFound; + iRingingType = KErrNotFound; + iVibra = KErrNotFound; + i3DEffect = KErrNotFound; + i3DEcho = KErrNotFound; + iFileSize = KErrNotFound; + iFullName = 0; + iActiveProfileRead = EFalse; + iPlayerStatus = EPlayerNotCreated; + + } + +void CMFPreviewHandlerBase::ConstructL() + { + // To allow/not allow screensaver + // Errors ignored, no actions needed if API is not available + //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver ); + TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) ); + + TRAP_IGNORE( ReadDefaultToneL() ); + // To keep backlight on while a video is being previewed + iBacklightTimer = CPeriodic::NewL( EPriorityLow ); + } + +CMFPreviewHandlerBase::~CMFPreviewHandlerBase() + { + delete iFullName; + iProperty.Close(); + + iApaSession.Close(); + } + +void CMFPreviewHandlerBase::SetAttr(const QString &file ) + { + if ( !file.isNull() ) + { + QString path = ToneFetcherUtils::normalizeSeperator(file); + delete iFullName; + iFullName = 0; + iFullName = XQConversions::qStringToS60Desc( path ); + } + } + +TInt CMFPreviewHandlerBase::RingingVolume() + { + const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels + + if ( iRingingVolume != KErrNotFound ) + { + return iRingingVolume; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingVolume; + } + + return KDefaultVolumeLevel; + } + +TInt CMFPreviewHandlerBase::RingingType() + { + if ( iRingingType != KErrNotFound ) + { + return iRingingType; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileRingingType; + } + + return ERingingTypeRinging; + } + +TInt CMFPreviewHandlerBase::Vibra() + { + if ( iVibra != KErrNotFound ) + { + return iVibra; + } + + if ( iActiveProfileRead ) + { + return iActiveProfileVibra; + } + + return 0; // in case of error vibra is off + } + +TInt CMFPreviewHandlerBase::Echo3D() + { + if ( i3DEcho != KErrNotFound ) + { + return i3DEcho; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEcho; + } + + return EProfile3DEchoOff; // from ProfileInternal.hrh + } + +TInt CMFPreviewHandlerBase::Effect3D() + { + if ( i3DEffect != KErrNotFound ) + { + return i3DEffect; + } + + if ( iActiveProfileRead ) + { + return iActiveProfile3DEffect; + } + + return EProfile3DEffectOff; + } + +TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume ) + { + const TInt KMinVolumeLevel = 1; + const TInt KMaxVolumeLevel = 10; + + TInt result = aMaxVolume * aVolume / KMaxVolumeLevel; + + // if user has selected minimum volume level set HW volume 1 + if ( aVolume == KMinVolumeLevel && result == 0 ) + { + result = 1; + } + + return result; + } + +void CMFPreviewHandlerBase::ReadActiveProfileL() + { + iActiveProfileRead = EFalse; + + MProfileEngine* profileEngine = CreateProfileEngineL(); + CleanupReleasePushL( *profileEngine ); + + MProfile* activeProfile = profileEngine->ActiveProfileL(); + CleanupReleasePushL( *activeProfile ); + + const MProfileTones& profileTones = activeProfile->ProfileTones(); + + const TProfileToneSettings& toneSettings = profileTones.ToneSettings(); + iActiveProfileVibra = toneSettings.iVibratingAlert; + iActiveProfileRingingVolume = toneSettings.iRingingVolume; + iActiveProfileRingingType = toneSettings.iRingingType; + + const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings(); + const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); + + iActiveProfile3DEffect = threeD.Effect(); + iActiveProfile3DEcho = threeD.Echo(); + + CleanupStack::PopAndDestroy( activeProfile ); + CleanupStack::PopAndDestroy( profileEngine ); + + iActiveProfileRead = ETrue; + } + +void CMFPreviewHandlerBase::ReadDefaultToneL() + { + CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine ); + + User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) ); + CleanupStack::PopAndDestroy( cenrep ); + } + +TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType ) + { + TUid dummyUid( KNullUid ); + return iApaSession.AppForDocument( aFileName, dummyUid, aDataType ); + } + +TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ ) + { + User::ResetInactivityTime(); + return KErrNone; + } + +void CMFPreviewHandlerBase::DisableBackLight() + { + const TInt KResetInactivityTimerDelay = 2000000; + iBacklightTimer->Cancel(); // Just in case + // Disable backlight turn off during video preview + iBacklightTimer->Start( KResetInactivityTimerDelay, + KResetInactivityTimerDelay, + TCallBack( DoResetInactivityTimer, 0 ) ); + + } + + + +TonePreviewPrivate::TonePreviewPrivate( QObject *parent ) : CMFPreviewHandlerBase( parent ) + { + iAudioPlayerStatus = EPlayerNotCreated; + CMFPreviewHandlerBase::ConstructL(); + iTonePlayerStatus = EPlayerNotCreated; + } + +TonePreviewPrivate::~TonePreviewPrivate() + { + Cancel(); + + delete iAudioPlayer; + delete iTonePlayer; + delete i3dRingingTonePlugin; + } + +TBool TonePreviewPrivate::IsPlaying() + { + if ( iAudioPlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + if ( iTonePlayerStatus != EPlayerNotCreated ) + { + return ETrue; + } + + return EFalse; + } + +void TonePreviewPrivate::Play() + { + if( IsPlaying() ) + { + Stop(); + return; + } + //sequence for playing a beep once sound + _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\ + \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); + + // rng mime type + _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" ); + + Cancel(); // stop previous play + + if ( !iFullName || iFullName->Des().Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + + TRAP_IGNORE( ReadActiveProfileL() ); + + TPtrC fileName( iFullName->Des() ); + TDataType dataType; + TInt err = GetDataType( fileName, dataType ); + if ( err == KErrNotFound ) + { + fileName.Set( iDefaultTone ); + if ( fileName.Length() == 0 ) + { + User::Leave( KErrNotFound ); + } + } + else if ( err != KErrNone ) + { + User::Leave( err ); + } + + TBool mimeTypeRng = EFalse; + + if ( err == KErrNone ) + { + if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 ) + { + mimeTypeRng = ETrue; + } + } + + TInt ringingType = RingingType(); + if ( ringingType == ERingingTypeBeepOnce ) + { + // Active profile ringing tone is set to Beep Once + // Don't initialize a FileSequence but use DesSequence instead + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + if( mimeTypeRng ) + { + //Ringingtone is a RNG-file + iTonePlayer = CMdaAudioToneUtility::NewL( *this ); + iTonePlayer->PrepareToPlayFileSequence( fileName ); + iTonePlayerStatus = EPlayerInitializing; + } + else + { + delete iAudioPlayer; + iAudioPlayer = 0; + + iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL( + fileName, *this, KAudioPriorityRingingTonePreview, + ( TMdaPriorityPreference )KAudioPrefRingFilePreview ); + + iAudioPlayerStatus = EPlayerInitializing; + } + } + DisableBackLight(); + } + +void TonePreviewPrivate::Stop() + { + Cancel(); + } + +TInt TonePreviewPrivate::ConvertVolume( TInt aVolume ) + { + TInt result = 0; + if ( iAudioPlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() ); + } + else if ( iTonePlayer ) + { + result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() ); + } + + //if user has selected silent ringing type, set volume off + TInt ringingType = RingingType(); + if( ringingType == ERingingTypeSilent ) + { + result = 0; + } + + return result; + } + +void TonePreviewPrivate::SetToneRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iTonePlayer ) + { + return; + } + + + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + case ERingingTypeBeepOnce: + { + iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + default: + { + break; + } + } + } + +void TonePreviewPrivate::SetAudioRingingType( TInt aRingingType ) + { + const TInt KToneInterval = 1000000; // 1 second pause between tones + const TInt KAscendingVolumeInterval = 3000000; // 3 seconds + + if ( !iAudioPlayer ) + { + return; + } + + TInt ringingVolume = RingingVolume(); + + switch( aRingingType ) + { + case ERingingTypeRinging: + case ERingingTypeSilent: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + case ERingingTypeAscending: + { + iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever, + TTimeIntervalMicroSeconds( KToneInterval ) ); + TInt volRamp = KAscendingVolumeInterval * ringingVolume; + iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); + break; + } + case ERingingTypeRingOnce: + { + iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); + break; + } + + default: + { + break; + } + } + } + +void TonePreviewPrivate::Cancel() + { + TBool isPlaying = EFalse; + + if ( iAudioPlayer ) + { + isPlaying = ETrue; + if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect ) + { + i3dRingingTonePlugin->Stop(); + // plugin calls AudioPlayer->Stop() + iAudioPlayer->Close(); + } + if ( iAudioPlayerStatus == EPlayerPlaying ) + { + iAudioPlayer->Stop(); + iAudioPlayer->Close(); + } + + delete iAudioPlayer; + iAudioPlayer = 0; + iAudioPlayerStatus = EPlayerNotCreated; + } + + if ( iTonePlayer ) + { + isPlaying = ETrue; + if ( iTonePlayerStatus == EPlayerPlaying ) + { + iTonePlayer->CancelPlay(); + } + + delete iTonePlayer; + iTonePlayer = 0; + iTonePlayerStatus = EPlayerNotCreated; + } + + + if ( isPlaying ) + { + //User::InfoPrint(_L("cancel")); +// EnableScreenSaver( ETrue ); + iBacklightTimer->Cancel(); + } + } + +void TonePreviewPrivate::MatoPlayComplete( TInt aError ) + { + Cancel(); + emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError ); + } + +void TonePreviewPrivate::MatoPrepareComplete( TInt aError ) + { + if ( aError != KErrNone ) + { + Cancel(); + + emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError ); + return; + } + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + + iTonePlayerStatus = EPlayerInitialized; + SetToneRingingType( ringingType ); + iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iTonePlayer->SetPriority( KAudioPriorityPreview, pref ); + + iTonePlayer->Play(); + iTonePlayerStatus = EPlayerPlaying; + } + +void TonePreviewPrivate::MdapcInitComplete( TInt aError, + const TTimeIntervalMicroSeconds& /* aDuration */ ) + { + if ( aError != KErrNone ) + { + Cancel(); + emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError ); + return; + } + + + TInt ringingVolume = RingingVolume(); + TInt ringingType = RingingType(); + TInt vibra = Vibra(); + TInt echo3D = Echo3D(); + TInt effect3D = Effect3D(); + + + + iAudioPlayerStatus = EPlayerInitialized; + SetAudioRingingType( ringingType ); + iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) ); + + TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview; + if ( vibra ) + { + pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra; + } + iAudioPlayer->SetPriority( KAudioPriorityPreview, pref ); + + iAudioPlayerStatus = EPlayerPlaying; + + if ( effect3D == EProfile3DEffectOff ) + { + iAudioPlayer->Play(); // 3D not used + return; + } + + if ( !i3dRingingTonePlugin ) + { + TUid emptyUid = { 0 }; + TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) ); + if ( err != KErrNone || !i3dRingingTonePlugin ) + { + iAudioPlayer->Play(); + return; + } + } + + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D ); + i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer ); + TRAP_IGNORE( i3dRingingTonePlugin->PlayL() ); + + iAudioPlayerStatus = EPlayerPlayingWith3DEffect; + } + +void TonePreviewPrivate::MdapcPlayComplete( TInt aError ) + { + Cancel(); + emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError ); + } diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone previewing. + * + */ + +#ifndef TONEPREVIEWPRIVATE_H +#define TONEPREVIEWPRIVATE_H +#include +#include +#include +#include +#include +#include // for RApaLsSession +#include +#include +#include "tonefetcherengine.h" + +class C3DRingingToneInterface; +class RWindow; + +/** +* CMFPreviewHandlerBase +* +* Base class for CMFAudioPreviewHandler. + */ +class CMFPreviewHandlerBase : public QObject, public CBase + +{ +Q_OBJECT +public: + + enum TMediaFileType + { + EMediaFileTypeAudio = 0, + EMediaFileTypeVideo + }; + enum TPlayerStatus + { + EPlayerNotCreated, + EPlayerInitializing, + EPlayerReady, + EPlayerPlaying, + EPlayerInitialized, + EPlayerPlayingWith3DEffect + }; + + // these must match with the ones in Profile Engine + enum TRingingTypes + { + ERingingTypeRinging = 0, + ERingingTypeAscending, + ERingingTypeRingOnce, + ERingingTypeBeepOnce, + ERingingTypeSilent + }; + + enum TFLAllowScreenSaver + { + EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed + }; + +protected: + + virtual ~CMFPreviewHandlerBase(); + +protected: + + /** + * C++ default constructor. + */ + CMFPreviewHandlerBase( QObject *parent ); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + +public: + void SetAttr(const QString &file); + TInt Attr(TInt aAttr); + virtual void Play() = 0; + virtual void Stop() = 0; + virtual TBool IsPlaying() = 0; + +protected: + TInt ConvertVolume(TInt aVolume); + void ReadActiveProfileL(); + TInt GetDataType(const TDesC& aFileName, TDataType& aDataType); + void ReadDefaultToneL(); + + + void DisableBackLight(); + + static TInt DoResetInactivityTimer(TAny* aObject); +protected: + TInt RingingVolume(); + TInt RingingType(); + TInt Vibra(); + TInt Echo3D(); + TInt Effect3D(); + +protected: + static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume); + +protected: + TInt iRingingVolume; + TInt iRingingType; + TInt iVibra; + TInt i3DEffect; + TInt i3DEcho; + TInt iMediaType; + TInt iFileSize; + HBufC* iFullName; + + TBool iActiveProfileRead; + TInt iActiveProfileRingingVolume; + TInt iActiveProfileRingingType; + TInt iActiveProfileVibra; + TInt iActiveProfile3DEffect; + TInt iActiveProfile3DEcho; + + + TInt iPlayerStatus; + + // handle to window + RWindow* iWindow; // does not own + + // for getting file MIME types + RApaLsSession iApaSession; + + // for setting screensaver on/off + RProperty iProperty; + + // default ringing tone + TFileName iDefaultTone; + + // file server session + //RFs iFsSession; + + /** + * Timer for resetting the user inactivity timeout + */ + CPeriodic* iBacklightTimer; +}; + +// CLASS DECLARATION +/** + * This class is used for previewing the tones. + * + */ + +class TonePreviewPrivate : public CMFPreviewHandlerBase, + public MDrmAudioPlayerCallback, + public MMdaAudioToneObserver + +{ +Q_OBJECT +public: + TonePreviewPrivate( QObject *parent ); + virtual ~TonePreviewPrivate(); +signals: + void notifyPreviewEvent( ToneFetcherEngine::TPreviewEvent event, int errorId ); + +public: + void Play(); + void Stop(); + TBool IsPlaying(); + +private: + void Cancel(); + void SetAudioRingingType( TInt aRingingType ); + void SetToneRingingType( TInt aRingingType ); + TInt ConvertVolume( TInt aVolume ); + + +private: + // from MMdaAudioToneObserver + virtual void MatoPrepareComplete( TInt aError ); + virtual void MatoPlayComplete(TInt aError); + +private: + // from MDrmAudioPlayerCallback + void MdapcInitComplete(TInt aError, + const TTimeIntervalMicroSeconds& aDuration); + void MdapcPlayComplete(TInt aError); + +private: + // audio player + CDrmPlayerUtility* iAudioPlayer; + + /// Audioplayer status + TPlayerStatus iAudioPlayerStatus; + + /// toneplayer + CMdaAudioToneUtility* iTonePlayer; + + /// Toneplayer status + TPlayerStatus iTonePlayerStatus; + + // plugin for playing 3D effects + C3DRingingToneInterface* i3dRingingTonePlugin; + +}; + +#endif /* TONEPREVIEWPRIVATE_H_ */ diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for mde tone fetcher. + * + */ +#include "toneselectionengine_p.h" +#include +#include +#include +#include "tonepreviewprivate.h" +#include "tonefetcherengine.h" +#include +#include + +ToneSelectionEnginePrivate::ToneSelectionEnginePrivate( ToneFetcherEngine *engine ) : mServiceEngine( engine ) + + { + iSession = CMdESession::NewL( *this ); + + } + +ToneSelectionEnginePrivate::~ToneSelectionEnginePrivate() + { + delete iQuery; + delete iSession; + } + +void ToneSelectionEnginePrivate::HandleSessionOpened( CMdESession& /*aSession*/, TInt aError ) + { + if ( aError != KErrNone ) + { + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + emit mdeSessionError( aError ); + } + else + { + iSessionOpen = ETrue; + TRAP_IGNORE( AddObjectObserverL() ); + emit mdeSessionOpened(); + } + } + + + +void ToneSelectionEnginePrivate::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) + { + if ( aError == KErrNone ) + { + return; + } + + delete iSession; + iSession = 0; + iSessionOpen = EFalse; + emit mdeSessionError( aError ); + } + + +void ToneSelectionEnginePrivate::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/ ) + { + } + +void ToneSelectionEnginePrivate::HandleObjectNotification( CMdESession& /*aSession*/, + TObserverNotificationType aType, + const RArray& /*aObjectIdArray*/ ) + { + if ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) + { + emit notifyObjectChanged(); + } + } + +void ToneSelectionEnginePrivate::AddObjectObserverL() + { + if ( iSessionOpen ) + { + TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + iSession->AddObjectObserverL( *this, 0, notificationType, &defNS ); + + iSession->AddObjectPresentObserverL( *this ); + } + } + +void ToneSelectionEnginePrivate::HandleObjectPresentNotification( CMdESession& /*aSession*/, + TBool /*aPresent*/, const RArray& aObjectIdArray ) + { + if( aObjectIdArray.Count() > 0 ) + { + emit notifyObjectChanged(); + } + } + +void ToneSelectionEnginePrivate::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + { + iNameList.clear(); + iUriList.clear(); + if ( aError == KErrCancel ) + { + emit queryError( aError ); + return; + } + else + { + CMdEObjectQuery* query = static_cast (&aQuery); + TInt count = query->Count(); + for (TInt i = 0; i < count; ++i) + { + CMdEObject* object = + (CMdEObject*) query->TakeOwnershipOfResult(i); + CleanupStack::PushL(object); + CMdEPropertyDef& propDef = + ToneSelectionEnginePrivate::PropertyDefL( iSession, ToneSelectionEnginePrivate::EAttrSongName ); + + CMdEProperty* property = 0; + TInt err = object->Property( propDef, property, 0 ); + if ( err != KErrNotFound && property ) + { + QString songName( XQConversions::s60DescToQString( property->TextValueL() ) ); + QString uriValue( XQConversions::s60DescToQString( object->Uri() ) ); + iNameList.append( songName ); + iUriList.append( uriValue ); + } + CleanupStack::PopAndDestroy(object); + } + emit queryComplete(iNameList, iUriList ); + } + } + +void ToneSelectionEnginePrivate::QueryTones() + { + LeaveIfSessionClosedL(); + + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& musicObjectDef = + defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + + delete iQuery; + iQuery = 0; + iQuery = iSession->NewObjectQueryL( defNS, musicObjectDef, this ); + + + // set attributes that are included in query result + CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); + iQuery->AddPropertyFilterL( &namePropertyDef ); + + iQuery->SetResultMode( EQueryResultModeItem ); + + CMdELogicCondition& conditions = iQuery->Conditions(); + ExcludeMusicPropertiesL( conditions ); + + iQuery->FindL(); + } + +void ToneSelectionEnginePrivate::LeaveIfSessionClosedL() + { + if ( !iSession || !iSessionOpen ) + { + User::Leave( KErrDisconnected ); + } + } + +CMdEPropertyDef& ToneSelectionEnginePrivate::PropertyDefL( TInt aAttr ) + { + return PropertyDefL( iSession, aAttr ); + } + +CMdEPropertyDef& ToneSelectionEnginePrivate::PropertyDefL( CMdESession* aSession, TInt aAttr ) + { + CMdENamespaceDef& defNS = aSession->GetDefaultNamespaceDefL(); + + CMdEObjectDef& objectDef = + defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + + if ( aAttr == EAttrFileSize ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + } + else if ( aAttr == EAttrMediaType ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + } + else if ( aAttr == EAttrSongName || aAttr == EAttrFileName ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + } + else if ( aAttr == EAttrArtist ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); + } + else if ( aAttr == EAttrAlbum ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); + } + else if ( aAttr == EAttrGenre ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); + } + else if ( aAttr == EAttrComposer ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); + } + else + { + User::Leave( KErrNotSupported ); + } + + return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + } + +void ToneSelectionEnginePrivate::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition ) + { + TInt sizeLimitKB = 0; + CRepository* cenrep = CRepository::NewL( KCRUidProfileEngine ); + CleanupStack::PushL( cenrep ); + User::LeaveIfError( cenrep->Get( KProEngRingingToneMaxSize, sizeLimitKB ) ); + CleanupStack::PopAndDestroy(); // cenrep + + SetAttr( ToneFetcherEngine::EAttrFileSize, sizeLimitKB ); + CMdEPropertyDef& sizeTypeDef = PropertyDefL( EAttrFileSize ); + CMdEPropertyDef& mimeTypeDef = PropertyDefL( EAttrMediaType ); + CMdEPropertyDef& artistTypeDef = PropertyDefL( EAttrArtist ); + CMdEPropertyDef& albumTypeDef = PropertyDefL( EAttrAlbum ); + CMdEPropertyDef& genreTypeDef = PropertyDefL( EAttrGenre ); + CMdEPropertyDef& composerTypeDef = PropertyDefL( EAttrComposer ); + + CMdELogicCondition& condition = + aCondition.AddLogicConditionL( ELogicConditionOperatorAnd ); + condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize, EMdERangeTypeBetween) ); + condition.AddPropertyConditionL( mimeTypeDef, + ETextPropertyConditionCompareContains, KMimeMp3 ); + condition.AddPropertyConditionL( artistTypeDef ); + condition.AddPropertyConditionL( albumTypeDef ); + condition.AddPropertyConditionL( genreTypeDef ); + condition.AddPropertyConditionL( composerTypeDef ); + + condition.SetNegate( ETrue ); + } + +void ToneSelectionEnginePrivate::SetAttr( int attr, int value ) +{ + switch ( attr ) + { + case ToneFetcherEngine::EAttrFileSize: + { + iMaxFileSize = value; + break; + } + default: + { + break; + } + } +} +// End of File + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for mde tone fetcher. + * + */ +#ifndef TONESELECTIONENGINEPRIVATE_H +#define TONESELECTIONENGINEPRIVATE_H + +#include "toneselectionengine_p.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// FORWARD DECLARATIONS +class ToneFetcherEngine; +// CONSTANTS +_LIT( KMimeMp3, "mp3" ); + +// CLASS DECLARATION +/** + * This class is used for quering tones from mde. + * + */ +class ToneSelectionEnginePrivate : public QObject, + public CBase, + public MMdESessionObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver +{ + Q_OBJECT +public: + + enum TStorageType + { + EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard + }; + + enum TQueryAttribute + { + EAttrMediaType = 20, // integer + EAttrFileSize, // integer + EAttrStorageType, // integer + EAttrMediaFileId, // integer + EAttrFileName, // string + EAttrFullName, // string + EAttrSongName, // string + EAttrArtist, // string + EAttrAlbum, // string + EAttrGenre, // string + EAttrComposer + // string + }; + +public: + ToneSelectionEnginePrivate( ToneFetcherEngine *engine ); + virtual ~ToneSelectionEnginePrivate(); + +signals: + void mdeSessionOpened(); + void mdeSessionError( int error ); + void queryComplete( QStringList nameList, QStringList uriList ); + void queryError( int error ); + void notifyObjectChanged(); + + +public: + static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr); + void QueryTones(); + void SetAttr( int attr, int value ); + +private: + void ExcludeMusicPropertiesL(CMdELogicCondition& aCondition); + void LeaveIfSessionClosedL(); + CMdEPropertyDef& PropertyDefL(TInt aAttr); + +private: + // from MMdESessionObserver + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + +private: + // from MMdEQueryObserver (mdequery.h) + void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount); + void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); +private: + // from MMdEObjectObserver + void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); + +private: + // from MMdEObjectPresentObserver + void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + void AddObjectObserverL(); +private: + + ToneFetcherEngine *mServiceEngine; + + // session to metadata engine + CMdESession* iSession; + + // metadata query + CMdEObjectQuery* iQuery; + + // used for saving the quering result. + //both name and uri. + QStringList iNameList; + QStringList iUriList; + + // is metadata session open + TBool iSessionOpen; + + // max audio file file size + TInt iMaxFileSize; + + // query error + TInt iQueryError; +}; +#endif /* TONESELECTIONENGINE_H_ */ + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone fetcher engine. + * + */ +#include "tonefetcherengine.h" +#include "toneselectionengine_p.h" +#include "tonepreviewprivate.h" + +ToneFetcherEngine::ToneFetcherEngine(QObject* parent) : QObject(parent) +{ + d = new ToneSelectionEnginePrivate(this); + Q_ASSERT(d); + mAudioPlayer = new TonePreviewPrivate( this ); + Q_ASSERT(mAudioPlayer); + connect(d, SIGNAL(mdeSessionOpened()), + this, SIGNAL(mdeSessionOpened())); + connect(d, SIGNAL(mdeSessionError(int)), + this, SIGNAL(mdeSessionError(int))); + connect(d, SIGNAL(queryComplete(QStringList, QStringList)), + this, SIGNAL(queryComplete(QStringList, QStringList))); + connect(d, SIGNAL(queryError(int)), + this, SIGNAL(queryError(int))); + connect(d, SIGNAL(notifyObjectChanged()), + this, SIGNAL(notifyObjectChanged())); + connect(mAudioPlayer, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)), + this, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int))); +} + +ToneFetcherEngine::~ToneFetcherEngine() +{ + delete d; +} + +void ToneFetcherEngine::getTone() +{ + d->QueryTones(); +} + +void ToneFetcherEngine::preview(const QString &file ) +{ + mAudioPlayer->SetAttr(file); + mAudioPlayer->Play(); +} + +bool ToneFetcherEngine::IsPlaying() +{ + mAudioPlayer->IsPlaying(); +} +//End of File diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone fetcher engine. + * + */ + +#ifndef TONEFETCHERENGINE_H +#define TONEFETCHERENGINE_H +#include +#include "toneselectionengine_p.h" +#include +class TonePreviewPrivate; +class ToneSelectionEnginePrivate; + +// CLASS DECLARATION +/** + * This class is used for interacting with platform based codes + * including fetching tones from MDE (Metadata Engine) and previewing tones + * using platform-dependant interface. + * + */ +class ToneFetcherEngine : public QObject +{ + Q_OBJECT + +public: + enum TMediaFileListAttribute { + // max media file size + EAttrFileSize = 0, + // ringing volume (TProfileRingingVolume from Profile.hrh) + EAttrVolume, + // ringing type, (TProfileRingingType from Profile.hrh) + EAttrRingingType, + // vibra on/off (Boolean) + EAttrVibra, + // 3D effect (TProfile3DToneEffect from ProfileInternal.hrh) + EAttr3DEffect, + // 3D echo (TProfile3DToneEcho from ProfileInternal.hrh) + EAttr3DEcho, + // excluded mime type text + EAttrExcludeMimeType, + // for file protection checking + EAttrAutomatedType, + // media file dialog title + EAttrTitle, + // excluded folder (see enum TFolderType) + EAttrExcludeFolder + }; + + enum State { + SessionConnected = 0, + SessionError + }; + + enum TPreviewEvent { + EAudioPreviewComplete, + EPreviewError + }; + explicit ToneFetcherEngine( QObject* parent = 0 ); + ~ToneFetcherEngine(); + /* + * search the tone using MDE, not including rom files. + */ + void getTone(); + + /* + * preview the tone + * @param file the absolute path of the file. + */ + void preview(const QString &file); + + bool IsPlaying(); +signals: + void mdeSessionOpened(); + void mdeSessionError(int error); + void queryComplete(const QStringList &nameList, const QStringList &uriList); + void queryError(int error); + void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId); + void notifyObjectChanged(); +private: + ToneSelectionEnginePrivate *d; + TonePreviewPrivate *mAudioPlayer; +}; +#endif diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tsrc/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/main.cpp Fri May 14 13:21:08 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: + * The main window file for tone service test + * + */ +#include "tonetestapp.h" + +#include +#include + +int main(int argc, char *argv[]) +{ + + QCoreApplication::setOrganizationName("Nokia"); + QCoreApplication::setApplicationName("ToneTestApp"); + + HbApplication app(argc, argv); + HbMainWindow mainWindow; + ToneTestApp *mainView = new ToneTestApp; + mainWindow.addView(mainView); + mainWindow.show(); + return app.exec(); +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tsrc/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/rom/rom.pri Fri May 14 13:21:08 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: +# Rom exports for tonetestapp +# + +symbian { + TONETESTAPP_IBY_DIR = $$section(PWD, ":", 1) + + exists(/epoc32/include/platform_paths.hrh) { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } else { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } + + BLD_INF_RULES.prj_exports += "$$TONETESTAPP_IBY_DIR/tonetestapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tonetestapp.iby)" + +} diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tsrc/rom/tonetestapp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/rom/tonetestapp.iby Fri May 14 13:21:08 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: +* +* Description: +* +*/ + +#ifndef __TONETESTAPP_IBY__ +#define __TONETESTAPP_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\tonetestapp.exe SHARED_LIB_DIR\tonetestapp.exe +HB_UPGRADABLE_APP_REG_RSC(tonetestapp) +S60_APP_RESOURCE(tonetestapp) + +#endif + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tsrc/tonetestapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.cpp Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The source file for tone service test. + * + */ +#include "tonetestapp.h" +#include +#include +#include +#include +#include +#include +#include + +ToneTestApp::ToneTestApp(QGraphicsItem *parent) : + HbView(parent), + mReq(0), + mResultEdit(0), + mErrorCodeEdit(0), + mErrorEdit(0) +{ + qDebug() << "ToneTestApp::ToneTestApp("; + createLayout(); +} + +ToneTestApp::~ToneTestApp() +{ + qDebug() << "ToneTestApp::~ToneTestApp"; + delete mReq; +} + +void ToneTestApp::handleOk(const QVariant &result) +{ + qDebug() << "ToneTestApp::handleOk"; + + if (!result.canConvert()) + { + mErrorEdit->setText("Corrupt result"); + } + else + { + mResultEdit->setText(result.value()); + qDebug() << "ToneTestApp::handleOk" << ": result=" << result.value(); + } + +} + +void ToneTestApp::handleError(int errorCode, const QString& errorMessage) +{ + qDebug() << "ToneTestApp::handleError" << ": errorCode=" << errorCode << ", msg:" << errorMessage; + mErrorEdit->setText(errorMessage); + mErrorCodeEdit->setText(QString::number(errorCode)); +} + +void ToneTestApp::createLayout() +{ + qDebug() << "ToneTestApp::createLayout"; + + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); + + if (layout) + { + QGraphicsLinearLayout *topLayout = new QGraphicsLinearLayout(Qt::Vertical); + + if (topLayout) + { + topLayout->addStretch(5); + + mResultEdit = new HbLineEdit; + HbLabel* label = new HbLabel("Result:"); + if (mResultEdit && label) + { + topLayout->addItem(label); + mResultEdit->setMaxRows(5); + topLayout->addItem(mResultEdit); + } + + mErrorCodeEdit = new HbLineEdit; + label = new HbLabel("Error code:"); + if (mErrorCodeEdit && label) + { + topLayout->addItem(label); + topLayout->addItem(mErrorCodeEdit); + } + + mErrorEdit = new HbLineEdit; + label = new HbLabel("Error description:"); + if (mErrorEdit && label) + { + topLayout->addItem(label); + mErrorEdit->setMaxRows(5); + topLayout->addItem(mErrorEdit); + } + + layout->addItem(topLayout); + layout->setStretchFactor(topLayout, 5); + } + + QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout(Qt::Vertical); + + if (bottomLayout) + { + bottomLayout->addStretch(); + HbPushButton* button = new HbPushButton("Fetch tone"); + if (button) + { + connect(button, SIGNAL(clicked()), this, SLOT(fetchTone())); + bottomLayout->addItem(button); + } + layout->addItem(bottomLayout); + } + + setLayout(layout); // Takes ownership of layout + } +} + +void ToneTestApp::fetchTone() +{ + qDebug() << "ToneTestApp::fetchSong START"; + + mResultEdit->setText(""); + mErrorEdit->setText(""); + mErrorCodeEdit->setText(""); + + if (!mReq) + { + mReq = mAppMgr.create("com.nokia.symbian.IToneFetch", "fetch()", true); + // XQServiceRequest snd("com.nokia.services.toneserviceprovider.tone", "queryTone()", true); + // QVariant retValue; + + /* bool res = snd.send(retValue); + if (!res) + { + int returnvalue = snd.latestError(); + mErrorEdit->setText(QString::number(returnvalue)); + // mRetValue->setText("send fail!"); + }*/ + + if (!mReq) + { + mErrorEdit->setText("Failed to create REQ"); + return; + } + else + { + connect(mReq, SIGNAL(requestOk(const QVariant&)), SLOT(handleOk(const QVariant&))); + connect(mReq, SIGNAL(requestError(int,const QString&)), SLOT(handleError(int,const QString&))); + } + } + + // Set arguments for request (application title) + QList args; + args << QVariant(QString("")); + mReq->setArguments(args); + + // Make the request + if (!mReq->send()) + { + mErrorEdit->setText("Failed to send REQ"); + } +} + diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tsrc/tonetestapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.h Fri May 14 13:21:08 2010 +0800 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * The header file for tone service test. + * + */ +#ifndef TONETESTAPP_H +#define TONETESTAPP_H + +#include +#include + +class XQApplicationManager; +class XQAiwRequest; +class HbLineEdit; + +class ToneTestApp : public HbView +{ + Q_OBJECT + +public: + ToneTestApp(QGraphicsItem *parent=0); + virtual ~ToneTestApp(); + +private slots: + void handleOk(const QVariant &result); + void handleError(int errorCode, const QString& errorMessage); + + void fetchTone(); + +private: + void createLayout(); + +private: + XQApplicationManager mAppMgr; + XQAiwRequest* mReq; + HbLineEdit* mResultEdit; + HbLineEdit* mErrorCodeEdit; + HbLineEdit* mErrorEdit; +}; + +#endif // TONETESTAPP_H diff -r 624337f114fe -r 36aa4756ee82 controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanelui/src/tonefetcher/tsrc/tonetestapp.pro Fri May 14 13:21:08 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: +# + +TEMPLATE = app +TARGET = tonetestapp + +CONFIG += hb +LIBS += -lxqservice -lxqserviceutil + + +HEADERS += tonetestapp.h +SOURCES += tonetestapp_reg.rss \ + main.cpp \ + tonetestapp.cpp +RESOURCES += +symbian { + include(rom/rom.pri) + TARGET.UID3 = 0x2002BCC9 + TARGET.CAPABILITY = ALL -TCB + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +} +