3
|
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: Juha Kauppinen, Mika Hokkanen
|
|
13 |
*
|
|
14 |
* Description: Photo Browser
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "FileSystemMonitorAO.h"
|
|
19 |
|
|
20 |
|
|
21 |
CFileSystemMonitorAO* CFileSystemMonitorAO::NewL(RFs& aFileServer, CIEImageFinder* aImageFinder)
|
|
22 |
{
|
|
23 |
CFileSystemMonitorAO* self = new(ELeave) CFileSystemMonitorAO(aFileServer, aImageFinder);
|
|
24 |
CleanupStack::PushL(self);
|
|
25 |
self->ConstructL();
|
|
26 |
CleanupStack::Pop();
|
|
27 |
return self;
|
|
28 |
}
|
|
29 |
|
|
30 |
CFileSystemMonitorAO* CFileSystemMonitorAO::NewLC(RFs& aFileServer, CIEImageFinder* aImageFinder)
|
|
31 |
{
|
|
32 |
CFileSystemMonitorAO* self = new(ELeave) CFileSystemMonitorAO(aFileServer, aImageFinder);
|
|
33 |
CleanupStack::PushL( self );
|
|
34 |
self->ConstructL();
|
|
35 |
return self;
|
|
36 |
}
|
|
37 |
|
|
38 |
|
|
39 |
CFileSystemMonitorAO::CFileSystemMonitorAO(RFs& aFileServer, CIEImageFinder* aImageFinder) :
|
|
40 |
CActive(CActive::EPriorityLow),
|
|
41 |
iFileServer(aFileServer),
|
|
42 |
iImageFinder(aImageFinder)
|
|
43 |
{
|
|
44 |
CActiveScheduler::Add(this);
|
|
45 |
}
|
|
46 |
|
|
47 |
void CFileSystemMonitorAO::ConstructL()
|
|
48 |
{
|
|
49 |
//StartMonitoring();
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
CFileSystemMonitorAO::~CFileSystemMonitorAO()
|
|
54 |
{
|
|
55 |
Cancel();
|
|
56 |
}
|
|
57 |
|
|
58 |
void CFileSystemMonitorAO::RunL()
|
|
59 |
{
|
|
60 |
iImageFinder->FileSystemChanged();
|
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
void CFileSystemMonitorAO::DoCancel()
|
|
65 |
{
|
|
66 |
if(IsActive())
|
|
67 |
Cancel();
|
|
68 |
|
|
69 |
iFileServer.NotifyChangeCancel(iStatus);
|
|
70 |
}
|
|
71 |
|
|
72 |
|
|
73 |
void CFileSystemMonitorAO::RunError()
|
|
74 |
{
|
|
75 |
// Nothing here
|
|
76 |
}
|
|
77 |
|
|
78 |
//This name should be changed to IssueActiveRequest()
|
|
79 |
//This is more meaningful...
|
|
80 |
void CFileSystemMonitorAO::StartMonitoring()
|
|
81 |
{//ENotifyEntry, ENotifyFile
|
|
82 |
#ifdef __WINS__
|
|
83 |
iFileServer.NotifyChange(ENotifyEntry, iStatus, KRootImagePath);
|
|
84 |
#else
|
|
85 |
TFileName rootPath = PathInfo::MemoryCardRootPath();
|
|
86 |
rootPath.Append(ImagePath);
|
|
87 |
iFileServer.NotifyChange(ENotifyFile, iStatus, rootPath);
|
|
88 |
#endif
|
|
89 |
|
|
90 |
SetActive();
|
|
91 |
}
|
|
92 |
|
|
93 |
void CFileSystemMonitorAO::StopMonitoring()
|
|
94 |
{
|
|
95 |
iFileServer.NotifyChangeCancel();
|
|
96 |
}
|
|
97 |
|
|
98 |
|