×
Namespaces

Variants
Actions
(Difference between revisions)

Adaptive History List API

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Automated change of text from {{NoteS}} to {{Note|. (Using Template:Note now))
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix reviewer approved and ArticleMetaData)
 
Line 1: Line 1:
{{ReviewerApproved}}
+
{{ArticleMetaData <!-- v1.1 -->
 +
|sourcecode= [[Media:AhleUsage.zip]]
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|id= <!-- Article Id (Knowledge base articles only) -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20070616
 +
|author= [[User:Ltomuta]]
 +
}}
 +
 
 
__NOEDITSECTION__ __NOTOC__
 
__NOEDITSECTION__ __NOTOC__
 
{{Note|
 
{{Note|

Latest revision as of 08:16, 2 February 2012

Article Metadata
Code Example
Source file: Media:AhleUsage.zip
Compatibility
Platform(s):
FNWiki
Article
Created: ltomuta (16 Jun 2007)
Last edited: hamishwillee (02 Feb 2012)


Note.pngNote: :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

  1. 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"
  2. 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.lib

Capabilities 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
}
 
}

Example Application