upnpharvester/common/dbmanager/src/cmdmmain.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:      Main class in the Database manager component
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <bautils.h>
       
    25 #include "cmdmsqliteconnection.h"
       
    26 #include "cmdmsqldbmaintenance.h"
       
    27 #include "cmfillrule.h"
       
    28 #include "cmstorerule.h"
       
    29 #include "cmmediaserverfull.h"
       
    30 #include "cmbaselistitem.h"
       
    31 #include "cmfilllistitem.h"
       
    32 #include "cmstorelistitem.h"
       
    33 #include "cmdriveinfo.h"
       
    34 #include "cmdmmain.h"
       
    35 #include "msdebug.h"
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CCmDmMain::NewL
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 EXPORT_C CCmDmMain* CCmDmMain::NewL()
       
    43     {
       
    44     LOG( _L( "[DB MNGR]\t CCmDmMain::NewL()"));   
       
    45     CCmDmMain* self = CCmDmMain::NewLC();
       
    46     CleanupStack::Pop( self );
       
    47     return self;
       
    48     }
       
    49  
       
    50 // ---------------------------------------------------------------------------
       
    51 // CCmDmMain::NewLC
       
    52 // ---------------------------------------------------------------------------
       
    53 //    
       
    54 EXPORT_C CCmDmMain* CCmDmMain::NewLC()
       
    55     {
       
    56     LOG( _L( "[DB MNGR]\t CCmDmMain::NewLC()"));
       
    57     CCmDmMain* self = new ( ELeave ) CCmDmMain();
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     return self;  
       
    61     }    
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CCmDmMain::~CCmDmMain
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C CCmDmMain::~CCmDmMain()
       
    68     {
       
    69     LOG( _L( "[DB MNGR]\t CCmDmMain::~CCmDmMain()")); 
       
    70     delete iConnection;
       
    71     iConnection = NULL;
       
    72     delete iMaintenance;
       
    73     iMaintenance = NULL;    
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CCmDmMain::PrepareQueryCmdL
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C void CCmDmMain::PrepareQueryCmdL( TCMQueryCmdType aType )
       
    81     {
       
    82     LOG( _L( "[DB MNGR]\t CCmDmMain::PrepareQueryCmdL()")); 
       
    83     iConnection->PrepareQueryCmdL( aType );    
       
    84     }
       
    85     
       
    86 // ---------------------------------------------------------------------------
       
    87 // CCmDmMain::QueryFillRuleL
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C TInt CCmDmMain::QueryFillRuleL( CCmFillRule* aFillRule )
       
    91     {
       
    92     return iConnection->QueryFillRuleL( aFillRule );
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CCmDmMain::QuerySelectedFillRuleNamesL
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 EXPORT_C void CCmDmMain::QuerySelectedFillRuleNamesL( 
       
   100     RPointerArray<HBufC8>& aNames, TInt aSelected )
       
   101     {
       
   102     LOG( _L( "[DB MNGR]\t CCmDmMain::QuerySelectedFillRuleNamesL()")); 
       
   103     iConnection->QuerySelectedFillRuleNamesL( aNames, aSelected );
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CCmDmMain::QueryFillRuleNamesL
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 EXPORT_C void CCmDmMain::QueryFillRuleNamesL( RPointerArray<HBufC8>& aNames )
       
   111     {
       
   112     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryFillRuleNamesL()")); 
       
   113     iConnection->QueryFillRuleNamesL( aNames );
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CCmDmMain::QueryStoreRuleL
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C TInt CCmDmMain::QueryStoreRuleL(CCmStoreRule* aStoreRule)
       
   121     {
       
   122     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreRuleL()")); 
       
   123     return iConnection->QueryStoreRuleL( aStoreRule );
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CCmDmMain::QueryStoreRuleNamesL
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 EXPORT_C void CCmDmMain::QueryStoreRuleNamesL( RPointerArray<HBufC8>& aNames )
       
   131     {
       
   132     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreRuleNamesL()")); 
       
   133     iConnection->QueryStoreRuleNamesL( aNames );
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // CCmDmMain::QuerySelectedStoreRuleNamesL
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 EXPORT_C void CCmDmMain::QuerySelectedStoreRuleNamesL(
       
   141     RPointerArray<HBufC8>& aNames, TInt aSelected )
       
   142     {
       
   143     LOG( _L( "[DB MNGR]\t CCmDmMain::QuerySelectedStoreRuleNamesL()")); 
       
   144     iConnection->QuerySelectedStoreRuleNamesL( aNames, aSelected );
       
   145     }        
       
   146     
       
   147 // ---------------------------------------------------------------------------
       
   148 // CCmDmMain::QueryMediaServerL
       
   149 // ---------------------------------------------------------------------------
       
   150 //    
       
   151 EXPORT_C TInt CCmDmMain::QueryMediaServerL( CCmMediaServerFull* aMediaServer )
       
   152     {
       
   153     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerL()")); 
       
   154     return iConnection->QueryMediaServerL( aMediaServer );
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // CCmDmMain::QueryMediaServerId
       
   159 // ---------------------------------------------------------------------------
       
   160 //    
       
   161 EXPORT_C TInt64 CCmDmMain::QueryMediaServerId( const TDesC8& aUDN )
       
   162     {
       
   163     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerId()")); 
       
   164     return iConnection->QueryMediaServerId( aUDN );
       
   165     }
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // CmDmMain::QueryMediaServerUdn
       
   169 // ---------------------------------------------------------------------------
       
   170 //    
       
   171 EXPORT_C TInt CCmDmMain::QueryMediaServerUdn( HBufC8*& aUdn, 
       
   172     const TInt32 aId )
       
   173     {
       
   174     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerUdn()")); 
       
   175     return iConnection->QueryMediaServerUdn( aUdn, aId );
       
   176     }
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // CCmDmMain::QueryAllMediaServersL
       
   180 // ---------------------------------------------------------------------------
       
   181 //    
       
   182 EXPORT_C TInt CCmDmMain::QueryAllMediaServersL( 
       
   183     CCmMediaServerFull* aMediaServer )
       
   184     {
       
   185     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllMediaServersL()")); 
       
   186     return iConnection->QueryAllMediaServersL( aMediaServer );
       
   187     }
       
   188 
       
   189 // ---------------------------------------------------------------------------
       
   190 // CCmDmMain::GetMediaServersL
       
   191 // ---------------------------------------------------------------------------
       
   192 //    
       
   193 EXPORT_C void CCmDmMain::GetMediaServersL( 
       
   194     RPointerArray<CCmMediaServerFull>& aMediaServers )
       
   195     {
       
   196     LOG( _L( "[DB MNGR]\t CCmDmMain::GetMediaServersL()")); 
       
   197     iConnection->GetMediaServersL( aMediaServers );
       
   198     }
       
   199     
       
   200 // ---------------------------------------------------------------------------
       
   201 // CCmDmMain::GetLowPriorityFilledFilesL
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C TInt CCmDmMain::GetLowPriorityFilledFilesL( TInt aDrive,
       
   205     RPointerArray<CCmFillListItem>& aFilled )
       
   206     {
       
   207     LOG( _L( "[DB MNGR]\t CCmDmMain::GetLowPriorityFilledFilesL()")); 
       
   208     return iConnection->GetLowPriorityFilledFilesL( aDrive, aFilled );
       
   209     }
       
   210 
       
   211 // ---------------------------------------------------------------------------
       
   212 // CCmDmMain::QueryFillFileListL
       
   213 // ---------------------------------------------------------------------------
       
   214 //
       
   215 EXPORT_C TInt CCmDmMain::QueryFillFileListL( 
       
   216     RPointerArray<CCmBaseListItem>& aItems, 
       
   217     const TDesC8& aName, 
       
   218     TUint aStatus )
       
   219     {
       
   220     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryFillFileListL()")); 
       
   221     return iConnection->QueryFillFileListL( aItems, aName, aStatus );
       
   222     }
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // CCmDmMain::GetAllFillFilesL
       
   226 // ---------------------------------------------------------------------------
       
   227 //
       
   228 EXPORT_C TInt CCmDmMain::GetAllFillFilesL( 
       
   229                                     RPointerArray<CCmFillListItem>& aItems,
       
   230                                     TUint aStatus )
       
   231     {
       
   232     LOG( _L( "[DB MNGR]\t CCmDmMain::GetAllFillFilesL()")); 
       
   233     return iConnection->GetAllFillFilesL( aItems, aStatus );
       
   234     }
       
   235     
       
   236 // ---------------------------------------------------------------------------
       
   237 // CCmDmMain::QueryStoreFileListL
       
   238 // ---------------------------------------------------------------------------
       
   239 //    
       
   240 EXPORT_C TInt CCmDmMain::QueryStoreFileListL( 
       
   241     RPointerArray<CCmBaseListItem>& aItems, 
       
   242     const TDesC8& aName, 
       
   243     TUint aStatus )
       
   244     {
       
   245     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreFileListL()")); 
       
   246     return iConnection->QueryStoreFileListL( aItems, aName, aStatus );
       
   247     }
       
   248 
       
   249 // ---------------------------------------------------------------------------
       
   250 // CCmDmMain::GetAllStoreFilesL
       
   251 // ---------------------------------------------------------------------------
       
   252 //
       
   253 EXPORT_C TInt CCmDmMain::GetAllStoreFilesL( 
       
   254     RPointerArray<CCmStoreListItem>& aItems, TUint aStatus )
       
   255     {
       
   256     LOG( _L( "[DB MNGR]\t CCmDmMain::GetAllStoreFilesL()")); 
       
   257     return iConnection->GetAllStoreFilesL( aItems, aStatus );
       
   258     }
       
   259     
       
   260 // ---------------------------------------------------------------------------
       
   261 // CCmDmMain::QueryAllFillFilesL
       
   262 // ---------------------------------------------------------------------------
       
   263 //    
       
   264 EXPORT_C TInt CCmDmMain::QueryAllFillFilesL( 
       
   265     RPointerArray<CCmFillListItem>& aItems )
       
   266     {
       
   267     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllFillFilesL()")); 
       
   268     return iConnection->QueryAllFillFilesL( aItems );
       
   269     }
       
   270 
       
   271 // ---------------------------------------------------------------------------
       
   272 // CCmDmMain::QueryAllStoreFilesL
       
   273 // ---------------------------------------------------------------------------
       
   274 //    
       
   275 EXPORT_C TInt CCmDmMain::QueryAllStoreFilesL( 
       
   276     RPointerArray<CCmStoreListItem>& aItems )
       
   277     {
       
   278     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllStoreFilesL()")); 
       
   279     return iConnection->QueryAllStoreFilesL( aItems );    
       
   280     }
       
   281             
       
   282 // ---------------------------------------------------------------------------
       
   283 // CCmDmMain::QueryStoredRowL
       
   284 // ---------------------------------------------------------------------------
       
   285 //
       
   286 EXPORT_C void CCmDmMain::QueryStoredRowL( RPointerArray<HBufC16>& aFiles, 
       
   287     const TDesC8& aUDN, 
       
   288     TInt aAmount )
       
   289     {
       
   290     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoredRowL()")); 
       
   291     iConnection->QueryStoredRowL( aFiles, aUDN, aAmount );
       
   292     }
       
   293     
       
   294 // ---------------------------------------------------------------------------
       
   295 // CCmDmMain::QueryTransferHistory
       
   296 // ---------------------------------------------------------------------------
       
   297 //
       
   298 EXPORT_C void CCmDmMain::QueryTransferHistory( 
       
   299     const TDesC8& aUdn, 
       
   300     TInt64& aDownloadData, 
       
   301     TInt64& aUploadData, 
       
   302     TInt64& aDownloadTime, 
       
   303     TInt64& aUploadTime )
       
   304     {
       
   305     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryTransferHistory()")); 
       
   306     iConnection->QueryTransferHistory( aUdn, aDownloadData, 
       
   307         aUploadData, aDownloadTime, aUploadTime );
       
   308     }
       
   309 
       
   310 // ---------------------------------------------------------------------------
       
   311 // CCmDmMain::QueryDeletedItemsListsL
       
   312 // ---------------------------------------------------------------------------
       
   313 //
       
   314 EXPORT_C void CCmDmMain::QueryDeletedItemsListsL( 
       
   315     RPointerArray<CCmBaseListItem>& aArray, TUint aStatus )
       
   316     {
       
   317     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryDeletedItemsListsL()")); 
       
   318     iConnection->QueryDeletedItemsListsL( aArray, aStatus );
       
   319     }
       
   320 
       
   321 // ---------------------------------------------------------------------------
       
   322 // CCmDmMain::QueryDrivesL
       
   323 // ---------------------------------------------------------------------------
       
   324 //
       
   325 EXPORT_C void CCmDmMain::QueryDrivesL( RPointerArray<CCmDriveInfo>& aDrives )
       
   326     {
       
   327     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryDrivesL()")); 
       
   328     iConnection->QueryDrivesL( aDrives );
       
   329     }
       
   330     
       
   331 // ---------------------------------------------------------------------------
       
   332 // CCmDmMain::GetAvgImageShrinkTime
       
   333 // ---------------------------------------------------------------------------
       
   334 //
       
   335 EXPORT_C TInt CCmDmMain::GetAvgImageShrinkTime()
       
   336     {
       
   337     LOG( _L( "[DB MNGR]\t CCmDmMain::GetAvgImageShrinkTime()")); 
       
   338     return iConnection->GetAvgImageShrinkTime();
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 // CCmDmMain::GetFillListNameL
       
   343 // ---------------------------------------------------------------------------
       
   344 //
       
   345 EXPORT_C void CCmDmMain::GetFillListNameL( HBufC8*& aListName, 
       
   346     const TInt64 aListId )
       
   347     {
       
   348     LOG( _L( "[DB MNGR]\t CCmDmMain::GetFillListNameL()")); 
       
   349     return iConnection->GetFillListNameL( aListName, aListId );
       
   350     }
       
   351         
       
   352 // ---------------------------------------------------------------------------
       
   353 // CCmDmMain::SetFillFiles
       
   354 // ---------------------------------------------------------------------------
       
   355 //    
       
   356 EXPORT_C TInt CCmDmMain::SetFillFiles( 
       
   357     RPointerArray<CCmFillListItem>& aItems )
       
   358     {
       
   359     LOG( _L( "[DB MNGR]\t CCmDmMain::SetFillFiles()")); 
       
   360     return iConnection->SetFillFiles( aItems );
       
   361     }
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // CCmDmMain::SetStoreFilesL
       
   365 // ---------------------------------------------------------------------------
       
   366 //    
       
   367 EXPORT_C TInt CCmDmMain::SetStoreFilesL( 
       
   368     RPointerArray<CCmStoreListItem>& aItems )
       
   369     {
       
   370     LOG( _L( "[DB MNGR]\t CCmDmMain::SetStoreFilesL()")); 
       
   371     return iConnection->SetStoreFilesL( aItems );    
       
   372     }
       
   373 
       
   374 // ---------------------------------------------------------------------------
       
   375 // CCmDmMain::AddStoreFile
       
   376 // ---------------------------------------------------------------------------
       
   377 //
       
   378 EXPORT_C TInt CCmDmMain::AddStoreFile( CCmStoreListItem& aItem )
       
   379     {
       
   380     LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoreFile()")); 
       
   381     return iConnection->AddStoreFile( aItem );    
       
   382     }
       
   383     
       
   384 // ---------------------------------------------------------------------------
       
   385 // CCmDmMain::AddStoredL
       
   386 // ---------------------------------------------------------------------------
       
   387 //    
       
   388 EXPORT_C TInt CCmDmMain::AddStoredL( 
       
   389     const TDesC& aFileName, 
       
   390     const TDesC8& aUDN, 
       
   391     TTime aTimeStamp )
       
   392     {
       
   393     LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoredL()")); 
       
   394     return iConnection->AddStoredL( aFileName, aUDN, aTimeStamp );
       
   395     }
       
   396 
       
   397 // ---------------------------------------------------------------------------
       
   398 // CCmDmMain::AddFillRuleL
       
   399 // ---------------------------------------------------------------------------
       
   400 //
       
   401 EXPORT_C TInt CCmDmMain::AddFillRuleL( CCmFillRule* aFillRule )
       
   402     {
       
   403     LOG( _L( "[DB MNGR]\t CCmDmMain::AddFillRuleL()")); 
       
   404     return iConnection->AddFillRuleL( aFillRule );
       
   405     }
       
   406 
       
   407 // ---------------------------------------------------------------------------
       
   408 // CCmDmMain::AddStoreRuleL
       
   409 // ---------------------------------------------------------------------------
       
   410 //
       
   411 EXPORT_C TInt CCmDmMain::AddStoreRuleL( CCmStoreRule* aStoreRule )
       
   412     {
       
   413     LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoreRuleL()")); 
       
   414     return iConnection->AddStoreRuleL( aStoreRule );
       
   415     }
       
   416     
       
   417 // ---------------------------------------------------------------------------
       
   418 // CCmDmMain::AddMediaServerL
       
   419 // ---------------------------------------------------------------------------
       
   420 //
       
   421 EXPORT_C TInt CCmDmMain::AddMediaServerL( CCmMediaServerFull* aMediaServer )
       
   422     {
       
   423     LOG( _L( "[DB MNGR]\t CCmDmMain::AddMediaServerL()")); 
       
   424     return iConnection->AddMediaServerL( aMediaServer );
       
   425     }
       
   426 
       
   427 // ---------------------------------------------------------------------------
       
   428 // CCmDmMain::AddHashValue
       
   429 // ---------------------------------------------------------------------------
       
   430 //
       
   431 EXPORT_C TInt CCmDmMain::AddHashValue( TInt64 aMediaServerId, 
       
   432                                        CCmSearchResponseHash* aHashValue )
       
   433     {
       
   434     LOG( _L( "[DB MNGR]\t CCmDmMain::AddHashValue()")); 
       
   435     return iConnection->AddHashValue( aMediaServerId, aHashValue );
       
   436     }
       
   437 
       
   438 // ---------------------------------------------------------------------------
       
   439 // CCmDmMain::QueryHashValuesL
       
   440 // ---------------------------------------------------------------------------
       
   441 //
       
   442 EXPORT_C TInt CCmDmMain::QueryHashValuesL( TInt aMediaServer, 
       
   443         RPointerArray<CCmSearchResponseHash>& aHashValues )
       
   444     {
       
   445     LOG( _L( "[DB MNGR]\t CCmDmMain::QueryHashValuesL()")); 
       
   446     return iConnection->QueryHashValuesL( aMediaServer, aHashValues );
       
   447     }
       
   448 // ---------------------------------------------------------------------------
       
   449 // CCmDmMain::SetMediaServersL  
       
   450 // ---------------------------------------------------------------------------
       
   451 //
       
   452 EXPORT_C TInt CCmDmMain::SetMediaServersL( 
       
   453     RPointerArray<CCmMediaServerFull>& aServers )
       
   454     {
       
   455     LOG( _L( "[DB MNGR]\t CCmDmMain::SetMediaServersL()")); 
       
   456     return iConnection->SetMediaServersL( aServers );
       
   457     }
       
   458 
       
   459 // ---------------------------------------------------------------------------
       
   460 // CCmDmMain::SetSyncTime
       
   461 // ---------------------------------------------------------------------------
       
   462 //
       
   463 EXPORT_C TInt CCmDmMain::SetSyncTime()
       
   464     {
       
   465     LOG( _L( "[DB MNGR]\t CCmDmMain::SetSyncTime()")); 
       
   466     return iConnection->SetSyncTime();
       
   467     }
       
   468 
       
   469 // ---------------------------------------------------------------------------
       
   470 // CCmDmMain::GetSyncTime
       
   471 // ---------------------------------------------------------------------------
       
   472 //
       
   473 EXPORT_C TInt CCmDmMain::GetSyncTime( TTime& aTime )
       
   474     {
       
   475     LOG( _L( "[DB MNGR]\t CCmDmMain::GetSyncTime()")); 
       
   476     return iConnection->GetSyncTime( aTime );
       
   477     }
       
   478 
       
   479 // ---------------------------------------------------------------------------
       
   480 // CCmDmMain::SetProgressInfo
       
   481 // ---------------------------------------------------------------------------
       
   482 //
       
   483 EXPORT_C TInt CCmDmMain::SetProgressInfo( TInt aTransferred, 
       
   484     TInt aTotalCount)
       
   485     {
       
   486     LOG( _L( "[DB MNGR]\t CCmDmMain::SetProgressInfo()")); 
       
   487     return iConnection->SetProgressInfo( aTransferred, aTotalCount );
       
   488     }
       
   489 
       
   490 // ---------------------------------------------------------------------------
       
   491 // CCmDmMain::GetProgressInfo
       
   492 // ---------------------------------------------------------------------------
       
   493 //
       
   494 EXPORT_C TInt CCmDmMain::GetProgressInfo( TInt& aTransferred, 
       
   495     TInt& aTotalCount )
       
   496     {
       
   497     LOG( _L( "[DB MNGR]\t CCmDmMain::GetProgressInfo()")); 
       
   498     return iConnection->GetProgressInfo( aTransferred, aTotalCount );
       
   499     }
       
   500 
       
   501 // ---------------------------------------------------------------------------
       
   502 // CCmDmMain::SetDrivesL
       
   503 // ---------------------------------------------------------------------------
       
   504 //
       
   505 EXPORT_C void CCmDmMain::SetDrivesL( RPointerArray<CCmDriveInfo>& aDrives )
       
   506     {
       
   507     LOG( _L( "[DB MNGR]\t CCmDmMain::SetDrivesL()")); 
       
   508     iConnection->SetDrivesL( aDrives );
       
   509     }
       
   510     
       
   511 // ---------------------------------------------------------------------------
       
   512 // CCmDmMain::DeleteMediaServer
       
   513 // ---------------------------------------------------------------------------
       
   514 //    
       
   515 EXPORT_C TInt CCmDmMain::DeleteMediaServer( const TDesC8& aUDN )
       
   516     {
       
   517     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteMediaServer()")); 
       
   518     return iConnection->DeleteMediaServer( aUDN );
       
   519     }
       
   520 
       
   521 // ---------------------------------------------------------------------------
       
   522 // CCmDmMain::DeleteFillRuleByName
       
   523 // ---------------------------------------------------------------------------
       
   524 //        
       
   525 EXPORT_C TInt CCmDmMain::DeleteFillRuleByName( const TDesC8& aName )
       
   526     {
       
   527     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteFillRuleByName()")); 
       
   528     return iConnection->DeleteFillRuleByName( aName );
       
   529     }
       
   530     
       
   531 // ---------------------------------------------------------------------------
       
   532 // CCmDmMain::DeleteAllFillRules
       
   533 // ---------------------------------------------------------------------------
       
   534 //    
       
   535 EXPORT_C TInt CCmDmMain::DeleteAllFillRules()
       
   536     {
       
   537     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteAllFillRules()")); 
       
   538     return iConnection->DeleteAllFillRules();
       
   539     }
       
   540 
       
   541 // ---------------------------------------------------------------------------
       
   542 // CCmDmMain::DeleteAllStoreRules
       
   543 // ---------------------------------------------------------------------------
       
   544 //    
       
   545 EXPORT_C TInt CCmDmMain::DeleteAllStoreRules()
       
   546     {
       
   547     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteAllStoreRules()")); 
       
   548     return iConnection->DeleteAllStoreRules();
       
   549     }
       
   550     
       
   551 // ---------------------------------------------------------------------------
       
   552 // CCmDmMain::DeleteFillFiles
       
   553 // ---------------------------------------------------------------------------
       
   554 //    
       
   555 EXPORT_C TInt CCmDmMain::DeleteFillFiles()
       
   556     {
       
   557     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteFillFiles()")); 
       
   558     return iConnection->DeleteFillFiles();
       
   559     }
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // CCmDmMain::DeleteStoreFiles
       
   563 // ---------------------------------------------------------------------------
       
   564 //    
       
   565 EXPORT_C TInt CCmDmMain::DeleteStoreFiles()
       
   566     {
       
   567     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteStoreFiles()")); 
       
   568     return iConnection->DeleteStoreFiles();
       
   569     }
       
   570                       
       
   571 // ---------------------------------------------------------------------------
       
   572 // CCmDmMain::DeleteDeletedItemsL
       
   573 // ---------------------------------------------------------------------------
       
   574 //
       
   575 EXPORT_C void CCmDmMain::DeleteDeletedItemsL()
       
   576     {
       
   577     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteDeletedItemsL()")); 
       
   578     iConnection->DeleteDeletedItemsL();
       
   579     }
       
   580 
       
   581 // ---------------------------------------------------------------------------
       
   582 // CCmDmMain::DeleteItemsByFillListId
       
   583 // ---------------------------------------------------------------------------
       
   584 //
       
   585 EXPORT_C TInt CCmDmMain::DeleteItemsByFillListId( TInt aFillListId )
       
   586     {
       
   587     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteItemsByFillListId()")); 
       
   588     return iConnection->DeleteItemsByFillListId( aFillListId );
       
   589     }
       
   590 
       
   591 
       
   592 // ---------------------------------------------------------------------------
       
   593 // CCmDmMain::DeleteDeletedMediaServersL
       
   594 // ---------------------------------------------------------------------------
       
   595 //
       
   596 EXPORT_C void CCmDmMain::DeleteDeletedMediaServersL()
       
   597     {
       
   598     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteDeletedMediaServersL()")); 
       
   599     iConnection->DeleteDeletedMediaServersL();
       
   600     }
       
   601 
       
   602 // ---------------------------------------------------------------------------
       
   603 // CCmDmMain::DeleteHashValuesL
       
   604 // ---------------------------------------------------------------------------
       
   605 //
       
   606 EXPORT_C void CCmDmMain::DeleteHashValuesL( const TInt aMediaserverId,
       
   607     const TInt aSearchIndex )
       
   608     {
       
   609     LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteHashValuesL()")); 
       
   610     iConnection->DeleteHashValuesL( aMediaserverId, aSearchIndex );  
       
   611     }
       
   612                 
       
   613 // ---------------------------------------------------------------------------
       
   614 // CCmDmMain::UpdateMediaServerInfo
       
   615 // ---------------------------------------------------------------------------
       
   616 //    
       
   617 EXPORT_C TInt CCmDmMain::UpdateMediaServerInfo( 
       
   618     CCmMediaServerFull* aMediaServer )
       
   619     {
       
   620     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateMediaServerInfo()")); 
       
   621     return iConnection->UpdateMediaServerInfo( aMediaServer );
       
   622     }
       
   623 
       
   624 // ---------------------------------------------------------------------------
       
   625 // CCmDmMain::UpdateFillRuleSelected
       
   626 // ---------------------------------------------------------------------------
       
   627 //    
       
   628 EXPORT_C TInt CCmDmMain::UpdateFillRuleSelected( 
       
   629     const TDesC8& aName, 
       
   630     TInt aSelected )    
       
   631     {
       
   632     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillRuleSelected()")); 
       
   633     return iConnection->UpdateFillRuleSelected( aName, aSelected );
       
   634     }
       
   635     
       
   636 // ---------------------------------------------------------------------------
       
   637 // CCmDmMain::UpdateDownloadHistory
       
   638 // ---------------------------------------------------------------------------
       
   639 //
       
   640 EXPORT_C TInt CCmDmMain::UpdateDownloadHistory( TUint aMediaServerId,
       
   641     TInt64& aDownloadData, TInt64& aDownloadTime )
       
   642     {
       
   643     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateDownloadHistory()")); 
       
   644     return iConnection->UpdateDownloadHistory( aMediaServerId,
       
   645         aDownloadData, aDownloadTime );
       
   646     }
       
   647     
       
   648 // ---------------------------------------------------------------------------
       
   649 // CCmDmMain::UpdateUploadHistory
       
   650 // ---------------------------------------------------------------------------
       
   651 //
       
   652 EXPORT_C TInt CCmDmMain::UpdateUploadHistory( TUint aMediaServerId,
       
   653     TInt64& aUploadData, TInt64& aUploadTime )
       
   654     {
       
   655     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateUploadHistory()")); 
       
   656     return iConnection->UpdateUploadHistory( aMediaServerId,
       
   657         aUploadData, aUploadTime );
       
   658     }
       
   659 
       
   660 // ---------------------------------------------------------------------------
       
   661 // CCmDmMain::UpdateStatusValues
       
   662 // ---------------------------------------------------------------------------
       
   663 //
       
   664 EXPORT_C TInt CCmDmMain::UpdateStatusValues( 
       
   665     RPointerArray<CCmBaseListItem>& aStatusValues )
       
   666     {
       
   667     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateStatusValues()")); 
       
   668     return iConnection->UpdateStatusValues( aStatusValues );
       
   669     }
       
   670 
       
   671 // ---------------------------------------------------------------------------
       
   672 // CCmDmMain::UpdateFillListDriveStatusesL
       
   673 // ---------------------------------------------------------------------------
       
   674 //
       
   675 EXPORT_C void CCmDmMain::UpdateFillListDriveStatusesL( 
       
   676     CCmDriveInfo* aOrigDrive, CCmDriveInfo* aNewDrive, 
       
   677     TBool aDriveSelected )
       
   678     {
       
   679     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillListDriveStatusesL()")); 
       
   680     iConnection->UpdateFillListDriveStatusesL( 
       
   681         aOrigDrive, aNewDrive, aDriveSelected );
       
   682     }
       
   683     
       
   684 // ---------------------------------------------------------------------------
       
   685 // CCmDmMain::UpdateFillListItemPriority
       
   686 // ---------------------------------------------------------------------------
       
   687 //
       
   688 EXPORT_C TInt CCmDmMain::UpdateFillListItemPriority( 
       
   689     CCmFillRuleContainer* aContainer )
       
   690     {
       
   691     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillListItemPriority()")); 
       
   692     return iConnection->UpdateFillListItemPriority( aContainer );
       
   693     }
       
   694 
       
   695 // ---------------------------------------------------------------------------
       
   696 // CCmDmMain::SetFillListStateL
       
   697 // ---------------------------------------------------------------------------
       
   698 //
       
   699 EXPORT_C void CCmDmMain::SetFillListStateL( const TUint aListId, 
       
   700     TCmFillRuleStatus aState )
       
   701     {
       
   702     LOG( _L( "[DB MNGR]\t CCmDmMain::SetFillListStateL()")); 
       
   703     iConnection->SetFillListStateL( aListId, aState );
       
   704     }
       
   705 
       
   706 // ---------------------------------------------------------------------------
       
   707 // CCmDmMain::RestoreFileStatusesL
       
   708 // ---------------------------------------------------------------------------
       
   709 //
       
   710 EXPORT_C void CCmDmMain::RestoreFileStatusesL( 
       
   711     const RPointerArray<CCmFillListItem>& aItems, const TDesC8& aListName )
       
   712     {
       
   713     LOG( _L( "[DB MNGR]\t CCmDmMain::RestoreFileStatusesL()")); 
       
   714     return iConnection->RestoreFileStatusesL( aItems, aListName );
       
   715     }
       
   716             
       
   717 // ---------------------------------------------------------------------------
       
   718 // CCmDmMain::IncrementShrinkTimeL
       
   719 // ---------------------------------------------------------------------------
       
   720 //
       
   721 EXPORT_C TInt CCmDmMain::IncrementShrinkTimeL( TInt aImageCount, 
       
   722     TInt aMilliSeconds )
       
   723     {
       
   724     LOG( _L( "[DB MNGR]\t CCmDmMain::IncrementShrinkTimeL()")); 
       
   725     return iConnection->IncrementShrinkTimeL( aImageCount,
       
   726         aMilliSeconds );    
       
   727     }
       
   728     
       
   729 // ---------------------------------------------------------------------------
       
   730 // CCmDmMain::ListSize
       
   731 // ---------------------------------------------------------------------------
       
   732 //
       
   733 EXPORT_C TInt64 CCmDmMain::ListSize( 
       
   734     TCmRuleType aType, 
       
   735     const TDesC8& aListName,
       
   736     TUint aStatus )
       
   737     {
       
   738     LOG( _L( "[DB MNGR]\t CCmDmMain::ListSize()")); 
       
   739     
       
   740     TInt64 size( KErrNone );
       
   741     if( aType == ECmFmFillRule )
       
   742         {
       
   743         size = iConnection->FillListSize( aListName, aStatus );
       
   744         }
       
   745     else
       
   746         {
       
   747         size = iConnection->StoreListSize( aListName, aStatus );
       
   748         }
       
   749     return size;        
       
   750     }
       
   751 
       
   752 // ---------------------------------------------------------------------------
       
   753 // CCmDmMain::StoreFileCount
       
   754 // ---------------------------------------------------------------------------
       
   755 //    
       
   756 EXPORT_C TInt CCmDmMain::StoreFileCount( TUint aStatus )
       
   757     {
       
   758     LOG( _L( "[DB MNGR]\t CCmDmMain::StoreFileCount()")); 
       
   759     return iConnection->StoreFileCount( aStatus );
       
   760     }
       
   761 
       
   762 // ---------------------------------------------------------------------------
       
   763 // CCmDmMain::StoreFileCountNoDuplicates
       
   764 // ---------------------------------------------------------------------------
       
   765 //    
       
   766 EXPORT_C TInt CCmDmMain::StoreFileCountNoDuplicates()
       
   767     {
       
   768     LOG( _L( "[DB MNGR]\t CCmDmMain::StoreFileCountNoDuplicates()")); 
       
   769     return iConnection->StoreFileCountNoDuplicates();
       
   770     }
       
   771     
       
   772 // ---------------------------------------------------------------------------
       
   773 // CCmDmMain::FillFileCount
       
   774 // ---------------------------------------------------------------------------
       
   775 //    
       
   776 EXPORT_C TInt CCmDmMain::FillFileCount( TUint aStatus )
       
   777     {
       
   778     LOG( _L( "[DB MNGR]\t CCmDmMain::FillFileCount()")); 
       
   779     return iConnection->FillFileCount( aStatus );
       
   780     }
       
   781 
       
   782 // ---------------------------------------------------------------------------
       
   783 // Amount of data filled
       
   784 // ---------------------------------------------------------------------------
       
   785 //    
       
   786 EXPORT_C TInt64 CCmDmMain::BytesFilled( TUint aID )
       
   787     {
       
   788     return iConnection->BytesFilled( aID );
       
   789     }
       
   790 
       
   791 
       
   792 // CCmDmMain::KBytesToBeFilled
       
   793 // ---------------------------------------------------------------------------
       
   794 //    
       
   795 EXPORT_C TInt64 CCmDmMain::KBytesToBeFilled( TUint8 aMediaServerId, 
       
   796     TUint aStatus )
       
   797     {
       
   798     LOG( _L( "[DB MNGR]\t CCmDmMain::KBytesToBeFilled()")); 
       
   799     return iConnection->KBytesToBeFilled( aMediaServerId, aStatus );
       
   800     }
       
   801 
       
   802 // ---------------------------------------------------------------------------
       
   803 // CCmDmMain::KBytesToBeStored
       
   804 // ---------------------------------------------------------------------------
       
   805 //    
       
   806 EXPORT_C TInt64 CCmDmMain::KBytesToBeStored( TUint8 aMediaServerId, 
       
   807     TUint aStatus )
       
   808     {
       
   809     LOG( _L( "[DB MNGR]\t CCmDmMain::KBytesToBeStored()")); 
       
   810     return iConnection->KBytesToBeStored( aMediaServerId, aStatus );
       
   811     }
       
   812     
       
   813 // ---------------------------------------------------------------------------
       
   814 // CCmDmMain::UpdateTransferInfo
       
   815 // ---------------------------------------------------------------------------
       
   816 //    
       
   817 EXPORT_C TInt CCmDmMain::UpdateTransferInfo( TCmService aService, 
       
   818     TInt aCount, TInt aTime )
       
   819     {
       
   820     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateTransferInfo()")); 
       
   821     return iConnection->UpdateTransferInfo( aService, aCount, aTime );
       
   822     }   
       
   823 
       
   824 // ---------------------------------------------------------------------------
       
   825 // CCmDmMain::UpdateStoreTransferStatus
       
   826 // ---------------------------------------------------------------------------
       
   827 //
       
   828 EXPORT_C void CCmDmMain::UpdateStoreTransferStatus( TUint aStatus,
       
   829     TInt64 aFid, TInt64 aMsId )
       
   830     {
       
   831     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateStoreTransferStatus()")); 
       
   832     iConnection->UpdateStoreTransferStatus( aStatus, aFid, aMsId );
       
   833     }
       
   834 
       
   835 
       
   836 // ---------------------------------------------------------------------------
       
   837 // CCmDmMain::UpdateFillTransferStatus
       
   838 // ---------------------------------------------------------------------------
       
   839 //
       
   840 EXPORT_C void CCmDmMain::UpdateFillTransferStatus( TUint aStatus, 
       
   841     CCmFillListItem* aItem )
       
   842     {
       
   843     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillTransferStatus()")); 
       
   844     iConnection->UpdateFillTransferStatus( aStatus, aItem );
       
   845     }
       
   846     
       
   847 // ---------------------------------------------------------------------------
       
   848 // CCmDmMain::GetTransferInfo
       
   849 // ---------------------------------------------------------------------------
       
   850 //    
       
   851 EXPORT_C TInt CCmDmMain::GetTransferInfo( TCmService aService, 
       
   852     TInt& aCount, TInt& aTime )
       
   853     {
       
   854     LOG( _L( "[DB MNGR]\t CCmDmMain::GetTransferInfo()")); 
       
   855     return iConnection->GetTransferInfo( aService, aCount, aTime );
       
   856     }
       
   857    
       
   858 // ---------------------------------------------------------------------------
       
   859 // CCmDmMain::GetStoreFileCount
       
   860 // ---------------------------------------------------------------------------
       
   861 //    
       
   862 EXPORT_C TInt CCmDmMain::GetStoreFileCount( 
       
   863     const TDesC8& aListName, 
       
   864     TUint aStatus, 
       
   865     TInt& aCount )
       
   866     {
       
   867     LOG( _L( "[DB MNGR]\t CCmDmMain::GetStoreFileCount()")); 
       
   868     return iConnection->GetStoreFileCount( aListName, aStatus, aCount );
       
   869     }
       
   870 
       
   871 // ---------------------------------------------------------------------------
       
   872 // CCmDmMain::GetFillFileCount
       
   873 // ---------------------------------------------------------------------------
       
   874 //
       
   875 EXPORT_C TInt CCmDmMain::GetFillFileCount( 
       
   876     const TDesC8& aListName, 
       
   877     TUint aStatus, 
       
   878     TInt& aCount )
       
   879     {
       
   880     LOG( _L( "[DB MNGR]\t CCmDmMain::GetFillFileCount()")); 
       
   881     return iConnection->GetFillFileCount( aListName, aStatus, aCount );
       
   882     }
       
   883 
       
   884 // ---------------------------------------------------------------------------
       
   885 // CCmDmMain::GetStoreFileCountNoDuplicatesL
       
   886 // ---------------------------------------------------------------------------
       
   887 //
       
   888 EXPORT_C void CCmDmMain::GetStoreFileCountNoDuplicatesL( TInt& aCount,
       
   889     TUint aStatus )
       
   890     {
       
   891     LOG( _L( "[DB MNGR]\t CCmDmMain::GetStoreFileCountNoDuplicatesL()")); 
       
   892     iConnection->GetStoreFileCountNoDuplicatesL( aCount, aStatus );
       
   893     }
       
   894     
       
   895 // ---------------------------------------------------------------------------
       
   896 // CCmDmMain::SetFillListRealCountAndSizeL
       
   897 // ---------------------------------------------------------------------------
       
   898 //
       
   899 EXPORT_C void CCmDmMain::SetFillListRealCountAndSizeL( TInt64 aListId, 
       
   900     TInt64 aRealCount, TInt64 aRealSize )
       
   901     {    
       
   902     TRACE( Print( _L("CCmDmMain::SetFillListRealCountAndSizeL \
       
   903                     aListId =%ld,aRealCount=%ld,aRealSize=%ld"),
       
   904                     aListId,aRealCount, aRealSize ) );
       
   905 
       
   906     TInt64 realCount = ( aRealCount > 0 ) ? aRealCount : 0;
       
   907     TInt64 realSize = ( aRealSize > 0 ) ? aRealSize : 0;
       
   908     iConnection->SetFillListRealCountAndSizeL( 
       
   909         aListId, realCount, realSize );
       
   910     }
       
   911 
       
   912 // ---------------------------------------------------------------------------
       
   913 // CCmDmMain::UpdateFillRuleGroupInfo
       
   914 // ---------------------------------------------------------------------------
       
   915 //
       
   916 EXPORT_C TInt CCmDmMain::UpdateFillRuleGroupInfo()
       
   917     {
       
   918     LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillRuleGroupInfo()")); 
       
   919     return iConnection->UpdateFillRuleGroupInfo();
       
   920     }   
       
   921 
       
   922 // ---------------------------------------------------------------------------
       
   923 // CCmDmMain::CCmDmMain
       
   924 // ---------------------------------------------------------------------------
       
   925 //    
       
   926 CCmDmMain::CCmDmMain()
       
   927     {
       
   928     LOG( _L( "[DB MNGR]\t CCmDmMain::CCmDmMain()")); 
       
   929     }
       
   930 
       
   931 // ---------------------------------------------------------------------------
       
   932 // CCmDmMain::ConstructL
       
   933 // ---------------------------------------------------------------------------
       
   934 //    
       
   935 void CCmDmMain::ConstructL()
       
   936     {
       
   937     LOG( _L( "[DB MNGR]\t CCmDmMain::ConstructL()")); 
       
   938     
       
   939     RFs fs;
       
   940     CleanupClosePushL( fs );
       
   941     TInt err = fs.Connect();    
       
   942     TRAP(err, BaflUtils::EnsurePathExistsL(fs, KCmDbDir));
       
   943     CleanupStack::PopAndDestroy( &fs );
       
   944     
       
   945     iConnection = CCmDmSQLiteConnection::NewL();
       
   946     iMaintenance = CCmDmSqlDbMaintenance::NewL(); 
       
   947     if( iMaintenance->InitConnection(*iConnection) )
       
   948         {
       
   949         iMaintenance->CreateDbFile( *iConnection );
       
   950         }
       
   951     if( !iConnection->Validate() )
       
   952         {
       
   953         iMaintenance->CreateDb( *iConnection );
       
   954         iMaintenance->CreateIndexes( *iConnection );
       
   955         iConnection->InitIDs();        
       
   956         }         
       
   957                 
       
   958     iConnection->LoadIDs(); 
       
   959     }    
       
   960 
       
   961 // End of file
       
   962