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