mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp
equal
deleted
inserted
replaced
183 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
183 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
184 iAutoPlaylist = CMPXDbAutoPlaylist::NewL(*iDbManager, iFs, iResource); |
184 iAutoPlaylist = CMPXDbAutoPlaylist::NewL(*iDbManager, iFs, iResource); |
185 iDbAuxiliary = CMPXDbAuxiliary::NewL(*iDbManager); |
185 iDbAuxiliary = CMPXDbAuxiliary::NewL(*iDbManager); |
186 |
186 |
187 MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives)); |
187 MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives)); |
188 iCollectionOpen = ETrue; |
|
189 |
188 |
190 // If KErrCorrupt is returned, a database file was found to be corrupted |
189 // If KErrCorrupt is returned, a database file was found to be corrupted |
191 // and was replaced with a new one. The db plugin can ignore this error and continue |
190 // and was replaced with a new one. The db plugin can ignore this error and continue |
192 // because a new db file was successfully created in a subsequent retry. |
191 // because a new db file was successfully created in a subsequent retry. |
193 if ((err != KErrNone) && (err != KErrCorrupt) && (err != KErrDiskFull)) |
192 if ((err != KErrNone) && (err != KErrCorrupt) && (err != KErrDiskFull)) |
1485 iOutOfDisk = EFalse; |
1484 iOutOfDisk = EFalse; |
1486 // Re-open databases |
1485 // Re-open databases |
1487 // This is needed for the case where we were OOD before, but user |
1486 // This is needed for the case where we were OOD before, but user |
1488 // has cleared some space but now try to refresh |
1487 // has cleared some space but now try to refresh |
1489 MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives)); |
1488 MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives)); |
1490 iCollectionOpen = ETrue; |
|
1491 // Update (synchronize) music basic table if it's not |
|
1492 // in sync with music table |
|
1493 if(iSynchronizeBasicTable) |
|
1494 { |
|
1495 iDbMusic->RefreshEndL(); |
|
1496 } |
|
1497 iSynchronizeBasicTable = ETrue; |
|
1498 |
1489 |
1499 if(err == KErrDiskFull) |
1490 if(err == KErrDiskFull) |
1500 { |
1491 { |
1501 iOutOfDisk = ETrue; |
1492 iOutOfDisk = ETrue; |
1502 } |
1493 } |
1510 iOutOfDisk = ETrue; |
1501 iOutOfDisk = ETrue; |
1511 } |
1502 } |
1512 } |
1503 } |
1513 |
1504 |
1514 #ifdef __RAMDISK_PERF_ENABLE |
1505 #ifdef __RAMDISK_PERF_ENABLE |
1515 iDbManager->CopyDBsToRamL(); |
1506 iDbManager->CopyDBsToRamL(); |
1516 #endif //__RAMDISK_PERF_ENABLE |
1507 #endif //__RAMDISK_PERF_ENABLE |
1517 iDbMusic->RefreshStartL(); |
|
1518 |
1508 |
1519 BeginTransactionL(); |
1509 BeginTransactionL(); |
1520 iRefresh = ETrue; |
1510 iRefresh = ETrue; |
1521 } |
1511 } |
1522 |
1512 |
1535 // This also sets corrupt = 0 |
1525 // This also sets corrupt = 0 |
1536 TTime curTime; |
1526 TTime curTime; |
1537 curTime.HomeTime(); |
1527 curTime.HomeTime(); |
1538 SetLastRefreshedTimeL(curTime); |
1528 SetLastRefreshedTimeL(curTime); |
1539 } |
1529 } |
1540 iDbMusic->RefreshEndL(); |
|
1541 //Update of music basic table fails when the collection is not open |
|
1542 //Next time the collection is opened the music basic table must be updated |
|
1543 if (iCollectionOpen ) |
|
1544 { |
|
1545 iSynchronizeBasicTable = EFalse; |
|
1546 } |
|
1547 |
|
1548 #ifdef __RAMDISK_PERF_ENABLE |
1530 #ifdef __RAMDISK_PERF_ENABLE |
1549 iDbManager->CopyDBsFromRamL(); |
1531 iDbManager->CopyDBsFromRamL(); |
1550 #endif //__RAMDISK_PERF_ENABLE |
1532 #endif //__RAMDISK_PERF_ENABLE |
1551 } |
1533 } |
1552 |
1534 |
1769 // This also sets corrupt = 0 |
1751 // This also sets corrupt = 0 |
1770 TTime curTime; |
1752 TTime curTime; |
1771 curTime.HomeTime(); |
1753 curTime.HomeTime(); |
1772 SetLastRefreshedTimeL(curTime); |
1754 SetLastRefreshedTimeL(curTime); |
1773 } |
1755 } |
1774 } |
|
1775 } |
|
1776 |
|
1777 // ---------------------------------------------------------------------------- |
|
1778 // Notifies the handler that the collection was closed. |
|
1779 // ---------------------------------------------------------------------------- |
|
1780 // |
|
1781 void CMPXDbHandler::CollectionClosed() |
|
1782 { |
|
1783 MPX_FUNC("CMPXDbHandler::CollectionClosed"); |
|
1784 |
|
1785 iCollectionOpen = EFalse; |
|
1786 } |
|
1787 |
|
1788 // ---------------------------------------------------------------------------- |
|
1789 //Notifies the handler that the collection was opened. |
|
1790 // ---------------------------------------------------------------------------- |
|
1791 // |
|
1792 void CMPXDbHandler::CollectionOpenedL() |
|
1793 { |
|
1794 MPX_FUNC("CMPXDbHandler::CollectionOpened"); |
|
1795 |
|
1796 iCollectionOpen = ETrue; |
|
1797 // Update (synchronize) music basic table if it's not |
|
1798 // in sync with music table |
|
1799 if(iSynchronizeBasicTable) |
|
1800 { |
|
1801 iDbMusic->RefreshEndL(); |
|
1802 iSynchronizeBasicTable = EFalse; |
|
1803 } |
1756 } |
1804 } |
1757 } |
1805 |
1758 |
1806 // ---------------------------------------------------------------------------- |
1759 // ---------------------------------------------------------------------------- |
1807 // Add song to collection |
1760 // Add song to collection |