Update contrib.
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <caf/manager.h>
20 #include <caf/agentinterface.h>
21 #include <caf/agent.h>
22 #include "agentinfo.h"
23 #include <caf/agentfactory.h>
24 #include <caf/attributeset.h>
25 #include <caf/caftypes.h>
26 #include <caf/caferr.h>
27 #include <caf/virtualpath.h>
28 #include <caf/dirstreamable.h>
29 #include <caf/rightsmanager.h>
30 #include <caf/cafpanic.h>
33 using namespace ContentAccess;
35 EXPORT_C CManager* CManager::NewL()
37 CManager* self = CManager::NewLC();
38 CleanupStack::Pop(self);
42 EXPORT_C CManager* CManager::NewLC()
44 CManager* self = new (ELeave) CManager;
45 CleanupStack::PushL(self);
59 void CManager::ConstructL()
61 iResolver = CAgentResolver::NewL(EFalse);
64 EXPORT_C TInt CManager::DeleteFile(const TDesC &aFileName) const
66 TRAPD(err, DoDeleteFileL(aFileName));
70 void CManager::DoDeleteFileL(const TDesC &aFileName) const
72 TFileName actualFileName;
74 // initalise a pointer to the relevant CAgentManager object
75 // iResolver retains ownership of the pointer
76 CAgentInfo& agentInfo = iResolver->ResolveFileL(aFileName, actualFileName, EContentShareReadOnly);
78 User::LeaveIfError(agentInfo.AgentManagerL().DeleteFile(actualFileName));
81 EXPORT_C TInt CManager::CopyFile(RFile& aSourceFile, const TDesC &aDestination) const
83 TRAPD(err, DoCopyFileL(aSourceFile, aDestination));
87 void CManager::DoCopyFileL(RFile& aSourceFile, const TDesC &aDestination) const
89 TFileName actualDestination;
90 TBool thePrivateDir = EFalse;
91 TUid agentUid = KNullUid;
93 // Find out which agent owns the directory where the destination file lives
94 TUid destinationAgentUid = iResolver->ResolveDirectory(aDestination, actualDestination, thePrivateDir);
96 if(destinationAgentUid != iResolver->DefaultAgentUid())
98 // Destination file is in an agent private directory
99 // Use destination agent to copy
100 agentUid = destinationAgentUid;
104 // Use RFile version of ResolveFileL to find the Agent Uid
105 agentUid = iResolver->ResolveFileL(aSourceFile).Agent().ImplementationUid();
108 // If creating the appropriate CAgentManager succeeded ask the agent to copy the file
109 User::LeaveIfError(iResolver->AgentInfoL(agentUid).AgentManagerL().CopyFile(aSourceFile, actualDestination));
112 EXPORT_C TInt CManager::CopyFile(const TDesC &aSource, const TDesC &aDestination) const
114 TRAPD(err, DoCopyFileL(aSource, aDestination));
118 void CManager::DoCopyFileL(const TDesC &aSource, const TDesC &aDestination) const
120 TFileName actualSource;
121 TFileName actualDestination;
122 TBool thePrivateDir = EFalse;
123 TUid agentUid = KNullUid;
125 // Find out which agent owns the directory where the source file lives
126 TUid sourceAgentUid = iResolver->ResolveDirectory(aSource, actualSource, thePrivateDir);
128 // Find out which agent owns the directory where the destination file lives
129 TUid destinationAgentUid = iResolver->ResolveDirectory(aDestination, actualDestination, thePrivateDir);
131 if(sourceAgentUid != iResolver->DefaultAgentUid())
133 // Source file is in an agent private directory
134 // Use source agent to copy
135 agentUid = sourceAgentUid;
137 else if(destinationAgentUid != iResolver->DefaultAgentUid())
139 // Destination file is in an agent private directory
140 // Use destination agent to copy
141 agentUid = destinationAgentUid;
145 // Source and destination are in publicly accessable directories
146 agentUid = iResolver->ResolveFileL(aSource, actualSource, EContentShareReadOnly).Agent().ImplementationUid();
149 // If creating the appropriate CAgentManager succeeded ask the agent to copy the file
150 User::LeaveIfError(iResolver->AgentInfoL(agentUid).AgentManagerL().CopyFile(actualSource, actualDestination));
153 EXPORT_C TInt CManager::RenameFile(const TDesC& aSource, const TDesC& aDestination) const
155 TRAPD(err, DoRenameFileL(aSource, aDestination));
159 void CManager::DoRenameFileL(const TDesC& aSource, const TDesC& aDestination) const
161 TFileName actualSource;
162 TFileName actualDestination;
163 TBool thePrivateDir = EFalse;
164 TUid agentUid = KNullUid;
166 // Find out which agent owns the directory where the source file lives
167 TUid sourceAgentUid = iResolver->ResolveDirectory(aSource, actualSource, thePrivateDir);
169 // Find out which agent owns the directory where the destination file lives
170 TUid destinationAgentUid = iResolver->ResolveDirectory(aDestination, actualDestination, thePrivateDir);
172 if(sourceAgentUid != iResolver->DefaultAgentUid())
174 // Source file is in an agent private directory
175 // Use source agent to copy
176 agentUid = sourceAgentUid;
178 else if(destinationAgentUid != iResolver->DefaultAgentUid())
180 // Destination file is in an agent private directory
181 // Use destination agent to copy
182 agentUid = destinationAgentUid;
186 // Source and destination are in publicly accessable directories
187 agentUid = iResolver->ResolveFileL(aSource, actualSource, EContentShareReadOnly).Agent().ImplementationUid();
190 // Ask the agent to move or rename the file
191 User::LeaveIfError(iResolver->AgentInfoL(agentUid).AgentManagerL().RenameFile(actualSource, actualDestination));
194 EXPORT_C TInt CManager::MkDir(const TDesC &aPath) const
196 TRAPD(err, DoMkDirL(aPath));
201 void CManager::DoMkDirL(const TDesC &aPath) const
203 TBool isThePrivateDir = EFalse;
204 TFileName actualPath;
206 // Figure out which agent handles the directory
207 TUid uid = iResolver->ResolveDirectory(aPath, actualPath, isThePrivateDir);
209 User::LeaveIfError(iResolver->AgentInfoL(uid).AgentManagerL().MkDir(actualPath));
212 EXPORT_C TInt CManager::MkDirAll (const TDesC &aPath) const
214 TRAPD(err, DoMkDirAllL(aPath));
218 void CManager::DoMkDirAllL(const TDesC &aPath) const
220 TBool isThePrivateDir = EFalse;
221 TFileName actualPath;
223 // Figure out which agent handles the directory
224 TUid uid = iResolver->ResolveDirectory(aPath, actualPath, isThePrivateDir);
226 User::LeaveIfError(iResolver->AgentInfoL(uid).AgentManagerL().MkDirAll(actualPath));
229 EXPORT_C TInt CManager::RmDir(const TDesC &aPath) const
231 TRAPD(err, DoRmDirL(aPath));
235 void CManager::DoRmDirL(const TDesC &aPath) const
237 TBool isThePrivateDir = EFalse;
238 TFileName actualPath;
240 // Figure out which agent handles the directory
241 TUid uid = iResolver->ResolveDirectory(aPath, actualPath, isThePrivateDir);
245 User::Leave(KErrAccessDenied);
249 User::LeaveIfError(iResolver->AgentInfoL(uid).AgentManagerL().RmDir(actualPath));
253 EXPORT_C TInt CManager::RenameDir(const TDesC& aOldName, const TDesC& aNewName) const
255 TRAPD(err, DoRenameDirL(aOldName, aNewName));
259 void CManager::DoRenameDirL(const TDesC &aOldName, const TDesC& aNewName) const
262 TPath actualDestination;
263 TBool thePrivateDir = EFalse;
264 TUid agentUid = iResolver->DefaultAgentUid();
266 // Find out which agent owns the directory where the source file lives
267 TUid sourceAgentUid = iResolver->ResolveDirectory(aOldName, actualSource, thePrivateDir);
269 // Find out which agent owns the directory where the destination file lives
270 TUid destinationAgentUid = iResolver->ResolveDirectory(aNewName, actualDestination, thePrivateDir);
272 if(sourceAgentUid != iResolver->DefaultAgentUid())
274 // Source file is in an agent private directory
275 // Use source agent to copy
276 agentUid = sourceAgentUid;
278 else if(destinationAgentUid != iResolver->DefaultAgentUid())
280 // Destination file is in an agent private directory
281 // Use destination agent to copy
282 agentUid = destinationAgentUid;
285 // Ask the agent to move or rename the file
286 User::LeaveIfError(iResolver->AgentInfoL(agentUid).AgentManagerL().RenameDir(actualSource, actualDestination));
290 EXPORT_C TInt CManager::GetDir(const TDesC &aName, TUint aEntryAttMask, TUint aEntrySortKey, CDir *&aEntryList) const
292 TRAPD(err, DoGetDirL(aName, aEntryAttMask, aEntrySortKey, aEntryList));
296 void CManager::DoGetDirL(const TDesC &aName, TUint aEntryAttMask, TUint aEntrySortKey, CDir *&aEntryList) const
298 TBool isThePrivateDir = EFalse;
299 TFileName actualPath;
301 // Figure out which agent handles the directory
302 TUid uid = iResolver->ResolveDirectory(aName, actualPath, isThePrivateDir);
306 // If we are doing GetDir of C:\\private\\ just create an empty CDirStreamable
307 aEntryList = CDirStreamable::NewL();
311 User::LeaveIfError(iResolver->AgentInfoL(uid).AgentManagerL().GetDir(actualPath, aEntryAttMask, aEntrySortKey, aEntryList));
315 EXPORT_C TInt CManager::GetDir(const TDesC &aName, TUint aEntryAttMask, TUint aEntrySortKey, CDir *&aEntryList, CDir *&aDirList) const
317 TRAPD(err, DoGetDirL(aName, aEntryAttMask, aEntrySortKey, aEntryList, aDirList));
321 void CManager::DoGetDirL(const TDesC &aName, TUint aEntryAttMask, TUint aEntrySortKey, CDir *&aEntryList, CDir *&aDirList) const
323 TBool isThePrivateDir = EFalse;
324 TFileName actualPath;
327 // Figure out which agent handles the directory
328 TUid uid = iResolver->ResolveDirectory(aName, actualPath, isThePrivateDir);
332 // If we are doing GetDir of C:\\private\\ just create an empty entryList
333 emptyDirList = CDirStreamable::NewL();
334 CleanupStack::PushL(emptyDirList);
336 GetListOfAgentPrivateDirectoriesL(aDirList);
338 CleanupStack::Pop(emptyDirList);
339 aEntryList = emptyDirList;
343 User::LeaveIfError(iResolver->AgentInfoL(uid).AgentManagerL().GetDir(actualPath, aEntryAttMask, aEntrySortKey, aEntryList, aDirList));
347 EXPORT_C TInt CManager::GetDir(const TDesC &aName, const TUidType &aEntryUid, TUint aEntrySortKey, CDir *&aFileList) const
349 TRAPD(err, DoGetDirL(aName, aEntryUid, aEntrySortKey, aFileList));
353 void CManager::DoGetDirL(const TDesC &aName, const TUidType &aEntryUid, TUint aEntrySortKey, CDir *&aFileList) const
355 TBool isThePrivateDir = EFalse;
356 TFileName actualPath;
358 // Figure out which agent handles the directory
359 TUid uid = iResolver->ResolveDirectory(aName, actualPath, isThePrivateDir);
363 // We've been asked to look at C:\\private\\ just return an empty CDirStreamable
364 aFileList = CDirStreamable::NewL();
368 User::LeaveIfError(iResolver->AgentInfoL(uid).AgentManagerL().GetDir(actualPath, aEntryUid, aEntrySortKey, aFileList));
372 EXPORT_C TInt CManager::GetAttribute(TInt aAttribute, TInt& aValue, const TVirtualPathPtr& aVirtualPath) const
374 TRAPD(err, DoGetAttributeL(aAttribute, aValue, aVirtualPath));
378 void CManager::DoGetAttributeL(TInt aAttribute, TInt& aValue, const TVirtualPathPtr& aVirtualPath) const
380 HBufC* uriBuffer = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
381 TPtr uri = uriBuffer->Des();
383 // Find the agent who handles the file
384 CAgentInfo& agentInfo = iResolver->ResolveFileL(aVirtualPath.URI(),uri, EContentShareReadOnly);
385 User::LeaveIfError(agentInfo.AgentManagerL().GetAttribute(aAttribute, aValue, TVirtualPathPtr(uri, aVirtualPath.UniqueId())));
386 CleanupStack::PopAndDestroy(uriBuffer);
389 EXPORT_C TInt CManager::GetAttribute(TInt aAttribute, TInt& aValue, RFile& aFile, const TDesC& aUniqueId)
391 TRAPD(err, DoGetAttributeL(aAttribute, aValue, aFile, aUniqueId));
395 void CManager::DoGetAttributeL(TInt aAttribute, TInt& aValue, RFile& aFile, const TDesC& aUniqueId) const
397 // Find the agent who handles the file
398 CAgentInfo& agentInfo = iResolver->ResolveFileL(aFile);
399 User::LeaveIfError(agentInfo.AgentManagerL().GetAttribute(aAttribute, aValue, aFile, aUniqueId));
403 EXPORT_C TInt CManager::GetStringAttribute(TInt aAttribute, TDes& aValue, const TVirtualPathPtr& aVirtualPath) const
405 TRAPD(err, DoGetStringAttributeL(aAttribute, aValue, aVirtualPath));
409 void CManager::DoGetStringAttributeL(TInt aAttribute, TDes& aValue, const TVirtualPathPtr& aVirtualPath) const
411 HBufC* uriBuffer = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
412 TPtr uri = uriBuffer->Des();
415 // Find the agent who handles the file
416 CAgentInfo& agentInfo = iResolver->ResolveFileL(aVirtualPath.URI(), uri, EContentShareReadOnly);
418 // find out the attribute
419 User::LeaveIfError(agentInfo.AgentManagerL().GetStringAttribute(aAttribute, aValue, TVirtualPathPtr(uri,aVirtualPath.UniqueId())));
420 CleanupStack::PopAndDestroy(uriBuffer);
423 EXPORT_C TInt CManager::GetStringAttribute (TInt aAttribute, TDes& aValue, RFile& aFile, const TDesC& aUniqueId)
425 TRAPD(err, DoGetStringAttributeL(aAttribute, aValue, aFile, aUniqueId));
429 void CManager::DoGetStringAttributeL(TInt aAttribute, TDes& aValue, RFile& aFile, const TDesC& aUniqueId) const
431 // Find the agent who handles the file
432 CAgentInfo& agentInfo = iResolver->ResolveFileL(aFile);
433 // find out the attribute
434 User::LeaveIfError(agentInfo.AgentManagerL().GetStringAttribute(aAttribute, aValue, aFile, aUniqueId));
437 EXPORT_C TInt CManager::GetAttributeSet(RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath) const
439 TRAPD(err, DoGetAttributeSetL(aAttributeSet, aVirtualPath));
443 void CManager::DoGetAttributeSetL(RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath) const
445 HBufC* uriBuffer = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
446 TPtr uri = uriBuffer->Des();
448 // Find the agent who handles the file
449 CAgentInfo& agentInfo = iResolver->ResolveFileL(aVirtualPath.URI(), uri, EContentShareReadOnly);
451 User::LeaveIfError(agentInfo.AgentManagerL().GetAttributeSet(aAttributeSet, TVirtualPathPtr(uri, aVirtualPath.UniqueId())));
452 CleanupStack::PopAndDestroy(uriBuffer);
455 EXPORT_C TInt CManager::GetAttributeSet (RAttributeSet& aAttributeSet, RFile& aFile, const TDesC& aUniqueId)
457 TRAPD(err, DoGetAttributeSetL(aAttributeSet, aFile, aUniqueId));
461 void CManager::DoGetAttributeSetL(RAttributeSet& aAttributeSet, RFile& aFile, const TDesC& aUniqueId) const
463 // Find the agent who handles the file
464 CAgentInfo& agentInfo = iResolver->ResolveFileL(aFile);
465 User::LeaveIfError(agentInfo.AgentManagerL().GetAttributeSet(aAttributeSet, aFile, aUniqueId));
468 EXPORT_C TInt CManager::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TVirtualPathPtr& aVirtualPath) const
470 TRAPD(err, DoGetStringAttributeSetL(aStringAttributeSet, aVirtualPath));
474 void CManager::DoGetStringAttributeSetL(RStringAttributeSet& aStringAttributeSet, const TVirtualPathPtr& aVirtualPath) const
476 HBufC* uriBuffer = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
477 TPtr uri = uriBuffer->Des();
479 // Find the agent who handles the file
480 CAgentInfo& agentInfo = iResolver->ResolveFileL(aVirtualPath.URI(),uri, EContentShareReadOnly);
482 // find out the array of attributes
483 User::LeaveIfError(agentInfo.AgentManagerL().GetStringAttributeSet(aStringAttributeSet, TVirtualPathPtr(uri, aVirtualPath.UniqueId())));
484 CleanupStack::PopAndDestroy(uriBuffer);
487 EXPORT_C TInt CManager::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, RFile& aFile, const TDesC& aUniqueId)
489 TRAPD(err, DoGetStringAttributeSetL(aStringAttributeSet, aFile, aUniqueId));
493 void CManager::DoGetStringAttributeSetL(RStringAttributeSet& aStringAttributeSet, RFile& aFile, const TDesC& aUniqueId) const
495 // Find the agent who handles the file
496 CAgentInfo& agentInfo = iResolver->ResolveFileL(aFile);
497 // find out the array of attributes
498 User::LeaveIfError(agentInfo.AgentManagerL().GetStringAttributeSet(aStringAttributeSet, aFile, aUniqueId));
501 EXPORT_C void CManager::NotifyStatusChange(const TDesC &aURI, TEventMask aMask, TRequestStatus &aStatus)
503 TRAPD(err, DoNotifyStatusChangeL(aURI, aMask, aStatus));
506 // Must have failed before asking the agent for status
507 TRequestStatus* status = &aStatus;
508 User::RequestComplete(status, err);
512 void CManager::DoNotifyStatusChangeL(const TDesC &aURI, TEventMask aMask, TRequestStatus &aStatus)
514 HBufC* uriBuffer = HBufC::NewLC(aURI.Length() + KMaxSIDLength);
515 TPtr uri = uriBuffer->Des();
517 // Find the agent who handles the file
518 CAgentInfo& agentInfo = iResolver->ResolveFileL(aURI, uri, EContentShareReadOnly);
520 // Ask the agent to notifiy the client when the status of the given file changes
521 agentInfo.AgentManagerL().NotifyStatusChange(uri, aMask, aStatus);
522 CleanupStack::PopAndDestroy(uriBuffer);
525 EXPORT_C TInt CManager::CancelNotifyStatusChange (const TDesC &aURI, TRequestStatus &aStatus)
527 TRAPD(err, DoCancelNotifyStatusChangeL(aURI, aStatus));
531 void CManager::DoCancelNotifyStatusChangeL(const TDesC &aURI, TRequestStatus &aStatus)
533 HBufC* uriBuffer = HBufC::NewLC(aURI.Length() + KMaxSIDLength);
534 TPtr uri = uriBuffer->Des();
536 // Find the agent who handles the file
537 CAgentInfo& agentInfo = iResolver->ResolveFileL(aURI, uri, EContentShareReadOnly);
539 // cancel the notification request
540 User::LeaveIfError(agentInfo.AgentManagerL().CancelNotifyStatusChange(uri, aStatus));
541 CleanupStack::PopAndDestroy(uriBuffer);
544 EXPORT_C TInt CManager::SetProperty(TAgentProperty aProperty, TInt aValue)
546 TRAPD(err, DoSetPropertyL(aProperty, aValue));
550 void CManager::DoSetPropertyL(TAgentProperty aProperty, TInt aValue)
553 TInt rVal = KErrNone;
555 TInt count = iResolver->AgentInfoCount();
557 CAgentInfo &defaultAgentInfo = iResolver->AgentInfoL(iResolver->DefaultAgentUid());
558 err = defaultAgentInfo.AgentManagerL().SetProperty(aProperty, aValue);
559 if(err == KErrNoMemory)
561 User::Leave(KErrNoMemory);
564 // Ignore F32 agent return code unless it's KErrNoMemory
567 // Set the property in all the other agents
568 for( i = 0; i < count; i++)
570 CAgentInfo& agentInfo = iResolver->AgentInfo(i);
571 err = agentInfo.AgentManagerL().SetProperty(aProperty, aValue);
572 if(err == KErrNoMemory)
574 User::Leave(KErrNoMemory);
577 // If an error occurred and no previous error has occured
578 if(err != KErrNone && rVal == KErrNone)
584 // leave if an error occurred in any agent
585 User::LeaveIfError(rVal);
588 EXPORT_C void CManager::DisplayInfoL(TDisplayInfo aInfo, const TVirtualPathPtr& aVirtualPath)
590 HBufC* uriBuffer = HBufC::NewLC(aVirtualPath.URI().Length() + KMaxSIDLength);
591 TPtr uri = uriBuffer->Des();
593 // Find the agent who handles the file
594 CAgentInfo& agentInfo = iResolver->ResolveFileL(aVirtualPath.URI(), uri, EContentShareReadOnly);
596 // find out the attribute
597 agentInfo.AgentManagerL().DisplayInfoL(aInfo, TVirtualPathPtr(uri, aVirtualPath.UniqueId()));
598 CleanupStack::PopAndDestroy(uriBuffer);
601 EXPORT_C void CManager::DisplayInfoL(TDisplayInfo aInfo, RFile& aFile, const TDesC& aUniqueId)
603 // Find the agent who handles the file
604 CAgentInfo& agentInfo = iResolver->ResolveFileL(aFile);
605 // find out the attribute
606 agentInfo.AgentManagerL().DisplayInfoL(aInfo, aFile, aUniqueId);
609 EXPORT_C void CManager::ListAgentsL (RArray <TAgent>& aAgents)
612 TBuf <KMaxAgentNameLength> agentName;
613 TInt count = iResolver->AgentInfoCount();
615 // build the array of pointers from CAgentResolver
616 for(i = 0; i < count; i++)
618 TAgent agent = iResolver->AgentInfo(i).Agent();
619 User::LeaveIfError(aAgents.Append(agent));
623 EXPORT_C TInt CManager::AgentSpecificCommand (TAgent &aAgent, TInt aCommand, const TDesC8 &aInputBuffer, TDes8 &aOutputBuffer)
625 CAgentManager* manager = NULL;
627 TRAP(err, manager = &iResolver->AgentInfoL(aAgent.ImplementationUid()).AgentManagerL());
630 err = manager->AgentSpecificCommand (aCommand, aInputBuffer, aOutputBuffer);
635 EXPORT_C void CManager::AgentSpecificCommand (TAgent &aAgent, TInt aCommand, const TDesC8 &aInputBuffer, TDes8 &aOutputBuffer, TRequestStatus &aStatus)
637 CAgentManager* manager = NULL;
639 TRAPD(err, manager = &iResolver->AgentInfoL(aAgent.ImplementationUid()).AgentManagerL());
642 manager->AgentSpecificCommand (aCommand, aInputBuffer, aOutputBuffer, aStatus);
646 TRequestStatus* status = &aStatus;
647 User::RequestComplete(status, err);
651 EXPORT_C void CManager::DisplayManagementInfoL(TAgent& aAgent)
653 CAgentInfo& agentInfo = iResolver->AgentInfoL(aAgent.ImplementationUid());
655 // Ask agent to display management info
656 agentInfo.AgentManagerL().DisplayManagementInfoL();
659 EXPORT_C CRightsManager* CManager::CreateRightsManagerL(TAgent& aAgent) const
661 // Create a rights manager
662 return CRightsManager::NewL(aAgent.ImplementationUid());
665 void CManager::GetListOfAgentPrivateDirectoriesL(CDir *&aDir) const
667 CDirStreamable *ptr = NULL;
668 // fill in the agent directories under the \\private\\ directory
670 TInt count = iResolver->AgentInfoCount();
672 TBuf <KMaxAgentNameLength> agentName;
673 TPath privateDirectory;
675 // Create CDirStreamable object
676 ptr = CDirStreamable::NewL();
677 CleanupStack::PushL(ptr);
679 // set aDir to point to the CDirStreamable we just created
680 for(i = 0; i < count; i++)
682 // only fill in the agents that have a private directory that is not blank
683 if(iResolver->AgentInfo(i).PrivateDirectoryName().Length() != 0)
686 aEntry.iName = iResolver->AgentInfo(i).Agent().Name();
687 aEntry.iAtt = KEntryAttDir;
688 aEntry.iType = TUidType();
693 CleanupStack::Pop(ptr);
698 EXPORT_C void CManager::DeleteFileL(const TDesC &aFileName)
700 CManager *m = CManager::NewLC();
701 User::LeaveIfError(m->DeleteFile(aFileName));
702 CleanupStack::PopAndDestroy(m);
704 #endif // REMOVE_CAF1
706 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
708 EXPORT_C TInt CManager::GetAttribute(const TDesC8& aHeaderData, TInt aAttribute, TInt& aValue) const
710 TRAPD(err, DoGetAttributeL(aHeaderData, aAttribute, aValue));
714 void CManager::DoGetAttributeL(const TDesC8& aHeaderData, TInt aAttribute, TInt& aValue) const
716 // Find the agent who handles the file
717 CAgentInfo& agentInfo = iResolver->ResolveFileL(aHeaderData);
718 User::LeaveIfError(agentInfo.AgentManagerL().GetAttribute(aHeaderData, aAttribute, aValue));
721 EXPORT_C TInt CManager::GetAttributeSet(const TDesC8& aHeaderData, RAttributeSet& aAttributeSet) const
723 TRAPD(err, DoGetAttributeSetL(aHeaderData, aAttributeSet));
727 void CManager::DoGetAttributeSetL(const TDesC8& aHeaderData, RAttributeSet& aAttributeSet) const
729 // Find the agent who handles the file
730 CAgentInfo& agentInfo = iResolver->ResolveFileL(aHeaderData);
732 User::LeaveIfError(agentInfo.AgentManagerL().GetAttributeSet(aHeaderData, aAttributeSet));
735 EXPORT_C TInt CManager::GetStringAttribute(const TDesC8& aHeaderData, TInt aAttribute, TDes& aValue) const
737 TRAPD(err, DoGetStringAttributeL(aHeaderData, aAttribute, aValue));
741 void CManager::DoGetStringAttributeL(const TDesC8& aHeaderData, TInt aAttribute, TDes& aValue) const
743 // Find the agent who handles the file
744 CAgentInfo& agentInfo = iResolver->ResolveFileL(aHeaderData);
746 // find out the attribute
747 User::LeaveIfError(agentInfo.AgentManagerL().GetStringAttribute(aHeaderData, aAttribute, aValue));
750 EXPORT_C TInt CManager::GetStringAttributeSet(const TDesC8& aHeaderData, RStringAttributeSet& aStringAttributeSet) const
752 TRAPD(err, DoGetStringAttributeSetL(aHeaderData, aStringAttributeSet));
756 void CManager::DoGetStringAttributeSetL(const TDesC8& aHeaderData, RStringAttributeSet& aStringAttributeSet) const
758 // Find the agent who handles the file
759 CAgentInfo& agentInfo = iResolver->ResolveFileL(aHeaderData);
761 // find out the array of attributes
762 User::LeaveIfError(agentInfo.AgentManagerL().GetStringAttributeSet(aHeaderData, aStringAttributeSet));
765 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT