author | hgs |
Thu, 30 Sep 2010 16:15:53 +0800 | |
changeset 41 | ab0490982943 |
parent 33 | 0cfa53de576f |
permissions | -rw-r--r-- |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0"" |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include "cpprofilemodel_p.h" |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
19 |
#include "cpprofilemodel.h" |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
20 |
#include <cplogger.h> |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <e32base.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <QString> |
19 | 23 |
#include <QMap> |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
24 |
#include <MProfileEngineExtended2.h> |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <MProfileExtended.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <MProfileName.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <MProfileTones.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <MProfileSetTones.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include <MProfileExtraTones.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#include <MProfileSetExtraTones.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <MProfileExtraSettings.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include <MProfileSetExtraSettings.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include <MProfileFeedbackSettings.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include <MProfileSetFeedbackSettings.h> |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
35 |
#include <MProfilesNamesArray.h> |
41 | 36 |
#include <MProfileSetName.h> |
19 | 37 |
#include <settingsinternalcrkeys.h> |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
38 |
#include <hbglobal.h> |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
39 |
#include <QtCore/QStringList> |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
40 |
#include <MProfileExtended2.h> |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
41 |
#include <MProfileSetExtraTones2.h> |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
42 |
#include <MProfileExtraTones2.h> |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
43 |
#include <MProfileVibraSettings.h> |
19 | 44 |
#include <MProfileSetVibraSettings.h> |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
#include <TProfileToneSettings.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
#include <hwrmvibrasdkcrkeys.h> |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include <centralrepository.h> |
33 | 48 |
#include <XQConversions> |
49 |
#include <profile.hrh> |
|
50 |
/* |
|
51 |
* Constructor |
|
52 |
*/ |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
CpProfileModelPrivate::CpProfileModelPrivate() |
41 | 54 |
: mEngine(0), |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
55 |
q_ptr(0) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
{ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
57 |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
|
33 | 60 |
/* |
61 |
* Initialize the profile engine and available profile list for profile wrapper. |
|
62 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
63 |
void CpProfileModelPrivate::initialize(CpProfileModel *parent) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
{ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
65 |
q_ptr = parent; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
66 |
CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START."); |
33 | 67 |
TRAP_IGNORE( |
68 |
mEngine = CreateProfileEngineExtended2L(); |
|
69 |
/* |
|
70 |
* Currently, engine part will return all previous version of profile |
|
71 |
* so some invalid profile will be added in the new list, to avoid this |
|
72 |
* use hard code to get the right list of profile. |
|
73 |
*/ |
|
74 |
/*MProfilesNamesArray* nameList = mEngine->ProfilesNamesArrayLC(); |
|
75 |
int profileCount = nameList->MdcaCount(); |
|
76 |
for (int i = 0; i<profileCount; i++) { |
|
77 |
MProfileName *profileName = nameList->ProfileName(i); |
|
78 |
mProfileList.insert(profileName->Id(), mEngine->Profile2L(profileName->Id())); |
|
79 |
} |
|
80 |
CleanupStack::PopAndDestroy(*nameList);*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
81 |
); |
33 | 82 |
mProfileList.append(static_cast<int>(EProfileWrapperGeneralId)); // general id |
83 |
mProfileList.append(static_cast<int>(EProfileWrapperMeetingId)); // meeting id |
|
84 |
CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END"); |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
85 |
} |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
|
33 | 87 |
/* |
88 |
* Destructor |
|
89 |
*/ |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
CpProfileModelPrivate::~CpProfileModelPrivate() |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
{ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
92 |
if (mEngine!=0) { |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
93 |
mEngine->Release(); |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
94 |
} |
33 | 95 |
mProfileList.clear(); |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
97 |
|
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
/* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
* Get profile name with its id |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
*/ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
101 |
QString CpProfileModelPrivate::profileName(int profileId) const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
{ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
103 |
CPFW_LOG("CpProfileModelPrivate::profileName(), START."); |
33 | 104 |
// Return an empty string if id is not valid. |
105 |
if (!isValidProfile(profileId)) { |
|
106 |
return QString(); |
|
107 |
} |
|
41 | 108 |
QString profileName; |
109 |
QT_TRAP_THROWING( |
|
110 |
MProfile *profile = mEngine->Profile2L(profileId); |
|
111 |
const MProfileName &name = profile->ProfileName(); |
|
112 |
if (name.Name().Length() > 0) { |
|
113 |
profileName = XQConversions::s60DescToQString(name.Name()); |
|
114 |
} |
|
115 |
profile->Release(); |
|
116 |
) |
|
117 |
return profileName; |
|
33 | 118 |
|
41 | 119 |
} |
120 |
||
121 |
/* |
|
122 |
* Set profile name with \a profileId. |
|
123 |
*/ |
|
124 |
void CpProfileModelPrivate::setProfileName(int profileId, const QString &name) |
|
125 |
{ |
|
126 |
if(!isValidProfile(profileId)) { |
|
127 |
return; |
|
33 | 128 |
} |
41 | 129 |
HBufC *des = XQConversions::qStringToS60Desc( name ); |
130 |
QT_TRAP_THROWING( |
|
131 |
CleanupStack::PushL(des); |
|
132 |
MProfileExtended *profileExtend = mEngine->Profile2L(profileId); |
|
133 |
CleanupStack::PushL(profileExtend); |
|
134 |
MProfileSetName &profileSetName = profileExtend->ProfileSetName(); |
|
135 |
profileSetName.SetNameL(*des); |
|
136 |
mEngine ->CommitChangeL(*profileExtend); |
|
137 |
CleanupStack::Pop(2); // des, profileExtend |
|
138 |
profileExtend->Release(); |
|
139 |
) |
|
33 | 140 |
} |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
|
33 | 142 |
/* |
143 |
* Get available profiles' name list. |
|
144 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
145 |
QStringList CpProfileModelPrivate::profileNames() const |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
146 |
{ |
33 | 147 |
CPFW_LOG("CpProfileModelPrivate::profileNames(), START."); |
41 | 148 |
QStringList nameList; |
149 |
foreach(int profileId, mProfileList) { |
|
150 |
QT_TRAP_THROWING( |
|
151 |
MProfile *profile = mEngine->Profile2L(profileId); |
|
152 |
const MProfileName &name = profile->ProfileName(); |
|
153 |
if (name.Name().Length() > 0) { |
|
154 |
nameList.append(XQConversions::s60DescToQString(name.Name())); |
|
155 |
} |
|
156 |
profile->Release(); |
|
157 |
) |
|
33 | 158 |
} |
159 |
CPFW_LOG("CpProfileModelPrivate::profileNames(), END."); |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
160 |
return nameList; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
161 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
162 |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
|
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
/* |
33 | 165 |
* Activate a profile with its id, return the result. |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
*/ |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
int CpProfileModelPrivate::activateProfile(int profileId) |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
{ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
169 |
CPFW_LOG("CpProfileModelPrivate::activateProfile(), START."); |
33 | 170 |
// currently, only two profile remains: general and meeting, |
171 |
// But profile engine also support the old profile like: |
|
172 |
// silence, out ... |
|
173 |
// so filter the invalid profile id first. |
|
174 |
if (!isValidProfile(profileId)) { |
|
175 |
return KErrNotFound; |
|
176 |
} |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
TRAPD( err, |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
mEngine->SetActiveProfileL( profileId ); |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
); |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
180 |
CPFW_LOG("CpProfileModelPrivate::activateProfile(), END."); |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
return err; |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
|
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
/* |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
* Get active profile's id |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
*/ |
19 | 187 |
int CpProfileModelPrivate::activeProfileId() const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
{ |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
return mEngine->ActiveProfileId(); |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
|
33 | 192 |
/* |
193 |
* Return all profile settings according to profile's id |
|
194 |
*/ |
|
19 | 195 |
void CpProfileModelPrivate::profileSettings(int profileId, |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
196 |
CpProfileSettings& profileSettings) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
{ |
33 | 198 |
if (!isValidProfile(profileId)) { |
199 |
return; |
|
200 |
} |
|
201 |
QT_TRAP_THROWING( |
|
202 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
203 |
CleanupStack::PushL(profileExtend); |
|
204 |
||
205 |
const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
206 |
const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
|
207 |
const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
|
208 |
const MProfileVibraSettings &vibraSettings = |
|
209 |
profileExtend->ProfileVibraSettings(); |
|
210 |
const MProfileExtraSettings &extraSettings = |
|
211 |
profileExtend->ProfileExtraSettings(); |
|
212 |
const MProfileFeedbackSettings &feedbackSettings = |
|
213 |
extraSettings.ProfileFeedbackSettings(); |
|
214 |
||
215 |
profileSettings.mRingTone = XQConversions::s60DescToQString(setTones.RingingTone1()); |
|
216 |
profileSettings.mMessageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone()); |
|
217 |
profileSettings.mEmailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone()); |
|
218 |
profileSettings.mReminderTone = XQConversions::s60DescToQString(extTones.ReminderTone()); |
|
219 |
profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones; |
|
220 |
||
221 |
// only use Keypad Volume as a base value for display in key & touch screen setting option |
|
222 |
profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume; |
|
223 |
profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
|
224 |
CleanupStack::Pop(); // profileExtend |
|
225 |
profileExtend->Release(); |
|
226 |
); |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
227 |
} |
33 | 228 |
/* |
229 |
* set profile settings |
|
22 | 230 |
*/ |
33 | 231 |
void CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
232 |
{ |
33 | 233 |
if (!isValidProfile(profileId)) { |
234 |
return; |
|
235 |
} |
|
22 | 236 |
|
33 | 237 |
QT_TRAP_THROWING ( |
238 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
239 |
CleanupStack::PushL(profileExtend); |
|
240 |
||
241 |
MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
242 |
TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
|
243 |
MProfileSetExtraTones2 &setExtTones = |
|
244 |
profileExtend->ProfileSetExtraTones2(); |
|
245 |
MProfileSetVibraSettings &setVibraSettings = |
|
246 |
profileExtend->ProfileSetVibraSettings(); |
|
247 |
MProfileSetExtraSettings &extraSettings = |
|
248 |
profileExtend->ProfileSetExtraSettings(); |
|
249 |
MProfileSetFeedbackSettings &setFeedbackSettings = |
|
250 |
extraSettings.ProfileSetFeedbackSettings(); |
|
251 |
||
41 | 252 |
HBufC *setting = XQConversions::qStringToS60Desc(profileSettings.mRingTone); |
253 |
CleanupStack::PushL(setting); |
|
254 |
setTones.SetRingingTone1L(*setting); |
|
255 |
CleanupStack::PopAndDestroy(); |
|
33 | 256 |
|
41 | 257 |
setting = XQConversions::qStringToS60Desc(profileSettings.mMessageTone); |
258 |
CleanupStack::PushL(setting); |
|
259 |
setTones.SetMessageAlertToneL(*setting); |
|
260 |
CleanupStack::PopAndDestroy(); |
|
261 |
||
262 |
setting = XQConversions::qStringToS60Desc(profileSettings.mEmailTone); |
|
263 |
CleanupStack::PushL(setting); |
|
264 |
setExtTones.SetEmailAlertToneL(*setting); |
|
265 |
CleanupStack::PopAndDestroy(); |
|
266 |
||
267 |
setting = XQConversions::qStringToS60Desc(profileSettings.mReminderTone); |
|
268 |
CleanupStack::PushL(setting); |
|
269 |
setExtTones.SetReminderToneL(*setting); |
|
270 |
CleanupStack::PopAndDestroy(); |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
271 |
|
33 | 272 |
toneSettings.iWarningAndGameTones |
273 |
= profileSettings.mNotificationTone; |
|
274 |
// Change the keypad volume and touch screen tone together |
|
275 |
toneSettings.iKeypadVolume |
|
276 |
= static_cast<TProfileKeypadVolume> (profileSettings.mKeyTouchScreenTone); |
|
277 |
setFeedbackSettings.SetAudioFeedback( |
|
278 |
static_cast<TProfileAudioFeedback> (profileSettings.mKeyTouchScreenTone)); |
|
279 |
setFeedbackSettings.SetTactileFeedback( |
|
280 |
static_cast<TProfileTactileFeedback> (profileSettings.mKeyTouchScreenVibra)); |
|
281 |
||
282 |
mEngine->CommitChangeL(*profileExtend); |
|
283 |
CleanupStack::Pop(); // profileExtend |
|
19 | 284 |
) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
|
33 | 287 |
/* |
288 |
* Get the active profile's ring tone name |
|
289 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
290 |
QString CpProfileModelPrivate::ringTone() const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
{ |
33 | 292 |
// return empty string when active profile id is invalid, |
293 |
// some old application still set the profile which is not available now, |
|
294 |
// this check can be removed when every application use a correct profile id |
|
295 |
||
296 |
QString ringTone; |
|
297 |
if (!isValidProfile(activeProfileId())) { |
|
298 |
return ringTone; |
|
299 |
} |
|
300 |
QT_TRAP_THROWING( |
|
301 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(activeProfileId()); |
|
302 |
CleanupStack::PushL(profileExtend); |
|
303 |
const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
304 |
||
305 |
ringTone = XQConversions::s60DescToQString(setTones.RingingTone1()); |
|
306 |
CleanupStack::Pop(); // profileExtend |
|
307 |
profileExtend->Release(); |
|
308 |
) |
|
309 |
||
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
310 |
return ringTone; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
311 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
312 |
|
33 | 313 |
/* |
314 |
* Set the ring tone for all profiles |
|
315 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
316 |
void CpProfileModelPrivate::setRingTone(const QString& filePath) |
33 | 317 |
{ |
318 |
for (TInt i = 0; i < mProfileList.count(); ++i) { |
|
319 |
QT_TRAP_THROWING( |
|
320 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(mProfileList.at(i)); |
|
321 |
CleanupStack::PushL(profileExtend); |
|
322 |
||
323 |
MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
41 | 324 |
HBufC *ringTone = XQConversions::qStringToS60Desc(filePath); |
325 |
CleanupStack::PushL(ringTone); |
|
326 |
setTones.SetRingingTone1L( *ringTone ); |
|
33 | 327 |
mEngine ->CommitChangeL(*profileExtend); |
41 | 328 |
CleanupStack::PopAndDestroy(); |
33 | 329 |
CleanupStack::Pop(); // profileExtend |
330 |
profileExtend->Release(); |
|
331 |
) |
|
19 | 332 |
} |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
334 |
|
33 | 335 |
/* |
336 |
* Get the ringing volume value |
|
337 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
338 |
int CpProfileModelPrivate::masterVolume() const |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
339 |
{ |
19 | 340 |
int masterVolume = 0; |
33 | 341 |
QT_TRAP_THROWING(masterVolume = mEngine->MasterVolumeL();) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
342 |
return masterVolume; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
343 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
344 |
|
33 | 345 |
/* |
346 |
* Set the ringing volume |
|
347 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
348 |
void CpProfileModelPrivate::setMasterVolume(int volume) |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
349 |
{ |
33 | 350 |
// the volume range 1-10 |
351 |
if (volume >= EProfileRingingVolumeLevel1 && volume <= EProfileRingingVolumeLevel10) { |
|
352 |
QT_TRAP_THROWING(mEngine->SetMasterVolumeL( volume );) |
|
353 |
} |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
354 |
} |
33 | 355 |
/* |
356 |
* Get the master vibra's status |
|
357 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
358 |
bool CpProfileModelPrivate::masterVibra() const |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
359 |
{ |
19 | 360 |
bool masterVibra = false; |
33 | 361 |
QT_TRAP_THROWING(masterVibra = mEngine->MasterVibraL();) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
362 |
return masterVibra; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
363 |
} |
33 | 364 |
|
365 |
/* |
|
366 |
* Set master vibra's status |
|
367 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
368 |
void CpProfileModelPrivate::setMasterVibra(bool isVibra) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
{ |
33 | 370 |
QT_TRAP_THROWING(mEngine->SetMasterVibraL( isVibra );) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
371 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
372 |
|
33 | 373 |
/* |
374 |
* Get the status of silence mode. |
|
375 |
*/ |
|
19 | 376 |
bool CpProfileModelPrivate::silenceMode() const |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
377 |
{ |
19 | 378 |
bool isSlience = false; |
33 | 379 |
QT_TRAP_THROWING(isSlience = mEngine->SilenceModeL();) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
380 |
return isSlience; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
381 |
} |
33 | 382 |
|
383 |
/* |
|
384 |
* Set the status of silence mode |
|
385 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
386 |
void CpProfileModelPrivate::setSilenceMode(bool isSilence) |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
387 |
{ |
33 | 388 |
QT_TRAP_THROWING(mEngine->SetSilenceModeL( isSilence );) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
389 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
390 |
|
33 | 391 |
/* |
392 |
* Return the ring tone of a profile, if the profile id is invalid, always |
|
393 |
* return an empty string |
|
394 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
395 |
QString CpProfileModelPrivate::ringTone(int profileId) const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
396 |
{ |
33 | 397 |
QString ringTone; |
398 |
if(!isValidProfile(profileId)) { |
|
399 |
return ringTone; |
|
400 |
} |
|
401 |
QT_TRAP_THROWING( |
|
402 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
403 |
CleanupStack::PushL(profileExtend); |
|
404 |
||
405 |
const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
406 |
||
407 |
ringTone = XQConversions::s60DescToQString(setTones.RingingTone1()); |
|
408 |
CleanupStack::Pop(); // profileExtend |
|
409 |
profileExtend->Release(); |
|
410 |
) |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
411 |
return ringTone; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
412 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
413 |
|
33 | 414 |
/* |
415 |
* Set the ring tone for a profile, if the profile id is invalid, nothing happens |
|
416 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
417 |
void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
418 |
{ |
33 | 419 |
if(!isValidProfile(profileId)) { |
420 |
return; |
|
421 |
} |
|
422 |
QT_TRAP_THROWING( |
|
423 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
424 |
CleanupStack::PushL(profileExtend); |
|
425 |
||
426 |
MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
41 | 427 |
HBufC *ringTone = XQConversions::qStringToS60Desc(filePath); |
428 |
CleanupStack::PushL(ringTone); |
|
429 |
setTones.SetRingingTone1L(*ringTone); |
|
430 |
mEngine->CommitChangeL(*profileExtend); |
|
431 |
CleanupStack::PopAndDestroy(); //ringTone |
|
33 | 432 |
CleanupStack::Pop(); // profileExtend |
433 |
profileExtend->Release(); |
|
434 |
) |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
435 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
436 |
|
33 | 437 |
/* |
438 |
* Get the message tone of a profile, if the profile id is invalid, always return |
|
439 |
* an empty string |
|
440 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
441 |
QString CpProfileModelPrivate::messageTone(int profileId) const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
{ |
33 | 443 |
QString messageTone; |
444 |
if(!isValidProfile(profileId)) { |
|
445 |
return messageTone; |
|
446 |
} |
|
447 |
QT_TRAP_THROWING( |
|
448 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
449 |
CleanupStack::PushL(profileExtend); |
|
450 |
||
451 |
const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
452 |
||
453 |
messageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone()); |
|
454 |
CleanupStack::Pop(); // profileExtend |
|
455 |
profileExtend->Release(); |
|
456 |
) |
|
19 | 457 |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
458 |
return messageTone; |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
459 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
460 |
|
33 | 461 |
/* |
462 |
* Set the message tone of a profile, if the profile id is invalid, nothing happens |
|
463 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
464 |
void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
465 |
{ |
33 | 466 |
if(!isValidProfile(profileId)) { |
467 |
return; |
|
468 |
} |
|
469 |
QT_TRAP_THROWING( |
|
470 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
471 |
CleanupStack::PushL(profileExtend); |
|
472 |
MProfileSetTones &setTones = |
|
19 | 473 |
profileExtend->ProfileSetTones(); |
41 | 474 |
HBufC *messageTone = XQConversions::qStringToS60Desc(filePath); |
475 |
CleanupStack::PushL(messageTone); |
|
476 |
setTones.SetMessageAlertToneL(*messageTone); |
|
19 | 477 |
mEngine->CommitChangeL(*profileExtend); |
41 | 478 |
CleanupStack::PopAndDestroy();//messageTone |
33 | 479 |
CleanupStack::Pop(); // profileExtend |
480 |
profileExtend->Release(); |
|
481 |
) |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
482 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
483 |
|
33 | 484 |
/* |
485 |
* Get the email tone of a profile, if profile id is invalid, return an empty string |
|
486 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
487 |
QString CpProfileModelPrivate::emailTone(int profileId) const |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
488 |
{ |
33 | 489 |
QString emailTone; |
490 |
||
491 |
if(!isValidProfile(profileId)) { |
|
492 |
return emailTone; |
|
493 |
} |
|
494 |
QT_TRAP_THROWING( |
|
495 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
496 |
CleanupStack::PushL(profileExtend); |
|
497 |
const MProfileExtraTones2 &extTones = |
|
498 |
profileExtend->ProfileExtraTones2(); |
|
19 | 499 |
|
33 | 500 |
emailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone()); |
501 |
CleanupStack::Pop(); // profileExtend |
|
502 |
profileExtend->Release(); |
|
503 |
) |
|
504 |
return emailTone; |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
505 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
506 |
|
33 | 507 |
/* |
508 |
* Set the email tone for a profile, if the profile id is invalid, nothing happens |
|
509 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
510 |
void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
511 |
{ |
33 | 512 |
if(!isValidProfile(profileId)) { |
513 |
return ; |
|
514 |
} |
|
515 |
QT_TRAP_THROWING( |
|
516 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
517 |
CleanupStack::PushL(profileExtend); |
|
518 |
MProfileSetExtraTones2 &setExtTones = |
|
519 |
profileExtend->ProfileSetExtraTones2(); |
|
41 | 520 |
HBufC *emailTone = XQConversions::qStringToS60Desc(filePath); |
521 |
CleanupStack::PushL(emailTone); |
|
522 |
setExtTones.SetEmailAlertToneL(*emailTone); |
|
19 | 523 |
mEngine->CommitChangeL(*profileExtend); |
41 | 524 |
CleanupStack::PopAndDestroy();//emailtone; |
33 | 525 |
CleanupStack::Pop(); // profileExtend |
526 |
profileExtend->Release(); |
|
19 | 527 |
) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
528 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
529 |
|
33 | 530 |
/* |
531 |
* Get a reminder tone for a profile, if the profile id is invalid, |
|
532 |
* always return an emtpy string |
|
533 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
534 |
QString CpProfileModelPrivate::reminderTone(int profileId) const |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
535 |
{ |
33 | 536 |
QString reminderTone; |
537 |
if(!isValidProfile(profileId)) { |
|
538 |
return reminderTone; |
|
539 |
} |
|
540 |
QT_TRAP_THROWING( |
|
541 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
542 |
CleanupStack::PushL(profileExtend); |
|
543 |
const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
|
544 |
||
545 |
reminderTone = XQConversions::s60DescToQString(extTones.ReminderTone()); |
|
546 |
CleanupStack::Pop(); // profileExtend |
|
547 |
profileExtend->Release(); |
|
548 |
) |
|
19 | 549 |
return reminderTone; |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
550 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
551 |
|
33 | 552 |
/* |
553 |
* Set a reminder tone for a profile, if the profile id is invalid, |
|
554 |
* nothing happens |
|
555 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
556 |
void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
557 |
{ |
33 | 558 |
if(!isValidProfile(profileId)) { |
559 |
return; |
|
560 |
} |
|
561 |
QT_TRAP_THROWING( |
|
562 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
563 |
CleanupStack::PushL(profileExtend); |
|
564 |
||
565 |
MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
|
41 | 566 |
HBufC *reminderTone = XQConversions::qStringToS60Desc(filePath); |
567 |
CleanupStack::PushL(reminderTone); |
|
568 |
setExtTones.SetReminderToneL( *reminderTone ); |
|
33 | 569 |
mEngine->CommitChangeL(*profileExtend); |
41 | 570 |
CleanupStack::PopAndDestroy(); //reminderTone; |
33 | 571 |
CleanupStack::Pop(); // profileExtend |
572 |
profileExtend->Release(); |
|
19 | 573 |
) |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
574 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
575 |
|
33 | 576 |
/* |
577 |
* Get the status of notification tone, if the profile id is invalid, |
|
578 |
* always return false |
|
579 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
580 |
bool CpProfileModelPrivate::notificationTone(int profileId) const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
581 |
{ |
33 | 582 |
bool ret = false; |
583 |
if(!isValidProfile(profileId)) { |
|
584 |
return false; |
|
585 |
} |
|
586 |
QT_TRAP_THROWING( |
|
587 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
588 |
CleanupStack::PushL(profileExtend); |
|
589 |
||
590 |
const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
591 |
const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
|
592 |
ret = toneSettings.iWarningAndGameTones; |
|
593 |
||
594 |
CleanupStack::Pop(); // profileExtend |
|
595 |
profileExtend->Release(); |
|
596 |
) |
|
597 |
return ret; |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
598 |
} |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
599 |
|
33 | 600 |
/* |
601 |
* Set the status of notification tone, if the profile id is |
|
602 |
* invalid, nothing happens |
|
603 |
*/ |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
604 |
void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) |
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
605 |
{ |
33 | 606 |
if(!isValidProfile(profileId)) { |
607 |
return ; |
|
608 |
} |
|
609 |
QT_TRAP_THROWING( |
|
610 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
611 |
CleanupStack::PushL(profileExtend); |
|
612 |
MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
613 |
TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
614 |
|
33 | 615 |
toneSettings.iWarningAndGameTones = isActive; |
616 |
||
617 |
mEngine->CommitChangeL(*profileExtend); |
|
618 |
CleanupStack::Pop(); // profileExtend |
|
619 |
profileExtend->Release(); |
|
620 |
) |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
} |
33 | 622 |
/* |
623 |
* Get key & touch screen tone's value, if the profile id |
|
624 |
* is invalid, always return 0 |
|
22 | 625 |
*/ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
626 |
int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
627 |
{ |
33 | 628 |
int level = 0; |
629 |
if(!isValidProfile(profileId)) { |
|
630 |
return level; |
|
631 |
} |
|
19 | 632 |
|
33 | 633 |
QT_TRAP_THROWING( |
634 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
635 |
CleanupStack::PushL(profileExtend); |
|
19 | 636 |
|
33 | 637 |
const MProfileTones &setTones = profileExtend->ProfileTones(); |
638 |
const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
|
639 |
||
640 |
// Return only keypad volume, but touch tone volume will be synchronized in |
|
641 |
// SetKeyTouchScreenTone(), these two settings also have the same default value |
|
642 |
// in cenrep key |
|
643 |
level = toneSettings.iKeypadVolume; |
|
644 |
CleanupStack::Pop(); // profileExtend |
|
645 |
profileExtend->Release(); |
|
646 |
) |
|
647 |
return level; |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
648 |
} |
33 | 649 |
/* |
650 |
* set key & touch screen tone, if the profile id |
|
651 |
* is invalid, nothing happens |
|
22 | 652 |
*/ |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
653 |
void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) |
33 | 654 |
{ |
655 |
if(!isValidProfile(profileId)) { |
|
656 |
return ; |
|
657 |
} |
|
658 |
QT_TRAP_THROWING( |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
659 |
|
33 | 660 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
661 |
CleanupStack::PushL(profileExtend); |
|
662 |
MProfileSetTones &setTones = |
|
663 |
profileExtend->ProfileSetTones(); |
|
664 |
TProfileToneSettings &toneSettings = |
|
665 |
setTones.SetToneSettings(); |
|
666 |
||
667 |
MProfileSetExtraSettings &extraSettings = |
|
668 |
profileExtend->ProfileSetExtraSettings(); |
|
669 |
MProfileSetFeedbackSettings &setFeedbackSettings = |
|
670 |
extraSettings.ProfileSetFeedbackSettings(); |
|
671 |
||
672 |
// Update the key pad volume and touch tone volume together |
|
673 |
toneSettings.iKeypadVolume |
|
674 |
= static_cast<TProfileKeypadVolume> (level); |
|
675 |
||
676 |
setFeedbackSettings.SetAudioFeedback( |
|
677 |
static_cast<TProfileAudioFeedback> (level)); |
|
678 |
||
679 |
mEngine->CommitChangeL(*profileExtend); |
|
680 |
CleanupStack::Pop(); // profileExtend |
|
681 |
profileExtend->Release(); |
|
19 | 682 |
) |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
683 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
684 |
|
33 | 685 |
/* |
686 |
* Get key touch screen vibra's value of a profile, return 0 if the |
|
687 |
* profile id is invalid |
|
688 |
*/ |
|
689 |
int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
690 |
{ |
33 | 691 |
int level = 0; |
692 |
if(!isValidProfile(profileId)) { |
|
693 |
return level; |
|
694 |
} |
|
695 |
QT_TRAP_THROWING( |
|
696 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
697 |
CleanupStack::PushL(profileExtend); |
|
698 |
const MProfileExtraSettings &extraSettings = |
|
699 |
profileExtend->ProfileExtraSettings(); |
|
700 |
const MProfileFeedbackSettings &feedbackSettings = |
|
701 |
extraSettings.ProfileFeedbackSettings(); |
|
702 |
level = feedbackSettings.TactileFeedback(); |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
703 |
|
33 | 704 |
CleanupStack::Pop(); // profileExtend |
705 |
profileExtend->Release(); |
|
706 |
) |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
707 |
|
33 | 708 |
return level; |
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
709 |
} |
11
10d0dd0e43f1
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
710 |
|
33 | 711 |
/* |
712 |
* Set key & touch screen vibra for a profile, |
|
713 |
* if the profile id is invalid, nothing happens |
|
714 |
*/ |
|
715 |
void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
716 |
{ |
33 | 717 |
if(!isValidProfile(profileId)) { |
718 |
return ; |
|
12
624337f114fe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
11
diff
changeset
|
719 |
} |
33 | 720 |
QT_TRAP_THROWING( |
721 |
MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
722 |
CleanupStack::PushL(profileExtend); |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
723 |
|
33 | 724 |
MProfileSetExtraSettings &extraSettings = |
725 |
profileExtend->ProfileSetExtraSettings(); |
|
726 |
MProfileSetFeedbackSettings &setFeedbackSettings = |
|
727 |
extraSettings.ProfileSetFeedbackSettings(); |
|
728 |
setFeedbackSettings.SetTactileFeedback( |
|
729 |
static_cast<TProfileTactileFeedback> (level)); |
|
730 |
mEngine->CommitChangeL(*profileExtend); |
|
731 |
CleanupStack::Pop(); // profileExtend |
|
732 |
profileExtend->Release(); |
|
733 |
) |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
734 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
735 |
|
33 | 736 |
/* |
737 |
* Judge the profile is valid or not |
|
738 |
*/ |
|
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
739 |
|
33 | 740 |
bool CpProfileModelPrivate::isValidProfile(int profileId) const |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
741 |
{ |
33 | 742 |
return mProfileList.contains(profileId); |
10
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
743 |
} |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
744 |
|
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
745 |
// End of file |
0a74be98a8bc
Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
746 |
|
19 | 747 |