99
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#ifndef AFSTORAGE_H
|
|
18 |
#define AFSTORAGE_H
|
|
19 |
|
|
20 |
#define __E32SVR_H__
|
|
21 |
|
|
22 |
#include <e32std.h>
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <d32dbms.h> // RDbStoreDatabase
|
|
25 |
#include <s32file.h> // CFileStore & CPermanentFileStore
|
|
26 |
#include "afentry.h"
|
|
27 |
|
112
|
28 |
class CAfDatabaseCleaner;
|
|
29 |
|
99
|
30 |
class CAfStorage : public CBase
|
|
31 |
{
|
|
32 |
public:
|
|
33 |
~CAfStorage();
|
|
34 |
|
116
|
35 |
static CAfStorage* NewL(RFs& aSession);
|
|
36 |
|
|
37 |
void SaveActivityL(CAfEntry &aEntry);
|
99
|
38 |
|
116
|
39 |
void DeleteActivityL(CAfEntry &aEntry);
|
99
|
40 |
|
116
|
41 |
void DeleteActivitiesL(CAfEntry &aEntry);
|
99
|
42 |
|
116
|
43 |
void AllActivitiesL(RPointerArray<CAfEntry> &aDst, TInt aLimit);
|
99
|
44 |
|
116
|
45 |
void ActivitiesL(RPointerArray<CAfEntry> &aDst, TInt aAppId);
|
99
|
46 |
|
116
|
47 |
void ActivityL(RPointerArray<CAfEntry> &aDst, CAfEntry &aSrc);
|
99
|
48 |
|
|
49 |
RFs& Fs();
|
|
50 |
|
116
|
51 |
static void ThumbnailPathL(RBuf &aDst,
|
|
52 |
RFs& aFileSystem,
|
|
53 |
TInt aUid,
|
|
54 |
const TDesC &aActivityName,
|
|
55 |
TBool aPersistent);
|
99
|
56 |
|
116
|
57 |
static void StoragePathL(RBuf &aDst,
|
|
58 |
RFs& aFileSystem,
|
|
59 |
TBool aPersistent);
|
|
60 |
|
|
61 |
static void AppStoragePathL(RBuf &aDst,
|
|
62 |
RFs& aFileSystem,
|
|
63 |
TInt aUid,
|
|
64 |
TBool aPersistent);
|
99
|
65 |
private:
|
116
|
66 |
static HBufC8* Md5HexDigestL(const TDesC8 &aString);
|
99
|
67 |
|
|
68 |
private:
|
116
|
69 |
CAfStorage(RFs& aSession);
|
99
|
70 |
|
|
71 |
void ConstructL();
|
|
72 |
|
116
|
73 |
void CreateDbL(const TDesC& aDatabaseFile);
|
|
74 |
|
|
75 |
void OpenDbL(const TDesC& aDatabaseFile);
|
99
|
76 |
|
116
|
77 |
void VerifyDbL();
|
|
78 |
|
|
79 |
CDbColSet* ExpectedTableLC();
|
99
|
80 |
|
|
81 |
void CreateTableL();
|
|
82 |
|
116
|
83 |
void VerifyTableL();
|
|
84 |
|
99
|
85 |
void DeleteNonPersistentActivitiesL();
|
|
86 |
|
116
|
87 |
void GetActivitiesL(const TDesC& aDst);
|
99
|
88 |
|
116
|
89 |
HBufC* SelectRowLC(TInt aAppId, const TDesC& aActId) const;
|
99
|
90 |
|
116
|
91 |
HBufC* SelectRowsLC(TInt aAppId) const;
|
99
|
92 |
|
116
|
93 |
HBufC* DeleteRowLC(TInt aAppId, const TDesC& aActId) const;
|
99
|
94 |
|
116
|
95 |
HBufC* DeleteRowsLC(TInt aAppId) const;
|
99
|
96 |
|
116
|
97 |
HBufC* BuildQueryLC(const TDesC& aFormat, TInt aAppId, const TDesC& aActId) const;
|
99
|
98 |
|
116
|
99 |
void ActivitiesL(RPointerArray<CAfEntry>& aDst,
|
|
100 |
const TDesC& aQuery,
|
|
101 |
CAfEntry::AccessRights aRights,
|
|
102 |
TInt aLimit = 0,
|
|
103 |
TBool deserializeAllData = EFalse);
|
99
|
104 |
|
116
|
105 |
void ActivitiesL(RPointerArray<CAfEntry>& aDst,
|
|
106 |
RDbView& aQuery,
|
|
107 |
CAfEntry::AccessRights aRights,
|
|
108 |
TInt aLimit = 0,
|
|
109 |
TBool deserializeAllData = EFalse);
|
99
|
110 |
|
116
|
111 |
void GetActivityForUpdateL(RDbView& aQuery, TInt aAppId, const TDesC& aActId);
|
99
|
112 |
|
116
|
113 |
void ReadDataL(RBuf& aDst, RDbRowSet& aSrc, TInt aOffset) const;
|
99
|
114 |
|
116
|
115 |
void ExternalizeDataL(RDbRowSet &aDst,const CAfEntry & aSrc, TInt aOffset) const;
|
99
|
116 |
|
116
|
117 |
void InternalizeDataL(CAfEntry &aDst, RDbRowSet& aSrc, TInt aOffset) const;
|
99
|
118 |
|
112
|
119 |
public:
|
|
120 |
TBool InterruptCleanup();
|
|
121 |
void RequestCleanup();
|
|
122 |
|
99
|
123 |
private:
|
116
|
124 |
RFs& iFsSession;
|
|
125 |
RDbStoreDatabase iActDb;/** For database operations*/
|
|
126 |
CFileStore* iFileStore; /** For creating and opening database files */
|
|
127 |
CAfDatabaseCleaner *iDatabaseCleaner;
|
99
|
128 |
};
|
|
129 |
|
|
130 |
#endif //AFSTORAGE_H
|