equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <xqsettingsmanager.h> |
18 #include <XQSettingsManager> |
19 #include <xqcentralrepositoryutils.h> |
19 #include <XQCentralRepositoryUtils> |
20 #include <xqcentralrepositorysearchcriteria.h> |
20 #include <XQCentralRepositorySearchCriteria> |
21 #include <QList> |
21 #include <QList> |
22 |
22 |
23 #include "nmipsextendedsettingsmanager.h" |
23 #include "nmipsextendedsettingsmanager.h" |
24 #include "nmipssettingitems.h" |
24 #include "nmipssettingitems.h" |
25 #include "ipssettingkeys.h" |
25 #include "ipssettingkeys.h" |
32 */ |
32 */ |
33 |
33 |
34 // ======== MEMBER FUNCTIONS ======== |
34 // ======== MEMBER FUNCTIONS ======== |
35 |
35 |
36 /*! |
36 /*! |
37 Constructor |
37 Constructor |
38 Creates the NmIpsExtendedSettingsManagerfor loading and saving extended mailbox settings. |
38 Creates the NmIpsExtendedSettingsManagerfor loading and saving extended mailbox settings. |
39 \param mailboxId Mailbox identifier. |
39 \param mailboxId Mailbox identifier. |
40 */ |
40 */ |
41 NmIpsExtendedSettingsManager::NmIpsExtendedSettingsManager(const NmId &mailboxId) |
41 NmIpsExtendedSettingsManager::NmIpsExtendedSettingsManager(const NmId &mailboxId) |
42 : mMailboxId(mailboxId), mMailboxOffset(-1), mActiveProfileOffset(-1) |
42 : mMailboxId(mailboxId), mMailboxOffset(-1), mActiveProfileOffset(-1) |
52 NmIpsExtendedSettingsManager::~NmIpsExtendedSettingsManager() |
52 NmIpsExtendedSettingsManager::~NmIpsExtendedSettingsManager() |
53 { |
53 { |
54 delete mSettingsManager; |
54 delete mSettingsManager; |
55 } |
55 } |
56 |
56 |
57 /*! |
57 /*! |
58 Reads extended mailbox setting. |
58 Reads extended mailbox setting. |
59 \param settingItem SettingItem enum of the setting to return. |
59 \param settingItem SettingItem enum of the setting to return. |
60 \param QVariant SettingValue of the found setting value. |
60 \param QVariant SettingValue of the found setting value. |
61 \return bool <true> when the setting item was read, otherwise <false>. |
61 \return bool <true> when the setting item was read, otherwise <false>. |
62 */ |
62 */ |
114 break; |
114 break; |
115 } |
115 } |
116 } |
116 } |
117 return ret; |
117 return ret; |
118 } |
118 } |
119 |
119 |
120 /*! |
120 /*! |
121 Writes extended mailbox setting. |
121 Writes extended mailbox setting. |
122 \param settingItem SettingItem enum of the setting to replace. |
122 \param settingItem SettingItem enum of the setting to replace. |
123 \param settingValue QVariant of the new setting value. |
123 \param settingValue QVariant of the new setting value. |
124 \return bool <true> when the setting item was written, otherwise <false>. |
124 \return bool <true> when the setting item was written, otherwise <false>. |
125 */ |
125 */ |
127 const QVariant &settingValue) |
127 const QVariant &settingValue) |
128 { |
128 { |
129 return writeSettingToCenRep(mActiveProfileOffset, settingItem, settingValue); |
129 return writeSettingToCenRep(mActiveProfileOffset, settingItem, settingValue); |
130 } |
130 } |
131 |
131 |
132 /*! |
132 /*! |
133 |
133 Writes extended mailbox setting. |
|
134 \param profileMode profile to save the setting |
|
135 \param settingItem SettingItem enum of the setting to replace. |
|
136 \param settingValue QVariant of the new setting value. |
|
137 \return bool <true> when the setting item was written, otherwise <false>. |
134 */ |
138 */ |
135 bool NmIpsExtendedSettingsManager::writeSetting(int profileMode, |
139 bool NmIpsExtendedSettingsManager::writeSetting(int profileMode, |
136 IpsServices::SettingItem settingItem, const QVariant &settingValue) |
140 IpsServices::SettingItem settingItem, const QVariant &settingValue) |
137 { |
141 { |
138 quint32 profileOffset = convertToProfileOffset(profileMode); |
142 quint32 profileOffset = convertToProfileOffset(profileMode); |
162 } |
166 } |
163 } |
167 } |
164 } |
168 } |
165 |
169 |
166 /*! |
170 /*! |
167 |
171 Writes extended mailbox setting. |
|
172 \param pfileOffset offset for the profile |
|
173 \param settingItem SettingItem enum of the setting to replace. |
|
174 \param settingValue QVariant of the new setting value. |
|
175 \return bool <true> when the setting item was written, otherwise <false>. |
168 */ |
176 */ |
169 bool NmIpsExtendedSettingsManager::writeSettingToCenRep(qint32 profileOffset, |
177 bool NmIpsExtendedSettingsManager::writeSettingToCenRep(qint32 profileOffset, |
170 IpsServices::SettingItem settingItem, const QVariant &settingValue) |
178 IpsServices::SettingItem settingItem, const QVariant &settingValue) |
171 { |
179 { |
172 bool ret(profileOffset >= 0); |
180 bool ret(profileOffset >= 0); |
247 XQCentralRepositorySettingsKey settingKey(IpsServices::EmailMailboxSettingRepository, |
255 XQCentralRepositorySettingsKey settingKey(IpsServices::EmailMailboxSettingRepository, |
248 mMailboxOffset + key); |
256 mMailboxOffset + key); |
249 return mSettingsManager->writeItemValue(settingKey, value); |
257 return mSettingsManager->writeItemValue(settingKey, value); |
250 } |
258 } |
251 |
259 |
|
260 /*! |
|
261 Calculate CenRep offset for current mailbox |
|
262 */ |
252 void NmIpsExtendedSettingsManager::calculateMailboxOffset() |
263 void NmIpsExtendedSettingsManager::calculateMailboxOffset() |
253 { |
264 { |
254 // Find all the keys that match the criteria 0xZZZZZ000, where Z=don't care. |
265 // Find all the keys that match the criteria 0xZZZZZ000, where Z=don't care. |
255 // This will give us all the keys that hold the mailbox ids, e.g. 0x00001000, 0x00002000, etc. |
266 // This will give us all the keys that hold the mailbox ids, e.g. 0x00001000, 0x00002000, etc. |
256 quint32 partialKey(0x00000000); |
267 quint32 partialKey(0x00000000); |
279 QVariant activeProfile = readFromCenRep(IpsServices::EmailKeyReceptionActiveProfile); |
290 QVariant activeProfile = readFromCenRep(IpsServices::EmailKeyReceptionActiveProfile); |
280 mActiveProfileOffset = convertToProfileOffset(activeProfile.toInt()); |
291 mActiveProfileOffset = convertToProfileOffset(activeProfile.toInt()); |
281 } |
292 } |
282 |
293 |
283 /*! |
294 /*! |
284 |
295 Calculate the offset for profile |
|
296 \param profile profile id |
|
297 \return offset for the profile |
285 */ |
298 */ |
286 qint32 NmIpsExtendedSettingsManager::convertToProfileOffset(int profile) |
299 qint32 NmIpsExtendedSettingsManager::convertToProfileOffset(int profile) |
287 { |
300 { |
288 quint32 profileOffset(0); |
301 quint32 profileOffset(0); |
289 // Possible values are defined in ipssettingkeys.h |
302 // Possible values are defined in ipssettingkeys.h |