Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 06:28, 25 September 2007.

Add a Bookmark

From Forum Nokia Wiki


Adding a Bookmark in S60 2nd edition

In order to add a bookmark CFavouritesDb is used.

#include <FavouritesDb.h>
 
_LIT( KBookmarkDbPath, "c:\\system\\data\\" );
_LIT( KBookmarkDbFile, "Bookmarks1.db" );
 
CAddFavouritesDb* CAddFavouritesDb::NewL()
    {
    CAddFavouritesDb* favdb = new (ELeave) CAddFavouritesDb();
    CleanupStack::PushL( favdb );
    favdb->ConstructL( KBookmarkDbPath, KBookmarkDbFile );
    CleanupStack::Pop();    
    return favdb;
    }
CAddFavouritesDb * addBookmrk = CAddFavouritesDb::NewL();
   CleanupStack::PushL( addBookmrk );
   User::LeaveIfError(addBookmrk->OpenL());
   CFavouritesItem* bookmrkItem = CFavouritesItem::NewLC();
   bookmrkItem->SetType( CFavouritesItem::EItem );
   bookmrkItem->SetNameL( _L("AddBookmark") );
   bookmrkItem->SetUrlL( _L("http://www.forum.nokia.com") );
   addBookmrk->AddL(*bookmrkItem , ETrue);
   addBookmrk->Close();
   CleanupStack::PopAndDestroy( bookmrkItem );
   CleanupStack::PopAndDestroy( addBookmrk );


Need to link with favouritesengine.lib in .mmp file.

LIBRARY favouritesengine.lib

Adding a Bookmark in S60 3rd Edition

In S60 3rd edition, CAddFavouritesDb has been replaced by the R-class, RFavouritesDb. To make matters more complex, in S60 3.0 there was a divide between bookmarks displayed in the OSS Browser ("Web" application) and the Services browser. The OSS browser would only display bookmarks where the name and URL was prefixed with the string "oss". This has been rectified in S60 3.1.

To add a bookmark to the Services and OSS browser in S60 3.1:

#include <favouritessession.h> 
#include <favouritesdb.h>
#include <favouritesitem.h>
 
// Link against: favouritesengine.lib 
 
RFavouritesSession iSession;
User::LeaveIfError(iSession.Connect());
CleanupClosePushL(iSession);
 
RFavouritesDb db;
// KBrowserBookmarks is picked up from the header
User::LeaveIfError(db.Open(iSession, KBrowserBookmarks)); 
CleanupClosePushL(db);
 
CFavouritesItem* item =  CFavouritesItem::NewLC();
item->SetNameL(_L("Google UK"));
item->SetParentFolder(KFavouritesRootUid);
item->SetType(CFavouritesItem::EItem);
item->SetUrlL(_L("http://www.google.co.uk/"));
		
User::LeaveIfError(db.Add(*item, ETrue));
 
CleanupStack::PopAndDestroy(3, &session); // db, item

The equivalent to add the same bookmark to the OSS browser in S60 3rd edition would be:

CFavouritesItem* item =  CFavouritesItem::NewLC();
item->SetNameL(_L("ossGoogle UK"));
item->SetParentFolder(KFavouritesRootUid);
item->SetType(CFavouritesItem::EItem);
item->SetUrlL(_L("osshttp://www.google.co.uk/"));

Links

How to use SQL

Related Discussions
Thread Thread Starter Forum Replies Last Post
jB5 - new web browser launch boumitran News, Announcements and Job Listings 3 2007-04-16 09:24
Sending .dd over the air Jorrti Digital Rights Management & Content Downloading 2 2003-07-30 23:22
Jad manipulaltion Syeed Shah Mobile Java General 1 2007-12-10 20:41
Sending Bookmark r4chm4n Smart Messaging 1 2003-09-29 13:32
nokia 6110, palm Vx, Thinkpad A21p Nokia_Archived PC Suite API and PC Connectivity SDK 1 2002-05-23 14:17
 
Powered by MediaWiki