00001 /* 00002 * ============================================================================== 00003 * Name : FavouritesDb.h 00004 * Part of : Favourites Engine 00005 * Interface : Favourites Engine API 00006 * Description : Declaration of RFavouritesDb. 00007 * Version : %Version% 00008 * 00009 * Copyright (C) 2004 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * 00019 * ============================================================================ 00020 */ 00021 00022 #ifndef FAVOURITES_DB_H 00023 #define FAVOURITES_DB_H 00024 00025 // INCLUDES 00026 00027 #include <e32base.h> 00028 #include <d32dbms.h> 00029 #include <FavouritesItem.h> 00030 #include <FavouritesLimits.h> 00031 #include <FavouritesSession.h> 00032 #include <FavouritesHandle.h> 00033 00034 // FORWARD DECLARATIONS 00035 00036 class CFavouritesItemList; 00037 class MFavouritesItemData; 00038 class MRfsApMapper; 00039 00040 // CLASS DECLARATION 00041 00048 class RFavouritesDb: public RFavouritesHandle 00049 { 00050 00051 public: // New methods 00052 00060 IMPORT_C TInt Open( RFavouritesSession& aSess, const TDesC& aName ); 00061 00062 public: // Adminstration 00063 00069 IMPORT_C TVersion Version() const; 00070 00077 IMPORT_C TInt IsDamaged( TBool& aIsDamaged ); 00078 00085 IMPORT_C TInt Recover(); 00086 00093 IMPORT_C TInt Compact(); 00094 00101 IMPORT_C TInt Size( RDbDatabase::TSize& aSize ) const; 00102 00108 IMPORT_C TInt UpdateStats(); 00109 00110 public: // Transaction support 00111 00118 IMPORT_C TInt Begin( TBool aWrite = EFalse ); 00119 00125 IMPORT_C TInt Commit(); 00126 00132 IMPORT_C void Rollback(); 00133 00140 IMPORT_C void CleanupRollbackPushL(); 00141 00142 public: // Data access / update / delete 00143 00151 IMPORT_C TInt Get( TInt aUid, CFavouritesItem& aItem ); 00152 00168 IMPORT_C TInt GetAll 00169 ( 00170 CFavouritesItemList& aItemList, 00171 TInt aParentFolderFilter = KFavouritesNullUid, 00172 CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone, 00173 const TDesC* aNameFilter = NULL, 00174 TInt32 aContextIdFilter = KFavouritesNullContextId 00175 ); 00176 00192 IMPORT_C TInt GetUids 00193 ( 00194 CArrayFix<TInt>& aUids, 00195 TInt aParentFolderFilter = KFavouritesNullUid, 00196 CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone, 00197 const TDesC* aNameFilter = NULL, 00198 TInt32 aContextIdFilter = KFavouritesNullContextId 00199 ); 00200 00208 IMPORT_C TInt PreferredUid( TInt aFolder, TInt& aPreferredUid ); 00209 00219 IMPORT_C TInt Delete( TInt aUid ); 00220 00239 IMPORT_C TInt Update 00240 ( CFavouritesItem& aItem, TInt aUid, TBool aAutoRename ); 00241 00255 IMPORT_C TInt Add( CFavouritesItem& aItem, TBool aAutoRename ); 00256 00269 IMPORT_C TInt SetHomepage( CFavouritesItem& aItem ); 00270 00283 IMPORT_C TInt SetLastVisited( CFavouritesItem& aItem ); 00284 00294 IMPORT_C TInt SetFactoryItem( TInt aUid, TBool aFactoryItem ); 00295 00304 IMPORT_C TInt SetReadOnly( TInt aUid, TBool aReadOnly ); 00305 00317 IMPORT_C TInt SetModified( TInt aUid, TTime aModified ); 00318 00328 IMPORT_C TInt SetPreferredUid( TInt aFolder, TInt aUid ); 00329 00337 IMPORT_C TInt ItemExists( TInt aUid, TBool& aItemExists ); 00338 00346 IMPORT_C TInt FolderExists( TInt aFolder, TBool& aFolderExists ); 00347 00363 IMPORT_C TInt Count 00364 ( 00365 TInt& aCount, 00366 TInt aParentFolderFilter = KFavouritesNullUid, 00367 CFavouritesItem::TType aTypeFilter = CFavouritesItem::ENone, 00368 const TDesC* aNameFilter = NULL, 00369 TInt32 aContextIdFilter = KFavouritesNullContextId 00370 ); 00371 00372 public: // extra data 00373 00384 IMPORT_C TInt SetData( TInt aUid, const MFavouritesItemData& aData ); 00385 00394 IMPORT_C TInt GetData( TInt aUid, MFavouritesItemData& aData ); 00395 00396 public: // Browser data 00397 00410 IMPORT_C TInt SetBrowserData( TInt aUid, const MFavouritesItemData& aData ); 00411 00421 IMPORT_C TInt GetBrowserData( TInt aUid, MFavouritesItemData& aData ); 00422 00423 public: // unique name support 00424 00440 IMPORT_C TInt MakeUniqueName( TDes& aName, TInt aFolder ); 00441 00453 IMPORT_C TInt MakeUniqueName( CFavouritesItem& aItem ); 00454 00455 public: // Browser support 00456 00464 IMPORT_C CFavouritesItem* CreateStartPageItemL(); 00465 00474 IMPORT_C CFavouritesItem* CreateAdaptiveItemsFolderL(); 00475 00476 public: // Files 00477 00484 IMPORT_C TInt DeleteFile( TInt aUid ); 00485 00486 public: // RFS 00487 00498 IMPORT_C static void RestoreFactorySettingsL 00499 ( 00500 const TDesC& aName, 00501 const TDesC& aReferenceDbPath, 00502 MRfsApMapper& aApMapper 00503 ); 00504 00505 private: // New methods 00506 00514 TInt SetSpecialItem( CFavouritesItem& aItem, TInt aUid ); 00515 00524 TInt SetData 00525 ( TInt aFunction, TInt aUid, const MFavouritesItemData& aData ); 00526 00535 TInt GetData 00536 ( TInt aFunction, TInt aUid, MFavouritesItemData& aData ); 00537 00544 void DoRestoreFactorySettingsL 00545 ( const TDesC& aReferenceDbPath, MRfsApMapper& aApMapper ); 00546 00552 static void StaticRollback( TAny* aPtr ); 00553 00554 }; 00555 00556 #endif 00557 00558 // End of File