author | Sebastian Brannstrom <sebastianb@symbian.org> |
Tue, 16 Nov 2010 10:39:20 +0000 | |
branch | symbian1 |
changeset 364 | 998e9d114bd5 |
parent 349 | 4538abb763e4 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef SETTINGSENGINE_H_ |
|
20 |
#define SETTINGSENGINE_H_ |
|
21 |
||
22 |
#include <e32base.h> |
|
23 |
#include "PodcastModel.h" |
|
24 |
||
25 |
_LIT(KPodcastDir1, "F:\\Podcasts\\"); // memory card on phone with flash disk |
|
26 |
_LIT(KPodcastDir2, "E:\\Podcasts\\"); // memory card on phone without flash disk |
|
27 |
_LIT(KPodcastDir3, "C:\\Podcasts\\"); |
|
28 |
||
29 |
_LIT(KConfigImportFile, "config.cfg"); |
|
30 |
_LIT(KDefaultFeedsFile, "defaultfeeds.xml"); |
|
31 |
_LIT(KImportFeedsFile, "feeds.xml"); |
|
32 |
||
33 |
_LIT(KConfigFile, "config.db"); |
|
34 |
||
35 |
// constants |
|
36 |
const TInt KSettingsUid = 1000; |
|
37 |
const TInt KDefaultUpdateFeedInterval = 60; |
|
38 |
const TInt KDefaultMaxListItems = 100; |
|
39 |
const TInt32 KUseIAPFlag =0x01000000; |
|
40 |
const TInt32 KUseIAPMask =0x00FFFFFF; |
|
41 |
||
42 |
enum TAutoUpdateSetting |
|
43 |
{ |
|
44 |
EAutoUpdateOff, |
|
45 |
EAutoUpdatePeriod1=60, |
|
46 |
EAutoUpdatePeriod2=360, |
|
47 |
EAutoUpdatePeriod3=720, |
|
48 |
EAutoUpdatePeriod4=1440 |
|
49 |
}; |
|
50 |
||
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
51 |
enum TAutoDeleteSetting |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
52 |
{ |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
53 |
EAutoDeleteOff, |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
54 |
EAutoDeleteAfter1Day, |
364
998e9d114bd5
Sync with symbian3 branch
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
349
diff
changeset
|
55 |
EAutoDeleteAfter7Days |
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
56 |
}; |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
57 |
|
2 | 58 |
class CSettingsEngine : public CBase |
59 |
{ |
|
60 |
public: |
|
61 |
static CSettingsEngine* NewL(CPodcastModel& aPodcastModel); |
|
62 |
virtual ~CSettingsEngine(); |
|
63 |
||
64 |
||
65 |
TFileName DefaultFeedsFileName(); |
|
66 |
TFileName ImportFeedsFileName(); |
|
67 |
TFileName PrivatePath(); |
|
68 |
||
69 |
TInt MaxListItems(); |
|
70 |
||
71 |
IMPORT_C TFileName& BaseDir(); |
|
72 |
IMPORT_C void SetBaseDir(TFileName& aFileName); |
|
73 |
||
74 |
IMPORT_C TInt UpdateFeedInterval(); |
|
75 |
IMPORT_C void SetUpdateFeedInterval(TInt aInterval); |
|
76 |
||
77 |
IMPORT_C TInt MaxSimultaneousDownloads(); |
|
78 |
IMPORT_C void SetMaxSimultaneousDownloads(TInt aMaxDownloads); |
|
79 |
||
80 |
IMPORT_C TAutoUpdateSetting UpdateAutomatically(); |
|
81 |
IMPORT_C void SetUpdateAutomatically(TAutoUpdateSetting aAutoOn); |
|
82 |
||
83 |
IMPORT_C TBool DownloadAutomatically(); |
|
84 |
IMPORT_C void SetDownloadAutomatically(TBool aAutoDownloadOn); |
|
85 |
||
86 |
IMPORT_C TBool DownloadSuspended(); |
|
87 |
IMPORT_C void SetDownloadSuspended(TBool aSuspended); |
|
88 |
||
89 |
IMPORT_C TTime UpdateFeedTime(); |
|
90 |
IMPORT_C void SetUpdateFeedTime(TTime aTime); |
|
91 |
||
92 |
IMPORT_C TInt SpecificIAP(); |
|
93 |
IMPORT_C void SetSpecificIAP(TInt aIap); |
|
94 |
||
95 |
IMPORT_C void SaveSettingsL(); |
|
96 |
||
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
97 |
IMPORT_C TAutoDeleteSetting DeleteAutomatically(); |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
98 |
IMPORT_C void SetDeleteAutomatically(TAutoDeleteSetting aAutoDeleteOn); |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
99 |
|
2 | 100 |
private: |
101 |
CSettingsEngine(CPodcastModel& aPodcastModel); |
|
102 |
void ConstructL(); |
|
103 |
void LoadSettingsL(); |
|
104 |
void GetDefaultBaseDirL(TDes &aBaseDir); |
|
105 |
||
106 |
||
107 |
private: |
|
108 |
// the settings we serialize |
|
109 |
TFileName iBaseDir; |
|
110 |
TInt iUpdateFeedInterval; |
|
111 |
TAutoUpdateSetting iUpdateAutomatically; |
|
112 |
TBool iDownloadAutomatically; |
|
113 |
TInt iIap; |
|
114 |
TInt iMaxListItems; |
|
115 |
TTime iUpdateFeedTime; |
|
116 |
TBool iDownloadSuspended; |
|
349
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
117 |
TAutoDeleteSetting iDeleteAutomatically; |
4538abb763e4
Added auto delete feature
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
2
diff
changeset
|
118 |
|
2 | 119 |
// Other member variables |
120 |
CPodcastModel &iPodcastModel; // reference to the model |
|
121 |
}; |
|
122 |
||
123 |
#endif /*SETTINGSENGINE_H_*/ |