equal
deleted
inserted
replaced
17 #include "afstorage.h" |
17 #include "afstorage.h" |
18 #include <bautils.h> |
18 #include <bautils.h> |
19 #include <hash.h> |
19 #include <hash.h> |
20 #include <s32mem.h> |
20 #include <s32mem.h> |
21 |
21 |
|
22 #include "afdatabasecleaner.h" |
22 #include "afqueries.h" |
23 #include "afqueries.h" |
23 #include "afentry.h" |
24 #include "afentry.h" |
24 |
25 |
25 _LIT(KDbName, "activity.db"); |
26 _LIT(KDbName, "activity.db"); |
26 _LIT(KDbDrive, "c:"); |
27 _LIT(KDbDrive, "c:"); |
47 /** |
48 /** |
48 * Destructor. |
49 * Destructor. |
49 */ |
50 */ |
50 CAfStorage::~CAfStorage() |
51 CAfStorage::~CAfStorage() |
51 { |
52 { |
|
53 delete mDatabaseCleaner; |
52 mActDb.Close(); |
54 mActDb.Close(); |
53 delete mFileStore; |
55 delete mFileStore; |
54 } |
56 } |
55 |
57 |
56 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
81 path.Insert(0, KDbDrive); |
83 path.Insert(0, KDbDrive); |
82 BaflUtils::EnsurePathExistsL(mFsSession, path); |
84 BaflUtils::EnsurePathExistsL(mFsSession, path); |
83 BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path); |
85 BaflUtils::FileExists(mFsSession, path) ? OpenDbL(path) : CreateDbL(path); |
84 CleanupStack::PopAndDestroy(&path); |
86 CleanupStack::PopAndDestroy(&path); |
85 |
87 |
|
88 mDatabaseCleaner = new (ELeave) CAfDatabaseCleaner(mActDb); |
|
89 |
86 DeleteNonPersistentActivitiesL(); |
90 DeleteNonPersistentActivitiesL(); |
|
91 RequestCleanup(); |
87 } |
92 } |
88 |
93 |
89 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
90 /** |
95 /** |
91 * Create database and its structure |
96 * Create database and its structure |
657 bufPtr.AppendFormat(KMd5HexFormat,hashedSig[i]); |
662 bufPtr.AppendFormat(KMd5HexFormat,hashedSig[i]); |
658 } |
663 } |
659 CleanupStack::PopAndDestroy(md5); |
664 CleanupStack::PopAndDestroy(md5); |
660 return buf; |
665 return buf; |
661 } |
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 /** |
|
670 * Cancel ongoing cleanup if one is in progress. |
|
671 * @return ETrue if the database cleanup was in progress, EFalse otherwise |
|
672 */ |
|
673 TBool CAfStorage::InterruptCleanup() |
|
674 { |
|
675 if (mDatabaseCleaner->IsActive()) { |
|
676 mDatabaseCleaner->Cancel(); |
|
677 return ETrue; |
|
678 } else { |
|
679 return EFalse; |
|
680 } |
|
681 } |
|
682 |
|
683 // ----------------------------------------------------------------------------- |
|
684 /** |
|
685 * Start database cleanup |
|
686 */ |
|
687 void CAfStorage::RequestCleanup() |
|
688 { |
|
689 mDatabaseCleaner->StartCleanup(); |
|
690 } |