author | hgs |
Fri, 23 Jul 2010 10:35:38 +0300 | |
changeset 33 | 221be23823c5 |
parent 31 | d429f823a6b7 |
child 34 | 1c05ae5a7e41 |
permissions | -rw-r--r-- |
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 | 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 | 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 | 55 |
TN_DEBUG3( "CThumbnailFetchedChecker::LastFetchResult(aUri=%S aThumbnailSize=%d)", &aUri, aThumbnailSize); |
56 |
||
57 |
CEntry* entry = NULL; |
|
58 |
TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, KErrNone ) ); |
|
59 |
if ( !err && entry ) |
|
17
ffa62e555b02
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
{ |
31 | 61 |
TInt ret = iNotFetched.FindInOrder( entry, CEntry::FindCB ); |
62 |
if ( ret != KErrNotFound ) |
|
63 |
{ |
|
64 |
TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> error found"); |
|
33 | 65 |
delete entry; |
31 | 66 |
entry = NULL; |
67 |
return iNotFetched[ ret ]->iError; |
|
68 |
} |
|
17
ffa62e555b02
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
} |
31 | 70 |
|
71 |
delete entry; |
|
72 |
entry = NULL; |
|
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 | 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 | 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 | 86 |
// Remove successful results from store |
87 |
CEntry* entry = NULL; |
|
88 |
TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) ); |
|
89 |
if ( !err && entry ) |
|
17
ffa62e555b02
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
{ |
31 | 91 |
TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB ); |
92 |
if ( i >= 0 ) |
|
93 |
{ |
|
94 |
TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Remove successful results from store %d", iNotFetched.Count() ); |
|
95 |
delete iNotFetched[ i ]; |
|
33 | 96 |
iNotFetched[ i ] = NULL; |
31 | 97 |
iNotFetched.Remove( i ); |
98 |
} |
|
17
ffa62e555b02
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
} |
31 | 100 |
entry = NULL; |
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 | 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 | 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 | 114 |
// update existing fetch result |
115 |
TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB ); |
|
116 |
if ( i >= 0 ) |
|
17
ffa62e555b02
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
{ |
31 | 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 | 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 | 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 | 143 |
// CThumbnailFetchedChecker::DeleteFetchResult() |
144 |
// ----------------------------------------------------------------------------- |
|
145 |
// |
|
146 |
void CThumbnailFetchedChecker::DeleteFetchResult( const TDesC& aUri ) |
|
147 |
{ |
|
148 |
TN_DEBUG2( "CThumbnailFetchedChecker::DeleteFetchResult(%S)", &aUri); |
|
149 |
// delete all entries of passed uri |
|
150 |
TInt ret; |
|
151 |
do |
|
152 |
{ |
|
153 |
ret = iNotFetched.FindInOrder( aUri, CEntry::FindCBUri ); |
|
154 |
if ( ret >= 0 ) |
|
155 |
{ |
|
156 |
TN_DEBUG1( "CThumbnailFetchedChecker::DeleteFetchResult() -> Deteled URI from fetched list" ); |
|
157 |
delete iNotFetched[ ret ]; |
|
33 | 158 |
iNotFetched[ ret ] = NULL; |
31 | 159 |
iNotFetched.Remove( ret ); |
160 |
} |
|
161 |
} |
|
162 |
while(ret != KErrNotFound ); |
|
163 |
||
164 |
} |
|
165 |
||
166 |
// ----------------------------------------------------------------------------- |
|
167 |
// CThumbnailFetchedChecker::LastFetchResult() |
|
168 |
// ----------------------------------------------------------------------------- |
|
169 |
// |
|
170 |
void CThumbnailFetchedChecker::RenameFetchResultL( const TDesC& aNewUri, const TDesC& aOldUri ) |
|
171 |
{ |
|
172 |
TN_DEBUG3( "CThumbnailFetchedChecker::RenameFetchResult(aNewUri=%S aOldUri=%S)", &aNewUri, &aOldUri); |
|
173 |
// change every occurence of passed uri |
|
174 |
TInt ret; |
|
175 |
do |
|
176 |
{ |
|
177 |
ret = iNotFetched.FindInOrder( aOldUri, CEntry::FindCBUri ); |
|
178 |
if ( ret >= 0 ) |
|
179 |
{ |
|
180 |
delete iNotFetched[ ret ]->iUri; |
|
181 |
iNotFetched[ ret ]->iUri = NULL; |
|
182 |
||
183 |
iNotFetched[ ret ]->iUri = aNewUri.AllocL(); |
|
184 |
TN_DEBUG1( "CThumbnailFetchedChecker::RenameeFetchResult() -> Renamed URI in fetched list" ); |
|
185 |
} |
|
186 |
} |
|
187 |
while(ret != KErrNotFound ); |
|
188 |
||
189 |
} |
|
190 |
||
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 | 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 | 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 | 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 | 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 | 212 |
self->iUri = aUri.AllocL(); |
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 | 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 | 231 |
TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::FindCB"); |
232 |
if( aEntry1.iSize == aEntry.iSize) |
|
233 |
{ |
|
234 |
// return index if size and uri matches |
|
235 |
return aEntry.iUri->CompareF( *( aEntry1.iUri ) ); |
|
236 |
} |
|
237 |
else |
|
238 |
{ |
|
239 |
return KErrNotFound; |
|
240 |
} |
|
241 |
} |
|
242 |
||
243 |
// ----------------------------------------------------------------------------- |
|
244 |
// CThumbnailFetchedChecker::CEntry::FindCBUri() |
|
245 |
// ----------------------------------------------------------------------------- |
|
246 |
// |
|
247 |
TInt CThumbnailFetchedChecker::CEntry::FindCBUri( |
|
248 |
const TDesC* aUri, const CThumbnailFetchedChecker::CEntry& aEntry ) |
|
249 |
{ |
|
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 | 262 |
TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::InsertCB"); |
263 |
if( aEntry1.iSize == aEntry2.iSize) |
|
264 |
{ |
|
265 |
// return index if size and uri matches |
|
266 |
return aEntry1.iUri->CompareF( *( aEntry2.iUri ) ); |
|
267 |
} |
|
268 |
else |
|
269 |
{ |
|
270 |
return KErrNotFound; |
|
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 |
} |