[EMAIL PROTECTED] (Akmal) wrote in message news:<[EMAIL PROTECTED]>...
> Hello All,
> 
> Can anybody help me to mozilla's global history usage. I wrote a
> simple web browser with gecko embedded, and now would like to show
> history sidebar like it is in firefox or mozilla. How can I retrieve
> all URLs which were saved in history.dat ? I looked at
> nsIGlobalHistory and it can only add or checj IsVisited property.
> Please help me.
> 
> Thank you.
> 
> -akmal.

You can use this code segment to do your job... best of luck.

Sachin Garg [India]
http://www.geocities.com/schngrg
http://sachingarg.go.to


===============

nsCOMPtr<nsIRDFDataSource> bHistoryRdfDataSource;

nsIRDFResource *kNC_Child;
nsIRDFResource *kNC_HistoryRoot;

rv = RDFService->GetDataSourceBlocking("rdf:history",
getter_AddRefs(bHistoryRdfDataSource));
if (NS_FAILED(rv))      return 6;

rv = RDFService->GetResource(nsCString(/*NC_NAMESPACE_URI*/
"http://home.netscape.com/NC-rdf#child";), &kNC_Child);
if (NS_FAILED(rv))      return 7;

rv = RDFService->GetResource(nsCString("NC:HistoryRoot"),
&kNC_HistoryRoot);
if (NS_FAILED(rv))      return 7;

nsCOMPtr<nsISimpleEnumerator> targets;
rv = 
bHistoryRdfDataSource->GetTargets(kNC_HistoryRoot,kNC_Child,true/*???*/,getter_AddRefs(targets));
if (NS_FAILED(rv))      return 7;

char *Url;
while(true)
{
        PRBool hasMore=true;
        rv = targets->HasMoreElements(&hasMore);
        if (NS_FAILED(rv)) return 7;

        if(!hasMore) break;

        nsCOMPtr<nsISupports> isupports;
        rv = targets->GetNext(getter_AddRefs(isupports));
        if (NS_FAILED(rv)) return 7;

        nsCOMPtr<nsIRDFResource> aTarget = do_QueryInterface(isupports);

        rv=aTarget->GetValue(&Url);
        if (NS_FAILED(rv))      return 2;

        HistoryEntry aHistoryEntry;
        aHistoryEntry.Url=Url;

        HistoryEntries.push_back(aHistoryEntry);
}
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to