imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp
author hgs
Fri, 23 Jul 2010 10:35:38 +0300
changeset 33 221be23823c5
parent 31 d429f823a6b7
child 34 1c05ae5a7e41
permissions -rw-r--r--
201029
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 *
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include "thumbnailfetchedchecker.h"
31
hgs
parents: 29
diff changeset
    19
#include "thumbnaillog.h"
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
const int KMaxStoredEntries = 100;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
// CThumbnailFetchedChecker::CThumbnailFetchedChecker()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
CThumbnailFetchedChecker* CThumbnailFetchedChecker::NewL()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
    {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
    return new (ELeave) CThumbnailFetchedChecker();
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
// CThumbnailFetchedChecker::CThumbnailFetchedChecker()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
CThumbnailFetchedChecker::CThumbnailFetchedChecker()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
    {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
// CThumbnailFetchedChecker::~CThumbnailFetchedChecker()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
CThumbnailFetchedChecker::~CThumbnailFetchedChecker()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
    {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
    iNotFetched.ResetAndDestroy();
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// CThumbnailFetchedChecker::LastFetchResult()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
//
31
hgs
parents: 29
diff changeset
    53
TInt CThumbnailFetchedChecker::LastFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    {
31
hgs
parents: 29
diff changeset
    55
    TN_DEBUG3( "CThumbnailFetchedChecker::LastFetchResult(aUri=%S aThumbnailSize=%d)", &aUri, aThumbnailSize);
hgs
parents: 29
diff changeset
    56
hgs
parents: 29
diff changeset
    57
    CEntry* entry = NULL;
hgs
parents: 29
diff changeset
    58
    TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, KErrNone ) );
hgs
parents: 29
diff changeset
    59
    if ( !err && entry )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
        {
31
hgs
parents: 29
diff changeset
    61
        TInt ret = iNotFetched.FindInOrder( entry, CEntry::FindCB );
hgs
parents: 29
diff changeset
    62
        if ( ret != KErrNotFound )
hgs
parents: 29
diff changeset
    63
            {
hgs
parents: 29
diff changeset
    64
            TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> error found");
33
hgs
parents: 31
diff changeset
    65
            delete entry;
31
hgs
parents: 29
diff changeset
    66
            entry = NULL;
hgs
parents: 29
diff changeset
    67
            return iNotFetched[ ret ]->iError;
hgs
parents: 29
diff changeset
    68
            }
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
        }
31
hgs
parents: 29
diff changeset
    70
hgs
parents: 29
diff changeset
    71
    delete entry;        
hgs
parents: 29
diff changeset
    72
    entry = NULL;
hgs
parents: 29
diff changeset
    73
        
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    return KErrNone;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
// CThumbnailFetchedChecker::SetFetchResult()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
//
31
hgs
parents: 29
diff changeset
    81
void CThumbnailFetchedChecker::SetFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    {
31
hgs
parents: 29
diff changeset
    83
    TN_DEBUG4( "CThumbnailFetchedChecker::SetFetchResult(aUri=%S aThumbnailSize=%d aError=%d)", &aUri, aThumbnailSize, aError);
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
    if ( aError == KErrNone )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
        {
31
hgs
parents: 29
diff changeset
    86
        // Remove successful results from store
hgs
parents: 29
diff changeset
    87
        CEntry* entry = NULL;
hgs
parents: 29
diff changeset
    88
        TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) );
hgs
parents: 29
diff changeset
    89
        if ( !err && entry )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
            {
31
hgs
parents: 29
diff changeset
    91
            TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB );
hgs
parents: 29
diff changeset
    92
            if ( i >= 0 )
hgs
parents: 29
diff changeset
    93
                {
hgs
parents: 29
diff changeset
    94
                TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Remove successful results from store %d",  iNotFetched.Count() );
hgs
parents: 29
diff changeset
    95
                delete iNotFetched[ i ];
33
hgs
parents: 31
diff changeset
    96
                iNotFetched[ i ] = NULL;
31
hgs
parents: 29
diff changeset
    97
                iNotFetched.Remove( i );
hgs
parents: 29
diff changeset
    98
                }
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
            }
31
hgs
parents: 29
diff changeset
   100
        entry = NULL;
hgs
parents: 29
diff changeset
   101
        delete entry;
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
        }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    else
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
        {
31
hgs
parents: 29
diff changeset
   105
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
        // Add or update
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
        CEntry* entry = NULL;
31
hgs
parents: 29
diff changeset
   108
        TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) );
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
        if ( !err && entry )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
            {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
            err = iNotFetched.Find( entry );
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
            if ( err != KErrNotFound )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
                {
31
hgs
parents: 29
diff changeset
   114
                // update existing fetch result
hgs
parents: 29
diff changeset
   115
                TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB );
hgs
parents: 29
diff changeset
   116
                if ( i >= 0 )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
                    {
31
hgs
parents: 29
diff changeset
   118
                    TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> Update fetched tn error" );
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
                    iNotFetched[ i ]->iError = aError;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
                    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
                }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
            else 
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
                {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
                if( iNotFetched.Count() < KMaxStoredEntries )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
                    {
31
hgs
parents: 29
diff changeset
   126
                    // insert new fetch result
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
                    TInt err = iNotFetched.InsertInOrder( entry, CEntry::InsertCB );
29
4bdfb6b5c9b4 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   128
                    if ( err == KErrNone )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
                        {
31
hgs
parents: 29
diff changeset
   130
                        TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Inserted new fetched tn error %d", iNotFetched.Count());	
29
4bdfb6b5c9b4 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   131
                        entry = NULL; // owned by array now
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
                        }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
                    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
                }
29
4bdfb6b5c9b4 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   135
            
4bdfb6b5c9b4 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   136
            delete entry;
4bdfb6b5c9b4 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   137
            entry = NULL;
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
            }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
        }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
// -----------------------------------------------------------------------------
31
hgs
parents: 29
diff changeset
   143
// CThumbnailFetchedChecker::DeleteFetchResult()
hgs
parents: 29
diff changeset
   144
// -----------------------------------------------------------------------------
hgs
parents: 29
diff changeset
   145
//
hgs
parents: 29
diff changeset
   146
void CThumbnailFetchedChecker::DeleteFetchResult( const TDesC& aUri )
hgs
parents: 29
diff changeset
   147
    {
hgs
parents: 29
diff changeset
   148
    TN_DEBUG2( "CThumbnailFetchedChecker::DeleteFetchResult(%S)", &aUri);
hgs
parents: 29
diff changeset
   149
    // delete all entries of passed uri
hgs
parents: 29
diff changeset
   150
    TInt ret;
hgs
parents: 29
diff changeset
   151
    do
hgs
parents: 29
diff changeset
   152
        {
hgs
parents: 29
diff changeset
   153
        ret = iNotFetched.FindInOrder( aUri, CEntry::FindCBUri );
hgs
parents: 29
diff changeset
   154
        if ( ret >= 0 )
hgs
parents: 29
diff changeset
   155
            {
hgs
parents: 29
diff changeset
   156
            TN_DEBUG1( "CThumbnailFetchedChecker::DeleteFetchResult() -> Deteled URI from fetched list" );	
hgs
parents: 29
diff changeset
   157
            delete iNotFetched[ ret ];
33
hgs
parents: 31
diff changeset
   158
            iNotFetched[ ret ] = NULL;
31
hgs
parents: 29
diff changeset
   159
            iNotFetched.Remove( ret );
hgs
parents: 29
diff changeset
   160
            }
hgs
parents: 29
diff changeset
   161
        }
hgs
parents: 29
diff changeset
   162
    while(ret != KErrNotFound );
hgs
parents: 29
diff changeset
   163
    
hgs
parents: 29
diff changeset
   164
    }
hgs
parents: 29
diff changeset
   165
hgs
parents: 29
diff changeset
   166
// -----------------------------------------------------------------------------
hgs
parents: 29
diff changeset
   167
// CThumbnailFetchedChecker::LastFetchResult()
hgs
parents: 29
diff changeset
   168
// -----------------------------------------------------------------------------
hgs
parents: 29
diff changeset
   169
//
hgs
parents: 29
diff changeset
   170
void CThumbnailFetchedChecker::RenameFetchResultL( const TDesC& aNewUri, const TDesC& aOldUri )
hgs
parents: 29
diff changeset
   171
    {
hgs
parents: 29
diff changeset
   172
    TN_DEBUG3( "CThumbnailFetchedChecker::RenameFetchResult(aNewUri=%S aOldUri=%S)", &aNewUri, &aOldUri);
hgs
parents: 29
diff changeset
   173
    // change every occurence of passed uri
hgs
parents: 29
diff changeset
   174
    TInt ret;
hgs
parents: 29
diff changeset
   175
    do
hgs
parents: 29
diff changeset
   176
        {
hgs
parents: 29
diff changeset
   177
        ret = iNotFetched.FindInOrder( aOldUri, CEntry::FindCBUri );
hgs
parents: 29
diff changeset
   178
        if ( ret >= 0 )
hgs
parents: 29
diff changeset
   179
            {
hgs
parents: 29
diff changeset
   180
            delete iNotFetched[ ret ]->iUri;
hgs
parents: 29
diff changeset
   181
            iNotFetched[ ret ]->iUri = NULL;
hgs
parents: 29
diff changeset
   182
hgs
parents: 29
diff changeset
   183
            iNotFetched[ ret ]->iUri = aNewUri.AllocL();
hgs
parents: 29
diff changeset
   184
            TN_DEBUG1( "CThumbnailFetchedChecker::RenameeFetchResult() -> Renamed URI in fetched list" );	
hgs
parents: 29
diff changeset
   185
            }
hgs
parents: 29
diff changeset
   186
        }
hgs
parents: 29
diff changeset
   187
    while(ret != KErrNotFound );
hgs
parents: 29
diff changeset
   188
    
hgs
parents: 29
diff changeset
   189
    }
hgs
parents: 29
diff changeset
   190
hgs
parents: 29
diff changeset
   191
// -----------------------------------------------------------------------------
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
// CThumbnailFetchedChecker::Reset()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
void CThumbnailFetchedChecker::Reset()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
    {
31
hgs
parents: 29
diff changeset
   197
    TN_DEBUG1( "CThumbnailFetchedChecker::Reset()");
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
    iNotFetched.ResetAndDestroy();
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
// -----------------------------------------------------------------------------
31
hgs
parents: 29
diff changeset
   202
// CThumbnailFetchedChecker::CEntry::NewL()
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
CThumbnailFetchedChecker::CEntry* CThumbnailFetchedChecker::CEntry::NewL(
31
hgs
parents: 29
diff changeset
   206
        const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    {
31
hgs
parents: 29
diff changeset
   208
    TN_DEBUG4( "CThumbnailFetchedChecker::CEntry::NewL(aUri=%S aThumbnailSize=%d aError=%d)", &aUri, aThumbnailSize, aError);
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
    CEntry* self  = new (ELeave) CEntry();
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
    if ( self )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
        {
31
hgs
parents: 29
diff changeset
   212
        self->iUri = aUri.AllocL();
hgs
parents: 29
diff changeset
   213
        self->iSize = aThumbnailSize;
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
        self->iError = aError;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
        if ( !self->iUri )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
            {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
            delete self;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
            self = NULL;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
            }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
        }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    return self;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
// CThumbnailFetchedChecker::CEntry::FindCB()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
TInt CThumbnailFetchedChecker::CEntry::FindCB(
31
hgs
parents: 29
diff changeset
   229
        const CThumbnailFetchedChecker::CEntry& aEntry, const CThumbnailFetchedChecker::CEntry& aEntry1 )
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
    {
31
hgs
parents: 29
diff changeset
   231
    TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::FindCB");
hgs
parents: 29
diff changeset
   232
    if( aEntry1.iSize == aEntry.iSize)
hgs
parents: 29
diff changeset
   233
        {
hgs
parents: 29
diff changeset
   234
        // return index if size and uri matches
hgs
parents: 29
diff changeset
   235
        return aEntry.iUri->CompareF( *( aEntry1.iUri ) );
hgs
parents: 29
diff changeset
   236
        }
hgs
parents: 29
diff changeset
   237
    else 
hgs
parents: 29
diff changeset
   238
        {
hgs
parents: 29
diff changeset
   239
        return KErrNotFound;
hgs
parents: 29
diff changeset
   240
        }
hgs
parents: 29
diff changeset
   241
    }
hgs
parents: 29
diff changeset
   242
hgs
parents: 29
diff changeset
   243
// -----------------------------------------------------------------------------
hgs
parents: 29
diff changeset
   244
// CThumbnailFetchedChecker::CEntry::FindCBUri()
hgs
parents: 29
diff changeset
   245
// -----------------------------------------------------------------------------
hgs
parents: 29
diff changeset
   246
//
hgs
parents: 29
diff changeset
   247
TInt CThumbnailFetchedChecker::CEntry::FindCBUri(
hgs
parents: 29
diff changeset
   248
        const TDesC* aUri, const CThumbnailFetchedChecker::CEntry& aEntry )
hgs
parents: 29
diff changeset
   249
    {
hgs
parents: 29
diff changeset
   250
    TN_DEBUG2( "CThumbnailFetchedChecker::CEntry::FindCBUri(aUri=%S", &aUri);
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
    return aUri->CompareF( *( aEntry.iUri ) );
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
// CThumbnailFetchedChecker::CEntry::InsertCB()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
TInt CThumbnailFetchedChecker::CEntry::InsertCB(
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
        const CThumbnailFetchedChecker::CEntry& aEntry1,
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
        const CThumbnailFetchedChecker::CEntry& aEntry2 )
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
    {
31
hgs
parents: 29
diff changeset
   262
    TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::InsertCB");
hgs
parents: 29
diff changeset
   263
    if( aEntry1.iSize == aEntry2.iSize)
hgs
parents: 29
diff changeset
   264
        {
hgs
parents: 29
diff changeset
   265
        // return index if size and uri matches
hgs
parents: 29
diff changeset
   266
        return aEntry1.iUri->CompareF( *( aEntry2.iUri ) );
hgs
parents: 29
diff changeset
   267
        }
hgs
parents: 29
diff changeset
   268
    else 
hgs
parents: 29
diff changeset
   269
        {
hgs
parents: 29
diff changeset
   270
        return KErrNotFound;
hgs
parents: 29
diff changeset
   271
        }
17
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
// CThumbnailFetchedChecker::CEntry::CEntry()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
CThumbnailFetchedChecker::CEntry::CEntry()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
    {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
    }
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
// CThumbnailFetchedChecker::CEntry::~CEntry()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
// -----------------------------------------------------------------------------
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
//
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
CThumbnailFetchedChecker::CEntry::~CEntry()
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
    {
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
    delete iUri;
ffa62e555b02 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
    }