Adaptive History List API
Article Metadata
Code Example
Source file: Media:AhleUsage.zip
Article
Created: ltomuta
(16 Jun 2007)
Last edited: hamishwillee
(02 Feb 2012)
Note: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.
API Purpose
Adaptive History List API can be used to keep track of the browser activity. One can retrieve the name as well as the URL of the recently visited sites.
Use cases
- To retrieve the URL address and the name of the websites visted using the browser.These contents will be written into a file named "History.txt"
- To clear the cache which contains the details like the URL address.
Example code
One can get to know of the recently visited links by following the steps mentioned below.
Header Files:
#include <AhleClientObserver.h>
#include <Ahle.h>
Link against:
LIBRARY AhleClient.libCapabilities Required:
CAPABILITY ReadUserData WriteUserData
1) Derive your class from MAHLEClientObserver.
2) Create a CAhle object preferably in the constructL
iAhle = CAHLE::NewL();
iAhle->SetObserverL(this);
3) Implement AdaptiveListChangedL( ) method. It is a pure virtual method defined in MAHLEClientObserver.
void AdaptiveListChanged(TInt aError)
{
TRAPD(err,DoAdaptiveListChangedL())
if(err)
{
//handle error here
}
}
void DoAdaptiveListChangedL()
{
RFs myFileSession;
RFile myFileObject;
CDesC16ArrayFlat* itemsArray = new(ELeave) CDesC16ArrayFlat(8);
CDesC16ArrayFlat* itemsNameArray = new(ELeave) CDesC16ArrayFlat(8);
CleanupStack::PushL(itemsArray);
CleanupStack::PushL(itemsNameArray);
CleanupClosePushL(myFileSession);
CleanupClosePushL(myFileObject);
myFileSession.Connect();
myFileObject.Replace(myFileSession,_L("C:\\History.txt"),EFileWrite);
TRAPD(err,iAhle->AdaptiveListL(*itemsArray,*itemsNameArray,TUint(100),
_L(""),EAHLEAdaptiveSiteDetails));
TBuf8<500> tempBuffer;
//writes the recently visited links to a buffer
for(TInt i=0;i<itemsNameArray->Count();i++)
{
tempBuffer.Append(itemsNameArray->MdcaPoint(i));
tempBuffer.Append(_L8("-"));
tempBuffer.Append(itemsArray->MdcaPoint(i));
tempBuffer.Append(_L8("\n"));
}
//logs the contents of the buffer into a file
myFileObject.Write(tempBuffer);
tempBuffer.Zero();
CleanupStack::PopAndDestroy(4);
}
4) To clear the cache which contains the browser activity details.
void ClearAdaptiveList()
{
TInt retval;
retval=iAhle->Clear();
if(retval)
{
//handle error here
}
}

